8000 Add support for CSS-based theming on the canvas by mattpap · Pull Request #13828 · bokeh/bokeh · GitHub
[go: up one dir, main page]

Skip to content
Merged
Changes from 1 commit
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
366d1c5
Separate rendering from painting
mattpap Mar 29, 2024
4b74d9a
Make RendererView inherit from DOMComponentView
mattpap Mar 29, 2024
717a6c3
Don't use append(), remove() and replaceWith()
mattpap Apr 11, 2024
18f3e08
Move RendererGroup to a separate module
mattpap Apr 13, 2024
8edd1a1
Introduce StyledElement base class
mattpap Apr 14, 2024
346ad21
Attach renderers' elements to the canvas
mattpap Apr 16, 2024
2783f4d
Use CSS variables in canvas visuals
mattpap Apr 16, 2024
ef6b1f0
Add styling/visuals/css_variables.py
mattpap Apr 16, 2024
ecb85a7
Restore functionality of HTML label annotation
mattpap Apr 17, 2024
084a5ec
Update bokehjs' unit tests
mattpap Apr 17, 2024
6f4193d
Use stylesheet based styling in HTML labels
mattpap Apr 18, 2024
0273ed1
Update cross tests baselines
mattpap Apr 18, 2024
85edc1b
Correctly render the Toolbar in ToolbarPanel
mattpap Apr 21, 2024
fc318fc
Add CSS support to Text and Hatch visuals
mattpap Apr 21, 2024
cad5ad0
Style text in css_variables example
mattpap Apr 21, 2024
9827484
Migrate styling/visuals/css_variables.py to bokehjs
mattpap Apr 21, 2024
75eee1b
Allow to specific rendering target for canvas renderers
mattpap Apr 22, 2024
80aac1f
Reposition menu after toolbar resize if open
mattpap Apr 22, 2024
3dabe74
Correctly update canvas renderers' elements
mattpap Apr 22, 2024
f2d9a79
Allow to recover from invalid gesture state
mattpap Apr 22, 2024
be4ad84
Safeguard against disconnected elements
mattpap Apr 22, 2024
67cba1f
Use render_to() to render toolbar's tool buttons
mattpap Apr 22, 2024
d4c9030
Add integration tests for HTMLLabel
mattpap Apr 22, 2024
431040a
Add docstrings to models/ui/ui_element.py
mattpap Apr 23, 2024
15d4f4a
Remove deprecated APIs from core/dom.ts
mattpap Apr 23, 2024
22bcd1d
Compute CSS prefix of visual properties once
mattpap Apr 23, 2024
0c4c892
Robustify render() and after_render() logic
mattpap Apr 26, 2024
8a28c2a
Call r_after_render() after updating children
mattpap May 1, 2024
980a149
Use computed_renderer_views to avoid race conditions
mattpap May 1, 2024
c9cd2dc
Display duration in devtools' progress bar
mattpap May 1, 2024
5b20522
Robustify is_paused and hold_render logic
mattpap May 1, 2024
2d8bfb0
Recompute toolbar buttons after layout
mattpap May 1, 2024
3bbb63e
Update integration baseline images
mattpap May 1, 2024
77a1459
Robustify ready state in TileRenderer
mattpap May 2, 2024
500f55f
Mark _was_build in after_render()
mattpap May 2, 2024
f22de60
Correctly render contents in Dialog
mattpap May 2, 2024
1e4544a
Add a regression test for issue #13787
mattpap May 2, 2024
11804cd
Update *.blf baseline files
mattpap May 2, 2024
cf8dc3e
Update bokeh's examples
mattpap May 2, 2024
55d9deb
Add release notes
mattpap May 3, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Correctly update canvas renderers' elements
  • Loading branch information
mattpap committed May 1, 2024
commit 3dabe74a7a668fe6702d5c46e6710de3ff001315
44 changes: 36 additions & 8 deletions bokehjs/src/lib/models/plots/plot_canvas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import {Panel} from "../ui/panel"
import {Div} from "../dom/elements"

import {Reset} from "core/bokeh_events"
import type {ViewStorage, IterViews, ViewOf} from "core/build_views"
import type {ViewStorage, IterViews, ViewOf, BuildResult} from "core/build_views"
import {build_views, remove_views} from "core/build_views"
import type {Paintable} from "core/visuals"
import {Visuals} from "core/visuals"
Expand Down Expand Up @@ -763,10 +763,38 @@ export class PlotView extends LayoutDOMView implements Paintable {
// TODO this._attribution.title = contents_el.textContent!.replace(/\s*\n\s*/g, " ")
}

async build_renderer_views(): Promise<void> {
protected async _build_renderers(): Promise<BuildResult<Renderer>> {
this.computed_renderers = [...this._compute_renderers()]
await build_views(this.renderer_views, this.computed_renderers, {parent: this})
const result = await build_views(this.renderer_views, this.computed_renderers, {parent: this})
this._update_attribution()
return result
}

protected async _update_renderers(): Promise<void> {
const {created} = await this._build_renderers()
const created_renderers = new Set(created)

// First remove and then either reattach existing renderers or render and
// attach new renderers, so that the order of children is consistent, while
// avoiding expensive re-rendering of existing views.
for (const renderer_view of this.renderer_views.values()) {
renderer_view.el.remove()
}

for (const renderer_view of this.renderer_views.values()) {
const is_new = created_renderers.has(renderer_view)

const target = renderer_view.rendering_target()
if (is_new) {
renderer_view.render_to(target)
} else {
target.append(renderer_view.el)
}
}
}

async build_renderer_views(): Promise<void> {
await this._build_renderers()
}

async build_tool_views(): Promise<void> {
Expand Down Expand Up @@ -794,16 +822,16 @@ export class PlotView extends LayoutDOMView implements Paintable {
const {above, below, left, right, center, renderers} = this.model.properties
const panels = [above, below, left, right, center]
this.on_change(renderers, async () => {
await this.build_renderer_views()
await this._update_renderers()
})
this.on_change(panels, async () => {
await this.build_renderer_views()
await this._update_renderers()
this.invalidate_layout()
})

this.connect(this.model.toolbar.properties.tools.change, async () => {
await this.build_tool_views()
await this.build_renderer_views()
await this._update_renderers()
})

const {x_ranges, y_ranges} = this.frame
Expand All @@ -829,15 +857,15 @@ export class PlotView extends LayoutDOMView implements Paintable {
this._toolbar.toolbar.location = toolbar_location
} else {
this._toolbar = undefined
await this.build_renderer_views()
await this._update_renderers()
}
} else {
if (toolbar_location != null) {
const {toolbar, toolbar_inner} = this.model
this._toolbar = new ToolbarPanel({toolbar})
toolbar.location = toolbar_location
toolbar.inner = toolbar_inner
await this.build_renderer_views()
await this._update_renderers()
}
}
this.invalidate_layout()
Expand Down
0