sanity-plugin-visual-editor 1.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/LICENSE +21 -0
- package/README.md +35 -0
- package/dist/index.d.mts +21 -0
- package/dist/index.d.ts +21 -0
- package/dist/index.js +8 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +8 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +72 -0
- package/sanity.json +8 -0
- package/src/index.ts +27 -0
- package/v2-incompatible.js +11 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Dennis Regalado
|
|
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.
|
package/README.md
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# sanity-plugin-visual-editor
|
|
2
|
+
|
|
3
|
+
> This is a **Sanity Studio v3** plugin.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```sh
|
|
8
|
+
npm install sanity-plugin-visual-editor
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
Add it as a plugin in `sanity.config.ts` (or .js):
|
|
14
|
+
|
|
15
|
+
```ts
|
|
16
|
+
import {defineConfig} from 'sanity'
|
|
17
|
+
import {myPlugin} from 'sanity-plugin-visual-editor'
|
|
18
|
+
|
|
19
|
+
export default defineConfig({
|
|
20
|
+
//...
|
|
21
|
+
plugins: [myPlugin({})],
|
|
22
|
+
})
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## License
|
|
26
|
+
|
|
27
|
+
[MIT](LICENSE) © Dennis Regalado
|
|
28
|
+
|
|
29
|
+
## Develop & test
|
|
30
|
+
|
|
31
|
+
This plugin uses [@sanity/plugin-kit](https://github.com/sanity-io/plugin-kit)
|
|
32
|
+
with default configuration for build & watch scripts.
|
|
33
|
+
|
|
34
|
+
See [Testing a plugin in Sanity Studio](https://github.com/sanity-io/plugin-kit#testing-a-plugin-in-sanity-studio)
|
|
35
|
+
on how to run this plugin with hotreload in the studio.
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import {Plugin as Plugin_2} from 'sanity'
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Usage in `sanity.config.ts` (or .js)
|
|
5
|
+
*
|
|
6
|
+
* ```ts
|
|
7
|
+
* import {defineConfig} from 'sanity'
|
|
8
|
+
* import {myPlugin} from 'sanity-plugin-visual-editor'
|
|
9
|
+
*
|
|
10
|
+
* export default defineConfig({
|
|
11
|
+
* // ...
|
|
12
|
+
* plugins: [myPlugin()],
|
|
13
|
+
* })
|
|
14
|
+
* ```
|
|
15
|
+
* @public
|
|
16
|
+
*/
|
|
17
|
+
export declare const myPlugin: Plugin_2<void | MyPluginConfig>
|
|
18
|
+
|
|
19
|
+
declare interface MyPluginConfig {}
|
|
20
|
+
|
|
21
|
+
export {}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import {Plugin as Plugin_2} from 'sanity'
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Usage in `sanity.config.ts` (or .js)
|
|
5
|
+
*
|
|
6
|
+
* ```ts
|
|
7
|
+
* import {defineConfig} from 'sanity'
|
|
8
|
+
* import {myPlugin} from 'sanity-plugin-visual-editor'
|
|
9
|
+
*
|
|
10
|
+
* export default defineConfig({
|
|
11
|
+
* // ...
|
|
12
|
+
* plugins: [myPlugin()],
|
|
13
|
+
* })
|
|
14
|
+
* ```
|
|
15
|
+
* @public
|
|
16
|
+
*/
|
|
17
|
+
export declare const myPlugin: Plugin_2<void | MyPluginConfig>
|
|
18
|
+
|
|
19
|
+
declare interface MyPluginConfig {}
|
|
20
|
+
|
|
21
|
+
export {}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: !0 });
|
|
3
|
+
var sanity = require("sanity");
|
|
4
|
+
const myPlugin = sanity.definePlugin((config = {}) => (console.log("hello from sanity-plugin-visual-editor"), {
|
|
5
|
+
name: "sanity-plugin-visual-editor"
|
|
6
|
+
}));
|
|
7
|
+
exports.myPlugin = myPlugin;
|
|
8
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../src/index.ts"],"sourcesContent":["import {definePlugin} from 'sanity'\n\ninterface MyPluginConfig {\n /* nothing here yet */\n}\n\n/**\n * Usage in `sanity.config.ts` (or .js)\n *\n * ```ts\n * import {defineConfig} from 'sanity'\n * import {myPlugin} from 'sanity-plugin-visual-editor'\n *\n * export default defineConfig({\n * // ...\n * plugins: [myPlugin()],\n * })\n * ```\n * @public\n */\nexport const myPlugin = definePlugin<MyPluginConfig | void>((config = {}) => {\n // eslint-disable-next-line no-console\n console.log('hello from sanity-plugin-visual-editor')\n return {\n name: 'sanity-plugin-visual-editor',\n }\n})\n"],"names":["definePlugin"],"mappings":";;;AAoBO,MAAM,WAAWA,OAAAA,aAAoC,CAAC,SAAS,CAAA,OAEpE,QAAQ,IAAI,wCAAwC,GAC7C;AAAA,EACL,MAAM;AACR,EACD;;"}
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../src/index.ts"],"sourcesContent":["import {definePlugin} from 'sanity'\n\ninterface MyPluginConfig {\n /* nothing here yet */\n}\n\n/**\n * Usage in `sanity.config.ts` (or .js)\n *\n * ```ts\n * import {defineConfig} from 'sanity'\n * import {myPlugin} from 'sanity-plugin-visual-editor'\n *\n * export default defineConfig({\n * // ...\n * plugins: [myPlugin()],\n * })\n * ```\n * @public\n */\nexport const myPlugin = definePlugin<MyPluginConfig | void>((config = {}) => {\n // eslint-disable-next-line no-console\n console.log('hello from sanity-plugin-visual-editor')\n return {\n name: 'sanity-plugin-visual-editor',\n }\n})\n"],"names":[],"mappings":";AAoBO,MAAM,WAAW,aAAoC,CAAC,SAAS,CAAA,OAEpE,QAAQ,IAAI,wCAAwC,GAC7C;AAAA,EACL,MAAM;AACR,EACD;"}
|
package/package.json
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "sanity-plugin-visual-editor",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"sanity",
|
|
7
|
+
"sanity-plugin"
|
|
8
|
+
],
|
|
9
|
+
"license": "MIT",
|
|
10
|
+
"author": "Dennis Regalado <dennis@baggy.studio>",
|
|
11
|
+
"sideEffects": false,
|
|
12
|
+
"type": "commonjs",
|
|
13
|
+
"exports": {
|
|
14
|
+
".": {
|
|
15
|
+
"source": "./src/index.ts",
|
|
16
|
+
"import": "./dist/index.mjs",
|
|
17
|
+
"default": "./dist/index.js"
|
|
18
|
+
},
|
|
19
|
+
"./package.json": "./package.json"
|
|
20
|
+
},
|
|
21
|
+
"main": "./dist/index.js",
|
|
22
|
+
"types": "./dist/index.d.ts",
|
|
23
|
+
"files": [
|
|
24
|
+
"dist",
|
|
25
|
+
"sanity.json",
|
|
26
|
+
"src",
|
|
27
|
+
"v2-incompatible.js"
|
|
28
|
+
],
|
|
29
|
+
"scripts": {
|
|
30
|
+
"build": "plugin-kit verify-package --silent && pkg-utils build --strict --check --clean",
|
|
31
|
+
"format": "prettier --write --cache --ignore-unknown .",
|
|
32
|
+
"link-watch": "plugin-kit link-watch",
|
|
33
|
+
"lint": "eslint .",
|
|
34
|
+
"prepublishOnly": "npm run build",
|
|
35
|
+
"watch": "pkg-utils watch --strict"
|
|
36
|
+
},
|
|
37
|
+
"dependencies": {
|
|
38
|
+
"@sanity/incompatible-plugin": "^1.0.5"
|
|
39
|
+
},
|
|
40
|
+
"devDependencies": {
|
|
41
|
+
"@sanity/pkg-utils": "^8.1.17",
|
|
42
|
+
"@sanity/plugin-kit": "^4.0.19",
|
|
43
|
+
"@types/react": "^19.2.0",
|
|
44
|
+
"@typescript-eslint/eslint-plugin": "^8.45.0",
|
|
45
|
+
"@typescript-eslint/parser": "^8.45.0",
|
|
46
|
+
"eslint": "^8.57.1",
|
|
47
|
+
"eslint-config-prettier": "^10.1.8",
|
|
48
|
+
"eslint-config-sanity": "^7.1.4",
|
|
49
|
+
"eslint-plugin-prettier": "^5.5.4",
|
|
50
|
+
"eslint-plugin-react": "^7.37.5",
|
|
51
|
+
"eslint-plugin-react-hooks": "^6.1.0",
|
|
52
|
+
"prettier": "^3.6.2",
|
|
53
|
+
"prettier-plugin-packagejson": "^2.5.19",
|
|
54
|
+
"react": "^19.2.0",
|
|
55
|
+
"react-dom": "^19.2.0",
|
|
56
|
+
"sanity": "^4.10.2",
|
|
57
|
+
"styled-components": "^6.1.19",
|
|
58
|
+
"typescript": "^5.9.3"
|
|
59
|
+
},
|
|
60
|
+
"peerDependencies": {
|
|
61
|
+
"react": "^18",
|
|
62
|
+
"sanity": "^3"
|
|
63
|
+
},
|
|
64
|
+
"engines": {
|
|
65
|
+
"node": ">=18"
|
|
66
|
+
},
|
|
67
|
+
"sanityPlugin": {
|
|
68
|
+
"verifyPackage": {
|
|
69
|
+
"eslintImports": false
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
package/sanity.json
ADDED
package/src/index.ts
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import {definePlugin} from 'sanity'
|
|
2
|
+
|
|
3
|
+
interface MyPluginConfig {
|
|
4
|
+
/* nothing here yet */
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Usage in `sanity.config.ts` (or .js)
|
|
9
|
+
*
|
|
10
|
+
* ```ts
|
|
11
|
+
* import {defineConfig} from 'sanity'
|
|
12
|
+
* import {myPlugin} from 'sanity-plugin-visual-editor'
|
|
13
|
+
*
|
|
14
|
+
* export default defineConfig({
|
|
15
|
+
* // ...
|
|
16
|
+
* plugins: [myPlugin()],
|
|
17
|
+
* })
|
|
18
|
+
* ```
|
|
19
|
+
* @public
|
|
20
|
+
*/
|
|
21
|
+
export const myPlugin = definePlugin<MyPluginConfig | void>((config = {}) => {
|
|
22
|
+
// eslint-disable-next-line no-console
|
|
23
|
+
console.log('hello from sanity-plugin-visual-editor')
|
|
24
|
+
return {
|
|
25
|
+
name: 'sanity-plugin-visual-editor',
|
|
26
|
+
}
|
|
27
|
+
})
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
const {showIncompatiblePluginDialog} = require('@sanity/incompatible-plugin')
|
|
2
|
+
const {name, version, sanityExchangeUrl} = require('./package.json')
|
|
3
|
+
|
|
4
|
+
export default showIncompatiblePluginDialog({
|
|
5
|
+
name: name,
|
|
6
|
+
versions: {
|
|
7
|
+
v3: version,
|
|
8
|
+
v2: undefined,
|
|
9
|
+
},
|
|
10
|
+
sanityExchangeUrl,
|
|
11
|
+
})
|