@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.
- package/README.md +3 -20
- package/dist/_chunks-es/ColorInput.js +340 -0
- package/dist/_chunks-es/ColorInput.js.map +1 -0
- package/dist/index.d.ts +64 -0
- package/dist/index.js +138 -0
- package/dist/index.js.map +1 -0
- package/package.json +33 -67
- package/lib/_chunks-cjs/ColorInput.js +0 -1041
- package/lib/_chunks-cjs/ColorInput.js.map +0 -1
- package/lib/_chunks-es/ColorInput.mjs +0 -1051
- package/lib/_chunks-es/ColorInput.mjs.map +0 -1
- package/lib/_legacy/ColorInput.esm.js +0 -1051
- package/lib/_legacy/ColorInput.esm.js.map +0 -1
- package/lib/index.d.mts +0 -93
- package/lib/index.d.ts +0 -93
- package/lib/index.esm.js +0 -114
- package/lib/index.esm.js.map +0 -1
- package/lib/index.js +0 -114
- package/lib/index.js.map +0 -1
- package/lib/index.mjs +0 -114
- package/lib/index.mjs.map +0 -1
- package/sanity.json +0 -8
- package/src/ColorInput.tsx +0 -97
- package/src/ColorList.tsx +0 -70
- package/src/ColorPicker.tsx +0 -152
- package/src/ColorPickerFields.tsx +0 -144
- package/src/LazyColorInput.tsx +0 -3
- package/src/index.ts +0 -18
- package/src/schemas/color.tsx +0 -98
- package/src/schemas/hslaColor.ts +0 -13
- package/src/schemas/hsvaColor.ts +0 -13
- package/src/schemas/rgbaColor.ts +0 -13
- package/src/types.ts +0 -19
- package/v2-incompatible.js +0 -11
|
@@ -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,OA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AA,EAAA;AAElD,CAAC;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sanity/color-input",
|
|
3
|
-
"version": "
|
|
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/
|
|
16
|
+
"url": "https://github.com/sanity-io/plugins/issues"
|
|
17
17
|
},
|
|
18
18
|
"repository": {
|
|
19
19
|
"type": "git",
|
|
20
|
-
"url": "git@github.com
|
|
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
|
-
"
|
|
25
|
+
"type": "module",
|
|
25
26
|
"exports": {
|
|
26
27
|
".": {
|
|
27
28
|
"source": "./src/index.ts",
|
|
28
|
-
"
|
|
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
|
-
"
|
|
35
|
-
"module": "./lib/index.esm.js",
|
|
36
|
-
"types": "./lib/index.d.ts",
|
|
33
|
+
"types": "./dist/index.d.ts",
|
|
37
34
|
"files": [
|
|
38
|
-
"
|
|
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.
|
|
57
|
-
"@sanity/
|
|
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
|
-
"@
|
|
64
|
-
"@
|
|
65
|
-
"@
|
|
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
|
|
73
|
-
"
|
|
74
|
-
"eslint": "^9.
|
|
75
|
-
"
|
|
76
|
-
"
|
|
77
|
-
"
|
|
78
|
-
"
|
|
79
|
-
"
|
|
80
|
-
"
|
|
81
|
-
"
|
|
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": "^
|
|
63
|
+
"sanity": "^4",
|
|
94
64
|
"styled-components": "^6.1"
|
|
95
65
|
},
|
|
96
66
|
"engines": {
|
|
97
|
-
"node": ">=
|
|
67
|
+
"node": ">=20.19 <22 || >=22.12"
|
|
98
68
|
},
|
|
99
69
|
"publishConfig": {
|
|
100
70
|
"access": "public"
|
|
101
71
|
},
|
|
102
|
-
"
|
|
103
|
-
"
|
|
104
|
-
|
|
105
|
-
|
|
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
|
+
}
|