@sanity/ui 3.0.0-static.11 → 3.0.0-static.13
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/_chunks-cjs/_visual-editing.js +1293 -1215
- package/dist/_chunks-cjs/_visual-editing.js.map +1 -1
- package/dist/_chunks-cjs/buildCommand.js +28 -10
- package/dist/_chunks-cjs/buildCommand.js.map +1 -1
- package/dist/_chunks-es/_visual-editing.mjs +1284 -1202
- package/dist/_chunks-es/_visual-editing.mjs.map +1 -1
- package/dist/_visual-editing.d.mts +528 -358
- package/dist/_visual-editing.d.ts +528 -358
- package/dist/cli.js +1 -1
- package/dist/css.d.mts +143 -73
- package/dist/css.d.ts +143 -73
- package/dist/css.js +329 -472
- package/dist/css.js.map +1 -1
- package/dist/css.mjs +330 -473
- package/dist/css.mjs.map +1 -1
- package/dist/index.d.mts +1362 -869
- package/dist/index.d.ts +1362 -869
- package/dist/index.js +383 -308
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +387 -312
- package/dist/index.mjs.map +1 -1
- package/dist/sanity-palette.css +105 -1
- package/dist/sanity-palette.min.css +1 -0
- package/dist/sanity-theme.css +4571 -1
- package/dist/sanity-theme.min.css +1 -0
- package/dist/system.css +22053 -21946
- package/dist/system.min.css +1 -0
- package/dist/theme.d.mts +51 -106
- package/dist/theme.d.ts +51 -106
- package/dist/theme.js +9 -9
- package/dist/theme.js.map +1 -1
- package/dist/theme.mjs +9 -9
- package/dist/theme.mjs.map +1 -1
- package/package.json +10 -5
- package/src/cli/buildCommand.ts +46 -19
- package/src/css/_comp.ts +2 -2
- package/src/css/{compile/compileStyle.ts → _compileStyle.ts} +7 -7
- package/src/css/{system.style.ts → _system.style.ts} +3 -2
- package/src/css/aspects/display/display.ts +1 -0
- package/src/css/aspects/display/types.ts +2 -3
- package/src/css/aspects/flex/types.ts +4 -12
- package/src/css/aspects/flexItem/types.ts +1 -3
- package/src/css/aspects/font/types.ts +1 -3
- package/src/css/aspects/grid/grid.ts +1 -0
- package/src/css/aspects/grid/types.ts +5 -9
- package/src/css/aspects/gridItem/gridItem.ts +1 -1
- package/src/css/aspects/gridItem/types.ts +7 -18
- package/src/css/aspects/height/height.ts +3 -4
- package/src/css/aspects/inset/inset.ts +1 -0
- package/src/css/aspects/margin/margin.ts +1 -0
- package/src/css/aspects/margin/types.ts +1 -0
- package/src/css/aspects/maxWidth/maxWidth.ts +1 -0
- package/src/css/aspects/maxWidth/types.ts +1 -0
- package/src/css/aspects/minWidth/minWidth.ts +1 -0
- package/src/css/aspects/minWidth/types.ts +2 -0
- package/src/css/aspects/overflow/overflow.ts +1 -0
- package/src/css/aspects/padding/padding.ts +1 -0
- package/src/css/aspects/pointerEvents/pointerEvents.ts +1 -0
- package/src/css/aspects/position/position.ts +1 -0
- package/src/css/aspects/shadow/shadow.ts +1 -0
- package/src/css/aspects/textOverflow/textOverflow.ts +1 -0
- package/src/css/aspects/textOverflow/types.ts +1 -0
- package/src/css/aspects/width/types.ts +2 -0
- package/src/css/aspects/width/width.ts +1 -0
- package/src/css/{compile/compilePalette.ts → compilePalette.ts} +14 -10
- package/src/css/compileSystem.ts +7 -0
- package/src/css/{compile/compileTheme.ts → compileTheme.ts} +1 -0
- package/src/css/{compile/compileTheme_v3.ts → compileTheme_v3.ts} +123 -104
- package/src/css/components/breadcrumbs/breadcrumbs.ts +1 -0
- package/src/css/components/dialog/dialog.ts +7 -0
- package/src/css/components/menu/menu.ts +2 -0
- package/src/css/components/skeleton/skeleton.ts +4 -0
- package/src/css/components/skeleton/types.ts +4 -0
- package/src/css/components/toast/toast.ts +5 -0
- package/src/css/components/tree/tree.ts +1 -0
- package/src/css/composeClassNames.ts +4 -2
- package/src/css/constants.ts +2 -0
- package/src/css/index.ts +3 -3
- package/src/css/primitives/_arrow/_arrow.ts +3 -0
- package/src/css/primitives/_input/input.ts +2 -0
- package/src/css/primitives/_selectable/_selectable.style.ts +1 -2
- package/src/css/primitives/_selectable/selectable.ts +1 -2
- package/src/css/primitives/avatar/avatar.style.ts +5 -8
- package/src/css/primitives/avatar/avatar.ts +6 -0
- package/src/css/primitives/avatar/types.ts +1 -0
- package/src/css/primitives/box/types.ts +1 -3
- package/src/css/primitives/button/button.ts +4 -21
- package/src/css/primitives/button/index.ts +1 -0
- package/src/css/primitives/button/types.ts +18 -0
- package/src/css/primitives/card/card.style.ts +3 -6
- package/src/css/primitives/card/card.ts +2 -2
- package/src/css/primitives/card/types.ts +2 -2
- package/src/css/primitives/checkbox/checkbox.ts +2 -0
- package/src/css/primitives/container/container.ts +1 -0
- package/src/css/primitives/container/types.ts +1 -0
- package/src/css/primitives/kbd/kbd.ts +1 -0
- package/src/css/primitives/label/types.ts +7 -2
- package/src/css/primitives/popover/popover.ts +2 -0
- package/src/css/primitives/radio/radio.ts +1 -0
- package/src/css/primitives/select/select.ts +2 -0
- package/src/css/primitives/spinner/spinner.ts +2 -0
- package/src/css/primitives/switch/switch.ts +5 -0
- package/src/css/primitives/text/types.ts +4 -0
- package/src/css/primitives/textArea/textArea.ts +1 -0
- package/src/css/primitives/textInput/textInput.ts +1 -0
- package/src/css/primitives/tooltip/tooltip.ts +2 -0
- package/src/css/scopeClassName.ts +1 -0
- package/src/css/types.ts +9 -12
- package/src/css/util.ts +5 -0
- package/src/css/utils/srOnly/srOnly.ts +3 -1
- package/src/css/varNames.ts +131 -141
- package/src/css/vars.ts +1 -6
- package/src/theme/palette/constants.ts +2 -0
- package/src/theme/palette/types.ts +3 -0
- package/src/theme/types.ts +2 -6
- package/src/theme/v0/focusRing.ts +1 -3
- package/src/theme/v0/font.ts +6 -18
- package/src/theme/v0/layer.ts +1 -3
- package/src/theme/v0/shadow.ts +2 -6
- package/src/theme/v2/avatar.ts +1 -3
- package/src/theme/v2/color/_system.ts +1 -3
- package/src/theme/v2/color/avatar.ts +2 -6
- package/src/theme/v2/color/badge.ts +2 -6
- package/src/theme/v2/color/button.ts +3 -9
- package/src/theme/v2/color/color.ts +3 -9
- package/src/theme/v2/color/input.ts +3 -9
- package/src/theme/v2/color/kbd.ts +1 -3
- package/src/theme/v2/color/selectable.ts +2 -6
- package/src/theme/v2/color/state.ts +1 -3
- package/src/theme/v2/color/syntax.ts +1 -3
- package/src/theme/v2/input.ts +1 -3
- package/src/theme/v2/theme.ts +2 -6
- package/src/theme/v3/buildTheme_v3.ts +1 -0
- package/src/theme/v3/color/color.ts +6 -4
- package/src/theme/v3/color/renderColor.ts +4 -1
- package/src/theme/v3/defaultTokens.ts +1 -0
- package/src/theme/v3/resolveTokens.ts +9 -9
- package/src/ui/RootClassNames.tsx +3 -0
- package/src/ui/StyleTags.tsx +3 -1
- package/src/ui/_compat/theme/themeColorProvider.tsx +2 -6
- package/src/ui/_compat/theme/themeProvider.tsx +2 -6
- package/src/ui/_compat/theme/types.ts +1 -3
- package/src/ui/_compat/theme/useRootTheme.ts +1 -3
- package/src/ui/_compat/theme/useTheme.ts +2 -6
- package/src/ui/components/autocomplete/__workshop__/constrainedHeight.tsx +2 -2
- package/src/ui/components/autocomplete/autocomplete.tsx +86 -114
- package/src/ui/components/autocomplete/autocompleteOption.tsx +2 -0
- package/src/ui/components/autocomplete/types.ts +3 -8
- package/src/ui/components/breadcrumbs/breadcrumbs.tsx +27 -21
- package/src/ui/components/dialog/dialog.tsx +89 -291
- package/src/ui/components/dialog/dialogCard.tsx +183 -0
- package/src/ui/components/dialog/isTargetWithinScope.ts +14 -0
- package/src/ui/components/hotkeys/hotkeys.tsx +33 -15
- package/src/ui/components/menu/__workshop__/asComponent.tsx +6 -6
- package/src/ui/components/menu/menu.tsx +27 -33
- package/src/ui/components/menu/menuButton.tsx +10 -14
- package/src/ui/components/menu/menuDivider.tsx +25 -13
- package/src/ui/components/menu/menuGroup.tsx +34 -26
- package/src/ui/components/menu/menuItem.tsx +51 -40
- package/src/ui/components/skeleton/codeSkeleton.tsx +53 -0
- package/src/ui/components/skeleton/headingSkeleton.tsx +52 -0
- package/src/ui/components/skeleton/index.ts +3 -0
- package/src/ui/components/skeleton/labelSkeleton.tsx +51 -0
- package/src/ui/components/skeleton/skeleton.tsx +39 -16
- package/src/ui/components/skeleton/textSkeleton.tsx +31 -110
- package/src/ui/components/tab/tab.tsx +23 -19
- package/src/ui/components/tab/tabList.tsx +34 -33
- package/src/ui/components/tab/tabPanel.tsx +25 -19
- package/src/ui/components/toast/toast.tsx +21 -16
- package/src/ui/components/toast/toastLayer.tsx +28 -10
- package/src/ui/components/toast/toastProvider.tsx +2 -6
- package/src/ui/components/toast/types.ts +2 -6
- package/src/ui/components/toast/useToast.ts +1 -3
- package/src/ui/components/tree/tree.tsx +194 -187
- package/src/ui/components/tree/treeGroup.tsx +25 -5
- package/src/ui/components/tree/treeItem.tsx +35 -23
- package/src/ui/hooks/useClickOutside.ts +2 -6
- package/src/ui/hooks/useClickOutsideEvent.ts +3 -9
- package/src/ui/primitives/_selectable/selectable.tsx +33 -20
- package/src/ui/primitives/avatar/avatar.tsx +28 -31
- package/src/ui/primitives/avatar/avatarCounter.tsx +33 -25
- package/src/ui/primitives/avatar/avatarStack.tsx +31 -24
- package/src/ui/primitives/avatar/types.ts +2 -0
- package/src/ui/primitives/badge/__workshop__/props.tsx +1 -9
- package/src/ui/primitives/badge/__workshop__/tones.tsx +1 -6
- package/src/ui/primitives/badge/badge.tsx +33 -32
- package/src/ui/primitives/badge/types.ts +2 -1
- package/src/ui/primitives/box/box.tsx +59 -29
- package/src/ui/primitives/button/__workshop__/sanityUploadButton.tsx +3 -3
- package/src/ui/primitives/button/__workshop__/uploadButton.tsx +2 -1
- package/src/ui/primitives/button/button.test.tsx +1 -15
- package/src/ui/primitives/button/button.tsx +64 -70
- package/src/ui/primitives/card/__workshop__/asComponent.tsx +3 -3
- package/src/ui/primitives/card/card.tsx +22 -22
- package/src/ui/primitives/card/cardProvider.tsx +2 -0
- package/src/ui/primitives/checkbox/checkbox.tsx +26 -15
- package/src/ui/primitives/code/code.tsx +24 -22
- package/src/ui/primitives/container/container.tsx +26 -15
- package/src/ui/primitives/flex/flex.tsx +21 -19
- package/src/ui/primitives/grid/grid.tsx +21 -16
- package/src/ui/primitives/heading/heading.tsx +42 -19
- package/src/ui/primitives/inline/inline.tsx +26 -23
- package/src/ui/primitives/kbd/kbd.tsx +25 -23
- package/src/ui/primitives/label/label.tsx +41 -26
- package/src/ui/primitives/popover/popover.tsx +281 -277
- package/src/ui/primitives/popover/popoverCard.tsx +119 -118
- package/src/ui/primitives/radio/radio.tsx +30 -14
- package/src/ui/primitives/select/select.tsx +24 -16
- package/src/ui/primitives/spinner/animatedSpinnerIcon.tsx +4 -2
- package/src/ui/primitives/spinner/spinner.tsx +24 -12
- package/src/ui/primitives/stack/stack.tsx +27 -18
- package/src/ui/primitives/switch/switch.tsx +31 -14
- package/src/ui/primitives/text/text.tsx +42 -24
- package/src/ui/primitives/textArea/textArea.tsx +33 -18
- package/src/ui/primitives/textInput/textInput.tsx +28 -40
- package/src/ui/primitives/tooltip/constants.ts +1 -1
- package/src/ui/primitives/tooltip/tooltip.tsx +76 -59
- package/src/ui/primitives/tooltip/tooltipCard.tsx +89 -82
- package/src/ui/primitives/types.ts +1 -3
- package/src/ui/types/avatar.ts +3 -6
- package/src/ui/types/badge.ts +1 -3
- package/src/ui/types/button.ts +1 -3
- package/src/ui/types/card.ts +1 -3
- package/src/ui/types/dialog.ts +1 -3
- package/src/ui/types/props.ts +20 -10
- package/src/ui/utils/arrow/arrow.tsx +40 -14
- package/src/ui/utils/boundaryElement/boundaryElementProvider.tsx +2 -6
- package/src/ui/utils/boundaryElement/types.ts +1 -3
- package/src/ui/utils/boundaryElement/useBoundaryElement.ts +1 -3
- package/src/ui/utils/elementQuery/elementQuery.tsx +36 -14
- package/src/ui/utils/errorBoundary.tsx +2 -0
- package/src/ui/utils/index.ts +0 -1
- package/src/ui/utils/layer/layer.tsx +23 -93
- package/src/ui/utils/layer/layerCard.tsx +92 -0
- package/src/ui/utils/layer/layerProvider.tsx +2 -6
- package/src/ui/utils/layer/useLayer.ts +1 -3
- package/src/ui/utils/portal/portal.ts +2 -6
- package/src/ui/utils/portal/portalProvider.tsx +2 -6
- package/src/ui/utils/portal/types.ts +1 -3
- package/src/ui/utils/portal/usePortal.ts +1 -3
- package/src/ui/utils/srOnly/srOnly.tsx +25 -20
- package/src/ui/utils/virtualList/virtualList.tsx +36 -24
- package/src/css/compile/compileRule.ts +0 -97
- package/src/css/compile/compileRules.test.ts +0 -36
- package/src/css/compile/compileRules.ts +0 -43
- package/src/css/compile/compileSystem.ts +0 -7
- package/src/css/compile/types.ts +0 -6
- package/src/css/primitives/_selectable/_contants.ts +0 -11
- package/src/css/primitives/card/_constants.ts +0 -13
- package/src/ui/utils/conditionalWrapper/conditionalWrapper.tsx +0 -23
- package/src/ui/utils/conditionalWrapper/index.ts +0 -1
package/package.json
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sanity/ui",
|
|
3
|
-
"version": "3.0.0-static.
|
|
3
|
+
"version": "3.0.0-static.13",
|
|
4
4
|
"keywords": [
|
|
5
|
-
"
|
|
5
|
+
"react",
|
|
6
6
|
"ui",
|
|
7
|
+
"kit",
|
|
8
|
+
"library",
|
|
7
9
|
"primitives",
|
|
8
|
-
"react",
|
|
9
10
|
"components",
|
|
10
|
-
"
|
|
11
|
+
"utils"
|
|
11
12
|
],
|
|
12
13
|
"homepage": "https://www.sanity.io/",
|
|
13
14
|
"bugs": {
|
|
@@ -108,8 +109,13 @@
|
|
|
108
109
|
"@juggle/resize-observer": "^3.4.0",
|
|
109
110
|
"@sanity/color": "^3.0.6",
|
|
110
111
|
"@sanity/icons": "^3.7.0",
|
|
112
|
+
"cssnano": "^7.0.7",
|
|
111
113
|
"csstype": "^3.1.3",
|
|
112
114
|
"framer-motion": "^12.9.7",
|
|
115
|
+
"gzip-size": "^7.0.0",
|
|
116
|
+
"postcss": "^8.5.3",
|
|
117
|
+
"prettier": "^3.5.3",
|
|
118
|
+
"pretty-bytes": "^7.0.0",
|
|
113
119
|
"react-compiler-runtime": "19.1.0-rc.1",
|
|
114
120
|
"react-refractor": "^2.2.0",
|
|
115
121
|
"use-effect-event": "^1.0.2"
|
|
@@ -181,7 +187,6 @@
|
|
|
181
187
|
"magic-string": "^0.30.17",
|
|
182
188
|
"module-alias": "^2.2.3",
|
|
183
189
|
"npm-run-all2": "^5.0.2",
|
|
184
|
-
"prettier": "^3.5.3",
|
|
185
190
|
"react": "^19.1.0",
|
|
186
191
|
"react-dom": "^19.1.0",
|
|
187
192
|
"react-is": "^19.1.0",
|
package/src/cli/buildCommand.ts
CHANGED
|
@@ -1,48 +1,75 @@
|
|
|
1
|
+
/* eslint-disable no-console */
|
|
2
|
+
|
|
1
3
|
import {compilePalette, compileSystem, compileTheme} from '@sanity/ui/css'
|
|
2
4
|
import {buildTheme_v3, RootTheme} from '@sanity/ui/theme'
|
|
5
|
+
import cssnano from 'cssnano'
|
|
3
6
|
import fs from 'fs/promises'
|
|
7
|
+
import {gzipSizeSync} from 'gzip-size'
|
|
4
8
|
import path from 'path'
|
|
9
|
+
import postcss from 'postcss'
|
|
10
|
+
import {format, resolveConfig} from 'prettier'
|
|
11
|
+
import prettyBytes from 'pretty-bytes'
|
|
12
|
+
|
|
13
|
+
async function minify(css: string) {
|
|
14
|
+
return postcss([cssnano()]).process(css, {from: undefined})
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
async function prettify(css: string) {
|
|
18
|
+
const options = await resolveConfig(__dirname)
|
|
19
|
+
|
|
20
|
+
if (!options) {
|
|
21
|
+
throw new Error('Prettier config not found')
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
return format(css, {...options, filepath: 'index.css', printWidth: 9999})
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function prettySize(str: string) {
|
|
28
|
+
return `${prettyBytes(str.length)} / ${prettyBytes(gzipSizeSync(str))}`
|
|
29
|
+
}
|
|
5
30
|
|
|
6
31
|
async function buildPalette(outDir: string) {
|
|
7
32
|
const css = compilePalette()
|
|
33
|
+
const minified = await minify(css)
|
|
34
|
+
const prettified = await prettify(css)
|
|
8
35
|
|
|
9
36
|
await fs.mkdir(outDir, {recursive: true})
|
|
37
|
+
await fs.writeFile(path.resolve(outDir, 'sanity-palette.css'), prettified, 'utf-8')
|
|
38
|
+
await fs.writeFile(path.resolve(outDir, 'sanity-palette.min.css'), minified.css, 'utf-8')
|
|
10
39
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
// eslint-disable-next-line no-console
|
|
14
|
-
console.log('- sanity-palette.css')
|
|
40
|
+
console.log(`- built sanity-palette.css (${prettySize(prettified)})`)
|
|
41
|
+
console.log(`- built sanity-palette.min.css (${prettySize(minified.css)})`)
|
|
15
42
|
}
|
|
16
43
|
|
|
17
44
|
async function buildTheme(outDir: string) {
|
|
18
|
-
const css = compileTheme({v3: buildTheme_v3()} as RootTheme)
|
|
45
|
+
const css = await prettify(compileTheme({v3: buildTheme_v3()} as RootTheme))
|
|
46
|
+
const minified = await minify(css)
|
|
47
|
+
const prettified = await prettify(css)
|
|
19
48
|
|
|
20
49
|
await fs.mkdir(outDir, {recursive: true})
|
|
50
|
+
await fs.writeFile(path.resolve(outDir, 'sanity-theme.css'), prettified, 'utf-8')
|
|
51
|
+
await fs.writeFile(path.resolve(outDir, 'sanity-theme.min.css'), minified.css, 'utf-8')
|
|
21
52
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
// eslint-disable-next-line no-console
|
|
25
|
-
console.log('- sanity-theme.css')
|
|
53
|
+
console.log(`- built sanity-theme.css (${prettySize(prettified)})`)
|
|
54
|
+
console.log(`- built sanity-theme.min.css (${prettySize(minified.css)})`)
|
|
26
55
|
}
|
|
27
56
|
|
|
28
57
|
async function buildSystem(outDir: string) {
|
|
29
|
-
const css = compileSystem()
|
|
58
|
+
const css = await prettify(compileSystem())
|
|
59
|
+
const minified = await minify(css)
|
|
60
|
+
const prettified = await prettify(css)
|
|
30
61
|
|
|
31
62
|
await fs.mkdir(outDir, {recursive: true})
|
|
63
|
+
await fs.writeFile(path.resolve(outDir, 'system.css'), prettified, 'utf-8')
|
|
64
|
+
await fs.writeFile(path.resolve(outDir, 'system.min.css'), minified.css, 'utf-8')
|
|
32
65
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
// eslint-disable-next-line no-console
|
|
36
|
-
console.log('- system.css')
|
|
66
|
+
console.log(`- built system.css (${prettySize(prettified)})`)
|
|
67
|
+
console.log(`- built system.min.css (${prettySize(minified.css)})`)
|
|
37
68
|
}
|
|
38
69
|
|
|
39
70
|
export async function buildCommand(options: {cwd?: string; outDir?: string}): Promise<void> {
|
|
40
71
|
const cwd = options.cwd ?? process.cwd()
|
|
41
72
|
const outDir = options.outDir ?? path.resolve(cwd, 'dist')
|
|
42
73
|
|
|
43
|
-
await buildPalette(outDir)
|
|
44
|
-
|
|
45
|
-
await buildTheme(outDir)
|
|
46
|
-
|
|
47
|
-
await buildSystem(outDir)
|
|
74
|
+
await Promise.all([buildPalette(outDir), buildTheme(outDir), buildSystem(outDir)])
|
|
48
75
|
}
|
package/src/css/_comp.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {_getClassNames} from './composeClassNames'
|
|
2
2
|
import {scopeClassName} from './scopeClassName'
|
|
3
3
|
|
|
4
4
|
export function _comp(...classNames: Array<string | false | undefined>): string | undefined {
|
|
5
5
|
return (
|
|
6
|
-
|
|
6
|
+
_getClassNames(...classNames)
|
|
7
7
|
.filter(Boolean)
|
|
8
8
|
.map(scopeClassName)
|
|
9
9
|
.join(' ') || undefined
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {PREFIX} from '
|
|
2
|
-
import {Properties, PropertiesWithVarsAndNested, Style, StyleRules} from '
|
|
3
|
-
import {isArray} from '
|
|
1
|
+
import {PREFIX} from './constants'
|
|
2
|
+
import {Properties, PropertiesWithVarsAndNested, Style, StyleRules} from './types'
|
|
3
|
+
import {isArray} from './util'
|
|
4
4
|
|
|
5
|
-
/** @
|
|
6
|
-
export function
|
|
5
|
+
/** @internal */
|
|
6
|
+
export function _compileStyle(style: Style): string {
|
|
7
7
|
let css = ''
|
|
8
8
|
|
|
9
9
|
if (style.rules) {
|
|
@@ -20,7 +20,7 @@ export function compileStyle(style: Style): string {
|
|
|
20
20
|
keyframesCss += `}\n`
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
keyframesCss += `\n}\n`
|
|
23
|
+
keyframesCss += `\n}\n\n`
|
|
24
24
|
|
|
25
25
|
css += keyframesCss
|
|
26
26
|
}
|
|
@@ -39,7 +39,7 @@ export function compileStyle(style: Style): string {
|
|
|
39
39
|
return css
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
-
function compileStyleRules(rules: StyleRules) {
|
|
42
|
+
export function compileStyleRules(rules: StyleRules) {
|
|
43
43
|
let css = ''
|
|
44
44
|
|
|
45
45
|
const mediaMap = new Map<
|
|
@@ -67,8 +67,9 @@ import {tooltipStyle} from './primitives/tooltip/tooltip.style'
|
|
|
67
67
|
import {type Style} from './types'
|
|
68
68
|
import {srOnlyStyle} from './utils/srOnly/srOnly.style'
|
|
69
69
|
|
|
70
|
-
|
|
71
|
-
|
|
70
|
+
/** @internal */
|
|
71
|
+
export const _systemStyle: Style = _mergeStyles([
|
|
72
|
+
// NOTE: Order matters in CSS!
|
|
72
73
|
|
|
73
74
|
{
|
|
74
75
|
// define order of layers
|
|
@@ -2,6 +2,7 @@ import {_resp} from '../../_resp'
|
|
|
2
2
|
import {composeClassNames} from '../../composeClassNames'
|
|
3
3
|
import {DisplayStyleProps} from './types'
|
|
4
4
|
|
|
5
|
+
/** @internal */
|
|
5
6
|
export function display(props: DisplayStyleProps): string | undefined {
|
|
6
7
|
return composeClassNames(_resp(undefined, props.display))
|
|
7
8
|
}
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import {ResponsiveProp} from '../../types'
|
|
2
2
|
|
|
3
|
-
/**
|
|
4
|
-
* @public
|
|
5
|
-
*/
|
|
3
|
+
/** @public */
|
|
6
4
|
export type Display =
|
|
7
5
|
| 'block'
|
|
8
6
|
| 'inline-block'
|
|
@@ -12,6 +10,7 @@ export type Display =
|
|
|
12
10
|
| 'inline-grid'
|
|
13
11
|
| 'none'
|
|
14
12
|
|
|
13
|
+
/** @public */
|
|
15
14
|
export interface DisplayStyleProps {
|
|
16
15
|
display?: ResponsiveProp<Display>
|
|
17
16
|
}
|
|
@@ -1,18 +1,12 @@
|
|
|
1
1
|
import {ResponsiveProp} from '../../types'
|
|
2
2
|
|
|
3
|
-
/**
|
|
4
|
-
* @public
|
|
5
|
-
*/
|
|
3
|
+
/** @public */
|
|
6
4
|
export type FlexAlign = 'flex-start' | 'flex-end' | 'center' | 'baseline' | 'stretch'
|
|
7
5
|
|
|
8
|
-
/**
|
|
9
|
-
* @public
|
|
10
|
-
*/
|
|
6
|
+
/** @public */
|
|
11
7
|
export type FlexDirection = 'row' | 'row-reverse' | 'column' | 'column-reverse'
|
|
12
8
|
|
|
13
|
-
/**
|
|
14
|
-
* @public
|
|
15
|
-
*/
|
|
9
|
+
/** @public */
|
|
16
10
|
export type FlexJustify =
|
|
17
11
|
| 'flex-start'
|
|
18
12
|
| 'flex-end'
|
|
@@ -21,9 +15,7 @@ export type FlexJustify =
|
|
|
21
15
|
| 'space-around'
|
|
22
16
|
| 'space-evenly'
|
|
23
17
|
|
|
24
|
-
/**
|
|
25
|
-
* @public
|
|
26
|
-
*/
|
|
18
|
+
/** @public */
|
|
27
19
|
export type FlexWrap = 'wrap' | 'wrap-reverse' | 'nowrap'
|
|
28
20
|
|
|
29
21
|
/** @public */
|
|
@@ -2,6 +2,7 @@ import {_resp} from '../../_resp'
|
|
|
2
2
|
import {composeClassNames} from '../../composeClassNames'
|
|
3
3
|
import {GridStyleProps} from './types'
|
|
4
4
|
|
|
5
|
+
/** @internal */
|
|
5
6
|
export function grid(props: GridStyleProps): string | undefined {
|
|
6
7
|
return composeClassNames(
|
|
7
8
|
_resp('auto-cols', props.autoCols),
|
|
@@ -1,22 +1,18 @@
|
|
|
1
1
|
import {ResponsiveProp} from '../../types'
|
|
2
2
|
|
|
3
|
-
/**
|
|
4
|
-
* @public
|
|
5
|
-
*/
|
|
3
|
+
/** @public */
|
|
6
4
|
export type GridAutoRows = 'auto' | 'min' | 'max' | 'fr'
|
|
7
5
|
|
|
8
|
-
/**
|
|
9
|
-
* @public
|
|
10
|
-
*/
|
|
6
|
+
/** @public */
|
|
11
7
|
export type GridAutoCols = 'auto' | 'min' | 'max' | 'fr'
|
|
12
8
|
|
|
13
|
-
/**
|
|
14
|
-
* @public
|
|
15
|
-
*/
|
|
9
|
+
/** @public */
|
|
16
10
|
export type GridAutoFlow = 'row' | 'column' | 'row dense' | 'column dense'
|
|
17
11
|
|
|
12
|
+
/** @public */
|
|
18
13
|
export type Columns = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12
|
|
19
14
|
|
|
15
|
+
/** @public */
|
|
20
16
|
export type Rows = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12
|
|
21
17
|
|
|
22
18
|
/** @public */
|
|
@@ -2,7 +2,7 @@ import {_resp} from '../../_resp'
|
|
|
2
2
|
import {composeClassNames} from '../../composeClassNames'
|
|
3
3
|
import {GridItemStyleProps} from './types'
|
|
4
4
|
|
|
5
|
-
/** @
|
|
5
|
+
/** @internal */
|
|
6
6
|
export function gridItem(props: GridItemStyleProps): string | undefined {
|
|
7
7
|
return composeClassNames(
|
|
8
8
|
_resp(`col`, props.column),
|
|
@@ -1,35 +1,24 @@
|
|
|
1
1
|
import {ResponsiveProp} from '../../types'
|
|
2
2
|
|
|
3
|
-
/**
|
|
4
|
-
* @public
|
|
5
|
-
*/
|
|
3
|
+
/** @public */
|
|
6
4
|
export type GridItemColumn = 'auto' | 'full' | number
|
|
7
5
|
|
|
8
|
-
/**
|
|
9
|
-
* @public
|
|
10
|
-
*/
|
|
6
|
+
/** @public */
|
|
11
7
|
export type GridItemColumnStart = 'auto' | number
|
|
12
8
|
|
|
13
|
-
/**
|
|
14
|
-
* @public
|
|
15
|
-
*/
|
|
9
|
+
/** @public */
|
|
16
10
|
export type GridItemColumnEnd = 'auto' | number
|
|
17
11
|
|
|
18
|
-
/**
|
|
19
|
-
* @public
|
|
20
|
-
*/
|
|
12
|
+
/** @public */
|
|
21
13
|
export type GridItemRow = 'auto' | 'full' | number
|
|
22
14
|
|
|
23
|
-
/**
|
|
24
|
-
* @public
|
|
25
|
-
*/
|
|
15
|
+
/** @public */
|
|
26
16
|
export type GridItemRowStart = 'auto' | number
|
|
27
17
|
|
|
28
|
-
/**
|
|
29
|
-
* @public
|
|
30
|
-
*/
|
|
18
|
+
/** @public */
|
|
31
19
|
export type GridItemRowEnd = 'auto' | number
|
|
32
20
|
|
|
21
|
+
/** @public */
|
|
33
22
|
export interface GridItemStyleProps {
|
|
34
23
|
column?: ResponsiveProp<GridItemColumn>
|
|
35
24
|
columnStart?: ResponsiveProp<GridItemColumnStart>
|
|
@@ -2,16 +2,15 @@ import {_resp} from '../../_resp'
|
|
|
2
2
|
import {composeClassNames} from '../../composeClassNames'
|
|
3
3
|
import {ResponsiveProp} from '../../types'
|
|
4
4
|
|
|
5
|
-
/**
|
|
6
|
-
* @public
|
|
7
|
-
*/
|
|
5
|
+
/** @public */
|
|
8
6
|
export type BoxHeight = 'stretch' | 'fill'
|
|
9
7
|
|
|
8
|
+
/** @public */
|
|
10
9
|
export interface HeightStyleProps {
|
|
11
10
|
height?: ResponsiveProp<BoxHeight>
|
|
12
11
|
}
|
|
13
12
|
|
|
14
|
-
/** @
|
|
13
|
+
/** @internal */
|
|
15
14
|
export function height(props: HeightStyleProps): string | undefined {
|
|
16
15
|
return composeClassNames(_resp(`h`, props.height))
|
|
17
16
|
}
|
|
@@ -2,6 +2,7 @@ import {_resp} from '../../_resp'
|
|
|
2
2
|
import {composeClassNames} from '../../composeClassNames'
|
|
3
3
|
import {InsetStyleProps} from './types'
|
|
4
4
|
|
|
5
|
+
/** @internal */
|
|
5
6
|
export function inset(props: InsetStyleProps): string | undefined {
|
|
6
7
|
return composeClassNames(
|
|
7
8
|
_resp('inset', props.inset),
|
|
@@ -2,6 +2,7 @@ import {_resp} from '../../_resp'
|
|
|
2
2
|
import {composeClassNames} from '../../composeClassNames'
|
|
3
3
|
import {MarginStyleProps} from './types'
|
|
4
4
|
|
|
5
|
+
/** @internal */
|
|
5
6
|
export function margin(props: MarginStyleProps): string | undefined {
|
|
6
7
|
return composeClassNames(
|
|
7
8
|
_resp('m', props.margin),
|
|
@@ -2,6 +2,7 @@ import {_resp} from '../../_resp'
|
|
|
2
2
|
import {composeClassNames} from '../../composeClassNames'
|
|
3
3
|
import {OverflowStyleProps} from './types'
|
|
4
4
|
|
|
5
|
+
/** @internal */
|
|
5
6
|
export function overflow(props: OverflowStyleProps): string | undefined {
|
|
6
7
|
return composeClassNames(
|
|
7
8
|
_resp(`overflow`, props.overflow),
|
|
@@ -2,6 +2,7 @@ import {_resp} from '../../_resp'
|
|
|
2
2
|
import {composeClassNames} from '../../composeClassNames'
|
|
3
3
|
import {PaddingStyleProps} from './types'
|
|
4
4
|
|
|
5
|
+
/** @internal */
|
|
5
6
|
export function padding(props: PaddingStyleProps): string | undefined {
|
|
6
7
|
return composeClassNames(
|
|
7
8
|
_resp('p', props.padding),
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import {composeClassNames} from '../../composeClassNames'
|
|
2
2
|
import {PointerEventsStyleProps} from './types'
|
|
3
3
|
|
|
4
|
+
/** @internal */
|
|
4
5
|
export function pointerEvents(props: PointerEventsStyleProps): string | undefined {
|
|
5
6
|
return composeClassNames(props.pointerEvents && `pointer-events-${props.pointerEvents}`)
|
|
6
7
|
}
|
|
@@ -2,6 +2,7 @@ import {_resp} from '../../_resp'
|
|
|
2
2
|
import {composeClassNames} from '../../composeClassNames'
|
|
3
3
|
import {PositionStyleProps} from './types'
|
|
4
4
|
|
|
5
|
+
/** @internal */
|
|
5
6
|
export function position(props: PositionStyleProps): string | undefined {
|
|
6
7
|
return composeClassNames(_resp('position', props.position))
|
|
7
8
|
}
|
|
@@ -2,6 +2,7 @@ import {_resp} from '../../_resp'
|
|
|
2
2
|
import {composeClassNames} from '../../composeClassNames'
|
|
3
3
|
import {ShadowStyleProps} from './types'
|
|
4
4
|
|
|
5
|
+
/** @internal */
|
|
5
6
|
export function shadow(props: ShadowStyleProps): string | undefined {
|
|
6
7
|
return composeClassNames(_resp('shadow', props.shadow))
|
|
7
8
|
}
|
|
@@ -1,23 +1,27 @@
|
|
|
1
1
|
import {color} from '@sanity/color'
|
|
2
2
|
import {HUES, TINTS} from '@sanity/ui/theme'
|
|
3
3
|
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
4
|
+
import {_compileStyle} from './_compileStyle'
|
|
5
|
+
import {Properties} from './types'
|
|
6
|
+
import {varNames} from './varNames'
|
|
6
7
|
|
|
8
|
+
/** @internal */
|
|
7
9
|
export function compilePalette(): string {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
+
return _compileStyle({
|
|
11
|
+
layers: {
|
|
12
|
+
theme: {
|
|
13
|
+
':root': compilePaletteProperties(),
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
})
|
|
17
|
+
}
|
|
10
18
|
|
|
19
|
+
function compilePaletteProperties() {
|
|
20
|
+
const rules: Properties = {
|
|
11
21
|
[varNames.black]: color.black.hex,
|
|
12
22
|
[varNames.white]: color.white.hex,
|
|
13
23
|
}
|
|
14
24
|
|
|
15
|
-
return compileRule(':root', props, {keyframes: {}, media: {}})
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
function compileHues() {
|
|
19
|
-
const rules: Record<string, string> = {}
|
|
20
|
-
|
|
21
25
|
for (const hue of HUES) {
|
|
22
26
|
for (const tint of TINTS) {
|
|
23
27
|
rules[varNames[hue][tint]] = color[hue][tint].hex
|