@driftime/sanity-plugin-icon 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +206 -0
- package/dist/drawing-Bo0HTICv.js +120 -0
- package/dist/drawing-Bo0HTICv.js.map +1 -0
- package/dist/index.d.ts +20 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +685 -0
- package/dist/index.js.map +1 -0
- package/dist/render.d.ts +21 -0
- package/dist/render.d.ts.map +1 -0
- package/dist/render.js +19 -0
- package/dist/render.js.map +1 -0
- package/dist/types-nQUVfUHK.d.ts +16 -0
- package/dist/types-nQUVfUHK.d.ts.map +1 -0
- package/package.json +97 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":["ObjectFieldProps","FormField","FieldProps","Field","t0","$","_c","title","description","inputId","validation","path","children","t1","gridCellSize","gridRowGap","gridRowHeight","gridColumns","gridVisibleRows","gridHeight","gridOverscan","gridLayoutStyle","justifyItems","rowGap","const","Button","ComponentProps","Drawing","gridCellSize","LibraryIcon","CellProps","Omit","icon","selected","focusable","position","total","onSelect","Cell","t0","$","_c","props","t1","t2","Symbol","for","width","height","t3","node","t4","t5","label","name","Button","Flex","Grid","Stack","Text","ComponentProps","Cell","gridColumns","gridLayoutStyle","LibraryIcon","RecentProps","Omit","icons","selected","onSelect","icon","onForget","Recent","t0","$","_c","props","t1","Symbol","for","t2","t3","t4","length","index","name","map","t5","Stack","Text","Popover","ComponentProps","LibraryIcon","isDefined","HoveredIcon","icon","element","HTMLElement","TooltipProps","Omit","hovered","Tooltip","t0","$","_c","props","t1","t2","t3","t4","Symbol","for","pointerEvents","t5","maxWidth","label","tags","t6","ComponentProps","defaultIconProps","width","height","strokeWidth","IconNode","parseIconNode","convertCase","isDefined","LibraryIcon","name","label","tags","node","terms","normaliseTerms","value","toLowerCase","replaceAll","trim","readLibrary","drawings","Promise","all","nodes","Record","default","Object","keys","flatMap","iconTags","join","libraryRequest","undefined","requestLibrary","library","useEffect","useState","LibraryIcon","requestLibrary","useIconLibrary","$","_c","library","setLibrary","t0","t1","Symbol","for","active","load","loaded","storageKey","limit","readRecent","stored","JSON","parse","globalThis","localStorage","getItem","Array","isArray","filter","entry","writeRecent","name","updated","slice","setItem","stringify","clearRecent","removeItem","useState","clearRecent","readRecent","writeRecent","useRecentIcons","$","_c","recent","setRecent","t0","Symbol","for","remember","name","t1","forget","t2","gridColumns","gridOverscan","gridVisibleRows","getNextIndex","key","current","last","undefined","getVisibleRows","scrollRow","count","totalRows","Math","ceil","firstRow","max","lastRow","min","SearchIcon","Box","Button","Dialog","Flex","Grid","Spinner","Stack","Text","TextInput","ChangeEvent","ComponentProps","KeyboardEvent","MouseEvent","useEffect","useRef","useState","Cell","Recent","HoveredIcon","Tooltip","defaultIconProps","gridColumns","gridHeight","gridLayoutStyle","gridRowHeight","useIconLibrary","useRecentIcons","getNextIndex","getVisibleRows","LibraryIcon","normaliseTerms","isDefined","PickerProps","Omit","selected","onSelect","icon","Picker","t0","$","_c","props","library","recent","remember","forget","search","setSearch","scrollRow","setScrollRow","movedIndex","setMovedIndex","hovered","setHovered","scrolling","setScrolling","scroller","activeCell","focusActiveCell","scrollFrame","undefined","scrollStop","hoverStart","query","searching","results","filter","terms","includes","byName","Map","map","_temp","recentIcons","flatMap","entry","icon_1","get","totalRows","firstRow","lastRow","length","visible","slice","selectedIndex","findIndex","icon_2","name","activeIndex","Math","max","t1","t2","element","current","scrollTop","floor","t3","t4","Symbol","for","cancelAnimationFrame","clearTimeout","t5","focus","t6","t7","handleSelect","icon_3","t8","handleSearch","event","currentTarget","value","selectActive","icon_4","handleSearchKeyDown","event_0","key","preventDefault","t9","handleScroll","setTimeout","requestAnimationFrame","element_0","handleHover","event_1","target","Element","closest","cell","HTMLElement","dataset","icon_5","t10","clearHover","handleGridKeyDown","event_2","last","next","index","min","element_1","top","t11","t12","t13","height","t14","t15","toLocaleString","overflowY","paddingTop","paddingBottom","icon_6","offset","index_0","icon_0","Nullable","T","iconTypeName","SanityIcon","_type","name","node","CloseIcon","Button","Flex","useState","ObjectInputProps","set","setIfMissing","unset","Drawing","Picker","defaultIconProps","LibraryIcon","resolveIconNode","serialiseIconNode","convertCase","isDefined","SanityIcon","iconTypeName","InputProps","Partial","Input","t0","$","_c","id","value","onChange","readOnly","name","node","open","setOpen","selectedNode","selectedLabel","undefined","t1","handleSelect","icon","_type","T0","t2","T1","t3","t4","t5","t6","t7","t8","t9","t10","t11","t12","Drawing","defaultIconProps","resolveIconNode","isDefined","SanityIcon","createIconPreview","value","node","undefined","IconPreview","ComponentProps","SquareDashedIconProps","SquareDashedIcon","props","$","_c","t0","t1","t10","t11","t2","t3","t4","t5","t6","t7","t8","t9","Symbol","for","t12","ComponentProps","ComponentType","createElement","defaultIconProps","createSanityIcon","icon","props","Icon","SanityIcon","defineField","defineType","Field","Input","createIconPreview","SquareDashedIcon","createSanityIcon","convertCase","isDefined","SanityIcon","iconTypeName","iconType","name","type","icon","description","components","field","input","preview","select","node","prepare","selection","title","media","_type","fields","definePlugin","iconType","iconPlugin","name","schema","types"],"sources":["../src/components/field.tsx","../src/config/grid.ts","../src/components/picker/cell.tsx","../src/components/picker/recent.tsx","../src/components/picker/tooltip.tsx","../src/config/defaults.ts","../src/lib/library.ts","../src/hooks/use-icon-library.ts","../src/lib/recent.ts","../src/hooks/use-recent-icons.ts","../src/lib/grid.ts","../src/components/picker/picker.tsx","../src/types.ts","../src/components/input.tsx","../src/components/preview.tsx","../src/icons/square-dashed.tsx","../src/lib/icons.ts","../src/schemas/types/icon.ts","../src/plugin.ts"],"sourcesContent":["import type { ObjectFieldProps } from \"sanity\";\nimport { FormField } from \"sanity\";\n\nexport type FieldProps = ObjectFieldProps;\n\n// Swaps the frame Sanity puts around a nested object for the flat one a plain field gets.\nexport function Field({ title, description, inputId, validation, path, children }: FieldProps) {\n return (\n <FormField title={title} description={description} inputId={inputId} validation={validation} path={path}>\n {children}\n </FormField>\n );\n}\n","/** Size of one cell, in pixels. Fixed so the grid never reflows. */\nexport const gridCellSize = 40;\n\n/** Space between rows, in pixels. */\nconst gridRowGap = 4;\n\n/** Distance from one row to the next, which placing a window over the grid depends on knowing. */\nexport const gridRowHeight = gridCellSize + gridRowGap;\n\n/** How many icons a row holds. */\nexport const gridColumns = 8;\n\n/** How many rows the scrolling area shows at once. */\nexport const gridVisibleRows = 8;\n\n/** Height of the scrolling area, sized to the rows it shows. The final row carries no trailing gap. */\nexport const gridHeight = gridVisibleRows * gridRowHeight - gridRowGap;\n\n/**\n * Rows built either side of the visible ones. Everything built is also painted, so a row scrolled\n * into view is already there rather than arriving with it.\n */\nexport const gridOverscan = gridVisibleRows;\n\n/** Layout both grids share, so a recent icon sits on the same columns as the library below it. */\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<ComponentProps<typeof Button>, \"icon\" | \"selected\" | \"onSelect\" | \"onClick\"> & {\n icon: LibraryIcon;\n selected: boolean;\n focusable: boolean;\n position: number;\n total: number;\n onSelect: (icon: LibraryIcon) => void;\n};\n\nexport function Cell({ icon, selected, focusable, position, total, onSelect, ...props }: CellProps) {\n return (\n <Button\n type=\"button\"\n role=\"option\"\n aria-selected={selected}\n // Stated, because counting the mounted cells would report the window rather than the library.\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 node={icon.node} width=\"1.25em\" height=\"1.25em\" strokeWidth={1.5} />}\n aria-label={icon.label}\n data-icon={icon.name}\n onClick={() => {\n onSelect(icon);\n }}\n {...props}\n />\n );\n}\n","import { Button, Flex, Grid, Stack, Text } from \"@sanity/ui\";\nimport type { ComponentProps } from \"react\";\n\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 onForget: () => void;\n};\n\nexport function Recent({ icons, selected, onSelect, 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=\"Forget the recently used 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 />\n ))}\n </Grid>\n </Stack>\n );\n}\n","import { Stack, Text } from \"@sanity/ui\";\nimport { Popover } from \"@sanity/ui/popover\";\nimport type { ComponentProps } from \"react\";\n\nimport type { LibraryIcon } from \"@/lib/library\";\nimport { isDefined } from \"@/lib/utils\";\n\n/** The icon a tooltip is describing, paired with the cell it points at. */\nexport interface HoveredIcon {\n /** Icon the cell holds. */\n icon: LibraryIcon;\n /** Cell the tooltip anchors itself to. */\n element: HTMLElement;\n}\n\nexport type TooltipProps = Omit<ComponentProps<typeof Popover>, \"open\" | \"referenceElement\" | \"content\"> & {\n hovered: HoveredIcon | undefined;\n};\n\nexport function Tooltip({ hovered, ...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 API, and the only lever for the gap. Top only, since the tooltip sits above.\n __unstable_margins={[-4, 0, 0, 0]}\n // Portalled out of the grid, so a cursor touching it would dismiss the icon it moved onto.\n style={{ pointerEvents: \"none\" }}\n content={\n isDefined(hovered) && (\n <Stack gap={3} style={{ maxWidth: \"16rem\" }}>\n <Text size={1} weight=\"medium\">\n {hovered.icon.label}\n </Text>\n {isDefined(hovered.icon.tags) && (\n <Text size={1} muted>\n {hovered.icon.tags}\n </Text>\n )}\n </Stack>\n )\n }\n {...props}\n />\n );\n}\n","import type { ComponentProps } from \"react\";\n\n/** Properties every icon the Studio draws is rendered with. */\nexport const defaultIconProps: ComponentProps<\"svg\"> = { width: \"1em\", height: \"1em\", strokeWidth: 1.5 };\n","import type { IconNode } from \"@/lib/nodes\";\nimport { parseIconNode } from \"@/lib/nodes\";\nimport { convertCase, isDefined } from \"@/lib/utils\";\n\n/** Single icon the library offers, carrying the terms a search matches it on. */\nexport interface LibraryIcon {\n /** Name the icon goes by in the library it came from. */\n name: string;\n /** Readable form of the name, shown beside the icon. */\n label: string;\n /** What the icon depicts, as a readable list. */\n tags: string;\n /** Shapes the icon is drawn from. */\n node: IconNode;\n /** Name and tags flattened into the form a search compares against. */\n terms: string;\n}\n\n/**\n * Flattens text into the form a search compares against, so a hyphenated icon name and a multi-word\n * tag are matched the same way.\n *\n * @param value - The text to flatten.\n * @returns The text in comparable form.\n */\nexport function normaliseTerms(value: string) {\n return value\n .toLowerCase()\n .replaceAll(/[\\s-]+/gu, \" \")\n .trim();\n}\n\n/**\n * Reads the icon library, pairing each drawing with the terms it can be found by. Both files come\n * from the same release as the icons themselves, so the drawings and their terms never disagree.\n *\n * @returns Every icon the library offers.\n */\nasync function readLibrary() {\n const [drawings, tags] = await Promise.all([\n import(\"lucide-static/icon-nodes.json\"),\n import(\"lucide-static/tags.json\"),\n ]);\n\n const nodes: Record<string, unknown> = drawings.default;\n const terms: Record<string, string[]> = tags.default;\n\n return Object.keys(nodes).flatMap((name) => {\n const node = parseIconNode(nodes[name]);\n if (!isDefined(node)) return [];\n\n const iconTags = terms[name] ?? [];\n\n return [\n {\n name,\n label: convertCase(name, \"sentence\"),\n tags: iconTags.join(\", \"),\n node,\n terms: normaliseTerms([name, ...iconTags].join(\" \")),\n },\n ];\n });\n}\n\n/** The library once asked for, held so every field in a Studio session shares the one request. */\nlet libraryRequest: Promise<LibraryIcon[]> | undefined = undefined;\n\n/**\n * Reads the icon library, sharing a single request across every field opened in the session. The\n * library is a megabyte of data that never changes within a release, so asking twice only ever costs.\n *\n * @returns Every icon the library offers.\n */\nexport async function requestLibrary() {\n libraryRequest ??= readLibrary();\n const library = await libraryRequest;\n\n return library;\n}\n","import { useEffect, useState } from \"react\";\n\nimport type { LibraryIcon } from \"@/lib/library\";\nimport { requestLibrary } from \"@/lib/library\";\n\n/**\n * Reads the icon library, sharing one request with every other field in the session. Callers mount\n * only while a picker is open, so a Studio that never opens one never pays the megabyte it costs.\n *\n * @returns Every icon the library offers, or undefined while it is still being read.\n */\nexport function useIconLibrary() {\n const [library, setLibrary] = useState<LibraryIcon[]>();\n\n useEffect(() => {\n let active = true;\n\n async function load() {\n const loaded = await requestLibrary();\n if (active) setLibrary(loaded);\n }\n\n void load();\n\n return () => {\n active = false;\n };\n }, []);\n\n return library;\n}\n","/** Where the icons an author reached for last are kept, in the browser rather than the dataset. */\nconst storageKey = \"driftime:sanity-plugin-icon:recent\";\n\n/** How many icons are remembered. */\nconst limit = 8;\n\n/**\n * Reads the icons an author reached for last.\n *\n * @returns Names of the remembered icons, most recent first.\n */\nexport function readRecent() {\n try {\n const stored: unknown = JSON.parse(globalThis.localStorage.getItem(storageKey) ?? \"[]\");\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 * Remembers an icon as the one reached for most recently.\n *\n * @param name - Name of the chosen icon.\n * @returns Names of the remembered icons, most recent first.\n */\nexport function writeRecent(name: string) {\n const updated = [name, ...readRecent().filter((entry) => entry !== name)].slice(0, limit);\n\n try {\n globalThis.localStorage.setItem(storageKey, JSON.stringify(updated));\n } catch {\n // A Studio with storage blocked simply does not remember, which is not worth reporting.\n }\n\n return updated;\n}\n\n/** Forgets every icon reached for so far. */\nexport function clearRecent() {\n try {\n globalThis.localStorage.removeItem(storageKey);\n } catch {\n // A Studio with storage blocked has nothing to forget.\n }\n}\n","import { useState } from \"react\";\n\nimport { clearRecent, readRecent, writeRecent } from \"@/lib/recent\";\n\n/**\n * Tracks the icons an author reached for last, keeping what is remembered and what is drawn in step.\n * The stored list is read as the picker mounts, so another tab choosing an icon is picked up too.\n *\n * @returns The remembered names, most recent first, alongside ways to add to and empty them.\n */\nexport function useRecentIcons() {\n const [recent, setRecent] = useState<string[]>(readRecent);\n\n function remember(name: string) {\n setRecent(writeRecent(name));\n }\n\n function forget() {\n clearRecent();\n setRecent([]);\n }\n\n return { recent, remember, forget };\n}\n","import { gridColumns, gridOverscan, gridVisibleRows } from \"@/config/grid\";\n\n/**\n * Works out which icon a key press moves to, so the library can be walked without a mouse.\n *\n * @param key - The key pressed.\n * @param current - Index of the icon the grid is on.\n * @param last - Index of the final icon in the results.\n * @returns The index moved to, or undefined when the key does not 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 the grid builds for a given scroll position, so only the icons near the\n * viewport are mounted. The rows above and below stand in as padding, keeping the scrollbar honest.\n *\n * @param scrollRow - Row the scrolling area has reached.\n * @param count - Number of icons in the results.\n * @returns The row the grid starts building at, the row it stops at, and the row count in total.\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","import { SearchIcon } from \"@sanity/icons/Search\";\nimport { Box, Button, Dialog, Flex, Grid, Spinner, Stack, Text, TextInput } from \"@sanity/ui\";\nimport type { ChangeEvent, ComponentProps, KeyboardEvent, MouseEvent } from \"react\";\nimport { useEffect, useRef, useState } from \"react\";\n\nimport { Cell } from \"@/components/picker/cell\";\nimport { Recent } from \"@/components/picker/recent\";\nimport type { HoveredIcon } from \"@/components/picker/tooltip\";\nimport { Tooltip } from \"@/components/picker/tooltip\";\nimport { defaultIconProps } from \"@/config/defaults\";\nimport { gridColumns, gridHeight, gridLayoutStyle, gridRowHeight } from \"@/config/grid\";\nimport { useIconLibrary } from \"@/hooks/use-icon-library\";\nimport { useRecentIcons } from \"@/hooks/use-recent-icons\";\nimport { getNextIndex, getVisibleRows } from \"@/lib/grid\";\nimport type { LibraryIcon } from \"@/lib/library\";\nimport { normaliseTerms } from \"@/lib/library\";\nimport { isDefined } from \"@/lib/utils\";\n\nexport type PickerProps = Omit<\n ComponentProps<typeof Dialog>,\n \"children\" | \"header\" | \"width\" | \"selected\" | \"onSelect\"\n> & {\n selected: string | undefined;\n onSelect: (icon: LibraryIcon) => void;\n};\n\nexport function Picker({ selected, onSelect, ...props }: PickerProps) {\n const library = useIconLibrary();\n const { recent, remember, forget } = useRecentIcons();\n\n const [search, setSearch] = useState(\"\");\n const [scrollRow, setScrollRow] = useState(0);\n const [movedIndex, setMovedIndex] = useState<number>();\n const [hovered, setHovered] = useState<HoveredIcon>();\n const [scrolling, setScrolling] = useState(false);\n\n const scroller = useRef<HTMLDivElement>(null);\n const activeCell = useRef<HTMLButtonElement>(null);\n const focusActiveCell = useRef(false);\n const scrollFrame = useRef<number>(undefined);\n const scrollStop = useRef<ReturnType<typeof setTimeout>>(undefined);\n const hoverStart = useRef<ReturnType<typeof setTimeout>>(undefined);\n\n const query = normaliseTerms(search);\n const searching = isDefined(query);\n const results = (library ?? []).filter((icon) => !searching || icon.terms.includes(query));\n\n const byName = new Map((library ?? []).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 { totalRows, firstRow, lastRow } = getVisibleRows(scrollRow, results.length);\n const visible = results.slice(firstRow * gridColumns, lastRow * gridColumns);\n\n // Derived rather than stored, so the grid cannot disagree with what is selected.\n const selectedIndex =\n searching || !isDefined(library) || !isDefined(selected) ? -1 : library.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 = Math.max(0, Math.floor(selectedIndex / gridColumns) * gridRowHeight - gridHeight / 2);\n }, [selectedIndex]);\n\n useEffect(\n () => () => {\n if (isDefined(scrollFrame.current)) cancelAnimationFrame(scrollFrame.current);\n if (isDefined(scrollStop.current)) clearTimeout(scrollStop.current);\n if (isDefined(hoverStart.current)) clearTimeout(hoverStart.current);\n },\n [],\n );\n\n useEffect(() => {\n if (!focusActiveCell.current) return;\n\n focusActiveCell.current = false;\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 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 // Coalesced to a frame, so a scroll gesture moves the window a row at a time rather than per event.\n function handleScroll() {\n if (isDefined(hoverStart.current)) clearTimeout(hoverStart.current);\n setHovered(undefined);\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 // Rows passing under a still cursor fire hover events of their own, hence the scroll guard.\n function handleHover(event: MouseEvent<HTMLElement>) {\n if (scrolling) return;\n\n // Element rather than HTMLElement, since the glyph under the cursor is an SVG and inherits neither.\n const target = event.target instanceof Element ? event.target.closest(\"[data-icon]\") : undefined;\n const cell = target instanceof HTMLElement ? target : undefined;\n\n if (cell === hovered?.element) return;\n\n const name = cell?.dataset[\"icon\"];\n const icon = isDefined(name) ? byName.get(name) : undefined;\n\n if (isDefined(hoverStart.current)) clearTimeout(hoverStart.current);\n\n if (!isDefined(icon) || !isDefined(cell)) {\n setHovered(undefined);\n\n return;\n }\n\n // Once one tooltip is up, the next follows the cursor rather than waiting again.\n if (isDefined(hovered)) {\n setHovered({ icon, element: cell });\n\n return;\n }\n\n hoverStart.current = setTimeout(() => {\n setHovered({ icon, element: cell });\n }, 200);\n }\n\n function clearHover() {\n if (isDefined(hoverStart.current)) clearTimeout(hoverStart.current);\n if (isDefined(hovered)) setHovered(undefined);\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 focusActiveCell.current = true;\n setMovedIndex(index);\n\n // Worked out from the index rather than the cell, since Home and End can land outside the window.\n const element = scroller.current;\n if (!isDefined(element)) return;\n\n const top = Math.floor(index / gridColumns) * gridRowHeight;\n\n if (top < element.scrollTop) {\n element.scrollTop = top;\n } else if (top + gridRowHeight > element.scrollTop + gridHeight) {\n element.scrollTop = top + gridRowHeight - gridHeight;\n }\n }\n\n return (\n <Dialog header=\"Select icon\" width={1} {...props}>\n <Stack gap={4} padding={4}>\n <TextInput\n icon={<SearchIcon {...defaultIconProps} />}\n placeholder=\"Search by name or by what the icon depicts\"\n value={search}\n onChange={handleSearch}\n onKeyDown={handleSearchKeyDown}\n disabled={!isDefined(library)}\n aria-label=\"Search the icon library\"\n />\n {!isDefined(library) && (\n <Flex align=\"center\" justify=\"center\" style={{ height: gridHeight }}>\n <Spinner muted />\n </Flex>\n )}\n {isDefined(recentIcons) && (\n <Recent\n icons={recentIcons}\n selected={selected}\n onSelect={handleSelect}\n onForget={forget}\n onMouseOver={handleHover}\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-GB\")})\n </Text>\n </Box>\n <Box\n ref={scroller}\n role=\"listbox\"\n aria-label=\"Icon library\"\n onScroll={handleScroll}\n onMouseOver={handleHover}\n onMouseLeave={clearHover}\n onKeyDown={handleGridKeyDown}\n style={{ height: gridHeight, overflowY: \"auto\" }}\n >\n {results.length === 0 && (\n <Flex align=\"center\" justify=\"center\" direction=\"column\" gap={3} style={{ height: gridHeight }}>\n <Text size={1} muted>\n Nothing matches “{search}”.\n </Text>\n <Button\n type=\"button\"\n mode=\"ghost\"\n text=\"Clear search\"\n onClick={() => {\n setSearch(\"\");\n setMovedIndex(undefined);\n }}\n />\n </Flex>\n )}\n {results.length > 0 && (\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={results.length}\n onSelect={handleSelect}\n />\n );\n })}\n </Grid>\n )}\n </Box>\n </Stack>\n )}\n <Tooltip key={hovered?.icon.name} hovered={hovered} />\n </Stack>\n </Dialog>\n );\n}\n","/** A value that may be absent, covering both null and undefined. */\nexport type Nullable<T> = T | null | undefined;\n\n/** Type name of the icon object. */\nexport const iconTypeName = \"icon\";\n\n/**\n * An icon an author chose, stored as the name it was chosen by alongside the shapes it draws.\n *\n * @public\n */\nexport interface SanityIcon {\n _type: typeof iconTypeName;\n /** Name the icon goes by in the library it was taken from. */\n name?: string;\n /** Shapes the icon is drawn from, written when the icon is chosen. */\n node?: string;\n}\n","import { CloseIcon } from \"@sanity/icons/Close\";\nimport { Button, Flex } from \"@sanity/ui\";\nimport { useState } from \"react\";\nimport type { ObjectInputProps } from \"sanity\";\nimport { set, setIfMissing, unset } from \"sanity\";\n\nimport { Drawing } from \"@/components/drawing\";\nimport { Picker } from \"@/components/picker/picker\";\nimport { defaultIconProps } from \"@/config/defaults\";\nimport type { LibraryIcon } from \"@/lib/library\";\nimport { resolveIconNode, serialiseIconNode } from \"@/lib/nodes\";\nimport { convertCase, isDefined } from \"@/lib/utils\";\nimport type { SanityIcon } from \"@/types\";\nimport { iconTypeName } from \"@/types\";\n\nexport type InputProps = ObjectInputProps<Partial<SanityIcon>>;\n\nexport function Input({ id, value, onChange, readOnly }: InputProps) {\n const { name, node } = value ?? {};\n\n const [open, setOpen] = useState(false);\n\n const selectedNode = resolveIconNode(node);\n const selectedLabel = isDefined(name) ? convertCase(name, \"sentence\") : undefined;\n\n function handleSelect(icon: LibraryIcon) {\n onChange([\n setIfMissing({ _type: iconTypeName satisfies SanityIcon[\"_type\"] }),\n set(icon.name, [\"name\" satisfies keyof SanityIcon]),\n set(serialiseIconNode(icon.node), [\"node\" satisfies keyof SanityIcon]),\n ]);\n\n setOpen(false);\n }\n\n return (\n <Flex gap={2}>\n <Button\n id={id}\n type=\"button\"\n mode=\"ghost\"\n icon={isDefined(selectedNode) ? <Drawing node={selectedNode} {...defaultIconProps} /> : undefined}\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 {...defaultIconProps} />}\n text=\"Clear\"\n disabled={readOnly}\n onClick={() => {\n onChange(unset());\n }}\n aria-label=\"Clear the currently selected icon.\"\n />\n )}\n {open && (\n <Picker\n id={`${id}-library`}\n selected={name}\n onSelect={handleSelect}\n onClose={() => {\n setOpen(false);\n }}\n onClickOutside={() => {\n setOpen(false);\n }}\n />\n )}\n </Flex>\n );\n}\n","import { Drawing } from \"@/components/drawing\";\nimport { defaultIconProps } from \"@/config/defaults\";\nimport { resolveIconNode } from \"@/lib/nodes\";\nimport { isDefined } from \"@/lib/utils\";\nimport type { SanityIcon } from \"@/types\";\n\n/**\n * Builds the media a stored icon previews with, so a document lists the drawing an author chose\n * rather than one placeholder standing in for every icon alike.\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 node = resolveIconNode(value?.node);\n if (!isDefined(node)) return undefined;\n\n return function IconPreview() {\n return <Drawing node={node} {...defaultIconProps} />;\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 type { ComponentProps, ComponentType } from \"react\";\nimport { createElement } from \"react\";\n\nimport { defaultIconProps } from \"@/config/defaults\";\n\n/**\n * Creates a Sanity Studio icon component from an SVG icon.\n *\n * @param icon - The icon component to wrap.\n * @param props - Additional props merged over the default properties a Studio icon is drawn with.\n * @returns A Studio 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","import { defineField, defineType } from \"sanity\";\n\nimport { Field } from \"@/components/field\";\nimport { Input } from \"@/components/input\";\nimport { createIconPreview } from \"@/components/preview\";\nimport { SquareDashedIcon } from \"@/icons/square-dashed\";\nimport { createSanityIcon } from \"@/lib/icons\";\nimport { convertCase, isDefined } from \"@/lib/utils\";\nimport type { SanityIcon } from \"@/types\";\nimport { iconTypeName } from \"@/types\";\n\nexport const iconType = defineType({\n name: iconTypeName satisfies SanityIcon[\"_type\"],\n type: \"object\",\n icon: createSanityIcon(SquareDashedIcon),\n description: \"Icon chosen from the Lucide library.\",\n components: { field: Field, input: Input },\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, \"sentence\") : \"No icon\",\n media: createIconPreview({ _type: iconTypeName, name, node }),\n };\n },\n },\n fields: [\n defineField({\n name: \"name\" satisfies keyof SanityIcon,\n type: \"string\",\n description: \"Name of the chosen icon in the library it was taken from.\",\n }),\n defineField({\n name: \"node\" satisfies keyof SanityIcon,\n type: \"text\",\n description: \"Shapes the icon is drawn from, written when the icon is chosen.\",\n }),\n ],\n});\n","import { definePlugin } from \"sanity\";\n\nimport { iconType } from \"@/schemas/types/icon\";\n\n/**\n * Creates the icon field type for Sanity Studio, offering the Lucide library through a searchable\n * picker and storing the chosen drawing ready to render.\n *\n * @returns Sanity plugin definition.\n * @public\n */\nexport const iconPlugin = definePlugin({\n name: \"@driftime/sanity-plugin-icon\",\n schema: {\n types: [iconType],\n },\n});\n"],"mappings":";;;;;;;;;AAMA,SAAOG,MAAAC,IAAA;CAAA,IAAAC,IAAAC,EAAA,CAAA,GAAe,EAAAC,OAAAC,aAAAC,SAAAC,YAAAC,MAAAC,aAAAR,IAAuES;CAI7E,OAJ6ER,EAAA,OAAAO,YAAAP,EAAA,OAAAG,eAAAH,EAAA,OAAAI,WAAAJ,EAAA,OAAAM,QAAAN,EAAA,OAAAE,SAAAF,EAAA,OAAAK,cAEzFG,KAAA,oBAAC,WAAD;EAAkBN;EAAoBC;EAAsBC;EAAqBC;EAAkBC;EAChGC;CADO,CAAA,GAEEP,EAAA,KAAAO,UAAAP,EAAA,KAAAG,aAAAH,EAAA,KAAAI,SAAAJ,EAAA,KAAAM,MAAAN,EAAA,KAAAE,OAAAF,EAAA,KAAAK,YAAAL,EAAA,KAAAQ,MAAAA,KAAAR,EAAA,IAFZQ;AAEY;;ACNhB,MAqBaQ,kBAAkB;CAAEC,cAAc;CAAUC,QAAQR;AAAW;ACT5E,SAAOuB,KAAAC,IAAA;CAAA,IAAAC,IAAAC,EAAA,EAAA,GAAAP,WAAAF,MAAAK,UAAAF,UAAAO,OAAAT,UAAAG;CAAA,AAAAI,EAAA,OAAAD,MAA2FL,YAAAM,EAAA,IAAAR,OAAAQ,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,IAAIL,YAAYK,MAAM,UAAU,IAAI;IACzDa,OAAOrB,kBAAkB;KAAEsB,OAAOhB;KAAcE;KAAMS;IAAK,CAAC;GAC9D;EACF;CACF;CACAM,QAAQ,CACN3B,YAAY;EACVY,MAAM;EACNC,MAAM;EACNE,aAAa;CACf,CAAC,GACDf,YAAY;EACVY,MAAM;EACNC,MAAM;EACNE,aAAa;CACf,CAAC,CAAC;AAEN,CAAC,GChCYe,aAAaF,aAAa;CACrCG,MAAM;CACNC,QAAQ,EACNC,OAAO,CAACJ,QAAQ,EAClB;AACF,CAAC"}
|
package/dist/render.d.ts
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { t as SanityIcon } from "./types-nQUVfUHK.js";
|
|
2
|
+
import { ComponentProps } from "react";
|
|
3
|
+
/**
|
|
4
|
+
* Properties for drawing a stored icon, extending an SVG element with the value to read it from.
|
|
5
|
+
*
|
|
6
|
+
* @public
|
|
7
|
+
*/
|
|
8
|
+
type IconProps = Omit<ComponentProps<"svg">, "children"> & {
|
|
9
|
+
value: SanityIcon | undefined;
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* Draws the icon an author chose, taking the shapes from the stored value so nothing has to resolve
|
|
13
|
+
* them against an icon library. Renders nothing when the value is absent or unreadable.
|
|
14
|
+
*
|
|
15
|
+
* @param props - The stored icon, alongside any attributes the SVG should carry.
|
|
16
|
+
* @returns The icon, or nothing when there is nothing to draw.
|
|
17
|
+
* @public
|
|
18
|
+
*/
|
|
19
|
+
declare function Icon({ value, ...props }: IconProps): import("react").JSX.Element;
|
|
20
|
+
export { Icon, type IconProps, type SanityIcon };
|
|
21
|
+
//# sourceMappingURL=render.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"render.d.ts","names":[],"sources":["../src/components/icon.tsx"],"mappings":";;;;;;;KAcY,YAAY,KAAK;EAAuC,OAAO;;;;;;;;;;iBAU3D,OAAO,UAAU,SAAS,4BAAS,IAAA"}
|
package/dist/render.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { r as resolveIconNode, t as Drawing } from "./drawing-Bo0HTICv.js";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
/**
|
|
4
|
+
* Draws the icon an author chose, taking the shapes from the stored value so nothing has to resolve
|
|
5
|
+
* them against an icon library. Renders nothing when the value is absent or unreadable.
|
|
6
|
+
*
|
|
7
|
+
* @param props - The stored icon, alongside any attributes the SVG should carry.
|
|
8
|
+
* @returns The icon, or nothing when there is nothing to draw.
|
|
9
|
+
* @public
|
|
10
|
+
*/
|
|
11
|
+
function Icon({ value, ...props }) {
|
|
12
|
+
return /* @__PURE__ */ jsx(Drawing, {
|
|
13
|
+
node: resolveIconNode(value?.node),
|
|
14
|
+
...props
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
export { Icon };
|
|
18
|
+
|
|
19
|
+
//# sourceMappingURL=render.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"render.js","names":["ComponentProps","Drawing","resolveIconNode","SanityIcon","IconProps","Omit","value","Icon","props","node"],"sources":["../src/components/icon.tsx"],"sourcesContent":["// Runs inside a consumer's server components, where the compiler's memo cache hook cannot.\n\"use no memo\";\n\nimport type { ComponentProps } from \"react\";\n\nimport { Drawing } from \"@/components/drawing\";\nimport { resolveIconNode } from \"@/lib/nodes\";\nimport type { SanityIcon } from \"@/types\";\n\n/**\n * Properties for drawing a stored icon, extending an SVG element with the value to read it from.\n *\n * @public\n */\nexport type IconProps = Omit<ComponentProps<\"svg\">, \"children\"> & { value: SanityIcon | undefined };\n\n/**\n * Draws the icon an author chose, taking the shapes from the stored value so nothing has to resolve\n * them against an icon library. Renders nothing when the value is absent or unreadable.\n *\n * @param props - The stored icon, alongside any attributes the SVG should carry.\n * @returns The icon, or nothing when there is nothing to draw.\n * @public\n */\nexport function Icon({ value, ...props }: IconProps) {\n return <Drawing node={resolveIconNode(value?.node)} {...props} />;\n}\n"],"mappings":";;;;;;;;;;AAwBA,SAAgBO,KAAK,EAAED,OAAO,GAAGE,SAAoB;CACnD,OAAO,oBAAC,SAAD;EAAS,MAAMN,gBAAgBI,OAAOG,IAAI;EAAG,GAAID;CAAM,CAAA;AAChE"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/** Type name of the icon object. */
|
|
2
|
+
declare const iconTypeName = "icon";
|
|
3
|
+
/**
|
|
4
|
+
* An icon an author chose, stored as the name it was chosen by alongside the shapes it draws.
|
|
5
|
+
*
|
|
6
|
+
* @public
|
|
7
|
+
*/
|
|
8
|
+
interface SanityIcon {
|
|
9
|
+
_type: typeof iconTypeName;
|
|
10
|
+
/** Name the icon goes by in the library it was taken from. */
|
|
11
|
+
name?: string;
|
|
12
|
+
/** Shapes the icon is drawn from, written when the icon is chosen. */
|
|
13
|
+
node?: string;
|
|
14
|
+
}
|
|
15
|
+
export { SanityIcon as t };
|
|
16
|
+
//# sourceMappingURL=types-nQUVfUHK.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types-nQUVfUHK.d.ts","names":[],"sources":["../src/types.ts"],"mappings":"AAIA;cAAa;;;;;;UAOI;EACf,cAAc;;EAEd;;EAEA"}
|
package/package.json
ADDED
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@driftime/sanity-plugin-icon",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Lucide icons for Sanity Studio, stored as drawings and rendered without the library.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"sanity",
|
|
7
|
+
"sanity-plugin"
|
|
8
|
+
],
|
|
9
|
+
"homepage": "https://github.com/driftime/sanity-plugin-icon",
|
|
10
|
+
"bugs": {
|
|
11
|
+
"url": "https://github.com/driftime/sanity-plugin-icon/issues",
|
|
12
|
+
"email": "kenny@driftime.com"
|
|
13
|
+
},
|
|
14
|
+
"license": "MIT",
|
|
15
|
+
"author": {
|
|
16
|
+
"name": "Kenny Heard",
|
|
17
|
+
"email": "kenny@driftime.com",
|
|
18
|
+
"url": "https://driftime.com"
|
|
19
|
+
},
|
|
20
|
+
"repository": {
|
|
21
|
+
"type": "git",
|
|
22
|
+
"url": "git+ssh://git@github.com/driftime/sanity-plugin-icon.git"
|
|
23
|
+
},
|
|
24
|
+
"files": [
|
|
25
|
+
"dist"
|
|
26
|
+
],
|
|
27
|
+
"type": "module",
|
|
28
|
+
"sideEffects": false,
|
|
29
|
+
"types": "./dist/index.d.ts",
|
|
30
|
+
"exports": {
|
|
31
|
+
".": {
|
|
32
|
+
"source": "./src/index.ts",
|
|
33
|
+
"default": "./dist/index.js"
|
|
34
|
+
},
|
|
35
|
+
"./render": {
|
|
36
|
+
"source": "./src/render.ts",
|
|
37
|
+
"default": "./dist/render.js"
|
|
38
|
+
},
|
|
39
|
+
"./package.json": "./package.json"
|
|
40
|
+
},
|
|
41
|
+
"publishConfig": {
|
|
42
|
+
"exports": {
|
|
43
|
+
".": "./dist/index.js",
|
|
44
|
+
"./render": "./dist/render.js",
|
|
45
|
+
"./package.json": "./package.json"
|
|
46
|
+
},
|
|
47
|
+
"access": "public"
|
|
48
|
+
},
|
|
49
|
+
"scripts": {
|
|
50
|
+
"typecheck": "tsc",
|
|
51
|
+
"check": "oxfmt --check && oxlint",
|
|
52
|
+
"fix": "oxfmt && oxlint --fix",
|
|
53
|
+
"dev": "plugin-kit link-watch",
|
|
54
|
+
"watch": "pkg-utils watch --strict",
|
|
55
|
+
"build": "bun run check && bun run typecheck && plugin-kit verify-package --silent && pkg-utils build --strict --check --clean && node --check dist/index.js",
|
|
56
|
+
"prepublishOnly": "bun run build"
|
|
57
|
+
},
|
|
58
|
+
"dependencies": {
|
|
59
|
+
"@sanity/client": "^7.26.2",
|
|
60
|
+
"@sanity/icons": "^5.2.1",
|
|
61
|
+
"@sanity/ui": "^4.0.3",
|
|
62
|
+
"lucide-static": "^1.43.0"
|
|
63
|
+
},
|
|
64
|
+
"devDependencies": {
|
|
65
|
+
"@sanity/browserslist-config": "1.0.5",
|
|
66
|
+
"@sanity/pkg-utils": "12.1.2",
|
|
67
|
+
"@sanity/plugin-kit": "10.0.5",
|
|
68
|
+
"@sanity/tsconfig": "2.2.1",
|
|
69
|
+
"@types/node": "26.2.0",
|
|
70
|
+
"@types/react": "19.2.18",
|
|
71
|
+
"@types/react-dom": "19.2.4",
|
|
72
|
+
"babel-plugin-react-compiler": "1.0.0",
|
|
73
|
+
"oxfmt": "0.63.0",
|
|
74
|
+
"oxlint": "1.78.0",
|
|
75
|
+
"oxlint-tsgolint": "7.0.2001",
|
|
76
|
+
"react": "19.2.8",
|
|
77
|
+
"react-dom": "19.2.8",
|
|
78
|
+
"sanity": "6.9.2",
|
|
79
|
+
"typescript": "7.0.2"
|
|
80
|
+
},
|
|
81
|
+
"peerDependencies": {
|
|
82
|
+
"react": "19",
|
|
83
|
+
"sanity": "6"
|
|
84
|
+
},
|
|
85
|
+
"browserslist": "extends @sanity/browserslist-config",
|
|
86
|
+
"engines": {
|
|
87
|
+
"node": ">=20.19 <22 || >=22.12"
|
|
88
|
+
},
|
|
89
|
+
"sanityPlugin": {
|
|
90
|
+
"verifyPackage": {
|
|
91
|
+
"tsconfig": false,
|
|
92
|
+
"scripts": false,
|
|
93
|
+
"oxlint": false,
|
|
94
|
+
"oxfmt": false
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}
|