From f5f3794006f005c0f7439ff4e828fcfe1a0fa20c Mon Sep 17 00:00:00 2001 From: DarkWiiPlayer Date: Tue, 19 Oct 2021 20:03:48 +0200 Subject: [PATCH] Switch camel-to-kebab case convertion in v helper Calling as a function will no longer do the transformation, but instead indexing the proxy will do this now. --- css.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/css.js b/css.js index d97adb3..5023f00 100644 --- a/css.js +++ b/css.js @@ -38,7 +38,9 @@ const mkVar = name => { return v } -export const v = new Proxy(Window, { - get: (target, name, receiver) => mkVar(name), - apply: (target, object, [name]) => `var(--${keyToPropName(name)})`, +export const variable = new Proxy(Window, { + get: (target, name, receiver) => mkVar(keyToPropName(name)), + apply: (target, object, [name, value]) => value + ? `var(--${name})` + : `var(--${name}, value)` })