LegendBuilder
Defined in: packages/core/src/renderer/legend-builder.ts:83
Builds legend HTML from layer configurations
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new LegendBuilder(
options?):LegendBuilder
Defined in: packages/core/src/renderer/legend-builder.ts:87
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
options | LegendBuilderOptions |
Returns
Section titled “Returns”LegendBuilder
Methods
Section titled “Methods”build()
Section titled “build()”build(
container,layers,config?):void
Defined in: packages/core/src/renderer/legend-builder.ts:95
Build legend in container from layers
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
container | string | HTMLElement |
layers | (objectOutputType<object & object, ZodTypeAny, "passthrough"> | objectOutputType<object & object, ZodTypeAny, "passthrough"> | objectOutputType<object & object, ZodTypeAny, "passthrough"> | objectOutputType<object & object, ZodTypeAny, "passthrough"> | objectOutputType<object & object, ZodTypeAny, "passthrough"> | objectOutputType<object & object, ZodTypeAny, "passthrough"> | objectOutputType<object & object, ZodTypeAny, "passthrough"> | objectOutputType<object & object, ZodTypeAny, "passthrough"> | objectOutputType<object & object, ZodTypeAny, "passthrough"> | objectOutputType<{ id: ZodString; layout: ZodOptional<ZodObject<{ }, "passthrough", ZodTypeAny, objectOutputType<{ }, ZodTypeAny, "passthrough">, objectInputType<{ }, ZodTypeAny, "passthrough">>>; metadata: ZodOptional<ZodRecord<ZodString, ZodAny>>; paint: ZodOptional<ZodObject<{ background-color: ZodOptional<ZodUnion<[ZodEffects<…, …, …>, ZodType<…, …, …>]>>; background-opacity: ZodOptional<ZodUnion<[ZodNumber, ZodType<…, …, …>]>>; background-pattern: ZodOptional<ZodUnion<[ZodString, ZodType<…, …, …>]>>; }, "passthrough", ZodTypeAny, objectOutputType<{ background-color: ZodOptional<ZodUnion<[…, …]>>; background-opacity: ZodOptional<ZodUnion<[…, …]>>; background-pattern: ZodOptional<ZodUnion<[…, …]>>; }, ZodTypeAny, "passthrough">, objectInputType<{ background-color: ZodOptional<ZodUnion<[…, …]>>; background-opacity: ZodOptional<ZodUnion<[…, …]>>; background-pattern: ZodOptional<ZodUnion<[…, …]>>; }, ZodTypeAny, "passthrough">>>; type: ZodLiteral<"background">; }, ZodTypeAny, "passthrough">)[] |
config? | Partial<{ collapsed: boolean; items?: object[]; position: "top-left" | "top-right" | "bottom-left" | "bottom-right"; title?: string; }> |
Returns
Section titled “Returns”void
entries()
Section titled “entries()”entries(
layers,config?,overrides?):LegendEntry[]
Defined in: packages/core/src/renderer/legend-builder.ts:151
The legend’s entries: the block’s own items:, else every layer’s
legend: field. Empty when there is nothing to show.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
layers | (objectOutputType<object & object, ZodTypeAny, "passthrough"> | objectOutputType<object & object, ZodTypeAny, "passthrough"> | objectOutputType<object & object, ZodTypeAny, "passthrough"> | objectOutputType<object & object, ZodTypeAny, "passthrough"> | objectOutputType<object & object, ZodTypeAny, "passthrough"> | objectOutputType<object & object, ZodTypeAny, "passthrough"> | objectOutputType<object & object, ZodTypeAny, "passthrough"> | objectOutputType<object & object, ZodTypeAny, "passthrough"> | objectOutputType<object & object, ZodTypeAny, "passthrough"> | objectOutputType<{ id: ZodString; layout: ZodOptional<ZodObject<{ }, "passthrough", ZodTypeAny, objectOutputType<{ }, ZodTypeAny, "passthrough">, objectInputType<{ }, ZodTypeAny, "passthrough">>>; metadata: ZodOptional<ZodRecord<ZodString, ZodAny>>; paint: ZodOptional<ZodObject<{ background-color: ZodOptional<ZodUnion<[ZodEffects<…, …, …>, ZodType<…, …, …>]>>; background-opacity: ZodOptional<ZodUnion<[ZodNumber, ZodType<…, …, …>]>>; background-pattern: ZodOptional<ZodUnion<[ZodString, ZodType<…, …, …>]>>; }, "passthrough", ZodTypeAny, objectOutputType<{ background-color: ZodOptional<ZodUnion<[…, …]>>; background-opacity: ZodOptional<ZodUnion<[…, …]>>; background-pattern: ZodOptional<ZodUnion<[…, …]>>; }, ZodTypeAny, "passthrough">, objectInputType<{ background-color: ZodOptional<ZodUnion<[…, …]>>; background-opacity: ZodOptional<ZodUnion<[…, …]>>; background-pattern: ZodOptional<ZodUnion<[…, …]>>; }, ZodTypeAny, "passthrough">>>; type: ZodLiteral<"background">; }, ZodTypeAny, "passthrough">)[] |
config? | Partial<{ collapsed: boolean; items?: object[]; position: "top-left" | "top-right" | "bottom-left" | "bottom-right"; title?: string; }> |
overrides? | ClassifyOverrides |
Returns
Section titled “Returns”LegendEntry[]
Remarks
Section titled “Remarks”A classified layer’s classes are shown either way (ml-aot.94): after the
block’s items: when it lists its own, since those were written by hand
and cannot describe classes computed from the data. A layer opts out with
legend: false (or replaces its classes with its own legend: entry).
itemsHTML()
Section titled “itemsHTML()”itemsHTML(
items):string
Defined in: packages/core/src/renderer/legend-builder.ts:164
The entries’ markup (swatch + label each), without the box or a title: for a host that puts them in its own panel (a story’s pinned legend).
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
items | LegendEntry[] |
Returns
Section titled “Returns”string