Skip to content

Commit

Permalink
Build
Browse files Browse the repository at this point in the history
  • Loading branch information
AyIong committed Aug 5, 2024
1 parent 980a634 commit 08bb103
Show file tree
Hide file tree
Showing 9 changed files with 357 additions and 80 deletions.
5 changes: 5 additions & 0 deletions dist/assets/ImageButton.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 15 additions & 0 deletions dist/common/string.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,21 @@
* ```
*/
export declare function createSearch<TObj>(searchText: string, stringifier?: (obj: TObj) => string): (obj: TObj) => boolean;
export declare const VOWELS: string[];
/**
* Pluralizes a word based on the number given.
* Handles -es and -ies.
*
* @param override - A custom string to be appended instead for plurals. Useful for words that don't follow the standard rules.
*
* @example
* ```tsx
* pluralize('Dog', 1) // Dog
* pluralize('Dog', 2) // Dogs
* pluralize('Monarch', 2, "s") // Monarchs
* ```
*/
export declare function pluralize(str: string, n: number, override?: string): string;
/**
* Capitalizes a word and lowercases the rest.
*
Expand Down
36 changes: 21 additions & 15 deletions dist/common/string.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,20 @@ function p(e, t = (r) => JSON.stringify(r)) {
return o ? o.toLowerCase().includes(r) : !1;
};
}
function a(e) {
const a = ["a", "e", "i", "o", "u"];
function l(e, t, r) {
return t === 1 ? e : r ? e + r : e.endsWith("s") || e.endsWith("x") || e.endsWith("z") || e.endsWith("ch") || e.endsWith("sh") ? e + "es" : e.endsWith("y") && !a.includes(e.charAt(e.length - 2)) ? e.slice(0, -1) + "ies" : e + "s";
}
function c(e) {
return e.charAt(0).toUpperCase() + e.slice(1).toLowerCase();
}
function u(e) {
function f(e) {
return e.replace(/(^\w{1})|(\s+\w{1})/g, (t) => t.toUpperCase());
}
function l(e) {
function h(e) {
return e.replace(/^\w/, (t) => t.toUpperCase());
}
const c = ["Id", "Tv"], s = [
const i = ["Id", "Tv"], s = [
"A",
"An",
"And",
Expand All @@ -39,32 +43,32 @@ const c = ["Id", "Tv"], s = [
"To",
"With"
];
function f(e) {
function g(e) {
if (!e) return e;
let t = e.replace(/([^\W_]+[^\s-]*) */g, (r) => a(r));
let t = e.replace(/([^\W_]+[^\s-]*) */g, (r) => c(r));
for (const r of s) {
const n = new RegExp("\\s" + r + "\\s", "g");
t = t.replace(n, (o) => o.toLowerCase());
}
for (const r of c) {
for (const r of i) {
const n = new RegExp("\\b" + r + "\\b", "g");
t = t.replace(n, (o) => o.toLowerCase());
}
return t;
}
const i = {
const u = {
amp: "&",
apos: "'",
gt: ">",
lt: "<",
nbsp: " ",
quot: '"'
};
function g(e) {
function d(e) {
return e && e.replace(/<br>/gi, `
`).replace(/<\/?[a-z0-9-_]+[^>]*>/gi, "").replace(
/&(nbsp|amp|quot|lt|gt|apos);/g,
(t, r) => i[r]
(t, r) => u[r]
).replace(/&#?([0-9]+);/gi, (t, r) => {
const n = parseInt(r, 10);
return String.fromCharCode(n);
Expand All @@ -74,10 +78,12 @@ function g(e) {
});
}
export {
a as capitalize,
u as capitalizeAll,
l as capitalizeFirst,
a as VOWELS,
c as capitalize,
f as capitalizeAll,
h as capitalizeFirst,
p as createSearch,
g as decodeHtmlEntities,
f as toTitleCase
d as decodeHtmlEntities,
l as pluralize,
g as toTitleCase
};
29 changes: 29 additions & 0 deletions dist/components/ImageButton.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import { Placement } from '@popperjs/core';
import { BooleanLike } from '../common/react';
import { ReactNode } from 'react';
import { BoxProps } from './Box';

type Props = Partial<{
asset: string;
base64: string;
buttons: ReactNode;
buttonsAlt: boolean;
children: ReactNode;
className: string;
color: string;
disabled: BooleanLike;
dmFallback: ReactNode;
dmIcon: string | null;
dmIconState: string | null;
fluid: boolean;
imageSize: number;
imageSrc: string;
onClick: (e: any) => void;
onRightClick: (e: any) => void;
selected: BooleanLike;
title: string;
tooltip: ReactNode;
tooltipPosition: Placement;
}> & BoxProps;
export declare function ImageButton(props: Props): import("react/jsx-runtime").JSX.Element;
export {};
Loading

0 comments on commit 08bb103

Please sign in to comment.