lucent-ui 0.41.0 → 0.42.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/dist/{LucentProvider-DluNb5H9.cjs → LucentProvider-CIiTlQ5E.cjs} +6 -6
- package/dist/{LucentProvider-lGSitrJV.js → LucentProvider-tSCR4lQw.js} +609 -597
- package/dist/devtools.cjs +1 -1
- package/dist/devtools.js +27 -27
- package/dist/index.cjs +19 -19
- package/dist/index.d.ts +12 -0
- package/dist/index.js +913 -912
- package/package.json +5 -1
package/dist/devtools.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),g=require("react"),ae=require("react-dom"),n=require("./LucentProvider-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),g=require("react"),ae=require("react-dom"),n=require("./LucentProvider-CIiTlQ5E.cjs");function re(){const{tokens:t}=n.useLucent(),[s,o]=g.useState({}),l=g.useRef(s);l.current=s;const c=g.useCallback((f,d)=>{document.documentElement.style.setProperty(n.tokenToCssVar(f),d),o(m=>({...m,[f]:d}))},[]),i=g.useCallback(f=>{document.documentElement.style.removeProperty(n.tokenToCssVar(f)),o(d=>{const m={...d};return delete m[f],m})},[]),y=g.useCallback(()=>{for(const f of Object.keys(l.current))document.documentElement.style.removeProperty(n.tokenToCssVar(f));o({})},[]);return{tokens:t,overrides:s,overrideCount:Object.keys(s).length,setOverride:c,removeOverride:i,resetAll:y}}function u(t){return{key:t,controlType:"color"}}function p(t,s,o,l,c){return{key:t,controlType:"slider",sliderConfig:{min:s,max:o,step:l,unit:c}}}function x(t){return{key:t,controlType:"text"}}const H=[{label:"Colors",defaultExpanded:!0,subgroups:[{label:"Navigation",tokens:[u("navigation")]},{label:"Background",tokens:[u("bgBase"),u("bgSubtle"),u("bgOverlay")]},{label:"Surface",tokens:[u("surface"),u("surfaceSecondary"),u("surfaceRaised"),u("surfaceOverlay"),u("surfaceTint")]},{label:"Border",tokens:[u("borderDefault"),u("borderSubtle"),u("borderStrong"),u("controlTrack")]},{label:"Text",tokens:[u("textPrimary"),u("textSecondary"),u("textDisabled"),u("textInverse")]},{label:"Accent",tokens:[u("accentDefault"),u("accentHover"),u("accentSubtle"),u("accentBorder"),u("accentFg")]},{label:"Success",tokens:[u("successDefault"),u("successSubtle"),u("successText")]},{label:"Warning",tokens:[u("warningDefault"),u("warningSubtle"),u("warningText")]},{label:"Danger",tokens:[u("dangerDefault"),u("dangerHover"),u("dangerSubtle"),u("dangerText")]},{label:"Info",tokens:[u("infoDefault"),u("infoSubtle"),u("infoText")]}]},{label:"Typography",tokens:[x("fontFamilyBase"),x("fontFamilyMono"),x("fontFamilyDisplay"),p("fontSizeXs",.5,2,.0625,"rem"),p("fontSizeSm",.5,2,.0625,"rem"),p("fontSizeMd",.5,2,.0625,"rem"),p("fontSizeLg",.5,3,.0625,"rem"),p("fontSizeXl",.5,3,.0625,"rem"),p("fontSize2xl",.5,4,.0625,"rem"),p("fontSize3xl",.5,4,.0625,"rem"),x("fontWeightRegular"),x("fontWeightMedium"),x("fontWeightSemibold"),x("fontWeightBold"),x("lineHeightTight"),x("lineHeightBase"),x("lineHeightRelaxed"),x("letterSpacingTight"),x("letterSpacingBase"),x("letterSpacingWide")]},{label:"Spacing",tokens:[p("space0",0,6,.125,"rem"),p("space1",0,6,.125,"rem"),p("space2",0,6,.125,"rem"),p("space3",0,6,.125,"rem"),p("space4",0,6,.125,"rem"),p("space5",0,6,.125,"rem"),p("space6",0,6,.125,"rem"),p("space8",0,6,.125,"rem"),p("space10",0,6,.125,"rem"),p("space12",0,8,.125,"rem"),p("space16",0,10,.125,"rem"),p("space20",0,12,.125,"rem"),p("space24",0,12,.125,"rem")]},{label:"Radius",tokens:[x("radiusNone"),p("radiusSm",0,2,.0625,"rem"),p("radiusMd",0,2,.0625,"rem"),p("radiusLg",0,2,.0625,"rem"),p("radiusXl",0,3,.0625,"rem"),x("radiusFull")]},{label:"Shadows",tokens:[x("shadowNone"),x("shadowSm"),x("shadowMd"),x("shadowLg"),x("shadowXl")]},{label:"Motion",tokens:[x("durationFast"),x("durationBase"),x("durationSlow"),x("easingDefault"),x("easingEmphasized"),x("easingDecelerate")]}];function le(t){return Object.keys(t).length===0?`<LucentProvider>
|
|
2
2
|
{children}
|
|
3
3
|
</LucentProvider>`:`<LucentProvider tokens={{
|
|
4
4
|
${Object.entries(t).map(([o,l])=>` ${o}: '${l}'`).join(`,
|
package/dist/devtools.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsxs as c, jsx as t, Fragment as fe } from "react/jsx-runtime";
|
|
2
2
|
import { useState as z, useRef as ue, useCallback as L, useEffect as W, useMemo as be, createContext as ve } from "react";
|
|
3
3
|
import { createPortal as xe } from "react-dom";
|
|
4
|
-
import {
|
|
4
|
+
import { $ as ye, a0 as S, T as y, C as P, B as F, e as _, I as ge, a1 as Se, a2 as ke, A as we, M as Ce, N as ze, m as Be, G as Fe, v as Te, Z as Me, y as Re, a as M, g as De, a3 as Oe, S as Le, d as ae, p as Pe, h as Ee, f as Ie, b as Ae } from "./LucentProvider-tSCR4lQw.js";
|
|
5
5
|
function Ge() {
|
|
6
6
|
const { tokens: e } = ye(), [n, a] = z({}), l = ue(n);
|
|
7
7
|
l.current = n;
|
|
@@ -174,14 +174,14 @@ ${Object.entries(e).map(([a, l]) => ` ${a}: '${l}'`).join(`,
|
|
|
174
174
|
{children}
|
|
175
175
|
</LucentProvider>`;
|
|
176
176
|
}
|
|
177
|
-
async function
|
|
177
|
+
async function je(e) {
|
|
178
178
|
try {
|
|
179
179
|
return await navigator.clipboard.writeText(e), !0;
|
|
180
180
|
} catch {
|
|
181
181
|
return !1;
|
|
182
182
|
}
|
|
183
183
|
}
|
|
184
|
-
function
|
|
184
|
+
function _e({ label: e, value: n, isOverridden: a, onChange: l, onReset: s }) {
|
|
185
185
|
return /* @__PURE__ */ c("div", { style: Ne, children: [
|
|
186
186
|
/* @__PURE__ */ t(y, { as: "code", size: "xs", family: "mono", color: "secondary", style: { overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap", marginRight: 8 }, children: e }),
|
|
187
187
|
/* @__PURE__ */ c("div", { style: { display: "flex", alignItems: "center", gap: 6 }, children: [
|
|
@@ -216,11 +216,11 @@ function We({
|
|
|
216
216
|
onReset: d
|
|
217
217
|
}) {
|
|
218
218
|
const b = parseFloat(n) || 0;
|
|
219
|
-
return /* @__PURE__ */ c("div", { style:
|
|
219
|
+
return /* @__PURE__ */ c("div", { style: Ue, children: [
|
|
220
220
|
/* @__PURE__ */ t(y, { as: "code", size: "xs", family: "mono", color: "secondary", style: { overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap", marginRight: 8 }, children: e }),
|
|
221
221
|
/* @__PURE__ */ c("div", { style: { display: "flex", alignItems: "center", gap: 6 }, children: [
|
|
222
222
|
/* @__PURE__ */ t(
|
|
223
|
-
|
|
223
|
+
_,
|
|
224
224
|
{
|
|
225
225
|
min: l,
|
|
226
226
|
max: s,
|
|
@@ -236,14 +236,14 @@ function We({
|
|
|
236
236
|
] })
|
|
237
237
|
] });
|
|
238
238
|
}
|
|
239
|
-
const
|
|
239
|
+
const Ue = {
|
|
240
240
|
display: "flex",
|
|
241
241
|
alignItems: "center",
|
|
242
242
|
justifyContent: "space-between",
|
|
243
243
|
padding: "4px 0",
|
|
244
244
|
minHeight: 28
|
|
245
245
|
};
|
|
246
|
-
function
|
|
246
|
+
function Ke({ label: e, value: n, isOverridden: a, onChange: l, onReset: s }) {
|
|
247
247
|
return /* @__PURE__ */ c("div", { style: Je, children: [
|
|
248
248
|
/* @__PURE__ */ t(y, { as: "code", size: "xs", family: "mono", color: "secondary", style: { overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap", marginRight: 8 }, children: e }),
|
|
249
249
|
/* @__PURE__ */ c("div", { style: { display: "flex", alignItems: "center", gap: 6 }, children: [
|
|
@@ -596,8 +596,8 @@ function yt({ state: e, theme: n }) {
|
|
|
596
596
|
fontFamilyBase: o.fontFamily
|
|
597
597
|
};
|
|
598
598
|
N(o.fontFamily), requestAnimationFrame(() => {
|
|
599
|
-
for (const [G,
|
|
600
|
-
e.setOverride(G,
|
|
599
|
+
for (const [G, K] of Object.entries(A))
|
|
600
|
+
e.setOverride(G, K);
|
|
601
601
|
});
|
|
602
602
|
}, [e, n]), B = ue(n);
|
|
603
603
|
W(() => {
|
|
@@ -612,8 +612,8 @@ function yt({ state: e, theme: n }) {
|
|
|
612
612
|
...q(C.border, n),
|
|
613
613
|
...V(g, n)
|
|
614
614
|
};
|
|
615
|
-
for (const [G,
|
|
616
|
-
e.setOverride(G,
|
|
615
|
+
for (const [G, K] of Object.entries(A))
|
|
616
|
+
e.setOverride(G, K);
|
|
617
617
|
}, [n, d, g, e]);
|
|
618
618
|
const R = (o) => {
|
|
619
619
|
O(), l(o), x(re(o));
|
|
@@ -627,7 +627,7 @@ function yt({ state: e, theme: n }) {
|
|
|
627
627
|
O(), e.setOverride("navigation", o);
|
|
628
628
|
}, w = (o) => {
|
|
629
629
|
O(), /^#[0-9a-f]{6}$/i.test(o) ? x(H(o, n)) : e.setOverride("bgBase", o);
|
|
630
|
-
},
|
|
630
|
+
}, U = (o) => {
|
|
631
631
|
O(), /^#[0-9a-f]{6}$/i.test(o) ? x(X(o, n)) : e.setOverride("surface", o);
|
|
632
632
|
}, he = (o) => {
|
|
633
633
|
O(), /^#[0-9a-f]{6}$/i.test(o) ? x(q(o, n)) : e.setOverride("borderDefault", o);
|
|
@@ -680,7 +680,7 @@ function yt({ state: e, theme: n }) {
|
|
|
680
680
|
/* @__PURE__ */ t(y, { as: "code", size: "xs", family: "mono", style: { color: "var(--lucent-accent-default)" }, children: ee })
|
|
681
681
|
] }),
|
|
682
682
|
/* @__PURE__ */ c("div", { style: { display: "flex", alignItems: "center", gap: 10 }, children: [
|
|
683
|
-
/* @__PURE__ */ t(P, { value: te, onChange:
|
|
683
|
+
/* @__PURE__ */ t(P, { value: te, onChange: U, size: "sm", presetGroups: ft }),
|
|
684
684
|
/* @__PURE__ */ t(y, { size: "xs", color: "secondary", style: { flex: 1 }, children: "Surface" }),
|
|
685
685
|
/* @__PURE__ */ t(y, { as: "code", size: "xs", family: "mono", style: { color: "var(--lucent-accent-default)" }, children: te })
|
|
686
686
|
] }),
|
|
@@ -693,7 +693,7 @@ function yt({ state: e, theme: n }) {
|
|
|
693
693
|
/* @__PURE__ */ c($, { label: "Density", children: [
|
|
694
694
|
/* @__PURE__ */ c("div", { style: { display: "flex", alignItems: "center", gap: 8 }, children: [
|
|
695
695
|
/* @__PURE__ */ t(y, { size: "xs", family: "mono", color: "secondary", style: { width: 54, flexShrink: 0 }, children: "Compact" }),
|
|
696
|
-
/* @__PURE__ */ t(
|
|
696
|
+
/* @__PURE__ */ t(_, { min: 0.7, max: 1.35, step: 0.01, value: a, onChange: (o) => R(parseFloat(o.target.value)), size: "sm", style: { flex: 1 } }),
|
|
697
697
|
/* @__PURE__ */ t(y, { size: "xs", family: "mono", color: "secondary", style: { width: 54, textAlign: "right", flexShrink: 0 }, children: "Spacious" })
|
|
698
698
|
] }),
|
|
699
699
|
/* @__PURE__ */ t("div", { style: { textAlign: "center", marginTop: 4 }, children: /* @__PURE__ */ c(y, { size: "xs", style: { color: "var(--lucent-accent-default)" }, children: [
|
|
@@ -706,7 +706,7 @@ function yt({ state: e, theme: n }) {
|
|
|
706
706
|
/* @__PURE__ */ c($, { label: "Roundness", children: [
|
|
707
707
|
/* @__PURE__ */ c("div", { style: { display: "flex", alignItems: "center", gap: 8 }, children: [
|
|
708
708
|
/* @__PURE__ */ t(y, { size: "xs", family: "mono", color: "secondary", style: { width: 36, flexShrink: 0 }, children: "Sharp" }),
|
|
709
|
-
/* @__PURE__ */ t(
|
|
709
|
+
/* @__PURE__ */ t(_, { min: 0, max: 1, step: 0.01, value: s, onChange: (o) => T(parseFloat(o.target.value)), size: "sm", style: { flex: 1 } }),
|
|
710
710
|
/* @__PURE__ */ t(y, { size: "xs", family: "mono", color: "secondary", style: { width: 24, textAlign: "right", flexShrink: 0 }, children: "Pill" })
|
|
711
711
|
] }),
|
|
712
712
|
/* @__PURE__ */ t("div", { style: { display: "flex", gap: 8, marginTop: 8, justifyContent: "center" }, children: [0, 0.25, 0.5, 0.75, 1].map((o) => /* @__PURE__ */ t("div", { style: {
|
|
@@ -782,7 +782,7 @@ function gt({ state: e, theme: n }) {
|
|
|
782
782
|
f(r), B(Z(s, r));
|
|
783
783
|
}, I = d === "all" ? E : E.filter((r) => r.category === d);
|
|
784
784
|
return /* @__PURE__ */ c("div", { style: { padding: "4px 12px 12px", display: "flex", flexDirection: "column", gap: 16 }, children: [
|
|
785
|
-
/* @__PURE__ */ c(
|
|
785
|
+
/* @__PURE__ */ c(j, { label: "Font Family", children: [
|
|
786
786
|
/* @__PURE__ */ t("div", { style: { marginBottom: 8 }, children: /* @__PURE__ */ t(
|
|
787
787
|
Le,
|
|
788
788
|
{
|
|
@@ -836,7 +836,7 @@ function gt({ state: e, theme: n }) {
|
|
|
836
836
|
)
|
|
837
837
|
] })
|
|
838
838
|
] }),
|
|
839
|
-
/* @__PURE__ */ t(
|
|
839
|
+
/* @__PURE__ */ t(j, { label: "Code & Display Fonts", children: /* @__PURE__ */ c("div", { style: { display: "flex", flexDirection: "column", gap: 8 }, children: [
|
|
840
840
|
/* @__PURE__ */ c("div", { children: [
|
|
841
841
|
/* @__PURE__ */ t(y, { size: "xs", color: "secondary", style: { marginBottom: 4, display: "block" }, children: "Monospace" }),
|
|
842
842
|
/* @__PURE__ */ t(
|
|
@@ -872,11 +872,11 @@ function gt({ state: e, theme: n }) {
|
|
|
872
872
|
)
|
|
873
873
|
] })
|
|
874
874
|
] }) }),
|
|
875
|
-
/* @__PURE__ */ t(
|
|
875
|
+
/* @__PURE__ */ t(j, { label: "Type Scale", children: /* @__PURE__ */ c("div", { style: { display: "flex", flexDirection: "column", gap: 10 }, children: [
|
|
876
876
|
/* @__PURE__ */ c("div", { children: [
|
|
877
877
|
/* @__PURE__ */ t(y, { size: "xs", color: "secondary", style: { marginBottom: 4, display: "block" }, children: "Base Size" }),
|
|
878
878
|
/* @__PURE__ */ c("div", { style: { display: "flex", alignItems: "center", gap: 8 }, children: [
|
|
879
|
-
/* @__PURE__ */ t(
|
|
879
|
+
/* @__PURE__ */ t(_, { min: 0.75, max: 1.5, step: 0.0625, value: s, onChange: (r) => R(parseFloat(r.target.value)), size: "sm", style: { flex: 1 } }),
|
|
880
880
|
/* @__PURE__ */ c(y, { as: "code", size: "xs", family: "mono", style: { width: 56, textAlign: "right", flexShrink: 0, color: "var(--lucent-accent-default)" }, children: [
|
|
881
881
|
s,
|
|
882
882
|
"rem"
|
|
@@ -886,7 +886,7 @@ function gt({ state: e, theme: n }) {
|
|
|
886
886
|
/* @__PURE__ */ c("div", { children: [
|
|
887
887
|
/* @__PURE__ */ t(y, { size: "xs", color: "secondary", style: { marginBottom: 4, display: "block" }, children: "Scale Ratio" }),
|
|
888
888
|
/* @__PURE__ */ c("div", { style: { display: "flex", alignItems: "center", gap: 8 }, children: [
|
|
889
|
-
/* @__PURE__ */ t(
|
|
889
|
+
/* @__PURE__ */ t(_, { min: 1, max: 1.618, step: 1e-3, value: g, onChange: (r) => T(parseFloat(r.target.value)), size: "sm", style: { flex: 1 } }),
|
|
890
890
|
/* @__PURE__ */ t(y, { as: "code", size: "xs", family: "mono", style: { width: 56, textAlign: "right", flexShrink: 0, color: "var(--lucent-accent-default)" }, children: g.toFixed(3) })
|
|
891
891
|
] }),
|
|
892
892
|
/* @__PURE__ */ t("div", { style: { display: "flex", flexWrap: "wrap", gap: 4, marginTop: 6 }, children: qe.map((r) => /* @__PURE__ */ t(
|
|
@@ -901,21 +901,21 @@ function gt({ state: e, theme: n }) {
|
|
|
901
901
|
)) })
|
|
902
902
|
] })
|
|
903
903
|
] }) }),
|
|
904
|
-
/* @__PURE__ */ t(
|
|
904
|
+
/* @__PURE__ */ t(j, { label: "Text Colors", children: /* @__PURE__ */ t("div", { style: { display: "flex", flexDirection: "column", gap: 6 }, children: ht.map(({ key: r, label: h }) => {
|
|
905
905
|
const w = e.overrides[r] ?? e.tokens[r];
|
|
906
906
|
return /* @__PURE__ */ t(
|
|
907
907
|
P,
|
|
908
908
|
{
|
|
909
909
|
label: h,
|
|
910
910
|
value: w,
|
|
911
|
-
onChange: (
|
|
911
|
+
onChange: (U) => e.setOverride(r, U),
|
|
912
912
|
size: "sm",
|
|
913
913
|
inline: !0
|
|
914
914
|
},
|
|
915
915
|
r
|
|
916
916
|
);
|
|
917
917
|
}) }) }),
|
|
918
|
-
/* @__PURE__ */ t(
|
|
918
|
+
/* @__PURE__ */ t(j, { label: "Preview", children: /* @__PURE__ */ t(
|
|
919
919
|
pt,
|
|
920
920
|
{
|
|
921
921
|
family: v,
|
|
@@ -934,7 +934,7 @@ const ht = [
|
|
|
934
934
|
{ key: "textDisabled", label: "Disabled" },
|
|
935
935
|
{ key: "textInverse", label: "Inverse" }
|
|
936
936
|
];
|
|
937
|
-
function
|
|
937
|
+
function j({ label: e, children: n }) {
|
|
938
938
|
return /* @__PURE__ */ c("div", { style: {
|
|
939
939
|
background: "var(--lucent-surface)",
|
|
940
940
|
borderRadius: "var(--lucent-radius-lg)",
|
|
@@ -1011,7 +1011,7 @@ function vt({ state: e, theme: n, position: a, mode: l, onModeChange: s, onTheme
|
|
|
1011
1011
|
D((w) => ({ ...w, [h]: !w[h] }));
|
|
1012
1012
|
}, I = async () => {
|
|
1013
1013
|
const h = $e(e.overrides);
|
|
1014
|
-
await
|
|
1014
|
+
await je(h) && (R(!0), setTimeout(() => R(!1), 2e3));
|
|
1015
1015
|
}, r = b.toLowerCase();
|
|
1016
1016
|
return /* @__PURE__ */ t(bt, { children: /* @__PURE__ */ c("div", { style: {
|
|
1017
1017
|
...St,
|
|
@@ -1141,7 +1141,7 @@ function de({ meta: e, state: n }) {
|
|
|
1141
1141
|
switch (e.controlType) {
|
|
1142
1142
|
case "color":
|
|
1143
1143
|
return /* @__PURE__ */ t(
|
|
1144
|
-
|
|
1144
|
+
_e,
|
|
1145
1145
|
{
|
|
1146
1146
|
label: e.key,
|
|
1147
1147
|
value: a,
|
|
@@ -1167,7 +1167,7 @@ function de({ meta: e, state: n }) {
|
|
|
1167
1167
|
);
|
|
1168
1168
|
case "text":
|
|
1169
1169
|
return /* @__PURE__ */ t(
|
|
1170
|
-
|
|
1170
|
+
Ke,
|
|
1171
1171
|
{
|
|
1172
1172
|
label: e.key,
|
|
1173
1173
|
value: a,
|