Documentation
¶
Overview ¶
Package chart is the chart plugin: one canonical chart-v1 spec, two renderers that must agree. The server renders a static SVG (chart/ssr) so the page works with JavaScript off; the sandboxed Observable Plot frame hydrates it into an interactive chart. The host adapter hides the SSR node when the frame reports ready — the decision that keeps this plugin core-free (pluginhost.MountConfig has no initial-children slot, and none was added).
Index ¶
Constants ¶
const ( Name = "chart" Version = "0.1.0" RoutePrefix = "/__gofastr/plugin/chart" ChartHTMLURL = RoutePrefix + "/chart.html" ChartJSURL = RoutePrefix + "/chart.js" ChartCSSURL = RoutePrefix + "/chart.css" AdapterScriptURL = RoutePrefix + "/adapter.js" SaveURL = RoutePrefix + "/save" DemoURL = "/chart" SchemaVersion = ssr.SchemaVersion )
Identity and route constants. The Go plugin, host/adapter.js, and the frame bundle hard-code these exactly. The demo lives at /chart.
Variables ¶
This section is empty.
Functions ¶
func DefaultCapabilities ¶
func DefaultCapabilities() []string
DefaultCapabilities is the grant set: no uploads, no network — document read/write plus theme bridging is the whole surface.
func Mount ¶
func Mount(cfg MountConfig) render.HTML
Mount renders the SSR chart in a wrapper element followed by the normal mount marker and hidden field. With JavaScript off the SSR SVG is the page; with JavaScript on, host/adapter.js hides the wrapper when the frame reports ready (and un-hides it if the frame fails to boot).
func UIHostOption ¶
UIHostOption injects the platform broker and this plugin's adapter.
Types ¶
type MountConfig ¶
type MountConfig struct {
// DocID is the persistence key.
DocID string
// SpecField is the hidden input name that carries the spec JSON.
SpecField string
// MinHeight is the initial iframe height before first resize.
MinHeight string
// Spec is the canonical chart JSON. It is rendered server-side into
// the SSR wrapper AND placed on the marker for the frame's init.
Spec []byte
}
MountConfig configures Mount.
type Option ¶
type Option func(*Plugin)
func WithCapabilities ¶
func WithDemoPage ¶
func WithDemoPage() Option
func WithDevGrantAll ¶
func WithDevGrantAll() Option
func WithSaveHandler ¶
func WithSaveHandler(fn func(ctx context.Context, req SaveRequest) error) Option
type Plugin ¶
type Plugin struct {
// contains filtered or unexported fields
}
Plugin is the chart plugin. It implements framework.Plugin.
func New ¶
New constructs a Plugin. The platform manifest is built and Validate()'d here so a bad isolation/sandbox config aborts construction rather than silently de-opaquing the frame at runtime.
func (*Plugin) Capabilities ¶
func (*Plugin) Manifest ¶
func (p *Plugin) Manifest() pluginhost.Manifest