tgui-core 5.9.0 → 5.11.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.
@@ -118,6 +118,6 @@ type StyleMap = StringStyleMap & BooleanStyleMap;
118
118
  /** Super light implementation of tailwind-like class names. */
119
119
  export declare function computeTwClass(input: string | undefined): StyleMap;
120
120
  /** Short list of accepted DOM event handlers */
121
- export declare const eventHandlers: ["onClick", "onContextMenu", "onDoubleClick", "onKeyDown", "onKeyUp", "onMouseDown", "onMouseLeave", "onMouseMove", "onMouseOver", "onMouseUp", "onScroll", "onWheel", "onDrag", "onDragEnd", "onDragEnter", "onDragExit", "onDragLeave", "onDragOver", "onDragStart", "onDrop"];
121
+ export declare const eventHandlers: ["onClick", "onAuxClick", "onContextMenu", "onDoubleClick", "onKeyDown", "onKeyUp", "onMouseDown", "onMouseEnter", "onMouseLeave", "onMouseMove", "onMouseOver", "onMouseUp", "onScroll", "onWheel", "onDrag", "onDragEnd", "onDragEnter", "onDragExit", "onDragLeave", "onDragOver", "onDragStart", "onDrop"];
122
122
  export type EventHandlers<TElement = HTMLDivElement> = Pick<DOMAttributes<TElement>, (typeof eventHandlers)[number]>;
123
123
  export {};
