@stylable/core
Version:
CSS for Components
160 lines • 6.07 kB
TypeScript
import { FeatureContext } from './feature';
import type { StylableMeta } from '../stylable-meta';
import type { ImmutablePseudoClass, PseudoClass } from '@tokey/css-selector-parser';
import type * as postcss from 'postcss';
import type { Stylable } from '../stylable';
export interface ImportSymbol {
_kind: 'import';
type: 'named' | 'default';
name: string;
import: Imported;
context: string;
}
export interface AnalyzedImport {
from: string;
default: string;
named: Record<string, string>;
typed: {
keyframes: Record<string, string>;
};
}
export interface Imported {
from: string;
defaultExport: string;
named: Record<string, string>;
/**@deprecated use imported.typed.keyframes (remove in stylable 5) */
keyframes: Record<string, string>;
typed: Record<string, Record<string, string>>;
rule: postcss.Rule | postcss.AtRule;
request: string;
context: string;
}
export declare const PseudoImport = ":import";
export declare const PseudoImportDecl: {
readonly DEFAULT: "-st-default";
readonly NAMED: "-st-named";
readonly FROM: "-st-from";
};
/**
* ImportTypeHook is used as a way to cast imported symbols before resolving their actual type.
* currently used only for `keyframes` as they are completely on a separate namespace from other symbols.
*
* Hooks are registered statically since the features are static and cannot be selected/disabled.
* If the system will ever change to support picking features dynamically, this mechanism would
* have to move into the `metaInit` hook.
*/
export declare const ImportTypeHook: Map<string, (context: FeatureContext, localName: string, importName: string, importDef: Imported) => void>;
export declare const diagnostics: {
FORBIDDEN_DEF_IN_COMPLEX_SELECTOR: {
(name: string): import("../diagnostics").DiagnosticBase;
code: string;
severity: import("../diagnostics").DiagnosticSeverity;
};
NO_ST_IMPORT_IN_NESTED_SCOPE: {
(): import("../diagnostics").DiagnosticBase;
code: string;
severity: import("../diagnostics").DiagnosticSeverity;
};
NO_PSEUDO_IMPORT_IN_NESTED_SCOPE: {
(): import("../diagnostics").DiagnosticBase;
code: string;
severity: import("../diagnostics").DiagnosticSeverity;
};
INVALID_CUSTOM_PROPERTY_AS_VALUE: {
(name: string, as: string): import("../diagnostics").DiagnosticBase;
code: string;
severity: import("../diagnostics").DiagnosticSeverity;
};
UNKNOWN_IMPORTED_SYMBOL: {
(name: string, path: string): import("../diagnostics").DiagnosticBase;
code: string;
severity: import("../diagnostics").DiagnosticSeverity;
};
UNKNOWN_IMPORTED_FILE: {
(path: string, error?: unknown): import("../diagnostics").DiagnosticBase;
code: string;
severity: import("../diagnostics").DiagnosticSeverity;
};
UNKNOWN_TYPED_IMPORT: {
(type: string): import("../diagnostics").DiagnosticBase;
code: string;
severity: import("../diagnostics").DiagnosticSeverity;
};
NO_DEFAULT_EXPORT: {
(path: string): import("../diagnostics").DiagnosticBase;
code: string;
severity: import("../diagnostics").DiagnosticSeverity;
};
UNSUPPORTED_NATIVE_IMPORT: {
(): import("../diagnostics").DiagnosticBase;
code: string;
severity: import("../diagnostics").DiagnosticSeverity;
};
ST_IMPORT_STAR: {
(): import("../diagnostics").DiagnosticBase;
code: string;
severity: import("../diagnostics").DiagnosticSeverity;
};
INVALID_ST_IMPORT_FORMAT: {
(errors: string[]): import("../diagnostics").DiagnosticBase;
code: string;
severity: import("../diagnostics").DiagnosticSeverity;
};
ST_IMPORT_EMPTY_FROM: {
(): import("../diagnostics").DiagnosticBase;
code: string;
severity: import("../diagnostics").DiagnosticSeverity;
};
EMPTY_IMPORT_FROM: {
(): import("../diagnostics").DiagnosticBase;
code: string;
severity: import("../diagnostics").DiagnosticSeverity;
};
MULTIPLE_FROM_IN_IMPORT: {
(): import("../diagnostics").DiagnosticBase;
code: string;
severity: import("../diagnostics").DiagnosticSeverity;
};
DEFAULT_IMPORT_IS_LOWER_CASE: {
(): import("../diagnostics").DiagnosticBase;
code: string;
severity: import("../diagnostics").DiagnosticSeverity;
};
ILLEGAL_PROP_IN_IMPORT: {
(propName: string): import("../diagnostics").DiagnosticBase;
code: string;
severity: import("../diagnostics").DiagnosticSeverity;
};
FROM_PROP_MISSING_IN_IMPORT: {
(): import("../diagnostics").DiagnosticBase;
code: string;
severity: import("../diagnostics").DiagnosticSeverity;
};
INVALID_NAMED_IMPORT_AS: {
(name: string): import("../diagnostics").DiagnosticBase;
code: string;
severity: import("../diagnostics").DiagnosticSeverity;
};
INVALID_NESTED_KEYFRAMES: {
(name: string): import("../diagnostics").DiagnosticBase;
code: string;
severity: import("../diagnostics").DiagnosticSeverity;
};
INVALID_NESTED_TYPED_IMPORT: {
(type: string, name: string): import("../diagnostics").DiagnosticBase;
code: string;
severity: import("../diagnostics").DiagnosticSeverity;
};
};
export declare const hooks: import("./feature").FeatureHooks<{
SELECTOR: PseudoClass;
IMMUTABLE_SELECTOR: ImmutablePseudoClass;
}>;
export declare class StylablePublicApi {
private stylable;
constructor(stylable: Stylable);
analyze(meta: StylableMeta): AnalyzedImport[];
}
export declare function getImportStatements({ data }: StylableMeta): ReadonlyArray<Imported>;
export declare function createImportSymbol(importDef: Imported, type: `default` | `named`, name: string, dirContext: string): ImportSymbol;
//# sourceMappingURL=st-import.d.ts.map