@sanity/ui 3.0.0-static.41 → 3.0.0-static.43
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/dist/css/index.cjs +51 -45
- package/dist/css/index.cjs.map +1 -1
- package/dist/css/index.css +1 -1
- package/dist/css/index.d.cts +16 -1
- package/dist/css/index.d.ts +16 -1
- package/dist/css/index.js +50 -45
- package/dist/css/index.js.map +1 -1
- package/dist/index.cjs +2431 -264
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +2302 -132
- package/dist/index.js.map +1 -1
- package/package.json +1 -10
- package/src/css/getVarName.ts +27 -0
- package/src/css/index.ts +15 -12
- package/src/css/types.ts +4 -1
- package/dist/_chunks-cjs/_visual-editing.cjs +0 -2250
- package/dist/_chunks-cjs/_visual-editing.cjs.map +0 -1
- package/dist/_chunks-es/_visual-editing.js +0 -2261
- package/dist/_chunks-es/_visual-editing.js.map +0 -1
- package/dist/_visual-editing.cjs +0 -28
- package/dist/_visual-editing.cjs.map +0 -1
- package/dist/_visual-editing.d.cts +0 -853
- package/dist/_visual-editing.d.ts +0 -853
- package/dist/_visual-editing.js +0 -28
- package/dist/_visual-editing.js.map +0 -1
- package/exports/_visual-editing.ts +0 -28
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sanity/ui",
|
|
3
|
-
"version": "3.0.0-static.
|
|
3
|
+
"version": "3.0.0-static.43",
|
|
4
4
|
"keywords": [
|
|
5
5
|
"react",
|
|
6
6
|
"ui",
|
|
@@ -29,12 +29,6 @@
|
|
|
29
29
|
"require": "./dist/index.cjs",
|
|
30
30
|
"default": "./dist/index.js"
|
|
31
31
|
},
|
|
32
|
-
"./_visual-editing": {
|
|
33
|
-
"source": "./exports/_visual-editing.ts",
|
|
34
|
-
"import": "./dist/_visual-editing.js",
|
|
35
|
-
"require": "./dist/_visual-editing.cjs",
|
|
36
|
-
"default": "./dist/_visual-editing.js"
|
|
37
|
-
},
|
|
38
32
|
"./css": {
|
|
39
33
|
"source": "./exports/css.ts",
|
|
40
34
|
"import": "./dist/css/index.js",
|
|
@@ -55,9 +49,6 @@
|
|
|
55
49
|
"types": "./dist/index.d.ts",
|
|
56
50
|
"typesVersions": {
|
|
57
51
|
"*": {
|
|
58
|
-
"_visual-editing": [
|
|
59
|
-
"./dist/_visual-editing.d.ts"
|
|
60
|
-
],
|
|
61
52
|
"css": [
|
|
62
53
|
"./dist/css.d.ts"
|
|
63
54
|
],
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type {CSSVarFunction, CSSVarName} from './types'
|
|
2
|
+
|
|
3
|
+
const RE_CSS_VAR = /^var\((.*)\)$/
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Extract the name of a CSS variable.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```ts
|
|
10
|
+
* getVarName('var(--color-primary)') // '--color-primary'
|
|
11
|
+
* ```
|
|
12
|
+
*
|
|
13
|
+
* @public
|
|
14
|
+
*/
|
|
15
|
+
export function getVarName(variable: CSSVarFunction): CSSVarName {
|
|
16
|
+
const matches = variable.match(RE_CSS_VAR)
|
|
17
|
+
|
|
18
|
+
if (matches) {
|
|
19
|
+
return matches[1] as CSSVarName
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
// NOTE: This code path should not occur when using TypeScript,
|
|
23
|
+
// and is a potential source of bugs.
|
|
24
|
+
|
|
25
|
+
// If the variable is not a CSS variable, return it as is.
|
|
26
|
+
return variable as CSSVarName
|
|
27
|
+
}
|
package/src/css/index.ts
CHANGED
|
@@ -1,13 +1,19 @@
|
|
|
1
|
-
|
|
1
|
+
// NOTE: Order is important, as it affects the order of compiled CSS.
|
|
2
2
|
|
|
3
|
+
// API
|
|
4
|
+
export * from './constants'
|
|
5
|
+
export * from './getVarName'
|
|
6
|
+
export * from './theme/buildCSSTheme'
|
|
7
|
+
export * from './types'
|
|
8
|
+
|
|
9
|
+
// CSS: variables
|
|
3
10
|
export * from './layers.css'
|
|
4
11
|
export * from './vars.css'
|
|
5
12
|
|
|
6
|
-
// theme
|
|
7
|
-
export * from './theme/buildCSSTheme'
|
|
13
|
+
// CSS: theme
|
|
8
14
|
export * from './theme/defaultTheme.css'
|
|
9
15
|
|
|
10
|
-
// props
|
|
16
|
+
// CSS: props
|
|
11
17
|
export * from './props/alignItems/alignItems'
|
|
12
18
|
export * from './props/alignItems/types'
|
|
13
19
|
export * from './props/border/border'
|
|
@@ -80,15 +86,13 @@ export * from './props/textAlign/textAlign'
|
|
|
80
86
|
export * from './props/textAlign/types'
|
|
81
87
|
export * from './props/textOverflow/textOverflow'
|
|
82
88
|
export * from './props/textOverflow/types'
|
|
83
|
-
export * from './props/width/width'
|
|
84
89
|
export * from './props/width/types'
|
|
90
|
+
export * from './props/width/width'
|
|
85
91
|
|
|
86
|
-
// primitives
|
|
92
|
+
// CSS:primitives
|
|
87
93
|
export * from './primitives/_arrow/_arrow'
|
|
88
94
|
export * from './primitives/_input/input'
|
|
89
95
|
export * from './primitives/_input/types'
|
|
90
|
-
export * from './primitives/selectable/selectable'
|
|
91
|
-
export * from './primitives/selectable/types'
|
|
92
96
|
export * from './primitives/avatar/avatar'
|
|
93
97
|
export * from './primitives/avatar/types'
|
|
94
98
|
export * from './primitives/badge/badge'
|
|
@@ -116,6 +120,8 @@ export * from './primitives/root/root'
|
|
|
116
120
|
export * from './primitives/root/types'
|
|
117
121
|
export * from './primitives/select/select'
|
|
118
122
|
export * from './primitives/select/types'
|
|
123
|
+
export * from './primitives/selectable/selectable'
|
|
124
|
+
export * from './primitives/selectable/types'
|
|
119
125
|
export * from './primitives/spinner/spinner'
|
|
120
126
|
export * from './primitives/spinner/types'
|
|
121
127
|
export * from './primitives/srOnly/srOnly'
|
|
@@ -130,7 +136,7 @@ export * from './primitives/textInput/types'
|
|
|
130
136
|
export * from './primitives/tooltip/tooltip'
|
|
131
137
|
export * from './primitives/tooltip/types'
|
|
132
138
|
|
|
133
|
-
// components
|
|
139
|
+
// CSS: components
|
|
134
140
|
export * from './components/breadcrumbs/breadcrumbs'
|
|
135
141
|
export * from './components/dialog/dialog'
|
|
136
142
|
export * from './components/menu/menu'
|
|
@@ -138,6 +144,3 @@ export * from './components/skeleton/skeleton'
|
|
|
138
144
|
export * from './components/skeleton/types'
|
|
139
145
|
export * from './components/toast/toast'
|
|
140
146
|
export * from './components/tree/tree'
|
|
141
|
-
|
|
142
|
-
export * from './constants'
|
|
143
|
-
export * from './types'
|
package/src/css/types.ts
CHANGED
|
@@ -33,7 +33,10 @@ export type ResponsiveRules = Record<Breakpoint, string>
|
|
|
33
33
|
export type ResponsiveRuleOptions<K extends string | number> = Record<K, ResponsiveRules>
|
|
34
34
|
|
|
35
35
|
/** @public */
|
|
36
|
-
export type
|
|
36
|
+
export type CSSVarName = `--${string}`
|
|
37
|
+
|
|
38
|
+
/** @public */
|
|
39
|
+
export type CSSVarFunction = `var(${CSSVarName})`
|
|
37
40
|
|
|
38
41
|
/** @public */
|
|
39
42
|
export type ElementColorTokens = {
|