package/dist/common/ui.js CHANGED
@@ -1 +1 @@
1
- import{CSS_COLORS as t}from"./constants.js";import{classes as o}from"./react.js";let e=t=>"string"==typeof t?t.endsWith("px")?`${Number.parseFloat(t)/12}rem`:t:"number"==typeof t?`${t}rem`:void 0,n=t=>"string"==typeof t?e(t):"number"==typeof t?e(.5*t):void 0;function i(o){return"string"==typeof o&&t.includes(o)}let r=t=>(o,e)=>{("number"==typeof e||"string"==typeof e)&&(o[t]=e)},l=(t,o)=>(e,n)=>{("number"==typeof n||"string"==typeof n)&&(e[t]=o(n))},p=(t,o)=>(e,n)=>{n&&(e[t]=o)},a=(t,o,e)=>(n,i)=>{if("number"==typeof i||"string"==typeof i)for(let r=0;r<e.length;r++)n[t+e[r]]=o(i)},g=t=>(o,e)=>{i(e)||(o[t]=e)},f={align:r("textAlign"),backgroundColor:g("backgroundColor"),bottom:l("bottom",e),color:g("color"),fontFamily:r("fontFamily"),fontSize:l("fontSize",e),fontWeight:r("fontWeight"),g:l("gap",n),gc:l("columnGap",n),gr:l("rowGap",n),height:l("height",e),left:l("left",e),lineHeight:(t,o)=>{"number"==typeof o?t.lineHeight=o:"string"==typeof o&&(t.lineHeight=e(o))},m:a("margin",n,["Top","Bottom","Left","Right"]),maxHeight:l("maxHeight",e),maxWidth:l("maxWidth",e),mb:l("marginBottom",n),minHeight:l("minHeight",e),minWidth:l("minWidth",e),ml:l("marginLeft",n),mr:l("marginRight",n),mt:l("marginTop",n),mx:a("margin",n,["Left","Right"]),my:a("margin",n,["Top","Bottom"]),opacity:r("opacity"),overflow:r("overflow"),overflowX:r("overflowX"),overflowY:r("overflowY"),p:a("padding",n,["Top","Bottom","Left","Right"]),pb:l("paddingBottom",n),pl:l("paddingLeft",n),position:r("position"),pr:l("paddingRight",n),pt:l("paddingTop",n),px:a("padding",n,["Left","Right"]),py:a("padding",n,["Top","Bottom"]),right:l("right",e),textAlign:r("textAlign"),textColor:g("color"),top:l("top",e),verticalAlign:r("verticalAlign"),width:l("width",e)},m={bold:p("fontWeight","bold"),fillPositionedParent:(t,o)=>{o&&(t.position="absolute",t.top=0,t.bottom=0,t.left=0,t.right=0)},inline:p("display","inline-block"),italic:p("fontStyle","italic"),nowrap:p("whiteSpace","nowrap"),preserveWhitespace:p("whiteSpace","pre-wrap")};function s(t){let o={},e={};for(let n in t){if("style"===n)continue;let i=t[n],r=f[n]||m[n];r?r(e,i):o[n]=i}return o.style={...e,...t.style},o}function u(t){let e=t.textColor||t.color,{backgroundColor:n}=t;return o([i(e)&&`color-${e}`,i(n)&&`color-bg-${n}`])}function c(t){let o={};if(!t)return o;for(let e of t.split(" ")){let[t,n]=e.split("-");if(t)if(t in f){if(""===n)continue;let e=Number(n);!Number.isNaN(e)&&Number.isFinite(e)?o[t]=e:o[t]=n}else t in m?o[t]=!0:console.warn(`Unknown prop ${t}`)}return o}let h=["onClick","onContextMenu","onDoubleClick","onKeyDown","onKeyUp","onMouseDown","onMouseLeave","onMouseMove","onMouseOver","onMouseUp","onScroll","onWheel","onDrag","onDragEnd","onDragEnter","onDragExit","onDragLeave","onDragOver","onDragStart","onDrop"];export{m as booleanStyleMap,u as computeBoxClassName,s as computeBoxProps,c as computeTwClass,h as eventHandlers,n as halfUnit,f as stringStyleMap,e as unit};
1
+ import{CSS_COLORS as t}from"./constants.js";import{classes as o}from"./react.js";let e=t=>"string"==typeof t?t.endsWith("px")?`${Number.parseFloat(t)/12}rem`:t:"number"==typeof t?`${t}rem`:void 0,n=t=>"string"==typeof t?e(t):"number"==typeof t?e(.5*t):void 0;function i(o){return"string"==typeof o&&t.includes(o)}let r=t=>(o,e)=>{("number"==typeof e||"string"==typeof e)&&(o[t]=e)},l=(t,o)=>(e,n)=>{("number"==typeof n||"string"==typeof n)&&(e[t]=o(n))},p=(t,o)=>(e,n)=>{n&&(e[t]=o)},a=(t,o,e)=>(n,i)=>{if("number"==typeof i||"string"==typeof i)for(let r=0;r<e.length;r++)n[t+e[r]]=o(i)},g=t=>(o,e)=>{i(e)||(o[t]=e)},f={align:r("textAlign"),backgroundColor:g("backgroundColor"),bottom:l("bottom",e),color:g("color"),fontFamily:r("fontFamily"),fontSize:l("fontSize",e),fontWeight:r("fontWeight"),g:l("gap",n),gc:l("columnGap",n),gr:l("rowGap",n),height:l("height",e),left:l("left",e),lineHeight:(t,o)=>{"number"==typeof o?t.lineHeight=o:"string"==typeof o&&(t.lineHeight=e(o))},m:a("margin",n,["Top","Bottom","Left","Right"]),maxHeight:l("maxHeight",e),maxWidth:l("maxWidth",e),mb:l("marginBottom",n),minHeight:l("minHeight",e),minWidth:l("minWidth",e),ml:l("marginLeft",n),mr:l("marginRight",n),mt:l("marginTop",n),mx:a("margin",n,["Left","Right"]),my:a("margin",n,["Top","Bottom"]),opacity:r("opacity"),overflow:r("overflow"),overflowX:r("overflowX"),overflowY:r("overflowY"),p:a("padding",n,["Top","Bottom","Left","Right"]),pb:l("paddingBottom",n),pl:l("paddingLeft",n),position:r("position"),pr:l("paddingRight",n),pt:l("paddingTop",n),px:a("padding",n,["Left","Right"]),py:a("padding",n,["Top","Bottom"]),right:l("right",e),textAlign:r("textAlign"),textColor:g("color"),top:l("top",e),verticalAlign:r("verticalAlign"),width:l("width",e)},m={bold:p("fontWeight","bold"),fillPositionedParent:(t,o)=>{o&&(t.position="absolute",t.top=0,t.bottom=0,t.left=0,t.right=0)},inline:p("display","inline-block"),italic:p("fontStyle","italic"),nowrap:p("whiteSpace","nowrap"),preserveWhitespace:p("whiteSpace","pre-wrap")};function s(t){let o={},e={};for(let n in t){if("style"===n)continue;let i=t[n],r=f[n]||m[n];r?r(e,i):o[n]=i}return o.style={...e,...t.style},o}function u(t){let e=t.textColor||t.color,{backgroundColor:n}=t;return o([i(e)&&`color-${e}`,i(n)&&`color-bg-${n}`])}function c(t){let o={};if(!t)return o;for(let e of t.split(" ")){let[t,n]=e.split("-");if(t)if(t in f){if(""===n)continue;let e=Number(n);!Number.isNaN(e)&&Number.isFinite(e)?o[t]=e:o[t]=n}else t in m?o[t]=!0:console.warn(`Unknown prop ${t}`)}return o}let h=["onClick","onAuxClick","onContextMenu","onDoubleClick","onKeyDown","onKeyUp","onMouseDown","onMouseEnter","onMouseLeave","onMouseMove","onMouseOver","onMouseUp","onScroll","onWheel","onDrag","onDragEnd","onDragEnter","onDragExit","onDragLeave","onDragOver","onDragStart","onDrop"];export{m as booleanStyleMap,u as computeBoxClassName,s as computeBoxProps,c as computeTwClass,h as eventHandlers,n as halfUnit,f as stringStyleMap,e as unit};
@@ -21,6 +21,8 @@ type Props = {
21
21
  } & Partial<{
22
22
  /** Animates the value if it was changed externally. */
23
23
  animated: boolean;
24
+ /** Disables the control. */
25
+ disabled: boolean;
24
26
  /** The matrix to use for the drag. */
25
27
  dragMatrix: [number, number];
26
28
  /** onChange also fires when you drag the input. */
@@ -1 +1 @@
1
- import{Fragment as e,jsx as r,jsxs as t}from"react/jsx-runtime";import{KEY as n,isEscape as u}from"../common/keys.js";import{clamp as o}from"../common/math.js";import{useEffect as l,useRef as c,useState as i}from"react";import{AnimatedNumber as a}from"./AnimatedNumber.js";function s(e,r){return e.screenX*r[0]+e.screenY*r[1]}function m(m){let{animated:f,children:v,dragMatrix:p=[1,0],tickWhileDragging:d,format:h,maxValue:y=1/0,minValue:g=-1/0,onChange:E,step:b=1,stepPixelSize:N,unclamped:w,unit:T,updateRate:j=400,fontSize:x,height:L,lineHeight:S}=m,[k,z]=i(m.value),[D,I]=i(!1),F=c(!1),M=c(m.value),O=c(0),$=c(0),_=c(null),A=c(null),B=c(null),C=c(null);function H(e){let r=$.current;if(null===r)throw Error("Origin is unset.");let t=s(e,p),n=_.current;if(null===n)throw Error("Final step pixel size has not been computed.");let u=O.current;if(null===u)throw Error("Original value is unset.");let l=o(Math.floor(u/b)*b+Math.trunc((t-r)/n)*b,g,y);M.current=l,z(l)}function K(e){document.body.style["pointer-events"]="auto",B.current&&clearInterval(B.current),$.current=null,_.current=null,O.current=null,document.removeEventListener("mousemove",H),document.removeEventListener("mouseup",K),F.current&&(E?.(e,M.current),F.current=!1)}l(()=>{m.value!==M.current&&(M.current=m.value,z(m.value))},[m.value]);let P=m.value;F.current&&(P=M.current);let U=t(e,{children:[f&&!F.current?r(a,{format:h,value:P}):h?h(P):P,T?` ${T}`:""]}),W=r("input",{className:"NumberInput__input",onBlur:function(e){let r=Number.parseFloat(e.currentTarget.value);(w||(r=o(r,g,y)),Number.isNaN(r))?I(!1):(M.current=r,z(r),E?.(e.nativeEvent,r),D&&I(!1))},onKeyDown:function(e){(e.key===n.Enter||u(e.key))&&I(!1)},ref:A,style:{display:D?void 0:"none",fontSize:x,height:L,lineHeight:S}});return v({displayElement:U,displayValue:P,dragging:F.current,editing:D,handleDragStart:function(e){if(!D){if("number"!=typeof N){let r=e.currentTarget.offsetWidth/((y-g)/b);if(void 0===N)_.current=r;else if("function"==typeof N)_.current=N(r);else throw Error(`Unsupported value for stepPixelSize of type ${typeof N}`)}else _.current=N;document.body.style["pointer-events"]="none",$.current=s(e.nativeEvent,p),O.current=m.value,F.current=!0,document.addEventListener("mouseup",K),C.current=setTimeout(()=>{var r=e.nativeEvent;if(F.current)document.addEventListener("mousemove",H),B.current=setInterval(()=>{F.current&&d&&E?.(r,M.current)},j);else if(I(!0),A.current){let e=A.current;e.value=M.current.toString(),setTimeout(()=>{e.focus(),e.select()},10)}C.current&&clearTimeout(C.current)},100)}},inputElement:W})}export{m as DraggableControl};
1
+ import{Fragment as e,jsx as r,jsxs as t}from"react/jsx-runtime";import{KEY as n,isEscape as u}from"../common/keys.js";import{clamp as o}from"../common/math.js";import{useEffect as l,useRef as c,useState as i}from"react";import{AnimatedNumber as a}from"./AnimatedNumber.js";function s(e,r){return e.screenX*r[0]+e.screenY*r[1]}function m(m){let{animated:f,disabled:v,children:p,dragMatrix:d=[1,0],tickWhileDragging:y,format:h,maxValue:g=1/0,minValue:E=-1/0,onChange:b,step:N=1,stepPixelSize:w,unclamped:T,unit:j,updateRate:x=400,fontSize:L,height:S,lineHeight:k}=m,[z,D]=i(m.value),[I,O]=i(!1),F=c(!1),M=c(m.value),$=c(0),_=c(0),A=c(null),B=c(null),C=c(null),H=c(null);function K(e){let r=_.current;if(null===r)throw Error("Origin is unset.");let t=s(e,d),n=A.current;if(null===n)throw Error("Final step pixel size has not been computed.");let u=$.current;if(null===u)throw Error("Original value is unset.");let l=o(Math.floor(u/N)*N+Math.trunc((t-r)/n)*N,E,g);M.current=l,D(l)}function P(e){document.body.style["pointer-events"]="auto",C.current&&clearInterval(C.current),_.current=null,A.current=null,$.current=null,document.removeEventListener("mousemove",K),document.removeEventListener("mouseup",P),F.current&&(b?.(e,M.current),F.current=!1)}l(()=>{m.value!==M.current&&(M.current=m.value,D(m.value))},[m.value]);let U=m.value;F.current&&(U=M.current);let W=t(e,{children:[f&&!F.current?r(a,{format:h,value:U}):h?h(U):U,j?` ${j}`:""]}),X=r("input",{className:"NumberInput__input",onBlur:function(e){let r=Number.parseFloat(e.currentTarget.value);(T||(r=o(r,E,g)),Number.isNaN(r))?O(!1):(M.current=r,D(r),b?.(e.nativeEvent,r),I&&O(!1))},onKeyDown:function(e){(e.key===n.Enter||u(e.key))&&O(!1)},ref:B,readOnly:v,style:{display:I?void 0:"none",fontSize:L,height:S,lineHeight:k}});return p({displayElement:W,displayValue:U,dragging:F.current,editing:I,handleDragStart:function(e){if(!I&&!v){if("number"!=typeof w){let r=e.currentTarget.offsetWidth/((g-E)/N);if(void 0===w)A.current=r;else if("function"==typeof w)A.current=w(r);else throw Error(`Unsupported value for stepPixelSize of type ${typeof w}`)}else A.current=w;document.body.style["pointer-events"]="none",_.current=s(e.nativeEvent,d),$.current=m.value,F.current=!0,document.addEventListener("mouseup",P),H.current=setTimeout(()=>{var r=e.nativeEvent;if(F.current)document.addEventListener("mousemove",K),C.current=setInterval(()=>{F.current&&y&&b?.(r,M.current)},x);else if(O(!0),B.current){let e=B.current;e.value=M.current.toString(),setTimeout(()=>{e.focus(),e.select()},10)}H.current&&clearTimeout(H.current)},100)}},inputElement:X})}export{m as DraggableControl};
@@ -32,6 +32,10 @@ type Props = {
32
32
  iconRotation: number;
33
33
  /** Whether or not the icon should spin */
34
34
  iconSpin: boolean;
35
+ /** Whether we want to make the search input styled like a regular dropdown button. */
36
+ styledInput: boolean;
37
+ /** Maximum number of items to display before having to scroll */
38
+ maxItems: number;
35
39
  /** Width of the dropdown menu in box units. Default: 15 */
36
40
  menuWidth: string | number;
37
41
  /** Whether or not the arrow on the right hand side of the dropdown button is visible */
@@ -42,6 +46,8 @@ type Props = {
42
46
  fluid: boolean;
43
47
  /** Text to show when nothing has been selected. */
44
48
  placeholder: string;
49
+ /** Turns the dropdown button into a search textbox. Incompatible with Tiny */
50
+ searchInput: boolean;
45
51
  /** @deprecated If you want to allow dropdown breaks layout, set width 100% */
46
52
  clipSelectedText: boolean;
47
53
  /** Called when dropdown button is clicked */
@@ -1 +1 @@
1
- import{Fragment as o,jsx as n,jsxs as e}from"react/jsx-runtime";import{KEY as t}from"../common/keys.js";import{classes as r}from"../common/react.js";import{unit as l}from"../common/ui.js";import{useRef as i,useState as c}from"react";import{Button as d}from"./Button.js";import{Floating as s}from"./Floating.js";import{Icon as a}from"./Icon.js";function m(o){return"string"==typeof o?o:o.value}function p(p){let{autoScroll:u=!0,buttons:_,className:w,color:f="default",disabled:h,displayText:D,icon:y,iconRotation:v,iconSpin:N,iconOnly:g,menuWidth:b,noChevron:x,onClick:j,onSelected:k,options:C=[],over:B,placeholder:I="Select...",selected:T,fluid:A,width:E=15}=p,[K,O]=c(!1),S=i(null),$=C.findIndex(o=>m(o)===T)||0;function F(o){let n=o;n=o<$?o<2?0:o-2:o>C.length-3?C.length-1:o-2;let e=S.current,t=e?.children[n];e&&t&&(e.scrollTop=t.offsetTop)}function M(o){let n;if(C.length<1||h)return;let e=C.length-1;n=$<0?"next"===o?e:0:"next"===o?$===e?0:$+1:0===$?e:$-1,K&&u&&F(n),k?.(m(C[n]))}let W=B?"top":"bottom";return g&&(W=`${W}-start`),e("div",{className:r(["Dropdown",A&&"Dropdown--fluid"]),children:[n(s,{allowedOutsideClasses:".Dropdown__button",closeAfterInteract:!0,content:n("div",{className:"Dropdown__menu",ref:S,children:0===C.length?n("div",{className:"Dropdown__menu--entry",children:"No options"}):C.map(o=>{let e=m(o);return n("div",{className:r(["Dropdown__menu--entry",T===e&&"selected"]),onClick:()=>{k?.(e)},onKeyDown:o=>{o.key===t.Enter&&k?.(e)},children:"string"==typeof o?o:o.displayText},e)})}),contentAutoWidth:!b,contentClasses:"Dropdown__menu--wrapper",contentStyles:{width:b?l(b):void 0},disabled:h,onMounted:()=>{K&&u&&-1!==$&&F($)},onOpenChange:O,placement:W,children:e("div",{className:r(["Dropdown__control",`Button--color--${f}`,h&&"Button--disabled",g&&"Dropdown__control--icon-only",w]),onClick:o=>{(!h||K)&&j?.(o)},onKeyDown:o=>{o.key!==t.Enter||h||j?.(o)},style:{width:l(E)},children:[y&&n(a,{className:"Dropdown__icon",name:y,rotation:v,spin:N}),!g&&e(o,{children:[n("span",{className:"Dropdown__selected-text",children:D||T&&m(T)||I}),!x&&n(a,{className:r(["Dropdown__icon","Dropdown__icon--arrow",B&&"over",K&&"open"]),name:"chevron-down"})]})]})}),_&&e(o,{children:[n(d,{className:"Dropdown__button",disabled:h,icon:"chevron-left",onClick:()=>{M("previous")}}),n(d,{className:"Dropdown__button",disabled:h,icon:"chevron-right",onClick:()=>{M("next")}})]})]})}export{p as Dropdown};
1
+ import{Fragment as e,jsx as n,jsxs as o}from"react/jsx-runtime";import{KEY as t}from"../common/keys.js";import{classes as r}from"../common/react.js";import{unit as l}from"../common/ui.js";import{useRef as i,useState as d}from"react";import{Button as c}from"./Button.js";import{Floating as s}from"./Floating.js";import{Icon as a}from"./Icon.js";import{Input as u}from"./Input.js";let p=null;function m(e){return"string"==typeof e?e:e.value}function w(w){let{autoScroll:_=!0,buttons:h,className:f,color:y="default",disabled:D,displayText:v,icon:N,iconRotation:g,iconSpin:b,iconOnly:C,styledInput:x,maxItems:j,menuWidth:k,noChevron:S,onClick:B,onSelected:E,options:F=[],over:I,placeholder:M="Select...",searchInput:T,selected:K,fluid:O,width:$=15}=w,[A,L]=d(!1),[P,z]=d(""),U=i(null),V=i(!1),W=i(!1),q=i(null),G=F.findIndex(e=>m(e)===K)||0;function H(e){let n=e;n=e<G?e<2?0:e-2:e>F.length-3?F.length-1:e-2;let o=U.current,t=o?.children[n];o&&t&&(o.scrollTop=t.offsetTop)}function J(e){let n;if(F.length<1||D)return;let o=F.length-1;n=G<0?"next"===e?o:0:"next"===e?G===o?0:G+1:0===G?o:G-1,A&&_&&H(n),E?.(m(F[n]))}let Q=P?F.filter(e=>("string"==typeof e?e:e.displayText||m(e)).toString().toLowerCase().includes(P.toLowerCase())):F,R=I?"top":"bottom";C&&(R=`${R}-start`);let X=j?{"--dropdown-menu-max-height":l(Math.max(Math.min(j,25),3)*function(){if(null!==p)return p;let e=parseFloat(getComputedStyle(document.body).getPropertyValue("--font-size")),n=document.createElement("div");n.className="Dropdown__menu--entry",n.textContent="test",document.body.appendChild(n);let o=parseFloat(getComputedStyle(n).height);return document.body.removeChild(n),p=Number.isNaN(o)||0===o||Number.isNaN(e)||0===e?1.7:o/e}())}:void 0;return o("div",{className:r(["Dropdown",O&&"Dropdown--fluid",T&&x&&`Button--color--${y}`]),children:[n(s,{ref:q,allowedOutsideClasses:".Dropdown__button",closeAfterInteract:!0,content:n("div",{className:"Dropdown__menu",ref:U,style:X,children:0===Q.length?n("div",{className:"Dropdown__menu--entry",children:"No options"}):Q.map(e=>{let o=m(e);return n("div",{className:r(["Dropdown__menu--entry",K===o&&"selected"]),onClick:()=>{V.current=!0,E?.(o),z("")},onKeyDown:e=>{e.key===t.Enter&&(V.current=!0,E?.(o),z(""))},children:"string"==typeof e?e:e.displayText},o)})}),contentAutoWidth:!k,contentClasses:"Dropdown__menu--wrapper",contentStyles:{width:k?l(k):void 0},disabled:D,onMounted:()=>{A&&_&&-1!==G&&H(G)},onOpenChange:L,placement:R,children:T?o("div",{className:"Dropdown__input-wrapper",style:{width:l($)},children:[n(u,{className:r(["Dropdown__input",x&&"Dropdown__input--styled",f]),placeholder:v?.toString()||M,disabled:D,value:P,alwaysUpdate:!0,onKeyDown:e=>{" "===e.key&&e.stopPropagation()},onEnter:()=>{W.current=!0,q.current?.close()},onChange:z,onBlur:function(e){e&&W.current&&!V.current&&Q.length>0&&(V.current=!0,E?.(m(Q[0]))),V.current=!1,W.current=!1,z("")},fluid:!0}),!S&&n("div",{className:"Dropdown__input-chevron",children:n(a,{className:r(["Dropdown__icon","Dropdown__icon--arrow",A&&"open"]),name:"chevron-down"})})]}):o("div",{className:r(["Dropdown__control",`Button--color--${y}`,D&&"Button--disabled",C&&"Dropdown__control--icon-only",f]),onClick:e=>{(!D||A)&&B?.(e)},onKeyDown:e=>{e.key!==t.Enter||D||B?.(e)},style:{width:l($)},children:[N&&n(a,{className:"Dropdown__icon",name:N,rotation:g,spin:b}),!C&&o(e,{children:[n("span",{className:"Dropdown__selected-text",children:v||K&&m(K)||M}),!S&&n(a,{className:r(["Dropdown__icon","Dropdown__icon--arrow",I&&"over",A&&"open"]),name:"chevron-down"})]})]})}),h&&o(e,{children:[n(c,{className:"Dropdown__button",disabled:D,icon:"chevron-left",onClick:()=>{J("previous")}}),n(c,{className:"Dropdown__button",disabled:D,icon:"chevron-right",onClick:()=>{J("next")}})]})]})}new MutationObserver(()=>{p=null}).observe(document.documentElement,{attributes:!0,attributeFilter:["style"]});export{w as Dropdown};
@@ -1,7 +1,18 @@
1
1
  import { type BooleanLike } from '../common/react.ts';
2
2
  import { type Placement } from '@floating-ui/react';
3
3
  import { type CSSProperties, type ReactNode } from 'react';
4
- type Props = {
4
+ export type FloatingHandle = {
5
+ /** Imperatively close the floating element. */
6
+ close: () => void;
7
+ };
8
+ /**
9
+ * ## Floating
10
+ *
11
+ * Floating lets you position elements so that they don't go out of the bounds of the window.
12
+ *
13
+ * - [Documentation](https://floating-ui.com/docs/react) for more information.
14
+ */
15
+ export declare const Floating: import("react").ForwardRefExoticComponent<{
5
16
  /** Interacting with this element will open the floating element. */
6
17
  children: ReactNode;
7
18
  /** The content to display like floating. */
@@ -75,13 +86,4 @@ type Props = {
75
86
  * Called when mounted
76
87
  */
77
88
  onMounted: () => void;
78
- }>;
79
- /**
80
- * ## Floating
81
- *
82
- * Floating lets you position elements so that they don't go out of the bounds of the window.
83
- *
84
- * - [Documentation](https://floating-ui.com/docs/react) for more information.
85
- */
86
- export declare function Floating(props: Props): import("react/jsx-runtime").JSX.Element;
87
- export {};
89
+ }> & import("react").RefAttributes<FloatingHandle>>;
@@ -1 +1 @@
1
- import{Fragment as e,jsx as t,jsxs as n}from"react/jsx-runtime";import{classes as o}from"../common/react.js";import{FloatingPortal as r,autoUpdate as i,flip as a,offset as l,safePolygon as s,shift as c,size as d,useClick as m,useDismiss as p,useFloating as g,useHover as f,useInteractions as h,useTransitionStatus as u}from"@floating-ui/react";import{cloneElement as C,isValidElement as v,useEffect as w,useState as F}from"react";function b(b){let x,{allowedOutsideClasses:y,animationDuration:O,children:R,closeAfterInteract:j,content:k,contentAutoWidth:z,contentClasses:E,contentOffset:M=6,contentStyles:P,disabled:S,hoverDelay:q,hoverOpen:I,hoverSafePolygon:N,handleOpen:$,onMounted:A,placement:B,preventPortal:D,stopChildPropagation:G,onOpenChange:H}=b,[J,K]=F(!1),{refs:L,floatingStyles:Q,context:T}=g({middleware:[l(M),a({padding:6}),c(),z&&d({apply({rects:e,elements:t}){t.floating.style.width=`${e.reference.width}px`}})],onOpenChange(e){K(e),H?.(e)},open:J,placement:B||"bottom",transform:!1,whileElementsMounted:(e,t,n)=>(void 0!==A&&A(),i(e,t,n,{ancestorResize:!1,ancestorScroll:!1,elementResize:!1}))}),{isMounted:U,status:V}=u(T,{duration:O||200}),W=p(T,{ancestorScroll:!0,outsidePress:e=>!y||e.target instanceof Element&&!e.target.closest(y)}),X=m(T,{enabled:!S}),Y=f(T,{enabled:!S,restMs:q||200,handleClose:N?s({requireIntent:!1}):null}),Z=void 0!==$,{getReferenceProps:_,getFloatingProps:ee}=h(Z?[]:[W,I?Y:X]),et=_({ref:L.setReference,...G&&{onClick:e=>e.stopPropagation()}}),en=ee({onClick:()=>{j&&T.onOpenChange(!1)},ref:L.setFloating});w(()=>{Z&&T.onOpenChange($)},[$]),x=v(R)?C(R,et):t("div",{...et,children:R});let eo=t("div",{className:o(["Floating",!O&&"Floating--animated",E]),"data-position":T.placement,"data-transition":V,style:{...Q,...P},...en,children:k});return n(e,{children:[x,U&&!!k&&(D?eo:t(r,{id:"tgui-root",children:eo}))]})}export{b as Floating};
1
+ import{Fragment as e,jsx as t,jsxs as n}from"react/jsx-runtime";import{classes as o}from"../common/react.js";import{FloatingPortal as a,autoUpdate as i,flip as r,offset as l,safePolygon as s,shift as c,size as d,useClick as m,useDismiss as p,useFloating as g,useHover as f,useInteractions as h,useTransitionStatus as u}from"@floating-ui/react";import{cloneElement as C,forwardRef as F,isValidElement as v,useEffect as w,useImperativeHandle as O,useState as b}from"react";let x=F(function(F,x){let y,{allowedOutsideClasses:R,animationDuration:j,children:k,closeAfterInteract:z,content:E,contentAutoWidth:M,contentClasses:P,contentOffset:S=6,contentStyles:q,disabled:I,hoverDelay:N,hoverOpen:$,hoverSafePolygon:_,handleOpen:A,onMounted:B,placement:D,preventPortal:G,stopChildPropagation:H,onOpenChange:J}=F,[K,L]=b(!1),{refs:Q,floatingStyles:T,context:U}=g({middleware:[l(S),r({padding:6}),c(),M&&d({apply({rects:e,elements:t}){t.floating.style.width=`${e.reference.width}px`}})],onOpenChange(e){L(e),J?.(e)},open:K,placement:D||"bottom",transform:!1,whileElementsMounted:(e,t,n)=>(void 0!==B&&B(),i(e,t,n,{ancestorResize:!1,ancestorScroll:!1,elementResize:!1}))});O(x,()=>({close:()=>U.onOpenChange(!1)}));let{isMounted:V,status:W}=u(U,{duration:j||200}),X=p(U,{ancestorScroll:!0,outsidePress:e=>!R||e.target instanceof Element&&!e.target.closest(R)}),Y=m(U,{enabled:!I}),Z=f(U,{enabled:!I,restMs:N||200,handleClose:_?s({requireIntent:!1}):null}),ee=void 0!==A,{getReferenceProps:et,getFloatingProps:en}=h(ee?[]:[X,$?Z:Y]),eo=et({ref:Q.setReference,...H&&{onClick:e=>e.stopPropagation()}}),ea=en({onClick:()=>{z&&U.onOpenChange(!1)},ref:Q.setFloating});w(()=>{ee&&U.onOpenChange(A)},[A]),y=v(k)?C(k,eo):t("div",{...eo,children:k});let ei=t("div",{className:o(["Floating",!j&&"Floating--animated",P]),"data-position":U.placement,"data-transition":W,style:{...T,...q},...ea,children:E});return n(e,{children:[y,V&&!!E&&(G?ei:t(a,{id:"tgui-root",children:ei}))]})});export{x as Floating};
@@ -24,6 +24,8 @@ export type BaseInputProps<TElement = HTMLInputElement, TInput = string> = Parti
24
24
  fluid: boolean;
25
25
  /** Mark this if you want to use a monospace font */
26
26
  monospace: boolean;
27
+ /** Will force an update when value changes even if the input isn't currently highlighted */
28
+ alwaysUpdate: boolean;
27
29
  /** Fires each time focus leaves the input, including if Esc or Enter are pressed */
28
30
  onBlur: (value: TInput) => void;
29
31
  /**
@@ -1 +1 @@
1
- import{jsx as e}from"react/jsx-runtime";import{KEY as t,isEscape as r}from"../common/keys.js";import{classes as n}from"../common/react.js";import{inputDebounce as u}from"../common/timer.js";import{computeBoxClassName as o,computeBoxProps as m}from"../common/ui.js";import{useEffect as c,useRef as l,useState as a}from"react";function p(p){let{autoFocus:i,autoSelect:f,className:s,disabled:d,expensive:g,fluid:v,maxLength:T,monospace:y,onBlur:b,onChange:j,onEnter:I,onEscape:h,onKeyDown:k,placeholder:x,ref:C,selfClear:D,spellcheck:E=!1,value:w,...B}=p,K=l(null),L=C??K,[N,q]=a(w??"");c(()=>{let e;return(i||f)&&(e=setTimeout(()=>{L.current?.focus(),f&&L.current?.select()},1)),()=>clearTimeout(e)},[]),c(()=>{L.current&&document.activeElement!==L.current&&w!==N&&q(w??"")},[w]);let z=m(B),A=n(["Input",d&&"Input--disabled",v&&"Input--fluid",y&&"Input--monospace",o(B),s]);return e("input",{...z,autoComplete:"off",className:A,disabled:d,maxLength:T,onBlur:()=>b?.(N),onChange:function(e){let t=e.currentTarget.value;q(t),g?u("number"==typeof g?g:250)(()=>j?.(t,e)):j?.(t,e)},onKeyDown:function(e){if(k?.(e),e.key===t.Enter){e.preventDefault(),I?.(e.currentTarget.value,e),D&&q(""),e.currentTarget.blur();return}r(e.key)&&(e.preventDefault(),h?.(e.currentTarget.value,e),e.currentTarget.blur())},placeholder:x,ref:L,spellCheck:E,type:"text",value:N})}export{p as Input};
1
+ import{jsx as e}from"react/jsx-runtime";import{KEY as t,isEscape as r}from"../common/keys.js";import{classes as n}from"../common/react.js";import{inputDebounce as u}from"../common/timer.js";import{computeBoxClassName as o,computeBoxProps as m}from"../common/ui.js";import{useEffect as c,useRef as l,useState as a}from"react";function p(p){let{autoFocus:i,autoSelect:f,className:s,disabled:d,expensive:g,fluid:v,maxLength:T,monospace:y,onBlur:b,onChange:j,onEnter:I,onEscape:h,onKeyDown:k,placeholder:x,ref:C,selfClear:D,alwaysUpdate:E,spellcheck:w=!1,value:B,...K}=p,L=l(null),N=C??L,[q,z]=a(B??"");c(()=>{let e;return(i||f)&&(e=setTimeout(()=>{N.current?.focus(),f&&N.current?.select()},1)),()=>clearTimeout(e)},[]),c(()=>{(N.current&&document.activeElement!==N.current&&B!==q||E)&&z(B??"")},[B]);let A=m(K),F=n(["Input",d&&"Input--disabled",v&&"Input--fluid",y&&"Input--monospace",o(K),s]);return e("input",{...A,autoComplete:"off",className:F,disabled:d,maxLength:T,onBlur:()=>b?.(q),onChange:function(e){let t=e.currentTarget.value;z(t),g?u("number"==typeof g?g:250)(()=>j?.(t,e)):j?.(t,e)},onKeyDown:function(e){if(k?.(e),e.key===t.Enter){e.preventDefault(),I?.(e.currentTarget.value,e),D&&z(""),e.currentTarget.blur();return}r(e.key)&&(e.preventDefault(),h?.(e.currentTarget.value,e),e.currentTarget.blur())},placeholder:x,ref:N,spellCheck:w,type:"text",value:q})}export{p as Input};
@@ -1 +1 @@
1
- import{jsx as r,jsxs as e}from"react/jsx-runtime";import{clamp01 as i,keyOfMatchingRange as s,scale as l}from"../common/math.js";import{classes as a}from"../common/react.js";import{computeBoxClassName as o,computeBoxProps as t}from"../common/ui.js";import{DraggableControl as m}from"./DraggableControl.js";function d(d){let{animated:c,tickWhileDragging:n,format:_,maxValue:f,minValue:h,onChange:u,step:g,stepPixelSize:p,unit:v,value:B,className:N,fillValue:P,color:S,ranges:j={},children:w,...x}=d,y=void 0!==w;return r(m,{dragMatrix:[1,0],animated:c,tickWhileDragging:n,format:_,maxValue:f,minValue:h,onChange:u,step:g,stepPixelSize:p,unit:v,value:B,children:m=>{let{displayElement:d,displayValue:c,dragging:n,editing:_,handleDragStart:u,inputElement:g}=m,p=null!=P,v=i(l(P??c,h,f)),M=i(l(c,h,f)),$=S||s(P??B,j)||"default";return e("div",{className:a(["Slider",_&&"Slider--editing","ProgressBar",`ProgressBar--color--${$}`,N,o(x)]),...t(x),onMouseDown:u,children:[r("div",{className:a(["ProgressBar__fill",p&&!n&&"ProgressBar__fill--animated"]),style:{opacity:.4,width:`${100*Math.max(v,M)}%`}}),r("div",{className:a(["ProgressBar__fill",!n&&"ProgressBar__fill--animated"]),style:{width:`${100*Math.min(v,M)}%`}}),r("div",{className:"Slider__cursorOffset",style:{width:`${100*M}%`},children:r("div",{className:"Slider__cursor",children:n&&r("div",{className:"Slider__popupValue",children:d})})}),r("div",{className:"ProgressBar__content",children:y?w:d}),g]})}})}export{d as Slider};
1
+ import{jsx as r,jsxs as e}from"react/jsx-runtime";import{clamp01 as i,keyOfMatchingRange as l,scale as s}from"../common/math.js";import{classes as a}from"../common/react.js";import{computeBoxClassName as o,computeBoxProps as t}from"../common/ui.js";import{DraggableControl as d}from"./DraggableControl.js";function m(m){let{animated:c,disabled:n,tickWhileDragging:_,format:f,maxValue:h,minValue:u,onChange:g,step:p,stepPixelSize:v,unit:B,value:N,className:P,fillValue:S,color:j,ranges:w={},children:x,...y}=m,M=void 0!==x;return r(d,{dragMatrix:[1,0],animated:c,disabled:n,tickWhileDragging:_,format:f,maxValue:h,minValue:u,onChange:g,step:p,stepPixelSize:v,unit:B,value:N,children:d=>{let{displayElement:m,displayValue:c,dragging:_,editing:f,handleDragStart:g,inputElement:p}=d,v=null!=S,B=i(s(S??c,u,h)),$=i(s(c,u,h)),b=j||l(S??N,w)||"default";return e("div",{className:a(["Slider",n&&"Slider--disabled",f&&"Slider--editing","ProgressBar",`ProgressBar--color--${b}`,P,o(y)]),...t(y),onMouseDown:g,children:[r("div",{className:a(["ProgressBar__fill",v&&!_&&"ProgressBar__fill--animated"]),style:{opacity:.4,width:`${100*Math.max(B,$)}%`}}),r("div",{className:a(["ProgressBar__fill",!_&&"ProgressBar__fill--animated"]),style:{width:`${100*Math.min(B,$)}%`}}),r("div",{className:"Slider__cursorOffset",style:{width:`${100*$}%`},children:r("div",{className:"Slider__cursor",children:_&&r("div",{className:"Slider__popupValue",children:m})})}),r("div",{className:"ProgressBar__content",children:M?x:m}),p]})}})}export{m as Slider};
package/package.json CHANGED
@@ -71,5 +71,5 @@
71
71
  "test": "bun test"
72
72
  },
73
73
  "type": "module",
74
- "version": "5.9.0"
74
+ "version": "5.11.0"
75
75
  }
@@ -5,6 +5,7 @@
5
5
  @include meta.load-css("./atomic/centered-image.scss");
6
6
  @include meta.load-css("./atomic/color.scss");
7
7
  @include meta.load-css("./atomic/debug-layout.scss");
8
+ @include meta.load-css("./atomic/helpers.scss");
8
9
  @include meta.load-css("./atomic/fit-text.scss");
9
10
  @include meta.load-css("./atomic/links.scss");
10
11
  @include meta.load-css("./atomic/outline.scss");
@@ -0,0 +1,19 @@
1
+ .dragging {
2
+ pointer-events: none;
3
+ }
4
+
5
+ .moving {
6
+ cursor: var(--cursor-grab);
7
+ }
8
+
9
+ .resizing-x {
10
+ cursor: var(--cursor-e-resize);
11
+ }
12
+
13
+ .resizing-y {
14
+ cursor: var(--cursor-n-resize);
15
+ }
16
+
17
+ .resizing-both {
18
+ cursor: var(--cursor-se-resize);
19
+ }
package/styles/base.scss CHANGED
@@ -1,29 +1,112 @@
1
1
  /**
2
- * @deprecated Use css-variables
2
+ * TGUI
3
+ * Base variables
4
+ *
5
+ * This file contains all values, like spacings, sizes, etc.
6
+ * You won't find any colors here, just numbers and letters.
7
+ *
8
+ * Made with love by Aylong (https://github.com/AyIong)
3
9
  */
4
10
 
5
- @use "sass:color";
6
- @use "sass:math";
11
+ :root {
12
+ /* Font */
13
+ --font-size: 12px;
14
+ --font-family: Verdana, Geneva, sans-serif;
15
+ --font-family-mono: Consolas, monospace;
7
16
 
8
- $color-fg: hsl(0, 0%, 100%) !default;
9
- $color-bg: var(--color-base) !default;
10
- $color-bg-section: var(--color-section) !default;
11
- $color-bg-grad-spread: var(--base-gradient-spread) !default;
12
- $color-bg-start: var(--color-base-start) !default;
13
- $color-bg-end: var(--color-base-end) !default;
17
+ /* Border thickness */
18
+ --border-thickness-unit: 0.5em;
19
+ /* 1px | 0.085em */
20
+ --border-thickness-tiny: calc(var(--border-thickness-unit) * 0.5 * 0.34);
21
+ /* 2px | 0.17em */
22
+ --border-thickness-small: calc(var(--border-thickness-unit) * 0.34);
23
+ /* 3px | 0.25em */
24
+ --border-thickness-medium: calc(var(--border-thickness-unit) * 0.5);
25
+ /* 4px | 0.33em */
26
+ --border-thickness-large: calc(var(--border-thickness-unit) * 0.66);
27
+ /* 6px | 0.5em */
28
+ --border-thickness-larger: var(--border-thickness-unit);
14
29
 
15
- $cursor-default: var(--cursor-default) !default;
16
- $cursor-hover: var(--cursor-pointer) !default;
17
- $cursor-disabled: var(--cursor-default) !default;
30
+ /* Border radius */
31
+ --border-radius-unit: 1rem;
32
+ /* 2px | 0.17rem */
33
+ --border-radius-tiny: calc(var(--border-radius-unit) * 0.25 * 0.68);
34
+ /* 3px | 0.25rem */
35
+ --border-radius-small: calc(var(--border-radius-unit) * 0.25);
36
+ /* 4px | 0.33rem */
37
+ --border-radius-medium: calc(var(--border-radius-unit) * 0.33);
38
+ /* 6px | 0.5rem */
39
+ --border-radius-large: calc(var(--border-radius-unit) * 0.5);
40
+ /* 10px | 0.75rem */
41
+ --border-radius-larger: calc(var(--border-radius-unit) * 0.75);
42
+ /* 12px | 1rem*/
43
+ --border-radius-huge: var(--border-radius-unit);
44
+ /* 24px | 2rem*/
45
+ --border-radius-giant: calc(var(--border-radius-unit) * 2);
46
+ /* Maximum border radius. Makes perfect circles */
47
+ --border-radius-circular: 99999px;
18
48
 
19
- $unit: 12px;
20
- $font-size: 1 * $unit !default;
21
- $border-radius: 0.16em !default;
49
+ /* Spacing */
50
+ --space-unit: 1em;
51
+ /* 1px | 0.085em */
52
+ --space-xxs: calc(var(--space-unit) * 0.25 * 0.34);
53
+ /* 2px | 0.17em */
54
+ --space-xs: calc(var(--space-unit) * 0.25 * 0.68);
55
+ /* 3px | 0.25em */
56
+ --space-s: calc(var(--space-unit) * 0.25);
57
+ /* 4px | 0.33em */
58
+ --space-sm: calc(var(--space-unit) * 0.33);
59
+ /* 6px | 0.5em */
60
+ --space-m: calc(var(--space-unit) * 0.5);
61
+ /* 8px | 0.66em */
62
+ --space-ml: calc(var(--space-unit) * 0.66);
63
+ /* 10px | 0.75em */
64
+ --space-l: calc(var(--space-unit) * 0.75);
65
+ /* 12px | 1em*/
66
+ --space-xl: var(--space-unit);
67
+ /* 24px | 2em*/
68
+ --space-xxl: calc(var(--space-unit) * 2);
22
69
 
23
- @function em($px) {
24
- @return 1em * math.div($px, $unit);
25
- }
70
+ /* Transition */
71
+ --transition-time-unit: 1s;
72
+ /* 0.1s | 100ms */
73
+ --transition-time-fast: calc(var(--transition-time-unit) * 0.1);
74
+ /* 0.2s | 200ms */
75
+ --transition-time-medium: calc(var(--transition-time-unit) * 0.2);
76
+ /* 0.5s | 500ms */
77
+ --transition-time-slow: calc(var(--transition-time-unit) * 0.5);
78
+ /* 1s | 1000ms */
79
+ --transition-time-slowest: var(--transition-time-unit);
80
+
81
+ /* Shadows */
82
+ --shadow-unit: 1rem;
83
+ /* 0 0 0.5rem */
84
+ --shadow-glow-small: 0 0 calc(var(--shadow-unit) * 0.5);
85
+ /* 0 0 1rem */
86
+ --shadow-glow-medium: 0 0 var(--shadow-unit);
87
+ /* 0 0 2rem */
88
+ --shadow-glow-large: 0 0 calc(var(--shadow-unit) * 2);
89
+
90
+ /* Blur */
91
+ --blur-small: blur(6px);
92
+ --blur-medium: blur(12px);
93
+ --blur-large: blur(24px);
94
+
95
+ /* Adjustments */
96
+ /* Color lightness multiplier. + for FG - for BG */
97
+ --adjust-color: 5;
98
+ /* Color lightness multiplier when hovered */
99
+ --adjust-hover: 10;
100
+ /* Color lightness multiplier when active (clicked) */
101
+ --adjust-active: 7.5;
26
102
 
27
- @function rem($px) {
28
- @return 1rem * math.div($px, $unit);
103
+ /* Cursors */
104
+ --cursor-default: default;
105
+ --cursor-pointer: pointer;
106
+ --cursor-grab: grab;
107
+ --cursor-disabled: var(--cursor-default);
108
+ --cursor-n-resize: n-resize;
109
+ --cursor-s-resize: s-resize;
110
+ --cursor-se-resize: se-resize;
111
+ --cursor-e-resize: e-resize;
29
112
  }
@@ -1,40 +1,122 @@
1
1
  /**
2
- * Copyright (c) 2020 Aleksej Komarov
3
- * SPDX-License-Identifier: MIT
2
+ * TGUI
3
+ * Main Colors
4
4
  *
5
- * @deprecated Use css-variables
5
+ * This file contains all the main colors that are
6
+ * used elsewhere and are mixed/modified to
7
+ * suit the needs of the components/ui's.
8
+ *
9
+ * The main goal is to standardize colors.
10
+ * When adding new independent colors, you should add them here.
11
+ *
12
+ * Overwriting these variables will have an extreme impact
13
+ * on the global appearance of the entire TGUI, as they are used everywhere.
14
+ * For finer customization of components, use vars-components.scss
6
15
  */
7
16
 
8
17
  @use "sass:color";
9
18
  @use "sass:map";
10
19
  @use "sass:meta";
11
20
 
12
- // Base colors
13
- $black: var(--color-black) !default;
14
- $white: var(--color-white) !default;
15
- $red: var(--color-red) !default;
16
- $orange: var(--color-orange) !default;
17
- $yellow: var(--color-yellow) !default;
18
- $olive: var(--color-olive) !default;
19
- $green: var(--color-green) !default;
20
- $teal: var(--color-teal) !default;
21
- $blue: var(--color-blue) !default;
22
- $violet: var(--color-violet) !default;
23
- $purple: var(--color-purple) !default;
24
- $pink: var(--color-pink) !default;
25
- $brown: var(--color-brown) !default;
26
- $grey: var(--color-grey) !default;
27
- $light-grey: var(--color-light-grey) !default;
21
+ :root {
22
+ /* Background colors */
23
+ --color-base: hsl(0, 0%, 15%);
24
+ --color-section: hsla(0, 0%, 0%, 0.33);
25
+ --color-secondary: hsl(
26
+ from var(--color-base) var(--secondary-hue) var(--secondary-saturation)
27
+ calc(l + var(--secondary-lightness-adjustment))
28
+ );
29
+ --secondary-hue: h;
30
+ --secondary-saturation: s;
31
+ --secondary-lightness-adjustment: 7.5;
32
+ --base-gradient-spread: 2;
33
+ --color-base-start: hsl(
34
+ from var(--color-base) h s calc(l + var(--base-gradient-spread))
35
+ );
36
+ --color-base-end: hsl(
37
+ from var(--color-base) h s calc(l - var(--base-gradient-spread))
38
+ );
39
+
40
+ /* Scrollbar */
41
+ --color-scrollbar-base: var(--color-section);
42
+ --color-scrollbar-thumb: hsl(from var(--color-base) h s calc(l + 9.25));
43
+
44
+ /* Candystripe */
45
+ --candystripe-odd: hsla(0, 0%, 0%, 0.25);
46
+ --candystripe-even: transparent;
47
+
48
+ /* Base colors */
49
+ --color-red: hsl(0, 70%, 50%);
50
+ --color-orange: hsl(25, 90%, 50%);
51
+ --color-yellow: hsl(50, 97.5%, 50%);
52
+ --color-olive: hsl(70, 75%, 45%);
53
+ --color-green: hsl(140, 70%, 40%);
54
+ --color-teal: hsl(180, 100%, 35%);
55
+ --color-blue: hsl(210, 65%, 47.5%);
56
+ --color-violet: hsl(260, 60%, 50%);
57
+ --color-purple: hsl(290, 60%, 50%);
58
+ --color-pink: hsl(325, 70%, 50%);
59
+ --color-brown: hsl(25, 47.5%, 45%);
60
+
61
+ /* Additional colors */
62
+ --color-gold: hsl(40, 90%, 50%);
63
+
64
+ /* Grayscale colors */
65
+ --color-black: hsl(0, 0%, 0%);
66
+ --color-white: hsl(0, 0%, 100%);
67
+ --color-grey: hsl(0, 0%, 50%);
68
+ --color-light-grey: hsl(0, 0%, 66.6%);
69
+ --color-gray: var(--color-grey);
70
+ --color-light-gray: var(--color-light-grey);
71
+
72
+ /* Action colors */
73
+ --color-action: hsl(0, 0%, 50%);
74
+ --color-hover: hsl(from var(--color-action) h s l / 0.25);
75
+ --color-active: hsl(from var(--color-action) h s l / 0.3);
76
+ --color-selected: hsl(from var(--color-action) h s l / 0.4);
77
+
78
+ /* Semantic colors */
79
+ --primary-hue: 210;
80
+ --primary-saturation: 37.5%;
81
+ --primary-lightness: 45%;
82
+ --color-primary: hsl(
83
+ var(--primary-hue),
84
+ var(--primary-saturation),
85
+ var(--primary-lightness)
86
+ );
87
+ --color-good: hsl(95, 62.5%, 40%);
88
+ --color-average: hsl(32.5, 90%, 50%);
89
+ --color-bad: hsl(0, 72.5%, 50%);
90
+ --color-label: hsl(from var(--color-primary) h 17.5 57.5);
28
91
 
29
- $primary: var(--color-primary) !default;
30
- $good: var(--color-good) !default;
31
- $average: var(--color-average) !default;
32
- $bad: var(--color-bad) !default;
33
- $label: var(--color-label) !default;
92
+ /* Text colors */
93
+ --color-text: var(--color-white);
94
+ --color-text-translucent: hsl(from var(--color-text) h s l / 0.5);
95
+ --color-text-translucent-light: hsl(from var(--color-text) h s l / 0.75);
96
+ --color-text-fixed-white: var(--color-white);
97
+ --color-text-fixed-black: var(--color-black);
98
+
99
+ /* Link colors */
100
+ --color-hyperlink: hsl(220, 100%, 70%);
101
+ --color-hyperlink-visited: hsl(260, 100%, 70%);
102
+ --color-hyperlink-new: hsl(0, 100%, 70%);
103
+ --color-hyperlink-new-visited: hsl(15, 100%, 70%);
104
+
105
+ /* Border */
106
+ --color-border: hsla(0, 0%, 100%, 0.1);
107
+ --color-border-dark: hsla(0, 0%, 0%, 0.33);
108
+ --border-primary-saturation: 100;
109
+ --border-primary-lightness: 75;
110
+ --border-primary-alpha: 0.75;
111
+ --color-border-primary: hsl(
112
+ from var(--color-primary) h var(--border-primary-saturation)
113
+ var(--border-primary-lightness) / var(--border-primary-alpha)
114
+ );
115
+ --color-border-secondary: hsl(from var(--color-border-primary) h s l / 1);
116
+ }
34
117
 
35
118
  // Mappings of color names
36
119
  $color-map: ();
37
-
38
120
  $_gen_map: (
39
121
  /* Base colors */ "red": var(--color-red),
40
122
  "orange": var(--color-orange),
@@ -72,18 +154,3 @@ $color-map-keys: map.keys($_gen_map) !default;
72
154
  )
73
155
  );
74
156
  }
75
-
76
- /**
77
- * Background and foreground color lightness ratios
78
- * @deprecated
79
- */
80
- $bg-lightness: -15% !default;
81
- $fg-lightness: 10% !default;
82
-
83
- @function bg($color) {
84
- @return hsl(from $color h s calc(l - var(--adjust-color)));
85
- }
86
-
87
- @function fg($color) {
88
- @return hsl(from $color h s calc(l + var(--adjust-color)));
89
- }
@@ -1,4 +1,3 @@
1
- @use "../base";
2
1
  @use "../colors";
3
2
 
4
3
  @mixin button-color() {
@@ -1,4 +1,4 @@
1
- @use "../base";
1
+ @use "../functions" as fn;
2
2
 
3
3
  .Dialog {
4
4
  position: fixed;
@@ -13,7 +13,7 @@
13
13
  display: flex;
14
14
  flex-direction: column;
15
15
  font-family: var(--font-family-mono);
16
- font-size: base.em(14px);
16
+ font-size: fn.em(14px);
17
17
  background-color: var(--color-base);
18
18
  }
19
19
 
@@ -1,4 +1,5 @@
1
1
  @use "../base";
2
+ @use "../functions" as fn;
2
3
  @use "./Button" as button;
3
4
 
4
5
  .Dropdown {
@@ -24,18 +25,33 @@
24
25
  width: 100%;
25
26
  }
26
27
 
28
+ &__input,
27
29
  &__control {
28
30
  display: flex;
29
31
  overflow: hidden;
30
32
  flex: 1;
31
33
  font-family: var(--font-family);
32
- font-size: base.em(12px);
33
- line-height: base.em(16px);
34
- height: base.em(22px);
34
+ font-size: fn.em(12px);
35
+ line-height: fn.em(16px);
36
+ height: fn.em(22px);
35
37
  border-radius: var(--button-border-radius);
36
38
  @include button.button-color();
37
39
  }
38
40
 
41
+ &__input-wrapper {
42
+ position: relative;
43
+ display: flex;
44
+ flex: 1;
45
+ }
46
+
47
+ &__input-chevron {
48
+ position: absolute;
49
+ right: 4px;
50
+ top: 50%;
51
+ transform: translateY(-50%);
52
+ pointer-events: none;
53
+ }
54
+
39
55
  &__selected-text {
40
56
  flex: 1;
41
57
  display: inline-block;
@@ -53,7 +69,7 @@
53
69
  align-content: center;
54
70
  text-align: center;
55
71
  height: 100%;
56
- width: base.em(22px);
72
+ width: fn.em(22px);
57
73
  transition: transform var(--dropdown-transition);
58
74
 
59
75
  &--arrow {
@@ -73,7 +89,7 @@
73
89
  overflow-y: auto;
74
90
  scrollbar-width: thin;
75
91
  scrollbar-color: var(--color-scrollbar-thumb) transparent;
76
- max-height: base.em(200px);
92
+ max-height: var(--dropdown-menu-max-height);
77
93
  padding: var(--space-sm);
78
94
 
79
95
  &--wrapper {
@@ -91,8 +107,8 @@
91
107
  white-space: nowrap;
92
108
  text-overflow: ellipsis;
93
109
  font-family: var(--font-family);
94
- font-size: base.em(12px);
95
- line-height: base.em(16px);
110
+ font-size: fn.em(12px);
111
+ line-height: var(--dropdown-entry-line-height);
96
112
  padding: var(--space-xs) var(--space-m);
97
113
  border-radius: var(--dropdown-entry-border-radius);
98
114
  transition: background-color var(--dropdown-entry-transition);
@@ -125,3 +141,16 @@
125
141
  justify-content: center;
126
142
  max-width: 2rem;
127
143
  }
144
+
145
+ .Dropdown__input--styled {
146
+ --input-background: var(--button-background);
147
+ --input-border-color: var(--color-border-dark);
148
+ --input-border-color-focus: var(--color-border-dark);
149
+ --input-border-disabled: var(--color-border-dark);
150
+ --input-color: var(--button-color);
151
+ --input-color-placeholder: var(--button-color);
152
+
153
+ &.Input::placeholder {
154
+ font-style: normal;
155
+ }
156
+ }
@@ -1,4 +1,4 @@
1
- @use "../base";
1
+ @use "../functions" as fn;
2
2
 
3
3
  .MenuBar {
4
4
  display: flex;
@@ -6,8 +6,8 @@
6
6
 
7
7
  .MenuBar__font {
8
8
  font-family: var(--menu-bar-font-family);
9
- font-size: base.em(12px);
10
- line-height: base.em(17px);
9
+ font-size: fn.em(12px);
10
+ line-height: fn.em(17px);
11
11
 
12
12
  &.MenuBar__disabled {
13
13
  color: hsl(from currentColor h s l / 0.2);
@@ -75,7 +75,7 @@
75
75
  .MenuBar__MenuBarButton-text {
76
76
  text-overflow: clip;
77
77
  white-space: nowrap;
78
- height: base.em(17px);
78
+ height: fn.em(17px);
79
79
  }
80
80
 
81
81
  .MenuBar__Separator {
@@ -1,4 +1,4 @@
1
- @use "../base";
1
+ @use "../functions" as fn;
2
2
  @use "../colors";
3
3
 
4
4
  .NoticeBox {
@@ -12,8 +12,8 @@
12
12
  );
13
13
  background-image: repeating-linear-gradient(
14
14
  -45deg,
15
- transparent 0 base.em(10px),
16
- var(--notice-box-stripes) base.em(10px) base.em(20px)
15
+ transparent 0 fn.em(10px),
16
+ var(--notice-box-stripes) fn.em(10px) fn.em(20px)
17
17
  );
18
18
  color: var(--notice-box-color);
19
19
  }
@@ -1,4 +1,4 @@
1
- @use "../base";
1
+ @use "../functions" as fn;
2
2
 
3
3
  .NumberInput {
4
4
  cursor: var(--cursor-n-resize);
@@ -6,7 +6,7 @@
6
6
  position: relative;
7
7
  display: inline-block;
8
8
  text-align: right;
9
- line-height: base.em(17px);
9
+ line-height: fn.em(17px);
10
10
  padding: 0 var(--space-sm);
11
11
  margin-right: var(--space-xs);
12
12
  background-color: var(--number-input-background);
@@ -39,7 +39,7 @@
39
39
  position: absolute;
40
40
  bottom: 0;
41
41
  left: 0;
42
- width: base.em(3px);
42
+ width: fn.em(3px);
43
43
  box-sizing: border-box;
44
44
  border-bottom: var(--border-thickness-tiny) solid
45
45
  var(--number-input-border-color-active);
@@ -54,9 +54,9 @@
54
54
  border: 0;
55
55
  outline: 0;
56
56
  width: 100%;
57
- font-size: base.em(12px);
58
- line-height: base.em(17px);
59
- height: base.em(17px);
57
+ font-size: fn.em(12px);
58
+ line-height: fn.em(17px);
59
+ height: fn.em(17px);
60
60
  margin: 0;
61
61
  padding: 0 var(--space-m);
62
62
  font-family: var(--font-family);
@@ -1,4 +1,3 @@
1
- @use "../base";
2
1
  @use "../colors";
3
2
 
4
3
  .ProgressBar {
@@ -1,4 +1,4 @@
1
- @use "../base";
1
+ @use "../functions" as fn;
2
2
 
3
3
  .Section {
4
4
  position: relative;
@@ -21,7 +21,7 @@
21
21
  }
22
22
 
23
23
  .Section__titleText {
24
- font-size: base.em(14px);
24
+ font-size: fn.em(14px);
25
25
  font-weight: bold;
26
26
  color: var(--section-title-color);
27
27
  }
@@ -107,12 +107,12 @@
107
107
 
108
108
  // Level 2 section title
109
109
  .Section .Section .Section__titleText {
110
- font-size: base.em(13px);
110
+ font-size: fn.em(13px);
111
111
  }
112
112
 
113
113
  // Level 3 section title
114
114
  .Section .Section .Section .Section__titleText {
115
- font-size: base.em(12px);
115
+ font-size: fn.em(12px);
116
116
  }
117
117
 
118
118
  .Section--flex {
@@ -1,5 +1,3 @@
1
- @use "../base";
2
-
3
1
  .Slider {
4
2
  cursor: e-resize;
5
3
  user-select: none;
@@ -10,6 +8,15 @@
10
8
  }
11
9
  }
12
10
 
11
+ &--disabled {
12
+ cursor: default;
13
+ opacity: var(--slider-disabled-opacity);
14
+
15
+ .Slider__cursor:before {
16
+ display: none;
17
+ }
18
+ }
19
+
13
20
  &__cursor {
14
21
  position: absolute;
15
22
  inset: 0 calc(-1 * var(--space-xxs));
@@ -1,4 +1,4 @@
1
- @use "../base";
1
+ @use "../functions" as fn;
2
2
 
3
3
  .Tooltip {
4
4
  backdrop-filter: var(--tooltip-blur);
@@ -6,7 +6,7 @@
6
6
  border-radius: var(--tooltip-border-radius);
7
7
  box-shadow: 0.1em 0.1em 1.25em -0.1em hsla(0, 0%, 0%, 0.5);
8
8
  color: var(--tooltip-color);
9
- max-width: base.em(250px);
9
+ max-width: fn.em(250px);
10
10
  padding: var(--space-m) var(--space-l);
11
11
  pointer-events: none;
12
12
  text-align: left;
@@ -12,12 +12,32 @@
12
12
  @return math.div($value, $value * 0 + 1);
13
13
  }
14
14
 
15
- // Increases perceptual color lightness.
15
+ /* Darken color, to make it more readable if used as a background */
16
+ @function bg($color) {
17
+ @return hsl(from $color h s calc(l - var(--adjust-color)));
18
+ }
19
+
20
+ /* Lighten color, to make it more readable if used as a text */
21
+ @function fg($color) {
22
+ @return hsl(from $color h s calc(l + var(--adjust-color)));
23
+ }
24
+
25
+ /* Increases perceptual color lightness. */
16
26
  @function lighten($color, $amount) {
17
27
  @return color.adjust($color, $lightness: $amount * 1%, $space: hsl);
18
28
  }
19
29
 
20
- // Decreases perceptual color lightness.
30
+ /* Decreases perceptual color lightness. */
21
31
  @function darken($color, $amount) {
22
32
  @return color.adjust($color, $lightness: -$amount * 1%, $space: hsl);
23
33
  }
34
+
35
+ /* Converts px to em. Relies on the font-size variable. */
36
+ @function em($px) {
37
+ @return calc($px / var(--font-size) * 1em);
38
+ }
39
+
40
+ /* Converts px to rem. Relies on the font-size variable. */
41
+ @function rem($px) {
42
+ @return calc($px / var(--font-size) * 1rem);
43
+ }
package/styles/main.scss CHANGED
@@ -1,8 +1,8 @@
1
1
  @use "sass:meta";
2
2
 
3
3
  // CSS Variables
4
- @use "./vars-colors";
5
- @use "./vars-values";
4
+ @use "./base";
5
+ @use "./colors";
6
6
  @use "./vars-components";
7
7
 
8
8
  // Core styles
@@ -18,6 +18,8 @@
18
18
  *
19
19
  * Made with love by Aylong (https://github.com/AyIong)
20
20
  */
21
+ @use "./base";
22
+ @use "./functions" as fn;
21
23
 
22
24
  :root {
23
25
  /* BlockQuote */
@@ -54,6 +56,8 @@
54
56
  --divider-border: var(--border-thickness-small) solid var(--divider-color);
55
57
 
56
58
  /* Dropdown */
59
+ --dropdown-menu-max-height: #{fn.em(200px)};
60
+ --dropdown-entry-line-height: #{fn.em(16px)};
57
61
  --dropdown-transition: var(--transition-time-medium);
58
62
  --dropdown-menu-color: var(--color-text);
59
63
  --dropdown-menu-background: hsl(
@@ -165,6 +169,7 @@
165
169
  --slider-popup-color: var(--tooltip-color);
166
170
  --slider-popup-border-radius: var(--tooltip-border-radius);
167
171
  --slider-popup-blur: var(--tooltip-blur);
172
+ --slider-disabled-opacity: 0.5;
168
173
 
169
174
  /* Tooltip */
170
175
  --tooltip-color: var(--color-text);
@@ -1,114 +0,0 @@
1
- /**
2
- * TGUI
3
- * Main Colors
4
- *
5
- * This file contains all the main colors that are
6
- * used elsewhere and are mixed/modified to
7
- * suit the needs of the components/ui's.
8
- *
9
- * The main goal is to standardize colors.
10
- * When adding new independent colors, you should add them here.
11
- *
12
- * Overwriting these variables will have an extreme impact
13
- * on the global appearance of the entire TGUI, as they are used everywhere.
14
- * For finer customization of components, use vars-components.scss
15
- *
16
- * Made with love by Aylong (https://github.com/AyIong)
17
- */
18
-
19
- :root {
20
- /* Background colors */
21
- --color-base: hsl(0, 0%, 15%);
22
- --color-section: hsla(0, 0%, 0%, 0.33);
23
- --color-secondary: hsl(
24
- from var(--color-base) var(--secondary-hue) var(--secondary-saturation)
25
- calc(l + var(--secondary-lightness-adjustment))
26
- );
27
- --secondary-hue: h;
28
- --secondary-saturation: s;
29
- --secondary-lightness-adjustment: 7.5;
30
- --base-gradient-spread: 2;
31
- --color-base-start: hsl(
32
- from var(--color-base) h s calc(l + var(--base-gradient-spread))
33
- );
34
- --color-base-end: hsl(
35
- from var(--color-base) h s calc(l - var(--base-gradient-spread))
36
- );
37
-
38
- /* Scrollbar */
39
- --color-scrollbar-base: var(--color-section);
40
- --color-scrollbar-thumb: hsl(from var(--color-base) h s calc(l + 9.25));
41
-
42
- /* Candystripe */
43
- --candystripe-odd: hsla(0, 0%, 0%, 0.25);
44
- --candystripe-even: transparent;
45
-
46
- /* Base colors */
47
- --color-red: hsl(0, 70%, 50%);
48
- --color-orange: hsl(25, 90%, 50%);
49
- --color-yellow: hsl(50, 97.5%, 50%);
50
- --color-olive: hsl(70, 75%, 45%);
51
- --color-green: hsl(140, 70%, 40%);
52
- --color-teal: hsl(180, 100%, 35%);
53
- --color-blue: hsl(210, 65%, 47.5%);
54
- --color-violet: hsl(260, 60%, 50%);
55
- --color-purple: hsl(290, 60%, 50%);
56
- --color-pink: hsl(325, 70%, 50%);
57
- --color-brown: hsl(25, 47.5%, 45%);
58
-
59
- /* Additional colors */
60
- --color-gold: hsl(40, 90%, 50%);
61
-
62
- /* Grayscale colors */
63
- --color-black: hsl(0, 0%, 0%);
64
- --color-white: hsl(0, 0%, 100%);
65
- --color-grey: hsl(0, 0%, 50%);
66
- --color-light-grey: hsl(0, 0%, 66.6%);
67
- --color-gray: var(--color-grey);
68
- --color-light-gray: var(--color-light-grey);
69
-
70
- /* Action colors */
71
- --color-action: hsl(0, 0%, 50%);
72
- --color-hover: hsl(from var(--color-action) h s l / 0.25);
73
- --color-active: hsl(from var(--color-action) h s l / 0.3);
74
- --color-selected: hsl(from var(--color-action) h s l / 0.4);
75
-
76
- /* Semantic colors */
77
- --primary-hue: 210;
78
- --primary-saturation: 37.5%;
79
- --primary-lightness: 45%;
80
- --color-primary: hsl(
81
- var(--primary-hue),
82
- var(--primary-saturation),
83
- var(--primary-lightness)
84
- );
85
- --color-good: hsl(95, 62.5%, 40%);
86
- --color-average: hsl(32.5, 90%, 50%);
87
- --color-bad: hsl(0, 72.5%, 50%);
88
- --color-label: hsl(from var(--color-primary) h 17.5 57.5);
89
-
90
- /* Text colors */
91
- --color-text: var(--color-white);
92
- --color-text-translucent: hsl(from var(--color-text) h s l / 0.5);
93
- --color-text-translucent-light: hsl(from var(--color-text) h s l / 0.75);
94
- --color-text-fixed-white: var(--color-white);
95
- --color-text-fixed-black: var(--color-black);
96
-
97
- /* Link colors */
98
- --color-hyperlink: hsl(220, 100%, 70%);
99
- --color-hyperlink-visited: hsl(260, 100%, 70%);
100
- --color-hyperlink-new: hsl(0, 100%, 70%);
101
- --color-hyperlink-new-visited: hsl(15, 100%, 70%);
102
-
103
- /* Border */
104
- --color-border: hsla(0, 0%, 100%, 0.1);
105
- --color-border-dark: hsla(0, 0%, 0%, 0.33);
106
- --border-primary-saturation: 100;
107
- --border-primary-lightness: 75;
108
- --border-primary-alpha: 0.75;
109
- --color-border-primary: hsl(
110
- from var(--color-primary) h var(--border-primary-saturation)
111
- var(--border-primary-lightness) / var(--border-primary-alpha)
112
- );
113
- --color-border-secondary: hsl(from var(--color-border-primary) h s l / 1);
114
- }
@@ -1,110 +0,0 @@
1
- /**
2
- * TGUI
3
- * Values Variables
4
- *
5
- * This file contains all values, like spacings, sizes, etc.
6
- * You won't find any colors here, just numbers and letters.
7
- *
8
- * Made with love by Aylong (https://github.com/AyIong)
9
- */
10
- :root {
11
- /* Font */
12
- --font-size: 12px;
13
- --font-family: Verdana, Geneva, sans-serif;
14
- --font-family-mono: Consolas, monospace;
15
-
16
- /* Border thickness */
17
- --border-thickness-unit: 0.5em;
18
- /* 1px | 0.085em */
19
- --border-thickness-tiny: calc(var(--border-thickness-unit) * 0.5 * 0.34);
20
- /* 2px | 0.17em */
21
- --border-thickness-small: calc(var(--border-thickness-unit) * 0.34);
22
- /* 3px | 0.25em */
23
- --border-thickness-medium: calc(var(--border-thickness-unit) * 0.5);
24
- /* 4px | 0.33em */
25
- --border-thickness-large: calc(var(--border-thickness-unit) * 0.66);
26
- /* 6px | 0.5em */
27
- --border-thickness-larger: var(--border-thickness-unit);
28
-
29
- /* Border radius */
30
- --border-radius-unit: 1rem;
31
- /* 2px | 0.17rem */
32
- --border-radius-tiny: calc(var(--border-radius-unit) * 0.25 * 0.68);
33
- /* 3px | 0.25rem */
34
- --border-radius-small: calc(var(--border-radius-unit) * 0.25);
35
- /* 4px | 0.33rem */
36
- --border-radius-medium: calc(var(--border-radius-unit) * 0.33);
37
- /* 6px | 0.5rem */
38
- --border-radius-large: calc(var(--border-radius-unit) * 0.5);
39
- /* 10px | 0.75rem */
40
- --border-radius-larger: calc(var(--border-radius-unit) * 0.75);
41
- /* 12px | 1rem*/
42
- --border-radius-huge: var(--border-radius-unit);
43
- /* 24px | 2rem*/
44
- --border-radius-giant: calc(var(--border-radius-unit) * 2);
45
- /* Maximum border radius. Makes perfect circles */
46
- --border-radius-circular: 99999px;
47
-
48
- /* Spacing */
49
- --space-unit: 1em;
50
- /* 1px | 0.085em */
51
- --space-xxs: calc(var(--space-unit) * 0.25 * 0.34);
52
- /* 2px | 0.17em */
53
- --space-xs: calc(var(--space-unit) * 0.25 * 0.68);
54
- /* 3px | 0.25em */
55
- --space-s: calc(var(--space-unit) * 0.25);
56
- /* 4px | 0.33em */
57
- --space-sm: calc(var(--space-unit) * 0.33);
58
- /* 6px | 0.5em */
59
- --space-m: calc(var(--space-unit) * 0.5);
60
- /* 8px | 0.66em */
61
- --space-ml: calc(var(--space-unit) * 0.66);
62
- /* 10px | 0.75em */
63
- --space-l: calc(var(--space-unit) * 0.75);
64
- /* 12px | 1em*/
65
- --space-xl: var(--space-unit);
66
- /* 24px | 2em*/
67
- --space-xxl: calc(var(--space-unit) * 2);
68
-
69
- /* Transition */
70
- --transition-time-unit: 1s;
71
- /* 0.1s | 100ms */
72
- --transition-time-fast: calc(var(--transition-time-unit) * 0.1);
73
- /* 0.2s | 200ms */
74
- --transition-time-medium: calc(var(--transition-time-unit) * 0.2);
75
- /* 0.5s | 500ms */
76
- --transition-time-slow: calc(var(--transition-time-unit) * 0.5);
77
- /* 1s | 1000ms */
78
- --transition-time-slowest: var(--transition-time-unit);
79
-
80
- /* Shadows */
81
- --shadow-unit: 1rem;
82
- /* 0 0 0.5rem */
83
- --shadow-glow-small: 0 0 calc(var(--shadow-unit) * 0.5);
84
- /* 0 0 1rem */
85
- --shadow-glow-medium: 0 0 var(--shadow-unit);
86
- /* 0 0 2rem */
87
- --shadow-glow-large: 0 0 calc(var(--shadow-unit) * 2);
88
-
89
- /* Blur */
90
- --blur-small: blur(6px);
91
- --blur-medium: blur(12px);
92
- --blur-large: blur(24px);
93
-
94
- /* Adjustments */
95
- /* Color lightness multiplier. + for FG - for BG */
96
- --adjust-color: 5;
97
- /* Color lightness multiplier wneh hovered */
98
- --adjust-hover: 10;
99
- /* Color lightness multiplier when active (clicked) */
100
- --adjust-active: 7.5;
101
-
102
- /* Cursors */
103
- --cursor-default: default;
104
- --cursor-pointer: pointer;
105
- --cursor-disabled: var(--cursor-default);
106
- --cursor-n-resize: n-resize;
107
- --cursor-s-resize: s-resize;
108
- --cursor-se-resize: se-resize;
109
- --cursor-e-resize: e-resize;
110
- }