diff --git a/.github/renovate.json b/.github/renovate.json index 94b4eddc8..04a1efdc9 100644 --- a/.github/renovate.json +++ b/.github/renovate.json @@ -53,11 +53,11 @@ ] }, { - "matchDepNames": ["sanity", "@sanity/util"], + "matchDepNames": ["sanity", "@sanity/util", "@sanity/types"], "matchFileNames": [ "packages/presentation/package.json", + "packages/presentation-comlink/package.json", "packages/preview-url-secret/package.json", - "packages/visual-editing-helpers/package.json", "packages/vercel-protection-bypass/package.json" ], "matchDepTypes": ["devDependencies", "peerDependencies"], diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 155618468..a44590dff 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1 +1 @@ -{"packages/core-loader":"1.7.26","packages/react-loader":"1.10.35","packages/svelte-loader":"1.13.2","packages/presentation":"1.22.0","packages/preview-url-secret":"2.1.0","packages/preview-kit-compat":"1.5.32","packages/visual-editing-helpers":"0.7.14","packages/visual-editing":"2.12.2","packages/insert-menu":"1.0.19","packages/comlink":"3.0.0","packages/next-loader":"1.2.14","packages/vercel-protection-bypass":"1.0.1"} +{"packages/core-loader":"1.7.26","packages/react-loader":"1.10.35","packages/svelte-loader":"1.13.2","packages/presentation":"1.22.0","packages/preview-url-secret":"2.1.0","packages/preview-kit-compat":"1.5.32","packages/visual-editing":"2.12.2","packages/insert-menu":"1.0.19","packages/comlink":"3.0.0","packages/next-loader":"1.2.14","packages/vercel-protection-bypass":"1.0.1"} diff --git a/apps/nuxt/server/tsconfig.json b/apps/nuxt/server/tsconfig.json deleted file mode 100644 index b9ed69c19..000000000 --- a/apps/nuxt/server/tsconfig.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "../.nuxt/tsconfig.server.json" -} diff --git a/package.json b/package.json index b683a522e..4e6884aac 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "visual-editing-monorepo", "private": true, "scripts": { - "build": "turbo run build --filter='!./apps/*'", + "build": "turbo run build --filter='!./apps/*' --filter='!./packages/comlink/playground'", "build:astro": "turbo run build --filter=./apps/astro", "dev": "turbo run build --filter='!./apps/*' && turbo watch dev --filter='./packages/*' --filter='./packages/@repo/*' --filter=./apps/* --filter=!next-with-i18n", "dev:astro": "turbo run build --filter=apps-astro^... --filter=apps-studio^... && turbo watch dev --filter=apps-astro... --filter=apps-studio...", @@ -67,6 +67,7 @@ "@sanity/core-loader": "workspace:*", "@sanity/next-loader": "workspace:*", "@sanity/presentation": "workspace:*", + "@sanity/presentation-comlink": "workspace:*", "@sanity/preview-kit-compat": "workspace:*", "@sanity/preview-url-secret": "workspace:*", "@sanity/react-loader": "workspace:*", @@ -75,6 +76,7 @@ "@sanity/util": "$@sanity/util", "@sanity/vision": "$@sanity/vision", "@sanity/visual-editing": "workspace:*", + "@sanity/visual-editing-csm": "workspace:*", "@types/react": "$@types/react", "@types/react-dom": "$@types/react-dom", "groq": "$groq", diff --git a/packages/@repo/package.config/src/package.config.ts b/packages/@repo/package.config/src/package.config.ts index 51d0dbcd1..842ac89b2 100644 --- a/packages/@repo/package.config/src/package.config.ts +++ b/packages/@repo/package.config/src/package.config.ts @@ -5,12 +5,11 @@ export default defineConfig({ optimizeLodash: true, }, extract: { - bundledPackages: ['@repo/visual-editing-helpers'], rules: { 'ae-forgotten-export': 'error', 'ae-incompatible-release-tags': 'warn', 'ae-internal-missing-underscore': 'off', - 'ae-missing-release-tag': 'warn', + 'ae-missing-release-tag': 'off', }, }, tsconfig: 'tsconfig.build.json', diff --git a/packages/@repo/sanity-schema/src/page-builder-demo/index.tsx b/packages/@repo/sanity-schema/src/page-builder-demo/index.tsx index bc0f80d99..833127be8 100644 --- a/packages/@repo/sanity-schema/src/page-builder-demo/index.tsx +++ b/packages/@repo/sanity-schema/src/page-builder-demo/index.tsx @@ -7,6 +7,7 @@ import { type PresentationPluginOptions, } from '@sanity/presentation' import {defineArrayMember, defineField, definePlugin, defineType} from 'sanity' +import {structureTool} from 'sanity/structure' import {PageSectionInput} from './PageSectionInput' const {dataset, workspace, tool} = workspaces['cross-dataset-references'] @@ -678,5 +679,6 @@ export const pageBuilderDemoPlugin = definePlugin< }, ...config, }), + structureTool(), ], })) diff --git a/packages/comlink/package.json b/packages/comlink/package.json index 26f15c048..abd1cdf24 100644 --- a/packages/comlink/package.json +++ b/packages/comlink/package.json @@ -57,6 +57,7 @@ "devDependencies": { "@repo/eslint-config": "workspace:*", "@repo/package.config": "workspace:*", + "@sanity/pkg-utils": "6.13.4", "eslint": "^8.57.1", "typescript": "5.7.3", "vitest": "^2.1.8" diff --git a/packages/core-loader/CHANGELOG.md b/packages/core-loader/CHANGELOG.md index da6d073d8..0bd6786d1 100644 --- a/packages/core-loader/CHANGELOG.md +++ b/packages/core-loader/CHANGELOG.md @@ -6,27 +6,9 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. -### Dependencies - -* The following workspace dependencies were updated - * devDependencies - * @sanity/visual-editing-helpers bumped from 0.4.0 to 0.5.0 - -### Dependencies - -* The following workspace dependencies were updated - * devDependencies - * @sanity/visual-editing-helpers bumped from 0.6.0 to 0.6.1 - ## [1.7.26](https://github.com/sanity-io/visual-editing/compare/core-loader-v1.7.25...core-loader-v1.7.26) (2025-01-14) -### Dependencies - -* The following workspace dependencies were updated - * devDependencies - * @repo/visual-editing-helpers bumped to 0.7.14 - ## [1.7.25](https://github.com/sanity-io/visual-editing/compare/core-loader-v1.7.24...core-loader-v1.7.25) (2025-01-09) @@ -35,8 +17,6 @@ All notable changes to this project will be documented in this file. See * The following workspace dependencies were updated * dependencies * @sanity/comlink bumped to 3.0.0 - * devDependencies - * @repo/visual-editing-helpers bumped to 0.7.13 ## [1.7.24](https://github.com/sanity-io/visual-editing/compare/core-loader-v1.7.23...core-loader-v1.7.24) (2025-01-09) @@ -46,8 +26,6 @@ All notable changes to this project will be documented in this file. See * The following workspace dependencies were updated * dependencies * @sanity/comlink bumped to 2.0.5 - * devDependencies - * @repo/visual-editing-helpers bumped to 0.7.12 ## [1.7.23](https://github.com/sanity-io/visual-editing/compare/core-loader-v1.7.22...core-loader-v1.7.23) (2025-01-06) @@ -57,8 +35,6 @@ All notable changes to this project will be documented in this file. See * The following workspace dependencies were updated * dependencies * @sanity/comlink bumped to 2.0.4 - * devDependencies - * @repo/visual-editing-helpers bumped to 0.7.11 ## [1.7.22](https://github.com/sanity-io/visual-editing/compare/core-loader-v1.7.21...core-loader-v1.7.22) (2024-12-21) @@ -73,18 +49,10 @@ All notable changes to this project will be documented in this file. See * The following workspace dependencies were updated * dependencies * @sanity/comlink bumped to 2.0.3 - * devDependencies - * @repo/visual-editing-helpers bumped to 0.7.10 ## [1.7.21](https://github.com/sanity-io/visual-editing/compare/core-loader-v1.7.20...core-loader-v1.7.21) (2024-12-16) -### Dependencies - -* The following workspace dependencies were updated - * devDependencies - * @repo/visual-editing-helpers bumped to 0.7.9 - ## [1.7.20](https://github.com/sanity-io/visual-editing/compare/core-loader-v1.7.19...core-loader-v1.7.20) (2024-12-16) @@ -93,8 +61,6 @@ All notable changes to this project will be documented in this file. See * The following workspace dependencies were updated * dependencies * @sanity/comlink bumped to 2.0.2 - * devDependencies - * @repo/visual-editing-helpers bumped to 0.7.8 ## [1.7.19](https://github.com/sanity-io/visual-editing/compare/core-loader-v1.7.18...core-loader-v1.7.19) (2024-12-05) @@ -104,8 +70,6 @@ All notable changes to this project will be documented in this file. See * The following workspace dependencies were updated * dependencies * @sanity/comlink bumped to 2.0.1 - * devDependencies - * @repo/visual-editing-helpers bumped to 0.7.7 ## [1.7.18](https://github.com/sanity-io/visual-editing/compare/core-loader-v1.7.17...core-loader-v1.7.18) (2024-12-03) @@ -136,12 +100,6 @@ All notable changes to this project will be documented in this file. See * **deps:** update dependency @sanity/client to ^6.23.0 ([#2244](https://github.com/sanity-io/visual-editing/issues/2244)) ([eeacde8](https://github.com/sanity-io/visual-editing/commit/eeacde893e6534b14344581456e3e2147b84f75b)) -### Dependencies - -* The following workspace dependencies were updated - * devDependencies - * @repo/visual-editing-helpers bumped to 0.7.6 - ## [1.7.14](https://github.com/sanity-io/visual-editing/compare/core-loader-v1.7.13...core-loader-v1.7.14) (2024-11-28) @@ -150,8 +108,6 @@ All notable changes to this project will be documented in this file. See * The following workspace dependencies were updated * dependencies * @sanity/comlink bumped to 2.0.0 - * devDependencies - * @repo/visual-editing-helpers bumped to 0.7.5 ## [1.7.13](https://github.com/sanity-io/visual-editing/compare/core-loader-v1.7.12...core-loader-v1.7.13) (2024-11-26) @@ -161,8 +117,6 @@ All notable changes to this project will be documented in this file. See * The following workspace dependencies were updated * dependencies * @sanity/comlink bumped to 1.1.4 - * devDependencies - * @repo/visual-editing-helpers bumped to 0.7.4 ## [1.7.12](https://github.com/sanity-io/visual-editing/compare/core-loader-v1.7.11...core-loader-v1.7.12) (2024-11-19) @@ -172,12 +126,6 @@ All notable changes to this project will be documented in this file. See * **deps:** update dependency @sanity/client to ^6.22.5 ([#2185](https://github.com/sanity-io/visual-editing/issues/2185)) ([da0aa32](https://github.com/sanity-io/visual-editing/commit/da0aa328063f1711687f8459ca00fd95a0b69ccb)) -### Dependencies - -* The following workspace dependencies were updated - * devDependencies - * @repo/visual-editing-helpers bumped to 0.7.3 - ## [1.7.11](https://github.com/sanity-io/visual-editing/compare/core-loader-v1.7.10...core-loader-v1.7.11) (2024-11-14) @@ -186,8 +134,6 @@ All notable changes to this project will be documented in this file. See * The following workspace dependencies were updated * dependencies * @sanity/comlink bumped to 1.1.3 - * devDependencies - * @repo/visual-editing-helpers bumped to 0.7.2 ## [1.7.10](https://github.com/sanity-io/visual-editing/compare/core-loader-v1.7.9...core-loader-v1.7.10) (2024-11-12) @@ -197,8 +143,6 @@ All notable changes to this project will be documented in this file. See * The following workspace dependencies were updated * dependencies * @sanity/comlink bumped to 1.1.2 - * devDependencies - * @repo/visual-editing-helpers bumped to 0.7.1 ## [1.7.9](https://github.com/sanity-io/visual-editing/compare/core-loader-v1.7.8...core-loader-v1.7.9) (2024-11-12) @@ -208,12 +152,6 @@ All notable changes to this project will be documented in this file. See * **deps:** update dependency @sanity/client to ^6.22.4 ([#2132](https://github.com/sanity-io/visual-editing/issues/2132)) ([4f96d9a](https://github.com/sanity-io/visual-editing/commit/4f96d9a539094173caf1644a67f168492f3a35c4)) -### Dependencies - -* The following workspace dependencies were updated - * devDependencies - * @repo/visual-editing-helpers bumped to 0.7.0 - ## [1.7.8](https://github.com/sanity-io/visual-editing/compare/core-loader-v1.7.7...core-loader-v1.7.8) (2024-11-06) @@ -222,30 +160,12 @@ All notable changes to this project will be documented in this file. See * **deps:** update dependency @sanity/client to ^6.22.3 ([0b78719](https://github.com/sanity-io/visual-editing/commit/0b7871937422d0d8dfe7851bd1603141f0c434c4)) -### Dependencies - -* The following workspace dependencies were updated - * devDependencies - * @repo/visual-editing-helpers bumped to 0.6.30 - ## [1.7.7](https://github.com/sanity-io/visual-editing/compare/core-loader-v1.7.6...core-loader-v1.7.7) (2024-11-04) -### Dependencies - -* The following workspace dependencies were updated - * devDependencies - * @repo/visual-editing-helpers bumped to 0.6.29 - ## [1.7.6](https://github.com/sanity-io/visual-editing/compare/core-loader-v1.7.5...core-loader-v1.7.6) (2024-10-28) -### Dependencies - -* The following workspace dependencies were updated - * devDependencies - * @repo/visual-editing-helpers bumped to 0.6.28 - ## [1.7.5](https://github.com/sanity-io/visual-editing/compare/core-loader-v1.7.4...core-loader-v1.7.5) (2024-10-24) @@ -254,8 +174,6 @@ All notable changes to this project will be documented in this file. See * The following workspace dependencies were updated * dependencies * @sanity/comlink bumped to 1.1.1 - * devDependencies - * @repo/visual-editing-helpers bumped to 0.6.27 ## [1.7.4](https://github.com/sanity-io/visual-editing/compare/core-loader-v1.7.3...core-loader-v1.7.4) (2024-10-24) @@ -265,18 +183,10 @@ All notable changes to this project will be documented in this file. See * The following workspace dependencies were updated * dependencies * @sanity/comlink bumped to 1.1.0 - * devDependencies - * @repo/visual-editing-helpers bumped to 0.6.26 ## [1.7.3](https://github.com/sanity-io/visual-editing/compare/core-loader-v1.7.2...core-loader-v1.7.3) (2024-10-23) -### Dependencies - -* The following workspace dependencies were updated - * devDependencies - * @repo/visual-editing-helpers bumped to 0.6.25 - ## [1.7.2](https://github.com/sanity-io/visual-editing/compare/core-loader-v1.7.1...core-loader-v1.7.2) (2024-10-21) @@ -285,12 +195,6 @@ All notable changes to this project will be documented in this file. See * stop inlining rxjs and `@sanity/comlink` ([#2012](https://github.com/sanity-io/visual-editing/issues/2012)) ([8df6708](https://github.com/sanity-io/visual-editing/commit/8df670861f40a762684f936fb968e3fbde4f63ba)) -### Dependencies - -* The following workspace dependencies were updated - * devDependencies - * @repo/visual-editing-helpers bumped to 0.6.24 - ## [1.7.1](https://github.com/sanity-io/visual-editing/compare/core-loader-v1.7.0...core-loader-v1.7.1) (2024-10-21) @@ -299,12 +203,6 @@ All notable changes to this project will be documented in this file. See * **comlink:** handle heartbeat compatibility correctly ([#2006](https://github.com/sanity-io/visual-editing/issues/2006)) ([65af1e1](https://github.com/sanity-io/visual-editing/commit/65af1e17aa329d5f5282152d4b77bca8750a539f)) -### Dependencies - -* The following workspace dependencies were updated - * devDependencies - * @repo/visual-editing-helpers bumped to 0.6.23 - ## [1.7.0](https://github.com/sanity-io/visual-editing/compare/core-loader-v1.6.23...core-loader-v1.7.0) (2024-10-21) @@ -322,8 +220,6 @@ All notable changes to this project will be documented in this file. See ### Dependencies * The following workspace dependencies were updated - * devDependencies - * @repo/visual-editing-helpers bumped to 0.6.22 * @sanity/comlink bumped to 1.0.0 ## [1.6.23](https://github.com/sanity-io/visual-editing/compare/core-loader-v1.6.22...core-loader-v1.6.23) (2024-09-11) @@ -334,12 +230,6 @@ All notable changes to this project will be documented in this file. See * **deps:** update dependency @sanity/client to ^6.21.3 ([#1793](https://github.com/sanity-io/visual-editing/issues/1793)) ([1dc1b1b](https://github.com/sanity-io/visual-editing/commit/1dc1b1b9222e6a2f36d6b807415dc1a9b0a2426a)) -### Dependencies - -* The following workspace dependencies were updated - * devDependencies - * @repo/visual-editing-helpers bumped to 0.6.21 - ## [1.6.22](https://github.com/sanity-io/visual-editing/compare/core-loader-v1.6.21...core-loader-v1.6.22) (2024-08-12) @@ -348,12 +238,6 @@ All notable changes to this project will be documented in this file. See * **deps:** update dependency @sanity/client to v6.21.2 ([#1749](https://github.com/sanity-io/visual-editing/issues/1749)) ([b9efdd2](https://github.com/sanity-io/visual-editing/commit/b9efdd2a672fdef518bc22a29a25992c938ba1ef)) -### Dependencies - -* The following workspace dependencies were updated - * devDependencies - * @repo/visual-editing-helpers bumped to 0.6.20 - ## [1.6.21](https://github.com/sanity-io/visual-editing/compare/core-loader-v1.6.20...core-loader-v1.6.21) (2024-08-02) @@ -362,12 +246,6 @@ All notable changes to this project will be documented in this file. See * **deps:** update dependency @sanity/client to v6.21.1 ([#1704](https://github.com/sanity-io/visual-editing/issues/1704)) ([32f1ef8](https://github.com/sanity-io/visual-editing/commit/32f1ef8582134a130d6325320274a981217ee2e8)) -### Dependencies - -* The following workspace dependencies were updated - * devDependencies - * @repo/visual-editing-helpers bumped from 0.6.18 to 0.6.19 - ## [1.6.20](https://github.com/sanity-io/visual-editing/compare/core-loader-v1.6.19...core-loader-v1.6.20) (2024-07-03) @@ -376,30 +254,12 @@ All notable changes to this project will be documented in this file. See * **deps:** update dependency @sanity/client to v6.20.1 ([#1680](https://github.com/sanity-io/visual-editing/issues/1680)) ([bb89688](https://github.com/sanity-io/visual-editing/commit/bb8968816838a60a32242ce803a3ef804f2f885e)) -### Dependencies - -* The following workspace dependencies were updated - * devDependencies - * @repo/visual-editing-helpers bumped from 0.6.17 to 0.6.18 - ## [1.6.19](https://github.com/sanity-io/visual-editing/compare/core-loader-v1.6.18...core-loader-v1.6.19) (2024-06-13) -### Dependencies - -* The following workspace dependencies were updated - * devDependencies - * @repo/visual-editing-helpers bumped from 0.6.16 to 0.6.17 - ## [1.6.18](https://github.com/sanity-io/visual-editing/compare/core-loader-v1.6.17...core-loader-v1.6.18) (2024-06-07) -### Dependencies - -* The following workspace dependencies were updated - * devDependencies - * @repo/visual-editing-helpers bumped from 0.6.15 to 0.6.16 - ## [1.6.17](https://github.com/sanity-io/visual-editing/compare/core-loader-v1.6.16...core-loader-v1.6.17) (2024-05-30) @@ -408,12 +268,6 @@ All notable changes to this project will be documented in this file. See * **deps:** update dependency @sanity/client to v6.19.1 ([#1602](https://github.com/sanity-io/visual-editing/issues/1602)) ([ebaa50c](https://github.com/sanity-io/visual-editing/commit/ebaa50ca0bf6f6324819a9b3ceb85eb1326d7d72)) -### Dependencies - -* The following workspace dependencies were updated - * devDependencies - * @repo/visual-editing-helpers bumped from 0.6.14 to 0.6.15 - ## [1.6.16](https://github.com/sanity-io/visual-editing/compare/core-loader-v1.6.15...core-loader-v1.6.16) (2024-05-28) @@ -422,12 +276,6 @@ All notable changes to this project will be documented in this file. See * **deps:** update dependency @sanity/client to v6.19.0 ([#1575](https://github.com/sanity-io/visual-editing/issues/1575)) ([f0094a1](https://github.com/sanity-io/visual-editing/commit/f0094a1ee716f856cc424f82bc68ca2b99881575)) -### Dependencies - -* The following workspace dependencies were updated - * devDependencies - * @repo/visual-editing-helpers bumped from 0.6.13 to 0.6.14 - ## [1.6.15](https://github.com/sanity-io/visual-editing/compare/core-loader-v1.6.14...core-loader-v1.6.15) (2024-05-27) @@ -436,12 +284,6 @@ All notable changes to this project will be documented in this file. See * **deps:** update dependency @sanity/client to v6.18.3 ([#1563](https://github.com/sanity-io/visual-editing/issues/1563)) ([609a3b1](https://github.com/sanity-io/visual-editing/commit/609a3b1ad00b0809ba1f926328cee4d082668bf1)) -### Dependencies - -* The following workspace dependencies were updated - * devDependencies - * @repo/visual-editing-helpers bumped from 0.6.12 to 0.6.13 - ## [1.6.14](https://github.com/sanity-io/visual-editing/compare/core-loader-v1.6.13...core-loader-v1.6.14) (2024-05-15) @@ -450,21 +292,9 @@ All notable changes to this project will be documented in this file. See * **deps:** update dependency @sanity/client to v6.18.2 ([#1519](https://github.com/sanity-io/visual-editing/issues/1519)) ([78c387e](https://github.com/sanity-io/visual-editing/commit/78c387eba9c29c9a6f6e7d6b392a04a9cd5724ab)) -### Dependencies - -* The following workspace dependencies were updated - * devDependencies - * @repo/visual-editing-helpers bumped from 0.6.11 to 0.6.12 - ## [1.6.13](https://github.com/sanity-io/visual-editing/compare/core-loader-v1.6.12...core-loader-v1.6.13) (2024-05-13) -### Dependencies - -* The following workspace dependencies were updated - * devDependencies - * @repo/visual-editing-helpers bumped from 0.6.10 to 0.6.11 - ## [1.6.12](https://github.com/sanity-io/visual-editing/compare/core-loader-v1.6.11...core-loader-v1.6.12) (2024-05-05) @@ -473,12 +303,6 @@ All notable changes to this project will be documented in this file. See * **deps:** update dependency @sanity/client to v6.17.2 ([#1449](https://github.com/sanity-io/visual-editing/issues/1449)) ([928b45c](https://github.com/sanity-io/visual-editing/commit/928b45c47c66c5e1ddbe8b00783efd399b9fa17a)) -### Dependencies - -* The following workspace dependencies were updated - * devDependencies - * @repo/visual-editing-helpers bumped from 0.6.9 to 0.6.10 - ## [1.6.11](https://github.com/sanity-io/visual-editing/compare/core-loader-v1.6.10...core-loader-v1.6.11) (2024-04-29) @@ -489,12 +313,6 @@ All notable changes to this project will be documented in this file. See ## [1.6.10](https://github.com/sanity-io/visual-editing/compare/core-loader-v1.6.9...core-loader-v1.6.10) (2024-04-26) -### Dependencies - -* The following workspace dependencies were updated - * devDependencies - * @repo/visual-editing-helpers bumped from 0.6.8 to 0.6.9 - ## [1.6.9](https://github.com/sanity-io/visual-editing/compare/core-loader-v1.6.8...core-loader-v1.6.9) (2024-04-22) @@ -503,12 +321,6 @@ All notable changes to this project will be documented in this file. See * **deps:** update dependency @sanity/client to v6.15.20 ([#1385](https://github.com/sanity-io/visual-editing/issues/1385)) ([8ead6bf](https://github.com/sanity-io/visual-editing/commit/8ead6bf64505b194ebe1b084d6f5b6d4f1d7196e)) -### Dependencies - -* The following workspace dependencies were updated - * devDependencies - * @repo/visual-editing-helpers bumped from 0.6.7 to 0.6.8 - ## [1.6.8](https://github.com/sanity-io/visual-editing/compare/core-loader-v1.6.7...core-loader-v1.6.8) (2024-04-19) @@ -517,12 +329,6 @@ All notable changes to this project will be documented in this file. See * **deps:** update dependency @sanity/client to v6.15.19 ([#1374](https://github.com/sanity-io/visual-editing/issues/1374)) ([fde2034](https://github.com/sanity-io/visual-editing/commit/fde203405fe8899fd1bd241523853b732c095b37)) -### Dependencies - -* The following workspace dependencies were updated - * devDependencies - * @repo/visual-editing-helpers bumped from 0.6.6 to 0.6.7 - ## [1.6.7](https://github.com/sanity-io/visual-editing/compare/core-loader-v1.6.6...core-loader-v1.6.7) (2024-04-17) @@ -532,12 +338,6 @@ All notable changes to this project will be documented in this file. See * inline `async-cache-dedupe` to improve ESM interop ([cb53fbd](https://github.com/sanity-io/visual-editing/commit/cb53fbd1348887443a7aa55808d73e8060865371)) -### Dependencies - -* The following workspace dependencies were updated - * devDependencies - * @repo/visual-editing-helpers bumped from 0.6.5 to 0.6.6 - ## [1.6.6](https://github.com/sanity-io/visual-editing/compare/core-loader-v1.6.5...core-loader-v1.6.6) (2024-04-16) @@ -546,12 +346,6 @@ All notable changes to this project will be documented in this file. See * **deps:** update dependency @sanity/client to v6.15.13 ([#1327](https://github.com/sanity-io/visual-editing/issues/1327)) ([a52f2c2](https://github.com/sanity-io/visual-editing/commit/a52f2c2180e1da09a8166e516aaeb206e13e13ae)) -### Dependencies - -* The following workspace dependencies were updated - * devDependencies - * @repo/visual-editing-helpers bumped from 0.6.4 to 0.6.5 - ## [1.6.5](https://github.com/sanity-io/visual-editing/compare/core-loader-v1.6.4...core-loader-v1.6.5) (2024-04-05) @@ -564,7 +358,6 @@ All notable changes to this project will be documented in this file. See * The following workspace dependencies were updated * devDependencies - * @sanity/visual-editing-helpers bumped from 0.6.3 to 0.6.4 ## [1.6.4](https://github.com/sanity-io/visual-editing/compare/core-loader-v1.6.3...core-loader-v1.6.4) (2024-04-05) @@ -579,7 +372,6 @@ All notable changes to this project will be documented in this file. See * The following workspace dependencies were updated * devDependencies - * @sanity/visual-editing-helpers bumped from 0.6.2 to 0.6.3 ## [1.6.3](https://github.com/sanity-io/visual-editing/compare/core-loader-v1.6.2...core-loader-v1.6.3) (2024-04-02) @@ -600,7 +392,6 @@ All notable changes to this project will be documented in this file. See * The following workspace dependencies were updated * devDependencies - * @sanity/visual-editing-helpers bumped from 0.6.1 to 0.6.2 ## [1.6.0](https://github.com/sanity-io/visual-editing/compare/core-loader-v1.5.1...core-loader-v1.6.0) (2024-03-06) @@ -619,7 +410,6 @@ All notable changes to this project will be documented in this file. See * The following workspace dependencies were updated * devDependencies - * @sanity/visual-editing-helpers bumped from 0.5.2 to 0.6.0 ## [1.5.1](https://github.com/sanity-io/visual-editing/compare/core-loader-v1.5.0...core-loader-v1.5.1) (2024-03-01) @@ -645,7 +435,6 @@ All notable changes to this project will be documented in this file. See * The following workspace dependencies were updated * devDependencies - * @sanity/visual-editing-helpers bumped from 0.5.1 to 0.5.2 ## [1.4.6](https://github.com/sanity-io/visual-editing/compare/core-loader-v1.4.5...core-loader-v1.4.6) (2024-02-26) @@ -659,7 +448,6 @@ All notable changes to this project will be documented in this file. See * The following workspace dependencies were updated * devDependencies - * @sanity/visual-editing-helpers bumped from 0.5.0 to 0.5.1 ## [1.4.4](https://github.com/sanity-io/visual-editing/compare/core-loader-v1.4.3...core-loader-v1.4.4) (2024-02-21) @@ -673,7 +461,6 @@ All notable changes to this project will be documented in this file. See * The following workspace dependencies were updated * devDependencies - * @sanity/visual-editing-helpers bumped from 0.3.1 to 0.4.0 ## [1.4.3](https://github.com/sanity-io/visual-editing/compare/core-loader-v1.4.2...core-loader-v1.4.3) (2024-02-16) @@ -688,7 +475,6 @@ All notable changes to this project will be documented in this file. See * The following workspace dependencies were updated * devDependencies - * @sanity/visual-editing-helpers bumped from 0.3.0 to 0.3.1 ## [1.4.2](https://github.com/sanity-io/visual-editing/compare/core-loader-v1.4.1...core-loader-v1.4.2) (2024-02-15) @@ -703,7 +489,6 @@ All notable changes to this project will be documented in this file. See * The following workspace dependencies were updated * devDependencies - * @sanity/visual-editing-helpers bumped from 0.2.6 to 0.3.0 ## [1.4.1](https://github.com/sanity-io/visual-editing/compare/core-loader-v1.4.0...core-loader-v1.4.1) (2024-02-05) @@ -731,7 +516,6 @@ All notable changes to this project will be documented in this file. See * The following workspace dependencies were updated * devDependencies - * @sanity/visual-editing-helpers bumped from 0.2.5 to 0.2.6 ## [1.3.9](https://github.com/sanity-io/visual-editing/compare/core-loader-v1.3.8...core-loader-v1.3.9) (2024-01-26) @@ -748,7 +532,6 @@ All notable changes to this project will be documented in this file. See * The following workspace dependencies were updated * devDependencies - * @sanity/visual-editing-helpers bumped from 0.2.4 to 0.2.5 ## [1.3.8](https://github.com/sanity-io/visual-editing/compare/core-loader-v1.3.7...core-loader-v1.3.8) (2024-01-22) @@ -769,7 +552,6 @@ All notable changes to this project will be documented in this file. See * The following workspace dependencies were updated * devDependencies - * @sanity/visual-editing-helpers bumped from 0.2.2 to 0.2.3 ## [1.3.5](https://github.com/sanity-io/visual-editing/compare/core-loader-v1.3.4...core-loader-v1.3.5) (2024-01-10) @@ -791,7 +573,6 @@ All notable changes to this project will be documented in this file. See * The following workspace dependencies were updated * devDependencies * @sanity/channels bumped from 0.3.0 to 0.4.0 - * @sanity/visual-editing-helpers bumped from 0.2.1 to 0.2.2 ## [1.3.3](https://github.com/sanity-io/visual-editing/compare/core-loader-v1.3.2...core-loader-v1.3.3) (2024-01-04) @@ -805,7 +586,6 @@ All notable changes to this project will be documented in this file. See * The following workspace dependencies were updated * devDependencies - * @sanity/visual-editing-helpers bumped from 0.2.0 to 0.2.1 ## [1.3.0](https://github.com/sanity-io/visual-editing/compare/core-loader-v1.2.0...core-loader-v1.3.0) (2023-12-12) @@ -834,7 +614,6 @@ All notable changes to this project will be documented in this file. See * The following workspace dependencies were updated * devDependencies * @sanity/channels bumped from 0.1.0 to 0.2.0 - * @sanity/visual-editing-helpers bumped from 0.1.3 to 0.1.4 ## [1.1.3](https://github.com/sanity-io/visual-editing/compare/core-loader-v1.1.2...core-loader-v1.1.3) (2023-12-07) @@ -848,7 +627,6 @@ All notable changes to this project will be documented in this file. See * The following workspace dependencies were updated * devDependencies - * @sanity/visual-editing-helpers bumped from 0.1.1 to 0.1.2 ## [1.1.0](https://github.com/sanity-io/visual-editing/compare/core-loader-v1.0.3...core-loader-v1.1.0) (2023-12-05) diff --git a/packages/core-loader/package.config.ts b/packages/core-loader/package.config.ts index bd41d0d04..f1ca93195 100644 --- a/packages/core-loader/package.config.ts +++ b/packages/core-loader/package.config.ts @@ -5,7 +5,7 @@ export default defineConfig({ ...baseConfig, extract: { ...baseConfig.extract, - bundledPackages: [...baseConfig.extract.bundledPackages, 'nanostores'], + bundledPackages: ['nanostores'], rules: { ...baseConfig.extract.rules, 'ae-forgotten-export': 'warn', diff --git a/packages/core-loader/package.json b/packages/core-loader/package.json index 6b3805a24..eae5cc845 100644 --- a/packages/core-loader/package.json +++ b/packages/core-loader/package.json @@ -69,13 +69,14 @@ }, "dependencies": { "@sanity/client": "^6.24.3", - "@sanity/comlink": "workspace:*" + "@sanity/comlink": "workspace:^", + "@sanity/presentation-comlink": "workspace:^", + "@sanity/visual-editing-csm": "workspace:^" }, "devDependencies": { "@repo/eslint-config": "workspace:*", "@repo/package.config": "workspace:*", "@repo/prettier-config": "workspace:*", - "@repo/visual-editing-helpers": "workspace:*", "@sanity/pkg-utils": "6.13.4", "@typescript-eslint/eslint-plugin": "^7.18.0", "@typescript-eslint/parser": "^7.18.0", diff --git a/packages/core-loader/src/createDataAttribute.ts b/packages/core-loader/src/createDataAttribute.ts index 448638a9b..c0565d832 100644 --- a/packages/core-loader/src/createDataAttribute.ts +++ b/packages/core-loader/src/createDataAttribute.ts @@ -11,4 +11,4 @@ export { * @deprecated use `import type {CreateDataAttributeProps} from '@sanity/visual-editing'` instead */ type CreateDataAttributeProps, -} from '@repo/visual-editing-helpers' +} from '@sanity/visual-editing-csm' diff --git a/packages/core-loader/src/encodeDataAttribute.ts b/packages/core-loader/src/encodeDataAttribute.ts index cdebf4639..6b803de21 100644 --- a/packages/core-loader/src/encodeDataAttribute.ts +++ b/packages/core-loader/src/encodeDataAttribute.ts @@ -1,4 +1,3 @@ -import {encodeSanityNodeData} from '@repo/visual-editing-helpers/csm' import { jsonPathToStudioPath, resolveEditInfo, @@ -8,6 +7,7 @@ import { type StudioPathLike, } from '@sanity/client/csm' import type {StegaConfig} from '@sanity/client/stega' +import {encodeSanityNodeData} from '@sanity/visual-editing-csm' import type {EncodeDataAttribute} from './types' /** @public */ diff --git a/packages/core-loader/src/live-mode/enableLiveMode.ts b/packages/core-loader/src/live-mode/enableLiveMode.ts index 645e3ec1b..591d37afc 100644 --- a/packages/core-loader/src/live-mode/enableLiveMode.ts +++ b/packages/core-loader/src/live-mode/enableLiveMode.ts @@ -1,8 +1,3 @@ -import { - createCompatibilityActors, - type LoaderControllerMsg, - type LoaderNodeMsg, -} from '@repo/visual-editing-helpers' import { validateApiPerspective, type ClientPerspective, @@ -13,6 +8,11 @@ import { } from '@sanity/client' import {stegaEncodeSourceMap} from '@sanity/client/stega' import {createNode, createNodeMachine} from '@sanity/comlink' +import { + createCompatibilityActors, + type LoaderControllerMsg, + type LoaderNodeMsg, +} from '@sanity/presentation-comlink' import {atom, type MapStore} from 'nanostores' import type {EnableLiveModeOptions, QueryStoreState, SetFetcher} from '../types' diff --git a/packages/next-loader/CHANGELOG.md b/packages/next-loader/CHANGELOG.md index aa3c96c94..b8a526ee4 100644 --- a/packages/next-loader/CHANGELOG.md +++ b/packages/next-loader/CHANGELOG.md @@ -3,12 +3,6 @@ ## [1.2.14](https://github.com/sanity-io/visual-editing/compare/next-loader-v1.2.13...next-loader-v1.2.14) (2025-01-14) -### Dependencies - -* The following workspace dependencies were updated - * devDependencies - * @repo/visual-editing-helpers bumped to 0.7.14 - ## [1.2.13](https://github.com/sanity-io/visual-editing/compare/next-loader-v1.2.12...next-loader-v1.2.13) (2025-01-10) @@ -26,8 +20,6 @@ * The following workspace dependencies were updated * dependencies * @sanity/comlink bumped to 3.0.0 - * devDependencies - * @repo/visual-editing-helpers bumped to 0.7.13 ## [1.2.11](https://github.com/sanity-io/visual-editing/compare/next-loader-v1.2.10...next-loader-v1.2.11) (2025-01-09) @@ -42,8 +34,6 @@ * The following workspace dependencies were updated * dependencies * @sanity/comlink bumped to 2.0.5 - * devDependencies - * @repo/visual-editing-helpers bumped to 0.7.12 * @sanity/preview-url-secret bumped to 2.0.7 ## [1.2.10](https://github.com/sanity-io/visual-editing/compare/next-loader-v1.2.9...next-loader-v1.2.10) (2025-01-09) @@ -63,8 +53,6 @@ * The following workspace dependencies were updated * dependencies * @sanity/comlink bumped to 2.0.4 - * devDependencies - * @repo/visual-editing-helpers bumped to 0.7.11 ## [1.2.8](https://github.com/sanity-io/visual-editing/compare/next-loader-v1.2.7...next-loader-v1.2.8) (2024-12-21) @@ -74,18 +62,10 @@ * The following workspace dependencies were updated * dependencies * @sanity/comlink bumped to 2.0.3 - * devDependencies - * @repo/visual-editing-helpers bumped to 0.7.10 ## [1.2.7](https://github.com/sanity-io/visual-editing/compare/next-loader-v1.2.6...next-loader-v1.2.7) (2024-12-16) -### Dependencies - -* The following workspace dependencies were updated - * devDependencies - * @repo/visual-editing-helpers bumped to 0.7.9 - ## [1.2.6](https://github.com/sanity-io/visual-editing/compare/next-loader-v1.2.5...next-loader-v1.2.6) (2024-12-16) @@ -94,8 +74,6 @@ * The following workspace dependencies were updated * dependencies * @sanity/comlink bumped to 2.0.2 - * devDependencies - * @repo/visual-editing-helpers bumped to 0.7.8 ## [1.2.5](https://github.com/sanity-io/visual-editing/compare/next-loader-v1.2.4...next-loader-v1.2.5) (2024-12-12) @@ -124,8 +102,6 @@ * The following workspace dependencies were updated * dependencies * @sanity/comlink bumped to 2.0.1 - * devDependencies - * @repo/visual-editing-helpers bumped to 0.7.7 ## [1.2.2](https://github.com/sanity-io/visual-editing/compare/next-loader-v1.2.1...next-loader-v1.2.2) (2024-12-03) @@ -164,8 +140,6 @@ ### Dependencies * The following workspace dependencies were updated - * devDependencies - * @repo/visual-editing-helpers bumped to 0.7.6 * @sanity/preview-url-secret bumped to 2.0.5 ## [1.1.11](https://github.com/sanity-io/visual-editing/compare/next-loader-v1.1.10...next-loader-v1.1.11) (2024-11-28) @@ -176,8 +150,6 @@ * The following workspace dependencies were updated * dependencies * @sanity/comlink bumped to 2.0.0 - * devDependencies - * @repo/visual-editing-helpers bumped to 0.7.5 ## [1.1.10](https://github.com/sanity-io/visual-editing/compare/next-loader-v1.1.9...next-loader-v1.1.10) (2024-11-27) @@ -195,8 +167,6 @@ * The following workspace dependencies were updated * dependencies * @sanity/comlink bumped to 1.1.4 - * devDependencies - * @repo/visual-editing-helpers bumped to 0.7.4 ## [1.1.8](https://github.com/sanity-io/visual-editing/compare/next-loader-v1.1.7...next-loader-v1.1.8) (2024-11-19) @@ -210,8 +180,6 @@ ### Dependencies * The following workspace dependencies were updated - * devDependencies - * @repo/visual-editing-helpers bumped to 0.7.3 * @sanity/preview-url-secret bumped to 2.0.4 ## [1.1.7](https://github.com/sanity-io/visual-editing/compare/next-loader-v1.1.6...next-loader-v1.1.7) (2024-11-14) @@ -222,8 +190,6 @@ * The following workspace dependencies were updated * dependencies * @sanity/comlink bumped to 1.1.3 - * devDependencies - * @repo/visual-editing-helpers bumped to 0.7.2 ## [1.1.6](https://github.com/sanity-io/visual-editing/compare/next-loader-v1.1.5...next-loader-v1.1.6) (2024-11-12) @@ -233,8 +199,6 @@ * The following workspace dependencies were updated * dependencies * @sanity/comlink bumped to 1.1.2 - * devDependencies - * @repo/visual-editing-helpers bumped to 0.7.1 ## [1.1.5](https://github.com/sanity-io/visual-editing/compare/next-loader-v1.1.4...next-loader-v1.1.5) (2024-11-12) @@ -247,8 +211,6 @@ ### Dependencies * The following workspace dependencies were updated - * devDependencies - * @repo/visual-editing-helpers bumped to 0.7.0 * @sanity/preview-url-secret bumped to 2.0.3 ## [1.1.4](https://github.com/sanity-io/visual-editing/compare/next-loader-v1.1.3...next-loader-v1.1.4) (2024-11-07) @@ -273,28 +235,14 @@ ### Dependencies * The following workspace dependencies were updated - * devDependencies - * @repo/visual-editing-helpers bumped to 0.6.30 * @sanity/preview-url-secret bumped to 2.0.1 ## [1.1.2](https://github.com/sanity-io/visual-editing/compare/next-loader-v1.1.1...next-loader-v1.1.2) (2024-11-04) -### Dependencies - -* The following workspace dependencies were updated - * devDependencies - * @repo/visual-editing-helpers bumped to 0.6.29 - ## [1.1.1](https://github.com/sanity-io/visual-editing/compare/next-loader-v1.1.0...next-loader-v1.1.1) (2024-10-28) -### Dependencies - -* The following workspace dependencies were updated - * devDependencies - * @repo/visual-editing-helpers bumped to 0.6.28 - ## [1.1.0](https://github.com/sanity-io/visual-editing/compare/next-loader-v1.0.8...next-loader-v1.1.0) (2024-10-24) @@ -308,8 +256,6 @@ * The following workspace dependencies were updated * dependencies * @sanity/comlink bumped to 1.1.1 - * devDependencies - * @repo/visual-editing-helpers bumped to 0.6.27 ## [1.0.8](https://github.com/sanity-io/visual-editing/compare/next-loader-v1.0.7...next-loader-v1.0.8) (2024-10-24) @@ -319,18 +265,10 @@ * The following workspace dependencies were updated * dependencies * @sanity/comlink bumped to 1.1.0 - * devDependencies - * @repo/visual-editing-helpers bumped to 0.6.26 ## [1.0.7](https://github.com/sanity-io/visual-editing/compare/next-loader-v1.0.6...next-loader-v1.0.7) (2024-10-23) -### Dependencies - -* The following workspace dependencies were updated - * devDependencies - * @repo/visual-editing-helpers bumped to 0.6.25 - ## [1.0.6](https://github.com/sanity-io/visual-editing/compare/next-loader-v1.0.5...next-loader-v1.0.6) (2024-10-23) @@ -363,12 +301,6 @@ ## [1.0.2](https://github.com/sanity-io/visual-editing/compare/next-loader-v1.0.1...next-loader-v1.0.2) (2024-10-21) -### Dependencies - -* The following workspace dependencies were updated - * devDependencies - * @repo/visual-editing-helpers bumped to 0.6.24 - ## [1.0.1](https://github.com/sanity-io/visual-editing/compare/next-loader-v1.0.0...next-loader-v1.0.1) (2024-10-21) @@ -377,12 +309,6 @@ * **comlink:** handle heartbeat compatibility correctly ([#2006](https://github.com/sanity-io/visual-editing/issues/2006)) ([65af1e1](https://github.com/sanity-io/visual-editing/commit/65af1e17aa329d5f5282152d4b77bca8750a539f)) -### Dependencies - -* The following workspace dependencies were updated - * devDependencies - * @repo/visual-editing-helpers bumped to 0.6.23 - ## 1.0.0 (2024-10-21) @@ -401,6 +327,4 @@ * The following workspace dependencies were updated * dependencies * @sanity/comlink bumped to 1.0.0 - * devDependencies - * @repo/visual-editing-helpers bumped to 0.6.22 * @sanity/preview-url-secret bumped to 2.0.0 diff --git a/packages/next-loader/package.json b/packages/next-loader/package.json index 8d325d027..983ce435b 100644 --- a/packages/next-loader/package.json +++ b/packages/next-loader/package.json @@ -89,14 +89,14 @@ }, "dependencies": { "@sanity/client": "^6.24.3", - "@sanity/comlink": "workspace:*", + "@sanity/comlink": "workspace:^", + "@sanity/presentation-comlink": "workspace:^", "use-effect-event": "^1.0.2" }, "devDependencies": { "@repo/eslint-config": "workspace:*", "@repo/package.config": "workspace:*", "@repo/prettier-config": "workspace:*", - "@repo/visual-editing-helpers": "workspace:*", "@sanity/pkg-utils": "6.13.4", "@sanity/preview-url-secret": "workspace:*", "@types/react": "^19.0.7", diff --git a/packages/next-loader/src/client-components/live-stream/SanityLiveStream.tsx b/packages/next-loader/src/client-components/live-stream/SanityLiveStream.tsx index 1ac4526cd..04211ad31 100644 --- a/packages/next-loader/src/client-components/live-stream/SanityLiveStream.tsx +++ b/packages/next-loader/src/client-components/live-stream/SanityLiveStream.tsx @@ -1,4 +1,3 @@ -import type {LoaderControllerMsg} from '@repo/visual-editing-helpers' import { type ClientPerspective, type ContentSourceMap, @@ -6,6 +5,7 @@ import { type QueryParams, } from '@sanity/client' import {stegaEncodeSourceMap} from '@sanity/client/stega' +import type {LoaderControllerMsg} from '@sanity/presentation-comlink' import isEqual from 'fast-deep-equal' import {useCallback, useEffect, useState, useSyncExternalStore} from 'react' import * as React from 'react' diff --git a/packages/next-loader/src/client-components/live/PresentationComlink.tsx b/packages/next-loader/src/client-components/live/PresentationComlink.tsx index 0d68d209f..4e217dc50 100644 --- a/packages/next-loader/src/client-components/live/PresentationComlink.tsx +++ b/packages/next-loader/src/client-components/live/PresentationComlink.tsx @@ -1,8 +1,3 @@ -import { - createCompatibilityActors, - type LoaderControllerMsg, - type LoaderNodeMsg, -} from '@repo/visual-editing-helpers' import type {ClientPerspective} from '@sanity/client' import { createNode, @@ -10,6 +5,11 @@ import { // type Node, } from '@sanity/comlink' import {setPerspectiveCookie} from '@sanity/next-loader/server-actions' +import { + createCompatibilityActors, + type LoaderControllerMsg, + type LoaderNodeMsg, +} from '@sanity/presentation-comlink' import {useRouter} from 'next/navigation.js' import { useEffect, diff --git a/packages/next-loader/src/client-components/live/SanityLive.tsx b/packages/next-loader/src/client-components/live/SanityLive.tsx index 96fc67ced..c176686a0 100644 --- a/packages/next-loader/src/client-components/live/SanityLive.tsx +++ b/packages/next-loader/src/client-components/live/SanityLive.tsx @@ -7,6 +7,7 @@ import { type LiveEventWelcome, } from '@sanity/client' import {revalidateSyncTags} from '@sanity/next-loader/server-actions' +import {isMaybePresentation, isMaybePreviewWindow} from '@sanity/presentation-comlink' import dynamic from 'next/dynamic' import {useRouter} from 'next/navigation.js' import {useEffect, useMemo, useRef, useState} from 'react' @@ -47,12 +48,6 @@ export interface SanityLiveProps onError?: (error: unknown) => void } -// @TODO these should be reusable utils in visual-editing-helpers - -const isMaybePreviewIframe = () => window !== window.parent -const isMaybePreviewWindow = () => !!window.opener -const isMaybePresentation = () => isMaybePreviewIframe() || isMaybePreviewWindow() - const handleError = (error: unknown) => { /* eslint-disable no-console */ if (isCorsOriginError(error)) { diff --git a/packages/next-loader/src/hooks/context.ts b/packages/next-loader/src/hooks/context.ts index aed0843c1..a491af7f2 100644 --- a/packages/next-loader/src/hooks/context.ts +++ b/packages/next-loader/src/hooks/context.ts @@ -1,6 +1,6 @@ -import {type LoaderControllerMsg, type LoaderNodeMsg} from '@repo/visual-editing-helpers' import type {ClientPerspective} from '@sanity/client' import {type Node} from '@sanity/comlink' +import {type LoaderControllerMsg, type LoaderNodeMsg} from '@sanity/presentation-comlink' /** * The Sanity Client perspective used when fetching data in Draft Mode, in the `sanityFetch` calls diff --git a/packages/visual-editing-helpers/.eslintignore b/packages/presentation-comlink/.eslintignore similarity index 100% rename from packages/visual-editing-helpers/.eslintignore rename to packages/presentation-comlink/.eslintignore diff --git a/packages/presentation-comlink/.gitignore b/packages/presentation-comlink/.gitignore new file mode 100644 index 000000000..c66ae6b38 --- /dev/null +++ b/packages/presentation-comlink/.gitignore @@ -0,0 +1 @@ +src/**/*.d.ts diff --git a/packages/presentation-comlink/README.md b/packages/presentation-comlink/README.md new file mode 100644 index 000000000..21f559dc2 --- /dev/null +++ b/packages/presentation-comlink/README.md @@ -0,0 +1,8 @@ +# @sanity/presentation-comlink + +> [!WARNING] +> This package is not meant to be used directly, it's a shared dependency of `sanity/presentation` and `@sanity/visual-editing`. Using it in production is at your own risk. + +The `sanity/presentation` tool requires a way to communicate with the application that lives within its preview iframe. The application is required to load up at least `@sanity/visual-editing`, but can also load up `@sanity/core-loader`, `@sanity/next-loader`, `@sanity/svelte-loader`, and `@sanity/react-loader`. +It uses `@sanity/comlink` to communicate over the iframe, and any popup preview windows, over the `window.postMessage` protocol. +The typings for those messages are defined in this package, as well as utils for maintaining compatibility with how older versions of `sanity/presentation` and `@sanity/visual-editing` used to format its message payloads, and helpers for handling payloads.. diff --git a/packages/presentation-comlink/package.config.ts b/packages/presentation-comlink/package.config.ts new file mode 100644 index 000000000..0a2ae4f17 --- /dev/null +++ b/packages/presentation-comlink/package.config.ts @@ -0,0 +1,10 @@ +import baseConfig from '@repo/package.config' +import {defineConfig} from '@sanity/pkg-utils' + +export default defineConfig({ + ...baseConfig, + runtime: 'browser', + define: { + 'process.env.NODE_ENV': 'production', + }, +}) diff --git a/packages/visual-editing-helpers/package.json b/packages/presentation-comlink/package.json similarity index 52% rename from packages/visual-editing-helpers/package.json rename to packages/presentation-comlink/package.json index 99444e7d4..b1601e600 100644 --- a/packages/visual-editing-helpers/package.json +++ b/packages/presentation-comlink/package.json @@ -1,7 +1,15 @@ { - "name": "@repo/visual-editing-helpers", - "version": "0.7.14", - "private": true, + "name": "@sanity/presentation-comlink", + "version": "0.0.0", + "homepage": "https://github.com/sanity-io/visual-editing/tree/main/packages/presentation-comlink#readme", + "bugs": { + "url": "https://github.com/sanity-io/visual-editing/issues" + }, + "repository": { + "type": "git", + "url": "git+ssh://git@github.com/sanity-io/visual-editing.git", + "directory": "packages/presentation-comlink" + }, "license": "MIT", "author": "Sanity.io ", "sideEffects": false, @@ -13,33 +21,11 @@ "require": "./dist/index.cjs", "default": "./dist/index.js" }, - "./csm": { - "source": "./src/csm/index.ts", - "import": "./dist/csm.js", - "require": "./dist/csm.cjs", - "default": "./dist/csm.js" - }, - "./hooks": { - "source": "./src/hooks/index.ts", - "import": "./dist/hooks.js", - "require": "./dist/hooks.cjs", - "default": "./dist/hooks.js" - }, "./package.json": "./package.json" }, "main": "./dist/index.cjs", "module": "./dist/index.js", "types": "./dist/index.d.ts", - "typesVersions": { - "*": { - "csm": [ - "./dist/csm.d.ts" - ], - "hooks": [ - "./dist/hooks.d.ts" - ] - } - }, "files": [ "dist", "src", @@ -53,43 +39,32 @@ "test": "vitest --pass-with-no-tests --typecheck" }, "browserslist": "extends @sanity/browserslist-config", - "prettier": "@repo/prettier-config", "eslintConfig": { "extends": [ "@repo/eslint-config" ], "root": true }, + "dependencies": { + "@sanity/comlink": "workspace:^", + "@sanity/visual-editing-types": "workspace:^" + }, "devDependencies": { "@repo/eslint-config": "workspace:*", "@repo/package.config": "workspace:*", - "@repo/prettier-config": "workspace:*", "@sanity/client": "^6.24.3", - "@sanity/comlink": "workspace:*", - "@sanity/util": "3.70.0", - "@types/react": "^19.0.7", + "@sanity/pkg-utils": "6.13.4", "eslint": "^8.57.1", - "react": "^19.0.0", - "sanity": "3.70.0", "typescript": "5.7.3", - "valibot": "0.31.1", "vitest": "^2.1.8" }, "peerDependencies": { - "@sanity/client": "^6.24.3", - "@sanity/comlink": "workspace:*", - "react": "^18.2.0 || ^19", - "valibot": "0.31.1" - }, - "peerDependenciesMeta": { - "react": { - "optional": true - }, - "valibot": { - "optional": true - } + "@sanity/client": "^6.24.3" }, "engines": { "node": ">=18" + }, + "publishConfig": { + "access": "public" } } diff --git a/packages/visual-editing-helpers/src/comlinkCompatibility.ts b/packages/presentation-comlink/src/comlinkCompatibility.ts similarity index 99% rename from packages/visual-editing-helpers/src/comlinkCompatibility.ts rename to packages/presentation-comlink/src/comlinkCompatibility.ts index 918f77c3c..11809cfe7 100644 --- a/packages/visual-editing-helpers/src/comlinkCompatibility.ts +++ b/packages/presentation-comlink/src/comlinkCompatibility.ts @@ -149,7 +149,6 @@ const sendAsChannelsMessage = ( }) } -// @todo Why is this necessary? export { type ListenInput, type Message, diff --git a/packages/presentation-comlink/src/index.ts b/packages/presentation-comlink/src/index.ts new file mode 100644 index 000000000..43e501336 --- /dev/null +++ b/packages/presentation-comlink/src/index.ts @@ -0,0 +1,29 @@ +export * from './comlinkCompatibility' +export * from './isMaybePresentation' +export type * from './types' +export type {Path} from '@sanity/client/csm' +export type { + DocumentSchema, + InsertMenuOptions, + PreviewSnapshot, + ResolvedSchemaTypeMap, + SanityNode, + SanityStegaNode, + SchemaArrayItem, + SchemaArrayNode, + SchemaBooleanNode, + SchemaInlineNode, + SchemaNode, + SchemaNullNode, + SchemaNumberNode, + SchemaObjectField, + SchemaObjectNode, + SchemaStringNode, + SchemaType, + SchemaUnionNode, + SchemaUnionNodeOptions, + SchemaUnionOption, + SchemaUnknownNode, + TypeSchema, + UnresolvedPath, +} from '@sanity/visual-editing-types' diff --git a/packages/presentation-comlink/src/isMaybePresentation.ts b/packages/presentation-comlink/src/isMaybePresentation.ts new file mode 100644 index 000000000..58b2083a6 --- /dev/null +++ b/packages/presentation-comlink/src/isMaybePresentation.ts @@ -0,0 +1,9 @@ +export function isMaybePreviewIframe(): boolean { + return window.self !== window.top +} +export function isMaybePreviewWindow(): boolean { + return Boolean(window.opener) +} +export function isMaybePresentation(): boolean { + return isMaybePreviewIframe() || isMaybePreviewWindow() +} diff --git a/packages/visual-editing-helpers/src/types/comlink.ts b/packages/presentation-comlink/src/types.ts similarity index 94% rename from packages/visual-editing-helpers/src/types/comlink.ts rename to packages/presentation-comlink/src/types.ts index 78d19e690..deabfe5f5 100644 --- a/packages/visual-editing-helpers/src/types/comlink.ts +++ b/packages/presentation-comlink/src/types.ts @@ -9,15 +9,14 @@ import type { SyncTag, WelcomeEvent, } from '@sanity/client' -import type {PreviewValue} from '@sanity/types' -import type {SanityNode, SanityStegaNode} from './overlays' -import type {ResolvedSchemaTypeMap, SchemaType, UnresolvedPath} from './schema' - -/** - * @internal - * client.fetch(query, params) => `${query}-${JSON.stringify(params)}` - */ -export type QueryCacheKey = `${string}-${string}` +import type { + PreviewSnapshot, + ResolvedSchemaTypeMap, + SanityNode, + SanityStegaNode, + SchemaType, + UnresolvedPath, +} from '@sanity/visual-editing-types' /** * Preview frame history update @@ -77,16 +76,6 @@ export type HistoryRefresh = } } -/** - * @public - */ -export type PreviewSnapshot = { - // Explicitly exclude media, as it's not serializable - [K in keyof Omit]?: Omit[K] -} & { - _id: string -} - /** * @public */ diff --git a/packages/visual-editing-helpers/tsconfig.base.json b/packages/presentation-comlink/tsconfig.base.json similarity index 100% rename from packages/visual-editing-helpers/tsconfig.base.json rename to packages/presentation-comlink/tsconfig.base.json diff --git a/packages/presentation-comlink/tsconfig.build.json b/packages/presentation-comlink/tsconfig.build.json new file mode 100644 index 000000000..83b7b37c7 --- /dev/null +++ b/packages/presentation-comlink/tsconfig.build.json @@ -0,0 +1,8 @@ +{ + "extends": "./tsconfig.base", + "compilerOptions": { + "rootDir": "src" + }, + "include": ["src/**/*.ts"], + "exclude": ["dist", "node_modules"] +} diff --git a/packages/visual-editing-helpers/tsconfig.json b/packages/presentation-comlink/tsconfig.json similarity index 66% rename from packages/visual-editing-helpers/tsconfig.json rename to packages/presentation-comlink/tsconfig.json index 59dce1c9c..f9f8d7b3e 100644 --- a/packages/visual-editing-helpers/tsconfig.json +++ b/packages/presentation-comlink/tsconfig.json @@ -1,5 +1,5 @@ { "extends": "./tsconfig.base", - "include": ["**/*.ts", "**/*.tsx"], + "include": ["**/*.ts"], "exclude": ["dist", "node_modules"] } diff --git a/packages/visual-editing-helpers/turbo.json b/packages/presentation-comlink/turbo.json similarity index 100% rename from packages/visual-editing-helpers/turbo.json rename to packages/presentation-comlink/turbo.json diff --git a/packages/visual-editing-helpers/vitest.config.ts b/packages/presentation-comlink/vitest.config.ts similarity index 100% rename from packages/visual-editing-helpers/vitest.config.ts rename to packages/presentation-comlink/vitest.config.ts diff --git a/packages/presentation/CHANGELOG.md b/packages/presentation/CHANGELOG.md index c496d49b2..488863e77 100644 --- a/packages/presentation/CHANGELOG.md +++ b/packages/presentation/CHANGELOG.md @@ -6,12 +6,6 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. -### Dependencies - -* The following workspace dependencies were updated - * devDependencies - * @sanity/visual-editing-helpers bumped from 0.5.2 to 0.6.0 - ## [1.22.0](https://github.com/sanity-io/visual-editing/compare/presentation-v1.21.3...presentation-v1.22.0) (2025-01-16) @@ -32,12 +26,6 @@ All notable changes to this project will be documented in this file. See * explicitly fetch preview snapshots on connect ([#2487](https://github.com/sanity-io/visual-editing/issues/2487)) ([cf07d56](https://github.com/sanity-io/visual-editing/commit/cf07d56b8feca6b815d7609b69c3a51769442263)) -### Dependencies - -* The following workspace dependencies were updated - * devDependencies - * @repo/visual-editing-helpers bumped to 0.7.14 - ## [1.21.2](https://github.com/sanity-io/visual-editing/compare/presentation-v1.21.1...presentation-v1.21.2) (2025-01-13) @@ -79,8 +67,6 @@ All notable changes to this project will be documented in this file. See * The following workspace dependencies were updated * dependencies * @sanity/comlink bumped to 3.0.0 - * devDependencies - * @repo/visual-editing-helpers bumped to 0.7.13 ## [1.20.3](https://github.com/sanity-io/visual-editing/compare/presentation-v1.20.2...presentation-v1.20.3) (2025-01-09) @@ -96,8 +82,6 @@ All notable changes to this project will be documented in this file. See * dependencies * @sanity/comlink bumped to 2.0.5 * @sanity/preview-url-secret bumped to 2.0.7 - * devDependencies - * @repo/visual-editing-helpers bumped to 0.7.12 ## [1.20.2](https://github.com/sanity-io/visual-editing/compare/presentation-v1.20.1...presentation-v1.20.2) (2025-01-09) @@ -130,8 +114,6 @@ All notable changes to this project will be documented in this file. See * The following workspace dependencies were updated * dependencies * @sanity/comlink bumped to 2.0.4 - * devDependencies - * @repo/visual-editing-helpers bumped to 0.7.11 ## [1.19.16](https://github.com/sanity-io/visual-editing/compare/presentation-v1.19.15...presentation-v1.19.16) (2024-12-21) @@ -161,8 +143,6 @@ All notable changes to this project will be documented in this file. See * The following workspace dependencies were updated * dependencies * @sanity/comlink bumped to 2.0.3 - * devDependencies - * @repo/visual-editing-helpers bumped to 0.7.10 ## [1.19.13](https://github.com/sanity-io/visual-editing/compare/presentation-v1.19.12...presentation-v1.19.13) (2024-12-18) @@ -193,12 +173,6 @@ All notable changes to this project will be documented in this file. See * add visual-editing telemetry ([#2263](https://github.com/sanity-io/visual-editing/issues/2263)) ([8d2fd18](https://github.com/sanity-io/visual-editing/commit/8d2fd18dfd5bd99d8953acb2d47999892c38eb5d)) -### Dependencies - -* The following workspace dependencies were updated - * devDependencies - * @repo/visual-editing-helpers bumped to 0.7.9 - ## [1.19.9](https://github.com/sanity-io/visual-editing/compare/presentation-v1.19.8...presentation-v1.19.9) (2024-12-16) @@ -212,8 +186,6 @@ All notable changes to this project will be documented in this file. See * The following workspace dependencies were updated * dependencies * @sanity/comlink bumped to 2.0.2 - * devDependencies - * @repo/visual-editing-helpers bumped to 0.7.8 ## [1.19.8](https://github.com/sanity-io/visual-editing/compare/presentation-v1.19.7...presentation-v1.19.8) (2024-12-09) @@ -245,8 +217,6 @@ All notable changes to this project will be documented in this file. See * The following workspace dependencies were updated * dependencies * @sanity/comlink bumped to 2.0.1 - * devDependencies - * @repo/visual-editing-helpers bumped to 0.7.7 ## [1.19.4](https://github.com/sanity-io/visual-editing/compare/presentation-v1.19.3...presentation-v1.19.4) (2024-12-02) @@ -261,8 +231,6 @@ All notable changes to this project will be documented in this file. See * The following workspace dependencies were updated * dependencies * @sanity/preview-url-secret bumped to 2.0.5 - * devDependencies - * @repo/visual-editing-helpers bumped to 0.7.6 ## [1.19.3](https://github.com/sanity-io/visual-editing/compare/presentation-v1.19.2...presentation-v1.19.3) (2024-11-28) @@ -279,8 +247,6 @@ All notable changes to this project will be documented in this file. See * The following workspace dependencies were updated * dependencies * @sanity/comlink bumped to 2.0.0 - * devDependencies - * @repo/visual-editing-helpers bumped to 0.7.5 ## [1.19.1](https://github.com/sanity-io/visual-editing/compare/presentation-v1.19.0...presentation-v1.19.1) (2024-11-27) @@ -309,8 +275,6 @@ All notable changes to this project will be documented in this file. See * The following workspace dependencies were updated * dependencies * @sanity/comlink bumped to 1.1.4 - * devDependencies - * @repo/visual-editing-helpers bumped to 0.7.4 ## [1.18.4](https://github.com/sanity-io/visual-editing/compare/presentation-v1.18.3...presentation-v1.18.4) (2024-11-19) @@ -325,8 +289,6 @@ All notable changes to this project will be documented in this file. See * The following workspace dependencies were updated * dependencies * @sanity/preview-url-secret bumped to 2.0.4 - * devDependencies - * @repo/visual-editing-helpers bumped to 0.7.3 ## [1.18.3](https://github.com/sanity-io/visual-editing/compare/presentation-v1.18.2...presentation-v1.18.3) (2024-11-14) @@ -336,8 +298,6 @@ All notable changes to this project will be documented in this file. See * The following workspace dependencies were updated * dependencies * @sanity/comlink bumped to 1.1.3 - * devDependencies - * @repo/visual-editing-helpers bumped to 0.7.2 ## [1.18.2](https://github.com/sanity-io/visual-editing/compare/presentation-v1.18.1...presentation-v1.18.2) (2024-11-13) @@ -354,8 +314,6 @@ All notable changes to this project will be documented in this file. See * The following workspace dependencies were updated * dependencies * @sanity/comlink bumped to 1.1.2 - * devDependencies - * @repo/visual-editing-helpers bumped to 0.7.1 ## [1.18.0](https://github.com/sanity-io/visual-editing/compare/presentation-v1.17.10...presentation-v1.18.0) (2024-11-12) @@ -378,8 +336,6 @@ All notable changes to this project will be documented in this file. See * The following workspace dependencies were updated * dependencies * @sanity/preview-url-secret bumped to 2.0.3 - * devDependencies - * @repo/visual-editing-helpers bumped to 0.7.0 ## [1.17.10](https://github.com/sanity-io/visual-editing/compare/presentation-v1.17.9...presentation-v1.17.10) (2024-11-07) @@ -403,8 +359,6 @@ All notable changes to this project will be documented in this file. See * The following workspace dependencies were updated * dependencies * @sanity/preview-url-secret bumped to 2.0.1 - * devDependencies - * @repo/visual-editing-helpers bumped to 0.6.30 ## [1.17.8](https://github.com/sanity-io/visual-editing/compare/presentation-v1.17.7...presentation-v1.17.8) (2024-11-04) @@ -414,21 +368,9 @@ All notable changes to this project will be documented in this file. See * **presentation:** remove media from preview snapshot payload ([#2079](https://github.com/sanity-io/visual-editing/issues/2079)) ([f1d04b3](https://github.com/sanity-io/visual-editing/commit/f1d04b396abbba1879c1f1f0b605269e94f4400f)) -### Dependencies - -* The following workspace dependencies were updated - * devDependencies - * @repo/visual-editing-helpers bumped to 0.6.29 - ## [1.17.7](https://github.com/sanity-io/visual-editing/compare/presentation-v1.17.6...presentation-v1.17.7) (2024-10-28) -### Dependencies - -* The following workspace dependencies were updated - * devDependencies - * @repo/visual-editing-helpers bumped to 0.6.28 - ## [1.17.6](https://github.com/sanity-io/visual-editing/compare/presentation-v1.17.5...presentation-v1.17.6) (2024-10-24) @@ -437,8 +379,6 @@ All notable changes to this project will be documented in this file. See * The following workspace dependencies were updated * dependencies * @sanity/comlink bumped to 1.1.1 - * devDependencies - * @repo/visual-editing-helpers bumped to 0.6.27 ## [1.17.5](https://github.com/sanity-io/visual-editing/compare/presentation-v1.17.4...presentation-v1.17.5) (2024-10-24) @@ -448,8 +388,6 @@ All notable changes to this project will be documented in this file. See * The following workspace dependencies were updated * dependencies * @sanity/comlink bumped to 1.1.0 - * devDependencies - * @repo/visual-editing-helpers bumped to 0.6.26 ## [1.17.4](https://github.com/sanity-io/visual-editing/compare/presentation-v1.17.3...presentation-v1.17.4) (2024-10-23) @@ -459,30 +397,12 @@ All notable changes to this project will be documented in this file. See * resolve issues with newly added canary features ([#2036](https://github.com/sanity-io/visual-editing/issues/2036)) ([7b6507b](https://github.com/sanity-io/visual-editing/commit/7b6507b35c48e5307e7a2e70536d4336e18327b6)) -### Dependencies - -* The following workspace dependencies were updated - * devDependencies - * @repo/visual-editing-helpers bumped to 0.6.25 - ## [1.17.3](https://github.com/sanity-io/visual-editing/compare/presentation-v1.17.2...presentation-v1.17.3) (2024-10-21) -### Dependencies - -* The following workspace dependencies were updated - * devDependencies - * @repo/visual-editing-helpers bumped to 0.6.24 - ## [1.17.2](https://github.com/sanity-io/visual-editing/compare/presentation-v1.17.1...presentation-v1.17.2) (2024-10-21) -### Dependencies - -* The following workspace dependencies were updated - * devDependencies - * @repo/visual-editing-helpers bumped to 0.6.23 - ## [1.17.1](https://github.com/sanity-io/visual-editing/compare/presentation-v1.17.0...presentation-v1.17.1) (2024-10-21) @@ -512,8 +432,6 @@ All notable changes to this project will be documented in this file. See * dependencies * @sanity/comlink bumped to 1.0.0 * @sanity/preview-url-secret bumped to 2.0.0 - * devDependencies - * @repo/visual-editing-helpers bumped to 0.6.22 ## [1.16.5](https://github.com/sanity-io/visual-editing/compare/presentation-v1.16.4...presentation-v1.16.5) (2024-09-11) @@ -530,8 +448,6 @@ All notable changes to this project will be documented in this file. See * The following workspace dependencies were updated * dependencies * @sanity/preview-url-secret bumped to 1.6.21 - * devDependencies - * @repo/visual-editing-helpers bumped to 0.6.21 ## [1.16.4](https://github.com/sanity-io/visual-editing/compare/presentation-v1.16.3...presentation-v1.16.4) (2024-08-12) @@ -546,8 +462,6 @@ All notable changes to this project will be documented in this file. See * The following workspace dependencies were updated * dependencies * @sanity/preview-url-secret bumped to 1.6.20 - * devDependencies - * @repo/visual-editing-helpers bumped to 0.6.20 ## [1.16.3](https://github.com/sanity-io/visual-editing/compare/presentation-v1.16.2...presentation-v1.16.3) (2024-08-02) @@ -564,8 +478,6 @@ All notable changes to this project will be documented in this file. See * The following workspace dependencies were updated * dependencies * @sanity/preview-url-secret bumped from ^1.6.18 to ^1.6.19 - * devDependencies - * @repo/visual-editing-helpers bumped from 0.6.18 to 0.6.19 ## [1.16.2](https://github.com/sanity-io/visual-editing/compare/presentation-v1.16.1...presentation-v1.16.2) (2024-07-03) @@ -582,8 +494,6 @@ All notable changes to this project will be documented in this file. See * The following workspace dependencies were updated * dependencies * @sanity/preview-url-secret bumped from ^1.6.17 to ^1.6.18 - * devDependencies - * @repo/visual-editing-helpers bumped from 0.6.17 to 0.6.18 ## [1.16.1](https://github.com/sanity-io/visual-editing/compare/presentation-v1.16.0...presentation-v1.16.1) (2024-06-26) @@ -614,21 +524,9 @@ All notable changes to this project will be documented in this file. See * **presentation:** dedupe search param derived state ([#1646](https://github.com/sanity-io/visual-editing/issues/1646)) ([6f21b7c](https://github.com/sanity-io/visual-editing/commit/6f21b7c6ff1d71b62490d9b05c84ea8118892d06)) -### Dependencies - -* The following workspace dependencies were updated - * devDependencies - * @repo/visual-editing-helpers bumped from 0.6.16 to 0.6.17 - ## [1.15.14](https://github.com/sanity-io/visual-editing/compare/presentation-v1.15.13...presentation-v1.15.14) (2024-06-07) -### Dependencies - -* The following workspace dependencies were updated - * devDependencies - * @repo/visual-editing-helpers bumped from 0.6.15 to 0.6.16 - ## [1.15.13](https://github.com/sanity-io/visual-editing/compare/presentation-v1.15.12...presentation-v1.15.13) (2024-05-31) @@ -649,8 +547,6 @@ All notable changes to this project will be documented in this file. See * The following workspace dependencies were updated * dependencies * @sanity/preview-url-secret bumped from ^1.6.16 to ^1.6.17 - * devDependencies - * @repo/visual-editing-helpers bumped from 0.6.14 to 0.6.15 ## [1.15.11](https://github.com/sanity-io/visual-editing/compare/presentation-v1.15.10...presentation-v1.15.11) (2024-05-29) @@ -679,8 +575,6 @@ All notable changes to this project will be documented in this file. See * The following workspace dependencies were updated * dependencies * @sanity/preview-url-secret bumped from ^1.6.14 to ^1.6.15 - * devDependencies - * @repo/visual-editing-helpers bumped from 0.6.13 to 0.6.14 ## [1.15.9](https://github.com/sanity-io/visual-editing/compare/presentation-v1.15.8...presentation-v1.15.9) (2024-05-27) @@ -695,8 +589,6 @@ All notable changes to this project will be documented in this file. See * The following workspace dependencies were updated * dependencies * @sanity/preview-url-secret bumped from ^1.6.13 to ^1.6.14 - * devDependencies - * @repo/visual-editing-helpers bumped from 0.6.12 to 0.6.13 ## [1.15.8](https://github.com/sanity-io/visual-editing/compare/presentation-v1.15.7...presentation-v1.15.8) (2024-05-21) @@ -739,8 +631,6 @@ All notable changes to this project will be documented in this file. See * The following workspace dependencies were updated * dependencies * @sanity/preview-url-secret bumped from ^1.6.12 to ^1.6.13 - * devDependencies - * @repo/visual-editing-helpers bumped from 0.6.11 to 0.6.12 ## [1.15.3](https://github.com/sanity-io/visual-editing/compare/presentation-v1.15.2...presentation-v1.15.3) (2024-05-14) @@ -757,12 +647,6 @@ All notable changes to this project will be documented in this file. See * **presentation:** remove use of startTransition ([#1496](https://github.com/sanity-io/visual-editing/issues/1496)) ([ca53919](https://github.com/sanity-io/visual-editing/commit/ca539194ba3e0453da8598962d876061329a1454)) -### Dependencies - -* The following workspace dependencies were updated - * devDependencies - * @repo/visual-editing-helpers bumped from 0.6.10 to 0.6.11 - ## [1.15.1](https://github.com/sanity-io/visual-editing/compare/presentation-v1.15.0...presentation-v1.15.1) (2024-05-08) @@ -795,8 +679,6 @@ All notable changes to this project will be documented in this file. See * The following workspace dependencies were updated * dependencies * @sanity/preview-url-secret bumped from ^1.6.11 to ^1.6.12 - * devDependencies - * @repo/visual-editing-helpers bumped from 0.6.9 to 0.6.10 ## [1.13.0](https://github.com/sanity-io/visual-editing/compare/presentation-v1.12.10...presentation-v1.13.0) (2024-04-29) @@ -821,12 +703,6 @@ All notable changes to this project will be documented in this file. See * panels should recover from broken local storage state ([#1412](https://github.com/sanity-io/visual-editing/issues/1412)) ([6c92a9e](https://github.com/sanity-io/visual-editing/commit/6c92a9e3f4a4d2d6fadd8ba774b1be6d18692cee)) -### Dependencies - -* The following workspace dependencies were updated - * devDependencies - * @repo/visual-editing-helpers bumped from 0.6.8 to 0.6.9 - ## [1.12.8](https://github.com/sanity-io/visual-editing/compare/presentation-v1.12.7...presentation-v1.12.8) (2024-04-25) @@ -848,8 +724,6 @@ All notable changes to this project will be documented in this file. See * The following workspace dependencies were updated * dependencies * @sanity/preview-url-secret bumped from ^1.6.10 to ^1.6.11 - * devDependencies - * @repo/visual-editing-helpers bumped from 0.6.7 to 0.6.8 ## [1.12.6](https://github.com/sanity-io/visual-editing/compare/presentation-v1.12.5...presentation-v1.12.6) (2024-04-19) @@ -864,8 +738,6 @@ All notable changes to this project will be documented in this file. See * The following workspace dependencies were updated * dependencies * @sanity/preview-url-secret bumped from ^1.6.9 to ^1.6.10 - * devDependencies - * @repo/visual-editing-helpers bumped from 0.6.6 to 0.6.7 ## [1.12.5](https://github.com/sanity-io/visual-editing/compare/presentation-v1.12.4...presentation-v1.12.5) (2024-04-17) @@ -881,8 +753,6 @@ All notable changes to this project will be documented in this file. See * The following workspace dependencies were updated * dependencies * @sanity/preview-url-secret bumped from ^1.6.8 to ^1.6.9 - * devDependencies - * @repo/visual-editing-helpers bumped from 0.6.5 to 0.6.6 ## [1.12.4](https://github.com/sanity-io/visual-editing/compare/presentation-v1.12.3...presentation-v1.12.4) (2024-04-16) @@ -898,8 +768,6 @@ All notable changes to this project will be documented in this file. See * The following workspace dependencies were updated * dependencies * @sanity/preview-url-secret bumped from ^1.6.7 to ^1.6.8 - * devDependencies - * @repo/visual-editing-helpers bumped from 0.6.4 to 0.6.5 ## [1.12.3](https://github.com/sanity-io/visual-editing/compare/presentation-v1.12.2...presentation-v1.12.3) (2024-04-05) @@ -914,8 +782,6 @@ All notable changes to this project will be documented in this file. See * The following workspace dependencies were updated * dependencies * @sanity/preview-url-secret bumped from ^1.6.6 to ^1.6.7 - * devDependencies - * @sanity/visual-editing-helpers bumped from 0.6.3 to 0.6.4 ## [1.12.2](https://github.com/sanity-io/visual-editing/compare/presentation-v1.12.1...presentation-v1.12.2) (2024-04-05) @@ -930,8 +796,6 @@ All notable changes to this project will be documented in this file. See * The following workspace dependencies were updated * dependencies * @sanity/preview-url-secret bumped from ^1.6.5 to ^1.6.6 - * devDependencies - * @sanity/visual-editing-helpers bumped from 0.6.2 to 0.6.3 ## [1.12.1](https://github.com/sanity-io/visual-editing/compare/presentation-v1.12.0...presentation-v1.12.1) (2024-03-21) @@ -958,8 +822,6 @@ All notable changes to this project will be documented in this file. See * The following workspace dependencies were updated * dependencies * @sanity/preview-url-secret bumped from ^1.6.4 to ^1.6.5 - * devDependencies - * @sanity/visual-editing-helpers bumped from 0.6.1 to 0.6.2 ## [1.11.8](https://github.com/sanity-io/visual-editing/compare/presentation-v1.11.7...presentation-v1.11.8) (2024-03-18) @@ -999,12 +861,6 @@ All notable changes to this project will be documented in this file. See * **presentation:** prevent horizontal scroll on narrow document pane ([#1060](https://github.com/sanity-io/visual-editing/issues/1060)) ([6e02d3e](https://github.com/sanity-io/visual-editing/commit/6e02d3e5d4639d5d1d8b4b422737fd3f6d679b79)) -### Dependencies - -* The following workspace dependencies were updated - * devDependencies - * @sanity/visual-editing-helpers bumped from 0.6.0 to 0.6.1 - ## [1.11.2](https://github.com/sanity-io/visual-editing/compare/presentation-v1.11.1...presentation-v1.11.2) (2024-02-27) @@ -1013,12 +869,6 @@ All notable changes to this project will be documented in this file. See * allow encoding draft ids ([#982](https://github.com/sanity-io/visual-editing/issues/982)) ([637a33d](https://github.com/sanity-io/visual-editing/commit/637a33d8dbfd22fc7a664f0d828cf2450556cc73)) -### Dependencies - -* The following workspace dependencies were updated - * devDependencies - * @sanity/visual-editing-helpers bumped from 0.5.1 to 0.5.2 - ## [1.11.1](https://github.com/sanity-io/visual-editing/compare/presentation-v1.11.0...presentation-v1.11.1) (2024-02-26) @@ -1033,8 +883,6 @@ All notable changes to this project will be documented in this file. See * The following workspace dependencies were updated * dependencies * @sanity/preview-url-secret bumped from ^1.6.3 to ^1.6.4 - * devDependencies - * @sanity/visual-editing-helpers bumped from 0.5.0 to 0.5.1 ## [1.11.0](https://github.com/sanity-io/visual-editing/compare/presentation-v1.10.0...presentation-v1.11.0) (2024-02-23) @@ -1049,12 +897,6 @@ All notable changes to this project will be documented in this file. See * **deps:** Update dependency framer-motion to ^11.0.6 ([#991](https://github.com/sanity-io/visual-editing/issues/991)) ([fbe8d5f](https://github.com/sanity-io/visual-editing/commit/fbe8d5fa20a150470fafc60977d4261fa73c0fc0)) -### Dependencies - -* The following workspace dependencies were updated - * devDependencies - * @sanity/visual-editing-helpers bumped from 0.4.0 to 0.5.0 - ## [1.10.0](https://github.com/sanity-io/visual-editing/compare/presentation-v1.9.1...presentation-v1.10.0) (2024-02-21) @@ -1069,12 +911,6 @@ All notable changes to this project will be documented in this file. See * always show the refresh button ([f985e8d](https://github.com/sanity-io/visual-editing/commit/f985e8decc305e280a410569edbeff9891419e6f)) -### Dependencies - -* The following workspace dependencies were updated - * devDependencies - * @sanity/visual-editing-helpers bumped from 0.3.1 to 0.4.0 - ## [1.9.1](https://github.com/sanity-io/visual-editing/compare/presentation-v1.9.0...presentation-v1.9.1) (2024-02-16) @@ -1089,8 +925,6 @@ All notable changes to this project will be documented in this file. See * The following workspace dependencies were updated * dependencies * @sanity/preview-url-secret bumped from ^1.6.2 to ^1.6.3 - * devDependencies - * @sanity/visual-editing-helpers bumped from 0.3.0 to 0.3.1 ## [1.9.0](https://github.com/sanity-io/visual-editing/compare/presentation-v1.8.2...presentation-v1.9.0) (2024-02-15) @@ -1112,8 +946,6 @@ All notable changes to this project will be documented in this file. See * The following workspace dependencies were updated * dependencies * @sanity/preview-url-secret bumped from ^1.6.1 to ^1.6.2 - * devDependencies - * @sanity/visual-editing-helpers bumped from 0.2.6 to 0.3.0 ## [1.8.2](https://github.com/sanity-io/visual-editing/compare/presentation-v1.8.1...presentation-v1.8.2) (2024-02-08) @@ -1180,8 +1012,6 @@ All notable changes to this project will be documented in this file. See * The following workspace dependencies were updated * dependencies * @sanity/preview-url-secret bumped from ^1.5.4 to ^1.5.5 - * devDependencies - * @sanity/visual-editing-helpers bumped from 0.2.5 to 0.2.6 ## [1.7.1](https://github.com/sanity-io/visual-editing/compare/presentation-v1.7.0...presentation-v1.7.1) (2024-01-26) @@ -1202,8 +1032,6 @@ All notable changes to this project will be documented in this file. See * The following workspace dependencies were updated * dependencies * @sanity/preview-url-secret bumped from ^1.5.3 to ^1.5.4 - * devDependencies - * @sanity/visual-editing-helpers bumped from 0.2.4 to 0.2.5 ## [1.7.0](https://github.com/sanity-io/visual-editing/compare/presentation-v1.6.1...presentation-v1.7.0) (2024-01-22) @@ -1226,8 +1054,6 @@ All notable changes to this project will be documented in this file. See * The following workspace dependencies were updated * dependencies * @sanity/preview-url-secret bumped from ^1.5.2 to ^1.5.3 - * devDependencies - * @sanity/visual-editing-helpers bumped from 0.2.3 to 0.2.4 ## [1.6.0](https://github.com/sanity-io/visual-editing/compare/presentation-v1.5.3...presentation-v1.6.0) (2024-01-16) @@ -1273,8 +1099,6 @@ All notable changes to this project will be documented in this file. See * The following workspace dependencies were updated * dependencies * @sanity/preview-url-secret bumped from ^1.5.0 to ^1.5.1 - * devDependencies - * @sanity/visual-editing-helpers bumped from 0.2.2 to 0.2.3 ## [1.5.1](https://github.com/sanity-io/visual-editing/compare/presentation-v1.5.0...presentation-v1.5.1) (2024-01-10) @@ -1307,8 +1131,6 @@ All notable changes to this project will be documented in this file. See * @sanity/groq-store bumped from 5.3.9 to 5.3.10 * @sanity/preview-url-secret bumped from ^1.4.1 to ^1.5.0 * devDependencies - * @sanity/channels bumped from 0.3.0 to 0.4.0 - * @sanity/visual-editing-helpers bumped from 0.2.1 to 0.2.2 ## [1.4.3](https://github.com/sanity-io/visual-editing/compare/presentation-v1.4.2...presentation-v1.4.3) (2024-01-05) @@ -1347,8 +1169,6 @@ All notable changes to this project will be documented in this file. See * The following workspace dependencies were updated * dependencies * @sanity/groq-store bumped from 5.3.7 to 5.3.8 - * devDependencies - * @sanity/visual-editing-helpers bumped from 0.2.0 to 0.2.1 ## [1.4.0](https://github.com/sanity-io/visual-editing/compare/presentation-v1.3.0...presentation-v1.4.0) (2023-12-19) @@ -1364,8 +1184,6 @@ All notable changes to this project will be documented in this file. See * dependencies * @sanity/groq-store bumped from 5.3.6 to 5.3.7 * @sanity/preview-url-secret bumped from ^1.3.6 to ^1.4.0 - * devDependencies - * @sanity/visual-editing-helpers bumped from 0.1.4 to 0.2.0 ## [1.3.0](https://github.com/sanity-io/visual-editing/compare/presentation-v1.2.3...presentation-v1.3.0) (2023-12-19) @@ -1420,8 +1238,6 @@ All notable changes to this project will be documented in this file. See * @sanity/groq-store bumped from 5.3.4 to 5.3.5 * @sanity/preview-url-secret bumped from ^1.3.3 to ^1.3.4 * devDependencies - * @sanity/channels bumped from 0.1.0 to 0.2.0 - * @sanity/visual-editing-helpers bumped from 0.1.3 to 0.1.4 ## [1.1.5](https://github.com/sanity-io/visual-editing/compare/presentation-v1.1.4...presentation-v1.1.5) (2023-12-08) @@ -1456,8 +1272,6 @@ All notable changes to this project will be documented in this file. See * dependencies * @sanity/groq-store bumped from 5.3.2 to 5.3.3 * @sanity/preview-url-secret bumped from ^1.3.1 to ^1.3.2 - * devDependencies - * @sanity/visual-editing-helpers bumped from 0.1.1 to 0.1.2 ## [1.1.2](https://github.com/sanity-io/visual-editing/compare/presentation-v1.1.1...presentation-v1.1.2) (2023-12-05) @@ -1475,8 +1289,6 @@ All notable changes to this project will be documented in this file. See * @sanity/groq-store bumped from 5.3.0 to 5.3.1 * @sanity/preview-url-secret bumped from ^1.3.0 to ^1.3.1 * devDependencies - * @sanity/channels bumped to 0.1.0 - * @sanity/visual-editing-helpers bumped to 0.1.0 ## [1.1.1](https://github.com/sanity-io/visual-editing/compare/presentation-v1.1.0...presentation-v1.1.1) (2023-12-05) @@ -2022,7 +1834,6 @@ All notable changes to this project will be documented in this file. See * **deps:** Update sanity monorepo to v3.18.2-pink-lizard.172 ([#233](https://github.com/sanity-io/visual-editing/issues/233)) ([c5e6c5d](https://github.com/sanity-io/visual-editing/commit/c5e6c5d48f6d1c6b17d97e3845e3da751aef9918)) * listen to document changes directly ([213159e](https://github.com/sanity-io/visual-editing/commit/213159e164f721b316a0cee3f724d1378652a95a)) * load src directly ([94308f0](https://github.com/sanity-io/visual-editing/commit/94308f0ba815d89347c7201eb759cc0ba6e2bbf7)) -* move `@sanity/csm` into `visual-editing-helpers` ([257a4ad](https://github.com/sanity-io/visual-editing/commit/257a4adf64dcd74cbf435b883995c6f5b8730c25)) * prepare release ([f2ce9cb](https://github.com/sanity-io/visual-editing/commit/f2ce9cb4046df2cb7581e66fcad3a5c0631778ae)) ## [0.5.0-pink-lizard](https://github.com/sanity-io/visual-editing/compare/presentation-v0.5.0-pink-lizard...presentation-v0.5.0-pink-lizard) (2023-11-01) diff --git a/packages/presentation/package.json b/packages/presentation/package.json index 5c1cc1e17..1c669c337 100644 --- a/packages/presentation/package.json +++ b/packages/presentation/package.json @@ -49,10 +49,11 @@ }, "dependencies": { "@sanity/client": "^6.24.3", - "@sanity/comlink": "workspace:*", + "@sanity/comlink": "workspace:^", "@sanity/icons": "^3.5.7", "@sanity/logos": "^2.1.13", - "@sanity/preview-url-secret": "workspace:*", + "@sanity/presentation-comlink": "workspace:^", + "@sanity/preview-url-secret": "workspace:^", "@sanity/ui": "^2.11.2", "@sanity/uuid": "3.0.2", "fast-deep-equal": "3.1.3", @@ -70,8 +71,8 @@ "@repo/eslint-config": "workspace:*", "@repo/package.config": "workspace:*", "@repo/prettier-config": "workspace:*", - "@repo/visual-editing-helpers": "workspace:*", "@sanity/pkg-utils": "6.13.4", + "@sanity/visual-editing-csm": "workspace:*", "@types/lodash": "^4.17.14", "babel-plugin-react-compiler": "19.0.0-beta-e552027-20250112", "eslint": "^8.57.1", diff --git a/packages/presentation/src/PresentationTool.tsx b/packages/presentation/src/PresentationTool.tsx index 58143a685..b47c555d2 100644 --- a/packages/presentation/src/PresentationTool.tsx +++ b/packages/presentation/src/PresentationTool.tsx @@ -1,11 +1,3 @@ -import { - createCompatibilityActors, - isAltKey, - isHotkey, - type PreviewKitNodeMsg, - type VisualEditingControllerMsg, - type VisualEditingNodeMsg, -} from '@repo/visual-editing-helpers' import {studioPath} from '@sanity/client/csm' import { createConnectionMachine, @@ -13,6 +5,12 @@ import { type Controller, type Message, } from '@sanity/comlink' +import { + createCompatibilityActors, + type PreviewKitNodeMsg, + type VisualEditingControllerMsg, + type VisualEditingNodeMsg, +} from '@sanity/presentation-comlink' import { urlSearchParamVercelProtectionBypass, urlSearchParamVercelSetBypassCookie, @@ -635,3 +633,24 @@ export default function PresentationTool(props: { ) } + +function isAltKey(event: KeyboardEvent): boolean { + return event.key === 'Alt' +} + +const IS_MAC = + typeof window != 'undefined' && /Mac|iPod|iPhone|iPad/.test(window.navigator.platform) +const MODIFIERS: Record = { + alt: 'altKey', + ctrl: 'ctrlKey', + mod: IS_MAC ? 'metaKey' : 'ctrlKey', + shift: 'shiftKey', +} +function isHotkey(keys: string[], event: KeyboardEvent): boolean { + return keys.every((key) => { + if (MODIFIERS[key]) { + return event[MODIFIERS[key]] + } + return event.key === key.toUpperCase() + }) +} diff --git a/packages/presentation/src/editor/PostMessagePreviewSnapshots.tsx b/packages/presentation/src/editor/PostMessagePreviewSnapshots.tsx index eebb53763..bfd4516d9 100644 --- a/packages/presentation/src/editor/PostMessagePreviewSnapshots.tsx +++ b/packages/presentation/src/editor/PostMessagePreviewSnapshots.tsx @@ -1,5 +1,5 @@ -import type {PreviewSnapshot} from '@repo/visual-editing-helpers' import type {ClientPerspective} from '@sanity/client' +import type {PreviewSnapshot} from '@sanity/presentation-comlink' import {memo, useEffect, useMemo, useRef, type FC} from 'react' import { combineLatest, diff --git a/packages/presentation/src/index.ts b/packages/presentation/src/index.ts index 327bc6162..93040bd4e 100644 --- a/packages/presentation/src/index.ts +++ b/packages/presentation/src/index.ts @@ -50,4 +50,4 @@ export type { SerializableArray, SerializableObject, SerializablePrimitive, -} from '@repo/visual-editing-helpers' +} from '@sanity/presentation-comlink' diff --git a/packages/presentation/src/lib/parse.ts b/packages/presentation/src/lib/parse.ts index 0cf8ce3cc..dd108c0cb 100644 --- a/packages/presentation/src/lib/parse.ts +++ b/packages/presentation/src/lib/parse.ts @@ -1,5 +1,5 @@ -import {urlStringToPath} from '@repo/visual-editing-helpers' import {studioPath} from '@sanity/client/csm' +import {urlStringToPath} from '@sanity/visual-editing-csm' import type {PresentationStateParams} from '../types' export function parseId(rawId: string | undefined): string | undefined { diff --git a/packages/presentation/src/loader/LiveQueries.tsx b/packages/presentation/src/loader/LiveQueries.tsx index 0a1f09b5e..c65441cae 100644 --- a/packages/presentation/src/loader/LiveQueries.tsx +++ b/packages/presentation/src/loader/LiveQueries.tsx @@ -1,10 +1,3 @@ -import { - createCompatibilityActors, - getQueryCacheKey, - type LoaderControllerMsg, - type LoaderNodeMsg, -} from '@repo/visual-editing-helpers' -import {useQueryParams, useRevalidate} from '@repo/visual-editing-helpers/hooks' import { createClient, type ClientPerspective, @@ -20,6 +13,11 @@ import { type Controller, type StatusEvent, } from '@sanity/comlink' +import { + createCompatibilityActors, + type LoaderControllerMsg, + type LoaderNodeMsg, +} from '@sanity/presentation-comlink' import isEqual from 'fast-deep-equal' // import {createPreviewSecret} from '@sanity/preview-url-secret/create-secret' import {memo, useDeferredValue, useEffect, useMemo, useState} from 'react' @@ -41,6 +39,7 @@ import type { PresentationPerspective, } from '../types' import type {DocumentOnPage} from '../useDocumentsOnPage' +import {useQueryParams, useRevalidate} from './utils' export interface LoaderQueriesProps { liveDocument: Partial | null | undefined @@ -483,3 +482,7 @@ export function turboChargeResultIfSourceMap( perspective, ) } + +function getQueryCacheKey(query: string, params: QueryParams | string): `${string}-${string}` { + return `${query}-${typeof params === 'string' ? params : JSON.stringify(params)}` +} diff --git a/packages/presentation/src/loader/LoaderQueries.tsx b/packages/presentation/src/loader/LoaderQueries.tsx index c45900d99..b876540fc 100644 --- a/packages/presentation/src/loader/LoaderQueries.tsx +++ b/packages/presentation/src/loader/LoaderQueries.tsx @@ -1,10 +1,3 @@ -import { - createCompatibilityActors, - getQueryCacheKey, - type LoaderControllerMsg, - type LoaderNodeMsg, -} from '@repo/visual-editing-helpers' -import {useQueryParams, useRevalidate} from '@repo/visual-editing-helpers/hooks' import type { ClientConfig, ClientPerspective, @@ -19,6 +12,11 @@ import { type Controller, type StatusEvent, } from '@sanity/comlink' +import { + createCompatibilityActors, + type LoaderControllerMsg, + type LoaderNodeMsg, +} from '@sanity/presentation-comlink' import {applyPatch} from 'mendoza' import LRUCache from 'mnemonist/lru-cache-with-delete' import {memo, useEffect, useMemo, useState} from 'react' @@ -42,6 +40,7 @@ import type { PresentationPerspective, } from '../types' import type {DocumentOnPage} from '../useDocumentsOnPage' +import {useQueryParams, useRevalidate} from './utils' export interface LoaderQueriesProps { liveDocument: Partial | null | undefined @@ -550,3 +549,7 @@ export function turboChargeResultIfSourceMap( perspective, ) } + +function getQueryCacheKey(query: string, params: QueryParams | string): `${string}-${string}` { + return `${query}-${typeof params === 'string' ? params : JSON.stringify(params)}` +} diff --git a/packages/presentation/src/loader/utils.ts b/packages/presentation/src/loader/utils.ts index 696fff008..46c56b6f4 100644 --- a/packages/presentation/src/loader/utils.ts +++ b/packages/presentation/src/loader/utils.ts @@ -1,4 +1,5 @@ import type {ClientPerspective, QueryParams} from '@sanity/client' +import {useCallback, useEffect, useMemo, useState, useSyncExternalStore} from 'react' /** * @internal @@ -14,3 +15,124 @@ export function getQueryCacheKey( ): QueryCacheKey { return `${perspective}-${query}-${JSON.stringify(params)}` } + +/** + * Return params that are stable with deep equal as long as the key order is the same + * @internal + */ +export function useQueryParams(params?: undefined | null | QueryParams): QueryParams { + const stringifiedParams = useMemo(() => JSON.stringify(params || {}), [params]) + return useMemo(() => JSON.parse(stringifiedParams) as QueryParams, [stringifiedParams]) +} + +/** + * 'hit' - the cache is fresh and valid + * 'stale' - the cache should revalidate, but can't/shouldn't yet (offline, visibility = hidden) + * 'refresh' - stale cache, and now is a great time to start refreshing + * 'inflight' - refreshing cache, revalidate events should be ignored + */ +export type RevalidateState = 'hit' | 'stale' | 'refresh' | 'inflight' +/** + * Keeps track of when queries should revalidate + */ +export function useRevalidate(props: { + /** + * How frequently queries should be refetched in the background to refresh the parts of queries that can't be source mapped. + * Setting it to `0` will disable background refresh. + */ + refreshInterval: number +}): [RevalidateState, () => () => void] { + const {refreshInterval} = props + + const shouldPause = useShouldPause() + const [state, setState] = useState('hit') + + // Keep track of indicators for when revalidation should be 'paused' + // Like if we're currently offline, or the document isn't visible + // Basically if 'stale' and all good we return 'refresh' + + // Next keep track of staleness itself. If we come back online, on a windows focus event + // or on a refreshInterval timeout + // Basically it controls if cache should be 'hit' or 'stale' + + // How to handle refresh to inflight? + + const startRefresh = useCallback(() => { + setState('inflight') + return () => setState('hit') + }, []) + + // Revalidate on refreshInterval + useEffect(() => { + // If refreshInterval is nullish then we don't want to refresh. + // Inflight means it's already refreshing and we pause the countdown. + // It's only necessary to start the countdown if the cache isn't already stale + if (!refreshInterval || state !== 'hit') { + return + } + const timeout = setTimeout(() => setState('stale'), refreshInterval) + return () => clearTimeout(timeout) + }, [refreshInterval, state]) + // Revalidate on windows focus + useEffect(() => { + if (state !== 'hit') { + return + } + const onFocus = () => setState('stale') + window.addEventListener('focus', onFocus) + return () => window.removeEventListener('focus', onFocus) + }, [refreshInterval, state]) + // Revalidate on changes to shouldPause + useEffect(() => { + // Mark as stale pre-emptively if we're offline or the document isn't visible + if (shouldPause && state === 'hit') { + setState('stale') + } + // If not paused we can mark stale as ready for refresh + if (!shouldPause && state === 'stale') { + setState('refresh') + } + }, [shouldPause, state]) + + return [state, startRefresh] +} + +/** + * Keeps track of when revalidation and activities should be paused + */ +function useShouldPause(): boolean { + const [online, setOnline] = useState(false) + useEffect(() => { + setOnline(navigator.onLine) + const online = () => setOnline(true) + const offline = () => setOnline(false) + window.addEventListener('online', online) + window.addEventListener('offline', offline) + return () => { + window.removeEventListener('online', online) + window.removeEventListener('offline', offline) + } + }, []) + const visibilityState = useSyncExternalStore( + onVisibilityChange, + () => document.visibilityState, + () => 'hidden' satisfies DocumentVisibilityState, + ) + + // Should pause activity when offline + if (!online) { + return true + } + + // Should pause when the document isn't visible, as it's likely the user isn't looking at the page + if (visibilityState === 'hidden') { + return true + } + + return false +} + +function onVisibilityChange(onStoreChange: () => void): () => void { + document.addEventListener('visibilitychange', onStoreChange) + return () => document.removeEventListener('visibilitychange', onStoreChange) +} diff --git a/packages/presentation/src/overlays/SharedStateContext.tsx b/packages/presentation/src/overlays/SharedStateContext.tsx index 10513af8e..5a72f2124 100644 --- a/packages/presentation/src/overlays/SharedStateContext.tsx +++ b/packages/presentation/src/overlays/SharedStateContext.tsx @@ -1,4 +1,4 @@ -import type {Serializable} from '@repo/visual-editing-helpers' +import type {Serializable} from '@sanity/presentation-comlink' import {createContext} from 'react' export interface SharedStateContextValue { diff --git a/packages/presentation/src/overlays/SharedStateProvider.tsx b/packages/presentation/src/overlays/SharedStateProvider.tsx index 1b12dbb79..bf641e520 100644 --- a/packages/presentation/src/overlays/SharedStateProvider.tsx +++ b/packages/presentation/src/overlays/SharedStateProvider.tsx @@ -1,4 +1,4 @@ -import type {Serializable, SerializableObject} from '@repo/visual-editing-helpers' +import type {Serializable, SerializableObject} from '@sanity/presentation-comlink' import { useCallback, useEffect, diff --git a/packages/presentation/src/overlays/schema/PostMessageSchema.tsx b/packages/presentation/src/overlays/schema/PostMessageSchema.tsx index 2851ea07e..5de08b0b0 100644 --- a/packages/presentation/src/overlays/schema/PostMessageSchema.tsx +++ b/packages/presentation/src/overlays/schema/PostMessageSchema.tsx @@ -1,5 +1,5 @@ -import type {UnresolvedPath} from '@repo/visual-editing-helpers' import type {ClientPerspective} from '@sanity/client' +import type {UnresolvedPath} from '@sanity/presentation-comlink' import {useRootTheme} from '@sanity/ui' import {memo, useEffect} from 'react' import {API_VERSION} from '../../constants' diff --git a/packages/presentation/src/overlays/schema/extract.ts b/packages/presentation/src/overlays/schema/extract.ts index b64651227..2bbb597f6 100644 --- a/packages/presentation/src/overlays/schema/extract.ts +++ b/packages/presentation/src/overlays/schema/extract.ts @@ -1,4 +1,5 @@ import type { + InsertMenuOptions, SchemaArrayNode, SchemaBooleanNode, SchemaInlineNode, @@ -13,8 +14,7 @@ import type { SchemaUnionNodeOptions, SchemaUnionOption, SchemaUnknownNode, -} from '@repo/visual-editing-helpers' -import type {InsertMenuOptions} from '@sanity/insert-menu' +} from '@sanity/presentation-comlink' import type { ArraySchemaType, NumberSchemaType, diff --git a/packages/presentation/src/overlays/useSharedState.ts b/packages/presentation/src/overlays/useSharedState.ts index 4a3200209..aa5776735 100644 --- a/packages/presentation/src/overlays/useSharedState.ts +++ b/packages/presentation/src/overlays/useSharedState.ts @@ -1,4 +1,4 @@ -import type {Serializable} from '@repo/visual-editing-helpers' +import type {Serializable} from '@sanity/presentation-comlink' import {useContext, useEffect} from 'react' import {SharedStateContext} from './SharedStateContext' diff --git a/packages/presentation/src/types.ts b/packages/presentation/src/types.ts index 1889b5d25..f5b0d554f 100644 --- a/packages/presentation/src/types.ts +++ b/packages/presentation/src/types.ts @@ -1,11 +1,11 @@ +import type {ClientPerspective, QueryParams} from '@sanity/client' +import type {ChannelInstance} from '@sanity/comlink' import type { LoaderControllerMsg, LoaderNodeMsg, VisualEditingControllerMsg, VisualEditingNodeMsg, -} from '@repo/visual-editing-helpers' -import type {ClientPerspective, QueryParams} from '@sanity/client' -import type {ChannelInstance} from '@sanity/comlink' +} from '@sanity/presentation-comlink' import type { PreviewUrlResolver, PreviewUrlResolverOptions, diff --git a/packages/presentation/tsconfig.json b/packages/presentation/tsconfig.json index d41cbc9bf..a7a9a9d37 100644 --- a/packages/presentation/tsconfig.json +++ b/packages/presentation/tsconfig.json @@ -2,15 +2,13 @@ "extends": "./tsconfig.base", "compilerOptions": { "paths": { - "@sanity/preview-url-secret": ["./node_modules/@sanity/preview-url-secret/src"], - "@repo/visual-editing-helpers": ["./node_modules/@repo/visual-editing-helpers/src"] + "@sanity/preview-url-secret": ["./node_modules/@sanity/preview-url-secret/src"] } }, "include": [ "**/*.ts", "**/*.tsx", - "./node_modules/@sanity/preview-url-secret/src", - "./node_modules/@repo/visual-editing-helpers/src" + "./node_modules/@sanity/preview-url-secret/src" ], "exclude": ["dist", "node_modules"] } diff --git a/packages/preview-kit-compat/CHANGELOG.md b/packages/preview-kit-compat/CHANGELOG.md index 4535fbc3b..b8ef078fa 100644 --- a/packages/preview-kit-compat/CHANGELOG.md +++ b/packages/preview-kit-compat/CHANGELOG.md @@ -6,45 +6,9 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. -### Dependencies - -* The following workspace dependencies were updated - * devDependencies - * @sanity/visual-editing-helpers bumped from 0.3.1 to 0.4.0 - -### Dependencies - -* The following workspace dependencies were updated - * devDependencies - * @sanity/visual-editing-helpers bumped from 0.4.0 to 0.5.0 - -### Dependencies - -* The following workspace dependencies were updated - * devDependencies - * @sanity/visual-editing-helpers bumped from 0.5.1 to 0.5.2 - -### Dependencies - -* The following workspace dependencies were updated - * devDependencies - * @sanity/visual-editing-helpers bumped from 0.5.2 to 0.6.0 - -### Dependencies - -* The following workspace dependencies were updated - * devDependencies - * @sanity/visual-editing-helpers bumped from 0.6.0 to 0.6.1 - ## [1.5.32](https://github.com/sanity-io/visual-editing/compare/preview-kit-compat-v1.5.31...preview-kit-compat-v1.5.32) (2025-01-14) -### Dependencies - -* The following workspace dependencies were updated - * devDependencies - * @repo/visual-editing-helpers bumped to 0.7.14 - ## [1.5.31](https://github.com/sanity-io/visual-editing/compare/preview-kit-compat-v1.5.30...preview-kit-compat-v1.5.31) (2025-01-09) @@ -53,8 +17,6 @@ All notable changes to this project will be documented in this file. See * The following workspace dependencies were updated * dependencies * @sanity/comlink bumped to 3.0.0 - * devDependencies - * @repo/visual-editing-helpers bumped to 0.7.13 ## [1.5.30](https://github.com/sanity-io/visual-editing/compare/preview-kit-compat-v1.5.29...preview-kit-compat-v1.5.30) (2025-01-09) @@ -69,8 +31,6 @@ All notable changes to this project will be documented in this file. See * The following workspace dependencies were updated * dependencies * @sanity/comlink bumped to 2.0.5 - * devDependencies - * @repo/visual-editing-helpers bumped to 0.7.12 ## [1.5.29](https://github.com/sanity-io/visual-editing/compare/preview-kit-compat-v1.5.28...preview-kit-compat-v1.5.29) (2025-01-06) @@ -80,8 +40,6 @@ All notable changes to this project will be documented in this file. See * The following workspace dependencies were updated * dependencies * @sanity/comlink bumped to 2.0.4 - * devDependencies - * @repo/visual-editing-helpers bumped to 0.7.11 ## [1.5.28](https://github.com/sanity-io/visual-editing/compare/preview-kit-compat-v1.5.27...preview-kit-compat-v1.5.28) (2024-12-21) @@ -96,18 +54,10 @@ All notable changes to this project will be documented in this file. See * The following workspace dependencies were updated * dependencies * @sanity/comlink bumped to 2.0.3 - * devDependencies - * @repo/visual-editing-helpers bumped to 0.7.10 ## [1.5.27](https://github.com/sanity-io/visual-editing/compare/preview-kit-compat-v1.5.26...preview-kit-compat-v1.5.27) (2024-12-16) -### Dependencies - -* The following workspace dependencies were updated - * devDependencies - * @repo/visual-editing-helpers bumped to 0.7.9 - ## [1.5.26](https://github.com/sanity-io/visual-editing/compare/preview-kit-compat-v1.5.25...preview-kit-compat-v1.5.26) (2024-12-16) @@ -116,8 +66,6 @@ All notable changes to this project will be documented in this file. See * The following workspace dependencies were updated * dependencies * @sanity/comlink bumped to 2.0.2 - * devDependencies - * @repo/visual-editing-helpers bumped to 0.7.8 ## [1.5.25](https://github.com/sanity-io/visual-editing/compare/preview-kit-compat-v1.5.24...preview-kit-compat-v1.5.25) (2024-12-05) @@ -127,8 +75,6 @@ All notable changes to this project will be documented in this file. See * The following workspace dependencies were updated * dependencies * @sanity/comlink bumped to 2.0.1 - * devDependencies - * @repo/visual-editing-helpers bumped to 0.7.7 ## [1.5.24](https://github.com/sanity-io/visual-editing/compare/preview-kit-compat-v1.5.23...preview-kit-compat-v1.5.24) (2024-12-02) @@ -138,12 +84,6 @@ All notable changes to this project will be documented in this file. See * **deps:** update dependency @sanity/client to ^6.23.0 ([#2244](https://github.com/sanity-io/visual-editing/issues/2244)) ([eeacde8](https://github.com/sanity-io/visual-editing/commit/eeacde893e6534b14344581456e3e2147b84f75b)) -### Dependencies - -* The following workspace dependencies were updated - * devDependencies - * @repo/visual-editing-helpers bumped to 0.7.6 - ## [1.5.23](https://github.com/sanity-io/visual-editing/compare/preview-kit-compat-v1.5.22...preview-kit-compat-v1.5.23) (2024-11-28) @@ -152,8 +92,6 @@ All notable changes to this project will be documented in this file. See * The following workspace dependencies were updated * dependencies * @sanity/comlink bumped to 2.0.0 - * devDependencies - * @repo/visual-editing-helpers bumped to 0.7.5 ## [1.5.22](https://github.com/sanity-io/visual-editing/compare/preview-kit-compat-v1.5.21...preview-kit-compat-v1.5.22) (2024-11-26) @@ -163,8 +101,6 @@ All notable changes to this project will be documented in this file. See * The following workspace dependencies were updated * dependencies * @sanity/comlink bumped to 1.1.4 - * devDependencies - * @repo/visual-editing-helpers bumped to 0.7.4 ## [1.5.21](https://github.com/sanity-io/visual-editing/compare/preview-kit-compat-v1.5.20...preview-kit-compat-v1.5.21) (2024-11-19) @@ -174,12 +110,6 @@ All notable changes to this project will be documented in this file. See * **deps:** update dependency @sanity/client to ^6.22.5 ([#2185](https://github.com/sanity-io/visual-editing/issues/2185)) ([da0aa32](https://github.com/sanity-io/visual-editing/commit/da0aa328063f1711687f8459ca00fd95a0b69ccb)) -### Dependencies - -* The following workspace dependencies were updated - * devDependencies - * @repo/visual-editing-helpers bumped to 0.7.3 - ## [1.5.20](https://github.com/sanity-io/visual-editing/compare/preview-kit-compat-v1.5.19...preview-kit-compat-v1.5.20) (2024-11-14) @@ -188,8 +118,6 @@ All notable changes to this project will be documented in this file. See * The following workspace dependencies were updated * dependencies * @sanity/comlink bumped to 1.1.3 - * devDependencies - * @repo/visual-editing-helpers bumped to 0.7.2 ## [1.5.19](https://github.com/sanity-io/visual-editing/compare/preview-kit-compat-v1.5.18...preview-kit-compat-v1.5.19) (2024-11-12) @@ -199,8 +127,6 @@ All notable changes to this project will be documented in this file. See * The following workspace dependencies were updated * dependencies * @sanity/comlink bumped to 1.1.2 - * devDependencies - * @repo/visual-editing-helpers bumped to 0.7.1 ## [1.5.18](https://github.com/sanity-io/visual-editing/compare/preview-kit-compat-v1.5.17...preview-kit-compat-v1.5.18) (2024-11-12) @@ -210,12 +136,6 @@ All notable changes to this project will be documented in this file. See * **deps:** update dependency @sanity/client to ^6.22.4 ([#2132](https://github.com/sanity-io/visual-editing/issues/2132)) ([4f96d9a](https://github.com/sanity-io/visual-editing/commit/4f96d9a539094173caf1644a67f168492f3a35c4)) -### Dependencies - -* The following workspace dependencies were updated - * devDependencies - * @repo/visual-editing-helpers bumped to 0.7.0 - ## [1.5.17](https://github.com/sanity-io/visual-editing/compare/preview-kit-compat-v1.5.16...preview-kit-compat-v1.5.17) (2024-11-06) @@ -224,30 +144,12 @@ All notable changes to this project will be documented in this file. See * **deps:** update dependency @sanity/client to ^6.22.3 ([0b78719](https://github.com/sanity-io/visual-editing/commit/0b7871937422d0d8dfe7851bd1603141f0c434c4)) -### Dependencies - -* The following workspace dependencies were updated - * devDependencies - * @repo/visual-editing-helpers bumped to 0.6.30 - ## [1.5.16](https://github.com/sanity-io/visual-editing/compare/preview-kit-compat-v1.5.15...preview-kit-compat-v1.5.16) (2024-11-04) -### Dependencies - -* The following workspace dependencies were updated - * devDependencies - * @repo/visual-editing-helpers bumped to 0.6.29 - ## [1.5.15](https://github.com/sanity-io/visual-editing/compare/preview-kit-compat-v1.5.14...preview-kit-compat-v1.5.15) (2024-10-28) -### Dependencies - -* The following workspace dependencies were updated - * devDependencies - * @repo/visual-editing-helpers bumped to 0.6.28 - ## [1.5.14](https://github.com/sanity-io/visual-editing/compare/preview-kit-compat-v1.5.13...preview-kit-compat-v1.5.14) (2024-10-24) @@ -256,8 +158,6 @@ All notable changes to this project will be documented in this file. See * The following workspace dependencies were updated * dependencies * @sanity/comlink bumped to 1.1.1 - * devDependencies - * @repo/visual-editing-helpers bumped to 0.6.27 ## [1.5.13](https://github.com/sanity-io/visual-editing/compare/preview-kit-compat-v1.5.12...preview-kit-compat-v1.5.13) (2024-10-24) @@ -267,18 +167,10 @@ All notable changes to this project will be documented in this file. See * The following workspace dependencies were updated * dependencies * @sanity/comlink bumped to 1.1.0 - * devDependencies - * @repo/visual-editing-helpers bumped to 0.6.26 ## [1.5.12](https://github.com/sanity-io/visual-editing/compare/preview-kit-compat-v1.5.11...preview-kit-compat-v1.5.12) (2024-10-23) -### Dependencies - -* The following workspace dependencies were updated - * devDependencies - * @repo/visual-editing-helpers bumped to 0.6.25 - ## [1.5.11](https://github.com/sanity-io/visual-editing/compare/preview-kit-compat-v1.5.10...preview-kit-compat-v1.5.11) (2024-10-23) @@ -294,21 +186,9 @@ All notable changes to this project will be documented in this file. See * stop inlining rxjs and `@sanity/comlink` ([#2012](https://github.com/sanity-io/visual-editing/issues/2012)) ([8df6708](https://github.com/sanity-io/visual-editing/commit/8df670861f40a762684f936fb968e3fbde4f63ba)) -### Dependencies - -* The following workspace dependencies were updated - * devDependencies - * @repo/visual-editing-helpers bumped to 0.6.24 - ## [1.5.9](https://github.com/sanity-io/visual-editing/compare/preview-kit-compat-v1.5.8...preview-kit-compat-v1.5.9) (2024-10-21) -### Dependencies - -* The following workspace dependencies were updated - * devDependencies - * @repo/visual-editing-helpers bumped to 0.6.23 - ## [1.5.8](https://github.com/sanity-io/visual-editing/compare/preview-kit-compat-v1.5.7...preview-kit-compat-v1.5.8) (2024-10-21) @@ -321,8 +201,6 @@ All notable changes to this project will be documented in this file. See ### Dependencies * The following workspace dependencies were updated - * devDependencies - * @repo/visual-editing-helpers bumped to 0.6.22 * @sanity/comlink bumped to 1.0.0 ## [1.5.7](https://github.com/sanity-io/visual-editing/compare/preview-kit-compat-v1.5.6...preview-kit-compat-v1.5.7) (2024-09-11) @@ -333,12 +211,6 @@ All notable changes to this project will be documented in this file. See * **deps:** update dependency @sanity/client to ^6.21.3 ([#1793](https://github.com/sanity-io/visual-editing/issues/1793)) ([1dc1b1b](https://github.com/sanity-io/visual-editing/commit/1dc1b1b9222e6a2f36d6b807415dc1a9b0a2426a)) -### Dependencies - -* The following workspace dependencies were updated - * devDependencies - * @repo/visual-editing-helpers bumped to 0.6.21 - ## [1.5.6](https://github.com/sanity-io/visual-editing/compare/preview-kit-compat-v1.5.5...preview-kit-compat-v1.5.6) (2024-08-12) @@ -347,12 +219,6 @@ All notable changes to this project will be documented in this file. See * **deps:** update dependency @sanity/client to v6.21.2 ([#1749](https://github.com/sanity-io/visual-editing/issues/1749)) ([b9efdd2](https://github.com/sanity-io/visual-editing/commit/b9efdd2a672fdef518bc22a29a25992c938ba1ef)) -### Dependencies - -* The following workspace dependencies were updated - * devDependencies - * @repo/visual-editing-helpers bumped to 0.6.20 - ## [1.5.5](https://github.com/sanity-io/visual-editing/compare/preview-kit-compat-v1.5.4...preview-kit-compat-v1.5.5) (2024-08-02) @@ -361,12 +227,6 @@ All notable changes to this project will be documented in this file. See * **deps:** update dependency @sanity/client to v6.21.1 ([#1704](https://github.com/sanity-io/visual-editing/issues/1704)) ([32f1ef8](https://github.com/sanity-io/visual-editing/commit/32f1ef8582134a130d6325320274a981217ee2e8)) -### Dependencies - -* The following workspace dependencies were updated - * devDependencies - * @repo/visual-editing-helpers bumped from 0.6.18 to 0.6.19 - ## [1.5.4](https://github.com/sanity-io/visual-editing/compare/preview-kit-compat-v1.5.3...preview-kit-compat-v1.5.4) (2024-07-03) @@ -375,30 +235,12 @@ All notable changes to this project will be documented in this file. See * **deps:** update dependency @sanity/client to v6.20.1 ([#1680](https://github.com/sanity-io/visual-editing/issues/1680)) ([bb89688](https://github.com/sanity-io/visual-editing/commit/bb8968816838a60a32242ce803a3ef804f2f885e)) -### Dependencies - -* The following workspace dependencies were updated - * devDependencies - * @repo/visual-editing-helpers bumped from 0.6.17 to 0.6.18 - ## [1.5.3](https://github.com/sanity-io/visual-editing/compare/preview-kit-compat-v1.5.2...preview-kit-compat-v1.5.3) (2024-06-13) -### Dependencies - -* The following workspace dependencies were updated - * devDependencies - * @repo/visual-editing-helpers bumped from 0.6.16 to 0.6.17 - ## [1.5.2](https://github.com/sanity-io/visual-editing/compare/preview-kit-compat-v1.5.1...preview-kit-compat-v1.5.2) (2024-06-07) -### Dependencies - -* The following workspace dependencies were updated - * devDependencies - * @repo/visual-editing-helpers bumped from 0.6.15 to 0.6.16 - ## [1.5.1](https://github.com/sanity-io/visual-editing/compare/preview-kit-compat-v1.5.0...preview-kit-compat-v1.5.1) (2024-05-30) @@ -407,12 +249,6 @@ All notable changes to this project will be documented in this file. See * **deps:** update dependency @sanity/client to v6.19.1 ([#1602](https://github.com/sanity-io/visual-editing/issues/1602)) ([ebaa50c](https://github.com/sanity-io/visual-editing/commit/ebaa50ca0bf6f6324819a9b3ceb85eb1326d7d72)) -### Dependencies - -* The following workspace dependencies were updated - * devDependencies - * @repo/visual-editing-helpers bumped from 0.6.14 to 0.6.15 - ## [1.5.0](https://github.com/sanity-io/visual-editing/compare/preview-kit-compat-v1.4.25...preview-kit-compat-v1.5.0) (2024-05-29) @@ -428,12 +264,6 @@ All notable changes to this project will be documented in this file. See * **deps:** update dependency @sanity/client to v6.19.0 ([#1575](https://github.com/sanity-io/visual-editing/issues/1575)) ([f0094a1](https://github.com/sanity-io/visual-editing/commit/f0094a1ee716f856cc424f82bc68ca2b99881575)) -### Dependencies - -* The following workspace dependencies were updated - * devDependencies - * @repo/visual-editing-helpers bumped from 0.6.13 to 0.6.14 - ## [1.4.24](https://github.com/sanity-io/visual-editing/compare/preview-kit-compat-v1.4.23...preview-kit-compat-v1.4.24) (2024-05-27) @@ -442,12 +272,6 @@ All notable changes to this project will be documented in this file. See * **deps:** update dependency @sanity/client to v6.18.3 ([#1563](https://github.com/sanity-io/visual-editing/issues/1563)) ([609a3b1](https://github.com/sanity-io/visual-editing/commit/609a3b1ad00b0809ba1f926328cee4d082668bf1)) -### Dependencies - -* The following workspace dependencies were updated - * devDependencies - * @repo/visual-editing-helpers bumped from 0.6.12 to 0.6.13 - ## [1.4.23](https://github.com/sanity-io/visual-editing/compare/preview-kit-compat-v1.4.22...preview-kit-compat-v1.4.23) (2024-05-15) @@ -456,21 +280,9 @@ All notable changes to this project will be documented in this file. See * **deps:** update dependency @sanity/client to v6.18.2 ([#1519](https://github.com/sanity-io/visual-editing/issues/1519)) ([78c387e](https://github.com/sanity-io/visual-editing/commit/78c387eba9c29c9a6f6e7d6b392a04a9cd5724ab)) -### Dependencies - -* The following workspace dependencies were updated - * devDependencies - * @repo/visual-editing-helpers bumped from 0.6.11 to 0.6.12 - ## [1.4.22](https://github.com/sanity-io/visual-editing/compare/preview-kit-compat-v1.4.21...preview-kit-compat-v1.4.22) (2024-05-13) -### Dependencies - -* The following workspace dependencies were updated - * devDependencies - * @repo/visual-editing-helpers bumped from 0.6.10 to 0.6.11 - ## [1.4.21](https://github.com/sanity-io/visual-editing/compare/preview-kit-compat-v1.4.20...preview-kit-compat-v1.4.21) (2024-05-05) @@ -479,12 +291,6 @@ All notable changes to this project will be documented in this file. See * **deps:** update dependency @sanity/client to v6.17.2 ([#1449](https://github.com/sanity-io/visual-editing/issues/1449)) ([928b45c](https://github.com/sanity-io/visual-editing/commit/928b45c47c66c5e1ddbe8b00783efd399b9fa17a)) -### Dependencies - -* The following workspace dependencies were updated - * devDependencies - * @repo/visual-editing-helpers bumped from 0.6.9 to 0.6.10 - ## [1.4.20](https://github.com/sanity-io/visual-editing/compare/preview-kit-compat-v1.4.19...preview-kit-compat-v1.4.20) (2024-04-26) @@ -494,12 +300,6 @@ All notable changes to this project will be documented in this file. See * revert react peer dep to ^18.2.0 ([#1414](https://github.com/sanity-io/visual-editing/issues/1414)) ([3578262](https://github.com/sanity-io/visual-editing/commit/3578262da3f94df17b626e31981bef473cd21840)) -### Dependencies - -* The following workspace dependencies were updated - * devDependencies - * @repo/visual-editing-helpers bumped from 0.6.8 to 0.6.9 - ## [1.4.19](https://github.com/sanity-io/visual-editing/compare/preview-kit-compat-v1.4.18...preview-kit-compat-v1.4.19) (2024-04-22) @@ -508,12 +308,6 @@ All notable changes to this project will be documented in this file. See * **deps:** update dependency @sanity/client to v6.15.20 ([#1385](https://github.com/sanity-io/visual-editing/issues/1385)) ([8ead6bf](https://github.com/sanity-io/visual-editing/commit/8ead6bf64505b194ebe1b084d6f5b6d4f1d7196e)) -### Dependencies - -* The following workspace dependencies were updated - * devDependencies - * @repo/visual-editing-helpers bumped from 0.6.7 to 0.6.8 - ## [1.4.18](https://github.com/sanity-io/visual-editing/compare/preview-kit-compat-v1.4.17...preview-kit-compat-v1.4.18) (2024-04-19) @@ -522,12 +316,6 @@ All notable changes to this project will be documented in this file. See * **deps:** update dependency @sanity/client to v6.15.19 ([#1374](https://github.com/sanity-io/visual-editing/issues/1374)) ([fde2034](https://github.com/sanity-io/visual-editing/commit/fde203405fe8899fd1bd241523853b732c095b37)) -### Dependencies - -* The following workspace dependencies were updated - * devDependencies - * @repo/visual-editing-helpers bumped from 0.6.6 to 0.6.7 - ## [1.4.17](https://github.com/sanity-io/visual-editing/compare/preview-kit-compat-v1.4.16...preview-kit-compat-v1.4.17) (2024-04-17) @@ -537,12 +325,6 @@ All notable changes to this project will be documented in this file. See * inline `async-cache-dedupe` to improve ESM interop ([cb53fbd](https://github.com/sanity-io/visual-editing/commit/cb53fbd1348887443a7aa55808d73e8060865371)) -### Dependencies - -* The following workspace dependencies were updated - * devDependencies - * @repo/visual-editing-helpers bumped from 0.6.5 to 0.6.6 - ## [1.4.16](https://github.com/sanity-io/visual-editing/compare/preview-kit-compat-v1.4.15...preview-kit-compat-v1.4.16) (2024-04-16) @@ -551,12 +333,6 @@ All notable changes to this project will be documented in this file. See * **deps:** update dependency @sanity/client to v6.15.13 ([#1327](https://github.com/sanity-io/visual-editing/issues/1327)) ([a52f2c2](https://github.com/sanity-io/visual-editing/commit/a52f2c2180e1da09a8166e516aaeb206e13e13ae)) -### Dependencies - -* The following workspace dependencies were updated - * devDependencies - * @repo/visual-editing-helpers bumped from 0.6.4 to 0.6.5 - ## [1.4.15](https://github.com/sanity-io/visual-editing/compare/preview-kit-compat-v1.4.14...preview-kit-compat-v1.4.15) (2024-04-05) @@ -565,12 +341,6 @@ All notable changes to this project will be documented in this file. See * **deps:** update dependency @sanity/client to v6.15.11 ([#1273](https://github.com/sanity-io/visual-editing/issues/1273)) ([d2131b7](https://github.com/sanity-io/visual-editing/commit/d2131b7ec338b9d00a0040c6113b78b828ef4f2f)) -### Dependencies - -* The following workspace dependencies were updated - * devDependencies - * @sanity/visual-editing-helpers bumped from 0.6.3 to 0.6.4 - ## [1.4.14](https://github.com/sanity-io/visual-editing/compare/preview-kit-compat-v1.4.13...preview-kit-compat-v1.4.14) (2024-04-05) @@ -579,12 +349,6 @@ All notable changes to this project will be documented in this file. See * **deps:** update dependency @sanity/client to v6.15.10 ([#1258](https://github.com/sanity-io/visual-editing/issues/1258)) ([9bf3cdb](https://github.com/sanity-io/visual-editing/commit/9bf3cdbcb7924cdcb96b7de15a159457385e8fec)) -### Dependencies - -* The following workspace dependencies were updated - * devDependencies - * @sanity/visual-editing-helpers bumped from 0.6.2 to 0.6.3 - ## [1.4.13](https://github.com/sanity-io/visual-editing/compare/preview-kit-compat-v1.4.12...preview-kit-compat-v1.4.13) (2024-03-20) @@ -593,12 +357,6 @@ All notable changes to this project will be documented in this file. See * ship TS Node16 compatible typings ([a21794d](https://github.com/sanity-io/visual-editing/commit/a21794dec5001867279a5979403220060b1d16f0)) -### Dependencies - -* The following workspace dependencies were updated - * devDependencies - * @sanity/visual-editing-helpers bumped from 0.6.1 to 0.6.2 - ## [1.4.9](https://github.com/sanity-io/visual-editing/compare/preview-kit-compat-v1.4.8...preview-kit-compat-v1.4.9) (2024-02-26) @@ -607,12 +365,6 @@ All notable changes to this project will be documented in this file. See * **deps:** update dependency @sanity/client to v6.14.4 ([#1002](https://github.com/sanity-io/visual-editing/issues/1002)) ([1239cb2](https://github.com/sanity-io/visual-editing/commit/1239cb24da0f9132f6093f8ae9eccd275565fc7d)) -### Dependencies - -* The following workspace dependencies were updated - * devDependencies - * @sanity/visual-editing-helpers bumped from 0.5.0 to 0.5.1 - ## [1.4.6](https://github.com/sanity-io/visual-editing/compare/preview-kit-compat-v1.4.5...preview-kit-compat-v1.4.6) (2024-02-16) @@ -621,12 +373,6 @@ All notable changes to this project will be documented in this file. See * **deps:** update dependency @sanity/client to v6.13.3 ([#929](https://github.com/sanity-io/visual-editing/issues/929)) ([f711adc](https://github.com/sanity-io/visual-editing/commit/f711adc089198de325c55bc43a02c062ef9eef0e)) -### Dependencies - -* The following workspace dependencies were updated - * devDependencies - * @sanity/visual-editing-helpers bumped from 0.3.0 to 0.3.1 - ## [1.4.5](https://github.com/sanity-io/visual-editing/compare/preview-kit-compat-v1.4.4...preview-kit-compat-v1.4.5) (2024-02-15) @@ -635,12 +381,6 @@ All notable changes to this project will be documented in this file. See * **deps:** update dependency @sanity/client to v6.13.3 ([#921](https://github.com/sanity-io/visual-editing/issues/921)) ([e150d8d](https://github.com/sanity-io/visual-editing/commit/e150d8d375a0fc12d8b9d4d11f04454a93a6a2c0)) -### Dependencies - -* The following workspace dependencies were updated - * devDependencies - * @sanity/visual-editing-helpers bumped from 0.2.6 to 0.3.0 - ## [1.4.4](https://github.com/sanity-io/visual-editing/compare/preview-kit-compat-v1.4.3...preview-kit-compat-v1.4.4) (2024-01-29) @@ -649,12 +389,6 @@ All notable changes to this project will be documented in this file. See * **deps:** update dependency @sanity/client to ^6.12.3 ([#787](https://github.com/sanity-io/visual-editing/issues/787)) ([634d8a3](https://github.com/sanity-io/visual-editing/commit/634d8a35f4db4ac04157f5e3d01eff9abfba2f99)) -### Dependencies - -* The following workspace dependencies were updated - * devDependencies - * @sanity/visual-editing-helpers bumped from 0.2.5 to 0.2.6 - ## [1.4.3](https://github.com/sanity-io/visual-editing/compare/preview-kit-compat-v1.4.2...preview-kit-compat-v1.4.3) (2024-01-26) @@ -665,12 +399,6 @@ All notable changes to this project will be documented in this file. See * **deps:** update dependency @sanity/client to ^6.12.1 ([#774](https://github.com/sanity-io/visual-editing/issues/774)) ([4ba2074](https://github.com/sanity-io/visual-editing/commit/4ba2074d807fb6c69c17b783cba1d7154846782f)) -### Dependencies - -* The following workspace dependencies were updated - * devDependencies - * @sanity/visual-editing-helpers bumped from 0.2.4 to 0.2.5 - ## [1.4.1](https://github.com/sanity-io/visual-editing/compare/preview-kit-compat-v1.4.0...preview-kit-compat-v1.4.1) (2024-01-10) @@ -679,12 +407,6 @@ All notable changes to this project will be documented in this file. See * **deps:** update dependency @sanity/client to ^6.11.1 ([#666](https://github.com/sanity-io/visual-editing/issues/666)) ([487d552](https://github.com/sanity-io/visual-editing/commit/487d552ffdef039ab9807a440df3b1a66b9fa064)) -### Dependencies - -* The following workspace dependencies were updated - * devDependencies - * @sanity/visual-editing-helpers bumped from 0.2.2 to 0.2.3 - ## [1.4.0](https://github.com/sanity-io/visual-editing/compare/preview-kit-compat-v1.3.3...preview-kit-compat-v1.4.0) (2024-01-10) @@ -702,8 +424,6 @@ All notable changes to this project will be documented in this file. See * The following workspace dependencies were updated * devDependencies - * @sanity/channels bumped from 0.3.0 to 0.4.0 - * @sanity/visual-editing-helpers bumped from 0.2.1 to 0.2.2 ## [1.3.0](https://github.com/sanity-io/visual-editing/compare/preview-kit-compat-v1.2.3...preview-kit-compat-v1.3.0) (2023-12-12) @@ -723,8 +443,6 @@ All notable changes to this project will be documented in this file. See * The following workspace dependencies were updated * devDependencies - * @sanity/channels bumped from 0.1.0 to 0.2.0 - * @sanity/visual-editing-helpers bumped from 0.1.3 to 0.1.4 ## [1.2.2](https://github.com/sanity-io/visual-editing/compare/preview-kit-compat-v1.2.1...preview-kit-compat-v1.2.2) (2023-12-07) @@ -734,12 +452,6 @@ All notable changes to this project will be documented in this file. See * **deps:** update dependency @sanity/client to ^6.9.3 ([#517](https://github.com/sanity-io/visual-editing/issues/517)) ([39528c8](https://github.com/sanity-io/visual-editing/commit/39528c8dc3f4898ad596c686513d9c13df9368e1)) -### Dependencies - -* The following workspace dependencies were updated - * devDependencies - * @sanity/visual-editing-helpers bumped from 0.1.1 to 0.1.2 - ## [1.2.0](https://github.com/sanity-io/visual-editing/compare/preview-kit-compat-v1.1.0...preview-kit-compat-v1.2.0) (2023-12-05) @@ -753,8 +465,6 @@ All notable changes to this project will be documented in this file. See * The following workspace dependencies were updated * devDependencies - * @sanity/channels bumped to 0.1.0 - * @sanity/visual-editing-helpers bumped to 0.1.0 ## [1.1.0](https://github.com/sanity-io/visual-editing/compare/preview-kit-compat-v1.0.2...preview-kit-compat-v1.1.0) (2023-12-05) diff --git a/packages/preview-kit-compat/package.json b/packages/preview-kit-compat/package.json index e8aaef78f..069157e6c 100644 --- a/packages/preview-kit-compat/package.json +++ b/packages/preview-kit-compat/package.json @@ -47,13 +47,13 @@ "root": true }, "dependencies": { - "@sanity/comlink": "workspace:*" + "@sanity/comlink": "workspace:^", + "@sanity/presentation-comlink": "workspace:^" }, "devDependencies": { "@repo/eslint-config": "workspace:*", "@repo/package.config": "workspace:*", "@repo/prettier-config": "workspace:*", - "@repo/visual-editing-helpers": "workspace:*", "@sanity/client": "^6.24.3", "@sanity/pkg-utils": "6.13.4", "@types/react": "^19.0.7", diff --git a/packages/preview-kit-compat/src/index.ts b/packages/preview-kit-compat/src/index.ts index e0ad992a4..6784dde44 100644 --- a/packages/preview-kit-compat/src/index.ts +++ b/packages/preview-kit-compat/src/index.ts @@ -1,6 +1,3 @@ export * from './useDocumentsInUse' -export { - type RevalidateState, - useQueryParams, - useRevalidate, -} from '@repo/visual-editing-helpers/hooks' +export {useQueryParams} from './useQueryParams' +export {useRevalidate, type RevalidateState} from './useRevalidate' diff --git a/packages/preview-kit-compat/src/useDocumentsInUse.ts b/packages/preview-kit-compat/src/useDocumentsInUse.ts index e6d9a4bb0..06ecb06ff 100644 --- a/packages/preview-kit-compat/src/useDocumentsInUse.ts +++ b/packages/preview-kit-compat/src/useDocumentsInUse.ts @@ -1,6 +1,10 @@ -import {createCompatibilityActors, type PreviewKitNodeMsg} from '@repo/visual-editing-helpers' import type {ContentSourceMapDocuments} from '@sanity/client/csm' import {createNode, createNodeMachine, type Message, type Node} from '@sanity/comlink' +import { + createCompatibilityActors, + isMaybePresentation, + type PreviewKitNodeMsg, +} from '@sanity/presentation-comlink' import {useEffect, useState} from 'react' /** @@ -16,7 +20,7 @@ export function useDocumentsInUse( const [connected, setConnected] = useState(false) useEffect(() => { - if (window.self === window.top && !window.opener) { + if (!isMaybePresentation()) { return } const comlink = createNode( diff --git a/packages/visual-editing-helpers/src/hooks/useQueryParams.ts b/packages/preview-kit-compat/src/useQueryParams.ts similarity index 100% rename from packages/visual-editing-helpers/src/hooks/useQueryParams.ts rename to packages/preview-kit-compat/src/useQueryParams.ts diff --git a/packages/visual-editing-helpers/src/hooks/useRevalidate.ts b/packages/preview-kit-compat/src/useRevalidate.ts similarity index 100% rename from packages/visual-editing-helpers/src/hooks/useRevalidate.ts rename to packages/preview-kit-compat/src/useRevalidate.ts diff --git a/packages/react-loader/CHANGELOG.md b/packages/react-loader/CHANGELOG.md index 04bd18afd..3485efc64 100644 --- a/packages/react-loader/CHANGELOG.md +++ b/packages/react-loader/CHANGELOG.md @@ -11,32 +11,24 @@ All notable changes to this project will be documented in this file. See * The following workspace dependencies were updated * dependencies * @sanity/core-loader bumped from 1.4.3 to 1.4.4 - * devDependencies - * @sanity/visual-editing-helpers bumped from 0.3.1 to 0.4.0 ### Dependencies * The following workspace dependencies were updated * dependencies * @sanity/core-loader bumped from 1.4.4 to 1.4.5 - * devDependencies - * @sanity/visual-editing-helpers bumped from 0.4.0 to 0.5.0 ### Dependencies * The following workspace dependencies were updated * dependencies * @sanity/core-loader bumped from 1.5.1 to 1.6.0 - * devDependencies - * @sanity/visual-editing-helpers bumped from 0.5.2 to 0.6.0 ### Dependencies * The following workspace dependencies were updated * dependencies * @sanity/core-loader bumped from 1.6.0 to 1.6.1 - * devDependencies - * @sanity/visual-editing-helpers bumped from 0.6.0 to 0.6.1 ## [1.10.35](https://github.com/sanity-io/visual-editing/compare/react-loader-v1.10.34...react-loader-v1.10.35) (2025-01-14) @@ -46,8 +38,6 @@ All notable changes to this project will be documented in this file. See * The following workspace dependencies were updated * dependencies * @sanity/core-loader bumped to 1.7.26 - * devDependencies - * @repo/visual-editing-helpers bumped to 0.7.14 ## [1.10.34](https://github.com/sanity-io/visual-editing/compare/react-loader-v1.10.33...react-loader-v1.10.34) (2025-01-09) @@ -57,8 +47,6 @@ All notable changes to this project will be documented in this file. See * The following workspace dependencies were updated * dependencies * @sanity/core-loader bumped to 1.7.25 - * devDependencies - * @repo/visual-editing-helpers bumped to 0.7.13 ## [1.10.33](https://github.com/sanity-io/visual-editing/compare/react-loader-v1.10.32...react-loader-v1.10.33) (2025-01-09) @@ -73,8 +61,6 @@ All notable changes to this project will be documented in this file. See * The following workspace dependencies were updated * dependencies * @sanity/core-loader bumped to 1.7.24 - * devDependencies - * @repo/visual-editing-helpers bumped to 0.7.12 ## [1.10.32](https://github.com/sanity-io/visual-editing/compare/react-loader-v1.10.31...react-loader-v1.10.32) (2025-01-06) @@ -84,8 +70,6 @@ All notable changes to this project will be documented in this file. See * The following workspace dependencies were updated * dependencies * @sanity/core-loader bumped to 1.7.23 - * devDependencies - * @repo/visual-editing-helpers bumped to 0.7.11 ## [1.10.31](https://github.com/sanity-io/visual-editing/compare/react-loader-v1.10.30...react-loader-v1.10.31) (2024-12-21) @@ -95,8 +79,6 @@ All notable changes to this project will be documented in this file. See * The following workspace dependencies were updated * dependencies * @sanity/core-loader bumped to 1.7.22 - * devDependencies - * @repo/visual-editing-helpers bumped to 0.7.10 ## [1.10.30](https://github.com/sanity-io/visual-editing/compare/react-loader-v1.10.29...react-loader-v1.10.30) (2024-12-16) @@ -106,8 +88,6 @@ All notable changes to this project will be documented in this file. See * The following workspace dependencies were updated * dependencies * @sanity/core-loader bumped to 1.7.21 - * devDependencies - * @repo/visual-editing-helpers bumped to 0.7.9 ## [1.10.29](https://github.com/sanity-io/visual-editing/compare/react-loader-v1.10.28...react-loader-v1.10.29) (2024-12-16) @@ -117,8 +97,6 @@ All notable changes to this project will be documented in this file. See * The following workspace dependencies were updated * dependencies * @sanity/core-loader bumped to 1.7.20 - * devDependencies - * @repo/visual-editing-helpers bumped to 0.7.8 ## [1.10.28](https://github.com/sanity-io/visual-editing/compare/react-loader-v1.10.27...react-loader-v1.10.28) (2024-12-05) @@ -128,8 +106,6 @@ All notable changes to this project will be documented in this file. See * The following workspace dependencies were updated * dependencies * @sanity/core-loader bumped to 1.7.19 - * devDependencies - * @repo/visual-editing-helpers bumped to 0.7.7 ## [1.10.27](https://github.com/sanity-io/visual-editing/compare/react-loader-v1.10.26...react-loader-v1.10.27) (2024-12-03) @@ -176,8 +152,6 @@ All notable changes to this project will be documented in this file. See * The following workspace dependencies were updated * dependencies * @sanity/core-loader bumped to 1.7.15 - * devDependencies - * @repo/visual-editing-helpers bumped to 0.7.6 ## [1.10.23](https://github.com/sanity-io/visual-editing/compare/react-loader-v1.10.22...react-loader-v1.10.23) (2024-11-28) @@ -187,8 +161,6 @@ All notable changes to this project will be documented in this file. See * The following workspace dependencies were updated * dependencies * @sanity/core-loader bumped to 1.7.14 - * devDependencies - * @repo/visual-editing-helpers bumped to 0.7.5 ## [1.10.22](https://github.com/sanity-io/visual-editing/compare/react-loader-v1.10.21...react-loader-v1.10.22) (2024-11-27) @@ -205,8 +177,6 @@ All notable changes to this project will be documented in this file. See * The following workspace dependencies were updated * dependencies * @sanity/core-loader bumped to 1.7.13 - * devDependencies - * @repo/visual-editing-helpers bumped to 0.7.4 ## [1.10.20](https://github.com/sanity-io/visual-editing/compare/react-loader-v1.10.19...react-loader-v1.10.20) (2024-11-19) @@ -221,8 +191,6 @@ All notable changes to this project will be documented in this file. See * The following workspace dependencies were updated * dependencies * @sanity/core-loader bumped to 1.7.12 - * devDependencies - * @repo/visual-editing-helpers bumped to 0.7.3 ## [1.10.19](https://github.com/sanity-io/visual-editing/compare/react-loader-v1.10.18...react-loader-v1.10.19) (2024-11-14) @@ -232,8 +200,6 @@ All notable changes to this project will be documented in this file. See * The following workspace dependencies were updated * dependencies * @sanity/core-loader bumped to 1.7.11 - * devDependencies - * @repo/visual-editing-helpers bumped to 0.7.2 ## [1.10.18](https://github.com/sanity-io/visual-editing/compare/react-loader-v1.10.17...react-loader-v1.10.18) (2024-11-12) @@ -243,8 +209,6 @@ All notable changes to this project will be documented in this file. See * The following workspace dependencies were updated * dependencies * @sanity/core-loader bumped to 1.7.10 - * devDependencies - * @repo/visual-editing-helpers bumped to 0.7.1 ## [1.10.17](https://github.com/sanity-io/visual-editing/compare/react-loader-v1.10.16...react-loader-v1.10.17) (2024-11-12) @@ -259,8 +223,6 @@ All notable changes to this project will be documented in this file. See * The following workspace dependencies were updated * dependencies * @sanity/core-loader bumped to 1.7.9 - * devDependencies - * @repo/visual-editing-helpers bumped to 0.7.0 ## [1.10.16](https://github.com/sanity-io/visual-editing/compare/react-loader-v1.10.15...react-loader-v1.10.16) (2024-11-06) @@ -275,8 +237,6 @@ All notable changes to this project will be documented in this file. See * The following workspace dependencies were updated * dependencies * @sanity/core-loader bumped to 1.7.8 - * devDependencies - * @repo/visual-editing-helpers bumped to 0.6.30 ## [1.10.15](https://github.com/sanity-io/visual-editing/compare/react-loader-v1.10.14...react-loader-v1.10.15) (2024-11-04) @@ -286,8 +246,6 @@ All notable changes to this project will be documented in this file. See * The following workspace dependencies were updated * dependencies * @sanity/core-loader bumped to 1.7.7 - * devDependencies - * @repo/visual-editing-helpers bumped to 0.6.29 ## [1.10.14](https://github.com/sanity-io/visual-editing/compare/react-loader-v1.10.13...react-loader-v1.10.14) (2024-10-28) @@ -297,8 +255,6 @@ All notable changes to this project will be documented in this file. See * The following workspace dependencies were updated * dependencies * @sanity/core-loader bumped to 1.7.6 - * devDependencies - * @repo/visual-editing-helpers bumped to 0.6.28 ## [1.10.13](https://github.com/sanity-io/visual-editing/compare/react-loader-v1.10.12...react-loader-v1.10.13) (2024-10-24) @@ -308,8 +264,6 @@ All notable changes to this project will be documented in this file. See * The following workspace dependencies were updated * dependencies * @sanity/core-loader bumped to 1.7.5 - * devDependencies - * @repo/visual-editing-helpers bumped to 0.6.27 ## [1.10.12](https://github.com/sanity-io/visual-editing/compare/react-loader-v1.10.11...react-loader-v1.10.12) (2024-10-24) @@ -319,8 +273,6 @@ All notable changes to this project will be documented in this file. See * The following workspace dependencies were updated * dependencies * @sanity/core-loader bumped to 1.7.4 - * devDependencies - * @repo/visual-editing-helpers bumped to 0.6.26 ## [1.10.11](https://github.com/sanity-io/visual-editing/compare/react-loader-v1.10.10...react-loader-v1.10.11) (2024-10-23) @@ -330,8 +282,6 @@ All notable changes to this project will be documented in this file. See * The following workspace dependencies were updated * dependencies * @sanity/core-loader bumped to 1.7.3 - * devDependencies - * @repo/visual-editing-helpers bumped to 0.6.25 ## [1.10.10](https://github.com/sanity-io/visual-editing/compare/react-loader-v1.10.9...react-loader-v1.10.10) (2024-10-21) @@ -341,8 +291,6 @@ All notable changes to this project will be documented in this file. See * The following workspace dependencies were updated * dependencies * @sanity/core-loader bumped to 1.7.2 - * devDependencies - * @repo/visual-editing-helpers bumped to 0.6.24 ## [1.10.9](https://github.com/sanity-io/visual-editing/compare/react-loader-v1.10.8...react-loader-v1.10.9) (2024-10-21) @@ -357,8 +305,6 @@ All notable changes to this project will be documented in this file. See * The following workspace dependencies were updated * dependencies * @sanity/core-loader bumped to 1.7.1 - * devDependencies - * @repo/visual-editing-helpers bumped to 0.6.23 ## [1.10.8](https://github.com/sanity-io/visual-editing/compare/react-loader-v1.10.7...react-loader-v1.10.8) (2024-10-21) @@ -374,8 +320,6 @@ All notable changes to this project will be documented in this file. See * The following workspace dependencies were updated * dependencies * @sanity/core-loader bumped to 1.7.0 - * devDependencies - * @repo/visual-editing-helpers bumped to 0.6.22 ## [1.10.7](https://github.com/sanity-io/visual-editing/compare/react-loader-v1.10.6...react-loader-v1.10.7) (2024-09-11) @@ -390,8 +334,6 @@ All notable changes to this project will be documented in this file. See * The following workspace dependencies were updated * dependencies * @sanity/core-loader bumped to 1.6.23 - * devDependencies - * @repo/visual-editing-helpers bumped to 0.6.21 ## [1.10.6](https://github.com/sanity-io/visual-editing/compare/react-loader-v1.10.5...react-loader-v1.10.6) (2024-08-12) @@ -406,8 +348,6 @@ All notable changes to this project will be documented in this file. See * The following workspace dependencies were updated * dependencies * @sanity/core-loader bumped to 1.6.22 - * devDependencies - * @repo/visual-editing-helpers bumped to 0.6.20 ## [1.10.5](https://github.com/sanity-io/visual-editing/compare/react-loader-v1.10.4...react-loader-v1.10.5) (2024-08-02) @@ -423,8 +363,6 @@ All notable changes to this project will be documented in this file. See * The following workspace dependencies were updated * dependencies * @sanity/core-loader bumped from 1.6.20 to 1.6.21 - * devDependencies - * @repo/visual-editing-helpers bumped from 0.6.18 to 0.6.19 ## [1.10.4](https://github.com/sanity-io/visual-editing/compare/react-loader-v1.10.3...react-loader-v1.10.4) (2024-07-03) @@ -439,8 +377,6 @@ All notable changes to this project will be documented in this file. See * The following workspace dependencies were updated * dependencies * @sanity/core-loader bumped from 1.6.19 to 1.6.20 - * devDependencies - * @repo/visual-editing-helpers bumped from 0.6.17 to 0.6.18 ## [1.10.3](https://github.com/sanity-io/visual-editing/compare/react-loader-v1.10.2...react-loader-v1.10.3) (2024-06-13) @@ -450,8 +386,6 @@ All notable changes to this project will be documented in this file. See * The following workspace dependencies were updated * dependencies * @sanity/core-loader bumped from 1.6.18 to 1.6.19 - * devDependencies - * @repo/visual-editing-helpers bumped from 0.6.16 to 0.6.17 ## [1.10.2](https://github.com/sanity-io/visual-editing/compare/react-loader-v1.10.1...react-loader-v1.10.2) (2024-06-07) @@ -461,8 +395,6 @@ All notable changes to this project will be documented in this file. See * The following workspace dependencies were updated * dependencies * @sanity/core-loader bumped from 1.6.17 to 1.6.18 - * devDependencies - * @repo/visual-editing-helpers bumped from 0.6.15 to 0.6.16 ## [1.10.1](https://github.com/sanity-io/visual-editing/compare/react-loader-v1.10.0...react-loader-v1.10.1) (2024-05-30) @@ -477,8 +409,6 @@ All notable changes to this project will be documented in this file. See * The following workspace dependencies were updated * dependencies * @sanity/core-loader bumped from 1.6.16 to 1.6.17 - * devDependencies - * @repo/visual-editing-helpers bumped from 0.6.14 to 0.6.15 ## [1.10.0](https://github.com/sanity-io/visual-editing/compare/react-loader-v1.9.21...react-loader-v1.10.0) (2024-05-29) @@ -500,8 +430,6 @@ All notable changes to this project will be documented in this file. See * The following workspace dependencies were updated * dependencies * @sanity/core-loader bumped from 1.6.15 to 1.6.16 - * devDependencies - * @repo/visual-editing-helpers bumped from 0.6.13 to 0.6.14 ## [1.9.20](https://github.com/sanity-io/visual-editing/compare/react-loader-v1.9.19...react-loader-v1.9.20) (2024-05-27) @@ -516,8 +444,6 @@ All notable changes to this project will be documented in this file. See * The following workspace dependencies were updated * dependencies * @sanity/core-loader bumped from 1.6.14 to 1.6.15 - * devDependencies - * @repo/visual-editing-helpers bumped from 0.6.12 to 0.6.13 ## [1.9.19](https://github.com/sanity-io/visual-editing/compare/react-loader-v1.9.18...react-loader-v1.9.19) (2024-05-15) @@ -532,8 +458,6 @@ All notable changes to this project will be documented in this file. See * The following workspace dependencies were updated * dependencies * @sanity/core-loader bumped from 1.6.13 to 1.6.14 - * devDependencies - * @repo/visual-editing-helpers bumped from 0.6.11 to 0.6.12 ## [1.9.18](https://github.com/sanity-io/visual-editing/compare/react-loader-v1.9.17...react-loader-v1.9.18) (2024-05-13) @@ -543,8 +467,6 @@ All notable changes to this project will be documented in this file. See * The following workspace dependencies were updated * dependencies * @sanity/core-loader bumped from 1.6.12 to 1.6.13 - * devDependencies - * @repo/visual-editing-helpers bumped from 0.6.10 to 0.6.11 ## [1.9.17](https://github.com/sanity-io/visual-editing/compare/react-loader-v1.9.16...react-loader-v1.9.17) (2024-05-05) @@ -559,8 +481,6 @@ All notable changes to this project will be documented in this file. See * The following workspace dependencies were updated * dependencies * @sanity/core-loader bumped from 1.6.11 to 1.6.12 - * devDependencies - * @repo/visual-editing-helpers bumped from 0.6.9 to 0.6.10 ## [1.9.16](https://github.com/sanity-io/visual-editing/compare/react-loader-v1.9.15...react-loader-v1.9.16) (2024-04-29) @@ -585,8 +505,6 @@ All notable changes to this project will be documented in this file. See * The following workspace dependencies were updated * dependencies * @sanity/core-loader bumped from 1.6.9 to 1.6.10 - * devDependencies - * @repo/visual-editing-helpers bumped from 0.6.8 to 0.6.9 ## [1.9.14](https://github.com/sanity-io/visual-editing/compare/react-loader-v1.9.13...react-loader-v1.9.14) (2024-04-22) @@ -601,8 +519,6 @@ All notable changes to this project will be documented in this file. See * The following workspace dependencies were updated * dependencies * @sanity/core-loader bumped from 1.6.8 to 1.6.9 - * devDependencies - * @repo/visual-editing-helpers bumped from 0.6.7 to 0.6.8 ## [1.9.13](https://github.com/sanity-io/visual-editing/compare/react-loader-v1.9.12...react-loader-v1.9.13) (2024-04-19) @@ -617,8 +533,6 @@ All notable changes to this project will be documented in this file. See * The following workspace dependencies were updated * dependencies * @sanity/core-loader bumped from 1.6.7 to 1.6.8 - * devDependencies - * @repo/visual-editing-helpers bumped from 0.6.6 to 0.6.7 ## [1.9.12](https://github.com/sanity-io/visual-editing/compare/react-loader-v1.9.11...react-loader-v1.9.12) (2024-04-17) @@ -641,8 +555,6 @@ All notable changes to this project will be documented in this file. See * The following workspace dependencies were updated * dependencies * @sanity/core-loader bumped from 1.6.6 to 1.6.7 - * devDependencies - * @repo/visual-editing-helpers bumped from 0.6.5 to 0.6.6 ## [1.9.10](https://github.com/sanity-io/visual-editing/compare/react-loader-v1.9.9...react-loader-v1.9.10) (2024-04-16) @@ -657,8 +569,6 @@ All notable changes to this project will be documented in this file. See * The following workspace dependencies were updated * dependencies * @sanity/core-loader bumped from 1.6.5 to 1.6.6 - * devDependencies - * @repo/visual-editing-helpers bumped from 0.6.4 to 0.6.5 ## [1.9.9](https://github.com/sanity-io/visual-editing/compare/react-loader-v1.9.8...react-loader-v1.9.9) (2024-04-05) @@ -673,8 +583,6 @@ All notable changes to this project will be documented in this file. See * The following workspace dependencies were updated * dependencies * @sanity/core-loader bumped from 1.6.4 to 1.6.5 - * devDependencies - * @sanity/visual-editing-helpers bumped from 0.6.3 to 0.6.4 ## [1.9.8](https://github.com/sanity-io/visual-editing/compare/react-loader-v1.9.7...react-loader-v1.9.8) (2024-04-05) @@ -696,8 +604,6 @@ All notable changes to this project will be documented in this file. See * The following workspace dependencies were updated * dependencies * @sanity/core-loader bumped from 1.6.3 to 1.6.4 - * devDependencies - * @sanity/visual-editing-helpers bumped from 0.6.2 to 0.6.3 ## [1.9.6](https://github.com/sanity-io/visual-editing/compare/react-loader-v1.9.5...react-loader-v1.9.6) (2024-04-02) @@ -721,8 +627,6 @@ All notable changes to this project will be documented in this file. See * The following workspace dependencies were updated * dependencies * @sanity/core-loader bumped from 1.6.1 to 1.6.2 - * devDependencies - * @sanity/visual-editing-helpers bumped from 0.6.1 to 0.6.2 ## [1.9.4](https://github.com/sanity-io/visual-editing/compare/react-loader-v1.9.3...react-loader-v1.9.4) (2024-03-18) @@ -758,8 +662,6 @@ All notable changes to this project will be documented in this file. See * The following workspace dependencies were updated * dependencies * @sanity/core-loader bumped from 1.4.6 to 1.5.0 - * devDependencies - * @sanity/visual-editing-helpers bumped from 0.5.1 to 0.5.2 ## [1.8.8](https://github.com/sanity-io/visual-editing/compare/react-loader-v1.8.7...react-loader-v1.8.8) (2024-02-26) @@ -774,8 +676,6 @@ All notable changes to this project will be documented in this file. See * The following workspace dependencies were updated * dependencies * @sanity/core-loader bumped from 1.4.5 to 1.4.6 - * devDependencies - * @sanity/visual-editing-helpers bumped from 0.5.0 to 0.5.1 ## [1.8.5](https://github.com/sanity-io/visual-editing/compare/react-loader-v1.8.4...react-loader-v1.8.5) (2024-02-16) @@ -790,8 +690,6 @@ All notable changes to this project will be documented in this file. See * The following workspace dependencies were updated * dependencies * @sanity/core-loader bumped from 1.4.2 to 1.4.3 - * devDependencies - * @sanity/visual-editing-helpers bumped from 0.3.0 to 0.3.1 ## [1.8.4](https://github.com/sanity-io/visual-editing/compare/react-loader-v1.8.3...react-loader-v1.8.4) (2024-02-15) @@ -806,8 +704,6 @@ All notable changes to this project will be documented in this file. See * The following workspace dependencies were updated * dependencies * @sanity/core-loader bumped from 1.4.1 to 1.4.2 - * devDependencies - * @sanity/visual-editing-helpers bumped from 0.2.6 to 0.3.0 ## [1.8.3](https://github.com/sanity-io/visual-editing/compare/react-loader-v1.8.2...react-loader-v1.8.3) (2024-02-05) @@ -836,8 +732,6 @@ All notable changes to this project will be documented in this file. See * The following workspace dependencies were updated * dependencies * @sanity/core-loader bumped from 1.3.9 to 1.3.10 - * devDependencies - * @sanity/visual-editing-helpers bumped from 0.2.5 to 0.2.6 ## [1.8.0](https://github.com/sanity-io/visual-editing/compare/react-loader-v1.7.6...react-loader-v1.8.0) (2024-01-26) @@ -861,8 +755,6 @@ All notable changes to this project will be documented in this file. See * The following workspace dependencies were updated * dependencies * @sanity/core-loader bumped from 1.3.8 to 1.3.9 - * devDependencies - * @sanity/visual-editing-helpers bumped from 0.2.4 to 0.2.5 ## [1.7.4](https://github.com/sanity-io/visual-editing/compare/react-loader-v1.7.3...react-loader-v1.7.4) (2024-01-10) @@ -877,8 +769,6 @@ All notable changes to this project will be documented in this file. See * The following workspace dependencies were updated * dependencies * @sanity/core-loader bumped from 1.3.5 to 1.3.6 - * devDependencies - * @sanity/visual-editing-helpers bumped from 0.2.2 to 0.2.3 ## [1.7.3](https://github.com/sanity-io/visual-editing/compare/react-loader-v1.7.2...react-loader-v1.7.3) (2024-01-10) @@ -916,8 +806,6 @@ All notable changes to this project will be documented in this file. See * dependencies * @sanity/core-loader bumped from 1.3.3 to 1.3.4 * devDependencies - * @sanity/channels bumped from 0.3.0 to 0.4.0 - * @sanity/visual-editing-helpers bumped from 0.2.1 to 0.2.2 ## [1.7.0](https://github.com/sanity-io/visual-editing/compare/react-loader-v1.6.5...react-loader-v1.7.0) (2024-01-05) @@ -975,8 +863,6 @@ All notable changes to this project will be documented in this file. See * dependencies * @sanity/core-loader bumped from 1.1.4 to 1.2.0 * devDependencies - * @sanity/channels bumped from 0.1.0 to 0.2.0 - * @sanity/visual-editing-helpers bumped from 0.1.3 to 0.1.4 ## [1.4.0](https://github.com/sanity-io/visual-editing/compare/react-loader-v1.3.1...react-loader-v1.4.0) (2023-12-08) @@ -991,8 +877,6 @@ All notable changes to this project will be documented in this file. See * The following workspace dependencies were updated * dependencies * @sanity/core-loader bumped from 1.1.3 to 1.1.4 - * devDependencies - * @sanity/visual-editing-helpers bumped from 0.1.2 to 0.1.3 ## [1.3.1](https://github.com/sanity-io/visual-editing/compare/react-loader-v1.3.0...react-loader-v1.3.1) (2023-12-07) @@ -1007,8 +891,6 @@ All notable changes to this project will be documented in this file. See * The following workspace dependencies were updated * dependencies * @sanity/core-loader bumped from 1.1.2 to 1.1.3 - * devDependencies - * @sanity/visual-editing-helpers bumped from 0.1.1 to 0.1.2 ## [1.3.0](https://github.com/sanity-io/visual-editing/compare/react-loader-v1.2.1...react-loader-v1.3.0) (2023-12-06) @@ -1030,8 +912,6 @@ All notable changes to this project will be documented in this file. See * The following workspace dependencies were updated * dependencies * @sanity/core-loader bumped from 1.1.1 to 1.1.2 - * devDependencies - * @sanity/visual-editing-helpers bumped from 0.1.0 to 0.1.1 ## [1.2.0](https://github.com/sanity-io/visual-editing/compare/react-loader-v1.1.3...react-loader-v1.2.0) (2023-12-05) @@ -1425,8 +1305,6 @@ All notable changes to this project will be documented in this file. See * **deps:** update dependency @sanity/client to v6.7.1-pink-lizard.0 ([#224](https://github.com/sanity-io/visual-editing/issues/224)) ([937c5cb](https://github.com/sanity-io/visual-editing/commit/937c5cbe290a260c1f0a0dccbab7c46b4ef50767)) * **deps:** Update sanity monorepo ([#222](https://github.com/sanity-io/visual-editing/issues/222)) ([dec2114](https://github.com/sanity-io/visual-editing/commit/dec2114132de1b98da5a78f92def08a5528528a7)) * load src directly ([94308f0](https://github.com/sanity-io/visual-editing/commit/94308f0ba815d89347c7201eb759cc0ba6e2bbf7)) -* migrate to `visual-editing-helpers` ([e8bfae1](https://github.com/sanity-io/visual-editing/commit/e8bfae1dabfdc5017908697ced574bb23daf9f3b)) -* move `@sanity/csm` into `visual-editing-helpers` ([257a4ad](https://github.com/sanity-io/visual-editing/commit/257a4adf64dcd74cbf435b883995c6f5b8730c25)) * prepare release ([f2ce9cb](https://github.com/sanity-io/visual-editing/commit/f2ce9cb4046df2cb7581e66fcad3a5c0631778ae)) * remove `@sanity/csm` references ([c77205b](https://github.com/sanity-io/visual-editing/commit/c77205befbd41a58ba00c2c8f58dc4158a2a2e0d)) diff --git a/packages/react-loader/package.json b/packages/react-loader/package.json index 6ab41e638..b59d1c526 100644 --- a/packages/react-loader/package.json +++ b/packages/react-loader/package.json @@ -62,6 +62,8 @@ "files": [ "dist", "src", + "!**/*.test.*", + "!**/__fixtures__/*", "CHANGELOG.md" ], "scripts": { @@ -69,7 +71,7 @@ "dev": "pkg build --strict", "lint": "eslint --cache .", "prepack": "turbo run build", - "test": "vitest --pass-with-no-tests --typecheck" + "test": "vitest --typecheck" }, "browserslist": "extends @sanity/browserslist-config", "prettier": "@repo/prettier-config", @@ -81,13 +83,13 @@ }, "dependencies": { "@sanity/client": "^6.24.3", - "@sanity/core-loader": "workspace:*" + "@sanity/core-loader": "workspace:*", + "@sanity/visual-editing-csm": "workspace:^" }, "devDependencies": { "@repo/eslint-config": "workspace:*", "@repo/package.config": "workspace:*", "@repo/prettier-config": "workspace:*", - "@repo/visual-editing-helpers": "workspace:*", "@sanity/pkg-utils": "6.13.4", "@types/react": "^19.0.7", "eslint": "^8.57.1", diff --git a/packages/react-loader/src/jsx/SanityElement.tsx b/packages/react-loader/src/jsx/SanityElement.tsx index 03e78bcc8..6caf301ec 100644 --- a/packages/react-loader/src/jsx/SanityElement.tsx +++ b/packages/react-loader/src/jsx/SanityElement.tsx @@ -1,6 +1,7 @@ -import {encodeSanityNodeData, type SourceNode} from '@repo/visual-editing-helpers/csm' +import {encodeSanityNodeData} from '@sanity/visual-editing-csm' import type {HTMLProps, Ref} from 'react' import {forwardRef} from 'react' +import type {SourceNode} from './wrap' export interface SanityElementProps { children?: SourceNode | null diff --git a/packages/react-loader/src/jsx/index.ts b/packages/react-loader/src/jsx/index.ts index 3b186c2da..14d5f4025 100644 --- a/packages/react-loader/src/jsx/index.ts +++ b/packages/react-loader/src/jsx/index.ts @@ -1,8 +1,7 @@ export * from './jsx' +export {encodeSanityNodeData, type SanityNode} from '@sanity/visual-editing-csm' export { - encodeSanityNodeData, type SanityKey, - type SanityNode, type SanityNodeContext, type SanityPrimitive, type SourceNode, @@ -10,7 +9,7 @@ export { type UnwrappedValue, wrapData, type WrappedValue, -} from '@repo/visual-editing-helpers/csm' +} from './wrap' export type { Any, ContentSourceMap, diff --git a/packages/visual-editing-helpers/src/csm/wrap/__fixtures__/responses.ts b/packages/react-loader/src/jsx/wrap/__fixtures__/responses.ts similarity index 100% rename from packages/visual-editing-helpers/src/csm/wrap/__fixtures__/responses.ts rename to packages/react-loader/src/jsx/wrap/__fixtures__/responses.ts diff --git a/packages/visual-editing-helpers/src/csm/wrap/constants.ts b/packages/react-loader/src/jsx/wrap/constants.ts similarity index 100% rename from packages/visual-editing-helpers/src/csm/wrap/constants.ts rename to packages/react-loader/src/jsx/wrap/constants.ts diff --git a/packages/visual-editing-helpers/src/csm/wrap/helpers.ts b/packages/react-loader/src/jsx/wrap/helpers.ts similarity index 100% rename from packages/visual-editing-helpers/src/csm/wrap/helpers.ts rename to packages/react-loader/src/jsx/wrap/helpers.ts diff --git a/packages/visual-editing-helpers/src/csm/wrap/index.ts b/packages/react-loader/src/jsx/wrap/index.ts similarity index 100% rename from packages/visual-editing-helpers/src/csm/wrap/index.ts rename to packages/react-loader/src/jsx/wrap/index.ts diff --git a/packages/visual-editing-helpers/src/csm/wrap/isSourceNode.ts b/packages/react-loader/src/jsx/wrap/isSourceNode.ts similarity index 100% rename from packages/visual-editing-helpers/src/csm/wrap/isSourceNode.ts rename to packages/react-loader/src/jsx/wrap/isSourceNode.ts diff --git a/packages/visual-editing-helpers/src/csm/resolveSanityNode.ts b/packages/react-loader/src/jsx/wrap/resolveSanityNode.ts similarity index 92% rename from packages/visual-editing-helpers/src/csm/resolveSanityNode.ts rename to packages/react-loader/src/jsx/wrap/resolveSanityNode.ts index ee1ad6f4d..31c93a49d 100644 --- a/packages/visual-editing-helpers/src/csm/resolveSanityNode.ts +++ b/packages/react-loader/src/jsx/wrap/resolveSanityNode.ts @@ -7,8 +7,8 @@ import { type ContentSourceMap, type ContentSourceMapParsedPath, } from '@sanity/client/csm' -import type {SanityNode} from '../types' -import type {SanityNodeContext} from './wrap/types' +import type {SanityNode} from '@sanity/visual-editing-csm' +import type {SanityNodeContext} from './types' /** @internal */ export function resolveSanityNode( diff --git a/packages/visual-editing-helpers/src/csm/wrap/types.ts b/packages/react-loader/src/jsx/wrap/types.ts similarity index 97% rename from packages/visual-editing-helpers/src/csm/wrap/types.ts rename to packages/react-loader/src/jsx/wrap/types.ts index 79c7ab132..794a65d4a 100644 --- a/packages/visual-editing-helpers/src/csm/wrap/types.ts +++ b/packages/react-loader/src/jsx/wrap/types.ts @@ -1,4 +1,4 @@ -import type {SanityNode} from '../../index' +import type {SanityNode} from '@sanity/visual-editing-csm' /** @public */ export type SanityKey = diff --git a/packages/visual-editing-helpers/src/csm/wrap/unwrapData.test.ts b/packages/react-loader/src/jsx/wrap/unwrapData.test.ts similarity index 100% rename from packages/visual-editing-helpers/src/csm/wrap/unwrapData.test.ts rename to packages/react-loader/src/jsx/wrap/unwrapData.test.ts diff --git a/packages/visual-editing-helpers/src/csm/wrap/unwrapData.ts b/packages/react-loader/src/jsx/wrap/unwrapData.ts similarity index 100% rename from packages/visual-editing-helpers/src/csm/wrap/unwrapData.ts rename to packages/react-loader/src/jsx/wrap/unwrapData.ts diff --git a/packages/visual-editing-helpers/src/csm/wrap/wrapData.test.ts b/packages/react-loader/src/jsx/wrap/wrapData.test.ts similarity index 100% rename from packages/visual-editing-helpers/src/csm/wrap/wrapData.test.ts rename to packages/react-loader/src/jsx/wrap/wrapData.test.ts diff --git a/packages/visual-editing-helpers/src/csm/wrap/wrapData.ts b/packages/react-loader/src/jsx/wrap/wrapData.ts similarity index 96% rename from packages/visual-editing-helpers/src/csm/wrap/wrapData.ts rename to packages/react-loader/src/jsx/wrap/wrapData.ts index f4550709a..5e5410523 100644 --- a/packages/visual-editing-helpers/src/csm/wrap/wrapData.ts +++ b/packages/react-loader/src/jsx/wrap/wrapData.ts @@ -6,9 +6,9 @@ import { type ContentSourceMap, type ContentSourceMapParsedPath, } from '@sanity/client/csm' -import {resolveSanityNode} from '../resolveSanityNode' import {SANITY_KEYS} from './constants' import {isArray, isRecord} from './helpers' +import {resolveSanityNode} from './resolveSanityNode' import type {SanityKey, SanityNodeContext, WrappedValue} from './types' /** @public */ diff --git a/packages/react-loader/tsconfig.json b/packages/react-loader/tsconfig.json index 94ad56ed7..4bdf2946a 100644 --- a/packages/react-loader/tsconfig.json +++ b/packages/react-loader/tsconfig.json @@ -2,16 +2,13 @@ "extends": "./tsconfig.base", "compilerOptions": { "paths": { - "@sanity/core-loader": ["./node_modules/@sanity/core-loader/src"], - "@repo/visual-editing-helpers": ["./node_modules/@repo/visual-editing-helpers/src"], - "@repo/visual-editing-helpers/*": ["./node_modules/@repo/visual-editing-helpers/src/*"] + "@sanity/core-loader": ["./node_modules/@sanity/core-loader/src"] } }, "include": [ "**/*.ts", "**/*.tsx", "./node_modules/@sanity/core-loader/src", - "./node_modules/@repo/visual-editing-helpers/src" ], "exclude": ["dist", "node_modules"] } diff --git a/packages/svelte-loader/CHANGELOG.md b/packages/svelte-loader/CHANGELOG.md index 8aa796003..f9db2a5f1 100644 --- a/packages/svelte-loader/CHANGELOG.md +++ b/packages/svelte-loader/CHANGELOG.md @@ -11,16 +11,12 @@ All notable changes to this project will be documented in this file. See * The following workspace dependencies were updated * dependencies * @sanity/core-loader bumped from 1.4.3 to 1.4.4 - * devDependencies - * @sanity/visual-editing-helpers bumped from 0.3.1 to 0.4.0 ### Dependencies * The following workspace dependencies were updated * dependencies * @sanity/core-loader bumped from 1.4.4 to 1.4.5 - * devDependencies - * @sanity/visual-editing-helpers bumped from 0.4.0 to 0.5.0 ### Dependencies @@ -37,7 +33,6 @@ All notable changes to this project will be documented in this file. See * dependencies * @sanity/core-loader bumped to 1.7.26 * devDependencies - * @repo/visual-editing-helpers bumped to 0.7.14 * @sanity/visual-editing bumped to 2.12.2 * peerDependencies * @sanity/visual-editing bumped from 2.x to 2.12.2 @@ -78,7 +73,6 @@ All notable changes to this project will be documented in this file. See * dependencies * @sanity/core-loader bumped to 1.7.25 * devDependencies - * @repo/visual-editing-helpers bumped to 0.7.13 * @sanity/visual-editing bumped to 2.11.9 ## [1.12.42](https://github.com/sanity-io/visual-editing/compare/svelte-loader-v1.12.41...svelte-loader-v1.12.42) (2025-01-09) @@ -90,7 +84,6 @@ All notable changes to this project will be documented in this file. See * dependencies * @sanity/core-loader bumped to 1.7.24 * devDependencies - * @repo/visual-editing-helpers bumped to 0.7.12 * @sanity/preview-url-secret bumped to 2.0.7 * @sanity/visual-editing bumped to 2.11.8 @@ -122,7 +115,6 @@ All notable changes to this project will be documented in this file. See * dependencies * @sanity/core-loader bumped to 1.7.23 * devDependencies - * @repo/visual-editing-helpers bumped to 0.7.11 * @sanity/visual-editing bumped to 2.11.5 ## [1.12.38](https://github.com/sanity-io/visual-editing/compare/svelte-loader-v1.12.37...svelte-loader-v1.12.38) (2025-01-02) @@ -161,7 +153,6 @@ All notable changes to this project will be documented in this file. See * dependencies * @sanity/core-loader bumped to 1.7.22 * devDependencies - * @repo/visual-editing-helpers bumped to 0.7.10 * @sanity/visual-editing bumped to 2.11.1 ## [1.12.34](https://github.com/sanity-io/visual-editing/compare/svelte-loader-v1.12.33...svelte-loader-v1.12.34) (2024-12-19) @@ -191,7 +182,6 @@ All notable changes to this project will be documented in this file. See * dependencies * @sanity/core-loader bumped to 1.7.21 * devDependencies - * @repo/visual-editing-helpers bumped to 0.7.9 * @sanity/visual-editing bumped to 2.10.9 ## [1.12.31](https://github.com/sanity-io/visual-editing/compare/svelte-loader-v1.12.30...svelte-loader-v1.12.31) (2024-12-16) @@ -203,7 +193,6 @@ All notable changes to this project will be documented in this file. See * dependencies * @sanity/core-loader bumped to 1.7.20 * devDependencies - * @repo/visual-editing-helpers bumped to 0.7.8 * @sanity/visual-editing bumped to 2.10.8 ## [1.12.30](https://github.com/sanity-io/visual-editing/compare/svelte-loader-v1.12.29...svelte-loader-v1.12.30) (2024-12-12) @@ -242,7 +231,6 @@ All notable changes to this project will be documented in this file. See * dependencies * @sanity/core-loader bumped to 1.7.19 * devDependencies - * @repo/visual-editing-helpers bumped to 0.7.7 * @sanity/visual-editing bumped to 2.10.4 ## [1.12.26](https://github.com/sanity-io/visual-editing/compare/svelte-loader-v1.12.25...svelte-loader-v1.12.26) (2024-12-03) @@ -291,7 +279,6 @@ All notable changes to this project will be documented in this file. See * dependencies * @sanity/core-loader bumped to 1.7.15 * devDependencies - * @repo/visual-editing-helpers bumped to 0.7.6 * @sanity/preview-url-secret bumped to 2.0.5 * @sanity/visual-editing bumped to 2.10.3 @@ -313,7 +300,6 @@ All notable changes to this project will be documented in this file. See * dependencies * @sanity/core-loader bumped to 1.7.14 * devDependencies - * @repo/visual-editing-helpers bumped to 0.7.5 * @sanity/visual-editing bumped to 2.10.1 ## [1.12.20](https://github.com/sanity-io/visual-editing/compare/svelte-loader-v1.12.19...svelte-loader-v1.12.20) (2024-11-27) @@ -334,7 +320,6 @@ All notable changes to this project will be documented in this file. See * dependencies * @sanity/core-loader bumped to 1.7.13 * devDependencies - * @repo/visual-editing-helpers bumped to 0.7.4 * @sanity/visual-editing bumped to 2.9.0 ## [1.12.18](https://github.com/sanity-io/visual-editing/compare/svelte-loader-v1.12.17...svelte-loader-v1.12.18) (2024-11-19) @@ -351,7 +336,6 @@ All notable changes to this project will be documented in this file. See * dependencies * @sanity/core-loader bumped to 1.7.12 * devDependencies - * @repo/visual-editing-helpers bumped to 0.7.3 * @sanity/preview-url-secret bumped to 2.0.4 * @sanity/visual-editing bumped to 2.8.0 @@ -373,7 +357,6 @@ All notable changes to this project will be documented in this file. See * dependencies * @sanity/core-loader bumped to 1.7.11 * devDependencies - * @repo/visual-editing-helpers bumped to 0.7.2 * @sanity/visual-editing bumped to 2.7.1 ## [1.12.15](https://github.com/sanity-io/visual-editing/compare/svelte-loader-v1.12.14...svelte-loader-v1.12.15) (2024-11-12) @@ -385,7 +368,6 @@ All notable changes to this project will be documented in this file. See * dependencies * @sanity/core-loader bumped to 1.7.10 * devDependencies - * @repo/visual-editing-helpers bumped to 0.7.1 * @sanity/visual-editing bumped to 2.7.0 ## [1.12.14](https://github.com/sanity-io/visual-editing/compare/svelte-loader-v1.12.13...svelte-loader-v1.12.14) (2024-11-12) @@ -402,7 +384,6 @@ All notable changes to this project will be documented in this file. See * dependencies * @sanity/core-loader bumped to 1.7.9 * devDependencies - * @repo/visual-editing-helpers bumped to 0.7.0 * @sanity/preview-url-secret bumped to 2.0.3 * @sanity/visual-editing bumped to 2.6.0 @@ -430,7 +411,6 @@ All notable changes to this project will be documented in this file. See * dependencies * @sanity/core-loader bumped to 1.7.8 * devDependencies - * @repo/visual-editing-helpers bumped to 0.6.30 * @sanity/preview-url-secret bumped to 2.0.1 * @sanity/visual-editing bumped to 2.5.1 @@ -461,7 +441,6 @@ All notable changes to this project will be documented in this file. See * dependencies * @sanity/core-loader bumped to 1.7.7 * devDependencies - * @repo/visual-editing-helpers bumped to 0.6.29 * @sanity/visual-editing bumped to 2.4.3 ## [1.12.8](https://github.com/sanity-io/visual-editing/compare/svelte-loader-v1.12.7...svelte-loader-v1.12.8) (2024-10-28) @@ -473,7 +452,6 @@ All notable changes to this project will be documented in this file. See * dependencies * @sanity/core-loader bumped to 1.7.6 * devDependencies - * @repo/visual-editing-helpers bumped to 0.6.28 * @sanity/visual-editing bumped to 2.4.2 ## [1.12.7](https://github.com/sanity-io/visual-editing/compare/svelte-loader-v1.12.6...svelte-loader-v1.12.7) (2024-10-24) @@ -485,7 +463,6 @@ All notable changes to this project will be documented in this file. See * dependencies * @sanity/core-loader bumped to 1.7.5 * devDependencies - * @repo/visual-editing-helpers bumped to 0.6.27 * @sanity/visual-editing bumped to 2.4.1 ## [1.12.6](https://github.com/sanity-io/visual-editing/compare/svelte-loader-v1.12.5...svelte-loader-v1.12.6) (2024-10-24) @@ -497,7 +474,6 @@ All notable changes to this project will be documented in this file. See * dependencies * @sanity/core-loader bumped to 1.7.4 * devDependencies - * @repo/visual-editing-helpers bumped to 0.6.26 * @sanity/visual-editing bumped to 2.4.0 ## [1.12.5](https://github.com/sanity-io/visual-editing/compare/svelte-loader-v1.12.4...svelte-loader-v1.12.5) (2024-10-24) @@ -518,7 +494,6 @@ All notable changes to this project will be documented in this file. See * dependencies * @sanity/core-loader bumped to 1.7.3 * devDependencies - * @repo/visual-editing-helpers bumped to 0.6.25 * @sanity/visual-editing bumped to 2.3.1 ## [1.12.3](https://github.com/sanity-io/visual-editing/compare/svelte-loader-v1.12.2...svelte-loader-v1.12.3) (2024-10-22) @@ -539,7 +514,6 @@ All notable changes to this project will be documented in this file. See * dependencies * @sanity/core-loader bumped to 1.7.2 * devDependencies - * @repo/visual-editing-helpers bumped to 0.6.24 * @sanity/visual-editing bumped to 2.2.2 ## [1.12.1](https://github.com/sanity-io/visual-editing/compare/svelte-loader-v1.12.0...svelte-loader-v1.12.1) (2024-10-21) @@ -556,7 +530,6 @@ All notable changes to this project will be documented in this file. See * dependencies * @sanity/core-loader bumped to 1.7.1 * devDependencies - * @repo/visual-editing-helpers bumped to 0.6.23 * @sanity/visual-editing bumped to 2.2.1 ## [1.12.0](https://github.com/sanity-io/visual-editing/compare/svelte-loader-v1.11.37...svelte-loader-v1.12.0) (2024-10-21) @@ -579,7 +552,6 @@ All notable changes to this project will be documented in this file. See * dependencies * @sanity/core-loader bumped to 1.7.0 * devDependencies - * @repo/visual-editing-helpers bumped to 0.6.22 * @sanity/preview-url-secret bumped to 2.0.0 * @sanity/visual-editing bumped to 2.2.0 @@ -597,7 +569,6 @@ All notable changes to this project will be documented in this file. See * dependencies * @sanity/core-loader bumped to 1.6.23 * devDependencies - * @repo/visual-editing-helpers bumped to 0.6.21 * @sanity/preview-url-secret bumped to 1.6.21 * @sanity/visual-editing bumped to 2.1.10 @@ -615,7 +586,6 @@ All notable changes to this project will be documented in this file. See * dependencies * @sanity/core-loader bumped to 1.6.22 * devDependencies - * @repo/visual-editing-helpers bumped to 0.6.20 * @sanity/preview-url-secret bumped to 1.6.20 * @sanity/visual-editing bumped to 2.1.9 @@ -643,7 +613,6 @@ All notable changes to this project will be documented in this file. See * dependencies * @sanity/core-loader bumped from 1.6.20 to 1.6.21 * devDependencies - * @repo/visual-editing-helpers bumped from 0.6.18 to 0.6.19 * @sanity/preview-url-secret bumped from ^1.6.18 to ^1.6.19 * @sanity/visual-editing bumped from 2.1.6 to 2.1.7 @@ -661,7 +630,6 @@ All notable changes to this project will be documented in this file. See * dependencies * @sanity/core-loader bumped from 1.6.19 to 1.6.20 * devDependencies - * @repo/visual-editing-helpers bumped from 0.6.17 to 0.6.18 * @sanity/preview-url-secret bumped from ^1.6.17 to ^1.6.18 * @sanity/visual-editing bumped from 2.1.5 to 2.1.6 @@ -674,7 +642,6 @@ All notable changes to this project will be documented in this file. See * dependencies * @sanity/core-loader bumped from 1.6.18 to 1.6.19 * devDependencies - * @repo/visual-editing-helpers bumped from 0.6.16 to 0.6.17 * @sanity/visual-editing bumped from 2.1.4 to 2.1.5 ## [1.11.31](https://github.com/sanity-io/visual-editing/compare/svelte-loader-v1.11.30...svelte-loader-v1.11.31) (2024-06-07) @@ -686,7 +653,6 @@ All notable changes to this project will be documented in this file. See * dependencies * @sanity/core-loader bumped from 1.6.17 to 1.6.18 * devDependencies - * @repo/visual-editing-helpers bumped from 0.6.15 to 0.6.16 * @sanity/visual-editing bumped from 2.1.3 to 2.1.4 ## [1.11.30](https://github.com/sanity-io/visual-editing/compare/svelte-loader-v1.11.29...svelte-loader-v1.11.30) (2024-05-30) @@ -703,7 +669,6 @@ All notable changes to this project will be documented in this file. See * dependencies * @sanity/core-loader bumped from 1.6.16 to 1.6.17 * devDependencies - * @repo/visual-editing-helpers bumped from 0.6.14 to 0.6.15 * @sanity/preview-url-secret bumped from ^1.6.16 to ^1.6.17 * @sanity/visual-editing bumped from 2.1.2 to 2.1.3 @@ -740,7 +705,6 @@ All notable changes to this project will be documented in this file. See * dependencies * @sanity/core-loader bumped from 1.6.15 to 1.6.16 * devDependencies - * @repo/visual-editing-helpers bumped from 0.6.13 to 0.6.14 * @sanity/preview-url-secret bumped from ^1.6.14 to ^1.6.15 * @sanity/visual-editing bumped from 2.0.0 to 2.1.0 @@ -767,7 +731,6 @@ All notable changes to this project will be documented in this file. See * dependencies * @sanity/core-loader bumped from 1.6.14 to 1.6.15 * devDependencies - * @repo/visual-editing-helpers bumped from 0.6.12 to 0.6.13 * @sanity/preview-url-secret bumped from ^1.6.13 to ^1.6.14 * @sanity/visual-editing bumped from 1.8.21 to 1.8.22 @@ -799,7 +762,6 @@ All notable changes to this project will be documented in this file. See * dependencies * @sanity/core-loader bumped from 1.6.13 to 1.6.14 * devDependencies - * @repo/visual-editing-helpers bumped from 0.6.11 to 0.6.12 * @sanity/preview-url-secret bumped from ^1.6.12 to ^1.6.13 * @sanity/visual-editing bumped from 1.8.19 to 1.8.20 @@ -812,7 +774,6 @@ All notable changes to this project will be documented in this file. See * dependencies * @sanity/core-loader bumped from 1.6.12 to 1.6.13 * devDependencies - * @repo/visual-editing-helpers bumped from 0.6.10 to 0.6.11 * @sanity/visual-editing bumped from 1.8.18 to 1.8.19 ## [1.11.21](https://github.com/sanity-io/visual-editing/compare/svelte-loader-v1.11.20...svelte-loader-v1.11.21) (2024-05-05) @@ -829,7 +790,6 @@ All notable changes to this project will be documented in this file. See * dependencies * @sanity/core-loader bumped from 1.6.11 to 1.6.12 * devDependencies - * @repo/visual-editing-helpers bumped from 0.6.9 to 0.6.10 * @sanity/preview-url-secret bumped from ^1.6.11 to ^1.6.12 * @sanity/visual-editing bumped from 1.8.17 to 1.8.18 @@ -860,7 +820,6 @@ All notable changes to this project will be documented in this file. See * dependencies * @sanity/core-loader bumped from 1.6.9 to 1.6.10 * devDependencies - * @repo/visual-editing-helpers bumped from 0.6.8 to 0.6.9 * @sanity/visual-editing bumped from 1.8.15 to 1.8.16 ## [1.11.17](https://github.com/sanity-io/visual-editing/compare/svelte-loader-v1.11.16...svelte-loader-v1.11.17) (2024-04-22) @@ -877,7 +836,6 @@ All notable changes to this project will be documented in this file. See * dependencies * @sanity/core-loader bumped from 1.6.8 to 1.6.9 * devDependencies - * @repo/visual-editing-helpers bumped from 0.6.7 to 0.6.8 * @sanity/preview-url-secret bumped from ^1.6.10 to ^1.6.11 * @sanity/visual-editing bumped from 1.8.14 to 1.8.15 @@ -895,7 +853,6 @@ All notable changes to this project will be documented in this file. See * dependencies * @sanity/core-loader bumped from 1.6.7 to 1.6.8 * devDependencies - * @repo/visual-editing-helpers bumped from 0.6.6 to 0.6.7 * @sanity/preview-url-secret bumped from ^1.6.9 to ^1.6.10 * @sanity/visual-editing bumped from 1.8.13 to 1.8.14 @@ -932,7 +889,6 @@ All notable changes to this project will be documented in this file. See * dependencies * @sanity/core-loader bumped from 1.6.6 to 1.6.7 * devDependencies - * @repo/visual-editing-helpers bumped from 0.6.5 to 0.6.6 * @sanity/preview-url-secret bumped from ^1.6.8 to ^1.6.9 * @sanity/visual-editing bumped from 1.8.10 to 1.8.11 @@ -959,7 +915,6 @@ All notable changes to this project will be documented in this file. See * dependencies * @sanity/core-loader bumped from 1.6.5 to 1.6.6 * devDependencies - * @repo/visual-editing-helpers bumped from 0.6.4 to 0.6.5 * @sanity/preview-url-secret bumped from ^1.6.7 to ^1.6.8 * @sanity/visual-editing bumped from 1.8.8 to 1.8.9 @@ -988,7 +943,6 @@ All notable changes to this project will be documented in this file. See * devDependencies * @sanity/preview-url-secret bumped from ^1.6.6 to ^1.6.7 * @sanity/visual-editing bumped from 1.8.6 to 1.8.7 - * @sanity/visual-editing-helpers bumped from 0.6.3 to 0.6.4 ## [1.11.8](https://github.com/sanity-io/visual-editing/compare/svelte-loader-v1.11.7...svelte-loader-v1.11.8) (2024-04-05) @@ -1006,7 +960,6 @@ All notable changes to this project will be documented in this file. See * devDependencies * @sanity/preview-url-secret bumped from ^1.6.5 to ^1.6.6 * @sanity/visual-editing bumped from 1.8.5 to 1.8.6 - * @sanity/visual-editing-helpers bumped from 0.6.2 to 0.6.3 ## [1.11.7](https://github.com/sanity-io/visual-editing/compare/svelte-loader-v1.11.6...svelte-loader-v1.11.7) (2024-04-02) @@ -1044,7 +997,6 @@ All notable changes to this project will be documented in this file. See * devDependencies * @sanity/preview-url-secret bumped from ^1.6.4 to ^1.6.5 * @sanity/visual-editing bumped from 1.8.2 to 1.8.3 - * @sanity/visual-editing-helpers bumped from 0.6.1 to 0.6.2 ## [1.11.4](https://github.com/sanity-io/visual-editing/compare/svelte-loader-v1.11.3...svelte-loader-v1.11.4) (2024-03-18) @@ -1095,7 +1047,6 @@ All notable changes to this project will be documented in this file. See * @sanity/core-loader bumped from 1.6.0 to 1.6.1 * devDependencies * @sanity/visual-editing bumped to 1.7.0 - * @sanity/visual-editing-helpers bumped from 0.6.0 to 0.6.1 ## [1.9.0](https://github.com/sanity-io/visual-editing/compare/svelte-loader-v1.8.1...svelte-loader-v1.9.0) (2024-03-06) @@ -1112,7 +1063,6 @@ All notable changes to this project will be documented in this file. See * @sanity/core-loader bumped from 1.5.1 to 1.6.0 * devDependencies * @sanity/visual-editing bumped to 1.6.0 - * @sanity/visual-editing-helpers bumped from 0.5.2 to 0.6.0 ## [1.8.1](https://github.com/sanity-io/visual-editing/compare/svelte-loader-v1.8.0...svelte-loader-v1.8.1) (2024-03-01) @@ -1146,8 +1096,6 @@ All notable changes to this project will be documented in this file. See * The following workspace dependencies were updated * dependencies * @sanity/core-loader bumped from 1.4.6 to 1.5.0 - * devDependencies - * @sanity/visual-editing-helpers bumped from 0.5.1 to 0.5.2 ## [1.7.7](https://github.com/sanity-io/visual-editing/compare/svelte-loader-v1.7.6...svelte-loader-v1.7.7) (2024-02-26) @@ -1164,7 +1112,6 @@ All notable changes to this project will be documented in this file. See * @sanity/core-loader bumped from 1.4.5 to 1.4.6 * devDependencies * @sanity/preview-url-secret bumped from ^1.6.3 to ^1.6.4 - * @sanity/visual-editing-helpers bumped from 0.5.0 to 0.5.1 ## [1.7.4](https://github.com/sanity-io/visual-editing/compare/svelte-loader-v1.7.3...svelte-loader-v1.7.4) (2024-02-16) @@ -1181,7 +1128,6 @@ All notable changes to this project will be documented in this file. See * @sanity/core-loader bumped from 1.4.2 to 1.4.3 * devDependencies * @sanity/preview-url-secret bumped from ^1.6.2 to ^1.6.3 - * @sanity/visual-editing-helpers bumped from 0.3.0 to 0.3.1 ## [1.7.3](https://github.com/sanity-io/visual-editing/compare/svelte-loader-v1.7.2...svelte-loader-v1.7.3) (2024-02-15) @@ -1198,7 +1144,6 @@ All notable changes to this project will be documented in this file. See * @sanity/core-loader bumped from 1.4.1 to 1.4.2 * devDependencies * @sanity/preview-url-secret bumped from ^1.6.1 to ^1.6.2 - * @sanity/visual-editing-helpers bumped from 0.2.6 to 0.3.0 ## [1.7.2](https://github.com/sanity-io/visual-editing/compare/svelte-loader-v1.7.1...svelte-loader-v1.7.2) (2024-02-05) @@ -1248,8 +1193,6 @@ All notable changes to this project will be documented in this file. See * The following workspace dependencies were updated * dependencies * @sanity/core-loader bumped from 1.3.9 to 1.3.10 - * devDependencies - * @sanity/visual-editing-helpers bumped from 0.2.5 to 0.2.6 ## [1.6.5](https://github.com/sanity-io/visual-editing/compare/svelte-loader-v1.6.4...svelte-loader-v1.6.5) (2024-01-26) @@ -1267,8 +1210,6 @@ All notable changes to this project will be documented in this file. See * The following workspace dependencies were updated * dependencies * @sanity/core-loader bumped from 1.3.8 to 1.3.9 - * devDependencies - * @sanity/visual-editing-helpers bumped from 0.2.4 to 0.2.5 ## [1.6.2](https://github.com/sanity-io/visual-editing/compare/svelte-loader-v1.6.1...svelte-loader-v1.6.2) (2024-01-10) @@ -1283,8 +1224,6 @@ All notable changes to this project will be documented in this file. See * The following workspace dependencies were updated * dependencies * @sanity/core-loader bumped from 1.3.5 to 1.3.6 - * devDependencies - * @sanity/visual-editing-helpers bumped from 0.2.2 to 0.2.3 ## [1.6.1](https://github.com/sanity-io/visual-editing/compare/svelte-loader-v1.6.0...svelte-loader-v1.6.1) (2024-01-10) @@ -1322,7 +1261,6 @@ All notable changes to this project will be documented in this file. See * @sanity/core-loader bumped from 1.3.3 to 1.3.4 * devDependencies * @sanity/channels bumped from 0.3.0 to 0.4.0 - * @sanity/visual-editing-helpers bumped from 0.2.1 to 0.2.2 ## [1.5.0](https://github.com/sanity-io/visual-editing/compare/svelte-loader-v1.4.3...svelte-loader-v1.5.0) (2024-01-05) @@ -1366,7 +1304,6 @@ All notable changes to this project will be documented in this file. See * @sanity/core-loader bumped from 1.1.4 to 1.2.0 * devDependencies * @sanity/channels bumped from 0.1.0 to 0.2.0 - * @sanity/visual-editing-helpers bumped from 0.1.3 to 0.1.4 ## [1.2.1](https://github.com/sanity-io/visual-editing/compare/svelte-loader-v1.2.0...svelte-loader-v1.2.1) (2023-12-07) @@ -1381,8 +1318,6 @@ All notable changes to this project will be documented in this file. See * The following workspace dependencies were updated * dependencies * @sanity/core-loader bumped from 1.1.2 to 1.1.3 - * devDependencies - * @sanity/visual-editing-helpers bumped from 0.1.1 to 0.1.2 ## [1.2.0](https://github.com/sanity-io/visual-editing/compare/svelte-loader-v1.1.1...svelte-loader-v1.2.0) (2023-12-06) @@ -1397,8 +1332,6 @@ All notable changes to this project will be documented in this file. See * The following workspace dependencies were updated * dependencies * @sanity/core-loader bumped from 1.1.1 to 1.1.2 - * devDependencies - * @sanity/visual-editing-helpers bumped from 0.1.0 to 0.1.1 ## [1.1.0](https://github.com/sanity-io/visual-editing/compare/svelte-loader-v1.0.4...svelte-loader-v1.1.0) (2023-12-05) diff --git a/packages/svelte-loader/package.json b/packages/svelte-loader/package.json index 30b021655..663186e0e 100644 --- a/packages/svelte-loader/package.json +++ b/packages/svelte-loader/package.json @@ -55,7 +55,6 @@ "@repo/eslint-config": "workspace:*", "@repo/package.config": "workspace:*", "@repo/prettier-config": "workspace:*", - "@repo/visual-editing-helpers": "workspace:*", "@sanity/pkg-utils": "6.13.4", "@sanity/visual-editing": "workspace:*", "@sveltejs/kit": "^2.15.3", diff --git a/packages/visual-editing-csm/.eslintignore b/packages/visual-editing-csm/.eslintignore new file mode 100644 index 000000000..1521c8b76 --- /dev/null +++ b/packages/visual-editing-csm/.eslintignore @@ -0,0 +1 @@ +dist diff --git a/packages/visual-editing-csm/.gitignore b/packages/visual-editing-csm/.gitignore new file mode 100644 index 000000000..c66ae6b38 --- /dev/null +++ b/packages/visual-editing-csm/.gitignore @@ -0,0 +1 @@ +src/**/*.d.ts diff --git a/packages/visual-editing-csm/README.md b/packages/visual-editing-csm/README.md new file mode 100644 index 000000000..fae80ac84 --- /dev/null +++ b/packages/visual-editing-csm/README.md @@ -0,0 +1,4 @@ +# @sanity/visual-editing-csm + +> [!WARNING] +> This package is not meant to be used directly, it's an internal dependency. Using it in production is at your own risk. diff --git a/packages/visual-editing-helpers/package.config.ts b/packages/visual-editing-csm/package.config.ts similarity index 100% rename from packages/visual-editing-helpers/package.config.ts rename to packages/visual-editing-csm/package.config.ts diff --git a/packages/visual-editing-csm/package.json b/packages/visual-editing-csm/package.json new file mode 100644 index 000000000..7979a2142 --- /dev/null +++ b/packages/visual-editing-csm/package.json @@ -0,0 +1,71 @@ +{ + "name": "@sanity/visual-editing-csm", + "version": "0.0.0", + "homepage": "https://github.com/sanity-io/visual-editing/tree/main/packages/visual-editing-csm#readme", + "bugs": { + "url": "https://github.com/sanity-io/visual-editing/issues" + }, + "repository": { + "type": "git", + "url": "git+ssh://git@github.com/sanity-io/visual-editing.git", + "directory": "packages/visual-editing-csm" + }, + "license": "MIT", + "author": "Sanity.io ", + "sideEffects": false, + "type": "module", + "exports": { + ".": { + "source": "./src/index.ts", + "import": "./dist/index.js", + "require": "./dist/index.cjs", + "default": "./dist/index.js" + }, + "./package.json": "./package.json" + }, + "main": "./dist/index.cjs", + "module": "./dist/index.js", + "types": "./dist/index.d.ts", + "files": [ + "dist", + "src", + "!**/*.test.*", + "CHANGELOG.md" + ], + "scripts": { + "build": "pkg build --strict --check --clean", + "dev": "pkg build --strict", + "lint": "eslint --cache .", + "prepack": "turbo run build", + "test": "vitest --typecheck" + }, + "browserslist": "extends @sanity/browserslist-config", + "eslintConfig": { + "extends": [ + "@repo/eslint-config" + ], + "root": true + }, + "dependencies": { + "@sanity/visual-editing-types": "workspace:^", + "valibot": "0.31.1" + }, + "devDependencies": { + "@repo/eslint-config": "workspace:*", + "@repo/package.config": "workspace:*", + "@sanity/client": "^6.24.3", + "@sanity/pkg-utils": "6.13.4", + "eslint": "^8.57.1", + "typescript": "5.7.3", + "vitest": "^2.1.8" + }, + "peerDependencies": { + "@sanity/client": "^6.24.3" + }, + "engines": { + "node": ">=18" + }, + "publishConfig": { + "access": "public" + } +} diff --git a/packages/visual-editing-csm/src/constants.ts b/packages/visual-editing-csm/src/constants.ts new file mode 100644 index 000000000..ed8b9816a --- /dev/null +++ b/packages/visual-editing-csm/src/constants.ts @@ -0,0 +1 @@ +export const DRAFTS_PREFIX = 'drafts.' diff --git a/packages/visual-editing-helpers/src/createDataAttribute.test.ts b/packages/visual-editing-csm/src/createDataAttribute.test.ts similarity index 98% rename from packages/visual-editing-helpers/src/createDataAttribute.test.ts rename to packages/visual-editing-csm/src/createDataAttribute.test.ts index 75b4c8a2a..4147f12fd 100644 --- a/packages/visual-editing-helpers/src/createDataAttribute.test.ts +++ b/packages/visual-editing-csm/src/createDataAttribute.test.ts @@ -1,5 +1,5 @@ import {describe, expect, test} from 'vitest' -import {createDataAttribute} from '../src/createDataAttribute' +import {createDataAttribute} from './createDataAttribute' describe('createDataAttribute', () => { const type = 'page' diff --git a/packages/visual-editing-helpers/src/createDataAttribute.ts b/packages/visual-editing-csm/src/createDataAttribute.ts similarity index 50% rename from packages/visual-editing-helpers/src/createDataAttribute.ts rename to packages/visual-editing-csm/src/createDataAttribute.ts index c091d289f..40441a167 100644 --- a/packages/visual-editing-helpers/src/createDataAttribute.ts +++ b/packages/visual-editing-csm/src/createDataAttribute.ts @@ -1,6 +1,78 @@ import {studioPath, type StudioPathLike} from '@sanity/client/csm' -import {encodeSanityNodeData} from './csm/transformSanityNodeData' -import type {CreateDataAttribute, CreateDataAttributeProps, SanityNode} from './types' +import type {SanityNode} from '@sanity/visual-editing-types' +import {encodeSanityNodeData} from './encodeSanityNodeData' + +/** + * Helper + * @internal + */ +export type WithRequired = T & {[P in K]-?: T[P]} + +/** + * The metadata that can be embedded in a data attribute. + * All values are marked optional in the base type as they can be provided incrementally using the `createDataAttribute` function. + * @public + */ +export interface CreateDataAttributeProps { + /** The studio base URL, optional */ + baseUrl?: string + /** The dataset, optional */ + dataset?: string + /** The document ID, required */ + id?: string + /** The field path, required */ + path?: StudioPathLike + /** The project ID, optional */ + projectId?: string + /** The studio tool name, optional */ + tool?: string + /** The document type, required */ + type?: string + /** The studio workspace, optional */ + workspace?: string +} + +/** + * @public + */ +export type CreateDataAttribute = (T extends WithRequired< + CreateDataAttributeProps, + 'id' | 'type' | 'path' +> + ? { + /** + * Returns a string representation of the data attribute + * @param path - An optional path to concatenate with any existing path + * @public + */ + (path?: StudioPathLike): string + /** + * Returns a string representation of the data attribute + * @public + */ + toString(): string + } + : T extends WithRequired + ? /** + * Returns a string representation of the data attribute + * @param path - An optional path to concatenate with any existing path + * @public + */ + (path: StudioPathLike) => string + : object) & { + /** + * Concatenate the current path with a new path + * @param path - A path to concatenate with any existing path + * @public + */ + scope(path: StudioPathLike): CreateDataAttribute + /** + * Combines the current props with additional props + * @param props - New props to merge with any existing props + * @public + */ + combine: (props: U) => CreateDataAttribute +} /** * A helper function for creating `data-sanity` attributes by explicitly providing metadata. diff --git a/packages/visual-editing-csm/src/decodeSanityNodeData.test.ts b/packages/visual-editing-csm/src/decodeSanityNodeData.test.ts new file mode 100644 index 000000000..16460de59 --- /dev/null +++ b/packages/visual-editing-csm/src/decodeSanityNodeData.test.ts @@ -0,0 +1,19 @@ +import {expect, test} from 'vitest' +import {decodeSanityString} from './decodeSanityNodeData' + +test('an encoded string returns node data', async () => { + const input = decodeSanityString( + 'id=documentId;type=documentType;path=sections:abcdef.tagline;base=https%3A%2F%2Fsome.sanity.studio;workspace=docs;tool=desk', + ) + + const output = { + id: 'documentId', + type: 'documentType', + path: 'sections[_key=="abcdef"].tagline', + baseUrl: 'https://some.sanity.studio', + tool: 'desk', + workspace: 'docs', + } + + expect(input).toMatchObject(output) +}) diff --git a/packages/visual-editing-helpers/src/csm/transformSanityNodeData.ts b/packages/visual-editing-csm/src/decodeSanityNodeData.ts similarity index 58% rename from packages/visual-editing-helpers/src/csm/transformSanityNodeData.ts rename to packages/visual-editing-csm/src/decodeSanityNodeData.ts index cde67ba26..42681e7b0 100644 --- a/packages/visual-editing-helpers/src/csm/transformSanityNodeData.ts +++ b/packages/visual-editing-csm/src/decodeSanityNodeData.ts @@ -1,38 +1,11 @@ -import {getPublishedId, studioPath} from '@sanity/client/csm' -import { - is, - minLength, - object, - optional, - parse, - pipe, - record, - safeParse, - string, - unknown, -} from 'valibot' -import {pathToUrlString} from '../pathToUrlString' -import type {SanityNode, SanityStegaNode} from '../types' -import {urlStringToPath} from '../urlStringToPath' - -export type {SanityNode, SanityStegaNode} - -export const DRAFTS_PREFIX = 'drafts.' +import {studioPath} from '@sanity/client/csm' +import type {SanityNode, SanityStegaNode} from '@sanity/visual-editing-types' +import {minLength, object, optional, parse, pipe, record, safeParse, string, unknown} from 'valibot' +import {isValidSanityNode} from './isValidSanityNode' +import {sanityNodeSchema} from './sanityNodeSchema' +import {urlStringToPath} from './urlStringToPath' const lengthyStr = pipe(string(), minLength(1)) -const optionalLengthyStr = optional(lengthyStr) - -const sanityNodeSchema = object({ - baseUrl: lengthyStr, - dataset: optionalLengthyStr, - id: lengthyStr, - path: lengthyStr, - projectId: optionalLengthyStr, - tool: optionalLengthyStr, - type: optionalLengthyStr, - workspace: optionalLengthyStr, - isDraft: optional(string()), -}) const sanityLegacyNodeSchema = object({ origin: lengthyStr, @@ -40,50 +13,6 @@ const sanityLegacyNodeSchema = object({ data: optional(record(string(), unknown())), }) -/** @internal */ -export function isValidSanityNode(node: Partial): node is SanityNode { - return is(sanityNodeSchema, node) -} - -/** @internal */ -export function isValidSanityLegacyNode(node: Partial): node is SanityStegaNode { - return is(sanityLegacyNodeSchema, node) -} - -/** - * Transforms sanity node data into an encoded string - * @param node - An unencoded sanity node object - * @returns An encoded string of sanity data - * @public - */ -export function encodeSanityNodeData(node: SanityNode): string | undefined { - const {id: _id, path, baseUrl, tool, workspace, type} = node - - if (!isValidSanityNode(node)) { - return undefined - } - - const parts = [ - ['id', getPublishedId(_id)], - ['type', type], - ['path', pathToUrlString(studioPath.fromString(path))], - ['base', encodeURIComponent(baseUrl)], - ['workspace', workspace], - ['tool', tool], - ['isDraft', _id.startsWith(DRAFTS_PREFIX)], - ] - - return parts - .filter(([, value]) => !!value) - .map((part) => { - const [key, value] = part - // For true values, just display the key - if (value === true) return key - return part.join('=') - }) - .join(';') -} - /** * Transforms a sanity data string into sanity node data * @param str - An encoded string of sanity data diff --git a/packages/visual-editing-helpers/src/csm/transformSanityNodeData.test.ts b/packages/visual-editing-csm/src/encodeSanityNodeData.test.ts similarity index 58% rename from packages/visual-editing-helpers/src/csm/transformSanityNodeData.test.ts rename to packages/visual-editing-csm/src/encodeSanityNodeData.test.ts index c5ea7a9d3..614514146 100644 --- a/packages/visual-editing-helpers/src/csm/transformSanityNodeData.test.ts +++ b/packages/visual-editing-csm/src/encodeSanityNodeData.test.ts @@ -1,5 +1,5 @@ import {expect, test} from 'vitest' -import {decodeSanityString, encodeSanityNodeData} from './transformSanityNodeData' +import {encodeSanityNodeData} from './encodeSanityNodeData' test('node data returns an encoded string', async () => { const input = { @@ -29,20 +29,3 @@ test('incomplete node data returns undefined', async () => { expect(encodeSanityNodeData(input)).toBeUndefined() }) - -test('an encoded string returns node data', async () => { - const input = decodeSanityString( - 'id=documentId;type=documentType;path=sections:abcdef.tagline;base=https%3A%2F%2Fsome.sanity.studio;workspace=docs;tool=desk', - ) - - const output = { - id: 'documentId', - type: 'documentType', - path: 'sections[_key=="abcdef"].tagline', - baseUrl: 'https://some.sanity.studio', - tool: 'desk', - workspace: 'docs', - } - - expect(input).toMatchObject(output) -}) diff --git a/packages/visual-editing-csm/src/encodeSanityNodeData.ts b/packages/visual-editing-csm/src/encodeSanityNodeData.ts new file mode 100644 index 000000000..66752fb74 --- /dev/null +++ b/packages/visual-editing-csm/src/encodeSanityNodeData.ts @@ -0,0 +1,39 @@ +import {getPublishedId, studioPath} from '@sanity/client/csm' +import type {SanityNode} from '@sanity/visual-editing-types' +import {DRAFTS_PREFIX} from './constants' +import {isValidSanityNode} from './isValidSanityNode' +import {pathToUrlString} from './pathToUrlString' + +/** + * Transforms sanity node data into an encoded string + * @param node - An unencoded sanity node object + * @returns An encoded string of sanity data + * @public + */ +export function encodeSanityNodeData(node: SanityNode): string | undefined { + const {id: _id, path, baseUrl, tool, workspace, type} = node + + if (!isValidSanityNode(node)) { + return undefined + } + + const parts = [ + ['id', getPublishedId(_id)], + ['type', type], + ['path', pathToUrlString(studioPath.fromString(path))], + ['base', encodeURIComponent(baseUrl)], + ['workspace', workspace], + ['tool', tool], + ['isDraft', _id.startsWith(DRAFTS_PREFIX)], + ] + + return parts + .filter(([, value]) => !!value) + .map((part) => { + const [key, value] = part + // For true values, just display the key + if (value === true) return key + return part.join('=') + }) + .join(';') +} diff --git a/packages/visual-editing-csm/src/index.ts b/packages/visual-editing-csm/src/index.ts new file mode 100644 index 000000000..ab6e8aade --- /dev/null +++ b/packages/visual-editing-csm/src/index.ts @@ -0,0 +1,12 @@ +export { + createDataAttribute, + type CreateDataAttributeProps, + type CreateDataAttribute, + type WithRequired, +} from './createDataAttribute' +export {urlStringToPath} from './urlStringToPath' +export {encodeSanityNodeData} from './encodeSanityNodeData' +export {decodeSanityNodeData} from './decodeSanityNodeData' +export {DRAFTS_PREFIX} from './constants' +export {pathToUrlString} from './pathToUrlString' +export type {SanityNode, SanityStegaNode} from '@sanity/visual-editing-types' diff --git a/packages/visual-editing-csm/src/isArray.ts b/packages/visual-editing-csm/src/isArray.ts new file mode 100644 index 000000000..1583b1b7b --- /dev/null +++ b/packages/visual-editing-csm/src/isArray.ts @@ -0,0 +1,3 @@ +export function isArray(value: unknown): value is Array { + return value !== null && Array.isArray(value) +} diff --git a/packages/visual-editing-csm/src/isValidSanityNode.ts b/packages/visual-editing-csm/src/isValidSanityNode.ts new file mode 100644 index 000000000..be8dac3ee --- /dev/null +++ b/packages/visual-editing-csm/src/isValidSanityNode.ts @@ -0,0 +1,8 @@ +import type {SanityNode} from '@sanity/visual-editing-types' +import {is} from 'valibot' +import {sanityNodeSchema} from './sanityNodeSchema' + +/** @internal */ +export function isValidSanityNode(node: Partial): node is SanityNode { + return is(sanityNodeSchema, node) +} diff --git a/packages/visual-editing-helpers/src/pathToUrlString.ts b/packages/visual-editing-csm/src/pathToUrlString.ts similarity index 87% rename from packages/visual-editing-helpers/src/pathToUrlString.ts rename to packages/visual-editing-csm/src/pathToUrlString.ts index 6ef363371..01c2ed89a 100644 --- a/packages/visual-editing-helpers/src/pathToUrlString.ts +++ b/packages/visual-editing-csm/src/pathToUrlString.ts @@ -1,5 +1,5 @@ -import {isArray} from './csm/wrap/helpers' -import type {Path} from './types' +import type {Path} from '@sanity/client/csm' +import {isArray} from './isArray' /** @internal */ export function pathToUrlString(path: Path): string { diff --git a/packages/visual-editing-csm/src/sanityNodeSchema.ts b/packages/visual-editing-csm/src/sanityNodeSchema.ts new file mode 100644 index 000000000..de38dcf0e --- /dev/null +++ b/packages/visual-editing-csm/src/sanityNodeSchema.ts @@ -0,0 +1,16 @@ +import {minLength, object, optional, pipe, string} from 'valibot' + +const lengthyStr = pipe(string(), minLength(1)) +const optionalLengthyStr = optional(lengthyStr) + +export const sanityNodeSchema = object({ + baseUrl: lengthyStr, + dataset: optionalLengthyStr, + id: lengthyStr, + path: lengthyStr, + projectId: optionalLengthyStr, + tool: optionalLengthyStr, + type: optionalLengthyStr, + workspace: optionalLengthyStr, + isDraft: optional(string()), +}) diff --git a/packages/visual-editing-helpers/src/urlStringToPath.test.ts b/packages/visual-editing-csm/src/urlStringToPath.test.ts similarity index 100% rename from packages/visual-editing-helpers/src/urlStringToPath.test.ts rename to packages/visual-editing-csm/src/urlStringToPath.test.ts diff --git a/packages/visual-editing-helpers/src/urlStringToPath.ts b/packages/visual-editing-csm/src/urlStringToPath.ts similarity index 94% rename from packages/visual-editing-helpers/src/urlStringToPath.ts rename to packages/visual-editing-csm/src/urlStringToPath.ts index b2f43fe10..0b2c3a2f8 100644 --- a/packages/visual-editing-helpers/src/urlStringToPath.ts +++ b/packages/visual-editing-csm/src/urlStringToPath.ts @@ -1,4 +1,4 @@ -import type {Path} from './types' +import type {Path} from '@sanity/client/csm' const RE_SEGMENT_WITH_INDEX = /^([\w-]+):(0|[1-9][0-9]*)$/ const RE_SEGMENT_WITH_TUPLE = /^([\w-]+):([0-9]+),([0-9]+)$/ diff --git a/packages/visual-editing-csm/tsconfig.base.json b/packages/visual-editing-csm/tsconfig.base.json new file mode 100644 index 000000000..2684a948d --- /dev/null +++ b/packages/visual-editing-csm/tsconfig.base.json @@ -0,0 +1,7 @@ +{ + "extends": "@sanity/pkg-utils/tsconfig/strictest.json", + "compilerOptions": { + "rootDir": ".", + "outDir": "dist" + } +} diff --git a/packages/visual-editing-csm/tsconfig.build.json b/packages/visual-editing-csm/tsconfig.build.json new file mode 100644 index 000000000..83b7b37c7 --- /dev/null +++ b/packages/visual-editing-csm/tsconfig.build.json @@ -0,0 +1,8 @@ +{ + "extends": "./tsconfig.base", + "compilerOptions": { + "rootDir": "src" + }, + "include": ["src/**/*.ts"], + "exclude": ["dist", "node_modules"] +} diff --git a/packages/visual-editing-csm/tsconfig.json b/packages/visual-editing-csm/tsconfig.json new file mode 100644 index 000000000..f9f8d7b3e --- /dev/null +++ b/packages/visual-editing-csm/tsconfig.json @@ -0,0 +1,5 @@ +{ + "extends": "./tsconfig.base", + "include": ["**/*.ts"], + "exclude": ["dist", "node_modules"] +} diff --git a/packages/visual-editing-csm/turbo.json b/packages/visual-editing-csm/turbo.json new file mode 100644 index 000000000..07728cc5b --- /dev/null +++ b/packages/visual-editing-csm/turbo.json @@ -0,0 +1,9 @@ +{ + "$schema": "https://turbo.build/schema.json", + "extends": ["//"], + "tasks": { + "dev": { + "persistent": false + } + } +} diff --git a/packages/visual-editing-csm/vitest.config.ts b/packages/visual-editing-csm/vitest.config.ts new file mode 100644 index 000000000..b94ac31fc --- /dev/null +++ b/packages/visual-editing-csm/vitest.config.ts @@ -0,0 +1,9 @@ +import {defineConfig} from 'vitest/config' + +export default defineConfig({ + test: { + typecheck: { + tsconfig: 'tsconfig.build.json', + }, + }, +}) diff --git a/packages/visual-editing-helpers/CHANGELOG.md b/packages/visual-editing-helpers/CHANGELOG.md deleted file mode 100644 index ae5294000..000000000 --- a/packages/visual-editing-helpers/CHANGELOG.md +++ /dev/null @@ -1,596 +0,0 @@ -# Changelog - -## [0.7.14](https://github.com/sanity-io/visual-editing/compare/visual-editing-helpers-v0.7.13...visual-editing-helpers-v0.7.14) (2025-01-14) - - -### Bug Fixes - -* explicitly fetch preview snapshots on connect ([#2487](https://github.com/sanity-io/visual-editing/issues/2487)) ([cf07d56](https://github.com/sanity-io/visual-editing/commit/cf07d56b8feca6b815d7609b69c3a51769442263)) - -## [0.7.13](https://github.com/sanity-io/visual-editing/compare/visual-editing-helpers-v0.7.12...visual-editing-helpers-v0.7.13) (2025-01-09) - - -### Dependencies - -* The following workspace dependencies were updated - * devDependencies - * @sanity/comlink bumped to 3.0.0 - * peerDependencies - * @sanity/comlink bumped to 3.0.0 - -## [0.7.12](https://github.com/sanity-io/visual-editing/compare/visual-editing-helpers-v0.7.11...visual-editing-helpers-v0.7.12) (2025-01-09) - - -### Bug Fixes - -* ship react 19 ready typings ([67b9187](https://github.com/sanity-io/visual-editing/commit/67b9187bbfd6d31fca437dd9c9eb80b1f1c296a4)) - - -### Dependencies - -* The following workspace dependencies were updated - * devDependencies - * @sanity/comlink bumped to 2.0.5 - * peerDependencies - * @sanity/comlink bumped to 2.0.5 - -## [0.7.11](https://github.com/sanity-io/visual-editing/compare/visual-editing-helpers-v0.7.10...visual-editing-helpers-v0.7.11) (2025-01-06) - - -### Dependencies - -* The following workspace dependencies were updated - * devDependencies - * @sanity/comlink bumped to 2.0.4 - * peerDependencies - * @sanity/comlink bumped to 2.0.4 - -## [0.7.10](https://github.com/sanity-io/visual-editing/compare/visual-editing-helpers-v0.7.9...visual-editing-helpers-v0.7.10) (2024-12-21) - - -### Dependencies - -* The following workspace dependencies were updated - * devDependencies - * @sanity/comlink bumped to 2.0.3 - * peerDependencies - * @sanity/comlink bumped to 2.0.3 - -## [0.7.9](https://github.com/sanity-io/visual-editing/compare/visual-editing-helpers-v0.7.8...visual-editing-helpers-v0.7.9) (2024-12-16) - - -### Bug Fixes - -* add visual-editing telemetry ([#2263](https://github.com/sanity-io/visual-editing/issues/2263)) ([8d2fd18](https://github.com/sanity-io/visual-editing/commit/8d2fd18dfd5bd99d8953acb2d47999892c38eb5d)) - -## [0.7.8](https://github.com/sanity-io/visual-editing/compare/visual-editing-helpers-v0.7.7...visual-editing-helpers-v0.7.8) (2024-12-16) - - -### Dependencies - -* The following workspace dependencies were updated - * devDependencies - * @sanity/comlink bumped to 2.0.2 - * peerDependencies - * @sanity/comlink bumped to 2.0.2 - -## [0.7.7](https://github.com/sanity-io/visual-editing/compare/visual-editing-helpers-v0.7.6...visual-editing-helpers-v0.7.7) (2024-12-05) - - -### Dependencies - -* The following workspace dependencies were updated - * devDependencies - * @sanity/comlink bumped to 2.0.1 - * peerDependencies - * @sanity/comlink bumped to 2.0.1 - -## [0.7.6](https://github.com/sanity-io/visual-editing/compare/visual-editing-helpers-v0.7.5...visual-editing-helpers-v0.7.6) (2024-12-02) - - -### Bug Fixes - -* **deps:** update dependency @sanity/client to ^6.23.0 ([#2244](https://github.com/sanity-io/visual-editing/issues/2244)) ([eeacde8](https://github.com/sanity-io/visual-editing/commit/eeacde893e6534b14344581456e3e2147b84f75b)) - -## [0.7.5](https://github.com/sanity-io/visual-editing/compare/visual-editing-helpers-v0.7.4...visual-editing-helpers-v0.7.5) (2024-11-28) - - -### Dependencies - -* The following workspace dependencies were updated - * devDependencies - * @sanity/comlink bumped to 2.0.0 - * peerDependencies - * @sanity/comlink bumped to 2.0.0 - -## [0.7.4](https://github.com/sanity-io/visual-editing/compare/visual-editing-helpers-v0.7.3...visual-editing-helpers-v0.7.4) (2024-11-26) - - -### Dependencies - -* The following workspace dependencies were updated - * devDependencies - * @sanity/comlink bumped to 1.1.4 - * peerDependencies - * @sanity/comlink bumped to 1.1.4 - -## [0.7.3](https://github.com/sanity-io/visual-editing/compare/visual-editing-helpers-v0.7.2...visual-editing-helpers-v0.7.3) (2024-11-19) - - -### Bug Fixes - -* **deps:** update dependency @sanity/client to ^6.22.5 ([#2185](https://github.com/sanity-io/visual-editing/issues/2185)) ([da0aa32](https://github.com/sanity-io/visual-editing/commit/da0aa328063f1711687f8459ca00fd95a0b69ccb)) - -## [0.7.2](https://github.com/sanity-io/visual-editing/compare/visual-editing-helpers-v0.7.1...visual-editing-helpers-v0.7.2) (2024-11-14) - - -### Dependencies - -* The following workspace dependencies were updated - * devDependencies - * @sanity/comlink bumped to 1.1.3 - * peerDependencies - * @sanity/comlink bumped to 1.1.3 - -## [0.7.1](https://github.com/sanity-io/visual-editing/compare/visual-editing-helpers-v0.7.0...visual-editing-helpers-v0.7.1) (2024-11-12) - - -### Dependencies - -* The following workspace dependencies were updated - * devDependencies - * @sanity/comlink bumped to 1.1.2 - * peerDependencies - * @sanity/comlink bumped to 1.1.2 - -## [0.7.0](https://github.com/sanity-io/visual-editing/compare/visual-editing-helpers-v0.6.30...visual-editing-helpers-v0.7.0) (2024-11-12) - - -### Features - -* add shared state ([#2120](https://github.com/sanity-io/visual-editing/issues/2120)) ([1fb8143](https://github.com/sanity-io/visual-editing/commit/1fb814396cc6a867418b00e07751f493d202d58b)) - - -### Bug Fixes - -* **deps:** update dependency @sanity/client to ^6.22.4 ([#2132](https://github.com/sanity-io/visual-editing/issues/2132)) ([4f96d9a](https://github.com/sanity-io/visual-editing/commit/4f96d9a539094173caf1644a67f168492f3a35c4)) - -## [0.6.30](https://github.com/sanity-io/visual-editing/compare/visual-editing-helpers-v0.6.29...visual-editing-helpers-v0.6.30) (2024-11-06) - - -### Bug Fixes - -* **deps:** update dependency @sanity/client to ^6.22.3 ([0b78719](https://github.com/sanity-io/visual-editing/commit/0b7871937422d0d8dfe7851bd1603141f0c434c4)) - -## [0.6.29](https://github.com/sanity-io/visual-editing/compare/visual-editing-helpers-v0.6.28...visual-editing-helpers-v0.6.29) (2024-11-04) - - -### Bug Fixes - -* **presentation:** remove media from preview snapshot payload ([#2079](https://github.com/sanity-io/visual-editing/issues/2079)) ([f1d04b3](https://github.com/sanity-io/visual-editing/commit/f1d04b396abbba1879c1f1f0b605269e94f4400f)) -* **visual-editing-helpers:** include connection id in handshake payload for backwards compatibility ([#2078](https://github.com/sanity-io/visual-editing/issues/2078)) ([529fb5b](https://github.com/sanity-io/visual-editing/commit/529fb5bd3be2c298c2e394e16b7ea05eacab8486)) - -## [0.6.28](https://github.com/sanity-io/visual-editing/compare/visual-editing-helpers-v0.6.27...visual-editing-helpers-v0.6.28) (2024-10-28) - - -### Bug Fixes - -* **visual-editing:** nested union schema field resolution ([#2056](https://github.com/sanity-io/visual-editing/issues/2056)) ([1d20494](https://github.com/sanity-io/visual-editing/commit/1d2049402b50a121c5652e2cc7ced7a513863502)) - -## [0.6.27](https://github.com/sanity-io/visual-editing/compare/visual-editing-helpers-v0.6.26...visual-editing-helpers-v0.6.27) (2024-10-24) - - -### Dependencies - -* The following workspace dependencies were updated - * devDependencies - * @sanity/comlink bumped to 1.1.1 - * peerDependencies - * @sanity/comlink bumped to 1.1.1 - -## [0.6.26](https://github.com/sanity-io/visual-editing/compare/visual-editing-helpers-v0.6.25...visual-editing-helpers-v0.6.26) (2024-10-24) - - -### Dependencies - -* The following workspace dependencies were updated - * devDependencies - * @sanity/comlink bumped to 1.1.0 - * peerDependencies - * @sanity/comlink bumped to 1.1.0 - -## [0.6.25](https://github.com/sanity-io/visual-editing/compare/visual-editing-helpers-v0.6.24...visual-editing-helpers-v0.6.25) (2024-10-23) - - -### Bug Fixes - -* resolve issues with newly added canary features ([#2036](https://github.com/sanity-io/visual-editing/issues/2036)) ([7b6507b](https://github.com/sanity-io/visual-editing/commit/7b6507b35c48e5307e7a2e70536d4336e18327b6)) - -## [0.6.24](https://github.com/sanity-io/visual-editing/compare/visual-editing-helpers-v0.6.23...visual-editing-helpers-v0.6.24) (2024-10-21) - - -### Bug Fixes - -* stop inlining rxjs and `@sanity/comlink` ([#2012](https://github.com/sanity-io/visual-editing/issues/2012)) ([8df6708](https://github.com/sanity-io/visual-editing/commit/8df670861f40a762684f936fb968e3fbde4f63ba)) - -## [0.6.23](https://github.com/sanity-io/visual-editing/compare/visual-editing-helpers-v0.6.22...visual-editing-helpers-v0.6.23) (2024-10-21) - - -### Bug Fixes - -* **comlink:** handle heartbeat compatibility correctly ([#2006](https://github.com/sanity-io/visual-editing/issues/2006)) ([65af1e1](https://github.com/sanity-io/visual-editing/commit/65af1e17aa329d5f5282152d4b77bca8750a539f)) - -## [0.6.22](https://github.com/sanity-io/visual-editing/compare/visual-editing-helpers-v0.6.21...visual-editing-helpers-v0.6.22) (2024-10-21) - - -### Bug Fixes - -* **deps:** update dependency @sanity/client to ^6.22.2 ([8617331](https://github.com/sanity-io/visual-editing/commit/86173315ffc6704c26d5f2d6e5fe6fed1838ad0d)) - - -### Dependencies - -* The following workspace dependencies were updated - * devDependencies - * @sanity/comlink bumped to 1.0.0 - -## [0.6.21](https://github.com/sanity-io/visual-editing/compare/visual-editing-helpers-v0.6.20...visual-editing-helpers-v0.6.21) (2024-09-11) - - -### Bug Fixes - -* **deps:** update dependency @sanity/client to ^6.21.3 ([#1793](https://github.com/sanity-io/visual-editing/issues/1793)) ([1dc1b1b](https://github.com/sanity-io/visual-editing/commit/1dc1b1b9222e6a2f36d6b807415dc1a9b0a2426a)) - -## [0.6.20](https://github.com/sanity-io/visual-editing/compare/visual-editing-helpers-v0.6.19...visual-editing-helpers-v0.6.20) (2024-08-12) - - -### Bug Fixes - -* **deps:** update dependency @sanity/client to v6.21.2 ([#1749](https://github.com/sanity-io/visual-editing/issues/1749)) ([b9efdd2](https://github.com/sanity-io/visual-editing/commit/b9efdd2a672fdef518bc22a29a25992c938ba1ef)) - -## [0.6.19](https://github.com/sanity-io/visual-editing/compare/visual-editing-helpers-v0.6.18...visual-editing-helpers-v0.6.19) (2024-08-02) - - -### Bug Fixes - -* **deps:** update dependency @sanity/client to v6.21.1 ([#1704](https://github.com/sanity-io/visual-editing/issues/1704)) ([32f1ef8](https://github.com/sanity-io/visual-editing/commit/32f1ef8582134a130d6325320274a981217ee2e8)) - -## [0.6.18](https://github.com/sanity-io/visual-editing/compare/visual-editing-helpers-v0.6.17...visual-editing-helpers-v0.6.18) (2024-07-03) - - -### Bug Fixes - -* **deps:** update dependency @sanity/client to v6.20.1 ([#1680](https://github.com/sanity-io/visual-editing/issues/1680)) ([bb89688](https://github.com/sanity-io/visual-editing/commit/bb8968816838a60a32242ce803a3ef804f2f885e)) - -## [0.6.17](https://github.com/sanity-io/visual-editing/compare/visual-editing-helpers-v0.6.16...visual-editing-helpers-v0.6.17) (2024-06-13) - - -### Bug Fixes - -* **deps:** Update dependency valibot to v0.31.1 ([#1645](https://github.com/sanity-io/visual-editing/issues/1645)) ([0cc3a62](https://github.com/sanity-io/visual-editing/commit/0cc3a62023b8746ba297fc70b690e36d9cf21aa4)) - -## [0.6.16](https://github.com/sanity-io/visual-editing/compare/visual-editing-helpers-v0.6.15...visual-editing-helpers-v0.6.16) (2024-06-07) - - -### Bug Fixes - -* **deps:** Update dependency valibot to v0.31.0 ([#1636](https://github.com/sanity-io/visual-editing/issues/1636)) ([b4228b8](https://github.com/sanity-io/visual-editing/commit/b4228b851cc0bf0aef083bfbc3ae8c8ce2593000)) - -## [0.6.15](https://github.com/sanity-io/visual-editing/compare/visual-editing-helpers-v0.6.14...visual-editing-helpers-v0.6.15) (2024-05-30) - - -### Bug Fixes - -* **deps:** update dependency @sanity/client to v6.19.1 ([#1602](https://github.com/sanity-io/visual-editing/issues/1602)) ([ebaa50c](https://github.com/sanity-io/visual-editing/commit/ebaa50ca0bf6f6324819a9b3ceb85eb1326d7d72)) - -## [0.6.14](https://github.com/sanity-io/visual-editing/compare/visual-editing-helpers-v0.6.13...visual-editing-helpers-v0.6.14) (2024-05-28) - - -### Bug Fixes - -* **deps:** update dependency @sanity/client to v6.19.0 ([#1575](https://github.com/sanity-io/visual-editing/issues/1575)) ([f0094a1](https://github.com/sanity-io/visual-editing/commit/f0094a1ee716f856cc424f82bc68ca2b99881575)) - -## [0.6.13](https://github.com/sanity-io/visual-editing/compare/visual-editing-helpers-v0.6.12...visual-editing-helpers-v0.6.13) (2024-05-27) - - -### Bug Fixes - -* **deps:** update dependency @sanity/client to v6.18.3 ([#1563](https://github.com/sanity-io/visual-editing/issues/1563)) ([609a3b1](https://github.com/sanity-io/visual-editing/commit/609a3b1ad00b0809ba1f926328cee4d082668bf1)) - -## [0.6.12](https://github.com/sanity-io/visual-editing/compare/visual-editing-helpers-v0.6.11...visual-editing-helpers-v0.6.12) (2024-05-15) - - -### Bug Fixes - -* **deps:** update dependency @sanity/client to v6.18.2 ([#1519](https://github.com/sanity-io/visual-editing/issues/1519)) ([78c387e](https://github.com/sanity-io/visual-editing/commit/78c387eba9c29c9a6f6e7d6b392a04a9cd5724ab)) - -## [0.6.11](https://github.com/sanity-io/visual-editing/compare/visual-editing-helpers-v0.6.10...visual-editing-helpers-v0.6.11) (2024-05-13) - - -### Bug Fixes - -* improve createDataAttribute types ([#1458](https://github.com/sanity-io/visual-editing/issues/1458)) ([e51189f](https://github.com/sanity-io/visual-editing/commit/e51189fa301e97bcd892d73df5070c153146e867)) - -## [0.6.10](https://github.com/sanity-io/visual-editing/compare/visual-editing-helpers-v0.6.9...visual-editing-helpers-v0.6.10) (2024-05-05) - - -### Bug Fixes - -* **deps:** update dependency @sanity/client to v6.17.2 ([#1449](https://github.com/sanity-io/visual-editing/issues/1449)) ([928b45c](https://github.com/sanity-io/visual-editing/commit/928b45c47c66c5e1ddbe8b00783efd399b9fa17a)) - -## [0.6.9](https://github.com/sanity-io/visual-editing/compare/visual-editing-helpers-v0.6.8...visual-editing-helpers-v0.6.9) (2024-04-26) - - -### Bug Fixes - -* **deps:** Update react monorepo to ^18.3.0 ([#1409](https://github.com/sanity-io/visual-editing/issues/1409)) ([1dedfee](https://github.com/sanity-io/visual-editing/commit/1dedfee39a056308f68e8dc77e9d0295f82a53a7)) -* revert react peer dep to ^18.2.0 ([#1414](https://github.com/sanity-io/visual-editing/issues/1414)) ([3578262](https://github.com/sanity-io/visual-editing/commit/3578262da3f94df17b626e31981bef473cd21840)) - -## [0.6.8](https://github.com/sanity-io/visual-editing/compare/visual-editing-helpers-v0.6.7...visual-editing-helpers-v0.6.8) (2024-04-22) - - -### Bug Fixes - -* **deps:** update dependency @sanity/client to v6.15.20 ([#1385](https://github.com/sanity-io/visual-editing/issues/1385)) ([8ead6bf](https://github.com/sanity-io/visual-editing/commit/8ead6bf64505b194ebe1b084d6f5b6d4f1d7196e)) - -## [0.6.7](https://github.com/sanity-io/visual-editing/compare/visual-editing-helpers-v0.6.6...visual-editing-helpers-v0.6.7) (2024-04-19) - - -### Bug Fixes - -* **deps:** update dependency @sanity/client to v6.15.19 ([#1374](https://github.com/sanity-io/visual-editing/issues/1374)) ([fde2034](https://github.com/sanity-io/visual-editing/commit/fde203405fe8899fd1bd241523853b732c095b37)) - -## [0.6.6](https://github.com/sanity-io/visual-editing/compare/visual-editing-helpers-v0.6.5...visual-editing-helpers-v0.6.6) (2024-04-17) - - -### Bug Fixes - -* **deps:** update dependency @sanity/client to v6.15.17 ([d203cbd](https://github.com/sanity-io/visual-editing/commit/d203cbd6a9aa1b289c41667406540da30ca72be1)) - -## [0.6.5](https://github.com/sanity-io/visual-editing/compare/visual-editing-helpers-v0.6.4...visual-editing-helpers-v0.6.5) (2024-04-16) - - -### Bug Fixes - -* **deps:** update dependency @sanity/client to v6.15.13 ([#1327](https://github.com/sanity-io/visual-editing/issues/1327)) ([a52f2c2](https://github.com/sanity-io/visual-editing/commit/a52f2c2180e1da09a8166e516aaeb206e13e13ae)) - -## [0.6.4](https://github.com/sanity-io/visual-editing/compare/visual-editing-helpers-v0.6.3...visual-editing-helpers-v0.6.4) (2024-04-05) - - -### Bug Fixes - -* **deps:** update dependency @sanity/client to v6.15.11 ([#1273](https://github.com/sanity-io/visual-editing/issues/1273)) ([d2131b7](https://github.com/sanity-io/visual-editing/commit/d2131b7ec338b9d00a0040c6113b78b828ef4f2f)) - -## [0.6.3](https://github.com/sanity-io/visual-editing/compare/visual-editing-helpers-v0.6.2...visual-editing-helpers-v0.6.3) (2024-04-05) - - -### Bug Fixes - -* **deps:** update dependency @sanity/client to v6.15.10 ([#1258](https://github.com/sanity-io/visual-editing/issues/1258)) ([9bf3cdb](https://github.com/sanity-io/visual-editing/commit/9bf3cdbcb7924cdcb96b7de15a159457385e8fec)) - -## [0.6.2](https://github.com/sanity-io/visual-editing/compare/visual-editing-helpers-v0.6.1...visual-editing-helpers-v0.6.2) (2024-03-20) - - -### Bug Fixes - -* ship TS Node16 compatible typings ([a21794d](https://github.com/sanity-io/visual-editing/commit/a21794dec5001867279a5979403220060b1d16f0)) - -## [0.6.1](https://github.com/sanity-io/visual-editing/compare/visual-editing-helpers-v0.6.0...visual-editing-helpers-v0.6.1) (2024-03-07) - - -### Bug Fixes - -* **deps:** Update dependency valibot to v0.30.0 ([#1071](https://github.com/sanity-io/visual-editing/issues/1071)) ([8734f34](https://github.com/sanity-io/visual-editing/commit/8734f348c44e9908e240e45b1ce5d64fd20b308e)) - -## [0.6.0](https://github.com/sanity-io/visual-editing/compare/visual-editing-helpers-v0.5.2...visual-editing-helpers-v0.6.0) (2024-03-06) - - -### Features - -* **visual-editing:** export `createDataAttribute` ([#1037](https://github.com/sanity-io/visual-editing/issues/1037)) ([2db8ac3](https://github.com/sanity-io/visual-editing/commit/2db8ac325cd66c6eea1697003dd2c39cab48e92a)) - -## [0.5.2](https://github.com/sanity-io/visual-editing/compare/visual-editing-helpers-v0.5.1...visual-editing-helpers-v0.5.2) (2024-02-27) - - -### Bug Fixes - -* allow encoding draft ids ([#982](https://github.com/sanity-io/visual-editing/issues/982)) ([637a33d](https://github.com/sanity-io/visual-editing/commit/637a33d8dbfd22fc7a664f0d828cf2450556cc73)) - -## [0.5.1](https://github.com/sanity-io/visual-editing/compare/visual-editing-helpers-v0.5.0...visual-editing-helpers-v0.5.1) (2024-02-26) - - -### Bug Fixes - -* **deps:** update dependency @sanity/client to v6.14.4 ([#1002](https://github.com/sanity-io/visual-editing/issues/1002)) ([1239cb2](https://github.com/sanity-io/visual-editing/commit/1239cb24da0f9132f6093f8ae9eccd275565fc7d)) - -## [0.5.0](https://github.com/sanity-io/visual-editing/compare/visual-editing-helpers-v0.4.0...visual-editing-helpers-v0.5.0) (2024-02-23) - - -### Features - -* add refresh mutation API ([#981](https://github.com/sanity-io/visual-editing/issues/981)) ([e507647](https://github.com/sanity-io/visual-editing/commit/e507647b61b9dac6c74b64d3f1e95fae1b546702)) - -## [0.4.0](https://github.com/sanity-io/visual-editing/compare/visual-editing-helpers-v0.3.1...visual-editing-helpers-v0.4.0) (2024-02-21) - - -### Features - -* **visual-editing:** report documents on page ([#942](https://github.com/sanity-io/visual-editing/issues/942)) ([f47c13e](https://github.com/sanity-io/visual-editing/commit/f47c13eebf71367d4be9a883025b4bc293a518f4)) - - -### Bug Fixes - -* **deps:** Update dependency valibot to v0.29.0 ([#953](https://github.com/sanity-io/visual-editing/issues/953)) ([a31911b](https://github.com/sanity-io/visual-editing/commit/a31911b52a78d1290c91eca068692932472e2a1f)) - -## [0.3.1](https://github.com/sanity-io/visual-editing/compare/visual-editing-helpers-v0.3.0...visual-editing-helpers-v0.3.1) (2024-02-16) - - -### Bug Fixes - -* **deps:** update dependency @sanity/client to v6.13.3 ([#929](https://github.com/sanity-io/visual-editing/issues/929)) ([f711adc](https://github.com/sanity-io/visual-editing/commit/f711adc089198de325c55bc43a02c062ef9eef0e)) - -## [0.3.0](https://github.com/sanity-io/visual-editing/compare/visual-editing-helpers-v0.2.6...visual-editing-helpers-v0.3.0) (2024-02-15) - - -### Features - -* support comments intent ([#901](https://github.com/sanity-io/visual-editing/issues/901)) ([91017aa](https://github.com/sanity-io/visual-editing/commit/91017aa1ed59c23fbeae51148b424d3dc236ef9b)) - - -### Bug Fixes - -* **deps:** update dependency @sanity/client to v6.13.3 ([#921](https://github.com/sanity-io/visual-editing/issues/921)) ([e150d8d](https://github.com/sanity-io/visual-editing/commit/e150d8d375a0fc12d8b9d4d11f04454a93a6a2c0)) -* **deps:** Update sanity monorepo to ^3.29.0 ([#903](https://github.com/sanity-io/visual-editing/issues/903)) ([cc1b9e5](https://github.com/sanity-io/visual-editing/commit/cc1b9e50d1512479fa279b1d07791955592bc2d4)) - -## [0.2.6](https://github.com/sanity-io/visual-editing/compare/visual-editing-helpers-v0.2.5...visual-editing-helpers-v0.2.6) (2024-01-29) - - -### Bug Fixes - -* **deps:** update dependency @sanity/client to ^6.12.3 ([#787](https://github.com/sanity-io/visual-editing/issues/787)) ([634d8a3](https://github.com/sanity-io/visual-editing/commit/634d8a35f4db4ac04157f5e3d01eff9abfba2f99)) -* **deps:** Update dependency valibot to v0.27.1 ([#785](https://github.com/sanity-io/visual-editing/issues/785)) ([2015de4](https://github.com/sanity-io/visual-editing/commit/2015de4d07197bf61177e70d33ef4371763caa8f)) - -## [0.2.5](https://github.com/sanity-io/visual-editing/compare/visual-editing-helpers-v0.2.4...visual-editing-helpers-v0.2.5) (2024-01-26) - - -### Bug Fixes - -* **deps:** update dependency @sanity/client to ^6.11.2 ([#745](https://github.com/sanity-io/visual-editing/issues/745)) ([7f24dd6](https://github.com/sanity-io/visual-editing/commit/7f24dd64c3e1147c77b8b92a7ca5635f2bde4b39)) -* **deps:** update dependency @sanity/client to ^6.11.3 ([#755](https://github.com/sanity-io/visual-editing/issues/755)) ([148ce5a](https://github.com/sanity-io/visual-editing/commit/148ce5acad111fe885a2d21662e0e1d61094916a)) -* **deps:** update dependency @sanity/client to ^6.12.1 ([#774](https://github.com/sanity-io/visual-editing/issues/774)) ([4ba2074](https://github.com/sanity-io/visual-editing/commit/4ba2074d807fb6c69c17b783cba1d7154846782f)) -* **deps:** Update dependency valibot to v0.27.0 ([#752](https://github.com/sanity-io/visual-editing/issues/752)) ([e07e239](https://github.com/sanity-io/visual-editing/commit/e07e2399c17db0cc0e183de04b252451821b5037)) -* **deps:** Update sanity monorepo to ^3.26.1 ([#772](https://github.com/sanity-io/visual-editing/issues/772)) ([6e4b171](https://github.com/sanity-io/visual-editing/commit/6e4b17158fd6f98bfeab0752097698dd2c121606)) - -## [0.2.4](https://github.com/sanity-io/visual-editing/compare/visual-editing-helpers-v0.2.3...visual-editing-helpers-v0.2.4) (2024-01-19) - - -### Bug Fixes - -* **deps:** Update dependency valibot to v0.26.0 ([#717](https://github.com/sanity-io/visual-editing/issues/717)) ([1437bd1](https://github.com/sanity-io/visual-editing/commit/1437bd1b6e402d9dd551bcb9588734be48a5b9bd)) -* **deps:** Update sanity monorepo to ^3.25.0 ([#709](https://github.com/sanity-io/visual-editing/issues/709)) ([aba05de](https://github.com/sanity-io/visual-editing/commit/aba05de6c24470f4c1e1be1ab7c88903c9570e15)) - -## [0.2.3](https://github.com/sanity-io/visual-editing/compare/visual-editing-helpers-v0.2.2...visual-editing-helpers-v0.2.3) (2024-01-10) - - -### Bug Fixes - -* **deps:** update dependency @sanity/client to ^6.11.1 ([#666](https://github.com/sanity-io/visual-editing/issues/666)) ([487d552](https://github.com/sanity-io/visual-editing/commit/487d552ffdef039ab9807a440df3b1a66b9fa064)) - -## [0.2.2](https://github.com/sanity-io/visual-editing/compare/visual-editing-helpers-v0.2.1...visual-editing-helpers-v0.2.2) (2024-01-10) - - -### Bug Fixes - -* **deps:** update dependency @sanity/client to ^6.11.0 ([#649](https://github.com/sanity-io/visual-editing/issues/649)) ([b94f848](https://github.com/sanity-io/visual-editing/commit/b94f8482e2928f77748b75a4b26536b33cf21330)) - -## [0.2.1](https://github.com/sanity-io/visual-editing/compare/visual-editing-helpers-v0.2.0...visual-editing-helpers-v0.2.1) (2024-01-04) - - -### Bug Fixes - -* **deps:** Update dependency valibot to v0.25.0 ([#597](https://github.com/sanity-io/visual-editing/issues/597)) ([031f397](https://github.com/sanity-io/visual-editing/commit/031f3979646c156c007ff0f8acac90284045544a)) -* unsubscribe live queries that are no longer in use on the curren… ([#613](https://github.com/sanity-io/visual-editing/issues/613)) ([12bce7a](https://github.com/sanity-io/visual-editing/commit/12bce7ab6b26233db39626fd28d1dfd5b059e9c9)) - -## [0.2.0](https://github.com/sanity-io/visual-editing/compare/visual-editing-helpers-v0.1.4...visual-editing-helpers-v0.2.0) (2023-12-19) - - -### Features - -* **deps:** update sanity to ^3.23.0, update @sanity/ui to 2.0.0-beta.13 ([9ea150d](https://github.com/sanity-io/visual-editing/commit/9ea150d1473092f4152f9efb91f3ff3ee3fa7d42)) - -## [0.1.4](https://github.com/sanity-io/visual-editing/compare/visual-editing-helpers-v0.1.3...visual-editing-helpers-v0.1.4) (2023-12-12) - - -### Bug Fixes - -* **deps:** update dependency @sanity/client to ^6.10.0 ([#551](https://github.com/sanity-io/visual-editing/issues/551)) ([5dc24c9](https://github.com/sanity-io/visual-editing/commit/5dc24c98bb84d7bc6dea5e77ac88dc4ca2cc9c6b)) -* **deps:** Update dependency valibot to v0.24.1 ([#548](https://github.com/sanity-io/visual-editing/issues/548)) ([f31dc1a](https://github.com/sanity-io/visual-editing/commit/f31dc1a6adf2e03c3b8e894d8e0ba4e471ab5fc9)) - -## [0.1.3](https://github.com/sanity-io/visual-editing/compare/visual-editing-helpers-v0.1.2...visual-editing-helpers-v0.1.3) (2023-12-08) - - -### Bug Fixes - -* **deps:** Update dependency valibot to v0.23.0 ([#532](https://github.com/sanity-io/visual-editing/issues/532)) ([b908b5c](https://github.com/sanity-io/visual-editing/commit/b908b5cc3f6c2b52e169520e25cef3f13b6eafa8)) - -## [0.1.2](https://github.com/sanity-io/visual-editing/compare/visual-editing-helpers-v0.1.1...visual-editing-helpers-v0.1.2) (2023-12-07) - - -### Bug Fixes - -* **deps:** update dependency @sanity/client to ^6.9.3 ([#517](https://github.com/sanity-io/visual-editing/issues/517)) ([39528c8](https://github.com/sanity-io/visual-editing/commit/39528c8dc3f4898ad596c686513d9c13df9368e1)) - -## [0.1.1](https://github.com/sanity-io/visual-editing/compare/visual-editing-helpers-v0.1.0...visual-editing-helpers-v0.1.1) (2023-12-06) - - -### Bug Fixes - -* **deps:** Update sanity monorepo to ^3.21.0 ([#497](https://github.com/sanity-io/visual-editing/issues/497)) ([a8188d8](https://github.com/sanity-io/visual-editing/commit/a8188d84ef23b491b8f9edfd298e1d5d1acac219)) - -## 0.1.0 (2023-12-05) - - -### ⚠ BREAKING CHANGES - -* lazy load live mode ([#281](https://github.com/sanity-io/visual-editing/issues/281)) - -### Features - -* add `encodeDataAttribute` API ([d9179f3](https://github.com/sanity-io/visual-editing/commit/d9179f30ab0defb1539d589a24c230683cce9c4e)) -* add new `same-origin` option ([#471](https://github.com/sanity-io/visual-editing/issues/471)) ([09621ad](https://github.com/sanity-io/visual-editing/commit/09621ad85897d4c600cbf7a011f8ddcfed75841e)) -* **hooks:** add `useQueryParams` ([3becce2](https://github.com/sanity-io/visual-editing/commit/3becce2ffc48cb69f4763f751c12f23111a1afca)) -* **hooks:** add `useRevalidate` ([2ba9b22](https://github.com/sanity-io/visual-editing/commit/2ba9b2263a2f19070fc32e438d0d56b8b9c4873d)) -* **overlays:** toggle overlay using mod key ([#228](https://github.com/sanity-io/visual-editing/issues/228)) ([60484e1](https://github.com/sanity-io/visual-editing/commit/60484e1458fdc9f85071cdbca2afc0978fae8041)) -* use the new `@sanity/client/stega` features ([#252](https://github.com/sanity-io/visual-editing/issues/252)) ([fa08bb2](https://github.com/sanity-io/visual-editing/commit/fa08bb24e6413bfa49adb79df256217e06ed0844)) - - -### Bug Fixes - -* add base readmes ([e5f3f70](https://github.com/sanity-io/visual-editing/commit/e5f3f7054090c269a98bc5d5f6ff9572a8c3725b)) -* add support for `@sanity/preview-kit` ([f57235a](https://github.com/sanity-io/visual-editing/commit/f57235a9e97ce035ac8f5cbc7ecfd670f1919559)) -* **deps:** pin dependencies ([#239](https://github.com/sanity-io/visual-editing/issues/239)) ([e1583b9](https://github.com/sanity-io/visual-editing/commit/e1583b99eb45342ffbddb68c1af66b33bc9a25d1)) -* **deps:** Update dependency @sanity/client to ^6.8.1 ([#351](https://github.com/sanity-io/visual-editing/issues/351)) ([6efe86f](https://github.com/sanity-io/visual-editing/commit/6efe86f7589ae8e0b2e64e1c5b6c439b5ec5292d)) -* **deps:** Update dependency @sanity/client to ^6.8.2 ([#356](https://github.com/sanity-io/visual-editing/issues/356)) ([b80dfa5](https://github.com/sanity-io/visual-editing/commit/b80dfa519c9790efdfdc0590ad7eb3f56998ea01)) -* **deps:** Update dependency @sanity/client to ^6.8.4 ([5dbbe06](https://github.com/sanity-io/visual-editing/commit/5dbbe062ac1dd71a251e70d15caa1c5d53a505f6)) -* **deps:** Update dependency @sanity/client to ^6.8.5 ([#361](https://github.com/sanity-io/visual-editing/issues/361)) ([e8e61c1](https://github.com/sanity-io/visual-editing/commit/e8e61c1a377b2737db60a1c3e42160794b26ad9b)) -* **deps:** update dependency @sanity/client to ^6.8.6 ([#374](https://github.com/sanity-io/visual-editing/issues/374)) ([f62967a](https://github.com/sanity-io/visual-editing/commit/f62967a2068844b358357c7c2254cd1d9228ba6d)) -* **deps:** update dependency @sanity/client to ^6.9.0 ([#434](https://github.com/sanity-io/visual-editing/issues/434)) ([c7c8ec5](https://github.com/sanity-io/visual-editing/commit/c7c8ec59e6503060eb60800bac4a494e39c1595c)) -* **deps:** update dependency @sanity/client to ^6.9.1 ([#437](https://github.com/sanity-io/visual-editing/issues/437)) ([6974b0d](https://github.com/sanity-io/visual-editing/commit/6974b0d6fabd9911af40f6a1de645473b47df19d)) -* **deps:** update dependency @sanity/client to v6.7.1-pink-lizard.0 ([#224](https://github.com/sanity-io/visual-editing/issues/224)) ([937c5cb](https://github.com/sanity-io/visual-editing/commit/937c5cbe290a260c1f0a0dccbab7c46b4ef50767)) -* **deps:** update dependency @sanity/client to v6.8.0-pink-lizard.0 ([#264](https://github.com/sanity-io/visual-editing/issues/264)) ([010b87a](https://github.com/sanity-io/visual-editing/commit/010b87a5afbc3619a3406db405299522456854a2)) -* **deps:** update dependency @sanity/client to v6.8.0-pink-lizard.12 ([#298](https://github.com/sanity-io/visual-editing/issues/298)) ([4bfbfff](https://github.com/sanity-io/visual-editing/commit/4bfbfffb8fab9e3440fb525babd2df0120fc4900)) -* **deps:** update dependency @sanity/client to v6.8.0-pink-lizard.3 ([#267](https://github.com/sanity-io/visual-editing/issues/267)) ([432f47b](https://github.com/sanity-io/visual-editing/commit/432f47bdd742cc863bbeb257325690b0f2063022)) -* **deps:** update dependency @sanity/client to v6.8.0-pink-lizard.4 ([#278](https://github.com/sanity-io/visual-editing/issues/278)) ([f9a64c4](https://github.com/sanity-io/visual-editing/commit/f9a64c4f245da1f7beb3052fb205f422ec94221e)) -* **deps:** update dependency @sanity/client to v6.8.0-pink-lizard.7 ([#288](https://github.com/sanity-io/visual-editing/issues/288)) ([7d63682](https://github.com/sanity-io/visual-editing/commit/7d63682b533495e75cdcef446e818e10b742329b)) -* **deps:** update dependency @sanity/client to v6.8.0-pink-lizard.8 ([#291](https://github.com/sanity-io/visual-editing/issues/291)) ([9623639](https://github.com/sanity-io/visual-editing/commit/9623639ac7c333ee7b13c253a61a7f9d4f9f599a)) -* **deps:** update dependency @sanity/client to v6.8.0-pink-lizard.9 ([#295](https://github.com/sanity-io/visual-editing/issues/295)) ([6335f36](https://github.com/sanity-io/visual-editing/commit/6335f36c0c5324499ccbd42256e3a5d317e3a709)) -* **deps:** update dependency `@sanity/client` to ^6.8.0 ([4e11e0c](https://github.com/sanity-io/visual-editing/commit/4e11e0c1efd01e889c269d6a270b7c761b776fc0)) -* **deps:** update dependency `@sanity/client` to v6.8.0-pink-lizard.5 ([c88e4ec](https://github.com/sanity-io/visual-editing/commit/c88e4ec3a12c4dd3d5bac5c3e9c39a52fc698603)) -* **deps:** Update dependency valibot to 0.20.1 ([158559e](https://github.com/sanity-io/visual-editing/commit/158559edaa40bd05c10a5be1008f86967e162439)) -* **deps:** Update dependency valibot to v0.21.0 ([#401](https://github.com/sanity-io/visual-editing/issues/401)) ([d356978](https://github.com/sanity-io/visual-editing/commit/d356978aab55779575646eb05d78f86868f2e1d4)) -* **deps:** Update dependency valibot to v0.22.0 ([#460](https://github.com/sanity-io/visual-editing/issues/460)) ([38de8ae](https://github.com/sanity-io/visual-editing/commit/38de8ae12772f4ff8bec79731efac896be781fae)) -* **deps:** Update sanity monorepo ([#222](https://github.com/sanity-io/visual-editing/issues/222)) ([dec2114](https://github.com/sanity-io/visual-editing/commit/dec2114132de1b98da5a78f92def08a5528528a7)) -* **deps:** Update sanity monorepo to ^3.19.3 ([#369](https://github.com/sanity-io/visual-editing/issues/369)) ([24813fa](https://github.com/sanity-io/visual-editing/commit/24813fafa42da329efe4025deed48766ca6c454b)) -* **deps:** Update sanity monorepo to ^3.20.1 ([#418](https://github.com/sanity-io/visual-editing/issues/418)) ([b91335b](https://github.com/sanity-io/visual-editing/commit/b91335bb9a02f4ef547decbcf10923f7facb7498)) -* **deps:** Update sanity monorepo to ^3.20.2 ([#433](https://github.com/sanity-io/visual-editing/issues/433)) ([d5b60f0](https://github.com/sanity-io/visual-editing/commit/d5b60f06c4c92a251a130bf22af94f8e7ecec3a7)) -* **deps:** Update sanity monorepo to v3.19.2-pink-lizard.19 ([#270](https://github.com/sanity-io/visual-editing/issues/270)) ([9bdea72](https://github.com/sanity-io/visual-editing/commit/9bdea72e927f46f029273350a8fb898fa45f0e86)) -* **deps:** Update sanity monorepo to v3.19.2-pink-lizard.28 ([#311](https://github.com/sanity-io/visual-editing/issues/311)) ([915953e](https://github.com/sanity-io/visual-editing/commit/915953e2f78fa222ac5fd4c85977dae55ba21371)) -* **deps:** Update sanity monorepo to v3.19.3-pink-lizard.10 ([#315](https://github.com/sanity-io/visual-editing/issues/315)) ([4da915e](https://github.com/sanity-io/visual-editing/commit/4da915eaba5d437f6ad70415dc1f3750ac278f4b)) -* **deps:** Update sanity monorepo to v3.19.3-pink-lizard.18 ([#318](https://github.com/sanity-io/visual-editing/issues/318)) ([f97a770](https://github.com/sanity-io/visual-editing/commit/f97a770c95b3e76c94592739d8cee5262f6d5f86)) -* **deps:** Update sanity monorepo to v3.19.3-pink-lizard.21 ([2bb162c](https://github.com/sanity-io/visual-editing/commit/2bb162cc8b5844ddc927876e8f039b028e4250cc)) -* handle bundler issue with importing from `sanity` ([03f45c5](https://github.com/sanity-io/visual-editing/commit/03f45c50c5591322d4b829c06111366f7dd73755)) -* handle stega nodes in a way that supports focus ([#254](https://github.com/sanity-io/visual-editing/issues/254)) ([dce801f](https://github.com/sanity-io/visual-editing/commit/dce801f3b76e6e2bb0597345b5deacc2038e6fec)) -* lazy load live mode ([#281](https://github.com/sanity-io/visual-editing/issues/281)) ([e52991c](https://github.com/sanity-io/visual-editing/commit/e52991cc974df76647c4ede51de16527c14e6c10)) -* load src directly ([94308f0](https://github.com/sanity-io/visual-editing/commit/94308f0ba815d89347c7201eb759cc0ba6e2bbf7)) -* migrate to `visual-editing-helpers` ([e8bfae1](https://github.com/sanity-io/visual-editing/commit/e8bfae1dabfdc5017908697ced574bb23daf9f3b)) -* move `@sanity/csm` into `visual-editing-helpers` ([257a4ad](https://github.com/sanity-io/visual-editing/commit/257a4adf64dcd74cbf435b883995c6f5b8730c25)) -* **presentation:** complete keyboard implementation ([a931b1b](https://github.com/sanity-io/visual-editing/commit/a931b1b68cf85a17dd1ab8010445313c4d75539a)) -* stop using the deprecated `simplifyPath` ([dfda670](https://github.com/sanity-io/visual-editing/commit/dfda67059ea3baa609f95ef5b63348acaca71ecb)) -* the build ([e01df01](https://github.com/sanity-io/visual-editing/commit/e01df01138691e4c51f818f7504b38ad761648a3)) -* update node parser to ignore `projectId` and `dataset` ([d9fc6c3](https://github.com/sanity-io/visual-editing/commit/d9fc6c37a17df56f20cd6fc7150db63ce3b194e6)) -* update tests ([f1b5b83](https://github.com/sanity-io/visual-editing/commit/f1b5b83ac3a8cd0ba0d9f8fe6fe4976f5b35cd1d)) -* use `createEditUrl ` from `@sanity/client` ([e83bb2b](https://github.com/sanity-io/visual-editing/commit/e83bb2bf28794477300d914e053d77b6ad1c07e4)) -* use `getPublishedId` from `@sanity/client` ([2a75bdb](https://github.com/sanity-io/visual-editing/commit/2a75bdb5b0de32f7204ff5609951c7b3158f9bab)) -* use `studioPath` utils from `@sanity/client/csm` ([a804364](https://github.com/sanity-io/visual-editing/commit/a80436410083ae88f6dc46a259ae3a08a7f4b59f)) -* use new `ContentSourceMapParsedPathKeyedSegment` format ([20b3186](https://github.com/sanity-io/visual-editing/commit/20b31864815aeacb4c40e6cea5311d32805c6c2e)) -* use the same path utils everywhere ([a437719](https://github.com/sanity-io/visual-editing/commit/a4377194fdcaefddb3f199650aeb87a6989b0694)) diff --git a/packages/visual-editing-helpers/README.md b/packages/visual-editing-helpers/README.md deleted file mode 100644 index 75038d390..000000000 --- a/packages/visual-editing-helpers/README.md +++ /dev/null @@ -1,3 +0,0 @@ -> **Warning** -> -> This is a private package that is bundled into other packages, it's not meant to be published to npm or be used directly. diff --git a/packages/visual-editing-helpers/src/csm/index.ts b/packages/visual-editing-helpers/src/csm/index.ts deleted file mode 100644 index 11d232c0f..000000000 --- a/packages/visual-editing-helpers/src/csm/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -export * from './resolveSanityNode' -export * from './transformSanityNodeData' -export * from './wrap' diff --git a/packages/visual-editing-helpers/src/getQueryCacheKey.ts b/packages/visual-editing-helpers/src/getQueryCacheKey.ts deleted file mode 100644 index 04c9a6a6c..000000000 --- a/packages/visual-editing-helpers/src/getQueryCacheKey.ts +++ /dev/null @@ -1,9 +0,0 @@ -import type {QueryParams} from '@sanity/client' -import type {QueryCacheKey} from './types' - -/** - * @internal - */ -export function getQueryCacheKey(query: string, params: QueryParams | string): QueryCacheKey { - return `${query}-${typeof params === 'string' ? params : JSON.stringify(params)}` -} diff --git a/packages/visual-editing-helpers/src/hooks/index.ts b/packages/visual-editing-helpers/src/hooks/index.ts deleted file mode 100644 index 0d0bb5db4..000000000 --- a/packages/visual-editing-helpers/src/hooks/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from './useQueryParams' -export * from './useRevalidate' diff --git a/packages/visual-editing-helpers/src/hotkeys.ts b/packages/visual-editing-helpers/src/hotkeys.ts deleted file mode 100644 index 725cb738b..000000000 --- a/packages/visual-editing-helpers/src/hotkeys.ts +++ /dev/null @@ -1,26 +0,0 @@ -const IS_MAC = - typeof window != 'undefined' && /Mac|iPod|iPhone|iPad/.test(window.navigator.platform) - -const MODIFIERS: Record = { - alt: 'altKey', - ctrl: 'ctrlKey', - mod: IS_MAC ? 'metaKey' : 'ctrlKey', - shift: 'shiftKey', -} - -export function isHotkey(keys: string[], event: KeyboardEvent): boolean { - return keys.every((key) => { - if (MODIFIERS[key]) { - return event[MODIFIERS[key]] - } - return event.key === key.toUpperCase() - }) -} - -export function isModKey(event: KeyboardEvent): boolean { - return event.key === (IS_MAC ? 'Meta' : 'Ctrl') -} - -export function isAltKey(event: KeyboardEvent): boolean { - return event.key === 'Alt' -} diff --git a/packages/visual-editing-helpers/src/index.ts b/packages/visual-editing-helpers/src/index.ts deleted file mode 100644 index 06128aec7..000000000 --- a/packages/visual-editing-helpers/src/index.ts +++ /dev/null @@ -1,7 +0,0 @@ -export * from './comlinkCompatibility' -export {createDataAttribute} from './createDataAttribute' -export {getQueryCacheKey} from './getQueryCacheKey' -export {isAltKey, isHotkey, isModKey} from './hotkeys' -export {pathToUrlString} from './pathToUrlString' -export * from './types' -export {urlStringToPath} from './urlStringToPath' diff --git a/packages/visual-editing-helpers/src/types/attributes.ts b/packages/visual-editing-helpers/src/types/attributes.ts deleted file mode 100644 index 06d1ef35d..000000000 --- a/packages/visual-editing-helpers/src/types/attributes.ts +++ /dev/null @@ -1,73 +0,0 @@ -import type {StudioPathLike} from '@sanity/client/csm' - -/** - * Helper - * @internal - */ -export type WithRequired = T & {[P in K]-?: T[P]} - -/** - * The metadata that can be embedded in a data attribute. - * All values are marked optional in the base type as they can be provided incrementally using the `createDataAttribute` function. - * @public - */ -export interface CreateDataAttributeProps { - /** The studio base URL, optional */ - baseUrl?: string - /** The dataset, optional */ - dataset?: string - /** The document ID, required */ - id?: string - /** The field path, required */ - path?: StudioPathLike - /** The project ID, optional */ - projectId?: string - /** The studio tool name, optional */ - tool?: string - /** The document type, required */ - type?: string - /** The studio workspace, optional */ - workspace?: string -} - -/** - * @public - */ -export type CreateDataAttribute = (T extends WithRequired< - CreateDataAttributeProps, - 'id' | 'type' | 'path' -> - ? { - /** - * Returns a string representation of the data attribute - * @param path - An optional path to concatenate with any existing path - * @public - */ - (path?: StudioPathLike): string - /** - * Returns a string representation of the data attribute - * @public - */ - toString(): string - } - : T extends WithRequired - ? /** - * Returns a string representation of the data attribute - * @param path - An optional path to concatenate with any existing path - * @public - */ - (path: StudioPathLike) => string - : object) & { - /** - * Concatenate the current path with a new path - * @param path - A path to concatenate with any existing path - * @public - */ - scope(path: StudioPathLike): CreateDataAttribute - /** - * Combines the current props with additional props - * @param props - New props to merge with any existing props - * @public - */ - combine: (props: U) => CreateDataAttribute -} diff --git a/packages/visual-editing-helpers/src/types/index.ts b/packages/visual-editing-helpers/src/types/index.ts deleted file mode 100644 index 384ef6430..000000000 --- a/packages/visual-editing-helpers/src/types/index.ts +++ /dev/null @@ -1,5 +0,0 @@ -export * from './attributes' -export * from './comlink' -export * from './overlays' -export * from './schema' -export type {Path} from '@sanity/client/csm' diff --git a/packages/visual-editing-helpers/src/types/overlays.ts b/packages/visual-editing-helpers/src/types/overlays.ts deleted file mode 100644 index a841d943f..000000000 --- a/packages/visual-editing-helpers/src/types/overlays.ts +++ /dev/null @@ -1,25 +0,0 @@ -/** - * Data resolved from a Sanity node - * @public - */ -export type SanityNode = { - baseUrl: string - dataset?: string - id: string - isDraft?: string - path: string - projectId?: string - tool?: string - type?: string - workspace?: string -} - -/** - * Data resolved from a Sanity Stega node - * @public - */ -export type SanityStegaNode = { - origin: string - href: string - data?: unknown -} diff --git a/packages/visual-editing-helpers/tsconfig.build.json b/packages/visual-editing-helpers/tsconfig.build.json deleted file mode 100644 index 6376797c7..000000000 --- a/packages/visual-editing-helpers/tsconfig.build.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "extends": "./tsconfig.base", - "include": ["src/**/*.ts", "src/**/*.tsx"], - "exclude": ["dist", "node_modules"], - "compilerOptions": { - "rootDir": "src" - } -} diff --git a/packages/visual-editing-types/.eslintignore b/packages/visual-editing-types/.eslintignore new file mode 100644 index 000000000..1521c8b76 --- /dev/null +++ b/packages/visual-editing-types/.eslintignore @@ -0,0 +1 @@ +dist diff --git a/packages/visual-editing-types/.gitignore b/packages/visual-editing-types/.gitignore new file mode 100644 index 000000000..c66ae6b38 --- /dev/null +++ b/packages/visual-editing-types/.gitignore @@ -0,0 +1 @@ +src/**/*.d.ts diff --git a/packages/visual-editing-types/README.md b/packages/visual-editing-types/README.md new file mode 100644 index 000000000..3940c542f --- /dev/null +++ b/packages/visual-editing-types/README.md @@ -0,0 +1,4 @@ +# @sanity/visual-editing-types + +> [!WARNING] +> Don't use this package directly, it's an internal package used by `@sanity/presentation-comlink` & `@sanity/visual-editing-csm` diff --git a/packages/visual-editing-types/package.config.ts b/packages/visual-editing-types/package.config.ts new file mode 100644 index 000000000..bfb057684 --- /dev/null +++ b/packages/visual-editing-types/package.config.ts @@ -0,0 +1,6 @@ +import baseConfig from '@repo/package.config' +import {defineConfig} from '@sanity/pkg-utils' + +export default defineConfig({ + ...baseConfig, +}) diff --git a/packages/visual-editing-types/package.json b/packages/visual-editing-types/package.json new file mode 100644 index 000000000..a8797075c --- /dev/null +++ b/packages/visual-editing-types/package.json @@ -0,0 +1,73 @@ +{ + "name": "@sanity/visual-editing-types", + "version": "0.0.0", + "homepage": "https://github.com/sanity-io/visual-editing/tree/main/packages/visual-editing-types#readme", + "bugs": { + "url": "https://github.com/sanity-io/visual-editing/issues" + }, + "repository": { + "type": "git", + "url": "git+ssh://git@github.com/sanity-io/visual-editing.git", + "directory": "packages/visual-editing-types" + }, + "license": "MIT", + "author": "Sanity.io ", + "sideEffects": false, + "type": "module", + "exports": { + ".": { + "source": "./src/index.ts", + "import": "./dist/index.js", + "require": "./dist/index.cjs", + "default": "./dist/index.js" + }, + "./package.json": "./package.json" + }, + "main": "./dist/index.cjs", + "module": "./dist/index.js", + "types": "./dist/index.d.ts", + "files": [ + "dist", + "src", + "!**/*.test.*", + "CHANGELOG.md" + ], + "scripts": { + "build": "pkg build --strict --check --clean", + "dev": "pkg build --strict", + "lint": "eslint --cache .", + "prepack": "turbo run build" + }, + "browserslist": "extends @sanity/browserslist-config", + "eslintConfig": { + "extends": [ + "@repo/eslint-config" + ], + "root": true + }, + "devDependencies": { + "@repo/eslint-config": "workspace:*", + "@repo/package.config": "workspace:*", + "@sanity/client": "^6.24.3", + "@sanity/insert-menu": "workspace:*", + "@sanity/pkg-utils": "6.13.4", + "@sanity/types": "3.70.0", + "eslint": "^8.57.1", + "typescript": "5.7.3" + }, + "peerDependencies": { + "@sanity/client": "^6.24.3", + "@sanity/types": "*" + }, + "peerDependenciesMeta": { + "@sanity/types": { + "optional": true + } + }, + "engines": { + "node": ">=18" + }, + "publishConfig": { + "access": "public" + } +} diff --git a/packages/visual-editing-helpers/src/types/schema.ts b/packages/visual-editing-types/src/index.ts similarity index 77% rename from packages/visual-editing-helpers/src/types/schema.ts rename to packages/visual-editing-types/src/index.ts index 2140d15e6..e7832126a 100644 --- a/packages/visual-editing-helpers/src/types/schema.ts +++ b/packages/visual-editing-types/src/index.ts @@ -1,6 +1,36 @@ import type {StudioPathLike} from '@sanity/client/csm' import type {InsertMenuOptions} from '@sanity/insert-menu' -import type {ArrayOptions} from '@sanity/types' +import type {ArrayOptions, PreviewValue} from '@sanity/types' + +export type {InsertMenuOptions} + +export type {Path} from '@sanity/client/csm' + +/** + * Data resolved from a Sanity node + * @public + */ +export type SanityNode = { + baseUrl: string + dataset?: string + id: string + isDraft?: string + path: string + projectId?: string + tool?: string + type?: string + workspace?: string +} + +/** + * Data resolved from a Sanity Stega node + * @public + */ +export type SanityStegaNode = { + origin: string + href: string + data?: unknown +} export interface DocumentSchema { type: 'document' @@ -119,3 +149,13 @@ export interface UnresolvedPath { id: string path: string } + +/** + * @public + */ +export type PreviewSnapshot = { + // Explicitly exclude media, as it's not serializable + [K in keyof Omit]?: Omit[K] +} & { + _id: string +} diff --git a/packages/visual-editing-types/tsconfig.base.json b/packages/visual-editing-types/tsconfig.base.json new file mode 100644 index 000000000..2684a948d --- /dev/null +++ b/packages/visual-editing-types/tsconfig.base.json @@ -0,0 +1,7 @@ +{ + "extends": "@sanity/pkg-utils/tsconfig/strictest.json", + "compilerOptions": { + "rootDir": ".", + "outDir": "dist" + } +} diff --git a/packages/visual-editing-types/tsconfig.build.json b/packages/visual-editing-types/tsconfig.build.json new file mode 100644 index 000000000..83b7b37c7 --- /dev/null +++ b/packages/visual-editing-types/tsconfig.build.json @@ -0,0 +1,8 @@ +{ + "extends": "./tsconfig.base", + "compilerOptions": { + "rootDir": "src" + }, + "include": ["src/**/*.ts"], + "exclude": ["dist", "node_modules"] +} diff --git a/packages/visual-editing-types/tsconfig.json b/packages/visual-editing-types/tsconfig.json new file mode 100644 index 000000000..f9f8d7b3e --- /dev/null +++ b/packages/visual-editing-types/tsconfig.json @@ -0,0 +1,5 @@ +{ + "extends": "./tsconfig.base", + "include": ["**/*.ts"], + "exclude": ["dist", "node_modules"] +} diff --git a/packages/visual-editing-types/turbo.json b/packages/visual-editing-types/turbo.json new file mode 100644 index 000000000..07728cc5b --- /dev/null +++ b/packages/visual-editing-types/turbo.json @@ -0,0 +1,9 @@ +{ + "$schema": "https://turbo.build/schema.json", + "extends": ["//"], + "tasks": { + "dev": { + "persistent": false + } + } +} diff --git a/packages/visual-editing/CHANGELOG.md b/packages/visual-editing/CHANGELOG.md index b969ab681..8ad8c3665 100644 --- a/packages/visual-editing/CHANGELOG.md +++ b/packages/visual-editing/CHANGELOG.md @@ -12,7 +12,6 @@ * The following workspace dependencies were updated * devDependencies - * @repo/visual-editing-helpers bumped to 0.7.14 ## [2.12.1](https://github.com/sanity-io/visual-editing/compare/visual-editing-v2.12.0...visual-editing-v2.12.1) (2025-01-13) @@ -50,7 +49,6 @@ * dependencies * @sanity/comlink bumped to 3.0.0 * devDependencies - * @repo/visual-editing-helpers bumped to 0.7.13 ## [2.11.8](https://github.com/sanity-io/visual-editing/compare/visual-editing-v2.11.7...visual-editing-v2.11.8) (2025-01-09) @@ -67,7 +65,6 @@ * @sanity/comlink bumped to 2.0.5 * @sanity/preview-url-secret bumped to 2.0.7 * devDependencies - * @repo/visual-editing-helpers bumped to 0.7.12 ## [2.11.7](https://github.com/sanity-io/visual-editing/compare/visual-editing-v2.11.6...visual-editing-v2.11.7) (2025-01-09) @@ -100,7 +97,6 @@ * dependencies * @sanity/comlink bumped to 2.0.4 * devDependencies - * @repo/visual-editing-helpers bumped to 0.7.11 ## [2.11.4](https://github.com/sanity-io/visual-editing/compare/visual-editing-v2.11.3...visual-editing-v2.11.4) (2025-01-02) @@ -139,7 +135,6 @@ * dependencies * @sanity/comlink bumped to 2.0.3 * devDependencies - * @repo/visual-editing-helpers bumped to 0.7.10 ## [2.11.0](https://github.com/sanity-io/visual-editing/compare/visual-editing-v2.10.10...visual-editing-v2.11.0) (2024-12-19) @@ -167,7 +162,6 @@ * The following workspace dependencies were updated * devDependencies - * @repo/visual-editing-helpers bumped to 0.7.9 ## [2.10.8](https://github.com/sanity-io/visual-editing/compare/visual-editing-v2.10.7...visual-editing-v2.10.8) (2024-12-16) @@ -183,7 +177,6 @@ * dependencies * @sanity/comlink bumped to 2.0.2 * devDependencies - * @repo/visual-editing-helpers bumped to 0.7.8 ## [2.10.7](https://github.com/sanity-io/visual-editing/compare/visual-editing-v2.10.6...visual-editing-v2.10.7) (2024-12-12) @@ -215,7 +208,6 @@ * dependencies * @sanity/comlink bumped to 2.0.1 * devDependencies - * @repo/visual-editing-helpers bumped to 0.7.7 ## [2.10.3](https://github.com/sanity-io/visual-editing/compare/visual-editing-v2.10.2...visual-editing-v2.10.3) (2024-12-02) @@ -231,7 +223,6 @@ * dependencies * @sanity/preview-url-secret bumped to 2.0.5 * devDependencies - * @repo/visual-editing-helpers bumped to 0.7.6 ## [2.10.2](https://github.com/sanity-io/visual-editing/compare/visual-editing-v2.10.1...visual-editing-v2.10.2) (2024-11-28) @@ -249,7 +240,6 @@ * dependencies * @sanity/comlink bumped to 2.0.0 * devDependencies - * @repo/visual-editing-helpers bumped to 0.7.5 ## [2.10.0](https://github.com/sanity-io/visual-editing/compare/visual-editing-v2.9.0...visual-editing-v2.10.0) (2024-11-27) @@ -277,7 +267,6 @@ * dependencies * @sanity/comlink bumped to 1.1.4 * devDependencies - * @repo/visual-editing-helpers bumped to 0.7.4 ## [2.8.0](https://github.com/sanity-io/visual-editing/compare/visual-editing-v2.7.2...visual-editing-v2.8.0) (2024-11-19) @@ -298,7 +287,6 @@ * dependencies * @sanity/preview-url-secret bumped to 2.0.4 * devDependencies - * @repo/visual-editing-helpers bumped to 0.7.3 ## [2.7.2](https://github.com/sanity-io/visual-editing/compare/visual-editing-v2.7.1...visual-editing-v2.7.2) (2024-11-15) @@ -316,7 +304,6 @@ * dependencies * @sanity/comlink bumped to 1.1.3 * devDependencies - * @repo/visual-editing-helpers bumped to 0.7.2 ## [2.7.0](https://github.com/sanity-io/visual-editing/compare/visual-editing-v2.6.0...visual-editing-v2.7.0) (2024-11-12) @@ -337,7 +324,6 @@ * dependencies * @sanity/comlink bumped to 1.1.2 * devDependencies - * @repo/visual-editing-helpers bumped to 0.7.1 ## [2.6.0](https://github.com/sanity-io/visual-editing/compare/visual-editing-v2.5.2...visual-editing-v2.6.0) (2024-11-12) @@ -360,7 +346,6 @@ * dependencies * @sanity/preview-url-secret bumped to 2.0.3 * devDependencies - * @repo/visual-editing-helpers bumped to 0.7.0 ## [2.5.2](https://github.com/sanity-io/visual-editing/compare/visual-editing-v2.5.1...visual-editing-v2.5.2) (2024-11-07) @@ -390,7 +375,6 @@ * dependencies * @sanity/preview-url-secret bumped to 2.0.1 * devDependencies - * @repo/visual-editing-helpers bumped to 0.6.30 ## [2.5.0](https://github.com/sanity-io/visual-editing/compare/visual-editing-v2.4.4...visual-editing-v2.5.0) (2024-11-06) @@ -424,7 +408,6 @@ * The following workspace dependencies were updated * devDependencies - * @repo/visual-editing-helpers bumped to 0.6.29 ## [2.4.2](https://github.com/sanity-io/visual-editing/compare/visual-editing-v2.4.1...visual-editing-v2.4.2) (2024-10-28) @@ -440,7 +423,6 @@ * The following workspace dependencies were updated * devDependencies - * @repo/visual-editing-helpers bumped to 0.6.28 ## [2.4.1](https://github.com/sanity-io/visual-editing/compare/visual-editing-v2.4.0...visual-editing-v2.4.1) (2024-10-24) @@ -451,7 +433,6 @@ * dependencies * @sanity/comlink bumped to 1.1.1 * devDependencies - * @repo/visual-editing-helpers bumped to 0.6.27 ## [2.4.0](https://github.com/sanity-io/visual-editing/compare/visual-editing-v2.3.2...visual-editing-v2.4.0) (2024-10-24) @@ -467,7 +448,6 @@ * dependencies * @sanity/comlink bumped to 1.1.0 * devDependencies - * @repo/visual-editing-helpers bumped to 0.6.26 ## [2.3.2](https://github.com/sanity-io/visual-editing/compare/visual-editing-v2.3.1...visual-editing-v2.3.2) (2024-10-24) @@ -488,7 +468,6 @@ * The following workspace dependencies were updated * devDependencies - * @repo/visual-editing-helpers bumped to 0.6.25 ## [2.3.0](https://github.com/sanity-io/visual-editing/compare/visual-editing-v2.2.2...visual-editing-v2.3.0) (2024-10-22) @@ -515,7 +494,6 @@ * The following workspace dependencies were updated * devDependencies - * @repo/visual-editing-helpers bumped to 0.6.24 ## [2.2.1](https://github.com/sanity-io/visual-editing/compare/visual-editing-v2.2.0...visual-editing-v2.2.1) (2024-10-21) @@ -529,7 +507,6 @@ * The following workspace dependencies were updated * devDependencies - * @repo/visual-editing-helpers bumped to 0.6.23 ## [2.2.0](https://github.com/sanity-io/visual-editing/compare/visual-editing-v2.1.10...visual-editing-v2.2.0) (2024-10-21) @@ -553,7 +530,6 @@ * dependencies * @sanity/preview-url-secret bumped to 2.0.0 * devDependencies - * @repo/visual-editing-helpers bumped to 0.6.22 * @sanity/comlink bumped to 1.0.0 ## [2.1.10](https://github.com/sanity-io/visual-editing/compare/visual-editing-v2.1.9...visual-editing-v2.1.10) (2024-09-11) @@ -571,7 +547,6 @@ * dependencies * @sanity/preview-url-secret bumped to 1.6.21 * devDependencies - * @repo/visual-editing-helpers bumped to 0.6.21 ## [2.1.9](https://github.com/sanity-io/visual-editing/compare/visual-editing-v2.1.8...visual-editing-v2.1.9) (2024-08-12) @@ -587,7 +562,6 @@ * dependencies * @sanity/preview-url-secret bumped to 1.6.20 * devDependencies - * @repo/visual-editing-helpers bumped to 0.6.20 ## [2.1.8](https://github.com/sanity-io/visual-editing/compare/visual-editing-v2.1.7...visual-editing-v2.1.8) (2024-08-05) @@ -611,7 +585,6 @@ * dependencies * @sanity/preview-url-secret bumped from ^1.6.18 to ^1.6.19 * devDependencies - * @repo/visual-editing-helpers bumped from 0.6.18 to 0.6.19 ## [2.1.6](https://github.com/sanity-io/visual-editing/compare/visual-editing-v2.1.5...visual-editing-v2.1.6) (2024-07-03) @@ -627,7 +600,6 @@ * dependencies * @sanity/preview-url-secret bumped from ^1.6.17 to ^1.6.18 * devDependencies - * @repo/visual-editing-helpers bumped from 0.6.17 to 0.6.18 ## [2.1.5](https://github.com/sanity-io/visual-editing/compare/visual-editing-v2.1.4...visual-editing-v2.1.5) (2024-06-13) @@ -641,7 +613,6 @@ * The following workspace dependencies were updated * devDependencies - * @repo/visual-editing-helpers bumped from 0.6.16 to 0.6.17 ## [2.1.4](https://github.com/sanity-io/visual-editing/compare/visual-editing-v2.1.3...visual-editing-v2.1.4) (2024-06-07) @@ -656,7 +627,6 @@ * The following workspace dependencies were updated * devDependencies - * @repo/visual-editing-helpers bumped from 0.6.15 to 0.6.16 ## [2.1.3](https://github.com/sanity-io/visual-editing/compare/visual-editing-v2.1.2...visual-editing-v2.1.3) (2024-05-30) @@ -672,7 +642,6 @@ * dependencies * @sanity/preview-url-secret bumped from ^1.6.16 to ^1.6.17 * devDependencies - * @repo/visual-editing-helpers bumped from 0.6.14 to 0.6.15 ## [2.1.2](https://github.com/sanity-io/visual-editing/compare/visual-editing-v2.1.1...visual-editing-v2.1.2) (2024-05-29) @@ -709,7 +678,6 @@ * dependencies * @sanity/preview-url-secret bumped from ^1.6.14 to ^1.6.15 * devDependencies - * @repo/visual-editing-helpers bumped from 0.6.13 to 0.6.14 ## [2.0.0](https://github.com/sanity-io/visual-editing/compare/visual-editing-v1.8.22...visual-editing-v2.0.0) (2024-05-28) @@ -737,7 +705,6 @@ * dependencies * @sanity/preview-url-secret bumped from ^1.6.13 to ^1.6.14 * devDependencies - * @repo/visual-editing-helpers bumped from 0.6.12 to 0.6.13 ## [1.8.21](https://github.com/sanity-io/visual-editing/compare/visual-editing-v1.8.20...visual-editing-v1.8.21) (2024-05-15) @@ -760,7 +727,6 @@ * dependencies * @sanity/preview-url-secret bumped from ^1.6.12 to ^1.6.13 * devDependencies - * @repo/visual-editing-helpers bumped from 0.6.11 to 0.6.12 ## [1.8.19](https://github.com/sanity-io/visual-editing/compare/visual-editing-v1.8.18...visual-editing-v1.8.19) (2024-05-13) @@ -774,7 +740,6 @@ * The following workspace dependencies were updated * devDependencies - * @repo/visual-editing-helpers bumped from 0.6.10 to 0.6.11 ## [1.8.18](https://github.com/sanity-io/visual-editing/compare/visual-editing-v1.8.17...visual-editing-v1.8.18) (2024-05-05) @@ -791,7 +756,6 @@ * dependencies * @sanity/preview-url-secret bumped from ^1.6.11 to ^1.6.12 * devDependencies - * @repo/visual-editing-helpers bumped from 0.6.9 to 0.6.10 ## [1.8.17](https://github.com/sanity-io/visual-editing/compare/visual-editing-v1.8.16...visual-editing-v1.8.17) (2024-05-02) @@ -812,7 +776,6 @@ * The following workspace dependencies were updated * devDependencies - * @repo/visual-editing-helpers bumped from 0.6.8 to 0.6.9 ## [1.8.15](https://github.com/sanity-io/visual-editing/compare/visual-editing-v1.8.14...visual-editing-v1.8.15) (2024-04-22) @@ -828,7 +791,6 @@ * dependencies * @sanity/preview-url-secret bumped from ^1.6.10 to ^1.6.11 * devDependencies - * @repo/visual-editing-helpers bumped from 0.6.7 to 0.6.8 ## [1.8.14](https://github.com/sanity-io/visual-editing/compare/visual-editing-v1.8.13...visual-editing-v1.8.14) (2024-04-19) @@ -844,7 +806,6 @@ * dependencies * @sanity/preview-url-secret bumped from ^1.6.9 to ^1.6.10 * devDependencies - * @repo/visual-editing-helpers bumped from 0.6.6 to 0.6.7 ## [1.8.13](https://github.com/sanity-io/visual-editing/compare/visual-editing-v1.8.12...visual-editing-v1.8.13) (2024-04-19) @@ -875,7 +836,6 @@ * dependencies * @sanity/preview-url-secret bumped from ^1.6.8 to ^1.6.9 * devDependencies - * @repo/visual-editing-helpers bumped from 0.6.5 to 0.6.6 ## [1.8.10](https://github.com/sanity-io/visual-editing/compare/visual-editing-v1.8.9...visual-editing-v1.8.10) (2024-04-16) @@ -899,7 +859,6 @@ * dependencies * @sanity/preview-url-secret bumped from ^1.6.7 to ^1.6.8 * devDependencies - * @repo/visual-editing-helpers bumped from 0.6.4 to 0.6.5 ## [1.8.8](https://github.com/sanity-io/visual-editing/compare/visual-editing-v1.8.7...visual-editing-v1.8.8) (2024-04-11) @@ -922,7 +881,6 @@ * dependencies * @sanity/preview-url-secret bumped from ^1.6.6 to ^1.6.7 * devDependencies - * @sanity/visual-editing-helpers bumped from 0.6.3 to 0.6.4 ## [1.8.6](https://github.com/sanity-io/visual-editing/compare/visual-editing-v1.8.5...visual-editing-v1.8.6) (2024-04-05) @@ -938,7 +896,6 @@ * dependencies * @sanity/preview-url-secret bumped from ^1.6.5 to ^1.6.6 * devDependencies - * @sanity/visual-editing-helpers bumped from 0.6.2 to 0.6.3 ## [1.8.5](https://github.com/sanity-io/visual-editing/compare/visual-editing-v1.8.4...visual-editing-v1.8.5) (2024-04-02) @@ -969,7 +926,6 @@ * dependencies * @sanity/preview-url-secret bumped to 1.6.5 * devDependencies - * @sanity/visual-editing-helpers bumped from 0.6.1 to 0.6.2 ## [1.8.2](https://github.com/sanity-io/visual-editing/compare/visual-editing-v1.8.1...visual-editing-v1.8.2) (2024-03-18) @@ -1017,7 +973,6 @@ * The following workspace dependencies were updated * devDependencies - * @sanity/visual-editing-helpers bumped from 0.6.0 to 0.6.1 ## [1.6.0](https://github.com/sanity-io/visual-editing/compare/visual-editing-v1.5.2...visual-editing-v1.6.0) (2024-03-06) @@ -1037,7 +992,6 @@ * The following workspace dependencies were updated * devDependencies - * @sanity/visual-editing-helpers bumped from 0.5.2 to 0.6.0 ## [1.5.2](https://github.com/sanity-io/visual-editing/compare/visual-editing-v1.5.1...visual-editing-v1.5.2) (2024-02-27) @@ -1051,7 +1005,6 @@ * The following workspace dependencies were updated * devDependencies - * @sanity/visual-editing-helpers bumped from 0.5.1 to 0.5.2 ## [1.5.1](https://github.com/sanity-io/visual-editing/compare/visual-editing-v1.5.0...visual-editing-v1.5.1) (2024-02-26) @@ -1065,7 +1018,6 @@ * The following workspace dependencies were updated * devDependencies - * @sanity/visual-editing-helpers bumped from 0.5.0 to 0.5.1 ## [1.5.0](https://github.com/sanity-io/visual-editing/compare/visual-editing-v1.4.0...visual-editing-v1.5.0) (2024-02-23) @@ -1079,7 +1031,6 @@ * The following workspace dependencies were updated * devDependencies - * @sanity/visual-editing-helpers bumped from 0.4.0 to 0.5.0 ## [1.4.0](https://github.com/sanity-io/visual-editing/compare/visual-editing-v1.3.1...visual-editing-v1.4.0) (2024-02-21) @@ -1099,7 +1050,6 @@ * The following workspace dependencies were updated * devDependencies - * @sanity/visual-editing-helpers bumped from 0.3.1 to 0.4.0 ## [1.3.1](https://github.com/sanity-io/visual-editing/compare/visual-editing-v1.3.0...visual-editing-v1.3.1) (2024-02-16) @@ -1113,7 +1063,6 @@ * The following workspace dependencies were updated * devDependencies - * @sanity/visual-editing-helpers bumped from 0.3.0 to 0.3.1 ## [1.3.0](https://github.com/sanity-io/visual-editing/compare/visual-editing-v1.2.2...visual-editing-v1.3.0) (2024-02-15) @@ -1132,7 +1081,6 @@ * The following workspace dependencies were updated * devDependencies - * @sanity/visual-editing-helpers bumped from 0.2.6 to 0.3.0 ## [1.2.2](https://github.com/sanity-io/visual-editing/compare/visual-editing-v1.2.1...visual-editing-v1.2.2) (2024-02-09) diff --git a/packages/visual-editing/package.json b/packages/visual-editing/package.json index 88948dd18..302314a27 100644 --- a/packages/visual-editing/package.json +++ b/packages/visual-editing/package.json @@ -145,9 +145,11 @@ "root": true }, "dependencies": { - "@sanity/comlink": "workspace:*", + "@sanity/comlink": "workspace:^", "@sanity/mutate": "0.11.0-canary.4", - "@sanity/preview-url-secret": "workspace:*", + "@sanity/presentation-comlink": "workspace:^", + "@sanity/preview-url-secret": "workspace:^", + "@sanity/visual-editing-csm": "workspace:^", "@vercel/stega": "0.1.2", "get-random-values-esm": "^1.0.2", "rxjs": "^7.8.1", @@ -160,10 +162,10 @@ "@remix-run/react": "^2.15.2", "@repo/eslint-config": "workspace:*", "@repo/package.config": "workspace:*", - "@repo/visual-editing-helpers": "workspace:*", "@sanity/client": "^6.24.3", "@sanity/color": "^3.0.6", "@sanity/demo": "^2.0.0", + "@sanity/insert-menu": "workspace:*", "@sanity/pkg-utils": "6.13.4", "@sanity/ui": "2.11.2", "@storybook/addon-essentials": "^8.5.0", diff --git a/packages/visual-editing/src/create-data-attribute.ts b/packages/visual-editing/src/create-data-attribute.ts index 323748064..a7d363423 100644 --- a/packages/visual-editing/src/create-data-attribute.ts +++ b/packages/visual-editing/src/create-data-attribute.ts @@ -3,4 +3,4 @@ export { createDataAttribute, type CreateDataAttributeProps, type WithRequired, -} from '@repo/visual-editing-helpers' +} from '@sanity/visual-editing-csm' diff --git a/packages/visual-editing/src/index.ts b/packages/visual-editing/src/index.ts index 7986c3699..c7ee00522 100644 --- a/packages/visual-editing/src/index.ts +++ b/packages/visual-editing/src/index.ts @@ -71,6 +71,10 @@ export {useSharedState} from './ui/shared-state/useSharedState' export { type CreateDataAttribute, type CreateDataAttributeProps, + type WithRequired, + createDataAttribute, +} from '@sanity/visual-editing-csm' +export { type DocumentSchema, type SchemaArrayItem, type SchemaArrayNode, @@ -86,9 +90,7 @@ export { type SchemaUnionNodeOptions, type SchemaUnionOption, type SchemaUnknownNode, - type WithRequired, - createDataAttribute, -} from '@repo/visual-editing-helpers' +} from '@sanity/presentation-comlink' export {getArrayItemKeyAndParentPath} from './util/mutations' /** diff --git a/packages/visual-editing/src/next-pages-router/index.ts b/packages/visual-editing/src/next-pages-router/index.ts index 5e9fd233b..1c447ff8b 100644 --- a/packages/visual-editing/src/next-pages-router/index.ts +++ b/packages/visual-editing/src/next-pages-router/index.ts @@ -16,14 +16,10 @@ export type { export {VisualEditing} from './VisualEditing' export type {VisualEditingProps} from './VisualEditingComponent' export { - createDataAttribute, - type CreateDataAttribute, - type CreateDataAttributeProps, type DocumentSchema, type SchemaArrayItem, type SchemaNode, type SchemaUnionOption, - type WithRequired, type SchemaArrayNode, type SchemaBooleanNode, type SchemaInlineNode, @@ -35,4 +31,10 @@ export { type SchemaUnionNode, type SchemaUnionNodeOptions, type SchemaUnknownNode, -} from '@repo/visual-editing-helpers' +} from '@sanity/presentation-comlink' +export { + createDataAttribute, + type CreateDataAttribute, + type CreateDataAttributeProps, + type WithRequired, +} from '@sanity/visual-editing-csm' diff --git a/packages/visual-editing/src/optimistic/index.ts b/packages/visual-editing/src/optimistic/index.ts index f207226bd..6cd389683 100644 --- a/packages/visual-editing/src/optimistic/index.ts +++ b/packages/visual-editing/src/optimistic/index.ts @@ -5,8 +5,6 @@ export type { HistoryUpdate, PreviewSnapshot, ResolvedSchemaTypeMap, - SanityNode, - SanityStegaNode, SchemaArrayItem, SchemaArrayNode, SchemaBooleanNode, @@ -30,7 +28,9 @@ export type { UnresolvedPath, VisualEditingControllerMsg, VisualEditingNodeMsg, -} from '@repo/visual-editing-helpers' + SanityNode, + SanityStegaNode, +} from '@sanity/presentation-comlink' export type { DocumentsGet, DocumentsMutate, diff --git a/packages/visual-editing/src/overlay-components/components/InsertMenu.tsx b/packages/visual-editing/src/overlay-components/components/InsertMenu.tsx index 2396f2db9..750672365 100644 --- a/packages/visual-editing/src/overlay-components/components/InsertMenu.tsx +++ b/packages/visual-editing/src/overlay-components/components/InsertMenu.tsx @@ -1,6 +1,6 @@ -import type {SchemaUnionNode} from '@repo/visual-editing-helpers' import type {InsertMenuOptions} from '@sanity/insert-menu' import {InsertMenu as SanityInsertMenu} from '@sanity/insert-menu' +import type {SchemaUnionNode} from '@sanity/presentation-comlink' import type {SchemaType} from '@sanity/types' import {Popover} from '@sanity/ui' import {type FunctionComponent} from 'react' diff --git a/packages/visual-editing/src/overlay-components/components/UnionInsertMenuOverlay.tsx b/packages/visual-editing/src/overlay-components/components/UnionInsertMenuOverlay.tsx index 73bde431a..adca39de8 100644 --- a/packages/visual-editing/src/overlay-components/components/UnionInsertMenuOverlay.tsx +++ b/packages/visual-editing/src/overlay-components/components/UnionInsertMenuOverlay.tsx @@ -1,5 +1,5 @@ -import type {SchemaNode, SchemaUnionNode} from '@repo/visual-editing-helpers' import {AddIcon} from '@sanity/icons' +import type {SchemaNode, SchemaUnionNode} from '@sanity/presentation-comlink' import type {SchemaType} from '@sanity/types' import {Button, Flex} from '@sanity/ui' import { diff --git a/packages/visual-editing/src/overlay-components/index.ts b/packages/visual-editing/src/overlay-components/index.ts index 0807fb93f..ee77457a3 100644 --- a/packages/visual-editing/src/overlay-components/index.ts +++ b/packages/visual-editing/src/overlay-components/index.ts @@ -13,7 +13,6 @@ export type { } from '../types' export type { DocumentSchema, - SanityNode, SchemaArrayItem, SchemaArrayNode, SchemaBooleanNode, @@ -28,4 +27,5 @@ export type { SchemaUnionNodeOptions, SchemaUnionOption, SchemaUnknownNode, -} from '@repo/visual-editing-helpers' + SanityNode, +} from '@sanity/presentation-comlink' diff --git a/packages/visual-editing/src/react-router/index.ts b/packages/visual-editing/src/react-router/index.ts index 5e9fd233b..33b3f4115 100644 --- a/packages/visual-editing/src/react-router/index.ts +++ b/packages/visual-editing/src/react-router/index.ts @@ -16,14 +16,10 @@ export type { export {VisualEditing} from './VisualEditing' export type {VisualEditingProps} from './VisualEditingComponent' export { - createDataAttribute, - type CreateDataAttribute, - type CreateDataAttributeProps, type DocumentSchema, type SchemaArrayItem, type SchemaNode, type SchemaUnionOption, - type WithRequired, type SchemaArrayNode, type SchemaBooleanNode, type SchemaInlineNode, @@ -35,4 +31,10 @@ export { type SchemaUnionNode, type SchemaUnionNodeOptions, type SchemaUnknownNode, -} from '@repo/visual-editing-helpers' +} from '@sanity/presentation-comlink' +export { + createDataAttribute, + type CreateDataAttributeProps, + type CreateDataAttribute, + type WithRequired, +} from '@sanity/visual-editing-csm' diff --git a/packages/visual-editing/src/react/index.ts b/packages/visual-editing/src/react/index.ts index 702a09edf..8454d5e08 100644 --- a/packages/visual-editing/src/react/index.ts +++ b/packages/visual-editing/src/react/index.ts @@ -16,13 +16,9 @@ export type { } from '../types' export {VisualEditing} from '../ui/VisualEditing' export { - createDataAttribute, - type CreateDataAttribute, - type CreateDataAttributeProps, type DocumentSchema, type PreviewSnapshot, type ResolvedSchemaTypeMap, - type SanityStegaNode, type SchemaArrayItem, type SchemaArrayNode, type SchemaBooleanNode, @@ -46,8 +42,14 @@ export { type UnresolvedPath, type VisualEditingControllerMsg, type VisualEditingNodeMsg, +} from '@sanity/presentation-comlink' +export { + createDataAttribute, + type CreateDataAttribute, + type CreateDataAttributeProps, type WithRequired, -} from '@repo/visual-editing-helpers' + type SanityStegaNode, +} from '@sanity/visual-editing-csm' export {createDocumentMutator} from '../optimistic/state/documentMutator' export { createDatasetMutator, diff --git a/packages/visual-editing/src/react/useDocuments.ts b/packages/visual-editing/src/react/useDocuments.ts index 1e6641993..d34cef5f0 100644 --- a/packages/visual-editing/src/react/useDocuments.ts +++ b/packages/visual-editing/src/react/useDocuments.ts @@ -1,6 +1,7 @@ /* eslint-disable @typescript-eslint/no-explicit-any */ import type {SanityDocument} from '@sanity/client' import {createIfNotExists, patch} from '@sanity/mutate' +import {isMaybePreviewIframe, isMaybePreviewWindow} from '@sanity/presentation-comlink' import {get as getAtPath} from '@sanity/util/paths' import {useCallback} from 'react' import {isEmptyActor, type MutatorActor} from '../optimistic/context' @@ -25,8 +26,8 @@ function debounce) => ReturnType>(fn: F, ti } function getDocumentsAndSnapshot>(id: string, actor: MutatorActor) { - const inFrame = window.self !== window.top - const inPopUp = Boolean(window.opener) + const inFrame = isMaybePreviewIframe() + const inPopUp = isMaybePreviewWindow() if (isEmptyActor(actor) || (!inFrame && !inPopUp)) { throw new Error('The `useDocuments` hook cannot be used in this context') diff --git a/packages/visual-editing/src/remix/index.ts b/packages/visual-editing/src/remix/index.ts index 5e9fd233b..33b3f4115 100644 --- a/packages/visual-editing/src/remix/index.ts +++ b/packages/visual-editing/src/remix/index.ts @@ -16,14 +16,10 @@ export type { export {VisualEditing} from './VisualEditing' export type {VisualEditingProps} from './VisualEditingComponent' export { - createDataAttribute, - type CreateDataAttribute, - type CreateDataAttributeProps, type DocumentSchema, type SchemaArrayItem, type SchemaNode, type SchemaUnionOption, - type WithRequired, type SchemaArrayNode, type SchemaBooleanNode, type SchemaInlineNode, @@ -35,4 +31,10 @@ export { type SchemaUnionNode, type SchemaUnionNodeOptions, type SchemaUnknownNode, -} from '@repo/visual-editing-helpers' +} from '@sanity/presentation-comlink' +export { + createDataAttribute, + type CreateDataAttributeProps, + type CreateDataAttribute, + type WithRequired, +} from '@sanity/visual-editing-csm' diff --git a/packages/visual-editing/src/types.ts b/packages/visual-editing/src/types.ts index 7339dfefb..78766a7eb 100644 --- a/packages/visual-editing/src/types.ts +++ b/packages/visual-editing/src/types.ts @@ -1,3 +1,4 @@ +import type {Node} from '@sanity/comlink' import type { DocumentSchema, HistoryRefresh, @@ -11,8 +12,7 @@ import type { SchemaUnionOption, VisualEditingControllerMsg, VisualEditingNodeMsg, -} from '@repo/visual-editing-helpers' -import type {Node} from '@sanity/comlink' +} from '@sanity/presentation-comlink' import type { ComponentType, FunctionComponent, @@ -26,7 +26,7 @@ export type { HistoryUpdate, SanityNode, SanityStegaNode, -} from '@repo/visual-editing-helpers' +} from '@sanity/presentation-comlink' /** * @public diff --git a/packages/visual-editing/src/ui/ElementOverlay.tsx b/packages/visual-editing/src/ui/ElementOverlay.tsx index 3a461fb4d..14da4d255 100644 --- a/packages/visual-editing/src/ui/ElementOverlay.tsx +++ b/packages/visual-editing/src/ui/ElementOverlay.tsx @@ -1,7 +1,7 @@ -import {pathToUrlString} from '@repo/visual-editing-helpers' import {createEditUrl, studioPath} from '@sanity/client/csm' import {DocumentIcon, DragHandleIcon} from '@sanity/icons' import {Box, Card, Flex, Text} from '@sanity/ui' +import {pathToUrlString} from '@sanity/visual-editing-csm' import { isValidElement, memo, diff --git a/packages/visual-editing/src/ui/Overlays.tsx b/packages/visual-editing/src/ui/Overlays.tsx index ed9dbd438..3d8d3f09a 100644 --- a/packages/visual-editing/src/ui/Overlays.tsx +++ b/packages/visual-editing/src/ui/Overlays.tsx @@ -1,6 +1,6 @@ -import {isAltKey, isHotkey, type VisualEditingControllerMsg} from '@repo/visual-editing-helpers' import type {ClientPerspective} from '@sanity/client' import type {Status} from '@sanity/comlink' +import {type VisualEditingControllerMsg} from '@sanity/presentation-comlink' import { isHTMLAnchorElement, isHTMLElement, @@ -432,3 +432,24 @@ export const Overlays: FunctionComponent<{ ) } + +const IS_MAC = + typeof window != 'undefined' && /Mac|iPod|iPhone|iPad/.test(window.navigator.platform) + +const MODIFIERS: Record = { + alt: 'altKey', + ctrl: 'ctrlKey', + mod: IS_MAC ? 'metaKey' : 'ctrlKey', + shift: 'shiftKey', +} +function isHotkey(keys: string[], event: KeyboardEvent): boolean { + return keys.every((key) => { + if (MODIFIERS[key]) { + return event[MODIFIERS[key]] + } + return event.key === key.toUpperCase() + }) +} +function isAltKey(event: KeyboardEvent): boolean { + return event.key === 'Alt' +} diff --git a/packages/visual-editing/src/ui/VisualEditing.tsx b/packages/visual-editing/src/ui/VisualEditing.tsx index c2849113f..c3b55207e 100644 --- a/packages/visual-editing/src/ui/VisualEditing.tsx +++ b/packages/visual-editing/src/ui/VisualEditing.tsx @@ -1,3 +1,4 @@ +import {isMaybePreviewIframe, isMaybePreviewWindow} from '@sanity/presentation-comlink' import {useEffect, useState} from 'react' import {createPortal} from 'react-dom' import type {VisualEditingOptions} from '../types' @@ -17,8 +18,8 @@ export const VisualEditing = (props: VisualEditingOptions & {portal: boolean}): const [inFrame, setInFrame] = useState(null) const [inPopUp, setInPopUp] = useState(null) useEffect(() => { - setInFrame(window.self !== window.top) - setInPopUp(Boolean(window.opener)) + setInFrame(isMaybePreviewIframe()) + setInPopUp(isMaybePreviewWindow()) }, []) const [portalElement, setPortalElement] = useState(null) diff --git a/packages/visual-editing/src/ui/context-menu/contextMenuItems.tsx b/packages/visual-editing/src/ui/context-menu/contextMenuItems.tsx index 68f3ad4c0..343eb9cbd 100644 --- a/packages/visual-editing/src/ui/context-menu/contextMenuItems.tsx +++ b/packages/visual-editing/src/ui/context-menu/contextMenuItems.tsx @@ -1,10 +1,3 @@ -import type { - SanityNode, - SchemaArrayItem, - SchemaNode, - SchemaUnionNode, - SchemaUnionOption, -} from '@repo/visual-editing-helpers' import { ArrowDownIcon, ArrowUpIcon, @@ -16,6 +9,13 @@ import { SortIcon, UnpublishIcon, } from '@sanity/icons' +import type { + SanityNode, + SchemaArrayItem, + SchemaNode, + SchemaUnionNode, + SchemaUnionOption, +} from '@sanity/presentation-comlink' import type {SchemaType} from '@sanity/types' import {MenuGroup} from '@sanity/ui' import {type FunctionComponent} from 'react' diff --git a/packages/visual-editing/src/ui/elementsReducer.ts b/packages/visual-editing/src/ui/elementsReducer.ts index cd6c62213..8a99f8f23 100644 --- a/packages/visual-editing/src/ui/elementsReducer.ts +++ b/packages/visual-editing/src/ui/elementsReducer.ts @@ -1,4 +1,4 @@ -import type {VisualEditingControllerMsg} from '@repo/visual-editing-helpers' +import type {VisualEditingControllerMsg} from '@sanity/presentation-comlink' import type {ElementState, OverlayMsg} from '../types' /** diff --git a/packages/visual-editing/src/ui/overlayStateReducer.ts b/packages/visual-editing/src/ui/overlayStateReducer.ts index 762b92194..bc8add5aa 100644 --- a/packages/visual-editing/src/ui/overlayStateReducer.ts +++ b/packages/visual-editing/src/ui/overlayStateReducer.ts @@ -1,5 +1,5 @@ -import type {SanityNode, VisualEditingControllerMsg} from '@repo/visual-editing-helpers' import type {ClientPerspective} from '@sanity/client' +import type {SanityNode, VisualEditingControllerMsg} from '@sanity/presentation-comlink' import type { DragInsertPosition, DragSkeleton, diff --git a/packages/visual-editing/src/ui/preview/PreviewSnapshotsContext.tsx b/packages/visual-editing/src/ui/preview/PreviewSnapshotsContext.tsx index cea6cd6a4..bacd40036 100644 --- a/packages/visual-editing/src/ui/preview/PreviewSnapshotsContext.tsx +++ b/packages/visual-editing/src/ui/preview/PreviewSnapshotsContext.tsx @@ -1,4 +1,4 @@ -import type {PreviewSnapshot} from '@repo/visual-editing-helpers' +import type {PreviewSnapshot} from '@sanity/presentation-comlink' import {createContext} from 'react' export type PreviewSnapshotsContextValue = PreviewSnapshot[] diff --git a/packages/visual-editing/src/ui/schema/SchemaContext.tsx b/packages/visual-editing/src/ui/schema/SchemaContext.tsx index f59274987..2c714e7b4 100644 --- a/packages/visual-editing/src/ui/schema/SchemaContext.tsx +++ b/packages/visual-editing/src/ui/schema/SchemaContext.tsx @@ -5,7 +5,7 @@ import type { SanityStegaNode, SchemaType, TypeSchema, -} from '@repo/visual-editing-helpers' +} from '@sanity/presentation-comlink' import {createContext} from 'react' import type {OverlayElementField, OverlayElementParent} from '../../types' diff --git a/packages/visual-editing/src/ui/schema/SchemaProvider.tsx b/packages/visual-editing/src/ui/schema/SchemaProvider.tsx index caffc5311..3d7d7a2f4 100644 --- a/packages/visual-editing/src/ui/schema/SchemaProvider.tsx +++ b/packages/visual-editing/src/ui/schema/SchemaProvider.tsx @@ -6,7 +6,7 @@ import type { SchemaType, TypeSchema, UnresolvedPath, -} from '@repo/visual-editing-helpers' +} from '@sanity/presentation-comlink' import { useCallback, useEffect, diff --git a/packages/visual-editing/src/ui/shared-state/SharedStateProvider.tsx b/packages/visual-editing/src/ui/shared-state/SharedStateProvider.tsx index cb1bfc8b9..224de26bc 100644 --- a/packages/visual-editing/src/ui/shared-state/SharedStateProvider.tsx +++ b/packages/visual-editing/src/ui/shared-state/SharedStateProvider.tsx @@ -1,4 +1,4 @@ -import type {SerializableObject} from '@repo/visual-editing-helpers' +import type {SerializableObject} from '@sanity/presentation-comlink' import {useEffect, useMemo, type FunctionComponent, type PropsWithChildren} from 'react' import type {VisualEditingNode} from '../../types' import {SharedStateContext} from './SharedStateContext' diff --git a/packages/visual-editing/src/ui/shared-state/sharedStateStore.ts b/packages/visual-editing/src/ui/shared-state/sharedStateStore.ts index b1671c7aa..fc76e4b5d 100644 --- a/packages/visual-editing/src/ui/shared-state/sharedStateStore.ts +++ b/packages/visual-editing/src/ui/shared-state/sharedStateStore.ts @@ -1,4 +1,4 @@ -import type {SerializableObject} from '@repo/visual-editing-helpers' +import type {SerializableObject} from '@sanity/presentation-comlink' export interface SharedStateStore { getState: () => T diff --git a/packages/visual-editing/src/ui/useComlink.tsx b/packages/visual-editing/src/ui/useComlink.tsx index b91600e40..39f6d22a2 100644 --- a/packages/visual-editing/src/ui/useComlink.tsx +++ b/packages/visual-editing/src/ui/useComlink.tsx @@ -1,9 +1,9 @@ +import {createNode, createNodeMachine} from '@sanity/comlink' import { createCompatibilityActors, type VisualEditingControllerMsg, type VisualEditingNodeMsg, -} from '@repo/visual-editing-helpers' -import {createNode, createNodeMachine} from '@sanity/comlink' +} from '@sanity/presentation-comlink' import {useEffect, useState} from 'react' import type {VisualEditingNode} from '../types' diff --git a/packages/visual-editing/src/ui/usePerspectiveSync.tsx b/packages/visual-editing/src/ui/usePerspectiveSync.tsx index e5f14b12c..0f0077417 100644 --- a/packages/visual-editing/src/ui/usePerspectiveSync.tsx +++ b/packages/visual-editing/src/ui/usePerspectiveSync.tsx @@ -1,4 +1,4 @@ -import type {VisualEditingControllerMsg} from '@repo/visual-editing-helpers' +import type {VisualEditingControllerMsg} from '@sanity/presentation-comlink' import {useEffect} from 'react' import type {OverlayMsg, VisualEditingNode} from '../types' diff --git a/packages/visual-editing/src/ui/useReportDocuments.ts b/packages/visual-editing/src/ui/useReportDocuments.ts index 0cd11389c..b8e4e3cf4 100644 --- a/packages/visual-editing/src/ui/useReportDocuments.ts +++ b/packages/visual-editing/src/ui/useReportDocuments.ts @@ -1,5 +1,5 @@ -import {DRAFTS_PREFIX} from '@repo/visual-editing-helpers/csm' import type {ClientPerspective, ContentSourceMapDocuments} from '@sanity/client' +import {DRAFTS_PREFIX} from '@sanity/visual-editing-csm' import {useCallback, useEffect, useRef} from 'react' import type {ElementState, SanityNode, VisualEditingNode} from '../types' diff --git a/packages/visual-editing/src/util/documents.ts b/packages/visual-editing/src/util/documents.ts index d25b03124..15a10bba1 100644 --- a/packages/visual-editing/src/util/documents.ts +++ b/packages/visual-editing/src/util/documents.ts @@ -1,4 +1,4 @@ -import {DRAFTS_PREFIX} from '@repo/visual-editing-helpers/csm' +import {DRAFTS_PREFIX} from '@sanity/visual-editing-csm' export function isDraftId(id: string): boolean { return id.startsWith(DRAFTS_PREFIX) diff --git a/packages/visual-editing/src/util/findSanityNodes.ts b/packages/visual-editing/src/util/findSanityNodes.ts index 8450b1d45..3d11a1d1c 100644 --- a/packages/visual-editing/src/util/findSanityNodes.ts +++ b/packages/visual-editing/src/util/findSanityNodes.ts @@ -1,4 +1,4 @@ -import {decodeSanityNodeData} from '@repo/visual-editing-helpers/csm' +import {decodeSanityNodeData} from '@sanity/visual-editing-csm' import type { ElementNode, OverlayElement, diff --git a/packages/visual-editing/src/util/getNodeIcon.tsx b/packages/visual-editing/src/util/getNodeIcon.tsx index 1155ecac4..ad0eca80e 100644 --- a/packages/visual-editing/src/util/getNodeIcon.tsx +++ b/packages/visual-editing/src/util/getNodeIcon.tsx @@ -1,10 +1,3 @@ -import type { - SchemaArrayItem, - SchemaNumberNode, - SchemaObjectField, - SchemaStringNode, - SchemaUnionOption, -} from '@repo/visual-editing-helpers' import { BlockContentIcon, CheckmarkCircleIcon, @@ -14,6 +7,13 @@ import { StringIcon, ThListIcon, } from '@sanity/icons' +import type { + SchemaArrayItem, + SchemaNumberNode, + SchemaObjectField, + SchemaStringNode, + SchemaUnionOption, +} from '@sanity/presentation-comlink' type Option = | SchemaNumberNode diff --git a/packages/visual-editing/src/util/mutations.ts b/packages/visual-editing/src/util/mutations.ts index d1e32bbe9..745dba5f8 100644 --- a/packages/visual-editing/src/util/mutations.ts +++ b/packages/visual-editing/src/util/mutations.ts @@ -1,6 +1,6 @@ -import type {SanityNode} from '@repo/visual-editing-helpers' import type {SanityDocument} from '@sanity/client' import {at, insert, truncate, type NodePatchList} from '@sanity/mutate' +import type {SanityNode} from '@sanity/presentation-comlink' import {get} from '@sanity/util/paths' import type {OptimisticDocument} from '../optimistic/types' import {randomKey} from './randomKey' diff --git a/packages/visual-editing/src/util/stega.ts b/packages/visual-editing/src/util/stega.ts index d69d88183..6a5c8cb5c 100644 --- a/packages/visual-editing/src/util/stega.ts +++ b/packages/visual-editing/src/util/stega.ts @@ -1,4 +1,4 @@ -import type {SanityStegaNode} from '@repo/visual-editing-helpers' +import type {SanityStegaNode} from '@sanity/presentation-comlink' import {vercelStegaDecode} from '@vercel/stega' import {VERCEL_STEGA_REGEX} from '../constants' diff --git a/packages/visual-editing/svelte/optimistic/useOptimistic.ts b/packages/visual-editing/svelte/optimistic/useOptimistic.ts index 707311597..ec1841d67 100644 --- a/packages/visual-editing/svelte/optimistic/useOptimistic.ts +++ b/packages/visual-editing/svelte/optimistic/useOptimistic.ts @@ -1,4 +1,5 @@ import type {SanityDocument} from '@sanity/types' +import {DRAFTS_PREFIX} from '@sanity/visual-editing-csm' import { isEmptyActor, type OptimisticReducer, @@ -9,7 +10,6 @@ import {derived, get, writable, type Readable} from 'svelte/store' import {optimisticActor} from './optimisticActor' function getPublishedId(id: string): string { - const DRAFTS_PREFIX = 'drafts.' return id.startsWith(DRAFTS_PREFIX) ? id.slice(DRAFTS_PREFIX.length) : id } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 13997fea4..952236ce0 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -9,6 +9,7 @@ overrides: '@sanity/core-loader': workspace:* '@sanity/next-loader': workspace:* '@sanity/presentation': workspace:* + '@sanity/presentation-comlink': workspace:* '@sanity/preview-kit-compat': workspace:* '@sanity/preview-url-secret': workspace:* '@sanity/react-loader': workspace:* @@ -17,6 +18,7 @@ overrides: '@sanity/util': 3.70.0 '@sanity/vision': 3.70.0 '@sanity/visual-editing': workspace:* + '@sanity/visual-editing-csm': workspace:* '@types/react': 19.0.7 '@types/react-dom': 19.0.3 groq: 3.70.0 @@ -177,7 +179,7 @@ importers: version: 19.0.3(@types/react@19.0.7) '@vercel/speed-insights': specifier: ^1.1.0 - version: 1.1.0(@sveltejs/kit@2.15.3(@sveltejs/vite-plugin-svelte@3.1.2(svelte@4.2.19)(vite@6.0.7(@types/node@20.17.12)(jiti@2.4.2)(terser@5.37.0)(yaml@2.7.0)))(svelte@4.2.19)(vite@6.0.7(@types/node@20.17.12)(jiti@2.4.2)(terser@5.37.0)(yaml@2.7.0)))(next@15.2.0-canary.12(@babel/core@7.26.0)(babel-plugin-react-compiler@19.0.0-beta-e552027-20250112)(react-dom@19.0.0(react@19.0.0))(react@19.0.0))(react@19.0.0)(svelte@4.2.19)(vue-router@4.5.0(vue@3.5.13(typescript@5.7.3)))(vue@3.5.13(typescript@5.7.3)) + version: 1.1.0(@sveltejs/kit@2.15.3(@sveltejs/vite-plugin-svelte@3.1.2(svelte@4.2.19)(vite@6.0.7(@types/node@20.17.12)(jiti@2.4.2)(terser@5.37.0)(yaml@2.7.0)))(svelte@4.2.19)(vite@6.0.7(@types/node@20.17.12)(jiti@2.4.2)(terser@5.37.0)(yaml@2.7.0)))(next@15.2.0-canary.13(@babel/core@7.26.0)(babel-plugin-react-compiler@19.0.0-beta-e552027-20250112)(react-dom@19.0.0(react@19.0.0))(react@19.0.0))(react@19.0.0)(svelte@4.2.19)(vue-router@4.5.0(vue@3.5.13(typescript@5.7.3)))(vue@3.5.13(typescript@5.7.3)) autoprefixer: specifier: ^10.4.20 version: 10.4.20(postcss@8.5.1) @@ -192,10 +194,10 @@ importers: version: 11.18.0(@emotion/is-prop-valid@1.2.2)(react-dom@19.0.0(react@19.0.0))(react@19.0.0) next: specifier: canary - version: 15.2.0-canary.12(@babel/core@7.26.0)(babel-plugin-react-compiler@19.0.0-beta-e552027-20250112)(react-dom@19.0.0(react@19.0.0))(react@19.0.0) + version: 15.2.0-canary.13(@babel/core@7.26.0)(babel-plugin-react-compiler@19.0.0-beta-e552027-20250112)(react-dom@19.0.0(react@19.0.0))(react@19.0.0) next-sanity: specifier: 9.8.37 - version: 9.8.37(@sanity/client@6.24.3)(@sanity/icons@3.5.7(react@19.0.0))(@sanity/types@3.70.0(@types/react@19.0.7))(@sanity/ui@2.11.2(@emotion/is-prop-valid@1.2.2)(react-dom@19.0.0(react@19.0.0))(react-is@19.0.0)(react@19.0.0)(styled-components@6.1.14(react-dom@19.0.0(react@19.0.0))(react@19.0.0)))(next@15.2.0-canary.12(@babel/core@7.26.0)(babel-plugin-react-compiler@19.0.0-beta-e552027-20250112)(react-dom@19.0.0(react@19.0.0))(react@19.0.0))(react@19.0.0)(sanity@3.70.0(@emotion/is-prop-valid@1.2.2)(@types/babel__core@7.20.5)(@types/node@20.17.12)(@types/react@19.0.7)(babel-plugin-react-compiler@19.0.0-beta-e552027-20250112)(react-dom@19.0.0(react@19.0.0))(react@19.0.0)(styled-components@6.1.14(react-dom@19.0.0(react@19.0.0))(react@19.0.0))(terser@5.37.0)(typescript@5.7.3))(styled-components@6.1.14(react-dom@19.0.0(react@19.0.0))(react@19.0.0)) + version: 9.8.37(@sanity/client@6.24.3)(@sanity/icons@3.5.7(react@19.0.0))(@sanity/types@3.70.0(@types/react@19.0.7))(@sanity/ui@2.11.2(@emotion/is-prop-valid@1.2.2)(react-dom@19.0.0(react@19.0.0))(react-is@19.0.0)(react@19.0.0)(styled-components@6.1.14(react-dom@19.0.0(react@19.0.0))(react@19.0.0)))(next@15.2.0-canary.13(@babel/core@7.26.0)(babel-plugin-react-compiler@19.0.0-beta-e552027-20250112)(react-dom@19.0.0(react@19.0.0))(react@19.0.0))(react@19.0.0)(sanity@3.70.0(@emotion/is-prop-valid@1.2.2)(@types/babel__core@7.20.5)(@types/node@20.17.12)(@types/react@19.0.7)(babel-plugin-react-compiler@19.0.0-beta-e552027-20250112)(react-dom@19.0.0(react@19.0.0))(react@19.0.0)(styled-components@6.1.14(react-dom@19.0.0(react@19.0.0))(react@19.0.0))(terser@5.37.0)(typescript@5.7.3))(styled-components@6.1.14(react-dom@19.0.0(react@19.0.0))(react@19.0.0)) postcss: specifier: ^8.5.1 version: 8.5.1 @@ -220,7 +222,7 @@ importers: devDependencies: '@next/bundle-analyzer': specifier: canary - version: 15.2.0-canary.12 + version: 15.2.0-canary.13 '@repo/prettier-config': specifier: workspace:* version: link:../../packages/@repo/prettier-config @@ -229,7 +231,7 @@ importers: version: 8.57.1 eslint-config-next: specifier: canary - version: 15.2.0-canary.12(eslint@8.57.1)(typescript@5.7.3) + version: 15.2.0-canary.13(eslint@8.57.1)(typescript@5.7.3) eslint-plugin-react-compiler: specifier: 19.0.0-beta-e552027-20250112 version: 19.0.0-beta-e552027-20250112(eslint@8.57.1) @@ -974,6 +976,9 @@ importers: '@repo/package.config': specifier: workspace:* version: link:../@repo/package.config + '@sanity/pkg-utils': + specifier: 6.13.4 + version: 6.13.4(@types/babel__core@7.20.5)(@types/node@22.10.6)(babel-plugin-react-compiler@19.0.0-beta-e552027-20250112)(typescript@5.7.3) eslint: specifier: ^8.57.1 version: 8.57.1 @@ -1071,6 +1076,12 @@ importers: '@sanity/comlink': specifier: workspace:* version: link:../comlink + '@sanity/presentation-comlink': + specifier: workspace:* + version: link:../presentation-comlink + '@sanity/visual-editing-csm': + specifier: workspace:* + version: link:../visual-editing-csm devDependencies: '@repo/eslint-config': specifier: workspace:* @@ -1081,9 +1092,6 @@ importers: '@repo/prettier-config': specifier: workspace:* version: link:../@repo/prettier-config - '@repo/visual-editing-helpers': - specifier: workspace:* - version: link:../visual-editing-helpers '@sanity/pkg-utils': specifier: 6.13.4 version: 6.13.4(@types/babel__core@7.20.5)(@types/node@22.10.6)(babel-plugin-react-compiler@19.0.0-beta-e552027-20250112)(typescript@5.7.3) @@ -1175,6 +1183,9 @@ importers: '@sanity/comlink': specifier: workspace:* version: link:../comlink + '@sanity/presentation-comlink': + specifier: workspace:* + version: link:../presentation-comlink use-effect-event: specifier: ^1.0.2 version: 1.0.2(react@19.0.0) @@ -1188,9 +1199,6 @@ importers: '@repo/prettier-config': specifier: workspace:* version: link:../@repo/prettier-config - '@repo/visual-editing-helpers': - specifier: workspace:* - version: link:../visual-editing-helpers '@sanity/pkg-utils': specifier: 6.13.4 version: 6.13.4(@types/babel__core@7.20.5)(@types/node@22.10.6)(babel-plugin-react-compiler@19.0.0-beta-e552027-20250112)(typescript@5.7.3) @@ -1233,6 +1241,9 @@ importers: '@sanity/logos': specifier: ^2.1.13 version: 2.1.13(@sanity/color@3.0.6)(react@19.0.0) + '@sanity/presentation-comlink': + specifier: workspace:* + version: link:../presentation-comlink '@sanity/preview-url-secret': specifier: workspace:* version: link:../preview-url-secret @@ -1282,12 +1293,12 @@ importers: '@repo/prettier-config': specifier: workspace:* version: link:../@repo/prettier-config - '@repo/visual-editing-helpers': - specifier: workspace:* - version: link:../visual-editing-helpers '@sanity/pkg-utils': specifier: 6.13.4 version: 6.13.4(@types/babel__core@7.20.5)(@types/node@22.10.6)(babel-plugin-react-compiler@19.0.0-beta-e552027-20250112)(typescript@5.7.3) + '@sanity/visual-editing-csm': + specifier: workspace:* + version: link:../visual-editing-csm '@types/lodash': specifier: ^4.17.14 version: 4.17.14 @@ -1319,11 +1330,45 @@ importers: specifier: ^2.1.8 version: 2.1.8(@types/node@22.10.6)(happy-dom@16.6.0)(jsdom@26.0.0)(terser@5.37.0) + packages/presentation-comlink: + dependencies: + '@sanity/comlink': + specifier: workspace:* + version: link:../comlink + '@sanity/visual-editing-types': + specifier: workspace:^ + version: link:../visual-editing-types + devDependencies: + '@repo/eslint-config': + specifier: workspace:* + version: link:../@repo/eslint-config + '@repo/package.config': + specifier: workspace:* + version: link:../@repo/package.config + '@sanity/client': + specifier: ^6.24.3 + version: 6.24.3(debug@4.4.0) + '@sanity/pkg-utils': + specifier: 6.13.4 + version: 6.13.4(@types/babel__core@7.20.5)(@types/node@22.10.6)(babel-plugin-react-compiler@19.0.0-beta-e552027-20250112)(typescript@5.7.3) + eslint: + specifier: ^8.57.1 + version: 8.57.1 + typescript: + specifier: 5.7.3 + version: 5.7.3 + vitest: + specifier: ^2.1.8 + version: 2.1.8(@types/node@22.10.6)(happy-dom@16.6.0)(jsdom@26.0.0)(terser@5.37.0) + packages/preview-kit-compat: dependencies: '@sanity/comlink': specifier: workspace:* version: link:../comlink + '@sanity/presentation-comlink': + specifier: workspace:* + version: link:../presentation-comlink devDependencies: '@repo/eslint-config': specifier: workspace:* @@ -1334,9 +1379,6 @@ importers: '@repo/prettier-config': specifier: workspace:* version: link:../@repo/prettier-config - '@repo/visual-editing-helpers': - specifier: workspace:* - version: link:../visual-editing-helpers '@sanity/client': specifier: ^6.24.3 version: 6.24.3(debug@4.4.0) @@ -1404,6 +1446,9 @@ importers: '@sanity/core-loader': specifier: workspace:* version: link:../core-loader + '@sanity/visual-editing-csm': + specifier: workspace:* + version: link:../visual-editing-csm devDependencies: '@repo/eslint-config': specifier: workspace:* @@ -1414,9 +1459,6 @@ importers: '@repo/prettier-config': specifier: workspace:* version: link:../@repo/prettier-config - '@repo/visual-editing-helpers': - specifier: workspace:* - version: link:../visual-editing-helpers '@sanity/pkg-utils': specifier: 6.13.4 version: 6.13.4(@types/babel__core@7.20.5)(@types/node@22.10.6)(babel-plugin-react-compiler@19.0.0-beta-e552027-20250112)(typescript@5.7.3) @@ -1460,9 +1502,6 @@ importers: '@repo/prettier-config': specifier: workspace:* version: link:../@repo/prettier-config - '@repo/visual-editing-helpers': - specifier: workspace:* - version: link:../visual-editing-helpers '@sanity/pkg-utils': specifier: 6.13.4 version: 6.13.4(@types/babel__core@7.20.5)(@types/node@22.10.6)(babel-plugin-react-compiler@19.0.0-beta-e552027-20250112)(typescript@5.7.3) @@ -1545,9 +1584,15 @@ importers: '@sanity/mutate': specifier: 0.11.0-canary.4 version: 0.11.0-canary.4(xstate@5.19.2) + '@sanity/presentation-comlink': + specifier: workspace:* + version: link:../presentation-comlink '@sanity/preview-url-secret': specifier: workspace:* version: link:../preview-url-secret + '@sanity/visual-editing-csm': + specifier: workspace:* + version: link:../visual-editing-csm '@vercel/stega': specifier: 0.1.2 version: 0.1.2 @@ -1582,9 +1627,6 @@ importers: '@repo/package.config': specifier: workspace:* version: link:../@repo/package.config - '@repo/visual-editing-helpers': - specifier: workspace:* - version: link:../visual-editing-helpers '@sanity/client': specifier: ^6.24.3 version: 6.24.3(debug@4.4.0) @@ -1594,6 +1636,9 @@ importers: '@sanity/demo': specifier: ^2.0.0 version: 2.0.0(@sanity/color@3.0.6)(tailwindcss@3.4.17) + '@sanity/insert-menu': + specifier: workspace:* + version: link:../insert-menu '@sanity/pkg-utils': specifier: 6.13.4 version: 6.13.4(@types/babel__core@7.20.5)(@types/node@22.10.6)(babel-plugin-react-compiler@19.0.0-beta-e552027-20250112)(typescript@5.7.3) @@ -1691,7 +1736,14 @@ importers: specifier: ^2.1.8 version: 2.1.8(@types/node@22.10.6)(happy-dom@16.6.0)(jsdom@26.0.0)(terser@5.37.0) - packages/visual-editing-helpers: + packages/visual-editing-csm: + dependencies: + '@sanity/visual-editing-types': + specifier: workspace:^ + version: link:../visual-editing-types + valibot: + specifier: 0.31.1 + version: 0.31.1 devDependencies: '@repo/eslint-config': specifier: workspace:* @@ -1699,39 +1751,48 @@ importers: '@repo/package.config': specifier: workspace:* version: link:../@repo/package.config - '@repo/prettier-config': + '@sanity/client': + specifier: ^6.24.3 + version: 6.24.3(debug@4.4.0) + '@sanity/pkg-utils': + specifier: 6.13.4 + version: 6.13.4(@types/babel__core@7.20.5)(@types/node@22.10.6)(babel-plugin-react-compiler@19.0.0-beta-e552027-20250112)(typescript@5.7.3) + eslint: + specifier: ^8.57.1 + version: 8.57.1 + typescript: + specifier: 5.7.3 + version: 5.7.3 + vitest: + specifier: ^2.1.8 + version: 2.1.8(@types/node@22.10.6)(happy-dom@16.6.0)(jsdom@26.0.0)(terser@5.37.0) + + packages/visual-editing-types: + devDependencies: + '@repo/eslint-config': specifier: workspace:* - version: link:../@repo/prettier-config + version: link:../@repo/eslint-config + '@repo/package.config': + specifier: workspace:* + version: link:../@repo/package.config '@sanity/client': specifier: ^6.24.3 version: 6.24.3(debug@4.4.0) - '@sanity/comlink': + '@sanity/insert-menu': specifier: workspace:* - version: link:../comlink - '@sanity/util': + version: link:../insert-menu + '@sanity/pkg-utils': + specifier: 6.13.4 + version: 6.13.4(@types/babel__core@7.20.5)(@types/node@22.10.6)(babel-plugin-react-compiler@19.0.0-beta-e552027-20250112)(typescript@5.7.3) + '@sanity/types': specifier: 3.70.0 version: 3.70.0(@types/react@19.0.7)(debug@4.4.0) - '@types/react': - specifier: 19.0.7 - version: 19.0.7 eslint: specifier: ^8.57.1 version: 8.57.1 - react: - specifier: ^19.0.0 - version: 19.0.0 - sanity: - specifier: 3.70.0 - version: 3.70.0(@emotion/is-prop-valid@1.2.2)(@types/babel__core@7.20.5)(@types/node@22.10.6)(@types/react@19.0.7)(babel-plugin-react-compiler@19.0.0-beta-e552027-20250112)(react-dom@19.0.0(react@19.0.0))(react@19.0.0)(styled-components@6.1.14(react-dom@19.0.0(react@19.0.0))(react@19.0.0))(terser@5.37.0)(typescript@5.7.3) typescript: specifier: 5.7.3 version: 5.7.3 - valibot: - specifier: 0.31.1 - version: 0.31.1 - vitest: - specifier: ^2.1.8 - version: 2.1.8(@types/node@22.10.6)(happy-dom@16.6.0)(jsdom@26.0.0)(terser@5.37.0) packages: @@ -3279,20 +3340,20 @@ packages: '@next/bundle-analyzer@15.1.4': resolution: {integrity: sha512-W8X96jOW0U5VjLVAkFr1P37kH2f/Ma9zzwgX2o3Omft92pI0XHpFG8Xa9YUT3NlhRJCe4ZKznr1VxhSrFNA+BA==} - '@next/bundle-analyzer@15.2.0-canary.12': - resolution: {integrity: sha512-wTr1VrRuVJR6kkdf5Dt1JzxpNDUQCQxdRVxeU6wB04xKVl2VM2LxKS6+z/GOdZS2YgoSbUQ0CJMjEaKOB72XnA==} + '@next/bundle-analyzer@15.2.0-canary.13': + resolution: {integrity: sha512-+oWGMObI3Twqei6v5p6kAfRwSR5ktl4xfPDwq6iLTj0QNYSK2q/hOhZKocY/BN7R+tLLWH6N0QbzBMFB2gWwZQ==} '@next/env@15.1.4': resolution: {integrity: sha512-2fZ5YZjedi5AGaeoaC0B20zGntEHRhi2SdWcu61i48BllODcAmmtj8n7YarSPt4DaTsJaBFdxQAVEVzgmx2Zpw==} - '@next/env@15.2.0-canary.12': - resolution: {integrity: sha512-QROcneclOKgx5bPz/Ae/tokhwaabbDBuXGf1OvFOhFE484ZP0H+p6bxf+jbP0ANP6bXYvrHDDWnplfi9Y33gKA==} + '@next/env@15.2.0-canary.13': + resolution: {integrity: sha512-c92pSdozGK+TCuER2ma/Y0hZdJ0OWOVjtGZl0D4pPMMUtB04wjo431GYQKZ9Dz8j7IXmBGGKW7T0zElt+fnG0Q==} '@next/eslint-plugin-next@15.1.4': resolution: {integrity: sha512-HwlEXwCK3sr6zmVGEvWBjW9tBFs1Oe6hTmTLoFQtpm4As5HCdu8jfSE0XJOp7uhfEGLniIx8yrGxEWwNnY0fmQ==} - '@next/eslint-plugin-next@15.2.0-canary.12': - resolution: {integrity: sha512-67ZdVoT8GscNdzlSUtVtV+0d7l6+zM+3nNlxl7P8myCM71dHY8+PMXIPMRlXZ3Bhmu9EJmxJCwQEdVrT8uX8DQ==} + '@next/eslint-plugin-next@15.2.0-canary.13': + resolution: {integrity: sha512-RDbnNj3cywMspFVjUSyO/qzaoFXE5xhw4h2aOl9KXK2LrASpnkVdrQnHkvvGRIPl866RC8k5zH6HS8fBy3i2cg==} '@next/swc-darwin-arm64@15.1.4': resolution: {integrity: sha512-wBEMBs+np+R5ozN1F8Y8d/Dycns2COhRnkxRc+rvnbXke5uZBHkUGFgWxfTXn5rx7OLijuUhyfB+gC/ap58dDw==} @@ -3300,8 +3361,8 @@ packages: cpu: [arm64] os: [darwin] - '@next/swc-darwin-arm64@15.2.0-canary.12': - resolution: {integrity: sha512-pMyI06D0qN0930CavbCTsFOUtcw6eHXy6QA1dy+9dk64Ed5QRZm3pXA0AO93qhFY8+Z17KBMg5VKxvzqoK93Yg==} + '@next/swc-darwin-arm64@15.2.0-canary.13': + resolution: {integrity: sha512-5bGssN8CewFN4Lr+Jy95DGz5ZGTnM3lAvo453HMoMJ8YXrrVBf+YxMKBOR6XrcfQD0YLNQAEAlk2oKOMoonO9A==} engines: {node: '>= 10'} cpu: [arm64] os: [darwin] @@ -3312,8 +3373,8 @@ packages: cpu: [x64] os: [darwin] - '@next/swc-darwin-x64@15.2.0-canary.12': - resolution: {integrity: sha512-pZMhYlq9LutJTuEevIERN3tSgHPLfS/IAgqZdDw4VDUHKKzCEGqUNTnyJE7kJiF/AcaW9OxDjtKzM5SZ3BRgWA==} + '@next/swc-darwin-x64@15.2.0-canary.13': + resolution: {integrity: sha512-twl2GMxF05iHxLDKHj3jMmGMz0/P+f7e3AzDETDLn7qilFsKrkVD6uZq7Jt6w82KrAZ74GiHH/yvlyDTbZxnIQ==} engines: {node: '>= 10'} cpu: [x64] os: [darwin] @@ -3324,8 +3385,8 @@ packages: cpu: [arm64] os: [linux] - '@next/swc-linux-arm64-gnu@15.2.0-canary.12': - resolution: {integrity: sha512-sWPENLhbW40NY4EnVJ1Fl3P1YO9PCicG1fvygr7XM5U0QOwiZzgkKuS7nMEFgkSKwLBQBScHGM/Fvz38T1qtlw==} + '@next/swc-linux-arm64-gnu@15.2.0-canary.13': + resolution: {integrity: sha512-BPF9MxHx6gU3glKoCoh+lPTm5Iv5cVt/5MowAPi5/DsVX8DYD3h9WOPsoVfPbgUVmf2drXRY6uRuUCzhxQUu0A==} engines: {node: '>= 10'} cpu: [arm64] os: [linux] @@ -3336,8 +3397,8 @@ packages: cpu: [arm64] os: [linux] - '@next/swc-linux-arm64-musl@15.2.0-canary.12': - resolution: {integrity: sha512-vRqNP7Bv14+Kqu11/9+pgL2PDEzGYe9rC9VJx83JgrJbab/8FCdFS6PHiMjGJmYLKgjtNP0CK3lu+9CuFTp90w==} + '@next/swc-linux-arm64-musl@15.2.0-canary.13': + resolution: {integrity: sha512-IW1Fe8aG5TxTdJd4yw9ksfniNIJi1KkM+qKwsFJf44vATyfrm2lnVE/1dzzGAYP2Yuy1VDx39fMotrmRzYlCIA==} engines: {node: '>= 10'} cpu: [arm64] os: [linux] @@ -3348,8 +3409,8 @@ packages: cpu: [x64] os: [linux] - '@next/swc-linux-x64-gnu@15.2.0-canary.12': - resolution: {integrity: sha512-njFDHJBP5EymQVzuFQusM+IRne2197MO7+ObaRtPIaL38uaaK7sr9WDzBZkCQKP8uLuDefwPHqQPPS2U2WStfw==} + '@next/swc-linux-x64-gnu@15.2.0-canary.13': + resolution: {integrity: sha512-6GwUHndcKXT2zJBb7ighNxL4CUx7dN7/gzNJV1FJUqAMe2p3P542N74nDh4jRzjjRJBzak8ktXiB4kA7sY5huA==} engines: {node: '>= 10'} cpu: [x64] os: [linux] @@ -3360,8 +3421,8 @@ packages: cpu: [x64] os: [linux] - '@next/swc-linux-x64-musl@15.2.0-canary.12': - resolution: {integrity: sha512-C7cLHlf8FxHosAB7IWu5xMz/zMZCcH0q86tU8HCZNJu1wXLDZHla56mF5WeAqH8ohLO5fw2l0Nu2DKe3OGqm1A==} + '@next/swc-linux-x64-musl@15.2.0-canary.13': + resolution: {integrity: sha512-HQj18HE6jGcyJ+js/tUKUz2Pp5x+sXDsulPPmuBwJM5rnuEKOUFUP0Y8RrUDrntAUqnhfLIh510gkGikT1Sx8Q==} engines: {node: '>= 10'} cpu: [x64] os: [linux] @@ -3372,8 +3433,8 @@ packages: cpu: [arm64] os: [win32] - '@next/swc-win32-arm64-msvc@15.2.0-canary.12': - resolution: {integrity: sha512-cHwlngpGkO8io/unOURrclS4v3Yem1xZjntrs4G8StQ1AwHPr+XqDhH4k4QBk6P+ianL8yroIi7nK+By3sUe4w==} + '@next/swc-win32-arm64-msvc@15.2.0-canary.13': + resolution: {integrity: sha512-dnBdN8Qpf2d+nL8qh1EJIire66wkEpi3HWj7aZ/bYtRL/Yna3lo1vYGsnbiW5l+MYmjrdGY3wzpudo5Ys/tplw==} engines: {node: '>= 10'} cpu: [arm64] os: [win32] @@ -3384,8 +3445,8 @@ packages: cpu: [x64] os: [win32] - '@next/swc-win32-x64-msvc@15.2.0-canary.12': - resolution: {integrity: sha512-9SSJ5YhvN9JYdnsMKL8jojFcUqPgC7n4hhvqXOruZzt/SzmwgEyeIbxQQ/ICLJRz1LJCY/ytUNvLcbQkDqKQfA==} + '@next/swc-win32-x64-msvc@15.2.0-canary.13': + resolution: {integrity: sha512-nZnrOh3LVMPd0g7fgLCWe/8wifAB1kdpUOe2kyNUpMjjElTiXZg1hFqMrjocFKPtGg/wg5WBp+K75mLdKBZKyQ==} engines: {node: '>= 10'} cpu: [x64] os: [win32] @@ -7068,8 +7129,8 @@ packages: typescript: optional: true - eslint-config-next@15.2.0-canary.12: - resolution: {integrity: sha512-5i9WfAn3h8MoLIu3XZV8dB7fx//GAP6olK04GSo4YuCJH0bt1++wfQUeo8aVngtZxpO0JN1csgU9qPTFENmPFw==} + eslint-config-next@15.2.0-canary.13: + resolution: {integrity: sha512-NSt8qV7OBMvWvLzTeIX7nxnecZV0gn/HZqRvwH/7cmEuR6qebTZyzi1hUTcxzr+HFSJ68S+YVXRK3qqkGDXwnA==} peerDependencies: eslint: ^7.23.0 || ^8.0.0 || ^9.0.0 typescript: '>=3.3.1' @@ -7083,12 +7144,6 @@ packages: peerDependencies: eslint: '>=7.0.0' - eslint-config-prettier@9.1.0: - resolution: {integrity: sha512-NSWl5BFQWEPi1j4TjVNItzYV7dZXZ+wP6I6ZhrBGpChQhZRUaElihE9uRRkcbRnNb76UMKDF3r+WTmNcGPKsqw==} - hasBin: true - peerDependencies: - eslint: '>=7.0.0' - eslint-config-turbo@2.3.3: resolution: {integrity: sha512-cM9wSBYowQIrjx2MPCzFE6jTnG4vpTPJKZ/O+Ps3CqrmGK/wtNOsY6WHGMwLtKY/nNbgRahAJH6jGVF6k2coOg==} peerDependencies: @@ -9757,8 +9812,8 @@ packages: sass: optional: true - next@15.2.0-canary.12: - resolution: {integrity: sha512-pWl5u2pFPxvEFURX6dz3YIrEEJgRR/May2YvY4iwvLEmLGyYBwDOjy4A8SbWzvpDQXDsFSJGe+WQIOZ00/G8vQ==} + next@15.2.0-canary.13: + resolution: {integrity: sha512-4rCvCu20t0yAL5YULTOqZmaII+RN9jo1RqCU5M1zHGdHuQbxpAdtSWzxvsGn0Yhphn3TVDrin5ostV5ArbpR1w==} engines: {node: ^18.18.0 || ^19.8.0 || >= 20.0.0} hasBin: true peerDependencies: @@ -15361,7 +15416,7 @@ snapshots: - bufferutil - utf-8-validate - '@next/bundle-analyzer@15.2.0-canary.12': + '@next/bundle-analyzer@15.2.0-canary.13': dependencies: webpack-bundle-analyzer: 4.10.1 transitivePeerDependencies: @@ -15370,62 +15425,62 @@ snapshots: '@next/env@15.1.4': {} - '@next/env@15.2.0-canary.12': {} + '@next/env@15.2.0-canary.13': {} '@next/eslint-plugin-next@15.1.4': dependencies: fast-glob: 3.3.1 - '@next/eslint-plugin-next@15.2.0-canary.12': + '@next/eslint-plugin-next@15.2.0-canary.13': dependencies: fast-glob: 3.3.1 '@next/swc-darwin-arm64@15.1.4': optional: true - '@next/swc-darwin-arm64@15.2.0-canary.12': + '@next/swc-darwin-arm64@15.2.0-canary.13': optional: true '@next/swc-darwin-x64@15.1.4': optional: true - '@next/swc-darwin-x64@15.2.0-canary.12': + '@next/swc-darwin-x64@15.2.0-canary.13': optional: true '@next/swc-linux-arm64-gnu@15.1.4': optional: true - '@next/swc-linux-arm64-gnu@15.2.0-canary.12': + '@next/swc-linux-arm64-gnu@15.2.0-canary.13': optional: true '@next/swc-linux-arm64-musl@15.1.4': optional: true - '@next/swc-linux-arm64-musl@15.2.0-canary.12': + '@next/swc-linux-arm64-musl@15.2.0-canary.13': optional: true '@next/swc-linux-x64-gnu@15.1.4': optional: true - '@next/swc-linux-x64-gnu@15.2.0-canary.12': + '@next/swc-linux-x64-gnu@15.2.0-canary.13': optional: true '@next/swc-linux-x64-musl@15.1.4': optional: true - '@next/swc-linux-x64-musl@15.2.0-canary.12': + '@next/swc-linux-x64-musl@15.2.0-canary.13': optional: true '@next/swc-win32-arm64-msvc@15.1.4': optional: true - '@next/swc-win32-arm64-msvc@15.2.0-canary.12': + '@next/swc-win32-arm64-msvc@15.2.0-canary.13': optional: true '@next/swc-win32-x64-msvc@15.1.4': optional: true - '@next/swc-win32-x64-msvc@15.2.0-canary.12': + '@next/swc-win32-x64-msvc@15.2.0-canary.13': optional: true '@nicolo-ribaudo/eslint-scope-5-internals@5.1.1-v1': @@ -18666,10 +18721,10 @@ snapshots: react-dom: 19.0.0(react@19.0.0) ts-morph: 12.0.0 - '@vercel/speed-insights@1.1.0(@sveltejs/kit@2.15.3(@sveltejs/vite-plugin-svelte@3.1.2(svelte@4.2.19)(vite@6.0.7(@types/node@20.17.12)(jiti@2.4.2)(terser@5.37.0)(yaml@2.7.0)))(svelte@4.2.19)(vite@6.0.7(@types/node@20.17.12)(jiti@2.4.2)(terser@5.37.0)(yaml@2.7.0)))(next@15.2.0-canary.12(@babel/core@7.26.0)(babel-plugin-react-compiler@19.0.0-beta-e552027-20250112)(react-dom@19.0.0(react@19.0.0))(react@19.0.0))(react@19.0.0)(svelte@4.2.19)(vue-router@4.5.0(vue@3.5.13(typescript@5.7.3)))(vue@3.5.13(typescript@5.7.3))': + '@vercel/speed-insights@1.1.0(@sveltejs/kit@2.15.3(@sveltejs/vite-plugin-svelte@3.1.2(svelte@4.2.19)(vite@6.0.7(@types/node@20.17.12)(jiti@2.4.2)(terser@5.37.0)(yaml@2.7.0)))(svelte@4.2.19)(vite@6.0.7(@types/node@20.17.12)(jiti@2.4.2)(terser@5.37.0)(yaml@2.7.0)))(next@15.2.0-canary.13(@babel/core@7.26.0)(babel-plugin-react-compiler@19.0.0-beta-e552027-20250112)(react-dom@19.0.0(react@19.0.0))(react@19.0.0))(react@19.0.0)(svelte@4.2.19)(vue-router@4.5.0(vue@3.5.13(typescript@5.7.3)))(vue@3.5.13(typescript@5.7.3))': optionalDependencies: '@sveltejs/kit': 2.15.3(@sveltejs/vite-plugin-svelte@3.1.2(svelte@4.2.19)(vite@6.0.7(@types/node@20.17.12)(jiti@2.4.2)(terser@5.37.0)(yaml@2.7.0)))(svelte@4.2.19)(vite@6.0.7(@types/node@20.17.12)(jiti@2.4.2)(terser@5.37.0)(yaml@2.7.0)) - next: 15.2.0-canary.12(@babel/core@7.26.0)(babel-plugin-react-compiler@19.0.0-beta-e552027-20250112)(react-dom@19.0.0(react@19.0.0))(react@19.0.0) + next: 15.2.0-canary.13(@babel/core@7.26.0)(babel-plugin-react-compiler@19.0.0-beta-e552027-20250112)(react-dom@19.0.0(react@19.0.0))(react@19.0.0) react: 19.0.0 svelte: 4.2.19 vue: 3.5.13(typescript@5.7.3) @@ -20919,9 +20974,9 @@ snapshots: - eslint-plugin-import-x - supports-color - eslint-config-next@15.2.0-canary.12(eslint@8.57.1)(typescript@5.7.3): + eslint-config-next@15.2.0-canary.13(eslint@8.57.1)(typescript@5.7.3): dependencies: - '@next/eslint-plugin-next': 15.2.0-canary.12 + '@next/eslint-plugin-next': 15.2.0-canary.13 '@rushstack/eslint-patch': 1.10.5 '@typescript-eslint/eslint-plugin': 7.18.0(@typescript-eslint/parser@7.18.0(eslint@8.57.1)(typescript@5.7.3))(eslint@8.57.1)(typescript@5.7.3) '@typescript-eslint/parser': 7.18.0(eslint@8.57.1)(typescript@5.7.3) @@ -20943,10 +20998,6 @@ snapshots: dependencies: eslint: 8.57.1 - eslint-config-prettier@9.1.0(eslint@8.57.1): - dependencies: - eslint: 8.57.1 - eslint-config-turbo@2.3.3(eslint@8.57.1): dependencies: eslint: 8.57.1 @@ -24510,7 +24561,7 @@ snapshots: sanity: 3.70.0(@emotion/is-prop-valid@1.2.2)(@types/babel__core@7.20.5)(@types/node@22.10.6)(@types/react@19.0.7)(babel-plugin-react-compiler@19.0.0-beta-e552027-20250112)(react-dom@19.0.0(react@19.0.0))(react@19.0.0)(styled-components@6.1.14(react-dom@19.0.0(react@19.0.0))(react@19.0.0))(terser@5.37.0)(typescript@5.7.3) styled-components: 6.1.14(react-dom@19.0.0(react@19.0.0))(react@19.0.0) - next-sanity@9.8.37(@sanity/client@6.24.3)(@sanity/icons@3.5.7(react@19.0.0))(@sanity/types@3.70.0(@types/react@19.0.7))(@sanity/ui@2.11.2(@emotion/is-prop-valid@1.2.2)(react-dom@19.0.0(react@19.0.0))(react-is@19.0.0)(react@19.0.0)(styled-components@6.1.14(react-dom@19.0.0(react@19.0.0))(react@19.0.0)))(next@15.2.0-canary.12(@babel/core@7.26.0)(babel-plugin-react-compiler@19.0.0-beta-e552027-20250112)(react-dom@19.0.0(react@19.0.0))(react@19.0.0))(react@19.0.0)(sanity@3.70.0(@emotion/is-prop-valid@1.2.2)(@types/babel__core@7.20.5)(@types/node@20.17.12)(@types/react@19.0.7)(babel-plugin-react-compiler@19.0.0-beta-e552027-20250112)(react-dom@19.0.0(react@19.0.0))(react@19.0.0)(styled-components@6.1.14(react-dom@19.0.0(react@19.0.0))(react@19.0.0))(terser@5.37.0)(typescript@5.7.3))(styled-components@6.1.14(react-dom@19.0.0(react@19.0.0))(react@19.0.0)): + next-sanity@9.8.37(@sanity/client@6.24.3)(@sanity/icons@3.5.7(react@19.0.0))(@sanity/types@3.70.0(@types/react@19.0.7))(@sanity/ui@2.11.2(@emotion/is-prop-valid@1.2.2)(react-dom@19.0.0(react@19.0.0))(react-is@19.0.0)(react@19.0.0)(styled-components@6.1.14(react-dom@19.0.0(react@19.0.0))(react@19.0.0)))(next@15.2.0-canary.13(@babel/core@7.26.0)(babel-plugin-react-compiler@19.0.0-beta-e552027-20250112)(react-dom@19.0.0(react@19.0.0))(react@19.0.0))(react@19.0.0)(sanity@3.70.0(@emotion/is-prop-valid@1.2.2)(@types/babel__core@7.20.5)(@types/node@20.17.12)(@types/react@19.0.7)(babel-plugin-react-compiler@19.0.0-beta-e552027-20250112)(react-dom@19.0.0(react@19.0.0))(react@19.0.0)(styled-components@6.1.14(react-dom@19.0.0(react@19.0.0))(react@19.0.0))(terser@5.37.0)(typescript@5.7.3))(styled-components@6.1.14(react-dom@19.0.0(react@19.0.0))(react@19.0.0)): dependencies: '@portabletext/react': 3.2.0(react@19.0.0) '@sanity/client': 6.24.3(debug@4.4.0) @@ -24523,7 +24574,7 @@ snapshots: '@sanity/visual-editing': link:packages/visual-editing groq: 3.70.0 history: 5.3.0 - next: 15.2.0-canary.12(@babel/core@7.26.0)(babel-plugin-react-compiler@19.0.0-beta-e552027-20250112)(react-dom@19.0.0(react@19.0.0))(react@19.0.0) + next: 15.2.0-canary.13(@babel/core@7.26.0)(babel-plugin-react-compiler@19.0.0-beta-e552027-20250112)(react-dom@19.0.0(react@19.0.0))(react@19.0.0) react: 19.0.0 sanity: 3.70.0(@emotion/is-prop-valid@1.2.2)(@types/babel__core@7.20.5)(@types/node@20.17.12)(@types/react@19.0.7)(babel-plugin-react-compiler@19.0.0-beta-e552027-20250112)(react-dom@19.0.0(react@19.0.0))(react@19.0.0)(styled-components@6.1.14(react-dom@19.0.0(react@19.0.0))(react@19.0.0))(terser@5.37.0)(typescript@5.7.3) styled-components: 6.1.14(react-dom@19.0.0(react@19.0.0))(react@19.0.0) @@ -24554,9 +24605,9 @@ snapshots: - '@babel/core' - babel-plugin-macros - next@15.2.0-canary.12(@babel/core@7.26.0)(babel-plugin-react-compiler@19.0.0-beta-e552027-20250112)(react-dom@19.0.0(react@19.0.0))(react@19.0.0): + next@15.2.0-canary.13(@babel/core@7.26.0)(babel-plugin-react-compiler@19.0.0-beta-e552027-20250112)(react-dom@19.0.0(react@19.0.0))(react@19.0.0): dependencies: - '@next/env': 15.2.0-canary.12 + '@next/env': 15.2.0-canary.13 '@swc/counter': 0.1.3 '@swc/helpers': 0.5.15 busboy: 1.6.0 @@ -24566,14 +24617,14 @@ snapshots: react-dom: 19.0.0(react@19.0.0) styled-jsx: 5.1.6(@babel/core@7.26.0)(react@19.0.0) optionalDependencies: - '@next/swc-darwin-arm64': 15.2.0-canary.12 - '@next/swc-darwin-x64': 15.2.0-canary.12 - '@next/swc-linux-arm64-gnu': 15.2.0-canary.12 - '@next/swc-linux-arm64-musl': 15.2.0-canary.12 - '@next/swc-linux-x64-gnu': 15.2.0-canary.12 - '@next/swc-linux-x64-musl': 15.2.0-canary.12 - '@next/swc-win32-arm64-msvc': 15.2.0-canary.12 - '@next/swc-win32-x64-msvc': 15.2.0-canary.12 + '@next/swc-darwin-arm64': 15.2.0-canary.13 + '@next/swc-darwin-x64': 15.2.0-canary.13 + '@next/swc-linux-arm64-gnu': 15.2.0-canary.13 + '@next/swc-linux-arm64-musl': 15.2.0-canary.13 + '@next/swc-linux-x64-gnu': 15.2.0-canary.13 + '@next/swc-linux-x64-musl': 15.2.0-canary.13 + '@next/swc-win32-arm64-msvc': 15.2.0-canary.13 + '@next/swc-win32-x64-msvc': 15.2.0-canary.13 babel-plugin-react-compiler: 19.0.0-beta-e552027-20250112 sharp: 0.33.5 transitivePeerDependencies: diff --git a/release-please-config.json b/release-please-config.json index 253b96fee..62bc94fca 100644 --- a/release-please-config.json +++ b/release-please-config.json @@ -7,14 +7,14 @@ "packages/insert-menu": {}, "packages/next-loader": {}, "packages/presentation": {}, + "packages/presentation-comlink": {}, "packages/preview-kit-compat": {}, "packages/preview-url-secret": {}, "packages/react-loader": {}, "packages/svelte-loader": {}, "packages/vercel-protection-bypass": {}, "packages/visual-editing": {}, - "packages/visual-editing-helpers": { - "bump-minor-pre-major": true - } + "packages/visual-editing-csm": {}, + "packages/visual-editing-types": {} } } diff --git a/turbo.json b/turbo.json index 1c026dfd3..f3a89d917 100644 --- a/turbo.json +++ b/turbo.json @@ -5,7 +5,7 @@ "tasks": { "build": { "outputs": [".svelte-kit/**", "dist/**", "dist-svelte/**"], - "dependsOn": ["@sanity/insert-menu#build", "^build"] + "dependsOn": ["^build"] }, "test": { "dependsOn": ["^build"], diff --git a/vitest.workspace.js b/vitest.workspace.js index f7d13e6e5..883487106 100644 --- a/vitest.workspace.js +++ b/vitest.workspace.js @@ -2,11 +2,12 @@ import {defineWorkspace} from 'vitest/config' export default defineWorkspace([ './packages/presentation/vitest.config.ts', + './packages/presentation-comlink/vitest.config.ts', './packages/preview-url-secret/vitest.config.ts', './packages/react-loader/vitest.config.ts', './packages/preview-kit-compat/vitest.config.ts', './packages/visual-editing/vitest.config.ts', './packages/core-loader/vitest.config.ts', './packages/svelte-loader/vitest.config.ts', - './packages/visual-editing-helpers/vitest.config.ts', + './packages/visual-editing-csm/vitest.config.ts', ])