@kithinji/arcane 1.0.0 → 1.0.2
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/build.js +3 -3
- package/dist/browser/index.mjs +211215 -0
- package/dist/browser/index.mjs.map +7 -0
- package/dist/node/index.cjs +420 -0
- package/dist/node/index.cjs.map +7 -0
- package/dist/node/index.mjs +382 -0
- package/dist/node/index.mjs.map +7 -0
- package/dist/types/assert/index.d.ts +1 -0
- package/dist/types/assert/index.d.ts.map +1 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/style/index.d.ts +2 -0
- package/dist/types/style/index.d.ts.map +1 -0
- package/dist/types/style/style.d.ts +6 -0
- package/dist/types/style/style.d.ts.map +1 -0
- package/dist/types/style/style_types.d.ts +70 -0
- package/dist/types/style/style_types.d.ts.map +1 -0
- package/dist/types/style/types.d.ts +906 -0
- package/dist/types/style/types.d.ts.map +1 -0
- package/dist/types/style/var_types.d.ts +42 -0
- package/dist/types/style/var_types.d.ts.map +1 -0
- package/package.json +4 -2
|
@@ -0,0 +1,420 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
|
|
30
|
+
// src/index.ts
|
|
31
|
+
var index_exports = {};
|
|
32
|
+
__export(index_exports, {
|
|
33
|
+
apply$: () => apply$,
|
|
34
|
+
style$: () => style$
|
|
35
|
+
});
|
|
36
|
+
module.exports = __toCommonJS(index_exports);
|
|
37
|
+
|
|
38
|
+
// src/style/style.ts
|
|
39
|
+
var import_typescript = __toESM(require("typescript"), 1);
|
|
40
|
+
var UNITLESS_PROPS = /* @__PURE__ */ new Set([
|
|
41
|
+
"z-index",
|
|
42
|
+
"opacity",
|
|
43
|
+
"flex-grow",
|
|
44
|
+
"flex-shrink",
|
|
45
|
+
"flex",
|
|
46
|
+
"order",
|
|
47
|
+
"font-weight",
|
|
48
|
+
"line-height",
|
|
49
|
+
"zoom",
|
|
50
|
+
"column-count",
|
|
51
|
+
"animation-iteration-count",
|
|
52
|
+
"grid-column",
|
|
53
|
+
"grid-row",
|
|
54
|
+
"grid-column-start",
|
|
55
|
+
"grid-column-end",
|
|
56
|
+
"grid-row-start",
|
|
57
|
+
"grid-row-end",
|
|
58
|
+
"tab-size",
|
|
59
|
+
"counter-increment",
|
|
60
|
+
"counter-reset",
|
|
61
|
+
"orphans",
|
|
62
|
+
"widows"
|
|
63
|
+
]);
|
|
64
|
+
var DEV_MODE = process.env.NODE_ENV === "development";
|
|
65
|
+
function simpleHash(str) {
|
|
66
|
+
let hash = 0;
|
|
67
|
+
for (let i = 0; i < str.length; i++) {
|
|
68
|
+
const char = str.charCodeAt(i);
|
|
69
|
+
hash = (hash << 5) - hash + char;
|
|
70
|
+
hash = hash & hash;
|
|
71
|
+
}
|
|
72
|
+
return Math.abs(hash).toString(36).padStart(8, "0").slice(0, 8);
|
|
73
|
+
}
|
|
74
|
+
function hashProperty(prop, value, cssRules) {
|
|
75
|
+
const input = `${prop}:${value}`;
|
|
76
|
+
let hash = simpleHash(input);
|
|
77
|
+
let className;
|
|
78
|
+
if (DEV_MODE) {
|
|
79
|
+
const hint = prop.replace(/[^a-z]/gi, "").slice(0, 3).toLowerCase();
|
|
80
|
+
className = `a-${hint}-${hash}`;
|
|
81
|
+
} else {
|
|
82
|
+
className = `a-${hash}`;
|
|
83
|
+
}
|
|
84
|
+
let attempt = 0;
|
|
85
|
+
while (cssRules.has(className)) {
|
|
86
|
+
const existing = cssRules.get(className);
|
|
87
|
+
const kebabProp = toKebabCase(prop);
|
|
88
|
+
const normalizedValue = normalizeValue(prop, value);
|
|
89
|
+
const expectedRule = `.${className} { ${kebabProp}: ${normalizedValue}; }`;
|
|
90
|
+
if (existing.includes(`${kebabProp}: ${normalizedValue}`)) {
|
|
91
|
+
break;
|
|
92
|
+
}
|
|
93
|
+
hash = simpleHash(`${input}-${++attempt}`);
|
|
94
|
+
className = DEV_MODE ? `a-${prop.slice(0, 3)}-${hash}` : `a-${hash}`;
|
|
95
|
+
if (attempt > 100) {
|
|
96
|
+
throw new Error(
|
|
97
|
+
`Hash collision limit exceeded for property ${prop}:${value}`
|
|
98
|
+
);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
return className;
|
|
102
|
+
}
|
|
103
|
+
function toKebabCase(str) {
|
|
104
|
+
if (str.match(/^(webkit|moz|ms)[A-Z]/)) {
|
|
105
|
+
return "-" + str.replace(/[A-Z]/g, (letter) => `-${letter.toLowerCase()}`);
|
|
106
|
+
}
|
|
107
|
+
if (str.startsWith("--")) {
|
|
108
|
+
return str;
|
|
109
|
+
}
|
|
110
|
+
return str.replace(/[A-Z]/g, (letter) => `-${letter.toLowerCase()}`);
|
|
111
|
+
}
|
|
112
|
+
function normalizeValue(prop, value) {
|
|
113
|
+
if (typeof value === "number") {
|
|
114
|
+
const kebabProp = toKebabCase(prop);
|
|
115
|
+
if (UNITLESS_PROPS.has(kebabProp)) {
|
|
116
|
+
return String(value);
|
|
117
|
+
}
|
|
118
|
+
return `${value}px`;
|
|
119
|
+
}
|
|
120
|
+
return String(value);
|
|
121
|
+
}
|
|
122
|
+
function isPseudoOrMediaKey(key) {
|
|
123
|
+
return key.startsWith(":") || key.startsWith("@") || key.startsWith("&");
|
|
124
|
+
}
|
|
125
|
+
function validateStyleValue(value, path) {
|
|
126
|
+
if (value === null) {
|
|
127
|
+
throw new Error(
|
|
128
|
+
`Invalid style value at ${path}: null is not allowed. Use undefined or omit the property.`
|
|
129
|
+
);
|
|
130
|
+
}
|
|
131
|
+
if (typeof value === "function") {
|
|
132
|
+
throw new Error(
|
|
133
|
+
`Invalid style value at ${path}: functions must be resolved at build time.`
|
|
134
|
+
);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
function processStyleValue(prop, value, cssRules, path = prop) {
|
|
138
|
+
validateStyleValue(value, path);
|
|
139
|
+
if (prop.startsWith("--")) {
|
|
140
|
+
const className2 = hashProperty(prop, value, cssRules);
|
|
141
|
+
if (!cssRules.has(className2)) {
|
|
142
|
+
const cssRule = `.${className2} { ${prop}: ${value}; }`;
|
|
143
|
+
cssRules.set(className2, cssRule);
|
|
144
|
+
}
|
|
145
|
+
return className2;
|
|
146
|
+
}
|
|
147
|
+
const kebabProp = toKebabCase(prop);
|
|
148
|
+
if (typeof value === "object" && !Array.isArray(value)) {
|
|
149
|
+
const classes = [];
|
|
150
|
+
for (const [nestedKey, nestedValue] of Object.entries(value)) {
|
|
151
|
+
validateStyleValue(nestedValue, `${path}.${nestedKey}`);
|
|
152
|
+
if (nestedKey === "default") {
|
|
153
|
+
const normalizedValue2 = normalizeValue(
|
|
154
|
+
prop,
|
|
155
|
+
nestedValue
|
|
156
|
+
);
|
|
157
|
+
const className2 = hashProperty(prop, normalizedValue2, cssRules);
|
|
158
|
+
if (!cssRules.has(className2)) {
|
|
159
|
+
const cssRule = `.${className2} { ${kebabProp}: ${normalizedValue2}; }`;
|
|
160
|
+
cssRules.set(className2, cssRule);
|
|
161
|
+
}
|
|
162
|
+
classes.push(className2);
|
|
163
|
+
} else if (isPseudoOrMediaKey(nestedKey)) {
|
|
164
|
+
const normalizedValue2 = normalizeValue(
|
|
165
|
+
prop,
|
|
166
|
+
nestedValue
|
|
167
|
+
);
|
|
168
|
+
const className2 = hashProperty(
|
|
169
|
+
`${prop}${nestedKey}`,
|
|
170
|
+
normalizedValue2,
|
|
171
|
+
cssRules
|
|
172
|
+
);
|
|
173
|
+
if (!cssRules.has(className2)) {
|
|
174
|
+
let cssRule;
|
|
175
|
+
if (nestedKey.startsWith("@")) {
|
|
176
|
+
cssRule = `${nestedKey} { .${className2} { ${kebabProp}: ${normalizedValue2}; } }`;
|
|
177
|
+
} else if (nestedKey.startsWith("&")) {
|
|
178
|
+
const selector = nestedKey.slice(1);
|
|
179
|
+
cssRule = `.${className2}${selector} { ${kebabProp}: ${normalizedValue2}; }`;
|
|
180
|
+
} else {
|
|
181
|
+
cssRule = `.${className2}${nestedKey} { ${kebabProp}: ${normalizedValue2}; }`;
|
|
182
|
+
}
|
|
183
|
+
cssRules.set(className2, cssRule);
|
|
184
|
+
}
|
|
185
|
+
classes.push(className2);
|
|
186
|
+
} else {
|
|
187
|
+
throw new Error(
|
|
188
|
+
`Invalid nested key "${nestedKey}" at ${path}. Expected "default", a pseudo-class (":hover"), media query ("@media"), or nesting selector ("&").`
|
|
189
|
+
);
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
return classes.join(" ");
|
|
193
|
+
}
|
|
194
|
+
const normalizedValue = normalizeValue(prop, value);
|
|
195
|
+
const className = hashProperty(prop, normalizedValue, cssRules);
|
|
196
|
+
if (!cssRules.has(className)) {
|
|
197
|
+
const cssRule = `.${className} { ${kebabProp}: ${normalizedValue}; }`;
|
|
198
|
+
cssRules.set(className, cssRule);
|
|
199
|
+
}
|
|
200
|
+
return className;
|
|
201
|
+
}
|
|
202
|
+
function processStyleObject(styleObj, cssRules) {
|
|
203
|
+
const result = {};
|
|
204
|
+
for (const [namespace, styles] of Object.entries(styleObj)) {
|
|
205
|
+
if (typeof styles !== "object" || Array.isArray(styles)) {
|
|
206
|
+
throw new Error(
|
|
207
|
+
`Invalid style namespace "${namespace}": expected an object, got ${typeof styles}`
|
|
208
|
+
);
|
|
209
|
+
}
|
|
210
|
+
const classes = [];
|
|
211
|
+
for (const [prop, value] of Object.entries(styles)) {
|
|
212
|
+
if (value === void 0) continue;
|
|
213
|
+
const className = processStyleValue(
|
|
214
|
+
prop,
|
|
215
|
+
value,
|
|
216
|
+
cssRules,
|
|
217
|
+
`${namespace}.${prop}`
|
|
218
|
+
);
|
|
219
|
+
if (className) {
|
|
220
|
+
classes.push(className);
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
result[namespace] = classes.filter(Boolean).join(" ");
|
|
224
|
+
}
|
|
225
|
+
return result;
|
|
226
|
+
}
|
|
227
|
+
function style$(style, context) {
|
|
228
|
+
if (!context) {
|
|
229
|
+
throw new Error(
|
|
230
|
+
"style$ macro requires MacroContext. Ensure you're using this as a build-time macro."
|
|
231
|
+
);
|
|
232
|
+
}
|
|
233
|
+
const rStyle = style;
|
|
234
|
+
const value = context.resolveNodeValue(rStyle);
|
|
235
|
+
if (value == void 0) {
|
|
236
|
+
throw new Error(
|
|
237
|
+
`Could not resolve style object at build time. Ensure all values are statically analyzable (no runtime expressions, dynamic imports should be inlined).`
|
|
238
|
+
);
|
|
239
|
+
}
|
|
240
|
+
if (typeof value !== "object" || Array.isArray(value)) {
|
|
241
|
+
throw new Error(
|
|
242
|
+
`style$ expects an object with style namespaces, got ${typeof value}`
|
|
243
|
+
);
|
|
244
|
+
}
|
|
245
|
+
const cssRules = /* @__PURE__ */ new Map();
|
|
246
|
+
const classNameMap = processStyleObject(value, cssRules);
|
|
247
|
+
context.store.set("style_rules", Array.from(cssRules.values()));
|
|
248
|
+
const properties = Object.entries(classNameMap).map(
|
|
249
|
+
([key, className]) => context.factory.createPropertyAssignment(
|
|
250
|
+
context.factory.createStringLiteral(key),
|
|
251
|
+
context.factory.createStringLiteral(className)
|
|
252
|
+
)
|
|
253
|
+
);
|
|
254
|
+
return context.factory.createObjectLiteralExpression(properties, true);
|
|
255
|
+
}
|
|
256
|
+
function apply$(...c) {
|
|
257
|
+
if (c.length < 1) {
|
|
258
|
+
throw new Error("apply$ requires at least one argument plus MacroContext");
|
|
259
|
+
}
|
|
260
|
+
const context = c.pop();
|
|
261
|
+
if (!context || !context.factory) {
|
|
262
|
+
throw new Error(
|
|
263
|
+
"apply$ macro requires MacroContext as the last argument. Ensure you're using this as a build-time macro."
|
|
264
|
+
);
|
|
265
|
+
}
|
|
266
|
+
const args = c;
|
|
267
|
+
if (args.length === 0) {
|
|
268
|
+
return context.factory.createObjectLiteralExpression(
|
|
269
|
+
[
|
|
270
|
+
context.factory.createPropertyAssignment(
|
|
271
|
+
context.factory.createIdentifier("className"),
|
|
272
|
+
context.factory.createStringLiteral("")
|
|
273
|
+
)
|
|
274
|
+
],
|
|
275
|
+
false
|
|
276
|
+
);
|
|
277
|
+
}
|
|
278
|
+
const f = context.factory;
|
|
279
|
+
function isTrue(e) {
|
|
280
|
+
return e.kind === import_typescript.default.SyntaxKind.TrueKeyword;
|
|
281
|
+
}
|
|
282
|
+
function isFalse(e) {
|
|
283
|
+
return e.kind === import_typescript.default.SyntaxKind.FalseKeyword;
|
|
284
|
+
}
|
|
285
|
+
function isEmptyString(e) {
|
|
286
|
+
return import_typescript.default.isStringLiteral(e) && e.text === "";
|
|
287
|
+
}
|
|
288
|
+
function tryResolveStatic(expr) {
|
|
289
|
+
if (import_typescript.default.isStringLiteral(expr)) {
|
|
290
|
+
return expr.text;
|
|
291
|
+
}
|
|
292
|
+
if (!import_typescript.default.isPropertyAccessExpression(expr)) return null;
|
|
293
|
+
const chain = [];
|
|
294
|
+
let cur = expr;
|
|
295
|
+
while (import_typescript.default.isPropertyAccessExpression(cur)) {
|
|
296
|
+
chain.unshift(cur.name.text);
|
|
297
|
+
cur = cur.expression;
|
|
298
|
+
}
|
|
299
|
+
if (!import_typescript.default.isIdentifier(cur)) return null;
|
|
300
|
+
chain.unshift(cur.text);
|
|
301
|
+
const root = context.resolveIdentifier(f.createIdentifier(chain[0]));
|
|
302
|
+
let value = context.resolveNodeValue(root);
|
|
303
|
+
if (value == null) return null;
|
|
304
|
+
for (let i = 1; i < chain.length; i++) {
|
|
305
|
+
if (typeof value !== "object" || !(chain[i] in value)) {
|
|
306
|
+
return null;
|
|
307
|
+
}
|
|
308
|
+
value = value[chain[i]];
|
|
309
|
+
}
|
|
310
|
+
return typeof value === "string" ? value : null;
|
|
311
|
+
}
|
|
312
|
+
function build(expr) {
|
|
313
|
+
if (isEmptyString(expr)) {
|
|
314
|
+
return { kind: "static", value: "" };
|
|
315
|
+
}
|
|
316
|
+
const s = tryResolveStatic(expr);
|
|
317
|
+
if (s != null) {
|
|
318
|
+
return { kind: "static", value: s };
|
|
319
|
+
}
|
|
320
|
+
if (import_typescript.default.isBinaryExpression(expr) && expr.operatorToken.kind === import_typescript.default.SyntaxKind.AmpersandAmpersandToken) {
|
|
321
|
+
if (isTrue(expr.left)) return build(expr.right);
|
|
322
|
+
if (isFalse(expr.left)) return { kind: "static", value: "" };
|
|
323
|
+
const rs = tryResolveStatic(expr.right);
|
|
324
|
+
if (rs != null) {
|
|
325
|
+
return {
|
|
326
|
+
kind: "dynamic",
|
|
327
|
+
stringSafe: true,
|
|
328
|
+
expr: f.createElementAccessExpression(
|
|
329
|
+
f.createArrayLiteralExpression([
|
|
330
|
+
f.createStringLiteral(""),
|
|
331
|
+
f.createStringLiteral(rs)
|
|
332
|
+
]),
|
|
333
|
+
f.createPrefixUnaryExpression(import_typescript.default.SyntaxKind.PlusToken, expr.left)
|
|
334
|
+
)
|
|
335
|
+
};
|
|
336
|
+
}
|
|
337
|
+
return { kind: "dynamic", expr, stringSafe: false };
|
|
338
|
+
}
|
|
339
|
+
if (import_typescript.default.isConditionalExpression(expr)) {
|
|
340
|
+
if (isTrue(expr.condition)) return build(expr.whenTrue);
|
|
341
|
+
if (isFalse(expr.condition)) return build(expr.whenFalse);
|
|
342
|
+
const t = tryResolveStatic(expr.whenTrue);
|
|
343
|
+
const fv = tryResolveStatic(expr.whenFalse);
|
|
344
|
+
if (t != null && fv != null) {
|
|
345
|
+
return {
|
|
346
|
+
kind: "dynamic",
|
|
347
|
+
stringSafe: true,
|
|
348
|
+
expr: f.createElementAccessExpression(
|
|
349
|
+
f.createArrayLiteralExpression([
|
|
350
|
+
f.createStringLiteral(fv),
|
|
351
|
+
f.createStringLiteral(t)
|
|
352
|
+
]),
|
|
353
|
+
f.createPrefixUnaryExpression(
|
|
354
|
+
import_typescript.default.SyntaxKind.PlusToken,
|
|
355
|
+
expr.condition
|
|
356
|
+
)
|
|
357
|
+
)
|
|
358
|
+
};
|
|
359
|
+
}
|
|
360
|
+
return { kind: "dynamic", expr, stringSafe: false };
|
|
361
|
+
}
|
|
362
|
+
return { kind: "dynamic", expr, stringSafe: false };
|
|
363
|
+
}
|
|
364
|
+
const frags = [];
|
|
365
|
+
for (const arg of args) {
|
|
366
|
+
const frag = build(arg);
|
|
367
|
+
if (frag.kind === "static" && frag.value === "") {
|
|
368
|
+
continue;
|
|
369
|
+
}
|
|
370
|
+
const last = frags[frags.length - 1];
|
|
371
|
+
if (frag.kind === "static" && last?.kind === "static") {
|
|
372
|
+
last.value += " " + frag.value;
|
|
373
|
+
} else {
|
|
374
|
+
frags.push(frag);
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
let classExpr;
|
|
378
|
+
if (frags.length === 0) {
|
|
379
|
+
classExpr = f.createStringLiteral("");
|
|
380
|
+
} else if (frags.every((f2) => f2.kind === "static")) {
|
|
381
|
+
classExpr = f.createStringLiteral(
|
|
382
|
+
frags.map((f2) => f2.value).join(" ").trim()
|
|
383
|
+
);
|
|
384
|
+
} else {
|
|
385
|
+
classExpr = f.createCallExpression(
|
|
386
|
+
f.createPropertyAccessExpression(
|
|
387
|
+
f.createArrayLiteralExpression(
|
|
388
|
+
frags.map((frag) => {
|
|
389
|
+
if (frag.kind === "static") {
|
|
390
|
+
return f.createStringLiteral(frag.value);
|
|
391
|
+
}
|
|
392
|
+
if (frag.stringSafe) {
|
|
393
|
+
return frag.expr;
|
|
394
|
+
}
|
|
395
|
+
return f.createConditionalExpression(
|
|
396
|
+
frag.expr,
|
|
397
|
+
void 0,
|
|
398
|
+
frag.expr,
|
|
399
|
+
void 0,
|
|
400
|
+
f.createStringLiteral("")
|
|
401
|
+
);
|
|
402
|
+
})
|
|
403
|
+
),
|
|
404
|
+
"join"
|
|
405
|
+
),
|
|
406
|
+
void 0,
|
|
407
|
+
[f.createStringLiteral(" ")]
|
|
408
|
+
);
|
|
409
|
+
}
|
|
410
|
+
return f.createObjectLiteralExpression(
|
|
411
|
+
[f.createPropertyAssignment(f.createIdentifier("className"), classExpr)],
|
|
412
|
+
false
|
|
413
|
+
);
|
|
414
|
+
}
|
|
415
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
416
|
+
0 && (module.exports = {
|
|
417
|
+
apply$,
|
|
418
|
+
style$
|
|
419
|
+
});
|
|
420
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/index.ts", "../../src/style/style.ts"],
|
|
4
|
+
"sourcesContent": ["export * from \"./style\";\n", "import { MacroContext } from \"@kithinji/pod\";\nimport ts from \"typescript\";\nimport { MapNamespaces } from \"./style_types\";\n\nconst UNITLESS_PROPS = new Set([\n \"z-index\",\n \"opacity\",\n \"flex-grow\",\n \"flex-shrink\",\n \"flex\",\n \"order\",\n \"font-weight\",\n \"line-height\",\n \"zoom\",\n \"column-count\",\n \"animation-iteration-count\",\n \"grid-column\",\n \"grid-row\",\n \"grid-column-start\",\n \"grid-column-end\",\n \"grid-row-start\",\n \"grid-row-end\",\n \"tab-size\",\n \"counter-increment\",\n \"counter-reset\",\n \"orphans\",\n \"widows\",\n]);\n\nconst DEV_MODE = process.env.NODE_ENV === \"development\";\n\nfunction simpleHash(str: string): string {\n let hash = 0;\n for (let i = 0; i < str.length; i++) {\n const char = str.charCodeAt(i);\n hash = (hash << 5) - hash + char;\n hash = hash & hash;\n }\n\n return Math.abs(hash).toString(36).padStart(8, \"0\").slice(0, 8);\n}\n\nfunction hashProperty(\n prop: string,\n value: string | number,\n cssRules: Map<string, string>\n): string {\n const input = `${prop}:${value}`;\n let hash = simpleHash(input);\n let className: string;\n\n if (DEV_MODE) {\n // Add readable hint in development\n const hint = prop\n .replace(/[^a-z]/gi, \"\")\n .slice(0, 3)\n .toLowerCase();\n className = `a-${hint}-${hash}`;\n } else {\n className = `a-${hash}`;\n }\n\n let attempt = 0;\n\n // Handle hash collisions\n while (cssRules.has(className)) {\n const existing = cssRules.get(className)!;\n const kebabProp = toKebabCase(prop);\n const normalizedValue = normalizeValue(prop, value);\n const expectedRule = `.${className} { ${kebabProp}: ${normalizedValue}; }`;\n\n // If the existing rule matches, it's the same style (deduplication)\n if (existing.includes(`${kebabProp}: ${normalizedValue}`)) {\n break;\n }\n\n // Collision detected, rehash\n hash = simpleHash(`${input}-${++attempt}`);\n className = DEV_MODE ? `a-${prop.slice(0, 3)}-${hash}` : `a-${hash}`;\n\n if (attempt > 100) {\n throw new Error(\n `Hash collision limit exceeded for property ${prop}:${value}`\n );\n }\n }\n\n return className;\n}\n\nfunction toKebabCase(str: string): string {\n // Handle vendor prefixes (webkit, moz, ms)\n if (str.match(/^(webkit|moz|ms)[A-Z]/)) {\n return \"-\" + str.replace(/[A-Z]/g, (letter) => `-${letter.toLowerCase()}`);\n }\n\n // Handle CSS custom properties\n if (str.startsWith(\"--\")) {\n return str;\n }\n\n return str.replace(/[A-Z]/g, (letter) => `-${letter.toLowerCase()}`);\n}\n\nfunction normalizeValue(prop: string, value: string | number): string {\n if (typeof value === \"number\") {\n const kebabProp = toKebabCase(prop);\n\n if (UNITLESS_PROPS.has(kebabProp)) {\n return String(value);\n }\n\n return `${value}px`;\n }\n\n return String(value);\n}\n\nfunction isPseudoOrMediaKey(key: string): boolean {\n return key.startsWith(\":\") || key.startsWith(\"@\") || key.startsWith(\"&\");\n}\n\nfunction validateStyleValue(value: any, path: string): void {\n if (value === null) {\n throw new Error(\n `Invalid style value at ${path}: null is not allowed. Use undefined or omit the property.`\n );\n }\n\n if (typeof value === \"function\") {\n throw new Error(\n `Invalid style value at ${path}: functions must be resolved at build time.`\n );\n }\n}\n\nfunction processStyleValue(\n prop: string,\n value: any,\n cssRules: Map<string, string>,\n path: string = prop\n): string {\n validateStyleValue(value, path);\n\n if (prop.startsWith(\"--\")) {\n const className = hashProperty(prop, value, cssRules);\n if (!cssRules.has(className)) {\n const cssRule = `.${className} { ${prop}: ${value}; }`;\n cssRules.set(className, cssRule);\n }\n return className;\n }\n\n const kebabProp = toKebabCase(prop);\n\n // Handle nested objects for pseudo-classes, media queries, etc.\n if (typeof value === \"object\" && !Array.isArray(value)) {\n const classes: string[] = [];\n\n for (const [nestedKey, nestedValue] of Object.entries(value)) {\n validateStyleValue(nestedValue, `${path}.${nestedKey}`);\n\n if (nestedKey === \"default\") {\n const normalizedValue = normalizeValue(\n prop,\n nestedValue as string | number\n );\n const className = hashProperty(prop, normalizedValue, cssRules);\n\n if (!cssRules.has(className)) {\n const cssRule = `.${className} { ${kebabProp}: ${normalizedValue}; }`;\n cssRules.set(className, cssRule);\n }\n\n classes.push(className);\n } else if (isPseudoOrMediaKey(nestedKey)) {\n const normalizedValue = normalizeValue(\n prop,\n nestedValue as string | number\n );\n const className = hashProperty(\n `${prop}${nestedKey}`,\n normalizedValue,\n cssRules\n );\n\n if (!cssRules.has(className)) {\n let cssRule: string;\n\n if (nestedKey.startsWith(\"@\")) {\n // Media query\n cssRule = `${nestedKey} { .${className} { ${kebabProp}: ${normalizedValue}; } }`;\n } else if (nestedKey.startsWith(\"&\")) {\n // Nesting selector (e.g., &:hover, & > div)\n const selector = nestedKey.slice(1);\n cssRule = `.${className}${selector} { ${kebabProp}: ${normalizedValue}; }`;\n } else {\n // Pseudo-class/element (e.g., :hover, ::before)\n cssRule = `.${className}${nestedKey} { ${kebabProp}: ${normalizedValue}; }`;\n }\n\n cssRules.set(className, cssRule);\n }\n\n classes.push(className);\n } else {\n throw new Error(\n `Invalid nested key \"${nestedKey}\" at ${path}. Expected \"default\", a pseudo-class (\":hover\"), media query (\"@media\"), or nesting selector (\"&\").`\n );\n }\n }\n\n return classes.join(\" \");\n }\n\n const normalizedValue = normalizeValue(prop, value);\n const className = hashProperty(prop, normalizedValue, cssRules);\n\n if (!cssRules.has(className)) {\n const cssRule = `.${className} { ${kebabProp}: ${normalizedValue}; }`;\n cssRules.set(className, cssRule);\n }\n\n return className;\n}\n\nfunction processStyleObject(\n styleObj: Record<string, any>,\n cssRules: Map<string, string>\n): Record<string, string> {\n const result: Record<string, string> = {};\n\n for (const [namespace, styles] of Object.entries(styleObj)) {\n if (typeof styles !== \"object\" || Array.isArray(styles)) {\n throw new Error(\n `Invalid style namespace \"${namespace}\": expected an object, got ${typeof styles}`\n );\n }\n\n const classes: string[] = [];\n\n for (const [prop, value] of Object.entries(styles)) {\n if (value === undefined) continue;\n\n const className = processStyleValue(\n prop,\n value,\n cssRules,\n `${namespace}.${prop}`\n );\n\n if (className) {\n classes.push(className);\n }\n }\n\n result[namespace] = classes.filter(Boolean).join(\" \");\n }\n\n return result;\n}\n\nexport function style$<const T extends Record<string, any>>(\n style: T,\n context?: MacroContext\n): MapNamespaces<T> {\n if (!context) {\n throw new Error(\n \"style$ macro requires MacroContext. Ensure you're using this as a build-time macro.\"\n );\n }\n\n const rStyle = style as unknown as ts.Node;\n const value = context.resolveNodeValue(rStyle);\n\n if (value == undefined) {\n throw new Error(\n `Could not resolve style object at build time. ` +\n `Ensure all values are statically analyzable (no runtime expressions, dynamic imports should be inlined).`\n );\n }\n\n if (typeof value !== \"object\" || Array.isArray(value)) {\n throw new Error(\n `style$ expects an object with style namespaces, got ${typeof value}`\n );\n }\n\n const cssRules = new Map<string, string>();\n const classNameMap = processStyleObject(value, cssRules);\n\n context.store.set(\"style_rules\", Array.from(cssRules.values()));\n\n const properties = Object.entries(classNameMap).map(([key, className]) =>\n context.factory.createPropertyAssignment(\n context.factory.createStringLiteral(key),\n context.factory.createStringLiteral(className)\n )\n );\n\n return context.factory.createObjectLiteralExpression(properties, true) as any;\n}\n\ntype Fragment =\n | { kind: \"static\"; value: string }\n | { kind: \"dynamic\"; expr: ts.Expression; stringSafe: boolean };\n\nexport function apply$(...c: any[]) {\n if (c.length < 1) {\n throw new Error(\"apply$ requires at least one argument plus MacroContext\");\n }\n\n const context = c.pop() as MacroContext;\n\n if (!context || !context.factory) {\n throw new Error(\n \"apply$ macro requires MacroContext as the last argument. Ensure you're using this as a build-time macro.\"\n );\n }\n\n const args = c as ts.Expression[];\n\n if (args.length === 0) {\n return context.factory.createObjectLiteralExpression(\n [\n context.factory.createPropertyAssignment(\n context.factory.createIdentifier(\"className\"),\n context.factory.createStringLiteral(\"\")\n ),\n ],\n false\n );\n }\n\n const f = context.factory;\n\n function isTrue(e: ts.Expression): boolean {\n return e.kind === ts.SyntaxKind.TrueKeyword;\n }\n\n function isFalse(e: ts.Expression): boolean {\n return e.kind === ts.SyntaxKind.FalseKeyword;\n }\n\n function isEmptyString(e: ts.Expression): boolean {\n return ts.isStringLiteral(e) && e.text === \"\";\n }\n\n function tryResolveStatic(expr: ts.Expression): string | null {\n // Try to resolve string literals directly\n if (ts.isStringLiteral(expr)) {\n return expr.text;\n }\n\n // Try to resolve property access chains (e.g., classes.button)\n if (!ts.isPropertyAccessExpression(expr)) return null;\n\n const chain: string[] = [];\n let cur: ts.Expression = expr;\n\n while (ts.isPropertyAccessExpression(cur)) {\n chain.unshift(cur.name.text);\n cur = cur.expression;\n }\n\n if (!ts.isIdentifier(cur)) return null;\n chain.unshift(cur.text);\n\n const root = context.resolveIdentifier(f.createIdentifier(chain[0]));\n let value = context.resolveNodeValue(root);\n\n if (value == null) return null;\n\n for (let i = 1; i < chain.length; i++) {\n if (typeof value !== \"object\" || !(chain[i] in value)) {\n return null;\n }\n value = value[chain[i]];\n }\n\n return typeof value === \"string\" ? value : null;\n }\n\n function build(expr: ts.Expression): Fragment {\n // Handle empty strings\n if (isEmptyString(expr)) {\n return { kind: \"static\", value: \"\" };\n }\n\n // Try static resolution first\n const s = tryResolveStatic(expr);\n if (s != null) {\n return { kind: \"static\", value: s };\n }\n\n // Handle: condition && \"class\"\n if (\n ts.isBinaryExpression(expr) &&\n expr.operatorToken.kind === ts.SyntaxKind.AmpersandAmpersandToken\n ) {\n if (isTrue(expr.left)) return build(expr.right);\n if (isFalse(expr.left)) return { kind: \"static\", value: \"\" };\n\n const rs = tryResolveStatic(expr.right);\n if (rs != null) {\n // Optimize to: [\"\", \"class\"][+condition]\n return {\n kind: \"dynamic\",\n stringSafe: true,\n expr: f.createElementAccessExpression(\n f.createArrayLiteralExpression([\n f.createStringLiteral(\"\"),\n f.createStringLiteral(rs),\n ]),\n f.createPrefixUnaryExpression(ts.SyntaxKind.PlusToken, expr.left)\n ),\n };\n }\n\n return { kind: \"dynamic\", expr, stringSafe: false };\n }\n\n // Handle: condition ? \"a\" : \"b\"\n if (ts.isConditionalExpression(expr)) {\n if (isTrue(expr.condition)) return build(expr.whenTrue);\n if (isFalse(expr.condition)) return build(expr.whenFalse);\n\n const t = tryResolveStatic(expr.whenTrue);\n const fv = tryResolveStatic(expr.whenFalse);\n\n if (t != null && fv != null) {\n // Optimize to: [\"b\", \"a\"][+condition]\n return {\n kind: \"dynamic\",\n stringSafe: true,\n expr: f.createElementAccessExpression(\n f.createArrayLiteralExpression([\n f.createStringLiteral(fv),\n f.createStringLiteral(t),\n ]),\n f.createPrefixUnaryExpression(\n ts.SyntaxKind.PlusToken,\n expr.condition\n )\n ),\n };\n }\n\n return { kind: \"dynamic\", expr, stringSafe: false };\n }\n\n return { kind: \"dynamic\", expr, stringSafe: false };\n }\n\n // Build and merge fragments\n const frags: Fragment[] = [];\n\n for (const arg of args) {\n const frag = build(arg);\n\n // Skip empty static values\n if (frag.kind === \"static\" && frag.value === \"\") {\n continue;\n }\n\n const last = frags[frags.length - 1];\n\n // Merge consecutive static fragments\n if (frag.kind === \"static\" && last?.kind === \"static\") {\n last.value += \" \" + frag.value;\n } else {\n frags.push(frag);\n }\n }\n\n // Generate final className expression\n let classExpr: ts.Expression;\n\n if (frags.length === 0) {\n // All classes were empty\n classExpr = f.createStringLiteral(\"\");\n } else if (frags.every((f) => f.kind === \"static\")) {\n // All static - compile to single string\n classExpr = f.createStringLiteral(\n frags\n .map((f) => f.value)\n .join(\" \")\n .trim()\n );\n } else {\n // Mixed static/dynamic - generate array.join(\" \")\n classExpr = f.createCallExpression(\n f.createPropertyAccessExpression(\n f.createArrayLiteralExpression(\n frags.map((frag) => {\n if (frag.kind === \"static\") {\n return f.createStringLiteral(frag.value);\n }\n if (frag.stringSafe) {\n return frag.expr;\n }\n // Wrap unsafe expressions in conditional: expr ? expr : \"\"\n return f.createConditionalExpression(\n frag.expr,\n undefined,\n frag.expr,\n undefined,\n f.createStringLiteral(\"\")\n );\n })\n ),\n \"join\"\n ),\n undefined,\n [f.createStringLiteral(\" \")]\n );\n }\n\n return f.createObjectLiteralExpression(\n [f.createPropertyAssignment(f.createIdentifier(\"className\"), classExpr)],\n false\n );\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;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