-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow to customize toolbars with any UI components
- Loading branch information
Showing
21 changed files
with
320 additions
and
145 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
:host { | ||
// TODO: shared with tool_button.less | ||
--button-color: lightgray; | ||
} | ||
|
||
:host { | ||
flex: 0 0 auto; | ||
background-color: var(--button-color); | ||
} | ||
|
||
:host(.bk-horizontal) { | ||
height: 10px; | ||
width: 1px; | ||
} | ||
|
||
:host(.bk-vertical) { | ||
height: 1px; | ||
width: 10px; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,21 @@ | ||
.bk-logo { | ||
margin: 5px; | ||
position: relative; | ||
display: block; | ||
:host { | ||
// TODO: shared with tool_button.less | ||
--button-width: 30px; | ||
--button-height: 30px; | ||
} | ||
|
||
:host { | ||
flex: 0 0 auto; | ||
background-repeat: no-repeat; | ||
&.bk-grey { | ||
filter: grayscale(100%); | ||
} | ||
background-position: center; | ||
} | ||
|
||
:host(.bk-grey) { | ||
filter: grayscale(100%); | ||
} | ||
|
||
.bk-logo-small { | ||
width: 20px; | ||
height: 20px; | ||
:host(.bk-small) { | ||
width: var(--button-width); | ||
height: var(--button-width); | ||
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAABx0RVh0U29mdHdhcmUAQWRvYmUgRmlyZXdvcmtzIENTNui8sowAAAOkSURBVDiNjZRtaJVlGMd/1/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g6Ckj5qebgBVbT3V3NNXMSiWSDdGV3hrtzla7J+duwPOToIg42ChPQOQjspnSlp1V+Gjdged7+8UN5CRAV7a5EdFNwCjEaBR27b3W890TE7g24NAP/mMDXRWrGoFPQI9ls/MWO2dWFAar/xcOIImbbpA3zgAAAABJRU5ErkJggg==); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import {UIElement, UIElementView} from "../ui/ui_element" | ||
import type {ToolbarView} from "./toolbar" | ||
import type {StyleSheetLike} from "core/dom" | ||
import * as divider_css from "styles/divider.css" | ||
import type * as p from "core/properties" | ||
|
||
export class DividerView extends UIElementView { | ||
declare model: Divider | ||
declare parent: ToolbarView | ||
|
||
override stylesheets(): StyleSheetLike[] { | ||
return [...super.stylesheets(), divider_css.default] | ||
} | ||
|
||
override render(): void { | ||
super.render() | ||
this.class_list.add(divider_css[this.parent.orientation]) | ||
} | ||
} | ||
|
||
export namespace Divider { | ||
export type Attrs = p.AttrsOf<Props> | ||
export type Props = UIElement.Props | ||
} | ||
|
||
export interface Divider extends Divider.Attrs {} | ||
|
||
export class Divider extends UIElement { | ||
declare properties: Divider.Props | ||
declare __view_type__: DividerView | ||
|
||
constructor(attrs?: Partial<Divider.Attrs>) { | ||
super(attrs) | ||
} | ||
|
||
static { | ||
this.prototype.default_view = DividerView | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
import {UIElement, UIElementView} from "../ui/ui_element" | ||
import type {ToolbarView} from "./toolbar" | ||
import {LogoStyle as LogoStyle} from "core/enums" | ||
import type {StyleSheetLike} from "core/dom" | ||
import {a} from "core/dom" | ||
import * as logo_css from "styles/logo.css" | ||
import type * as p from "core/properties" | ||
|
||
export class LogoView extends UIElementView { | ||
declare model: Logo | ||
declare parent: ToolbarView | ||
|
||
override stylesheets(): StyleSheetLike[] { | ||
return [...super.stylesheets(), logo_css.default] | ||
} | ||
|
||
override render(): void { | ||
super.render() | ||
|
||
this.class_list.add(logo_css.small) | ||
this.class_list.toggle(logo_css.grey, this.model.style == "grey") | ||
|
||
const logo_el = a({href: "https://bokeh.org/", target: "_blank"}) | ||
this.shadow_el.append(logo_el) | ||
} | ||
} | ||
|
||
export namespace Logo { | ||
export type Attrs = p.AttrsOf<Props> | ||
|
||
export type Props = UIElement.Props & { | ||
style: p.Property<LogoStyle> | ||
} | ||
} | ||
|
||
export interface Logo extends Logo.Attrs {} | ||
|
||
export class Logo extends UIElement { | ||
declare properties: Logo.Props | ||
declare __view_type__: LogoView | ||
|
||
constructor(attrs?: Partial<Logo.Attrs>) { | ||
super(attrs) | ||
} | ||
|
||
static { | ||
this.prototype.default_view = LogoView | ||
|
||
this.define<Logo.Props>(() => ({ | ||
style: [ LogoStyle, "normal" ], | ||
})) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.