mirror of
https://github.com/Wei-Shaw/claude-relay-service.git
synced 2026-01-23 21:17:30 +00:00
chore: update frontend build for v1.1.83 [skip ci]
This commit is contained in:
21
web/admin-spa/node_modules/scule/LICENSE
generated
vendored
Normal file
21
web/admin-spa/node_modules/scule/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) Pooya Parsa <pooya@pi0.io>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
149
web/admin-spa/node_modules/scule/README.md
generated
vendored
Normal file
149
web/admin-spa/node_modules/scule/README.md
generated
vendored
Normal file
@@ -0,0 +1,149 @@
|
||||
# 🧵 Scule
|
||||
|
||||
[![npm version][npm-version-src]][npm-version-href]
|
||||
[![npm downloads][npm-downloads-src]][npm-downloads-href]
|
||||
[![bundle][bundle-src]][bundle-href]
|
||||
[![Codecov][codecov-src]][codecov-href]
|
||||
|
||||
<!--  -->
|
||||
|
||||
## Install
|
||||
|
||||
Install using npm or yarn:
|
||||
|
||||
```bash
|
||||
npm i scule
|
||||
```
|
||||
|
||||
Import:
|
||||
|
||||
```js
|
||||
// CommonJS
|
||||
const { pascalCase } = require("scule");
|
||||
|
||||
// ESM
|
||||
import { pascalCase } from "scule";
|
||||
```
|
||||
|
||||
**Notice:** You may need to transpile package for legacy environments.
|
||||
|
||||
## Utils
|
||||
|
||||
### `pascalCase(str, opts?: { normalize })`
|
||||
|
||||
Splits string and joins by PascalCase convention:
|
||||
|
||||
```ts
|
||||
pascalCase("foo-bar_baz");
|
||||
// FooBarBaz
|
||||
```
|
||||
|
||||
**Notice:** If an uppercase letter is followed by other uppercase letters (like `FooBAR`), they are preserved. You can use `{ normalize: true }` for strictly following pascalCase convention.
|
||||
|
||||
### `camelCase(str, opts?: { normalize })`
|
||||
|
||||
Splits string and joins by camelCase convention:
|
||||
|
||||
```ts
|
||||
camelCase("foo-bar_baz");
|
||||
// fooBarBaz
|
||||
```
|
||||
|
||||
### `kebabCase(str)`
|
||||
|
||||
Splits string and joins by kebab-case convention:
|
||||
|
||||
```ts
|
||||
kebabCase("fooBar_Baz");
|
||||
// foo-bar-baz
|
||||
```
|
||||
|
||||
**Notice:** It does **not** preserve case.
|
||||
|
||||
### `snakeCase`
|
||||
|
||||
Splits string and joins by snake_case convention:
|
||||
|
||||
```ts
|
||||
snakeCase("foo-barBaz");
|
||||
// foo_bar_baz
|
||||
```
|
||||
|
||||
### `flatCase`
|
||||
|
||||
Splits string and joins by flatcase convention:
|
||||
|
||||
```ts
|
||||
flatCase("foo-barBaz");
|
||||
// foobarbaz
|
||||
```
|
||||
|
||||
### `trainCase(str, opts?: { normalize })`
|
||||
|
||||
Split string and joins by Train-Case (a.k.a. HTTP-Header-Case) convention:
|
||||
|
||||
```ts
|
||||
trainCase("FooBARb");
|
||||
// Foo-Ba-Rb
|
||||
```
|
||||
|
||||
**Notice:** If an uppercase letter is followed by other uppercase letters (like `WWWAuthenticate`), they are preserved (=> `WWW-Authenticate`). You can use `{ normalize: true }` for strictly only having the first letter uppercased.
|
||||
|
||||
### `titleCase(str, opts?: { normalize })`
|
||||
|
||||
With Title Case all words are capitalized, except for minor words.
|
||||
A compact regex of common minor words (such as `a`, `for`, `to`) is used to automatically keep them lower case.
|
||||
|
||||
```ts
|
||||
titleCase("this-IS-aTitle");
|
||||
// This is a Title
|
||||
```
|
||||
|
||||
### `upperFirst(str)`
|
||||
|
||||
Converts first character to upper case:
|
||||
|
||||
```ts
|
||||
upperFirst("hello world!");
|
||||
// Hello world!
|
||||
```
|
||||
|
||||
### `lowerFirst(str)`
|
||||
|
||||
Converts first character to lower case:
|
||||
|
||||
```ts
|
||||
lowerFirst("Hello world!");
|
||||
// hello world!
|
||||
```
|
||||
|
||||
### `splitByCase(str, splitters?)`
|
||||
|
||||
- Splits string by the splitters provided (default: `['-', '_', '/', '.']`)
|
||||
- Splits when case changes from lower to upper or upper to lower
|
||||
- Ignores numbers for case changes
|
||||
- Case is preserved in returned value
|
||||
- Is an irreversible function since splitters are omitted
|
||||
|
||||
## Development
|
||||
|
||||
- Clone this repository
|
||||
- Install latest LTS version of [Node.js](https://nodejs.org/en/)
|
||||
- Enable [Corepack](https://github.com/nodejs/corepack) using corepack enable
|
||||
- Install dependencies using pnpm install
|
||||
- Run interactive tests using pnpm dev
|
||||
|
||||
## License
|
||||
|
||||
[MIT](./LICENSE)
|
||||
|
||||
<!-- Badges -->
|
||||
|
||||
[npm-version-src]: https://img.shields.io/npm/v/scule?style=flat&colorA=18181B&colorB=F0DB4F
|
||||
[npm-version-href]: https://npmjs.com/package/scule
|
||||
[npm-downloads-src]: https://img.shields.io/npm/dm/scule?style=flat&colorA=18181B&colorB=F0DB4F
|
||||
[npm-downloads-href]: https://npmjs.com/package/scule
|
||||
[codecov-src]: https://img.shields.io/codecov/c/gh/unjs/scule/main?style=flat&colorA=18181B&colorB=F0DB4F
|
||||
[codecov-href]: https://codecov.io/gh/unjs/scule
|
||||
[bundle-src]: https://img.shields.io/bundlephobia/minzip/scule?style=flat&colorA=18181B&colorB=F0DB4F
|
||||
[bundle-href]: https://bundlephobia.com/result?p=scule
|
||||
92
web/admin-spa/node_modules/scule/dist/index.cjs
generated
vendored
Normal file
92
web/admin-spa/node_modules/scule/dist/index.cjs
generated
vendored
Normal file
@@ -0,0 +1,92 @@
|
||||
'use strict';
|
||||
|
||||
const NUMBER_CHAR_RE = /\d/;
|
||||
const STR_SPLITTERS = ["-", "_", "/", "."];
|
||||
function isUppercase(char = "") {
|
||||
if (NUMBER_CHAR_RE.test(char)) {
|
||||
return void 0;
|
||||
}
|
||||
return char !== char.toLowerCase();
|
||||
}
|
||||
function splitByCase(str, separators) {
|
||||
const splitters = separators ?? STR_SPLITTERS;
|
||||
const parts = [];
|
||||
if (!str || typeof str !== "string") {
|
||||
return parts;
|
||||
}
|
||||
let buff = "";
|
||||
let previousUpper;
|
||||
let previousSplitter;
|
||||
for (const char of str) {
|
||||
const isSplitter = splitters.includes(char);
|
||||
if (isSplitter === true) {
|
||||
parts.push(buff);
|
||||
buff = "";
|
||||
previousUpper = void 0;
|
||||
continue;
|
||||
}
|
||||
const isUpper = isUppercase(char);
|
||||
if (previousSplitter === false) {
|
||||
if (previousUpper === false && isUpper === true) {
|
||||
parts.push(buff);
|
||||
buff = char;
|
||||
previousUpper = isUpper;
|
||||
continue;
|
||||
}
|
||||
if (previousUpper === true && isUpper === false && buff.length > 1) {
|
||||
const lastChar = buff.at(-1);
|
||||
parts.push(buff.slice(0, Math.max(0, buff.length - 1)));
|
||||
buff = lastChar + char;
|
||||
previousUpper = isUpper;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
buff += char;
|
||||
previousUpper = isUpper;
|
||||
previousSplitter = isSplitter;
|
||||
}
|
||||
parts.push(buff);
|
||||
return parts;
|
||||
}
|
||||
function upperFirst(str) {
|
||||
return str ? str[0].toUpperCase() + str.slice(1) : "";
|
||||
}
|
||||
function lowerFirst(str) {
|
||||
return str ? str[0].toLowerCase() + str.slice(1) : "";
|
||||
}
|
||||
function pascalCase(str, opts) {
|
||||
return str ? (Array.isArray(str) ? str : splitByCase(str)).map((p) => upperFirst(opts?.normalize ? p.toLowerCase() : p)).join("") : "";
|
||||
}
|
||||
function camelCase(str, opts) {
|
||||
return lowerFirst(pascalCase(str || "", opts));
|
||||
}
|
||||
function kebabCase(str, joiner) {
|
||||
return str ? (Array.isArray(str) ? str : splitByCase(str)).map((p) => p.toLowerCase()).join(joiner ?? "-") : "";
|
||||
}
|
||||
function snakeCase(str) {
|
||||
return kebabCase(str || "", "_");
|
||||
}
|
||||
function flatCase(str) {
|
||||
return kebabCase(str || "", "");
|
||||
}
|
||||
function trainCase(str, opts) {
|
||||
return (Array.isArray(str) ? str : splitByCase(str)).filter(Boolean).map((p) => upperFirst(opts?.normalize ? p.toLowerCase() : p)).join("-");
|
||||
}
|
||||
const titleCaseExceptions = /^(a|an|and|as|at|but|by|for|if|in|is|nor|of|on|or|the|to|with)$/i;
|
||||
function titleCase(str, opts) {
|
||||
return (Array.isArray(str) ? str : splitByCase(str)).filter(Boolean).map(
|
||||
(p) => titleCaseExceptions.test(p) ? p.toLowerCase() : upperFirst(opts?.normalize ? p.toLowerCase() : p)
|
||||
).join(" ");
|
||||
}
|
||||
|
||||
exports.camelCase = camelCase;
|
||||
exports.flatCase = flatCase;
|
||||
exports.isUppercase = isUppercase;
|
||||
exports.kebabCase = kebabCase;
|
||||
exports.lowerFirst = lowerFirst;
|
||||
exports.pascalCase = pascalCase;
|
||||
exports.snakeCase = snakeCase;
|
||||
exports.splitByCase = splitByCase;
|
||||
exports.titleCase = titleCase;
|
||||
exports.trainCase = trainCase;
|
||||
exports.upperFirst = upperFirst;
|
||||
57
web/admin-spa/node_modules/scule/dist/index.d.cts
generated
vendored
Normal file
57
web/admin-spa/node_modules/scule/dist/index.d.cts
generated
vendored
Normal file
@@ -0,0 +1,57 @@
|
||||
type Splitter = "-" | "_" | "/" | ".";
|
||||
type FirstOfString<S extends string> = S extends `${infer F}${string}` ? F : never;
|
||||
type RemoveFirstOfString<S extends string> = S extends `${string}${infer R}` ? R : never;
|
||||
type IsUpper<S extends string> = S extends Uppercase<S> ? true : false;
|
||||
type IsLower<S extends string> = S extends Lowercase<S> ? true : false;
|
||||
type SameLetterCase<X extends string, Y extends string> = IsUpper<X> extends IsUpper<Y> ? true : IsLower<X> extends IsLower<Y> ? true : false;
|
||||
type CapitalizedWords<T extends readonly string[], Accumulator extends string = "", Normalize extends boolean | undefined = false> = T extends readonly [infer F extends string, ...infer R extends string[]] ? CapitalizedWords<R, `${Accumulator}${Capitalize<Normalize extends true ? Lowercase<F> : F>}`, Normalize> : Accumulator;
|
||||
type JoinLowercaseWords<T extends readonly string[], Joiner extends string, Accumulator extends string = ""> = T extends readonly [infer F extends string, ...infer R extends string[]] ? Accumulator extends "" ? JoinLowercaseWords<R, Joiner, `${Accumulator}${Lowercase<F>}`> : JoinLowercaseWords<R, Joiner, `${Accumulator}${Joiner}${Lowercase<F>}`> : Accumulator;
|
||||
type LastOfArray<T extends any[]> = T extends [...any, infer R] ? R : never;
|
||||
type RemoveLastOfArray<T extends any[]> = T extends [...infer F, any] ? F : never;
|
||||
type CaseOptions = {
|
||||
normalize?: boolean;
|
||||
};
|
||||
type SplitByCase<T, Separator extends string = Splitter, Accumulator extends unknown[] = []> = string extends Separator ? string[] : T extends `${infer F}${infer R}` ? [LastOfArray<Accumulator>] extends [never] ? SplitByCase<R, Separator, [F]> : LastOfArray<Accumulator> extends string ? R extends "" ? SplitByCase<R, Separator, [
|
||||
...RemoveLastOfArray<Accumulator>,
|
||||
`${LastOfArray<Accumulator>}${F}`
|
||||
]> : SameLetterCase<F, FirstOfString<R>> extends true ? F extends Separator ? FirstOfString<R> extends Separator ? SplitByCase<R, Separator, [...Accumulator, ""]> : IsUpper<FirstOfString<R>> extends true ? SplitByCase<RemoveFirstOfString<R>, Separator, [
|
||||
...Accumulator,
|
||||
FirstOfString<R>
|
||||
]> : SplitByCase<R, Separator, [...Accumulator, ""]> : SplitByCase<R, Separator, [
|
||||
...RemoveLastOfArray<Accumulator>,
|
||||
`${LastOfArray<Accumulator>}${F}`
|
||||
]> : IsLower<F> extends true ? SplitByCase<RemoveFirstOfString<R>, Separator, [
|
||||
...RemoveLastOfArray<Accumulator>,
|
||||
`${LastOfArray<Accumulator>}${F}`,
|
||||
FirstOfString<R>
|
||||
]> : SplitByCase<R, Separator, [...Accumulator, F]> : never : Accumulator extends [] ? T extends "" ? [] : string[] : Accumulator;
|
||||
type JoinByCase<T, Joiner extends string> = string extends T ? string : string[] extends T ? string : T extends string ? SplitByCase<T> extends readonly string[] ? JoinLowercaseWords<SplitByCase<T>, Joiner> : never : T extends readonly string[] ? JoinLowercaseWords<T, Joiner> : never;
|
||||
type PascalCase<T, Normalize extends boolean | undefined = false> = string extends T ? string : string[] extends T ? string : T extends string ? SplitByCase<T> extends readonly string[] ? CapitalizedWords<SplitByCase<T>, "", Normalize> : never : T extends readonly string[] ? CapitalizedWords<T, "", Normalize> : never;
|
||||
type CamelCase<T, Normalize extends boolean | undefined = false> = string extends T ? string : string[] extends T ? string : Uncapitalize<PascalCase<T, Normalize>>;
|
||||
type KebabCase<T extends string | readonly string[], Joiner extends string = "-"> = JoinByCase<T, Joiner>;
|
||||
type SnakeCase<T extends string | readonly string[]> = JoinByCase<T, "_">;
|
||||
type TrainCase<T, Normalize extends boolean | undefined = false, Joiner extends string = "-"> = string extends T ? string : string[] extends T ? string : T extends string ? SplitByCase<T> extends readonly string[] ? CapitalizedWords<SplitByCase<T>, Joiner> : never : T extends readonly string[] ? CapitalizedWords<T, Joiner, Normalize> : never;
|
||||
type FlatCase<T extends string | readonly string[], Joiner extends string = ""> = JoinByCase<T, Joiner>;
|
||||
|
||||
declare function isUppercase(char?: string): boolean | undefined;
|
||||
declare function splitByCase<T extends string>(str: T): SplitByCase<T>;
|
||||
declare function splitByCase<T extends string, Separator extends readonly string[]>(str: T, separators: Separator): SplitByCase<T, Separator[number]>;
|
||||
declare function upperFirst<S extends string>(str: S): Capitalize<S>;
|
||||
declare function lowerFirst<S extends string>(str: S): Uncapitalize<S>;
|
||||
declare function pascalCase(): "";
|
||||
declare function pascalCase<T extends string | readonly string[], UserCaseOptions extends CaseOptions = CaseOptions>(str: T, opts?: CaseOptions): PascalCase<T, UserCaseOptions["normalize"]>;
|
||||
declare function camelCase(): "";
|
||||
declare function camelCase<T extends string | readonly string[], UserCaseOptions extends CaseOptions = CaseOptions>(str: T, opts?: UserCaseOptions): CamelCase<T, UserCaseOptions["normalize"]>;
|
||||
declare function kebabCase(): "";
|
||||
declare function kebabCase<T extends string | readonly string[]>(str: T): KebabCase<T>;
|
||||
declare function kebabCase<T extends string | readonly string[], Joiner extends string>(str: T, joiner: Joiner): KebabCase<T, Joiner>;
|
||||
declare function snakeCase(): "";
|
||||
declare function snakeCase<T extends string | readonly string[]>(str: T): SnakeCase<T>;
|
||||
declare function flatCase(): "";
|
||||
declare function flatCase<T extends string | readonly string[]>(str: T): FlatCase<T>;
|
||||
declare function trainCase(): "";
|
||||
declare function trainCase<T extends string | readonly string[], UserCaseOptions extends CaseOptions = CaseOptions>(str: T, opts?: UserCaseOptions): TrainCase<T, UserCaseOptions["normalize"]>;
|
||||
declare function titleCase(): "";
|
||||
declare function titleCase<T extends string | readonly string[], UserCaseOptions extends CaseOptions = CaseOptions>(str: T, opts?: UserCaseOptions): TrainCase<T, UserCaseOptions["normalize"], " ">;
|
||||
|
||||
export { type CamelCase, type CaseOptions, type FlatCase, type JoinByCase, type KebabCase, type PascalCase, type SnakeCase, type SplitByCase, type TrainCase, camelCase, flatCase, isUppercase, kebabCase, lowerFirst, pascalCase, snakeCase, splitByCase, titleCase, trainCase, upperFirst };
|
||||
57
web/admin-spa/node_modules/scule/dist/index.d.mts
generated
vendored
Normal file
57
web/admin-spa/node_modules/scule/dist/index.d.mts
generated
vendored
Normal file
@@ -0,0 +1,57 @@
|
||||
type Splitter = "-" | "_" | "/" | ".";
|
||||
type FirstOfString<S extends string> = S extends `${infer F}${string}` ? F : never;
|
||||
type RemoveFirstOfString<S extends string> = S extends `${string}${infer R}` ? R : never;
|
||||
type IsUpper<S extends string> = S extends Uppercase<S> ? true : false;
|
||||
type IsLower<S extends string> = S extends Lowercase<S> ? true : false;
|
||||
type SameLetterCase<X extends string, Y extends string> = IsUpper<X> extends IsUpper<Y> ? true : IsLower<X> extends IsLower<Y> ? true : false;
|
||||
type CapitalizedWords<T extends readonly string[], Accumulator extends string = "", Normalize extends boolean | undefined = false> = T extends readonly [infer F extends string, ...infer R extends string[]] ? CapitalizedWords<R, `${Accumulator}${Capitalize<Normalize extends true ? Lowercase<F> : F>}`, Normalize> : Accumulator;
|
||||
type JoinLowercaseWords<T extends readonly string[], Joiner extends string, Accumulator extends string = ""> = T extends readonly [infer F extends string, ...infer R extends string[]] ? Accumulator extends "" ? JoinLowercaseWords<R, Joiner, `${Accumulator}${Lowercase<F>}`> : JoinLowercaseWords<R, Joiner, `${Accumulator}${Joiner}${Lowercase<F>}`> : Accumulator;
|
||||
type LastOfArray<T extends any[]> = T extends [...any, infer R] ? R : never;
|
||||
type RemoveLastOfArray<T extends any[]> = T extends [...infer F, any] ? F : never;
|
||||
type CaseOptions = {
|
||||
normalize?: boolean;
|
||||
};
|
||||
type SplitByCase<T, Separator extends string = Splitter, Accumulator extends unknown[] = []> = string extends Separator ? string[] : T extends `${infer F}${infer R}` ? [LastOfArray<Accumulator>] extends [never] ? SplitByCase<R, Separator, [F]> : LastOfArray<Accumulator> extends string ? R extends "" ? SplitByCase<R, Separator, [
|
||||
...RemoveLastOfArray<Accumulator>,
|
||||
`${LastOfArray<Accumulator>}${F}`
|
||||
]> : SameLetterCase<F, FirstOfString<R>> extends true ? F extends Separator ? FirstOfString<R> extends Separator ? SplitByCase<R, Separator, [...Accumulator, ""]> : IsUpper<FirstOfString<R>> extends true ? SplitByCase<RemoveFirstOfString<R>, Separator, [
|
||||
...Accumulator,
|
||||
FirstOfString<R>
|
||||
]> : SplitByCase<R, Separator, [...Accumulator, ""]> : SplitByCase<R, Separator, [
|
||||
...RemoveLastOfArray<Accumulator>,
|
||||
`${LastOfArray<Accumulator>}${F}`
|
||||
]> : IsLower<F> extends true ? SplitByCase<RemoveFirstOfString<R>, Separator, [
|
||||
...RemoveLastOfArray<Accumulator>,
|
||||
`${LastOfArray<Accumulator>}${F}`,
|
||||
FirstOfString<R>
|
||||
]> : SplitByCase<R, Separator, [...Accumulator, F]> : never : Accumulator extends [] ? T extends "" ? [] : string[] : Accumulator;
|
||||
type JoinByCase<T, Joiner extends string> = string extends T ? string : string[] extends T ? string : T extends string ? SplitByCase<T> extends readonly string[] ? JoinLowercaseWords<SplitByCase<T>, Joiner> : never : T extends readonly string[] ? JoinLowercaseWords<T, Joiner> : never;
|
||||
type PascalCase<T, Normalize extends boolean | undefined = false> = string extends T ? string : string[] extends T ? string : T extends string ? SplitByCase<T> extends readonly string[] ? CapitalizedWords<SplitByCase<T>, "", Normalize> : never : T extends readonly string[] ? CapitalizedWords<T, "", Normalize> : never;
|
||||
type CamelCase<T, Normalize extends boolean | undefined = false> = string extends T ? string : string[] extends T ? string : Uncapitalize<PascalCase<T, Normalize>>;
|
||||
type KebabCase<T extends string | readonly string[], Joiner extends string = "-"> = JoinByCase<T, Joiner>;
|
||||
type SnakeCase<T extends string | readonly string[]> = JoinByCase<T, "_">;
|
||||
type TrainCase<T, Normalize extends boolean | undefined = false, Joiner extends string = "-"> = string extends T ? string : string[] extends T ? string : T extends string ? SplitByCase<T> extends readonly string[] ? CapitalizedWords<SplitByCase<T>, Joiner> : never : T extends readonly string[] ? CapitalizedWords<T, Joiner, Normalize> : never;
|
||||
type FlatCase<T extends string | readonly string[], Joiner extends string = ""> = JoinByCase<T, Joiner>;
|
||||
|
||||
declare function isUppercase(char?: string): boolean | undefined;
|
||||
declare function splitByCase<T extends string>(str: T): SplitByCase<T>;
|
||||
declare function splitByCase<T extends string, Separator extends readonly string[]>(str: T, separators: Separator): SplitByCase<T, Separator[number]>;
|
||||
declare function upperFirst<S extends string>(str: S): Capitalize<S>;
|
||||
declare function lowerFirst<S extends string>(str: S): Uncapitalize<S>;
|
||||
declare function pascalCase(): "";
|
||||
declare function pascalCase<T extends string | readonly string[], UserCaseOptions extends CaseOptions = CaseOptions>(str: T, opts?: CaseOptions): PascalCase<T, UserCaseOptions["normalize"]>;
|
||||
declare function camelCase(): "";
|
||||
declare function camelCase<T extends string | readonly string[], UserCaseOptions extends CaseOptions = CaseOptions>(str: T, opts?: UserCaseOptions): CamelCase<T, UserCaseOptions["normalize"]>;
|
||||
declare function kebabCase(): "";
|
||||
declare function kebabCase<T extends string | readonly string[]>(str: T): KebabCase<T>;
|
||||
declare function kebabCase<T extends string | readonly string[], Joiner extends string>(str: T, joiner: Joiner): KebabCase<T, Joiner>;
|
||||
declare function snakeCase(): "";
|
||||
declare function snakeCase<T extends string | readonly string[]>(str: T): SnakeCase<T>;
|
||||
declare function flatCase(): "";
|
||||
declare function flatCase<T extends string | readonly string[]>(str: T): FlatCase<T>;
|
||||
declare function trainCase(): "";
|
||||
declare function trainCase<T extends string | readonly string[], UserCaseOptions extends CaseOptions = CaseOptions>(str: T, opts?: UserCaseOptions): TrainCase<T, UserCaseOptions["normalize"]>;
|
||||
declare function titleCase(): "";
|
||||
declare function titleCase<T extends string | readonly string[], UserCaseOptions extends CaseOptions = CaseOptions>(str: T, opts?: UserCaseOptions): TrainCase<T, UserCaseOptions["normalize"], " ">;
|
||||
|
||||
export { type CamelCase, type CaseOptions, type FlatCase, type JoinByCase, type KebabCase, type PascalCase, type SnakeCase, type SplitByCase, type TrainCase, camelCase, flatCase, isUppercase, kebabCase, lowerFirst, pascalCase, snakeCase, splitByCase, titleCase, trainCase, upperFirst };
|
||||
57
web/admin-spa/node_modules/scule/dist/index.d.ts
generated
vendored
Normal file
57
web/admin-spa/node_modules/scule/dist/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,57 @@
|
||||
type Splitter = "-" | "_" | "/" | ".";
|
||||
type FirstOfString<S extends string> = S extends `${infer F}${string}` ? F : never;
|
||||
type RemoveFirstOfString<S extends string> = S extends `${string}${infer R}` ? R : never;
|
||||
type IsUpper<S extends string> = S extends Uppercase<S> ? true : false;
|
||||
type IsLower<S extends string> = S extends Lowercase<S> ? true : false;
|
||||
type SameLetterCase<X extends string, Y extends string> = IsUpper<X> extends IsUpper<Y> ? true : IsLower<X> extends IsLower<Y> ? true : false;
|
||||
type CapitalizedWords<T extends readonly string[], Accumulator extends string = "", Normalize extends boolean | undefined = false> = T extends readonly [infer F extends string, ...infer R extends string[]] ? CapitalizedWords<R, `${Accumulator}${Capitalize<Normalize extends true ? Lowercase<F> : F>}`, Normalize> : Accumulator;
|
||||
type JoinLowercaseWords<T extends readonly string[], Joiner extends string, Accumulator extends string = ""> = T extends readonly [infer F extends string, ...infer R extends string[]] ? Accumulator extends "" ? JoinLowercaseWords<R, Joiner, `${Accumulator}${Lowercase<F>}`> : JoinLowercaseWords<R, Joiner, `${Accumulator}${Joiner}${Lowercase<F>}`> : Accumulator;
|
||||
type LastOfArray<T extends any[]> = T extends [...any, infer R] ? R : never;
|
||||
type RemoveLastOfArray<T extends any[]> = T extends [...infer F, any] ? F : never;
|
||||
type CaseOptions = {
|
||||
normalize?: boolean;
|
||||
};
|
||||
type SplitByCase<T, Separator extends string = Splitter, Accumulator extends unknown[] = []> = string extends Separator ? string[] : T extends `${infer F}${infer R}` ? [LastOfArray<Accumulator>] extends [never] ? SplitByCase<R, Separator, [F]> : LastOfArray<Accumulator> extends string ? R extends "" ? SplitByCase<R, Separator, [
|
||||
...RemoveLastOfArray<Accumulator>,
|
||||
`${LastOfArray<Accumulator>}${F}`
|
||||
]> : SameLetterCase<F, FirstOfString<R>> extends true ? F extends Separator ? FirstOfString<R> extends Separator ? SplitByCase<R, Separator, [...Accumulator, ""]> : IsUpper<FirstOfString<R>> extends true ? SplitByCase<RemoveFirstOfString<R>, Separator, [
|
||||
...Accumulator,
|
||||
FirstOfString<R>
|
||||
]> : SplitByCase<R, Separator, [...Accumulator, ""]> : SplitByCase<R, Separator, [
|
||||
...RemoveLastOfArray<Accumulator>,
|
||||
`${LastOfArray<Accumulator>}${F}`
|
||||
]> : IsLower<F> extends true ? SplitByCase<RemoveFirstOfString<R>, Separator, [
|
||||
...RemoveLastOfArray<Accumulator>,
|
||||
`${LastOfArray<Accumulator>}${F}`,
|
||||
FirstOfString<R>
|
||||
]> : SplitByCase<R, Separator, [...Accumulator, F]> : never : Accumulator extends [] ? T extends "" ? [] : string[] : Accumulator;
|
||||
type JoinByCase<T, Joiner extends string> = string extends T ? string : string[] extends T ? string : T extends string ? SplitByCase<T> extends readonly string[] ? JoinLowercaseWords<SplitByCase<T>, Joiner> : never : T extends readonly string[] ? JoinLowercaseWords<T, Joiner> : never;
|
||||
type PascalCase<T, Normalize extends boolean | undefined = false> = string extends T ? string : string[] extends T ? string : T extends string ? SplitByCase<T> extends readonly string[] ? CapitalizedWords<SplitByCase<T>, "", Normalize> : never : T extends readonly string[] ? CapitalizedWords<T, "", Normalize> : never;
|
||||
type CamelCase<T, Normalize extends boolean | undefined = false> = string extends T ? string : string[] extends T ? string : Uncapitalize<PascalCase<T, Normalize>>;
|
||||
type KebabCase<T extends string | readonly string[], Joiner extends string = "-"> = JoinByCase<T, Joiner>;
|
||||
type SnakeCase<T extends string | readonly string[]> = JoinByCase<T, "_">;
|
||||
type TrainCase<T, Normalize extends boolean | undefined = false, Joiner extends string = "-"> = string extends T ? string : string[] extends T ? string : T extends string ? SplitByCase<T> extends readonly string[] ? CapitalizedWords<SplitByCase<T>, Joiner> : never : T extends readonly string[] ? CapitalizedWords<T, Joiner, Normalize> : never;
|
||||
type FlatCase<T extends string | readonly string[], Joiner extends string = ""> = JoinByCase<T, Joiner>;
|
||||
|
||||
declare function isUppercase(char?: string): boolean | undefined;
|
||||
declare function splitByCase<T extends string>(str: T): SplitByCase<T>;
|
||||
declare function splitByCase<T extends string, Separator extends readonly string[]>(str: T, separators: Separator): SplitByCase<T, Separator[number]>;
|
||||
declare function upperFirst<S extends string>(str: S): Capitalize<S>;
|
||||
declare function lowerFirst<S extends string>(str: S): Uncapitalize<S>;
|
||||
declare function pascalCase(): "";
|
||||
declare function pascalCase<T extends string | readonly string[], UserCaseOptions extends CaseOptions = CaseOptions>(str: T, opts?: CaseOptions): PascalCase<T, UserCaseOptions["normalize"]>;
|
||||
declare function camelCase(): "";
|
||||
declare function camelCase<T extends string | readonly string[], UserCaseOptions extends CaseOptions = CaseOptions>(str: T, opts?: UserCaseOptions): CamelCase<T, UserCaseOptions["normalize"]>;
|
||||
declare function kebabCase(): "";
|
||||
declare function kebabCase<T extends string | readonly string[]>(str: T): KebabCase<T>;
|
||||
declare function kebabCase<T extends string | readonly string[], Joiner extends string>(str: T, joiner: Joiner): KebabCase<T, Joiner>;
|
||||
declare function snakeCase(): "";
|
||||
declare function snakeCase<T extends string | readonly string[]>(str: T): SnakeCase<T>;
|
||||
declare function flatCase(): "";
|
||||
declare function flatCase<T extends string | readonly string[]>(str: T): FlatCase<T>;
|
||||
declare function trainCase(): "";
|
||||
declare function trainCase<T extends string | readonly string[], UserCaseOptions extends CaseOptions = CaseOptions>(str: T, opts?: UserCaseOptions): TrainCase<T, UserCaseOptions["normalize"]>;
|
||||
declare function titleCase(): "";
|
||||
declare function titleCase<T extends string | readonly string[], UserCaseOptions extends CaseOptions = CaseOptions>(str: T, opts?: UserCaseOptions): TrainCase<T, UserCaseOptions["normalize"], " ">;
|
||||
|
||||
export { type CamelCase, type CaseOptions, type FlatCase, type JoinByCase, type KebabCase, type PascalCase, type SnakeCase, type SplitByCase, type TrainCase, camelCase, flatCase, isUppercase, kebabCase, lowerFirst, pascalCase, snakeCase, splitByCase, titleCase, trainCase, upperFirst };
|
||||
80
web/admin-spa/node_modules/scule/dist/index.mjs
generated
vendored
Normal file
80
web/admin-spa/node_modules/scule/dist/index.mjs
generated
vendored
Normal file
@@ -0,0 +1,80 @@
|
||||
const NUMBER_CHAR_RE = /\d/;
|
||||
const STR_SPLITTERS = ["-", "_", "/", "."];
|
||||
function isUppercase(char = "") {
|
||||
if (NUMBER_CHAR_RE.test(char)) {
|
||||
return void 0;
|
||||
}
|
||||
return char !== char.toLowerCase();
|
||||
}
|
||||
function splitByCase(str, separators) {
|
||||
const splitters = separators ?? STR_SPLITTERS;
|
||||
const parts = [];
|
||||
if (!str || typeof str !== "string") {
|
||||
return parts;
|
||||
}
|
||||
let buff = "";
|
||||
let previousUpper;
|
||||
let previousSplitter;
|
||||
for (const char of str) {
|
||||
const isSplitter = splitters.includes(char);
|
||||
if (isSplitter === true) {
|
||||
parts.push(buff);
|
||||
buff = "";
|
||||
previousUpper = void 0;
|
||||
continue;
|
||||
}
|
||||
const isUpper = isUppercase(char);
|
||||
if (previousSplitter === false) {
|
||||
if (previousUpper === false && isUpper === true) {
|
||||
parts.push(buff);
|
||||
buff = char;
|
||||
previousUpper = isUpper;
|
||||
continue;
|
||||
}
|
||||
if (previousUpper === true && isUpper === false && buff.length > 1) {
|
||||
const lastChar = buff.at(-1);
|
||||
parts.push(buff.slice(0, Math.max(0, buff.length - 1)));
|
||||
buff = lastChar + char;
|
||||
previousUpper = isUpper;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
buff += char;
|
||||
previousUpper = isUpper;
|
||||
previousSplitter = isSplitter;
|
||||
}
|
||||
parts.push(buff);
|
||||
return parts;
|
||||
}
|
||||
function upperFirst(str) {
|
||||
return str ? str[0].toUpperCase() + str.slice(1) : "";
|
||||
}
|
||||
function lowerFirst(str) {
|
||||
return str ? str[0].toLowerCase() + str.slice(1) : "";
|
||||
}
|
||||
function pascalCase(str, opts) {
|
||||
return str ? (Array.isArray(str) ? str : splitByCase(str)).map((p) => upperFirst(opts?.normalize ? p.toLowerCase() : p)).join("") : "";
|
||||
}
|
||||
function camelCase(str, opts) {
|
||||
return lowerFirst(pascalCase(str || "", opts));
|
||||
}
|
||||
function kebabCase(str, joiner) {
|
||||
return str ? (Array.isArray(str) ? str : splitByCase(str)).map((p) => p.toLowerCase()).join(joiner ?? "-") : "";
|
||||
}
|
||||
function snakeCase(str) {
|
||||
return kebabCase(str || "", "_");
|
||||
}
|
||||
function flatCase(str) {
|
||||
return kebabCase(str || "", "");
|
||||
}
|
||||
function trainCase(str, opts) {
|
||||
return (Array.isArray(str) ? str : splitByCase(str)).filter(Boolean).map((p) => upperFirst(opts?.normalize ? p.toLowerCase() : p)).join("-");
|
||||
}
|
||||
const titleCaseExceptions = /^(a|an|and|as|at|but|by|for|if|in|is|nor|of|on|or|the|to|with)$/i;
|
||||
function titleCase(str, opts) {
|
||||
return (Array.isArray(str) ? str : splitByCase(str)).filter(Boolean).map(
|
||||
(p) => titleCaseExceptions.test(p) ? p.toLowerCase() : upperFirst(opts?.normalize ? p.toLowerCase() : p)
|
||||
).join(" ");
|
||||
}
|
||||
|
||||
export { camelCase, flatCase, isUppercase, kebabCase, lowerFirst, pascalCase, snakeCase, splitByCase, titleCase, trainCase, upperFirst };
|
||||
43
web/admin-spa/node_modules/scule/package.json
generated
vendored
Normal file
43
web/admin-spa/node_modules/scule/package.json
generated
vendored
Normal file
@@ -0,0 +1,43 @@
|
||||
{
|
||||
"name": "scule",
|
||||
"version": "1.3.0",
|
||||
"description": "String case utils",
|
||||
"repository": "unjs/scule",
|
||||
"license": "MIT",
|
||||
"sideEffects": false,
|
||||
"exports": {
|
||||
".": {
|
||||
"types": "./dist/index.d.ts",
|
||||
"require": "./dist/index.cjs",
|
||||
"import": "./dist/index.mjs"
|
||||
},
|
||||
"./*": "./*"
|
||||
},
|
||||
"main": "./dist/index.cjs",
|
||||
"module": "./dist/index.mjs",
|
||||
"types": "./dist/index.d.ts",
|
||||
"files": [
|
||||
"dist"
|
||||
],
|
||||
"scripts": {
|
||||
"build": "unbuild",
|
||||
"dev": "vitest dev --typecheck",
|
||||
"lint": "eslint --cache --ext .ts,.js,.mjs,.cjs . && prettier -c src test",
|
||||
"lint:fix": "eslint --cache --ext .ts,.js,.mjs,.cjs . --fix && prettier -c src test -w",
|
||||
"prepack": "pnpm run build",
|
||||
"release": "pnpm test && changelogen --release --push && npm publish",
|
||||
"test": "pnpm lint && vitest run --typecheck --coverage"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^20.11.3",
|
||||
"@vitest/coverage-v8": "^1.2.0",
|
||||
"changelogen": "^0.5.5",
|
||||
"eslint": "^8.56.0",
|
||||
"eslint-config-unjs": "^0.2.1",
|
||||
"prettier": "^3.2.2",
|
||||
"typescript": "^5.3.3",
|
||||
"unbuild": "^2.0.0",
|
||||
"vitest": "^1.2.0"
|
||||
},
|
||||
"packageManager": "pnpm@8.14.1"
|
||||
}
|
||||
Reference in New Issue
Block a user