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