Initial commit with Advoware proxy

This commit is contained in:
root
2025-10-19 14:57:07 +00:00
commit 273aa8b549
45771 changed files with 5534555 additions and 0 deletions

View File

@@ -0,0 +1,7 @@
Copyright © Jorge Bucaran <<https://jorgebucaran.com>>
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.

View File

@@ -0,0 +1,88 @@
# Classcat
> Build a [`class`](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/class) attribute string quickly.
- Framework agnostic, reusable, plain vanilla JavaScript.
- Up to [2.5x faster](#benchmarks) than alternatives.
- [217 B](http://bundlephobia.com/result?p=classcat) (minified+gzipped). 👌
This module makes it easy to build a space-delimited `class` attribute string from an object or array of CSS class names. Just pair each class with a boolean value to add or remove them conditionally.
```js
import cc from "classcat"
export const ToggleButton = ({ isOn, toggle }) => (
<div className="btn" onClick={() => toggle(!isOn)}>
<div
className={cc({
circle: true,
off: !isOn,
on: isOn,
})}
/>
<span className={cc({ textOff: !isOn })}>{isOn ? "ON" : "OFF"}</span>
</div>
)
```
[Try with React](https://codepen.io/jorgebucaran/pen/NYgLwG?editors=0010), [lit-html](https://codepen.io/jorgebucaran/pen/LjPJEp?editors=1000), [Mithril](https://codepen.io/jorgebucaran/pen/JjjOjwB?editors=1100), [Superfine](https://codepen.io/jorgebucaran/pen/wrMvjz?editors=1000)
## Installation
```console
npm install classcat
```
Or without a build step—import it right in your browser.
```html
<script type="module">
import cc from "https://unpkg.com/classcat"
</script>
```
## API
### `cc(names)`
```ps
cc(names: string | number | object | array): string
```
```js
import cc from "classcat"
cc("elf") //=> "elf"
cc(["elf", "orc", "gnome"]) //=> "elf orc gnome"
cc({
elf: false,
orc: null,
gnome: undefined,
}) //=> ""
cc({
elf: true,
orc: false,
gnome: true,
}) //=> "elf gnome"
cc([
{
elf: true,
orc: false,
},
"gnome",
]) //=> "elf gnome"
```
## Benchmarks
```console
npm --prefix bench start
```
## License
[MIT](LICENSE.md)

View File

@@ -0,0 +1,19 @@
module.exports = function cc(names) {
if (typeof names === "string" || typeof names === "number") return "" + names
let out = ""
if (Array.isArray(names)) {
for (let i = 0, tmp; i < names.length; i++) {
if ((tmp = cc(names[i])) !== "") {
out += (out && " ") + tmp
}
}
} else {
for (let k in names) {
if (names[k]) out += (out && " ") + k
}
}
return out
}

View File

@@ -0,0 +1,15 @@
export as namespace Classcat
export interface ClassObject {
[key: string]: boolean | any
}
export interface ClassArray extends Array<Class> {}
export type Class = string | number | null | undefined | ClassObject | ClassArray
/**
* @param names A string, array or object of CSS class names (as keys).
* @returns The class attribute string.
*/
export default function cc(names: Class): string

View File

@@ -0,0 +1,19 @@
export default function cc(names) {
if (typeof names === "string" || typeof names === "number") return "" + names
let out = ""
if (Array.isArray(names)) {
for (let i = 0, tmp; i < names.length; i++) {
if ((tmp = cc(names[i])) !== "") {
out += (out && " ") + tmp
}
}
} else {
for (let k in names) {
if (names[k]) out += (out && " ") + k
}
}
return out
}

View File

@@ -0,0 +1,38 @@
{
"name": "classcat",
"version": "5.0.5",
"type": "module",
"main": "index.cjs",
"module": "index.js",
"types": "index.d.ts",
"description": "Build a class attribute string quickly.",
"repository": "jorgebucaran/classcat",
"license": "MIT",
"exports": {
"./package.json": "./package.json",
".": {
"require": "./index.cjs",
"import": "./index.js"
}
},
"files": [
"*.*(c)[tj]s*"
],
"author": "Jorge Bucaran",
"keywords": [
"classnames",
"classlist",
"class"
],
"scripts": {
"test": "c8 twist tests/*.js",
"build": "node -e \"fs.writeFileSync('index.cjs',fs.readFileSync('index.js','utf8').replace(/export default/,'module.exports ='),'utf8')\"",
"deploy": "npm test && git commit --all --message $tag && git tag --sign $tag --message $tag && git push && git push --tags",
"release": "tag=$npm_package_version npm run deploy && npm publish --access public",
"prepare": "npm run build"
},
"devDependencies": {
"c8": "*",
"twist": "*"
}
}