@navita/adapter 0.1.0 → 3.0.0-next.1
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/index.cjs +14 -16
- package/index.d.ts +19 -18
- package/package.json +1 -1
package/index.cjs
CHANGED
|
@@ -1,34 +1,32 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
let adapter
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
//#region src/index.ts
|
|
3
|
+
let adapter;
|
|
4
4
|
function getAdapter() {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
}
|
|
8
|
-
return adapter;
|
|
5
|
+
if (!adapter) throw new Error("Could not find an adapter. Please ensure you have added a bundler integration:\nhttps://navita.style/#bundler-integration");
|
|
6
|
+
return adapter;
|
|
9
7
|
}
|
|
10
|
-
const setAdapter = (newAdapter)=>{
|
|
11
|
-
|
|
8
|
+
const setAdapter = (newAdapter) => {
|
|
9
|
+
adapter = newAdapter;
|
|
12
10
|
};
|
|
13
11
|
function generateIdentifier(value) {
|
|
14
|
-
|
|
12
|
+
return getAdapter().generateIdentifier(value);
|
|
15
13
|
}
|
|
16
14
|
function addCss(css) {
|
|
17
|
-
|
|
15
|
+
return getAdapter().addCss(css);
|
|
18
16
|
}
|
|
19
17
|
function addStaticCss(selector, css) {
|
|
20
|
-
|
|
18
|
+
return getAdapter().addStaticCss(selector, css);
|
|
21
19
|
}
|
|
22
20
|
function addKeyframe(keyframe) {
|
|
23
|
-
|
|
21
|
+
return getAdapter().addKeyframe(keyframe);
|
|
24
22
|
}
|
|
25
23
|
function addFontFace(fontFace) {
|
|
26
|
-
|
|
24
|
+
return getAdapter().addFontFace(fontFace);
|
|
27
25
|
}
|
|
28
26
|
function collectResult(input) {
|
|
29
|
-
|
|
27
|
+
return getAdapter().collectResult?.(input);
|
|
30
28
|
}
|
|
31
|
-
|
|
29
|
+
//#endregion
|
|
32
30
|
exports.addCss = addCss;
|
|
33
31
|
exports.addFontFace = addFontFace;
|
|
34
32
|
exports.addKeyframe = addKeyframe;
|
package/index.d.ts
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { CSSKeyframes, FontFaceRule, GlobalStyleRule, StyleRule } from "@navita/types";
|
|
2
2
|
|
|
3
|
+
//#region src/index.d.ts
|
|
3
4
|
type Adapter = {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
5
|
+
generateIdentifier: typeof generateIdentifier;
|
|
6
|
+
addCss: typeof addCss;
|
|
7
|
+
addStaticCss: typeof addStaticCss;
|
|
8
|
+
addKeyframe: typeof addKeyframe;
|
|
9
|
+
addFontFace: typeof addFontFace;
|
|
10
|
+
collectResult?: typeof collectResult;
|
|
10
11
|
};
|
|
11
12
|
declare const setAdapter: (newAdapter: Adapter) => void;
|
|
12
13
|
declare function generateIdentifier(value: unknown): string;
|
|
@@ -18,15 +19,15 @@ type Start = number;
|
|
|
18
19
|
type End = number;
|
|
19
20
|
type Position = [Start, End];
|
|
20
21
|
declare function collectResult<T>(input: {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
22
|
+
filePath: string;
|
|
23
|
+
index: number;
|
|
24
|
+
result: () => T;
|
|
25
|
+
identifier: string;
|
|
26
|
+
position: Position;
|
|
27
|
+
sourceMap: {
|
|
28
|
+
line: number;
|
|
29
|
+
column: number;
|
|
30
|
+
};
|
|
30
31
|
}): T;
|
|
31
|
-
|
|
32
|
-
export { Adapter, addCss, addFontFace, addKeyframe, addStaticCss, collectResult, generateIdentifier, setAdapter };
|
|
32
|
+
//#endregion
|
|
33
|
+
export { Adapter, addCss, addFontFace, addKeyframe, addStaticCss, collectResult, generateIdentifier, setAdapter };
|