Comparing version 0.0.10 to 0.0.11
{ | ||
"name": "adwavecss", | ||
"displayName": "ADWave CSS", | ||
"version": "0.0.10", | ||
"version": "0.0.11", | ||
"description": "Adwaita/GTK inspired CSS for the web.", | ||
@@ -6,0 +6,0 @@ "keywords": [ |
@@ -5,2 +5,4 @@ # ADWaveCSS | ||
See [examples here](https://ncpa0.github.io/adwave-docs). | ||
## Usage | ||
@@ -7,0 +9,0 @@ |
304
src/index.ts
@@ -5,2 +5,12 @@ export class Theme { | ||
static readonly light2 = "light-theme-2"; | ||
static className(params: { type?: "dark" | "light" | "light2" }) { | ||
switch (params.type) { | ||
case "light": | ||
return Theme.light; | ||
case "light2": | ||
return Theme.light2; | ||
} | ||
return Theme.dark; | ||
} | ||
} | ||
@@ -32,2 +42,23 @@ | ||
static readonly bg4 = "bg-level-4"; | ||
static className(params: { rounded?: boolean; bg?: 1 | 2 | 3 | 4 }) { | ||
let className = Box.box; | ||
if (params.rounded) { | ||
className += ` ${Box.rounded}`; | ||
} | ||
if (params.bg) { | ||
switch (params.bg) { | ||
case 4: | ||
className += ` ${Box.bg4}`; | ||
break; | ||
case 3: | ||
className += ` ${Box.bg3}`; | ||
break; | ||
case 2: | ||
className += ` ${Box.bg2}`; | ||
break; | ||
} | ||
} | ||
return className; | ||
} | ||
} | ||
@@ -91,2 +122,58 @@ | ||
static readonly linkedVertical = "vertical"; | ||
static className(params: { | ||
disabled?: boolean; | ||
color?: "primary" | "danger"; | ||
shape?: "circular" | "square"; | ||
flat?: boolean; | ||
pill?: boolean; | ||
toggled?: boolean; | ||
adaptive?: boolean; | ||
linked?: boolean; | ||
linkedVertical?: boolean; | ||
}) { | ||
let className = Button.button; | ||
if (params.disabled) { | ||
className += ` ${Button.disabled}`; | ||
} | ||
if (params.color) { | ||
switch (params.color) { | ||
case "primary": | ||
className += ` ${Button.primary}`; | ||
break; | ||
case "danger": | ||
className += ` ${Button.danger}`; | ||
break; | ||
} | ||
} | ||
if (params.shape) { | ||
switch (params.shape) { | ||
case "circular": | ||
className += ` ${Button.circular}`; | ||
break; | ||
case "square": | ||
className += ` ${Button.square}`; | ||
break; | ||
} | ||
} | ||
if (params.flat) { | ||
className += ` ${Button.flat}`; | ||
} | ||
if (params.pill) { | ||
className += ` ${Button.pill}`; | ||
} | ||
if (params.toggled) { | ||
className += ` ${Button.toggled}`; | ||
} | ||
if (params.adaptive) { | ||
className += ` ${Button.adaptive}`; | ||
} | ||
if (params.linked) { | ||
className += ` ${Button.linked}`; | ||
} | ||
if (params.linkedVertical) { | ||
className += ` ${Button.linkedVertical}`; | ||
} | ||
return className; | ||
} | ||
} | ||
@@ -106,2 +193,10 @@ | ||
static readonly activable = "activable"; | ||
static className(params: { activable?: boolean }) { | ||
let className = Card.card; | ||
if (params.activable) { | ||
className += ` ${Card.activable}`; | ||
} | ||
return className; | ||
} | ||
} | ||
@@ -121,2 +216,10 @@ | ||
static readonly disabled = "disabled"; | ||
static className(params: { disabled?: boolean }) { | ||
let className = Checkbox.checkbox; | ||
if (params.disabled) { | ||
className += ` ${Checkbox.disabled}`; | ||
} | ||
return className; | ||
} | ||
} | ||
@@ -132,2 +235,6 @@ | ||
static readonly frame = "frame"; | ||
static className() { | ||
return Frame.frame; | ||
} | ||
} | ||
@@ -159,2 +266,24 @@ | ||
static readonly wrapper = "input-wrapper"; | ||
static className(params: { | ||
disabled?: boolean; | ||
linked?: boolean; | ||
linkedVertical?: boolean; | ||
}) { | ||
let className = Input.input; | ||
if (params.disabled) { | ||
className += ` ${Input.disabled}`; | ||
} | ||
if (params.linked) { | ||
className += ` ${Input.linked}`; | ||
} | ||
if (params.linkedVertical) { | ||
className += ` ${Input.linkedVertical}`; | ||
} | ||
return className; | ||
} | ||
static wrapperClassName() { | ||
return Input.wrapper; | ||
} | ||
} | ||
@@ -178,2 +307,15 @@ | ||
static readonly activableElement = "activable"; | ||
static className() { | ||
let className = List.list; | ||
return className; | ||
} | ||
static elementClassName(params: { activable?: boolean }) { | ||
let className = List.element; | ||
if (params.activable) { | ||
className += ` ${List.activableElement}`; | ||
} | ||
return className; | ||
} | ||
} | ||
@@ -201,2 +343,20 @@ | ||
static readonly error = "error"; | ||
static className(params: { type?: "success" | "alert" | "error" }) { | ||
let className = Message.message; | ||
if (params.type) { | ||
switch (params.type) { | ||
case "success": | ||
className += ` ${Message.success}`; | ||
break; | ||
case "alert": | ||
className += ` ${Message.alert}`; | ||
break; | ||
case "error": | ||
className += ` ${Message.error}`; | ||
break; | ||
} | ||
} | ||
return className; | ||
} | ||
} | ||
@@ -221,2 +381,18 @@ | ||
static readonly active = "active"; | ||
static className() { | ||
return NavSidebar.navSidebar; | ||
} | ||
static btnClassName(params: { active?: boolean }) { | ||
let className = NavSidebar.button; | ||
if (params.active) { | ||
className += ` ${NavSidebar.active}`; | ||
} | ||
return className; | ||
} | ||
static separatorClassName() { | ||
return NavSidebar.separator; | ||
} | ||
} | ||
@@ -226,2 +402,6 @@ | ||
static readonly scrollView = "scrollview"; | ||
static className() { | ||
return ScrollView.scrollView; | ||
} | ||
} | ||
@@ -269,2 +449,44 @@ | ||
static readonly noPosition = "no-position"; | ||
static className(params: { | ||
disabled?: boolean; | ||
opened?: boolean; | ||
noPosition?: boolean; | ||
position?: "top" | "bottom"; | ||
}) { | ||
let className = Selector.selector; | ||
if (params.disabled) { | ||
className += ` ${Selector.disabled}`; | ||
} | ||
if (params.opened) { | ||
className += ` ${Selector.opened}`; | ||
} | ||
if (params.noPosition) { | ||
className += ` ${Selector.noPosition}`; | ||
} | ||
if (params.position === "top") { | ||
className += ` ${Selector.top}`; | ||
} | ||
return className; | ||
} | ||
static optionClassName() { | ||
let className = Selector.option; | ||
return className; | ||
} | ||
static selectedOptionClassName() { | ||
let className = Selector.selectedOption; | ||
return className; | ||
} | ||
static listClassName() { | ||
let className = Selector.optionsList; | ||
return className; | ||
} | ||
static downButtonClassName() { | ||
let className = Selector.downButton; | ||
return className; | ||
} | ||
} | ||
@@ -275,4 +497,20 @@ | ||
static readonly vertical = "vertical"; | ||
static className(params: { vertical?: boolean }) { | ||
let className = Separator.separator; | ||
if (params.vertical) { | ||
className += ` ${Separator.vertical}`; | ||
} | ||
return className; | ||
} | ||
} | ||
export class Skeleton { | ||
static readonly skeleton = "skeleton"; | ||
static className() { | ||
return Skeleton.skeleton; | ||
} | ||
} | ||
/** | ||
@@ -306,2 +544,28 @@ * Read more at @link https://github.com/ncpa0/ADWaveCSS/blob/master/docs/components/slider.md | ||
static readonly noPosition = "no-position"; | ||
static className(params: { disabled?: boolean; noPosition?: boolean }) { | ||
let className = Slider.slider; | ||
if (params.disabled) { | ||
className += ` ${Slider.disabled}`; | ||
} | ||
if (params.noPosition) { | ||
className += ` ${Slider.noPosition}`; | ||
} | ||
return className; | ||
} | ||
static trackClassName() { | ||
let className = Slider.track; | ||
return className; | ||
} | ||
static progressClassName() { | ||
let className = Slider.progress; | ||
return className; | ||
} | ||
static thumbClassName() { | ||
let className = Slider.thumb; | ||
return className; | ||
} | ||
} | ||
@@ -325,2 +589,15 @@ | ||
static readonly active = "active"; | ||
static className() { | ||
let className = Suggestions.suggestions; | ||
return className; | ||
} | ||
static optionClassName(params: { active?: boolean }) { | ||
let className = Suggestions.option; | ||
if (params.active) { | ||
className += ` ${Suggestions.active}`; | ||
} | ||
return className; | ||
} | ||
} | ||
@@ -348,2 +625,13 @@ | ||
static readonly active = "active"; | ||
static className(params: { disabled?: boolean; active?: boolean }) { | ||
let className = Switch.switch; | ||
if (params.disabled) { | ||
className += ` ${Switch.disabled}`; | ||
} | ||
if (params.active) { | ||
className += ` ${Switch.active}`; | ||
} | ||
return className; | ||
} | ||
} | ||
@@ -371,2 +659,14 @@ | ||
static readonly header = "header"; | ||
static className(params: { type?: "subtitle" | "label" | "header" }) { | ||
switch (params.type) { | ||
case "subtitle": | ||
return Typography.subtitle; | ||
case "label": | ||
return Typography.label; | ||
case "header": | ||
return Typography.header; | ||
} | ||
return Typography.text; | ||
} | ||
} | ||
@@ -385,2 +685,4 @@ | ||
Object.freeze(Selector); | ||
Object.freeze(Separator); | ||
Object.freeze(Skeleton); | ||
Object.freeze(Slider); | ||
@@ -404,2 +706,4 @@ Object.freeze(Suggestions); | ||
Selector, | ||
Separator, | ||
Skeleton, | ||
Slider, | ||
@@ -406,0 +710,0 @@ Suggestions, |
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
40
58155
25
646
1