Skip to content

Commit

Permalink
chore: add more jsdocs
Browse files Browse the repository at this point in the history
  • Loading branch information
johnchourajr committed May 30, 2024
1 parent e6d9cd4 commit 8061b4f
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 1 deletion.
2 changes: 1 addition & 1 deletion jsr.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@buen/type",
"version": "1.0.11",
"version": "1.0.12",
"exports": "./src/index.ts",
"publish": {
"include": ["src/**/*.ts", "src/defaults.ts", "src/types.ts", "README.md"],
Expand Down
6 changes: 6 additions & 0 deletions src/defaults.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import { TypeDefinitionHeadlines, TypeDefinitionTexts } from "./types.ts";

/**
* Default headline object
*/
export const DEFAULT_HEADLINE: TypeDefinitionHeadlines = {
"display-xxl": {
_className: "headline-display-xxl",
Expand Down Expand Up @@ -45,6 +48,9 @@ export const DEFAULT_HEADLINE: TypeDefinitionHeadlines = {
},
};

/**
* Default text object
*/
export const DEFAULT_TEXT: TypeDefinitionTexts = {
title: {
_className: "text-title",
Expand Down
30 changes: 30 additions & 0 deletions src/types.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@

/**
* Default headline types, e.g. `display-xxl`, `display-xl`, etc.
*/
export type DefaultHeadlineTypes =
| "display-xxl"
| "display-xl"
Expand All @@ -6,13 +10,22 @@ export type DefaultHeadlineTypes =
| "display-sm"
| "display-xs";

/**
* Default text types, e.g. `title`, `paragraph`, etc.
*/
export type DefaultTextTypes =
| "title"
| "paragraph"
| "string"
| "body"
| "caption";

/**
* Type definition properties
*
* @todo explore adding more properties,
* @todo refactor to import types from @react/types
*/
export type TypeDefinition = {
_className?: string;
fontFamily?: string;
Expand All @@ -24,6 +37,11 @@ export type TypeDefinition = {
clamp?: [number, number];
};

/**
* CSS output properties, mirrors TypeDefinition excluding clamp and _className
*
* @todo refactor to reference TypeDefinition and exclude _className and clamp
*/
export type CSSOutput = {
fontFamily?: string;
fontWeight?: string | number;
Expand All @@ -33,15 +51,27 @@ export type CSSOutput = {
fontSize?: string;
};

/**
* Type definitions object
*/
export type TypeDefinitions = Record<string, TypeDefinition>;

/**
* Default type definitions for headlines
*/
export type TypeDefinitionHeadlines = Record<
DefaultHeadlineTypes,
TypeDefinition
>;

/**
* Default type definitions for text elements
*/
export type TypeDefinitionTexts = Record<DefaultTextTypes, TypeDefinition>;

/**
* Custom type definitions for headlines and texts.
*/
export type CustomTypeDefinitions = {
customHeadlines?: Record<string, TypeDefinition>;
customTexts?: Record<string, TypeDefinition>;
Expand Down
1 change: 1 addition & 0 deletions src/utils/createRemClamp.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/**
* A module that provides a function to create a `rem`-based `clamp` function.
*
* @param minFontSize - The minimum font size in rem
* @param maxFontSize - The maximum font size in rem
Expand Down

0 comments on commit 8061b4f

Please sign in to comment.