@kithinji/arcane 1.0.9 → 1.0.10
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/dist/browser/index.mjs +28 -15
- package/dist/browser/index.mjs.map +2 -2
- package/dist/node/index.cjs +64 -74
- package/dist/node/index.cjs.map +2 -2
- package/dist/node/index.mjs +64 -74
- package/dist/node/index.mjs.map +2 -2
- package/dist/types/inline/inline.d.ts +36 -5
- package/dist/types/inline/inline.d.ts.map +1 -1
- package/dist/types/style/style.d.ts +2 -2
- package/dist/types/style/style.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/inline/inline.ts +76 -77
- package/src/style/style.ts +33 -17
package/dist/browser/index.mjs
CHANGED
|
@@ -211002,9 +211002,14 @@ function processStyleObject(styleObj, cssRules) {
|
|
|
211002
211002
|
}
|
|
211003
211003
|
return result;
|
|
211004
211004
|
}
|
|
211005
|
-
function style$(style) {
|
|
211005
|
+
function style$(style, context) {
|
|
211006
|
+
if (!context) {
|
|
211007
|
+
throw new Error(
|
|
211008
|
+
"style$ macro requires MacroContext. Ensure you're using this as a build-time macro."
|
|
211009
|
+
);
|
|
211010
|
+
}
|
|
211006
211011
|
const rStyle = style;
|
|
211007
|
-
const value =
|
|
211012
|
+
const value = context.resolveNodeValue(rStyle);
|
|
211008
211013
|
if (value == void 0) {
|
|
211009
211014
|
throw new Error(
|
|
211010
211015
|
`Could not resolve style object at build time. Ensure all values are statically analyzable (no runtime expressions, dynamic imports should be inlined).`
|
|
@@ -211017,30 +211022,38 @@ function style$(style) {
|
|
|
211017
211022
|
}
|
|
211018
211023
|
const cssRules = /* @__PURE__ */ new Map();
|
|
211019
211024
|
const classNameMap = processStyleObject(value, cssRules);
|
|
211020
|
-
|
|
211025
|
+
context.store.set("style_rules", Array.from(cssRules.values()));
|
|
211021
211026
|
const properties = Object.entries(classNameMap).map(
|
|
211022
|
-
([key, className]) =>
|
|
211023
|
-
|
|
211024
|
-
|
|
211027
|
+
([key, className]) => context.factory.createPropertyAssignment(
|
|
211028
|
+
context.factory.createStringLiteral(key),
|
|
211029
|
+
context.factory.createStringLiteral(className)
|
|
211025
211030
|
)
|
|
211026
211031
|
);
|
|
211027
|
-
return
|
|
211032
|
+
return context.factory.createObjectLiteralExpression(properties, true);
|
|
211028
211033
|
}
|
|
211029
211034
|
function apply$(...c) {
|
|
211035
|
+
if (c.length < 1) {
|
|
211036
|
+
throw new Error("apply$ requires at least one argument plus MacroContext");
|
|
211037
|
+
}
|
|
211038
|
+
const context = c.pop();
|
|
211039
|
+
if (!context || !context.factory) {
|
|
211040
|
+
throw new Error(
|
|
211041
|
+
"apply$ macro requires MacroContext as the last argument. Ensure you're using this as a build-time macro."
|
|
211042
|
+
);
|
|
211043
|
+
}
|
|
211030
211044
|
const args = c;
|
|
211031
|
-
const self = this;
|
|
211032
211045
|
if (args.length === 0) {
|
|
211033
|
-
return
|
|
211046
|
+
return context.factory.createObjectLiteralExpression(
|
|
211034
211047
|
[
|
|
211035
|
-
|
|
211036
|
-
|
|
211037
|
-
|
|
211048
|
+
context.factory.createPropertyAssignment(
|
|
211049
|
+
context.factory.createIdentifier("className"),
|
|
211050
|
+
context.factory.createStringLiteral("")
|
|
211038
211051
|
)
|
|
211039
211052
|
],
|
|
211040
211053
|
false
|
|
211041
211054
|
);
|
|
211042
211055
|
}
|
|
211043
|
-
const f =
|
|
211056
|
+
const f = context.factory;
|
|
211044
211057
|
function isTrue(e) {
|
|
211045
211058
|
return e.kind === import_typescript.default.SyntaxKind.TrueKeyword;
|
|
211046
211059
|
}
|
|
@@ -211063,8 +211076,8 @@ function apply$(...c) {
|
|
|
211063
211076
|
}
|
|
211064
211077
|
if (!import_typescript.default.isIdentifier(cur)) return null;
|
|
211065
211078
|
chain.unshift(cur.text);
|
|
211066
|
-
const root =
|
|
211067
|
-
let value =
|
|
211079
|
+
const root = context.resolveIdentifier(f.createIdentifier(chain[0]));
|
|
211080
|
+
let value = context.resolveNodeValue(root);
|
|
211068
211081
|
if (value == null) return null;
|
|
211069
211082
|
for (let i = 1; i < chain.length; i++) {
|
|
211070
211083
|
if (typeof value !== "object" || !(chain[i] in value)) {
|