@sanity/ui 3.0.0-static.10 → 3.0.0-static.12
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 +1300 -1269
- 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 +1298 -1263
- package/dist/_chunks-es/_visual-editing.mjs.map +1 -1
- package/dist/_visual-editing.d.mts +516 -360
- package/dist/_visual-editing.d.ts +516 -360
- package/dist/cli.js +1 -1
- package/dist/css.d.mts +258 -75
- package/dist/css.d.ts +258 -75
- package/dist/css.js +746 -752
- package/dist/css.js.map +1 -1
- package/dist/css.mjs +748 -754
- package/dist/css.mjs.map +1 -1
- package/dist/index.d.mts +1342 -871
- package/dist/index.d.ts +1342 -871
- package/dist/index.js +433 -325
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +429 -321
- 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 -21710
- 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 +19 -20
- package/dist/theme.js.map +1 -1
- package/dist/theme.mjs +19 -20
- 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/_resp.ts +0 -1
- 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/font.style.ts +7 -66
- 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.style.ts +16 -41
- 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/compilePalette.ts +32 -0
- package/src/css/compileSystem.ts +7 -0
- package/src/css/{compile/compileTheme.ts → compileTheme.ts} +1 -0
- package/src/css/compileTheme_v3.ts +434 -0
- 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.style.ts +8 -4
- 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 +11 -0
- package/src/css/index.ts +4 -3
- package/src/css/primitives/_arrow/_arrow.style.ts +6 -8
- package/src/css/primitives/_arrow/_arrow.ts +7 -0
- package/src/css/primitives/_input/input.ts +2 -0
- package/src/css/primitives/_selectable/_selectable.style.ts +24 -25
- 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.style.ts +48 -15
- 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 +4 -7
- 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/token/token.style.ts +37 -36
- package/src/css/primitives/tooltip/tooltip.ts +2 -0
- package/src/css/responsiveRules.ts +12 -19
- package/src/css/scopeClassName.ts +1 -0
- package/src/css/types.ts +115 -15
- package/src/css/util.ts +5 -0
- package/src/css/utils/srOnly/srOnly.ts +1 -0
- package/src/css/varNames.ts +230 -143
- package/src/css/vars.ts +53 -22
- 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 +2 -1
- package/src/theme/v3/color/color.ts +6 -4
- package/src/theme/v3/color/renderColor.ts +4 -1
- package/src/theme/v3/{defaults.ts → defaultTokens.ts} +2 -2
- package/src/theme/v3/index.ts +1 -1
- package/src/theme/v3/resolveTokens.ts +18 -18
- package/src/ui/RootClassNames.tsx +44 -0
- package/src/ui/StyleTags.tsx +3 -1
- package/src/ui/_compat/helpers.ts +72 -0
- package/src/ui/_compat/index.ts +2 -6
- package/src/ui/_compat/studioTheme.ts +7 -0
- 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/_compat/types.ts +0 -83
- 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/index.ts +1 -0
- 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 +63 -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 +29 -26
- package/src/ui/primitives/popover/popover.tsx +293 -271
- package/src/ui/primitives/popover/popoverCard.tsx +122 -120
- 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 +30 -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 +85 -61
- 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 +43 -25
- 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 +43 -19
- 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 +69 -50
- package/src/css/compile/compilePalette.ts +0 -27
- 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 -10
- package/src/css/compile/compileTheme_v3.ts +0 -401
- package/src/css/compile/types.ts +0 -6
- package/src/css/components/breadcrumbs/rules.ts +0 -25
- package/src/css/components/dialog/rules.ts +0 -78
- package/src/css/components/skeleton/rules.ts +0 -113
- package/src/css/components/toast/rules.ts +0 -18
- package/src/css/components/tree/rules.ts +0 -168
- package/src/css/primitives/_selectable/_contants.ts +0 -11
- package/src/css/primitives/card/_constants.ts +0 -13
- package/src/css/primitives/popover/rules.ts +0 -5
- package/src/css/primitives/spinner/rules.ts +0 -21
- package/src/css/primitives/token/rules.ts +0 -45
- 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.12",
|
|
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<
|
package/src/css/_resp.ts
CHANGED
|
@@ -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 */
|
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
// import {responsiveRules} from '../../responsiveRules'
|
|
2
1
|
import {_responsiveRule} from '../../_responsiveRule'
|
|
3
2
|
import {Style, StyleRules} from '../../types'
|
|
4
3
|
|
|
5
|
-
export const
|
|
4
|
+
export const primitive: StyleRules = {
|
|
6
5
|
'.font': {
|
|
7
|
-
// 'position': 'relative',
|
|
8
6
|
'fontFamily': 'var(--font-family)',
|
|
9
7
|
'fontFeatureSettings': 'var(--font-feature-settings)',
|
|
10
8
|
'fontSize': 'var(--font-size)',
|
|
@@ -71,81 +69,24 @@ export const rules: StyleRules = {
|
|
|
71
69
|
},
|
|
72
70
|
}
|
|
73
71
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
_responsiveRule(rules, `text-align-initial`, {
|
|
72
|
+
_responsiveRule(primitive, `text-align-initial`, {
|
|
77
73
|
textAlign: 'initial',
|
|
78
74
|
})
|
|
79
75
|
|
|
80
|
-
_responsiveRule(
|
|
76
|
+
_responsiveRule(primitive, `text-align-left`, {
|
|
81
77
|
textAlign: 'left',
|
|
82
78
|
})
|
|
83
79
|
|
|
84
|
-
_responsiveRule(
|
|
80
|
+
_responsiveRule(primitive, `text-align-center`, {
|
|
85
81
|
textAlign: 'center',
|
|
86
82
|
})
|
|
87
83
|
|
|
88
|
-
_responsiveRule(
|
|
84
|
+
_responsiveRule(primitive, `text-align-right`, {
|
|
89
85
|
textAlign: 'right',
|
|
90
86
|
})
|
|
91
87
|
|
|
92
|
-
_responsiveRule(
|
|
88
|
+
_responsiveRule(primitive, `text-align-justify`, {
|
|
93
89
|
textAlign: 'justify',
|
|
94
90
|
})
|
|
95
91
|
|
|
96
|
-
export const fontStyle: Style = {layers: {primitive
|
|
97
|
-
|
|
98
|
-
// .font {
|
|
99
|
-
// position: relative;
|
|
100
|
-
// font-family: var(--font-family);
|
|
101
|
-
// font-size: var(--font-size);
|
|
102
|
-
// line-height: var(--font-line-height);
|
|
103
|
-
// letter-spacing: var(--font-letter-spacing);
|
|
104
|
-
// font-weight: var(--font-weight);
|
|
105
|
-
// transform: translateY(var(--font-descender-height));
|
|
106
|
-
// padding: 1px 0;
|
|
107
|
-
// margin: 0;
|
|
108
|
-
|
|
109
|
-
// --font-negative-height: calc(var(--font-ascender-height) + var(--font-descender-height));
|
|
110
|
-
// --font-cap-height: calc(var(--font-line-height) - var(--font-negative-height));
|
|
111
|
-
// --font-icon-offset: calc((var(--font-cap-height) - var(--font-icon-size)) / 2);
|
|
112
|
-
// --font-custom-icon-size: calc((var(--font-size) * 1.125) / 2) * 2 + 1;
|
|
113
|
-
// --font-custom-icon-offset: calc((var(--font-cap-height) - var(--font-custom-icon-size)) / 2);
|
|
114
|
-
|
|
115
|
-
// &:before {
|
|
116
|
-
// content: '';
|
|
117
|
-
// display: block;
|
|
118
|
-
// height: 0;
|
|
119
|
-
// margin-top: calc(0px - var(--font-negative-height) - 1px);
|
|
120
|
-
// }
|
|
121
|
-
|
|
122
|
-
// &:after {
|
|
123
|
-
// content: '';
|
|
124
|
-
// display: block;
|
|
125
|
-
// height: 0;
|
|
126
|
-
// margin-bottom: -1px;
|
|
127
|
-
// }
|
|
128
|
-
|
|
129
|
-
// & > code,
|
|
130
|
-
// & > span {
|
|
131
|
-
// display: block;
|
|
132
|
-
// }
|
|
133
|
-
|
|
134
|
-
// &:not([hidden]) {
|
|
135
|
-
// display: block;
|
|
136
|
-
// }
|
|
137
|
-
|
|
138
|
-
// & svg:not([data-sanity-icon]) {
|
|
139
|
-
// /* todo */
|
|
140
|
-
// font-size: var(--font-custom-icon-size);
|
|
141
|
-
// /* font-size: calc(var(--font-custom-icon-size) / 16 * 1rem); */
|
|
142
|
-
// margin: var(--font-custom-icon-offset);
|
|
143
|
-
// }
|
|
144
|
-
|
|
145
|
-
// & [data-sanity-icon] {
|
|
146
|
-
// /* todo */
|
|
147
|
-
// font-size: var(--font-icon-size);
|
|
148
|
-
// /* font-size: calc(var(--font-icon-size) / 16 * 1rem); */
|
|
149
|
-
// margin: var(--font-icon-offset);
|
|
150
|
-
// }
|
|
151
|
-
// }
|
|
92
|
+
export const fontStyle: Style = {layers: {primitive}}
|
|
@@ -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
|
}
|
|
@@ -1,49 +1,24 @@
|
|
|
1
|
+
import {SHADOW} from '@sanity/ui/theme'
|
|
2
|
+
|
|
1
3
|
import {_responsiveRule} from '../../_responsiveRule'
|
|
2
4
|
import type {Style, StyleRules} from '../../types'
|
|
3
5
|
import {vars} from '../../vars'
|
|
4
6
|
|
|
5
7
|
const util: StyleRules = {}
|
|
6
8
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
`
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
`var(--shadow-2-ambient) ${vars.color.shadow.ambient}`,
|
|
22
|
-
].join(', '),
|
|
23
|
-
})
|
|
24
|
-
_responsiveRule(util, 'shadow-3', {
|
|
25
|
-
boxShadow: [
|
|
26
|
-
`var(--shadow-outline) ${vars.color.shadow.outline}`,
|
|
27
|
-
`var(--shadow-3-umbra) ${vars.color.shadow.umbra}`,
|
|
28
|
-
`var(--shadow-3-penumbra) ${vars.color.shadow.penumbra}`,
|
|
29
|
-
`var(--shadow-3-ambient) ${vars.color.shadow.ambient}`,
|
|
30
|
-
].join(', '),
|
|
31
|
-
})
|
|
32
|
-
_responsiveRule(util, 'shadow-4', {
|
|
33
|
-
boxShadow: [
|
|
34
|
-
`var(--shadow-outline) ${vars.color.shadow.outline}`,
|
|
35
|
-
`var(--shadow-4-umbra) ${vars.color.shadow.umbra}`,
|
|
36
|
-
`var(--shadow-4-penumbra) ${vars.color.shadow.penumbra}`,
|
|
37
|
-
`var(--shadow-4-ambient) ${vars.color.shadow.ambient}`,
|
|
38
|
-
].join(', '),
|
|
39
|
-
})
|
|
40
|
-
_responsiveRule(util, 'shadow-5', {
|
|
41
|
-
boxShadow: [
|
|
42
|
-
`var(--shadow-outline) ${vars.color.shadow.outline}`,
|
|
43
|
-
`var(--shadow-5-umbra) ${vars.color.shadow.umbra}`,
|
|
44
|
-
`var(--shadow-5-penumbra) ${vars.color.shadow.penumbra}`,
|
|
45
|
-
`var(--shadow-5-ambient) ${vars.color.shadow.ambient}`,
|
|
46
|
-
].join(', '),
|
|
47
|
-
})
|
|
9
|
+
for (const shadow of SHADOW) {
|
|
10
|
+
if (shadow === 0) {
|
|
11
|
+
_responsiveRule(util, 'shadow-0', {boxShadow: 'none'})
|
|
12
|
+
} else {
|
|
13
|
+
_responsiveRule(util, `shadow-${shadow}`, {
|
|
14
|
+
boxShadow: [
|
|
15
|
+
`0 0 0 ${vars.card.shadow.outline} ${vars.color.shadow.outline}`,
|
|
16
|
+
`${vars.shadow[shadow].umbra} ${vars.color.shadow.umbra}`,
|
|
17
|
+
`${vars.shadow[shadow].penumbra} ${vars.color.shadow.penumbra}`,
|
|
18
|
+
`${vars.shadow[shadow].ambient} ${vars.color.shadow.ambient}`,
|
|
19
|
+
].join(', '),
|
|
20
|
+
})
|
|
21
|
+
}
|
|
22
|
+
}
|
|
48
23
|
|
|
49
24
|
export const shadowStyle: Style = {layers: {util}}
|