@sanity/ui 2.1.3-canary.0 → 2.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sanity/ui",
3
- "version": "2.1.3-canary.0",
3
+ "version": "2.1.3",
4
4
  "keywords": [
5
5
  "sanity",
6
6
  "ui",
@@ -51,6 +51,32 @@
51
51
  "src",
52
52
  "theme.js"
53
53
  ],
54
+ "scripts": {
55
+ "build": "run-s clean pkg:build pkg:check figma:pkg:build",
56
+ "clean": "rimraf .workshop dist",
57
+ "commit": "cz",
58
+ "cypress:dev": "run-p dev cypress:open",
59
+ "cypress:open": "cypress open",
60
+ "cypress:run": "cypress run",
61
+ "dev": "run-p storybook:dev workshop:dev",
62
+ "figma:pkg:build": "cd figma && pnpm build",
63
+ "format": "prettier --write --cache --ignore-unknown .",
64
+ "lint": "eslint . --ext .cjs,.js,.jsx,.mjs,.ts,.tsx --quiet",
65
+ "pkg:build": "pkg build --strict",
66
+ "pkg:check": "pkg --strict",
67
+ "prepare": "husky install",
68
+ "prepublishOnly": "pnpm build",
69
+ "release": "semantic-release",
70
+ "storybook:build": "storybook build",
71
+ "storybook:dev": "storybook dev -p 6006",
72
+ "test": "jest",
73
+ "test:browser": "start-server-and-test 'run-s workshop:build workshop:start' http://localhost:1337 'run-s cypress:run'",
74
+ "ts:check": "tsc",
75
+ "watch": "pkg watch --strict",
76
+ "workshop:build": "workshop build",
77
+ "workshop:dev": "workshop dev",
78
+ "workshop:start": "http-server -a localhost -c-0 -p 1337 -s -P http://localhost:1337/index.html? dist"
79
+ },
54
80
  "commitlint": {
55
81
  "extends": [
56
82
  "@commitlint/config-conventional"
@@ -93,7 +119,7 @@
93
119
  "@commitlint/cli": "^19.2.1",
94
120
  "@commitlint/config-conventional": "^19.1.0",
95
121
  "@juggle/resize-observer": "^3.4.0",
96
- "@sanity/pkg-utils": "^6.4.1",
122
+ "@sanity/pkg-utils": "^6.6.1",
97
123
  "@sanity/semantic-release-preset": "^4.1.7",
98
124
  "@sanity/ui-workshop": "^2.0.12",
99
125
  "@storybook/addon-a11y": "^8.0.7",
@@ -175,29 +201,5 @@
175
201
  },
176
202
  "esm.sh": {
177
203
  "bundle": false
178
- },
179
- "scripts": {
180
- "build": "run-s clean pkg:build pkg:check figma:pkg:build",
181
- "clean": "rimraf .workshop dist",
182
- "commit": "cz",
183
- "cypress:dev": "run-p dev cypress:open",
184
- "cypress:open": "cypress open",
185
- "cypress:run": "cypress run",
186
- "dev": "run-p storybook:dev workshop:dev",
187
- "figma:pkg:build": "cd figma && pnpm build",
188
- "format": "prettier --write --cache --ignore-unknown .",
189
- "lint": "eslint . --ext .cjs,.js,.jsx,.mjs,.ts,.tsx --quiet",
190
- "pkg:build": "pkg build --strict",
191
- "pkg:check": "pkg --strict",
192
- "release": "semantic-release",
193
- "storybook:build": "storybook build",
194
- "storybook:dev": "storybook dev -p 6006",
195
- "test": "jest",
196
- "test:browser": "start-server-and-test 'run-s workshop:build workshop:start' http://localhost:1337 'run-s cypress:run'",
197
- "ts:check": "tsc",
198
- "watch": "pkg watch --strict",
199
- "workshop:build": "workshop build",
200
- "workshop:dev": "workshop dev",
201
- "workshop:start": "http-server -a localhost -c-0 -p 1337 -s -P http://localhost:1337/index.html? dist"
202
204
  }
203
- }
205
+ }
@@ -1,5 +1,4 @@
1
- import {createContext} from 'react'
2
- import {globalScope} from '../../lib/globalScope'
1
+ import {createGlobalScopedContext} from '../../lib/createGlobalScopedContext'
3
2
 
