@sanity/color-input 4.0.6 → 5.0.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.
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","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' as const\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"],"names":["ColorInput","lazy","round","val","Math","colorTypeName","color","defineType","name","type","title","components","input","fields","preview","select","alpha","hex","hsl","prepare","subtitle","h","s","l","media","backgroundColor","opacity","position","height","width","top","left","hslaColor","hsvaColor","rgbaColor","colorInput","definePlugin","schema","types"],"mappings":";;;AAEO,MAAMA,aAAaC,KAAK,MAAM,OAAO,4BAAc,CAAC,GCGrDC,QAAQA,CAACC,MAAc,MAAMC,KAAKF,MAAMC,MAAM,GAAG,GAEjDE,gBAAgB,SAiBTC,QAAQC,WAAW;AAAA,EAC9BC,MAAMH;AAAAA,EACNI,MAAM;AAAA,EACNC,OAAO;AAAA,EACPC,YAAY;AAAA,IAACC,OAAOZ;AAAAA,EAAAA;AAAAA,EACpBa,QAAQ,CACN;AAAA,IACEH,OAAO;AAAA,IACPF,MAAM;AAAA,IACNC,MAAM;AAAA,EAAA,GAER;AAAA,IACEC,OAAO;AAAA,IACPF,MAAM;AAAA,IACNC,MAAM;AAAA,EAAA,GAER;AAAA,IACEC,OAAO;AAAA,IACPF,MAAM;AAAA,IACNC,MAAM;AAAA,EAAA,GAER;AAAA,IACEC,OAAO;AAAA,IACPF,MAAM;AAAA,IACNC,MAAM;AAAA,EAAA,GAER;AAAA,IACEC,OAAO;AAAA,IACPF,MAAM;AAAA,IACNC,MAAM;AAAA,EAAA,CACP;AAAA,EAEHK,SAAS;AAAA,IACPC,QAAQ;AAAA,MACNL,OAAO;AAAA,MACPM,OAAO;AAAA,MACPC,KAAK;AAAA,MACLC,KAAK;AAAA,IAAA;AAAA,IAEPC,QAAQ;AAAA,MACNT;AAAAA,MACAO;AAAAA,MACAC;AAAAA,MACAF;AAAAA,IAAAA,GAMC;AACD,UAAII,WAAWH,OAAO;AACtB,aAAIC,QACFE,WAAW,KAAKlB,MAAMgB,IAAIG,CAAC,CAAC,MAAMnB,MAAMgB,IAAII,CAAC,CAAC,MAAMpB,MAAMgB,IAAIK,CAAC,CAAC,MAAMrB,MAAMc,KAAK,CAAC,KAE7E;AAAA,QACLN;AAAAA,QACAU;AAAAA,QACAI,OAAOA,MACL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AAAA,EAAA,GACnC;AAAA,IAACF,MAAM;AAAA,IAAKC,MAAM;AAAA,IAAUC,OAAO;AAAA,EAAA,GACnC;AAAA,IAACF,MAAM;AAAA,IAAKC,MAAM;AAAA,IAAUC,OAAO;AAAA,EAAA,GACnC;AAAA,IAACF,MAAM;AAAA,IAAKC,MAAM;AAAA,IAAUC,OAAO;AAAA,EAAA,CAAQ;AAE/C,CAAC,GCLYyB,aAAaC,aAAa;AAAA,EACrC5B,MAAM;AAAA,EACN6B,QAAQ;AAAA,IACNC,OAAO,CAACN,WAAWC,WAAWC,WAAW5B,KAAK;AAAA,EAAA;AAElD,CAAC;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sanity/color-input",
3
- "version": "4.0.6",
3
+ "version": "5.0.0",
4
4
  "description": "Color input",
5
5
  "keywords": [
6
6
  "sanity",
@@ -11,101 +11,67 @@
11
11
  "color-input",
12
12
  "sanity-plugin"
13
13
  ],
14
- "homepage": "https://github.com/sanity-io/color-input#readme",
14
+ "homepage": "https://github.com/sanity-io/plugins/tree/main/plugins/%40sanity/color-input#readme",
15
15
  "bugs": {
16
- "url": "https://github.com/sanity-io/color-input/issues"
16
+ "url": "https://github.com/sanity-io/plugins/issues"
17
17
  },
18
18
  "repository": {
19
19
  "type": "git",
20
- "url": "git@github.com:sanity-io/color-input.git"
20
+ "url": "git+ssh://git@github.com/sanity-io/plugins.git",
21
+ "directory": "plugins/@sanity/color-input"
21
22
  },
22
23
  "license": "MIT",
23
24
  "author": "Sanity.io <hello@sanity.io>",
24
- "sideEffects": false,
25
+ "type": "module",
25
26
  "exports": {
26
27
  ".": {
27
28
  "source": "./src/index.ts",
28
- "import": "./lib/index.mjs",
29
- "require": "./lib/index.js",
30
- "default": "./lib/index.js"
29
+ "default": "./dist/index.js"
31
30
  },
32
31
  "./package.json": "./package.json"
33
32
  },
