Initial commit

This commit is contained in:
2025-03-07 19:22:02 +01:00
commit 4a98255d83
55743 changed files with 5280367 additions and 0 deletions
+21
View File
@@ -0,0 +1,21 @@
import type { AtRules } from './utils/types';
export interface CompileAtomicCSSOptions {
className: string;
selectors: string[];
property: string;
value: number | string | Array<number | string>;
rtlClassName?: string;
rtlProperty?: string;
rtlValue?: number | string | Array<number | string>;
}
/**
* Normalizes pseudo selectors to always contain &, requires to work properly with comma-separated selectors.
*
* @example
* ":hover" => "&:hover"
* " :hover" => "& :hover"
* ":hover,:focus" => "&:hover,&:focus"
* " :hover, :focus" => "& :hover,& :focus"
*/
export declare function normalizePseudoSelector(pseudoSelector: string): string;
export declare function compileAtomicCSSRule(options: CompileAtomicCSSOptions, atRules: AtRules): [string?, string?];
+1
View File
@@ -0,0 +1 @@
export declare function compileCSSRules(cssRules: string, sortClassesInAtRules: boolean): string[];
+6
View File
@@ -0,0 +1,6 @@
import type { GriffelAnimation } from '@griffel/style-types';
export declare function compileKeyframeRule(keyframeObject: GriffelAnimation): string;
/**
* Creates CSS rules for insertion from passed CSS.
*/
export declare function compileKeyframesCSS(keyframeName: string, keyframeCSS: string): string[];
+1
View File
@@ -0,0 +1 @@
export declare function compileResetCSSRules(cssRules: string): [string[], string[]];
+2
View File
@@ -0,0 +1,2 @@
import type { GriffelStaticStyle } from '@griffel/style-types';
export declare function compileStaticCSS(property: string, value: GriffelStaticStyle): string;
+22
View File
@@ -0,0 +1,22 @@
import type { StyleBucketName } from '../types';
import type { AtRules } from './utils/types';
/**
* Gets the bucket depending on the pseudo.
*
* Input:
*
* ```
* ":hover"
* ":focus:hover"
* ```
*
* Output:
*
* ```
* "h"
* "f"
* ```
*
* @internal
*/
export declare function getStyleBucketName(selectors: string[], atRules: AtRules): StyleBucketName;
+14
View File
@@ -0,0 +1,14 @@
import type { CSSClassesMapBySlot, CSSClassesMap } from '../types';
/**
* Reduces a classname map for slot to a classname string. Uses classnames according to text directions.
*
* @private
*/
export declare function reduceToClassName(classMap: CSSClassesMap, dir: 'ltr' | 'rtl'): [string, string];
/**
* Reduces classname maps for slots to classname strings. Registers them in a definition cache to be used by
* `mergeClasses()`.
*
* @internal
*/
export declare function reduceToClassNameForSlots<Slots extends string | number>(classesMapBySlot: CSSClassesMapBySlot<Slots>, dir: 'ltr' | 'rtl'): Record<Slots, string>;
+6
View File
@@ -0,0 +1,6 @@
import type { GriffelResetStyle } from '@griffel/style-types';
import type { CSSRulesByBucket } from '../types';
/**
* @internal
*/
export declare function resolveResetStyleRules(styles: GriffelResetStyle, classNameHashSalt?: string): [string, string | null, CSSRulesByBucket | string[]];
+3
View File
@@ -0,0 +1,3 @@
import type { GriffelStaticStyles } from '@griffel/style-types';
import type { CSSBucketEntry } from '../types';
export declare function resolveStaticStyleRules(stylesSet: GriffelStaticStyles[]): CSSBucketEntry[];
+9
View File
@@ -0,0 +1,9 @@
import type { GriffelStyle } from '@griffel/style-types';
import type { CSSClassesMap, CSSRulesByBucket } from '../types';
import type { AtRules } from './utils/types';
/**
* Transforms input styles to classes maps & CSS rules.
*
* @internal
*/
export declare function resolveStyleRules(styles: GriffelStyle, classNameHashSalt?: string, selectors?: string[], atRules?: AtRules, cssClassesMap?: CSSClassesMap, cssRulesByBucket?: CSSRulesByBucket, rtlValue?: string): [CSSClassesMap, CSSRulesByBucket];
+5
View File
@@ -0,0 +1,5 @@
import type * as CSS from 'csstype';
import type { GriffelStylesUnsupportedCSSProperties } from '@griffel/style-types';
type AllowedShorthandProperties = keyof Omit<CSS.Properties, keyof GriffelStylesUnsupportedCSSProperties>;
export declare const shorthands: Partial<Record<AllowedShorthandProperties, [number, string[]]>>;
export {};
+2
View File
@@ -0,0 +1,2 @@
import type { Middleware } from 'stylis';
export declare const globalPlugin: Middleware;
+2
View File
@@ -0,0 +1,2 @@
import type { Element } from 'stylis';
export declare function isAtRuleElement(element: Element): boolean;
+9
View File
@@ -0,0 +1,9 @@
import type { Element, Middleware } from 'stylis';
export declare function prefix(value: string, length: number, children?: Element[]): string;
/**
* @param {object} element
* @param {number} index
* @param {object[]} children
* @param {function} callback
*/
export declare function prefixerPlugin(element: Element, index: number, children: Element[], callback: Middleware): string | undefined;
+6
View File
@@ -0,0 +1,6 @@
import type { Element, Middleware } from 'stylis';
export type RulesheetPluginCallback = (type: Element, rule: string) => void;
/**
* The same plugin as in stylis, but this version also has "element" argument.
*/
export declare function rulesheetPlugin(callback: RulesheetPluginCallback): Middleware;
@@ -0,0 +1,2 @@
import type { Middleware } from 'stylis';
export declare const sortClassesInAtRulesPlugin: Middleware;
+2
View File
@@ -0,0 +1,2 @@
import type { GriffelStaticStyle, GriffelStyle } from '@griffel/style-types';
export declare function cssifyObject(style: GriffelStyle | GriffelStaticStyle): string;
@@ -0,0 +1 @@
export declare function generateCombinedQuery(currentMediaQuery: string, nestedMediaQuery: string): string;
+9
View File
@@ -0,0 +1,9 @@
import type { AtRules } from './types';
interface HashedClassNameParts {
property: string;
value: string;
salt: string;
selector: string;
}
export declare function hashClassName({ property, selector, salt, value }: HashedClassNameParts, atRules: AtRules): string;
export {};
+4
View File
@@ -0,0 +1,4 @@
import type { PropertyHash } from '../../types';
import type { AtRules } from './types';
export declare function atRulesToString(atRules: AtRules): string;
export declare function hashPropertyKey(selector: string, property: string, atRules: AtRules): PropertyHash;
+2
View File
@@ -0,0 +1,2 @@
import type { SequenceHash } from '../../types';
export declare function hashSequence(classes: string, dir: 'ltr' | 'rtl', sequenceIds?: (SequenceHash | undefined)[]): SequenceHash;
+1
View File
@@ -0,0 +1 @@
export declare function hyphenateProperty(name: string): string;
@@ -0,0 +1 @@
export declare function isContainerQuerySelector(property: string): boolean;
+1
View File
@@ -0,0 +1 @@
export declare function isLayerSelector(property: string): boolean;
@@ -0,0 +1 @@
export declare function isMediaQuerySelector(property: string): boolean;
+1
View File
@@ -0,0 +1 @@
export declare function isNestedSelector(property: string): boolean;
+1
View File
@@ -0,0 +1 @@
export declare function isObject(val: any): val is Record<string, unknown>;
+1
View File
@@ -0,0 +1 @@
export declare function isResetValue(value: unknown): value is "unset";
@@ -0,0 +1 @@
export declare function isSupportQuerySelector(property: string): boolean;
@@ -0,0 +1,8 @@
import type { CSSBucketEntry } from '../../types';
/**
* @internal
*
* @param entry - CSS bucket entry that can be either a string or an array
* @returns An array where the first element is the CSS rule
*/
export declare function normalizeCSSBucketEntry(entry: CSSBucketEntry): [string] | [string, Record<string, unknown>];
@@ -0,0 +1 @@
export declare function normalizeNestedProperty(nestedProperty: string): string;
+4
View File
@@ -0,0 +1,4 @@
/**
* Trims selectors to generate consistent hashes.
*/
export declare function trimSelector(selector: string): string;
+6
View File
@@ -0,0 +1,6 @@
export type AtRules = {
container: string;
media: string;
layer: string;
supports: string;
};
+1
View File
@@ -0,0 +1 @@
export declare function logError(...args: unknown[]): void;
@@ -0,0 +1,2 @@
import type { GriffelResetStyle, GriffelStyle } from '@griffel/style-types';
export declare function warnAboutUnresolvedRule(property: string, value: GriffelStyle | GriffelResetStyle): void;
@@ -0,0 +1,2 @@
import type { GriffelStyle } from '@griffel/style-types';
export declare function warnAboutUnsupportedProperties(property: string, value: GriffelStyle[keyof GriffelStyle]): void;