@onu-ui/preset
Advanced tools
Comparing version 1.0.8-beta.3 to 1.0.8
@@ -1,8 +0,5 @@ | ||
import { ParsedColorValue, Preset } from 'unocss'; | ||
import { Theme } from '@unocss/preset-uno'; | ||
import { Preset } from 'unocss'; | ||
declare const theme: Theme; | ||
declare function parseColors(body: string, _theme?: Theme): ParsedColorValue | undefined; | ||
declare function presetOnu(): Preset; | ||
export { parseColors, presetOnu, theme }; | ||
export { presetOnu }; |
@@ -1,897 +0,9 @@ | ||
"use strict"; | ||
var __defProp = Object.defineProperty; | ||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor; | ||
var __getOwnPropNames = Object.getOwnPropertyNames; | ||
var __hasOwnProp = Object.prototype.hasOwnProperty; | ||
var __export = (target, all) => { | ||
for (var name in all) | ||
__defProp(target, name, { get: all[name], enumerable: true }); | ||
}; | ||
var __copyProps = (to, from, except, desc) => { | ||
if (from && typeof from === "object" || typeof from === "function") { | ||
for (let key of __getOwnPropNames(from)) | ||
if (!__hasOwnProp.call(to, key) && key !== except) | ||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); | ||
} | ||
return to; | ||
}; | ||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); | ||
// src/index.ts | ||
var src_exports = {}; | ||
__export(src_exports, { | ||
parseColors: () => parseColors, | ||
presetOnu: () => presetOnu, | ||
theme: () => theme | ||
}); | ||
module.exports = __toCommonJS(src_exports); | ||
// ../../node_modules/.pnpm/@unocss+core@0.45.13/node_modules/@unocss/core/dist/index.mjs | ||
function escapeRegExp(string) { | ||
return string.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"); | ||
} | ||
function escapeSelector(str) { | ||
const length = str.length; | ||
let index = -1; | ||
let codeUnit; | ||
let result = ""; | ||
const firstCodeUnit = str.charCodeAt(0); | ||
while (++index < length) { | ||
codeUnit = str.charCodeAt(index); | ||
if (codeUnit === 0) { | ||
result += "\uFFFD"; | ||
continue; | ||
} | ||
if (codeUnit === 44) { | ||
result += "\\,"; | ||
continue; | ||
} | ||
if (codeUnit >= 1 && codeUnit <= 31 || codeUnit === 127 || index === 0 && codeUnit >= 48 && codeUnit <= 57 || index === 1 && codeUnit >= 48 && codeUnit <= 57 && firstCodeUnit === 45) { | ||
result += `\\${codeUnit.toString(16)} `; | ||
continue; | ||
} | ||
if (index === 0 && length === 1 && codeUnit === 45) { | ||
result += `\\${str.charAt(index)}`; | ||
continue; | ||
} | ||
if (codeUnit >= 128 || codeUnit === 45 || codeUnit === 95 || codeUnit >= 48 && codeUnit <= 57 || codeUnit >= 65 && codeUnit <= 90 || codeUnit >= 97 && codeUnit <= 122) { | ||
result += str.charAt(index); | ||
continue; | ||
} | ||
result += `\\${str.charAt(index)}`; | ||
} | ||
return result; | ||
} | ||
function createValueHandler(handlers) { | ||
const handler2 = function(str) { | ||
var _a; | ||
const s = ((_a = this.__options) == null ? void 0 : _a.sequence) || []; | ||
this.__options.sequence = []; | ||
for (const n of s) { | ||
const res = handlers[n](str); | ||
if (res != null) | ||
return res; | ||
} | ||
}; | ||
function addProcessor(that, name) { | ||
if (!that.__options) { | ||
that.__options = { | ||
sequence: [] | ||
}; | ||
} | ||
that.__options.sequence.push(name); | ||
return that; | ||
} | ||
for (const name of Object.keys(handlers)) { | ||
Object.defineProperty(handler2, name, { | ||
enumerable: true, | ||
get() { | ||
return addProcessor(this, name); | ||
} | ||
}); | ||
} | ||
return handler2; | ||
} | ||
var LAYER_DEFAULT = "default"; | ||
var LAYER_PREFLIGHTS = "preflights"; | ||
var LAYER_SHORTCUTS = "shortcuts"; | ||
var DEAFULT_LAYERS = { | ||
[LAYER_PREFLIGHTS]: -100, | ||
[LAYER_SHORTCUTS]: -10, | ||
[LAYER_DEFAULT]: 0 | ||
}; | ||
// ../../node_modules/.pnpm/@unocss+preset-mini@0.45.13/node_modules/@unocss/preset-mini/dist/shared/preset-mini.d6dbef00.mjs | ||
var directionMap = { | ||
"l": ["-left"], | ||
"r": ["-right"], | ||
"t": ["-top"], | ||
"b": ["-bottom"], | ||
"s": ["-inline-start"], | ||
"e": ["-inline-end"], | ||
"x": ["-left", "-right"], | ||
"y": ["-top", "-bottom"], | ||
"": [""], | ||
"bs": ["-block-start"], | ||
"be": ["-block-end"], | ||
"is": ["-inline-start"], | ||
"ie": ["-inline-end"], | ||
"block": ["-block-start", "-block-end"], | ||
"inline": ["-inline-start", "-inline-end"] | ||
}; | ||
var insetMap = { | ||
...directionMap, | ||
s: ["-inset-inline-start"], | ||
e: ["-inset-inline-end"], | ||
bs: ["-inset-block-start"], | ||
be: ["-inset-block-end"], | ||
is: ["-inset-inline-start"], | ||
ie: ["-inset-inline-end"], | ||
block: ["-inset-block-start", "-inset-block-end"], | ||
inline: ["-inset-inline-start", "-inset-inline-end"] | ||
}; | ||
var basePositionMap = [ | ||
"top", | ||
"top center", | ||
"top left", | ||
"top right", | ||
"bottom", | ||
"bottom center", | ||
"bottom left", | ||
"bottom right", | ||
"left", | ||
"left center", | ||
"left top", | ||
"left bottom", | ||
"right", | ||
"right center", | ||
"right top", | ||
"right bottom", | ||
"center", | ||
"center top", | ||
"center bottom", | ||
"center left", | ||
"center right", | ||
"center center" | ||
]; | ||
var positionMap = Object.assign( | ||
{}, | ||
...basePositionMap.map((p) => ({ [p.replace(/ /, "-")]: p })), | ||
...basePositionMap.map((p) => ({ [p.replace(/\b(\w)\w+/g, "$1").replace(/ /, "")]: p })) | ||
); | ||
var globalKeywords = [ | ||
"inherit", | ||
"initial", | ||
"revert", | ||
"revert-layer", | ||
"unset" | ||
]; | ||
var numberWithUnitRE = /^(-?[0-9.]+)(px|pt|pc|rem|em|%|vh|vw|in|cm|mm|ex|ch|vmin|vmax|cqw|cqh|cqi|cqb|cqmin|cqmax|rpx)?$/i; | ||
var numberRE = /^(-?[0-9.]+)$/i; | ||
var unitOnlyRE = /^(px)$/i; | ||
var cssProps = [ | ||
"color", | ||
"border-color", | ||
"background-color", | ||
"flex-grow", | ||
"flex", | ||
"flex-shrink", | ||
"caret-color", | ||
"font", | ||
"gap", | ||
"opacity", | ||
"visibility", | ||
"z-index", | ||
"font-weight", | ||
"zoom", | ||
"text-shadow", | ||
"transform", | ||
"box-shadow", | ||
"backround-position", | ||
"left", | ||
"right", | ||
"top", | ||
"bottom", | ||
"object-position", | ||
"max-height", | ||
"min-height", | ||
"max-width", | ||
"min-width", | ||
"height", | ||
"width", | ||
"border-width", | ||
"margin", | ||
"padding", | ||
"outline-width", | ||
"outline-offset", | ||
"font-size", | ||
"line-height", | ||
"text-indent", | ||
"vertical-align", | ||
"border-spacing", | ||
"letter-spacing", | ||
"word-spacing", | ||
"stroke", | ||
"filter", | ||
"backdrop-filter", | ||
"fill", | ||
"mask", | ||
"mask-size", | ||
"mask-border", | ||
"clip-path", | ||
"clip", | ||
"border-radius" | ||
]; | ||
function round(n) { | ||
return n.toFixed(10).replace(/\.0+$/, "").replace(/(\.\d+?)0+$/, "$1"); | ||
} | ||
function numberWithUnit(str) { | ||
const match = str.match(numberWithUnitRE); | ||
if (!match) | ||
return; | ||
const [, n, unit] = match; | ||
const num = parseFloat(n); | ||
if (unit && !Number.isNaN(num)) | ||
return `${round(num)}${unit}`; | ||
} | ||
function auto(str) { | ||
if (str === "auto" || str === "a") | ||
return "auto"; | ||
} | ||
function rem(str) { | ||
if (str.match(unitOnlyRE)) | ||
return `1${str}`; | ||
const match = str.match(numberWithUnitRE); | ||
if (!match) | ||
return; | ||
const [, n, unit] = match; | ||
const num = parseFloat(n); | ||
if (!Number.isNaN(num)) | ||
return unit ? `${round(num)}${unit}` : `${round(num / 4)}rem`; | ||
} | ||
function px(str) { | ||
if (str.match(unitOnlyRE)) | ||
return `1${str}`; | ||
const match = str.match(numberWithUnitRE); | ||
if (!match) | ||
return; | ||
const [, n, unit] = match; | ||
const num = parseFloat(n); | ||
if (!Number.isNaN(num)) | ||
return unit ? `${round(num)}${unit}` : `${round(num)}px`; | ||
} | ||
function number(str) { | ||
if (!numberRE.test(str)) | ||
return; | ||
const num = parseFloat(str); | ||
if (!Number.isNaN(num)) | ||
return round(num); | ||
} | ||
function percent(str) { | ||
if (str.endsWith("%")) | ||
str = str.slice(0, -1); | ||
const num = parseFloat(str); | ||
if (!Number.isNaN(num)) | ||
return `${round(num / 100)}`; | ||
} | ||
function fraction(str) { | ||
if (str === "full") | ||
return "100%"; | ||
const [left, right] = str.split("/"); | ||
const num = parseFloat(left) / parseFloat(right); | ||
if (!Number.isNaN(num)) | ||
return `${round(num * 100)}%`; | ||
} | ||
var bracketTypeRe = /^\[(color|length|position):/i; | ||
function bracketWithType(str, type) { | ||
if (str && str.startsWith("[") && str.endsWith("]")) { | ||
let base; | ||
const match = str.match(bracketTypeRe); | ||
if (!match) | ||
base = str.slice(1, -1); | ||
else if (type && match[1] === type) | ||
base = str.slice(match[0].length, -1); | ||
if (!base) | ||
return; | ||
let curly = 0; | ||
for (const i of base) { | ||
if (i === "[") { | ||
curly += 1; | ||
} else if (i === "]") { | ||
curly -= 1; | ||
if (curly < 0) | ||
return; | ||
} | ||
} | ||
if (curly) | ||
return; | ||
return base.replace(/(url\(.*?\))/g, (v) => v.replace(/_/g, "\\_")).replace(/([^\\])_/g, "$1 ").replace(/(?:calc|clamp|max|min)\((.*)/g, (v) => { | ||
return v.replace(/(-?\d*\.?\d(?!\b-.+[,)](?![^+\-/*])\D)(?:%|[a-z]+)?|\))([+\-/*])/g, "$1 $2 "); | ||
}); | ||
} | ||
} | ||
function bracket(str) { | ||
return bracketWithType(str); | ||
} | ||
function bracketOfColor(str) { | ||
return bracketWithType(str, "color"); | ||
} | ||
function bracketOfLength(str) { | ||
return bracketWithType(str, "length"); | ||
} | ||
function bracketOfPosition(str) { | ||
return bracketWithType(str, "position"); | ||
} | ||
function cssvar(str) { | ||
if (str.match(/^\$\S/)) | ||
return `var(--${escapeSelector(str.slice(1))})`; | ||
} | ||
function time(str) { | ||
const match = str.match(/^(-?[0-9.]+)(s|ms)?$/i); | ||
if (!match) | ||
return; | ||
const [, n, unit] = match; | ||
const num = parseFloat(n); | ||
if (!Number.isNaN(num)) | ||
return unit ? `${round(num)}${unit}` : `${round(num)}ms`; | ||
} | ||
function degree(str) { | ||
const match = str.match(/^(-?[0-9.]+)(deg|rad|grad|turn)?$/i); | ||
if (!match) | ||
return; | ||
const [, n, unit] = match; | ||
const num = parseFloat(n); | ||
if (!Number.isNaN(num)) | ||
return unit ? `${round(num)}${unit}` : `${round(num)}deg`; | ||
} | ||
function global(str) { | ||
if (globalKeywords.includes(str)) | ||
return str; | ||
} | ||
function properties(str) { | ||
if (str.split(",").every((prop) => cssProps.includes(prop))) | ||
return str; | ||
} | ||
function position(str) { | ||
if (["top", "left", "right", "bottom", "center"].includes(str)) | ||
return str; | ||
} | ||
var valueHandlers = { | ||
__proto__: null, | ||
numberWithUnit, | ||
auto, | ||
rem, | ||
px, | ||
number, | ||
percent, | ||
fraction, | ||
bracket, | ||
bracketOfColor, | ||
bracketOfLength, | ||
bracketOfPosition, | ||
cssvar, | ||
time, | ||
degree, | ||
global, | ||
properties, | ||
position | ||
}; | ||
var handler = createValueHandler(valueHandlers); | ||
function getThemeColor(theme2, colors) { | ||
let obj = theme2.colors; | ||
let index = -1; | ||
for (const c of colors) { | ||
index += 1; | ||
if (obj && typeof obj !== "string") { | ||
const camel = colors.slice(index).join("-").replace(/(-[a-z])/g, (n) => n.slice(1).toUpperCase()); | ||
if (obj[camel]) | ||
return obj[camel]; | ||
if (obj[c]) { | ||
obj = obj[c]; | ||
continue; | ||
} | ||
} | ||
return void 0; | ||
} | ||
return obj; | ||
} | ||
function parseColor$1(body, theme2) { | ||
const split = body.split(/(?:\/|:)/); | ||
let main, opacity; | ||
if (split[0] === "[color") { | ||
main = split.slice(0, 2).join(":"); | ||
opacity = split[2]; | ||
} else { | ||
[main, opacity] = split; | ||
} | ||
const colors = main.replace(/([a-z])([0-9])/g, "$1-$2").split(/-/g); | ||
const [name] = colors; | ||
if (!name) | ||
return; | ||
let color; | ||
const bracket2 = handler.bracketOfColor(main); | ||
const bracketOrMain = bracket2 || main; | ||
if (bracketOrMain.match(/^#[\da-fA-F]+/g)) | ||
color = bracketOrMain; | ||
else if (bracketOrMain.match(/^hex-[\da-fA-F]+/g)) | ||
color = `#${bracketOrMain.slice(4)}`; | ||
else if (main.startsWith("$")) | ||
color = handler.cssvar(main); | ||
color = color || bracket2; | ||
let no = "DEFAULT"; | ||
if (!color) { | ||
let colorData; | ||
const [scale] = colors.slice(-1); | ||
if (scale.match(/^\d+$/)) { | ||
no = scale; | ||
colorData = getThemeColor(theme2, colors.slice(0, -1)); | ||
if (!colorData || typeof colorData === "string") | ||
color = void 0; | ||
else | ||
color = colorData[no]; | ||
} else { | ||
colorData = getThemeColor(theme2, colors); | ||
if (!colorData && colors.length <= 2) { | ||
[, no = no] = colors; | ||
colorData = getThemeColor(theme2, [name]); | ||
} | ||
if (typeof colorData === "string") | ||
color = colorData; | ||
else if (no && colorData) | ||
color = colorData[no]; | ||
} | ||
} | ||
return { | ||
opacity, | ||
name, | ||
no, | ||
color, | ||
cssColor: parseCssColor(color), | ||
alpha: handler.bracket.cssvar.percent(opacity ?? "") | ||
}; | ||
} | ||
function getComponent(str, open, close, separator) { | ||
if (str === "") | ||
return; | ||
const l = str.length; | ||
let parenthesis = 0; | ||
for (let i = 0; i < l; i++) { | ||
switch (str[i]) { | ||
case open: | ||
parenthesis++; | ||
break; | ||
case close: | ||
if (--parenthesis < 0) | ||
return; | ||
break; | ||
case separator: | ||
if (parenthesis === 0) { | ||
if (i === 0 || i === l - 1) | ||
return; | ||
return [ | ||
str.slice(0, i), | ||
str.slice(i + 1) | ||
]; | ||
} | ||
} | ||
} | ||
return [ | ||
str, | ||
"" | ||
]; | ||
} | ||
function getComponents(str, separator, limit) { | ||
if (separator.length !== 1) | ||
return; | ||
limit = limit ?? 10; | ||
const components = []; | ||
let i = 0; | ||
while (str !== "") { | ||
if (++i > limit) | ||
return; | ||
const componentPair = getComponent(str, "(", ")", separator); | ||
if (!componentPair) | ||
return; | ||
const [component, rest] = componentPair; | ||
components.push(component); | ||
str = rest; | ||
} | ||
if (components.length > 0) | ||
return components; | ||
} | ||
var cssColorFunctions = ["hsl", "hsla", "hwb", "lab", "lch", "oklab", "oklch", "rgb", "rgba"]; | ||
var alphaPlaceholders = ["%alpha", "<alpha-value>"]; | ||
var alphaPlaceholdersRE = new RegExp(alphaPlaceholders.map((v) => escapeRegExp(v)).join("|")); | ||
function parseCssColor(str = "") { | ||
const color = parseColor(str); | ||
if (color == null || color === false) | ||
return; | ||
const { type: casedType, components, alpha } = color; | ||
const type = casedType.toLowerCase(); | ||
if (components.length === 0) | ||
return; | ||
if (["rgba", "hsla"].includes(type) && alpha == null) | ||
return; | ||
if (cssColorFunctions.includes(type) && ![1, 3].includes(components.length)) | ||
return; | ||
return { | ||
type, | ||
components: components.map((c) => typeof c === "string" ? c.trim() : c), | ||
alpha: typeof alpha === "string" ? alpha.trim() : alpha | ||
}; | ||
} | ||
function parseColor(str) { | ||
if (!str) | ||
return; | ||
let color = parseHexColor(str); | ||
if (color != null) | ||
return color; | ||
color = cssColorKeyword(str); | ||
if (color != null) | ||
return color; | ||
color = parseCssCommaColorFunction(str); | ||
if (color != null) | ||
return color; | ||
color = parseCssSpaceColorFunction(str); | ||
if (color != null) | ||
return color; | ||
color = parseCssColorFunction(str); | ||
if (color != null) | ||
return color; | ||
} | ||
function parseHexColor(str) { | ||
const [, body] = str.match(/^#([\da-f]+)$/i) || []; | ||
if (!body) | ||
return; | ||
switch (body.length) { | ||
case 3: | ||
case 4: | ||
const digits = Array.from(body, (s) => Number.parseInt(s, 16)).map((n) => n << 4 | n); | ||
return { | ||
type: "rgb", | ||
components: digits.slice(0, 3), | ||
alpha: body.length === 3 ? void 0 : Math.round(digits[3] / 255 * 100) / 100 | ||
}; | ||
case 6: | ||
case 8: | ||
const value = Number.parseInt(body, 16); | ||
return { | ||
type: "rgb", | ||
components: body.length === 6 ? [value >> 16 & 255, value >> 8 & 255, value & 255] : [value >> 24 & 255, value >> 16 & 255, value >> 8 & 255], | ||
alpha: body.length === 6 ? void 0 : Math.round((value & 255) / 255 * 100) / 100 | ||
}; | ||
} | ||
} | ||
function cssColorKeyword(str) { | ||
const color = { | ||
rebeccapurple: [102, 51, 153, 1] | ||
}[str]; | ||
if (color != null) { | ||
return { | ||
type: "rgb", | ||
components: color.slice(0, 3), | ||
alpha: color[3] | ||
}; | ||
} | ||
} | ||
function parseCssCommaColorFunction(color) { | ||
const match = color.match(/^(rgb|rgba|hsl|hsla)\((.+)\)$/i); | ||
if (!match) | ||
return; | ||
const [, type, componentString] = match; | ||
const components = getComponents(componentString, ",", 5); | ||
if (components) { | ||
if ([3, 4].includes(components.length)) { | ||
return { | ||
type, | ||
components: components.slice(0, 3), | ||
alpha: components[3] | ||
}; | ||
} else if (components.length !== 1) { | ||
return false; | ||
} | ||
} | ||
} | ||
var cssColorFunctionsRe = new RegExp(`^(${cssColorFunctions.join("|")})\\((.+)\\)$`, "i"); | ||
function parseCssSpaceColorFunction(color) { | ||
const match = color.match(cssColorFunctionsRe); | ||
if (!match) | ||
return; | ||
const [, fn, componentString] = match; | ||
const parsed = parseCssSpaceColorValues(`${fn} ${componentString}`); | ||
if (parsed) { | ||
const { alpha, components: [type, ...components] } = parsed; | ||
return { | ||
type, | ||
components, | ||
alpha | ||
}; | ||
} | ||
} | ||
function parseCssColorFunction(color) { | ||
const match = color.match(/^color\((.+)\)$/); | ||
if (!match) | ||
return; | ||
const parsed = parseCssSpaceColorValues(match[1]); | ||
if (parsed) { | ||
const { alpha, components: [type, ...components] } = parsed; | ||
return { | ||
type, | ||
components, | ||
alpha | ||
}; | ||
} | ||
} | ||
function parseCssSpaceColorValues(componentString) { | ||
const components = getComponents(componentString, " "); | ||
if (!components) | ||
return; | ||
let totalComponents = components.length; | ||
if (components[totalComponents - 2] === "/") { | ||
return { | ||
components: components.slice(0, totalComponents - 2), | ||
alpha: components[totalComponents - 1] | ||
}; | ||
} | ||
if (components[totalComponents - 2] != null && (components[totalComponents - 2].endsWith("/") || components[totalComponents - 1].startsWith("/"))) { | ||
const removed = components.splice(totalComponents - 2); | ||
components.push(removed.join(" ")); | ||
--totalComponents; | ||
} | ||
const withAlpha = getComponents(components[totalComponents - 1], "/", 2); | ||
if (!withAlpha) | ||
return; | ||
if (withAlpha.length === 1 || withAlpha[withAlpha.length - 1] === "") | ||
return { components }; | ||
const alpha = withAlpha.pop(); | ||
components[totalComponents - 1] = withAlpha.join("/"); | ||
return { | ||
components, | ||
alpha | ||
}; | ||
} | ||
// src/shortcuts.ts | ||
var commonShortcuts = { | ||
"pr": "relative", | ||
"pa": "absolute", | ||
"pf": "fixed", | ||
"p-c": "pa top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2", | ||
"f-c": "flex justify-center items-center", | ||
"f-c-c": "f-c flex-col", | ||
"fc": "flex justify-center", | ||
"fi": "flex items-center", | ||
"fcc": "flex justify-center items-center", | ||
"fs": "flex justify-start", | ||
"fsc": "flex justify-start items-center", | ||
"fse": "flex justify-start items-end", | ||
"fe": "flex justify-end", | ||
"fec": "flex justify-end items-center", | ||
"fb": "flex justify-between", | ||
"fbc": "flex justify-between items-center", | ||
"fa": "flex justify-around", | ||
"fac": "flex justify-around items-center", | ||
"fw": "flex justify-wrap", | ||
"fwr": "flex justify-wrap-reverse" | ||
}; | ||
// src/constants.ts | ||
var SwitchSizeMap = { | ||
sm: ["2rem", "1.125rem", "0.85rem"], | ||
md: ["2.5rem", "1.375rem", "1.1rem"], | ||
lg: ["3rem", "1.625rem", "1.375rem"] | ||
}; | ||
// src/index.ts | ||
var theme = { | ||
colors: { | ||
context: "rgba(var(--onu-c-context),%alpha)", | ||
primary: "#a855f7", | ||
secondary: "#1ABCFE", | ||
success: "#0ACF83", | ||
warning: "#FF9F43", | ||
error: "#FF5C5C", | ||
info: "#373e47", | ||
placeholder: "#dcdcdc" | ||
}, | ||
fontFamily: { | ||
sans: "Avenir, Helvetica, Arial, sans-serif" | ||
}, | ||
boxShadow: { | ||
xs: "var(--un-shadow-inset) 0 1px 1px 0 var(--un-shadow-color, rgba(0,0,0,0.03))", | ||
switch: "calc(var(--o-switch-offset) * -1) 0 0 2px var(--o-switch-bc) inset, 0 0 0 2px var(--o-switch-bc) inset;", | ||
switchActive: "calc(var(--o-switch-offset)) 0 0 2px var(--o-switch-c) inset, 0 0 0 2px var(--o-switch-c) inset;" | ||
}, | ||
animation: { | ||
keyframes: { | ||
switching: `{0%{ box-shadow: 0 0 0 2px #1890ff66; } | ||
"use strict";var g=Object.defineProperty;var rt=Object.getOwnPropertyDescriptor;var ot=Object.getOwnPropertyNames;var nt=Object.prototype.hasOwnProperty;var st=(t,e)=>{for(var o in e)g(t,o,{get:e[o],enumerable:!0})},it=(t,e,o,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of ot(e))!nt.call(t,n)&&n!==o&&g(t,n,{get:()=>e[n],enumerable:!(r=rt(e,n))||r.enumerable});return t};var at=t=>it(g({},"__esModule",{value:!0}),t);var Ut={};st(Ut,{presetOnu:()=>Pt});module.exports=at(Ut);var S={"o-border-base":"border-gray-400/50","o-border-300":"border-gray-400/40","o-border-200":"border-gray-400/25","o-transition":"transition-all duration-200","o-focus-base":"ring-2 ring-context/50","o-active-base":"ring-3 ring-context/10","o-borderless":"!border-none !shadow-none","o-solid":"bg-context border-context c-white","o-light":`!shadow-transparent bg-context:12 hover-bg-context active-bg-context:64 | ||
!border-context !hover-border-context !active-border-context:64 | ||
!c-context !hover-c-white !active-c-white`,"o-text":`!shadow-transparent !bg-transparent !hover-bg-context:32 !active-bg-context:12 | ||
!border-transparent | ||
!c-context`};var $={pr:"relative",pa:"absolute",pf:"fixed","p-c":"pa top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2","f-c":"flex justify-center items-center","f-c-c":"f-c flex-col",fc:"flex justify-center",fi:"flex items-center",fcc:"flex justify-center items-center",fs:"flex justify-start",fsc:"flex justify-start items-center",fse:"flex justify-start items-end",fe:"flex justify-end",fec:"flex justify-end items-center",fb:"flex justify-between",fbc:"flex justify-between items-center",fa:"flex justify-around",fac:"flex justify-around items-center",fw:"flex justify-wrap",fwr:"flex justify-wrap-reverse"};var k={"o-alert-base":"pr p-3 fi rounded o-transition w-full of-hidden c-context shadow-context:50 o-solid border fi","o-alert-light":"o-light","o-alert-content":"flex flex-col justify-center w-full","o-alert-header":"fb items-center","o-alert-title":"flex-1 text-sm font-600","o-alert-close":"text-base cursor-pointer pa top-3 right-3 fcc","o-alert-icon":"fi pr-5","o-alert-description":"flex break-all items-center text-sm"};var C={"o-avatar-base":"fcc of-hidden shadow-sm aspect-square rounded-full bg-context text-white","o-avatar-mode-bg":"bg-cover","o-avatar-mode-img":"object-cover select-none","o-avatar-xs":"h-6 text-xs shadow-xs","o-avatar-sm":"h-8 text-sm shadow-sm","o-avatar-md":"h-10 text-sm shadow-md","o-avatar-lg":"h-15 text-base shadow-md","o-avatar-group-base":"flex space-x--4 children-relative"},A=[[/^o-avatar-group-(.*)$/,([,t])=>{if(["xs","sm","md","lg"].includes(t)){let e=t,o={xs:"h-6 text-xs shadow-xs",sm:"h-8 text-sm shadow-sm",md:"h-10 text-sm shadow-md",lg:"h-15 text-base shadow-md"};return`important-${{xs:"space-x--2",sm:"space-x--3",md:"space-x--4",lg:"space-x--6"}[e]} ${o[e].split(" ").map(n=>`important-children-${n}`).join(" ")}`}}]];var _={"o-badge":"pr inline-block align-middle","o-badge-sup":"bg-context text-xs min-w-4.5 h-4.5 leading-4.5 whitespace-nowrap fcc inline-flex rounded-full px-1 z-1","o-badge-sup-fixed":"pa top-0 right-0 translate-x-[calc(50%-1px)] translate-y-[calc(-50%+1px)]","o-badge-sup-dot":"!min-w-auto !h-2 !w-2 rounded-full"};var M={"o-button-base":"fcc gap-1 inline-flex cursor-pointer rounded shadow-context:50 c-context o-solid border !focus:outline-none","o-button-hover":"hover-border-context:64 hover-text-white hover-bg-context:64","o-button-active":"active-border-context:32 active-text-white active-bg-context:32","o-button-light":"o-light","o-button-text":"o-text","o-button-xs":"px-2.5 h-6 text-xs shadow-xs","o-button-sm":"px-3 h-7 text-sm shadow-sm","o-button-md":"px-4 h-8 text-sm shadow-md","o-button-lg":"px-4 h-9 text-base shadow-lg"};var T={"o-card-bg":"bg-gradient-linear backdrop-blur-lg","o-card-base":"o-card-bg o-transition list-none relative rounded-md c-context w-full of-hidden","o-card":"o-card-base h-fit dark:b-darkBd dark:border","o-card-md":"rounded-md shadow-cardMD text-sm","o-card-sm":"rounded-sm shadow-cardSM text-xs","o-card-cover":"children-w-full children-aspect-video","o-card-header":"fb px-4 py-2.5","o-card-header-wrapper":"flex flex-col flex-1 gap-1.5","o-card-header-title":"text-base dark:c-darkTitle","o-card-header-description":"text-xs c-context:60 dark:c-darkSubText break-all !m-0","o-card-header-extra":"","o-card-body":"p-4 pt-1.5 leading-normal text-sm dark:c-darkText","o-card-actions":"p-4 pt-2","o-card-bordered":"border border-light-700 dark:b-darkBd important-shadow-none","o-card-hoverable":"hover-translate-y--1 hover-important-shadow-cardMD","o-card-shadow-always":"!shadow-cardMD"};var j={"o-checkbox-base":"fsc gap-1 inline-flex cursor-pointer","o-checkbox":"o-transition text-base rounded border fcc peer-checked-(bg-context b-context scale-full children-scale-full)","o-checkbox-icon":"o-transition scale-0 text-(white base)","o-checkbox-md":"w-4 h-4","o-checkbox-lg":"w-5 h-5","o-checkbox-disabled":"o-disabled"};var R={"o-collapse-base":"p2","o-collapse-item-title":"fi py-3 transition-all duration-300 cursor-pointer border-b-(1px solid #ebeef5)","o-collapse-item-title-active":"border-b-transparent","o-collapse-item-title-arrow-right":"justify-between","o-collapse-item-title-left":"fi gap-2","o-collapse-item-title-arrow-base":"transition-all duration-300 text-2xl","o-collapse-item-wrap":"overflow-hidden box-border transition-all duration-300 ease-out","o-collapse-item-content":"pb-5 border-b-(1px solid #ebeef5)"};var E={"o-icon-base":"c-context text-base"};var O={"o-message-base":`fixed top-5 o-solid left-1/2 translate-x--1/2 z-1000 o-transition | ||
shadow-md py-2 px-3 fi rounded of-hidden gap-3 text-sm`,"o-message-closable":"cursor-pointer","o-message-content":"fi gap-2"},F=[[/^o-message-icon-(.*)$/,([,t])=>{let e=t;if(["primary","secondary","success","warning","error","info"].includes(e))return`${{primary:"i-carbon-stop-sign",secondary:"i-carbon-software-resource",success:"i-carbon-checkmark-outline",warning:"i-carbon-warning-alt",error:"i-carbon-close-outline",info:"i-carbon-information"}[e]}`}]];var B={"o-switch-base":"b-(~ $o-switch-bc) bg-$o-switch-dot","o-switch-base-active":"checked-(b-context bg-$o-switch-dot-active)","o-switch-shadow":"shadow-switch checked-shadow-switchActive","o-switch":"o-switch-base o-switch-base-active o-switch-shadow appearance-none cursor-pointer flex-shrink-0 o-transition duration-300 rounded-full","o-switch-disabled":"o-disabled"};var N={"o-tag-base":"fcc gap-1 rounded inline-flex box-border !focus:outline-none c-context o-solid mx-1","o-tag-is-closable":"pr-7px","o-tag-xs":"px-1.5 h-5 text-xs","o-tag-sm":"px-2.5 h-6 text-sm","o-tag-md":"px-3 h-7 text-sm ","o-tag-lg":"px-4 h-8 text-base","o-tag-plain":"bg-context:20","o-tag-light":"c-context border !border-context:60 bg-context:12","o-tag-disabled":"o-disabled","o-tag-rounded":"rounded-full","o-tag-close":"ml-1.5 cursor-pointer c-context"};var z={"o-popup-title":"font-medium text-base","o-popup-content":"mt-1 break-words text-left text-sm"};var L={"o-trigger-popup-content":"box-border px-3 py-4 shadow-trigger rounded bg-light-100 dark:bg-darkBg c-context dark:b-darkBd b-softBd border","o-trigger-popup-arrow":"absolute z-2 bg-light-100 dark:bg-grayBg border b-light-900 dark:b-grayBd box-border w-2 h-2 ","o-trigger-top":"b-t-0 b-l-0 rounded-br-sm","o-trigger-left":"b-b-0 b-l-0 rounded-tr-sm","o-trigger-right":"b-t-0 b-r-0 rounded-bl-sm","o-trigger-bottom":"b-r-0 b-b-0 rounded-tl-sm","o-trigger-top-left":"b-t-0 b-l-0 rounded-br-sm","o-trigger-top-right":"b-t-0 b-l-0 rounded-br-sm","o-trigger-bottom-left":"b-r-0 b-b-0 rounded-tl-sm","o-trigger-bottom-right":"b-r-0 b-b-0 rounded-tl-sm","o-trigger-left-top":"b-b-0 b-l-0 rounded-tr-sm","o-trigger-left-bottom":"b-b-0 b-l-0 rounded-tr-sm","o-trigger-right-top":"b-t-0 b-r-0 rounded-bl-sm","o-trigger-right-bottom":"b-t-0 b-r-0 rounded-bl-sm"};var V={"o-rate":"f-c cursor-pointer","o-rate-icon":"text-xl m-.5 !w-5 !h-5","o-rate-text":"leading-5","o-rate-half":"o-bg-clip-half"};var D=[S,$,k,C,...A,_,M,T,j,R,E,O,...F,B,N,z,L,V];var P={colors:{context:"rgba(var(--onu-c-context),%alpha)",primary:"#a855f7",secondary:"#1ABCFE",success:"#0ACF83",warning:"#FF9F43",error:"#FF5C5C",info:"#373e47",placeholder:"#dcdcdc",darkBd:"#4C4D4F",grayBd:"#484849",darkBg:"#373739",darkTitle:"#ECECEC",darkText:"#7C7C7D",darkSubText:"rgba(255,255,255,.7)",softBd:"#E5E6EB",grayBg:"#373739"},fontFamily:{sans:"Avenir, Helvetica, Arial, sans-serif"},boxShadow:{xs:"var(--un-shadow-inset) 0 1px 1px 0 var(--un-shadow-color, rgba(0,0,0,0.03))",switch:"calc(var(--o-switch-offset) * -1) 0 0 2px var(--o-switch-bc) inset, 0 0 0 2px var(--o-switch-bc) inset;",switchActive:"calc(var(--o-switch-offset)) 0 0 2px var(--o-switch-c) inset, 0 0 0 2px var(--o-switch-c) inset;",trigger:"0px 4px 10px #0000001a",cardMD:"0px 0px 12px rgb(0 0 0 / 12%)",cardSM:"0px 0px 6px rgb(0 0 0 / 12%)"},animation:{keyframes:{switching:`{0%{ box-shadow: 0 0 0 2px #1890ff66; } | ||
60%{ box-shadow: 0 0 0 4px #1890ff33; } | ||
80%{ box-shadow: 0 0 0 6px #1890ff1a; } | ||
100%{ box-shadow: 0 0 0 8px #1890ff0d; }}` | ||
}, | ||
durations: { | ||
switching: "0.3s" | ||
} | ||
} | ||
}; | ||
function parseColors(body, _theme = theme) { | ||
return parseColor$1(body, _theme); | ||
} | ||
function presetOnu() { | ||
return { | ||
name: "@onu-ui/preset", | ||
theme, | ||
rules: [ | ||
[/^o-(.*)$/, ([, body], { theme: theme2 }) => { | ||
var _a; | ||
const color = parseColor$1(body, theme2); | ||
if (((_a = color == null ? void 0 : color.cssColor) == null ? void 0 : _a.type) === "rgb" && color.cssColor.components) { | ||
return { | ||
"--onu-c-context": `${color.cssColor.components.join(",")}` | ||
}; | ||
} | ||
}], | ||
[/^o-switch-(.+)$/, ([, s]) => { | ||
if (["sm", "md", "lg"].includes(s)) { | ||
return { | ||
"--o-switch-offset": SwitchSizeMap[s][2], | ||
"width": SwitchSizeMap[s][0], | ||
"height": SwitchSizeMap[s][1] | ||
}; | ||
} | ||
}], | ||
["o-dashed", { "border-style": "dashed" }], | ||
["o-solid", { "background-color": "rgba(var(--onu-c-context), 1) !important", "border-color": "rgba(var(--onu-c-context), 1)", "color": "white !important" }], | ||
["o-disabled", { opacity: 0.4, cursor: "not-allowed !important" }] | ||
], | ||
variants: [ | ||
(input) => { | ||
const prefix = "o-disabled:"; | ||
if (input.startsWith(prefix)) { | ||
return { | ||
matcher: input.slice(prefix.length), | ||
selector: (input2) => `[disabled] ${input2}, ${input2}[disabled]` | ||
}; | ||
} | ||
}, | ||
(input) => { | ||
const prefix = "o-checked:"; | ||
if (input.startsWith(prefix)) { | ||
return { | ||
matcher: input.slice(prefix.length), | ||
selector: (input2) => `[checked] ${input2}, ${input2}[checked]` | ||
}; | ||
} | ||
} | ||
], | ||
shortcuts: [ | ||
{ | ||
...commonShortcuts, | ||
"o-border-base": "border-gray-400/50", | ||
"o-border-300": "border-gray-400/40", | ||
"o-border-200": "border-gray-400/25", | ||
"o-transition": "transition-all duration-200", | ||
"o-focus-base": "ring-2 ring-context/50", | ||
"o-active-base": "ring-3 ring-context/10", | ||
"o-borderless": "!border-none !shadow-none", | ||
"o-solid": "bg-context border-context c-white", | ||
"o-light": `!shadow-transparent bg-context:12 hover-bg-context active-bg-context:64 | ||
!border-context !hover-border-context !active-border-context:64 | ||
!c-context !hover-c-white !active-c-white`, | ||
"o-text": `!shadow-transparent !bg-transparent !hover-bg-context:32 !active-bg-context:12 | ||
!border-transparent | ||
!c-context`, | ||
"o-button-base": "fcc gap-1 inline-flex cursor-pointer rounded shadow-context:50 !outline-none c-context o-solid border", | ||
"o-button-hover": "hover-border-context:64 hover-text-white hover-bg-context:64", | ||
"o-button-active": "active-border-context:32 active-text-white active-bg-context:32", | ||
"o-button-light": "o-light", | ||
"o-button-text": "o-text", | ||
"o-button-xs": "px-2.5 h-6 text-xs shadow-xs", | ||
"o-button-sm": "px-3 h-7 text-sm shadow-sm", | ||
"o-button-md": "px-4 h-8 text-sm shadow-md", | ||
"o-button-lg": "px-4 h-9 text-md shadow-lg", | ||
"o-avatar-base": "fcc of-hidden shadow-sm aspect-square rounded-full bg-context text-white", | ||
"o-avatar-mode-bg": "bg-cover", | ||
"o-avatar-mode-img": "object-cover select-none", | ||
"o-avatar-xs": "h-6 text-xs shadow-xs", | ||
"o-avatar-sm": "h-8 text-sm shadow-sm", | ||
"o-avatar-md": "h-10 text-sm shadow-md", | ||
"o-avatar-lg": "h-15 text-md shadow-md", | ||
"o-avatar-group-base": "flex space-x--4 children-relative", | ||
"o-card-bg": "bg-gradient-linear bg-gradient-from-rgba(255, 255, 255, 0.2) bg-gradient-to-rgba(255, 255, 255, 0.035) backdrop-blur-lg", | ||
"o-card-base": "o-card-bg o-transition list-none relative rounded-md c-context w-full of-hidden", | ||
"o-card": "o-card-base h-fit", | ||
"o-card-md": "rounded-md shadow-md text-sm", | ||
"o-card-sm": "rounded-sm shadow-sm text-xs", | ||
"o-card-cover": "children-w-full children-aspect-video", | ||
"o-card-header": "fb px-4 py-2.5", | ||
"o-card-header-wrapper": "flex flex-col flex-1 gap-1.5", | ||
"o-card-header-title": "text-md", | ||
"o-card-header-description": "text-xs c-context:60 break-all !m-0", | ||
"o-card-header-extra": "", | ||
"o-card-body": "p-4 pt-1.5 leading-normal text-sm", | ||
"o-card-actions": "p-4 pt-2", | ||
"o-card-bordered": "border border-light-700 dark:border-#4C4D4F important-shadow-none", | ||
"o-card-hoverable": "hover-translate-y--1 hover-important-shadow-md", | ||
"o-icon-base": "c-context text-md", | ||
"o-switch-base": "b-(~ $o-switch-bc) bg-$o-switch-dot", | ||
"o-switch-base-active": "checked-(b-context bg-$o-switch-dot-active)", | ||
"o-switch-shadow": "shadow-switch checked-shadow-switchActive", | ||
"o-switch": "o-switch-base o-switch-base-active o-switch-shadow appearance-none cursor-pointer flex-shrink-0 o-transition duration-300 rounded-full", | ||
"o-switch-disabled": "o-disabled", | ||
"o-checkbox-base": "fsc gap-1 inline-flex cursor-pointer", | ||
"o-checkbox": "o-transition text-md rounded border fcc peer-checked-(bg-context b-context scale-full children-scale-full)", | ||
"o-checkbox-icon": "o-transition scale-0 text-(white md)", | ||
"o-checkbox-md": "w-4 h-4", | ||
"o-checkbox-lg": "w-5 h-5", | ||
"o-checkbox-disabled": "o-disabled", | ||
"o-alert-base": "pr p-3 fi rounded o-transition w-full h-fit of-hidden c-context shadow-context:50 o-solid border fi", | ||
"o-alert-light": "o-light", | ||
"o-alert-content": "flex flex-col justify-center w-full", | ||
"o-alert-header": "fb items-center", | ||
"o-alert-title": "flex-1 text-sm font-600", | ||
"o-alert-close": "text-md cursor-pointer pa top-3 right-3 fcc", | ||
"o-alert-icon": "fi pr-5", | ||
"o-alert-description": "flex break-all items-center text-sm", | ||
"o-badge": "pr inline-block align-middle", | ||
"o-badge-sup": "bg-context text-xs min-w-4.5 h-4.5 leading-4.5 whitespace-nowrap fcc inline-flex rounded-full px-1 z-1", | ||
"o-badge-sup-fixed": "pa top-0 right-0 translate-x-[calc(50%-1px)] translate-y-[calc(-50%+1px)]", | ||
"o-badge-sup-dot": "!min-w-auto !h-2 !w-2 rounded-full", | ||
"o-tag-base": "fcc gap-1 rounded inline-flex box-border !outline-none c-context o-solid mx-1", | ||
"o-tag-is-closable": "pr-7px", | ||
"o-tag-xs": "px-1.5 h-5 text-xs", | ||
"o-tag-sm": "px-2.5 h-6 text-sm", | ||
"o-tag-md": "px-3 h-7 text-sm ", | ||
"o-tag-lg": "px-4 h-8 text-md", | ||
"o-tag-plain": "bg-context:20", | ||
"o-tag-light": "c-context border !border-context:60 bg-context:12", | ||
"o-tag-disabled": "o-disabled", | ||
"o-tag-rounded": "rounded-full", | ||
"o-tag-close": "ml-1.5 cursor-pointer c-context", | ||
"o-message-base": `fixed top-5 o-solid left-1/2 translate-x--1/2 z-1000 o-transition | ||
shadow-md p3 fi rounded of-hidden gap-3`, | ||
"o-message-closable": "cursor-pointer", | ||
"o-message-content": "fi gap-2" | ||
}, | ||
[/^o-avatar-group-(.*)$/, ([, s]) => { | ||
if (["xs", "sm", "md", "lg"].includes(s)) { | ||
const size = s; | ||
const avatarSizeMap = { | ||
xs: "h-6 text-xs shadow-xs", | ||
sm: "h-8 text-sm shadow-sm", | ||
md: "h-10 text-sm shadow-md", | ||
lg: "h-15 text-md shadow-md" | ||
}; | ||
const avatarGroupSpaceMap = { | ||
xs: "space-x--2", | ||
sm: "space-x--3", | ||
md: "space-x--4", | ||
lg: "space-x--6" | ||
}; | ||
return `important-${avatarGroupSpaceMap[size]} ${avatarSizeMap[size].split(" ").map((selector) => `important-children-${selector}`).join(" ")}`; | ||
} | ||
}], | ||
[/^o-message-icon-(.*)$/, ([, s]) => { | ||
const iconType = s; | ||
const themeType = ["primary", "secondary", "success", "warning", "error", "info"]; | ||
if (themeType.includes(iconType)) { | ||
const iconThemeMap = { | ||
primary: "i-carbon-stop-sign", | ||
secondary: "i-carbon-software-resource", | ||
success: "i-carbon-checkmark-outline", | ||
warning: "i-carbon-warning-alt", | ||
error: "i-carbon-close-outline", | ||
info: "i-carbon-information" | ||
}; | ||
return `${iconThemeMap[iconType]}`; | ||
} | ||
}] | ||
] | ||
}; | ||
} | ||
// Annotate the CommonJS export names for ESM import in node: | ||
0 && (module.exports = { | ||
parseColors, | ||
presetOnu, | ||
theme | ||
}); | ||
100%{ box-shadow: 0 0 0 8px #1890ff0d; }}`},durations:{switching:"0.3s"}}};function U(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function W(t){let e=t.length,o=-1,r,n="",s=t.charCodeAt(0);for(;++o<e;){if(r=t.charCodeAt(o),r===0){n+="\uFFFD";continue}if(r===44){n+="\\,";continue}if(r>=1&&r<=31||r===127||o===0&&r>=48&&r<=57||o===1&&r>=48&&r<=57&&s===45){n+=`\\${r.toString(16)} `;continue}if(o===0&&e===1&&r===45){n+=`\\${t.charAt(o)}`;continue}if(r>=128||r===45||r===95||r>=48&&r<=57||r>=65&&r<=90||r>=97&&r<=122){n+=t.charAt(o);continue}n+=`\\${t.charAt(o)}`}return n}function I(t){let e=function(r){var s;let n=((s=this.__options)==null?void 0:s.sequence)||[];this.__options.sequence=[];for(let i of n){let a=t[i](r);if(a!=null)return a}};function o(r,n){return r.__options||(r.__options={sequence:[]}),r.__options.sequence.push(n),r}for(let r of Object.keys(t))Object.defineProperty(e,r,{enumerable:!0,get(){return o(this,r)}});return e}var ct="default",lt="preflights",ft="shortcuts",ke={[lt]:-100,[ft]:-10,[ct]:0};var H={l:["-left"],r:["-right"],t:["-top"],b:["-bottom"],s:["-inline-start"],e:["-inline-end"],x:["-left","-right"],y:["-top","-bottom"],"":[""],bs:["-block-start"],be:["-block-end"],is:["-inline-start"],ie:["-inline-end"],block:["-block-start","-block-end"],inline:["-inline-start","-inline-end"]},ut={...H,s:["-inset-inline-start"],e:["-inset-inline-end"],bs:["-inset-block-start"],be:["-inset-block-end"],is:["-inset-inline-start"],ie:["-inset-inline-end"],block:["-inset-block-start","-inset-block-end"],inline:["-inset-inline-start","-inset-inline-end"]};var q=["top","top center","top left","top right","bottom","bottom center","bottom left","bottom right","left","left center","left top","left bottom","right","right center","right top","right bottom","center","center top","center bottom","center left","center right","center center"],pt=Object.assign({},...q.map(t=>({[t.replace(/ /,"-")]:t})),...q.map(t=>({[t.replace(/\b(\w)\w+/g,"$1").replace(/ /,"")]:t}))),G=["inherit","initial","revert","revert-layer","unset"],x=/^(-?[0-9.]+)(px|pt|pc|rem|em|%|vh|vw|in|cm|mm|ex|ch|vmin|vmax|cqw|cqh|cqi|cqb|cqmin|cqmax|rpx)?$/i,ht=/^(-?[0-9.]+)$/i,Y=/^(px)$/i,dt=["color","border-color","background-color","flex-grow","flex","flex-shrink","caret-color","font","gap","opacity","visibility","z-index","font-weight","zoom","text-shadow","transform","box-shadow","background-position","left","right","top","bottom","object-position","max-height","min-height","max-width","min-width","height","width","border-width","margin","padding","outline-width","outline-offset","font-size","line-height","text-indent","vertical-align","border-spacing","letter-spacing","word-spacing","stroke","filter","backdrop-filter","fill","mask","mask-size","mask-border","clip-path","clip","border-radius"];function c(t){return t.toFixed(10).replace(/\.0+$/,"").replace(/(\.\d+?)0+$/,"$1")}function mt(t){let e=t.match(x);if(!e)return;let[,o,r]=e,n=parseFloat(o);if(r&&!Number.isNaN(n))return`${c(n)}${r}`}function gt(t){if(t==="auto"||t==="a")return"auto"}function bt(t){if(t.match(Y))return`1${t}`;let e=t.match(x);if(!e)return;let[,o,r]=e,n=parseFloat(o);if(!Number.isNaN(n))return r?`${c(n)}${r}`:`${c(n/4)}rem`}function xt(t){if(t.match(Y))return`1${t}`;let e=t.match(x);if(!e)return;let[,o,r]=e,n=parseFloat(o);if(!Number.isNaN(n))return r?`${c(n)}${r}`:`${c(n)}px`}function yt(t){if(!ht.test(t))return;let e=parseFloat(t);if(!Number.isNaN(e))return c(e)}function wt(t){t.endsWith("%")&&(t=t.slice(0,-1));let e=parseFloat(t);if(!Number.isNaN(e))return`${c(e/100)}`}function vt(t){if(t==="full")return"100%";let[e,o]=t.split("/"),r=parseFloat(e)/parseFloat(o);if(!Number.isNaN(r))return`${c(r*100)}%`}var St=/^\[(color|length|position|raw|string):/i;function d(t,e){if(t&&t.startsWith("[")&&t.endsWith("]")){let o,r,n=t.match(St);if(n?(e||(r=n[1]),o=t.slice(n[0].length,-1)):o=t.slice(1,-1),!o)return;let s=0;for(let i of o)if(i==="[")s+=1;else if(i==="]"&&(s-=1,s<0))return;if(s)return;switch(r){case"raw":return o;case"string":return o.replace(/(^|[^\\])_/g,"$1 ").replace(/\\_/g,"_").replace(/(['\\])/g,"\\$1").replace(/^(.+)$/,"'$1'")}return o.replace(/(url\(.*?\))/g,i=>i.replace(/_/g,"\\_")).replace(/(^|[^\\])_/g,"$1 ").replace(/\\_/g,"_").replace(/(?:calc|clamp|max|min)\((.*)/g,i=>i.replace(/(-?\d*\.?\d(?!\b-.+[,)](?![^+\-/*])\D)(?:%|[a-z]+)?|\))([+\-/*])/g,"$1 $2 "))}}function $t(t){return d(t)}function kt(t){return d(t,"color")}function Ct(t){return d(t,"length")}function At(t){return d(t,"position")}function _t(t){if(t.match(/^\$\S/))return`var(--${W(t.slice(1))})`}function Mt(t){let e=t.match(/^(-?[0-9.]+)(s|ms)?$/i);if(!e)return;let[,o,r]=e,n=parseFloat(o);if(!Number.isNaN(n))return r?`${c(n)}${r}`:`${c(n)}ms`}function Tt(t){let e=t.match(/^(-?[0-9.]+)(deg|rad|grad|turn)?$/i);if(!e)return;let[,o,r]=e,n=parseFloat(o);if(!Number.isNaN(n))return r?`${c(n)}${r}`:`${c(n)}deg`}function jt(t){if(G.includes(t))return t}function Rt(t){if(t.split(",").every(e=>dt.includes(e)))return t}function Et(t){if(["top","left","right","bottom","center"].includes(t))return t}var K={__proto__:null,numberWithUnit:mt,auto:gt,rem:bt,px:xt,number:yt,percent:wt,fraction:vt,bracket:$t,bracketOfColor:kt,bracketOfLength:Ct,bracketOfPosition:At,cssvar:_t,time:Mt,degree:Tt,global:jt,properties:Rt,position:Et},p=I(K);function b(t,e){let o=t.colors,r=-1;for(let n of e){if(r+=1,o&&typeof o!="string"){let s=e.slice(r).join("-").replace(/(-[a-z])/g,i=>i.slice(1).toUpperCase());if(o[s])return o[s];if(o[n]){o=o[n];continue}}return}return o}function y(t,e){let o=t.split(/(?:\/|:)/),r,n;o[0]==="[color"?(r=o.slice(0,2).join(":"),n=o[2]):[r,n]=o;let s=r.replace(/([a-z])([0-9])/g,"$1-$2").split(/-/g),[i]=s;if(!i)return;let a,w=p.bracketOfColor(r),u=w||r;u.match(/^#[\da-fA-F]+/g)?a=u:u.match(/^hex-[\da-fA-F]+/g)?a=`#${u.slice(4)}`:r.startsWith("$")&&(a=p.cssvar(r)),a=a||w;let f="DEFAULT";if(!a){let l,[v]=s.slice(-1);v.match(/^\d+$/)?(f=v,l=b(e,s.slice(0,-1)),!l||typeof l=="string"?a=void 0:a=l[f]):(l=b(e,s),!l&&s.length<=2&&([,f=f]=s,l=b(e,[i])),typeof l=="string"?a=l:f&&l&&(a=l[f]))}return{opacity:n,name:i,no:f,color:a,cssColor:X(a),alpha:p.bracket.cssvar.percent(n??"")}}function J(t,e,o,r){if(t==="")return;let n=t.length,s=0;for(let i=0;i<n;i++)switch(t[i]){case e:s++;break;case o:if(--s<0)return;break;case r:if(s===0)return i===0||i===n-1?void 0:[t.slice(0,i),t.slice(i+1)]}return[t,""]}function h(t,e,o){if(e.length!==1)return;o=o??10;let r=[],n=0;for(;t!=="";){if(++n>o)return;let s=J(t,"(",")",e);if(!s)return;let[i,a]=s;r.push(i),t=a}if(r.length>0)return r}var Q=["hsl","hsla","hwb","lab","lch","oklab","oklch","rgb","rgba"],Ot=["%alpha","<alpha-value>"],Me=new RegExp(Ot.map(t=>U(t)).join("|"));function X(t=""){let e=Ft(t);if(e==null||e===!1)return;let{type:o,components:r,alpha:n}=e,s=o.toLowerCase();if(r.length!==0&&!(["rgba","hsla"].includes(s)&&n==null)&&!(Q.includes(s)&&![1,3].includes(r.length)))return{type:s,components:r.map(i=>typeof i=="string"?i.trim():i),alpha:typeof n=="string"?n.trim():n}}function Ft(t){if(!t)return;let e=Bt(t);if(e!=null||(e=Nt(t),e!=null)||(e=zt(t),e!=null)||(e=Vt(t),e!=null)||(e=Dt(t),e!=null))return e}function Bt(t){let[,e]=t.match(/^#([\da-f]+)$/i)||[];if(!!e)switch(e.length){case 3:case 4:let o=Array.from(e,n=>Number.parseInt(n,16)).map(n=>n<<4|n);return{type:"rgb",components:o.slice(0,3),alpha:e.length===3?void 0:Math.round(o[3]/255*100)/100};case 6:case 8:let r=Number.parseInt(e,16);return{type:"rgb",components:e.length===6?[r>>16&255,r>>8&255,r&255]:[r>>24&255,r>>16&255,r>>8&255],alpha:e.length===6?void 0:Math.round((r&255)/255*100)/100}}}function Nt(t){let e={rebeccapurple:[102,51,153,1]}[t];if(e!=null)return{type:"rgb",components:e.slice(0,3),alpha:e[3]}}function zt(t){let e=t.match(/^(rgb|rgba|hsl|hsla)\((.+)\)$/i);if(!e)return;let[,o,r]=e,n=h(r,",",5);if(n){if([3,4].includes(n.length))return{type:o,components:n.slice(0,3),alpha:n[3]};if(n.length!==1)return!1}}var Lt=new RegExp(`^(${Q.join("|")})\\((.+)\\)$`,"i");function Vt(t){let e=t.match(Lt);if(!e)return;let[,o,r]=e,n=Z(`${o} ${r}`);if(n){let{alpha:s,components:[i,...a]}=n;return{type:i,components:a,alpha:s}}}function Dt(t){let e=t.match(/^color\((.+)\)$/);if(!e)return;let o=Z(e[1]);if(o){let{alpha:r,components:[n,...s]}=o;return{type:n,components:s,alpha:r}}}function Z(t){let e=h(t," ");if(!e)return;let o=e.length;if(e[o-2]==="/")return{components:e.slice(0,o-2),alpha:e[o-1]};if(e[o-2]!=null&&(e[o-2].endsWith("/")||e[o-1].startsWith("/"))){let s=e.splice(o-2);e.push(s.join(" ")),--o}let r=h(e[o-1],"/",2);if(!r)return;if(r.length===1||r[r.length-1]==="")return{components:e};let n=r.pop();return e[o-1]=r.join("/"),{components:e,alpha:n}}var m={sm:["2rem","1.125rem","0.85rem"],md:["2.5rem","1.375rem","1.1rem"],lg:["3rem","1.625rem","1.375rem"]};var tt=[[/^o-(.*)$/,([,t],{theme:e})=>{var r;let o=y(t,e);if(((r=o==null?void 0:o.cssColor)==null?void 0:r.type)==="rgb"&&o.cssColor.components)return{"--onu-c-context":`${o.cssColor.components.join(",")}`}}],[/^o-switch-(.+)$/,([,t])=>{if(["sm","md","lg"].includes(t))return{"--o-switch-offset":m[t][2],width:m[t][0],height:m[t][1]}}],["o-dashed",{"border-style":"dashed"}],["o-solid",{"background-color":"rgba(var(--onu-c-context), 1) !important","border-color":"rgba(var(--onu-c-context), 1)",color:"white !important"}],["o-disabled",{opacity:.4,cursor:"not-allowed !important"}],["o-bg-clip-half",{"clip-path":"polygon(0% 0%, 50% 0, 50% 50%, 50% 100%, 0% 100%)"}]];var et=[t=>{let e="o-disabled:";if(t.startsWith(e))return{matcher:t.slice(e.length),selector:o=>`[disabled] ${o}, ${o}[disabled]`}},t=>{let e="o-checked:";if(t.startsWith(e))return{matcher:t.slice(e.length),selector:o=>`[checked] ${o}, ${o}[checked]`}}];function Pt(){return{name:"@onu-ui/preset",theme:P,rules:tt,variants:et,shortcuts:D}}0&&(module.exports={presetOnu}); |
{ | ||
"name": "@onu-ui/preset", | ||
"version": "1.0.8-beta.3", | ||
"version": "1.0.8", | ||
"description": "Onu-UI css rules for unocss preset", | ||
@@ -40,4 +40,4 @@ "keywords": [ | ||
"build": "tsup", | ||
"stub": "tsup --watch --onSuccess \"pnpm run --filter=components stub\"" | ||
"stub": "tsup --watch --onSuccess \"pnpm run --filter '../components' stub\"" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
0
40231
155
1