@driftime/sanity-plugin-icon 0.4.3 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. package/README.md +2 -0
  2. package/dist/{adapters-Bx_MyEX_.js → adapters-Dw6yeA3A.js} +2 -3
  3. package/dist/{adapters-Bx_MyEX_.js.map → adapters-Dw6yeA3A.js.map} +1 -1
  4. package/dist/index.js +3 -4
  5. package/dist/index.js.map +1 -1
  6. package/dist/loader-2g6inuO6.js +96 -0
  7. package/dist/loader-2g6inuO6.js.map +1 -0
  8. package/dist/next-loader.d.ts.map +1 -1
  9. package/dist/next-loader.js +3 -72
  10. package/dist/next-loader.js.map +1 -1
  11. package/dist/next.d.ts +3 -2
  12. package/dist/next.d.ts.map +1 -1
  13. package/dist/next.js +9 -8
  14. package/dist/next.js.map +1 -1
  15. package/dist/{nodes-DAzj56Xn.js → nodes-Bn7fLVZO.js} +47 -3
  16. package/dist/nodes-Bn7fLVZO.js.map +1 -0
  17. package/dist/read-worker.js +2 -2
  18. package/dist/render.js +2 -3
  19. package/dist/render.js.map +1 -1
  20. package/dist/{sets-B2lHNI7c.js → sets-B5arQvrZ.js} +58 -6
  21. package/dist/sets-B5arQvrZ.js.map +1 -0
  22. package/dist/{sets-BFcRq7dc.js → sets-DH5UbUV_.js} +13 -4
  23. package/dist/sets-DH5UbUV_.js.map +1 -0
  24. package/dist/{types-v7Qz7ogk.js → types-CmTEhJK6.js} +3 -5
  25. package/dist/{types-v7Qz7ogk.js.map → types-CmTEhJK6.js.map} +1 -1
  26. package/dist/vite.js +2 -3
  27. package/dist/vite.js.map +1 -1
  28. package/package.json +1 -1
  29. package/dist/nodes-DAzj56Xn.js.map +0 -1
  30. package/dist/registry-B0Dxiwhh.js +0 -68
  31. package/dist/registry-B0Dxiwhh.js.map +0 -1
  32. package/dist/registry-BEEpqK3z.js +0 -13
  33. package/dist/registry-BEEpqK3z.js.map +0 -1
  34. package/dist/sets-B2lHNI7c.js.map +0 -1
  35. package/dist/sets-BFcRq7dc.js.map +0 -1
  36. package/dist/utils-COPacfAq.js +0 -48
  37. package/dist/utils-COPacfAq.js.map +0 -1
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["isDefined","useState","ArrayOfObjectsFormNode","ArrayOfObjectsMember","BaseFormNode","DocumentFieldActionNode","ObjectFieldProps","ObjectFormNode","ObjectMember","ChangeIndicator","FieldActionsProvider","FieldActionsResolver","FormField","getPublishedId","useFormValue","hasMembers","node","collectNodeValidation","validation","collectMemberValidation","members","flatMap","member","kind","field","fieldSet","item","FieldProps","Field","t0","$","_c","actions","schemaType","title","description","presence","level","inputId","path","changed","children","inputProps","t1","Symbol","for","headerActions","setHeaderActions","t2","documentId","fieldValidation","focused","t3","publishedId","undefined","t4","name","t5","readOnly","deprecated","t6","t7","_c","ComponentProps","ComponentType","createElement","defaultIconProps","width","height","strokeWidth","createSanityIcon","icon","props","Icon","SanityIcon","gridCellSize","gridRowGap","gridRowHeight","gridColumns","gridVisibleRows","gridHeight","gridOverscan","gridLayoutStyle","justifyItems","rowGap","const","Button","ComponentProps","Drawing","gridCellSize","LibraryIcon","CellProps","Omit","icon","selected","focusable","position","total","onSelect","onHover","element","HTMLElement","Cell","t0","$","_c","props","t1","t2","Symbol","for","width","height","t3","drawing","t4","t5","event","currentTarget","t6","label","_c","isDefined","Box","Button","Flex","Grid","Text","ComponentProps","RefObject","CellProps","Cell","gridColumns","gridHeight","gridLayoutStyle","gridRowHeight","getVisibleRows","LibraryIcon","LibraryProps","Omit","icons","rows","ReturnType","selected","activeIndex","activeCell","HTMLButtonElement","search","onSelect","icon","onHover","onClearSearch","Library","t0","$","_c","props","totalRows","firstRow","lastRow","T0","t1","t2","t3","t4","t5","t6","visible","slice","height","overflowY","undefined","paddingTop","paddingBottom","map","offset","index","name","length","t7","_c","WarningOutlineIcon","Card","Flex","Stack","Text","ComponentProps","LibraryProblem","CodeTextProps","Omit","text","CodeText","t0","$","_c","props","t1","t2","parts","split","map","part","index","start","slice","join","length","t3","ProblemProps","problem","Problem","Symbol","for","title","description","t4","t5","_c","Button","Flex","Grid","Stack","Text","ComponentProps","CellProps","Cell","gridColumns","gridLayoutStyle","LibraryIcon","RecentProps","Omit","icons","selected","onSelect","icon","onHover","onForget","Recent","t0","$","_c","props","t1","Symbol","for","t2","t3","t4","length","index","name","map","t5","_c","isDefined","Stack","Text","Popover","CSSProperties","ComponentProps","LibraryIcon","splitMatches","HoveredIcon","icon","element","HTMLElement","tooltipMargins","matchStyle","background","color","textDecorationLine","textUnderlineOffset","HighlightProps","Omit","text","query","Highlight","t0","$","_c","props","t1","map","_temp","t2","part","match","start","TooltipProps","hovered","Tooltip","t3","Symbol","for","pointerEvents","t4","maxWidth","label","tags","t5","_c","_temp","useEffect","useState","LibraryResult","requestLibrary","useIconLibrary","library","style","$","_c","result","setResult","t0","t1","active","load","loaded","_c","isDefined","useEffect","useRef","useState","HoveredIcon","LibraryIcon","useIconTooltip","scrolling","$","_c","hovered","setHovered","hoverStart","undefined","scrolledOnto","t0","t1","Symbol","for","current","clearTimeout","t2","t3","landed","element","isConnected","matches","setTimeout","t4","clearHover","t5","handleHover","icon","t6","_c","storageKey","limit","getStorageKey","scope","readRecent","stored","JSON","parse","globalThis","localStorage","getItem","Array","isArray","filter","entry","writeRecent","name","updated","slice","setItem","stringify","clearRecent","removeItem","useState","clearRecent","readRecent","writeRecent","useRecentIcons","scope","$","_c","t0","recent","setRecent","t1","remember","name","t2","forget","t3","_c","gridColumns","gridHeight","gridOverscan","gridRowHeight","gridVisibleRows","getNextIndex","key","current","last","undefined","getVisibleRows","scrollRow","count","totalRows","Math","ceil","firstRow","max","lastRow","min","getCenteredScrollTop","index","floor","getRevealedScrollTop","scrollTop","top","isDefined","SearchIcon","Box","Dialog","Flex","Spinner","Stack","Text","TextInput","ChangeEvent","ComponentProps","KeyboardEvent","useEffect","useRef","useState","Library","Problem","Recent","Tooltip","gridHeight","gridRowHeight","useIconLibrary","useIconTooltip","useRecentIcons","getCenteredScrollTop","getNextIndex","getRevealedScrollTop","getVisibleRows","LibraryIcon","normalizeTerms","selectIcons","getIconSetKey","PickerProps","Omit","library","iconStyle","allowed","selected","onSelect","icon","Picker","t0","$","_c","libraryName","props","result","icons","t1","t2","t3","recent","remember","forget","search","setSearch","scrollRow","setScrollRow","movedIndex","setMovedIndex","scrolling","setScrolling","scroller","activeCell","focusIndex","undefined","scrollFrame","scrollStop","query","searching","results","filter","terms","includes","byName","Map","map","_temp","recentIcons","flatMap","entry","icon_1","get","hovered","handleHover","clearHover","rows","length","selectedIndex","findIndex","icon_2","name","activeIndex","Math","max","element","current","scrollTop","t4","t5","Symbol","for","cancelAnimationFrame","clearTimeout","t6","t7","focus","t8","handleSelect","icon_3","t9","clearSearch","handleSearch","event","currentTarget","value","selectActive","icon_4","handleSearchKeyDown","event_0","key","preventDefault","handleScroll","setTimeout","requestAnimationFrame","element_0","floor","handleGridKeyDown","event_1","last","next","index","min","element_1","T0","t10","t11","T1","t12","t13","t14","problem","t15","height","t16","t17","t18","toLocaleString","t19","t20","t21","t22","icon_0","_c","ComponentProps","SquareDashedIconProps","SquareDashedIcon","props","$","_c","t0","t1","t10","t11","t2","t3","t4","t5","t6","t7","t8","t9","Symbol","for","t12","_c","isDefined","SanityIconConfig","SanityIconOptions","SanityIconSelection","resolveIconOptions","options","config","library","style","icons","Partial","defaultIconProps","convertCase","isDefined","CloseIcon","Button","Flex","useEffect","useState","ObjectInputProps","ObjectSchemaType","set","setIfMissing","unset","Drawing","Picker","logger","SquareDashedIcon","LibraryIcon","requestLibrary","selectIcons","resolveIconDrawing","serializeIconDrawing","resolveIconOptions","SanityIconConfig","SanityIconOptions","SanityIcon","iconTypeName","IconSchemaType","options","InputProps","Partial","createSelectionPatches","icon","library","style","_type","name","drawing","createInput","config","Input","t0","$","_c","id","schemaType","value","onChange","readOnly","storedLibrary","node","open","setOpen","icons","selectedDrawing","selectedName","undefined","selectedLabel","undrawnName","active","saveDrawing","libraryIcons","find","candidate","warn","handleSelect","icon_0","T0","t1","T1","t2","t3","t4","t5","t6","t7","t8","t9","t10","t11","_c","isDefined","createElement","Drawing","resolveIconDrawing","SanityIcon","createIconPreview","value","drawing","node","undefined","IconPreview","width","height","Field","createSanityIcon","convertCase","isDefined","defineField","defineType","createInput","SquareDashedIcon","createIconPreview","SanityIconConfig","SanityIcon","iconTypeName","createIconType","config","name","type","icon","description","components","field","input","validation","rule","custom","value","Partial","node","preview","select","prepare","selection","title","media","_type","fields","BaseSchemaTypeOptions","InitialValueProperty","TypeAliasDefinition","definePlugin","pluginName","createIconType","IconLibraryId","ListedLibraryId","SanityIconName","SanityIconStyle","iconTypeName","IntrinsicDefinitions","icon","SanityIconDefinition","SanityIconSelection","library","Library","style","icons","SanityIconOptions","SanityIconInitialValue","name","Omit","options","initialValue","SanityIconConfig","plugin","config","schema","types","iconPlugin"],"sources":["../../@repo/components/field.tsx","../../@repo/lib/icons.ts","../src/config/grid.ts","../src/components/picker/cell.tsx","../src/components/picker/library.tsx","../src/components/picker/problem.tsx","../src/components/picker/recent.tsx","../src/components/picker/tooltip.tsx","../src/hooks/use-icon-library.ts","../src/hooks/use-icon-tooltip.ts","../src/lib/recent.ts","../src/hooks/use-recent-icons.ts","../src/lib/grid.ts","../src/components/picker/picker.tsx","../src/icons/square-dashed.tsx","../src/lib/options.ts","../src/components/input.tsx","../src/lib/preview.ts","../src/schemas/types/icon.ts","../src/plugin.ts"],"sourcesContent":["import { isDefined } from \"@repo/lib/utils\";\nimport { useState } from \"react\";\nimport type {\n ArrayOfObjectsFormNode,\n ArrayOfObjectsMember,\n BaseFormNode,\n DocumentFieldActionNode,\n ObjectFieldProps,\n ObjectFormNode,\n ObjectMember,\n} from \"sanity\";\nimport {\n ChangeIndicator,\n FieldActionsProvider,\n FieldActionsResolver,\n FormField,\n getPublishedId,\n useFormValue,\n} from \"sanity\";\n\n/**\n * Checks whether a form node has members, as objects and arrays of objects do.\n *\n * @param node - The form node to check.\n * @returns True if the node has members.\n */\nfunction hasMembers(node: BaseFormNode): node is ObjectFormNode | ArrayOfObjectsFormNode {\n return \"members\" in node;\n}\n\n/**\n * Collects the validation on a form node and everything inside it.\n *\n * @param node - The form node.\n * @returns Every validation result on the node or inside it.\n */\nfunction collectNodeValidation(node: BaseFormNode): BaseFormNode[\"validation\"] {\n return [...node.validation, ...(hasMembers(node) ? collectMemberValidation(node.members) : [])];\n}\n\n/**\n * Collects the validation anywhere inside a field's members. The form only passes a field the\n * validation at its own path, so a field that hides its members would otherwise show none of theirs.\n *\n * @param members - The members.\n * @returns Every validation result on the members or inside them.\n */\nfunction collectMemberValidation(members: (ObjectMember | ArrayOfObjectsMember)[]): BaseFormNode[\"validation\"] {\n return members.flatMap((member) => {\n if (member.kind === \"field\") return collectNodeValidation(member.field);\n if (member.kind === \"fieldSet\") return collectMemberValidation(member.fieldSet.members);\n if (member.kind === \"item\") return collectNodeValidation(member.item);\n\n return [];\n });\n}\n\nexport type FieldProps = ObjectFieldProps;\n\nexport function Field({\n actions,\n schemaType,\n title,\n description,\n presence,\n validation,\n level,\n inputId,\n path,\n changed,\n children,\n inputProps,\n}: FieldProps) {\n const [headerActions, setHeaderActions] = useState<DocumentFieldActionNode[]>([]);\n\n const documentId = useFormValue([\"_id\"]);\n const publishedId = typeof documentId === \"string\" ? getPublishedId(documentId) : undefined;\n const focused = inputProps.focused === true;\n const fieldValidation = [...validation, ...collectMemberValidation(inputProps.members)];\n\n return (\n <>\n {isDefined(publishedId) && isDefined(actions) && (\n <FieldActionsResolver\n actions={actions}\n documentId={publishedId}\n documentType={schemaType.name}\n onActions={setHeaderActions}\n path={path}\n schemaType={schemaType}\n />\n )}\n <FieldActionsProvider actions={headerActions} focused={focused} path={path}>\n <FormField\n __unstable_headerActions={headerActions}\n __unstable_presence={presence}\n description={description}\n inputId={inputId}\n level={level}\n title={title}\n validation={fieldValidation}\n deprecated={schemaType.deprecated}\n path={path}\n readOnly={inputProps.readOnly}\n >\n <ChangeIndicator path={path} hasFocus={focused} isChanged={changed}>\n {children}\n </ChangeIndicator>\n </FormField>\n </FieldActionsProvider>\n </>\n );\n}\n","import type { ComponentProps, ComponentType } from \"react\";\nimport { createElement } from \"react\";\n\n/** Default props for the plugin's own icons. Icons from `@sanity/icons` already match the Studio. */\nexport const defaultIconProps: ComponentProps<\"svg\"> = { width: \"1em\", height: \"1em\", strokeWidth: 1.5 };\n\n/**\n * Wraps an SVG icon component for use in the Studio.\n *\n * @param icon - The icon to wrap.\n * @param props - Props that override the Studio icon defaults.\n * @returns An icon component.\n */\nexport function createSanityIcon(icon: ComponentType<ComponentProps<\"svg\">>, props?: ComponentProps<\"svg\">) {\n const Icon = icon;\n\n function SanityIcon() {\n return createElement(Icon, { ...defaultIconProps, ...props });\n }\n\n return SanityIcon;\n}\n","/** Cell size in pixels, fixed so the grid never reflows. */\nexport const gridCellSize = 40;\n\n/** Gap between rows in pixels. */\nconst gridRowGap = 4;\n\n/** Distance from one row to the next, used to position the rendered rows. */\nexport const gridRowHeight = gridCellSize + gridRowGap;\n\n/** Icons per row. */\nexport const gridColumns = 8;\n\n/** Rows visible at once. */\nexport const gridVisibleRows = 8;\n\n/** Height of the scrolling area. The last row has no gap after it. */\nexport const gridHeight = gridVisibleRows * gridRowHeight - gridRowGap;\n\n/** Extra rows rendered above and below the visible ones, so rows are already drawn as they scroll into view. */\nexport const gridOverscan = gridVisibleRows;\n\n/** Layout shared by both grids, so recent icons line up with the library's columns. */\nexport const gridLayoutStyle = { justifyItems: \"center\", rowGap: gridRowGap } as const;\n","import { Button } from \"@sanity/ui\";\nimport type { ComponentProps } from \"react\";\n\nimport { Drawing } from \"@/components/drawing\";\nimport { gridCellSize } from \"@/config/grid\";\nimport type { LibraryIcon } from \"@/lib/library\";\n\nexport type CellProps = Omit<\n ComponentProps<typeof Button>,\n \"icon\" | \"selected\" | \"onSelect\" | \"onClick\" | \"onMouseEnter\"\n> & {\n icon: LibraryIcon;\n selected: boolean;\n focusable: boolean;\n position: number;\n total: number;\n onSelect: (icon: LibraryIcon) => void;\n onHover: (icon: LibraryIcon, element: HTMLElement) => void;\n};\n\nexport function Cell({ icon, selected, focusable, position, total, onSelect, onHover, ...props }: CellProps) {\n return (\n <Button\n type=\"button\"\n role=\"option\"\n aria-selected={selected}\n aria-posinset={position}\n aria-setsize={total}\n tabIndex={focusable ? 0 : -1}\n mode=\"bleed\"\n selected={selected}\n padding={0}\n style={{ width: gridCellSize, height: gridCellSize }}\n icon={<Drawing drawing={icon.drawing} width=\"1.25em\" height=\"1.25em\" />}\n aria-label={icon.label}\n onClick={() => {\n onSelect(icon);\n }}\n onMouseEnter={(event) => {\n onHover(icon, event.currentTarget);\n }}\n {...props}\n />\n );\n}\n","import { isDefined } from \"@repo/lib/utils\";\nimport { Box, Button, Flex, Grid, Text } from \"@sanity/ui\";\nimport type { ComponentProps, RefObject } from \"react\";\n\nimport type { CellProps } from \"@/components/picker/cell\";\nimport { Cell } from \"@/components/picker/cell\";\nimport { gridColumns, gridHeight, gridLayoutStyle, gridRowHeight } from \"@/config/grid\";\nimport type { getVisibleRows } from \"@/lib/grid\";\nimport type { LibraryIcon } from \"@/lib/library\";\n\nexport type LibraryProps = Omit<ComponentProps<typeof Box>, \"children\" | \"onSelect\"> & {\n icons: LibraryIcon[];\n rows: ReturnType<typeof getVisibleRows>;\n selected: string | undefined;\n activeIndex: number;\n activeCell: RefObject<HTMLButtonElement | null>;\n search: string;\n onSelect: (icon: LibraryIcon) => void;\n onHover: CellProps[\"onHover\"];\n onClearSearch: () => void;\n};\n\nexport function Library({\n icons,\n rows,\n selected,\n activeIndex,\n activeCell,\n search,\n onSelect,\n onHover,\n onClearSearch,\n ...props\n}: LibraryProps) {\n const { totalRows, firstRow, lastRow } = rows;\n const visible = icons.slice(firstRow * gridColumns, lastRow * gridColumns);\n\n return (\n <Box\n role=\"listbox\"\n aria-label=\"Icon library\"\n style={isDefined(icons) ? { height: gridHeight, overflowY: \"auto\" } : undefined}\n {...props}\n >\n {!isDefined(icons) && (\n <Flex align=\"center\" justify=\"center\" direction=\"column\" gap={3} paddingTop={5} paddingBottom={6}>\n <Text size={1} muted>{`Nothing matches \"${search}\".`}</Text>\n <Button type=\"button\" mode=\"ghost\" text=\"Clear search\" onClick={onClearSearch} />\n </Flex>\n )}\n {isDefined(icons) && (\n <Grid\n gridTemplateColumns={gridColumns}\n style={{\n ...gridLayoutStyle,\n paddingTop: firstRow * gridRowHeight,\n paddingBottom: (totalRows - lastRow) * gridRowHeight,\n }}\n >\n {visible.map((icon, offset) => {\n const index = firstRow * gridColumns + offset;\n\n return (\n <Cell\n key={icon.name}\n ref={index === activeIndex ? activeCell : undefined}\n icon={icon}\n selected={icon.name === selected}\n focusable={index === activeIndex}\n position={index + 1}\n total={icons.length}\n onSelect={onSelect}\n onHover={onHover}\n />\n );\n })}\n </Grid>\n )}\n </Box>\n );\n}\n","import { WarningOutlineIcon } from \"@sanity/icons/WarningOutline\";\nimport { Card, Flex, Stack, Text } from \"@sanity/ui\";\nimport type { ComponentProps } from \"react\";\n\nimport type { LibraryProblem } from \"@/lib/library\";\n\nexport type CodeTextProps = Omit<ComponentProps<\"span\">, \"children\"> & {\n text: string;\n};\n\nexport function CodeText({ text, ...props }: CodeTextProps) {\n const parts = text.split(\"`\");\n\n return (\n <span {...props}>\n {parts.map((part, index) => {\n const start = parts.slice(0, index).join(\"`\").length;\n\n return index % 2 === 1 ? <code key={start}>{part}</code> : part;\n })}\n </span>\n );\n}\n\nexport type ProblemProps = Omit<ComponentProps<typeof Card>, \"children\"> & {\n problem: LibraryProblem;\n};\n\nexport function Problem({ problem, ...props }: ProblemProps) {\n return (\n <Card tone=\"caution\" padding={4} radius={2} border {...props}>\n <Flex gap={3}>\n <Text size={1}>\n <WarningOutlineIcon />\n </Text>\n <Stack gap={3}>\n <Text size={1} weight=\"medium\">\n <CodeText text={problem.title} />\n </Text>\n <Text size={1} muted>\n <CodeText text={problem.description} />\n </Text>\n </Stack>\n </Flex>\n </Card>\n );\n}\n","import { Button, Flex, Grid, Stack, Text } from \"@sanity/ui\";\nimport type { ComponentProps } from \"react\";\n\nimport type { CellProps } from \"@/components/picker/cell\";\nimport { Cell } from \"@/components/picker/cell\";\nimport { gridColumns, gridLayoutStyle } from \"@/config/grid\";\nimport type { LibraryIcon } from \"@/lib/library\";\n\nexport type RecentProps = Omit<ComponentProps<typeof Stack>, \"children\" | \"onSelect\"> & {\n icons: LibraryIcon[];\n selected: string | undefined;\n onSelect: (icon: LibraryIcon) => void;\n onHover: CellProps[\"onHover\"];\n onForget: () => void;\n};\n\nexport function Recent({ icons, selected, onSelect, onHover, onForget, ...props }: RecentProps) {\n return (\n <Stack gap={3} {...props}>\n <Flex align=\"center\" justify=\"space-between\" gap={2}>\n <Text size={1} weight=\"medium\" muted>\n Recent icons\n </Text>\n <Button\n type=\"button\"\n mode=\"bleed\"\n fontSize={1}\n padding={2}\n text=\"Clear\"\n onClick={onForget}\n aria-label=\"Clear recent icons\"\n />\n </Flex>\n <Grid role=\"listbox\" aria-label=\"Recent icons\" gridTemplateColumns={gridColumns} style={gridLayoutStyle}>\n {icons.map((icon, index) => (\n <Cell\n key={icon.name}\n icon={icon}\n selected={icon.name === selected}\n focusable\n position={index + 1}\n total={icons.length}\n onSelect={onSelect}\n onHover={onHover}\n />\n ))}\n </Grid>\n </Stack>\n );\n}\n","import { isDefined } from \"@repo/lib/utils\";\nimport { Stack, Text } from \"@sanity/ui\";\nimport { Popover } from \"@sanity/ui/popover\";\nimport type { CSSProperties, ComponentProps } from \"react\";\n\nimport type { LibraryIcon } from \"@/lib/library\";\nimport { splitMatches } from \"@/lib/library\";\n\n/** Icon under the cursor and the cell showing it. */\nexport interface HoveredIcon {\n /** Icon in the cell. */\n icon: LibraryIcon;\n /** Cell the tooltip points at. */\n element: HTMLElement;\n}\n\n/**\n * Gap between the tooltip and its cell, set through margins because `@sanity/ui` offers no other way.\n * Only the top is set, since the tooltip always appears above the cell.\n */\nconst tooltipMargins: [number, number, number, number] = [-4, 0, 0, 0];\n\n/** Underlines a search match in place of the browser's highlighter-pen look, keeping the text's own colour. */\nconst matchStyle: CSSProperties = {\n background: \"none\",\n color: \"inherit\",\n textDecorationLine: \"underline\",\n textUnderlineOffset: \"0.2em\",\n};\n\nexport type HighlightProps = Omit<ComponentProps<\"span\">, \"children\"> & {\n text: string;\n query: string;\n};\n\nexport function Highlight({ text, query, ...props }: HighlightProps) {\n return (\n <span {...props}>\n {splitMatches(text, query).map((part) =>\n part.match ? (\n <mark key={part.start} style={matchStyle}>\n {part.text}\n </mark>\n ) : (\n part.text\n ),\n )}\n </span>\n );\n}\n\nexport type TooltipProps = Omit<ComponentProps<typeof Popover>, \"open\" | \"referenceElement\" | \"content\"> & {\n hovered: HoveredIcon | undefined;\n query: string;\n};\n\nexport function Tooltip({ hovered, query, ...props }: TooltipProps) {\n return (\n <Popover\n open={isDefined(hovered)}\n referenceElement={hovered?.element ?? null}\n placement=\"top\"\n portal\n padding={3}\n __unstable_margins={tooltipMargins}\n style={{ pointerEvents: \"none\" }}\n content={\n isDefined(hovered) && (\n <Stack gap={3} style={{ maxWidth: \"16rem\" }}>\n <Text size={1} weight=\"medium\">\n <Highlight text={hovered.icon.label} query={query} />\n </Text>\n {isDefined(hovered.icon.tags) && (\n <Text size={1} muted>\n <Highlight text={hovered.icon.tags} query={query} />\n </Text>\n )}\n </Stack>\n )\n }\n {...props}\n />\n );\n}\n","import { useEffect, useState } from \"react\";\n\nimport type { LibraryResult } from \"@/lib/library\";\nimport { requestLibrary } from \"@/lib/library\";\n\n/**\n * Loads an icon library style. Only an open picker calls this, so a Studio that never opens one never loads it.\n *\n * @param library - Identifier of the library, or undefined when none is set.\n * @param style - Identifier of the style, or undefined for the library's default.\n * @returns The icons or why they can't be shown, or undefined while loading.\n */\nexport function useIconLibrary(library: string | undefined, style: string | undefined) {\n const [result, setResult] = useState<LibraryResult>();\n\n useEffect(() => {\n let active = true;\n\n async function load() {\n const loaded = await requestLibrary(library, style);\n if (active) setResult(loaded);\n }\n\n void load();\n\n return () => {\n active = false;\n };\n }, [library, style]);\n\n return result;\n}\n","import { isDefined } from \"@repo/lib/utils\";\nimport { useEffect, useRef, useState } from \"react\";\n\nimport type { HoveredIcon } from \"@/components/picker/tooltip\";\nimport type { LibraryIcon } from \"@/lib/library\";\n\n/**\n * Tracks the icon under the cursor, showing its tooltip after a short delay. Tooltips are held back while the grid\n * scrolls, and the icon left under the cursor gets its tooltip once scrolling stops.\n *\n * @param scrolling - Whether the grid is scrolling.\n * @returns The hovered icon, and functions to update and clear it.\n */\nexport function useIconTooltip(scrolling: boolean) {\n const [hovered, setHovered] = useState<HoveredIcon>();\n const hoverStart = useRef<ReturnType<typeof setTimeout>>(undefined);\n const scrolledOnto = useRef<HoveredIcon>(undefined);\n\n useEffect(\n () => () => {\n if (isDefined(hoverStart.current)) clearTimeout(hoverStart.current);\n },\n [],\n );\n\n useEffect(() => {\n const landed = scrolledOnto.current;\n if (scrolling || !isDefined(landed)) return;\n\n scrolledOnto.current = undefined;\n if (!landed.element.isConnected || !landed.element.matches(\":hover\")) return;\n\n hoverStart.current = setTimeout(() => {\n setHovered(landed);\n }, 200);\n }, [scrolling]);\n\n function clearHover() {\n if (isDefined(hoverStart.current)) clearTimeout(hoverStart.current);\n if (isDefined(hovered)) setHovered(undefined);\n }\n\n function handleHover(icon: LibraryIcon, element: HTMLElement) {\n if (scrolling) {\n scrolledOnto.current = { icon, element };\n\n return;\n }\n\n if (element === hovered?.element) return;\n\n if (isDefined(hoverStart.current)) clearTimeout(hoverStart.current);\n\n if (isDefined(hovered)) {\n setHovered({ icon, element });\n\n return;\n }\n\n hoverStart.current = setTimeout(() => {\n setHovered({ icon, element });\n }, 200);\n }\n\n return { hovered, handleHover, clearHover };\n}\n","/** Local storage key for recent icons, which are kept in the browser rather than the dataset. */\nconst storageKey = \"driftime:sanity-plugin-icon:recent\";\n\n/** Number of recent icons to keep. */\nconst limit = 8;\n\n/**\n * Builds the storage key for one library style.\n *\n * @param scope - The library and style, such as `phosphor/bold`.\n * @returns The storage key.\n */\nfunction getStorageKey(scope: string) {\n return `${storageKey}:${scope}`;\n}\n\n/**\n * Reads the recently chosen icons.\n *\n * @param scope - The library and style, such as `phosphor/bold`.\n * @returns The icon names, most recent first.\n */\nexport function readRecent(scope: string) {\n try {\n const stored: unknown = JSON.parse(globalThis.localStorage.getItem(getStorageKey(scope)) ?? \"[]\");\n if (!Array.isArray(stored)) return [];\n\n return stored.filter((entry: unknown) => typeof entry === \"string\");\n } catch {\n return [];\n }\n}\n\n/**\n * Adds an icon to the front of the recent list.\n *\n * @param scope - The library and style, such as `phosphor/bold`.\n * @param name - The chosen icon's name.\n * @returns The updated icon names, most recent first.\n */\nexport function writeRecent(scope: string, name: string) {\n const updated = [name, ...readRecent(scope).filter((entry) => entry !== name)].slice(0, limit);\n\n try {\n globalThis.localStorage.setItem(getStorageKey(scope), JSON.stringify(updated));\n } catch {\n // If storage is blocked, the icon just isn't remembered.\n }\n\n return updated;\n}\n\n/**\n * Clears the recent icons.\n *\n * @param scope - The library and style, such as `phosphor/bold`.\n */\nexport function clearRecent(scope: string) {\n try {\n globalThis.localStorage.removeItem(getStorageKey(scope));\n } catch {\n // If storage is blocked, there's nothing to clear.\n }\n}\n","import { useState } from \"react\";\n\nimport { clearRecent, readRecent, writeRecent } from \"@/lib/recent\";\n\n/**\n * Tracks the icons an author chose most recently from one library style. The list is read when the picker opens, so\n * choices made in another tab are included.\n *\n * @param scope - The library and style, such as `phosphor/bold`.\n * @returns The recent icon names, most recent first, and functions to add to and clear them.\n */\nexport function useRecentIcons(scope: string) {\n const [recent, setRecent] = useState<string[]>(() => readRecent(scope));\n\n function remember(name: string) {\n setRecent(writeRecent(scope, name));\n }\n\n function forget() {\n clearRecent(scope);\n setRecent([]);\n }\n\n return { recent, remember, forget };\n}\n","import { gridColumns, gridHeight, gridOverscan, gridRowHeight, gridVisibleRows } from \"@/config/grid\";\n\n/**\n * Works out which icon a key press moves to.\n *\n * @param key - The key pressed.\n * @param current - Index of the current icon.\n * @param last - Index of the last icon.\n * @returns The new index, or undefined when the key doesn't move.\n */\nexport function getNextIndex(key: string, current: number, last: number) {\n if (key === \"ArrowRight\") return current + 1;\n if (key === \"ArrowLeft\") return current - 1;\n if (key === \"ArrowDown\") return current + gridColumns;\n if (key === \"ArrowUp\") return current - gridColumns;\n if (key === \"Home\") return 0;\n if (key === \"End\") return last;\n\n return undefined;\n}\n\n/**\n * Works out which rows to render at a scroll position, so only icons near the viewport are mounted.\n * Padding replaces the other rows, so the scrollbar stays the right size.\n *\n * @param scrollRow - The row scrolled to.\n * @param count - Number of icons in the results.\n * @returns The first and last rows to render, and the total number of rows.\n */\nexport function getVisibleRows(scrollRow: number, count: number) {\n const totalRows = Math.ceil(count / gridColumns);\n const firstRow = Math.max(0, scrollRow - gridOverscan);\n const lastRow = Math.min(totalRows, firstRow + gridVisibleRows + gridOverscan * 2);\n\n return { totalRows, firstRow, lastRow };\n}\n\n/**\n * Works out the scroll position that centres an icon, for opening on the selected icon.\n *\n * @param index - Index of the icon.\n * @returns The scroll position.\n */\nexport function getCenteredScrollTop(index: number) {\n return Math.max(0, Math.floor(index / gridColumns) * gridRowHeight - gridHeight / 2);\n}\n\n/**\n * Works out the scroll position that brings an icon into view, keeping the current one if it's\n * already visible. It uses the index because Home and End can move to rows that aren't mounted.\n *\n * @param index - Index of the icon.\n * @param scrollTop - The current scroll position.\n * @returns The scroll position.\n */\nexport function getRevealedScrollTop(index: number, scrollTop: number) {\n const top = Math.floor(index / gridColumns) * gridRowHeight;\n\n if (top < scrollTop) return top;\n if (top + gridRowHeight > scrollTop + gridHeight) return top + gridRowHeight - gridHeight;\n\n return scrollTop;\n}\n","import { isDefined } from \"@repo/lib/utils\";\nimport { SearchIcon } from \"@sanity/icons/Search\";\nimport { Box, Dialog, Flex, Spinner, Stack, Text, TextInput } from \"@sanity/ui\";\nimport type { ChangeEvent, ComponentProps, KeyboardEvent } from \"react\";\nimport { useEffect, useRef, useState } from \"react\";\n\nimport { Library } from \"@/components/picker/library\";\nimport { Problem } from \"@/components/picker/problem\";\nimport { Recent } from \"@/components/picker/recent\";\nimport { Tooltip } from \"@/components/picker/tooltip\";\nimport { gridHeight, gridRowHeight } from \"@/config/grid\";\nimport { useIconLibrary } from \"@/hooks/use-icon-library\";\nimport { useIconTooltip } from \"@/hooks/use-icon-tooltip\";\nimport { useRecentIcons } from \"@/hooks/use-recent-icons\";\nimport { getCenteredScrollTop, getNextIndex, getRevealedScrollTop, getVisibleRows } from \"@/lib/grid\";\nimport type { LibraryIcon } from \"@/lib/library\";\nimport { normalizeTerms, selectIcons } from \"@/lib/library\";\nimport { getIconSetKey } from \"@/lib/registry\";\n\nexport type PickerProps = Omit<\n ComponentProps<typeof Dialog>,\n \"children\" | \"header\" | \"width\" | \"selected\" | \"onSelect\"\n> & {\n library: string | undefined;\n iconStyle: string | undefined;\n allowed: string[] | undefined;\n selected: string | undefined;\n onSelect: (icon: LibraryIcon) => void;\n};\n\nexport function Picker({ library: libraryName, iconStyle, allowed, selected, onSelect, ...props }: PickerProps) {\n const result = useIconLibrary(libraryName, iconStyle);\n const library = result?.icons;\n const icons = selectIcons(library ?? [], allowed);\n const { recent, remember, forget } = useRecentIcons(getIconSetKey(libraryName ?? \"\", iconStyle ?? \"default\"));\n\n const [search, setSearch] = useState(\"\");\n const [scrollRow, setScrollRow] = useState(0);\n const [movedIndex, setMovedIndex] = useState<number>();\n const [scrolling, setScrolling] = useState(false);\n\n const scroller = useRef<HTMLDivElement>(null);\n const activeCell = useRef<HTMLButtonElement>(null);\n const focusIndex = useRef<number>(undefined);\n const scrollFrame = useRef<number>(undefined);\n const scrollStop = useRef<ReturnType<typeof setTimeout>>(undefined);\n\n const query = normalizeTerms(search);\n const searching = isDefined(query);\n const results = icons.filter((icon) => !searching || icon.terms.includes(query));\n\n const byName = new Map(icons.map((icon) => [icon.name, icon]));\n const recentIcons = searching\n ? []\n : recent.flatMap((entry) => {\n const icon = byName.get(entry);\n\n return isDefined(icon) ? [icon] : [];\n });\n\n const { hovered, handleHover, clearHover } = useIconTooltip(scrolling);\n\n const rows = getVisibleRows(scrollRow, results.length);\n\n const selectedIndex = searching || !isDefined(selected) ? -1 : icons.findIndex((icon) => icon.name === selected);\n const activeIndex = movedIndex ?? Math.max(0, selectedIndex);\n\n useEffect(() => {\n const element = scroller.current;\n if (!isDefined(element) || selectedIndex === -1) return;\n\n element.scrollTop = getCenteredScrollTop(selectedIndex);\n }, [scroller, selectedIndex]);\n\n useEffect(\n () => () => {\n if (isDefined(scrollFrame.current)) cancelAnimationFrame(scrollFrame.current);\n if (isDefined(scrollStop.current)) clearTimeout(scrollStop.current);\n },\n [],\n );\n\n useEffect(() => {\n if (focusIndex.current !== activeIndex) return;\n\n focusIndex.current = undefined;\n if (isDefined(activeCell.current)) activeCell.current.focus();\n }, [activeIndex]);\n\n function handleSelect(icon: LibraryIcon) {\n remember(icon.name);\n onSelect(icon);\n }\n\n function clearSearch() {\n setSearch(\"\");\n setMovedIndex(undefined);\n }\n\n function handleSearch(event: ChangeEvent<HTMLInputElement>) {\n setSearch(event.currentTarget.value);\n setMovedIndex(undefined);\n\n if (isDefined(scroller.current)) scroller.current.scrollTop = 0;\n }\n\n function selectActive() {\n const icon = results[activeIndex];\n\n if (isDefined(icon)) handleSelect(icon);\n }\n\n function handleSearchKeyDown(event: KeyboardEvent<HTMLInputElement>) {\n if (event.key === \"Enter\") {\n event.preventDefault();\n selectActive();\n\n return;\n }\n\n if (event.key !== \"ArrowDown\") return;\n\n event.preventDefault();\n\n if (isDefined(activeCell.current)) activeCell.current.focus();\n }\n\n function handleScroll() {\n clearHover();\n if (!scrolling) setScrolling(true);\n\n if (isDefined(scrollStop.current)) clearTimeout(scrollStop.current);\n scrollStop.current = setTimeout(() => {\n setScrolling(false);\n }, 150);\n\n if (isDefined(scrollFrame.current)) return;\n\n scrollFrame.current = requestAnimationFrame(() => {\n scrollFrame.current = undefined;\n\n const element = scroller.current;\n if (isDefined(element)) setScrollRow(Math.floor(element.scrollTop / gridRowHeight));\n });\n }\n\n function handleGridKeyDown(event: KeyboardEvent<HTMLDivElement>) {\n const last = results.length - 1;\n if (last < 0) return;\n\n if (event.key === \"Enter\" || event.key === \" \") {\n event.preventDefault();\n selectActive();\n\n return;\n }\n\n const next = getNextIndex(event.key, activeIndex, last);\n if (!isDefined(next)) return;\n\n event.preventDefault();\n\n const index = Math.min(Math.max(next, 0), last);\n focusIndex.current = index;\n setMovedIndex(index);\n\n const element = scroller.current;\n if (!isDefined(element)) return;\n\n element.scrollTop = getRevealedScrollTop(index, element.scrollTop);\n }\n\n return (\n <Dialog header=\"Select icon\" width={1} {...props}>\n <Stack gap={4} padding={4}>\n {!isDefined(result?.problem) && (\n <TextInput\n type=\"search\"\n icon={<SearchIcon />}\n placeholder=\"Search by name or keyword\"\n value={search}\n onChange={handleSearch}\n onKeyDown={handleSearchKeyDown}\n disabled={!isDefined(library) || !isDefined(icons)}\n aria-label=\"Search the icon library\"\n />\n )}\n {!isDefined(result) && (\n <Flex align=\"center\" justify=\"center\" style={{ height: gridHeight }}>\n <Spinner muted />\n </Flex>\n )}\n {isDefined(result?.problem) && <Problem problem={result.problem} />}\n {isDefined(recentIcons) && (\n <Recent\n icons={recentIcons}\n selected={selected}\n onSelect={handleSelect}\n onHover={handleHover}\n onForget={forget}\n onMouseLeave={clearHover}\n />\n )}\n {isDefined(library) && (\n <Stack gap={3}>\n <Box paddingY={2}>\n <Text size={1} weight=\"medium\" muted>\n All icons ({results.length.toLocaleString(\"en-US\")})\n </Text>\n </Box>\n {!isDefined(icons) && (\n <Flex align=\"center\" justify=\"center\" paddingTop={5} paddingBottom={6}>\n <Text size={1} muted>\n No icons available.\n </Text>\n </Flex>\n )}\n {isDefined(icons) && (\n <Library\n ref={scroller}\n icons={results}\n rows={rows}\n selected={selected}\n activeIndex={activeIndex}\n activeCell={activeCell}\n search={search}\n onSelect={handleSelect}\n onHover={handleHover}\n onClearSearch={clearSearch}\n onScroll={handleScroll}\n onMouseLeave={clearHover}\n onKeyDown={handleGridKeyDown}\n />\n )}\n </Stack>\n )}\n <Tooltip key={hovered?.icon.name} hovered={hovered} query={query} />\n </Stack>\n </Dialog>\n );\n}\n","import type { ComponentProps } from \"react\";\n\nexport type SquareDashedIconProps = ComponentProps<\"svg\">;\n\nexport function SquareDashedIcon(props: SquareDashedIconProps) {\n return (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width={24}\n height={24}\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth={2}\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n {...props}\n >\n <path d=\"M5 3a2 2 0 0 0-2 2\" />\n <path d=\"M19 3a2 2 0 0 1 2 2\" />\n <path d=\"M21 19a2 2 0 0 1-2 2\" />\n <path d=\"M5 21a2 2 0 0 1-2-2\" />\n <path d=\"M9 3h1\" />\n <path d=\"M9 21h1\" />\n <path d=\"M14 3h1\" />\n <path d=\"M14 21h1\" />\n <path d=\"M3 9v1\" />\n <path d=\"M21 9v1\" />\n <path d=\"M3 14v1\" />\n <path d=\"M21 14v1\" />\n </svg>\n );\n}\n","import { isDefined } from \"@repo/lib/utils\";\n\nimport type { SanityIconConfig, SanityIconOptions, SanityIconSelection } from \"@/plugin\";\n\n/**\n * Resolves the library, style, and icons a field offers. A field that names a library replaces all three of the\n * plugin's, and one that doesn't uses the plugin's.\n *\n * @param options - The field's options.\n * @param config - The plugin configuration.\n * @returns The field's settings, whose library is undefined when neither the field nor the plugin names one.\n */\nexport function resolveIconOptions(options: SanityIconOptions | undefined, config: SanityIconConfig | undefined) {\n const { library, style, icons }: Partial<SanityIconSelection> =\n (isDefined(options?.library) ? options : config) ?? {};\n\n return { library, style, icons };\n}\n","import { defaultIconProps } from \"@repo/lib/icons\";\nimport { convertCase, isDefined } from \"@repo/lib/utils\";\nimport { CloseIcon } from \"@sanity/icons/Close\";\nimport { Button, Flex } from \"@sanity/ui\";\nimport { useEffect, useState } from \"react\";\nimport type { ObjectInputProps, ObjectSchemaType } from \"sanity\";\nimport { set, setIfMissing, unset } from \"sanity\";\n\nimport { Drawing } from \"@/components/drawing\";\nimport { Picker } from \"@/components/picker/picker\";\nimport { logger } from \"@/config/defaults\";\nimport { SquareDashedIcon } from \"@/icons/square-dashed\";\nimport type { LibraryIcon } from \"@/lib/library\";\nimport { requestLibrary, selectIcons } from \"@/lib/library\";\nimport { resolveIconDrawing, serializeIconDrawing } from \"@/lib/nodes\";\nimport { resolveIconOptions } from \"@/lib/options\";\nimport type { SanityIconConfig, SanityIconOptions } from \"@/plugin\";\nimport type { SanityIcon } from \"@/types\";\nimport { iconTypeName } from \"@/types\";\n\n/** Compiled icon field type, with the field's own options. */\ninterface IconSchemaType extends ObjectSchemaType {\n options?: SanityIconOptions;\n}\n\nexport type InputProps = ObjectInputProps<Partial<SanityIcon>, IconSchemaType>;\n\n/**\n * Creates the patches that store an icon, with the library and style it was chosen from.\n *\n * @param icon - The icon.\n * @param library - Identifier of the library, or undefined when none is set.\n * @param style - Identifier of the style, or undefined for the library's default.\n * @returns The patches.\n */\nfunction createSelectionPatches(icon: LibraryIcon, library: string | undefined, style: string | undefined) {\n return [\n setIfMissing({ _type: iconTypeName satisfies SanityIcon[\"_type\"] }),\n isDefined(library)\n ? set(library, [\"library\" satisfies keyof SanityIcon])\n : unset([\"library\" satisfies keyof SanityIcon]),\n isDefined(style) ? set(style, [\"style\" satisfies keyof SanityIcon]) : unset([\"style\" satisfies keyof SanityIcon]),\n set(icon.name, [\"name\" satisfies keyof SanityIcon]),\n set(serializeIconDrawing(icon.drawing), [\"node\" satisfies keyof SanityIcon]),\n ];\n}\n\n/**\n * Creates the icon field input, bound to the plugin's configuration. A field's own icons replace the\n * plugin's rather than adding to them.\n *\n * @param config - The plugin configuration.\n * @returns The input component.\n */\nexport function createInput(config: SanityIconConfig) {\n function Input({ id, schemaType, value, onChange, readOnly }: InputProps) {\n const { library: storedLibrary, name, node } = value ?? {};\n\n const [open, setOpen] = useState(false);\n\n const { library, style, icons } = resolveIconOptions(schemaType.options, config);\n const selectedDrawing = resolveIconDrawing(node);\n const selectedName = storedLibrary === library ? name : undefined;\n const selectedLabel = isDefined(name) ? convertCase(name, \"title\") : undefined;\n const undrawnName = isDefined(node) ? undefined : name;\n\n // An initial value names an icon without its drawing, so the drawing is saved when the field is first shown.\n useEffect(() => {\n let active = true;\n\n async function saveDrawing() {\n if (!isDefined(undrawnName) || readOnly === true) return;\n\n const { icons: libraryIcons } = await requestLibrary(library, style);\n if (!active || !isDefined(libraryIcons)) return;\n\n const icon = selectIcons(libraryIcons, icons).find((candidate) => candidate.name === undrawnName);\n\n if (!isDefined(icon)) {\n logger.warn(\n `The icon field \"${id}\" starts with \"${undrawnName}\", which isn't one of its icons. Change its initialValue.`,\n );\n\n return;\n }\n\n onChange(createSelectionPatches(icon, library, style));\n }\n\n void saveDrawing();\n\n return () => {\n active = false;\n };\n }, [id, undrawnName, readOnly, library, style, icons, onChange]);\n\n function handleSelect(icon: LibraryIcon) {\n onChange(createSelectionPatches(icon, library, style));\n setOpen(false);\n }\n\n return (\n <Flex gap={2}>\n <Button\n id={id}\n type=\"button\"\n mode=\"ghost\"\n icon={\n isDefined(selectedDrawing) ? (\n <Drawing drawing={selectedDrawing} width=\"1em\" height=\"1em\" />\n ) : (\n <SquareDashedIcon {...defaultIconProps} />\n )\n }\n text={selectedLabel ?? \"Select icon\"}\n disabled={readOnly}\n onClick={() => {\n setOpen(true);\n }}\n aria-label={isDefined(selectedLabel) ? `${selectedLabel} currently selected` : \"Select icon\"}\n />\n {isDefined(value) && (\n <Button\n type=\"button\"\n mode=\"ghost\"\n tone=\"critical\"\n icon={<CloseIcon />}\n text=\"Clear\"\n disabled={readOnly}\n onClick={() => {\n onChange(unset());\n }}\n aria-label=\"Clear the selected icon\"\n />\n )}\n {open && (\n <Picker\n id={`${id}-library`}\n library={library}\n iconStyle={style}\n allowed={icons}\n selected={selectedName}\n onSelect={handleSelect}\n onClose={() => {\n setOpen(false);\n }}\n onClickOutside={() => {\n setOpen(false);\n }}\n />\n )}\n </Flex>\n );\n }\n\n return Input;\n}\n","import { isDefined } from \"@repo/lib/utils\";\nimport { createElement } from \"react\";\n\nimport { Drawing } from \"@/components/drawing\";\nimport { resolveIconDrawing } from \"@/lib/nodes\";\nimport type { SanityIcon } from \"@/types\";\n\n/**\n * Creates preview media for a stored icon, so each document shows its own icon instead of a placeholder.\n *\n * @param value - The stored icon.\n * @returns The media component, or undefined when nothing readable was stored.\n * @public\n */\nexport function createIconPreview(value: SanityIcon | undefined) {\n const drawing = resolveIconDrawing(value?.node);\n if (!isDefined(drawing)) return undefined;\n\n return function IconPreview() {\n return createElement(Drawing, { drawing, width: \"1em\", height: \"1em\" });\n };\n}\n","import { Field } from \"@repo/components/field\";\nimport { createSanityIcon } from \"@repo/lib/icons\";\nimport { convertCase, isDefined } from \"@repo/lib/utils\";\nimport { defineField, defineType } from \"sanity\";\n\nimport { createInput } from \"@/components/input\";\nimport { SquareDashedIcon } from \"@/icons/square-dashed\";\nimport { createIconPreview } from \"@/lib/preview\";\nimport type { SanityIconConfig } from \"@/plugin\";\nimport type { SanityIcon } from \"@/types\";\nimport { iconTypeName } from \"@/types\";\n\n/**\n * Creates the icon object type, offering the plugin's icons to fields that don't set their own.\n *\n * @param config - The plugin configuration.\n * @returns The icon type.\n */\nexport function createIconType(config: SanityIconConfig) {\n return defineType({\n name: iconTypeName satisfies SanityIcon[\"_type\"],\n type: \"object\",\n icon: createSanityIcon(SquareDashedIcon),\n description: \"Icon chosen from an icon library.\",\n // Uses a primitive field's flat frame on purpose, instead of Sanity's collapsible object fieldset.\n components: { field: Field, input: createInput(config) },\n validation: (rule) =>\n rule.custom((value: Partial<SanityIcon> | undefined) =>\n !isDefined(value?.name) || isDefined(value.node) ? true : \"Select the icon again to save its drawing.\",\n ),\n preview: {\n select: {\n name: \"name\",\n node: \"node\",\n },\n prepare(selection: { name?: string; node?: string }) {\n const { name, node } = selection;\n\n return {\n title: isDefined(name) ? convertCase(name, \"title\") : \"No icon\",\n media: createIconPreview({ _type: iconTypeName, name, node }),\n };\n },\n },\n fields: [\n defineField({\n name: \"library\" satisfies keyof SanityIcon,\n type: \"string\",\n description: \"Identifier of the library the icon came from.\",\n }),\n defineField({\n name: \"style\" satisfies keyof SanityIcon,\n type: \"string\",\n description: \"Identifier of the library style the icon came from.\",\n }),\n defineField({\n name: \"name\" satisfies keyof SanityIcon,\n type: \"string\",\n description: \"Name of the icon in its library.\",\n }),\n defineField({\n name: \"node\" satisfies keyof SanityIcon,\n type: \"text\",\n description: \"Shapes the icon is drawn from, saved when it's chosen.\",\n }),\n ],\n });\n}\n","import type { BaseSchemaTypeOptions, InitialValueProperty, TypeAliasDefinition } from \"sanity\";\nimport { definePlugin } from \"sanity\";\n\nimport { pluginName } from \"@/config/defaults\";\nimport { createIconType } from \"@/schemas/types/icon\";\nimport type { IconLibraryId, ListedLibraryId, SanityIconName, SanityIconStyle, iconTypeName } from \"@/types\";\n\ndeclare module \"@sanity/types\" {\n interface IntrinsicDefinitions {\n /** Definition of a field of type `icon`. */\n icon: SanityIconDefinition;\n }\n}\n\n/**\n * A choice of library, style, and icons, where the style and icons are checked against the library.\n *\n * @public\n */\nexport type SanityIconSelection = {\n [Library in IconLibraryId]: {\n /** Identifier of the icon library, such as `phosphor`. */\n library: Library;\n /** Identifier of the library style, such as `bold`. Defaults to the library's first style. */\n style?: SanityIconStyle<Library>;\n /** Icons authors can choose from, in the order listed. Defaults to every icon. */\n icons?: SanityIconName<Library>[];\n };\n}[IconLibraryId];\n\n/**\n * Options for an icon field. A field that names a library replaces the plugin's library, style, and icons, and one\n * that doesn't uses the plugin's.\n *\n * @public\n */\nexport type SanityIconOptions = BaseSchemaTypeOptions &\n (SanityIconSelection | { library?: undefined; style?: undefined; icons?: undefined });\n\n/**\n * Icon a field starts with. The Studio saves its drawing from the field's library the first time the field is shown.\n *\n * @public\n */\nexport interface SanityIconInitialValue {\n /** Name of the icon, from any library the build step has listed. */\n name: SanityIconName<ListedLibraryId>;\n}\n\n/**\n * Definition of a field or array member holding an icon, so its options and initial value are type-checked like a\n * built-in type's.\n *\n * @public\n */\nexport interface SanityIconDefinition extends Omit<\n TypeAliasDefinition<typeof iconTypeName, undefined>,\n \"options\" | \"initialValue\"\n> {\n /** Options for the field. */\n options?: SanityIconOptions;\n /** Icon the field starts with, or a function that returns one. */\n initialValue?: InitialValueProperty<unknown, SanityIconInitialValue>;\n}\n\n/**\n * Plugin configuration, naming the library every icon field uses unless it names its own.\n *\n * @public\n */\nexport type SanityIconConfig = SanityIconSelection;\n\nconst plugin = definePlugin<SanityIconConfig>((config) => ({\n name: pluginName,\n schema: {\n types: [createIconType(config)],\n },\n}));\n\n/**\n * Adds an icon field type to Sanity Studio, with a searchable picker for the installed icon libraries that\n * stores the chosen icon's drawing.\n *\n * @param config - The plugin configuration.\n * @returns The plugin.\n * @public\n */\nexport function iconPlugin(config: SanityIconConfig) {\n return plugin(config);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AA0BA,SAASe,WAAWC,MAAqE;CACvF,OAAO,aAAaA;AACtB;;;;;;;AAQA,SAASC,sBAAsBD,MAAgD;CAC7E,OAAO,CAAC,GAAGA,KAAKE,YAAY,GAAIH,WAAWC,IAAI,IAAIG,wBAAwBH,KAAKI,OAAO,IAAI,CAAA,CAAG;AAChG;;;;;;;;AASA,SAASD,wBAAwBC,SAA8E;CAC7G,OAAOA,QAAQC,SAASC,WAClBA,OAAOC,SAAS,UAAgBN,sBAAsBK,OAAOE,KAAK,IAClEF,OAAOC,SAAS,aAAmBJ,wBAAwBG,OAAOG,SAASL,OAAO,IAClFE,OAAOC,SAAS,SAAeN,sBAAsBK,OAAOI,IAAI,IAE7D,CAAA,CACR;AACH;AAIA,SAAOE,MAAAC,IAAA;CAAA,IAAAC,IAAAC,EAAA,EAAA,GAAe,EAAAC,SAAAC,YAAAC,OAAAC,aAAAC,UAAAl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OC,MAAM;AACtB"}
1
+ {"version":3,"file":"index.js","names":["isDefined","useState","ArrayOfObjectsFormNode","ArrayOfObjectsMember","BaseFormNode","DocumentFieldActionNode","ObjectFieldProps","ObjectFormNode","ObjectMember","ChangeIndicator","FieldActionsProvider","FieldActionsResolver","FormField","getPublishedId","useFormValue","hasMembers","node","collectNodeValidation","validation","collectMemberValidation","members","flatMap","member","kind","field","fieldSet","item","FieldProps","Field","t0","$","_c","actions","schemaType","title","description","presence","level","inputId","path","changed","children","inputProps","t1","Symbol","for","headerActions","setHeaderActions","t2","documentId","fieldValidation","focused","t3","publishedId","undefined","t4","name","t5","readOnly","deprecated","t6","t7","_c","ComponentProps","ComponentType","createElement","defaultIconProps","width","height","strokeWidth","createSanityIcon","icon","props","Icon","SanityIcon","gridCellSize","gridRowGap","gridRowHeight","gridColumns","gridVisibleRows","gridHeight","gridOverscan","gridLayoutStyle","justifyItems","rowGap","const","Button","ComponentProps","Drawing","gridCellSize","LibraryIcon","CellProps","Omit","icon","selected","focusable","position","total","onSelect","onHover","element","HTMLElement","Cell","t0","$","_c","props","t1","t2","Symbol","for","width","height","t3","drawing","t4","t5","event","currentTarget","t6","label","_c","isDefined","Box","Button","Flex","Grid","Text","ComponentProps","RefObject","CellProps","Cell","gridColumns","gridHeight","gridLayoutStyle","gridRowHeight","getVisibleRows","LibraryIcon","LibraryProps","Omit","icons","rows","ReturnType","selected","activeIndex","activeCell","HTMLButtonElement","search","onSelect","icon","onHover","onClearSearch","Library","t0","$","_c","props","totalRows","firstRow","lastRow","T0","t1","t2","t3","t4","t5","t6","visible","slice","height","overflowY","undefined","paddingTop","paddingBottom","map","offset","index","name","length","t7","_c","WarningOutlineIcon","Card","Flex","Stack","Text","ComponentProps","LibraryProblem","CodeTextProps","Omit","text","CodeText","t0","$","_c","props","t1","t2","parts","split","map","part","index","start","slice","join","length","t3","ProblemProps","problem","Problem","Symbol","for","title","description","t4","t5","_c","Button","Flex","Grid","Stack","Text","ComponentProps","CellProps","Cell","gridColumns","gridLayoutStyle","LibraryIcon","RecentProps","Omit","icons","selected","onSelect","icon","onHover","onForget","Recent","t0","$","_c","props","t1","Symbol","for","t2","t3","t4","length","index","name","map","t5","_c","isDefined","Stack","Text","Popover","CSSProperties","ComponentProps","LibraryIcon","splitMatches","HoveredIcon","icon","element","HTMLElement","tooltipMargins","matchStyle","background","color","textDecorationLine","textUnderlineOffset","HighlightProps","Omit","text","query","Highlight","t0","$","_c","props","t1","map","_temp","t2","part","match","start","TooltipProps","hovered","Tooltip","t3","Symbol","for","pointerEvents","t4","maxWidth","label","tags","t5","_c","_temp","useEffect","useState","LibraryResult","requestLibrary","useIconLibrary","library","style","$","_c","result","setResult","t0","t1","active","load","loaded","_c","isDefined","useEffect","useRef","useState","HoveredIcon","LibraryIcon","useIconTooltip","scrolling","$","_c","hovered","setHovered","hoverStart","undefined","scrolledOnto","t0","t1","Symbol","for","current","clearTimeout","t2","t3","landed","element","isConnected","matches","setTimeout","t4","clearHover","t5","handleHover","icon","t6","_c","storageKey","limit","getStorageKey","scope","readRecent","stored","JSON","parse","globalThis","localStorage","getItem","Array","isArray","filter","entry","writeRecent","name","updated","slice","setItem","stringify","clearRecent","removeItem","useState","clearRecent","readRecent","writeRecent","useRecentIcons","scope","$","_c","t0","recent","setRecent","t1","remember","name","t2","forget","t3","_c","gridColumns","gridHeight","gridOverscan","gridRowHeight","gridVisibleRows","getNextIndex","key","current","last","undefined","getVisibleRows","scrollRow","count","totalRows","Math","ceil","firstRow","max","lastRow","min","getCenteredScrollTop","index","floor","getRevealedScrollTop","scrollTop","top","isDefined","SearchIcon","Box","Dialog","Flex","Spinner","Stack","Text","TextInput","ChangeEvent","ComponentProps","KeyboardEvent","useEffect","useRef","useState","Library","Problem","Recent","Tooltip","gridHeight","gridRowHeight","useIconLibrary","useIconTooltip","useRecentIcons","getCenteredScrollTop","getNextIndex","getRevealedScrollTop","getVisibleRows","LibraryIcon","normalizeTerms","selectIcons","getIconSetKey","PickerProps","Omit","library","iconStyle","allowed","selected","onSelect","icon","Picker","t0","$","_c","libraryName","props","result","icons","t1","t2","t3","recent","remember","forget","search","setSearch","scrollRow","setScrollRow","movedIndex","setMovedIndex","scrolling","setScrolling","scroller","activeCell","focusIndex","undefined","scrollFrame","scrollStop","query","searching","results","filter","terms","includes","byName","Map","map","_temp","recentIcons","flatMap","entry","icon_1","get","hovered","handleHover","clearHover","rows","length","selectedIndex","findIndex","icon_2","name","activeIndex","Math","max","element","current","scrollTop","t4","t5","Symbol","for","cancelAnimationFrame","clearTimeout","t6","t7","focus","t8","handleSelect","icon_3","t9","clearSearch","handleSearch","event","currentTarget","value","selectActive","icon_4","handleSearchKeyDown","event_0","key","preventDefault","handleScroll","setTimeout","requestAnimationFrame","element_0","floor","handleGridKeyDown","event_1","last","next","index","min","element_1","T0","t10","t11","T1","t12","t13","t14","problem","t15","height","t16","t17","t18","toLocaleString","t19","t20","t21","t22","icon_0","_c","ComponentProps","SquareDashedIconProps","SquareDashedIcon","props","$","_c","t0","t1","t10","t11","t2","t3","t4","t5","t6","t7","t8","t9","Symbol","for","t12","_c","isDefined","SanityIconConfig","SanityIconOptions","SanityIconSelection","resolveIconOptions","options","config","library","style","icons","Partial","defaultIconProps","convertCase","isDefined","CloseIcon","Button","Flex","useEffect","useState","ObjectInputProps","ObjectSchemaType","set","setIfMissing","unset","Drawing","Picker","logger","SquareDashedIcon","LibraryIcon","requestLibrary","selectIcons","resolveIconDrawing","serializeIconDrawing","resolveIconOptions","SanityIconConfig","SanityIconOptions","SanityIcon","iconTypeName","IconSchemaType","options","InputProps","Partial","createSelectionPatches","icon","library","style","_type","name","drawing","createInput","config","Input","t0","$","_c","id","schemaType","value","onChange","readOnly","storedLibrary","node","open","setOpen","icons","selectedDrawing","selectedName","undefined","selectedLabel","undrawnName","active","saveDrawing","libraryIcons","find","candidate","warn","handleSelect","icon_0","T0","t1","T1","t2","t3","t4","t5","t6","t7","t8","t9","t10","t11","_c","isDefined","createElement","Drawing","resolveIconDrawing","SanityIcon","createIconPreview","value","drawing","node","undefined","IconPreview","width","height","Field","createSanityIcon","convertCase","isDefined","defineField","defineType","createInput","SquareDashedIcon","createIconPreview","SanityIconConfig","SanityIcon","iconTypeName","createIconType","config","name","type","icon","description","components","field","input","validation","rule","custom","value","Partial","node","preview","select","prepare","selection","title","media","_type","fields","BaseSchemaTypeOptions","InitialValueProperty","TypeAliasDefinition","definePlugin","pluginName","createIconType","IconLibraryId","ListedLibraryId","SanityIconName","SanityIconStyle","iconTypeName","IntrinsicDefinitions","icon","SanityIconDefinition","SanityIconSelection","library","Library","style","icons","SanityIconOptions","SanityIconInitialValue","name","Omit","options","initialValue","SanityIconConfig","plugin","config","schema","types","iconPlugin"],"sources":["../../@repo/components/field.tsx","../../@repo/lib/icons.ts","../src/config/grid.ts","../src/components/picker/cell.tsx","../src/components/picker/library.tsx","../src/components/picker/problem.tsx","../src/components/picker/recent.tsx","../src/components/picker/tooltip.tsx","../src/hooks/use-icon-library.ts","../src/hooks/use-icon-tooltip.ts","../src/lib/recent.ts","../src/hooks/use-recent-icons.ts","../src/lib/grid.ts","../src/components/picker/picker.tsx","../src/icons/square-dashed.tsx","../src/lib/options.ts","../src/components/input.tsx","../src/lib/preview.ts","../src/schemas/types/icon.ts","../src/plugin.ts"],"sourcesContent":["import { isDefined } from \"@repo/lib/utils\";\nimport { useState } from \"react\";\nimport type {\n ArrayOfObjectsFormNode,\n ArrayOfObjectsMember,\n BaseFormNode,\n DocumentFieldActionNode,\n ObjectFieldProps,\n ObjectFormNode,\n ObjectMember,\n} from \"sanity\";\nimport {\n ChangeIndicator,\n FieldActionsProvider,\n FieldActionsResolver,\n FormField,\n getPublishedId,\n useFormValue,\n} from \"sanity\";\n\n/**\n * Checks whether a form node has members, as objects and arrays of objects do.\n *\n * @param node - The form node to check.\n * @returns True if the node has members.\n */\nfunction hasMembers(node: BaseFormNode): node is ObjectFormNode | ArrayOfObjectsFormNode {\n return \"members\" in node;\n}\n\n/**\n * Collects the validation on a form node and everything inside it.\n *\n * @param node - The form node.\n * @returns Every validation result on the node or inside it.\n */\nfunction collectNodeValidation(node: BaseFormNode): BaseFormNode[\"validation\"] {\n return [...node.validation, ...(hasMembers(node) ? collectMemberValidation(node.members) : [])];\n}\n\n/**\n * Collects the validation anywhere inside a field's members. The form only passes a field the\n * validation at its own path, so a field that hides its members would otherwise show none of theirs.\n *\n * @param members - The members.\n * @returns Every validation result on the members or inside them.\n */\nfunction collectMemberValidation(members: (ObjectMember | ArrayOfObjectsMember)[]): BaseFormNode[\"validation\"] {\n return members.flatMap((member) => {\n if (member.kind === \"field\") return collectNodeValidation(member.field);\n if (member.kind === \"fieldSet\") return collectMemberValidation(member.fieldSet.members);\n if (member.kind === \"item\") return collectNodeValidation(member.item);\n\n return [];\n });\n}\n\nexport type FieldProps = ObjectFieldProps;\n\nexport function Field({\n actions,\n schemaType,\n title,\n description,\n presence,\n validation,\n level,\n inputId,\n path,\n changed,\n children,\n inputProps,\n}: FieldProps) {\n const [headerActions, setHeaderActions] = useState<DocumentFieldActionNode[]>([]);\n\n const documentId = useFormValue([\"_id\"]);\n const publishedId = typeof documentId === \"string\" ? getPublishedId(documentId) : undefined;\n const focused = inputProps.focused === true;\n const fieldValidation = [...validation, ...collectMemberValidation(inputProps.members)];\n\n return (\n <>\n {isDefined(publishedId) && isDefined(actions) && (\n <FieldActionsResolver\n actions={actions}\n documentId={publishedId}\n documentType={schemaType.name}\n onActions={setHeaderActions}\n path={path}\n schemaType={schemaType}\n />\n )}\n <FieldActionsProvider actions={headerActions} focused={focused} path={path}>\n <FormField\n __unstable_headerActions={headerActions}\n __unstable_presence={presence}\n description={description}\n inputId={inputId}\n level={level}\n title={title}\n validation={fieldValidation}\n deprecated={schemaType.deprecated}\n path={path}\n readOnly={inputProps.readOnly}\n >\n <ChangeIndicator path={path} hasFocus={focused} isChanged={changed}>\n {children}\n </ChangeIndicator>\n </FormField>\n </FieldActionsProvider>\n </>\n );\n}\n","import type { ComponentProps, ComponentType } from \"react\";\nimport { createElement } from \"react\";\n\n/** Default props for the plugin's own icons. Icons from `@sanity/icons` already match the Studio. */\nexport const defaultIconProps: ComponentProps<\"svg\"> = { width: \"1em\", height: \"1em\", strokeWidth: 1.5 };\n\n/**\n * Wraps an SVG icon component for use in the Studio.\n *\n * @param icon - The icon to wrap.\n * @param props - Props that override the Studio icon defaults.\n * @returns An icon component.\n */\nexport function createSanityIcon(icon: ComponentType<ComponentProps<\"svg\">>, props?: ComponentProps<\"svg\">) {\n const Icon = icon;\n\n function SanityIcon() {\n return createElement(Icon, { ...defaultIconProps, ...props });\n }\n\n return SanityIcon;\n}\n","/** Cell size in pixels, fixed so the grid never reflows. */\nexport const gridCellSize = 40;\n\n/** Gap between rows in pixels. */\nconst gridRowGap = 4;\n\n/** Distance from one row to the next, used to position the rendered rows. */\nexport const gridRowHeight = gridCellSize + gridRowGap;\n\n/** Icons per row. */\nexport const gridColumns = 8;\n\n/** Rows visible at once. */\nexport const gridVisibleRows = 8;\n\n/** Height of the scrolling area. The last row has no gap after it. */\nexport const gridHeight = gridVisibleRows * gridRowHeight - gridRowGap;\n\n/** Extra rows rendered above and below the visible ones, so rows are already drawn as they scroll into view. */\nexport const gridOverscan = gridVisibleRows;\n\n/** Layout shared by both grids, so recent icons line up with the library's columns. */\nexport const gridLayoutStyle = { justifyItems: \"center\", rowGap: gridRowGap } as const;\n","import { Button } from \"@sanity/ui\";\nimport type { ComponentProps } from \"react\";\n\nimport { Drawing } from \"@/components/drawing\";\nimport { gridCellSize } from \"@/config/grid\";\nimport type { LibraryIcon } from \"@/lib/library\";\n\nexport type CellProps = Omit<\n ComponentProps<typeof Button>,\n \"icon\" | \"selected\" | \"onSelect\" | \"onClick\" | \"onMouseEnter\"\n> & {\n icon: LibraryIcon;\n selected: boolean;\n focusable: boolean;\n position: number;\n total: number;\n onSelect: (icon: LibraryIcon) => void;\n onHover: (icon: LibraryIcon, element: HTMLElement) => void;\n};\n\nexport function Cell({ icon, selected, focusable, position, total, onSelect, onHover, ...props }: CellProps) {\n return (\n <Button\n type=\"button\"\n role=\"option\"\n aria-selected={selected}\n aria-posinset={position}\n aria-setsize={total}\n tabIndex={focusable ? 0 : -1}\n mode=\"bleed\"\n selected={selected}\n padding={0}\n style={{ width: gridCellSize, height: gridCellSize }}\n icon={<Drawing drawing={icon.drawing} width=\"1.25em\" height=\"1.25em\" />}\n aria-label={icon.label}\n onClick={() => {\n onSelect(icon);\n }}\n onMouseEnter={(event) => {\n onHover(icon, event.currentTarget);\n }}\n {...props}\n />\n );\n}\n","import { isDefined } from \"@repo/lib/utils\";\nimport { Box, Button, Flex, Grid, Text } from \"@sanity/ui\";\nimport type { ComponentProps, RefObject } from \"react\";\n\nimport type { CellProps } from \"@/components/picker/cell\";\nimport { Cell } from \"@/components/picker/cell\";\nimport { gridColumns, gridHeight, gridLayoutStyle, gridRowHeight } from \"@/config/grid\";\nimport type { getVisibleRows } from \"@/lib/grid\";\nimport type { LibraryIcon } from \"@/lib/library\";\n\nexport type LibraryProps = Omit<ComponentProps<typeof Box>, \"children\" | \"onSelect\"> & {\n icons: LibraryIcon[];\n rows: ReturnType<typeof getVisibleRows>;\n selected: string | undefined;\n activeIndex: number;\n activeCell: RefObject<HTMLButtonElement | null>;\n search: string;\n onSelect: (icon: LibraryIcon) => void;\n onHover: CellProps[\"onHover\"];\n onClearSearch: () => void;\n};\n\nexport function Library({\n icons,\n rows,\n selected,\n activeIndex,\n activeCell,\n search,\n onSelect,\n onHover,\n onClearSearch,\n ...props\n}: LibraryProps) {\n const { totalRows, firstRow, lastRow } = rows;\n const visible = icons.slice(firstRow * gridColumns, lastRow * gridColumns);\n\n return (\n <Box\n role=\"listbox\"\n aria-label=\"Icon library\"\n style={isDefined(icons) ? { height: gridHeight, overflowY: \"auto\" } : undefined}\n {...props}\n >\n {!isDefined(icons) && (\n <Flex align=\"center\" justify=\"center\" direction=\"column\" gap={3} paddingTop={5} paddingBottom={6}>\n <Text size={1} muted>{`Nothing matches \"${search}\".`}</Text>\n <Button type=\"button\" mode=\"ghost\" text=\"Clear search\" onClick={onClearSearch} />\n </Flex>\n )}\n {isDefined(icons) && (\n <Grid\n gridTemplateColumns={gridColumns}\n style={{\n ...gridLayoutStyle,\n paddingTop: firstRow * gridRowHeight,\n paddingBottom: (totalRows - lastRow) * gridRowHeight,\n }}\n >\n {visible.map((icon, offset) => {\n const index = firstRow * gridColumns + offset;\n\n return (\n <Cell\n key={icon.name}\n ref={index === activeIndex ? activeCell : undefined}\n icon={icon}\n selected={icon.name === selected}\n focusable={index === activeIndex}\n position={index + 1}\n total={icons.length}\n onSelect={onSelect}\n onHover={onHover}\n />\n );\n })}\n </Grid>\n )}\n </Box>\n );\n}\n","import { WarningOutlineIcon } from \"@sanity/icons/WarningOutline\";\nimport { Card, Flex, Stack, Text } from \"@sanity/ui\";\nimport type { ComponentProps } from \"react\";\n\nimport type { LibraryProblem } from \"@/lib/library\";\n\nexport type CodeTextProps = Omit<ComponentProps<\"span\">, \"children\"> & {\n text: string;\n};\n\nexport function CodeText({ text, ...props }: CodeTextProps) {\n const parts = text.split(\"`\");\n\n return (\n <span {...props}>\n {parts.map((part, index) => {\n const start = parts.slice(0, index).join(\"`\").length;\n\n return index % 2 === 1 ? <code key={start}>{part}</code> : part;\n })}\n </span>\n );\n}\n\nexport type ProblemProps = Omit<ComponentProps<typeof Card>, \"children\"> & {\n problem: LibraryProblem;\n};\n\nexport function Problem({ problem, ...props }: ProblemProps) {\n return (\n <Card tone=\"caution\" padding={4} radius={2} border {...props}>\n <Flex gap={3}>\n <Text size={1}>\n <WarningOutlineIcon />\n </Text>\n <Stack gap={3}>\n <Text size={1} weight=\"medium\">\n <CodeText text={problem.title} />\n </Text>\n <Text size={1} muted>\n <CodeText text={problem.description} />\n </Text>\n </Stack>\n </Flex>\n </Card>\n );\n}\n","import { Button, Flex, Grid, Stack, Text } from \"@sanity/ui\";\nimport type { ComponentProps } from \"react\";\n\nimport type { CellProps } from \"@/components/picker/cell\";\nimport { Cell } from \"@/components/picker/cell\";\nimport { gridColumns, gridLayoutStyle } from \"@/config/grid\";\nimport type { LibraryIcon } from \"@/lib/library\";\n\nexport type RecentProps = Omit<ComponentProps<typeof Stack>, \"children\" | \"onSelect\"> & {\n icons: LibraryIcon[];\n selected: string | undefined;\n onSelect: (icon: LibraryIcon) => void;\n onHover: CellProps[\"onHover\"];\n onForget: () => void;\n};\n\nexport function Recent({ icons, selected, onSelect, onHover, onForget, ...props }: RecentProps) {\n return (\n <Stack gap={3} {...props}>\n <Flex align=\"center\" justify=\"space-between\" gap={2}>\n <Text size={1} weight=\"medium\" muted>\n Recent icons\n </Text>\n <Button\n type=\"button\"\n mode=\"bleed\"\n fontSize={1}\n padding={2}\n text=\"Clear\"\n onClick={onForget}\n aria-label=\"Clear recent icons\"\n />\n </Flex>\n <Grid role=\"listbox\" aria-label=\"Recent icons\" gridTemplateColumns={gridColumns} style={gridLayoutStyle}>\n {icons.map((icon, index) => (\n <Cell\n key={icon.name}\n icon={icon}\n selected={icon.name === selected}\n focusable\n position={index + 1}\n total={icons.length}\n onSelect={onSelect}\n onHover={onHover}\n />\n ))}\n </Grid>\n </Stack>\n );\n}\n","import { isDefined } from \"@repo/lib/utils\";\nimport { Stack, Text } from \"@sanity/ui\";\nimport { Popover } from \"@sanity/ui/popover\";\nimport type { CSSProperties, ComponentProps } from \"react\";\n\nimport type { LibraryIcon } from \"@/lib/library\";\nimport { splitMatches } from \"@/lib/library\";\n\n/** Icon under the cursor and the cell showing it. */\nexport interface HoveredIcon {\n /** Icon in the cell. */\n icon: LibraryIcon;\n /** Cell the tooltip points at. */\n element: HTMLElement;\n}\n\n/**\n * Gap between the tooltip and its cell, set through margins because `@sanity/ui` offers no other way.\n * Only the top is set, since the tooltip always appears above the cell.\n */\nconst tooltipMargins: [number, number, number, number] = [-4, 0, 0, 0];\n\n/** Underlines a search match in place of the browser's highlighter-pen look, keeping the text's own colour. */\nconst matchStyle: CSSProperties = {\n background: \"none\",\n color: \"inherit\",\n textDecorationLine: \"underline\",\n textUnderlineOffset: \"0.2em\",\n};\n\nexport type HighlightProps = Omit<ComponentProps<\"span\">, \"children\"> & {\n text: string;\n query: string;\n};\n\nexport function Highlight({ text, query, ...props }: HighlightProps) {\n return (\n <span {...props}>\n {splitMatches(text, query).map((part) =>\n part.match ? (\n <mark key={part.start} style={matchStyle}>\n {part.text}\n </mark>\n ) : (\n part.text\n ),\n )}\n </span>\n );\n}\n\nexport type TooltipProps = Omit<ComponentProps<typeof Popover>, \"open\" | \"referenceElement\" | \"content\"> & {\n hovered: HoveredIcon | undefined;\n query: string;\n};\n\nexport function Tooltip({ hovered, query, ...props }: TooltipProps) {\n return (\n <Popover\n open={isDefined(hovered)}\n referenceElement={hovered?.element ?? null}\n placement=\"top\"\n portal\n padding={3}\n __unstable_margins={tooltipMargins}\n style={{ pointerEvents: \"none\" }}\n content={\n isDefined(hovered) && (\n <Stack gap={3} style={{ maxWidth: \"16rem\" }}>\n <Text size={1} weight=\"medium\">\n <Highlight text={hovered.icon.label} query={query} />\n </Text>\n {isDefined(hovered.icon.tags) && (\n <Text size={1} muted>\n <Highlight text={hovered.icon.tags} query={query} />\n </Text>\n )}\n </Stack>\n )\n }\n {...props}\n />\n );\n}\n","import { useEffect, useState } from \"react\";\n\nimport type { LibraryResult } from \"@/lib/library\";\nimport { requestLibrary } from \"@/lib/library\";\n\n/**\n * Loads an icon library style. Only an open picker calls this, so a Studio that never opens one never loads it.\n *\n * @param library - Identifier of the library, or undefined when none is set.\n * @param style - Identifier of the style, or undefined for the library's default.\n * @returns The icons or why they can't be shown, or undefined while loading.\n */\nexport function useIconLibrary(library: string | undefined, style: string | undefined) {\n const [result, setResult] = useState<LibraryResult>();\n\n useEffect(() => {\n let active = true;\n\n async function load() {\n const loaded = await requestLibrary(library, style);\n if (active) setResult(loaded);\n }\n\n void load();\n\n return () => {\n active = false;\n };\n }, [library, style]);\n\n return result;\n}\n","import { isDefined } from \"@repo/lib/utils\";\nimport { useEffect, useRef, useState } from \"react\";\n\nimport type { HoveredIcon } from \"@/components/picker/tooltip\";\nimport type { LibraryIcon } from \"@/lib/library\";\n\n/**\n * Tracks the icon under the cursor, showing its tooltip after a short delay. Tooltips are held back while the grid\n * scrolls, and the icon left under the cursor gets its tooltip once scrolling stops.\n *\n * @param scrolling - Whether the grid is scrolling.\n * @returns The hovered icon, and functions to update and clear it.\n */\nexport function useIconTooltip(scrolling: boolean) {\n const [hovered, setHovered] = useState<HoveredIcon>();\n const hoverStart = useRef<ReturnType<typeof setTimeout>>(undefined);\n const scrolledOnto = useRef<HoveredIcon>(undefined);\n\n useEffect(\n () => () => {\n if (isDefined(hoverStart.current)) clearTimeout(hoverStart.current);\n },\n [],\n );\n\n useEffect(() => {\n const landed = scrolledOnto.current;\n if (scrolling || !isDefined(landed)) return;\n\n scrolledOnto.current = undefined;\n if (!landed.element.isConnected || !landed.element.matches(\":hover\")) return;\n\n hoverStart.current = setTimeout(() => {\n setHovered(landed);\n }, 200);\n }, [scrolling]);\n\n function clearHover() {\n if (isDefined(hoverStart.current)) clearTimeout(hoverStart.current);\n if (isDefined(hovered)) setHovered(undefined);\n }\n\n function handleHover(icon: LibraryIcon, element: HTMLElement) {\n if (scrolling) {\n scrolledOnto.current = { icon, element };\n\n return;\n }\n\n if (element === hovered?.element) return;\n\n if (isDefined(hoverStart.current)) clearTimeout(hoverStart.current);\n\n if (isDefined(hovered)) {\n setHovered({ icon, element });\n\n return;\n }\n\n hoverStart.current = setTimeout(() => {\n setHovered({ icon, element });\n }, 200);\n }\n\n return { hovered, handleHover, clearHover };\n}\n","/** Local storage key for recent icons, which are kept in the browser rather than the dataset. */\nconst storageKey = \"driftime:sanity-plugin-icon:recent\";\n\n/** Number of recent icons to keep. */\nconst limit = 8;\n\n/**\n * Builds the storage key for one library style.\n *\n * @param scope - The library and style, such as `phosphor/bold`.\n * @returns The storage key.\n */\nfunction getStorageKey(scope: string) {\n return `${storageKey}:${scope}`;\n}\n\n/**\n * Reads the recently chosen icons.\n *\n * @param scope - The library and style, such as `phosphor/bold`.\n * @returns The icon names, most recent first.\n */\nexport function readRecent(scope: string) {\n try {\n const stored: unknown = JSON.parse(globalThis.localStorage.getItem(getStorageKey(scope)) ?? \"[]\");\n if (!Array.isArray(stored)) return [];\n\n return stored.filter((entry: unknown) => typeof entry === \"string\");\n } catch {\n return [];\n }\n}\n\n/**\n * Adds an icon to the front of the recent list.\n *\n * @param scope - The library and style, such as `phosphor/bold`.\n * @param name - The chosen icon's name.\n * @returns The updated icon names, most recent first.\n */\nexport function writeRecent(scope: string, name: string) {\n const updated = [name, ...readRecent(scope).filter((entry) => entry !== name)].slice(0, limit);\n\n try {\n globalThis.localStorage.setItem(getStorageKey(scope), JSON.stringify(updated));\n } catch {\n // If storage is blocked, the icon just isn't remembered.\n }\n\n return updated;\n}\n\n/**\n * Clears the recent icons.\n *\n * @param scope - The library and style, such as `phosphor/bold`.\n */\nexport function clearRecent(scope: string) {\n try {\n globalThis.localStorage.removeItem(getStorageKey(scope));\n } catch {\n // If storage is blocked, there's nothing to clear.\n }\n}\n","import { useState } from \"react\";\n\nimport { clearRecent, readRecent, writeRecent } from \"@/lib/recent\";\n\n/**\n * Tracks the icons an author chose most recently from one library style. The list is read when the picker opens, so\n * choices made in another tab are included.\n *\n * @param scope - The library and style, such as `phosphor/bold`.\n * @returns The recent icon names, most recent first, and functions to add to and clear them.\n */\nexport function useRecentIcons(scope: string) {\n const [recent, setRecent] = useState<string[]>(() => readRecent(scope));\n\n function remember(name: string) {\n setRecent(writeRecent(scope, name));\n }\n\n function forget() {\n clearRecent(scope);\n setRecent([]);\n }\n\n return { recent, remember, forget };\n}\n","import { gridColumns, gridHeight, gridOverscan, gridRowHeight, gridVisibleRows } from \"@/config/grid\";\n\n/**\n * Works out which icon a key press moves to.\n *\n * @param key - The key pressed.\n * @param current - Index of the current icon.\n * @param last - Index of the last icon.\n * @returns The new index, or undefined when the key doesn't move.\n */\nexport function getNextIndex(key: string, current: number, last: number) {\n if (key === \"ArrowRight\") return current + 1;\n if (key === \"ArrowLeft\") return current - 1;\n if (key === \"ArrowDown\") return current + gridColumns;\n if (key === \"ArrowUp\") return current - gridColumns;\n if (key === \"Home\") return 0;\n if (key === \"End\") return last;\n\n return undefined;\n}\n\n/**\n * Works out which rows to render at a scroll position, so only icons near the viewport are mounted.\n * Padding replaces the other rows, so the scrollbar stays the right size.\n *\n * @param scrollRow - The row scrolled to.\n * @param count - Number of icons in the results.\n * @returns The first and last rows to render, and the total number of rows.\n */\nexport function getVisibleRows(scrollRow: number, count: number) {\n const totalRows = Math.ceil(count / gridColumns);\n const firstRow = Math.max(0, scrollRow - gridOverscan);\n const lastRow = Math.min(totalRows, firstRow + gridVisibleRows + gridOverscan * 2);\n\n return { totalRows, firstRow, lastRow };\n}\n\n/**\n * Works out the scroll position that centres an icon, for opening on the selected icon.\n *\n * @param index - Index of the icon.\n * @returns The scroll position.\n */\nexport function getCenteredScrollTop(index: number) {\n return Math.max(0, Math.floor(index / gridColumns) * gridRowHeight - gridHeight / 2);\n}\n\n/**\n * Works out the scroll position that brings an icon into view, keeping the current one if it's\n * already visible. It uses the index because Home and End can move to rows that aren't mounted.\n *\n * @param index - Index of the icon.\n * @param scrollTop - The current scroll position.\n * @returns The scroll position.\n */\nexport function getRevealedScrollTop(index: number, scrollTop: number) {\n const top = Math.floor(index / gridColumns) * gridRowHeight;\n\n if (top < scrollTop) return top;\n if (top + gridRowHeight > scrollTop + gridHeight) return top + gridRowHeight - gridHeight;\n\n return scrollTop;\n}\n","import { isDefined } from \"@repo/lib/utils\";\nimport { SearchIcon } from \"@sanity/icons/Search\";\nimport { Box, Dialog, Flex, Spinner, Stack, Text, TextInput } from \"@sanity/ui\";\nimport type { ChangeEvent, ComponentProps, KeyboardEvent } from \"react\";\nimport { useEffect, useRef, useState } from \"react\";\n\nimport { Library } from \"@/components/picker/library\";\nimport { Problem } from \"@/components/picker/problem\";\nimport { Recent } from \"@/components/picker/recent\";\nimport { Tooltip } from \"@/components/picker/tooltip\";\nimport { gridHeight, gridRowHeight } from \"@/config/grid\";\nimport { useIconLibrary } from \"@/hooks/use-icon-library\";\nimport { useIconTooltip } from \"@/hooks/use-icon-tooltip\";\nimport { useRecentIcons } from \"@/hooks/use-recent-icons\";\nimport { getCenteredScrollTop, getNextIndex, getRevealedScrollTop, getVisibleRows } from \"@/lib/grid\";\nimport type { LibraryIcon } from \"@/lib/library\";\nimport { normalizeTerms, selectIcons } from \"@/lib/library\";\nimport { getIconSetKey } from \"@/lib/registry\";\n\nexport type PickerProps = Omit<\n ComponentProps<typeof Dialog>,\n \"children\" | \"header\" | \"width\" | \"selected\" | \"onSelect\"\n> & {\n library: string | undefined;\n iconStyle: string | undefined;\n allowed: string[] | undefined;\n selected: string | undefined;\n onSelect: (icon: LibraryIcon) => void;\n};\n\nexport function Picker({ library: libraryName, iconStyle, allowed, selected, onSelect, ...props }: PickerProps) {\n const result = useIconLibrary(libraryName, iconStyle);\n const library = result?.icons;\n const icons = selectIcons(library ?? [], allowed);\n const { recent, remember, forget } = useRecentIcons(getIconSetKey(libraryName ?? \"\", iconStyle ?? \"default\"));\n\n const [search, setSearch] = useState(\"\");\n const [scrollRow, setScrollRow] = useState(0);\n const [movedIndex, setMovedIndex] = useState<number>();\n const [scrolling, setScrolling] = useState(false);\n\n const scroller = useRef<HTMLDivElement>(null);\n const activeCell = useRef<HTMLButtonElement>(null);\n const focusIndex = useRef<number>(undefined);\n const scrollFrame = useRef<number>(undefined);\n const scrollStop = useRef<ReturnType<typeof setTimeout>>(undefined);\n\n const query = normalizeTerms(search);\n const searching = isDefined(query);\n const results = icons.filter((icon) => !searching || icon.terms.includes(query));\n\n const byName = new Map(icons.map((icon) => [icon.name, icon]));\n const recentIcons = searching\n ? []\n : recent.flatMap((entry) => {\n const icon = byName.get(entry);\n\n return isDefined(icon) ? [icon] : [];\n });\n\n const { hovered, handleHover, clearHover } = useIconTooltip(scrolling);\n\n const rows = getVisibleRows(scrollRow, results.length);\n\n const selectedIndex = searching || !isDefined(selected) ? -1 : icons.findIndex((icon) => icon.name === selected);\n const activeIndex = movedIndex ?? Math.max(0, selectedIndex);\n\n useEffect(() => {\n const element = scroller.current;\n if (!isDefined(element) || selectedIndex === -1) return;\n\n element.scrollTop = getCenteredScrollTop(selectedIndex);\n }, [scroller, selectedIndex]);\n\n useEffect(\n () => () => {\n if (isDefined(scrollFrame.current)) cancelAnimationFrame(scrollFrame.current);\n if (isDefined(scrollStop.current)) clearTimeout(scrollStop.current);\n },\n [],\n );\n\n useEffect(() => {\n if (focusIndex.current !== activeIndex) return;\n\n focusIndex.current = undefined;\n if (isDefined(activeCell.current)) activeCell.current.focus();\n }, [activeIndex]);\n\n function handleSelect(icon: LibraryIcon) {\n remember(icon.name);\n onSelect(icon);\n }\n\n function clearSearch() {\n setSearch(\"\");\n setMovedIndex(undefined);\n }\n\n function handleSearch(event: ChangeEvent<HTMLInputElement>) {\n setSearch(event.currentTarget.value);\n setMovedIndex(undefined);\n\n if (isDefined(scroller.current)) scroller.current.scrollTop = 0;\n }\n\n function selectActive() {\n const icon = results[activeIndex];\n\n if (isDefined(icon)) handleSelect(icon);\n }\n\n function handleSearchKeyDown(event: KeyboardEvent<HTMLInputElement>) {\n if (event.key === \"Enter\") {\n event.preventDefault();\n selectActive();\n\n return;\n }\n\n if (event.key !== \"ArrowDown\") return;\n\n event.preventDefault();\n\n if (isDefined(activeCell.current)) activeCell.current.focus();\n }\n\n function handleScroll() {\n clearHover();\n if (!scrolling) setScrolling(true);\n\n if (isDefined(scrollStop.current)) clearTimeout(scrollStop.current);\n scrollStop.current = setTimeout(() => {\n setScrolling(false);\n }, 150);\n\n if (isDefined(scrollFrame.current)) return;\n\n scrollFrame.current = requestAnimationFrame(() => {\n scrollFrame.current = undefined;\n\n const element = scroller.current;\n if (isDefined(element)) setScrollRow(Math.floor(element.scrollTop / gridRowHeight));\n });\n }\n\n function handleGridKeyDown(event: KeyboardEvent<HTMLDivElement>) {\n const last = results.length - 1;\n if (last < 0) return;\n\n if (event.key === \"Enter\" || event.key === \" \") {\n event.preventDefault();\n selectActive();\n\n return;\n }\n\n const next = getNextIndex(event.key, activeIndex, last);\n if (!isDefined(next)) return;\n\n event.preventDefault();\n\n const index = Math.min(Math.max(next, 0), last);\n focusIndex.current = index;\n setMovedIndex(index);\n\n const element = scroller.current;\n if (!isDefined(element)) return;\n\n element.scrollTop = getRevealedScrollTop(index, element.scrollTop);\n }\n\n return (\n <Dialog header=\"Select icon\" width={1} {...props}>\n <Stack gap={4} padding={4}>\n {!isDefined(result?.problem) && (\n <TextInput\n type=\"search\"\n icon={<SearchIcon />}\n placeholder=\"Search by name or keyword\"\n value={search}\n onChange={handleSearch}\n onKeyDown={handleSearchKeyDown}\n disabled={!isDefined(library) || !isDefined(icons)}\n aria-label=\"Search the icon library\"\n />\n )}\n {!isDefined(result) && (\n <Flex align=\"center\" justify=\"center\" style={{ height: gridHeight }}>\n <Spinner muted />\n </Flex>\n )}\n {isDefined(result?.problem) && <Problem problem={result.problem} />}\n {isDefined(recentIcons) && (\n <Recent\n icons={recentIcons}\n selected={selected}\n onSelect={handleSelect}\n onHover={handleHover}\n onForget={forget}\n onMouseLeave={clearHover}\n />\n )}\n {isDefined(library) && (\n <Stack gap={3}>\n <Box paddingY={2}>\n <Text size={1} weight=\"medium\" muted>\n All icons ({results.length.toLocaleString(\"en-US\")})\n </Text>\n </Box>\n {!isDefined(icons) && (\n <Flex align=\"center\" justify=\"center\" paddingTop={5} paddingBottom={6}>\n <Text size={1} muted>\n No icons available.\n </Text>\n </Flex>\n )}\n {isDefined(icons) && (\n <Library\n ref={scroller}\n icons={results}\n rows={rows}\n selected={selected}\n activeIndex={activeIndex}\n activeCell={activeCell}\n search={search}\n onSelect={handleSelect}\n onHover={handleHover}\n onClearSearch={clearSearch}\n onScroll={handleScroll}\n onMouseLeave={clearHover}\n onKeyDown={handleGridKeyDown}\n />\n )}\n </Stack>\n )}\n <Tooltip key={hovered?.icon.name} hovered={hovered} query={query} />\n </Stack>\n </Dialog>\n );\n}\n","import type { ComponentProps } from \"react\";\n\nexport type SquareDashedIconProps = ComponentProps<\"svg\">;\n\nexport function SquareDashedIcon(props: SquareDashedIconProps) {\n return (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width={24}\n height={24}\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth={2}\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n {...props}\n >\n <path d=\"M5 3a2 2 0 0 0-2 2\" />\n <path d=\"M19 3a2 2 0 0 1 2 2\" />\n <path d=\"M21 19a2 2 0 0 1-2 2\" />\n <path d=\"M5 21a2 2 0 0 1-2-2\" />\n <path d=\"M9 3h1\" />\n <path d=\"M9 21h1\" />\n <path d=\"M14 3h1\" />\n <path d=\"M14 21h1\" />\n <path d=\"M3 9v1\" />\n <path d=\"M21 9v1\" />\n <path d=\"M3 14v1\" />\n <path d=\"M21 14v1\" />\n </svg>\n );\n}\n","import { isDefined } from \"@repo/lib/utils\";\n\nimport type { SanityIconConfig, SanityIconOptions, SanityIconSelection } from \"@/plugin\";\n\n/**\n * Resolves the library, style, and icons a field offers. A field that names a library replaces all three of the\n * plugin's, and one that doesn't uses the plugin's.\n *\n * @param options - The field's options.\n * @param config - The plugin configuration.\n * @returns The field's settings, whose library is undefined when neither the field nor the plugin names one.\n */\nexport function resolveIconOptions(options: SanityIconOptions | undefined, config: SanityIconConfig | undefined) {\n const { library, style, icons }: Partial<SanityIconSelection> =\n (isDefined(options?.library) ? options : config) ?? {};\n\n return { library, style, icons };\n}\n","import { defaultIconProps } from \"@repo/lib/icons\";\nimport { convertCase, isDefined } from \"@repo/lib/utils\";\nimport { CloseIcon } from \"@sanity/icons/Close\";\nimport { Button, Flex } from \"@sanity/ui\";\nimport { useEffect, useState } from \"react\";\nimport type { ObjectInputProps, ObjectSchemaType } from \"sanity\";\nimport { set, setIfMissing, unset } from \"sanity\";\n\nimport { Drawing } from \"@/components/drawing\";\nimport { Picker } from \"@/components/picker/picker\";\nimport { logger } from \"@/config/defaults\";\nimport { SquareDashedIcon } from \"@/icons/square-dashed\";\nimport type { LibraryIcon } from \"@/lib/library\";\nimport { requestLibrary, selectIcons } from \"@/lib/library\";\nimport { resolveIconDrawing, serializeIconDrawing } from \"@/lib/nodes\";\nimport { resolveIconOptions } from \"@/lib/options\";\nimport type { SanityIconConfig, SanityIconOptions } from \"@/plugin\";\nimport type { SanityIcon } from \"@/types\";\nimport { iconTypeName } from \"@/types\";\n\n/** Compiled icon field type, with the field's own options. */\ninterface IconSchemaType extends ObjectSchemaType {\n options?: SanityIconOptions;\n}\n\nexport type InputProps = ObjectInputProps<Partial<SanityIcon>, IconSchemaType>;\n\n/**\n * Creates the patches that store an icon, with the library and style it was chosen from.\n *\n * @param icon - The icon.\n * @param library - Identifier of the library, or undefined when none is set.\n * @param style - Identifier of the style, or undefined for the library's default.\n * @returns The patches.\n */\nfunction createSelectionPatches(icon: LibraryIcon, library: string | undefined, style: string | undefined) {\n return [\n setIfMissing({ _type: iconTypeName satisfies SanityIcon[\"_type\"] }),\n isDefined(library)\n ? set(library, [\"library\" satisfies keyof SanityIcon])\n : unset([\"library\" satisfies keyof SanityIcon]),\n isDefined(style) ? set(style, [\"style\" satisfies keyof SanityIcon]) : unset([\"style\" satisfies keyof SanityIcon]),\n set(icon.name, [\"name\" satisfies keyof SanityIcon]),\n set(serializeIconDrawing(icon.drawing), [\"node\" satisfies keyof SanityIcon]),\n ];\n}\n\n/**\n * Creates the icon field input, bound to the plugin's configuration. A field's own icons replace the\n * plugin's rather than adding to them.\n *\n * @param config - The plugin configuration.\n * @returns The input component.\n */\nexport function createInput(config: SanityIconConfig) {\n function Input({ id, schemaType, value, onChange, readOnly }: InputProps) {\n const { library: storedLibrary, name, node } = value ?? {};\n\n const [open, setOpen] = useState(false);\n\n const { library, style, icons } = resolveIconOptions(schemaType.options, config);\n const selectedDrawing = resolveIconDrawing(node);\n const selectedName = storedLibrary === library ? name : undefined;\n const selectedLabel = isDefined(name) ? convertCase(name, \"title\") : undefined;\n const undrawnName = isDefined(node) ? undefined : name;\n\n // An initial value names an icon without its drawing, so the drawing is saved when the field is first shown.\n useEffect(() => {\n let active = true;\n\n async function saveDrawing() {\n if (!isDefined(undrawnName) || readOnly === true) return;\n\n const { icons: libraryIcons } = await requestLibrary(library, style);\n if (!active || !isDefined(libraryIcons)) return;\n\n const icon = selectIcons(libraryIcons, icons).find((candidate) => candidate.name === undrawnName);\n\n if (!isDefined(icon)) {\n logger.warn(\n `The icon field \"${id}\" starts with \"${undrawnName}\", which isn't one of its icons. Change its initialValue.`,\n );\n\n return;\n }\n\n onChange(createSelectionPatches(icon, library, style));\n }\n\n void saveDrawing();\n\n return () => {\n active = false;\n };\n }, [id, undrawnName, readOnly, library, style, icons, onChange]);\n\n function handleSelect(icon: LibraryIcon) {\n onChange(createSelectionPatches(icon, library, style));\n setOpen(false);\n }\n\n return (\n <Flex gap={2}>\n <Button\n id={id}\n type=\"button\"\n mode=\"ghost\"\n icon={\n isDefined(selectedDrawing) ? (\n <Drawing drawing={selectedDrawing} width=\"1em\" height=\"1em\" />\n ) : (\n <SquareDashedIcon {...defaultIconProps} />\n )\n }\n text={selectedLabel ?? \"Select icon\"}\n disabled={readOnly}\n onClick={() => {\n setOpen(true);\n }}\n aria-label={isDefined(selectedLabel) ? `${selectedLabel} currently selected` : \"Select icon\"}\n />\n {isDefined(value) && (\n <Button\n type=\"button\"\n mode=\"ghost\"\n tone=\"critical\"\n icon={<CloseIcon />}\n text=\"Clear\"\n disabled={readOnly}\n onClick={() => {\n onChange(unset());\n }}\n aria-label=\"Clear the selected icon\"\n />\n )}\n {open && (\n <Picker\n id={`${id}-library`}\n library={library}\n iconStyle={style}\n allowed={icons}\n selected={selectedName}\n onSelect={handleSelect}\n onClose={() => {\n setOpen(false);\n }}\n onClickOutside={() => {\n setOpen(false);\n }}\n />\n )}\n </Flex>\n );\n }\n\n return Input;\n}\n","import { isDefined } from \"@repo/lib/utils\";\nimport { createElement } from \"react\";\n\nimport { Drawing } from \"@/components/drawing\";\nimport { resolveIconDrawing } from \"@/lib/nodes\";\nimport type { SanityIcon } from \"@/types\";\n\n/**\n * Creates preview media for a stored icon, so each document shows its own icon instead of a placeholder.\n *\n * @param value - The stored icon.\n * @returns The media component, or undefined when nothing readable was stored.\n * @public\n */\nexport function createIconPreview(value: SanityIcon | undefined) {\n const drawing = resolveIconDrawing(value?.node);\n if (!isDefined(drawing)) return undefined;\n\n return function IconPreview() {\n return createElement(Drawing, { drawing, width: \"1em\", height: \"1em\" });\n };\n}\n","import { Field } from \"@repo/components/field\";\nimport { createSanityIcon } from \"@repo/lib/icons\";\nimport { convertCase, isDefined } from \"@repo/lib/utils\";\nimport { defineField, defineType } from \"sanity\";\n\nimport { createInput } from \"@/components/input\";\nimport { SquareDashedIcon } from \"@/icons/square-dashed\";\nimport { createIconPreview } from \"@/lib/preview\";\nimport type { SanityIconConfig } from \"@/plugin\";\nimport type { SanityIcon } from \"@/types\";\nimport { iconTypeName } from \"@/types\";\n\n/**\n * Creates the icon object type, offering the plugin's icons to fields that don't set their own.\n *\n * @param config - The plugin configuration.\n * @returns The icon type.\n */\nexport function createIconType(config: SanityIconConfig) {\n return defineType({\n name: iconTypeName satisfies SanityIcon[\"_type\"],\n type: \"object\",\n icon: createSanityIcon(SquareDashedIcon),\n description: \"Icon chosen from an icon library.\",\n // Uses a primitive field's flat frame on purpose, instead of Sanity's collapsible object fieldset.\n components: { field: Field, input: createInput(config) },\n validation: (rule) =>\n rule.custom((value: Partial<SanityIcon> | undefined) =>\n !isDefined(value?.name) || isDefined(value.node) ? true : \"Select the icon again to save its drawing.\",\n ),\n preview: {\n select: {\n name: \"name\",\n node: \"node\",\n },\n prepare(selection: { name?: string; node?: string }) {\n const { name, node } = selection;\n\n return {\n title: isDefined(name) ? convertCase(name, \"title\") : \"No icon\",\n media: createIconPreview({ _type: iconTypeName, name, node }),\n };\n },\n },\n fields: [\n defineField({\n name: \"library\" satisfies keyof SanityIcon,\n type: \"string\",\n description: \"Identifier of the library the icon came from.\",\n }),\n defineField({\n name: \"style\" satisfies keyof SanityIcon,\n type: \"string\",\n description: \"Identifier of the library style the icon came from.\",\n }),\n defineField({\n name: \"name\" satisfies keyof SanityIcon,\n type: \"string\",\n description: \"Name of the icon in its library.\",\n }),\n defineField({\n name: \"node\" satisfies keyof SanityIcon,\n type: \"text\",\n description: \"Shapes the icon is drawn from, saved when it's chosen.\",\n }),\n ],\n });\n}\n","import type { BaseSchemaTypeOptions, InitialValueProperty, TypeAliasDefinition } from \"sanity\";\nimport { definePlugin } from \"sanity\";\n\nimport { pluginName } from \"@/config/defaults\";\nimport { createIconType } from \"@/schemas/types/icon\";\nimport type { IconLibraryId, ListedLibraryId, SanityIconName, SanityIconStyle, iconTypeName } from \"@/types\";\n\ndeclare module \"@sanity/types\" {\n interface IntrinsicDefinitions {\n /** Definition of a field of type `icon`. */\n icon: SanityIconDefinition;\n }\n}\n\n/**\n * A choice of library, style, and icons, where the style and icons are checked against the library.\n *\n * @public\n */\nexport type SanityIconSelection = {\n [Library in IconLibraryId]: {\n /** Identifier of the icon library, such as `phosphor`. */\n library: Library;\n /** Identifier of the library style, such as `bold`. Defaults to the library's first style. */\n style?: SanityIconStyle<Library>;\n /** Icons authors can choose from, in the order listed. Defaults to every icon. */\n icons?: SanityIconName<Library>[];\n };\n}[IconLibraryId];\n\n/**\n * Options for an icon field. A field that names a library replaces the plugin's library, style, and icons, and one\n * that doesn't uses the plugin's.\n *\n * @public\n */\nexport type SanityIconOptions = BaseSchemaTypeOptions &\n (SanityIconSelection | { library?: undefined; style?: undefined; icons?: undefined });\n\n/**\n * Icon a field starts with. The Studio saves its drawing from the field's library the first time the field is shown.\n *\n * @public\n */\nexport interface SanityIconInitialValue {\n /** Name of the icon, from any library the build step has listed. */\n name: SanityIconName<ListedLibraryId>;\n}\n\n/**\n * Definition of a field or array member holding an icon, so its options and initial value are type-checked like a\n * built-in type's.\n *\n * @public\n */\nexport interface SanityIconDefinition extends Omit<\n TypeAliasDefinition<typeof iconTypeName, undefined>,\n \"options\" | \"initialValue\"\n> {\n /** Options for the field. */\n options?: SanityIconOptions;\n /** Icon the field starts with, or a function that returns one. */\n initialValue?: InitialValueProperty<unknown, SanityIconInitialValue>;\n}\n\n/**\n * Plugin configuration, naming the library every icon field uses unless it names its own.\n *\n * @public\n */\nexport type SanityIconConfig = SanityIconSelection;\n\nconst plugin = definePlugin<SanityIconConfig>((config) => ({\n name: pluginName,\n schema: {\n types: [createIconType(config)],\n },\n}));\n\n/**\n * Adds an icon field type to Sanity Studio, with a searchable picker for the installed icon libraries that\n * stores the chosen icon's drawing.\n *\n * @param config - The plugin configuration.\n * @returns The plugin.\n * @public\n */\nexport function iconPlugin(config: SanityIconConfig) {\n return plugin(config);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AA0BA,SAASe,WAAWC,MAAqE;CACvF,OAAO,aAAaA;AACtB;;;;;;;AAQA,SAASC,sBAAsBD,MAAgD;CAC7E,OAAO,CAAC,GAAGA,KAAKE,YAAY,GAAIH,WAAWC,IAAI,IAAIG,wBAAwBH,KAAKI,OAAO,IAAI,CAAA,CAAG;AAChG;;;;;;;;AASA,SAASD,wBAAwBC,SAA8E;CAC7G,OAAOA,QAAQC,SAASC,WAClBA,OAAOC,SAAS,UAAgBN,sBAAsBK,OAAOE,KAAK,IAClEF,OAAOC,SAAS,aAAmBJ,wBAAwBG,OAAOG,SAASL,OAAO,IAClFE,OAAOC,SAAS,SAAeN,sBAAsBK,OAAOI,IAAI,IAE7D,CAAA,CACR;AACH;AAIA,SAAOE,MAAAC,IAAA;CAAA,IAAAC,IAAAC,EAAA,EAAA,GAAe,EAAAC,SAAAC,YAAAC,OAAAC,aAAAC,UAAAlB,YAAAmB,OAAAC,SAAAC,MAAAC,SAAAC,UAAAC,eAAAb,IAaTc;CAAA,AAAAb,EAAA,OAAAc,OAAAC,IAAA,2BAAA,KACmEF,KAAA,CAAA,GAAEb,EAAA,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SAAS;GAAEK;GAASI,OAAO;GAAOC,QAAQ;EAAM,CAAC;CACxE;AACF;;;;;;;ACHA,SAAgBa,eAAeC,QAA0B;CACvD,OAAOR,WAAW;EAChBS,MAAMH;EACNI,MAAM;EACNC,MAAMf,iBAAiBM,gBAAgB;EACvCU,aAAa;EAEbC,YAAY;GAAEC,OAAOnB;GAAOoB,OAAOd,YAAYO,MAAM;EAAE;EACvDQ,aAAaC,SACXA,KAAKC,QAAQC,UACX,CAACrB,UAAUqB,OAAOV,IAAI,KAAKX,UAAUqB,MAAME,IAAI,IAAI,KAAO,4CAC5D;EACFC,SAAS;GACPC,QAAQ;IACNd,MAAM;IACNY,MAAM;GACR;GACAG,QAAQC,WAA6C;IACnD,IAAM,EAAEhB,MAAMY,SAASI;IAEvB,OAAO;KACLC,OAAO5B,UAAUW,IAAI,IAAIZ,YAAYY,MAAM,OAAO,IAAI;KACtDkB,OAAOxB,kBAAkB;MAAEyB,OAAOtB;MAAcG;MAAMY;KAAK,CAAC;IAC9D;GACF;EACF;EACAQ,QAAQ;GACN9B,YAAY;IACVU,MAAM;IACNC,MAAM;IACNE,aAAa;GACf,CAAC;GACDb,YAAY;IACVU,MAAM;IACNC,MAAM;IACNE,aAAa;GACf,CAAC;GACDb,YAAY;IACVU,MAAM;IACNC,MAAM;IACNE,aAAa;GACf,CAAC;GACDb,YAAY;IACVU,MAAM;IACNC,MAAM;IACNE,aAAa;GACf,CAAC;EAAC;CAEN,CAAC;AACH;ACKA,MAAM4C,SAASvB,cAAgCwB,YAAY;CACzDN,MAAMjB;CACNwB,QAAQ,EACNC,OAAO,CAACxB,eAAesB,MAAM,CAAC,EAChC;AACF,EAAE;;;;;;;;;AAUF,SAAgBG,WAAWH,QAA0B;CACnD,OAAOD,OAAOC,MAAM;AACtB"}
@@ -0,0 +1,96 @@
1
+ import { t as logger } from "./defaults-BEzCWZtH.js";
2
+ import { l as isRecord } from "./nodes-Bn7fLVZO.js";
3
+ import { a as writeIconNames, i as loadIconSet, n as detectLibraries, o as createRegistryModule, r as listRegistryDependencies, t as describeReport } from "./sets-B5arQvrZ.js";
4
+ import { i as listPluginFiles } from "./adapters-Dw6yeA3A.js";
5
+ import path from "node:path";
6
+ import { mkdir, readFile, rename, writeFile } from "node:fs/promises";
7
+ import { randomUUID } from "node:crypto";
8
+ /**
9
+ * Converts every installed library and writes each set to a file the bundler can split into its own chunk.
10
+ *
11
+ * @param root - The project folder.
12
+ * @param custom - Folders of the project's own icons, keyed by library identifier.
13
+ * @returns The libraries found, and each set with the file it was written to and what happened converting it.
14
+ */
15
+ async function writeIconSets(root, custom) {
16
+ let cacheDir = path.join(root, "node_modules", ".cache"), setsDir = path.join(cacheDir, "driftime-icon", "sets");
17
+ await mkdir(setsDir, { recursive: !0 });
18
+ let libraries = await detectLibraries(root, custom);
19
+ return {
20
+ libraries,
21
+ converted: await Promise.all(libraries.flatMap((library) => library.styles.map(async ({ style }) => {
22
+ let { adapter } = library, { set, report } = await loadIconSet(library, style, {
23
+ root,
24
+ cacheDir
25
+ }), file = path.join(setsDir, `${adapter.library}-${style}.json`), content = JSON.stringify(set);
26
+ if (await readFile(file, "utf8").catch(() => "") !== content) {
27
+ let temporary = `${file}.${randomUUID()}.tmp`;
28
+ await writeFile(temporary, content), await rename(temporary, file);
29
+ }
30
+ return {
31
+ adapter,
32
+ style,
33
+ set,
34
+ file,
35
+ report
36
+ };
37
+ })))
38
+ };
39
+ }
40
+ /**
41
+ * Converts every installed library, writes each set to a file the bundler can split into its own chunk, and returns
42
+ * the registry that replaces the placeholder.
43
+ *
44
+ * @param resourcePath - Path of the placeholder being replaced.
45
+ * @param options - The loader's options.
46
+ * @returns The registry's code, and the files and folders it was generated from.
47
+ */
48
+ async function generateRegistryOnce(resourcePath, options) {
49
+ let root = process.cwd(), custom = isRecord(options) && isRecord(options.custom) ? options.custom : {}, { libraries, converted } = await writeIconSets(root, Object.fromEntries(Object.entries(custom).flatMap(([name, folder]) => typeof folder == "string" ? [[name, folder]] : []))), files = /* @__PURE__ */ new Map(), names = /* @__PURE__ */ new Map();
50
+ for (let { adapter, style, set, file, report } of converted) {
51
+ let { label, library } = adapter;
52
+ logger.info(describeReport(label, style, report));
53
+ let libraryNames = names.get(library) ?? /* @__PURE__ */ new Set();
54
+ for (let icon of set.icons) libraryNames.add(icon.name);
55
+ names.set(library, libraryNames), files.set(`${library}/${style}`, file);
56
+ }
57
+ await writeIconNames(new Map([...names].filter(([, libraryNames]) => libraryNames.size > 0)));
58
+ let code = createRegistryModule(libraries, (key) => {
59
+ let file = files.get(key) ?? "", relative = path.relative(path.dirname(resourcePath), file).replaceAll("\\", "/");
60
+ return relative.startsWith(".") ? relative : `./${relative}`;
61
+ }), dependencies = listRegistryDependencies(root, libraries);
62
+ return {
63
+ code,
64
+ files: [...dependencies.files, ...await listPluginFiles()],
65
+ folders: dependencies.folders
66
+ };
67
+ }
68
+ /**
69
+ * Reads the project's `package.json` as text.
70
+ *
71
+ * @returns The contents, or an empty string when there's no file.
72
+ */
73
+ async function readManifest() {
74
+ try {
75
+ return await readFile(path.join(process.cwd(), "package.json"), "utf8");
76
+ } catch {
77
+ return "";
78
+ }
79
+ }
80
+ /**
81
+ * Generates the registry, running again when the project's `package.json` changes while it runs, so a package
82
+ * installed during a run isn't missed.
83
+ *
84
+ * @param resourcePath - Path of the placeholder being replaced.
85
+ * @param options - The loader's options.
86
+ * @param attempts - Runs allowed, including this one.
87
+ * @returns The registry's code, and the files and folders it was generated from.
88
+ * @public
89
+ */
90
+ async function generateRegistry(resourcePath, options, attempts = 3) {
91
+ let before = await readManifest(), result = await generateRegistryOnce(resourcePath, options);
92
+ return before === await readManifest() || attempts <= 1 ? result : generateRegistry(resourcePath, options, attempts - 1);
93
+ }
94
+ export { writeIconSets as n, generateRegistry as t };
95
+
96
+ //# sourceMappingURL=loader-2g6inuO6.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"loader-2g6inuO6.js","names":["randomUUID","mkdir","readFile","rename","writeFile","path","isRecord","writeIconNames","listPluginFiles","createRegistryModule","describeReport","detectLibraries","listRegistryDependencies","loadIconSet","logger","LoaderContext","resourcePath","getOptions","addDependency","file","addContextDependency","folder","writeIconSets","root","custom","Record","cacheDir","join","setsDir","recursive","libraries","converted","Promise","all","flatMap","library","styles","map","style","adapter","set","report","content","JSON","stringify","current","catch","temporary","generateRegistryOnce","options","process","cwd","folders","Object","fromEntries","entries","name","files","Map","names","Set","label","info","libraryNames","get","icon","icons","add","filter","size","code","key","relative","dirname","replaceAll","startsWith","dependencies","readManifest","generateRegistry","attempts","ReturnType","before","result","after","\"custom\""],"sources":["../src/build/loader.ts"],"sourcesContent":["import { randomUUID } from \"node:crypto\";\nimport { mkdir, readFile, rename, writeFile } from \"node:fs/promises\";\nimport path from \"node:path\";\n\nimport { isRecord } from \"@repo/lib/utils\";\n\nimport { writeIconNames } from \"@/build/names\";\nimport { listPluginFiles } from \"@/build/packages\";\nimport { createRegistryModule } from \"@/build/registry\";\nimport { describeReport, detectLibraries, listRegistryDependencies, loadIconSet } from \"@/build/sets\";\nimport { logger } from \"@/config/defaults\";\n\n/**\n * The parts of a webpack or Turbopack loader's context the build step uses.\n *\n * @public\n */\nexport interface LoaderContext {\n /** Path of the module being loaded. */\n resourcePath: string;\n /**\n * Reads the loader's options.\n *\n * @returns The options.\n */\n getOptions: () => unknown;\n /**\n * Tells the bundler to run the loader again when a file changes.\n *\n * @param file - The file.\n */\n addDependency?: (file: string) => void;\n /**\n * Tells the bundler to run the loader again when anything in a folder changes.\n *\n * @param folder - The folder.\n */\n addContextDependency?: (folder: string) => void;\n}\n\n/**\n * Converts every installed library and writes each set to a file the bundler can split into its own chunk.\n *\n * @param root - The project folder.\n * @param custom - Folders of the project's own icons, keyed by library identifier.\n * @returns The libraries found, and each set with the file it was written to and what happened converting it.\n */\nexport async function writeIconSets(root: string, custom: Record<string, string>) {\n const cacheDir = path.join(root, \"node_modules\", \".cache\");\n const setsDir = path.join(cacheDir, \"driftime-icon\", \"sets\");\n await mkdir(setsDir, { recursive: true });\n\n const libraries = await detectLibraries(root, custom);\n\n const converted = await Promise.all(\n libraries.flatMap((library) =>\n library.styles.map(async ({ style }) => {\n const { adapter } = library;\n const { set, report } = await loadIconSet(library, style, { root, cacheDir });\n const file = path.join(setsDir, `${adapter.library}-${style}.json`);\n const content = JSON.stringify(set);\n const current = await readFile(file, \"utf8\").catch(() => \"\");\n\n if (current !== content) {\n const temporary = `${file}.${randomUUID()}.tmp`;\n\n // The browser and server builds convert at once, even in one process, so each set is swapped in whole.\n await writeFile(temporary, content);\n await rename(temporary, file);\n }\n\n return { adapter, style, set, file, report };\n }),\n ),\n );\n\n return { libraries, converted };\n}\n\n/**\n * Converts every installed library, writes each set to a file the bundler can split into its own chunk, and returns\n * the registry that replaces the placeholder.\n *\n * @param resourcePath - Path of the placeholder being replaced.\n * @param options - The loader's options.\n * @returns The registry's code, and the files and folders it was generated from.\n */\nasync function generateRegistryOnce(resourcePath: string, options: unknown) {\n const root = process.cwd();\n const custom = isRecord(options) && isRecord(options[\"custom\"]) ? options[\"custom\"] : {};\n const folders = Object.fromEntries(\n Object.entries(custom).flatMap(([name, folder]) => (typeof folder === \"string\" ? [[name, folder]] : [])),\n );\n\n const { libraries, converted } = await writeIconSets(root, folders);\n const files = new Map<string, string>();\n const names = new Map<string, Set<string>>();\n\n for (const { adapter, style, set, file, report } of converted) {\n const { label, library } = adapter;\n logger.info(describeReport(label, style, report));\n\n const libraryNames = names.get(library) ?? new Set<string>();\n\n for (const icon of set.icons) libraryNames.add(icon.name);\n names.set(library, libraryNames);\n files.set(`${library}/${style}`, file);\n }\n\n await writeIconNames(new Map([...names].filter(([, libraryNames]) => libraryNames.size > 0)));\n\n const code = createRegistryModule(libraries, (key) => {\n const file = files.get(key) ?? \"\";\n const relative = path.relative(path.dirname(resourcePath), file).replaceAll(\"\\\\\", \"/\");\n\n return relative.startsWith(\".\") ? relative : `./${relative}`;\n });\n\n const dependencies = listRegistryDependencies(root, libraries);\n\n // The plugin's own files are included, so updating it runs the loader again even when `package.json` doesn't change.\n return { code, files: [...dependencies.files, ...(await listPluginFiles())], folders: dependencies.folders };\n}\n\n/**\n * Reads the project's `package.json` as text.\n *\n * @returns The contents, or an empty string when there's no file.\n */\nasync function readManifest() {\n try {\n return await readFile(path.join(process.cwd(), \"package.json\"), \"utf8\");\n } catch {\n return \"\";\n }\n}\n\n/**\n * Generates the registry, running again when the project's `package.json` changes while it runs, so a package\n * installed during a run isn't missed.\n *\n * @param resourcePath - Path of the placeholder being replaced.\n * @param options - The loader's options.\n * @param attempts - Runs allowed, including this one.\n * @returns The registry's code, and the files and folders it was generated from.\n * @public\n */\nexport async function generateRegistry(\n resourcePath: string,\n options: unknown,\n attempts = 3,\n): ReturnType<typeof generateRegistryOnce> {\n const before = await readManifest();\n const result = await generateRegistryOnce(resourcePath, options);\n const after = await readManifest();\n\n return before === after || attempts <= 1 ? result : generateRegistry(resourcePath, options, attempts - 1);\n}\n"],"mappings":";;;;;;;;;;;;;;AA+CA,eAAsBsB,cAAcC,MAAcC,QAAgC;CAChF,IAAME,WAAWrB,KAAKsB,KAAKJ,MAAM,gBAAgB,QAAQ,GACnDK,UAAUvB,KAAKsB,KAAKD,UAAU,iBAAiB,MAAM;CAC3D,MAAMzB,MAAM2B,SAAS,EAAEC,WAAW,GAAK,CAAC;CAExC,IAAMC,YAAY,MAAMnB,gBAAgBY,MAAMC,MAAM;CAwBpD,OAAO;EAAEM;EAAWC,WAAAA,MAtBIC,QAAQC,IAC9BH,UAAUI,SAASC,YACjBA,QAAQC,OAAOC,IAAI,OAAO,EAAEC,YAAY;GACtC,IAAM,EAAEC,YAAYJ,SACd,EAAEK,KAAKC,WAAW,MAAM5B,YAAYsB,SAASG,OAAO;IAAEf;IAAMG;GAAS,CAAC,GACtEP,OAAOd,KAAKsB,KAAKC,SAAS,GAAGW,QAAQJ,QAAO,GAAIG,MAAK,MAAO,GAC5DI,UAAUC,KAAKC,UAAUJ,GAAG;GAGlC,IAAIK,MAFkB3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Q,GAAGL,kBAAkBA,aAAaM,OAAO,CAAC,CAAC,CAAC;CAE5F,IAAMC,OAAO7D,qBAAqBqB,YAAYyC,QAAQ;EACpD,IAAMpD,OAAOsC,MAAMO,IAAIO,GAAG,KAAK,IACzBC,WAAWnE,KAAKmE,SAASnE,KAAKoE,QAAQzD,YAAY,GAAGG,IAAI,CAAC,CAACuD,WAAW,MAAM,GAAG;EAErF,OAAOF,SAASG,WAAW,GAAG,IAAIH,WAAW,KAAKA;CACpD,CAAC,GAEKI,eAAehE,yBAAyBW,MAAMO,SAAS;CAG7D,OAAO;EAAEwC;EAAMb,OAAO,CAAC,GAAGmB,aAAanB,OAAO,GAAI,MAAMjD,gBAAgB,CAAE;EAAG4C,SAASwB,aAAaxB;CAAQ;AAC7G;;;;;;AAOA,eAAeyB,eAAe;CAC5B,IAAI;EACF,OAAO,MAAM3E,SAASG,KAAKsB,KAAKuB,QAAQC,IAAI,GAAG,cAAc,GAAG,MAAM;CACxE,QAAQ;EACN,OAAO;CACT;AACF;;;;;;;;;;;AAYA,eAAsB2B,iBACpB9D,cACAiC,SACA8B,WAAW,GAC8B;CACzC,IAAME,SAAS,MAAMJ,aAAa,GAC5BK,SAAS,MAAMlC,qBAAqBhC,cAAciC,OAAO;CAG/D,OAAOgC,WAAWE,MAFEN,aAAa,KAENE,YAAY,IAAIG,SAASJ,iBAAiB9D,cAAciC,SAAS8B,WAAW,CAAC;AAC1G"}
@@ -1 +1 @@
1
- {"version":3,"file":"next-loader.d.ts","names":["LoaderContext","generateRegistryOnce","Promise","generateRegistry","ReturnType","LoaderContext","iconSetsLoader","Promise","default","generateRegistry"],"sources":["../src/build/loader.ts","../src/next-loader.ts"],"mappings":"AAiBA;;;;;UAAiBA;;EAEf;;;;;;EAMA;;;;;;EAMA,iBAAiB;;;;;;EAMjB,wBAAwB;;;;;;;;;;iBAWXC,qBAAqB,sBAAsB,mBAAgBC;;;;;;;;;;;;;;;wBA+EpDC,iBACpB,sBACA,kBACA,oBACCC,kBAAkBH;;;;;;;;;;;iBCnGNK,eAAe,MAAMD,gBAAaE"}
1
+ {"version":3,"file":"next-loader.d.ts","names":["_$__build_sets0","_$__adapters_types0","_$___lib_sets0","LoaderContext","writeIconSets","Record","DetectedLibrary","IconAdapter","IconSet","IconSetReport","Promise","generateRegistryOnce","generateRegistry","ReturnType","LoaderContext","iconSetsLoader","Promise","default","generateRegistry"],"sources":["../src/build/loader.ts","../src/next-loader.ts"],"mappings":"AAiBA;;;;;UAAiBG;;EAEf;;;;;;EAMA;;;;;;EAMA,iBAAiB;;;;;;EAMjB,wBAAwB;;;;;;;;;;iBAkDXQ,qBAAqB,sBAAsB,mBAAgBD;;;;;;;;;;;;;;;wBA4DpDE,iBACpB,sBACA,kBACA,oBACCC,kBAAkBF;;;;;;;;;;;iBCvHNI,eAAe,MAAMD,gBAAaE"}