figma-lupa 0.2.2 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/cli.js +2073 -309
- package/dist/server.js +2009 -279
- package/package.json +1 -1
- package/plugin/dist/code.js +1 -1
- package/skills/figma-implement/SKILL.md +4 -4
package/dist/server.js
CHANGED
|
@@ -291,24 +291,24 @@ var require_scope = __commonJS({
|
|
|
291
291
|
return;
|
|
292
292
|
return vs.get(keyOrRef);
|
|
293
293
|
}
|
|
294
|
-
scopeRefs(scopeName,
|
|
295
|
-
return this._reduceValues(
|
|
294
|
+
scopeRefs(scopeName, values2 = this._values) {
|
|
295
|
+
return this._reduceValues(values2, (name) => {
|
|
296
296
|
if (name.scopePath === void 0)
|
|
297
297
|
throw new Error(`CodeGen: name "${name}" has no value`);
|
|
298
298
|
return (0, code_1._)`${scopeName}${name.scopePath}`;
|
|
299
299
|
});
|
|
300
300
|
}
|
|
301
|
-
scopeCode(
|
|
302
|
-
return this._reduceValues(
|
|
301
|
+
scopeCode(values2 = this._values, usedValues, getCode) {
|
|
302
|
+
return this._reduceValues(values2, (name) => {
|
|
303
303
|
if (name.value === void 0)
|
|
304
304
|
throw new Error(`CodeGen: name "${name}" has no value`);
|
|
305
305
|
return name.value.code;
|
|
306
306
|
}, usedValues, getCode);
|
|
307
307
|
}
|
|
308
|
-
_reduceValues(
|
|
308
|
+
_reduceValues(values2, valueCode, usedValues = {}, getCode) {
|
|
309
309
|
let code = code_1.nil;
|
|
310
|
-
for (const prefix in
|
|
311
|
-
const vs =
|
|
310
|
+
for (const prefix in values2) {
|
|
311
|
+
const vs = values2[prefix];
|
|
312
312
|
if (!vs)
|
|
313
313
|
continue;
|
|
314
314
|
const nameSet = usedValues[prefix] = usedValues[prefix] || /* @__PURE__ */ new Map();
|
|
@@ -2051,7 +2051,7 @@ var require_fast_deep_equal = __commonJS({
|
|
|
2051
2051
|
if (a === b) return true;
|
|
2052
2052
|
if (a && b && typeof a == "object" && typeof b == "object") {
|
|
2053
2053
|
if (a.constructor !== b.constructor) return false;
|
|
2054
|
-
var length, i,
|
|
2054
|
+
var length, i, keys2;
|
|
2055
2055
|
if (Array.isArray(a)) {
|
|
2056
2056
|
length = a.length;
|
|
2057
2057
|
if (length != b.length) return false;
|
|
@@ -2062,13 +2062,13 @@ var require_fast_deep_equal = __commonJS({
|
|
|
2062
2062
|
if (a.constructor === RegExp) return a.source === b.source && a.flags === b.flags;
|
|
2063
2063
|
if (a.valueOf !== Object.prototype.valueOf) return a.valueOf() === b.valueOf();
|
|
2064
2064
|
if (a.toString !== Object.prototype.toString) return a.toString() === b.toString();
|
|
2065
|
-
|
|
2066
|
-
length =
|
|
2065
|
+
keys2 = Object.keys(a);
|
|
2066
|
+
length = keys2.length;
|
|
2067
2067
|
if (length !== Object.keys(b).length) return false;
|
|
2068
2068
|
for (i = length; i-- !== 0; )
|
|
2069
|
-
if (!Object.prototype.hasOwnProperty.call(b,
|
|
2069
|
+
if (!Object.prototype.hasOwnProperty.call(b, keys2[i])) return false;
|
|
2070
2070
|
for (i = length; i-- !== 0; ) {
|
|
2071
|
-
var key =
|
|
2071
|
+
var key = keys2[i];
|
|
2072
2072
|
if (!equal(a[key], b[key])) return false;
|
|
2073
2073
|
}
|
|
2074
2074
|
return true;
|
|
@@ -3231,16 +3231,16 @@ var require_utils = __commonJS({
|
|
|
3231
3231
|
return compressIPv6ZeroRun(expanded);
|
|
3232
3232
|
}
|
|
3233
3233
|
function normalizeIPv6(host) {
|
|
3234
|
-
const
|
|
3234
|
+
const bracketed2 = host[0] === "[" && host[host.length - 1] === "]";
|
|
3235
3235
|
const hasBracket = host[0] === "[" || host[host.length - 1] === "]";
|
|
3236
|
-
if (hasBracket && !
|
|
3237
|
-
let input2 =
|
|
3238
|
-
if (
|
|
3236
|
+
if (hasBracket && !bracketed2) return { host, isIPV6: false, error: true };
|
|
3237
|
+
let input2 = bracketed2 ? host.slice(1, -1) : host;
|
|
3238
|
+
if (bracketed2 && isIPvFuture(input2)) {
|
|
3239
3239
|
input2 = input2.toLowerCase();
|
|
3240
3240
|
return { host: `[${input2}]`, escapedHost: input2, isIPV6: false, isIPVFuture: true };
|
|
3241
3241
|
}
|
|
3242
3242
|
if (findToken(input2, ":") < 2) {
|
|
3243
|
-
return { host, isIPV6: false, error:
|
|
3243
|
+
return { host, isIPV6: false, error: bracketed2 };
|
|
3244
3244
|
}
|
|
3245
3245
|
let zoneIdentifier = "";
|
|
3246
3246
|
const zoneSeparator = input2.indexOf("%");
|
|
@@ -3265,8 +3265,8 @@ var require_utils = __commonJS({
|
|
|
3265
3265
|
}
|
|
3266
3266
|
return ind;
|
|
3267
3267
|
}
|
|
3268
|
-
function removeDotSegments(
|
|
3269
|
-
let input2 =
|
|
3268
|
+
function removeDotSegments(path5) {
|
|
3269
|
+
let input2 = path5;
|
|
3270
3270
|
const output2 = [];
|
|
3271
3271
|
let nextSlash = -1;
|
|
3272
3272
|
let len = 0;
|
|
@@ -3340,11 +3340,11 @@ var require_utils = __commonJS({
|
|
|
3340
3340
|
}
|
|
3341
3341
|
return output2.join("");
|
|
3342
3342
|
}
|
|
3343
|
-
function removeDotSegmentsRelative(
|
|
3344
|
-
if (
|
|
3345
|
-
return removeDotSegments(
|
|
3343
|
+
function removeDotSegmentsRelative(path5) {
|
|
3344
|
+
if (path5 === "" || path5[0] === "/") {
|
|
3345
|
+
return removeDotSegments(path5);
|
|
3346
3346
|
}
|
|
3347
|
-
const segments =
|
|
3347
|
+
const segments = path5.split("/");
|
|
3348
3348
|
const last = segments.length - 1;
|
|
3349
3349
|
const output2 = [];
|
|
3350
3350
|
let trailingDirectory = false;
|
|
@@ -3707,8 +3707,8 @@ var require_schemes = __commonJS({
|
|
|
3707
3707
|
}
|
|
3708
3708
|
if (wsComponent.resourceName) {
|
|
3709
3709
|
const queryIndex = wsComponent.resourceName.indexOf("?");
|
|
3710
|
-
const
|
|
3711
|
-
wsComponent.path =
|
|
3710
|
+
const path5 = queryIndex === -1 ? wsComponent.resourceName : wsComponent.resourceName.slice(0, queryIndex);
|
|
3711
|
+
wsComponent.path = path5 && path5 !== "/" ? path5 : void 0;
|
|
3712
3712
|
wsComponent.query = queryIndex === -1 ? void 0 : wsComponent.resourceName.slice(queryIndex + 1);
|
|
3713
3713
|
wsComponent.resourceName = void 0;
|
|
3714
3714
|
}
|
|
@@ -6947,8 +6947,8 @@ var require_formats = __commonJS({
|
|
|
6947
6947
|
"use strict";
|
|
6948
6948
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6949
6949
|
exports.formatNames = exports.fastFormats = exports.fullFormats = void 0;
|
|
6950
|
-
function fmtDef(validate2,
|
|
6951
|
-
return { validate: validate2, compare:
|
|
6950
|
+
function fmtDef(validate2, compare3) {
|
|
6951
|
+
return { validate: validate2, compare: compare3 };
|
|
6952
6952
|
}
|
|
6953
6953
|
exports.fullFormats = {
|
|
6954
6954
|
// date: http://tools.ietf.org/html/rfc3339#section-5.6
|
|
@@ -7599,26 +7599,26 @@ var require_permessage_deflate = __commonJS({
|
|
|
7599
7599
|
value = value[0];
|
|
7600
7600
|
if (key === "client_max_window_bits") {
|
|
7601
7601
|
if (value !== true) {
|
|
7602
|
-
const
|
|
7603
|
-
if (!Number.isInteger(
|
|
7602
|
+
const num2 = +value;
|
|
7603
|
+
if (!Number.isInteger(num2) || num2 < 8 || num2 > 15) {
|
|
7604
7604
|
throw new TypeError(
|
|
7605
7605
|
`Invalid value for parameter "${key}": ${value}`
|
|
7606
7606
|
);
|
|
7607
7607
|
}
|
|
7608
|
-
value =
|
|
7608
|
+
value = num2;
|
|
7609
7609
|
} else if (!this._isServer) {
|
|
7610
7610
|
throw new TypeError(
|
|
7611
7611
|
`Invalid value for parameter "${key}": ${value}`
|
|
7612
7612
|
);
|
|
7613
7613
|
}
|
|
7614
7614
|
} else if (key === "server_max_window_bits") {
|
|
7615
|
-
const
|
|
7616
|
-
if (!Number.isInteger(
|
|
7615
|
+
const num2 = +value;
|
|
7616
|
+
if (!Number.isInteger(num2) || num2 < 8 || num2 > 15) {
|
|
7617
7617
|
throw new TypeError(
|
|
7618
7618
|
`Invalid value for parameter "${key}": ${value}`
|
|
7619
7619
|
);
|
|
7620
7620
|
}
|
|
7621
|
-
value =
|
|
7621
|
+
value = num2;
|
|
7622
7622
|
} else if (key === "client_no_context_takeover" || key === "server_no_context_takeover") {
|
|
7623
7623
|
if (value !== true) {
|
|
7624
7624
|
throw new TypeError(
|
|
@@ -8332,8 +8332,8 @@ var require_receiver = __commonJS({
|
|
|
8332
8332
|
return;
|
|
8333
8333
|
}
|
|
8334
8334
|
const buf = this.consume(8);
|
|
8335
|
-
const
|
|
8336
|
-
if (
|
|
8335
|
+
const num2 = buf.readUInt32BE(0);
|
|
8336
|
+
if (num2 > Math.pow(2, 53 - 32) - 1) {
|
|
8337
8337
|
const error62 = this.createError(
|
|
8338
8338
|
RangeError,
|
|
8339
8339
|
"Unsupported WebSocket frame: payload length > 2^53 - 1",
|
|
@@ -8344,7 +8344,7 @@ var require_receiver = __commonJS({
|
|
|
8344
8344
|
cb(error62);
|
|
8345
8345
|
return;
|
|
8346
8346
|
}
|
|
8347
|
-
this._payloadLength =
|
|
8347
|
+
this._payloadLength = num2 * Math.pow(2, 32) + buf.readUInt32BE(4);
|
|
8348
8348
|
this.haveLength(cb);
|
|
8349
8349
|
}
|
|
8350
8350
|
/**
|
|
@@ -9476,9 +9476,9 @@ var require_extension = __commonJS({
|
|
|
9476
9476
|
return configurations.map((params) => {
|
|
9477
9477
|
return [extension2].concat(
|
|
9478
9478
|
Object.keys(params).map((k) => {
|
|
9479
|
-
let
|
|
9480
|
-
if (!Array.isArray(
|
|
9481
|
-
return
|
|
9479
|
+
let values2 = params[k];
|
|
9480
|
+
if (!Array.isArray(values2)) values2 = [values2];
|
|
9481
|
+
return values2.map((v) => v === true ? k : `${k}=${v}`).join("; ");
|
|
9482
9482
|
})
|
|
9483
9483
|
).join("; ");
|
|
9484
9484
|
}).join(", ");
|
|
@@ -13062,13 +13062,13 @@ var util;
|
|
|
13062
13062
|
});
|
|
13063
13063
|
};
|
|
13064
13064
|
util2.objectKeys = typeof Object.keys === "function" ? (obj) => Object.keys(obj) : (object3) => {
|
|
13065
|
-
const
|
|
13065
|
+
const keys2 = [];
|
|
13066
13066
|
for (const key in object3) {
|
|
13067
13067
|
if (Object.prototype.hasOwnProperty.call(object3, key)) {
|
|
13068
|
-
|
|
13068
|
+
keys2.push(key);
|
|
13069
13069
|
}
|
|
13070
13070
|
}
|
|
13071
|
-
return
|
|
13071
|
+
return keys2;
|
|
13072
13072
|
};
|
|
13073
13073
|
util2.find = (arr, checker) => {
|
|
13074
13074
|
for (const item of arr) {
|
|
@@ -13403,8 +13403,8 @@ function getErrorMap() {
|
|
|
13403
13403
|
|
|
13404
13404
|
// node_modules/zod/v3/helpers/parseUtil.js
|
|
13405
13405
|
var makeIssue = (params) => {
|
|
13406
|
-
const { data, path:
|
|
13407
|
-
const fullPath = [...
|
|
13406
|
+
const { data, path: path5, errorMaps, issueData } = params;
|
|
13407
|
+
const fullPath = [...path5, ...issueData.path || []];
|
|
13408
13408
|
const fullIssue = {
|
|
13409
13409
|
...issueData,
|
|
13410
13410
|
path: fullPath
|
|
@@ -13519,11 +13519,11 @@ var errorUtil;
|
|
|
13519
13519
|
|
|
13520
13520
|
// node_modules/zod/v3/types.js
|
|
13521
13521
|
var ParseInputLazyPath = class {
|
|
13522
|
-
constructor(parent, value,
|
|
13522
|
+
constructor(parent, value, path5, key) {
|
|
13523
13523
|
this._cachedPath = [];
|
|
13524
13524
|
this.parent = parent;
|
|
13525
13525
|
this.data = value;
|
|
13526
|
-
this._path =
|
|
13526
|
+
this._path = path5;
|
|
13527
13527
|
this._key = key;
|
|
13528
13528
|
}
|
|
13529
13529
|
get path() {
|
|
@@ -15303,8 +15303,8 @@ var ZodObject = class _ZodObject extends ZodType {
|
|
|
15303
15303
|
if (this._cached !== null)
|
|
15304
15304
|
return this._cached;
|
|
15305
15305
|
const shape = this._def.shape();
|
|
15306
|
-
const
|
|
15307
|
-
this._cached = { shape, keys };
|
|
15306
|
+
const keys2 = util.objectKeys(shape);
|
|
15307
|
+
this._cached = { shape, keys: keys2 };
|
|
15308
15308
|
return this._cached;
|
|
15309
15309
|
}
|
|
15310
15310
|
_parse(input2) {
|
|
@@ -16340,9 +16340,9 @@ ZodLiteral.create = (value, params) => {
|
|
|
16340
16340
|
...processCreateParams(params)
|
|
16341
16341
|
});
|
|
16342
16342
|
};
|
|
16343
|
-
function createZodEnum(
|
|
16343
|
+
function createZodEnum(values2, params) {
|
|
16344
16344
|
return new ZodEnum({
|
|
16345
|
-
values,
|
|
16345
|
+
values: values2,
|
|
16346
16346
|
typeName: ZodFirstPartyTypeKind.ZodEnum,
|
|
16347
16347
|
...processCreateParams(params)
|
|
16348
16348
|
});
|
|
@@ -16398,14 +16398,14 @@ var ZodEnum = class _ZodEnum extends ZodType {
|
|
|
16398
16398
|
}
|
|
16399
16399
|
return enumValues;
|
|
16400
16400
|
}
|
|
16401
|
-
extract(
|
|
16402
|
-
return _ZodEnum.create(
|
|
16401
|
+
extract(values2, newDef = this._def) {
|
|
16402
|
+
return _ZodEnum.create(values2, {
|
|
16403
16403
|
...this._def,
|
|
16404
16404
|
...newDef
|
|
16405
16405
|
});
|
|
16406
16406
|
}
|
|
16407
|
-
exclude(
|
|
16408
|
-
return _ZodEnum.create(this.options.filter((opt) => !
|
|
16407
|
+
exclude(values2, newDef = this._def) {
|
|
16408
|
+
return _ZodEnum.create(this.options.filter((opt) => !values2.includes(opt)), {
|
|
16409
16409
|
...this._def,
|
|
16410
16410
|
...newDef
|
|
16411
16411
|
});
|
|
@@ -16443,9 +16443,9 @@ var ZodNativeEnum = class extends ZodType {
|
|
|
16443
16443
|
return this._def.values;
|
|
16444
16444
|
}
|
|
16445
16445
|
};
|
|
16446
|
-
ZodNativeEnum.create = (
|
|
16446
|
+
ZodNativeEnum.create = (values2, params) => {
|
|
16447
16447
|
return new ZodNativeEnum({
|
|
16448
|
-
values,
|
|
16448
|
+
values: values2,
|
|
16449
16449
|
typeName: ZodFirstPartyTypeKind.ZodNativeEnum,
|
|
16450
16450
|
...processCreateParams(params)
|
|
16451
16451
|
});
|
|
@@ -17340,8 +17340,8 @@ function assert(_) {
|
|
|
17340
17340
|
}
|
|
17341
17341
|
function getEnumValues(entries) {
|
|
17342
17342
|
const numericValues = Object.values(entries).filter((v) => typeof v === "number");
|
|
17343
|
-
const
|
|
17344
|
-
return
|
|
17343
|
+
const values2 = Object.entries(entries).filter(([k, _]) => numericValues.indexOf(+k) === -1).map(([_, v]) => v);
|
|
17344
|
+
return values2;
|
|
17345
17345
|
}
|
|
17346
17346
|
function joinValues(array2, separator = "|") {
|
|
17347
17347
|
return array2.map((val) => stringifyPrimitive(val)).join(separator);
|
|
@@ -17442,9 +17442,9 @@ function putProp(target, key, value) {
|
|
|
17442
17442
|
else
|
|
17443
17443
|
target[key] = value;
|
|
17444
17444
|
}
|
|
17445
|
-
function mirrorShape(target, source,
|
|
17445
|
+
function mirrorShape(target, source, keys2, wrap) {
|
|
17446
17446
|
const raw = sourceShape(source);
|
|
17447
|
-
for (const key of
|
|
17447
|
+
for (const key of keys2) {
|
|
17448
17448
|
const desc = Object.getOwnPropertyDescriptor(raw, key);
|
|
17449
17449
|
if (!desc.enumerable)
|
|
17450
17450
|
continue;
|
|
@@ -17479,18 +17479,18 @@ function mergeDefs(...defs) {
|
|
|
17479
17479
|
function cloneDef(schema) {
|
|
17480
17480
|
return mergeDefs(schema._zod.def);
|
|
17481
17481
|
}
|
|
17482
|
-
function getElementAtPath(obj,
|
|
17483
|
-
if (!
|
|
17482
|
+
function getElementAtPath(obj, path5) {
|
|
17483
|
+
if (!path5)
|
|
17484
17484
|
return obj;
|
|
17485
|
-
return
|
|
17485
|
+
return path5.reduce((acc, key) => acc?.[key], obj);
|
|
17486
17486
|
}
|
|
17487
17487
|
function promiseAllObject(promisesObj) {
|
|
17488
|
-
const
|
|
17489
|
-
const promises =
|
|
17488
|
+
const keys2 = Object.keys(promisesObj);
|
|
17489
|
+
const promises = keys2.map((key) => promisesObj[key]);
|
|
17490
17490
|
return Promise.all(promises).then((results) => {
|
|
17491
17491
|
const resolvedObj = {};
|
|
17492
|
-
for (let i = 0; i <
|
|
17493
|
-
resolvedObj[
|
|
17492
|
+
for (let i = 0; i < keys2.length; i++) {
|
|
17493
|
+
resolvedObj[keys2[i]] = results[i];
|
|
17494
17494
|
}
|
|
17495
17495
|
return resolvedObj;
|
|
17496
17496
|
});
|
|
@@ -17712,15 +17712,15 @@ function pick(schema, mask) {
|
|
|
17712
17712
|
}
|
|
17713
17713
|
function maskedKeys(schema, mask) {
|
|
17714
17714
|
const raw = sourceShape(schema);
|
|
17715
|
-
const
|
|
17715
|
+
const keys2 = [];
|
|
17716
17716
|
for (const key of Reflect.ownKeys(mask)) {
|
|
17717
17717
|
if (!Object.getOwnPropertyDescriptor(raw, key)?.enumerable) {
|
|
17718
17718
|
throw new Error(`Unrecognized key: "${String(key)}"`);
|
|
17719
17719
|
}
|
|
17720
17720
|
if (mask[key])
|
|
17721
|
-
|
|
17721
|
+
keys2.push(key);
|
|
17722
17722
|
}
|
|
17723
|
-
return
|
|
17723
|
+
return keys2;
|
|
17724
17724
|
}
|
|
17725
17725
|
function omit(schema, mask) {
|
|
17726
17726
|
const currDef = schema._zod.def;
|
|
@@ -17822,11 +17822,11 @@ function explicitlyAborted(x, startIndex = 0) {
|
|
|
17822
17822
|
}
|
|
17823
17823
|
return false;
|
|
17824
17824
|
}
|
|
17825
|
-
function prefixIssues(
|
|
17825
|
+
function prefixIssues(path5, issues) {
|
|
17826
17826
|
return issues.map((iss) => {
|
|
17827
17827
|
var _a3;
|
|
17828
17828
|
(_a3 = iss).path ?? (_a3.path = []);
|
|
17829
|
-
iss.path.unshift(
|
|
17829
|
+
iss.path.unshift(path5);
|
|
17830
17830
|
return iss;
|
|
17831
17831
|
});
|
|
17832
17832
|
}
|
|
@@ -18288,16 +18288,16 @@ function flattenError(error62, mapper = (issue2) => issue2.message) {
|
|
|
18288
18288
|
}
|
|
18289
18289
|
function formatError(error62, mapper = (issue2) => issue2.message) {
|
|
18290
18290
|
const fieldErrors = { _errors: [] };
|
|
18291
|
-
const processError = (error63,
|
|
18291
|
+
const processError = (error63, path5 = []) => {
|
|
18292
18292
|
for (const issue2 of error63.issues) {
|
|
18293
18293
|
if (issue2.code === "invalid_union" && issue2.errors.length) {
|
|
18294
|
-
issue2.errors.map((issues) => processError({ issues }, [...
|
|
18294
|
+
issue2.errors.map((issues) => processError({ issues }, [...path5, ...issue2.path]));
|
|
18295
18295
|
} else if (issue2.code === "invalid_key") {
|
|
18296
|
-
processError({ issues: issue2.issues }, [...
|
|
18296
|
+
processError({ issues: issue2.issues }, [...path5, ...issue2.path]);
|
|
18297
18297
|
} else if (issue2.code === "invalid_element") {
|
|
18298
|
-
processError({ issues: issue2.issues }, [...
|
|
18298
|
+
processError({ issues: issue2.issues }, [...path5, ...issue2.path]);
|
|
18299
18299
|
} else {
|
|
18300
|
-
const fullpath = [...
|
|
18300
|
+
const fullpath = [...path5, ...issue2.path];
|
|
18301
18301
|
if (fullpath.length === 0) {
|
|
18302
18302
|
fieldErrors._errors.push(mapper(issue2));
|
|
18303
18303
|
} else {
|
|
@@ -18336,17 +18336,17 @@ function formatError(error62, mapper = (issue2) => issue2.message) {
|
|
|
18336
18336
|
}
|
|
18337
18337
|
function treeifyError(error62, mapper = (issue2) => issue2.message) {
|
|
18338
18338
|
const result = { errors: [] };
|
|
18339
|
-
const processError = (error63,
|
|
18339
|
+
const processError = (error63, path5 = []) => {
|
|
18340
18340
|
var _a3;
|
|
18341
18341
|
for (const issue2 of error63.issues) {
|
|
18342
18342
|
if (issue2.code === "invalid_union" && issue2.errors.length) {
|
|
18343
|
-
issue2.errors.map((issues) => processError({ issues }, [...
|
|
18343
|
+
issue2.errors.map((issues) => processError({ issues }, [...path5, ...issue2.path]));
|
|
18344
18344
|
} else if (issue2.code === "invalid_key") {
|
|
18345
|
-
processError({ issues: issue2.issues }, [...
|
|
18345
|
+
processError({ issues: issue2.issues }, [...path5, ...issue2.path]);
|
|
18346
18346
|
} else if (issue2.code === "invalid_element") {
|
|
18347
|
-
processError({ issues: issue2.issues }, [...
|
|
18347
|
+
processError({ issues: issue2.issues }, [...path5, ...issue2.path]);
|
|
18348
18348
|
} else {
|
|
18349
|
-
const fullpath = [...
|
|
18349
|
+
const fullpath = [...path5, ...issue2.path];
|
|
18350
18350
|
if (fullpath.length === 0) {
|
|
18351
18351
|
result.errors.push(mapper(issue2));
|
|
18352
18352
|
continue;
|
|
@@ -18385,8 +18385,8 @@ function treeifyError(error62, mapper = (issue2) => issue2.message) {
|
|
|
18385
18385
|
}
|
|
18386
18386
|
function toDotPath(_path) {
|
|
18387
18387
|
const segs = [];
|
|
18388
|
-
const
|
|
18389
|
-
for (const seg of
|
|
18388
|
+
const path5 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
|
|
18389
|
+
for (const seg of path5) {
|
|
18390
18390
|
if (typeof seg === "number")
|
|
18391
18391
|
segs.push(`[${seg}]`);
|
|
18392
18392
|
else if (typeof seg === "symbol")
|
|
@@ -20124,10 +20124,10 @@ function handlePropertyResult(result, final, key, input2, optin, optout) {
|
|
|
20124
20124
|
}
|
|
20125
20125
|
var NO_SYMBOL_KEYS = [];
|
|
20126
20126
|
function normalizeDef(def) {
|
|
20127
|
-
const
|
|
20127
|
+
const keys2 = Object.keys(def.shape);
|
|
20128
20128
|
const ownSymbols = Object.getOwnPropertySymbols(def.shape);
|
|
20129
20129
|
const symbolKeys = ownSymbols.length ? ownSymbols : NO_SYMBOL_KEYS;
|
|
20130
|
-
const allKeys = symbolKeys.length ? [...
|
|
20130
|
+
const allKeys = symbolKeys.length ? [...keys2, ...symbolKeys] : keys2;
|
|
20131
20131
|
for (const k of allKeys) {
|
|
20132
20132
|
if (!def.shape?.[k]?._zod?.traits?.has("$ZodType")) {
|
|
20133
20133
|
throw new Error(`Invalid element at key "${String(k)}": expected a Zod schema`);
|
|
@@ -20139,8 +20139,8 @@ function normalizeDef(def) {
|
|
|
20139
20139
|
allKeys,
|
|
20140
20140
|
symbolKeys,
|
|
20141
20141
|
// string-only: handleCatchall matches it against `for...in`, which never yields a symbol
|
|
20142
|
-
keySet: new Set(
|
|
20143
|
-
numKeys:
|
|
20142
|
+
keySet: new Set(keys2),
|
|
20143
|
+
numKeys: keys2.length,
|
|
20144
20144
|
optionalKeys: new Set(okeys)
|
|
20145
20145
|
};
|
|
20146
20146
|
}
|
|
@@ -20197,14 +20197,14 @@ var $ZodObject = /* @__PURE__ */ $constructor("$ZodObject", (inst, def) => {
|
|
|
20197
20197
|
const desc = Object.getOwnPropertyDescriptor(def, "shape");
|
|
20198
20198
|
const sh = desc?.get ? desc.get.raw : def.shape ?? {};
|
|
20199
20199
|
if (sh) {
|
|
20200
|
-
const
|
|
20200
|
+
const get2 = () => {
|
|
20201
20201
|
const newSh = { ...sh };
|
|
20202
20202
|
Object.defineProperty(def, "shape", { value: newSh });
|
|
20203
|
-
|
|
20203
|
+
get2.raw = newSh;
|
|
20204
20204
|
return newSh;
|
|
20205
20205
|
};
|
|
20206
|
-
|
|
20207
|
-
Object.defineProperty(def, "shape", { get });
|
|
20206
|
+
get2.raw = sh;
|
|
20207
|
+
Object.defineProperty(def, "shape", { get: get2 });
|
|
20208
20208
|
}
|
|
20209
20209
|
const _normalized = cached(() => normalizeDef(def));
|
|
20210
20210
|
defineLazyInternal(inst, "propValues", (zod) => {
|
|
@@ -20535,10 +20535,10 @@ function getDiscriminatedOption(union2, value) {
|
|
|
20535
20535
|
function discriminatorMap(def) {
|
|
20536
20536
|
const map2 = /* @__PURE__ */ new Map();
|
|
20537
20537
|
for (const option of def.options) {
|
|
20538
|
-
const
|
|
20539
|
-
if (!
|
|
20538
|
+
const values2 = option._zod.propValues?.[def.discriminator];
|
|
20539
|
+
if (!values2 || values2.size === 0)
|
|
20540
20540
|
throw new Error(`Invalid discriminated union option at index "${def.options.indexOf(option)}"`);
|
|
20541
|
-
for (const value of
|
|
20541
|
+
for (const value of values2) {
|
|
20542
20542
|
if (map2.has(value)) {
|
|
20543
20543
|
if (value !== void 0)
|
|
20544
20544
|
throw new Error(`Duplicate discriminator value "${String(value)}"`);
|
|
@@ -20683,19 +20683,19 @@ function handleIntersectionResults(result, left, right) {
|
|
|
20683
20683
|
let unrecIssue;
|
|
20684
20684
|
const keyIssues = /* @__PURE__ */ new Map();
|
|
20685
20685
|
const collect2 = (iss, side) => {
|
|
20686
|
-
let
|
|
20686
|
+
let keys2;
|
|
20687
20687
|
if (iss.code === "unrecognized_keys" && !iss.path?.length) {
|
|
20688
20688
|
unrecIssue ?? (unrecIssue = iss);
|
|
20689
|
-
|
|
20689
|
+
keys2 = iss.keys;
|
|
20690
20690
|
} else if (iss.code === "invalid_key" && iss.origin === "record" && iss.path?.length === 1) {
|
|
20691
20691
|
const k = String(iss.path[0]);
|
|
20692
20692
|
if (!keyIssues.has(k))
|
|
20693
20693
|
keyIssues.set(k, iss);
|
|
20694
|
-
|
|
20694
|
+
keys2 = [k];
|
|
20695
20695
|
} else {
|
|
20696
20696
|
return false;
|
|
20697
20697
|
}
|
|
20698
|
-
for (const k of
|
|
20698
|
+
for (const k of keys2) {
|
|
20699
20699
|
if (!unrecKeys.has(k))
|
|
20700
20700
|
unrecKeys.set(k, {});
|
|
20701
20701
|
unrecKeys.get(k)[side] = true;
|
|
@@ -20868,11 +20868,11 @@ var $ZodRecord = /* @__PURE__ */ $constructor("$ZodRecord", (inst, def) => {
|
|
|
20868
20868
|
return payload;
|
|
20869
20869
|
}
|
|
20870
20870
|
const proms = [];
|
|
20871
|
-
const
|
|
20872
|
-
if (
|
|
20871
|
+
const values2 = def.keyType._zod.values;
|
|
20872
|
+
if (values2 && !def.partial) {
|
|
20873
20873
|
payload.value = memo2 ? memo2.alloc(inst, payload, {}, ctx) : {};
|
|
20874
20874
|
const recordKeys = /* @__PURE__ */ new Set();
|
|
20875
|
-
for (const key of
|
|
20875
|
+
for (const key of values2) {
|
|
20876
20876
|
if (typeof key === "string" || typeof key === "number" || typeof key === "symbol") {
|
|
20877
20877
|
recordKeys.add(typeof key === "number" ? key.toString() : key);
|
|
20878
20878
|
if (key === "__proto__")
|
|
@@ -20958,7 +20958,7 @@ var $ZodRecord = /* @__PURE__ */ $constructor("$ZodRecord", (inst, def) => {
|
|
|
20958
20958
|
if (keyResult.issues.length) {
|
|
20959
20959
|
if (def.mode === "loose") {
|
|
20960
20960
|
payload.value[key] = input2[key];
|
|
20961
|
-
} else if (
|
|
20961
|
+
} else if (values2) {
|
|
20962
20962
|
unrecognized = unrecognized ?? [];
|
|
20963
20963
|
unrecognized.push(key);
|
|
20964
20964
|
} else {
|
|
@@ -21123,8 +21123,8 @@ function handleSetResult(result, final) {
|
|
|
21123
21123
|
}
|
|
21124
21124
|
var $ZodEnum = /* @__PURE__ */ $constructor("$ZodEnum", (inst, def) => {
|
|
21125
21125
|
$ZodType.init(inst, def);
|
|
21126
|
-
const
|
|
21127
|
-
const valuesSet = new Set(
|
|
21126
|
+
const values2 = getEnumValues(def.entries);
|
|
21127
|
+
const valuesSet = new Set(values2);
|
|
21128
21128
|
inst._zod.values = valuesSet;
|
|
21129
21129
|
defineLazyInternal(inst, "pattern", (zod) => {
|
|
21130
21130
|
const patternValues = getEnumValues(zod.def.entries).filter((k) => propertyKeyTypes.has(typeof k));
|
|
@@ -21137,7 +21137,7 @@ var $ZodEnum = /* @__PURE__ */ $constructor("$ZodEnum", (inst, def) => {
|
|
|
21137
21137
|
}
|
|
21138
21138
|
payload.issues.push({
|
|
21139
21139
|
code: "invalid_value",
|
|
21140
|
-
values,
|
|
21140
|
+
values: values2,
|
|
21141
21141
|
input: input2,
|
|
21142
21142
|
inst
|
|
21143
21143
|
});
|
|
@@ -21146,15 +21146,15 @@ var $ZodEnum = /* @__PURE__ */ $constructor("$ZodEnum", (inst, def) => {
|
|
|
21146
21146
|
});
|
|
21147
21147
|
var $ZodLiteral = /* @__PURE__ */ $constructor("$ZodLiteral", (inst, def) => {
|
|
21148
21148
|
$ZodType.init(inst, def);
|
|
21149
|
-
const
|
|
21150
|
-
inst._zod.values =
|
|
21149
|
+
const values2 = new Set(def.values);
|
|
21150
|
+
inst._zod.values = values2;
|
|
21151
21151
|
defineLazyInternal(inst, "pattern", (zod) => {
|
|
21152
21152
|
const vals = zod.def.values;
|
|
21153
21153
|
return new RegExp(vals.length ? `^(${vals.map((o) => typeof o === "string" ? escapeRegex(o) : o ? escapeRegex(o.toString()) : String(o)).join("|")})$` : "^[^\\s\\S]$");
|
|
21154
21154
|
});
|
|
21155
21155
|
inst._zod.parse = (payload, _ctx) => {
|
|
21156
21156
|
const input2 = payload.value;
|
|
21157
|
-
if (
|
|
21157
|
+
if (values2.has(input2)) {
|
|
21158
21158
|
return payload;
|
|
21159
21159
|
}
|
|
21160
21160
|
payload.issues.push({
|
|
@@ -21213,8 +21213,8 @@ var $ZodOptional = /* @__PURE__ */ $constructor("$ZodOptional", (inst, def) => {
|
|
|
21213
21213
|
defineLazyInternal(inst, "optin", (zod) => zod.def.innerType._zod.optin === "defaulted" ? "defaulted" : "optional");
|
|
21214
21214
|
inst._zod.optout = "optional";
|
|
21215
21215
|
defineLazyInternal(inst, "values", (zod) => {
|
|
21216
|
-
const
|
|
21217
|
-
return
|
|
21216
|
+
const values2 = zod.def.innerType._zod.values;
|
|
21217
|
+
return values2 ? /* @__PURE__ */ new Set([...values2, void 0]) : void 0;
|
|
21218
21218
|
});
|
|
21219
21219
|
defineLazyInternal(inst, "pattern", (zod) => {
|
|
21220
21220
|
const pattern = zod.def.innerType._zod.pattern;
|
|
@@ -30364,13 +30364,13 @@ function generateObjectCheck(doc, ctx, schema, accessor, buildsValue = true) {
|
|
|
30364
30364
|
const def = schema._zod.def;
|
|
30365
30365
|
doc.write(`if (typeof ${accessor} !== "object" || ${accessor} === null || Array.isArray(${accessor})) return INVALID;`);
|
|
30366
30366
|
const shape = def.shape;
|
|
30367
|
-
const
|
|
30367
|
+
const keys2 = Object.keys(shape);
|
|
30368
30368
|
const symbolKeys = Object.getOwnPropertySymbols(shape);
|
|
30369
|
-
const allKeys = symbolKeys.length ? [...
|
|
30369
|
+
const allKeys = symbolKeys.length ? [...keys2, ...symbolKeys] : keys2;
|
|
30370
30370
|
const keyExpr = (k) => typeof k === "symbol" ? addConstant(ctx, k) : esc(k);
|
|
30371
30371
|
const propKey = (k) => typeof k === "symbol" ? `[${keyExpr(k)}]` : esc(k);
|
|
30372
30372
|
const propShape = shape;
|
|
30373
|
-
if (
|
|
30373
|
+
if (keys2.includes("__proto__")) {
|
|
30374
30374
|
throw new ZodCompileUnsupportedError('object shape key "__proto__"');
|
|
30375
30375
|
}
|
|
30376
30376
|
const propOutputs = /* @__PURE__ */ new Map();
|
|
@@ -30412,7 +30412,7 @@ function generateObjectCheck(doc, ctx, schema, accessor, buildsValue = true) {
|
|
|
30412
30412
|
if (catchall) {
|
|
30413
30413
|
const catchallType = catchall._zod.def.type;
|
|
30414
30414
|
if (catchallType === "never") {
|
|
30415
|
-
const condition =
|
|
30415
|
+
const condition = keys2.map((k) => `k !== ${esc(k)}`).join(" && ") || "true";
|
|
30416
30416
|
doc.write(`for (const k in ${accessor}) {`);
|
|
30417
30417
|
doc.indented((d) => {
|
|
30418
30418
|
d.write(`if (${condition}) return INVALID;`);
|
|
@@ -30428,7 +30428,7 @@ function generateObjectCheck(doc, ctx, schema, accessor, buildsValue = true) {
|
|
|
30428
30428
|
const hasConditionalKeys = allKeys.some((k) => mayOmitUndefined(propShape[k]) || dropsWhenAbsent(propShape[k]));
|
|
30429
30429
|
if (!buildsValue) {
|
|
30430
30430
|
if (unknownKeysMode === "schema") {
|
|
30431
|
-
const knownSet =
|
|
30431
|
+
const knownSet = keys2.length > 0 ? addConstant(ctx, new Set(keys2)) : null;
|
|
30432
30432
|
doc.write(`for (const k in ${accessor}) {`);
|
|
30433
30433
|
doc.indented((d) => {
|
|
30434
30434
|
d.write(`if (k === "__proto__") continue;`);
|
|
@@ -30460,7 +30460,7 @@ function generateObjectCheck(doc, ctx, schema, accessor, buildsValue = true) {
|
|
|
30460
30460
|
}
|
|
30461
30461
|
}
|
|
30462
30462
|
if (unknownKeysMode !== "none") {
|
|
30463
|
-
const knownSet =
|
|
30463
|
+
const knownSet = keys2.length > 0 ? addConstant(ctx, new Set(keys2)) : null;
|
|
30464
30464
|
doc.write(`for (const k in ${accessor}) {`);
|
|
30465
30465
|
doc.indented((d) => {
|
|
30466
30466
|
d.write(`if (k === "__proto__") continue;`);
|
|
@@ -30670,15 +30670,15 @@ function generateArrayCheck(doc, ctx, schema, accessor, buildsValue = true) {
|
|
|
30670
30670
|
}
|
|
30671
30671
|
function generateLiteralCheck(doc, ctx, schema, accessor) {
|
|
30672
30672
|
const def = schema._zod.def;
|
|
30673
|
-
const
|
|
30674
|
-
if (
|
|
30675
|
-
const literalSet = addConstant(ctx, new Set(
|
|
30673
|
+
const values2 = def.values;
|
|
30674
|
+
if (values2.length !== 1) {
|
|
30675
|
+
const literalSet = addConstant(ctx, new Set(values2));
|
|
30676
30676
|
doc.write(`if (!${literalSet}.has(${accessor})) return INVALID;`);
|
|
30677
30677
|
return accessor;
|
|
30678
30678
|
}
|
|
30679
|
-
const value =
|
|
30679
|
+
const value = values2[0];
|
|
30680
30680
|
if (typeof value === "number" && Number.isNaN(value)) {
|
|
30681
|
-
const literalSet = addConstant(ctx, new Set(
|
|
30681
|
+
const literalSet = addConstant(ctx, new Set(values2));
|
|
30682
30682
|
doc.write(`if (!${literalSet}.has(${accessor})) return INVALID;`);
|
|
30683
30683
|
return accessor;
|
|
30684
30684
|
}
|
|
@@ -30698,11 +30698,11 @@ function generateLiteralCheck(doc, ctx, schema, accessor) {
|
|
|
30698
30698
|
return accessor;
|
|
30699
30699
|
}
|
|
30700
30700
|
function generateEnumCheck(doc, ctx, schema, accessor) {
|
|
30701
|
-
const
|
|
30702
|
-
if (!
|
|
30701
|
+
const values2 = schema._zod.values;
|
|
30702
|
+
if (!values2) {
|
|
30703
30703
|
throw new ZodCompileUnsupportedError("enum schema without enumerated values");
|
|
30704
30704
|
}
|
|
30705
|
-
const enumSet = addConstant(ctx,
|
|
30705
|
+
const enumSet = addConstant(ctx, values2);
|
|
30706
30706
|
doc.write(`if (!${enumSet}.has(${accessor})) return INVALID;`);
|
|
30707
30707
|
return accessor;
|
|
30708
30708
|
}
|
|
@@ -30851,8 +30851,8 @@ function generateUnionCheck(doc, ctx, schema, accessor) {
|
|
|
30851
30851
|
}
|
|
30852
30852
|
const allLiterals = options.every((opt) => opt._zod.def.type === "literal" && !opt._zod.def.checks?.length);
|
|
30853
30853
|
if (allLiterals) {
|
|
30854
|
-
const
|
|
30855
|
-
const valuesConst = addConstant(ctx,
|
|
30854
|
+
const values2 = new Set(options.flatMap((opt) => opt._zod.def.values));
|
|
30855
|
+
const valuesConst = addConstant(ctx, values2);
|
|
30856
30856
|
doc.write(`if (!${valuesConst}.has(${accessor})) return INVALID;`);
|
|
30857
30857
|
return accessor;
|
|
30858
30858
|
}
|
|
@@ -30889,17 +30889,17 @@ function generateDiscriminatedUnionCheck(doc, ctx, def, accessor) {
|
|
|
30889
30889
|
let firstBranch = true;
|
|
30890
30890
|
const claimed = /* @__PURE__ */ new Set();
|
|
30891
30891
|
for (const option of def.options) {
|
|
30892
|
-
const
|
|
30893
|
-
if (!
|
|
30892
|
+
const values2 = option._zod.propValues?.[def.discriminator];
|
|
30893
|
+
if (!values2 || values2.size === 0) {
|
|
30894
30894
|
throw new ZodCompileUnsupportedError("discriminated union option without static discriminator values");
|
|
30895
30895
|
}
|
|
30896
|
-
for (const value of
|
|
30896
|
+
for (const value of values2) {
|
|
30897
30897
|
if (claimed.has(value)) {
|
|
30898
30898
|
throw new ZodCompileUnsupportedError(`duplicate discriminator value ${String(value)}`);
|
|
30899
30899
|
}
|
|
30900
30900
|
claimed.add(value);
|
|
30901
30901
|
}
|
|
30902
|
-
const conditions = Array.from(
|
|
30902
|
+
const conditions = Array.from(values2, (value) => literalEquality(ctx, discVar, value));
|
|
30903
30903
|
const prefix = firstBranch ? "if" : "else if";
|
|
30904
30904
|
doc.write(`${prefix} (${conditions.join(" || ")}) {`);
|
|
30905
30905
|
doc.indented((d) => {
|
|
@@ -32001,8 +32001,8 @@ function _set(Class2, valueType, params) {
|
|
|
32001
32001
|
});
|
|
32002
32002
|
}
|
|
32003
32003
|
// @__NO_SIDE_EFFECTS__
|
|
32004
|
-
function _enum(Class2,
|
|
32005
|
-
const entries = Array.isArray(
|
|
32004
|
+
function _enum(Class2, values2, params) {
|
|
32005
|
+
const entries = Array.isArray(values2) ? Object.fromEntries(values2.map((v) => [v, v])) : values2;
|
|
32006
32006
|
return new Class2({
|
|
32007
32007
|
type: "enum",
|
|
32008
32008
|
entries,
|
|
@@ -32479,8 +32479,8 @@ function compactTypeUnion(schema) {
|
|
|
32479
32479
|
if (!option || typeof option !== "object")
|
|
32480
32480
|
return;
|
|
32481
32481
|
compactTypeUnion(option);
|
|
32482
|
-
const
|
|
32483
|
-
if (
|
|
32482
|
+
const keys2 = Object.keys(option);
|
|
32483
|
+
if (keys2.length !== 1 || keys2[0] !== "type")
|
|
32484
32484
|
return;
|
|
32485
32485
|
const type = option.type;
|
|
32486
32486
|
for (const member of Array.isArray(type) ? type : [type]) {
|
|
@@ -33015,16 +33015,16 @@ var dateProcessor = (schema, ctx, json2, params) => {
|
|
|
33015
33015
|
};
|
|
33016
33016
|
var enumProcessor = (schema, _ctx, json2, _params) => {
|
|
33017
33017
|
const def = schema._zod.def;
|
|
33018
|
-
const
|
|
33019
|
-
if (
|
|
33018
|
+
const values2 = getEnumValues(def.entries);
|
|
33019
|
+
if (values2.length === 0) {
|
|
33020
33020
|
json2.not = {};
|
|
33021
33021
|
return;
|
|
33022
33022
|
}
|
|
33023
|
-
if (
|
|
33023
|
+
if (values2.every((v) => typeof v === "number"))
|
|
33024
33024
|
json2.type = "number";
|
|
33025
|
-
if (
|
|
33025
|
+
if (values2.every((v) => typeof v === "string"))
|
|
33026
33026
|
json2.type = "string";
|
|
33027
|
-
json2.enum =
|
|
33027
|
+
json2.enum = values2;
|
|
33028
33028
|
};
|
|
33029
33029
|
var literalProcessor = (schema, ctx, json2, params) => {
|
|
33030
33030
|
const def = schema._zod.def;
|
|
@@ -33292,8 +33292,8 @@ function stringifyKeyNames(bySchema, json2, visited) {
|
|
|
33292
33292
|
}
|
|
33293
33293
|
const types = Array.isArray(json2.type) ? json2.type : [json2.type];
|
|
33294
33294
|
const numericType = !types.includes("string") && types.some((t) => t === "number" || t === "integer");
|
|
33295
|
-
const
|
|
33296
|
-
if (!numericType && !
|
|
33295
|
+
const values2 = json2.enum ?? (json2.const !== void 0 ? [json2.const] : void 0);
|
|
33296
|
+
if (!numericType && !values2?.some((v) => typeof v === "number"))
|
|
33297
33297
|
return json2;
|
|
33298
33298
|
const { minimum, maximum, exclusiveMinimum, exclusiveMaximum, multipleOf, format, id, ...rest } = json2;
|
|
33299
33299
|
if (rest.enum)
|
|
@@ -33303,7 +33303,7 @@ function stringifyKeyNames(bySchema, json2, visited) {
|
|
|
33303
33303
|
if (!numericType)
|
|
33304
33304
|
return rest;
|
|
33305
33305
|
rest.type = "string";
|
|
33306
|
-
if (!
|
|
33306
|
+
if (!values2)
|
|
33307
33307
|
rest.pattern = (types.includes("number") ? number : integer).source;
|
|
33308
33308
|
return rest;
|
|
33309
33309
|
}
|
|
@@ -33728,10 +33728,10 @@ function visit(schema, fnOrHandlers) {
|
|
|
33728
33728
|
switch (kind) {
|
|
33729
33729
|
case "object": {
|
|
33730
33730
|
const oldShape = def.shape;
|
|
33731
|
-
const
|
|
33731
|
+
const keys2 = Object.keys(oldShape);
|
|
33732
33732
|
let changed = false;
|
|
33733
33733
|
const newShape = {};
|
|
33734
|
-
for (const k of
|
|
33734
|
+
for (const k of keys2) {
|
|
33735
33735
|
const mapped = run(oldShape[k]);
|
|
33736
33736
|
if (mapped !== oldShape[k])
|
|
33737
33737
|
changed = true;
|
|
@@ -33859,11 +33859,11 @@ function isZ4Schema(s) {
|
|
|
33859
33859
|
return !!schema._zod;
|
|
33860
33860
|
}
|
|
33861
33861
|
function objectFromShape(shape) {
|
|
33862
|
-
const
|
|
33863
|
-
if (
|
|
33862
|
+
const values2 = Object.values(shape);
|
|
33863
|
+
if (values2.length === 0)
|
|
33864
33864
|
return object({});
|
|
33865
|
-
const allV4 =
|
|
33866
|
-
const allV3 =
|
|
33865
|
+
const allV4 = values2.every(isZ4Schema);
|
|
33866
|
+
const allV3 = values2.every((s) => !isZ4Schema(s));
|
|
33867
33867
|
if (allV4)
|
|
33868
33868
|
return object(shape);
|
|
33869
33869
|
if (allV3)
|
|
@@ -33917,8 +33917,8 @@ function normalizeObjectSchema(schema) {
|
|
|
33917
33917
|
const asV3 = schema;
|
|
33918
33918
|
const asV4 = schema;
|
|
33919
33919
|
if (!asV3._def && !asV4._zod) {
|
|
33920
|
-
const
|
|
33921
|
-
if (
|
|
33920
|
+
const values2 = Object.values(schema);
|
|
33921
|
+
if (values2.length > 0 && values2.every((v) => typeof v === "object" && v !== null && (v._def !== void 0 || v._zod !== void 0 || typeof v.parse === "function"))) {
|
|
33922
33922
|
return objectFromShape(schema);
|
|
33923
33923
|
}
|
|
33924
33924
|
}
|
|
@@ -33937,11 +33937,11 @@ function normalizeObjectSchema(schema) {
|
|
|
33937
33937
|
}
|
|
33938
33938
|
return void 0;
|
|
33939
33939
|
}
|
|
33940
|
-
function getDotPath(
|
|
33941
|
-
if (
|
|
33940
|
+
function getDotPath(path5) {
|
|
33941
|
+
if (path5.length === 0) {
|
|
33942
33942
|
return "object root";
|
|
33943
33943
|
}
|
|
33944
|
-
return
|
|
33944
|
+
return path5.reduce((acc, seg, index) => {
|
|
33945
33945
|
if (index === 0) {
|
|
33946
33946
|
return String(seg);
|
|
33947
33947
|
}
|
|
@@ -35607,11 +35607,11 @@ var ZodEnum2 = /* @__PURE__ */ $constructor("ZodEnum", (inst, def) => {
|
|
|
35607
35607
|
inst._zod.processJSONSchema = (ctx, json2, params) => enumProcessor(inst, ctx, json2, params);
|
|
35608
35608
|
inst.enum = def.entries;
|
|
35609
35609
|
inst.options = [...inst._zod.values];
|
|
35610
|
-
const
|
|
35611
|
-
inst.extract = (
|
|
35610
|
+
const keys2 = new Set(Object.keys(def.entries));
|
|
35611
|
+
inst.extract = (values2, params) => {
|
|
35612
35612
|
const newEntries = {};
|
|
35613
|
-
for (const value of
|
|
35614
|
-
if (
|
|
35613
|
+
for (const value of values2) {
|
|
35614
|
+
if (keys2.has(value)) {
|
|
35615
35615
|
newEntries[value] = def.entries[value];
|
|
35616
35616
|
} else
|
|
35617
35617
|
throw new Error(`Key ${value} not found in enum`);
|
|
@@ -35623,10 +35623,10 @@ var ZodEnum2 = /* @__PURE__ */ $constructor("ZodEnum", (inst, def) => {
|
|
|
35623
35623
|
entries: newEntries
|
|
35624
35624
|
});
|
|
35625
35625
|
};
|
|
35626
|
-
inst.exclude = (
|
|
35626
|
+
inst.exclude = (values2, params) => {
|
|
35627
35627
|
const newEntries = { ...def.entries };
|
|
35628
|
-
for (const value of
|
|
35629
|
-
if (
|
|
35628
|
+
for (const value of values2) {
|
|
35629
|
+
if (keys2.has(value)) {
|
|
35630
35630
|
delete newEntries[value];
|
|
35631
35631
|
} else
|
|
35632
35632
|
throw new Error(`Key ${value} not found in enum`);
|
|
@@ -35639,8 +35639,8 @@ var ZodEnum2 = /* @__PURE__ */ $constructor("ZodEnum", (inst, def) => {
|
|
|
35639
35639
|
});
|
|
35640
35640
|
};
|
|
35641
35641
|
});
|
|
35642
|
-
function _enum2(
|
|
35643
|
-
const entries = Array.isArray(
|
|
35642
|
+
function _enum2(values2, params) {
|
|
35643
|
+
const entries = Array.isArray(values2) ? Object.fromEntries(values2.map((v) => [v, v])) : values2;
|
|
35644
35644
|
return new ZodEnum2({
|
|
35645
35645
|
type: "enum",
|
|
35646
35646
|
entries,
|
|
@@ -36168,13 +36168,13 @@ function resolveRef(ref, ctx) {
|
|
|
36168
36168
|
if (!ref.startsWith("#")) {
|
|
36169
36169
|
throw new Error("External $ref is not supported, only local refs (#/...) are allowed");
|
|
36170
36170
|
}
|
|
36171
|
-
const
|
|
36172
|
-
if (
|
|
36171
|
+
const path5 = ref.slice(1).split("/").filter(Boolean);
|
|
36172
|
+
if (path5.length === 0) {
|
|
36173
36173
|
return ctx.rootSchema;
|
|
36174
36174
|
}
|
|
36175
36175
|
const defsKey = ctx.version === "draft-2020-12" ? "$defs" : "definitions";
|
|
36176
|
-
if (
|
|
36177
|
-
const key =
|
|
36176
|
+
if (path5[0] === defsKey) {
|
|
36177
|
+
const key = path5[1] === void 0 ? void 0 : decodeJSONPointerSegment(path5[1]);
|
|
36178
36178
|
if (!key || !ctx.defs[key]) {
|
|
36179
36179
|
throw new Error(`Reference not found: ${ref}`);
|
|
36180
36180
|
}
|
|
@@ -36187,8 +36187,8 @@ function checkObjectGuards(objectSchema, guards) {
|
|
|
36187
36187
|
const value = payload.value;
|
|
36188
36188
|
if (typeof value !== "object" || value === null || Array.isArray(value))
|
|
36189
36189
|
return;
|
|
36190
|
-
const
|
|
36191
|
-
if (guards.minProperties !== void 0 &&
|
|
36190
|
+
const keys2 = Object.getOwnPropertyNames(value);
|
|
36191
|
+
if (guards.minProperties !== void 0 && keys2.length < guards.minProperties) {
|
|
36192
36192
|
payload.issues.push({
|
|
36193
36193
|
origin: "object",
|
|
36194
36194
|
code: "too_small",
|
|
@@ -36200,7 +36200,7 @@ function checkObjectGuards(objectSchema, guards) {
|
|
|
36200
36200
|
continue: true
|
|
36201
36201
|
});
|
|
36202
36202
|
}
|
|
36203
|
-
if (guards.maxProperties !== void 0 &&
|
|
36203
|
+
if (guards.maxProperties !== void 0 && keys2.length > guards.maxProperties) {
|
|
36204
36204
|
payload.issues.push({
|
|
36205
36205
|
origin: "object",
|
|
36206
36206
|
code: "too_big",
|
|
@@ -36213,7 +36213,7 @@ function checkObjectGuards(objectSchema, guards) {
|
|
|
36213
36213
|
});
|
|
36214
36214
|
}
|
|
36215
36215
|
if (guards.keySchema) {
|
|
36216
|
-
for (const key of
|
|
36216
|
+
for (const key of keys2) {
|
|
36217
36217
|
const result = guards.keySchema.safeParse(key);
|
|
36218
36218
|
if (result.success)
|
|
36219
36219
|
continue;
|
|
@@ -36254,9 +36254,9 @@ function canonicalKey(value, seen) {
|
|
|
36254
36254
|
}
|
|
36255
36255
|
return `a${parts2.length}:[${parts2.join(",")}]`;
|
|
36256
36256
|
}
|
|
36257
|
-
const
|
|
36257
|
+
const keys2 = Object.keys(value).sort();
|
|
36258
36258
|
const parts = [];
|
|
36259
|
-
for (const k of
|
|
36259
|
+
for (const k of keys2) {
|
|
36260
36260
|
const key = canonicalKey(value[k], seen);
|
|
36261
36261
|
if (key === null)
|
|
36262
36262
|
return null;
|
|
@@ -39112,11 +39112,11 @@ function parseMapDef(def, refs) {
|
|
|
39112
39112
|
if (refs.mapStrategy === "record") {
|
|
39113
39113
|
return parseRecordDef(def, refs);
|
|
39114
39114
|
}
|
|
39115
|
-
const
|
|
39115
|
+
const keys2 = parseDef(def.keyType._def, {
|
|
39116
39116
|
...refs,
|
|
39117
39117
|
currentPath: [...refs.currentPath, "items", "items", "0"]
|
|
39118
39118
|
}) || parseAnyDef(refs);
|
|
39119
|
-
const
|
|
39119
|
+
const values2 = parseDef(def.valueType._def, {
|
|
39120
39120
|
...refs,
|
|
39121
39121
|
currentPath: [...refs.currentPath, "items", "items", "1"]
|
|
39122
39122
|
}) || parseAnyDef(refs);
|
|
@@ -39125,7 +39125,7 @@ function parseMapDef(def, refs) {
|
|
|
39125
39125
|
maxItems: 125,
|
|
39126
39126
|
items: {
|
|
39127
39127
|
type: "array",
|
|
39128
|
-
items: [
|
|
39128
|
+
items: [keys2, values2],
|
|
39129
39129
|
minItems: 2,
|
|
39130
39130
|
maxItems: 2
|
|
39131
39131
|
}
|
|
@@ -39139,7 +39139,7 @@ function parseNativeEnumDef(def) {
|
|
|
39139
39139
|
return typeof object3[object3[key]] !== "number";
|
|
39140
39140
|
});
|
|
39141
39141
|
const actualValues = actualKeys.map((key) => object3[key]);
|
|
39142
|
-
const parsedTypes = Array.from(new Set(actualValues.map((
|
|
39142
|
+
const parsedTypes = Array.from(new Set(actualValues.map((values2) => typeof values2)));
|
|
39143
39143
|
return {
|
|
39144
39144
|
type: parsedTypes.length === 1 ? parsedTypes[0] === "string" ? "string" : "number" : ["string", "number"],
|
|
39145
39145
|
enum: actualValues
|
|
@@ -42436,7 +42436,7 @@ var import_websocket_server = __toESM(require_websocket_server(), 1);
|
|
|
42436
42436
|
// package.json
|
|
42437
42437
|
var package_default = {
|
|
42438
42438
|
name: "figma-lupa",
|
|
42439
|
-
version: "0.
|
|
42439
|
+
version: "0.3.0",
|
|
42440
42440
|
description: "Read-only Figma CLI, MCP server and plugin for pixel-faithful design-to-code with a small context footprint.",
|
|
42441
42441
|
type: "module",
|
|
42442
42442
|
license: "GPL-3.0-or-later",
|
|
@@ -42929,7 +42929,7 @@ var FORMAT_LEGEND = `get_design format \u2014 one line per layer, children inden
|
|
|
42929
42929
|
"+N more like \u2191" / "+N more alternating like the 2 above" = siblings with the same structure as the layer(s) just printed; the lines under it give each one's id and its own texts/images.
|
|
42930
42930
|
"\u2026 +N layers not shown \u2192 get_design #id" = cut by the token budget; fetch that subtree when you need it.
|
|
42931
42931
|
// lines = designer notes, prototype interactions, component props, exports.
|
|
42932
|
-
Codebase: "\u2192 var(--x)" after a colour or font = the project's own variable for that value; "\u2192 .class" after a typography token = its text style class. "// project has: \u2026" = where the project defines that component. A src: outside the assets folder = the project's own icon with the same drawing.
|
|
42932
|
+
Codebase: "\u2192 var(--x)" after a colour or font = the project's own variable for that value; "\u2192 .class" after a typography token = its text style class. Tailwind theme (v4 @theme or v3 tailwind.config): "\u2192 *-grey-200" = that colour's utilities (bg-grey-200, text-grey-200, border-grey-200\u2026), "\u2192 font-sans" = the font utility, "\u2192 text-sm font-medium leading-[20px]" = utility classes for a typography token. "// project has: \u2026" = where the project defines that component, with its props when Lupa can read them (<Button variant="default*|outline"> for React cva/tv variants or string-union props, <.button variant="primary"> <:actions> for Phoenix attrs and slots; * = default). A src: outside the assets folder = the project's own icon with the same drawing; src:<PlusIcon /> (components/icons/plus.tsx) = the project's own icon component; src:<ChevronDown /> from lucide-react or src:<.icon name="hero-x-mark" /> = that icon from the project's icon library (no file written).
|
|
42933
42933
|
Reproduce exact values (sizes, spacing, colours, type). Before writing any colour, $token or raw (#hex, rgba), look for the codebase's own token with that name or value (Tailwind theme, CSS variables, theme object) and use it; hardcode only when none matches.`;
|
|
42934
42934
|
|
|
42935
42935
|
// src/model/css.ts
|
|
@@ -43387,9 +43387,9 @@ var KIND = {
|
|
|
43387
43387
|
LINE: "line"
|
|
43388
43388
|
};
|
|
43389
43389
|
var Builder = class {
|
|
43390
|
-
constructor(snap,
|
|
43390
|
+
constructor(snap, files2) {
|
|
43391
43391
|
this.snap = snap;
|
|
43392
|
-
this.files =
|
|
43392
|
+
this.files = files2;
|
|
43393
43393
|
this.reg = new Registry(snap);
|
|
43394
43394
|
}
|
|
43395
43395
|
reg;
|
|
@@ -43516,18 +43516,18 @@ var Builder = class {
|
|
|
43516
43516
|
if (!raw.layoutMode || raw.graphic) return;
|
|
43517
43517
|
const L = ir.layout;
|
|
43518
43518
|
const bv = raw.boundVariables ?? {};
|
|
43519
|
-
const
|
|
43519
|
+
const num2 = (key) => this.reg.number(raw[key] ?? 0, bv[key]?.id);
|
|
43520
43520
|
if (raw.layoutMode === "GRID") {
|
|
43521
43521
|
const tracks = (t, count) => (t?.length ? t : Array.from({ length: count ?? 0 }, () => ({ type: "FLEX", value: 1 }))).map((s) => s.type === "FIXED" ? n(s.value ?? 0) : s.type === "HUG" ? "auto" : `${n(s.value ?? 1)}fr`).join(",");
|
|
43522
43522
|
L.grid = "";
|
|
43523
43523
|
L.cols = emptyTracks(raw, "col", tracks(raw.gridColumnSizes, raw.gridColumnCount));
|
|
43524
43524
|
L.rows = emptyTracks(raw, "row", tracks(raw.gridRowSizes, raw.gridRowCount));
|
|
43525
|
-
if (raw.gridColumnGap) L.gap =
|
|
43526
|
-
if (raw.gridRowGap) L.rowgap =
|
|
43525
|
+
if (raw.gridColumnGap) L.gap = num2("gridColumnGap");
|
|
43526
|
+
if (raw.gridRowGap) L.rowgap = num2("gridRowGap");
|
|
43527
43527
|
} else {
|
|
43528
43528
|
L[raw.layoutMode === "VERTICAL" ? "col" : "row"] = "";
|
|
43529
43529
|
if (raw.primaryAxisAlignItems === "SPACE_BETWEEN") L.justify = "between";
|
|
43530
|
-
else if (raw.itemSpacing) L.gap =
|
|
43530
|
+
else if (raw.itemSpacing) L.gap = num2("itemSpacing");
|
|
43531
43531
|
if (raw.layoutWrap) {
|
|
43532
43532
|
L.wrap = "";
|
|
43533
43533
|
if (raw.counterAxisSpacing) L.rowgap = this.reg.number(raw.counterAxisSpacing, bv.counterAxisSpacing?.id);
|
|
@@ -43543,8 +43543,8 @@ var Builder = class {
|
|
|
43543
43543
|
const pad = (key, side) => {
|
|
43544
43544
|
const v = raw[key] ?? 0;
|
|
43545
43545
|
const w = inset?.[side] ?? 0;
|
|
43546
|
-
if (!w || v < w) return
|
|
43547
|
-
const ref =
|
|
43546
|
+
if (!w || v < w) return num2(key);
|
|
43547
|
+
const ref = num2(key);
|
|
43548
43548
|
return ref.startsWith("$") ? `calc(${ref} - ${n(w)})` : n(v - w);
|
|
43549
43549
|
};
|
|
43550
43550
|
const p = sides(pad("paddingTop", 0), pad("paddingRight", 1), pad("paddingBottom", 2), pad("paddingLeft", 3));
|
|
@@ -43628,8 +43628,8 @@ var Builder = class {
|
|
|
43628
43628
|
const full = raw.cornerRadius >= Math.min(raw.w, raw.h) / 2 - 0.01 && Math.min(raw.w, raw.h) > 0;
|
|
43629
43629
|
S.radius = bv.cornerRadius ? this.reg.number(raw.cornerRadius, bv.cornerRadius.id) : full ? "full" : n(raw.cornerRadius);
|
|
43630
43630
|
} else if (raw.radii) {
|
|
43631
|
-
const
|
|
43632
|
-
S.radius = raw.radii.map((r, i) => this.reg.number(r, bv[
|
|
43631
|
+
const keys2 = ["topLeftRadius", "topRightRadius", "bottomRightRadius", "bottomLeftRadius"];
|
|
43632
|
+
S.radius = raw.radii.map((r, i) => this.reg.number(r, bv[keys2[i]]?.id)).join(",");
|
|
43633
43633
|
}
|
|
43634
43634
|
if (raw.cornerSmoothing && S.radius) S.smooth = `${n(raw.cornerSmoothing * 100, 0)}%`;
|
|
43635
43635
|
}
|
|
@@ -43877,7 +43877,7 @@ var Components = class {
|
|
|
43877
43877
|
this.diffChildren(inst, def, "", out, keyOf, resized);
|
|
43878
43878
|
return out;
|
|
43879
43879
|
}
|
|
43880
|
-
diffChildren(a, d,
|
|
43880
|
+
diffChildren(a, d, path5, out, keyOf, resized) {
|
|
43881
43881
|
const defByKey = new Map(d.children.map((c) => [keyOf(c, true), c]));
|
|
43882
43882
|
const matched = /* @__PURE__ */ new Set();
|
|
43883
43883
|
const names = pathNames(d.children);
|
|
@@ -43888,7 +43888,7 @@ var Components = class {
|
|
|
43888
43888
|
const cand = d.children[a.children.indexOf(child)];
|
|
43889
43889
|
dc = ok(cand) ? cand : d.children.find(ok);
|
|
43890
43890
|
}
|
|
43891
|
-
const p = joinPath(
|
|
43891
|
+
const p = joinPath(path5, dc ? names.get(dc) ?? dc.name : child.name);
|
|
43892
43892
|
if (!dc) {
|
|
43893
43893
|
out.push({ path: p, changes: ["added"], sub: child });
|
|
43894
43894
|
continue;
|
|
@@ -43899,20 +43899,20 @@ var Components = class {
|
|
|
43899
43899
|
for (const dc of d.children) {
|
|
43900
43900
|
if (matched.has(dc) || dc.hidden) continue;
|
|
43901
43901
|
if (dc.propRefs?.visible) continue;
|
|
43902
|
-
out.push({ path: joinPath(
|
|
43902
|
+
out.push({ path: joinPath(path5, names.get(dc) ?? dc.name), changes: ["hidden"] });
|
|
43903
43903
|
}
|
|
43904
43904
|
}
|
|
43905
|
-
diffNode(a, d,
|
|
43905
|
+
diffNode(a, d, path5, out, keyOf, resized) {
|
|
43906
43906
|
if (a.hidden && !d.hidden) {
|
|
43907
|
-
if (!d.propRefs?.visible) out.push({ path:
|
|
43907
|
+
if (!d.propRefs?.visible) out.push({ path: path5, changes: ["hidden"] });
|
|
43908
43908
|
return;
|
|
43909
43909
|
}
|
|
43910
43910
|
if (!a.hidden && d.hidden) {
|
|
43911
43911
|
if (d.propRefs?.visible) {
|
|
43912
43912
|
const changes2 = this.nodeChanges(a, d, resized);
|
|
43913
|
-
if (changes2.length) out.push({ path:
|
|
43914
|
-
this.diffChildren(a, d,
|
|
43915
|
-
} else out.push({ path:
|
|
43913
|
+
if (changes2.length) out.push({ path: path5, changes: changes2 });
|
|
43914
|
+
this.diffChildren(a, d, path5, out, keyOf, resized);
|
|
43915
|
+
} else out.push({ path: path5, changes: ["shown"], sub: a });
|
|
43916
43916
|
return;
|
|
43917
43917
|
}
|
|
43918
43918
|
if (a.hidden) return;
|
|
@@ -43926,22 +43926,22 @@ var Components = class {
|
|
|
43926
43926
|
if (a.kind === "svg" || !a.children.length) {
|
|
43927
43927
|
if (a.kind === "svg" && a.style.src !== d.style.src && a.style.src) changes2.push(`src:${a.style.src}`);
|
|
43928
43928
|
if (a.kind === "svg" && a.style.color !== d.style.color && a.style.color) changes2.push(`color:${a.style.color}`);
|
|
43929
|
-
if (changes2.length) out.push({ path:
|
|
43929
|
+
if (changes2.length) out.push({ path: path5, changes: changes2 });
|
|
43930
43930
|
} else if (def) {
|
|
43931
43931
|
changes2.push(...this.rootChanges(a, def.ir));
|
|
43932
|
-
if (changes2.length) out.push({ path:
|
|
43932
|
+
if (changes2.length) out.push({ path: path5, changes: changes2 });
|
|
43933
43933
|
const nested = this.overrides(a, def.ir);
|
|
43934
|
-
for (const o2 of nested) out.push({ ...o2, path: joinPath(
|
|
43934
|
+
for (const o2 of nested) out.push({ ...o2, path: joinPath(path5, o2.path) });
|
|
43935
43935
|
} else {
|
|
43936
|
-
out.push({ path:
|
|
43936
|
+
out.push({ path: path5, changes: changes2.length ? changes2 : [`swap\u2192${label}`], sub: a });
|
|
43937
43937
|
}
|
|
43938
43938
|
return;
|
|
43939
43939
|
}
|
|
43940
43940
|
const changes = this.nodeChanges(a, d, resized);
|
|
43941
|
-
const o = { path:
|
|
43941
|
+
const o = { path: path5, changes };
|
|
43942
43942
|
if (a.runs && JSON.stringify(a.runs) !== JSON.stringify(d.runs)) o.runs = a.runs;
|
|
43943
43943
|
if (changes.length || o.runs) out.push(o);
|
|
43944
|
-
if (a.kind !== "svg") this.diffChildren(a, d,
|
|
43944
|
+
if (a.kind !== "svg") this.diffChildren(a, d, path5, out, keyOf, resized);
|
|
43945
43945
|
}
|
|
43946
43946
|
nodeChanges(a, d, resized) {
|
|
43947
43947
|
const changes = [];
|
|
@@ -44114,12 +44114,12 @@ var Renderer = class {
|
|
|
44114
44114
|
const fonts = this.fonts([...roots, ...[...this.comps.defs.values()].filter((d) => charged.has(d.mainId)).map((d) => d.ir)]);
|
|
44115
44115
|
if (fonts) head.push(`fonts: ${fonts}`);
|
|
44116
44116
|
const assets = this.assets(roots);
|
|
44117
|
-
const
|
|
44118
|
-
if (
|
|
44119
|
-
const own2 =
|
|
44120
|
-
const count = (/* @__PURE__ */ new Set([...
|
|
44117
|
+
const files2 = this.opts.files;
|
|
44118
|
+
if (files2) {
|
|
44119
|
+
const own2 = files2.reused?.size ?? 0;
|
|
44120
|
+
const count = (/* @__PURE__ */ new Set([...files2.byNode.values(), ...files2.byImage.values()])).size - own2;
|
|
44121
44121
|
const ownNote = own2 ? ` + ${own2} icon${own2 === 1 ? "" : "s"} the project already has` : "";
|
|
44122
|
-
head.push(`assets: ${count} file${count === 1 ? "" : "s"} in ${
|
|
44122
|
+
head.push(`assets: ${count} file${count === 1 ? "" : "s"} in ${files2.dir}/${ownNote}, named by src: on each layer${files2.failures.length ? ` (${files2.failures.length} failed \u2192 export_assets)` : ""}`);
|
|
44123
44123
|
} else if (assets) head.push(`assets: ${assets} \u2192 export_assets`);
|
|
44124
44124
|
if (cut) head.push(`budget: tree cut breadth-first at ~${Math.round(this.budgetChars / CHARS_PER_TOKEN)} tokens \u2014 "not shown" markers say how to expand`);
|
|
44125
44125
|
if (this.snap.stats.truncated) head.push(`warning: snapshot hit the node limit; some layers were not loaded`);
|
|
@@ -44661,9 +44661,9 @@ function formatOutline(o) {
|
|
|
44661
44661
|
function formatMatches(r) {
|
|
44662
44662
|
if (!r.matches.length) return "No matches.";
|
|
44663
44663
|
const out = r.matches.map((m) => {
|
|
44664
|
-
const
|
|
44664
|
+
const path5 = [m.page, ...m.path].filter(Boolean).join(" \u203A ");
|
|
44665
44665
|
const text2 = m.text !== void 0 ? ` ${JSON.stringify(m.text)}` : "";
|
|
44666
|
-
return `${m.type.toLowerCase()} "${m.name}" #${m.id} ${m.w}\xD7${m.h}${text2} \u2014 ${
|
|
44666
|
+
return `${m.type.toLowerCase()} "${m.name}" #${m.id} ${m.w}\xD7${m.h}${text2} \u2014 ${path5}`;
|
|
44667
44667
|
});
|
|
44668
44668
|
if (r.truncated) out.push("\u2026 more matches; narrow the query, page or type.");
|
|
44669
44669
|
return out.join("\n");
|
|
@@ -44722,9 +44722,9 @@ function formatTokens(t, format, filter) {
|
|
|
44722
44722
|
if (!vars.length) continue;
|
|
44723
44723
|
lines.push(`${c.name}${c.remote ? " (library)" : ""} \u2014 modes: ${c.modes.map((m) => m.name).join(" | ")}`);
|
|
44724
44724
|
for (const v of vars) {
|
|
44725
|
-
const
|
|
44726
|
-
const uniq = new Set(
|
|
44727
|
-
lines.push(` ${v.name} = ${uniq.size === 1 ?
|
|
44725
|
+
const values2 = c.modes.map((m) => tokenValue(v.values[m.id], v.type));
|
|
44726
|
+
const uniq = new Set(values2);
|
|
44727
|
+
lines.push(` ${v.name} = ${uniq.size === 1 ? values2[0] : values2.join(" | ")}${v.web ? ` ${v.web}` : ""}${v.description ? ` \u2014 ${v.description.slice(0, 80)}` : ""}`);
|
|
44728
44728
|
}
|
|
44729
44729
|
}
|
|
44730
44730
|
}
|
|
@@ -44756,15 +44756,1602 @@ function formatTokens(t, format, filter) {
|
|
|
44756
44756
|
}
|
|
44757
44757
|
|
|
44758
44758
|
// src/tools/media.ts
|
|
44759
|
-
import { mkdir as mkdir2, readFile as
|
|
44760
|
-
import
|
|
44759
|
+
import { mkdir as mkdir2, readFile as readFile4, writeFile as writeFile2 } from "node:fs/promises";
|
|
44760
|
+
import path4 from "node:path";
|
|
44761
|
+
|
|
44762
|
+
// src/tools/icons.ts
|
|
44763
|
+
import { readdir, readFile as readFile2, stat as stat2 } from "node:fs/promises";
|
|
44764
|
+
import path2 from "node:path";
|
|
44765
|
+
var pascal = (s) => s.replace(/(^|[-_])([a-z0-9])/g, (_, __, c) => c.toUpperCase());
|
|
44766
|
+
async function exists(p) {
|
|
44767
|
+
try {
|
|
44768
|
+
await stat2(p);
|
|
44769
|
+
return true;
|
|
44770
|
+
} catch {
|
|
44771
|
+
return false;
|
|
44772
|
+
}
|
|
44773
|
+
}
|
|
44774
|
+
async function installed(from, root, pkg) {
|
|
44775
|
+
for (let dir = from; ; dir = path2.dirname(dir)) {
|
|
44776
|
+
const p = path2.join(dir, "node_modules", pkg);
|
|
44777
|
+
if (await exists(p)) return p;
|
|
44778
|
+
if (dir === root || path2.dirname(dir) === dir || !dir.startsWith(root)) return void 0;
|
|
44779
|
+
}
|
|
44780
|
+
}
|
|
44781
|
+
async function files(dir, re) {
|
|
44782
|
+
try {
|
|
44783
|
+
return (await readdir(dir)).filter((f) => re.test(f)).sort().map((f) => path2.join(dir, f));
|
|
44784
|
+
} catch {
|
|
44785
|
+
return [];
|
|
44786
|
+
}
|
|
44787
|
+
}
|
|
44788
|
+
function once(f) {
|
|
44789
|
+
let p;
|
|
44790
|
+
return () => p ??= f();
|
|
44791
|
+
}
|
|
44792
|
+
var HERO_SETS = [
|
|
44793
|
+
{ dir: "24/outline", suffix: "", stroke: true },
|
|
44794
|
+
{ dir: "24/solid", suffix: "-solid", stroke: false },
|
|
44795
|
+
{ dir: "20/solid", suffix: "-mini", stroke: false },
|
|
44796
|
+
{ dir: "16/solid", suffix: "-micro", stroke: false }
|
|
44797
|
+
];
|
|
44798
|
+
async function svgFolder(dir, usage) {
|
|
44799
|
+
const out = [];
|
|
44800
|
+
for (const f of await files(dir, /\.svg$/i)) {
|
|
44801
|
+
const svg = await readFile2(f, "utf8").catch(() => "");
|
|
44802
|
+
const points = pointsOf(svg);
|
|
44803
|
+
const name = path2.basename(f, ".svg");
|
|
44804
|
+
if (points) out.push({ usage: usage(name), name, points });
|
|
44805
|
+
}
|
|
44806
|
+
return out;
|
|
44807
|
+
}
|
|
44808
|
+
async function lucideModules(pkgDir, pkg) {
|
|
44809
|
+
const out = [];
|
|
44810
|
+
for (const f of await files(path2.join(pkgDir, "dist/esm/icons"), /\.m?js$/)) {
|
|
44811
|
+
const js = await readFile2(f, "utf8").catch(() => "");
|
|
44812
|
+
const els = [...js.matchAll(/\[\s*"(path|circle|rect|ellipse|line|polyline|polygon)"\s*,\s*\{([^}]*)\}\s*\]/g)];
|
|
44813
|
+
if (!els.length) continue;
|
|
44814
|
+
const body = els.map((m) => `<${m[1]} ${[...m[2].matchAll(/(\w+)\s*:\s*"([^"]*)"/g)].filter((a) => a[1] !== "key").map((a) => `${a[1]}="${a[2]}"`).join(" ")}/>`).join("");
|
|
44815
|
+
const points = pointsOf(`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor">${body}</svg>`);
|
|
44816
|
+
const name = path2.basename(f).replace(/\.m?js$/, "");
|
|
44817
|
+
if (points) out.push({ usage: `<${pascal(name)} /> from ${pkg}`, name, points });
|
|
44818
|
+
}
|
|
44819
|
+
return out;
|
|
44820
|
+
}
|
|
44821
|
+
async function heroReact(pkgDir) {
|
|
44822
|
+
const out = [];
|
|
44823
|
+
for (const set2 of HERO_SETS) {
|
|
44824
|
+
for (const f of await files(path2.join(pkgDir, set2.dir), /Icon\.js$/)) {
|
|
44825
|
+
const js = await readFile2(f, "utf8").catch(() => "");
|
|
44826
|
+
const ds = [...js.matchAll(/\bd:\s*"([^"]+)"/g)].map((m) => `<path d="${m[1]}"/>`).join("");
|
|
44827
|
+
const size = set2.dir.split("/")[0];
|
|
44828
|
+
const points = pointsOf(`<svg viewBox="0 0 ${size} ${size}" ${set2.stroke ? 'fill="none" stroke="currentColor"' : ""}>${ds}</svg>`);
|
|
44829
|
+
const comp = path2.basename(f, ".js");
|
|
44830
|
+
const name = comp.replace(/Icon$/, "").replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
|
|
44831
|
+
if (points) out.push({ usage: `<${comp} /> from @heroicons/react/${set2.dir}`, name, points });
|
|
44832
|
+
}
|
|
44833
|
+
}
|
|
44834
|
+
return out;
|
|
44835
|
+
}
|
|
44836
|
+
async function heroPhoenix(base) {
|
|
44837
|
+
const out = [];
|
|
44838
|
+
for (const set2 of HERO_SETS) out.push(...await svgFolder(path2.join(base, set2.dir), (n2) => `<.icon name="hero-${n2}${set2.suffix}" />`));
|
|
44839
|
+
return out;
|
|
44840
|
+
}
|
|
44841
|
+
var kebab = (s) => s.replace(/([a-z0-9])([A-Z])/g, "$1-$2").replace(/_/g, "-").toLowerCase();
|
|
44842
|
+
var plainSvg = (svg) => svg.replace(/\{\.\.\.[^{}]*\}/g, "").replace(/([\w:-]+)=\{[^{}]*\}/g, '$1="currentColor"');
|
|
44843
|
+
function codeIcons(src, file2, phoenix = false) {
|
|
44844
|
+
const out = [];
|
|
44845
|
+
if (!src.includes("<svg")) return out;
|
|
44846
|
+
if (phoenix) {
|
|
44847
|
+
for (const m of src.matchAll(/\bdef\s+(\w+)\(assigns\)[^~]*?~H"""\s*(<svg\b[\s\S]*?<\/svg>)\s*"""/g)) {
|
|
44848
|
+
out.push({ usage: `<.${m[1]} /> (${file2})`, name: kebab(m[1]).replace(/-?icon-?/, ""), svg: plainSvg(m[2]) });
|
|
44849
|
+
}
|
|
44850
|
+
return out;
|
|
44851
|
+
}
|
|
44852
|
+
const defs = [...src.matchAll(/(?:function\s+([A-Z]\w*)|(?:const|let)\s+([A-Z]\w*)\s*(?::[^=]+)?=)/g)];
|
|
44853
|
+
for (const m of src.matchAll(/(?:return|=>)\s*\(?\s*(<svg\b[\s\S]*?<\/svg>)/g)) {
|
|
44854
|
+
const def = defs.filter((d) => d.index < m.index).pop();
|
|
44855
|
+
const name = def?.[1] ?? def?.[2];
|
|
44856
|
+
if (!name || !new RegExp(`export\\b[^\\n]*\\b${name}\\b`).test(src) || out.some((o) => o.usage.startsWith(`<${name} `))) continue;
|
|
44857
|
+
out.push({ usage: `<${name} /> (${file2})`, name: kebab(name.replace(/Icon$/, "")), svg: plainSvg(m[1]) });
|
|
44858
|
+
}
|
|
44859
|
+
return out;
|
|
44860
|
+
}
|
|
44861
|
+
function bracketed(t, open2) {
|
|
44862
|
+
let depth = 0;
|
|
44863
|
+
for (let i = open2; i < t.length; i++) {
|
|
44864
|
+
const c = t[i];
|
|
44865
|
+
if (c === '"' || c === "'" || c === "`") {
|
|
44866
|
+
for (i++; i < t.length && t[i] !== c; i++) if (t[i] === "\\") i++;
|
|
44867
|
+
} else if (c === "[" || c === "{") depth++;
|
|
44868
|
+
else if ((c === "]" || c === "}") && --depth === 0) return t.slice(open2, i + 1);
|
|
44869
|
+
}
|
|
44870
|
+
return t.slice(open2);
|
|
44871
|
+
}
|
|
44872
|
+
async function bannedImports(root, pkgs) {
|
|
44873
|
+
const out = /* @__PURE__ */ new Set();
|
|
44874
|
+
const quoted = (t, p) => t.includes(`'${p}'`) || t.includes(`"${p}"`);
|
|
44875
|
+
const names = [".oxlintrc.json", ".eslintrc", ".eslintrc.json", ".eslintrc.js", ".eslintrc.cjs", "eslint.config.js", "eslint.config.mjs", "eslint.config.cjs", "eslint.config.ts", "biome.json", "biome.jsonc"];
|
|
44876
|
+
for (const n2 of names) {
|
|
44877
|
+
const t = await readFile2(path2.join(root, n2), "utf8").catch(() => "");
|
|
44878
|
+
for (const m of t.matchAll(/(?:no-restricted-imports|noRestrictedImports)["']?\s*[:=]\s*/g)) {
|
|
44879
|
+
const at = m.index + m[0].length;
|
|
44880
|
+
if (t[at] !== "[" && t[at] !== "{") continue;
|
|
44881
|
+
const opts = bracketed(t, at);
|
|
44882
|
+
if (/^\[\s*["']off["']|^\[\s*0\b/.test(opts)) continue;
|
|
44883
|
+
for (const p of pkgs) if (quoted(opts, p)) out.add(p);
|
|
44884
|
+
}
|
|
44885
|
+
}
|
|
44886
|
+
const sg = await readFile2(path2.join(root, "sgconfig.yml"), "utf8").catch(() => "");
|
|
44887
|
+
const dirs = [...(/ruleDirs:\s*((?:\n\s*-\s*.+)+)/.exec(sg)?.[1] ?? "").matchAll(/-\s*["']?([^"'\n]+)/g)].map((m) => m[1].trim());
|
|
44888
|
+
for (const d of dirs) {
|
|
44889
|
+
for (const f of await files(path2.join(root, d), /\.ya?ml$/)) {
|
|
44890
|
+
const t = await readFile2(f, "utf8").catch(() => "");
|
|
44891
|
+
if (/^\s*severity:\s*off\b/m.test(t)) continue;
|
|
44892
|
+
for (const line of t.split("\n").filter((l) => /^\s*(?:-\s*)?pattern:/.test(l))) {
|
|
44893
|
+
for (const p of pkgs) if (/\b(?:from|import|require\s*\()/.test(line) && quoted(line, p)) out.add(p);
|
|
44894
|
+
}
|
|
44895
|
+
}
|
|
44896
|
+
}
|
|
44897
|
+
return out;
|
|
44898
|
+
}
|
|
44899
|
+
var ICON_PACKAGES = ["lucide-react", "lucide-vue-next", "@heroicons/react", "heroicons", "lucide-static"];
|
|
44900
|
+
async function iconLibraries(root, manifests, own2 = []) {
|
|
44901
|
+
const libs = /* @__PURE__ */ new Map();
|
|
44902
|
+
if (own2.length) {
|
|
44903
|
+
libs.set("project", {
|
|
44904
|
+
name: "project",
|
|
44905
|
+
load: once(async () => own2.flatMap((i) => {
|
|
44906
|
+
const points = pointsOf(i.svg);
|
|
44907
|
+
return points ? [{ usage: i.usage, name: i.name, points }] : [];
|
|
44908
|
+
}))
|
|
44909
|
+
});
|
|
44910
|
+
}
|
|
44911
|
+
const banned = await bannedImports(root, ICON_PACKAGES);
|
|
44912
|
+
const add = (name, load) => {
|
|
44913
|
+
if (!libs.has(name)) libs.set(name, { name, load: once(load) });
|
|
44914
|
+
};
|
|
44915
|
+
const phoenix = manifests.some((m) => path2.basename(m) === "mix.exs");
|
|
44916
|
+
for (const m of manifests) {
|
|
44917
|
+
const dir = path2.dirname(m);
|
|
44918
|
+
const text2 = await readFile2(m, "utf8").catch(() => "");
|
|
44919
|
+
if (path2.basename(m) === "mix.exs") {
|
|
44920
|
+
if (/\{:heroicons\b/.test(text2)) {
|
|
44921
|
+
const base = path2.join(root, "deps/heroicons/optimized");
|
|
44922
|
+
if (await exists(base)) add("heroicons (Phoenix)", () => heroPhoenix(base));
|
|
44923
|
+
}
|
|
44924
|
+
if (/\{:lucide_icons\b/.test(text2)) {
|
|
44925
|
+
const base = path2.join(root, "deps/lucide_icons/priv/node_modules/lucide-static/icons");
|
|
44926
|
+
if (await exists(base)) add("lucide_icons", () => svgFolder(base, (n2) => `<Lucideicons.${n2.replace(/-/g, "_")} />`));
|
|
44927
|
+
}
|
|
44928
|
+
continue;
|
|
44929
|
+
}
|
|
44930
|
+
let deps = {};
|
|
44931
|
+
try {
|
|
44932
|
+
const pkg = JSON.parse(text2);
|
|
44933
|
+
deps = { ...pkg.dependencies, ...pkg.devDependencies };
|
|
44934
|
+
} catch {
|
|
44935
|
+
continue;
|
|
44936
|
+
}
|
|
44937
|
+
for (const pkg of ICON_PACKAGES) {
|
|
44938
|
+
if (!(pkg in deps) || banned.has(pkg)) continue;
|
|
44939
|
+
const at = await installed(dir, root, pkg);
|
|
44940
|
+
if (!at) continue;
|
|
44941
|
+
if (pkg === "lucide-react" || pkg === "lucide-vue-next") add(pkg, () => lucideModules(at, pkg));
|
|
44942
|
+
else if (pkg === "@heroicons/react") add(pkg, () => heroReact(at));
|
|
44943
|
+
else if (pkg === "heroicons" && phoenix) add("heroicons (Phoenix)", () => heroPhoenix(at));
|
|
44944
|
+
else if (pkg === "lucide-static") {
|
|
44945
|
+
add(pkg, () => svgFolder(path2.join(at, "icons"), (n2) => `lucide-static/icons/${n2}.svg`));
|
|
44946
|
+
}
|
|
44947
|
+
}
|
|
44948
|
+
}
|
|
44949
|
+
return [...libs.values()];
|
|
44950
|
+
}
|
|
44951
|
+
async function matchLibraryIcon(libs, svg, layerName = "") {
|
|
44952
|
+
if (!libs.length) return void 0;
|
|
44953
|
+
const p = pointsOf(svg);
|
|
44954
|
+
if (!p) return void 0;
|
|
44955
|
+
const wanted = layerName.split("/").pop().trim().toLowerCase().replace(/icon$/i, "").replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "");
|
|
44956
|
+
const icons = (await Promise.all(libs.map(async (lib) => (await lib.load()).map((icon) => ({ icon, own: lib.name === "project" }))))).flat();
|
|
44957
|
+
for (const fit of [false, true]) {
|
|
44958
|
+
const a = fit ? fitted(p) : p;
|
|
44959
|
+
let best;
|
|
44960
|
+
for (const { icon, own: own2 } of icons) {
|
|
44961
|
+
if (fit && icon.points.kind !== p.kind) continue;
|
|
44962
|
+
const q = fit ? fitted(icon.points) : icon.points;
|
|
44963
|
+
if (q.box.some((v, i) => Math.abs(v - a.box[i]) > 0.12)) continue;
|
|
44964
|
+
const score = compare(a, q, best?.score);
|
|
44965
|
+
if (score === void 0) continue;
|
|
44966
|
+
const s = score - (icon.name === wanted ? 0.01 : 0) - (own2 ? 0.01 : 0);
|
|
44967
|
+
if (!best || s < best.score) best = { icon, score: s };
|
|
44968
|
+
}
|
|
44969
|
+
if (best) return best.icon;
|
|
44970
|
+
}
|
|
44971
|
+
return void 0;
|
|
44972
|
+
}
|
|
44973
|
+
var fits = /* @__PURE__ */ new WeakMap();
|
|
44974
|
+
function fitted(p) {
|
|
44975
|
+
let f = fits.get(p);
|
|
44976
|
+
if (f) return f;
|
|
44977
|
+
const [x0, y0, x1, y1] = p.box;
|
|
44978
|
+
const size = Math.max(x1 - x0, y1 - y0) || 1;
|
|
44979
|
+
const cx = (x0 + x1) / 2;
|
|
44980
|
+
const cy = (y0 + y1) / 2;
|
|
44981
|
+
const xy = p.xy.map((v, i) => (v - (i % 2 ? cy : cx)) / size + 0.5);
|
|
44982
|
+
f = { xy, box: [(x0 - cx) / size + 0.5, (y0 - cy) / size + 0.5, (x1 - cx) / size + 0.5, (y1 - cy) / size + 0.5], kind: p.kind };
|
|
44983
|
+
fits.set(p, f);
|
|
44984
|
+
return f;
|
|
44985
|
+
}
|
|
44986
|
+
var MAX_OFFSET = 0.09;
|
|
44987
|
+
var SAME_KIND_OFFSET = 0.02;
|
|
44988
|
+
var SPREAD = 0.025;
|
|
44989
|
+
function compare(a, b, beat = Infinity) {
|
|
44990
|
+
const d1 = nearest(a.xy, b.xy, MAX_OFFSET + SPREAD);
|
|
44991
|
+
if (!d1) return void 0;
|
|
44992
|
+
const d2 = nearest(b.xy, a.xy, MAX_OFFSET + SPREAD);
|
|
44993
|
+
if (!d2) return void 0;
|
|
44994
|
+
const all = Float64Array.from([...d1, ...d2]).sort();
|
|
44995
|
+
const offset = all[all.length >> 1];
|
|
44996
|
+
const spread = all[all.length - 1] - offset;
|
|
44997
|
+
const maxOffset = a.kind === b.kind && a.kind !== "mixed" ? SAME_KIND_OFFSET : MAX_OFFSET;
|
|
44998
|
+
if (offset > maxOffset || spread > SPREAD) return void 0;
|
|
44999
|
+
const score = spread + offset / 4;
|
|
45000
|
+
return score < beat + 0.01 ? score : void 0;
|
|
45001
|
+
}
|
|
45002
|
+
function nearest(a, b, limit) {
|
|
45003
|
+
const out = [];
|
|
45004
|
+
const lim2 = limit * limit;
|
|
45005
|
+
const stride = 14;
|
|
45006
|
+
for (let s = 0; s < stride; s += 2) {
|
|
45007
|
+
for (let i = s; i < a.length; i += stride) {
|
|
45008
|
+
const x = a[i];
|
|
45009
|
+
const y = a[i + 1];
|
|
45010
|
+
let m = Infinity;
|
|
45011
|
+
for (let j = 0; j < b.length; j += 2) {
|
|
45012
|
+
const dx = b[j] - x;
|
|
45013
|
+
const dy = b[j + 1] - y;
|
|
45014
|
+
const d = dx * dx + dy * dy;
|
|
45015
|
+
if (d < m) m = d;
|
|
45016
|
+
}
|
|
45017
|
+
if (m > lim2) return void 0;
|
|
45018
|
+
out.push(Math.sqrt(m));
|
|
45019
|
+
}
|
|
45020
|
+
}
|
|
45021
|
+
return out;
|
|
45022
|
+
}
|
|
45023
|
+
var STEP = 0.02;
|
|
45024
|
+
var MAX_POINTS = 240;
|
|
45025
|
+
function pointsOf(svg) {
|
|
45026
|
+
const rootTag = /<svg\b[^>]*>/i.exec(svg)?.[0];
|
|
45027
|
+
if (!rootTag) return void 0;
|
|
45028
|
+
const root = attrs(rootTag);
|
|
45029
|
+
const vb = (root.viewBox ?? `0 0 ${parseFloat(root.width ?? "")} ${parseFloat(root.height ?? "")}`).split(/[\s,]+/).map(Number);
|
|
45030
|
+
const [vx, vy, vw, vh] = vb;
|
|
45031
|
+
if (vb.length !== 4 || !(vw > 0) || !(vh > 0)) return void 0;
|
|
45032
|
+
const size = Math.max(vw, vh);
|
|
45033
|
+
const body = svg.replace(/<(mask|clipPath|defs|title|desc)\b[\s\S]*?<\/\1>/gi, "");
|
|
45034
|
+
const polys = [];
|
|
45035
|
+
let stroked = false;
|
|
45036
|
+
let filled = false;
|
|
45037
|
+
for (const m of body.matchAll(/<(path|rect|circle|ellipse|line|polyline|polygon)\b([^>]*)>/gi)) {
|
|
45038
|
+
const a = attrs(m[2]);
|
|
45039
|
+
const fill = a.fill ?? root.fill ?? "black";
|
|
45040
|
+
const stroke = a.stroke ?? root.stroke ?? "none";
|
|
45041
|
+
if ((fill === "none" || fill === "transparent") && (stroke === "none" || stroke === "transparent")) continue;
|
|
45042
|
+
if (a.opacity === "0" || a.visibility === "hidden" || a.display === "none") continue;
|
|
45043
|
+
const lines = shapeLines(m[1].toLowerCase(), a);
|
|
45044
|
+
if (!lines) return void 0;
|
|
45045
|
+
const t = a.transform ? matrix(a.transform) : void 0;
|
|
45046
|
+
for (const l of lines) polys.push(t ? apply2(t, l) : l);
|
|
45047
|
+
if (stroke !== "none" && stroke !== "transparent") stroked = true;
|
|
45048
|
+
if (fill !== "none" && fill !== "transparent" && !/^(line|polyline)$/i.test(m[1])) filled = true;
|
|
45049
|
+
}
|
|
45050
|
+
const pts = [];
|
|
45051
|
+
let len = 0;
|
|
45052
|
+
for (const l of polys) for (let i = 2; i < l.length; i += 2) len += Math.hypot(l[i] - l[i - 2], l[i + 1] - l[i - 1]);
|
|
45053
|
+
if (!len) return void 0;
|
|
45054
|
+
const step = Math.max(STEP * size, len / MAX_POINTS);
|
|
45055
|
+
for (const l of polys) {
|
|
45056
|
+
pts.push(l[0], l[1]);
|
|
45057
|
+
let carry = 0;
|
|
45058
|
+
for (let i = 2; i < l.length; i += 2) {
|
|
45059
|
+
const x0 = l[i - 2], y0 = l[i - 1], x1 = l[i], y1 = l[i + 1];
|
|
45060
|
+
const seg = Math.hypot(x1 - x0, y1 - y0);
|
|
45061
|
+
let s = step - carry;
|
|
45062
|
+
for (; s <= seg; s += step) pts.push(x0 + (x1 - x0) * s / seg, y0 + (y1 - y0) * s / seg);
|
|
45063
|
+
carry = seg - (s - step);
|
|
45064
|
+
}
|
|
45065
|
+
if (carry > 0) pts.push(l[l.length - 2], l[l.length - 1]);
|
|
45066
|
+
}
|
|
45067
|
+
const xy = new Float64Array(pts.length);
|
|
45068
|
+
const box = [Infinity, Infinity, -Infinity, -Infinity];
|
|
45069
|
+
for (let i = 0; i < pts.length; i += 2) {
|
|
45070
|
+
const x = (pts[i] - vx) / size;
|
|
45071
|
+
const y = (pts[i + 1] - vy) / size;
|
|
45072
|
+
xy[i] = x;
|
|
45073
|
+
xy[i + 1] = y;
|
|
45074
|
+
box[0] = Math.min(box[0], x);
|
|
45075
|
+
box[1] = Math.min(box[1], y);
|
|
45076
|
+
box[2] = Math.max(box[2], x);
|
|
45077
|
+
box[3] = Math.max(box[3], y);
|
|
45078
|
+
}
|
|
45079
|
+
return { xy, box, kind: stroked && filled ? "mixed" : stroked ? "stroke" : "fill" };
|
|
45080
|
+
}
|
|
45081
|
+
function attrs(tag) {
|
|
45082
|
+
const out = {};
|
|
45083
|
+
for (const m of tag.matchAll(/([\w:-]+)\s*=\s*("([^"]*)"|'([^']*)')/g)) out[m[1]] = m[3] ?? m[4] ?? "";
|
|
45084
|
+
for (const d of (out.style ?? "").split(";")) {
|
|
45085
|
+
const [k, v] = d.split(":").map((s) => s?.trim());
|
|
45086
|
+
if (k && v) out[k] = v;
|
|
45087
|
+
}
|
|
45088
|
+
return out;
|
|
45089
|
+
}
|
|
45090
|
+
function shapeLines(tag, a) {
|
|
45091
|
+
const f = (k) => parseFloat(a[k] ?? "0") || 0;
|
|
45092
|
+
switch (tag) {
|
|
45093
|
+
case "path":
|
|
45094
|
+
return a.d ? pathLines(a.d) : void 0;
|
|
45095
|
+
case "rect": {
|
|
45096
|
+
const x = f("x"), y = f("y"), w = f("width"), h = f("height");
|
|
45097
|
+
const r = Math.min(f("rx") || f("ry"), w / 2, h / 2);
|
|
45098
|
+
if (!r) return [[x, y, x + w, y, x + w, y + h, x, y + h, x, y]];
|
|
45099
|
+
return pathLines(`M${x + r} ${y}H${x + w - r}A${r} ${r} 0 0 1 ${x + w} ${y + r}V${y + h - r}A${r} ${r} 0 0 1 ${x + w - r} ${y + h}H${x + r}A${r} ${r} 0 0 1 ${x} ${y + h - r}V${y + r}A${r} ${r} 0 0 1 ${x + r} ${y}Z`);
|
|
45100
|
+
}
|
|
45101
|
+
case "circle":
|
|
45102
|
+
case "ellipse": {
|
|
45103
|
+
const cx = f("cx"), cy = f("cy");
|
|
45104
|
+
const rx = tag === "circle" ? f("r") : f("rx");
|
|
45105
|
+
const ry = tag === "circle" ? f("r") : f("ry");
|
|
45106
|
+
const l = [];
|
|
45107
|
+
for (let k = 0; k <= 48; k++) l.push(cx + rx * Math.cos(k / 48 * 2 * Math.PI), cy + ry * Math.sin(k / 48 * 2 * Math.PI));
|
|
45108
|
+
return [l];
|
|
45109
|
+
}
|
|
45110
|
+
case "line":
|
|
45111
|
+
return [[f("x1"), f("y1"), f("x2"), f("y2")]];
|
|
45112
|
+
default: {
|
|
45113
|
+
const pts = (a.points ?? "").trim().split(/[\s,]+/).map(Number);
|
|
45114
|
+
if (pts.length < 4 || pts.some(Number.isNaN)) return void 0;
|
|
45115
|
+
return [tag === "polygon" ? [...pts, pts[0], pts[1]] : pts];
|
|
45116
|
+
}
|
|
45117
|
+
}
|
|
45118
|
+
}
|
|
45119
|
+
var ARGS = { M: 2, L: 2, H: 1, V: 1, C: 6, S: 4, Q: 4, T: 2, A: 7, Z: 0 };
|
|
45120
|
+
function pathLines(d) {
|
|
45121
|
+
const NUM = /[\s,]*([-+]?(?:\d+\.?\d*|\.\d+)(?:[eE][-+]?\d+)?)/y;
|
|
45122
|
+
const FLAG = /[\s,]*([01])/y;
|
|
45123
|
+
const CMD = /[\s,]*([MmLlHhVvCcSsQqTtAaZz])/y;
|
|
45124
|
+
let i = 0;
|
|
45125
|
+
const read = (re) => {
|
|
45126
|
+
re.lastIndex = i;
|
|
45127
|
+
const m = re.exec(d);
|
|
45128
|
+
if (!m) return void 0;
|
|
45129
|
+
i = re.lastIndex;
|
|
45130
|
+
return m[1];
|
|
45131
|
+
};
|
|
45132
|
+
const out = [];
|
|
45133
|
+
let cur = [];
|
|
45134
|
+
let x = 0, y = 0, sx = 0, sy = 0;
|
|
45135
|
+
let cx = 0, cy = 0;
|
|
45136
|
+
let prev = "";
|
|
45137
|
+
let cmd = "";
|
|
45138
|
+
const num2 = () => {
|
|
45139
|
+
const t = read(NUM);
|
|
45140
|
+
if (t === void 0) throw new Error("bad path");
|
|
45141
|
+
return parseFloat(t);
|
|
45142
|
+
};
|
|
45143
|
+
const flag = () => {
|
|
45144
|
+
const t = read(FLAG);
|
|
45145
|
+
if (t === void 0) throw new Error("bad path");
|
|
45146
|
+
return Number(t);
|
|
45147
|
+
};
|
|
45148
|
+
const lineTo = (nx, ny) => {
|
|
45149
|
+
cur.push(nx, ny);
|
|
45150
|
+
x = nx;
|
|
45151
|
+
y = ny;
|
|
45152
|
+
};
|
|
45153
|
+
const curve = (pts) => {
|
|
45154
|
+
const n2 = pts.length / 2;
|
|
45155
|
+
for (let k = 1; k <= 12; k++) {
|
|
45156
|
+
const t = k / 12;
|
|
45157
|
+
const p = pts.slice();
|
|
45158
|
+
for (let r = n2 - 1; r > 0; r--) for (let j = 0; j < r; j++) {
|
|
45159
|
+
p[2 * j] = p[2 * j] + (p[2 * j + 2] - p[2 * j]) * t;
|
|
45160
|
+
p[2 * j + 1] = p[2 * j + 1] + (p[2 * j + 3] - p[2 * j + 1]) * t;
|
|
45161
|
+
}
|
|
45162
|
+
cur.push(p[0], p[1]);
|
|
45163
|
+
}
|
|
45164
|
+
x = pts[pts.length - 2];
|
|
45165
|
+
y = pts[pts.length - 1];
|
|
45166
|
+
};
|
|
45167
|
+
try {
|
|
45168
|
+
while (!/^[\s,]*$/.test(d.slice(i))) {
|
|
45169
|
+
const c = read(CMD);
|
|
45170
|
+
if (c) cmd = c;
|
|
45171
|
+
else if (!cmd || /z/i.test(cmd)) return void 0;
|
|
45172
|
+
const up = cmd.toUpperCase();
|
|
45173
|
+
const rel = cmd !== up;
|
|
45174
|
+
const ox = rel ? x : 0;
|
|
45175
|
+
const oy = rel ? y : 0;
|
|
45176
|
+
if (up === "Z") {
|
|
45177
|
+
if (cur.length) cur.push(sx, sy);
|
|
45178
|
+
x = sx;
|
|
45179
|
+
y = sy;
|
|
45180
|
+
prev = "Z";
|
|
45181
|
+
continue;
|
|
45182
|
+
}
|
|
45183
|
+
if (ARGS[up] === void 0) return void 0;
|
|
45184
|
+
if (up === "M") {
|
|
45185
|
+
if (cur.length > 2) out.push(cur);
|
|
45186
|
+
x = num2() + ox;
|
|
45187
|
+
y = num2() + oy;
|
|
45188
|
+
sx = x;
|
|
45189
|
+
sy = y;
|
|
45190
|
+
cur = [x, y];
|
|
45191
|
+
cmd = rel ? "l" : "L";
|
|
45192
|
+
} else if (up === "L") lineTo(num2() + ox, num2() + oy);
|
|
45193
|
+
else if (up === "H") lineTo(num2() + ox, y);
|
|
45194
|
+
else if (up === "V") lineTo(x, num2() + oy);
|
|
45195
|
+
else if (up === "C") {
|
|
45196
|
+
const p = [num2() + ox, num2() + oy, num2() + ox, num2() + oy, num2() + ox, num2() + oy];
|
|
45197
|
+
curve([x, y, ...p]);
|
|
45198
|
+
cx = p[2];
|
|
45199
|
+
cy = p[3];
|
|
45200
|
+
} else if (up === "S") {
|
|
45201
|
+
const [rx, ry] = /[CS]/.test(prev) ? [2 * x - cx, 2 * y - cy] : [x, y];
|
|
45202
|
+
const p = [num2() + ox, num2() + oy, num2() + ox, num2() + oy];
|
|
45203
|
+
curve([x, y, rx, ry, ...p]);
|
|
45204
|
+
cx = p[0];
|
|
45205
|
+
cy = p[1];
|
|
45206
|
+
} else if (up === "Q") {
|
|
45207
|
+
const p = [num2() + ox, num2() + oy, num2() + ox, num2() + oy];
|
|
45208
|
+
curve([x, y, ...p]);
|
|
45209
|
+
cx = p[0];
|
|
45210
|
+
cy = p[1];
|
|
45211
|
+
} else if (up === "T") {
|
|
45212
|
+
const [rx, ry] = /[QT]/.test(prev) ? [2 * x - cx, 2 * y - cy] : [x, y];
|
|
45213
|
+
curve([x, y, rx, ry, num2() + ox, num2() + oy]);
|
|
45214
|
+
cx = rx;
|
|
45215
|
+
cy = ry;
|
|
45216
|
+
} else if (up === "A") {
|
|
45217
|
+
const rx = num2(), ry = num2(), rot = num2(), large = flag(), sweep = flag();
|
|
45218
|
+
arc(x, y, rx, ry, rot, large, sweep, num2() + ox, num2() + oy, lineTo);
|
|
45219
|
+
}
|
|
45220
|
+
prev = up;
|
|
45221
|
+
}
|
|
45222
|
+
} catch {
|
|
45223
|
+
return void 0;
|
|
45224
|
+
}
|
|
45225
|
+
if (cur.length > 2) out.push(cur);
|
|
45226
|
+
return out;
|
|
45227
|
+
}
|
|
45228
|
+
function arc(x1, y1, rx, ry, rotDeg, large, sweep, x2, y2, lineTo) {
|
|
45229
|
+
rx = Math.abs(rx);
|
|
45230
|
+
ry = Math.abs(ry);
|
|
45231
|
+
if (!rx || !ry || x1 === x2 && y1 === y2) return lineTo(x2, y2);
|
|
45232
|
+
const phi = rotDeg * Math.PI / 180;
|
|
45233
|
+
const cos = Math.cos(phi), sin = Math.sin(phi);
|
|
45234
|
+
const dx = (x1 - x2) / 2, dy = (y1 - y2) / 2;
|
|
45235
|
+
const x1p = cos * dx + sin * dy, y1p = -sin * dx + cos * dy;
|
|
45236
|
+
const lambda = x1p * x1p / (rx * rx) + y1p * y1p / (ry * ry);
|
|
45237
|
+
if (lambda > 1) {
|
|
45238
|
+
rx *= Math.sqrt(lambda);
|
|
45239
|
+
ry *= Math.sqrt(lambda);
|
|
45240
|
+
}
|
|
45241
|
+
const num2 = rx * rx * ry * ry - rx * rx * y1p * y1p - ry * ry * x1p * x1p;
|
|
45242
|
+
const den = rx * rx * y1p * y1p + ry * ry * x1p * x1p;
|
|
45243
|
+
let k = Math.sqrt(Math.max(0, num2 / den));
|
|
45244
|
+
if (large === sweep) k = -k;
|
|
45245
|
+
const cxp = k * rx * y1p / ry, cyp = -k * ry * x1p / rx;
|
|
45246
|
+
const cx = cos * cxp - sin * cyp + (x1 + x2) / 2;
|
|
45247
|
+
const cy = sin * cxp + cos * cyp + (y1 + y2) / 2;
|
|
45248
|
+
const ang = (ux, uy, vx, vy) => Math.atan2(ux * vy - uy * vx, ux * vx + uy * vy);
|
|
45249
|
+
const t1 = ang(1, 0, (x1p - cxp) / rx, (y1p - cyp) / ry);
|
|
45250
|
+
let dt = ang((x1p - cxp) / rx, (y1p - cyp) / ry, (-x1p - cxp) / rx, (-y1p - cyp) / ry);
|
|
45251
|
+
if (!sweep && dt > 0) dt -= 2 * Math.PI;
|
|
45252
|
+
else if (sweep && dt < 0) dt += 2 * Math.PI;
|
|
45253
|
+
const n2 = Math.max(4, Math.ceil(Math.abs(dt) / (Math.PI / 12)));
|
|
45254
|
+
for (let s = 1; s <= n2; s++) {
|
|
45255
|
+
const t = t1 + dt * s / n2;
|
|
45256
|
+
const ex = rx * Math.cos(t), ey = ry * Math.sin(t);
|
|
45257
|
+
lineTo(cos * ex - sin * ey + cx, sin * ex + cos * ey + cy);
|
|
45258
|
+
}
|
|
45259
|
+
}
|
|
45260
|
+
function matrix(t) {
|
|
45261
|
+
let m = [1, 0, 0, 1, 0, 0];
|
|
45262
|
+
const mul = (a, b) => [
|
|
45263
|
+
a[0] * b[0] + a[2] * b[1],
|
|
45264
|
+
a[1] * b[0] + a[3] * b[1],
|
|
45265
|
+
a[0] * b[2] + a[2] * b[3],
|
|
45266
|
+
a[1] * b[2] + a[3] * b[3],
|
|
45267
|
+
a[0] * b[4] + a[2] * b[5] + a[4],
|
|
45268
|
+
a[1] * b[4] + a[3] * b[5] + a[5]
|
|
45269
|
+
];
|
|
45270
|
+
for (const f of t.matchAll(/(matrix|translate|scale|rotate)\s*\(([^)]*)\)/g)) {
|
|
45271
|
+
const v = f[2].split(/[\s,]+/).filter(Boolean).map(Number);
|
|
45272
|
+
let n2;
|
|
45273
|
+
if (f[1] === "matrix") n2 = v;
|
|
45274
|
+
else if (f[1] === "translate") n2 = [1, 0, 0, 1, v[0] ?? 0, v[1] ?? 0];
|
|
45275
|
+
else if (f[1] === "scale") n2 = [v[0] ?? 1, 0, 0, v[1] ?? v[0] ?? 1, 0, 0];
|
|
45276
|
+
else {
|
|
45277
|
+
const r = (v[0] ?? 0) * Math.PI / 180;
|
|
45278
|
+
const [c, s, px2, py] = [Math.cos(r), Math.sin(r), v[1] ?? 0, v[2] ?? 0];
|
|
45279
|
+
n2 = [c, s, -s, c, px2 - c * px2 + s * py, py - s * px2 - c * py];
|
|
45280
|
+
}
|
|
45281
|
+
m = mul(m, n2);
|
|
45282
|
+
}
|
|
45283
|
+
return m;
|
|
45284
|
+
}
|
|
45285
|
+
function apply2(m, l) {
|
|
45286
|
+
const out = [];
|
|
45287
|
+
for (let i = 0; i < l.length; i += 2) out.push(m[0] * l[i] + m[2] * l[i + 1] + m[4], m[1] * l[i] + m[3] * l[i + 1] + m[5]);
|
|
45288
|
+
return out;
|
|
45289
|
+
}
|
|
44761
45290
|
|
|
44762
45291
|
// src/tools/project.ts
|
|
44763
45292
|
import { execFile } from "node:child_process";
|
|
44764
|
-
import { readdir, readFile as
|
|
45293
|
+
import { readdir as readdir2, readFile as readFile3 } from "node:fs/promises";
|
|
44765
45294
|
import os2 from "node:os";
|
|
44766
|
-
import
|
|
45295
|
+
import path3 from "node:path";
|
|
44767
45296
|
import { promisify } from "node:util";
|
|
45297
|
+
|
|
45298
|
+
// src/tools/code-components.ts
|
|
45299
|
+
var MAX_VALUES = 8;
|
|
45300
|
+
function values(list, def) {
|
|
45301
|
+
const shown = list.slice(0, MAX_VALUES).map((v) => v === def ? `${v}*` : v);
|
|
45302
|
+
return shown.join("|") + (list.length > MAX_VALUES ? "|\u2026" : "");
|
|
45303
|
+
}
|
|
45304
|
+
function closing(src, open2) {
|
|
45305
|
+
let depth = 0;
|
|
45306
|
+
for (let i = open2; i < src.length; i++) {
|
|
45307
|
+
const c = src[i];
|
|
45308
|
+
if (c === '"' || c === "'" || c === "`") {
|
|
45309
|
+
for (i++; i < src.length && src[i] !== c; i++) if (src[i] === "\\") i++;
|
|
45310
|
+
} else if (c === "/" && src[i + 1] === "/") i = src.indexOf("\n", i) < 0 ? src.length : src.indexOf("\n", i);
|
|
45311
|
+
else if (c === "/" && src[i + 1] === "*") i = src.indexOf("*/", i) < 0 ? src.length : src.indexOf("*/", i) + 1;
|
|
45312
|
+
else if (c === "{") depth++;
|
|
45313
|
+
else if (c === "}" && --depth === 0) return i + 1;
|
|
45314
|
+
}
|
|
45315
|
+
return src.length;
|
|
45316
|
+
}
|
|
45317
|
+
function keys(src, open2) {
|
|
45318
|
+
const end = closing(src, open2);
|
|
45319
|
+
const out = [];
|
|
45320
|
+
let i = open2 + 1;
|
|
45321
|
+
while (i < end - 1) {
|
|
45322
|
+
const m = /^\s*(?:(["'])([^"']*)\1|([\w$-]+))\s*:\s*/.exec(src.slice(i, end));
|
|
45323
|
+
if (!m) break;
|
|
45324
|
+
out.push({ key: m[2] ?? m[3], at: i + m[0].length });
|
|
45325
|
+
let j = i + m[0].length;
|
|
45326
|
+
for (; j < end - 1; j++) {
|
|
45327
|
+
const c = src[j];
|
|
45328
|
+
if (c === "{" || c === "[" || c === "(") {
|
|
45329
|
+
const close = c === "{" ? "}" : c === "[" ? "]" : ")";
|
|
45330
|
+
let d = 0;
|
|
45331
|
+
for (; j < end; j++) {
|
|
45332
|
+
const x = src[j];
|
|
45333
|
+
if (x === '"' || x === "'" || x === "`") {
|
|
45334
|
+
for (j++; j < end && src[j] !== x; j++) if (src[j] === "\\") j++;
|
|
45335
|
+
} else if (x === c) d++;
|
|
45336
|
+
else if (x === close && --d === 0) break;
|
|
45337
|
+
}
|
|
45338
|
+
} else if (c === '"' || c === "'" || c === "`") {
|
|
45339
|
+
for (j++; j < end && src[j] !== c; j++) if (src[j] === "\\") j++;
|
|
45340
|
+
} else if (c === ",") break;
|
|
45341
|
+
}
|
|
45342
|
+
i = j + 1;
|
|
45343
|
+
}
|
|
45344
|
+
return out;
|
|
45345
|
+
}
|
|
45346
|
+
function variantCalls(src) {
|
|
45347
|
+
const out = /* @__PURE__ */ new Map();
|
|
45348
|
+
for (const m of src.matchAll(/(?:const|let)\s+(\w+)\s*=\s*(?:cva|tv)\s*\(/g)) {
|
|
45349
|
+
const v = /\bvariants\s*:\s*\{/.exec(src.slice(m.index));
|
|
45350
|
+
if (!v) continue;
|
|
45351
|
+
const open2 = m.index + v.index + v[0].length - 1;
|
|
45352
|
+
const defaults = /* @__PURE__ */ new Map();
|
|
45353
|
+
const dv = /\bdefaultVariants\s*:\s*\{/.exec(src.slice(m.index));
|
|
45354
|
+
if (dv) {
|
|
45355
|
+
const at = m.index + dv.index + dv[0].length - 1;
|
|
45356
|
+
for (const k of keys(src, at)) {
|
|
45357
|
+
const val = /^\s*(["'])([^"']*)\1/.exec(src.slice(k.at))?.[2] ?? /^\s*(true|false)\b/.exec(src.slice(k.at))?.[1];
|
|
45358
|
+
if (val) defaults.set(k.key, val);
|
|
45359
|
+
}
|
|
45360
|
+
}
|
|
45361
|
+
const props = [];
|
|
45362
|
+
for (const k of keys(src, open2)) {
|
|
45363
|
+
if (src[k.at] !== "{") continue;
|
|
45364
|
+
const opts = keys(src, k.at).map((o) => o.key);
|
|
45365
|
+
if (!opts.length) continue;
|
|
45366
|
+
props.push(opts.every((o) => o === "true" || o === "false") ? k.key : `${k.key}="${values(opts, defaults.get(k.key))}"`);
|
|
45367
|
+
}
|
|
45368
|
+
if (props.length) out.set(m[1], props);
|
|
45369
|
+
}
|
|
45370
|
+
return out;
|
|
45371
|
+
}
|
|
45372
|
+
function reactComponents(src) {
|
|
45373
|
+
const exported = /* @__PURE__ */ new Set();
|
|
45374
|
+
for (const m of src.matchAll(/export\s+(?:default\s+)?(?:async\s+)?(?:function|const|let|class)\s+([A-Z]\w*)/g)) exported.add(m[1]);
|
|
45375
|
+
for (const m of src.matchAll(/export\s*\{([^}]*)\}/g)) {
|
|
45376
|
+
for (const part of m[1].split(",")) {
|
|
45377
|
+
const name = part.trim().split(/\s+as\s+/)[0].trim();
|
|
45378
|
+
if (/^[A-Z]\w*$/.test(name)) exported.add(name);
|
|
45379
|
+
}
|
|
45380
|
+
}
|
|
45381
|
+
const defined = [];
|
|
45382
|
+
for (const m of src.matchAll(/(?:^|\n)\s*(?:export\s+)?(?:default\s+)?(?:function\s+([A-Z]\w*)\s*[(<]|(?:const|let)\s+([A-Z]\w*)\s*(?::[^=]+)?=\s*(?:React\.)?(?:forwardRef|memo|\(|function|<))/g)) {
|
|
45383
|
+
const name = m[1] ?? m[2];
|
|
45384
|
+
if (exported.has(name)) defined.push({ name, at: m.index });
|
|
45385
|
+
}
|
|
45386
|
+
if (!defined.length) return [];
|
|
45387
|
+
const calls = variantCalls(src);
|
|
45388
|
+
const unions = [];
|
|
45389
|
+
for (const m of src.matchAll(/\b(\w+)\??\s*:\s*((?:["'][\w-]+["']\s*\|\s*)+["'][\w-]+["'])/g)) {
|
|
45390
|
+
const opts = [...m[2].matchAll(/["']([\w-]+)["']/g)].map((x) => x[1]);
|
|
45391
|
+
unions.push(`${m[1]}="${values(opts)}"`);
|
|
45392
|
+
}
|
|
45393
|
+
return defined.map(({ name, at }, i) => {
|
|
45394
|
+
const body = src.slice(at, defined[i + 1]?.at ?? src.length);
|
|
45395
|
+
const props = [...calls].filter(([fn]) => new RegExp(`\\b${fn}\\s*\\(`).test(body)).flatMap(([, p]) => p);
|
|
45396
|
+
if (!props.length && defined.length === 1) props.push(...unions);
|
|
45397
|
+
return { name, api: `<${name}${props.length ? ` ${[...new Set(props)].join(" ")}` : ""}>` };
|
|
45398
|
+
});
|
|
45399
|
+
}
|
|
45400
|
+
function elixirList(v) {
|
|
45401
|
+
const w = /^~w[([{<]([^)\]}>]*)[)\]}>]/.exec(v);
|
|
45402
|
+
if (w) return w[1].trim().split(/\s+/).filter(Boolean);
|
|
45403
|
+
const l = /^\[([^\]]*)\]/.exec(v);
|
|
45404
|
+
if (!l) return void 0;
|
|
45405
|
+
const out = [...l[1].matchAll(/(?:"([^"]*)"|:(\w+))/g)].map((m) => m[1] ?? m[2]);
|
|
45406
|
+
return out.length ? out : void 0;
|
|
45407
|
+
}
|
|
45408
|
+
function phoenixComponents(src) {
|
|
45409
|
+
const attrs3 = /* @__PURE__ */ new Map();
|
|
45410
|
+
for (const m of src.matchAll(/^\s*@(\w+)\s+(.+)$/gm)) {
|
|
45411
|
+
const list = elixirList(m[2].trim());
|
|
45412
|
+
if (list) attrs3.set(m[1], list);
|
|
45413
|
+
else if (m[2].trim().startsWith("%{")) {
|
|
45414
|
+
const ks = [...m[2].matchAll(/(?:^%\{|,)\s*(?:(\w+):|"([^"]+)"\s*=>|:(\w+)\s*=>)/g)].map((k) => k[1] ?? k[2] ?? k[3]);
|
|
45415
|
+
if (ks.length) attrs3.set(m[1], ks);
|
|
45416
|
+
}
|
|
45417
|
+
}
|
|
45418
|
+
const resolve = (v) => {
|
|
45419
|
+
v = v.trim();
|
|
45420
|
+
const direct = elixirList(v);
|
|
45421
|
+
if (direct) return direct.filter((x) => x !== "nil");
|
|
45422
|
+
const a = /^(?:Map\.keys\()?@(\w+)\)?/.exec(v);
|
|
45423
|
+
if (a) return attrs3.get(a[1]);
|
|
45424
|
+
const withNil = /^\[nil\s*\|\s*(.+)\]$/.exec(v);
|
|
45425
|
+
return withNil ? resolve(withNil[1]) : void 0;
|
|
45426
|
+
};
|
|
45427
|
+
const out = [];
|
|
45428
|
+
let props = [];
|
|
45429
|
+
let slots = [];
|
|
45430
|
+
let any2 = false;
|
|
45431
|
+
const joined = src.replace(/([,[(])[ \t]*\r?\n\s*/g, (_, c) => c === "," ? ", " : c).replace(/\r?\n\s*(?=[\])])/g, "");
|
|
45432
|
+
for (const line of joined.split("\n")) {
|
|
45433
|
+
const a = /^\s*attr\s+:(\w+)\s*,\s*:(\w+)(.*)$/.exec(line);
|
|
45434
|
+
if (a) {
|
|
45435
|
+
any2 = true;
|
|
45436
|
+
const [, name, type, rest] = a;
|
|
45437
|
+
const vals = /\bvalues:\s*(.+?)(?:,\s*\w+:|\s*$)/.exec(rest)?.[1];
|
|
45438
|
+
const def = /\bdefault:\s*(?:"([^"]*)"|:(\w+))/.exec(rest);
|
|
45439
|
+
const list = vals ? resolve(vals) : void 0;
|
|
45440
|
+
if (list?.length) props.push(`${name}="${values(list, def?.[1] ?? def?.[2])}"`);
|
|
45441
|
+
else if (type === "boolean") props.push(name);
|
|
45442
|
+
continue;
|
|
45443
|
+
}
|
|
45444
|
+
const s = /^\s*slot\s+:(\w+)/.exec(line);
|
|
45445
|
+
if (s) {
|
|
45446
|
+
any2 = true;
|
|
45447
|
+
if (s[1] !== "inner_block") slots.push(`<:${s[1]}>`);
|
|
45448
|
+
continue;
|
|
45449
|
+
}
|
|
45450
|
+
const d = /^\s*(defp?)\s+(\w+)\s*\(/.exec(line);
|
|
45451
|
+
if (d) {
|
|
45452
|
+
if (d[1] === "def" && any2 && !out.some((c) => c.name === d[2])) {
|
|
45453
|
+
out.push({ name: d[2], api: [`<.${d[2]}${props.length ? ` ${props.join(" ")}` : ""}>`, ...slots].join(" ") });
|
|
45454
|
+
}
|
|
45455
|
+
if (d[1] === "defp" || any2) {
|
|
45456
|
+
props = [];
|
|
45457
|
+
slots = [];
|
|
45458
|
+
any2 = false;
|
|
45459
|
+
}
|
|
45460
|
+
}
|
|
45461
|
+
}
|
|
45462
|
+
return out;
|
|
45463
|
+
}
|
|
45464
|
+
|
|
45465
|
+
// src/tools/tailwind-v3-theme.ts
|
|
45466
|
+
var TAILWIND_V3_THEME = {
|
|
45467
|
+
"--color-black": "#000",
|
|
45468
|
+
"--color-white": "#fff",
|
|
45469
|
+
"--color-slate-50": "#f8fafc",
|
|
45470
|
+
"--color-slate-100": "#f1f5f9",
|
|
45471
|
+
"--color-slate-200": "#e2e8f0",
|
|
45472
|
+
"--color-slate-300": "#cbd5e1",
|
|
45473
|
+
"--color-slate-400": "#94a3b8",
|
|
45474
|
+
"--color-slate-500": "#64748b",
|
|
45475
|
+
"--color-slate-600": "#475569",
|
|
45476
|
+
"--color-slate-700": "#334155",
|
|
45477
|
+
"--color-slate-800": "#1e293b",
|
|
45478
|
+
"--color-slate-900": "#0f172a",
|
|
45479
|
+
"--color-slate-950": "#020617",
|
|
45480
|
+
"--color-gray-50": "#f9fafb",
|
|
45481
|
+
"--color-gray-100": "#f3f4f6",
|
|
45482
|
+
"--color-gray-200": "#e5e7eb",
|
|
45483
|
+
"--color-gray-300": "#d1d5db",
|
|
45484
|
+
"--color-gray-400": "#9ca3af",
|
|
45485
|
+
"--color-gray-500": "#6b7280",
|
|
45486
|
+
"--color-gray-600": "#4b5563",
|
|
45487
|
+
"--color-gray-700": "#374151",
|
|
45488
|
+
"--color-gray-800": "#1f2937",
|
|
45489
|
+
"--color-gray-900": "#111827",
|
|
45490
|
+
"--color-gray-950": "#030712",
|
|
45491
|
+
"--color-zinc-50": "#fafafa",
|
|
45492
|
+
"--color-zinc-100": "#f4f4f5",
|
|
45493
|
+
"--color-zinc-200": "#e4e4e7",
|
|
45494
|
+
"--color-zinc-300": "#d4d4d8",
|
|
45495
|
+
"--color-zinc-400": "#a1a1aa",
|
|
45496
|
+
"--color-zinc-500": "#71717a",
|
|
45497
|
+
"--color-zinc-600": "#52525b",
|
|
45498
|
+
"--color-zinc-700": "#3f3f46",
|
|
45499
|
+
"--color-zinc-800": "#27272a",
|
|
45500
|
+
"--color-zinc-900": "#18181b",
|
|
45501
|
+
"--color-zinc-950": "#09090b",
|
|
45502
|
+
"--color-neutral-50": "#fafafa",
|
|
45503
|
+
"--color-neutral-100": "#f5f5f5",
|
|
45504
|
+
"--color-neutral-200": "#e5e5e5",
|
|
45505
|
+
"--color-neutral-300": "#d4d4d4",
|
|
45506
|
+
"--color-neutral-400": "#a3a3a3",
|
|
45507
|
+
"--color-neutral-500": "#737373",
|
|
45508
|
+
"--color-neutral-600": "#525252",
|
|
45509
|
+
"--color-neutral-700": "#404040",
|
|
45510
|
+
"--color-neutral-800": "#262626",
|
|
45511
|
+
"--color-neutral-900": "#171717",
|
|
45512
|
+
"--color-neutral-950": "#0a0a0a",
|
|
45513
|
+
"--color-stone-50": "#fafaf9",
|
|
45514
|
+
"--color-stone-100": "#f5f5f4",
|
|
45515
|
+
"--color-stone-200": "#e7e5e4",
|
|
45516
|
+
"--color-stone-300": "#d6d3d1",
|
|
45517
|
+
"--color-stone-400": "#a8a29e",
|
|
45518
|
+
"--color-stone-500": "#78716c",
|
|
45519
|
+
"--color-stone-600": "#57534e",
|
|
45520
|
+
"--color-stone-700": "#44403c",
|
|
45521
|
+
"--color-stone-800": "#292524",
|
|
45522
|
+
"--color-stone-900": "#1c1917",
|
|
45523
|
+
"--color-stone-950": "#0c0a09",
|
|
45524
|
+
"--color-red-50": "#fef2f2",
|
|
45525
|
+
"--color-red-100": "#fee2e2",
|
|
45526
|
+
"--color-red-200": "#fecaca",
|
|
45527
|
+
"--color-red-300": "#fca5a5",
|
|
45528
|
+
"--color-red-400": "#f87171",
|
|
45529
|
+
"--color-red-500": "#ef4444",
|
|
45530
|
+
"--color-red-600": "#dc2626",
|
|
45531
|
+
"--color-red-700": "#b91c1c",
|
|
45532
|
+
"--color-red-800": "#991b1b",
|
|
45533
|
+
"--color-red-900": "#7f1d1d",
|
|
45534
|
+
"--color-red-950": "#450a0a",
|
|
45535
|
+
"--color-orange-50": "#fff7ed",
|
|
45536
|
+
"--color-orange-100": "#ffedd5",
|
|
45537
|
+
"--color-orange-200": "#fed7aa",
|
|
45538
|
+
"--color-orange-300": "#fdba74",
|
|
45539
|
+
"--color-orange-400": "#fb923c",
|
|
45540
|
+
"--color-orange-500": "#f97316",
|
|
45541
|
+
"--color-orange-600": "#ea580c",
|
|
45542
|
+
"--color-orange-700": "#c2410c",
|
|
45543
|
+
"--color-orange-800": "#9a3412",
|
|
45544
|
+
"--color-orange-900": "#7c2d12",
|
|
45545
|
+
"--color-orange-950": "#431407",
|
|
45546
|
+
"--color-amber-50": "#fffbeb",
|
|
45547
|
+
"--color-amber-100": "#fef3c7",
|
|
45548
|
+
"--color-amber-200": "#fde68a",
|
|
45549
|
+
"--color-amber-300": "#fcd34d",
|
|
45550
|
+
"--color-amber-400": "#fbbf24",
|
|
45551
|
+
"--color-amber-500": "#f59e0b",
|
|
45552
|
+
"--color-amber-600": "#d97706",
|
|
45553
|
+
"--color-amber-700": "#b45309",
|
|
45554
|
+
"--color-amber-800": "#92400e",
|
|
45555
|
+
"--color-amber-900": "#78350f",
|
|
45556
|
+
"--color-amber-950": "#451a03",
|
|
45557
|
+
"--color-yellow-50": "#fefce8",
|
|
45558
|
+
"--color-yellow-100": "#fef9c3",
|
|
45559
|
+
"--color-yellow-200": "#fef08a",
|
|
45560
|
+
"--color-yellow-300": "#fde047",
|
|
45561
|
+
"--color-yellow-400": "#facc15",
|
|
45562
|
+
"--color-yellow-500": "#eab308",
|
|
45563
|
+
"--color-yellow-600": "#ca8a04",
|
|
45564
|
+
"--color-yellow-700": "#a16207",
|
|
45565
|
+
"--color-yellow-800": "#854d0e",
|
|
45566
|
+
"--color-yellow-900": "#713f12",
|
|
45567
|
+
"--color-yellow-950": "#422006",
|
|
45568
|
+
"--color-lime-50": "#f7fee7",
|
|
45569
|
+
"--color-lime-100": "#ecfccb",
|
|
45570
|
+
"--color-lime-200": "#d9f99d",
|
|
45571
|
+
"--color-lime-300": "#bef264",
|
|
45572
|
+
"--color-lime-400": "#a3e635",
|
|
45573
|
+
"--color-lime-500": "#84cc16",
|
|
45574
|
+
"--color-lime-600": "#65a30d",
|
|
45575
|
+
"--color-lime-700": "#4d7c0f",
|
|
45576
|
+
"--color-lime-800": "#3f6212",
|
|
45577
|
+
"--color-lime-900": "#365314",
|
|
45578
|
+
"--color-lime-950": "#1a2e05",
|
|
45579
|
+
"--color-green-50": "#f0fdf4",
|
|
45580
|
+
"--color-green-100": "#dcfce7",
|
|
45581
|
+
"--color-green-200": "#bbf7d0",
|
|
45582
|
+
"--color-green-300": "#86efac",
|
|
45583
|
+
"--color-green-400": "#4ade80",
|
|
45584
|
+
"--color-green-500": "#22c55e",
|
|
45585
|
+
"--color-green-600": "#16a34a",
|
|
45586
|
+
"--color-green-700": "#15803d",
|
|
45587
|
+
"--color-green-800": "#166534",
|
|
45588
|
+
"--color-green-900": "#14532d",
|
|
45589
|
+
"--color-green-950": "#052e16",
|
|
45590
|
+
"--color-emerald-50": "#ecfdf5",
|
|
45591
|
+
"--color-emerald-100": "#d1fae5",
|
|
45592
|
+
"--color-emerald-200": "#a7f3d0",
|
|
45593
|
+
"--color-emerald-300": "#6ee7b7",
|
|
45594
|
+
"--color-emerald-400": "#34d399",
|
|
45595
|
+
"--color-emerald-500": "#10b981",
|
|
45596
|
+
"--color-emerald-600": "#059669",
|
|
45597
|
+
"--color-emerald-700": "#047857",
|
|
45598
|
+
"--color-emerald-800": "#065f46",
|
|
45599
|
+
"--color-emerald-900": "#064e3b",
|
|
45600
|
+
"--color-emerald-950": "#022c22",
|
|
45601
|
+
"--color-teal-50": "#f0fdfa",
|
|
45602
|
+
"--color-teal-100": "#ccfbf1",
|
|
45603
|
+
"--color-teal-200": "#99f6e4",
|
|
45604
|
+
"--color-teal-300": "#5eead4",
|
|
45605
|
+
"--color-teal-400": "#2dd4bf",
|
|
45606
|
+
"--color-teal-500": "#14b8a6",
|
|
45607
|
+
"--color-teal-600": "#0d9488",
|
|
45608
|
+
"--color-teal-700": "#0f766e",
|
|
45609
|
+
"--color-teal-800": "#115e59",
|
|
45610
|
+
"--color-teal-900": "#134e4a",
|
|
45611
|
+
"--color-teal-950": "#042f2e",
|
|
45612
|
+
"--color-cyan-50": "#ecfeff",
|
|
45613
|
+
"--color-cyan-100": "#cffafe",
|
|
45614
|
+
"--color-cyan-200": "#a5f3fc",
|
|
45615
|
+
"--color-cyan-300": "#67e8f9",
|
|
45616
|
+
"--color-cyan-400": "#22d3ee",
|
|
45617
|
+
"--color-cyan-500": "#06b6d4",
|
|
45618
|
+
"--color-cyan-600": "#0891b2",
|
|
45619
|
+
"--color-cyan-700": "#0e7490",
|
|
45620
|
+
"--color-cyan-800": "#155e75",
|
|
45621
|
+
"--color-cyan-900": "#164e63",
|
|
45622
|
+
"--color-cyan-950": "#083344",
|
|
45623
|
+
"--color-sky-50": "#f0f9ff",
|
|
45624
|
+
"--color-sky-100": "#e0f2fe",
|
|
45625
|
+
"--color-sky-200": "#bae6fd",
|
|
45626
|
+
"--color-sky-300": "#7dd3fc",
|
|
45627
|
+
"--color-sky-400": "#38bdf8",
|
|
45628
|
+
"--color-sky-500": "#0ea5e9",
|
|
45629
|
+
"--color-sky-600": "#0284c7",
|
|
45630
|
+
"--color-sky-700": "#0369a1",
|
|
45631
|
+
"--color-sky-800": "#075985",
|
|
45632
|
+
"--color-sky-900": "#0c4a6e",
|
|
45633
|
+
"--color-sky-950": "#082f49",
|
|
45634
|
+
"--color-blue-50": "#eff6ff",
|
|
45635
|
+
"--color-blue-100": "#dbeafe",
|
|
45636
|
+
"--color-blue-200": "#bfdbfe",
|
|
45637
|
+
"--color-blue-300": "#93c5fd",
|
|
45638
|
+
"--color-blue-400": "#60a5fa",
|
|
45639
|
+
"--color-blue-500": "#3b82f6",
|
|
45640
|
+
"--color-blue-600": "#2563eb",
|
|
45641
|
+
"--color-blue-700": "#1d4ed8",
|
|
45642
|
+
"--color-blue-800": "#1e40af",
|
|
45643
|
+
"--color-blue-900": "#1e3a8a",
|
|
45644
|
+
"--color-blue-950": "#172554",
|
|
45645
|
+
"--color-indigo-50": "#eef2ff",
|
|
45646
|
+
"--color-indigo-100": "#e0e7ff",
|
|
45647
|
+
"--color-indigo-200": "#c7d2fe",
|
|
45648
|
+
"--color-indigo-300": "#a5b4fc",
|
|
45649
|
+
"--color-indigo-400": "#818cf8",
|
|
45650
|
+
"--color-indigo-500": "#6366f1",
|
|
45651
|
+
"--color-indigo-600": "#4f46e5",
|
|
45652
|
+
"--color-indigo-700": "#4338ca",
|
|
45653
|
+
"--color-indigo-800": "#3730a3",
|
|
45654
|
+
"--color-indigo-900": "#312e81",
|
|
45655
|
+
"--color-indigo-950": "#1e1b4b",
|
|
45656
|
+
"--color-violet-50": "#f5f3ff",
|
|
45657
|
+
"--color-violet-100": "#ede9fe",
|
|
45658
|
+
"--color-violet-200": "#ddd6fe",
|
|
45659
|
+
"--color-violet-300": "#c4b5fd",
|
|
45660
|
+
"--color-violet-400": "#a78bfa",
|
|
45661
|
+
"--color-violet-500": "#8b5cf6",
|
|
45662
|
+
"--color-violet-600": "#7c3aed",
|
|
45663
|
+
"--color-violet-700": "#6d28d9",
|
|
45664
|
+
"--color-violet-800": "#5b21b6",
|
|
45665
|
+
"--color-violet-900": "#4c1d95",
|
|
45666
|
+
"--color-violet-950": "#2e1065",
|
|
45667
|
+
"--color-purple-50": "#faf5ff",
|
|
45668
|
+
"--color-purple-100": "#f3e8ff",
|
|
45669
|
+
"--color-purple-200": "#e9d5ff",
|
|
45670
|
+
"--color-purple-300": "#d8b4fe",
|
|
45671
|
+
"--color-purple-400": "#c084fc",
|
|
45672
|
+
"--color-purple-500": "#a855f7",
|
|
45673
|
+
"--color-purple-600": "#9333ea",
|
|
45674
|
+
"--color-purple-700": "#7e22ce",
|
|
45675
|
+
"--color-purple-800": "#6b21a8",
|
|
45676
|
+
"--color-purple-900": "#581c87",
|
|
45677
|
+
"--color-purple-950": "#3b0764",
|
|
45678
|
+
"--color-fuchsia-50": "#fdf4ff",
|
|
45679
|
+
"--color-fuchsia-100": "#fae8ff",
|
|
45680
|
+
"--color-fuchsia-200": "#f5d0fe",
|
|
45681
|
+
"--color-fuchsia-300": "#f0abfc",
|
|
45682
|
+
"--color-fuchsia-400": "#e879f9",
|
|
45683
|
+
"--color-fuchsia-500": "#d946ef",
|
|
45684
|
+
"--color-fuchsia-600": "#c026d3",
|
|
45685
|
+
"--color-fuchsia-700": "#a21caf",
|
|
45686
|
+
"--color-fuchsia-800": "#86198f",
|
|
45687
|
+
"--color-fuchsia-900": "#701a75",
|
|
45688
|
+
"--color-fuchsia-950": "#4a044e",
|
|
45689
|
+
"--color-pink-50": "#fdf2f8",
|
|
45690
|
+
"--color-pink-100": "#fce7f3",
|
|
45691
|
+
"--color-pink-200": "#fbcfe8",
|
|
45692
|
+
"--color-pink-300": "#f9a8d4",
|
|
45693
|
+
"--color-pink-400": "#f472b6",
|
|
45694
|
+
"--color-pink-500": "#ec4899",
|
|
45695
|
+
"--color-pink-600": "#db2777",
|
|
45696
|
+
"--color-pink-700": "#be185d",
|
|
45697
|
+
"--color-pink-800": "#9d174d",
|
|
45698
|
+
"--color-pink-900": "#831843",
|
|
45699
|
+
"--color-pink-950": "#500724",
|
|
45700
|
+
"--color-rose-50": "#fff1f2",
|
|
45701
|
+
"--color-rose-100": "#ffe4e6",
|
|
45702
|
+
"--color-rose-200": "#fecdd3",
|
|
45703
|
+
"--color-rose-300": "#fda4af",
|
|
45704
|
+
"--color-rose-400": "#fb7185",
|
|
45705
|
+
"--color-rose-500": "#f43f5e",
|
|
45706
|
+
"--color-rose-600": "#e11d48",
|
|
45707
|
+
"--color-rose-700": "#be123c",
|
|
45708
|
+
"--color-rose-800": "#9f1239",
|
|
45709
|
+
"--color-rose-900": "#881337",
|
|
45710
|
+
"--color-rose-950": "#4c0519",
|
|
45711
|
+
"--text-xs": "0.75rem",
|
|
45712
|
+
"--text-xs--line-height": "1rem",
|
|
45713
|
+
"--text-sm": "0.875rem",
|
|
45714
|
+
"--text-sm--line-height": "1.25rem",
|
|
45715
|
+
"--text-base": "1rem",
|
|
45716
|
+
"--text-base--line-height": "1.5rem",
|
|
45717
|
+
"--text-lg": "1.125rem",
|
|
45718
|
+
"--text-lg--line-height": "1.75rem",
|
|
45719
|
+
"--text-xl": "1.25rem",
|
|
45720
|
+
"--text-xl--line-height": "1.75rem",
|
|
45721
|
+
"--text-2xl": "1.5rem",
|
|
45722
|
+
"--text-2xl--line-height": "2rem",
|
|
45723
|
+
"--text-3xl": "1.875rem",
|
|
45724
|
+
"--text-3xl--line-height": "2.25rem",
|
|
45725
|
+
"--text-4xl": "2.25rem",
|
|
45726
|
+
"--text-4xl--line-height": "2.5rem",
|
|
45727
|
+
"--text-5xl": "3rem",
|
|
45728
|
+
"--text-5xl--line-height": "1",
|
|
45729
|
+
"--text-6xl": "3.75rem",
|
|
45730
|
+
"--text-6xl--line-height": "1",
|
|
45731
|
+
"--text-7xl": "4.5rem",
|
|
45732
|
+
"--text-7xl--line-height": "1",
|
|
45733
|
+
"--text-8xl": "6rem",
|
|
45734
|
+
"--text-8xl--line-height": "1",
|
|
45735
|
+
"--text-9xl": "8rem",
|
|
45736
|
+
"--text-9xl--line-height": "1",
|
|
45737
|
+
"--font-weight-thin": "100",
|
|
45738
|
+
"--font-weight-extralight": "200",
|
|
45739
|
+
"--font-weight-light": "300",
|
|
45740
|
+
"--font-weight-normal": "400",
|
|
45741
|
+
"--font-weight-medium": "500",
|
|
45742
|
+
"--font-weight-semibold": "600",
|
|
45743
|
+
"--font-weight-bold": "700",
|
|
45744
|
+
"--font-weight-extrabold": "800",
|
|
45745
|
+
"--font-weight-black": "900",
|
|
45746
|
+
"--tracking-tighter": "-0.05em",
|
|
45747
|
+
"--tracking-tight": "-0.025em",
|
|
45748
|
+
"--tracking-normal": "0em",
|
|
45749
|
+
"--tracking-wide": "0.025em",
|
|
45750
|
+
"--tracking-wider": "0.05em",
|
|
45751
|
+
"--tracking-widest": "0.1em",
|
|
45752
|
+
"--font-sans": 'ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"',
|
|
45753
|
+
"--font-serif": 'ui-serif, Georgia, Cambria, "Times New Roman", Times, serif',
|
|
45754
|
+
"--font-mono": 'ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace'
|
|
45755
|
+
};
|
|
45756
|
+
|
|
45757
|
+
// src/tools/tailwind-config.ts
|
|
45758
|
+
var OTHER = { t: "other" };
|
|
45759
|
+
var IDENT = /[\w$]/;
|
|
45760
|
+
var Reader = class {
|
|
45761
|
+
constructor(s, i = 0) {
|
|
45762
|
+
this.s = s;
|
|
45763
|
+
this.i = i;
|
|
45764
|
+
}
|
|
45765
|
+
ws() {
|
|
45766
|
+
const s = this.s;
|
|
45767
|
+
for (; ; ) {
|
|
45768
|
+
while (this.i < s.length && /\s/.test(s[this.i])) this.i++;
|
|
45769
|
+
if (s[this.i] === "/" && s[this.i + 1] === "/") {
|
|
45770
|
+
const nl = s.indexOf("\n", this.i);
|
|
45771
|
+
this.i = nl < 0 ? s.length : nl;
|
|
45772
|
+
} else if (s[this.i] === "/" && s[this.i + 1] === "*") {
|
|
45773
|
+
const end = s.indexOf("*/", this.i + 2);
|
|
45774
|
+
this.i = end < 0 ? s.length : end + 2;
|
|
45775
|
+
} else return;
|
|
45776
|
+
}
|
|
45777
|
+
}
|
|
45778
|
+
quoted() {
|
|
45779
|
+
const s = this.s;
|
|
45780
|
+
const q = s[this.i++];
|
|
45781
|
+
let out = "";
|
|
45782
|
+
for (; this.i < s.length && s[this.i] !== q; this.i++) {
|
|
45783
|
+
if (s[this.i] === "\\") this.i++;
|
|
45784
|
+
out += s[this.i] ?? "";
|
|
45785
|
+
}
|
|
45786
|
+
this.i++;
|
|
45787
|
+
return out;
|
|
45788
|
+
}
|
|
45789
|
+
/** Moves to the next `,` or closing bracket at this depth, without consuming it. */
|
|
45790
|
+
skipExpr() {
|
|
45791
|
+
const s = this.s;
|
|
45792
|
+
let depth = 0;
|
|
45793
|
+
for (; this.i < s.length; this.i++) {
|
|
45794
|
+
const c = s[this.i];
|
|
45795
|
+
if (c === '"' || c === "'" || c === "`") this.quoted(), this.i--;
|
|
45796
|
+
else if (c === "/" && (s[this.i + 1] === "/" || s[this.i + 1] === "*")) this.ws(), this.i--;
|
|
45797
|
+
else if (c === "{" || c === "[" || c === "(") depth++;
|
|
45798
|
+
else if (c === "}" || c === "]" || c === ")") {
|
|
45799
|
+
if (depth === 0) return;
|
|
45800
|
+
depth--;
|
|
45801
|
+
} else if (c === "," && depth === 0) return;
|
|
45802
|
+
}
|
|
45803
|
+
}
|
|
45804
|
+
/** A value; anything that isn't a literal, an object, an array or a plain reference is `other`. */
|
|
45805
|
+
value() {
|
|
45806
|
+
this.ws();
|
|
45807
|
+
const s = this.s;
|
|
45808
|
+
const c = s[this.i];
|
|
45809
|
+
let node2 = OTHER;
|
|
45810
|
+
if (c === "{") node2 = this.object();
|
|
45811
|
+
else if (c === "[") {
|
|
45812
|
+
this.i++;
|
|
45813
|
+
const items = [];
|
|
45814
|
+
for (; ; ) {
|
|
45815
|
+
this.ws();
|
|
45816
|
+
if (this.i >= s.length || s[this.i] === "]") break;
|
|
45817
|
+
if (s[this.i] === ",") {
|
|
45818
|
+
this.i++;
|
|
45819
|
+
continue;
|
|
45820
|
+
}
|
|
45821
|
+
const before = this.i;
|
|
45822
|
+
items.push(s.startsWith("...", this.i) ? (this.skipExpr(), OTHER) : this.value());
|
|
45823
|
+
if (this.i === before) this.i++;
|
|
45824
|
+
}
|
|
45825
|
+
this.i++;
|
|
45826
|
+
node2 = { t: "arr", items };
|
|
45827
|
+
} else if (c === '"' || c === "'") node2 = { t: "str", v: this.quoted() };
|
|
45828
|
+
else if (c === "`") {
|
|
45829
|
+
const v = this.quoted();
|
|
45830
|
+
node2 = v.includes("${") ? OTHER : { t: "str", v };
|
|
45831
|
+
} else if (c !== void 0 && /[\d.-]/.test(c)) {
|
|
45832
|
+
const m = /^-?[\d.]+/.exec(s.slice(this.i, this.i + 24));
|
|
45833
|
+
if (m) {
|
|
45834
|
+
this.i += m[0].length;
|
|
45835
|
+
node2 = { t: "str", v: m[0] };
|
|
45836
|
+
}
|
|
45837
|
+
} else if (c !== void 0 && IDENT.test(c)) {
|
|
45838
|
+
const path5 = [];
|
|
45839
|
+
for (; ; ) {
|
|
45840
|
+
const m = /^[\w$]+/.exec(s.slice(this.i, this.i + 80));
|
|
45841
|
+
if (!m) break;
|
|
45842
|
+
path5.push(m[0]);
|
|
45843
|
+
this.i += m[0].length;
|
|
45844
|
+
if (s[this.i] === ".") {
|
|
45845
|
+
this.i++;
|
|
45846
|
+
continue;
|
|
45847
|
+
}
|
|
45848
|
+
const lit = /^\[\s*(["']?)([\w-]+)\1\s*\]/.exec(s.slice(this.i, this.i + 40));
|
|
45849
|
+
if (!lit) break;
|
|
45850
|
+
path5.push(lit[2]);
|
|
45851
|
+
this.i += lit[0].length;
|
|
45852
|
+
if (s[this.i] === ".") this.i++;
|
|
45853
|
+
else break;
|
|
45854
|
+
}
|
|
45855
|
+
node2 = path5.length ? { t: "ref", path: path5 } : OTHER;
|
|
45856
|
+
}
|
|
45857
|
+
this.ws();
|
|
45858
|
+
if (node2 !== OTHER && /^(?:as|satisfies)\s/.test(s.slice(this.i, this.i + 11))) {
|
|
45859
|
+
this.skipExpr();
|
|
45860
|
+
return node2;
|
|
45861
|
+
}
|
|
45862
|
+
if (this.i < s.length && ![",", "}", "]", ")"].includes(s[this.i])) {
|
|
45863
|
+
this.skipExpr();
|
|
45864
|
+
return OTHER;
|
|
45865
|
+
}
|
|
45866
|
+
return node2;
|
|
45867
|
+
}
|
|
45868
|
+
object() {
|
|
45869
|
+
const s = this.s;
|
|
45870
|
+
this.i++;
|
|
45871
|
+
const props = /* @__PURE__ */ new Map();
|
|
45872
|
+
for (; ; ) {
|
|
45873
|
+
this.ws();
|
|
45874
|
+
if (this.i >= s.length || s[this.i] === "}") break;
|
|
45875
|
+
if (s[this.i] === ",") {
|
|
45876
|
+
this.i++;
|
|
45877
|
+
continue;
|
|
45878
|
+
}
|
|
45879
|
+
const before = this.i;
|
|
45880
|
+
let key;
|
|
45881
|
+
if (s[this.i] === '"' || s[this.i] === "'") key = this.quoted();
|
|
45882
|
+
else {
|
|
45883
|
+
const m = /^[\w$-]+/.exec(s.slice(this.i, this.i + 80));
|
|
45884
|
+
if (m) {
|
|
45885
|
+
key = m[0];
|
|
45886
|
+
this.i += m[0].length;
|
|
45887
|
+
}
|
|
45888
|
+
}
|
|
45889
|
+
this.ws();
|
|
45890
|
+
if (key !== void 0 && s[this.i] === ":") {
|
|
45891
|
+
this.i++;
|
|
45892
|
+
props.set(key, this.value());
|
|
45893
|
+
} else if (key !== void 0 && (s[this.i] === "," || s[this.i] === "}")) {
|
|
45894
|
+
props.set(key, { t: "ref", path: [key] });
|
|
45895
|
+
} else this.skipExpr();
|
|
45896
|
+
if (this.i === before) this.i++;
|
|
45897
|
+
}
|
|
45898
|
+
this.i++;
|
|
45899
|
+
return { t: "obj", props };
|
|
45900
|
+
}
|
|
45901
|
+
};
|
|
45902
|
+
var parseAt = (src, open2) => new Reader(src, open2).value();
|
|
45903
|
+
function configObject(src) {
|
|
45904
|
+
const anchor2 = /(?:module\.exports\s*=|export\s+default)\s*/.exec(src);
|
|
45905
|
+
if (!anchor2) return void 0;
|
|
45906
|
+
let i = anchor2.index + anchor2[0].length;
|
|
45907
|
+
const wrapper = /^[\w$.]+\s*\(\s*/.exec(src.slice(i));
|
|
45908
|
+
if (wrapper) i += wrapper[0].length;
|
|
45909
|
+
if (src[i] === "{") return parseAt(src, i);
|
|
45910
|
+
const name = /^[\w$]+/.exec(src.slice(i))?.[0];
|
|
45911
|
+
const decl = name && new RegExp(`(?:const|let|var)\\s+${name}\\s*(?::[^=\\n]+)?=\\s*(?:[\\w$.]+\\s*\\(\\s*)?\\{`).exec(src);
|
|
45912
|
+
return decl ? parseAt(src, decl.index + decl[0].length - 1) : void 0;
|
|
45913
|
+
}
|
|
45914
|
+
function localObject(src, name) {
|
|
45915
|
+
const m = new RegExp(`(?:const|let|var)\\s+${name}\\s*(?::[^=\\n]+)?=\\s*\\{`).exec(src);
|
|
45916
|
+
return m ? parseAt(src, m.index + m[0].length - 1) : void 0;
|
|
45917
|
+
}
|
|
45918
|
+
var get = (n2, key) => n2?.t === "obj" ? n2.props.get(key) : void 0;
|
|
45919
|
+
function paletteNames(src) {
|
|
45920
|
+
const names = /* @__PURE__ */ new Set();
|
|
45921
|
+
for (const m of src.matchAll(/(?:(?:const|let|var)\s+([\w$]+)\s*=\s*require\(|import\s+([\w$]+)\s+from\s+)\s*["']tailwindcss\/colors(?:\.js)?["']/g)) names.add(m[1] ?? m[2]);
|
|
45922
|
+
return names;
|
|
45923
|
+
}
|
|
45924
|
+
var GROUPS = [
|
|
45925
|
+
["colors", "--color-"],
|
|
45926
|
+
["fontFamily", "--font-"],
|
|
45927
|
+
["fontSize", "--text-"],
|
|
45928
|
+
["fontWeight", "--font-weight-"],
|
|
45929
|
+
["letterSpacing", "--tracking-"]
|
|
45930
|
+
];
|
|
45931
|
+
function replacedBy(name, replaced) {
|
|
45932
|
+
return [...replaced].some((p) => name.startsWith(p) && !(p === "--font-" && name.startsWith("--font-weight-")));
|
|
45933
|
+
}
|
|
45934
|
+
function tailwindV3Defaults(replaced) {
|
|
45935
|
+
return Object.entries(TAILWIND_V3_THEME).filter(([k]) => !replacedBy(k, replaced));
|
|
45936
|
+
}
|
|
45937
|
+
function tailwindConfigTheme(src, channel) {
|
|
45938
|
+
const out = { vars: [], replaced: /* @__PURE__ */ new Set() };
|
|
45939
|
+
const root = configObject(src);
|
|
45940
|
+
const theme = get(root, "theme");
|
|
45941
|
+
if (theme?.t !== "obj") return out;
|
|
45942
|
+
const palettes = paletteNames(src);
|
|
45943
|
+
const colorValue = (v) => {
|
|
45944
|
+
const fn = /^(hsl|rgb)a?\(\s*var\(\s*(--[\w-]+)\s*\)\s*(?:\/\s*([^)]*))?\)$/i.exec(v.trim());
|
|
45945
|
+
if (fn) {
|
|
45946
|
+
const ch = channel(fn[2]);
|
|
45947
|
+
if (!ch) return void 0;
|
|
45948
|
+
if (/^(hsl|rgb)a?\(/i.test(ch)) return ch;
|
|
45949
|
+
const alpha = fn[3]?.trim();
|
|
45950
|
+
return `${fn[1].toLowerCase()}(${ch}${alpha && !alpha.includes("<alpha-value>") ? ` / ${alpha}` : ""})`;
|
|
45951
|
+
}
|
|
45952
|
+
const plain = /^var\(\s*(--[\w-]+)\s*\)$/.exec(v.trim());
|
|
45953
|
+
return plain ? channel(plain[1]) : v;
|
|
45954
|
+
};
|
|
45955
|
+
const colors = (prefix, n2, depth = 0) => {
|
|
45956
|
+
if (depth > 6) return;
|
|
45957
|
+
if (n2.t === "str") {
|
|
45958
|
+
const v = colorValue(n2.v);
|
|
45959
|
+
if (v) out.vars.push([prefix, v]);
|
|
45960
|
+
} else if (n2.t === "obj") {
|
|
45961
|
+
for (const [k, x] of n2.props) colors(k === "DEFAULT" ? prefix : `${prefix}-${k}`, x, depth + 1);
|
|
45962
|
+
} else if (n2.t === "ref") {
|
|
45963
|
+
if (palettes.has(n2.path[0]) && n2.path.length > 1) {
|
|
45964
|
+
const base = `--color-${n2.path.slice(1).join("-")}`;
|
|
45965
|
+
for (const [k, v] of Object.entries(TAILWIND_V3_THEME)) {
|
|
45966
|
+
if (k === base || k.startsWith(`${base}-`)) out.vars.push([prefix + k.slice(base.length), v]);
|
|
45967
|
+
}
|
|
45968
|
+
} else if (n2.path.length === 1) {
|
|
45969
|
+
const local = localObject(src, n2.path[0]);
|
|
45970
|
+
if (local) colors(prefix, local, depth + 1);
|
|
45971
|
+
}
|
|
45972
|
+
}
|
|
45973
|
+
};
|
|
45974
|
+
const family = (n2) => {
|
|
45975
|
+
if (n2.t === "str") return n2.v;
|
|
45976
|
+
if (n2.t !== "arr") return void 0;
|
|
45977
|
+
const first = n2.items[0];
|
|
45978
|
+
const list = first?.t === "arr" ? first.items : n2.items;
|
|
45979
|
+
const names = list.flatMap((x) => x.t === "str" ? [/\s/.test(x.v) && !/[",]/.test(x.v) ? `"${x.v}"` : x.v] : []);
|
|
45980
|
+
return names.length ? names.join(", ") : void 0;
|
|
45981
|
+
};
|
|
45982
|
+
const sizes = (key, n2) => {
|
|
45983
|
+
const size = n2.t === "str" ? n2 : n2.t === "arr" ? n2.items[0] : void 0;
|
|
45984
|
+
if (size?.t !== "str") return;
|
|
45985
|
+
out.vars.push([`--text-${key}`, size.v]);
|
|
45986
|
+
const spec = n2.t === "arr" ? n2.items[1] : void 0;
|
|
45987
|
+
if (spec?.t === "str") out.vars.push([`--text-${key}--line-height`, spec.v]);
|
|
45988
|
+
else if (spec?.t === "obj") {
|
|
45989
|
+
for (const [prop2, name] of [["lineHeight", "line-height"], ["letterSpacing", "letter-spacing"], ["fontWeight", "font-weight"]]) {
|
|
45990
|
+
const x = spec.props.get(prop2);
|
|
45991
|
+
if (x?.t === "str") out.vars.push([`--text-${key}--${name}`, x.v]);
|
|
45992
|
+
}
|
|
45993
|
+
}
|
|
45994
|
+
};
|
|
45995
|
+
for (const layer of [theme, get(theme, "extend")]) {
|
|
45996
|
+
if (layer?.t !== "obj") continue;
|
|
45997
|
+
for (const [group, prefix] of GROUPS) {
|
|
45998
|
+
const n2 = layer.props.get(group);
|
|
45999
|
+
if (!n2) continue;
|
|
46000
|
+
if (layer === theme) out.replaced.add(prefix);
|
|
46001
|
+
if (n2.t !== "obj") continue;
|
|
46002
|
+
for (const [k, x] of n2.props) {
|
|
46003
|
+
if (group === "colors") colors(`--color-${k}`, x);
|
|
46004
|
+
else if (k === "DEFAULT") continue;
|
|
46005
|
+
else if (group === "fontSize") sizes(k, x);
|
|
46006
|
+
else if (group === "fontFamily") {
|
|
46007
|
+
const f = family(x);
|
|
46008
|
+
if (f) out.vars.push([`--font-${k}`, f]);
|
|
46009
|
+
} else if (x.t === "str") out.vars.push([`${prefix}${k}`, x.v]);
|
|
46010
|
+
}
|
|
46011
|
+
}
|
|
46012
|
+
}
|
|
46013
|
+
return out;
|
|
46014
|
+
}
|
|
46015
|
+
|
|
46016
|
+
// src/tools/tailwind-theme.ts
|
|
46017
|
+
var TAILWIND_THEME = {
|
|
46018
|
+
"--color-red-50": "oklch(97.1% 0.013 17.38)",
|
|
46019
|
+
"--color-red-100": "oklch(93.6% 0.032 17.717)",
|
|
46020
|
+
"--color-red-200": "oklch(88.5% 0.062 18.334)",
|
|
46021
|
+
"--color-red-300": "oklch(80.8% 0.114 19.571)",
|
|
46022
|
+
"--color-red-400": "oklch(70.4% 0.191 22.216)",
|
|
46023
|
+
"--color-red-500": "oklch(63.7% 0.237 25.331)",
|
|
46024
|
+
"--color-red-600": "oklch(57.7% 0.245 27.325)",
|
|
46025
|
+
"--color-red-700": "oklch(50.5% 0.213 27.518)",
|
|
46026
|
+
"--color-red-800": "oklch(44.4% 0.177 26.899)",
|
|
46027
|
+
"--color-red-900": "oklch(39.6% 0.141 25.723)",
|
|
46028
|
+
"--color-red-950": "oklch(25.8% 0.092 26.042)",
|
|
46029
|
+
"--color-orange-50": "oklch(98% 0.016 73.684)",
|
|
46030
|
+
"--color-orange-100": "oklch(95.4% 0.038 75.164)",
|
|
46031
|
+
"--color-orange-200": "oklch(90.1% 0.076 70.697)",
|
|
46032
|
+
"--color-orange-300": "oklch(83.7% 0.128 66.29)",
|
|
46033
|
+
"--color-orange-400": "oklch(75% 0.183 55.934)",
|
|
46034
|
+
"--color-orange-500": "oklch(70.5% 0.213 47.604)",
|
|
46035
|
+
"--color-orange-600": "oklch(64.6% 0.222 41.116)",
|
|
46036
|
+
"--color-orange-700": "oklch(55.3% 0.195 38.402)",
|
|
46037
|
+
"--color-orange-800": "oklch(47% 0.157 37.304)",
|
|
46038
|
+
"--color-orange-900": "oklch(40.8% 0.123 38.172)",
|
|
46039
|
+
"--color-orange-950": "oklch(26.6% 0.079 36.259)",
|
|
46040
|
+
"--color-amber-50": "oklch(98.7% 0.022 95.277)",
|
|
46041
|
+
"--color-amber-100": "oklch(96.2% 0.059 95.617)",
|
|
46042
|
+
"--color-amber-200": "oklch(92.4% 0.12 95.746)",
|
|
46043
|
+
"--color-amber-300": "oklch(87.9% 0.169 91.605)",
|
|
46044
|
+
"--color-amber-400": "oklch(82.8% 0.189 84.429)",
|
|
46045
|
+
"--color-amber-500": "oklch(76.9% 0.188 70.08)",
|
|
46046
|
+
"--color-amber-600": "oklch(66.6% 0.179 58.318)",
|
|
46047
|
+
"--color-amber-700": "oklch(55.5% 0.163 48.998)",
|
|
46048
|
+
"--color-amber-800": "oklch(47.3% 0.137 46.201)",
|
|
46049
|
+
"--color-amber-900": "oklch(41.4% 0.112 45.904)",
|
|
46050
|
+
"--color-amber-950": "oklch(27.9% 0.077 45.635)",
|
|
46051
|
+
"--color-yellow-50": "oklch(98.7% 0.026 102.212)",
|
|
46052
|
+
"--color-yellow-100": "oklch(97.3% 0.071 103.193)",
|
|
46053
|
+
"--color-yellow-200": "oklch(94.5% 0.129 101.54)",
|
|
46054
|
+
"--color-yellow-300": "oklch(90.5% 0.182 98.111)",
|
|
46055
|
+
"--color-yellow-400": "oklch(85.2% 0.199 91.936)",
|
|
46056
|
+
"--color-yellow-500": "oklch(79.5% 0.184 86.047)",
|
|
46057
|
+
"--color-yellow-600": "oklch(68.1% 0.162 75.834)",
|
|
46058
|
+
"--color-yellow-700": "oklch(55.4% 0.135 66.442)",
|
|
46059
|
+
"--color-yellow-800": "oklch(47.6% 0.114 61.907)",
|
|
46060
|
+
"--color-yellow-900": "oklch(42.1% 0.095 57.708)",
|
|
46061
|
+
"--color-yellow-950": "oklch(28.6% 0.066 53.813)",
|
|
46062
|
+
"--color-lime-50": "oklch(98.6% 0.031 120.757)",
|
|
46063
|
+
"--color-lime-100": "oklch(96.7% 0.067 122.328)",
|
|
46064
|
+
"--color-lime-200": "oklch(93.8% 0.127 124.321)",
|
|
46065
|
+
"--color-lime-300": "oklch(89.7% 0.196 126.665)",
|
|
46066
|
+
"--color-lime-400": "oklch(84.1% 0.238 128.85)",
|
|
46067
|
+
"--color-lime-500": "oklch(76.8% 0.233 130.85)",
|
|
46068
|
+
"--color-lime-600": "oklch(64.8% 0.2 131.684)",
|
|
46069
|
+
"--color-lime-700": "oklch(53.2% 0.157 131.589)",
|
|
46070
|
+
"--color-lime-800": "oklch(45.3% 0.124 130.933)",
|
|
46071
|
+
"--color-lime-900": "oklch(40.5% 0.101 131.063)",
|
|
46072
|
+
"--color-lime-950": "oklch(27.4% 0.072 132.109)",
|
|
46073
|
+
"--color-green-50": "oklch(98.2% 0.018 155.826)",
|
|
46074
|
+
"--color-green-100": "oklch(96.2% 0.044 156.743)",
|
|
46075
|
+
"--color-green-200": "oklch(92.5% 0.084 155.995)",
|
|
46076
|
+
"--color-green-300": "oklch(87.1% 0.15 154.449)",
|
|
46077
|
+
"--color-green-400": "oklch(79.2% 0.209 151.711)",
|
|
46078
|
+
"--color-green-500": "oklch(72.3% 0.219 149.579)",
|
|
46079
|
+
"--color-green-600": "oklch(62.7% 0.194 149.214)",
|
|
46080
|
+
"--color-green-700": "oklch(52.7% 0.154 150.069)",
|
|
46081
|
+
"--color-green-800": "oklch(44.8% 0.119 151.328)",
|
|
46082
|
+
"--color-green-900": "oklch(39.3% 0.095 152.535)",
|
|
46083
|
+
"--color-green-950": "oklch(26.6% 0.065 152.934)",
|
|
46084
|
+
"--color-emerald-50": "oklch(97.9% 0.021 166.113)",
|
|
46085
|
+
"--color-emerald-100": "oklch(95% 0.052 163.051)",
|
|
46086
|
+
"--color-emerald-200": "oklch(90.5% 0.093 164.15)",
|
|
46087
|
+
"--color-emerald-300": "oklch(84.5% 0.143 164.978)",
|
|
46088
|
+
"--color-emerald-400": "oklch(76.5% 0.177 163.223)",
|
|
46089
|
+
"--color-emerald-500": "oklch(69.6% 0.17 162.48)",
|
|
46090
|
+
"--color-emerald-600": "oklch(59.6% 0.145 163.225)",
|
|
46091
|
+
"--color-emerald-700": "oklch(50.8% 0.118 165.612)",
|
|
46092
|
+
"--color-emerald-800": "oklch(43.2% 0.095 166.913)",
|
|
46093
|
+
"--color-emerald-900": "oklch(37.8% 0.077 168.94)",
|
|
46094
|
+
"--color-emerald-950": "oklch(26.2% 0.051 172.552)",
|
|
46095
|
+
"--color-teal-50": "oklch(98.4% 0.014 180.72)",
|
|
46096
|
+
"--color-teal-100": "oklch(95.3% 0.051 180.801)",
|
|
46097
|
+
"--color-teal-200": "oklch(91% 0.096 180.426)",
|
|
46098
|
+
"--color-teal-300": "oklch(85.5% 0.138 181.071)",
|
|
46099
|
+
"--color-teal-400": "oklch(77.7% 0.152 181.912)",
|
|
46100
|
+
"--color-teal-500": "oklch(70.4% 0.14 182.503)",
|
|
46101
|
+
"--color-teal-600": "oklch(60% 0.118 184.704)",
|
|
46102
|
+
"--color-teal-700": "oklch(51.1% 0.096 186.391)",
|
|
46103
|
+
"--color-teal-800": "oklch(43.7% 0.078 188.216)",
|
|
46104
|
+
"--color-teal-900": "oklch(38.6% 0.063 188.416)",
|
|
46105
|
+
"--color-teal-950": "oklch(27.7% 0.046 192.524)",
|
|
46106
|
+
"--color-cyan-50": "oklch(98.4% 0.019 200.873)",
|
|
46107
|
+
"--color-cyan-100": "oklch(95.6% 0.045 203.388)",
|
|
46108
|
+
"--color-cyan-200": "oklch(91.7% 0.08 205.041)",
|
|
46109
|
+
"--color-cyan-300": "oklch(86.5% 0.127 207.078)",
|
|
46110
|
+
"--color-cyan-400": "oklch(78.9% 0.154 211.53)",
|
|
46111
|
+
"--color-cyan-500": "oklch(71.5% 0.143 215.221)",
|
|
46112
|
+
"--color-cyan-600": "oklch(60.9% 0.126 221.723)",
|
|
46113
|
+
"--color-cyan-700": "oklch(52% 0.105 223.128)",
|
|
46114
|
+
"--color-cyan-800": "oklch(45% 0.085 224.283)",
|
|
46115
|
+
"--color-cyan-900": "oklch(39.8% 0.07 227.392)",
|
|
46116
|
+
"--color-cyan-950": "oklch(30.2% 0.056 229.695)",
|
|
46117
|
+
"--color-sky-50": "oklch(97.7% 0.013 236.62)",
|
|
46118
|
+
"--color-sky-100": "oklch(95.1% 0.026 236.824)",
|
|
46119
|
+
"--color-sky-200": "oklch(90.1% 0.058 230.902)",
|
|
46120
|
+
"--color-sky-300": "oklch(82.8% 0.111 230.318)",
|
|
46121
|
+
"--color-sky-400": "oklch(74.6% 0.16 232.661)",
|
|
46122
|
+
"--color-sky-500": "oklch(68.5% 0.169 237.323)",
|
|
46123
|
+
"--color-sky-600": "oklch(58.8% 0.158 241.966)",
|
|
46124
|
+
"--color-sky-700": "oklch(50% 0.134 242.749)",
|
|
46125
|
+
"--color-sky-800": "oklch(44.3% 0.11 240.79)",
|
|
46126
|
+
"--color-sky-900": "oklch(39.1% 0.09 240.876)",
|
|
46127
|
+
"--color-sky-950": "oklch(29.3% 0.066 243.157)",
|
|
46128
|
+
"--color-blue-50": "oklch(97% 0.014 254.604)",
|
|
46129
|
+
"--color-blue-100": "oklch(93.2% 0.032 255.585)",
|
|
46130
|
+
"--color-blue-200": "oklch(88.2% 0.059 254.128)",
|
|
46131
|
+
"--color-blue-300": "oklch(80.9% 0.105 251.813)",
|
|
46132
|
+
"--color-blue-400": "oklch(70.7% 0.165 254.624)",
|
|
46133
|
+
"--color-blue-500": "oklch(62.3% 0.214 259.815)",
|
|
46134
|
+
"--color-blue-600": "oklch(54.6% 0.245 262.881)",
|
|
46135
|
+
"--color-blue-700": "oklch(48.8% 0.243 264.376)",
|
|
46136
|
+
"--color-blue-800": "oklch(42.4% 0.199 265.638)",
|
|
46137
|
+
"--color-blue-900": "oklch(37.9% 0.146 265.522)",
|
|
46138
|
+
"--color-blue-950": "oklch(28.2% 0.091 267.935)",
|
|
46139
|
+
"--color-indigo-50": "oklch(96.2% 0.018 272.314)",
|
|
46140
|
+
"--color-indigo-100": "oklch(93% 0.034 272.788)",
|
|
46141
|
+
"--color-indigo-200": "oklch(87% 0.065 274.039)",
|
|
46142
|
+
"--color-indigo-300": "oklch(78.5% 0.115 274.713)",
|
|
46143
|
+
"--color-indigo-400": "oklch(67.3% 0.182 276.935)",
|
|
46144
|
+
"--color-indigo-500": "oklch(58.5% 0.233 277.117)",
|
|
46145
|
+
"--color-indigo-600": "oklch(51.1% 0.262 276.966)",
|
|
46146
|
+
"--color-indigo-700": "oklch(45.7% 0.24 277.023)",
|
|
46147
|
+
"--color-indigo-800": "oklch(39.8% 0.195 277.366)",
|
|
46148
|
+
"--color-indigo-900": "oklch(35.9% 0.144 278.697)",
|
|
46149
|
+
"--color-indigo-950": "oklch(25.7% 0.09 281.288)",
|
|
46150
|
+
"--color-violet-50": "oklch(96.9% 0.016 293.756)",
|
|
46151
|
+
"--color-violet-100": "oklch(94.3% 0.029 294.588)",
|
|
46152
|
+
"--color-violet-200": "oklch(89.4% 0.057 293.283)",
|
|
46153
|
+
"--color-violet-300": "oklch(81.1% 0.111 293.571)",
|
|
46154
|
+
"--color-violet-400": "oklch(70.2% 0.183 293.541)",
|
|
46155
|
+
"--color-violet-500": "oklch(60.6% 0.25 292.717)",
|
|
46156
|
+
"--color-violet-600": "oklch(54.1% 0.281 293.009)",
|
|
46157
|
+
"--color-violet-700": "oklch(49.1% 0.27 292.581)",
|
|
46158
|
+
"--color-violet-800": "oklch(43.2% 0.232 292.759)",
|
|
46159
|
+
"--color-violet-900": "oklch(38% 0.189 293.745)",
|
|
46160
|
+
"--color-violet-950": "oklch(28.3% 0.141 291.089)",
|
|
46161
|
+
"--color-purple-50": "oklch(97.7% 0.014 308.299)",
|
|
46162
|
+
"--color-purple-100": "oklch(94.6% 0.033 307.174)",
|
|
46163
|
+
"--color-purple-200": "oklch(90.2% 0.063 306.703)",
|
|
46164
|
+
"--color-purple-300": "oklch(82.7% 0.119 306.383)",
|
|
46165
|
+
"--color-purple-400": "oklch(71.4% 0.203 305.504)",
|
|
46166
|
+
"--color-purple-500": "oklch(62.7% 0.265 303.9)",
|
|
46167
|
+
"--color-purple-600": "oklch(55.8% 0.288 302.321)",
|
|
46168
|
+
"--color-purple-700": "oklch(49.6% 0.265 301.924)",
|
|
46169
|
+
"--color-purple-800": "oklch(43.8% 0.218 303.724)",
|
|
46170
|
+
"--color-purple-900": "oklch(38.1% 0.176 304.987)",
|
|
46171
|
+
"--color-purple-950": "oklch(29.1% 0.149 302.717)",
|
|
46172
|
+
"--color-fuchsia-50": "oklch(97.7% 0.017 320.058)",
|
|
46173
|
+
"--color-fuchsia-100": "oklch(95.2% 0.037 318.852)",
|
|
46174
|
+
"--color-fuchsia-200": "oklch(90.3% 0.076 319.62)",
|
|
46175
|
+
"--color-fuchsia-300": "oklch(83.3% 0.145 321.434)",
|
|
46176
|
+
"--color-fuchsia-400": "oklch(74% 0.238 322.16)",
|
|
46177
|
+
"--color-fuchsia-500": "oklch(66.7% 0.295 322.15)",
|
|
46178
|
+
"--color-fuchsia-600": "oklch(59.1% 0.293 322.896)",
|
|
46179
|
+
"--color-fuchsia-700": "oklch(51.8% 0.253 323.949)",
|
|
46180
|
+
"--color-fuchsia-800": "oklch(45.2% 0.211 324.591)",
|
|
46181
|
+
"--color-fuchsia-900": "oklch(40.1% 0.17 325.612)",
|
|
46182
|
+
"--color-fuchsia-950": "oklch(29.3% 0.136 325.661)",
|
|
46183
|
+
"--color-pink-50": "oklch(97.1% 0.014 343.198)",
|
|
46184
|
+
"--color-pink-100": "oklch(94.8% 0.028 342.258)",
|
|
46185
|
+
"--color-pink-200": "oklch(89.9% 0.061 343.231)",
|
|
46186
|
+
"--color-pink-300": "oklch(82.3% 0.12 346.018)",
|
|
46187
|
+
"--color-pink-400": "oklch(71.8% 0.202 349.761)",
|
|
46188
|
+
"--color-pink-500": "oklch(65.6% 0.241 354.308)",
|
|
46189
|
+
"--color-pink-600": "oklch(59.2% 0.249 0.584)",
|
|
46190
|
+
"--color-pink-700": "oklch(52.5% 0.223 3.958)",
|
|
46191
|
+
"--color-pink-800": "oklch(45.9% 0.187 3.815)",
|
|
46192
|
+
"--color-pink-900": "oklch(40.8% 0.153 2.432)",
|
|
46193
|
+
"--color-pink-950": "oklch(28.4% 0.109 3.907)",
|
|
46194
|
+
"--color-rose-50": "oklch(96.9% 0.015 12.422)",
|
|
46195
|
+
"--color-rose-100": "oklch(94.1% 0.03 12.58)",
|
|
46196
|
+
"--color-rose-200": "oklch(89.2% 0.058 10.001)",
|
|
46197
|
+
"--color-rose-300": "oklch(81% 0.117 11.638)",
|
|
46198
|
+
"--color-rose-400": "oklch(71.2% 0.194 13.428)",
|
|
46199
|
+
"--color-rose-500": "oklch(64.5% 0.246 16.439)",
|
|
46200
|
+
"--color-rose-600": "oklch(58.6% 0.253 17.585)",
|
|
46201
|
+
"--color-rose-700": "oklch(51.4% 0.222 16.935)",
|
|
46202
|
+
"--color-rose-800": "oklch(45.5% 0.188 13.697)",
|
|
46203
|
+
"--color-rose-900": "oklch(41% 0.159 10.272)",
|
|
46204
|
+
"--color-rose-950": "oklch(27.1% 0.105 12.094)",
|
|
46205
|
+
"--color-slate-50": "oklch(98.4% 0.003 247.858)",
|
|
46206
|
+
"--color-slate-100": "oklch(96.8% 0.007 247.896)",
|
|
46207
|
+
"--color-slate-200": "oklch(92.9% 0.013 255.508)",
|
|
46208
|
+
"--color-slate-300": "oklch(86.9% 0.022 252.894)",
|
|
46209
|
+
"--color-slate-400": "oklch(70.4% 0.04 256.788)",
|
|
46210
|
+
"--color-slate-500": "oklch(55.4% 0.046 257.417)",
|
|
46211
|
+
"--color-slate-600": "oklch(44.6% 0.043 257.281)",
|
|
46212
|
+
"--color-slate-700": "oklch(37.2% 0.044 257.287)",
|
|
46213
|
+
"--color-slate-800": "oklch(27.9% 0.041 260.031)",
|
|
46214
|
+
"--color-slate-900": "oklch(20.8% 0.042 265.755)",
|
|
46215
|
+
"--color-slate-950": "oklch(12.9% 0.042 264.695)",
|
|
46216
|
+
"--color-gray-50": "oklch(98.5% 0.002 247.839)",
|
|
46217
|
+
"--color-gray-100": "oklch(96.7% 0.003 264.542)",
|
|
46218
|
+
"--color-gray-200": "oklch(92.8% 0.006 264.531)",
|
|
46219
|
+
"--color-gray-300": "oklch(87.2% 0.01 258.338)",
|
|
46220
|
+
"--color-gray-400": "oklch(70.7% 0.022 261.325)",
|
|
46221
|
+
"--color-gray-500": "oklch(55.1% 0.027 264.364)",
|
|
46222
|
+
"--color-gray-600": "oklch(44.6% 0.03 256.802)",
|
|
46223
|
+
"--color-gray-700": "oklch(37.3% 0.034 259.733)",
|
|
46224
|
+
"--color-gray-800": "oklch(27.8% 0.033 256.848)",
|
|
46225
|
+
"--color-gray-900": "oklch(21% 0.034 264.665)",
|
|
46226
|
+
"--color-gray-950": "oklch(13% 0.028 261.692)",
|
|
46227
|
+
"--color-zinc-50": "oklch(98.5% 0 none)",
|
|
46228
|
+
"--color-zinc-100": "oklch(96.7% 0.001 286.375)",
|
|
46229
|
+
"--color-zinc-200": "oklch(92% 0.004 286.32)",
|
|
46230
|
+
"--color-zinc-300": "oklch(87.1% 0.006 286.286)",
|
|
46231
|
+
"--color-zinc-400": "oklch(70.5% 0.015 286.067)",
|
|
46232
|
+
"--color-zinc-500": "oklch(55.2% 0.016 285.938)",
|
|
46233
|
+
"--color-zinc-600": "oklch(44.2% 0.017 285.786)",
|
|
46234
|
+
"--color-zinc-700": "oklch(37% 0.013 285.805)",
|
|
46235
|
+
"--color-zinc-800": "oklch(27.4% 0.006 286.033)",
|
|
46236
|
+
"--color-zinc-900": "oklch(21% 0.006 285.885)",
|
|
46237
|
+
"--color-zinc-950": "oklch(14.1% 0.005 285.823)",
|
|
46238
|
+
"--color-neutral-50": "oklch(98.5% 0 none)",
|
|
46239
|
+
"--color-neutral-100": "oklch(97% 0 none)",
|
|
46240
|
+
"--color-neutral-200": "oklch(92.2% 0 none)",
|
|
46241
|
+
"--color-neutral-300": "oklch(87% 0 none)",
|
|
46242
|
+
"--color-neutral-400": "oklch(70.8% 0 none)",
|
|
46243
|
+
"--color-neutral-500": "oklch(55.6% 0 none)",
|
|
46244
|
+
"--color-neutral-600": "oklch(43.9% 0 none)",
|
|
46245
|
+
"--color-neutral-700": "oklch(37.1% 0 none)",
|
|
46246
|
+
"--color-neutral-800": "oklch(26.9% 0 none)",
|
|
46247
|
+
"--color-neutral-900": "oklch(20.5% 0 none)",
|
|
46248
|
+
"--color-neutral-950": "oklch(14.5% 0 none)",
|
|
46249
|
+
"--color-stone-50": "oklch(98.5% 0.001 106.423)",
|
|
46250
|
+
"--color-stone-100": "oklch(97% 0.001 106.424)",
|
|
46251
|
+
"--color-stone-200": "oklch(92.3% 0.003 48.717)",
|
|
46252
|
+
"--color-stone-300": "oklch(86.9% 0.005 56.366)",
|
|
46253
|
+
"--color-stone-400": "oklch(70.9% 0.01 56.259)",
|
|
46254
|
+
"--color-stone-500": "oklch(55.3% 0.013 58.071)",
|
|
46255
|
+
"--color-stone-600": "oklch(44.4% 0.011 73.639)",
|
|
46256
|
+
"--color-stone-700": "oklch(37.4% 0.01 67.558)",
|
|
46257
|
+
"--color-stone-800": "oklch(26.8% 0.007 34.298)",
|
|
46258
|
+
"--color-stone-900": "oklch(21.6% 0.006 56.043)",
|
|
46259
|
+
"--color-stone-950": "oklch(14.7% 0.004 49.25)",
|
|
46260
|
+
"--color-mauve-50": "oklch(98.5% 0 none)",
|
|
46261
|
+
"--color-mauve-100": "oklch(96% 0.003 325.6)",
|
|
46262
|
+
"--color-mauve-200": "oklch(92.2% 0.005 325.62)",
|
|
46263
|
+
"--color-mauve-300": "oklch(86.5% 0.012 325.68)",
|
|
46264
|
+
"--color-mauve-400": "oklch(71.1% 0.019 323.02)",
|
|
46265
|
+
"--color-mauve-500": "oklch(54.2% 0.034 322.5)",
|
|
46266
|
+
"--color-mauve-600": "oklch(43.5% 0.029 321.78)",
|
|
46267
|
+
"--color-mauve-700": "oklch(36.4% 0.029 323.89)",
|
|
46268
|
+
"--color-mauve-800": "oklch(26.3% 0.024 320.12)",
|
|
46269
|
+
"--color-mauve-900": "oklch(21.2% 0.019 322.12)",
|
|
46270
|
+
"--color-mauve-950": "oklch(14.5% 0.008 326)",
|
|
46271
|
+
"--color-olive-50": "oklch(98.8% 0.003 106.5)",
|
|
46272
|
+
"--color-olive-100": "oklch(96.6% 0.005 106.5)",
|
|
46273
|
+
"--color-olive-200": "oklch(93% 0.007 106.5)",
|
|
46274
|
+
"--color-olive-300": "oklch(88% 0.011 106.6)",
|
|
46275
|
+
"--color-olive-400": "oklch(73.7% 0.021 106.9)",
|
|
46276
|
+
"--color-olive-500": "oklch(58% 0.031 107.3)",
|
|
46277
|
+
"--color-olive-600": "oklch(46.6% 0.025 107.3)",
|
|
46278
|
+
"--color-olive-700": "oklch(39.4% 0.023 107.4)",
|
|
46279
|
+
"--color-olive-800": "oklch(28.6% 0.016 107.4)",
|
|
46280
|
+
"--color-olive-900": "oklch(22.8% 0.013 107.4)",
|
|
46281
|
+
"--color-olive-950": "oklch(15.3% 0.006 107.1)",
|
|
46282
|
+
"--color-mist-50": "oklch(98.7% 0.002 197.1)",
|
|
46283
|
+
"--color-mist-100": "oklch(96.3% 0.002 197.1)",
|
|
46284
|
+
"--color-mist-200": "oklch(92.5% 0.005 214.3)",
|
|
46285
|
+
"--color-mist-300": "oklch(87.2% 0.007 219.6)",
|
|
46286
|
+
"--color-mist-400": "oklch(72.3% 0.014 214.4)",
|
|
46287
|
+
"--color-mist-500": "oklch(56% 0.021 213.5)",
|
|
46288
|
+
"--color-mist-600": "oklch(45% 0.017 213.2)",
|
|
46289
|
+
"--color-mist-700": "oklch(37.8% 0.015 216)",
|
|
46290
|
+
"--color-mist-800": "oklch(27.5% 0.011 216.9)",
|
|
46291
|
+
"--color-mist-900": "oklch(21.8% 0.008 223.9)",
|
|
46292
|
+
"--color-mist-950": "oklch(14.8% 0.004 228.8)",
|
|
46293
|
+
"--color-taupe-50": "oklch(98.6% 0.002 67.8)",
|
|
46294
|
+
"--color-taupe-100": "oklch(96% 0.002 17.2)",
|
|
46295
|
+
"--color-taupe-200": "oklch(92.2% 0.005 34.3)",
|
|
46296
|
+
"--color-taupe-300": "oklch(86.8% 0.007 39.5)",
|
|
46297
|
+
"--color-taupe-400": "oklch(71.4% 0.014 41.2)",
|
|
46298
|
+
"--color-taupe-500": "oklch(54.7% 0.021 43.1)",
|
|
46299
|
+
"--color-taupe-600": "oklch(43.8% 0.017 39.3)",
|
|
46300
|
+
"--color-taupe-700": "oklch(36.7% 0.016 35.7)",
|
|
46301
|
+
"--color-taupe-800": "oklch(26.8% 0.011 36.5)",
|
|
46302
|
+
"--color-taupe-900": "oklch(21.4% 0.009 43.1)",
|
|
46303
|
+
"--color-taupe-950": "oklch(14.7% 0.004 49.3)",
|
|
46304
|
+
"--color-black": "#000",
|
|
46305
|
+
"--color-white": "#fff",
|
|
46306
|
+
"--text-xs": "0.75rem",
|
|
46307
|
+
"--text-xs--line-height": "calc(1 / 0.75)",
|
|
46308
|
+
"--text-sm": "0.875rem",
|
|
46309
|
+
"--text-sm--line-height": "calc(1.25 / 0.875)",
|
|
46310
|
+
"--text-base": "1rem",
|
|
46311
|
+
"--text-base--line-height": "calc(1.5 / 1)",
|
|
46312
|
+
"--text-lg": "1.125rem",
|
|
46313
|
+
"--text-lg--line-height": "calc(1.75 / 1.125)",
|
|
46314
|
+
"--text-xl": "1.25rem",
|
|
46315
|
+
"--text-xl--line-height": "calc(1.75 / 1.25)",
|
|
46316
|
+
"--text-2xl": "1.5rem",
|
|
46317
|
+
"--text-2xl--line-height": "calc(2 / 1.5)",
|
|
46318
|
+
"--text-3xl": "1.875rem",
|
|
46319
|
+
"--text-3xl--line-height": "calc(2.25 / 1.875)",
|
|
46320
|
+
"--text-4xl": "2.25rem",
|
|
46321
|
+
"--text-4xl--line-height": "calc(2.5 / 2.25)",
|
|
46322
|
+
"--text-5xl": "3rem",
|
|
46323
|
+
"--text-5xl--line-height": "1",
|
|
46324
|
+
"--text-6xl": "3.75rem",
|
|
46325
|
+
"--text-6xl--line-height": "1",
|
|
46326
|
+
"--text-7xl": "4.5rem",
|
|
46327
|
+
"--text-7xl--line-height": "1",
|
|
46328
|
+
"--text-8xl": "6rem",
|
|
46329
|
+
"--text-8xl--line-height": "1",
|
|
46330
|
+
"--text-9xl": "8rem",
|
|
46331
|
+
"--text-9xl--line-height": "1",
|
|
46332
|
+
"--font-weight-thin": "100",
|
|
46333
|
+
"--font-weight-extralight": "200",
|
|
46334
|
+
"--font-weight-light": "300",
|
|
46335
|
+
"--font-weight-normal": "400",
|
|
46336
|
+
"--font-weight-medium": "500",
|
|
46337
|
+
"--font-weight-semibold": "600",
|
|
46338
|
+
"--font-weight-bold": "700",
|
|
46339
|
+
"--font-weight-extrabold": "800",
|
|
46340
|
+
"--font-weight-black": "900",
|
|
46341
|
+
"--tracking-tighter": "-0.05em",
|
|
46342
|
+
"--tracking-tight": "-0.025em",
|
|
46343
|
+
"--tracking-normal": "0em",
|
|
46344
|
+
"--tracking-wide": "0.025em",
|
|
46345
|
+
"--tracking-wider": "0.05em",
|
|
46346
|
+
"--tracking-widest": "0.1em",
|
|
46347
|
+
"--text-shadow-2xs": "0px 1px 0px rgb(0 0 0 / 0.15)",
|
|
46348
|
+
"--text-shadow-xs": "0px 1px 1px rgb(0 0 0 / 0.2)",
|
|
46349
|
+
"--text-shadow-sm": "0px 1px 0px rgb(0 0 0 / 0.075), 0px 1px 1px rgb(0 0 0 / 0.075), 0px 2px 2px rgb(0 0 0 / 0.075)",
|
|
46350
|
+
"--text-shadow-md": "0px 1px 1px rgb(0 0 0 / 0.1), 0px 1px 2px rgb(0 0 0 / 0.1), 0px 2px 4px rgb(0 0 0 / 0.1)",
|
|
46351
|
+
"--text-shadow-lg": "0px 1px 2px rgb(0 0 0 / 0.1), 0px 3px 2px rgb(0 0 0 / 0.1), 0px 4px 8px rgb(0 0 0 / 0.1)"
|
|
46352
|
+
};
|
|
46353
|
+
|
|
46354
|
+
// src/tools/project.ts
|
|
44768
46355
|
var TEXT_PROPS = /^(font(-[\w-]+)?|line-height|letter-spacing|text-transform|text-decoration[\w-]*|color|-webkit-font-smoothing|-moz-osx-font-smoothing|text-rendering)$/;
|
|
44769
46356
|
var SKIP_DIRS = /* @__PURE__ */ new Set([
|
|
44770
46357
|
"node_modules",
|
|
@@ -44792,26 +46379,33 @@ var MAX_ENTRIES = 3e4;
|
|
|
44792
46379
|
var MAX_MS = 2e3;
|
|
44793
46380
|
var MAX_STYLES = 600;
|
|
44794
46381
|
var MAX_SVGS = 3e3;
|
|
46382
|
+
var MAX_CODE = 4e3;
|
|
44795
46383
|
async function scanProject(root, exclude = [], maxEntries = MAX_ENTRIES) {
|
|
44796
|
-
root =
|
|
44797
|
-
if (root ===
|
|
44798
|
-
const skip = [...new Set(exclude.map((e) =>
|
|
46384
|
+
root = path3.resolve(root);
|
|
46385
|
+
if (root === path3.parse(root).root || root === os2.homedir()) return void 0;
|
|
46386
|
+
const skip = [...new Set(exclude.map((e) => path3.resolve(e)))];
|
|
44799
46387
|
const styles = [];
|
|
44800
46388
|
const svgs = [];
|
|
44801
46389
|
const comps = [];
|
|
44802
|
-
const
|
|
46390
|
+
const manifests = [];
|
|
46391
|
+
const elixir = [];
|
|
46392
|
+
const twConfigs = [];
|
|
46393
|
+
const shown = (p) => path3.relative(process.cwd(), p).split(path3.sep).join("/");
|
|
44803
46394
|
let incomplete;
|
|
44804
46395
|
const sort = (p) => {
|
|
44805
|
-
const name =
|
|
46396
|
+
const name = path3.basename(p);
|
|
44806
46397
|
if (STYLE.test(name)) styles.push(p);
|
|
44807
46398
|
else if (/\.svg$/i.test(name)) svgs.push(p);
|
|
44808
46399
|
else if (COMPONENT_FILE.test(name)) comps.push(p);
|
|
46400
|
+
else if (name === "package.json" || name === "mix.exs") manifests.push(p);
|
|
46401
|
+
else if (name.endsWith(".ex")) elixir.push(p);
|
|
46402
|
+
else if (/^tailwind\.config\.(js|cjs|mjs|ts)$/.test(name)) twConfigs.push(p);
|
|
44809
46403
|
};
|
|
44810
|
-
const skipped = (p) => skip.some((s) => p === s || p.startsWith(s +
|
|
46404
|
+
const skipped = (p) => skip.some((s) => p === s || p.startsWith(s + path3.sep));
|
|
44811
46405
|
const tracked = await gitFiles(root);
|
|
44812
46406
|
if (tracked?.length) {
|
|
44813
46407
|
for (const p of tracked) {
|
|
44814
|
-
const dirs =
|
|
46408
|
+
const dirs = path3.relative(root, p).split(path3.sep).slice(0, -1);
|
|
44815
46409
|
if (!dirs.some((d) => d.startsWith(".") || SKIP_DIRS.has(d)) && !skipped(p)) sort(p);
|
|
44816
46410
|
}
|
|
44817
46411
|
} else {
|
|
@@ -44825,14 +46419,14 @@ async function scanProject(root, exclude = [], maxEntries = MAX_ENTRIES) {
|
|
|
44825
46419
|
}
|
|
44826
46420
|
let list;
|
|
44827
46421
|
try {
|
|
44828
|
-
list = await
|
|
46422
|
+
list = await readdir2(dir, { withFileTypes: true });
|
|
44829
46423
|
} catch {
|
|
44830
46424
|
return;
|
|
44831
46425
|
}
|
|
44832
46426
|
entries += list.length;
|
|
44833
46427
|
list.sort((a, b) => a.name < b.name ? -1 : a.name > b.name ? 1 : 0);
|
|
44834
46428
|
for (const e of list) {
|
|
44835
|
-
const p =
|
|
46429
|
+
const p = path3.join(dir, e.name);
|
|
44836
46430
|
if (e.isDirectory()) {
|
|
44837
46431
|
if (!e.name.startsWith(".") && !SKIP_DIRS.has(e.name) && !skipped(p)) await walk(p, depth + 1);
|
|
44838
46432
|
} else if (e.isFile()) sort(p);
|
|
@@ -44850,17 +46444,25 @@ async function scanProject(root, exclude = [], maxEntries = MAX_ENTRIES) {
|
|
|
44850
46444
|
};
|
|
44851
46445
|
const vars = /* @__PURE__ */ new Map();
|
|
44852
46446
|
const classes = /* @__PURE__ */ new Map();
|
|
46447
|
+
let tailwind = false;
|
|
46448
|
+
const theme = /* @__PURE__ */ new Set();
|
|
46449
|
+
const resets = [];
|
|
44853
46450
|
for (const f of styles.slice(0, MAX_STYLES)) {
|
|
44854
46451
|
const css = await readText(f, 1e6);
|
|
44855
46452
|
if (!css) continue;
|
|
44856
46453
|
const text2 = css.replace(/\/\*[\s\S]*?\*\//g, "").replace(/^\s*\/\/.*$/gm, "");
|
|
46454
|
+
if (/@import\s+(?:url\(\s*)?["']tailwindcss(?:\/[\w-]+\.css)?["']|@theme\b/.test(text2)) tailwind = true;
|
|
46455
|
+
for (const block of themeBlocks(text2)) {
|
|
46456
|
+
for (const m of block.matchAll(/(?<=(?:^|[{;])\s*)(--[\w-]+)\s*:/g)) theme.add(m[1]);
|
|
46457
|
+
for (const m of block.matchAll(/(--[\w-]*)\*\s*:\s*initial/g)) resets.push(m[1]);
|
|
46458
|
+
}
|
|
44857
46459
|
const define = (re) => {
|
|
44858
46460
|
for (const m of text2.matchAll(re)) if (!vars.has(m[1])) vars.set(m[1], m[2].trim());
|
|
44859
46461
|
};
|
|
44860
46462
|
define(/(?<=(?:^|[{;])\s*)(--[\w-]+)\s*:\s*([^;{}]+)/g);
|
|
44861
46463
|
if (/\.(scss|sass)$/i.test(f)) define(/^\s*(\$[\w-]+)\s*:\s*([^;\n]+)/gm);
|
|
44862
46464
|
if (/\.less$/i.test(f)) define(/^\s*(@[\w-]+)\s*:\s*([^;\n]+)/gm);
|
|
44863
|
-
const stem = slug2(
|
|
46465
|
+
const stem = slug2(path3.basename(f).replace(/\.[^.]+$/, ""));
|
|
44864
46466
|
for (const m of text2.matchAll(/(?<=^|[{};])\s*\.(-?[_a-zA-Z][\w-]*)\s*\{([^{}]*)\}/g)) {
|
|
44865
46467
|
if (!/__|--/.test(m[1])) rules.push({ cls: m[1], decls: m[2], file: shown(f) });
|
|
44866
46468
|
}
|
|
@@ -44871,12 +46473,28 @@ async function scanProject(root, exclude = [], maxEntries = MAX_ENTRIES) {
|
|
|
44871
46473
|
}
|
|
44872
46474
|
}
|
|
44873
46475
|
}
|
|
46476
|
+
const defaults = /* @__PURE__ */ new Set();
|
|
46477
|
+
if (tailwind) {
|
|
46478
|
+
for (const [k, v] of Object.entries(TAILWIND_THEME)) {
|
|
46479
|
+
if (vars.has(k) || resets.some((r) => k.startsWith(r) && !(r === "--font-" && k.startsWith("--font-weight-")))) continue;
|
|
46480
|
+
vars.set(k, v);
|
|
46481
|
+
theme.add(k);
|
|
46482
|
+
defaults.add(k);
|
|
46483
|
+
}
|
|
46484
|
+
}
|
|
46485
|
+
const utility = (name) => {
|
|
46486
|
+
if (!theme.has(name)) return void 0;
|
|
46487
|
+
const m = /^--(color|font)-([\w-]+)$/.exec(name);
|
|
46488
|
+
if (!m || m[1] === "font" && m[2].startsWith("weight-")) return void 0;
|
|
46489
|
+
return m[1] === "color" ? `*-${m[2]}` : `font-${m[2]}`;
|
|
46490
|
+
};
|
|
44874
46491
|
const ref = (name, wrap) => {
|
|
46492
|
+
const u = utility(name);
|
|
46493
|
+
if (u) return u;
|
|
44875
46494
|
const r = name.startsWith("--") ? `var(${name})` : name;
|
|
44876
46495
|
return wrap ? `${wrap}(${r})` : r;
|
|
44877
46496
|
};
|
|
44878
|
-
const
|
|
44879
|
-
for (const [name, value] of vars) {
|
|
46497
|
+
const resolve = (value) => {
|
|
44880
46498
|
let v = value;
|
|
44881
46499
|
let alias = false;
|
|
44882
46500
|
for (let hops = 0; hops < 5; hops++) {
|
|
@@ -44886,19 +46504,48 @@ async function scanProject(root, exclude = [], maxEntries = MAX_ENTRIES) {
|
|
|
44886
46504
|
v = next;
|
|
44887
46505
|
alias = true;
|
|
44888
46506
|
}
|
|
44889
|
-
|
|
44890
|
-
}
|
|
44891
|
-
|
|
44892
|
-
|
|
44893
|
-
|
|
44894
|
-
|
|
44895
|
-
|
|
44896
|
-
|
|
44897
|
-
|
|
44898
|
-
|
|
44899
|
-
|
|
44900
|
-
|
|
44901
|
-
|
|
46507
|
+
return { v, alias };
|
|
46508
|
+
};
|
|
46509
|
+
if (twConfigs.length) {
|
|
46510
|
+
const channel = (name) => resolve(vars.get(name) ?? "").v || void 0;
|
|
46511
|
+
const replaced = /* @__PURE__ */ new Set();
|
|
46512
|
+
const own2 = [];
|
|
46513
|
+
for (const f of twConfigs.slice(0, 8)) {
|
|
46514
|
+
const src = await readText(f, 2e5);
|
|
46515
|
+
if (!src) continue;
|
|
46516
|
+
const c = tailwindConfigTheme(src, channel);
|
|
46517
|
+
c.replaced.forEach((p) => replaced.add(p));
|
|
46518
|
+
own2.push(...c.vars);
|
|
46519
|
+
}
|
|
46520
|
+
const add2 = (k, v, isDefault) => {
|
|
46521
|
+
if (vars.has(k)) return;
|
|
46522
|
+
vars.set(k, v);
|
|
46523
|
+
theme.add(k);
|
|
46524
|
+
if (isDefault) defaults.add(k);
|
|
46525
|
+
};
|
|
46526
|
+
for (const [k, v] of own2) add2(k, v, false);
|
|
46527
|
+
if (!tailwind) for (const [k, v] of tailwindV3Defaults(replaced)) add2(k, v, true);
|
|
46528
|
+
tailwind = true;
|
|
46529
|
+
}
|
|
46530
|
+
const ranked = [];
|
|
46531
|
+
for (const [name, value] of vars) {
|
|
46532
|
+
const { v, alias } = resolve(value);
|
|
46533
|
+
const rank2 = defaults.has(name) ? 3 : utility(name) ? 0 : alias ? 1 : 2;
|
|
46534
|
+
ranked.push({ name, v, rank: rank2 });
|
|
46535
|
+
}
|
|
46536
|
+
ranked.sort((a, b) => a.rank - b.rank);
|
|
46537
|
+
for (const { name, v } of ranked) {
|
|
46538
|
+
const c = parseColor(v);
|
|
46539
|
+
if (c) add(idx.colors, c.hex, ref(name, c.wrap));
|
|
46540
|
+
else if (/font|family|typeface/i.test(name) && !/^--(font-weight|text)-/.test(name)) {
|
|
46541
|
+
const fam = firstFamily(v);
|
|
46542
|
+
if (fam && !/^\d|^var\(/.test(fam)) add(idx.fonts, fam, ref(name));
|
|
46543
|
+
}
|
|
46544
|
+
}
|
|
46545
|
+
if (tailwind) idx.tailwind = tailwindTheme(theme, defaults, (name) => {
|
|
46546
|
+
const raw = vars.get(name);
|
|
46547
|
+
return raw === void 0 ? void 0 : resolve(raw).v;
|
|
46548
|
+
});
|
|
44902
46549
|
const family = (v) => {
|
|
44903
46550
|
let x = v?.trim();
|
|
44904
46551
|
for (let hops = 0; x && hops < 5; hops++) {
|
|
@@ -44920,16 +46567,31 @@ async function scanProject(root, exclude = [], maxEntries = MAX_ENTRIES) {
|
|
|
44920
46567
|
list.push({ file: shown(f), nums: s.nums });
|
|
44921
46568
|
idx.icons.set(s.key, list);
|
|
44922
46569
|
}
|
|
44923
|
-
|
|
44924
|
-
|
|
44925
|
-
|
|
44926
|
-
if (
|
|
44927
|
-
|
|
46570
|
+
const ownIcons = [];
|
|
46571
|
+
for (const [k, f] of comps.entries()) {
|
|
46572
|
+
let stem = path3.basename(f).replace(/\.[^.]+$/, "");
|
|
46573
|
+
if (/^index$/i.test(stem)) stem = path3.basename(path3.dirname(f));
|
|
46574
|
+
if (/\.(test|spec|stories|story)$/i.test(stem)) continue;
|
|
46575
|
+
const text2 = /\.(tsx|jsx)$/i.test(f) && k < MAX_CODE ? await readText(f, 2e5) : void 0;
|
|
46576
|
+
const found = text2 ? reactComponents(text2) : [];
|
|
46577
|
+
if (text2) ownIcons.push(...codeIcons(text2, shown(f)));
|
|
46578
|
+
for (const c of found) add(idx.components, slug2(c.name), `${c.api} (${shown(f)})`);
|
|
46579
|
+
if (!found.some((c) => slug2(c.name) === slug2(stem)) && !NOT_COMPONENT.test(stem)) add(idx.components, slug2(stem), shown(f));
|
|
46580
|
+
}
|
|
46581
|
+
for (const f of elixir.filter((f2) => !/(^|[/\\])test[/\\]/.test(path3.relative(root, f2))).slice(0, MAX_CODE)) {
|
|
46582
|
+
const text2 = await readText(f, 4e5);
|
|
46583
|
+
if (text2) ownIcons.push(...codeIcons(text2, shown(f), true));
|
|
46584
|
+
if (!text2 || !/^\s*(attr|slot)\s+:/m.test(text2)) continue;
|
|
46585
|
+
for (const c of phoenixComponents(text2)) add(idx.components, slug2(c.name), `${c.api} (${shown(f)})`);
|
|
44928
46586
|
}
|
|
44929
46587
|
for (const [c, f] of classes) add(idx.components, c.toLowerCase(), `.${c} (${f})`);
|
|
46588
|
+
const rank = (ref2) => /components?[/\\]ui[/\\]|core_components|_ui[/\\]|[/\\]components[/\\]/.test(ref2) ? 0 : /mail|email|stories|example/i.test(ref2) ? 2 : 1;
|
|
46589
|
+
for (const list of idx.components.values()) list.sort((a, b) => rank(a) - rank(b));
|
|
46590
|
+
const libs = await iconLibraries(root, manifests, ownIcons).catch(() => []);
|
|
46591
|
+
if (libs.length) idx.iconLibs = libs;
|
|
44930
46592
|
if (svgs.length > MAX_SVGS) incomplete ??= `read only the first ${MAX_SVGS} of ${svgs.length} SVG files`;
|
|
44931
46593
|
if (incomplete) idx.incomplete = `project scan of ${shown(root) || "."} ${incomplete}`;
|
|
44932
|
-
const empty = !idx.colors.size && !idx.fonts.size && !idx.icons.size && !idx.components.size && !idx.textStyles.length;
|
|
46594
|
+
const empty = !idx.colors.size && !idx.fonts.size && !idx.icons.size && !idx.components.size && !idx.textStyles.length && !idx.tailwind?.text.length && !idx.iconLibs;
|
|
44933
46595
|
return empty && !incomplete ? void 0 : idx;
|
|
44934
46596
|
}
|
|
44935
46597
|
async function gitFiles(root) {
|
|
@@ -44939,7 +46601,7 @@ async function gitFiles(root) {
|
|
|
44939
46601
|
maxBuffer: 256 * 1024 * 1024,
|
|
44940
46602
|
timeout: 1e4
|
|
44941
46603
|
});
|
|
44942
|
-
return stdout.split("\0").filter(Boolean).map((f) =>
|
|
46604
|
+
return stdout.split("\0").filter(Boolean).map((f) => path3.join(root, f));
|
|
44943
46605
|
} catch {
|
|
44944
46606
|
return void 0;
|
|
44945
46607
|
}
|
|
@@ -44951,12 +46613,77 @@ function withScanNote(text2, idx) {
|
|
|
44951
46613
|
## project scan incomplete
|
|
44952
46614
|
${idx.incomplete}: a colour, font, icon or component without a project match may still exist, so search the code before adding a copy`;
|
|
44953
46615
|
}
|
|
46616
|
+
function themeBlocks(css) {
|
|
46617
|
+
const out = [];
|
|
46618
|
+
for (const m of css.matchAll(/@(?:theme|plugin)\b[^{;]*\{/g)) {
|
|
46619
|
+
let depth = 1;
|
|
46620
|
+
let i = m.index + m[0].length;
|
|
46621
|
+
const start = i;
|
|
46622
|
+
for (; i < css.length && depth; i++) {
|
|
46623
|
+
if (css[i] === "{") depth++;
|
|
46624
|
+
else if (css[i] === "}") depth--;
|
|
46625
|
+
}
|
|
46626
|
+
out.push(css.slice(start, i - 1));
|
|
46627
|
+
}
|
|
46628
|
+
return out;
|
|
46629
|
+
}
|
|
46630
|
+
function lineHeightPx(v, size) {
|
|
46631
|
+
const c = /^calc\(\s*([\d.]+)\s*\/\s*([\d.]+)\s*\)$/.exec(v.trim());
|
|
46632
|
+
return c ? parseFloat(c[1]) / parseFloat(c[2]) * size : px(v, size);
|
|
46633
|
+
}
|
|
46634
|
+
function tailwindTheme(theme, defaults, value) {
|
|
46635
|
+
const out = { text: [], weights: /* @__PURE__ */ new Map(), tracking: /* @__PURE__ */ new Map() };
|
|
46636
|
+
for (const name of theme) {
|
|
46637
|
+
const v = value(name);
|
|
46638
|
+
if (v === void 0) continue;
|
|
46639
|
+
let m;
|
|
46640
|
+
if (m = /^--font-weight-([\w-]+)$/.exec(name)) {
|
|
46641
|
+
const w = parseInt(v, 10);
|
|
46642
|
+
if (w && !out.weights.has(w)) out.weights.set(w, m[1]);
|
|
46643
|
+
} else if (m = /^--tracking-([\w-]+)$/.exec(name)) {
|
|
46644
|
+
const em = /^(-?[\d.]+)em$/.exec(v.trim());
|
|
46645
|
+
if (em && !out.tracking.has(parseFloat(em[1]))) out.tracking.set(parseFloat(em[1]), m[1]);
|
|
46646
|
+
} else if ((m = /^--text-([\w-]+)$/.exec(name)) && !m[1].includes("--")) {
|
|
46647
|
+
const size = /[a-z%]$/i.test(v.trim()) ? px(v, 16) : void 0;
|
|
46648
|
+
if (!size) continue;
|
|
46649
|
+
const lh = value(`${name}--line-height`);
|
|
46650
|
+
const fw = value(`${name}--font-weight`);
|
|
46651
|
+
const ls = value(`${name}--letter-spacing`);
|
|
46652
|
+
out.text.push({
|
|
46653
|
+
cls: `text-${m[1]}`,
|
|
46654
|
+
size,
|
|
46655
|
+
lineHeight: lh === void 0 ? void 0 : lineHeightPx(lh, size),
|
|
46656
|
+
weight: fw === void 0 ? void 0 : parseInt(fw, 10) || void 0,
|
|
46657
|
+
letterSpacing: ls === void 0 ? void 0 : px(ls, size),
|
|
46658
|
+
own: !defaults.has(name)
|
|
46659
|
+
});
|
|
46660
|
+
}
|
|
46661
|
+
}
|
|
46662
|
+
return out;
|
|
46663
|
+
}
|
|
46664
|
+
var num = (x) => String(+x.toFixed(2));
|
|
46665
|
+
function tailwindText(tw, t) {
|
|
46666
|
+
const sized = tw.text.filter((x) => Math.abs(x.size - t.size) <= 0.01);
|
|
46667
|
+
const own2 = sized.filter((x) => x.own);
|
|
46668
|
+
return (own2.length ? own2 : sized).map((x) => {
|
|
46669
|
+
const parts = [x.cls];
|
|
46670
|
+
if ((x.weight ?? 400) !== t.weight) parts.push(`font-${tw.weights.get(t.weight) ?? `[${t.weight}]`}`);
|
|
46671
|
+
if (t.italic) parts.push("italic");
|
|
46672
|
+
if (t.lh !== void 0 && (x.lineHeight === void 0 || Math.abs(x.lineHeight - t.lh) > 0.5)) parts.push(`leading-[${num(t.lh)}px]`);
|
|
46673
|
+
if (Math.abs((x.letterSpacing ?? 0) - t.ls) > 0.05) {
|
|
46674
|
+
const named = [...tw.tracking].find(([em]) => Math.abs(em * t.size - t.ls) <= 0.05);
|
|
46675
|
+
parts.push(named ? `tracking-${named[1]}` : `tracking-[${t.lsText ?? `${num(t.ls)}px`}]`);
|
|
46676
|
+
}
|
|
46677
|
+
if (t.transform !== "none") parts.push(t.transform);
|
|
46678
|
+
return parts.join(" ");
|
|
46679
|
+
});
|
|
46680
|
+
}
|
|
44954
46681
|
function firstFamily(stack) {
|
|
44955
46682
|
return stack.split(",")[0].trim().replace(/^["']|["']$/g, "").toLowerCase();
|
|
44956
46683
|
}
|
|
44957
46684
|
async function readText(file2, max) {
|
|
44958
46685
|
try {
|
|
44959
|
-
const buf = await
|
|
46686
|
+
const buf = await readFile3(file2);
|
|
44960
46687
|
return buf.length > max ? void 0 : buf.toString("utf8");
|
|
44961
46688
|
} catch {
|
|
44962
46689
|
return void 0;
|
|
@@ -45058,7 +46785,8 @@ function textRefs(idx, spec) {
|
|
|
45058
46785
|
const ls = lsm ? lsm[2] === "em" ? parseFloat(lsm[1]) * size : parseFloat(lsm[1]) : 0;
|
|
45059
46786
|
const transform2 = /\b(uppercase|lowercase|capitalize)\b/.exec(g.rest)?.[1] ?? "none";
|
|
45060
46787
|
const fam = g.family.toLowerCase();
|
|
45061
|
-
|
|
46788
|
+
const tw = idx.tailwind ? tailwindText(idx.tailwind, { size, weight: Number(g.weight), italic: !!g.italic, lh, ls, lsText: lsm ? `${lsm[1]}${lsm[2]}` : void 0, transform: transform2 }) : [];
|
|
46789
|
+
const classes = idx.textStyles.filter((t) => {
|
|
45062
46790
|
if (t.size !== size && Math.abs(t.size - size) > 0.01) return false;
|
|
45063
46791
|
if (t.weight !== Number(g.weight) || t.italic !== !!g.italic || t.transform !== transform2) return false;
|
|
45064
46792
|
if (Math.abs(t.letterSpacing - ls) > 0.05) return false;
|
|
@@ -45066,7 +46794,8 @@ function textRefs(idx, spec) {
|
|
|
45066
46794
|
if (t.lineHeight === "normal") return g.lh === "normal";
|
|
45067
46795
|
if (lh === void 0) return true;
|
|
45068
46796
|
return typeof t.lineHeight === "number" && Math.abs(t.lineHeight - lh) <= 0.5;
|
|
45069
|
-
}).map((t) => t.ref)
|
|
46797
|
+
}).map((t) => t.ref);
|
|
46798
|
+
return [...classes, ...tw].slice(0, 3);
|
|
45070
46799
|
}
|
|
45071
46800
|
var hex23 = (v) => Math.round(Math.max(0, Math.min(255, v))).toString(16).padStart(2, "0");
|
|
45072
46801
|
function normHex(h) {
|
|
@@ -45128,28 +46857,28 @@ function parseColor(value) {
|
|
|
45128
46857
|
function shapeOf(svg) {
|
|
45129
46858
|
const rootTag = /<svg\b[^>]*>/i.exec(svg)?.[0];
|
|
45130
46859
|
if (!rootTag) return void 0;
|
|
45131
|
-
const root =
|
|
46860
|
+
const root = attrs2(rootTag);
|
|
45132
46861
|
const vb = (root.viewBox ?? `0 0 ${parseFloat(root.width ?? "")} ${parseFloat(root.height ?? "")}`).split(/[\s,]+/).map(Number);
|
|
45133
46862
|
const [vx, vy, vw, vh] = vb;
|
|
45134
46863
|
if (vb.length !== 4 || !(vw > 0) || !(vh > 0)) return void 0;
|
|
45135
46864
|
const body = svg.replace(/<(mask|clipPath|defs|title|desc)\b[\s\S]*?<\/\1>/gi, "");
|
|
45136
46865
|
const scaled = { x: (v) => (v - vx) / vw, y: (v) => (v - vy) / vh, s: (v) => v / vw, r: (v) => v };
|
|
45137
|
-
const
|
|
46866
|
+
const keys2 = [];
|
|
45138
46867
|
const nums = [];
|
|
45139
46868
|
for (const m of body.matchAll(/<(path|rect|circle|ellipse|line|polyline|polygon)\b([^>]*)>/gi)) {
|
|
45140
|
-
const a =
|
|
46869
|
+
const a = attrs2(m[2]);
|
|
45141
46870
|
const fill = a.fill ?? root.fill ?? "black";
|
|
45142
46871
|
const stroke = a.stroke ?? root.stroke ?? "none";
|
|
45143
46872
|
if ((fill === "none" || fill === "transparent") && (stroke === "none" || stroke === "transparent")) continue;
|
|
45144
46873
|
if (a.opacity === "0" || a.visibility === "hidden" || a.display === "none") continue;
|
|
45145
46874
|
const g = geometry(m[1].toLowerCase(), a);
|
|
45146
46875
|
if (!g) return void 0;
|
|
45147
|
-
|
|
46876
|
+
keys2.push(g.key);
|
|
45148
46877
|
for (const [v, axis] of g.vals) nums.push(scaled[axis](v));
|
|
45149
46878
|
}
|
|
45150
|
-
return
|
|
46879
|
+
return keys2.length ? { key: keys2.join("|"), nums } : void 0;
|
|
45151
46880
|
}
|
|
45152
|
-
function
|
|
46881
|
+
function attrs2(tag) {
|
|
45153
46882
|
const out = {};
|
|
45154
46883
|
for (const m of tag.matchAll(/([\w:-]+)\s*=\s*("([^"]*)"|'([^']*)')/g)) out[m[1]] = m[3] ?? m[4] ?? "";
|
|
45155
46884
|
for (const d of (out.style ?? "").split(";")) {
|
|
@@ -45179,7 +46908,7 @@ function geometry(tag, a) {
|
|
|
45179
46908
|
}
|
|
45180
46909
|
}
|
|
45181
46910
|
}
|
|
45182
|
-
var
|
|
46911
|
+
var ARGS2 = { M: 2, L: 2, H: 1, V: 1, C: 6, S: 4, Q: 4, T: 2, A: 7, Z: 0 };
|
|
45183
46912
|
function absolutePath(d) {
|
|
45184
46913
|
const NUM = /[\s,]*(-?(?:\d+\.?\d*|\.\d+)(?:[eE][-+]?\d+)?)/y;
|
|
45185
46914
|
const FLAG = /[\s,]*([01])/y;
|
|
@@ -45214,7 +46943,7 @@ function absolutePath(d) {
|
|
|
45214
46943
|
continue;
|
|
45215
46944
|
}
|
|
45216
46945
|
const n2 = [];
|
|
45217
|
-
for (let k = 0; k <
|
|
46946
|
+
for (let k = 0; k < ARGS2[up]; k++) {
|
|
45218
46947
|
const s = up === "A" && (k === 3 || k === 4) ? read(FLAG) : read(NUM);
|
|
45219
46948
|
if (s === void 0) return k === 0 && !c && atEnd() ? { key, vals } : void 0;
|
|
45220
46949
|
n2.push(Number(s));
|
|
@@ -45625,9 +47354,9 @@ async function screenshot(bridge, ids, file2, opts) {
|
|
|
45625
47354
|
const raster = decodePng(buf);
|
|
45626
47355
|
if (opts.saveTo) {
|
|
45627
47356
|
const target = ids.length > 1 || head.roots.length > 1 ? withSuffix(opts.saveTo, slug(root.name) || root.id) : opts.saveTo;
|
|
45628
|
-
await mkdir2(
|
|
47357
|
+
await mkdir2(path4.dirname(path4.resolve(target)), { recursive: true });
|
|
45629
47358
|
await writeFile2(target, buf);
|
|
45630
|
-
lines.push(`saved ${
|
|
47359
|
+
lines.push(`saved ${path4.resolve(target)} (${raster.width}\xD7${raster.height}px)`);
|
|
45631
47360
|
}
|
|
45632
47361
|
const parts = tiles(raster);
|
|
45633
47362
|
const visionScale = scale * parts[0].scale;
|
|
@@ -45641,8 +47370,8 @@ async function screenshot(bridge, ids, file2, opts) {
|
|
|
45641
47370
|
return { text: lines.join("\n"), images };
|
|
45642
47371
|
}
|
|
45643
47372
|
function withSuffix(file2, suffix) {
|
|
45644
|
-
const ext =
|
|
45645
|
-
return `${file2.slice(0, file2.length -
|
|
47373
|
+
const ext = path4.extname(file2) || ".png";
|
|
47374
|
+
return `${file2.slice(0, file2.length - path4.extname(file2).length)}-${suffix}${ext}`;
|
|
45646
47375
|
}
|
|
45647
47376
|
var VAGUE_NAME = /^(container|wrapper|content|inner|box|div|layer)(\s+\d+)?$/i;
|
|
45648
47377
|
var VARIANT_NAME = /^[^=,]+=[^=,]*(,\s*[^=,]+=[^=,]*)*$/;
|
|
@@ -45716,7 +47445,7 @@ function fileNamer() {
|
|
|
45716
47445
|
}
|
|
45717
47446
|
async function exportAssets(bridge, ids, file2, opts) {
|
|
45718
47447
|
if (opts.as !== "auto") {
|
|
45719
|
-
const dir =
|
|
47448
|
+
const dir = path4.resolve(opts.dir);
|
|
45720
47449
|
await mkdir2(dir, { recursive: true });
|
|
45721
47450
|
const fileName = fileNamer();
|
|
45722
47451
|
const lines = [];
|
|
@@ -45725,7 +47454,7 @@ async function exportAssets(bridge, ids, file2, opts) {
|
|
|
45725
47454
|
for (const b of res2.blobs) {
|
|
45726
47455
|
const name = fileName(b.name, opts.as);
|
|
45727
47456
|
const data = b.encoding === "utf8" ? opts.currentColor ? toCurrentColor(b.data) : b.data : Buffer.from(b.data, "base64");
|
|
45728
|
-
await writeFile2(
|
|
47457
|
+
await writeFile2(path4.join(dir, name), data);
|
|
45729
47458
|
lines.push(`${name} \u2190 "${b.name}" #${b.id} ${n(b.w)}\xD7${n(b.h)}${opts.as === "png" ? ` @${opts.scale ?? 2}x` : ""}`);
|
|
45730
47459
|
}
|
|
45731
47460
|
for (const e of res2.errors) lines.push(`failed #${e.id}: ${e.error}`);
|
|
@@ -45739,10 +47468,10 @@ async function exportAssets(bridge, ids, file2, opts) {
|
|
|
45739
47468
|
return res.report;
|
|
45740
47469
|
}
|
|
45741
47470
|
async function writeAssets(bridge, snap, file2, opts) {
|
|
45742
|
-
const dir =
|
|
47471
|
+
const dir = path4.resolve(opts.dir);
|
|
45743
47472
|
await mkdir2(dir, { recursive: true });
|
|
45744
47473
|
const fileName = fileNamer();
|
|
45745
|
-
const rel = (name) =>
|
|
47474
|
+
const rel = (name) => path4.join(opts.dir, name).split(path4.sep).join("/");
|
|
45746
47475
|
const lines = [];
|
|
45747
47476
|
const failures = [];
|
|
45748
47477
|
const fail2 = (line) => {
|
|
@@ -45778,13 +47507,14 @@ async function writeAssets(bridge, snap, file2, opts) {
|
|
|
45778
47507
|
continue;
|
|
45779
47508
|
}
|
|
45780
47509
|
const own3 = opts.project && iconFile(opts.project, svg);
|
|
45781
|
-
const
|
|
45782
|
-
|
|
45783
|
-
|
|
47510
|
+
const lib = !own3 && opts.project?.iconLibs ? (await matchLibraryIcon(opts.project.iconLibs, svg, g.name))?.usage : void 0;
|
|
47511
|
+
const name = own3 || lib || fileName(g.base, "svg");
|
|
47512
|
+
if (own3 || lib) reused.add(name);
|
|
47513
|
+
else await writeFile2(path4.join(dir, name), svg);
|
|
45784
47514
|
written.set(key, { name, line: lines.length, uses: 1, component: g.component, also: [] });
|
|
45785
|
-
byNode.set(g.nodeId, own3 || rel(name));
|
|
47515
|
+
byNode.set(g.nodeId, own3 || lib || rel(name));
|
|
45786
47516
|
if (g.sig) bySig.set(g.sig, name);
|
|
45787
|
-
lines.push(`${name} \u2190 svg "${g.name}" #${g.nodeId} ${n(b.w)}\xD7${n(b.h)}${own3 ? " (the project's own icon: not written)" : ""}`);
|
|
47517
|
+
lines.push(`${name} \u2190 svg "${g.name}" #${g.nodeId} ${n(b.w)}\xD7${n(b.h)}${own3 ? " (the project's own icon: not written)" : lib ? " (from the project's icon library: not written)" : ""}`);
|
|
45788
47518
|
}
|
|
45789
47519
|
}
|
|
45790
47520
|
for (const { g, error: error62 } of failed) {
|
|
@@ -45815,7 +47545,7 @@ async function writeAssets(bridge, snap, file2, opts) {
|
|
|
45815
47545
|
}
|
|
45816
47546
|
const buf = Buffer.from(got.data, "base64");
|
|
45817
47547
|
const name = fileName(img.base, imageExt(buf));
|
|
45818
|
-
await writeFile2(
|
|
47548
|
+
await writeFile2(path4.join(dir, name), buf);
|
|
45819
47549
|
byImage.set(img.hash, rel(name));
|
|
45820
47550
|
lines.push(`${name} \u2190 src:${img.hash.slice(0, 10)} "${img.name}" #${img.nodeId}${got.w ? ` ${got.w}\xD7${got.h}px original` : ""}${img.uses > 1 ? ` (used ${img.uses}\xD7)` : ""}`);
|
|
45821
47551
|
}
|
|
@@ -45883,8 +47613,8 @@ function ignoreEdges(a, b, band) {
|
|
|
45883
47613
|
}
|
|
45884
47614
|
}
|
|
45885
47615
|
}
|
|
45886
|
-
async function
|
|
45887
|
-
const actualBuf = typeof opts.image === "string" ? await
|
|
47616
|
+
async function compare2(bridge, root, file2, opts) {
|
|
47617
|
+
const actualBuf = typeof opts.image === "string" ? await readFile4(opts.image) : opts.image;
|
|
45888
47618
|
const actual = flatten(decodePng(actualBuf));
|
|
45889
47619
|
const scale = actual.width / root.w;
|
|
45890
47620
|
const res = await renderNode(bridge, root, file2, { scale, width: actual.width }, {});
|
|
@@ -45926,9 +47656,9 @@ async function compare(bridge, root, file2, opts) {
|
|
|
45926
47656
|
if (d.regions.length > 10) lines.push(` \u2026 +${d.regions.length - 10} smaller regions`);
|
|
45927
47657
|
let strip = sideBySide([a, b, d.diff]);
|
|
45928
47658
|
if (opts.saveDiff) {
|
|
45929
|
-
await mkdir2(
|
|
47659
|
+
await mkdir2(path4.dirname(path4.resolve(opts.saveDiff)), { recursive: true });
|
|
45930
47660
|
await writeFile2(opts.saveDiff, encodePng(strip));
|
|
45931
|
-
lines.push(`saved ${
|
|
47661
|
+
lines.push(`saved ${path4.resolve(opts.saveDiff)}`);
|
|
45932
47662
|
}
|
|
45933
47663
|
if (strip.width > VISION_MAX_EDGE || strip.height > VISION_MAX_EDGE) {
|
|
45934
47664
|
const s = Math.min(VISION_MAX_EDGE / strip.width, VISION_MAX_EDGE / strip.height);
|
|
@@ -46084,7 +47814,7 @@ ${Object.entries(x.css).map(([k, v]) => `${k}: ${v};`).join("\n")}`).join("\n\n"
|
|
|
46084
47814
|
note = `fonts not available to the page: ${page.missingFonts.map((f) => `"${f}"`).join(", ")}. The browser uses fallbacks, so text and the hug boxes around it differ in width. Load the fonts (@font-face or local install) for an exact comparison.`;
|
|
46085
47815
|
}
|
|
46086
47816
|
}
|
|
46087
|
-
return
|
|
47817
|
+
return compare2(this.bridge, root, r.file, { image, threshold: o.threshold, saveDiff: o.saveDiff, note });
|
|
46088
47818
|
}
|
|
46089
47819
|
};
|
|
46090
47820
|
|