Skip to content

Commit

Permalink
v0.3.13
Browse files Browse the repository at this point in the history
  • Loading branch information
CarcajadaArtificial committed Mar 6, 2024
1 parent d13a3df commit 49faab0
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 16 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Changelog

## v0.3.12
## v0.3.13

- Updated the `<Button />` component's documentation.

Expand Down
2 changes: 1 addition & 1 deletion components/Button/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import setup, { iButton } from './setup.ts';

// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
/**
* Render function for the [`<Button/>`]{@link components/Button} component.
* Render function for the [`<Button/ >`](/components/Button) component.
*
* @param {Partial<iButton>} props
* {@link iButton} (Partial by [design](https://deno.land/x/lunchbox#configure-anything-easily))
Expand Down
10 changes: 6 additions & 4 deletions components/Button/setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ import { transition } from '../../src/styles.ts';
import { css } from '../../deps.ts';

// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
/** Property type of the `<Button />` component. */
export type iButton = iComponent<HTMLButtonElement> & {
/** Properties of the `<Button />` component. */
export type ButtonProps = {
/** If true, expands the width of the button up to its maximum width. */
maxWidth: boolean;
/** If true, the button's paddings will be shorter. */
Expand All @@ -35,8 +35,10 @@ export type iButton = iComponent<HTMLButtonElement> & {
type: ButtonTypes;
};

// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
/** These are the default values of the `<Button />` component's props. */
/** Property type of the `<Button />` component. */
export type iButton = iComponent<HTMLButtonElement> & ButtonProps;

/** Default values of the `<Button />` component's props. */
const defaults: iButton = {
maxWidth: false,
compact: false,
Expand Down
42 changes: 32 additions & 10 deletions src/types.ts
Original file line number Diff line number Diff line change
@@ -1,29 +1,50 @@
// ___ _ _
// | __| |___ _ __ ___ _ _| |_
// | _|| / -_) ' \/ -_) ' \ _|
// |___|_\___|_|_|_\___|_||_\__|
//
// _____
// |_ _| _ _ __ ___ ___
// | || || | '_ \/ -_|_-<
// |_| \_, | .__/\___/__/
// |__/|_|
////////////////////////////////////////////////////////////////////////////////////////////////////////
/**
* This module contains auxiliary types related to HTML Elements and their properties.
* This module contains auxiliary types.
*
* @module
*/

import { JSX, Ref } from 'preact';

export type iComponent<T extends EventTarget = HTMLElement> = iElement<T> & {
/**
* This is a utility type that contains properties that all components must have.
* [See more](https://deno.land/x/lunchbox#configure-anything-easily)
*/
export type GenericComponent<T> = {
/**
* Short for "Forwarded Reference". This prop allows the component to receive a preact reference
* that points to the protagonist HTMLElement in the component.
*/
fref?: Ref<T>;
/** This prop removes the default styles for the component. */
nostyle?: boolean;
/** This prop removes the default styles and all class names for the component. */
nostyleAll?: boolean;
};

/**
* This type is a shorthand for an extension of `JSX.HTMLAttributes<T>`, `Partial<ARIAMixin>`, and ` Partial<GlobalEventHandlers>`.
* This type is used for standarizing all components. By design every component must have a protagonic
* HTMLElement that inherits its attributes, the GenericComponent properties, Aria atributes, and Event
* Handlers.
*/
export type iComponent<T extends EventTarget = HTMLElement> =
& iElement<T>
& GenericComponent<T>;

/**
* This type is a shorthand for an extension of `JSX.HTMLAttributes<T>`, `Partial<ARIAMixin>`, and
* `Partial<GlobalEventHandlers>`.
*/
export type iElement<T extends EventTarget = HTMLElement> =
& JSX.HTMLAttributes<T>
& Partial<ARIAMixin>
& Partial<GlobalEventHandlers>;

/**
* This type is a shorthand that helps in forwarding props and references to a component's part.
*/
Expand All @@ -33,6 +54,7 @@ export type iFwd<T extends EventTarget = HTMLElement> = iElement<T> & {
};

/**
* This type is a shorthand of `Record<string | number | symbol, never>` that `deno-lint(ban-types) recommends as the correct way to express the type of an empty object.`.
* This type is a shorthand of `Record<string | number | symbol, never>` that
* `deno-lint(ban-types) recommends as the correct way to express the type of an empty object.`.
*/
export type EmptyObject = Record<string | number | symbol, never>;

0 comments on commit 49faab0

Please sign in to comment.