sanity 5.2.0-next.37 → 5.2.0-next.39
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/lib/_chunks-es/TooltipDelayGroupProvider.js +13 -12
- package/lib/_chunks-es/TooltipDelayGroupProvider.js.map +1 -1
- package/lib/_chunks-es/package.js +1 -1
- package/lib/_chunks-es/version.js +1 -1
- package/lib/_internal/cli/threads/extractManifest.cjs +1 -6
- package/lib/_internal/cli/threads/extractManifest.cjs.map +1 -1
- package/lib/_singletons.d.ts +35 -24
- package/lib/_singletons.js +2 -2
- package/lib/_singletons.js.map +1 -1
- package/lib/desk.d.ts +0 -20
- package/lib/index.d.ts +51 -14
- package/lib/index.js +1036 -1045
- package/lib/index.js.map +1 -1
- package/lib/presentation.d.ts +0 -10
- package/lib/structure.d.ts +0 -10
- package/package.json +14 -14
|
@@ -39,30 +39,31 @@ const LARGE_BUTTON_PROPS = {
|
|
|
39
39
|
}
|
|
40
40
|
return children;
|
|
41
41
|
}), Dialog = forwardRef(function(t0, ref) {
|
|
42
|
-
const $ = c(
|
|
43
|
-
let bodyHeight, children, footer, props, t1, zOffset;
|
|
42
|
+
const $ = c(23);
|
|
43
|
+
let bodyHeight, children, footer, props, t1, t2, zOffset;
|
|
44
44
|
$[0] !== t0 ? ({
|
|
45
|
+
animate: t1,
|
|
45
46
|
bodyHeight,
|
|
46
47
|
children,
|
|
47
48
|
footer,
|
|
48
|
-
padding:
|
|
49
|
+
padding: t2,
|
|
49
50
|
zOffset,
|
|
50
51
|
...props
|
|
51
|
-
} = t0, $[0] = t0, $[1] = bodyHeight, $[2] = children, $[3] = footer, $[4] = props, $[5] = t1, $[6] = zOffset) : (bodyHeight = $[1], children = $[2], footer = $[3], props = $[4], t1 = $[5],
|
|
52
|
-
const
|
|
52
|
+
} = t0, $[0] = t0, $[1] = bodyHeight, $[2] = children, $[3] = footer, $[4] = props, $[5] = t1, $[6] = t2, $[7] = zOffset) : (bodyHeight = $[1], children = $[2], footer = $[3], props = $[4], t1 = $[5], t2 = $[6], zOffset = $[7]);
|
|
53
|
+
const animate = t1 === void 0 ? !0 : t1, padding = t2 === void 0 ? !0 : t2, {
|
|
53
54
|
t
|
|
54
55
|
} = useTranslation();
|
|
55
|
-
let
|
|
56
|
-
$[
|
|
56
|
+
let t3;
|
|
57
|
+
$[8] !== footer || $[9] !== props || $[10] !== t ? (t3 = (footer?.confirmButton || footer?.cancelButton) && /* @__PURE__ */ jsxs(Flex, { width: "full", gap: 3, justify: "flex-end", padding: 3, align: "center", children: [
|
|
57
58
|
footer?.description && /* @__PURE__ */ jsx(Box, { flex: 1, paddingLeft: 1, children: /* @__PURE__ */ jsx(Text, { size: 1, muted: !0, children: footer.description }) }),
|
|
58
59
|
props.onClose && /* @__PURE__ */ jsx(Button$1, { mode: "bleed", padding: 2, text: t("common.dialog.cancel-button.text"), tone: "default", onClick: props.onClose, "data-testid": "cancel-button", ...footer.cancelButton }),
|
|
59
60
|
footer.confirmButton && /* @__PURE__ */ jsx(Button$1, { mode: "default", padding: 2, text: t("common.dialog.confirm-button.text"), tone: "critical", "data-testid": "confirm-button", ...footer.confirmButton })
|
|
60
|
-
] }), $[
|
|
61
|
-
const
|
|
62
|
-
let t4;
|
|
63
|
-
$[11] !== bodyHeight || $[12] !== children || $[13] !== t3 ? (t4 = /* @__PURE__ */ jsx(Box, { height: bodyHeight, padding: t3, children }), $[11] = bodyHeight, $[12] = children, $[13] = t3, $[14] = t4) : t4 = $[14];
|
|
61
|
+
] }), $[8] = footer, $[9] = props, $[10] = t, $[11] = t3) : t3 = $[11];
|
|
62
|
+
const t4 = padding ? 4 : 0;
|
|
64
63
|
let t5;
|
|
65
|
-
|
|
64
|
+
$[12] !== bodyHeight || $[13] !== children || $[14] !== t4 ? (t5 = /* @__PURE__ */ jsx(Box, { height: bodyHeight, padding: t4, children }), $[12] = bodyHeight, $[13] = children, $[14] = t4, $[15] = t5) : t5 = $[15];
|
|
65
|
+
let t6;
|
|
66
|
+
return $[16] !== animate || $[17] !== props || $[18] !== ref || $[19] !== t3 || $[20] !== t5 || $[21] !== zOffset ? (t6 = /* @__PURE__ */ jsx(Dialog$1, { ...props, animate, zOffset, ref, footer: t3, children: t5 }), $[16] = animate, $[17] = props, $[18] = ref, $[19] = t3, $[20] = t5, $[21] = zOffset, $[22] = t6) : t6 = $[22], t6;
|
|
66
67
|
});
|
|
67
68
|
function ErrorBoundary(t0) {
|
|
68
69
|
const $ = c(9);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TooltipDelayGroupProvider.js","sources":["../../src/ui-components/button/Button.tsx","../../src/ui-components/dialog/Dialog.tsx","../../src/ui-components/errorBoundary/ErrorBoundary.tsx","../../src/ui-components/menuButton/MenuButton.tsx","../../src/core/components/Hotkeys.tsx","../../src/ui-components/tooltip/constants.ts","../../src/ui-components/tooltip/Tooltip.tsx","../../src/ui-components/menuItem/MenuItem.tsx","../../src/ui-components/popover/Popover.tsx","../../src/ui-components/tab/Tab.tsx","../../src/ui-components/tooltipDelayGroupProvider/TooltipDelayGroupProvider.tsx"],"sourcesContent":["/* eslint-disable no-restricted-imports */\n\nimport {Button as UIButton, type ButtonProps as UIButtonProps} from '@sanity/ui'\nimport {type ForwardedRef, forwardRef, type HTMLProps} from 'react'\nimport {styled} from 'styled-components'\n\nimport {Tooltip, type TooltipProps} from '..'\n\ntype BaseButtonProps = Pick<\n UIButtonProps,\n | 'as'\n | 'icon'\n | 'iconRight'\n | 'justify'\n | 'loading'\n | 'mode'\n | 'paddingY'\n | 'paddingLeft'\n | 'selected'\n | 'tone'\n | 'type'\n | 'width'\n> & {\n size?: 'default' | 'large'\n radius?: 'full'\n}\n\ntype ButtonWithText = {\n text: string\n tooltipProps?: TooltipProps | null\n icon?: UIButtonProps['icon']\n}\n\ntype IconButton = {\n text?: undefined\n icon?: UIButtonProps['icon']\n /**\n * When using a button with an icon, tooltipProps are required to enforce consistency in UI.\n */\n tooltipProps: TooltipProps | null\n}\n\n/** @internal */\nexport type ButtonProps = BaseButtonProps & (ButtonWithText | IconButton)\n\nconst LARGE_BUTTON_PROPS = {\n space: 3,\n padding: 3,\n}\nconst DEFAULT_BUTTON_PROPS = {\n space: 2,\n padding: 2,\n}\n\nconst TooltipButtonWrapper = styled.span`\n display: inline-flex;\n`\n/**\n * Customized Sanity UI <Button> with pre-defined layout options.\n *\n * @internal\n */\nexport const Button = forwardRef(function Button(\n {\n size = 'default',\n mode = 'default',\n paddingY,\n paddingLeft,\n tone = 'default',\n tooltipProps,\n ...rest\n }: ButtonProps & Omit<HTMLProps<HTMLButtonElement>, 'as' | 'size' | 'title'>,\n ref: ForwardedRef<HTMLButtonElement>,\n) {\n const sizeProps = size === 'default' ? DEFAULT_BUTTON_PROPS : LARGE_BUTTON_PROPS\n\n const children = (\n <UIButton\n {...rest}\n {...sizeProps}\n paddingY={paddingY}\n paddingLeft={paddingLeft}\n ref={ref}\n mode={mode}\n tone={tone}\n />\n )\n\n if (tooltipProps) {\n return (\n <Tooltip content={tooltipProps?.content} portal {...tooltipProps}>\n {/* This span is needed to make the tooltip work in disabled buttons */}\n <TooltipButtonWrapper>{children}</TooltipButtonWrapper>\n </Tooltip>\n )\n }\n\n return children\n})\n","/* eslint-disable no-restricted-imports */\nimport {\n Box,\n type BoxHeight,\n Button as UIButton,\n Dialog as UIDialog,\n type DialogProps as UIDialogProps,\n Flex,\n Text,\n} from '@sanity/ui'\nimport {type ComponentProps, forwardRef, type HTMLProps, type ReactNode, type Ref} from 'react'\nimport {useTranslation} from 'react-i18next'\n\n/** @internal */\nexport type DialogProps = Pick<\n UIDialogProps,\n | '__unstable_autoFocus'\n | '__unstable_hideCloseButton'\n | 'contentRef'\n | 'header'\n | 'id'\n | 'onActivate'\n | 'onClickOutside'\n | 'onClose'\n | 'portal'\n | 'position'\n | 'scheme'\n | 'width'\n> & {\n /**\n * Dialog body height.\n * Set this to 'fill' (i.e. 100%) if you want overflow body content to be contained\n * and not trigger dynamic border visibility.\n */\n bodyHeight?: BoxHeight\n children?: ReactNode\n zOffset?: number\n footer?: {\n cancelButton?: Omit<ComponentProps<typeof UIButton>, 'fontSize' | 'padding'>\n confirmButton?: Omit<ComponentProps<typeof UIButton>, 'fontSize' | 'padding'>\n /**\n * Description to be displayed side by side with the buttons.\n */\n description?: string\n }\n /**\n * If enabled, removes all default padding from dialog content.\n */\n padding?: boolean\n}\n\n/**\n * Customized Sanity UI <Dialog> that enforces an opinionated footer layout with a max of two buttons (confirm and cancel).\n *\n * @internal\n */\nexport const Dialog = forwardRef(function Dialog(\n {\n bodyHeight,\n children,\n footer,\n padding = true,\n zOffset,\n ...props\n }: DialogProps & Pick<HTMLProps<HTMLDivElement>, 'onDragEnter' | 'onDrop'>,\n ref: Ref<HTMLDivElement>,\n) {\n const {t} = useTranslation()\n\n return (\n <UIDialog\n {...props}\n animate\n zOffset={zOffset}\n ref={ref}\n footer={\n (footer?.confirmButton || footer?.cancelButton) && (\n <Flex width=\"full\" gap={3} justify=\"flex-end\" padding={3} align=\"center\">\n {footer?.description && (\n <Box flex={1} paddingLeft={1}>\n <Text size={1} muted>\n {footer.description}\n </Text>\n </Box>\n )}\n {props.onClose && (\n <UIButton\n mode=\"bleed\"\n padding={2}\n text={t('common.dialog.cancel-button.text')}\n tone=\"default\"\n onClick={props.onClose}\n data-testid=\"cancel-button\"\n {...footer.cancelButton}\n />\n )}\n {footer.confirmButton && (\n <UIButton\n mode=\"default\"\n padding={2}\n text={t('common.dialog.confirm-button.text')}\n tone=\"critical\"\n data-testid=\"confirm-button\"\n {...footer.confirmButton}\n />\n )}\n </Flex>\n )\n }\n >\n <Box height={bodyHeight} padding={padding ? 4 : 0}>\n {children}\n </Box>\n </UIDialog>\n )\n})\n","import {\n // eslint-disable-next-line no-restricted-imports\n ErrorBoundary as UIErrorBoundary,\n type ErrorBoundaryProps as UIErrorBoundaryProps,\n} from '@sanity/ui'\nimport {useCallback, useContext} from 'react'\n\nimport {SourceContext} from '../../_singletons'\n\nexport type ErrorBoundaryProps = UIErrorBoundaryProps\n\n/**\n * ErrorBoundary component that catches errors and uses onUncaughtError config property\n * It also calls the onCatch prop if it exists.\n */\nexport function ErrorBoundary({onCatch, ...rest}: ErrorBoundaryProps): React.JSX.Element {\n // Use context, because source could be undefined and we don't want to throw in that case\n const source = useContext(SourceContext)\n\n const handleCatch = useCallback(\n ({error: caughtError, info: caughtInfo}: {error: Error; info: React.ErrorInfo}) => {\n // Send the error to the source if it has an onUncaughtError method\n\n // Workaround for React Compiler not yet fully supporting try/catch/finally syntax\n const run = () => {\n source?.onUncaughtError?.(caughtError, caughtInfo)\n }\n try {\n run()\n } catch (e) {\n e.message = `Encountered an additional error when calling custom \"onUncaughtError()\": ${e.message}`\n console.error(e)\n }\n\n // Call the onCatch prop if it exists\n onCatch?.({error: caughtError, info: caughtInfo})\n },\n [source, onCatch],\n )\n\n return <UIErrorBoundary {...rest} onCatch={handleCatch} />\n}\n","/* eslint-disable no-restricted-imports */\nimport {\n MenuButton as UIMenuButton,\n type MenuButtonProps as UIMenuButtonProps,\n type PopoverProps,\n} from '@sanity/ui'\nimport {type ForwardedRef, forwardRef} from 'react'\n\n/** @internal */\nexport type MenuButtonProps = Omit<UIMenuButtonProps, 'popover'> & {\n popover?: Omit<PopoverProps, 'animate' | 'content' | 'open'>\n}\n\n/**\n * Customized Sanity UI <MenuButton> that enforces popover animation.\n *\n * @internal\n */\nexport const MenuButton = forwardRef(function MenuButton(\n props: MenuButtonProps,\n ref: ForwardedRef<HTMLButtonElement>,\n) {\n return (\n <UIMenuButton\n {...props}\n ref={ref}\n popover={{\n ...props.popover,\n animate: true,\n }}\n />\n )\n})\n","import {Hotkeys as UIHotkeys, type HotkeysProps as UIHotkeysProps} from '@sanity/ui'\nimport {type HTMLProps, type RefAttributes} from 'react'\n\n/**\n * Properties for the `Hotkeys` component.\n *\n * @public\n */\nexport type HotkeysProps = UIHotkeysProps & {\n /**\n * Whether to make the keys platform-aware (eg `alt` to `option` on Apple devices).\n *\n * @defaultValue true\n */\n makePlatformAware?: boolean\n} & Omit<HTMLProps<HTMLElement>, 'ref' | 'size' | 'as'> &\n RefAttributes<HTMLElement>\n\n/**\n * Renders given `keys` as \"keycaps\" visually.\n *\n * This is a wrapper around `@sanity/ui`'s `Hotkeys` component, which allows for altering keys\n * (eg `alt` to `option`) on Apple devices unless `makePlatformAware` is set to `false`.\n *\n * @param props - Properties to render with\n * @returns React element\n * @public\n */\nexport function Hotkeys({makePlatformAware = true, keys: hotKeys = [], ...props}: HotkeysProps) {\n const keys = makePlatformAware ? hotKeys.map(platformifyKey) : hotKeys\n return <UIHotkeys {...props} keys={keys} />\n}\n\n/**\n * @internal\n */\nconst IS_APPLE_DEVICE =\n typeof navigator === 'undefined' || typeof navigator.platform !== 'string'\n ? false\n : /Mac|iPod|iPhone|iPad/.test(navigator.platform || '')\n\n/**\n * Given key 'Alt', or 'Option' (case-insensitive), return the platform-appropriate key name\n * (eg 'Alt' on non-Apple devices, 'Option' on Apple devices).\n *\n * @param key - Key to platformify\n * @returns Platform-appropriate key name\n * @internal\n */\nfunction platformifyKey(key: string): string {\n const lowerKey = key.toLowerCase()\n\n if (lowerKey === 'alt' && IS_APPLE_DEVICE) {\n return matchCase(key, 'option')\n }\n\n if (lowerKey === 'option' && !IS_APPLE_DEVICE) {\n return matchCase(key, 'alt')\n }\n\n return key\n}\n\n/**\n * Apply the case (lowercase/uppercase) of `original` to `target`, character by character,\n * eg matching ALL CAPS, all lowercase or Mixed Case.\n *\n * @param original - The original string to match case of\n * @param target - The target string to apply case to\n * @returns Target string with case applied from original\n * @internal\n */\nfunction matchCase(original: string, target: string): string {\n const orgLength = original.length\n\n return target.replace(/./g, (char, i) => {\n // Replace character by character matching case of original\n // If running out of original, just return the target case as-is\n return i < orgLength && original[i] === original[i].toUpperCase() ? char.toUpperCase() : char\n })\n}\n","export const TOOLTIP_DELAY_PROPS = {\n open: 400,\n}\n","import {\n Box,\n Flex,\n type HotkeysProps,\n Text,\n // eslint-disable-next-line no-restricted-imports\n Tooltip as UITooltip,\n // eslint-disable-next-line no-restricted-imports\n type TooltipProps as UITooltipProps,\n} from '@sanity/ui'\nimport {type ForwardedRef, forwardRef} from 'react'\n\nimport {Hotkeys} from '../../core/components/Hotkeys'\nimport {TOOLTIP_DELAY_PROPS} from './constants'\n\n/** @internal */\n\nexport type TooltipProps = Omit<UITooltipProps, 'arrow' | 'padding' | 'shadow'> & {\n hotkeys?: HotkeysProps['keys']\n}\n\nconst TOOLTIP_SHARED_PROPS: UITooltipProps = {\n animate: true,\n arrow: false,\n boundaryElement: null,\n delay: TOOLTIP_DELAY_PROPS,\n fallbackPlacements: ['bottom-start', 'bottom-end', 'top-start', 'top-end'],\n placement: 'bottom',\n portal: true,\n}\n\n/**\n * Customized Sanity UI <Tooltip> with limited layout options and support for showing hotkeys.\n *\n * In just about all cases, its strongly recommended that you pass a string to the `content` prop.\n * This helps simplify i18n and encourages short and concise.\n *\n * Passing ReactNode values to `content` is supported, but discouraged.\n *\n * @internal\n */\nexport const Tooltip = forwardRef(function Tooltip(\n props: TooltipProps,\n ref: ForwardedRef<HTMLDivElement>,\n) {\n const {content, hotkeys, ...rest} = props\n\n if (typeof content === 'string') {\n return (\n <UITooltip\n {...TOOLTIP_SHARED_PROPS}\n content={\n <Flex align=\"center\">\n {content && (\n <Box flex={1} padding={1}>\n <Text size={1}>{content}</Text>\n </Box>\n )}\n {hotkeys && (\n <Box flex=\"none\">\n <Hotkeys keys={hotkeys} />\n </Box>\n )}\n </Flex>\n }\n padding={1}\n ref={ref}\n {...rest}\n />\n )\n }\n\n return <UITooltip {...TOOLTIP_SHARED_PROPS} content={content} ref={ref} {...rest} />\n})\n","/* eslint-disable no-restricted-imports */\nimport {\n Badge,\n Box,\n Flex,\n MenuItem as UIMenuItem,\n type MenuItemProps as UIMenuItemProps,\n Stack,\n Text,\n} from '@sanity/ui'\nimport {forwardRef, type HTMLProps, isValidElement, type ReactNode, type Ref, useMemo} from 'react'\nimport {isValidElementType} from 'react-is'\nimport {styled} from 'styled-components'\n\nimport {Hotkeys} from '../../core/components/Hotkeys'\nimport {Tooltip, type TooltipProps} from '..'\n\nconst FONT_SIZE = 1\nconst SUBTITLE_FONT_SIZE = 0\n\n/* Using px value here to make title/subtitles align with icon */\nconst SubtitleText = styled(Text)`\n margin-top: 2px;\n`\n\n/** @internal */\nexport type MenuItemProps = Pick<\n UIMenuItemProps,\n 'as' | 'icon' | 'iconRight' | 'pressed' | 'selected' | 'tone' | 'hotkeys'\n> & {\n badgeText?: string\n /**\n * Usage of `children` is not supported, import `MenuItem` from `@sanity/ui` instead.\n */\n children?: undefined\n /**\n * Previews should be 25x25.\n */\n preview?: ReactNode\n /**\n * Optional render callback which receives menu item content.\n */\n renderMenuItem?: (menuItemContent: React.JSX.Element) => ReactNode\n text?: string\n tooltipProps?: TooltipProps | null\n /**\n * Optional subtitle prop for the menu item.\n * While not recommended, it is utilized for the workspace menu button.\n */\n __unstable_subtitle?: string\n /**\n * An optional property to adjust spacing in the preview between the icon and the text.\n * Not recommended, but is applied to the workspace menu button..\n */\n __unstable_space?: number\n}\n\nconst PreviewWrapper = styled(Box)`\n height: 25px;\n width: 25px;\n overflow: hidden;\n`\n\n/**\n * Customized Sanity UI <MenuItem> that restricts usage of `children` to encourage simple,\n * single line menu items.\n *\n * The workspace menu button needed a subtitle - hence, the StudioUI MenuIten now takes a subtitle prop.\n * This is only an escape hatch for the workspace menu button and is not recommended for general use.\n *\n * It also accepts a prop to attach tooltips as well as custom badges too.\n *\n * @internal\n */\nexport const MenuItem = forwardRef(function MenuItem(\n {\n badgeText,\n children: childrenProp,\n disabled,\n hotkeys,\n icon: Icon,\n iconRight: IconRight,\n preview = null,\n renderMenuItem,\n text,\n tooltipProps,\n __unstable_subtitle,\n __unstable_space,\n ...rest\n }: MenuItemProps &\n Omit<HTMLProps<HTMLDivElement>, 'as' | 'height' | 'ref' | 'selected' | 'tabIndex' | 'size'>,\n ref: Ref<HTMLDivElement>,\n) {\n const menuItemContent = useMemo(() => {\n return (\n <Flex align=\"center\" gap={2}>\n {preview && (\n <PreviewWrapper\n style={{opacity: disabled ? 0.25 : undefined}}\n paddingRight={__unstable_space ? 1 : 0}\n >\n <Flex align=\"center\" height=\"fill\" justify=\"center\">\n {preview}\n </Flex>\n </PreviewWrapper>\n )}\n {Icon && (\n <Box paddingRight={1}>\n <Text size={FONT_SIZE}>\n {isValidElement(Icon) && Icon}\n {isValidElementType(Icon) && <Icon />}\n </Text>\n </Box>\n )}\n {text && (\n <Stack flex={1} space={__unstable_subtitle ? 1 : 2}>\n <Text size={FONT_SIZE} textOverflow=\"ellipsis\" weight=\"medium\">\n {text}\n </Text>\n {__unstable_subtitle && (\n <SubtitleText size={SUBTITLE_FONT_SIZE} textOverflow=\"ellipsis\" weight=\"medium\" muted>\n {__unstable_subtitle}\n </SubtitleText>\n )}\n </Stack>\n )}\n {(badgeText || hotkeys || IconRight) && (\n <Flex align=\"center\" gap={3} marginLeft={3}>\n {hotkeys && <Hotkeys keys={hotkeys} style={{marginTop: -4, marginBottom: -4}} />}\n\n {badgeText && (\n <Badge fontSize={0} style={{marginTop: -4, marginBottom: -4}}>\n {badgeText}\n </Badge>\n )}\n\n {IconRight && (\n <Text size={FONT_SIZE}>\n {isValidElement(IconRight) && IconRight}\n {isValidElementType(IconRight) && <IconRight />}\n </Text>\n )}\n </Flex>\n )}\n </Flex>\n )\n }, [\n preview,\n disabled,\n __unstable_space,\n Icon,\n text,\n __unstable_subtitle,\n badgeText,\n hotkeys,\n IconRight,\n ])\n\n const children = (\n <UIMenuItem\n disabled={disabled}\n paddingLeft={preview ? 1 : 3}\n paddingRight={3}\n paddingY={preview ? 1 : 3}\n ref={ref}\n {...rest}\n >\n {typeof childrenProp === 'undefined' && typeof renderMenuItem === 'function'\n ? renderMenuItem(menuItemContent)\n : menuItemContent}\n </UIMenuItem>\n )\n\n if (tooltipProps) {\n return (\n <Tooltip content={tooltipProps?.content} portal {...tooltipProps}>\n {/* This div is needed to make the tooltip work in disabled menu items */}\n <div>{children}</div>\n </Tooltip>\n )\n }\n\n return children\n})\n","/* eslint-disable no-restricted-imports */\nimport {Popover as UIPopover, type PopoverProps as UIPopoverProps} from '@sanity/ui'\nimport {type ForwardedRef, forwardRef, type HTMLProps} from 'react'\n\n/** @internal */\nexport type PopoverProps = UIPopoverProps\n\n/**\n * Customized Sanity UI <Popover> that defaults to `animate=true`\n *\n * All Popovers in the studio should be animated by default\n * Can be overridden when nesting popovers to prevent AnimatePresence conflicts\n *\n * @internal\n */\nexport const Popover = forwardRef(function Popover(\n props: PopoverProps & Omit<HTMLProps<HTMLDivElement>, 'as' | 'children' | 'content' | 'width'>,\n ref: ForwardedRef<HTMLDivElement>,\n) {\n const {animate = true, ...restProps} = props\n return <UIPopover {...restProps} animate={animate} ref={ref} />\n})\n","/* eslint-disable no-restricted-imports */\nimport {Tab as UITab, type TabProps as UITabProps} from '@sanity/ui'\nimport {type ForwardedRef, forwardRef, type HTMLProps} from 'react'\n\n/**\n * @internal\n *\n * Padding and font sizes are fixed in Studio UI <Tab> components.\n */\nexport type TabProps = Pick<\n UITabProps,\n 'aria-controls' | 'focused' | 'icon' | 'id' | 'label' | 'selected' | 'tone'\n>\n\n/**\n * Customized Sanity UI <Tab> with limited layout options.\n *\n * @internal\n */\nexport const Tab = forwardRef(function Tab(\n {tone = 'default', ...props}: TabProps & Omit<HTMLProps<HTMLButtonElement>, 'as' | 'size'>,\n ref: ForwardedRef<HTMLButtonElement>,\n) {\n return <UITab {...props} muted padding={2} ref={ref} tone={tone} />\n})\n","/* eslint-disable no-restricted-imports */\nimport {\n TooltipDelayGroupProvider as UITooltipDelayGroupProvider,\n type TooltipDelayGroupProviderProps as UITooltipDelayGroupProviderProps,\n} from '@sanity/ui'\n\nimport {TOOLTIP_DELAY_PROPS} from '../tooltip/constants'\n\n/** @internal */\nexport type TooltipDelayGroupProviderProps = Omit<UITooltipDelayGroupProviderProps, 'delay'>\n\n/**\n * Opinionated Sanity UI <TooltipDelayGroupProvider> which forces the same delay to all tooltips.\n *\n * @internal\n */\nexport const TooltipDelayGroupProvider = (props: TooltipDelayGroupProviderProps) => {\n return (\n <UITooltipDelayGroupProvider delay={TOOLTIP_DELAY_PROPS}>\n {props.children}\n </UITooltipDelayGroupProvider>\n )\n}\n"],"names":["LARGE_BUTTON_PROPS","space","padding","DEFAULT_BUTTON_PROPS","TooltipButtonWrapper","styled","span","Button","forwardRef","t0","ref","$","_c","paddingLeft","paddingY","rest","t1","t2","t3","tooltipProps","size","mode","tone","undefined","sizeProps","t4","UIButton","children","t5","content","t6","t7","Dialog","bodyHeight","footer","props","zOffset","t","useTranslation","confirmButton","cancelButton","description","onClose","UIDialog","ErrorBoundary","onCatch","source","useContext","SourceContext","error","caughtError","info","caughtInfo","run","onUncaughtError","e","message","console","handleCatch","UIErrorBoundary","MenuButton","popover","animate","UIMenuButton","Hotkeys","makePlatformAware","keys","hotKeys","map","platformifyKey","UIHotkeys","IS_APPLE_DEVICE","navigator","platform","test","key","lowerKey","toLowerCase","matchCase","original","target","orgLength","length","replace","char","i","toUpperCase","TOOLTIP_DELAY_PROPS","open","TOOLTIP_SHARED_PROPS","arrow","boundaryElement","delay","fallbackPlacements","placement","portal","Tooltip","hotkeys","UITooltip","FONT_SIZE","SUBTITLE_FONT_SIZE","SubtitleText","Text","PreviewWrapper","Box","MenuItem","Icon","IconRight","__unstable_space","__unstable_subtitle","badgeText","childrenProp","disabled","renderMenuItem","text","icon","iconRight","preview","opacity","isValidElement","isValidElementType","marginTop","marginBottom","menuItemContent","t8","t9","t10","UIMenuItem","t11","t12","t13","Popover","restProps","UIPopover","Tab","UITab","TooltipDelayGroupProvider","UITooltipDelayGroupProvider"],"mappings":";;;;;;;;AA6CA,MAAMA,qBAAqB;AAAA,EACzBC,OAAO;AAAA,EACPC,SAAS;AACX,GACMC,uBAAuB;AAAA,EAC3BF,OAAO;AAAA,EACPC,SAAS;AACX,GAEME,uBAAuBC,OAAOC;AAAAA;AAAAA,G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B,IAAAC,EAAA,CAAA;AAAA,MAAAH;AAAA,SAAAE,EAAA,CAAA,MAAAwB,MAAAR,YAErClB,KAAA,oBAACgI,6BAAA,EAAmClD,OAAAA,qBACjCpD,UAAAA,MAAKR,UACR,GAA8BhB,EAAA,CAAA,IAAAwB,MAAAR,UAAAhB,OAAAF,MAAAA,KAAAE,EAAA,CAAA,GAF9BF;AAE8B;"}
|
|
1
|
+
{"version":3,"file":"TooltipDelayGroupProvider.js","sources":["../../src/ui-components/button/Button.tsx","../../src/ui-components/dialog/Dialog.tsx","../../src/ui-components/errorBoundary/ErrorBoundary.tsx","../../src/ui-components/menuButton/MenuButton.tsx","../../src/core/components/Hotkeys.tsx","../../src/ui-components/tooltip/constants.ts","../../src/ui-components/tooltip/Tooltip.tsx","../../src/ui-components/menuItem/MenuItem.tsx","../../src/ui-components/popover/Popover.tsx","../../src/ui-components/tab/Tab.tsx","../../src/ui-components/tooltipDelayGroupProvider/TooltipDelayGroupProvider.tsx"],"sourcesContent":["/* eslint-disable no-restricted-imports */\n\nimport {Button as UIButton, type ButtonProps as UIButtonProps} from '@sanity/ui'\nimport {type ForwardedRef, forwardRef, type HTMLProps} from 'react'\nimport {styled} from 'styled-components'\n\nimport {Tooltip, type TooltipProps} from '..'\n\ntype BaseButtonProps = Pick<\n UIButtonProps,\n | 'as'\n | 'icon'\n | 'iconRight'\n | 'justify'\n | 'loading'\n | 'mode'\n | 'paddingY'\n | 'paddingLeft'\n | 'selected'\n | 'tone'\n | 'type'\n | 'width'\n> & {\n size?: 'default' | 'large'\n radius?: 'full'\n}\n\ntype ButtonWithText = {\n text: string\n tooltipProps?: TooltipProps | null\n icon?: UIButtonProps['icon']\n}\n\ntype IconButton = {\n text?: undefined\n icon?: UIButtonProps['icon']\n /**\n * When using a button with an icon, tooltipProps are required to enforce consistency in UI.\n */\n tooltipProps: TooltipProps | null\n}\n\n/** @internal */\nexport type ButtonProps = BaseButtonProps & (ButtonWithText | IconButton)\n\nconst LARGE_BUTTON_PROPS = {\n space: 3,\n padding: 3,\n}\nconst DEFAULT_BUTTON_PROPS = {\n space: 2,\n padding: 2,\n}\n\nconst TooltipButtonWrapper = styled.span`\n display: inline-flex;\n`\n/**\n * Customized Sanity UI <Button> with pre-defined layout options.\n *\n * @internal\n */\nexport const Button = forwardRef(function Button(\n {\n size = 'default',\n mode = 'default',\n paddingY,\n paddingLeft,\n tone = 'default',\n tooltipProps,\n ...rest\n }: ButtonProps & Omit<HTMLProps<HTMLButtonElement>, 'as' | 'size' | 'title'>,\n ref: ForwardedRef<HTMLButtonElement>,\n) {\n const sizeProps = size === 'default' ? DEFAULT_BUTTON_PROPS : LARGE_BUTTON_PROPS\n\n const children = (\n <UIButton\n {...rest}\n {...sizeProps}\n paddingY={paddingY}\n paddingLeft={paddingLeft}\n ref={ref}\n mode={mode}\n tone={tone}\n />\n )\n\n if (tooltipProps) {\n return (\n <Tooltip content={tooltipProps?.content} portal {...tooltipProps}>\n {/* This span is needed to make the tooltip work in disabled buttons */}\n <TooltipButtonWrapper>{children}</TooltipButtonWrapper>\n </Tooltip>\n )\n }\n\n return children\n})\n","/* eslint-disable no-restricted-imports */\nimport {\n Box,\n type BoxHeight,\n Button as UIButton,\n Dialog as UIDialog,\n type DialogProps as UIDialogProps,\n Flex,\n Text,\n} from '@sanity/ui'\nimport {type ComponentProps, forwardRef, type HTMLProps, type ReactNode, type Ref} from 'react'\nimport {useTranslation} from 'react-i18next'\n\n/** @internal */\nexport type DialogProps = Pick<\n UIDialogProps,\n | '__unstable_autoFocus'\n | '__unstable_hideCloseButton'\n | 'animate'\n | 'contentRef'\n | 'header'\n | 'id'\n | 'onActivate'\n | 'onClickOutside'\n | 'onClose'\n | 'portal'\n | 'position'\n | 'scheme'\n | 'width'\n> & {\n /**\n * Dialog body height.\n * Set this to 'fill' (i.e. 100%) if you want overflow body content to be contained\n * and not trigger dynamic border visibility.\n */\n bodyHeight?: BoxHeight\n children?: ReactNode\n zOffset?: number\n footer?: {\n cancelButton?: Omit<ComponentProps<typeof UIButton>, 'fontSize' | 'padding'>\n confirmButton?: Omit<ComponentProps<typeof UIButton>, 'fontSize' | 'padding'>\n /**\n * Description to be displayed side by side with the buttons.\n */\n description?: string\n }\n /**\n * If enabled, removes all default padding from dialog content.\n */\n padding?: boolean\n}\n\n/**\n * Customized Sanity UI <Dialog> that enforces an opinionated footer layout with a max of two buttons (confirm and cancel).\n *\n * @internal\n */\nexport const Dialog = forwardRef(function Dialog(\n {\n animate = true,\n bodyHeight,\n children,\n footer,\n padding = true,\n zOffset,\n ...props\n }: DialogProps & Pick<HTMLProps<HTMLDivElement>, 'onDragEnter' | 'onDrop'>,\n ref: Ref<HTMLDivElement>,\n) {\n const {t} = useTranslation()\n\n return (\n <UIDialog\n {...props}\n animate={animate}\n zOffset={zOffset}\n ref={ref}\n footer={\n (footer?.confirmButton || footer?.cancelButton) && (\n <Flex width=\"full\" gap={3} justify=\"flex-end\" padding={3} align=\"center\">\n {footer?.description && (\n <Box flex={1} paddingLeft={1}>\n <Text size={1} muted>\n {footer.description}\n </Text>\n </Box>\n )}\n {props.onClose && (\n <UIButton\n mode=\"bleed\"\n padding={2}\n text={t('common.dialog.cancel-button.text')}\n tone=\"default\"\n onClick={props.onClose}\n data-testid=\"cancel-button\"\n {...footer.cancelButton}\n />\n )}\n {footer.confirmButton && (\n <UIButton\n mode=\"default\"\n padding={2}\n text={t('common.dialog.confirm-button.text')}\n tone=\"critical\"\n data-testid=\"confirm-button\"\n {...footer.confirmButton}\n />\n )}\n </Flex>\n )\n }\n >\n <Box height={bodyHeight} padding={padding ? 4 : 0}>\n {children}\n </Box>\n </UIDialog>\n )\n})\n","import {\n // eslint-disable-next-line no-restricted-imports\n ErrorBoundary as UIErrorBoundary,\n type ErrorBoundaryProps as UIErrorBoundaryProps,\n} from '@sanity/ui'\nimport {useCallback, useContext} from 'react'\n\nimport {SourceContext} from '../../_singletons'\n\nexport type ErrorBoundaryProps = UIErrorBoundaryProps\n\n/**\n * ErrorBoundary component that catches errors and uses onUncaughtError config property\n * It also calls the onCatch prop if it exists.\n */\nexport function ErrorBoundary({onCatch, ...rest}: ErrorBoundaryProps): React.JSX.Element {\n // Use context, because source could be undefined and we don't want to throw in that case\n const source = useContext(SourceContext)\n\n const handleCatch = useCallback(\n ({error: caughtError, info: caughtInfo}: {error: Error; info: React.ErrorInfo}) => {\n // Send the error to the source if it has an onUncaughtError method\n\n // Workaround for React Compiler not yet fully supporting try/catch/finally syntax\n const run = () => {\n source?.onUncaughtError?.(caughtError, caughtInfo)\n }\n try {\n run()\n } catch (e) {\n e.message = `Encountered an additional error when calling custom \"onUncaughtError()\": ${e.message}`\n console.error(e)\n }\n\n // Call the onCatch prop if it exists\n onCatch?.({error: caughtError, info: caughtInfo})\n },\n [source, onCatch],\n )\n\n return <UIErrorBoundary {...rest} onCatch={handleCatch} />\n}\n","/* eslint-disable no-restricted-imports */\nimport {\n MenuButton as UIMenuButton,\n type MenuButtonProps as UIMenuButtonProps,\n type PopoverProps,\n} from '@sanity/ui'\nimport {type ForwardedRef, forwardRef} from 'react'\n\n/** @internal */\nexport type MenuButtonProps = Omit<UIMenuButtonProps, 'popover'> & {\n popover?: Omit<PopoverProps, 'animate' | 'content' | 'open'>\n}\n\n/**\n * Customized Sanity UI <MenuButton> that enforces popover animation.\n *\n * @internal\n */\nexport const MenuButton = forwardRef(function MenuButton(\n props: MenuButtonProps,\n ref: ForwardedRef<HTMLButtonElement>,\n) {\n return (\n <UIMenuButton\n {...props}\n ref={ref}\n popover={{\n ...props.popover,\n animate: true,\n }}\n />\n )\n})\n","import {Hotkeys as UIHotkeys, type HotkeysProps as UIHotkeysProps} from '@sanity/ui'\nimport {type HTMLProps, type RefAttributes} from 'react'\n\n/**\n * Properties for the `Hotkeys` component.\n *\n * @public\n */\nexport type HotkeysProps = UIHotkeysProps & {\n /**\n * Whether to make the keys platform-aware (eg `alt` to `option` on Apple devices).\n *\n * @defaultValue true\n */\n makePlatformAware?: boolean\n} & Omit<HTMLProps<HTMLElement>, 'ref' | 'size' | 'as'> &\n RefAttributes<HTMLElement>\n\n/**\n * Renders given `keys` as \"keycaps\" visually.\n *\n * This is a wrapper around `@sanity/ui`'s `Hotkeys` component, which allows for altering keys\n * (eg `alt` to `option`) on Apple devices unless `makePlatformAware` is set to `false`.\n *\n * @param props - Properties to render with\n * @returns React element\n * @public\n */\nexport function Hotkeys({makePlatformAware = true, keys: hotKeys = [], ...props}: HotkeysProps) {\n const keys = makePlatformAware ? hotKeys.map(platformifyKey) : hotKeys\n return <UIHotkeys {...props} keys={keys} />\n}\n\n/**\n * @internal\n */\nconst IS_APPLE_DEVICE =\n typeof navigator === 'undefined' || typeof navigator.platform !== 'string'\n ? false\n : /Mac|iPod|iPhone|iPad/.test(navigator.platform || '')\n\n/**\n * Given key 'Alt', or 'Option' (case-insensitive), return the platform-appropriate key name\n * (eg 'Alt' on non-Apple devices, 'Option' on Apple devices).\n *\n * @param key - Key to platformify\n * @returns Platform-appropriate key name\n * @internal\n */\nfunction platformifyKey(key: string): string {\n const lowerKey = key.toLowerCase()\n\n if (lowerKey === 'alt' && IS_APPLE_DEVICE) {\n return matchCase(key, 'option')\n }\n\n if (lowerKey === 'option' && !IS_APPLE_DEVICE) {\n return matchCase(key, 'alt')\n }\n\n return key\n}\n\n/**\n * Apply the case (lowercase/uppercase) of `original` to `target`, character by character,\n * eg matching ALL CAPS, all lowercase or Mixed Case.\n *\n * @param original - The original string to match case of\n * @param target - The target string to apply case to\n * @returns Target string with case applied from original\n * @internal\n */\nfunction matchCase(original: string, target: string): string {\n const orgLength = original.length\n\n return target.replace(/./g, (char, i) => {\n // Replace character by character matching case of original\n // If running out of original, just return the target case as-is\n return i < orgLength && original[i] === original[i].toUpperCase() ? char.toUpperCase() : char\n })\n}\n","export const TOOLTIP_DELAY_PROPS = {\n open: 400,\n}\n","import {\n Box,\n Flex,\n type HotkeysProps,\n Text,\n // eslint-disable-next-line no-restricted-imports\n Tooltip as UITooltip,\n // eslint-disable-next-line no-restricted-imports\n type TooltipProps as UITooltipProps,\n} from '@sanity/ui'\nimport {type ForwardedRef, forwardRef} from 'react'\n\nimport {Hotkeys} from '../../core/components/Hotkeys'\nimport {TOOLTIP_DELAY_PROPS} from './constants'\n\n/** @internal */\n\nexport type TooltipProps = Omit<UITooltipProps, 'arrow' | 'padding' | 'shadow'> & {\n hotkeys?: HotkeysProps['keys']\n}\n\nconst TOOLTIP_SHARED_PROPS: UITooltipProps = {\n animate: true,\n arrow: false,\n boundaryElement: null,\n delay: TOOLTIP_DELAY_PROPS,\n fallbackPlacements: ['bottom-start', 'bottom-end', 'top-start', 'top-end'],\n placement: 'bottom',\n portal: true,\n}\n\n/**\n * Customized Sanity UI <Tooltip> with limited layout options and support for showing hotkeys.\n *\n * In just about all cases, its strongly recommended that you pass a string to the `content` prop.\n * This helps simplify i18n and encourages short and concise.\n *\n * Passing ReactNode values to `content` is supported, but discouraged.\n *\n * @internal\n */\nexport const Tooltip = forwardRef(function Tooltip(\n props: TooltipProps,\n ref: ForwardedRef<HTMLDivElement>,\n) {\n const {content, hotkeys, ...rest} = props\n\n if (typeof content === 'string') {\n return (\n <UITooltip\n {...TOOLTIP_SHARED_PROPS}\n content={\n <Flex align=\"center\">\n {content && (\n <Box flex={1} padding={1}>\n <Text size={1}>{content}</Text>\n </Box>\n )}\n {hotkeys && (\n <Box flex=\"none\">\n <Hotkeys keys={hotkeys} />\n </Box>\n )}\n </Flex>\n }\n padding={1}\n ref={ref}\n {...rest}\n />\n )\n }\n\n return <UITooltip {...TOOLTIP_SHARED_PROPS} content={content} ref={ref} {...rest} />\n})\n","/* eslint-disable no-restricted-imports */\nimport {\n Badge,\n Box,\n Flex,\n MenuItem as UIMenuItem,\n type MenuItemProps as UIMenuItemProps,\n Stack,\n Text,\n} from '@sanity/ui'\nimport {forwardRef, type HTMLProps, isValidElement, type ReactNode, type Ref, useMemo} from 'react'\nimport {isValidElementType} from 'react-is'\nimport {styled} from 'styled-components'\n\nimport {Hotkeys} from '../../core/components/Hotkeys'\nimport {Tooltip, type TooltipProps} from '..'\n\nconst FONT_SIZE = 1\nconst SUBTITLE_FONT_SIZE = 0\n\n/* Using px value here to make title/subtitles align with icon */\nconst SubtitleText = styled(Text)`\n margin-top: 2px;\n`\n\n/** @internal */\nexport type MenuItemProps = Pick<\n UIMenuItemProps,\n 'as' | 'icon' | 'iconRight' | 'pressed' | 'selected' | 'tone' | 'hotkeys'\n> & {\n badgeText?: string\n /**\n * Usage of `children` is not supported, import `MenuItem` from `@sanity/ui` instead.\n */\n children?: undefined\n /**\n * Previews should be 25x25.\n */\n preview?: ReactNode\n /**\n * Optional render callback which receives menu item content.\n */\n renderMenuItem?: (menuItemContent: React.JSX.Element) => ReactNode\n text?: string\n tooltipProps?: TooltipProps | null\n /**\n * Optional subtitle prop for the menu item.\n * While not recommended, it is utilized for the workspace menu button.\n */\n __unstable_subtitle?: string\n /**\n * An optional property to adjust spacing in the preview between the icon and the text.\n * Not recommended, but is applied to the workspace menu button..\n */\n __unstable_space?: number\n}\n\nconst PreviewWrapper = styled(Box)`\n height: 25px;\n width: 25px;\n overflow: hidden;\n`\n\n/**\n * Customized Sanity UI <MenuItem> that restricts usage of `children` to encourage simple,\n * single line menu items.\n *\n * The workspace menu button needed a subtitle - hence, the StudioUI MenuIten now takes a subtitle prop.\n * This is only an escape hatch for the workspace menu button and is not recommended for general use.\n *\n * It also accepts a prop to attach tooltips as well as custom badges too.\n *\n * @internal\n */\nexport const MenuItem = forwardRef(function MenuItem(\n {\n badgeText,\n children: childrenProp,\n disabled,\n hotkeys,\n icon: Icon,\n iconRight: IconRight,\n preview = null,\n renderMenuItem,\n text,\n tooltipProps,\n __unstable_subtitle,\n __unstable_space,\n ...rest\n }: MenuItemProps &\n Omit<HTMLProps<HTMLDivElement>, 'as' | 'height' | 'ref' | 'selected' | 'tabIndex' | 'size'>,\n ref: Ref<HTMLDivElement>,\n) {\n const menuItemContent = useMemo(() => {\n return (\n <Flex align=\"center\" gap={2}>\n {preview && (\n <PreviewWrapper\n style={{opacity: disabled ? 0.25 : undefined}}\n paddingRight={__unstable_space ? 1 : 0}\n >\n <Flex align=\"center\" height=\"fill\" justify=\"center\">\n {preview}\n </Flex>\n </PreviewWrapper>\n )}\n {Icon && (\n <Box paddingRight={1}>\n <Text size={FONT_SIZE}>\n {isValidElement(Icon) && Icon}\n {isValidElementType(Icon) && <Icon />}\n </Text>\n </Box>\n )}\n {text && (\n <Stack flex={1} space={__unstable_subtitle ? 1 : 2}>\n <Text size={FONT_SIZE} textOverflow=\"ellipsis\" weight=\"medium\">\n {text}\n </Text>\n {__unstable_subtitle && (\n <SubtitleText size={SUBTITLE_FONT_SIZE} textOverflow=\"ellipsis\" weight=\"medium\" muted>\n {__unstable_subtitle}\n </SubtitleText>\n )}\n </Stack>\n )}\n {(badgeText || hotkeys || IconRight) && (\n <Flex align=\"center\" gap={3} marginLeft={3}>\n {hotkeys && <Hotkeys keys={hotkeys} style={{marginTop: -4, marginBottom: -4}} />}\n\n {badgeText && (\n <Badge fontSize={0} style={{marginTop: -4, marginBottom: -4}}>\n {badgeText}\n </Badge>\n )}\n\n {IconRight && (\n <Text size={FONT_SIZE}>\n {isValidElement(IconRight) && IconRight}\n {isValidElementType(IconRight) && <IconRight />}\n </Text>\n )}\n </Flex>\n )}\n </Flex>\n )\n }, [\n preview,\n disabled,\n __unstable_space,\n Icon,\n text,\n __unstable_subtitle,\n badgeText,\n hotkeys,\n IconRight,\n ])\n\n const children = (\n <UIMenuItem\n disabled={disabled}\n paddingLeft={preview ? 1 : 3}\n paddingRight={3}\n paddingY={preview ? 1 : 3}\n ref={ref}\n {...rest}\n >\n {typeof childrenProp === 'undefined' && typeof renderMenuItem === 'function'\n ? renderMenuItem(menuItemContent)\n : menuItemContent}\n </UIMenuItem>\n )\n\n if (tooltipProps) {\n return (\n <Tooltip content={tooltipProps?.content} portal {...tooltipProps}>\n {/* This div is needed to make the tooltip work in disabled menu items */}\n <div>{children}</div>\n </Tooltip>\n )\n }\n\n return children\n})\n","/* eslint-disable no-restricted-imports */\nimport {Popover as UIPopover, type PopoverProps as UIPopoverProps} from '@sanity/ui'\nimport {type ForwardedRef, forwardRef, type HTMLProps} from 'react'\n\n/** @internal */\nexport type PopoverProps = UIPopoverProps\n\n/**\n * Customized Sanity UI <Popover> that defaults to `animate=true`\n *\n * All Popovers in the studio should be animated by default\n * Can be overridden when nesting popovers to prevent AnimatePresence conflicts\n *\n * @internal\n */\nexport const Popover = forwardRef(function Popover(\n props: PopoverProps & Omit<HTMLProps<HTMLDivElement>, 'as' | 'children' | 'content' | 'width'>,\n ref: ForwardedRef<HTMLDivElement>,\n) {\n const {animate = true, ...restProps} = props\n return <UIPopover {...restProps} animate={animate} ref={ref} />\n})\n","/* eslint-disable no-restricted-imports */\nimport {Tab as UITab, type TabProps as UITabProps} from '@sanity/ui'\nimport {type ForwardedRef, forwardRef, type HTMLProps} from 'react'\n\n/**\n * @internal\n *\n * Padding and font sizes are fixed in Studio UI <Tab> components.\n */\nexport type TabProps = Pick<\n UITabProps,\n 'aria-controls' | 'focused' | 'icon' | 'id' | 'label' | 'selected' | 'tone'\n>\n\n/**\n * Customized Sanity UI <Tab> with limited layout options.\n *\n * @internal\n */\nexport const Tab = forwardRef(function Tab(\n {tone = 'default', ...props}: TabProps & Omit<HTMLProps<HTMLButtonElement>, 'as' | 'size'>,\n ref: ForwardedRef<HTMLButtonElement>,\n) {\n return <UITab {...props} muted padding={2} ref={ref} tone={tone} />\n})\n","/* eslint-disable no-restricted-imports */\nimport {\n TooltipDelayGroupProvider as UITooltipDelayGroupProvider,\n type TooltipDelayGroupProviderProps as UITooltipDelayGroupProviderProps,\n} from '@sanity/ui'\n\nimport {TOOLTIP_DELAY_PROPS} from '../tooltip/constants'\n\n/** @internal */\nexport type TooltipDelayGroupProviderProps = Omit<UITooltipDelayGroupProviderProps, 'delay'>\n\n/**\n * Opinionated Sanity UI <TooltipDelayGroupProvider> which forces the same delay to all tooltips.\n *\n * @internal\n */\nexport const TooltipDelayGroupProvider = (props: TooltipDelayGroupProviderProps) => {\n return (\n <UITooltipDelayGroupProvider delay={TOOLTIP_DELAY_PROPS}>\n {props.children}\n </UITooltipDelayGroupProvider>\n )\n}\n"],"names":["LARGE_BUTTON_PROPS","space","padding","DEFAULT_BUTTON_PROPS","TooltipButtonWrapper","styled","span","Button","forwardRef","t0","ref","$","_c","paddingLeft","paddingY","rest","t1","t2","t3","tooltipProps","size","mode","tone","undefined","sizeProps","t4","UIButton","children","t5","content","t6","t7","Dialog","bodyHeight","footer","props","zOffset","animate","t","useTranslation","confirmButton","cancelButton","description","onClose","UIDialog","ErrorBoundary","onCatch","source","useContext","SourceContext","error","caughtError","info","caughtInfo","run","onUncaughtError","e","message","console","handleCatch","UIErrorBoundary","MenuButton","popover","UIMenuButton","Hotkeys","makePlatformAware","keys","hotKeys","map","platformifyKey","UIHotkeys","IS_APPLE_DEVICE","navigator","platform","test","key","lowerKey","toLowerCase","matchCase","original","target","orgLength","length","replace","char","i","toUpperCase","TOOLTIP_DELAY_PROPS","open","TOOLTIP_SHARED_PROPS","arrow","boundaryElement","delay","fallbackPlacements","placement","portal","Tooltip","hotkeys","UITooltip","FONT_SIZE","SUBTITLE_FONT_SIZE","SubtitleText","Text","PreviewWrapper","Box","MenuItem","Icon","IconRight","__unstable_space","__unstable_subtitle","badgeText","childrenProp","disabled","renderMenuItem","text","icon","iconRight","preview","opacity","isValidElement","isValidElementType","marginTop","marginBottom","menuItemContent","t8","t9","t10","UIMenuItem","t11","t12","t13","Popover","restProps","UIPopover","Tab","UITab","TooltipDelayGroupProvider","UITooltipDelayGroupProvider"],"mappings":";;;;;;;;AA6CA,MAAMA,qBAAqB;AAAA,EACzBC,OAAO;AAAA,EACPC,SAAS;AACX,GACMC,uBAAuB;AAAA,EAC3BF,OAAO;AAAA,EACPC,SAAS;AACX,GAEME,uBAAuBC,OAAOC;AAAAA;AAAAA,GAQvBC,SAASC,WAAW,SAAAC,IAAAC,KAAA;AAAA,QAAAC,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,MAAAA,KAAAN,EAAA,CAAA,GAA5DM;AAA4D,CACpE,GCRYuH,4BAA4BrG,CAAAA,UAAA;AAAA,QAAAxB,IAAAC,EAAA,CAAA;AAAA,MAAAH;AAAA,SAAAE,EAAA,CAAA,MAAAwB,MAAAR,YAErClB,KAAA,oBAACgI,6BAAA,EAAmClD,OAAAA,qBACjCpD,UAAAA,MAAKR,UACR,GAA8BhB,EAAA,CAAA,IAAAwB,MAAAR,UAAAhB,OAAAF,MAAAA,KAAAE,EAAA,CAAA,GAF9BF;AAE8B;"}
|
|
@@ -7,7 +7,7 @@ try {
|
|
|
7
7
|
try {
|
|
8
8
|
buildVersion = buildVersion || // This is replaced by `@sanity/pkg-utils` at build time
|
|
9
9
|
// and must always be references by its full static name, e.g. no optional chaining, no `if (process && process.env)` etc.
|
|
10
|
-
"5.2.0-next.
|
|
10
|
+
"5.2.0-next.39+d8f0340485";
|
|
11
11
|
} catch {
|
|
12
12
|
}
|
|
13
13
|
const SANITY_VERSION = buildVersion || `${version}-dev`;
|
|
@@ -74,12 +74,7 @@ function getDefinedTypeName(type) {
|
|
|
74
74
|
}
|
|
75
75
|
const HTML_TAGS = ["img", "style"], SVG_TAGS = ["svg", "a", "altglyph", "altglyphdef", "altglyphitem", "animatecolor", "animatemotion", "animatetransform", "circle", "clippath", "defs", "desc", "ellipse", "filter", "font", "g", "glyph", "glyphref", "hkern", "image", "line", "lineargradient", "marker", "mask", "metadata", "mpath", "path", "pattern", "polygon", "polyline", "radialgradient", "rect", "stop", "style", "switch", "symbol", "text", "textpath", "title", "tref", "tspan", "view", "vkern"], SVG_FILTER_TAGS = ["feBlend", "feColorMatrix", "feComponentTransfer", "feComposite", "feConvolveMatrix", "feDiffuseLighting", "feDisplacementMap", "feDistantLight", "feDropShadow", "feFlood", "feFuncA", "feFuncB", "feFuncG", "feFuncR", "feGaussianBlur", "feImage", "feMerge", "feMergeNode", "feMorphology", "feOffset", "fePointLight", "feSpecularLighting", "feSpotLight", "feTile", "feTurbulence"], ALLOWED_TAGS = [...SVG_TAGS, ...HTML_TAGS, ...SVG_FILTER_TAGS], HTML_ATTRIBUTES = ["alt", "class", "crossorigin", "decoding", "elementtiming", "fetchpriority", "height", "loading", "src", "srcset", "style", "width"], SVG_ATTRIBUTES = ["accent-height", "accumulate", "additive", "alignment-baseline", "amplitude", "ascent", "attributename", "attributetype", "azimuth", "basefrequency", "baseline-shift", "begin", "bias", "by", "class", "clip", "clippathunits", "clip-path", "clip-rule", "color", "color-interpolation", "color-interpolation-filters", "color-profile", "color-rendering", "cx", "cy", "d", "dx", "dy", "diffuseconstant", "direction", "display", "divisor", "dur", "edgemode", "elevation", "end", "exponent", "fill", "fill-opacity", "fill-rule", "filter", "filterunits", "flood-color", "flood-opacity", "font-family", "font-size", "font-size-adjust", "font-stretch", "font-style", "font-variant", "font-weight", "fx", "fy", "g1", "g2", "glyph-name", "glyphref", "gradientunits", "gradienttransform", "height", "href", "id", "image-rendering", "in", "in2", "intercept", "k", "k1", "k2", "k3", "k4", "kerning", "keypoints", "keysplines", "keytimes", "lang", "lengthadjust", "letter-spacing", "kernelmatrix", "kernelunitlength", "lighting-color", "local", "marker-end", "marker-mid", "marker-start", "markerheight", "markerunits", "markerwidth", "maskcontentunits", "maskunits", "max", "mask", "media", "method", "mode", "min", "name", "numoctaves", "offset", "operator", "opacity", "order", "orient", "orientation", "origin", "overflow", "paint-order", "path", "pathlength", "patterncontentunits", "patterntransform", "patternunits", "points", "preservealpha", "preserveaspectratio", "primitiveunits", "r", "rx", "ry", "radius", "refx", "refy", "repeatcount", "repeatdur", "restart", "result", "rotate", "scale", "seed", "shape-rendering", "slope", "specularconstant", "specularexponent", "spreadmethod", "startoffset", "stddeviation", "stitchtiles", "stop-color", "stop-opacity", "stroke-dasharray", "stroke-dashoffset", "stroke-linecap", "stroke-linejoin", "stroke-miterlimit", "stroke-opacity", "stroke", "stroke-width", "style", "surfacescale", "systemlanguage", "tabindex", "tablevalues", "targetx", "targety", "transform", "transform-origin", "text-anchor", "text-decoration", "text-rendering", "textlength", "type", "u1", "u2", "unicode", "values", "viewbox", "visibility", "version", "vert-adv-y", "vert-origin-x", "vert-origin-y", "width", "word-spacing", "wrap", "writing-mode", "xchannelselector", "ychannelselector", "x", "x1", "x2", "xmlns", "y", "y1", "y2", "z", "zoomandpan"], ALLOWED_ATTR = [...SVG_ATTRIBUTES, ...HTML_ATTRIBUTES], config = {
|
|
76
76
|
ALLOWED_ATTR,
|
|
77
|
-
ALLOWED_TAGS
|
|
78
|
-
/**
|
|
79
|
-
* Required to allow for the use of `style` tags,
|
|
80
|
-
* namely rendering the style tags from `styled-components`
|
|
81
|
-
*/
|
|
82
|
-
FORCE_BODY: !0
|
|
77
|
+
ALLOWED_TAGS
|
|
83
78
|
}, MAX_CUSTOM_PROPERTY_DEPTH = 5;
|
|
84
79
|
function extractCreateWorkspaceManifest(workspace) {
|
|
85
80
|
const serializedSchema = extractManifestSchemaTypes(workspace.schema), serializedTools = extractManifestTools(workspace.tools);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extractManifest.cjs","sources":["../../../../src/_internal/manifest/Icon.tsx","../../../../src/_internal/manifest/manifestTypeHelpers.ts","../../../../src/_internal/manifest/purifyConfig.ts","../../../../src/_internal/manifest/extractWorkspaceManifest.tsx","../../../../src/_internal/cli/threads/extractManifest.ts"],"sourcesContent":["import {ThemeProvider} from '@sanity/ui'\nimport {buildTheme} from '@sanity/ui/theme'\nimport {type ComponentType, isValidElement, type ReactNode} from 'react'\nimport {isValidElementType} from 'react-is'\nimport {createDefaultIcon} from 'sanity'\n\nconst theme = buildTheme()\n\ninterface SchemaIconProps {\n icon?: ComponentType | ReactNode\n title: string\n subtitle?: string\n}\n\nconst SchemaIcon = ({icon, title, subtitle}: SchemaIconProps): React.JSX.Element => {\n return <ThemeProvider theme={theme}>{normalizeIcon(icon, title, subtitle)}</ThemeProvider>\n}\n\nfunction normalizeIcon(\n Icon: ComponentType | ReactNode | undefined,\n title: string,\n subtitle = '',\n): React.JSX.Element {\n if (isValidElementType(Icon)) return <Icon />\n if (isValidElement(Icon)) return Icon\n return createDefaultIcon(title, subtitle)\n}\n\nexport {SchemaIcon}\nexport type {SchemaIconProps}\n","import {\n type CrossDatasetReferenceSchemaType,\n type GlobalDocumentReferenceSchemaType,\n type ObjectField,\n type ObjectSchemaType,\n type ReferenceSchemaType,\n type SchemaType,\n} from '@sanity/types'\n\nconst DEFAULT_IMAGE_FIELDS = ['asset', 'hotspot', 'crop', 'media']\nconst DEFAULT_FILE_FIELDS = ['asset', 'media']\nconst DEFAULT_GEOPOINT_FIELDS = ['lat', 'lng', 'alt']\nconst DEFAULT_SLUG_FIELDS = ['current', 'source']\n\ntype InternalOwnProps = {fields?: unknown[]; type?: string; name?: string}\n\nexport function getCustomFields(type: ObjectSchemaType): (ObjectField & {fieldset?: string})[] {\n const fields = type.fieldsets\n ? type.fieldsets.flatMap((fs) => {\n if (fs.single) {\n return fs.field\n }\n return fs.fields.map((field) => ({\n ...field,\n fieldset: fs.name,\n }))\n })\n : type.fields\n\n if (isType(type, 'block')) {\n return []\n }\n if (isType(type, 'slug')) {\n return fields.filter((f) => !DEFAULT_SLUG_FIELDS.includes(f.name))\n }\n if (isType(type, 'geopoint')) {\n return fields.filter((f) => !DEFAULT_GEOPOINT_FIELDS.includes(f.name))\n }\n if (isType(type, 'image')) {\n return fields.filter((f) => !DEFAULT_IMAGE_FIELDS.includes(f.name))\n }\n if (isType(type, 'file')) {\n return fields.filter((f) => !DEFAULT_FILE_FIELDS.includes(f.name))\n }\n return fields\n}\n\nexport function isReference(type: SchemaType): type is ReferenceSchemaType {\n return isType(type, 'reference')\n}\n\nexport function isCrossDatasetReference(type: SchemaType): type is CrossDatasetReferenceSchemaType {\n return isType(type, 'crossDatasetReference')\n}\n\nexport function isGlobalDocumentReference(\n type: SchemaType,\n): type is GlobalDocumentReferenceSchemaType {\n return isType(type, 'globalDocumentReference')\n}\n\nexport function isObjectField(maybeOjectField: unknown): boolean {\n return (\n typeof maybeOjectField === 'object' && maybeOjectField !== null && 'name' in maybeOjectField\n )\n}\n\nexport function isCustomized(maybeCustomized: SchemaType): boolean {\n const internalOwnProps = getSchemaTypeInternalOwnProps(maybeCustomized)\n\n const hasFieldsArray =\n isObjectField(maybeCustomized) &&\n !isReference(maybeCustomized) &&\n !isCrossDatasetReference(maybeCustomized) &&\n !isGlobalDocumentReference(maybeCustomized) &&\n 'fields' in maybeCustomized &&\n Array.isArray(maybeCustomized.fields) &&\n // needed to differentiate inline, named array object types from globally defined types\n // we only consider it customized if the _definition_ has fields declared\n // this holds for all customizable object-like types: object, document, image and file\n internalOwnProps?.fields\n\n if (!hasFieldsArray) {\n return false\n }\n\n const fields = getCustomFields(maybeCustomized)\n return !!fields.length\n}\n\nexport function isType(schemaType: SchemaType, typeName: string): boolean {\n if (schemaType.name === typeName) {\n return true\n }\n if (!schemaType.type) {\n return false\n }\n return isType(schemaType.type, typeName)\n}\n\nexport function isDefined<T>(value: T | null | undefined): value is T {\n return value !== null && value !== undefined\n}\n\nexport function isRecord(value: unknown): value is Record<string, unknown> {\n return !!value && typeof value === 'object'\n}\n\nexport function isPrimitive(value: unknown): value is string | boolean | number {\n return isString(value) || isBoolean(value) || isNumber(value)\n}\n\nexport function isString(value: unknown): value is string {\n return typeof value === 'string'\n}\n\nfunction isNumber(value: unknown): value is number {\n return typeof value === 'boolean'\n}\n\nfunction isBoolean(value: unknown): value is boolean {\n return typeof value === 'number'\n}\n\n/**\n * _internal_ownProps contains the _definition_ for the type.\n * Without it we cannot differentiate inline array item types from globally defined types in array.of\n */\nexport function getSchemaTypeInternalOwnProps(type: SchemaType): InternalOwnProps | undefined {\n return (type as {_internal_ownProps?: InternalOwnProps})?._internal_ownProps\n}\n\n/**\n * This allows us to differentiate inline array.of type definitions vs global type names on compiled schema types\n */\nexport function getDefinedTypeName(type: SchemaType): string | undefined {\n return getSchemaTypeInternalOwnProps(type)?.type\n}\n","import {type Config} from 'isomorphic-dompurify'\n\n/**\n * This file maintains our sanitization configuration for DOMPurify.\n * We use an allowlist for tags and attributes to ensure that only safe\n * elements and attributes are allowed.\n *\n * This is easier to loosen as specs develop & use-cases are discovered.\n */\n\n///////// Tags\n\nconst HTML_TAGS = ['img', 'style']\n\nconst SVG_TAGS = [\n 'svg',\n 'a',\n 'altglyph',\n 'altglyphdef',\n 'altglyphitem',\n 'animatecolor',\n 'animatemotion',\n 'animatetransform',\n 'circle',\n 'clippath',\n 'defs',\n 'desc',\n 'ellipse',\n 'filter',\n 'font',\n 'g',\n 'glyph',\n 'glyphref',\n 'hkern',\n 'image',\n 'line',\n 'lineargradient',\n 'marker',\n 'mask',\n 'metadata',\n 'mpath',\n 'path',\n 'pattern',\n 'polygon',\n 'polyline',\n 'radialgradient',\n 'rect',\n 'stop',\n 'style',\n 'switch',\n 'symbol',\n 'text',\n 'textpath',\n 'title',\n 'tref',\n 'tspan',\n 'view',\n 'vkern',\n] as const\n\nconst SVG_FILTER_TAGS = [\n 'feBlend',\n 'feColorMatrix',\n 'feComponentTransfer',\n 'feComposite',\n 'feConvolveMatrix',\n 'feDiffuseLighting',\n 'feDisplacementMap',\n 'feDistantLight',\n 'feDropShadow',\n 'feFlood',\n 'feFuncA',\n 'feFuncB',\n 'feFuncG',\n 'feFuncR',\n 'feGaussianBlur',\n 'feImage',\n 'feMerge',\n 'feMergeNode',\n 'feMorphology',\n 'feOffset',\n 'fePointLight',\n 'feSpecularLighting',\n 'feSpotLight',\n 'feTile',\n 'feTurbulence',\n] as const\n\nconst ALLOWED_TAGS: Config['ALLOWED_TAGS'] = [...SVG_TAGS, ...HTML_TAGS, ...SVG_FILTER_TAGS]\n\n///////// Attributes\n\nconst HTML_ATTRIBUTES = [\n 'alt',\n 'class',\n 'crossorigin',\n 'decoding',\n 'elementtiming',\n 'fetchpriority',\n 'height',\n 'loading',\n 'src',\n 'srcset',\n 'style',\n 'width',\n]\n\nconst SVG_ATTRIBUTES = [\n 'accent-height',\n 'accumulate',\n 'additive',\n 'alignment-baseline',\n 'amplitude',\n 'ascent',\n 'attributename',\n 'attributetype',\n 'azimuth',\n 'basefrequency',\n 'baseline-shift',\n 'begin',\n 'bias',\n 'by',\n 'class',\n 'clip',\n 'clippathunits',\n 'clip-path',\n 'clip-rule',\n 'color',\n 'color-interpolation',\n 'color-interpolation-filters',\n 'color-profile',\n 'color-rendering',\n 'cx',\n 'cy',\n 'd',\n 'dx',\n 'dy',\n 'diffuseconstant',\n 'direction',\n 'display',\n 'divisor',\n 'dur',\n 'edgemode',\n 'elevation',\n 'end',\n 'exponent',\n 'fill',\n 'fill-opacity',\n 'fill-rule',\n 'filter',\n 'filterunits',\n 'flood-color',\n 'flood-opacity',\n 'font-family',\n 'font-size',\n 'font-size-adjust',\n 'font-stretch',\n 'font-style',\n 'font-variant',\n 'font-weight',\n 'fx',\n 'fy',\n 'g1',\n 'g2',\n 'glyph-name',\n 'glyphref',\n 'gradientunits',\n 'gradienttransform',\n 'height',\n 'href',\n 'id',\n 'image-rendering',\n 'in',\n 'in2',\n 'intercept',\n 'k',\n 'k1',\n 'k2',\n 'k3',\n 'k4',\n 'kerning',\n 'keypoints',\n 'keysplines',\n 'keytimes',\n 'lang',\n 'lengthadjust',\n 'letter-spacing',\n 'kernelmatrix',\n 'kernelunitlength',\n 'lighting-color',\n 'local',\n 'marker-end',\n 'marker-mid',\n 'marker-start',\n 'markerheight',\n 'markerunits',\n 'markerwidth',\n 'maskcontentunits',\n 'maskunits',\n 'max',\n 'mask',\n 'media',\n 'method',\n 'mode',\n 'min',\n 'name',\n 'numoctaves',\n 'offset',\n 'operator',\n 'opacity',\n 'order',\n 'orient',\n 'orientation',\n 'origin',\n 'overflow',\n 'paint-order',\n 'path',\n 'pathlength',\n 'patterncontentunits',\n 'patterntransform',\n 'patternunits',\n 'points',\n 'preservealpha',\n 'preserveaspectratio',\n 'primitiveunits',\n 'r',\n 'rx',\n 'ry',\n 'radius',\n 'refx',\n 'refy',\n 'repeatcount',\n 'repeatdur',\n 'restart',\n 'result',\n 'rotate',\n 'scale',\n 'seed',\n 'shape-rendering',\n 'slope',\n 'specularconstant',\n 'specularexponent',\n 'spreadmethod',\n 'startoffset',\n 'stddeviation',\n 'stitchtiles',\n 'stop-color',\n 'stop-opacity',\n 'stroke-dasharray',\n 'stroke-dashoffset',\n 'stroke-linecap',\n 'stroke-linejoin',\n 'stroke-miterlimit',\n 'stroke-opacity',\n 'stroke',\n 'stroke-width',\n 'style',\n 'surfacescale',\n 'systemlanguage',\n 'tabindex',\n 'tablevalues',\n 'targetx',\n 'targety',\n 'transform',\n 'transform-origin',\n 'text-anchor',\n 'text-decoration',\n 'text-rendering',\n 'textlength',\n 'type',\n 'u1',\n 'u2',\n 'unicode',\n 'values',\n 'viewbox',\n 'visibility',\n 'version',\n 'vert-adv-y',\n 'vert-origin-x',\n 'vert-origin-y',\n 'width',\n 'word-spacing',\n 'wrap',\n 'writing-mode',\n 'xchannelselector',\n 'ychannelselector',\n 'x',\n 'x1',\n 'x2',\n 'xmlns',\n 'y',\n 'y1',\n 'y2',\n 'z',\n 'zoomandpan',\n] as const\n\nconst ALLOWED_ATTR: Config['ALLOWED_ATTR'] = [...SVG_ATTRIBUTES, ...HTML_ATTRIBUTES]\n\nconst config = {\n ALLOWED_ATTR,\n ALLOWED_TAGS,\n /**\n * Required to allow for the use of `style` tags,\n * namely rendering the style tags from `styled-components`\n */\n FORCE_BODY: true,\n} satisfies Config\n\nexport {config}\n","import DOMPurify from 'isomorphic-dompurify'\nimport {startCase} from 'lodash-es'\nimport {renderToString} from 'react-dom/server'\nimport {\n type ArraySchemaType,\n type BlockDefinition,\n type BooleanSchemaType,\n ConcreteRuleClass,\n createSchema,\n type CrossDatasetReferenceSchemaType,\n type FileSchemaType,\n type GlobalDocumentReferenceSchemaType,\n type MultiFieldSet,\n type NumberSchemaType,\n type ObjectField,\n type ObjectSchemaType,\n type ReferenceSchemaType,\n type Rule,\n type RuleSpec,\n type Schema,\n type SchemaType,\n type SchemaValidationValue,\n type SpanSchemaType,\n type StringSchemaType,\n type Workspace,\n} from 'sanity'\n\nimport {SchemaIcon, type SchemaIconProps} from './Icon'\nimport {\n getCustomFields,\n getDefinedTypeName,\n isCrossDatasetReference,\n isCustomized,\n isDefined,\n isGlobalDocumentReference,\n isPrimitive,\n isRecord,\n isReference,\n isString,\n isType,\n} from './manifestTypeHelpers'\nimport {\n type CreateWorkspaceManifest,\n type ManifestField,\n type ManifestFieldset,\n type ManifestSchemaType,\n type ManifestSerializable,\n type ManifestTitledValue,\n type ManifestTool,\n type ManifestValidationGroup,\n type ManifestValidationRule,\n} from './manifestTypes'\nimport {config} from './purifyConfig'\n\ninterface Context {\n schema: Schema\n}\n\ntype SchemaTypeKey =\n | keyof ArraySchemaType\n | keyof BooleanSchemaType\n | keyof FileSchemaType\n | keyof NumberSchemaType\n | keyof ObjectSchemaType\n | keyof StringSchemaType\n | keyof ReferenceSchemaType\n | keyof BlockDefinition\n | 'group' // we strip this from fields\n\ntype Validation = {validation: ManifestValidationGroup[]} | Record<string, never>\ntype ObjectFields = {fields: ManifestField[]} | Record<string, never>\ntype SerializableProp = ManifestSerializable | ManifestSerializable[] | undefined\ntype ManifestValidationFlag = ManifestValidationRule['flag']\ntype ValidationRuleTransformer = (rule: RuleSpec) => ManifestValidationRule | undefined\n\nconst MAX_CUSTOM_PROPERTY_DEPTH = 5\n\nexport function extractCreateWorkspaceManifest(workspace: Workspace): CreateWorkspaceManifest {\n const serializedSchema = extractManifestSchemaTypes(workspace.schema)\n const serializedTools = extractManifestTools(workspace.tools)\n\n return {\n name: workspace.name,\n title: workspace.title,\n subtitle: workspace.subtitle,\n basePath: workspace.basePath,\n projectId: workspace.projectId,\n dataset: workspace.dataset,\n icon: resolveIcon({\n icon: workspace.icon,\n title: workspace.title,\n subtitle: workspace.subtitle,\n }),\n mediaLibrary: workspace.mediaLibrary,\n schema: serializedSchema,\n tools: serializedTools,\n }\n}\n\n/**\n * Extracts all serializable properties from userland schema types,\n * so they best-effort can be used as definitions for Schema.compile\n. */\nexport function extractManifestSchemaTypes(schema: Schema): ManifestSchemaType[] {\n const typeNames = schema.getTypeNames()\n const context = {schema}\n\n const studioDefaultTypeNames = createSchema({name: 'default', types: []}).getTypeNames()\n\n return typeNames\n .filter((typeName) => !studioDefaultTypeNames.includes(typeName))\n .map((typeName) => schema.get(typeName))\n .filter((type): type is SchemaType => typeof type !== 'undefined')\n .map((type) => transformType(type, context))\n}\n\nfunction transformCommonTypeFields(\n type: SchemaType & {fieldset?: string},\n typeName: string,\n context: Context,\n): Omit<ManifestSchemaType, 'name' | 'title' | 'type'> {\n const arrayProps =\n typeName === 'array' && type.jsonType === 'array' ? transformArrayMember(type, context) : {}\n\n const referenceProps = isReference(type) ? transformReference(type) : {}\n const crossDatasetRefProps = isCrossDatasetReference(type)\n ? transformCrossDatasetReference(type)\n : {}\n const globalRefProps = isGlobalDocumentReference(type)\n ? transformGlobalDocumentReference(type)\n : {}\n\n const objectFields: ObjectFields =\n type.jsonType === 'object' && type.type && isCustomized(type)\n ? {\n fields: getCustomFields(type).map((objectField) => transformField(objectField, context)),\n }\n : {}\n\n return {\n ...retainCustomTypeProps(type),\n ...transformValidation(type.validation),\n ...ensureString('description', type.description),\n ...objectFields,\n ...arrayProps,\n ...referenceProps,\n ...crossDatasetRefProps,\n ...globalRefProps,\n ...ensureConditional('readOnly', type.readOnly),\n ...ensureConditional('hidden', type.hidden),\n ...transformFieldsets(type),\n // fieldset prop gets instrumented via getCustomFields\n ...ensureString('fieldset', type.fieldset),\n ...transformBlockType(type, context),\n }\n}\n\nfunction transformFieldsets(\n type: SchemaType,\n): {fieldsets: ManifestFieldset[]} | Record<string, never> {\n if (type.jsonType !== 'object') {\n return {}\n }\n const fieldsets = type.fieldsets\n ?.filter((fs): fs is MultiFieldSet => !fs.single)\n .map((fs) => {\n const options = isRecord(fs.options) ? {options: retainSerializableProps(fs.options)} : {}\n return {\n name: fs.name,\n ...ensureCustomTitle(fs.name, fs.title),\n ...ensureString('description', fs.description),\n ...ensureConditional('readOnly', fs.readOnly),\n ...ensureConditional('hidden', fs.hidden),\n ...options,\n }\n })\n\n return fieldsets?.length ? {fieldsets} : {}\n}\n\nfunction transformType(type: SchemaType, context: Context): ManifestSchemaType {\n const typeName = type.type ? type.type.name : type.jsonType\n\n return {\n ...transformCommonTypeFields(type, typeName, context),\n name: type.name,\n type: typeName,\n ...ensureCustomTitle(type.name, type.title),\n }\n}\n\nfunction retainCustomTypeProps(type: SchemaType): Record<string, SerializableProp> {\n const manuallySerializedFields: SchemaTypeKey[] = [\n //explicitly added\n 'name',\n 'title',\n 'description',\n 'readOnly',\n 'hidden',\n 'validation',\n 'fieldsets',\n 'fields',\n 'to',\n 'of',\n // not serialized\n 'type',\n 'jsonType',\n '__experimental_actions',\n '__experimental_formPreviewTitle',\n '__experimental_omnisearch_visibility',\n '__experimental_search',\n 'components',\n 'icon',\n 'orderings',\n 'preview',\n 'groups',\n //only exists on fields\n 'group',\n // we know about these, but let them be generically handled\n // deprecated\n // rows (from text)\n // initialValue\n // options\n // crossDatasetReference props\n ]\n const typeWithoutManuallyHandledFields = Object.fromEntries(\n Object.entries(type).filter(\n ([key]) => !manuallySerializedFields.includes(key as unknown as SchemaTypeKey),\n ),\n )\n return retainSerializableProps(typeWithoutManuallyHandledFields) as Record<\n string,\n SerializableProp\n >\n}\n\nfunction retainSerializableProps(maybeSerializable: unknown, depth = 0): SerializableProp {\n if (depth > MAX_CUSTOM_PROPERTY_DEPTH) {\n return undefined\n }\n\n if (!isDefined(maybeSerializable)) {\n return undefined\n }\n\n if (isPrimitive(maybeSerializable)) {\n // cull empty strings\n if (maybeSerializable === '') {\n return undefined\n }\n return maybeSerializable\n }\n\n // url-schemes ect..\n if (maybeSerializable instanceof RegExp) {\n return maybeSerializable.toString()\n }\n\n if (Array.isArray(maybeSerializable)) {\n const arrayItems = maybeSerializable\n .map((item) => retainSerializableProps(item, depth + 1))\n .filter((item): item is ManifestSerializable => isDefined(item))\n return arrayItems.length ? arrayItems : undefined\n }\n\n if (isRecord(maybeSerializable)) {\n const serializableEntries = Object.entries(maybeSerializable)\n .map(([key, value]) => {\n return [key, retainSerializableProps(value, depth + 1)]\n })\n .filter(([, value]) => isDefined(value))\n return serializableEntries.length ? Object.fromEntries(serializableEntries) : undefined\n }\n\n return undefined\n}\n\nfunction transformField(field: ObjectField & {fieldset?: string}, context: Context): ManifestField {\n const fieldType = field.type\n const typeName = getDefinedTypeName(fieldType) ?? fieldType.name\n return {\n ...transformCommonTypeFields(fieldType, typeName, context),\n name: field.name,\n type: typeName,\n ...ensureCustomTitle(field.name, fieldType.title),\n // this prop gets added synthetically via getCustomFields\n ...ensureString('fieldset', field.fieldset),\n }\n}\n\nfunction transformArrayMember(\n arrayMember: ArraySchemaType,\n context: Context,\n): Pick<ManifestField, 'of'> {\n return {\n of: arrayMember.of.map((type) => {\n const typeName = getDefinedTypeName(type) ?? type.name\n return {\n ...transformCommonTypeFields(type, typeName, context),\n type: typeName,\n ...(typeName === type.name ? {} : {name: type.name}),\n ...ensureCustomTitle(type.name, type.title),\n }\n }),\n }\n}\n\nfunction transformReference(reference: ReferenceSchemaType): Pick<ManifestSchemaType, 'to'> {\n return {\n to: (reference.to ?? []).map((type) => {\n return {\n ...retainCustomTypeProps(type),\n type: type.name,\n }\n }),\n }\n}\n\nfunction transformCrossDatasetReference(\n reference: CrossDatasetReferenceSchemaType,\n): Pick<ManifestSchemaType, 'to' | 'preview'> {\n return {\n to: (reference.to ?? []).map((crossDataset) => {\n const preview = crossDataset.preview?.select\n ? {preview: {select: crossDataset.preview.select}}\n : {}\n return {\n type: crossDataset.type,\n ...ensureCustomTitle(crossDataset.type, crossDataset.title),\n ...preview,\n }\n }),\n }\n}\n\nfunction transformGlobalDocumentReference(\n reference: GlobalDocumentReferenceSchemaType,\n): Pick<ManifestSchemaType, 'to' | 'preview'> {\n return {\n to: (reference.to ?? []).map((crossDataset) => {\n const preview = crossDataset.preview?.select\n ? {preview: {select: crossDataset.preview.select}}\n : {}\n return {\n type: crossDataset.type,\n ...ensureCustomTitle(crossDataset.type, crossDataset.title),\n ...preview,\n }\n }),\n }\n}\n\nconst transformTypeValidationRule: ValidationRuleTransformer = (rule) => {\n return {\n ...rule,\n constraint:\n 'constraint' in rule &&\n (typeof rule.constraint === 'string'\n ? rule.constraint.toLowerCase()\n : retainSerializableProps(rule.constraint)),\n }\n}\n\nconst validationRuleTransformers: Partial<\n Record<ManifestValidationFlag, ValidationRuleTransformer>\n> = {\n type: transformTypeValidationRule,\n}\n\nfunction transformValidation(validation: SchemaValidationValue): Validation {\n const validationArray = (Array.isArray(validation) ? validation : [validation]).filter(\n (value): value is Rule => typeof value === 'object' && '_type' in value,\n )\n\n // we dont want type in the output as that is implicitly given by the typedef itself an will only bloat the payload\n const disallowedFlags = ['type']\n\n // Validation rules that refer to other fields use symbols, which cannot be serialized. It would\n // be possible to transform these to a serializable type, but we haven't implemented that for now.\n const disallowedConstraintTypes: (symbol | unknown)[] = [ConcreteRuleClass.FIELD_REF]\n\n const serializedValidation = validationArray\n .map(({_rules, _message, _level}) => {\n const message: Partial<Pick<ManifestValidationGroup, 'message'>> =\n typeof _message === 'string' ? {message: _message} : {}\n\n const serializedRules = _rules\n .filter((rule) => {\n if (!('constraint' in rule)) {\n return false\n }\n\n const {flag, constraint} = rule\n\n if (disallowedFlags.includes(flag)) {\n return false\n }\n\n return !(\n typeof constraint === 'object' &&\n 'type' in constraint &&\n disallowedConstraintTypes.includes(constraint.type)\n )\n })\n .reduce<ManifestValidationRule[]>((rules, rule) => {\n const transformer: ValidationRuleTransformer =\n validationRuleTransformers[rule.flag] ??\n ((spec) => retainSerializableProps(spec) as ManifestValidationRule)\n\n const transformedRule = transformer(rule)\n if (!transformedRule) {\n return rules\n }\n return [...rules, transformedRule]\n }, [])\n\n return {\n rules: serializedRules,\n level: _level,\n ...message,\n }\n })\n .filter((group) => !!group.rules.length)\n\n return serializedValidation.length ? {validation: serializedValidation} : {}\n}\n\nfunction ensureCustomTitle(typeName: string, value: unknown) {\n const titleObject = ensureString('title', value)\n\n const defaultTitle = startCase(typeName)\n // omit title if its the same as default, to reduce payload\n if (titleObject.title === defaultTitle) {\n return {}\n }\n return titleObject\n}\n\nfunction ensureString<Key extends string>(key: Key, value: unknown) {\n if (typeof value === 'string') {\n return {\n [key]: value,\n }\n }\n\n return {}\n}\n\nfunction ensureConditional<const Key extends string>(key: Key, value: unknown) {\n if (typeof value === 'boolean') {\n return {\n [key]: value,\n }\n }\n\n if (typeof value === 'function') {\n return {\n [key]: 'conditional',\n }\n }\n\n return {}\n}\n\nexport function transformBlockType(\n blockType: SchemaType,\n context: Context,\n): Pick<ManifestSchemaType, 'marks' | 'lists' | 'styles' | 'of'> | Record<string, never> {\n if (blockType.jsonType !== 'object' || !isType(blockType, 'block')) {\n return {}\n }\n\n const childrenField = blockType.fields?.find((field) => field.name === 'children') as\n | {type: ArraySchemaType}\n | undefined\n\n if (!childrenField) {\n return {}\n }\n const ofType = childrenField.type.of\n if (!ofType) {\n return {}\n }\n const spanType = ofType.find((memberType) => memberType.name === 'span') as\n | ObjectSchemaType\n | undefined\n if (!spanType) {\n return {}\n }\n const inlineObjectTypes = (ofType.filter((memberType) => memberType.name !== 'span') ||\n []) as ObjectSchemaType[]\n\n return {\n marks: {\n annotations: (spanType as SpanSchemaType).annotations.map((t) => transformType(t, context)),\n decorators: resolveEnabledDecorators(spanType),\n },\n lists: resolveEnabledListItems(blockType),\n styles: resolveEnabledStyles(blockType),\n of: inlineObjectTypes.map((t) => transformType(t, context)),\n }\n}\n\nfunction resolveEnabledStyles(blockType: ObjectSchemaType): ManifestTitledValue[] | undefined {\n const styleField = blockType.fields?.find((btField) => btField.name === 'style')\n return resolveTitleValueArray(styleField?.type?.options?.list)\n}\n\nfunction resolveEnabledDecorators(spanType: ObjectSchemaType): ManifestTitledValue[] | undefined {\n return 'decorators' in spanType ? resolveTitleValueArray(spanType.decorators) : undefined\n}\n\nfunction resolveEnabledListItems(blockType: ObjectSchemaType): ManifestTitledValue[] | undefined {\n const listField = blockType.fields?.find((btField) => btField.name === 'listItem')\n return resolveTitleValueArray(listField?.type?.options?.list)\n}\n\nfunction resolveTitleValueArray(possibleArray: unknown): ManifestTitledValue[] | undefined {\n if (!possibleArray || !Array.isArray(possibleArray)) {\n return undefined\n }\n const titledValues = possibleArray\n .filter(\n (d): d is {value: string; title?: string} => isRecord(d) && !!d.value && isString(d.value),\n )\n .map((item) => {\n return {\n value: item.value,\n ...ensureString('title', item.title),\n } satisfies ManifestTitledValue\n })\n if (!titledValues?.length) {\n return undefined\n }\n\n return titledValues\n}\n\nconst extractManifestTools = (tools: Workspace['tools']): ManifestTool[] =>\n tools.map((tool) => {\n const {\n title,\n name,\n icon,\n __internalApplicationType: type,\n } = tool as Workspace['tools'][number] & {__internalApplicationType: string}\n return {\n title,\n name,\n type: type || null,\n icon: resolveIcon({\n icon,\n title,\n }),\n } satisfies ManifestTool\n })\n\nconst resolveIcon = (props: SchemaIconProps): string | null => {\n try {\n const html = renderToString(<SchemaIcon {...props} />)\n return DOMPurify.sanitize(html.trim(), config)\n } catch {\n return null\n }\n}\n","import {isMainThread, parentPort, workerData as _workerData} from 'node:worker_threads'\n\nimport {extractCreateWorkspaceManifest} from '../../manifest/extractWorkspaceManifest'\nimport {getStudioWorkspaces} from '../util/getStudioWorkspaces'\nimport {mockBrowserEnvironment} from '../util/mockBrowserEnvironment'\n\n/** @internal */\nexport interface ExtractManifestWorkerData {\n workDir: string\n}\n\nasync function main() {\n if (isMainThread || !parentPort) {\n throw new Error('This module must be run as a worker thread')\n }\n\n const opts = _workerData as ExtractManifestWorkerData\n\n const cleanup = mockBrowserEnvironment(opts.workDir)\n\n try {\n const workspaces = await getStudioWorkspaces({basePath: opts.workDir})\n\n for (const workspace of workspaces) {\n parentPort?.postMessage(extractCreateWorkspaceManifest(workspace))\n }\n } finally {\n parentPort?.close()\n cleanup()\n }\n}\n\nvoid main().then(() => process.exit())\n"],"names":["theme","buildTheme","SchemaIcon","t0","$","_c","icon","title","subtitle","t1","normalizeIcon","t2","jsx","ThemeProvider","Icon","isValidElementType","isValidElement","createDefaultIcon","DEFAULT_IMAGE_FIELDS","DEFAULT_FILE_FIELDS","DEFAULT_GEOPOINT_FIELDS","DEFAULT_SLUG_FIELDS","getCustomFields","type","fields","fieldsets","flatMap","fs","single","field","map","fieldset","name","isType","filter","f","includes","isReference","isCrossDatasetReference","isGlobalDocumentReference","isObjectField","maybeOjectField","isCustomized","maybeCustomized","internalOwnProps","getSchemaTypeInternalOwnProps","Array","isArray","length","schemaType","typeName","isDefined","value","isRecord","isPrimitive","isString","isBoolean","isNumber","_internal_ownProps","getDefinedTypeName","HTML_TAGS","SVG_TAGS","SVG_FILTER_TAGS","ALLOWED_TAGS","HTML_ATTRIBUTES","SVG_ATTRIBUTES","ALLOWED_ATTR","config","FORCE_BODY","MAX_CUSTOM_PROPERTY_DEPTH","extractCreateWorkspaceManifest","workspace","serializedSchema","extractManifestSchemaTypes","schema","serializedTools","extractManifestTools","tools","basePath","projectId","dataset","resolveIcon","mediaLibrary","typeNames","getTypeNames","studioDefaultTypeNames","createSchema","types","get","transformType","transformCommonTypeFields","context","arrayProps","jsonType","transformArrayMember","referenceProps","transformReference","crossDatasetRefProps","transformCrossDatasetReference","globalRefProps","transformGlobalDocumentReference","objectFields","objectField","transformField","retainCustomTypeProps","transformValidation","validation","ensureString","description","ensureConditional","readOnly","hidden","transformFieldsets","transformBlockType","options","retainSerializableProps","ensureCustomTitle","manuallySerializedFields","typeWithoutManuallyHandledFields","Object","fromEntries","entries","key","maybeSerializable","depth","RegExp","toString","arrayItems","item","undefined","serializableEntries","fieldType","arrayMember","of","reference","to","crossDataset","preview","select","transformTypeValidationRule","rule","constraint","toLowerCase","validationRuleTransformers","validationArray","disallowedFlags","disallowedConstraintTypes","ConcreteRuleClass","FIELD_REF","serializedValidation","_rules","_message","_level","message","rules","flag","reduce","transformedRule","spec","level","group","titleObject","defaultTitle","startCase","blockType","childrenField","find","ofType","spanType","memberType","inlineObjectTypes","marks","annotations","t","decorators","resolveEnabledDecorators","lists","resolveEnabledListItems","styles","resolveEnabledStyles","styleField","btField","resolveTitleValueArray","list","listField","possibleArray","titledValues","d","tool","__internalApplicationType","props","html","renderToString","DOMPurify","sanitize","trim","main","isMainThread","parentPort","Error","opts","_workerData","cleanup","mockBrowserEnvironment","workDir","workspaces","getStudioWorkspaces","postMessage","close","then","process","exit"],"mappings":";;;;;;AAMA,MAAMA,QAAQC,QAAAA,WAAAA,GAQRC,aAAaC,CAAAA,OAAA;AAAA,QAAAC,IAAAC,kBAAA,CAAA,GAAC;AAAA,IAAAC;AAAAA,IAAAC;AAAAA,IAAAC;AAAAA,EAAAA,IAAAL;AAAwC,MAAAM;AAAAL,IAAA,CAAA,MAAAE,QAAAF,SAAAI,YAAAJ,EAAA,CAAA,MAAAG,SACrBE,KAAAC,cAAcJ,MAAMC,OAAOC,QAAQ,GAACJ,OAAAE,MAAAF,OAAAI,UAAAJ,OAAAG,OAAAH,OAAAK,MAAAA,KAAAL,EAAA,CAAA;AAAA,MAAAO;AAAA,SAAAP,SAAAK,MAAlEE,KAAAC,+BAACC,GAAAA,eAAA,EAAqBb,OAAQS,UAAAA,GAAAA,CAAqC,GAAgBL,OAAAK,IAAAL,OAAAO,MAAAA,KAAAP,EAAA,CAAA,GAAnFO;AAAmF;AAG5F,SAASD,cACPI,MACAP,OACAC,WAAW,IACQ;AACnB,SAAIO,QAAAA,mBAAmBD,IAAI,IAAUF,2BAAAA,IAAC,MAAA,CAAA,CAAI,IACtCI,MAAAA,eAAeF,IAAI,IAAUA,OAC1BG,OAAAA,kBAAkBV,OAAOC,QAAQ;AAC1C;ACjBA,MAAMU,uBAAuB,CAAC,SAAS,WAAW,QAAQ,OAAO,GAC3DC,sBAAsB,CAAC,SAAS,OAAO,GACvCC,0BAA0B,CAAC,OAAO,OAAO,KAAK,GAC9CC,sBAAsB,CAAC,WAAW,QAAQ;AAIzC,SAASC,gBAAgBC,MAA+D;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W,GAAGE,eAAe,GAIrFE,kBAAkB,CACtB,OACA,SACA,eACA,YACA,iBACA,iBACA,UACA,WACA,OACA,UACA,SACA,OAAO,GAGHC,iBAAiB,CACrB,iBACA,cACA,YACA,sBACA,aACA,UACA,iBACA,iBACA,WACA,iBACA,kBACA,SACA,QACA,MACA,SACA,QACA,iBACA,aACA,aACA,SACA,uBACA,+BACA,iBACA,mBACA,MACA,MACA,KACA,MACA,MACA,mBACA,aACA,WACA,WACA,OACA,YACA,aACA,OACA,YACA,QACA,gBACA,aACA,UACA,eACA,eACA,iBACA,eACA,aACA,oBACA,gBACA,cACA,gBACA,eACA,MACA,MACA,MACA,MACA,cACA,YACA,iBACA,qBACA,UACA,QACA,MACA,mBACA,MACA,OACA,aACA,KACA,MACA,MACA,MACA,MACA,WACA,aACA,cACA,YACA,QACA,gBACA,kBACA,gBACA,oBACA,kBACA,SACA,cACA,cACA,gBACA,gBACA,eACA,eACA,oBACA,aACA,OACA,QACA,SACA,UACA,QACA,OACA,QACA,cACA,UACA,YACA,WACA,SACA,UACA,eACA,UACA,YACA,eACA,QACA,cACA,uBACA,oBACA,gBACA,UACA,iBACA,uBACA,kBACA,KACA,MACA,MACA,UACA,QACA,QACA,eACA,aACA,WACA,UACA,UACA,SACA,QACA,mBACA,SACA,oBACA,oBACA,gBACA,eACA,gBACA,eACA,cACA,gBACA,oBACA,qBACA,kBACA,mBACA,qBACA,kBACA,UACA,gBACA,SACA,gBACA,kBACA,YACA,eACA,WACA,WACA,aACA,oBACA,eACA,mBACA,kBACA,cACA,QACA,MACA,MACA,WACA,UACA,WACA,cACA,WACA,cACA,iBACA,iBACA,SACA,gBACA,QACA,gBACA,oBACA,oBACA,KACA,MACA,MACA,SACA,KACA,MACA,MACA,KACA,YAAY,GAGRC,eAAuC,CAAC,GAAGD,gBAAgB,GAAGD,eAAe,GAE7EG,SAAS;AAAA,EACbD;AAAAA,EACAH;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA,EAKAK,YAAY;A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AAA,IACJrL;AAAAA,IACAyB;AAAAA,IACA1B;AAAAA,IACAuL,2BAA2BtK;AAAAA,EAAAA,IACzBqK;AACJ,SAAO;AAAA,IACLrL;AAAAA,IACAyB;AAAAA,IACAT,MAAMA,QAAQ;AAAA,IACdjB,MAAM2E,YAAY;AAAA,MAChB3E;AAAAA,MACAC;AAAAA,IAAAA,CACD;AAAA,EAAA;AAEL,CAAC,GAEG0E,cAAe6G,CAAAA,UAA0C;AAC7D,MAAI;AACF,UAAMC,OAAOC,OAAAA,eAAepL,2BAAAA,IAAC,YAAA,EAAW,GAAIkL,OAAM,CAAG;AACrD,WAAOG,mBAAAA,QAAUC,SAASH,KAAKI,KAAAA,GAAQhI,MAAM;AAAA,EAC/C,QAAQ;AACN,WAAO;AAAA,EACT;AACF;ACziBA,eAAeiI,OAAO;AACpB,MAAIC,oBAAAA,gBAAgB,CAACC,oBAAAA;AACnB,UAAM,IAAIC,MAAM,4CAA4C;AAG9D,QAAMC,OAAOC,oBAAAA,YAEPC,UAAUC,uBAAAA,uBAAuBH,KAAKI,OAAO;AAEnD,MAAI;AACF,UAAMC,aAAa,MAAMC,wCAAoB;AAAA,MAAChI,UAAU0H,KAAKI;AAAAA,IAAAA,CAAQ;AAErE,eAAWrI,aAAasI;AACtBP,0BAAAA,YAAYS,YAAYzI,+BAA+BC,SAAS,CAAC;AAAA,EAErE,UAAA;AACE+H,oCAAYU,MAAAA,GACZN,QAAAA;AAAAA,EACF;AACF;AAEKN,KAAAA,EAAOa,KAAK,MAAMC,QAAQC,MAAM;"}
|
|
1
|
+
{"version":3,"file":"extractManifest.cjs","sources":["../../../../src/_internal/manifest/Icon.tsx","../../../../src/_internal/manifest/manifestTypeHelpers.ts","../../../../src/_internal/manifest/purifyConfig.ts","../../../../src/_internal/manifest/extractWorkspaceManifest.tsx","../../../../src/_internal/cli/threads/extractManifest.ts"],"sourcesContent":["import {ThemeProvider} from '@sanity/ui'\nimport {buildTheme} from '@sanity/ui/theme'\nimport {type ComponentType, isValidElement, type ReactNode} from 'react'\nimport {isValidElementType} from 'react-is'\nimport {createDefaultIcon} from 'sanity'\n\nconst theme = buildTheme()\n\ninterface SchemaIconProps {\n icon?: ComponentType | ReactNode\n title: string\n subtitle?: string\n}\n\nconst SchemaIcon = ({icon, title, subtitle}: SchemaIconProps): React.JSX.Element => {\n return <ThemeProvider theme={theme}>{normalizeIcon(icon, title, subtitle)}</ThemeProvider>\n}\n\nfunction normalizeIcon(\n Icon: ComponentType | ReactNode | undefined,\n title: string,\n subtitle = '',\n): React.JSX.Element {\n if (isValidElementType(Icon)) return <Icon />\n if (isValidElement(Icon)) return Icon\n return createDefaultIcon(title, subtitle)\n}\n\nexport {SchemaIcon}\nexport type {SchemaIconProps}\n","import {\n type CrossDatasetReferenceSchemaType,\n type GlobalDocumentReferenceSchemaType,\n type ObjectField,\n type ObjectSchemaType,\n type ReferenceSchemaType,\n type SchemaType,\n} from '@sanity/types'\n\nconst DEFAULT_IMAGE_FIELDS = ['asset', 'hotspot', 'crop', 'media']\nconst DEFAULT_FILE_FIELDS = ['asset', 'media']\nconst DEFAULT_GEOPOINT_FIELDS = ['lat', 'lng', 'alt']\nconst DEFAULT_SLUG_FIELDS = ['current', 'source']\n\ntype InternalOwnProps = {fields?: unknown[]; type?: string; name?: string}\n\nexport function getCustomFields(type: ObjectSchemaType): (ObjectField & {fieldset?: string})[] {\n const fields = type.fieldsets\n ? type.fieldsets.flatMap((fs) => {\n if (fs.single) {\n return fs.field\n }\n return fs.fields.map((field) => ({\n ...field,\n fieldset: fs.name,\n }))\n })\n : type.fields\n\n if (isType(type, 'block')) {\n return []\n }\n if (isType(type, 'slug')) {\n return fields.filter((f) => !DEFAULT_SLUG_FIELDS.includes(f.name))\n }\n if (isType(type, 'geopoint')) {\n return fields.filter((f) => !DEFAULT_GEOPOINT_FIELDS.includes(f.name))\n }\n if (isType(type, 'image')) {\n return fields.filter((f) => !DEFAULT_IMAGE_FIELDS.includes(f.name))\n }\n if (isType(type, 'file')) {\n return fields.filter((f) => !DEFAULT_FILE_FIELDS.includes(f.name))\n }\n return fields\n}\n\nexport function isReference(type: SchemaType): type is ReferenceSchemaType {\n return isType(type, 'reference')\n}\n\nexport function isCrossDatasetReference(type: SchemaType): type is CrossDatasetReferenceSchemaType {\n return isType(type, 'crossDatasetReference')\n}\n\nexport function isGlobalDocumentReference(\n type: SchemaType,\n): type is GlobalDocumentReferenceSchemaType {\n return isType(type, 'globalDocumentReference')\n}\n\nexport function isObjectField(maybeOjectField: unknown): boolean {\n return (\n typeof maybeOjectField === 'object' && maybeOjectField !== null && 'name' in maybeOjectField\n )\n}\n\nexport function isCustomized(maybeCustomized: SchemaType): boolean {\n const internalOwnProps = getSchemaTypeInternalOwnProps(maybeCustomized)\n\n const hasFieldsArray =\n isObjectField(maybeCustomized) &&\n !isReference(maybeCustomized) &&\n !isCrossDatasetReference(maybeCustomized) &&\n !isGlobalDocumentReference(maybeCustomized) &&\n 'fields' in maybeCustomized &&\n Array.isArray(maybeCustomized.fields) &&\n // needed to differentiate inline, named array object types from globally defined types\n // we only consider it customized if the _definition_ has fields declared\n // this holds for all customizable object-like types: object, document, image and file\n internalOwnProps?.fields\n\n if (!hasFieldsArray) {\n return false\n }\n\n const fields = getCustomFields(maybeCustomized)\n return !!fields.length\n}\n\nexport function isType(schemaType: SchemaType, typeName: string): boolean {\n if (schemaType.name === typeName) {\n return true\n }\n if (!schemaType.type) {\n return false\n }\n return isType(schemaType.type, typeName)\n}\n\nexport function isDefined<T>(value: T | null | undefined): value is T {\n return value !== null && value !== undefined\n}\n\nexport function isRecord(value: unknown): value is Record<string, unknown> {\n return !!value && typeof value === 'object'\n}\n\nexport function isPrimitive(value: unknown): value is string | boolean | number {\n return isString(value) || isBoolean(value) || isNumber(value)\n}\n\nexport function isString(value: unknown): value is string {\n return typeof value === 'string'\n}\n\nfunction isNumber(value: unknown): value is number {\n return typeof value === 'boolean'\n}\n\nfunction isBoolean(value: unknown): value is boolean {\n return typeof value === 'number'\n}\n\n/**\n * _internal_ownProps contains the _definition_ for the type.\n * Without it we cannot differentiate inline array item types from globally defined types in array.of\n */\nexport function getSchemaTypeInternalOwnProps(type: SchemaType): InternalOwnProps | undefined {\n return (type as {_internal_ownProps?: InternalOwnProps})?._internal_ownProps\n}\n\n/**\n * This allows us to differentiate inline array.of type definitions vs global type names on compiled schema types\n */\nexport function getDefinedTypeName(type: SchemaType): string | undefined {\n return getSchemaTypeInternalOwnProps(type)?.type\n}\n","import {type Config} from 'isomorphic-dompurify'\n\n/**\n * This file maintains our sanitization configuration for DOMPurify.\n * We use an allowlist for tags and attributes to ensure that only safe\n * elements and attributes are allowed.\n *\n * This is easier to loosen as specs develop & use-cases are discovered.\n */\n\n///////// Tags\n\nconst HTML_TAGS = ['img', 'style']\n\nconst SVG_TAGS = [\n 'svg',\n 'a',\n 'altglyph',\n 'altglyphdef',\n 'altglyphitem',\n 'animatecolor',\n 'animatemotion',\n 'animatetransform',\n 'circle',\n 'clippath',\n 'defs',\n 'desc',\n 'ellipse',\n 'filter',\n 'font',\n 'g',\n 'glyph',\n 'glyphref',\n 'hkern',\n 'image',\n 'line',\n 'lineargradient',\n 'marker',\n 'mask',\n 'metadata',\n 'mpath',\n 'path',\n 'pattern',\n 'polygon',\n 'polyline',\n 'radialgradient',\n 'rect',\n 'stop',\n 'style',\n 'switch',\n 'symbol',\n 'text',\n 'textpath',\n 'title',\n 'tref',\n 'tspan',\n 'view',\n 'vkern',\n] as const\n\nconst SVG_FILTER_TAGS = [\n 'feBlend',\n 'feColorMatrix',\n 'feComponentTransfer',\n 'feComposite',\n 'feConvolveMatrix',\n 'feDiffuseLighting',\n 'feDisplacementMap',\n 'feDistantLight',\n 'feDropShadow',\n 'feFlood',\n 'feFuncA',\n 'feFuncB',\n 'feFuncG',\n 'feFuncR',\n 'feGaussianBlur',\n 'feImage',\n 'feMerge',\n 'feMergeNode',\n 'feMorphology',\n 'feOffset',\n 'fePointLight',\n 'feSpecularLighting',\n 'feSpotLight',\n 'feTile',\n 'feTurbulence',\n] as const\n\nconst ALLOWED_TAGS: Config['ALLOWED_TAGS'] = [...SVG_TAGS, ...HTML_TAGS, ...SVG_FILTER_TAGS]\n\n///////// Attributes\n\nconst HTML_ATTRIBUTES = [\n 'alt',\n 'class',\n 'crossorigin',\n 'decoding',\n 'elementtiming',\n 'fetchpriority',\n 'height',\n 'loading',\n 'src',\n 'srcset',\n 'style',\n 'width',\n]\n\nconst SVG_ATTRIBUTES = [\n 'accent-height',\n 'accumulate',\n 'additive',\n 'alignment-baseline',\n 'amplitude',\n 'ascent',\n 'attributename',\n 'attributetype',\n 'azimuth',\n 'basefrequency',\n 'baseline-shift',\n 'begin',\n 'bias',\n 'by',\n 'class',\n 'clip',\n 'clippathunits',\n 'clip-path',\n 'clip-rule',\n 'color',\n 'color-interpolation',\n 'color-interpolation-filters',\n 'color-profile',\n 'color-rendering',\n 'cx',\n 'cy',\n 'd',\n 'dx',\n 'dy',\n 'diffuseconstant',\n 'direction',\n 'display',\n 'divisor',\n 'dur',\n 'edgemode',\n 'elevation',\n 'end',\n 'exponent',\n 'fill',\n 'fill-opacity',\n 'fill-rule',\n 'filter',\n 'filterunits',\n 'flood-color',\n 'flood-opacity',\n 'font-family',\n 'font-size',\n 'font-size-adjust',\n 'font-stretch',\n 'font-style',\n 'font-variant',\n 'font-weight',\n 'fx',\n 'fy',\n 'g1',\n 'g2',\n 'glyph-name',\n 'glyphref',\n 'gradientunits',\n 'gradienttransform',\n 'height',\n 'href',\n 'id',\n 'image-rendering',\n 'in',\n 'in2',\n 'intercept',\n 'k',\n 'k1',\n 'k2',\n 'k3',\n 'k4',\n 'kerning',\n 'keypoints',\n 'keysplines',\n 'keytimes',\n 'lang',\n 'lengthadjust',\n 'letter-spacing',\n 'kernelmatrix',\n 'kernelunitlength',\n 'lighting-color',\n 'local',\n 'marker-end',\n 'marker-mid',\n 'marker-start',\n 'markerheight',\n 'markerunits',\n 'markerwidth',\n 'maskcontentunits',\n 'maskunits',\n 'max',\n 'mask',\n 'media',\n 'method',\n 'mode',\n 'min',\n 'name',\n 'numoctaves',\n 'offset',\n 'operator',\n 'opacity',\n 'order',\n 'orient',\n 'orientation',\n 'origin',\n 'overflow',\n 'paint-order',\n 'path',\n 'pathlength',\n 'patterncontentunits',\n 'patterntransform',\n 'patternunits',\n 'points',\n 'preservealpha',\n 'preserveaspectratio',\n 'primitiveunits',\n 'r',\n 'rx',\n 'ry',\n 'radius',\n 'refx',\n 'refy',\n 'repeatcount',\n 'repeatdur',\n 'restart',\n 'result',\n 'rotate',\n 'scale',\n 'seed',\n 'shape-rendering',\n 'slope',\n 'specularconstant',\n 'specularexponent',\n 'spreadmethod',\n 'startoffset',\n 'stddeviation',\n 'stitchtiles',\n 'stop-color',\n 'stop-opacity',\n 'stroke-dasharray',\n 'stroke-dashoffset',\n 'stroke-linecap',\n 'stroke-linejoin',\n 'stroke-miterlimit',\n 'stroke-opacity',\n 'stroke',\n 'stroke-width',\n 'style',\n 'surfacescale',\n 'systemlanguage',\n 'tabindex',\n 'tablevalues',\n 'targetx',\n 'targety',\n 'transform',\n 'transform-origin',\n 'text-anchor',\n 'text-decoration',\n 'text-rendering',\n 'textlength',\n 'type',\n 'u1',\n 'u2',\n 'unicode',\n 'values',\n 'viewbox',\n 'visibility',\n 'version',\n 'vert-adv-y',\n 'vert-origin-x',\n 'vert-origin-y',\n 'width',\n 'word-spacing',\n 'wrap',\n 'writing-mode',\n 'xchannelselector',\n 'ychannelselector',\n 'x',\n 'x1',\n 'x2',\n 'xmlns',\n 'y',\n 'y1',\n 'y2',\n 'z',\n 'zoomandpan',\n] as const\n\nconst ALLOWED_ATTR: Config['ALLOWED_ATTR'] = [...SVG_ATTRIBUTES, ...HTML_ATTRIBUTES]\n\nconst config = {\n ALLOWED_ATTR,\n ALLOWED_TAGS,\n} satisfies Config\n\nexport {config}\n","import DOMPurify from 'isomorphic-dompurify'\nimport {startCase} from 'lodash-es'\nimport {renderToString} from 'react-dom/server'\nimport {\n type ArraySchemaType,\n type BlockDefinition,\n type BooleanSchemaType,\n ConcreteRuleClass,\n createSchema,\n type CrossDatasetReferenceSchemaType,\n type FileSchemaType,\n type GlobalDocumentReferenceSchemaType,\n type MultiFieldSet,\n type NumberSchemaType,\n type ObjectField,\n type ObjectSchemaType,\n type ReferenceSchemaType,\n type Rule,\n type RuleSpec,\n type Schema,\n type SchemaType,\n type SchemaValidationValue,\n type SpanSchemaType,\n type StringSchemaType,\n type Workspace,\n} from 'sanity'\n\nimport {SchemaIcon, type SchemaIconProps} from './Icon'\nimport {\n getCustomFields,\n getDefinedTypeName,\n isCrossDatasetReference,\n isCustomized,\n isDefined,\n isGlobalDocumentReference,\n isPrimitive,\n isRecord,\n isReference,\n isString,\n isType,\n} from './manifestTypeHelpers'\nimport {\n type CreateWorkspaceManifest,\n type ManifestField,\n type ManifestFieldset,\n type ManifestSchemaType,\n type ManifestSerializable,\n type ManifestTitledValue,\n type ManifestTool,\n type ManifestValidationGroup,\n type ManifestValidationRule,\n} from './manifestTypes'\nimport {config} from './purifyConfig'\n\ninterface Context {\n schema: Schema\n}\n\ntype SchemaTypeKey =\n | keyof ArraySchemaType\n | keyof BooleanSchemaType\n | keyof FileSchemaType\n | keyof NumberSchemaType\n | keyof ObjectSchemaType\n | keyof StringSchemaType\n | keyof ReferenceSchemaType\n | keyof BlockDefinition\n | 'group' // we strip this from fields\n\ntype Validation = {validation: ManifestValidationGroup[]} | Record<string, never>\ntype ObjectFields = {fields: ManifestField[]} | Record<string, never>\ntype SerializableProp = ManifestSerializable | ManifestSerializable[] | undefined\ntype ManifestValidationFlag = ManifestValidationRule['flag']\ntype ValidationRuleTransformer = (rule: RuleSpec) => ManifestValidationRule | undefined\n\nconst MAX_CUSTOM_PROPERTY_DEPTH = 5\n\nexport function extractCreateWorkspaceManifest(workspace: Workspace): CreateWorkspaceManifest {\n const serializedSchema = extractManifestSchemaTypes(workspace.schema)\n const serializedTools = extractManifestTools(workspace.tools)\n\n return {\n name: workspace.name,\n title: workspace.title,\n subtitle: workspace.subtitle,\n basePath: workspace.basePath,\n projectId: workspace.projectId,\n dataset: workspace.dataset,\n icon: resolveIcon({\n icon: workspace.icon,\n title: workspace.title,\n subtitle: workspace.subtitle,\n }),\n mediaLibrary: workspace.mediaLibrary,\n schema: serializedSchema,\n tools: serializedTools,\n }\n}\n\n/**\n * Extracts all serializable properties from userland schema types,\n * so they best-effort can be used as definitions for Schema.compile\n. */\nexport function extractManifestSchemaTypes(schema: Schema): ManifestSchemaType[] {\n const typeNames = schema.getTypeNames()\n const context = {schema}\n\n const studioDefaultTypeNames = createSchema({name: 'default', types: []}).getTypeNames()\n\n return typeNames\n .filter((typeName) => !studioDefaultTypeNames.includes(typeName))\n .map((typeName) => schema.get(typeName))\n .filter((type): type is SchemaType => typeof type !== 'undefined')\n .map((type) => transformType(type, context))\n}\n\nfunction transformCommonTypeFields(\n type: SchemaType & {fieldset?: string},\n typeName: string,\n context: Context,\n): Omit<ManifestSchemaType, 'name' | 'title' | 'type'> {\n const arrayProps =\n typeName === 'array' && type.jsonType === 'array' ? transformArrayMember(type, context) : {}\n\n const referenceProps = isReference(type) ? transformReference(type) : {}\n const crossDatasetRefProps = isCrossDatasetReference(type)\n ? transformCrossDatasetReference(type)\n : {}\n const globalRefProps = isGlobalDocumentReference(type)\n ? transformGlobalDocumentReference(type)\n : {}\n\n const objectFields: ObjectFields =\n type.jsonType === 'object' && type.type && isCustomized(type)\n ? {\n fields: getCustomFields(type).map((objectField) => transformField(objectField, context)),\n }\n : {}\n\n return {\n ...retainCustomTypeProps(type),\n ...transformValidation(type.validation),\n ...ensureString('description', type.description),\n ...objectFields,\n ...arrayProps,\n ...referenceProps,\n ...crossDatasetRefProps,\n ...globalRefProps,\n ...ensureConditional('readOnly', type.readOnly),\n ...ensureConditional('hidden', type.hidden),\n ...transformFieldsets(type),\n // fieldset prop gets instrumented via getCustomFields\n ...ensureString('fieldset', type.fieldset),\n ...transformBlockType(type, context),\n }\n}\n\nfunction transformFieldsets(\n type: SchemaType,\n): {fieldsets: ManifestFieldset[]} | Record<string, never> {\n if (type.jsonType !== 'object') {\n return {}\n }\n const fieldsets = type.fieldsets\n ?.filter((fs): fs is MultiFieldSet => !fs.single)\n .map((fs) => {\n const options = isRecord(fs.options) ? {options: retainSerializableProps(fs.options)} : {}\n return {\n name: fs.name,\n ...ensureCustomTitle(fs.name, fs.title),\n ...ensureString('description', fs.description),\n ...ensureConditional('readOnly', fs.readOnly),\n ...ensureConditional('hidden', fs.hidden),\n ...options,\n }\n })\n\n return fieldsets?.length ? {fieldsets} : {}\n}\n\nfunction transformType(type: SchemaType, context: Context): ManifestSchemaType {\n const typeName = type.type ? type.type.name : type.jsonType\n\n return {\n ...transformCommonTypeFields(type, typeName, context),\n name: type.name,\n type: typeName,\n ...ensureCustomTitle(type.name, type.title),\n }\n}\n\nfunction retainCustomTypeProps(type: SchemaType): Record<string, SerializableProp> {\n const manuallySerializedFields: SchemaTypeKey[] = [\n //explicitly added\n 'name',\n 'title',\n 'description',\n 'readOnly',\n 'hidden',\n 'validation',\n 'fieldsets',\n 'fields',\n 'to',\n 'of',\n // not serialized\n 'type',\n 'jsonType',\n '__experimental_actions',\n '__experimental_formPreviewTitle',\n '__experimental_omnisearch_visibility',\n '__experimental_search',\n 'components',\n 'icon',\n 'orderings',\n 'preview',\n 'groups',\n //only exists on fields\n 'group',\n // we know about these, but let them be generically handled\n // deprecated\n // rows (from text)\n // initialValue\n // options\n // crossDatasetReference props\n ]\n const typeWithoutManuallyHandledFields = Object.fromEntries(\n Object.entries(type).filter(\n ([key]) => !manuallySerializedFields.includes(key as unknown as SchemaTypeKey),\n ),\n )\n return retainSerializableProps(typeWithoutManuallyHandledFields) as Record<\n string,\n SerializableProp\n >\n}\n\nfunction retainSerializableProps(maybeSerializable: unknown, depth = 0): SerializableProp {\n if (depth > MAX_CUSTOM_PROPERTY_DEPTH) {\n return undefined\n }\n\n if (!isDefined(maybeSerializable)) {\n return undefined\n }\n\n if (isPrimitive(maybeSerializable)) {\n // cull empty strings\n if (maybeSerializable === '') {\n return undefined\n }\n return maybeSerializable\n }\n\n // url-schemes ect..\n if (maybeSerializable instanceof RegExp) {\n return maybeSerializable.toString()\n }\n\n if (Array.isArray(maybeSerializable)) {\n const arrayItems = maybeSerializable\n .map((item) => retainSerializableProps(item, depth + 1))\n .filter((item): item is ManifestSerializable => isDefined(item))\n return arrayItems.length ? arrayItems : undefined\n }\n\n if (isRecord(maybeSerializable)) {\n const serializableEntries = Object.entries(maybeSerializable)\n .map(([key, value]) => {\n return [key, retainSerializableProps(value, depth + 1)]\n })\n .filter(([, value]) => isDefined(value))\n return serializableEntries.length ? Object.fromEntries(serializableEntries) : undefined\n }\n\n return undefined\n}\n\nfunction transformField(field: ObjectField & {fieldset?: string}, context: Context): ManifestField {\n const fieldType = field.type\n const typeName = getDefinedTypeName(fieldType) ?? fieldType.name\n return {\n ...transformCommonTypeFields(fieldType, typeName, context),\n name: field.name,\n type: typeName,\n ...ensureCustomTitle(field.name, fieldType.title),\n // this prop gets added synthetically via getCustomFields\n ...ensureString('fieldset', field.fieldset),\n }\n}\n\nfunction transformArrayMember(\n arrayMember: ArraySchemaType,\n context: Context,\n): Pick<ManifestField, 'of'> {\n return {\n of: arrayMember.of.map((type) => {\n const typeName = getDefinedTypeName(type) ?? type.name\n return {\n ...transformCommonTypeFields(type, typeName, context),\n type: typeName,\n ...(typeName === type.name ? {} : {name: type.name}),\n ...ensureCustomTitle(type.name, type.title),\n }\n }),\n }\n}\n\nfunction transformReference(reference: ReferenceSchemaType): Pick<ManifestSchemaType, 'to'> {\n return {\n to: (reference.to ?? []).map((type) => {\n return {\n ...retainCustomTypeProps(type),\n type: type.name,\n }\n }),\n }\n}\n\nfunction transformCrossDatasetReference(\n reference: CrossDatasetReferenceSchemaType,\n): Pick<ManifestSchemaType, 'to' | 'preview'> {\n return {\n to: (reference.to ?? []).map((crossDataset) => {\n const preview = crossDataset.preview?.select\n ? {preview: {select: crossDataset.preview.select}}\n : {}\n return {\n type: crossDataset.type,\n ...ensureCustomTitle(crossDataset.type, crossDataset.title),\n ...preview,\n }\n }),\n }\n}\n\nfunction transformGlobalDocumentReference(\n reference: GlobalDocumentReferenceSchemaType,\n): Pick<ManifestSchemaType, 'to' | 'preview'> {\n return {\n to: (reference.to ?? []).map((crossDataset) => {\n const preview = crossDataset.preview?.select\n ? {preview: {select: crossDataset.preview.select}}\n : {}\n return {\n type: crossDataset.type,\n ...ensureCustomTitle(crossDataset.type, crossDataset.title),\n ...preview,\n }\n }),\n }\n}\n\nconst transformTypeValidationRule: ValidationRuleTransformer = (rule) => {\n return {\n ...rule,\n constraint:\n 'constraint' in rule &&\n (typeof rule.constraint === 'string'\n ? rule.constraint.toLowerCase()\n : retainSerializableProps(rule.constraint)),\n }\n}\n\nconst validationRuleTransformers: Partial<\n Record<ManifestValidationFlag, ValidationRuleTransformer>\n> = {\n type: transformTypeValidationRule,\n}\n\nfunction transformValidation(validation: SchemaValidationValue): Validation {\n const validationArray = (Array.isArray(validation) ? validation : [validation]).filter(\n (value): value is Rule => typeof value === 'object' && '_type' in value,\n )\n\n // we dont want type in the output as that is implicitly given by the typedef itself an will only bloat the payload\n const disallowedFlags = ['type']\n\n // Validation rules that refer to other fields use symbols, which cannot be serialized. It would\n // be possible to transform these to a serializable type, but we haven't implemented that for now.\n const disallowedConstraintTypes: (symbol | unknown)[] = [ConcreteRuleClass.FIELD_REF]\n\n const serializedValidation = validationArray\n .map(({_rules, _message, _level}) => {\n const message: Partial<Pick<ManifestValidationGroup, 'message'>> =\n typeof _message === 'string' ? {message: _message} : {}\n\n const serializedRules = _rules\n .filter((rule) => {\n if (!('constraint' in rule)) {\n return false\n }\n\n const {flag, constraint} = rule\n\n if (disallowedFlags.includes(flag)) {\n return false\n }\n\n return !(\n typeof constraint === 'object' &&\n 'type' in constraint &&\n disallowedConstraintTypes.includes(constraint.type)\n )\n })\n .reduce<ManifestValidationRule[]>((rules, rule) => {\n const transformer: ValidationRuleTransformer =\n validationRuleTransformers[rule.flag] ??\n ((spec) => retainSerializableProps(spec) as ManifestValidationRule)\n\n const transformedRule = transformer(rule)\n if (!transformedRule) {\n return rules\n }\n return [...rules, transformedRule]\n }, [])\n\n return {\n rules: serializedRules,\n level: _level,\n ...message,\n }\n })\n .filter((group) => !!group.rules.length)\n\n return serializedValidation.length ? {validation: serializedValidation} : {}\n}\n\nfunction ensureCustomTitle(typeName: string, value: unknown) {\n const titleObject = ensureString('title', value)\n\n const defaultTitle = startCase(typeName)\n // omit title if its the same as default, to reduce payload\n if (titleObject.title === defaultTitle) {\n return {}\n }\n return titleObject\n}\n\nfunction ensureString<Key extends string>(key: Key, value: unknown) {\n if (typeof value === 'string') {\n return {\n [key]: value,\n }\n }\n\n return {}\n}\n\nfunction ensureConditional<const Key extends string>(key: Key, value: unknown) {\n if (typeof value === 'boolean') {\n return {\n [key]: value,\n }\n }\n\n if (typeof value === 'function') {\n return {\n [key]: 'conditional',\n }\n }\n\n return {}\n}\n\nexport function transformBlockType(\n blockType: SchemaType,\n context: Context,\n): Pick<ManifestSchemaType, 'marks' | 'lists' | 'styles' | 'of'> | Record<string, never> {\n if (blockType.jsonType !== 'object' || !isType(blockType, 'block')) {\n return {}\n }\n\n const childrenField = blockType.fields?.find((field) => field.name === 'children') as\n | {type: ArraySchemaType}\n | undefined\n\n if (!childrenField) {\n return {}\n }\n const ofType = childrenField.type.of\n if (!ofType) {\n return {}\n }\n const spanType = ofType.find((memberType) => memberType.name === 'span') as\n | ObjectSchemaType\n | undefined\n if (!spanType) {\n return {}\n }\n const inlineObjectTypes = (ofType.filter((memberType) => memberType.name !== 'span') ||\n []) as ObjectSchemaType[]\n\n return {\n marks: {\n annotations: (spanType as SpanSchemaType).annotations.map((t) => transformType(t, context)),\n decorators: resolveEnabledDecorators(spanType),\n },\n lists: resolveEnabledListItems(blockType),\n styles: resolveEnabledStyles(blockType),\n of: inlineObjectTypes.map((t) => transformType(t, context)),\n }\n}\n\nfunction resolveEnabledStyles(blockType: ObjectSchemaType): ManifestTitledValue[] | undefined {\n const styleField = blockType.fields?.find((btField) => btField.name === 'style')\n return resolveTitleValueArray(styleField?.type?.options?.list)\n}\n\nfunction resolveEnabledDecorators(spanType: ObjectSchemaType): ManifestTitledValue[] | undefined {\n return 'decorators' in spanType ? resolveTitleValueArray(spanType.decorators) : undefined\n}\n\nfunction resolveEnabledListItems(blockType: ObjectSchemaType): ManifestTitledValue[] | undefined {\n const listField = blockType.fields?.find((btField) => btField.name === 'listItem')\n return resolveTitleValueArray(listField?.type?.options?.list)\n}\n\nfunction resolveTitleValueArray(possibleArray: unknown): ManifestTitledValue[] | undefined {\n if (!possibleArray || !Array.isArray(possibleArray)) {\n return undefined\n }\n const titledValues = possibleArray\n .filter(\n (d): d is {value: string; title?: string} => isRecord(d) && !!d.value && isString(d.value),\n )\n .map((item) => {\n return {\n value: item.value,\n ...ensureString('title', item.title),\n } satisfies ManifestTitledValue\n })\n if (!titledValues?.length) {\n return undefined\n }\n\n return titledValues\n}\n\nconst extractManifestTools = (tools: Workspace['tools']): ManifestTool[] =>\n tools.map((tool) => {\n const {\n title,\n name,\n icon,\n __internalApplicationType: type,\n } = tool as Workspace['tools'][number] & {__internalApplicationType: string}\n return {\n title,\n name,\n type: type || null,\n icon: resolveIcon({\n icon,\n title,\n }),\n } satisfies ManifestTool\n })\n\nconst resolveIcon = (props: SchemaIconProps): string | null => {\n try {\n const html = renderToString(<SchemaIcon {...props} />)\n return DOMPurify.sanitize(html.trim(), config)\n } catch {\n return null\n }\n}\n","import {isMainThread, parentPort, workerData as _workerData} from 'node:worker_threads'\n\nimport {extractCreateWorkspaceManifest} from '../../manifest/extractWorkspaceManifest'\nimport {getStudioWorkspaces} from '../util/getStudioWorkspaces'\nimport {mockBrowserEnvironment} from '../util/mockBrowserEnvironment'\n\n/** @internal */\nexport interface ExtractManifestWorkerData {\n workDir: string\n}\n\nasync function main() {\n if (isMainThread || !parentPort) {\n throw new Error('This module must be run as a worker thread')\n }\n\n const opts = _workerData as ExtractManifestWorkerData\n\n const cleanup = mockBrowserEnvironment(opts.workDir)\n\n try {\n const workspaces = await getStudioWorkspaces({basePath: opts.workDir})\n\n for (const workspace of workspaces) {\n parentPort?.postMessage(extractCreateWorkspaceManifest(workspace))\n }\n } finally {\n parentPort?.close()\n cleanup()\n }\n}\n\nvoid main().then(() => process.exit())\n"],"names":["theme","buildTheme","SchemaIcon","t0","$","_c","icon","title","subtitle","t1","normalizeIcon","t2","jsx","ThemeProvider","Icon","isValidElementType","isValidElement","createDefaultIcon","DEFAULT_IMAGE_FIELDS","DEFAULT_FILE_FIELDS","DEFAULT_GEOPOINT_FIELDS","DEFAULT_SLUG_FIELDS","getCustomFields","type","fields","fieldsets","flatMap","fs","single","field","map","fieldset","name","isType","filter","f","includes","isReference","isCrossDatasetReference","isGlobalDocumentReference","isObjectField","maybeOjectField","isCustomized","maybeCustomized","internalOwnProps","getSchemaTypeInternalOwnProps","Array","isArray","length","schemaType","typeName","isDefined","value","isRecord","isPrimitive","isString","isBoolean","isNumber","_internal_ownProps","getDefinedTypeName","HTML_TAGS","SVG_TAGS","SVG_FILTER_TAGS","ALLOWED_TAGS","HTML_ATTRIBUTES","SVG_ATTRIBUTES","ALLOWED_ATTR","config","MAX_CUSTOM_PROPERTY_DEPTH","extractCreateWorkspaceManifest","workspace","serializedSchema","extractManifestSchemaTypes","schema","serializedTools","extractManifestTools","tools","basePath","projectId","dataset","resolveIcon","mediaLibrary","typeNames","getTypeNames","studioDefaultTypeNames","createSchema","types","get","transformType","transformCommonTypeFields","context","arrayProps","jsonType","transformArrayMember","referenceProps","transformReference","crossDatasetRefProps","transformCrossDatasetReference","globalRefProps","transformGlobalDocumentReference","objectFields","objectField","transformField","retainCustomTypeProps","transformValidation","validation","ensureString","description","ensureConditional","readOnly","hidden","transformFieldsets","transformBlockType","options","retainSerializableProps","ensureCustomTitle","manuallySerializedFields","typeWithoutManuallyHandledFields","Object","fromEntries","entries","key","maybeSerializable","depth","RegExp","toString","arrayItems","item","undefined","serializableEntries","fieldType","arrayMember","of","reference","to","crossDataset","preview","select","transformTypeValidationRule","rule","constraint","toLowerCase","validationRuleTransformers","validationArray","disallowedFlags","disallowedConstraintTypes","ConcreteRuleClass","FIELD_REF","serializedValidation","_rules","_message","_level","message","rules","flag","reduce","transformedRule","spec","level","group","titleObject","defaultTitle","startCase","blockType","childrenField","find","ofType","spanType","memberType","inlineObjectTypes","marks","annotations","t","decorators","resolveEnabledDecorators","lists","resolveEnabledListItems","styles","resolveEnabledStyles","styleField","btField","resolveTitleValueArray","list","listField","possibleArray","titledValues","d","tool","__internalApplicationType","props","html","renderToString","DOMPurify","sanitize","trim","main","isMainThread","parentPort","Error","opts","_workerData","cleanup","mockBrowserEnvironment","workDir","workspaces","getStudioWorkspaces","postMessage","close","then","process","exit"],"mappings":";;;;;;AAMA,MAAMA,QAAQC,QAAAA,WAAAA,GAQRC,aAAaC,CAAAA,OAAA;AAAA,QAAAC,IAAAC,kBAAA,CAAA,GAAC;AAAA,IAAAC;AAAAA,IAAAC;AAAAA,IAAAC;AAAAA,EAAAA,IAAAL;AAAwC,MAAAM;AAAAL,IAAA,CAAA,MAAAE,QAAAF,SAAAI,YAAAJ,EAAA,CAAA,MAAAG,SACrBE,KAAAC,cAAcJ,MAAMC,OAAOC,QAAQ,GAACJ,OAAAE,MAAAF,OAAAI,UAAAJ,OAAAG,OAAAH,OAAAK,MAAAA,KAAAL,EAAA,CAAA;AAAA,MAAAO;AAAA,SAAAP,SAAAK,MAAlEE,KAAAC,+BAACC,GAAAA,eAAA,EAAqBb,OAAQS,UAAAA,GAAAA,CAAqC,GAAgBL,OAAAK,IAAAL,OAAAO,MAAAA,KAAAP,EAAA,CAAA,GAAnFO;AAAmF;AAG5F,SAASD,cACPI,MACAP,OACAC,WAAW,IACQ;AACnB,SAAIO,QAAAA,mBAAmBD,IAAI,IAAUF,2BAAAA,IAAC,MAAA,CAAA,CAAI,IACtCI,MAAAA,eAAeF,IAAI,IAAUA,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,UACA,QACA,YACA,SACA,QACA,SACA,QACA,OAAO,GAGHC,kBAAkB,CACtB,WACA,iBACA,uBACA,eACA,oBACA,qBACA,qBACA,kBACA,gBACA,WACA,WACA,WACA,WACA,WACA,kBACA,WACA,WACA,eACA,gBACA,YACA,gBACA,sBACA,eACA,UACA,cAAc,GAGVC,eAAuC,CAAC,GAAGF,UAAU,GAAGD,WAAW,GAAGE,eAAe,GAIrFE,kBAAkB,CACtB,OACA,SACA,eACA,YACA,iBACA,iBACA,UACA,WACA,OACA,UACA,SACA,OAAO,GAGHC,iBAAiB,CACrB,iBACA,cACA,YACA,sBACA,aACA,UACA,iBACA,iBACA,WACA,iBACA,kBACA,SACA,QACA,MACA,SACA,QACA,iBACA,aACA,aACA,SACA,uBACA,+BACA,iBACA,mBACA,MACA,MACA,KACA,MACA,MACA,mBACA,aACA,WACA,WACA,OACA,YACA,aACA,OACA,YACA,QACA,gBACA,aACA,UACA,eACA,eACA,iBACA,eACA,aACA,oBACA,gBACA,cACA,gBACA,eACA,MACA,MACA,MACA,MACA,cACA,YACA,iBACA,qBACA,UACA,QACA,MACA,mBACA,MACA,OACA,aACA,KACA,MACA,MACA,MACA,MACA,WACA,aACA,cACA,YACA,QACA,gBACA,kBACA,gBACA,oBACA,kBACA,SACA,cACA,cACA,gBACA,gBACA,eACA,eACA,oBACA,aACA,OACA,QACA,SACA,UACA,QACA,OACA,QACA,cACA,UACA,YACA,WACA,SACA,UACA,eACA,UACA,YACA,eACA,QACA,cACA,uBACA,oBACA,gBACA,UACA,iBACA,uBACA,kBACA,KACA,MACA,MACA,UACA,QACA,QACA,eACA,aACA,WACA,UACA,UACA,SACA,QACA,mBACA,SACA,oBACA,oBACA,gBACA,eACA,gBACA,eACA,cACA,gBACA,oBACA,qBACA,kBACA,mBACA,qBACA,kBACA,UACA,gBACA,SACA,gBACA,kBACA,YACA,eACA,WACA,WACA,aACA,oBACA,eACA,mBACA,kBACA,cACA,QACA,MACA,MACA,WACA,UACA,WACA,cAC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viewUrlResolver<SanityClient>
|
|
|
3886
3886
|
|
|
3887
3887
|
declare type DialogMode = 'card' | 'help_menu'
|
|
3888
3888
|
|
|
3889
|
+
/**
|
|
3890
|
+
* Context for tracking the stack of open dialogs.
|
|
3891
|
+
*
|
|
3892
|
+
* @beta
|
|
3893
|
+
*/
|
|
3894
|
+
export declare const DialogStackContext: Context<DialogStackContextValue | null>
|
|
3895
|
+
|
|
3896
|
+
/**
|
|
3897
|
+
* Context value for tracking the dialog stack.
|
|
3898
|
+
*
|
|
3899
|
+
* @beta
|
|
3900
|
+
*/
|
|
3901
|
+
export declare interface DialogStackContextValue {
|
|
3902
|
+
/** Stack of dialog entries, last one is the top */
|
|
3903
|
+
stack: DialogStackEntry[]
|
|
3904
|
+
/** Push a dialog onto the stack */
|
|
3905
|
+
push: (id: string, path?: Path) => void
|
|
3906
|
+
/** Remove a dialog from the stack */
|
|
3907
|
+
remove: (id: string) => void
|
|
3908
|
+
/** Update the path of an existing dialog entry */
|
|
3909
|
+
update: (id: string, path?: Path) => void
|
|
3910
|
+
/** Close dialogs (might not close all of them, depending on fullscreen mode) */
|
|
3911
|
+
close: () => void
|
|
3912
|
+
}
|
|
3913
|
+
|
|
3914
|
+
/**
|
|
3915
|
+
* Entry in the dialog stack.
|
|
3916
|
+
*
|
|
3917
|
+
* @beta
|
|
3918
|
+
*/
|
|
3919
|
+
export declare interface DialogStackEntry {
|
|
3920
|
+
id: string
|
|
3921
|
+
path?: Path
|
|
3922
|
+
}
|
|
3923
|
+
|
|
3889
3924
|
/** @internal */
|
|
3890
3925
|
export declare const DiffContext: Context<{
|
|
3891
3926
|
path: Path
|
|
@@ -6108,10 +6143,6 @@ declare interface EnhancedObjectDialogContextValue {
|
|
|
6108
6143
|
* A boolean indicating whether tree editing is enabled
|
|
6109
6144
|
*/
|
|
6110
6145
|
enabled: boolean
|
|
6111
|
-
/**
|
|
6112
|
-
* A boolean indicating whether the EnhancedObjectDialog component is available in this tree to handle paths
|
|
6113
|
-
*/
|
|
6114
|
-
isDialogAvailable: boolean
|
|
6115
6146
|
/**
|
|
6116
6147
|
* A boolean indicating whether legacy editing is enabled - meaning that it will use the old modal based editing experience
|
|
6117
6148
|
*/
|
|
@@ -9534,16 +9565,6 @@ declare interface ObjectInputProps<
|
|
|
9534
9565
|
* @hidden
|
|
9535
9566
|
* @beta */
|
|
9536
9567
|
elementProps: ComplexElementProps
|
|
9537
|
-
/**
|
|
9538
|
-
* @deprecated – DO NOT USE
|
|
9539
|
-
*
|
|
9540
|
-
* The node for the array editing modal.
|
|
9541
|
-
* This node renders the array editing modal as a child of the root input.
|
|
9542
|
-
* It is necessary for the array editing dialog to be a child of the root input
|
|
9543
|
-
* because the root input may be wrapped in a React context using the Components API,
|
|
9544
|
-
* which is utilized by inputs in the form.
|
|
9545
|
-
*/
|
|
9546
|
-
__internal_enhancedbjectDialog?: ReactNode
|
|
9547
9568
|
}
|
|
9548
9569
|
|
|
9549
9570
|
/**
|
|
@@ -9626,16 +9647,6 @@ declare interface ObjectInputProps_2<
|
|
|
9626
9647
|
* @hidden
|
|
9627
9648
|
* @beta */
|
|
9628
9649
|
elementProps: ComplexElementProps_2
|
|
9629
|
-
/**
|
|
9630
|
-
* @deprecated – DO NOT USE
|
|
9631
|
-
*
|
|
9632
|
-
* The node for the array editing modal.
|
|
9633
|
-
* This node renders the array editing modal as a child of the root input.
|
|
9634
|
-
* It is necessary for the array editing dialog to be a child of the root input
|
|
9635
|
-
* because the root input may be wrapped in a React context using the Components API,
|
|
9636
|
-
* which is utilized by inputs in the form.
|
|
9637
|
-
*/
|
|
9638
|
-
__internal_enhancedbjectDialog?: ReactNode
|
|
9639
9650
|
}
|
|
9640
9651
|
|
|
9641
9652
|
/** @public */
|