34
- "main": "./lib/index.js",
35
- "module": "./lib/index.esm.js",
36
- "types": "./lib/index.d.ts",
33
+ "types": "./dist/index.d.ts",
37
34
  "files": [
38
- "lib",
39
- "sanity.json",
40
- "src",
41
- "v2-incompatible.js"
35
+ "dist"
42
36
  ],
43
- "scripts": {
44
- "build": "plugin-kit verify-package --silent && pkg-utils build --strict --check --clean",
45
- "compile": "tsc --noEmit",
46
- "format": "prettier --write --cache --ignore-unknown .",
47
- "link-watch": "plugin-kit link-watch",
48
- "lint": "eslint .",
49
- "prepare": "husky install",
50
- "prepublishOnly": "npm run build",
51
- "watch": "pkg-utils watch --strict"
52
- },
53
- "browserslist": "extends @sanity/browserslist-config",
54
- "prettier": "@sanity/prettier-config",
55
37
  "dependencies": {
56
- "@sanity/icons": "^3.5.3",
57
- "@sanity/incompatible-plugin": "^1.0.5",
58
- "@sanity/ui": "^3.0.5",
38
+ "@sanity/icons": "^3.7.4",
39
+ "@sanity/ui": "^3.1.11",
59
40
  "react-color": "^2.19.3",
41
+ "react-compiler-runtime": "^1.0.0",
42
+ "tinycolor2": "^1.6.0",
60
43
  "use-effect-event": "^2.0.3"
61
44
  },
62
45
  "devDependencies": {
63
- "@commitlint/cli": "^19.5.0",
64
- "@commitlint/config-conventional": "^19.5.0",
65
- "@sanity/pkg-utils": "^6.11.1",
66
- "@sanity/plugin-kit": "^4.0.18",
67
- "@sanity/prettier-config": "1.0.3",
68
- "@sanity/semantic-release-preset": "^5.0.0",
69
- "@types/react": "^18.3.5",
70
- "@types/react-color": "^2.17.11",
46
+ "@sanity/pkg-utils": "^9.1.1",
47
+ "@types/react": "^19.2.6",
48
+ "@types/react-color": "^2.17.12",
71
49
  "@types/tinycolor2": "^1.4.6",
72
- "@typescript-eslint/eslint-plugin": "^8.37.0",
73
- "@typescript-eslint/parser": "^8.37.0",
74
- "eslint": "^9.31.0",
75
- "eslint-config-prettier": "^10.1.5",
76
- "eslint-plugin-react": "^7.37.5",
77
- "eslint-plugin-react-hooks": "0.0.0-experimental-dffacc7b-20250717",
78
- "eslint-plugin-simple-import-sort": "^12.1.1",
79
- "husky": "^8.0.1",
80
- "lint-staged": "^13.0.3",
81
- "npm-run-all2": "^5.0.0",
82
- "prettier": "^3.3.3",
83
- "react": "^18.3.1",
84
- "react-dom": "^18.3.1",
85
- "sanity": "^3.67.1",
86
- "semantic-release": "^24.1.1",
87
- "styled-components": "^6.1",
88
- "typescript": "^5.6.2",
89
- "typescript-eslint": "^8.37.0"
50
+ "@typescript/native-preview": "7.0.0-dev.20251121.1",
51
+ "babel-plugin-react-compiler": "^1.0.0",
52
+ "eslint": "^9.39.1",
53
+ "react": "^19.2.0",
54
+ "sanity": "^4.17.0",
55
+ "styled-components": "^6.1.19",
56
+ "typescript": "5.9.3",
57
+ "@repo/eslint-config": "0.0.1",
58
+ "@repo/package.config": "0.0.0",
59
+ "@repo/tsconfig": "0.0.0"
90
60
  },
91
61
  "peerDependencies": {
92
62
  "react": "^18.3 || ^19",
93
- "sanity": "^3.23.0 || ^4.0.0-0",
63
+ "sanity": "^4",
94
64
  "styled-components": "^6.1"
95
65
  },
96
66
  "engines": {
97
- "node": ">=18"
67
+ "node": ">=20.19 <22 || >=22.12"
98
68
  },
99
69
  "publishConfig": {
100
70
  "access": "public"
101
71
  },
102
- "overrides": {
103
- "conventional-changelog-conventionalcommits": ">= 8.0.0"
104
- },
105
- "sanityExchangeUrl": "https://www.sanity.io/plugins/color-input",
106
- "sanityPlugin": {
107
- "verifyPackage": {
108
- "eslintImports": false
109
- }
72
+ "scripts": {
73
+ "build": "pkg build --strict --check --clean",
74
+ "lint": "eslint .",
75
+ "typecheck": "(cd ../../.. && tsgo --project plugins/@sanity/color-input/tsconfig.json)"
110
76
  }
111
- }
77
+ }