@sanity/color-input
6.0.126.0.13
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","defineType","ObjectDefinition","ColorInput","ColorOptions","round","val","Math","colorTypeName","ColorDefinition","Omit","type","options","IntrinsicDefinitions","color","name","title","components","input","fields","preview","select","alpha","hex","hsl","prepare","h","s","l","subtitle","media","backgroundColor","opacity","position","height","width","top","left","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/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 {defineType, type ObjectDefinition} from 'sanity'\n\nimport {ColorInput} from '../LazyColorInput'\nimport {type ColorOptions} from '../types'\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\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,\n subtitle: subtitle,\n media: () => (\n <div\n style={{\n backgroundColor: hex ?? '#000',\n opacity: alpha ?? 1,\n position: 'absolute',\n height: '100%',\n width: '100%',\n top: '0',\n left: '0',\n }}\n />\n ),\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,MAAaC,aAAaD,WAAW,OAAO,kBAAe,GCGrDM,SAASC,MAAc,MAAMC,KAAKF,MAAMC,MAAM,GAAG,GAmB1CQ,QAAQb,WAAW;CAC9Bc,MAAMP;CACNG,MAAM;CACNK,OAAO;CACPC,YAAY,EAACC,OAAOf,WAAU;CAC9BgB,QAAQ;EACN;GACEH,OAAO;GACPD,MAAM;GACNJ,MAAM;EACR;EACA;GACEK,OAAO;GACPD,MAAM;GACNJ,MAAM;EACR;EACA;GACEK,OAAO;GACPD,MAAM;GACNJ,MAAM;EACR;EACA;GACEK,OAAO;GACPD,MAAM;GACNJ,MAAM;EACR;EACA;GACEK,OAAO;GACPD,MAAM;GACNJ,MAAM;EACR;CAAC;CAEHS,SAAS;EACPC,QAAQ;GACNL,OAAO;GACPM,OAAO;GACPC,KAAK;GACLC,KAAK;EACP;EACAC,QAAQ,EACNT,OACAO,KACAC,KACAF,SAMC;GACD,IAAIO,WAAWN,OAAO;GAItB,OAHIC,QACFK,WAAW,KAAKxB,MAAMmB,IAAIE,CAAC,EAAC,KAAMrB,MAAMmB,IAAIG,CAAC,EAAC,KAAMtB,MAAMmB,IAAII,CAAC,EAAC,KAAMvB,MAAMiB,KAAK,MAE5E;IACEN;IACGa;IACVC,aACE,oBAAC,OAAD,EACE,OAAO;KACLC,iBAAiBR,OAAO;KACxBS,SAASV,SAAS;KAClBW,UAAU;KACVC,QAAQ;KACRC,OAAO;KACPC,KAAK;KACLC,MAAM;IACR,EAAE,CAAA;GAGR;EACF;CACF;AACF,CAAC,GC/FYE,YAAYD,WAAW;CAClCE,OAAO;CACPC,MAAM;CACNC,MAAM;CACNC,QAAQ;EACN;GAACF,MAAM;GAAKC,MAAM;GAAUF,OAAO;EAAK;EACxC;GAACC,MAAM;GAAKC,MAAM;GAAUF,OAAO;EAAY;EAC/C;GAACC,MAAM;GAAKC,MAAM;GAAUF,OAAO;EAAW;EAC9C;GAACC,MAAM;GAAKC,MAAM;GAAUF,OAAO;EAAO;CAAC;AAE/C,CAAC,GCVYK,YAAYD,WAAW;CAClCE,OAAO;CACPC,MAAM;CACNC,MAAM;CACNC,QAAQ;EACN;GAACF,MAAM;GAAKC,MAAM;GAAUF,OAAO;EAAK;EACxC;GAACC,MAAM;GAAKC,MAAM;GAAUF,OAAO;EAAY;EAC/C;GAACC,MAAM;GAAKC,MAAM;GAAUF,OAAO;EAAO;EAC1C;GAACC,MAAM;GAAKC,MAAM;GAAUF,OAAO;EAAO;CAAC;AAE/C,CAAC,GCVYK,YAAYD,WAAW;CAClCE,OAAO;CACPC,MAAM;CACNC,MAAM;CACNC,QAAQ;EACN;GAACF,MAAM;GAAKC,MAAM;GAAUF,OAAO;EAAK;EACxC;GAACC,MAAM;GAAKC,MAAM;GAAUF,OAAO;EAAO;EAC1C;GAACC,MAAM;GAAKC,MAAM;GAAUF,OAAO;EAAM;EACzC;GAACC,MAAM;GAAKC,MAAM;GAAUF,OAAO;EAAO;CAAC;AAE/C,CAAC,GCLYU,aAAaN,aAAa;CACrCO,MAAM;CACNC,QAAQ,EACNC,OAAO;EAACN;EAAWC;EAAWC;EAAWJ;CAAK,EAChD;AACF,CAAC"}
\ No newline at end of file
+{"version":3,"file":"index.js","names":["lazy","ColorInput","defineType","ObjectDefinition","ColorInput","ColorOptions","round","val","Math","colorTypeName","ColorDefinition","Omit","type","options","IntrinsicDefinitions","color","name","title","components","input","fields","preview","select","alpha","hex","hsl","prepare","h","s","l","subtitle","media","backgroundColor","opacity","position","height","width","top","left","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/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 {defineType, type ObjectDefinition} from 'sanity'\n\nimport {ColorInput} from '../LazyColorInput'\nimport {type ColorOptions} from '../types'\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\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,\n subtitle: subtitle,\n media: () => (\n <div\n style={{\n backgroundColor: hex ?? '#000',\n opacity: alpha ?? 1,\n position: 'absolute',\n height: '100%',\n width: '100%',\n top: '0',\n left: '0',\n }}\n />\n ),\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,MA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