@sanity/color-input
6.1.16.1.2
dist/index.js.map~
dist/index.js.mapModified+1−1
Index: package/dist/index.js.map
===================================================================
--- package/dist/index.js.map
+++ package/dist/index.js.map
@@ -1,1 +1,1 @@
-{"version":3,"file":"index.js","names":["lazy","ColorInput","assignInlineVars","defineType","ObjectDefinition","ColorInput","ColorOptions","backgroundColorVar","colorPreview","opacityVar","round","val","Math","colorTypeName","ColorDefinition","Omit","type","options","IntrinsicDefinitions","color","ColorPreviewMedia","t0","$","_c","hex","alpha","t1","t2","String","t3","t4","name","title","components","input","fields","preview","select","hsl","prepare","h","s","l","subtitle","media","defineType","hslaColor","title","name","type","fields","defineType","hsvaColor","title","name","type","fields","defineType","rgbaColor","title","name","type","fields","definePlugin","color","ColorDefinition","hslaColor","hsvaColor","rgbaColor","colorInput","name","schema","types","ColorInput","ColorInputProps","ColorOptions","ColorSchemaType","ColorValue"],"sources":["../src/LazyColorInput.tsx","../src/schemas/colorPreview.css.ts","../src/schemas/color.tsx","../src/schemas/hslaColor.ts","../src/schemas/hsvaColor.ts","../src/schemas/rgbaColor.ts","../src/index.ts"],"sourcesContent":["import {lazy} from 'react'\n\nexport const ColorInput = lazy(() => import('./ColorInput'))\n","import {createVar, style} from '@vanilla-extract/css'\n\nexport const backgroundColorVar = createVar()\nexport const opacityVar = createVar()\n\nexport const colorPreview = style({\n backgroundColor: backgroundColorVar,\n opacity: opacityVar,\n position: 'absolute',\n height: '100%',\n width: '100%',\n top: 0,\n left: 0,\n})\n","import {assignInlineVars} from '@vanilla-extract/dynamic'\nimport {defineType, type ObjectDefinition} from 'sanity'\n\nimport {ColorInput} from '../LazyColorInput'\nimport {type ColorOptions} from '../types'\n\nimport {backgroundColorVar, colorPreview, opacityVar} from './colorPreview.css'\n\nconst round = (val: number = 1) => Math.round(val * 100)\n\nconst colorTypeName = 'color'\n\n/**\n * @public\n */\nexport interface ColorDefinition extends Omit<ObjectDefinition, 'type' | 'fields' | 'options'> {\n type: typeof colorTypeName\n options?: ColorOptions\n}\n\ndeclare module 'sanity' {\n // makes type: 'color' narrow correctly when using defineType/defineField/defineArrayMember\n export interface IntrinsicDefinitions {\n color: ColorDefinition\n }\n}\n\nfunction ColorPreviewMedia({hex, alpha}: {hex?: string; alpha?: number}) {\n return (\n <div\n className={colorPreview}\n style={assignInlineVars({\n [backgroundColorVar]: hex ?? '#000',\n [opacityVar]: String(alpha ?? 1),\n })}\n />\n )\n}\n\nexport const color = defineType({\n name: colorTypeName,\n type: 'object',\n title: 'Color',\n components: {input: ColorInput},\n fields: [\n {\n title: 'Hex',\n name: 'hex',\n type: 'string',\n },\n {\n title: 'Alpha',\n name: 'alpha',\n type: 'number',\n },\n {\n title: 'Hue Saturation Lightness',\n name: 'hsl',\n type: 'hslaColor',\n },\n {\n title: 'Hue Saturation Value',\n name: 'hsv',\n type: 'hsvaColor',\n },\n {\n title: 'Red Green Blue (rgb)',\n name: 'rgb',\n type: 'rgbaColor',\n },\n ],\n preview: {\n select: {\n title: 'hex',\n alpha: 'alpha',\n hex: 'hex',\n hsl: 'hsl',\n },\n prepare({\n title,\n hex,\n hsl,\n alpha,\n }: {\n title?: string\n alpha?: number\n hex?: string\n hsl?: {h: number; s: number; l: number}\n }) {\n let subtitle = hex || 'No color set'\n if (hsl) {\n subtitle = `H:${round(hsl.h)} S:${round(hsl.s)} L:${round(hsl.l)} A:${round(alpha)}`\n }\n return {\n title: title || 'Color',\n subtitle: subtitle,\n media: () => <ColorPreviewMedia hex={hex} alpha={alpha} />,\n }\n },\n },\n})\n","import {defineType} from 'sanity'\n\nexport const hslaColor = defineType({\n title: 'Hue Saturation Lightness',\n name: 'hslaColor',\n type: 'object',\n fields: [\n {name: 'h', type: 'number', title: 'Hue'},\n {name: 's', type: 'number', title: 'Saturation'},\n {name: 'l', type: 'number', title: 'Lightness'},\n {name: 'a', type: 'number', title: 'Alpha'},\n ],\n})\n","import {defineType} from 'sanity'\n\nexport const hsvaColor = defineType({\n title: 'Hue Saturation Value',\n name: 'hsvaColor',\n type: 'object',\n fields: [\n {name: 'h', type: 'number', title: 'Hue'},\n {name: 's', type: 'number', title: 'Saturation'},\n {name: 'v', type: 'number', title: 'Value'},\n {name: 'a', type: 'number', title: 'Alpha'},\n ],\n})\n","import {defineType} from 'sanity'\n\nexport const rgbaColor = defineType({\n title: 'Red Green Blue (rgb)',\n name: 'rgbaColor',\n type: 'object',\n fields: [\n {name: 'r', type: 'number', title: 'Red'},\n {name: 'g', type: 'number', title: 'Green'},\n {name: 'b', type: 'number', title: 'Blue'},\n {name: 'a', type: 'number', title: 'Alpha'},\n ],\n})\n","import {definePlugin} from 'sanity'\n\nimport {color, type ColorDefinition} from './schemas/color'\nimport {hslaColor} from './schemas/hslaColor'\nimport {hsvaColor} from './schemas/hsvaColor'\nimport {rgbaColor} from './schemas/rgbaColor'\n\nexport const colorInput = definePlugin({\n name: '@sanity/color-input',\n schema: {\n types: [hslaColor, hsvaColor, rgbaColor, color],\n },\n})\n\nexport {color, hslaColor, hsvaColor, rgbaColor}\nexport {ColorInput} from './LazyColorInput'\nexport type {ColorDefinition}\nexport type {ColorInputProps, ColorOptions, ColorSchemaType, ColorValue} from './types'\n"],"mappings":";;;;;;AAEA,MAAA,aAAA,WAAA,OAAA,2BAAA;;AEMA,MAAA,SAAA,MAAA,MAAA,KAAA,MAAA,MAAA,GAAA;AAmBA,SAAA,kBAAA,IAAA;CAAA,IAAA,IAAA,EAAA,CAAA,GAA2B,EAAA,KAAA,UAAA,IAKG,KAAA,OAAA,QACR,KAAA,OAAA,SAAA,CAAA,GAAkB;CAAA,AAAA,EAAA,OAAA,MAAA,EAAA,OAAA,MAF3B6B,KAAAA,iBAAAA;GACJtB,qBAAAA;GACAE,aAAAA;CACH,CAAA,GAAEa,EAAAA,KAAAA,IAAAA,EAAAA,KAAAA,IAAAA,EAAAA,KAAAA,MAAA,KAAA,EAAA;CAAA,IAAA;CACF,OADE,EAAA,OAAA,KACF,KAAA,EAAA,MANFQ,KAAAA,oBAAAA,OAAAA;EACatB,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MAAAA;CACAC,QAAAA;EACE;GAACF,MAAAA;GAAWC,MAAAA;GAAgBF,OAAAA;EAAY;EACxC;GAACC,MAAAA;GAAWC,MAAAA;GAAgBF,OAAAA;EAAmB;EAC/C;GAACC,MAAAA;GAAWC,MAAAA;GAAgBF,OAAAA;EAAc;EAC1C;GAACC,MAAAA;GAAWC,MAAAA;GAAgBF,OAAAA;EAAc;CAAC;AAE/C,CAAA,GCVA,YAAA,WAAA;CACEM,OAAAA;CACAC,MAAAA;CACAC,MAAAA;CACAC,QAAAA;EACE;GAACF,MAAAA;GAAWC,MAAAA;GAAgBF,OAAAA;EAAY;EACxC;GAACC,MAAAA;GAAWC,MAAAA;GAAgBF,OAAAA;EAAc;EAC1C;GAACC,MAAAA;GAAWC,MAAAA;GAAgBF,OAAAA;EAAa;EACzC;GAACC,MAAAA;GAAWC,MAAAA;GAAgBF,OAAAA;EAAc;CAAC;AAE/C,CAAA,GCLA,aAAA,aAAA;CACEW,MAAAA;CACAC,QAAAA,EAAAA,OAAAA;EACUL;EAAWC;EAAWC;EAAWJ;CAAK,EAAA;AAElD,CAAA"}
\ No newline at end of file
+{"version":3,"file":"index.js","names":["lazy","ColorInput","assignInlineVars","defineType","ObjectDefinition","ColorInput","ColorOptions","backgroundColorVar","colorPreview","opacityVar","round","val","Math","colorTypeName","ColorDefinition","Omit","type","options","IntrinsicDefinitions","color","ColorPreviewMedia","t0","$","_c","hex","alpha","t1","t2","String","t3","t4","name","title","components","input","fields","preview","select","hsl","prepare","h","s","l","subtitle","media","defineType","hslaColor","title","name","type","fields","defineType","hsvaColor","title","name","type","fields","defineType","rgbaColor","title","name","type","fields","definePlugin","color","ColorDefinition","hslaColor","hsvaColor","rgbaColor","colorInput","name","schema","types","ColorInput","ColorInputProps","ColorOptions","ColorSchemaType","ColorValue"],"sources":["../src/LazyColorInput.tsx","../src/schemas/colorPreview.css.ts","../src/schemas/color.tsx","../src/schemas/hslaColor.ts","../src/schemas/hsvaColor.ts","../src/schemas/rgbaColor.ts","../src/index.ts"],"sourcesContent":["import {lazy} from 'react'\n\nexport const ColorInput = lazy(() => import('./ColorInput'))\n","import {createVar, style} from '@vanilla-extract/css'\n\nexport const backgroundColorVar = createVar()\nexport const opacityVar = createVar()\n\nexport const colorPreview = style({\n backgroundColor: backgroundColorVar,\n opacity: opacityVar,\n position: 'absolute',\n height: '100%',\n width: '100%',\n top: 0,\n left: 0,\n})\n","import {assignInlineVars} from '@vanilla-extract/dynamic'\nimport {defineType, type ObjectDefinition} from 'sanity'\n\nimport {ColorInput} from '../LazyColorInput'\nimport {type ColorOptions} from '../types'\n\nimport {backgroundColorVar, colorPreview, opacityVar} from './colorPreview.css'\n\nconst round = (val: number = 1) => Math.round(val * 100)\n\nconst colorTypeName = 'color'\n\n/**\n * @public\n */\nexport interface ColorDefinition extends Omit<ObjectDefinition, 'type' | 'fields' | 'options'> {\n type: typeof colorTypeName\n options?: ColorOptions\n}\n\ndeclare module 'sanity' {\n // makes type: 'color' narrow correctly when using defineType/defineField/defineArrayMember\n export interface IntrinsicDefinitions {\n color: ColorDefinition\n }\n}\n\nfunction ColorPreviewMedia({hex, alpha}: {hex?: string; alpha?: number}) {\n return (\n <div\n className={colorPreview}\n style={assignInlineVars({\n [backgroundColorVar]: hex ?? '#000',\n [opacityVar]: String(alpha ?? 1),\n })}\n />\n )\n}\n\nexport const color = defineType({\n name: colorTypeName,\n type: 'object',\n title: 'Color',\n components: {input: ColorInput},\n fields: [\n {\n title: 'Hex',\n name: 'hex',\n type: 'string',\n },\n {\n title: 'Alpha',\n name: 'alpha',\n type: 'number',\n },\n {\n title: 'Hue Saturation Lightness',\n name: 'hsl',\n type: 'hslaColor',\n },\n {\n title: 'Hue Saturation Value',\n name: 'hsv',\n type: 'hsvaColor',\n },\n {\n title: 'Red Green Blue (rgb)',\n name: 'rgb',\n type: 'rgbaColor',\n },\n ],\n preview: {\n select: {\n title: 'hex',\n alpha: 'alpha',\n hex: 'hex',\n hsl: 'hsl',\n },\n prepare({\n title,\n hex,\n hsl,\n alpha,\n }: {\n title?: string\n alpha?: number\n hex?: string\n hsl?: {h: number; s: number; l: number}\n }) {\n let subtitle = hex || 'No color set'\n if (hsl) {\n subtitle = `H:${round(hsl.h)} S:${round(hsl.s)} L:${round(hsl.l)} A:${round(alpha)}`\n }\n return {\n title: title || 'Color',\n subtitle: subtitle,\n media: () => <ColorPreviewMedia hex={hex} alpha={alpha} />,\n }\n },\n },\n})\n","import {defineType} from 'sanity'\n\nexport const hslaColor = defineType({\n title: 'Hue Saturation Lightness',\n name: 'hslaColor',\n type: 'object',\n fields: [\n {name: 'h', type: 'number', title: 'Hue'},\n {name: 's', type: 'number', title: 'Saturation'},\n {name: 'l', type: 'number', title: 'Lightness'},\n {name: 'a', type: 'number', title: 'Alpha'},\n ],\n})\n","import {defineType} from 'sanity'\n\nexport const hsvaColor = defineType({\n title: 'Hue Saturation Value',\n name: 'hsvaColor',\n type: 'object',\n fields: [\n {name: 'h', type: 'number', title: 'Hue'},\n {name: 's', type: 'number', title: 'Saturation'},\n {name: 'v', type: 'number', title: 'Value'},\n {name: 'a', type: 'number', title: 'Alpha'},\n ],\n})\n","import {defineType} from 'sanity'\n\nexport const rgbaColor = defineType({\n title: 'Red Green Blue (rgb)',\n name: 'rgbaColor',\n type: 'object',\n fields: [\n {name: 'r', type: 'number', title: 'Red'},\n {name: 'g', type: 'number', title: 'Green'},\n {name: 'b', type: 'number', title: 'Blue'},\n {name: 'a', type: 'number', title: 'Alpha'},\n ],\n})\n","import '@sanity/ui/styles.css'\nimport {definePlugin} from 'sanity'\n\nimport {color, type ColorDefinition} from './schemas/color'\nimport {hslaColor} from './schemas/hslaColor'\nimport {hsvaColor} from './schemas/hsvaColor'\nimport {rgbaColor} from './schemas/rgbaColor'\n\nexport const colorInput = definePlugin({\n name: '@sanity/color-input',\n schema: {\n types: [hslaColor, hsvaColor, rgbaColor, color],\n },\n})\n\nexport {color, hslaColor, hsvaColor, rgbaColor}\nexport {ColorInput} from './LazyColorInput'\nexport type {ColorDefinition}\nexport type {ColorInputProps, ColorOptions, ColorSchemaType, ColorValue} from './types'\n"],"mappings":";;;;;;;AAEA,MAAA,aAAA,WAAA,OAAA,2BAAA;;AEMA,MAAA,SAAA,MAAA,MAAA,KAAA,MAAA,MAAA,GAAA;AAmBA,SAAA,kBAAA,IAAA;CAAA,IAAA,IAAA,EAAA,CAAA,GAA2B,EAAA,KAAA,UAAA,IAKG,KAAA,OAAA,QACR,KAAA,OAAA,SAAA,CAAA,GAAkB;CAAA,AAAA,EAAA,OAAA,MAAA,EAAA,OAAA,MAF3B6B,KAAAA,iBAAAA;GACJtB,qBAAAA;GACAE,aAAAA;CACH,CAAA,GAAEa,EAAAA,KAAAA,IAAAA,EAAAA,KAAAA,IAAAA,EAAAA,KAAAA,MAAA,KAAA,EAAA;CAAA,IAAA;CACF,OADE,EAAA,OAAA,KACF,KAAA,EAAA,MANFQ,KAAAA,oBAAAA,OAAAA;EACatB,WAAAA;EACJ,OAAA;CAGL,CAAA,GACFc,EAAAA,KAAAA,IAAAA,EAAAA,KAAAA,KAAA;AAAA;AAIN,MAAA,QAAA,WAAA;CACES,MAAAA;CACAf,MAAAA;CACAgB,OAAAA;CACAC,YAAAA,EAAAA,OAAAA,WAAAA;CACAE,QAAAA;EACE;GACEH,OAAAA;GACAD,MAAAA;GACAf,MAAAA;EACF;EACA;GACEgB,OAAAA;GACAD,MAAAA;GACAf,MAAAA;EACF;EACA;GACEgB,OAAAA;GACAD,MAAAA;GACAf,MAAAA;EACF;EACA;GACEgB,OAAAA;GACAD,MAAAA;GACAf,MAAAA;EACF;EACA;GACEgB,OAAAA;GACAD,MAAAA;GACAf,MAAAA;EACF;CAAC;CAEHoB,SAAAA;EACEC,QAAAA;GACEL,OAAAA;GACAP,OAAAA;GACAD,KAAAA;GACAc,KAAAA;EACF;EACAC,QAAAA,EAAAA,OAAAA,KAAAA,KAAAA,SAAAA;GAWE,IAAA,WAAA,OAAA;GAIA,OAHA,QAAA,WAAA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