4
3
  export interface MenuContextValue {
5
4
  version: 0.0
@@ -26,6 +25,4 @@ export interface MenuContextValue {
26
25
 
27
26
  const key = Symbol.for('@sanity/ui/context/menu')
28
27
 
29
- globalScope[key] = globalScope[key] || createContext<MenuContextValue | null>(null)
30
-
31
- export const MenuContext: React.Context<MenuContextValue | null> = globalScope[key]
28
+ export const MenuContext = createGlobalScopedContext<MenuContextValue | null>(key, null)
@@ -1,9 +1,6 @@
1
- import {createContext} from 'react'
2
- import {globalScope} from '../../lib/globalScope'
1
+ import {createGlobalScopedContext} from '../../lib/createGlobalScopedContext'
3
2
  import {ToastContextValue} from './types'
4
3
 
5
4
  const key = Symbol.for('@sanity/ui/context/toast')
6
5
 
7
- globalScope[key] = globalScope[key] || createContext<ToastContextValue | null>(null)
8
-
9
- export const ToastContext: React.Context<ToastContextValue | null> = globalScope[key]
6
+ export const ToastContext = createGlobalScopedContext<ToastContextValue | null>(key, null)
@@ -1,12 +1,9 @@
1
- import {createContext} from 'react'
2
- import {globalScope} from '../../lib/globalScope'
1
+ import {createGlobalScopedContext} from '../../lib/createGlobalScopedContext'
3
2
  import {TreeContextValue} from './types'
4
3
 
5
4
  const key = Symbol.for('@sanity/ui/context/tree')
6
5
 
7
- globalScope[key] = globalScope[key] || createContext<TreeContextValue | null>(null)
8
-
9
6
  /**
10
7
  * @internal
11
8
  */
12
- export const TreeContext: React.Context<TreeContextValue | null> = globalScope[key]
9
+ export const TreeContext = createGlobalScopedContext<TreeContextValue | null>(key, null)
@@ -1,13 +1,10 @@
1
- import {createContext} from 'react'
2
- import {globalScope} from '../../../lib/globalScope'
1
+ import {createGlobalScopedContext} from '../../../lib/createGlobalScopedContext'
3
2
  import {TooltipDelayGroupContextValue} from './types'
4
3
 
5
4
  const key = Symbol.for('@sanity/ui/context/tooltipDelayGroup')
6
5
 
7
- globalScope[key] = globalScope[key] || createContext<TooltipDelayGroupContextValue | null>(null)
8
-
9
6
  /**
10
7
  * @beta
11
8
  */
12
- export const TooltipDelayGroupContext: React.Context<TooltipDelayGroupContextValue | null> =
13
- globalScope[key]
9
+ export const TooltipDelayGroupContext =
10
+ createGlobalScopedContext<TooltipDelayGroupContextValue | null>(key, null)
@@ -1,10 +1,9 @@
1
- import {createContext} from 'react'
2
- import {globalScope} from '../../lib/globalScope'
1
+ import {createGlobalScopedContext} from '../../lib/createGlobalScopedContext'
3
2
  import {BoundaryElementContextValue} from './types'
4
3
 
5
4
  const key = Symbol.for('@sanity/ui/context/boundaryElement')
6
5
 
7
- globalScope[key] = globalScope[key] || createContext<BoundaryElementContextValue | null>(null)
8
-
9
- export const BoundaryElementContext: React.Context<BoundaryElementContextValue | null> =
10
- globalScope[key]
6
+ export const BoundaryElementContext = createGlobalScopedContext<BoundaryElementContextValue | null>(
7
+ key,
8
+ null,
9
+ )
@@ -1,9 +1,6 @@
1
- import {Context, createContext} from 'react'
2
- import {globalScope} from '../../lib/globalScope'
1
+ import {createGlobalScopedContext} from '../../lib/createGlobalScopedContext'
3
2
  import {LayerContextValue} from './types'
4
3
 
5
4
  const key = Symbol.for('@sanity/ui/context/layer')
6
5
 
7
- globalScope[key] = globalScope[key] || createContext<LayerContextValue | null>(null)
8
-
9
- export const LayerContext: Context<LayerContextValue | null> = globalScope[key]
6
+ export const LayerContext = createGlobalScopedContext<LayerContextValue | null>(key, null)
@@ -1,4 +1,4 @@
1
- import {createContext} from 'react'
1
+ import {createGlobalScopedContext} from '../../lib/createGlobalScopedContext'
2
2
  import {globalScope} from '../../lib/globalScope'
3
3
  import {PortalContextValue} from './types'
4
4
 
@@ -28,6 +28,4 @@ export const defaultContextValue: PortalContextValue = {
28
28
  },
29
29
  }
30
30
 
31
- globalScope[key] = globalScope[key] || createContext<PortalContextValue>(defaultContextValue)
32
-
33
- export const PortalContext: React.Context<PortalContextValue> = globalScope[key]
31
+ export const PortalContext = createGlobalScopedContext<PortalContextValue>(key, defaultContextValue)