feat: Phase 1 — extract the client (web SPA + desktop) to dtoro/oikos-web
Some checks failed
ci / build-test (push) Has been cancelled
ci / docker-build (push) Has been cancelled

Problem: the hexagonal refactor churns the backend tree for nine more
phases; the UI delivery stack (web/ SPA, cmd/desktop Wails wrapper,
compose/web image) must move to its own repo first so doc/layout
rewrites land once on a backend-only tree.

Change:
- New repo git.hubris.network/dtoro/oikos-web (v0.33.0): web/, desktop/
  (updateURL repointed to oikos-web releases), compose/, own CI (web +
  desktop jobs), own deploy script (CI-green gate, TOCTOU guard,
  version-tagged images, prune-to-3), own webhook receiver on :9798 +
  launchd unit, own compose project publishing the same 8091:80.
- Cutover executed on mac-mini in order: oikos stack's web service
  stopped+removed, oikos-web project brought up on 8091; outer Caddy
  untouched (targets the published port) — serving + Authentik flow +
  /wails 404 quirk verified post-cutover.
- Stripped from oikos: web/, cmd/desktop/, compose/web/, desktop CI
  workflow, ci.yml web job, Makefile ui/desktop/desktop-package/install
  targets, the compose web service, oikos-web from deploy.sh's fallback
  prune list; wails + go-keyring dropped from go.mod, vendor synced.
- README / CONTRIBUTING / AGENTS.md / .agents dev+operations docs now
  point at the new repo; mbse + mascot design docs carry a path note.

Risk: production SPA serving depends on the new pipeline now; rollback
is versioned-image re-up of the old web service from a pre-split
checkout (port 8091). Desktop builds installed before the split still
check dtoro/oikos releases — one manual reinstall, noted in the
oikos-web release notes.

Verification: go vet, make test (race), make generate-check, golangci
(no new findings; baseline down 400→365); post-cutover curls —
localhost:8091 200, /wails/runtime.js 404, outer Caddy 302 Authentik.
This commit is contained in:
2026-08-15 22:27:52 +02:00
parent e074f04bdf
commit d4d99a7473
18854 changed files with 2615729 additions and 173735 deletions

21
web/node_modules/tailwind-variants/LICENSE generated vendored Normal file
View File

@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2020 Tailwid Variants
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.

204
web/node_modules/tailwind-variants/README.md generated vendored Normal file
View File

