@navita/engine 0.0.0-main-20230917201540

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.
Files changed (4) hide show
  1. package/index.d.ts +51 -0
  2. package/index.js +870 -0
  3. package/index.mjs +866 -0
  4. package/package.json +19 -0
package/index.d.ts ADDED
@@ -0,0 +1,51 @@
1
+ import { StyleRule, FontFaceRule, CSSKeyframes } from '@navita/types';
2
+
3
+ declare class ClassList extends String {
4
+ }
5
+
6
+ declare class Static {
7
+ }
8
+
9
+ type CacheKeys = keyof Engine["caches"];
10
+ type UsedIdCache = {
11
+ [key in CacheKeys]?: (string | number)[];
12
+ };
13
+ type Options = {
14
+ enableSourceMaps?: boolean;
15
+ enableDebugIdentifiers?: boolean;
16
+ };
17
+ declare class Engine {
18
+ private readonly caches;
19
+ private readonly usedIds;
20
+ private filePath;
21
+ private identifierCount;
22
+ private readonly options;
23
+ private sourceMapReferences;
24
+ constructor(options?: Options);
25
+ addStatic(selector: string, styles: StyleRule): Static;
26
+ addStyle(styles: StyleRule): ClassList;
27
+ addFontFace(fontFace: FontFaceRule | FontFaceRule[]): string;
28
+ addKeyframes(keyframes: CSSKeyframes): string;
29
+ addSourceMapReference({ filePath, identifier, classList, line, column, index }: {
30
+ index: number;
31
+ identifier: string;
32
+ classList: ClassList;
33
+ filePath: string;
34
+ line: number;
35
+ column: number;
36
+ }): string | false;
37
+ generateIdentifier(value: unknown): string;
38
+ renderCssToString(options?: {
39
+ filePaths?: string[];
40
+ usedIds?: UsedIdCache;
41
+ opinionatedLayers?: boolean;
42
+ }): string;
43
+ serialize(): string;
44
+ deserialize(buffer: Buffer | string): Promise<void>;
45
+ setFilePath(filePath: string | undefined): void;
46
+ clearUsedIds(filePath: string): void;
47
+ private addUsedIds;
48
+ getUsedCacheIds(filePaths?: string[]): UsedIdCache;
49
+ }
50
+
51
+ export { ClassList, Engine, Options, Static, UsedIdCache };