Skip to content

Commit

Permalink
feat(core): rename types of Config to GenerateConfig
Browse files Browse the repository at this point in the history
  • Loading branch information
TomokiMiyauci committed Mar 22, 2022
1 parent 275b0c0 commit 9098f79
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 13 deletions.
6 changes: 3 additions & 3 deletions _e2e/preset_svg/css_test.ts
@@ -1,10 +1,10 @@
import { Config, generate } from "../../core/mod.ts";
import { generate, GenerateConfig } from "../../core/mod.ts";
import { presetSVG } from "../../preset_svg/mod.ts";

import { expect, test } from "../../dev_deps.ts";

test("presetSVG generation test", () => {
const config: Config = {
const config: GenerateConfig = {
preset: [presetSVG({
carbon: {
"3d-curve-auto-colon":
Expand All @@ -29,7 +29,7 @@ test("presetSVG generation test", () => {
});

test("color mode is static", () => {
const config: Config = {
const config: GenerateConfig = {
preset: [presetSVG({
carbon: {
"3d-curve-auto-colon":
Expand Down
9 changes: 8 additions & 1 deletion core/generate.ts
Expand Up @@ -9,13 +9,20 @@ import {
} from "./postcss/mod.ts";
import { createInjectCSS } from "./preprocess.ts";
import { CHAR_MAP, SEPARATOR, VARIABLE_PREFIX } from "./constant.ts";
import type { Config, RuntimeContext, StaticContext, Syntax } from "./types.ts";
import type {
RuntimeContext,
StaticConfig,
StaticContext,
Syntax,
} from "./types.ts";

const defaultSyntax: Syntax = {
name: "mapcss/default-syntax",
fn: (identifier) => ({ identifier }),
};

export type Config = Partial<StaticConfig & StaticContext>;

export type Option = {};

export type Result = {
Expand Down
3 changes: 1 addition & 2 deletions core/generate_test.ts
@@ -1,6 +1,5 @@
import { generate, mapChar } from "./generate.ts";
import { Config, generate, mapChar } from "./generate.ts";
import { expect, test } from "../dev_deps.ts";
import type { Config } from "./types.ts";
test("mapChar", () => {
const table: [
...Parameters<typeof mapChar>,
Expand Down
1 change: 1 addition & 0 deletions core/mod.ts
@@ -1,5 +1,6 @@
export { generate } from "./generate.ts";
export type {
Config as GenerateConfig,
Option as GenerateOption,
Result as GenerateResult,
} from "./generate.ts";
Expand Down
2 changes: 0 additions & 2 deletions core/types.ts
Expand Up @@ -102,8 +102,6 @@ export type RuntimeContext = {
className: string;
};

export type Config = Partial<StaticConfig & StaticContext>;

export type SyntaxContext = StaticContext & {
modifierRoots: string[];
identifierRoots: string[];
Expand Down
4 changes: 2 additions & 2 deletions preset_svg/README.md
Expand Up @@ -6,8 +6,8 @@

```ts
import {
type Config,
generate,
type GenerateConfig,
} from "https://deno.land/x/mapcss@$VERSION/core/mod.ts";
import {
iconifyJSON,
Expand All @@ -17,7 +17,7 @@ import carbon from "https://esm.sh/@iconify-json/carbon/icons.json" assert {
type: "json",
};

const config: Config = {
const config: GenerateConfig = {
preset: [presetSVG({
carbon: iconifyJSON(carbon),
bitcoin: "<svg ...</svg>",
Expand Down
6 changes: 3 additions & 3 deletions preset_typography/README.md
Expand Up @@ -6,16 +6,16 @@

```ts
import {
type Config,
generate,
type GenerateConfig,
} from "https://deno.land/x/mapcss@$VERSION/core/mod.ts";
import { presetTypography } from "https://deno.land/x/mapcss@$VERSION/preset_typography/mod.ts";

const config: Config = {
const config: GenerateConfig = {
preset: [presetTypography()],
};

// generate(config, "prose").css;
// generate("prose", config).css;
```

## Feature
Expand Down

0 comments on commit 9098f79

Please sign in to comment.