@@ -0,0 +1,204 @@
<p align="center">
<a href="https://tailwind-variants.org">
<img width="20%" src=".github/assets/isotipo.png" alt="tailwind-variants" />
<h1 align="center">tailwind-variants</h1>
</a>
</p>
<p align="center">
The <em>power</em> of Tailwind combined with a <em>first-class</em> variant API.<br><br>
<a href="https://www.npmjs.com/package/tailwind-variants">
<img src="https://img.shields.io/npm/dm/tailwind-variants.svg?style=flat-round" alt="npm downloads">
</a>
<a href="https://www.npmjs.com/package/tailwind-variants">
<img alt="NPM Version" src="https://badgen.net/npm/v/tailwind-variants" />
</a>
<a href="https://github.com/heroui-inc/tailwind-variants/blob/main/LICENSE">
<img src="https://img.shields.io/npm/l/tailwind-variants?style=flat" alt="License">
</a>
</p>
## Features
- First-class variant API
- Slots support
- Composition support
- Fully typed
- Framework agnostic
- Built-in conflict resolution
- Tailwind CSS v4 support
## Installation
```bash
npm i tailwind-variants
# or
yarn add tailwind-variants
# or
pnpm add tailwind-variants
```
**Lite mode:** import from `tailwind-variants/lite` for a smaller bundle without conflict resolution.
**Upgrading?**
- v2 → v3: [migration guide](./.docs/migrations/v2-to-v3.md)
- v1 → v2: [migration guide](./.docs/migrations/v1-to-v2.md)
## Quick Start
```js
import { tv } from "tailwind-variants";
const button = tv({
base: "font-medium bg-blue-500 text-white rounded-full active:opacity-80",
variants: {
color: {
primary: "bg-blue-500 text-white",
secondary: "bg-purple-500 text-white",
},
size: {
sm: "text-sm",
md: "text-base",
lg: "px-4 py-3 text-lg",
},
},
compoundVariants: [
{
size: ["sm", "md"],
class: "px-3 py-1",
},
],
defaultVariants: {
size: "md",
color: "primary",
},
});
button({ size: "sm", color: "secondary" });
// => "font-medium rounded-full active:opacity-80 bg-purple-500 text-white text-sm px-3 py-1"
```
> **Note:** Tailwind CSS v4 no longer supports `config.content.transform`, so responsive variants
> were removed. Add responsive classes to your class names manually if needed.
## Conflict Resolution
Conflict resolution is built into the default entry — no extra package is required. It is available
on `tv`, `createTV`, `cn`, and `cnMerge` (`cx` and `/lite` do not merge).
```js
import { tv, cn } from "tailwind-variants";
cn("px-2", "px-4"); // => "px-4"
tv({ base: "px-2", variants: { size: { lg: "px-4" } } })({ size: "lg" }); // => "px-4"
```
### Custom configuration
Pass `twMergeConfig` to teach the resolver about custom utilities. Prefer `{ extend, override }`
`extend` appends to the defaults, `override` replaces them:
```ts
import { cnMerge, createTV, tv, type TWMergeConfig } from "tailwind-variants";
const twMergeConfig = {
extend: {
classGroups: {
elevation: ["elevation-low", "elevation-high"],
},
},
} satisfies TWMergeConfig;
tv({ base: "elevation-low", variants: { raised: { true: "elevation-high" } } }, { twMergeConfig });
createTV({ twMergeConfig });
cnMerge("elevation-low", "elevation-high")({ twMergeConfig }); // => "elevation-high"
```
Disable merging with `{ twMerge: false }` on `tv`, `createTV`, or `cnMerge`.
### Reusing a `tailwind-merge` config
If you already configure `extendTailwindMerge`, reuse the same config object as `twMergeConfig`
(pass the object — not the returned merge function):
```ts
import { extendTailwindMerge } from "tailwind-merge";
import { createTV, type TWMergeConfig } from "tailwind-variants";
const mergeConfig = {
extend: {
classGroups: {
elevation: ["elevation-low", "elevation-high"],
},
},
} satisfies TWMergeConfig;
extendTailwindMerge(mergeConfig);
createTV({ twMergeConfig: mergeConfig });
```
For `createTailwindMerge`, move the custom parts of the factory into `{ extend, override }` and pass
that object. Merge functions and full default configs cannot be passed directly.
## Utility Functions
| Function | Behavior |
| --------- | ---------------------------------------------------- |
| `cx` | Concatenate class names (no merging) |
| `cn` | Concatenate and merge with the default config |
| `cnMerge` | Concatenate and merge, with optional per-call config |
```js
import { cx, cn, cnMerge } from "tailwind-variants";
cx("px-2", "px-4"); // => "px-2 px-4"
cn("px-2", "px-4"); // => "px-4"
cnMerge("px-2", "px-4")({ twMerge: false }); // => "px-2 px-4"
```
## Documentation
For full documentation, visit [tailwind-variants.org](https://tailwind-variants.org).
## Acknowledgements
- [**cva**](https://github.com/joe-bell/cva) ([Joe Bell](https://github.com/joe-bell))
This project started as an extension of Joe's work on `cva` — a great tool for generating variants
for a single element with Tailwind CSS. Big shoutout to [Joe Bell](https://github.com/joe-bell) and
[contributors](https://github.com/joe-bell/cva/graphs/contributors)! If you don't need the
**Tailwind Variants** features listed
[here](https://www.tailwind-variants.org/docs/comparison), we recommend `cva`.
- [**Stitches**](https://stitches.dev/) ([Modulz](https://modulz.app))
The pioneers of the `variants` API movement. Immense thanks to [Modulz](https://modulz.app) for
their work on Stitches and the community around it.
- [**tailwind-merge**](https://github.com/dcastil/tailwind-merge), [**clsx**](https://github.com/lukeed/clsx), and [**cnfast**](https://github.com/aidenybai/cnfast)
Conflict resolution draws on ideas and MIT-licensed work from these projects.
## Community
We're excited to see the community adopt HeroUI, raise issues, and provide feedback. Whether it's a
feature request, bug report, or a project to showcase, please get involved!
- [Discord](https://discord.gg/9b6yyZKmH4)
- [Twitter](https://twitter.com/getnextui)
- [GitHub Discussions](https://github.com/heroui-inc/tailwind-variants/discussions)
## Contributing
Contributions are always welcome!
- [Contributing guidelines](./CONTRIBUTING.md)
- [Code of conduct](./CODE_OF_CONDUCT.md)
- [Security policy](./SECURITY.md)
## Authors
- Junior Garcia ([@jrgarciadev](https://github.com/jrgarciadev))
- Tianen Pang ([@tianenpang](https://github.com/tianenpang))
## License
Licensed under the MIT License. See [LICENSE](./LICENSE.md) for more information.

View File

@@ -0,0 +1,160 @@
'use strict';
// src/internal/join-class-value.ts
var isArray = Array.isArray;
var joinClassValue = (value) => {
if (!value && value !== 0 && value !== 0n) return "";
if (typeof value === "string") return value;
if (typeof value === "number") {
if (value !== value) return "";
return "" + value;
}
if (typeof value === "bigint") return "" + value;
let result = "";
if (isArray(value)) {
const length = value.length;
for (let index = 0; index < length; index++) {
const item = value[index];
if (!item && item !== 0 && item !== 0n) continue;
const resolved = typeof item === "string" ? item : joinClassValue(item);
if (resolved) {
if (result) result += " ";
result += resolved;
}
}
return result;
}
if (typeof value === "object") {
for (const key in value) {
if (value[key]) {
if (result) result += " ";
result += key;
}
}
}
return result;
};
// src/utils.ts
var SPACE_REGEX = /\s+/g;
var isArray2 = Array.isArray;
var removeExtraSpaces = (str) => {
if (typeof str !== "string" || !str) return str;
return str.replace(SPACE_REGEX, " ").trim();
};
var stringNeedsNormalize = (str) => {
const len = str.length;
if (len === 0) return false;
const first = str.charCodeAt(0);
const last = str.charCodeAt(len - 1);
if (first === 32 || last === 32 || first >= 9 && first <= 13 || first === 160 || last >= 9 && last <= 13 || last === 160) {
return true;
}
for (let i = 0; i < len; i++) {
const code = str.charCodeAt(i);
if (code >= 9 && code <= 13 || code === 160) return true;
if (code === 32 && i + 1 < len && str.charCodeAt(i + 1) === 32) return true;
}
return false;
};
var cx = (...classnames) => {
const result = joinClassValue(classnames);
if (!result) return void 0;
return stringNeedsNormalize(result) ? removeExtraSpaces(result) : result;
};
var falsyToString = (value) => value === false ? "false" : value === true ? "true" : value === 0 ? "0" : value;
var isEmptyObject = (obj) => {
if (!obj || typeof obj !== "object") return true;
for (const _ in obj) return false;
return true;
};
var isEqual = (obj1, obj2) => {
if (obj1 === obj2) return true;
if (!obj1 || !obj2) return false;
const record1 = obj1;
const record2 = obj2;
const keys1 = Object.keys(record1);
const keys2 = Object.keys(record2);
if (keys1.length !== keys2.length) return false;
for (let i = 0; i < keys1.length; i++) {
const key = keys1[i];
if (!keys2.includes(key)) return false;
if (record1[key] !== record2[key]) return false;
}
return true;
};
var isBoolean = (value) => value === true || value === false;
var joinObjects = (obj1, obj2) => {
const target = obj1;
for (const key in obj2) {
if (Object.hasOwn(obj2, key)) {
const val2 = obj2[key];
if (key in target) {
target[key] = cx(target[key], val2);
} else {
target[key] = val2;
}
}
}
return obj1;
};
var flat = (arr, target) => {
for (let i = 0; i < arr.length; i++) {
const el = arr[i];
if (isArray2(el)) flat(el, target);
else if (el) target.push(el);
}
};
function flatArray(arr) {
const flattened = [];
flat(arr, flattened);
return flattened;
}
var flatMergeArrays = (...arrays) => {
const result = [];
flat(arrays, result);
const filtered = [];
for (let i = 0; i < result.length; i++) {
if (result[i]) filtered.push(result[i]);
}
return filtered;
};
var mergeObjects = (obj1, obj2) => {
const record1 = obj1;
const record2 = obj2;
const result = {};
for (const key in record1) {
const val1 = record1[key];
if (key in record2) {
const val2 = record2[key];
if (isArray2(val1) || isArray2(val2)) {
result[key] = flatMergeArrays(val2, val1);
} else if (typeof val1 === "object" && typeof val2 === "object" && val1 && val2) {
result[key] = mergeObjects(val1, val2);
} else {
result[key] = val2 + " " + val1;
}
} else {
result[key] = val1;
}
}
for (const key in record2) {
if (!(key in record1)) {
result[key] = record2[key];
}
}
return result;
};
exports.cx = cx;
exports.falsyToString = falsyToString;
exports.flat = flat;
exports.flatArray = flatArray;
exports.flatMergeArrays = flatMergeArrays;
exports.isBoolean = isBoolean;
exports.isEmptyObject = isEmptyObject;
exports.isEqual = isEqual;
exports.joinClassValue = joinClassValue;
exports.joinObjects = joinObjects;
exports.mergeObjects = mergeObjects;
exports.removeExtraSpaces = removeExtraSpaces;

View File

@@ -0,0 +1,680 @@
'use strict';
var chunk2BFDQGZN_cjs = require('./chunk-2BFDQGZN.cjs');
// src/internal/default-config.ts
var defaultConfig = {
twMerge: true,
twMergeConfig: {}
};
// src/internal/cache.ts
var VARIANT_CACHE_LIMIT = 256;
var OVERRIDE_CACHE_LIMIT = 128;
var CACHE_MISS = /* @__PURE__ */ Symbol("tv-cache-miss");
var hasClassOverride = (props) => (props == null ? void 0 : props.class) != null && props.class !== "" || (props == null ? void 0 : props.className) != null && props.className !== "";
var serializeFingerprintValue = (value) => {
if (value === void 0) return "";
if (value === null) return "null";
if (typeof value === "string") return value;
if (typeof value === "boolean") return value ? "true" : "false";
if (typeof value === "number") return value === 0 ? "0" : String(value);
if (typeof value === "bigint") return String(value);
const mapped = chunk2BFDQGZN_cjs.falsyToString(value);
const mappedType = typeof mapped;
if (mappedType === "string" || mappedType === "number" || mappedType === "boolean" || mappedType === "bigint") {
return String(mapped);
}
if (mappedType === "object") {
try {
return JSON.stringify(mapped);
} catch {
return null;
}
}
return null;
};
var appendSignatureValue = (out, value) => {
if (value === void 0) return out;
if (value === null) return out + "null";
const type = typeof value;
if (type === "string" || type === "number" || type === "boolean" || type === "bigint") {
return out + String(value);
}
if (Array.isArray(value)) {
return out + value.join("\0");
}
try {
return out + JSON.stringify(value);
} catch {
return out + "?";
}
};
var buildPropsFingerprint = (variantKeys, defaultVariants, props, slotProps) => {
let fingerprint = "";
const seen = /* @__PURE__ */ Object.create(null);
for (let i = 0; i < variantKeys.length; i++) {
const key = variantKeys[i];
seen[key] = 1;
let value = defaultVariants[key];
if (props && props[key] !== void 0) value = props[key];
const serialized = serializeFingerprintValue(value);
if (serialized === null) return null;
fingerprint += key + ":" + serialized + ";";
}
const extras = [];
for (const key in defaultVariants) {
if (key === "class" || key === "className" || seen[key]) continue;
seen[key] = 1;
extras.push(key);
}
if (props) {
for (const key in props) {
if (key === "class" || key === "className" || seen[key] || props[key] === void 0) continue;
seen[key] = 1;
extras.push(key);
}
}
if (extras.length > 1) extras.sort();
for (let i = 0; i < extras.length; i++) {
const key = extras[i];
let value = defaultVariants[key];
if (props && props[key] !== void 0) value = props[key];
const serialized = serializeFingerprintValue(value);
if (serialized === null) return null;
fingerprint += key + ":" + serialized + ";";
}
return fingerprint;
};
var buildCompoundsSignature = (compoundVariants, compoundSlots) => {
let signature = "";
for (let i = 0; i < compoundVariants.length; i++) {
const { conditionKeys, source } = compoundVariants[i];
for (let j = 0; j < conditionKeys.length; j++) {
const key = conditionKeys[j];
signature += key + "=";
signature = appendSignatureValue(signature, source[key]);
signature += ",";
}
signature += "c=";
signature = appendSignatureValue(signature, source.class);
signature += "|cn=";
signature = appendSignatureValue(signature, source.className);
signature += ";";
}
for (let i = 0; i < compoundSlots.length; i++) {
const { conditionKeys, source } = compoundSlots[i];
for (let j = 0; j < conditionKeys.length; j++) {
const key = conditionKeys[j];
signature += key + "=";
signature = appendSignatureValue(signature, source[key]);
signature += ",";
}
if (Array.isArray(source.slots)) {
signature += "slots=" + source.slots.join(",") + ",";
}
signature += "c=";
signature = appendSignatureValue(signature, source.class);
signature += "|cn=";
signature = appendSignatureValue(signature, source.className);
signature += ";";
}
return signature;
};
var createBoundedCache = (limit = VARIANT_CACHE_LIMIT) => {
let primary = /* @__PURE__ */ new Map();
let secondary = null;
return {
get(key) {
if (primary.has(key)) return primary.get(key);
if (secondary == null ? void 0 : secondary.has(key)) {
const value = secondary.get(key);
primary.set(key, value);
return value;
}
return CACHE_MISS;
},
set(key, value) {
if (primary.size >= limit) {
secondary = primary;
primary = /* @__PURE__ */ new Map();
}
primary.set(key, value);
}
};
};
var createResultCache = (limit = VARIANT_CACHE_LIMIT) => {
const cache = createBoundedCache(limit);
return {
get(key) {
return cache.get(key);
},
set(key, value) {
cache.set(key, value);
}
};
};
var createNestedOverrideCache = (limit = OVERRIDE_CACHE_LIMIT) => {
let primary = /* @__PURE__ */ new Map();
let secondary = null;
let size = 0;
return {
get(coreKey, overrideKey) {
const primaryInner = primary.get(coreKey);
if (primaryInner) {
const value = primaryInner.get(overrideKey);
if (value !== void 0 || primaryInner.has(overrideKey)) return value;
}
if (secondary) {
const secondaryInner = secondary.get(coreKey);
if (secondaryInner) {
const value = secondaryInner.get(overrideKey);
if (value !== void 0 || secondaryInner.has(overrideKey)) {
let promoteInner = primary.get(coreKey);
if (!promoteInner) {
promoteInner = /* @__PURE__ */ new Map();
primary.set(coreKey, promoteInner);
}
if (!promoteInner.has(overrideKey)) size++;
promoteInner.set(overrideKey, value);
return value;
}
}
}
return CACHE_MISS;
},
set(coreKey, overrideKey, value) {
if (size >= limit) {
secondary = primary;
primary = /* @__PURE__ */ new Map();
size = 0;
}
let inner = primary.get(coreKey);
if (!inner) {
inner = /* @__PURE__ */ new Map();
primary.set(coreKey, inner);
}
if (!inner.has(overrideKey)) size++;
inner.set(overrideKey, value);
}
};
};
var createLazyOverrideMerge = (cn, config) => {
let cache = null;
return (core, props) => {
if (!hasClassOverride(props)) return core;
const classVal = props.class;
const classNameVal = props.className;
if (classVal != null && classVal !== "" && typeof classVal !== "string" || classNameVal != null && classNameVal !== "" && typeof classNameVal !== "string") {
return cn(config, core, classVal, classNameVal);
}
cache ??= createNestedOverrideCache();
const coreKey = core ?? "";
const overrideKey = (typeof classVal === "string" ? classVal : "") + "\0" + (typeof classNameVal === "string" ? classNameVal : "");
const cached = cache.get(coreKey, overrideKey);
if (cached !== CACHE_MISS) return cached;
const merged = cn(config, core, classVal, classNameVal);
cache.set(coreKey, overrideKey, merged);
return merged;
};
};
// src/internal/state.ts
function createState() {
let cachedTwMerge = null;
let cachedTwMergeConfig = {};
let didTwMergeConfigChange = false;
return {
get cachedTwMerge() {
return cachedTwMerge;
},
set cachedTwMerge(value) {
cachedTwMerge = value;
},
get cachedTwMergeConfig() {
return cachedTwMergeConfig;
},
set cachedTwMergeConfig(value) {
cachedTwMergeConfig = value;
},
get didTwMergeConfigChange() {
return didTwMergeConfigChange;
},
set didTwMergeConfigChange(value) {
didTwMergeConfigChange = value;
},
reset() {
cachedTwMerge = null;
cachedTwMergeConfig = {};
didTwMergeConfigChange = false;
}
};
}
var state = createState();
// src/internal/resolve-options.ts
var synchronizeTwMergeConfig = (config) => {
if (!chunk2BFDQGZN_cjs.isEmptyObject(config.twMergeConfig) && !chunk2BFDQGZN_cjs.isEqual(config.twMergeConfig, state.cachedTwMergeConfig)) {
state.didTwMergeConfigChange = true;
state.cachedTwMergeConfig = config.twMergeConfig;
}
};
var compileVariants = (variants, variantKeys) => {
const compiledVariants = [];
for (let i = 0; i < variantKeys.length; i++) {
const key = variantKeys[i];
const values = variants[key];
compiledVariants.push({ key, values, isEmpty: chunk2BFDQGZN_cjs.isEmptyObject(values) });
}
return compiledVariants;
};
var compileCompoundVariants = (compoundVariants) => {
if (!Array.isArray(compoundVariants) || compoundVariants.length === 0) return [];
const result = [];
for (let i = 0; i < compoundVariants.length; i++) {
const compoundVariant = compoundVariants[i];
const conditionKeys = [];
for (const key in compoundVariant) {
if (key !== "class" && key !== "className") {
conditionKeys.push(key);
}
}
result.push({ conditionKeys, source: compoundVariant });
}
return result;
};
var compileCompoundSlots = (compoundSlots) => {
if (!Array.isArray(compoundSlots) || compoundSlots.length === 0) return [];
const result = [];
for (let i = 0; i < compoundSlots.length; i++) {
const compoundSlot = compoundSlots[i];
const conditionKeys = [];
for (const key in compoundSlot) {
if (key !== "slots" && key !== "class" && key !== "className") {
conditionKeys.push(key);
}
}
result.push({ conditionKeys, source: compoundSlot });
}
return result;
};
var indexCompoundSlotsBySlot = (compiledCompoundSlots) => {
const index = {};
for (let i = 0; i < compiledCompoundSlots.length; i++) {
const compoundSlot = compiledCompoundSlots[i];
const slots = compoundSlot.source.slots;
if (!Array.isArray(slots)) continue;
for (let j = 0; j < slots.length; j++) {
const slotKey = slots[j];
if (!index[slotKey]) index[slotKey] = [];
index[slotKey].push(compoundSlot);
}
}
return index;
};
var resolveOptions = (options, configProp) => {
const {
extend = null,
slots: slotProps = {},
variants: variantsProps = {},
compoundVariants: compoundVariantsProps = [],
compoundSlots: compoundSlotsProps = [],
defaultVariants: defaultVariantsProps = {}
} = options;
const config = { ...defaultConfig, ...configProp };
const hasSlots = options.slots !== void 0;
const base = (extend == null ? void 0 : extend.base) ? chunk2BFDQGZN_cjs.cx(extend.base, options == null ? void 0 : options.base) : options == null ? void 0 : options.base;
const variants = (extend == null ? void 0 : extend.variants) && !chunk2BFDQGZN_cjs.isEmptyObject(extend.variants) ? chunk2BFDQGZN_cjs.mergeObjects(variantsProps, extend.variants) : variantsProps;
const defaultVariants = (extend == null ? void 0 : extend.defaultVariants) && !chunk2BFDQGZN_cjs.isEmptyObject(extend.defaultVariants) ? { ...extend.defaultVariants, ...defaultVariantsProps } : defaultVariantsProps;
synchronizeTwMergeConfig(config);
const isExtendedSlotsEmpty = !(extend == null ? void 0 : extend.slots) || chunk2BFDQGZN_cjs.isEmptyObject(extend.slots);
const componentBase = hasSlots ? isExtendedSlotsEmpty && (extend == null ? void 0 : extend.base) ? chunk2BFDQGZN_cjs.cx(options == null ? void 0 : options.base, extend.base) : typeof (options == null ? void 0 : options.base) === "string" || (options == null ? void 0 : options.base) == null ? options.base : chunk2BFDQGZN_cjs.cx(options.base) : void 0;
const componentSlots = hasSlots ? {
base: componentBase,
...slotProps
} : {};
const slots = isExtendedSlotsEmpty ? componentSlots : chunk2BFDQGZN_cjs.joinObjects(
{ ...extend == null ? void 0 : extend.slots },
chunk2BFDQGZN_cjs.isEmptyObject(componentSlots) ? { base: options == null ? void 0 : options.base } : componentSlots
);
const compoundVariants = !(extend == null ? void 0 : extend.compoundVariants) || chunk2BFDQGZN_cjs.isEmptyObject(extend.compoundVariants) ? compoundVariantsProps : chunk2BFDQGZN_cjs.flatMergeArrays(extend == null ? void 0 : extend.compoundVariants, compoundVariantsProps);
const compoundSlots = !(extend == null ? void 0 : extend.compoundSlots) || chunk2BFDQGZN_cjs.isEmptyObject(extend.compoundSlots) ? compoundSlotsProps : chunk2BFDQGZN_cjs.flatMergeArrays(extend == null ? void 0 : extend.compoundSlots, compoundSlotsProps);
const variantKeys = Object.keys(variants);
const deferredError = compoundVariants && !Array.isArray(compoundVariants) ? new TypeError(
`The "compoundVariants" prop must be an array. Received: ${typeof compoundVariants}`
) : compoundSlots && !Array.isArray(compoundSlots) ? new TypeError(
`The "compoundSlots" prop must be an array. Received: ${typeof compoundSlots}`
) : null;
const mode = hasSlots || !isExtendedSlotsEmpty ? "slots" : variantKeys.length === 0 ? "plain" : "variants";
return {
config,
extend,
base,
variants,
defaultVariants,
slots,
compoundVariants,
compoundSlots,
compiledVariants: null,
compiledCompoundVariants: null,
compiledCompoundSlots: null,
compiledCompoundSlotsBySlot: null,
deferredError,
mode,
slotKeys: null,
variantKeys
};
};
var compileResolvedOptions = (resolved) => {
if (resolved.compiledVariants !== null) return resolved;
resolved.compiledVariants = compileVariants(resolved.variants, resolved.variantKeys);
resolved.compiledCompoundVariants = compileCompoundVariants(resolved.compoundVariants);
resolved.compiledCompoundSlots = compileCompoundSlots(resolved.compoundSlots);
resolved.compiledCompoundSlotsBySlot = indexCompoundSlotsBySlot(resolved.compiledCompoundSlots);
resolved.slotKeys = resolved.slots && typeof resolved.slots === "object" ? Object.keys(resolved.slots) : [];
return resolved;
};
// src/internal/class-resolver.ts
var EMPTY_ARRAY = [];
var variantClassesScratch = [];
var compoundClassesScratch = [];
var compoundVariantBySlotScratch = [];
var compoundSlotClassesScratch = [];
var getCompleteProps = (defaultVariants, props, slotProps) => {
const result = {};
for (const key in defaultVariants) {
result[key] = defaultVariants[key];
}
if (props) {
for (const key in props) {
if (props[key] !== void 0) result[key] = props[key];
}
}
if (slotProps) {
for (const key in slotProps) {
if (slotProps[key] !== void 0) result[key] = slotProps[key];
}
}
return result;
};
var isNullishOrFalse = (value) => value == null || value === false;
var matchesCompoundValue = (expected, actual) => {
if (!Array.isArray(expected)) {
return expected === actual || isNullishOrFalse(expected) && isNullishOrFalse(actual);
}
for (let i = 0; i < expected.length; i++) {
const expectedValue = expected[i];
if (expectedValue === actual || isNullishOrFalse(expectedValue) && isNullishOrFalse(actual)) {
return true;
}
}
return false;
};
var getVariantValue = (variant, defaultVariants, props, slotProps) => {
if (variant.isEmpty) return null;
const variantProp = (slotProps == null ? void 0 : slotProps[variant.key]) ?? (props == null ? void 0 : props[variant.key]);
if (variantProp === null) return null;
const variantKey = chunk2BFDQGZN_cjs.falsyToString(variantProp);
if (typeof variantKey === "object") return null;
const defaultVariantProp = defaultVariants == null ? void 0 : defaultVariants[variant.key];
const key = variantKey != null ? variantKey : chunk2BFDQGZN_cjs.falsyToString(defaultVariantProp);
return variant.values[key || "false"];
};
var matchesConditions = (compound, completeProps) => {
const { conditionKeys, source } = compound;
for (let i = 0; i < conditionKeys.length; i++) {
const key = conditionKeys[i];
if (!matchesCompoundValue(source[key], completeProps[key])) return false;
}
return true;
};
var pushCompoundClassForSlot = (result, slotKey, classValue) => {
if (typeof classValue === "string") {
if (slotKey === "base") result.push(classValue);
} else if (classValue && typeof classValue === "object" && classValue[slotKey]) {
result.push(classValue[slotKey]);
}
};
var getVariantClassNames = (variants, defaultVariants, props) => {
const result = variantClassesScratch;
result.length = 0;
for (let i = 0; i < variants.length; i++) {
const value = getVariantValue(variants[i], defaultVariants, props);
if (value) result.push(value);
}
return result;
};
var getVariantClassNamesBySlot = (slotKey, variants, defaultVariants, props, slotProps) => {
const result = variantClassesScratch;
result.length = 0;
for (let i = 0; i < variants.length; i++) {
const variantValue = getVariantValue(variants[i], defaultVariants, props, slotProps);
const value = slotKey === "base" && typeof variantValue === "string" ? variantValue : variantValue && variantValue[slotKey];
if (value) result.push(value);
}
return result;
};
var getCompoundVariantClasses = (compoundVariants, completeProps) => {
const result = compoundClassesScratch;
result.length = 0;
for (let i = 0; i < compoundVariants.length; i++) {
const compoundVariant = compoundVariants[i];
if (!matchesConditions(compoundVariant, completeProps)) continue;
if (compoundVariant.source.class) result.push(compoundVariant.source.class);
if (compoundVariant.source.className) result.push(compoundVariant.source.className);
}
return result;
};
var getCompoundVariantClassesBySlot = (slotKey, compoundVariants, completeProps) => {
const result = compoundVariantBySlotScratch;
result.length = 0;
for (let i = 0; i < compoundVariants.length; i++) {
const compoundVariant = compoundVariants[i];
if (!matchesConditions(compoundVariant, completeProps)) continue;
pushCompoundClassForSlot(result, slotKey, compoundVariant.source.class);
pushCompoundClassForSlot(result, slotKey, compoundVariant.source.className);
}
return result;
};
var getCompoundSlotClasses = (compoundSlotsForKey, completeProps) => {
const result = compoundSlotClassesScratch;
result.length = 0;
for (let i = 0; i < compoundSlotsForKey.length; i++) {
const compoundSlot = compoundSlotsForKey[i];
if (!matchesConditions(compoundSlot, completeProps)) continue;
if (compoundSlot.source.class) result.push(compoundSlot.source.class);
if (compoundSlot.source.className) result.push(compoundSlot.source.className);
}
return result;
};
var createPlainResolver = (resolved, cn) => {
const { base, config } = resolved;
let core = CACHE_MISS;
const mergeOverride = createLazyOverrideMerge(cn, config);
return ((props) => {
if (core === CACHE_MISS) {
core = cn(config, base);
}
return mergeOverride(core, props);
});
};
var createVariantResolver = (resolved, cn) => {
const { base, config, defaultVariants, deferredError, variantKeys } = resolved;
let compiledCompoundVariants = resolved.compiledCompoundVariants;
let compiledVariants = resolved.compiledVariants;
let compiledCompoundSlots = EMPTY_ARRAY;
let cache = null;
const mergeOverride = createLazyOverrideMerge(cn, config);
let coldInvokesRemaining = 1;
const computeCore = (props) => {
const compoundClasses = compiledCompoundVariants.length > 0 ? getCompoundVariantClasses(
compiledCompoundVariants,
getCompleteProps(defaultVariants, props)
) : void 0;
return cn(
config,
base,
getVariantClassNames(compiledVariants, defaultVariants, props),
compoundClasses
);
};
return ((props) => {
if (deferredError) throw deferredError;
if (compiledVariants === null || compiledCompoundVariants === null) {
compileResolvedOptions(resolved);
compiledVariants = resolved.compiledVariants;
compiledCompoundVariants = resolved.compiledCompoundVariants;
compiledCompoundSlots = resolved.compiledCompoundSlots ?? EMPTY_ARRAY;
}
let core;
if (coldInvokesRemaining > 0) {
coldInvokesRemaining--;
core = computeCore(props);
} else {
cache ??= createResultCache();
const propsFingerprint = buildPropsFingerprint(variantKeys, defaultVariants, props);
if (propsFingerprint !== null) {
const compoundsSig = compiledCompoundVariants.length > 0 || compiledCompoundSlots.length > 0 ? buildCompoundsSignature(compiledCompoundVariants, compiledCompoundSlots) : "";
const cacheKey = propsFingerprint + "#" + compoundsSig;
const cached = cache.get(cacheKey);
if (cached !== CACHE_MISS) {
core = cached;
} else {
core = computeCore(props);
cache.set(cacheKey, core);
}
} else {
core = computeCore(props);
}
}
return mergeOverride(core, props);
});
};
var createSlotsResolver = (resolved, cn) => {
const { config, defaultVariants, deferredError, slots, variantKeys } = resolved;
let compoundVariants = null;
let compoundSlots = null;
let keys = null;
let slotComputers = null;
let hasCompounds = false;
let mergeOverride = null;
let parentCache = null;
let coldParentInvokesRemaining = 1;
const ensureCompiled = () => {
if (keys !== null) return;
if (resolved.compiledVariants === null || resolved.compiledCompoundVariants === null || resolved.compiledCompoundSlots === null || resolved.compiledCompoundSlotsBySlot === null || resolved.slotKeys === null) {
compileResolvedOptions(resolved);
}
const variants = resolved.compiledVariants;
compoundVariants = resolved.compiledCompoundVariants;
compoundSlots = resolved.compiledCompoundSlots;
const compoundSlotsBySlot = resolved.compiledCompoundSlotsBySlot;
keys = resolved.slotKeys;
hasCompounds = compoundVariants.length > 0 || compoundSlots.length > 0;
mergeOverride = createLazyOverrideMerge(cn, config);
const computers = new Array(keys.length);
for (let i = 0; i < keys.length; i++) {
const slotKey = keys[i];
const compoundSlotsForKey = compoundSlotsBySlot[slotKey] ?? EMPTY_ARRAY;
computers[i] = (propsRef, slotProps) => {
const completeProps = hasCompounds ? getCompleteProps(defaultVariants, propsRef, slotProps) : void 0;
const compoundVariantClasses = completeProps ? getCompoundVariantClassesBySlot(slotKey, compoundVariants, completeProps) : void 0;
const compoundSlotClasses = completeProps ? getCompoundSlotClasses(compoundSlotsForKey, completeProps) : void 0;
return cn(
config,
slots[slotKey],
getVariantClassNamesBySlot(slotKey, variants, defaultVariants, propsRef, slotProps),
compoundVariantClasses,
compoundSlotClasses
);
};
}
slotComputers = computers;
};
const createSlotsResult = (props) => {
const slotKeys = keys;
const computers = slotComputers;
const overrideMerge = mergeOverride;
const result = {};
for (let i = 0; i < slotKeys.length; i++) {
const compute = computers[i];
const core = compute(props);
result[slotKeys[i]] = (slotProps) => {
if (slotProps == null) return core;
let hasVariantOverride = false;
for (const key in slotProps) {
if (key === "class" || key === "className") continue;
if (slotProps[key] !== void 0) {
hasVariantOverride = true;
break;
}
}
if (!hasVariantOverride) {
return overrideMerge(core, slotProps);
}
return overrideMerge(compute(props, slotProps), slotProps);
};
}
return result;
};
return ((props) => {
if (deferredError) throw deferredError;
ensureCompiled();
if (coldParentInvokesRemaining > 0) {
coldParentInvokesRemaining--;
return createSlotsResult(props);
}
const propsFingerprint = buildPropsFingerprint(variantKeys, defaultVariants, props);
if (propsFingerprint === null) {
return createSlotsResult(props);
}
const compoundsSig = hasCompounds ? buildCompoundsSignature(compoundVariants, compoundSlots) : "";
const cacheKey = propsFingerprint + "#" + compoundsSig;
parentCache ??= createBoundedCache();
const cached = parentCache.get(cacheKey);
if (cached !== CACHE_MISS) return cached;
const next = createSlotsResult(props);
parentCache.set(cacheKey, next);
return next;
});
};
var createClassResolver = (resolved, cn) => {
if (resolved.mode === "plain") return createPlainResolver(resolved, cn);
let resolver;
return ((props) => {
resolver ??= resolved.mode === "slots" ? createSlotsResolver(resolved, cn) : createVariantResolver(resolved, cn);
return resolver(props);
});
};
// src/internal/tv.ts
var attachComponentMetadata = (component, resolved) => {
component.variantKeys = resolved.variantKeys;
component.extend = resolved.extend;
component.base = resolved.base;
component.slots = resolved.slots;
component.variants = resolved.variants;
component.defaultVariants = resolved.defaultVariants;
component.compoundSlots = resolved.compoundSlots;
component.compoundVariants = resolved.compoundVariants;
};
var getTailwindVariants = (cn) => {
const tv = (options, configProp) => {
const resolved = resolveOptions(options, configProp);
const component = createClassResolver(resolved, cn);
attachComponentMetadata(component, resolved);
return component;
};
const createTV = (configProp) => {
return (options, config) => tv(options, config ? chunk2BFDQGZN_cjs.mergeObjects(configProp, config) : configProp);
};
return {
tv,
createTV
};
};
exports.defaultConfig = defaultConfig;
exports.getTailwindVariants = getTailwindVariants;
exports.state = state;

View File

@@ -0,0 +1,147 @@
// src/internal/join-class-value.ts
var isArray = Array.isArray;
var joinClassValue = (value) => {
if (!value && value !== 0 && value !== 0n) return "";
if (typeof value === "string") return value;
if (typeof value === "number") {
if (value !== value) return "";
return "" + value;
}
if (typeof value === "bigint") return "" + value;
let result = "";
if (isArray(value)) {
const length = value.length;
for (let index = 0; index < length; index++) {
const item = value[index];
if (!item && item !== 0 && item !== 0n) continue;
const resolved = typeof item === "string" ? item : joinClassValue(item);
if (resolved) {
if (result) result += " ";
result += resolved;
}
}
return result;
}
if (typeof value === "object") {
for (const key in value) {
if (value[key]) {
if (result) result += " ";
result += key;
}
}
}
return result;
};
// src/utils.ts
var SPACE_REGEX = /\s+/g;
var isArray2 = Array.isArray;
var removeExtraSpaces = (str) => {
if (typeof str !== "string" || !str) return str;
return str.replace(SPACE_REGEX, " ").trim();
};
var stringNeedsNormalize = (str) => {
const len = str.length;
if (len === 0) return false;
const first = str.charCodeAt(0);
const last = str.charCodeAt(len - 1);
if (first === 32 || last === 32 || first >= 9 && first <= 13 || first === 160 || last >= 9 && last <= 13 || last === 160) {
return true;
}
for (let i = 0; i < len; i++) {
const code = str.charCodeAt(i);
if (code >= 9 && code <= 13 || code === 160) return true;
if (code === 32 && i + 1 < len && str.charCodeAt(i + 1) === 32) return true;
}
return false;
};
var cx = (...classnames) => {
const result = joinClassValue(classnames);
if (!result) return void 0;
return stringNeedsNormalize(result) ? removeExtraSpaces(result) : result;
};
var falsyToString = (value) => value === false ? "false" : value === true ? "true" : value === 0 ? "0" : value;
var isEmptyObject = (obj) => {
if (!obj || typeof obj !== "object") return true;
for (const _ in obj) return false;
return true;
};
var isEqual = (obj1, obj2) => {
if (obj1 === obj2) return true;
if (!obj1 || !obj2) return false;
const record1 = obj1;
const record2 = obj2;
const keys1 = Object.keys(record1);
const keys2 = Object.keys(record2);
if (keys1.length !== keys2.length) return false;
for (let i = 0; i < keys1.length; i++) {
const key = keys1[i];
if (!keys2.includes(key)) return false;
if (record1[key] !== record2[key]) return false;
}
return true;
};
var isBoolean = (value) => value === true || value === false;
var joinObjects = (obj1, obj2) => {
const target = obj1;
for (const key in obj2) {
if (Object.hasOwn(obj2, key)) {
const val2 = obj2[key];
if (key in target) {
target[key] = cx(target[key], val2);
} else {
target[key] = val2;
}
}
}
return obj1;
};
var flat = (arr, target) => {
for (let i = 0; i < arr.length; i++) {
const el = arr[i];
if (isArray2(el)) flat(el, target);
else if (el) target.push(el);
}
};
function flatArray(arr) {
const flattened = [];
flat(arr, flattened);
return flattened;
}
var flatMergeArrays = (...arrays) => {
const result = [];
flat(arrays, result);
const filtered = [];
for (let i = 0; i < result.length; i++) {
if (result[i]) filtered.push(result[i]);
}
return filtered;
};
var mergeObjects = (obj1, obj2) => {
const record1 = obj1;
const record2 = obj2;
const result = {};
for (const key in record1) {
const val1 = record1[key];
if (key in record2) {
const val2 = record2[key];
if (isArray2(val1) || isArray2(val2)) {
result[key] = flatMergeArrays(val2, val1);
} else if (typeof val1 === "object" && typeof val2 === "object" && val1 && val2) {
result[key] = mergeObjects(val1, val2);
} else {
result[key] = val2 + " " + val1;
}
} else {
result[key] = val1;
}
}
for (const key in record2) {
if (!(key in record1)) {
result[key] = record2[key];
}
}
return result;
};
export { cx, falsyToString, flat, flatArray, flatMergeArrays, isBoolean, isEmptyObject, isEqual, joinClassValue, joinObjects, mergeObjects, removeExtraSpaces };

View File

@@ -0,0 +1,676 @@
import { mergeObjects, cx, isEmptyObject, joinObjects, flatMergeArrays, isEqual, falsyToString } from './chunk-OYFAXDFZ.js';
// src/internal/default-config.ts
var defaultConfig = {
twMerge: true,
twMergeConfig: {}
};
// src/internal/cache.ts
var VARIANT_CACHE_LIMIT = 256;
var OVERRIDE_CACHE_LIMIT = 128;
var CACHE_MISS = /* @__PURE__ */ Symbol("tv-cache-miss");
var hasClassOverride = (props) => (props == null ? void 0 : props.class) != null && props.class !== "" || (props == null ? void 0 : props.className) != null && props.className !== "";
var serializeFingerprintValue = (value) => {
if (value === void 0) return "";
if (value === null) return "null";
if (typeof value === "string") return value;
if (typeof value === "boolean") return value ? "true" : "false";
if (typeof value === "number") return value === 0 ? "0" : String(value);
if (typeof value === "bigint") return String(value);
const mapped = falsyToString(value);
const mappedType = typeof mapped;
if (mappedType === "string" || mappedType === "number" || mappedType === "boolean" || mappedType === "bigint") {
return String(mapped);
}
if (mappedType === "object") {
try {
return JSON.stringify(mapped);
} catch {
return null;
}
}
return null;
};
var appendSignatureValue = (out, value) => {
if (value === void 0) return out;
if (value === null) return out + "null";
const type = typeof value;
if (type === "string" || type === "number" || type === "boolean" || type === "bigint") {
return out + String(value);
}
if (Array.isArray(value)) {
return out + value.join("\0");
}
try {
return out + JSON.stringify(value);
} catch {
return out + "?";
}
};
var buildPropsFingerprint = (variantKeys, defaultVariants, props, slotProps) => {
let fingerprint = "";
const seen = /* @__PURE__ */ Object.create(null);
for (let i = 0; i < variantKeys.length; i++) {
const key = variantKeys[i];
seen[key] = 1;
let value = defaultVariants[key];
if (props && props[key] !== void 0) value = props[key];
const serialized = serializeFingerprintValue(value);
if (serialized === null) return null;
fingerprint += key + ":" + serialized + ";";
}
const extras = [];
for (const key in defaultVariants) {
if (key === "class" || key === "className" || seen[key]) continue;
seen[key] = 1;
extras.push(key);
}
if (props) {
for (const key in props) {
if (key === "class" || key === "className" || seen[key] || props[key] === void 0) continue;
seen[key] = 1;
extras.push(key);
}
}
if (extras.length > 1) extras.sort();
for (let i = 0; i < extras.length; i++) {
const key = extras[i];
let value = defaultVariants[key];
if (props && props[key] !== void 0) value = props[key];
const serialized = serializeFingerprintValue(value);
if (serialized === null) return null;
fingerprint += key + ":" + serialized + ";";
}
return fingerprint;
};
var buildCompoundsSignature = (compoundVariants, compoundSlots) => {
let signature = "";
for (let i = 0; i < compoundVariants.length; i++) {
const { conditionKeys, source } = compoundVariants[i];
for (let j = 0; j < conditionKeys.length; j++) {
const key = conditionKeys[j];
signature += key + "=";
signature = appendSignatureValue(signature, source[key]);
signature += ",";
}
signature += "c=";
signature = appendSignatureValue(signature, source.class);
signature += "|cn=";
signature = appendSignatureValue(signature, source.className);
signature += ";";
}
for (let i = 0; i < compoundSlots.length; i++) {
const { conditionKeys, source } = compoundSlots[i];
for (let j = 0; j < conditionKeys.length; j++) {
const key = conditionKeys[j];
signature += key + "=";
signature = appendSignatureValue(signature, source[key]);
signature += ",";
}
if (Array.isArray(source.slots)) {
signature += "slots=" + source.slots.join(",") + ",";
}
signature += "c=";
signature = appendSignatureValue(signature, source.class);
signature += "|cn=";
signature = appendSignatureValue(signature, source.className);
signature += ";";
}
return signature;
};
var createBoundedCache = (limit = VARIANT_CACHE_LIMIT) => {
let primary = /* @__PURE__ */ new Map();
let secondary = null;
return {
get(key) {
if (primary.has(key)) return primary.get(key);
if (secondary == null ? void 0 : secondary.has(key)) {
const value = secondary.get(key);
primary.set(key, value);
return value;
}
return CACHE_MISS;
},
set(key, value) {
if (primary.size >= limit) {
secondary = primary;
primary = /* @__PURE__ */ new Map();
}
primary.set(key, value);
}
};
};
var createResultCache = (limit = VARIANT_CACHE_LIMIT) => {
const cache = createBoundedCache(limit);
return {
get(key) {
return cache.get(key);
},
set(key, value) {
cache.set(key, value);
}
};
};
var createNestedOverrideCache = (limit = OVERRIDE_CACHE_LIMIT) => {
let primary = /* @__PURE__ */ new Map();
let secondary = null;
let size = 0;
return {
get(coreKey, overrideKey) {
const primaryInner = primary.get(coreKey);
if (primaryInner) {
const value = primaryInner.get(overrideKey);
if (value !== void 0 || primaryInner.has(overrideKey)) return value;
}
if (secondary) {
const secondaryInner = secondary.get(coreKey);
if (secondaryInner) {
const value = secondaryInner.get(overrideKey);
if (value !== void 0 || secondaryInner.has(overrideKey)) {
let promoteInner = primary.get(coreKey);
if (!promoteInner) {
promoteInner = /* @__PURE__ */ new Map();
primary.set(coreKey, promoteInner);
}
if (!promoteInner.has(overrideKey)) size++;
promoteInner.set(overrideKey, value);
return value;
}
}
}
return CACHE_MISS;
},
set(coreKey, overrideKey, value) {
if (size >= limit) {
secondary = primary;
primary = /* @__PURE__ */ new Map();
size = 0;
}
let inner = primary.get(coreKey);
if (!inner) {
inner = /* @__PURE__ */ new Map();
primary.set(coreKey, inner);
}
if (!inner.has(overrideKey)) size++;
inner.set(overrideKey, value);
}
};
};
var createLazyOverrideMerge = (cn, config) => {
let cache = null;
return (core, props) => {
if (!hasClassOverride(props)) return core;
const classVal = props.class;
const classNameVal = props.className;
if (classVal != null && classVal !== "" && typeof classVal !== "string" || classNameVal != null && classNameVal !== "" && typeof classNameVal !== "string") {
return cn(config, core, classVal, classNameVal);
}
cache ??= createNestedOverrideCache();
const coreKey = core ?? "";
const overrideKey = (typeof classVal === "string" ? classVal : "") + "\0" + (typeof classNameVal === "string" ? classNameVal : "");
const cached = cache.get(coreKey, overrideKey);
if (cached !== CACHE_MISS) return cached;
const merged = cn(config, core, classVal, classNameVal);
cache.set(coreKey, overrideKey, merged);
return merged;
};
};
// src/internal/state.ts
function createState() {
let cachedTwMerge = null;
let cachedTwMergeConfig = {};
let didTwMergeConfigChange = false;
return {
get cachedTwMerge() {
return cachedTwMerge;
},
set cachedTwMerge(value) {
cachedTwMerge = value;
},
get cachedTwMergeConfig() {
return cachedTwMergeConfig;
},
set cachedTwMergeConfig(value) {
cachedTwMergeConfig = value;
},
get didTwMergeConfigChange() {
return didTwMergeConfigChange;
},
set didTwMergeConfigChange(value) {
didTwMergeConfigChange = value;
},
reset() {
cachedTwMerge = null;
cachedTwMergeConfig = {};
didTwMergeConfigChange = false;
}
};
}
var state = createState();
// src/internal/resolve-options.ts
var synchronizeTwMergeConfig = (config) => {
if (!isEmptyObject(config.twMergeConfig) && !isEqual(config.twMergeConfig, state.cachedTwMergeConfig)) {
state.didTwMergeConfigChange = true;
state.cachedTwMergeConfig = config.twMergeConfig;
}
};
var compileVariants = (variants, variantKeys) => {
const compiledVariants = [];
for (let i = 0; i < variantKeys.length; i++) {
const key = variantKeys[i];
const values = variants[key];
compiledVariants.push({ key, values, isEmpty: isEmptyObject(values) });
}
return compiledVariants;
};
var compileCompoundVariants = (compoundVariants) => {
if (!Array.isArray(compoundVariants) || compoundVariants.length === 0) return [];
const result = [];
for (let i = 0; i < compoundVariants.length; i++) {
const compoundVariant = compoundVariants[i];
const conditionKeys = [];
for (const key in compoundVariant) {
if (key !== "class" && key !== "className") {
conditionKeys.push(key);
}
}
result.push({ conditionKeys, source: compoundVariant });
}
return result;
};
var compileCompoundSlots = (compoundSlots) => {
if (!Array.isArray(compoundSlots) || compoundSlots.length === 0) return [];
const result = [];
for (let i = 0; i < compoundSlots.length; i++) {
const compoundSlot = compoundSlots[i];
const conditionKeys = [];
for (const key in compoundSlot) {
if (key !== "slots" && key !== "class" && key !== "className") {
conditionKeys.push(key);
}
}
result.push({ conditionKeys, source: compoundSlot });
}
return result;
};
var indexCompoundSlotsBySlot = (compiledCompoundSlots) => {
const index = {};
for (let i = 0; i < compiledCompoundSlots.length; i++) {
const compoundSlot = compiledCompoundSlots[i];
const slots = compoundSlot.source.slots;
if (!Array.isArray(slots)) continue;
for (let j = 0; j < slots.length; j++) {
const slotKey = slots[j];
if (!index[slotKey]) index[slotKey] = [];
index[slotKey].push(compoundSlot);
}
}
return index;
};
var resolveOptions = (options, configProp) => {
const {
extend = null,
slots: slotProps = {},
variants: variantsProps = {},
compoundVariants: compoundVariantsProps = [],
compoundSlots: compoundSlotsProps = [],
defaultVariants: defaultVariantsProps = {}
} = options;
const config = { ...defaultConfig, ...configProp };
const hasSlots = options.slots !== void 0;
const base = (extend == null ? void 0 : extend.base) ? cx(extend.base, options == null ? void 0 : options.base) : options == null ? void 0 : options.base;
const variants = (extend == null ? void 0 : extend.variants) && !isEmptyObject(extend.variants) ? mergeObjects(variantsProps, extend.variants) : variantsProps;
const defaultVariants = (extend == null ? void 0 : extend.defaultVariants) && !isEmptyObject(extend.defaultVariants) ? { ...extend.defaultVariants, ...defaultVariantsProps } : defaultVariantsProps;
synchronizeTwMergeConfig(config);
const isExtendedSlotsEmpty = !(extend == null ? void 0 : extend.slots) || isEmptyObject(extend.slots);
const componentBase = hasSlots ? isExtendedSlotsEmpty && (extend == null ? void 0 : extend.base) ? cx(options == null ? void 0 : options.base, extend.base) : typeof (options == null ? void 0 : options.base) === "string" || (options == null ? void 0 : options.base) == null ? options.base : cx(options.base) : void 0;
const componentSlots = hasSlots ? {
base: componentBase,
...slotProps
} : {};
const slots = isExtendedSlotsEmpty ? componentSlots : joinObjects(
{ ...extend == null ? void 0 : extend.slots },
isEmptyObject(componentSlots) ? { base: options == null ? void 0 : options.base } : componentSlots
);
const compoundVariants = !(extend == null ? void 0 : extend.compoundVariants) || isEmptyObject(extend.compoundVariants) ? compoundVariantsProps : flatMergeArrays(extend == null ? void 0 : extend.compoundVariants, compoundVariantsProps);
const compoundSlots = !(extend == null ? void 0 : extend.compoundSlots) || isEmptyObject(extend.compoundSlots) ? compoundSlotsProps : flatMergeArrays(extend == null ? void 0 : extend.compoundSlots, compoundSlotsProps);
const variantKeys = Object.keys(variants);
const deferredError = compoundVariants && !Array.isArray(compoundVariants) ? new TypeError(
`The "compoundVariants" prop must be an array. Received: ${typeof compoundVariants}`
) : compoundSlots && !Array.isArray(compoundSlots) ? new TypeError(
`The "compoundSlots" prop must be an array. Received: ${typeof compoundSlots}`
) : null;
const mode = hasSlots || !isExtendedSlotsEmpty ? "slots" : variantKeys.length === 0 ? "plain" : "variants";
return {
config,
extend,
base,
variants,
defaultVariants,
slots,
compoundVariants,
compoundSlots,
compiledVariants: null,
compiledCompoundVariants: null,
compiledCompoundSlots: null,
compiledCompoundSlotsBySlot: null,
deferredError,
mode,
slotKeys: null,
variantKeys
};
};
var compileResolvedOptions = (resolved) => {
if (resolved.compiledVariants !== null) return resolved;
resolved.compiledVariants = compileVariants(resolved.variants, resolved.variantKeys);
resolved.compiledCompoundVariants = compileCompoundVariants(resolved.compoundVariants);
resolved.compiledCompoundSlots = compileCompoundSlots(resolved.compoundSlots);
resolved.compiledCompoundSlotsBySlot = indexCompoundSlotsBySlot(resolved.compiledCompoundSlots);
resolved.slotKeys = resolved.slots && typeof resolved.slots === "object" ? Object.keys(resolved.slots) : [];
return resolved;
};
// src/internal/class-resolver.ts
var EMPTY_ARRAY = [];
var variantClassesScratch = [];
var compoundClassesScratch = [];
var compoundVariantBySlotScratch = [];
var compoundSlotClassesScratch = [];
var getCompleteProps = (defaultVariants, props, slotProps) => {
const result = {};
for (const key in defaultVariants) {
result[key] = defaultVariants[key];
}
if (props) {
for (const key in props) {
if (props[key] !== void 0) result[key] = props[key];
}
}
if (slotProps) {
for (const key in slotProps) {
if (slotProps[key] !== void 0) result[key] = slotProps[key];
}
}
return result;
};
var isNullishOrFalse = (value) => value == null || value === false;
var matchesCompoundValue = (expected, actual) => {
if (!Array.isArray(expected)) {
return expected === actual || isNullishOrFalse(expected) && isNullishOrFalse(actual);
}
for (let i = 0; i < expected.length; i++) {
const expectedValue = expected[i];
if (expectedValue === actual || isNullishOrFalse(expectedValue) && isNullishOrFalse(actual)) {
return true;
}
}
return false;
};
var getVariantValue = (variant, defaultVariants, props, slotProps) => {
if (variant.isEmpty) return null;
const variantProp = (slotProps == null ? void 0 : slotProps[variant.key]) ?? (props == null ? void 0 : props[variant.key]);
if (variantProp === null) return null;
const variantKey = falsyToString(variantProp);
if (typeof variantKey === "object") return null;
const defaultVariantProp = defaultVariants == null ? void 0 : defaultVariants[variant.key];
const key = variantKey != null ? variantKey : falsyToString(defaultVariantProp);
return variant.values[key || "false"];
};
var matchesConditions = (compound, completeProps) => {
const { conditionKeys, source } = compound;
for (let i = 0; i < conditionKeys.length; i++) {
const key = conditionKeys[i];
if (!matchesCompoundValue(source[key], completeProps[key])) return false;
}
return true;
};
var pushCompoundClassForSlot = (result, slotKey, classValue) => {
if (typeof classValue === "string") {
if (slotKey === "base") result.push(classValue);
} else if (classValue && typeof classValue === "object" && classValue[slotKey]) {
result.push(classValue[slotKey]);
}
};
var getVariantClassNames = (variants, defaultVariants, props) => {
const result = variantClassesScratch;
result.length = 0;
for (let i = 0; i < variants.length; i++) {
const value = getVariantValue(variants[i], defaultVariants, props);
if (value) result.push(value);
}
return result;
};
var getVariantClassNamesBySlot = (slotKey, variants, defaultVariants, props, slotProps) => {
const result = variantClassesScratch;
result.length = 0;
for (let i = 0; i < variants.length; i++) {
const variantValue = getVariantValue(variants[i], defaultVariants, props, slotProps);
const value = slotKey === "base" && typeof variantValue === "string" ? variantValue : variantValue && variantValue[slotKey];
if (value) result.push(value);
}
return result;
};
var getCompoundVariantClasses = (compoundVariants, completeProps) => {
const result = compoundClassesScratch;
result.length = 0;
for (let i = 0; i < compoundVariants.length; i++) {
const compoundVariant = compoundVariants[i];
if (!matchesConditions(compoundVariant, completeProps)) continue;
if (compoundVariant.source.class) result.push(compoundVariant.source.class);
if (compoundVariant.source.className) result.push(compoundVariant.source.className);
}
return result;
};
var getCompoundVariantClassesBySlot = (slotKey, compoundVariants, completeProps) => {
const result = compoundVariantBySlotScratch;
result.length = 0;
for (let i = 0; i < compoundVariants.length; i++) {
const compoundVariant = compoundVariants[i];
if (!matchesConditions(compoundVariant, completeProps)) continue;
pushCompoundClassForSlot(result, slotKey, compoundVariant.source.class);
pushCompoundClassForSlot(result, slotKey, compoundVariant.source.className);
}
return result;
};
var getCompoundSlotClasses = (compoundSlotsForKey, completeProps) => {
const result = compoundSlotClassesScratch;
result.length = 0;
for (let i = 0; i < compoundSlotsForKey.length; i++) {
const compoundSlot = compoundSlotsForKey[i];
if (!matchesConditions(compoundSlot, completeProps)) continue;
if (compoundSlot.source.class) result.push(compoundSlot.source.class);
if (compoundSlot.source.className) result.push(compoundSlot.source.className);
}
return result;
};
var createPlainResolver = (resolved, cn) => {
const { base, config } = resolved;
let core = CACHE_MISS;
const mergeOverride = createLazyOverrideMerge(cn, config);
return ((props) => {
if (core === CACHE_MISS) {
core = cn(config, base);
}
return mergeOverride(core, props);
});
};
var createVariantResolver = (resolved, cn) => {
const { base, config, defaultVariants, deferredError, variantKeys } = resolved;
let compiledCompoundVariants = resolved.compiledCompoundVariants;
let compiledVariants = resolved.compiledVariants;
let compiledCompoundSlots = EMPTY_ARRAY;
let cache = null;
const mergeOverride = createLazyOverrideMerge(cn, config);
let coldInvokesRemaining = 1;
const computeCore = (props) => {
const compoundClasses = compiledCompoundVariants.length > 0 ? getCompoundVariantClasses(
compiledCompoundVariants,
getCompleteProps(defaultVariants, props)
) : void 0;
return cn(
config,
base,
getVariantClassNames(compiledVariants, defaultVariants, props),
compoundClasses
);
};
return ((props) => {
if (deferredError) throw deferredError;
if (compiledVariants === null || compiledCompoundVariants === null) {
compileResolvedOptions(resolved);
compiledVariants = resolved.compiledVariants;
compiledCompoundVariants = resolved.compiledCompoundVariants;
compiledCompoundSlots = resolved.compiledCompoundSlots ?? EMPTY_ARRAY;
}
let core;
if (coldInvokesRemaining > 0) {
coldInvokesRemaining--;
core = computeCore(props);
} else {
cache ??= createResultCache();
const propsFingerprint = buildPropsFingerprint(variantKeys, defaultVariants, props);
if (propsFingerprint !== null) {
const compoundsSig = compiledCompoundVariants.length > 0 || compiledCompoundSlots.length > 0 ? buildCompoundsSignature(compiledCompoundVariants, compiledCompoundSlots) : "";
const cacheKey = propsFingerprint + "#" + compoundsSig;
const cached = cache.get(cacheKey);
if (cached !== CACHE_MISS) {
core = cached;
} else {
core = computeCore(props);
cache.set(cacheKey, core);
}
} else {
core = computeCore(props);
}
}
return mergeOverride(core, props);
});
};
var createSlotsResolver = (resolved, cn) => {
const { config, defaultVariants, deferredError, slots, variantKeys } = resolved;
let compoundVariants = null;
let compoundSlots = null;
let keys = null;
let slotComputers = null;
let hasCompounds = false;
let mergeOverride = null;
let parentCache = null;
let coldParentInvokesRemaining = 1;
const ensureCompiled = () => {
if (keys !== null) return;
if (resolved.compiledVariants === null || resolved.compiledCompoundVariants === null || resolved.compiledCompoundSlots === null || resolved.compiledCompoundSlotsBySlot === null || resolved.slotKeys === null) {
compileResolvedOptions(resolved);
}
const variants = resolved.compiledVariants;
compoundVariants = resolved.compiledCompoundVariants;
compoundSlots = resolved.compiledCompoundSlots;
const compoundSlotsBySlot = resolved.compiledCompoundSlotsBySlot;
keys = resolved.slotKeys;
hasCompounds = compoundVariants.length > 0 || compoundSlots.length > 0;
mergeOverride = createLazyOverrideMerge(cn, config);
const computers = new Array(keys.length);
for (let i = 0; i < keys.length; i++) {
const slotKey = keys[i];
const compoundSlotsForKey = compoundSlotsBySlot[slotKey] ?? EMPTY_ARRAY;
computers[i] = (propsRef, slotProps) => {
const completeProps = hasCompounds ? getCompleteProps(defaultVariants, propsRef, slotProps) : void 0;
const compoundVariantClasses = completeProps ? getCompoundVariantClassesBySlot(slotKey, compoundVariants, completeProps) : void 0;
const compoundSlotClasses = completeProps ? getCompoundSlotClasses(compoundSlotsForKey, completeProps) : void 0;
return cn(
config,
slots[slotKey],
getVariantClassNamesBySlot(slotKey, variants, defaultVariants, propsRef, slotProps),
compoundVariantClasses,
compoundSlotClasses
);
};
}
slotComputers = computers;
};
const createSlotsResult = (props) => {
const slotKeys = keys;
const computers = slotComputers;
const overrideMerge = mergeOverride;
const result = {};
for (let i = 0; i < slotKeys.length; i++) {
const compute = computers[i];
const core = compute(props);
result[slotKeys[i]] = (slotProps) => {
if (slotProps == null) return core;
let hasVariantOverride = false;
for (const key in slotProps) {
if (key === "class" || key === "className") continue;
if (slotProps[key] !== void 0) {
hasVariantOverride = true;
break;
}
}
if (!hasVariantOverride) {
return overrideMerge(core, slotProps);
}
return overrideMerge(compute(props, slotProps), slotProps);
};
}
return result;
};
return ((props) => {
if (deferredError) throw deferredError;
ensureCompiled();
if (coldParentInvokesRemaining > 0) {
coldParentInvokesRemaining--;
return createSlotsResult(props);
}
const propsFingerprint = buildPropsFingerprint(variantKeys, defaultVariants, props);
if (propsFingerprint === null) {
return createSlotsResult(props);
}
const compoundsSig = hasCompounds ? buildCompoundsSignature(compoundVariants, compoundSlots) : "";
const cacheKey = propsFingerprint + "#" + compoundsSig;
parentCache ??= createBoundedCache();
const cached = parentCache.get(cacheKey);
if (cached !== CACHE_MISS) return cached;
const next = createSlotsResult(props);
parentCache.set(cacheKey, next);
return next;
});
};
var createClassResolver = (resolved, cn) => {
if (resolved.mode === "plain") return createPlainResolver(resolved, cn);
let resolver;
return ((props) => {
resolver ??= resolved.mode === "slots" ? createSlotsResolver(resolved, cn) : createVariantResolver(resolved, cn);
return resolver(props);
});
};
// src/internal/tv.ts
var attachComponentMetadata = (component, resolved) => {
component.variantKeys = resolved.variantKeys;
component.extend = resolved.extend;
component.base = resolved.base;
component.slots = resolved.slots;
component.variants = resolved.variants;
component.defaultVariants = resolved.defaultVariants;
component.compoundSlots = resolved.compoundSlots;
component.compoundVariants = resolved.compoundVariants;
};
var getTailwindVariants = (cn) => {
const tv = (options, configProp) => {
const resolved = resolveOptions(options, configProp);
const component = createClassResolver(resolved, cn);
attachComponentMetadata(component, resolved);
return component;
};
const createTV = (configProp) => {
return (options, config) => tv(options, config ? mergeObjects(configProp, config) : configProp);
};
return {
tv,
createTV
};
};
export { defaultConfig, getTailwindVariants, state };

View File

@@ -0,0 +1,112 @@
/** Class value accepted by the callable merger (`createMerger()`). */
type ClassNameValue = ClassNameArray | string | null | undefined | 0 | 0n | false;
type ClassNameArray = readonly ClassNameValue[];
/** Built-in merger configuration shape. */
type Config<ClassGroupIds extends string, ThemeGroupIds extends string> = ConfigGroupsPart<ClassGroupIds, ThemeGroupIds>;
/**
* Dynamic merger config groups. When merging configs, use `override` or `extend`.
*/
interface ConfigGroupsPart<ClassGroupIds extends string, ThemeGroupIds extends string> {
/**
* Theme scales used in classGroups.
*
* The keys are the same as in the Tailwind config but the values are sometimes defined more broadly.
*/
theme: NoInfer<ThemeObject<ThemeGroupIds>>;
/**
* Object with groups of classes.
*
* @example
* {
* // Creates group of classes `group`, `of` and `classes`
* 'group-id': ['group', 'of', 'classes'],
* // Creates group of classes `look-at-me-other` and `look-at-me-group`.
* 'other-group': [{ 'look-at-me': ['other', 'group']}]
* }
*/
classGroups: NoInfer<Record<ClassGroupIds, ClassGroup<ThemeGroupIds>>>;
/**
* Conflicting classes across groups.
*
* The key is the ID of a class group which creates a conflict, values are IDs of class groups which receive a conflict. That means if a class from from the key ID is present, all preceding classes from the values are removed.
*
* A class group ID is the key of a class group in the classGroups object.
*
* @example { gap: ['gap-x', 'gap-y'] }
*/
conflictingClassGroups: NoInfer<Partial<Record<ClassGroupIds, readonly ClassGroupIds[]>>>;
/**
* Postfix modifiers conflicting with other class groups.
*
* A class group ID is the key of a class group in classGroups object.
*
* @example { 'font-size': ['leading'] }
*/
conflictingClassGroupModifiers: NoInfer<Partial<Record<ClassGroupIds, readonly ClassGroupIds[]>>>;
/**
* Class group IDs which should be resolved again with their postfix modifier attached.
*
* This is needed when a slash can make the full class name belong to a different class group than the part before the slash.
*
* @example ['container-type'] // `@container-size/sidebar` should resolve differently from `@container-size`
*/
postfixLookupClassGroups?: readonly NoInferString<ClassGroupIds>[];
/**
* Modifiers whose order among multiple modifiers should be preserved because their order changes which element gets targeted.
*
* Classes with these modifiers are not overwritten by peers that only differ in order-sensitive modifier position.
*/
orderSensitiveModifiers: string[];
}
type ThemeObject<ThemeGroupIds extends string> = Record<ThemeGroupIds, ClassGroup<ThemeGroupIds>>;
type ClassGroup<ThemeGroupIds extends string> = readonly ClassDefinition<ThemeGroupIds>[];
type ClassDefinition<ThemeGroupIds extends string> = string | ClassValidator | ThemeGetter | ClassObject<ThemeGroupIds>;
type ClassValidator = (classPart: string) => boolean;
interface ThemeGetter {
(theme: ThemeObject<AnyThemeGroupIds>): ClassGroup<AnyClassGroupIds>;
isThemeGetter: true;
}
type ClassObject<ThemeGroupIds extends string> = Record<string, readonly ClassDefinition<ThemeGroupIds>[]>;
/**
* Hack from https://stackoverflow.com/questions/56687668/a-way-to-disable-type-argument-inference-in-generics/56688073#56688073
*
* Could be replaced with NoInfer utility type from TypeScript (https://www.typescriptlang.org/docs/handbook/utility-types.html#noinfertype), but that is only supported in TypeScript 5.4 or higher, so I should wait some time before using it.
*/
type NoInfer<T> = [T][T extends unknown ? 0 : never];
/**
* Special-purpose NoInfer variant for string unions used in array item positions.
*
* The NoInfer helper above doesn't prevent inference from array items in all cases, so this keeps
* config arrays like `postfixLookupClassGroups` from defining or narrowing class group IDs.
* Prefer TypeScript's built-in `NoInfer` when the minimum supported version is 5.4+.
*/
type NoInferString<T extends string> = T extends infer S ? S & string : never;
type AnyClassGroupIds = string;
type AnyThemeGroupIds = string;
/** Merger config with unrestricted class-group and theme-group IDs. */
type AnyConfig = Config<AnyClassGroupIds, AnyThemeGroupIds>;
/** Merger config: `override` replaces class groups, `extend` appends to them. */
interface ConfigExtension {
override?: Partial<AnyConfig>;
extend?: Partial<AnyConfig>;
}
/** Merger config for the built-in Tailwind conflict resolver. */
type TWMergeConfig = ConfigExtension & Partial<AnyConfig> & {
extend?: Partial<AnyConfig>;
override?: Partial<AnyConfig>;
};
type TWMConfig = {
/**
* Whether to merge conflicting Tailwind classes.
* @default true
*/
twMerge?: boolean;
/**
* Custom merger config (`extend` / `override`, or legacy flat fields).
*/
twMergeConfig?: TWMergeConfig;
};
type TVConfig = TWMConfig;
export type { ClassNameValue as C, TWMConfig as T, TVConfig as a, TWMergeConfig as b };

View File

@@ -0,0 +1,112 @@
/** Class value accepted by the callable merger (`createMerger()`). */
type ClassNameValue = ClassNameArray | string | null | undefined | 0 | 0n | false;
type ClassNameArray = readonly ClassNameValue[];
/** Built-in merger configuration shape. */
type Config<ClassGroupIds extends string, ThemeGroupIds extends string> = ConfigGroupsPart<ClassGroupIds, ThemeGroupIds>;
/**
* Dynamic merger config groups. When merging configs, use `override` or `extend`.
*/
interface ConfigGroupsPart<ClassGroupIds extends string, ThemeGroupIds extends string> {
/**
* Theme scales used in classGroups.
*
* The keys are the same as in the Tailwind config but the values are sometimes defined more broadly.
*/
theme: NoInfer<ThemeObject<ThemeGroupIds>>;
/**
* Object with groups of classes.
*
* @example
* {
* // Creates group of classes `group`, `of` and `classes`
* 'group-id': ['group', 'of', 'classes'],
* // Creates group of classes `look-at-me-other` and `look-at-me-group`.
* 'other-group': [{ 'look-at-me': ['other', 'group']}]
* }
*/
classGroups: NoInfer<Record<ClassGroupIds, ClassGroup<ThemeGroupIds>>>;
/**
* Conflicting classes across groups.
*
* The key is the ID of a class group which creates a conflict, values are IDs of class groups which receive a conflict. That means if a class from from the key ID is present, all preceding classes from the values are removed.
*
* A class group ID is the key of a class group in the classGroups object.
*
* @example { gap: ['gap-x', 'gap-y'] }
*/
conflictingClassGroups: NoInfer<Partial<Record<ClassGroupIds, readonly ClassGroupIds[]>>>;
/**
* Postfix modifiers conflicting with other class groups.
*
* A class group ID is the key of a class group in classGroups object.
*
* @example { 'font-size': ['leading'] }
*/
conflictingClassGroupModifiers: NoInfer<Partial<Record<ClassGroupIds, readonly ClassGroupIds[]>>>;
/**
* Class group IDs which should be resolved again with their postfix modifier attached.
*
* This is needed when a slash can make the full class name belong to a different class group than the part before the slash.
*
* @example ['container-type'] // `@container-size/sidebar` should resolve differently from `@container-size`
*/
postfixLookupClassGroups?: readonly NoInferString<ClassGroupIds>[];
/**
* Modifiers whose order among multiple modifiers should be preserved because their order changes which element gets targeted.
*
* Classes with these modifiers are not overwritten by peers that only differ in order-sensitive modifier position.
*/
orderSensitiveModifiers: string[];
}
type ThemeObject<ThemeGroupIds extends string> = Record<ThemeGroupIds, ClassGroup<ThemeGroupIds>>;
type ClassGroup<ThemeGroupIds extends string> = readonly ClassDefinition<ThemeGroupIds>[];
type ClassDefinition<ThemeGroupIds extends string> = string | ClassValidator | ThemeGetter | ClassObject<ThemeGroupIds>;
type ClassValidator = (classPart: string) => boolean;
interface ThemeGetter {
(theme: ThemeObject<AnyThemeGroupIds>): ClassGroup<AnyClassGroupIds>;
isThemeGetter: true;
}
type ClassObject<ThemeGroupIds extends string> = Record<string, readonly ClassDefinition<ThemeGroupIds>[]>;
/**
* Hack from https://stackoverflow.com/questions/56687668/a-way-to-disable-type-argument-inference-in-generics/56688073#56688073
*
* Could be replaced with NoInfer utility type from TypeScript (https://www.typescriptlang.org/docs/handbook/utility-types.html#noinfertype), but that is only supported in TypeScript 5.4 or higher, so I should wait some time before using it.
*/
type NoInfer<T> = [T][T extends unknown ? 0 : never];
/**
* Special-purpose NoInfer variant for string unions used in array item positions.
*
* The NoInfer helper above doesn't prevent inference from array items in all cases, so this keeps
* config arrays like `postfixLookupClassGroups` from defining or narrowing class group IDs.
* Prefer TypeScript's built-in `NoInfer` when the minimum supported version is 5.4+.
*/
type NoInferString<T extends string> = T extends infer S ? S & string : never;
type AnyClassGroupIds = string;
type AnyThemeGroupIds = string;
/** Merger config with unrestricted class-group and theme-group IDs. */
type AnyConfig = Config<AnyClassGroupIds, AnyThemeGroupIds>;
/** Merger config: `override` replaces class groups, `extend` appends to them. */
interface ConfigExtension {
override?: Partial<AnyConfig>;
extend?: Partial<AnyConfig>;
}
/** Merger config for the built-in Tailwind conflict resolver. */
type TWMergeConfig = ConfigExtension & Partial<AnyConfig> & {
extend?: Partial<AnyConfig>;
override?: Partial<AnyConfig>;
};
type TWMConfig = {
/**
* Whether to merge conflicting Tailwind classes.
* @default true
*/
twMerge?: boolean;
/**
* Custom merger config (`extend` / `override`, or legacy flat fields).
*/
twMergeConfig?: TWMergeConfig;
};
type TVConfig = TWMConfig;
export type { ClassNameValue as C, TWMConfig as T, TVConfig as a, TWMergeConfig as b };

2
web/node_modules/tailwind-variants/dist/config.cjs generated vendored Normal file
View File

@@ -0,0 +1,2 @@
'use strict';

1
web/node_modules/tailwind-variants/dist/config.d.cts generated vendored Normal file
View File

@@ -0,0 +1 @@
export { a as TVConfig, T as TWMConfig, b as TWMergeConfig } from './config-bO3A8WhU.cjs';

1
web/node_modules/tailwind-variants/dist/config.d.ts generated vendored Normal file
View File

@@ -0,0 +1 @@
export { a as TVConfig, T as TWMConfig, b as TWMergeConfig } from './config-bO3A8WhU.js';

1
web/node_modules/tailwind-variants/dist/config.js generated vendored Normal file
View File

@@ -0,0 +1 @@

3329
web/node_modules/tailwind-variants/dist/index.cjs generated vendored Normal file

File diff suppressed because it is too large Load Diff

35
web/node_modules/tailwind-variants/dist/index.d.cts generated vendored Normal file
View File

@@ -0,0 +1,35 @@
import { CnOptions, CnReturn, TV } from './types.cjs';
export { ClassProp, OmitUndefined, StringToBoolean, TVCompoundSlots, TVCompoundVariants, TVDefaultVariants, TVLite, TVProps, TVReturnProps, TVReturnType, TVReturnTypeLike, TVScreenPropsValue, TVVariantKeys, TVVariants, VariantProps, WithInitialScreen, isTrueOrArray } from './types.cjs';
import { T as TWMConfig, a as TVConfig } from './config-bO3A8WhU.cjs';
export { C as ClassValue, b as TWMergeConfig } from './config-bO3A8WhU.cjs';
/**
* Combines class names and merges conflicting Tailwind classes (default config).
*/
declare const cn: <T extends CnOptions>(...classnames: T) => CnReturn;
/**
* Combines class names and merges conflicting Tailwind classes.
* Pass optional `twMerge` / `twMergeConfig` on the second call.
*/
declare const cnMerge: <T extends CnOptions>(...classnames: T) => ((config?: TWMConfig) => CnReturn);
/**
* Creates a variant-aware component function with Tailwind CSS classes.
* Supports variants, slots, compound variants, and component composition.
* @see https://www.tailwind-variants.org/docs/getting-started
*/
declare const tv: TV;
/**
* Creates a configured `tv` instance with custom default configuration.
*/
declare const createTV: (config: TVConfig) => TV;
/**
* Default configuration object for tailwind-variants.
*/
declare const defaultConfig: TVConfig;
/**
* Combines class names without merging conflicting Tailwind CSS classes.
*/
declare const cx: <T extends CnOptions>(...classnames: T) => CnReturn;
export { CnOptions, CnReturn, TV, TVConfig, TWMConfig, cn, cnMerge, createTV, cx, defaultConfig, tv };

35
web/node_modules/tailwind-variants/dist/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,35 @@
import { CnOptions, CnReturn, TV } from './types.js';
export { ClassProp, OmitUndefined, StringToBoolean, TVCompoundSlots, TVCompoundVariants, TVDefaultVariants, TVLite, TVProps, TVReturnProps, TVReturnType, TVReturnTypeLike, TVScreenPropsValue, TVVariantKeys, TVVariants, VariantProps, WithInitialScreen, isTrueOrArray } from './types.js';
import { T as TWMConfig, a as TVConfig } from './config-bO3A8WhU.js';
export { C as ClassValue, b as TWMergeConfig } from './config-bO3A8WhU.js';
/**
* Combines class names and merges conflicting Tailwind classes (default config).
*/
declare const cn: <T extends CnOptions>(...classnames: T) => CnReturn;
/**
* Combines class names and merges conflicting Tailwind classes.
* Pass optional `twMerge` / `twMergeConfig` on the second call.
*/
declare const cnMerge: <T extends CnOptions>(...classnames: T) => ((config?: TWMConfig) => CnReturn);
/**
* Creates a variant-aware component function with Tailwind CSS classes.
* Supports variants, slots, compound variants, and component composition.
* @see https://www.tailwind-variants.org/docs/getting-started
*/
declare const tv: TV;
/**
* Creates a configured `tv` instance with custom default configuration.
*/
declare const createTV: (config: TVConfig) => TV;
/**
* Default configuration object for tailwind-variants.
*/
declare const defaultConfig: TVConfig;
/**
* Combines class names without merging conflicting Tailwind CSS classes.
*/
declare const cx: <T extends CnOptions>(...classnames: T) => CnReturn;
export { CnOptions, CnReturn, TV, TVConfig, TWMConfig, cn, cnMerge, createTV, cx, defaultConfig, tv };

3322
web/node_modules/tailwind-variants/dist/index.js generated vendored Normal file

File diff suppressed because it is too large Load Diff

31
web/node_modules/tailwind-variants/dist/lite.cjs generated vendored Normal file
View File

@@ -0,0 +1,31 @@
'use strict';
var chunkHIKWJRSK_cjs = require('./chunk-HIKWJRSK.cjs');
var chunk2BFDQGZN_cjs = require('./chunk-2BFDQGZN.cjs');
// src/lite.ts
var cn = (...classnames) => {
return (_config) => {
const base = chunk2BFDQGZN_cjs.cx(classnames);
return base || void 0;
};
};
var cnAdapter = cn;
var classAdapter = (_config, ...classnames) => {
const result = chunk2BFDQGZN_cjs.cx(classnames);
return result || void 0;
};
var runtime = chunkHIKWJRSK_cjs.getTailwindVariants(classAdapter);
var tv = runtime.tv;
var createTV = runtime.createTV;
var defaultConfig2 = chunkHIKWJRSK_cjs.defaultConfig;
Object.defineProperty(exports, "cx", {
enumerable: true,
get: function () { return chunk2BFDQGZN_cjs.cx; }
});
exports.cn = cn;
exports.cnAdapter = cnAdapter;
exports.createTV = createTV;
exports.defaultConfig = defaultConfig2;
exports.tv = tv;

10
web/node_modules/tailwind-variants/dist/lite.d.cts generated vendored Normal file
View File

@@ -0,0 +1,10 @@
import { CnOptions, CnReturn, TVLite } from './types.cjs';
export { ClassProp, OmitUndefined, StringToBoolean, TV, TVCompoundSlots, TVCompoundVariants, TVDefaultVariants, TVProps, TVReturnProps, TVReturnType, TVReturnTypeLike, TVScreenPropsValue, TVVariantKeys, TVVariants, VariantProps, WithInitialScreen, isTrueOrArray } from './types.cjs';
export { cx } from './utils.cjs';
export { C as ClassValue } from './config-bO3A8WhU.cjs';
declare const cn: <T extends CnOptions>(...classnames: T) => ((config?: any) => CnReturn);
declare const tv: TVLite;
declare const createTV: () => TVLite;
export { CnOptions, CnReturn, TVLite, cn, createTV, tv };

10
web/node_modules/tailwind-variants/dist/lite.d.ts generated vendored Normal file
View File

@@ -0,0 +1,10 @@
import { CnOptions, CnReturn, TVLite } from './types.js';
export { ClassProp, OmitUndefined, StringToBoolean, TV, TVCompoundSlots, TVCompoundVariants, TVDefaultVariants, TVProps, TVReturnProps, TVReturnType, TVReturnTypeLike, TVScreenPropsValue, TVVariantKeys, TVVariants, VariantProps, WithInitialScreen, isTrueOrArray } from './types.js';
export { cx } from './utils.js';
export { C as ClassValue } from './config-bO3A8WhU.js';
declare const cn: <T extends CnOptions>(...classnames: T) => ((config?: any) => CnReturn);
declare const tv: TVLite;
declare const createTV: () => TVLite;
export { CnOptions, CnReturn, TVLite, cn, createTV, tv };

22
web/node_modules/tailwind-variants/dist/lite.js generated vendored Normal file
View File

@@ -0,0 +1,22 @@
import { getTailwindVariants, defaultConfig } from './chunk-SUL6UUW2.js';
import { cx } from './chunk-OYFAXDFZ.js';
export { cx } from './chunk-OYFAXDFZ.js';
// src/lite.ts
var cn = (...classnames) => {
return (_config) => {
const base = cx(classnames);
return base || void 0;
};
};
var cnAdapter = cn;
var classAdapter = (_config, ...classnames) => {
const result = cx(classnames);
return result || void 0;
};
var runtime = getTailwindVariants(classAdapter);
var tv = runtime.tv;
var createTV = runtime.createTV;
var defaultConfig2 = defaultConfig;
export { cn, cnAdapter, createTV, defaultConfig2 as defaultConfig, tv };

2
web/node_modules/tailwind-variants/dist/types.cjs generated vendored Normal file
View File

@@ -0,0 +1,2 @@
'use strict';

168
web/node_modules/tailwind-variants/dist/types.d.cts generated vendored Normal file
View File

@@ -0,0 +1,168 @@
import { C as ClassNameValue, a as TVConfig } from './config-bO3A8WhU.cjs';
type ClassProp<V = ClassNameValue> = {
class?: V;
className?: never;
} | {
class?: never;
className?: V;
};
type TVBaseName = "base";
type TVScreens = "initial";
type TVSlots = Record<string, ClassNameValue> | undefined;
type TVVariantsShape = Record<string, Record<string, unknown>> | undefined;
interface TVReturnTypeLike<V extends TVVariantsShape, S extends TVSlots> {
(...args: any[]): any;
variants: V;
slots: S;
}
type OmitUndefined<T> = T extends undefined ? never : T;
type StringToBoolean<T> = T extends "true" | "false" ? boolean : T;
type VariantValue<V, K> = K extends keyof V ? StringToBoolean<keyof V[K]> : never;
type VariantValueWithBooleanUndefined<V, K> = VariantValue<V, K> | (boolean extends VariantValue<V, K> ? undefined : never);
type CnClassValue = string | number | bigint | boolean | null | undefined | CnClassDictionary | CnClassArray;
interface CnClassDictionary {
[key: string]: any;
}
interface CnClassArray extends Array<CnClassValue> {
}
type CnOptions = CnClassValue[];
type CnReturn = string | undefined;
type isTrueOrArray<T> = T extends true | unknown[] ? true : false;
type WithInitialScreen<T extends Array<string>> = ["initial", ...T];
type TVSlotsWithBase<S extends TVSlots, B extends ClassNameValue> = keyof S | (B extends undefined ? never : TVBaseName);
type SlotsClassValue<S extends TVSlots, B extends ClassNameValue> = {
[K in TVSlotsWithBase<S, B>]?: ClassNameValue;
};
type TVVariantsDefault<S extends TVSlots, B extends ClassNameValue> = S extends undefined ? {} : {
[key: string]: {
[key: string]: S extends TVSlots ? SlotsClassValue<S, B> | ClassNameValue : ClassNameValue;
};
};
type TVVariants<S extends TVSlots | undefined, B extends ClassNameValue | undefined = undefined, EV extends TVVariantsShape = undefined, _ES extends TVSlots | undefined = undefined> = EV extends undefined ? TVVariantsDefault<S, B> : {
[K in keyof EV]: {
[K2 in keyof EV[K]]: S extends TVSlots ? SlotsClassValue<S, B> | ClassNameValue : ClassNameValue;
};
} | TVVariantsDefault<S, B>;
type TVCompoundVariants<V extends TVVariantsShape, S extends TVSlots, B extends ClassNameValue, EV extends TVVariantsShape, _ES extends TVSlots> = Array<{
[K in keyof V | keyof EV]?: VariantValueWithBooleanUndefined<V, K> | VariantValueWithBooleanUndefined<EV, K> | (K extends keyof V ? VariantValueWithBooleanUndefined<V, K>[] : never);
} & ClassProp<SlotsClassValue<S, B> | ClassNameValue>>;
type TVCompoundSlots<V extends TVVariantsShape, S extends TVSlots, B extends ClassNameValue> = Array<{
slots: Array<TVSlotsWithBase<S, B>>;
} & {
[K in keyof V]?: VariantValueWithBooleanUndefined<V, K> | VariantValueWithBooleanUndefined<V, K>[];
} & ClassProp>;
type TVDefaultVariants<V extends TVVariantsShape, _S extends TVSlots, EV extends TVVariantsShape, _ES extends TVSlots> = {
[K in keyof V | keyof EV]?: VariantValue<V, K> | VariantValue<EV, K>;
};
type TVScreenPropsValue<V extends TVVariantsShape, _S extends TVSlots, K extends keyof V> = {
[Screen in TVScreens]?: StringToBoolean<keyof V[K]>;
};
type TVProps<V extends TVVariantsShape, _S extends TVSlots, EV extends TVVariantsShape, _ES extends TVSlots> = EV extends undefined ? V extends undefined ? ClassProp<ClassNameValue> : {
[K in keyof V]?: VariantValue<V, K> | undefined;
} & ClassProp<ClassNameValue> : V extends undefined ? {
[K in keyof EV]?: VariantValue<EV, K> | undefined;
} & ClassProp<ClassNameValue> : {
[K in keyof V | keyof EV]?: VariantValue<V, K> | VariantValue<EV, K> | undefined;
} & ClassProp<ClassNameValue>;
type TVVariantKeys<V extends TVVariantsShape, _S extends TVSlots> = V extends undefined ? undefined : Array<keyof V>;
type TVMergedVariants<V extends TVVariantsShape, EV extends TVVariantsShape> = V extends undefined ? EV : EV extends undefined ? V : V & EV;
type TVMergedSlots<S extends TVSlots, ES extends TVSlots> = S extends undefined ? ES : ES extends undefined ? S : S & ES;
interface TVReturnProps<V extends TVVariantsShape, S extends TVSlots, B extends ClassNameValue, EV extends TVVariantsShape, ES extends TVSlots, E extends TVReturnTypeLike<any, any> | undefined = undefined> {
extend: E;
base: B;
slots: TVMergedSlots<S, ES>;
variants: TVMergedVariants<V, EV>;
defaultVariants: TVDefaultVariants<V, S, EV, ES>;
compoundVariants: TVCompoundVariants<V, S, B, EV, ES>;
compoundSlots: TVCompoundSlots<V, S, B>;
variantKeys: TVVariantKeys<TVMergedVariants<V, EV>, TVMergedSlots<S, ES>>;
}
type HasSlots<S extends TVSlots, ES extends TVSlots> = S extends undefined ? ES extends undefined ? false : true : true;
interface TVReturnType<V extends TVVariantsShape, S extends TVSlots, B extends ClassNameValue, EV extends TVVariantsShape, ES extends TVSlots, E extends TVReturnTypeLike<any, any> | undefined = undefined> extends TVReturnProps<V, S, B, EV, ES, E> {
(props?: TVProps<V, S, EV, ES>): HasSlots<S, ES> extends true ? {
[K in keyof (ES extends undefined ? {} : ES)]: (slotProps?: TVProps<V, S, EV, ES>) => string;
} & {
[K in keyof (S extends undefined ? {} : S)]: (slotProps?: TVProps<V, S, EV, ES>) => string;
} & {
[K in TVBaseName]: (slotProps?: TVProps<V, S, EV, ES>) => string;
} : string;
}
type TV = <V extends TVVariants<S, B, EV>, CV extends TVCompoundVariants<V, S, B, EV, ES>, DV extends TVDefaultVariants<V, S, EV, ES>, B extends ClassNameValue = undefined, S extends TVSlots = undefined, E extends TVReturnTypeLike<any, any> = TVReturnTypeLike<V, S>, EV extends TVVariants<ES, B, E["variants"], ES> = E["variants"], ES extends TVSlots = E["slots"] extends TVSlots ? E["slots"] : undefined>(options: {
/**
* Extend allows for easy composition of components.
* @see https://www.tailwind-variants.org/docs/composing-components
*/
extend?: E;
/**
* Base allows you to set a base class for a component.
*/
base?: B;
/**
* Slots allow you to separate a component into multiple parts.
* @see https://www.tailwind-variants.org/docs/slots
*/
slots?: S;
/**
* Variants allow you to create multiple versions of the same component.
* @see https://www.tailwind-variants.org/docs/variants#adding-variants
*/
variants?: V;
/**
* Compound variants allow you to apply classes to multiple variants at once.
* @see https://www.tailwind-variants.org/docs/variants#compound-variants
*/
compoundVariants?: CV;
/**
* Compound slots allow you to apply classes to multiple slots at once.
*/
compoundSlots?: TVCompoundSlots<V, S, B>;
/**
* Default variants allow you to set default variants for a component.
* @see https://www.tailwind-variants.org/docs/variants#default-variants
*/
defaultVariants?: DV;
},
/**
* The config object allows you to modify the default configuration.
* @see https://www.tailwind-variants.org/docs/api-reference#config-optional
*/
config?: TVConfig) => TVReturnType<V, S, B, EV, ES, E>;
type TVLite = <V extends TVVariants<S, B, EV>, CV extends TVCompoundVariants<V, S, B, EV, ES>, DV extends TVDefaultVariants<V, S, EV, ES>, B extends ClassNameValue = undefined, S extends TVSlots = undefined, E extends TVReturnTypeLike<any, any> = TVReturnTypeLike<V, S>, EV extends TVVariants<ES, B, E["variants"], ES> = E["variants"], ES extends TVSlots = E["slots"] extends TVSlots ? E["slots"] : undefined>(options: {
/**
* Extend allows for easy composition of components.
* @see https://www.tailwind-variants.org/docs/composing-components
*/
extend?: E;
/**
* Base allows you to set a base class for a component.
*/
base?: B;
/**
* Slots allow you to separate a component into multiple parts.
* @see https://www.tailwind-variants.org/docs/slots
*/
slots?: S;
/**
* Variants allow you to create multiple versions of the same component.
* @see https://www.tailwind-variants.org/docs/variants#adding-variants
*/
variants?: V;
/**
* Compound variants allow you to apply classes to multiple variants at once.
* @see https://www.tailwind-variants.org/docs/variants#compound-variants
*/
compoundVariants?: CV;
/**
* Compound slots allow you to apply classes to multiple slots at once.
*/
compoundSlots?: TVCompoundSlots<V, S, B>;
/**
* Default variants allow you to set default variants for a component.
* @see https://www.tailwind-variants.org/docs/variants#default-variants
*/
defaultVariants?: DV;
}) => TVReturnType<V, S, B, EV, ES, E>;
type VariantProps<Component extends (...args: any) => any> = Omit<OmitUndefined<Parameters<Component>[0]>, "class" | "className">;
export { type ClassProp, ClassNameValue as ClassValue, type CnOptions, type CnReturn, type OmitUndefined, type StringToBoolean, type TV, type TVCompoundSlots, type TVCompoundVariants, type TVDefaultVariants, type TVLite, type TVProps, type TVReturnProps, type TVReturnType, type TVReturnTypeLike, type TVScreenPropsValue, type TVVariantKeys, type TVVariants, type VariantProps, type WithInitialScreen, type isTrueOrArray };

168
web/node_modules/tailwind-variants/dist/types.d.ts generated vendored Normal file
View File

@@ -0,0 +1,168 @@
import { C as ClassNameValue, a as TVConfig } from './config-bO3A8WhU.js';
type ClassProp<V = ClassNameValue> = {
class?: V;
className?: never;
} | {
class?: never;
className?: V;
};
type TVBaseName = "base";
type TVScreens = "initial";
type TVSlots = Record<string, ClassNameValue> | undefined;
type TVVariantsShape = Record<string, Record<string, unknown>> | undefined;
interface TVReturnTypeLike<V extends TVVariantsShape, S extends TVSlots> {
(...args: any[]): any;
variants: V;
slots: S;
}
type OmitUndefined<T> = T extends undefined ? never : T;
type StringToBoolean<T> = T extends "true" | "false" ? boolean : T;
type VariantValue<V, K> = K extends keyof V ? StringToBoolean<keyof V[K]> : never;
type VariantValueWithBooleanUndefined<V, K> = VariantValue<V, K> | (boolean extends VariantValue<V, K> ? undefined : never);
type CnClassValue = string | number | bigint | boolean | null | undefined | CnClassDictionary | CnClassArray;
interface CnClassDictionary {
[key: string]: any;
}
interface CnClassArray extends Array<CnClassValue> {
}
type CnOptions = CnClassValue[];
type CnReturn = string | undefined;
type isTrueOrArray<T> = T extends true | unknown[] ? true : false;
type WithInitialScreen<T extends Array<string>> = ["initial", ...T];
type TVSlotsWithBase<S extends TVSlots, B extends ClassNameValue> = keyof S | (B extends undefined ? never : TVBaseName);
type SlotsClassValue<S extends TVSlots, B extends ClassNameValue> = {
[K in TVSlotsWithBase<S, B>]?: ClassNameValue;
};
type TVVariantsDefault<S extends TVSlots, B extends ClassNameValue> = S extends undefined ? {} : {
[key: string]: {
[key: string]: S extends TVSlots ? SlotsClassValue<S, B> | ClassNameValue : ClassNameValue;
};
};
type TVVariants<S extends TVSlots | undefined, B extends ClassNameValue | undefined = undefined, EV extends TVVariantsShape = undefined, _ES extends TVSlots | undefined = undefined> = EV extends undefined ? TVVariantsDefault<S, B> : {
[K in keyof EV]: {
[K2 in keyof EV[K]]: S extends TVSlots ? SlotsClassValue<S, B> | ClassNameValue : ClassNameValue;
};
} | TVVariantsDefault<S, B>;
type TVCompoundVariants<V extends TVVariantsShape, S extends TVSlots, B extends ClassNameValue, EV extends TVVariantsShape, _ES extends TVSlots> = Array<{
[K in keyof V | keyof EV]?: VariantValueWithBooleanUndefined<V, K> | VariantValueWithBooleanUndefined<EV, K> | (K extends keyof V ? VariantValueWithBooleanUndefined<V, K>[] : never);
} & ClassProp<SlotsClassValue<S, B> | ClassNameValue>>;
type TVCompoundSlots<V extends TVVariantsShape, S extends TVSlots, B extends ClassNameValue> = Array<{
slots: Array<TVSlotsWithBase<S, B>>;
} & {
[K in keyof V]?: VariantValueWithBooleanUndefined<V, K> | VariantValueWithBooleanUndefined<V, K>[];
} & ClassProp>;
type TVDefaultVariants<V extends TVVariantsShape, _S extends TVSlots, EV extends TVVariantsShape, _ES extends TVSlots> = {
[K in keyof V | keyof EV]?: VariantValue<V, K> | VariantValue<EV, K>;
};
type TVScreenPropsValue<V extends TVVariantsShape, _S extends TVSlots, K extends keyof V> = {
[Screen in TVScreens]?: StringToBoolean<keyof V[K]>;
};
type TVProps<V extends TVVariantsShape, _S extends TVSlots, EV extends TVVariantsShape, _ES extends TVSlots> = EV extends undefined ? V extends undefined ? ClassProp<ClassNameValue> : {
[K in keyof V]?: VariantValue<V, K> | undefined;
} & ClassProp<ClassNameValue> : V extends undefined ? {
[K in keyof EV]?: VariantValue<EV, K> | undefined;
} & ClassProp<ClassNameValue> : {
[K in keyof V | keyof EV]?: VariantValue<V, K> | VariantValue<EV, K> | undefined;
} & ClassProp<ClassNameValue>;
type TVVariantKeys<V extends TVVariantsShape, _S extends TVSlots> = V extends undefined ? undefined : Array<keyof V>;
type TVMergedVariants<V extends TVVariantsShape, EV extends TVVariantsShape> = V extends undefined ? EV : EV extends undefined ? V : V & EV;
type TVMergedSlots<S extends TVSlots, ES extends TVSlots> = S extends undefined ? ES : ES extends undefined ? S : S & ES;
interface TVReturnProps<V extends TVVariantsShape, S extends TVSlots, B extends ClassNameValue, EV extends TVVariantsShape, ES extends TVSlots, E extends TVReturnTypeLike<any, any> | undefined = undefined> {
extend: E;
base: B;
slots: TVMergedSlots<S, ES>;
variants: TVMergedVariants<V, EV>;
defaultVariants: TVDefaultVariants<V, S, EV, ES>;
compoundVariants: TVCompoundVariants<V, S, B, EV, ES>;
compoundSlots: TVCompoundSlots<V, S, B>;
variantKeys: TVVariantKeys<TVMergedVariants<V, EV>, TVMergedSlots<S, ES>>;
}
type HasSlots<S extends TVSlots, ES extends TVSlots> = S extends undefined ? ES extends undefined ? false : true : true;
interface TVReturnType<V extends TVVariantsShape, S extends TVSlots, B extends ClassNameValue, EV extends TVVariantsShape, ES extends TVSlots, E extends TVReturnTypeLike<any, any> | undefined = undefined> extends TVReturnProps<V, S, B, EV, ES, E> {
(props?: TVProps<V, S, EV, ES>): HasSlots<S, ES> extends true ? {
[K in keyof (ES extends undefined ? {} : ES)]: (slotProps?: TVProps<V, S, EV, ES>) => string;
} & {
[K in keyof (S extends undefined ? {} : S)]: (slotProps?: TVProps<V, S, EV, ES>) => string;
} & {
[K in TVBaseName]: (slotProps?: TVProps<V, S, EV, ES>) => string;
} : string;
}
type TV = <V extends TVVariants<S, B, EV>, CV extends TVCompoundVariants<V, S, B, EV, ES>, DV extends TVDefaultVariants<V, S, EV, ES>, B extends ClassNameValue = undefined, S extends TVSlots = undefined, E extends TVReturnTypeLike<any, any> = TVReturnTypeLike<V, S>, EV extends TVVariants<ES, B, E["variants"], ES> = E["variants"], ES extends TVSlots = E["slots"] extends TVSlots ? E["slots"] : undefined>(options: {
/**
* Extend allows for easy composition of components.
* @see https://www.tailwind-variants.org/docs/composing-components
*/
extend?: E;
/**
* Base allows you to set a base class for a component.
*/
base?: B;
/**
* Slots allow you to separate a component into multiple parts.
* @see https://www.tailwind-variants.org/docs/slots
*/
slots?: S;
/**
* Variants allow you to create multiple versions of the same component.
* @see https://www.tailwind-variants.org/docs/variants#adding-variants
*/
variants?: V;
/**
* Compound variants allow you to apply classes to multiple variants at once.
* @see https://www.tailwind-variants.org/docs/variants#compound-variants
*/
compoundVariants?: CV;
/**
* Compound slots allow you to apply classes to multiple slots at once.
*/
compoundSlots?: TVCompoundSlots<V, S, B>;
/**
* Default variants allow you to set default variants for a component.
* @see https://www.tailwind-variants.org/docs/variants#default-variants
*/
defaultVariants?: DV;
},
/**
* The config object allows you to modify the default configuration.
* @see https://www.tailwind-variants.org/docs/api-reference#config-optional
*/
config?: TVConfig) => TVReturnType<V, S, B, EV, ES, E>;
type TVLite = <V extends TVVariants<S, B, EV>, CV extends TVCompoundVariants<V, S, B, EV, ES>, DV extends TVDefaultVariants<V, S, EV, ES>, B extends ClassNameValue = undefined, S extends TVSlots = undefined, E extends TVReturnTypeLike<any, any> = TVReturnTypeLike<V, S>, EV extends TVVariants<ES, B, E["variants"], ES> = E["variants"], ES extends TVSlots = E["slots"] extends TVSlots ? E["slots"] : undefined>(options: {
/**
* Extend allows for easy composition of components.
* @see https://www.tailwind-variants.org/docs/composing-components
*/
extend?: E;
/**
* Base allows you to set a base class for a component.
*/
base?: B;
/**
* Slots allow you to separate a component into multiple parts.
* @see https://www.tailwind-variants.org/docs/slots
*/
slots?: S;
/**
* Variants allow you to create multiple versions of the same component.
* @see https://www.tailwind-variants.org/docs/variants#adding-variants
*/
variants?: V;
/**
* Compound variants allow you to apply classes to multiple variants at once.
* @see https://www.tailwind-variants.org/docs/variants#compound-variants
*/
compoundVariants?: CV;
/**
* Compound slots allow you to apply classes to multiple slots at once.
*/
compoundSlots?: TVCompoundSlots<V, S, B>;
/**
* Default variants allow you to set default variants for a component.
* @see https://www.tailwind-variants.org/docs/variants#default-variants
*/
defaultVariants?: DV;
}) => TVReturnType<V, S, B, EV, ES, E>;
type VariantProps<Component extends (...args: any) => any> = Omit<OmitUndefined<Parameters<Component>[0]>, "class" | "className">;
export { type ClassProp, ClassNameValue as ClassValue, type CnOptions, type CnReturn, type OmitUndefined, type StringToBoolean, type TV, type TVCompoundSlots, type TVCompoundVariants, type TVDefaultVariants, type TVLite, type TVProps, type TVReturnProps, type TVReturnType, type TVReturnTypeLike, type TVScreenPropsValue, type TVVariantKeys, type TVVariants, type VariantProps, type WithInitialScreen, type isTrueOrArray };

1
web/node_modules/tailwind-variants/dist/types.js generated vendored Normal file
View File

@@ -0,0 +1 @@

50
web/node_modules/tailwind-variants/dist/utils.cjs generated vendored Normal file
View File

@@ -0,0 +1,50 @@
'use strict';
var chunk2BFDQGZN_cjs = require('./chunk-2BFDQGZN.cjs');
Object.defineProperty(exports, "cx", {
enumerable: true,
get: function () { return chunk2BFDQGZN_cjs.cx; }
});
Object.defineProperty(exports, "falsyToString", {
enumerable: true,
get: function () { return chunk2BFDQGZN_cjs.falsyToString; }
});
Object.defineProperty(exports, "flat", {
enumerable: true,
get: function () { return chunk2BFDQGZN_cjs.flat; }
});
Object.defineProperty(exports, "flatArray", {
enumerable: true,
get: function () { return chunk2BFDQGZN_cjs.flatArray; }
});
Object.defineProperty(exports, "flatMergeArrays", {
enumerable: true,
get: function () { return chunk2BFDQGZN_cjs.flatMergeArrays; }
});
Object.defineProperty(exports, "isBoolean", {
enumerable: true,
get: function () { return chunk2BFDQGZN_cjs.isBoolean; }
});
Object.defineProperty(exports, "isEmptyObject", {
enumerable: true,
get: function () { return chunk2BFDQGZN_cjs.isEmptyObject; }
});
Object.defineProperty(exports, "isEqual", {
enumerable: true,
get: function () { return chunk2BFDQGZN_cjs.isEqual; }
});
Object.defineProperty(exports, "joinObjects", {
enumerable: true,
get: function () { return chunk2BFDQGZN_cjs.joinObjects; }
});
Object.defineProperty(exports, "mergeObjects", {
enumerable: true,
get: function () { return chunk2BFDQGZN_cjs.mergeObjects; }
});
Object.defineProperty(exports, "removeExtraSpaces", {
enumerable: true,
get: function () { return chunk2BFDQGZN_cjs.removeExtraSpaces; }
});

16
web/node_modules/tailwind-variants/dist/utils.d.cts generated vendored Normal file
View File

@@ -0,0 +1,16 @@
import { CnOptions, CnReturn } from './types.cjs';
import './config-bO3A8WhU.cjs';
declare const removeExtraSpaces: (str: string) => string;
declare const cx: <T extends CnOptions>(...classnames: T) => CnReturn;
declare const falsyToString: <T>(value: T) => T | string;
declare const isEmptyObject: (obj: unknown) => boolean;
declare const isEqual: (obj1: object, obj2: object) => boolean;
declare const isBoolean: (value: unknown) => boolean;
declare const joinObjects: <T extends Record<string, unknown>, U extends Record<string, unknown>>(obj1: T, obj2: U) => T & U;
declare const flat: <T>(arr: unknown[], target: T[]) => void;
declare function flatArray<T>(arr: unknown[]): T[];
declare const flatMergeArrays: <T>(...arrays: unknown[][]) => T[];
declare const mergeObjects: <T extends object, U extends object>(obj1: T, obj2: U) => Record<string, unknown>;
export { cx, falsyToString, flat, flatArray, flatMergeArrays, isBoolean, isEmptyObject, isEqual, joinObjects, mergeObjects, removeExtraSpaces };

16
web/node_modules/tailwind-variants/dist/utils.d.ts generated vendored Normal file
View File

@@ -0,0 +1,16 @@
import { CnOptions, CnReturn } from './types.js';
import './config-bO3A8WhU.js';
declare const removeExtraSpaces: (str: string) => string;
declare const cx: <T extends CnOptions>(...classnames: T) => CnReturn;
declare const falsyToString: <T>(value: T) => T | string;
declare const isEmptyObject: (obj: unknown) => boolean;
declare const isEqual: (obj1: object, obj2: object) => boolean;
declare const isBoolean: (value: unknown) => boolean;
declare const joinObjects: <T extends Record<string, unknown>, U extends Record<string, unknown>>(obj1: T, obj2: U) => T & U;
declare const flat: <T>(arr: unknown[], target: T[]) => void;
declare function flatArray<T>(arr: unknown[]): T[];
declare const flatMergeArrays: <T>(...arrays: unknown[][]) => T[];
declare const mergeObjects: <T extends object, U extends object>(obj1: T, obj2: U) => Record<string, unknown>;
export { cx, falsyToString, flat, flatArray, flatMergeArrays, isBoolean, isEmptyObject, isEqual, joinObjects, mergeObjects, removeExtraSpaces };

1
web/node_modules/tailwind-variants/dist/utils.js generated vendored Normal file
View File

@@ -0,0 +1 @@
export { cx, falsyToString, flat, flatArray, flatMergeArrays, isBoolean, isEmptyObject, isEqual, joinObjects, mergeObjects, removeExtraSpaces } from './chunk-OYFAXDFZ.js';

118
web/node_modules/tailwind-variants/package.json generated vendored Normal file
View File

@@ -0,0 +1,118 @@
{
"name": "tailwind-variants",
"version": "3.3.1",
"description": "🦄 Tailwindcss first-class variant API",
"keywords": [
"tailwindcss",
"classes",
"responsive",
"variants",
"styled",
"styles"
],
"author": "Junior Garcia <jrgarciadev@gmail.com>",
"license": "MIT",
"repository": {
"type": "git",
"url": "https://github.com/heroui-inc/tailwind-variants"
},
"bugs": {
"url": "https://github.com/heroui-inc/tailwind-variants/issues"
},
"type": "module",
"main": "./dist/index.cjs",
"module": "./dist/index.js",
"types": "./dist/index.d.ts",
"exports": {
".": {
"import": {
"types": "./dist/index.d.ts",
"default": "./dist/index.js"
},
"require": {
"types": "./dist/index.d.cts",
"default": "./dist/index.cjs"
}
},
"./lite": {
"import": {
"types": "./dist/lite.d.ts",
"default": "./dist/lite.js"
},
"require": {
"types": "./dist/lite.d.cts",
"default": "./dist/lite.cjs"
}
},
"./utils": {
"import": {
"types": "./dist/utils.d.ts",
"default": "./dist/utils.js"
},
"require": {
"types": "./dist/utils.d.cts",
"default": "./dist/utils.cjs"
}
},
"./dist/*": "./dist/*",
"./package.json": "./package.json"
},
"sideEffects": false,
"files": [
"dist",
"README.md",
"LICENSE"
],
"publishConfig": {
"access": "public"
},
"devDependencies": {
"@biomejs/biome": "2.5.5",
"@commitlint/cli": "21.2.1",
"@commitlint/config-conventional": "21.2.0",
"@commitlint/types": "21.2.0",
"@types/node": "26.1.1",
"bumpp": "11.1.0",
"changelogithub": "14.0.0",
"conventional-changelog": "8.1.0",
"conventional-changelog-angular": "9.2.1",
"esbuild": "0.28.1",
"tailwind-merge": "3.6.0",
"tinybench": "6.1.2",
"tsup": "8.5.1",
"typescript": "5.6.3",
"vitest": "4.1.10"
},
"peerDependencies": {
"tailwind-merge": ">=3.0.0",
"tailwindcss": "*"
},
"peerDependenciesMeta": {
"tailwind-merge": {
"optional": true
},
"tailwindcss": {
"optional": true
}
},
"engines": {
"pnpm": ">=7.x",
"node": ">=16.9.x"
},
"scripts": {
"dev": "tsup --config .config/tsup.config.ts --watch",
"build": "tsup --config .config/tsup.config.ts",
"typecheck": "tsc --noEmit && pnpm typecheck:types",
"typecheck:types": "tsc -p .config/tsconfig.type-tests.json",
"benchmark": "pnpm build && node benchmark/run.mjs",
"lint": "biome check .",
"lint:fix": "biome check --write .",
"test": "vitest run --config .config/vitest.config.ts",
"test:watch": "vitest --config .config/vitest.config.ts",
"changelog": "conventional-changelog -p angular -i CHANGELOG.md -s --commit-path .",
"release": "bumpp --execute='pnpm run changelog' --all",
"release:check": "pnpm run lint && pnpm run typecheck && pnpm run test && pnpm run build",
"clean": "pnpm clean:cache && pnpm i",
"clean:cache": "find . \\( -name 'dist' -o -name 'node_modules' -o -name 'pnpm-lock.yaml' \\) -prune -exec rm -rf '{}' +"
}
}