-
-
Notifications
You must be signed in to change notification settings - Fork 243
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1d057e1
commit 5286731
Showing
23 changed files
with
1,302 additions
and
881 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
--- | ||
'@pandacss/is-valid-prop': minor | ||
'@pandacss/generator': minor | ||
'@pandacss/types': minor | ||
--- | ||
|
||
Add support for recent baseline and experimental css properties: | ||
|
||
- **Size interpolation:** fieldSizing, interpolateSize | ||
- **Text rendering:** textWrapMode, textWrapStyle and textSpacingTrim | ||
- **[Experimental] Anchor positioning:** anchorName, anchorScope, positionAnchor, positionArea, positionTry, | ||
positionTryFallback, positionTryOrder, positionVisibility |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import { GlobalPositionTry } from '../src/global-position-try' | ||
|
||
describe('global position try', () => { | ||
test('dash ident', () => { | ||
const pos = new GlobalPositionTry({ | ||
globalPositionTry: { | ||
'--bottom-scrollable': { | ||
alignSelf: 'stretch', | ||
}, | ||
}, | ||
}) | ||
|
||
expect(pos.toString()).toMatchInlineSnapshot(` | ||
"@position-try --bottom-scrollable { | ||
align-self: stretch; | ||
}" | ||
`) | ||
}) | ||
|
||
test('without dash ident', () => { | ||
const pos = new GlobalPositionTry({ | ||
globalPositionTry: { | ||
'bottom-scrollable': { | ||
positionArea: 'block-start span-inline-end', | ||
alignSelf: 'stretch', | ||
}, | ||
}, | ||
}) | ||
|
||
expect(pos.toString()).toMatchInlineSnapshot(` | ||
"@position-try --bottom-scrollable { | ||
position-area: block-start span-inline-end; | ||
align-self: stretch; | ||
}" | ||
`) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import type { FontfaceRule, GlobalPositionTry as GlobalPositionTryDefinition } from '@pandacss/types' | ||
import { stringify } from './stringify' | ||
|
||
interface GlobalFontfaceOptions { | ||
globalPositionTry?: GlobalPositionTryDefinition | ||
} | ||
|
||
export class GlobalPositionTry { | ||
names: string[] | ||
|
||
constructor(private opts: GlobalFontfaceOptions) { | ||
this.names = Object.keys(opts.globalPositionTry ?? {}) | ||
} | ||
|
||
isEmpty() { | ||
return this.names.length === 0 | ||
} | ||
|
||
toString() { | ||
return stringifyGlobalPositionTry(this.opts.globalPositionTry ?? {}) | ||
} | ||
} | ||
|
||
const stringifyGlobalPositionTry = (dfns: GlobalPositionTryDefinition) => { | ||
if (!dfns) return '' | ||
|
||
const lines: string[] = [] | ||
|
||
Object.entries(dfns).forEach(([key, value]) => { | ||
const _value = Array.isArray(value) ? value : [value] | ||
_value.forEach((v) => { | ||
lines.push(stringifyPositionTry(key, v)) | ||
}) | ||
}) | ||
|
||
return lines.join('\n\n') | ||
} | ||
|
||
const ident = (key: string) => (key.startsWith('--') ? key : `--${key}`) | ||
|
||
function stringifyPositionTry(key: string, config: FontfaceRule) { | ||
return `@position-try ${ident(key)} { | ||
${stringify(config)} | ||
}` | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.