@web-portfolio/icons-sanity 3.0.1 → 3.0.3
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 +74 -40
- package/dist/index.js +12 -12
- package/package.json +26 -16
- package/LICENSE +0 -21
package/README.md
CHANGED
|
@@ -17,46 +17,20 @@ to see exactly what your editors will be choosing from.
|
|
|
17
17
|
|
|
18
18
|
[](https://icons.getresume.dev)
|
|
19
19
|
|
|
20
|
-
##
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
**97% smaller package**
|
|
36
|
-
- This plugin no longer bundles its own copy of the 633-icon SVG registry.
|
|
37
|
-
It now renders icon previews through `@web-portfolio/icons`'s `<Icon>`
|
|
38
|
-
component (added as a peer dependency, see below) and only carries the
|
|
39
|
-
lightweight search index — name, label, tags, category, no SVG markup —
|
|
40
|
-
that the picker's search and filtering actually need.
|
|
41
|
-
- Published size: **1.1 MB → 35.7 KB** (tarball), **1.36 MB → 60.5 KB**
|
|
42
|
-
(unpacked JS), **577 KB → 15 KB** (gzipped). Since any project using this
|
|
43
|
-
plugin already installs `@web-portfolio/icons` to render the picked icon
|
|
44
|
-
on its frontend, that icon data is no longer downloaded twice.
|
|
45
|
-
|
|
46
|
-
**Security & supply chain**
|
|
47
|
-
- Bumped `vitest` to 3.2.7 and `drizzle-orm` to 0.45.2 across the monorepo,
|
|
48
|
-
and pinned several transitive dependencies (`esbuild`, `sharp`, `postcss`,
|
|
49
|
-
`glob`, `js-yaml`, `uuid`, `prismjs`, `adm-zip`, `es-define-property`) to
|
|
50
|
-
patched versions via pnpm overrides.
|
|
51
|
-
- Install scripts now run only for an explicit allow-list (`esbuild`,
|
|
52
|
-
`sharp`) instead of the whole dependency tree by default.
|
|
53
|
-
- Current
|
|
54
|
-
[Socket.dev](https://socket.dev/npm/package/@web-portfolio/icons-sanity)
|
|
55
|
-
score: **100** Vulnerability, **100** Quality, **100** License, **88**
|
|
56
|
-
Maintenance, **80** Supply Chain Security. This plugin still ships zero
|
|
57
|
-
runtime dependencies of its own — the Supply Chain number reflects
|
|
58
|
-
Socket's scan of the full Sanity Studio peer tree (`sanity`, `@sanity/ui`,
|
|
59
|
-
...), not this plugin's code.
|
|
20
|
+
## Contents
|
|
21
|
+
|
|
22
|
+
- [Why this plugin](#why-this-plugin)
|
|
23
|
+
- [Installation](#installation)
|
|
24
|
+
- [Setup](#setup)
|
|
25
|
+
- [Usage](#usage)
|
|
26
|
+
- [What editors see](#what-editors-see)
|
|
27
|
+
- [Building your own input](#building-your-own-input)
|
|
28
|
+
- [Social/contact links example](#socialcontact-links-example)
|
|
29
|
+
- [Rendering the picked icon on your frontend](#rendering-the-picked-icon-on-your-frontend)
|
|
30
|
+
- [What's in the icon set](#whats-in-the-icon-set)
|
|
31
|
+
- [Limitations](#limitations)
|
|
32
|
+
- [Changelog](#changelog)
|
|
33
|
+
- [License](#license)
|
|
60
34
|
|
|
61
35
|
## Why this plugin
|
|
62
36
|
|
|
@@ -236,6 +210,66 @@ Not sure exactly what's in there? The
|
|
|
236
210
|
or filter by category to see every icon before you commit to using it in a
|
|
237
211
|
schema.
|
|
238
212
|
|
|
213
|
+
## Limitations
|
|
214
|
+
|
|
215
|
+
- **Closed set.** Editors pick from the 633 bundled icons; there's no
|
|
216
|
+
"upload your own SVG" escape hatch in the picker itself. If you need a
|
|
217
|
+
one-off brand mark that isn't in the set, it has to be added to the
|
|
218
|
+
upstream registry and shipped in a new version of this plugin (and
|
|
219
|
+
`@web-portfolio/icons`) before it shows up here.
|
|
220
|
+
- **Requires `@web-portfolio/icons` at render time.** The field only stores
|
|
221
|
+
a name — you need the sibling package on your frontend to turn that name
|
|
222
|
+
back into markup. It's a peer dependency for exactly this reason.
|
|
223
|
+
- **ESM-only as of v3.** There's no CommonJS entry point; if something in
|
|
224
|
+
your toolchain still calls `require()` on this package directly, it will
|
|
225
|
+
fail. Sanity Studio v3+ already loads plugins as ESM, so this only bites
|
|
226
|
+
unusual setups.
|
|
227
|
+
- **Renames need a re-pick.** If an icon's registry name changes upstream,
|
|
228
|
+
documents that stored the old name show an explicit "not found" state
|
|
229
|
+
rather than silently rendering nothing — but an editor still has to open
|
|
230
|
+
the field and choose the replacement; it isn't automatic.
|
|
231
|
+
|
|
232
|
+
## Changelog
|
|
233
|
+
|
|
234
|
+
**v3.0.0 — ESM-only, built with `@sanity/plugin-kit`**
|
|
235
|
+
- The build now uses [`@sanity/plugin-kit`](https://github.com/sanity-io/plugins/tree/main/packages/@sanity/plugin-kit)
|
|
236
|
+
and [`@sanity/pkg-utils`](https://github.com/sanity-io/pkg-utils) instead
|
|
237
|
+
of a hand-rolled `tsup` config — the same toolchain Sanity's own plugin
|
|
238
|
+
ecosystem uses.
|
|
239
|
+
- **Breaking:** the package is now ESM-only. The `require()`/CJS entry point
|
|
240
|
+
(`main`, `module` fields, and the `require` export condition) has been
|
|
241
|
+
removed — Sanity Studio v3+ is pure ESM, so this plugin was never actually
|
|
242
|
+
loaded via `require()` in practice. If you import this package with
|
|
243
|
+
`require()` directly (outside a Studio config), switch to `import`.
|
|
244
|
+
- No other behavior changed: same `sanityIconPicker()` export, same `iconRef`
|
|
245
|
+
schema type, same peer dependencies.
|
|
246
|
+
|
|
247
|
+
**97% smaller package**
|
|
248
|
+
- This plugin no longer bundles its own copy of the 633-icon SVG registry.
|
|
249
|
+
It now renders icon previews through `@web-portfolio/icons`'s `<Icon>`
|
|
250
|
+
component (added as a peer dependency, see below) and only carries the
|
|
251
|
+
lightweight search index — name, label, tags, category, no SVG markup —
|
|
252
|
+
that the picker's search and filtering actually need.
|
|
253
|
+
- Published size: **1.1 MB → 35.7 KB** (tarball), **1.36 MB → 60.5 KB**
|
|
254
|
+
(unpacked JS), **577 KB → 15 KB** (gzipped). Since any project using this
|
|
255
|
+
plugin already installs `@web-portfolio/icons` to render the picked icon
|
|
256
|
+
on its frontend, that icon data is no longer downloaded twice.
|
|
257
|
+
|
|
258
|
+
**Security & supply chain**
|
|
259
|
+
- Bumped `vitest` to 3.2.7 and `drizzle-orm` to 0.45.2 across the monorepo,
|
|
260
|
+
and pinned several transitive dependencies (`esbuild`, `sharp`, `postcss`,
|
|
261
|
+
`glob`, `js-yaml`, `uuid`, `prismjs`, `adm-zip`, `es-define-property`) to
|
|
262
|
+
patched versions via pnpm overrides.
|
|
263
|
+
- Install scripts now run only for an explicit allow-list (`esbuild`,
|
|
264
|
+
`sharp`) instead of the whole dependency tree by default.
|
|
265
|
+
- Current
|
|
266
|
+
[Socket.dev](https://socket.dev/npm/package/@web-portfolio/icons-sanity)
|
|
267
|
+
score: **100** Vulnerability, **100** Quality, **100** License, **88**
|
|
268
|
+
Maintenance, **80** Supply Chain Security. This plugin still ships zero
|
|
269
|
+
runtime dependencies of its own — the Supply Chain number reflects
|
|
270
|
+
Socket's scan of the full Sanity Studio peer tree (`sanity`, `@sanity/ui`,
|
|
271
|
+
...), not this plugin's code.
|
|
272
|
+
|
|
239
273
|
## License
|
|
240
274
|
|
|
241
275
|
MIT — see [LICENSE](https://github.com/jatinrao/icons/blob/main/LICENSE).
|
package/dist/index.js
CHANGED
|
@@ -5194,22 +5194,22 @@ const metadata = {
|
|
|
5194
5194
|
}
|
|
5195
5195
|
}, PreviewFrame = styled(Card).withConfig({
|
|
5196
5196
|
displayName: "PreviewFrame",
|
|
5197
|
-
componentId: "sc-
|
|
5197
|
+
componentId: "sc-0esdoi-0"
|
|
5198
5198
|
})`flex-shrink:0;width:${({ theme }) => rem(28 + theme.sanity.space[3] * 2)};height:${({ theme }) => rem(28 + theme.sanity.space[3] * 2)};`, ResultsScroller = styled(Box).withConfig({
|
|
5199
5199
|
displayName: "ResultsScroller",
|
|
5200
|
-
componentId: "sc-
|
|
5200
|
+
componentId: "sc-0esdoi-1"
|
|
5201
5201
|
})`max-height:${rem(400)};overflow-y:auto;overscroll-behavior:contain;`, IconTile = styled(Card).withConfig({
|
|
5202
5202
|
displayName: "IconTile",
|
|
5203
|
-
componentId: "sc-
|
|
5203
|
+
componentId: "sc-0esdoi-2"
|
|
5204
5204
|
})`&&[data-as='button']{cursor:pointer;border:1px solid var(--card-border-color);min-width:0;overflow:hidden;}`, GlyphRow = styled(Flex).withConfig({
|
|
5205
5205
|
displayName: "GlyphRow",
|
|
5206
|
-
componentId: "sc-
|
|
5207
|
-
})`height:${
|
|
5206
|
+
componentId: "sc-0esdoi-3"
|
|
5207
|
+
})`height:${rem(37)};`, LabelRow = styled(Box).withConfig({
|
|
5208
5208
|
displayName: "LabelRow",
|
|
5209
|
-
componentId: "sc-
|
|
5209
|
+
componentId: "sc-0esdoi-4"
|
|
5210
5210
|
})`min-height:${rem(20)};`, CategorySelectBox = styled(Box).withConfig({
|
|
5211
5211
|
displayName: "CategorySelectBox",
|
|
5212
|
-
componentId: "sc-
|
|
5212
|
+
componentId: "sc-0esdoi-5"
|
|
5213
5213
|
})`width:${rem(180)};`;
|
|
5214
5214
|
function matchesQuery(name, entry, query) {
|
|
5215
5215
|
if (!query.trim()) return !0;
|
|
@@ -5242,7 +5242,7 @@ function formatCategoryLabel(category) {
|
|
|
5242
5242
|
return CATEGORY_LABEL_OVERRIDES[category] ? CATEGORY_LABEL_OVERRIDES[category] : category.split(/[-_]/).filter(Boolean).map((word) => word[0].toUpperCase() + word.slice(1)).join(" ");
|
|
5243
5243
|
}
|
|
5244
5244
|
function IconPickerInput(props) {
|
|
5245
|
-
let { value, onChange, readOnly, elementProps } = props, [open, setOpen] = useState(!1), [query, setQuery] = useState(""), [category, setCategory] = useState(""), [visibleCount, setVisibleCount] = useState(
|
|
5245
|
+
let { value, onChange, readOnly, elementProps } = props, [open, setOpen] = useState(!1), [query, setQuery] = useState(""), [category, setCategory] = useState(""), [visibleCount, setVisibleCount] = useState(48), names = useMemo(() => Object.keys(metadata).sort(), []), categories = useMemo(() => {
|
|
5246
5246
|
let found = /* @__PURE__ */ new Set();
|
|
5247
5247
|
for (let name of names) {
|
|
5248
5248
|
let entry = metadata[name];
|
|
@@ -5261,7 +5261,7 @@ function IconPickerInput(props) {
|
|
|
5261
5261
|
category
|
|
5262
5262
|
]);
|
|
5263
5263
|
useEffect(() => {
|
|
5264
|
-
setVisibleCount(
|
|
5264
|
+
setVisibleCount(48);
|
|
5265
5265
|
}, [query, category]);
|
|
5266
5266
|
let visible = filtered.slice(0, visibleCount), remaining = filtered.length - visible.length, selectedEntry = value ? metadata[value] : void 0, hasUnknownValue = !!(value && !selectedEntry), closeDialog = useCallback(() => {
|
|
5267
5267
|
setOpen(!1), setQuery(""), setCategory("");
|
|
@@ -5476,7 +5476,7 @@ function IconPickerInput(props) {
|
|
|
5476
5476
|
justify: "center",
|
|
5477
5477
|
children: /* @__PURE__ */ jsx(Icon, {
|
|
5478
5478
|
name,
|
|
5479
|
-
size:
|
|
5479
|
+
size: 29
|
|
5480
5480
|
})
|
|
5481
5481
|
}), /* @__PURE__ */ jsx(LabelRow, { children: /* @__PURE__ */ jsx(Text, {
|
|
5482
5482
|
size: 0,
|
|
@@ -5492,8 +5492,8 @@ function IconPickerInput(props) {
|
|
|
5492
5492
|
}), remaining > 0 && /* @__PURE__ */ jsx(Button, {
|
|
5493
5493
|
mode: "ghost",
|
|
5494
5494
|
width: "fill",
|
|
5495
|
-
text: `Show ${Math.min(remaining,
|
|
5496
|
-
onClick: () => setVisibleCount((count) => count +
|
|
5495
|
+
text: `Show ${Math.min(remaining, 48)} more`,
|
|
5496
|
+
onClick: () => setVisibleCount((count) => count + 48)
|
|
5497
5497
|
})]
|
|
5498
5498
|
}) })]
|
|
5499
5499
|
})
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@web-portfolio/icons-sanity",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.3",
|
|
4
4
|
"description": "Sanity Studio icon picker input, backed by the same bundled registry as @web-portfolio/icons.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"keywords": [
|
|
@@ -9,7 +9,9 @@
|
|
|
9
9
|
"sanity-io",
|
|
10
10
|
"icon-picker",
|
|
11
11
|
"icons",
|
|
12
|
-
"cms"
|
|
12
|
+
"cms",
|
|
13
|
+
"custom input",
|
|
14
|
+
"sanity field"
|
|
13
15
|
],
|
|
14
16
|
"homepage": "https://github.com/jatinrao/icons#readme",
|
|
15
17
|
"bugs": {
|
|
@@ -18,7 +20,10 @@
|
|
|
18
20
|
"type": "module",
|
|
19
21
|
"types": "./dist/index.d.ts",
|
|
20
22
|
"exports": {
|
|
21
|
-
".":
|
|
23
|
+
".": {
|
|
24
|
+
"source": "./src/index.ts",
|
|
25
|
+
"default": "./dist/index.js"
|
|
26
|
+
},
|
|
22
27
|
"./package.json": "./package.json"
|
|
23
28
|
},
|
|
24
29
|
"files": [
|
|
@@ -37,6 +42,15 @@
|
|
|
37
42
|
"tsconfig": false
|
|
38
43
|
}
|
|
39
44
|
},
|
|
45
|
+
"scripts": {
|
|
46
|
+
"build": "plugin-kit verify-package --silent && pkg-utils build --strict --check --clean",
|
|
47
|
+
"watch": "pkg-utils watch --strict",
|
|
48
|
+
"prepublishOnly": "pnpm build && pnpm verify-package",
|
|
49
|
+
"test": "vitest run",
|
|
50
|
+
"typecheck": "tsc --noEmit",
|
|
51
|
+
"verify-package": "node scripts/verify-package.mjs",
|
|
52
|
+
"link-watch": "plugin-kit link-watch"
|
|
53
|
+
},
|
|
40
54
|
"peerDependencies": {
|
|
41
55
|
"@sanity/icons": ">=3",
|
|
42
56
|
"@sanity/ui": ">=2",
|
|
@@ -55,30 +69,26 @@
|
|
|
55
69
|
"@testing-library/react": "^16.1.0",
|
|
56
70
|
"@types/react": "^18.3.0",
|
|
57
71
|
"@types/react-dom": "^18.3.0",
|
|
72
|
+
"@web-portfolio/icons": "workspace:*",
|
|
73
|
+
"@web-portfolio/icons-core": "workspace:*",
|
|
58
74
|
"jsdom": "^25.0.1",
|
|
59
75
|
"react": "^18.3.1",
|
|
60
76
|
"react-dom": "^18.3.1",
|
|
61
77
|
"sanity": "^3.68.0",
|
|
62
78
|
"styled-components": "^6.1.13",
|
|
63
79
|
"typescript": "^5.7.0",
|
|
64
|
-
"vitest": "^3.2.7"
|
|
65
|
-
"@web-portfolio/icons": "1.0.3",
|
|
66
|
-
"@web-portfolio/icons-core": "0.0.0"
|
|
80
|
+
"vitest": "^3.2.7"
|
|
67
81
|
},
|
|
68
82
|
"publishConfig": {
|
|
69
|
-
"access": "public"
|
|
83
|
+
"access": "public",
|
|
84
|
+
"exports": {
|
|
85
|
+
".": "./dist/index.js",
|
|
86
|
+
"./package.json": "./package.json"
|
|
87
|
+
}
|
|
70
88
|
},
|
|
71
89
|
"repository": {
|
|
72
90
|
"type": "git",
|
|
73
91
|
"url": "git+https://github.com/jatinrao/icons.git",
|
|
74
92
|
"directory": "packages/sanity-plugin"
|
|
75
|
-
},
|
|
76
|
-
"scripts": {
|
|
77
|
-
"build": "plugin-kit verify-package --silent && pkg-utils build --strict --check --clean",
|
|
78
|
-
"watch": "pkg-utils watch --strict",
|
|
79
|
-
"test": "vitest run",
|
|
80
|
-
"typecheck": "tsc --noEmit",
|
|
81
|
-
"verify-package": "node scripts/verify-package.mjs",
|
|
82
|
-
"link-watch": "plugin-kit link-watch"
|
|
83
93
|
}
|
|
84
|
-
}
|
|
94
|
+
}
|
package/LICENSE
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2026 Jatin Rao
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|