@kubex/zinc 1.1.28 → 1.1.31
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/custom-elements-manifest.config.js +2 -2
- package/dist/custom-elements.json +1910 -362
- package/dist/vscode.html-custom-data.json +55 -14
- package/dist/web-types.json +185 -32
- package/dist/zn.d.ts +684 -16
- package/dist/zn.min.js +1325 -929
- package/docs/pages/components/flow-builder-troubleshooter-demo.njk +106 -78
- package/docs/pages/components/flow-builder.md +422 -66
- package/docs/pages/components/page-builder.md +167 -0
- package/docs/pages/components/settings-container.md +37 -2
- package/package.json +1 -1
- package/src/components/datepicker/datepicker.scss +0 -10
- package/src/components/flow-builder/flow-builder.component.ts +377 -16
- package/src/components/flow-builder/flow-builder.scss +398 -250
- package/src/components/flow-builder/flow-builder.test.ts +241 -4
- package/src/components/flow-builder/flow-layout.ts +42 -17
- package/src/components/flow-builder/flow.types.ts +168 -43
- package/src/components/flow-builder/modules/flow-branch-conditions/flow-branch-conditions.component.ts +300 -0
- package/src/components/flow-builder/modules/flow-branch-conditions/flow-branch-conditions.scss +222 -0
- package/src/components/flow-builder/modules/flow-branch-conditions/flow-branch-conditions.test.ts +125 -0
- package/src/components/flow-builder/modules/flow-branch-conditions/index.ts +12 -0
- package/src/components/flow-builder/modules/flow-canvas/flow-canvas.component.ts +184 -26
- package/src/components/flow-builder/modules/flow-canvas/flow-canvas.scss +170 -120
- package/src/components/flow-builder/modules/flow-node/flow-node.scss +42 -42
- package/src/components/flow-builder/modules/flow-step/flow-step.component.ts +2 -1
- package/src/components/flow-builder/modules/flow-step/flow-step.scss +25 -17
- package/src/components/header/header.scss +3 -1
- package/src/components/icon-picker/icon-picker.component.ts +20 -37
- package/src/components/icon-picker/icon-picker.scss +5 -45
- package/src/components/page-builder/index.ts +14 -0
- package/src/components/page-builder/modules/page-palette-item/index.ts +12 -0
- package/src/components/page-builder/modules/page-palette-item/page-palette-item.component.ts +71 -0
- package/src/components/page-builder/modules/page-palette-item/page-palette-item.scss +70 -0
- package/src/components/page-builder/modules/page-palette-item/page-palette-item.test.ts +20 -0
- package/src/components/page-builder/modules/page-section-card/index.ts +12 -0
- package/src/components/page-builder/modules/page-section-card/page-section-card.component.ts +93 -0
- package/src/components/page-builder/modules/page-section-card/page-section-card.scss +92 -0
- package/src/components/page-builder/modules/page-section-card/page-section-card.test.ts +50 -0
- package/src/components/page-builder/page-builder.component.ts +1053 -0
- package/src/components/page-builder/page-builder.scss +494 -0
- package/src/components/page-builder/page-builder.test.ts +464 -0
- package/src/components/page-builder/page-registry.ts +48 -0
- package/src/components/page-builder/page.types.ts +75 -0
- package/src/components/panel/panel.scss +1 -0
- package/src/components/settings-container/settings-container.component.ts +74 -9
- package/src/components/settings-container/settings-container.scss +75 -0
- package/src/components/settings-container/settings-container.test.ts +35 -0
- package/src/events/events.ts +2 -0
- package/src/events/zn-page-change.ts +9 -0
- package/src/events/zn-page-selection-change.ts +7 -0
- package/src/zinc.ts +4 -0
- package/web-test-runner.config.js +6 -1
package/dist/zn.d.ts
CHANGED
|
@@ -4425,7 +4425,6 @@ declare module "components/icon-picker/icon-picker.component" {
|
|
|
4425
4425
|
private handleFreeInput;
|
|
4426
4426
|
private handleClear;
|
|
4427
4427
|
private _handleTriggerClick;
|
|
4428
|
-
private _handleTriggerKeyDown;
|
|
4429
4428
|
render(): import("lit-html").TemplateResult<1>;
|
|
4430
4429
|
}
|
|
4431
4430
|
}
|
|
@@ -7700,10 +7699,13 @@ declare module "components/settings-container/settings-container.component" {
|
|
|
7700
7699
|
*
|
|
7701
7700
|
* @dependency zn-example
|
|
7702
7701
|
*
|
|
7703
|
-
* @event zn-
|
|
7702
|
+
* @event zn-show - Emitted when the pull tab panel opens.
|
|
7703
|
+
* @event zn-hide - Emitted when the pull tab panel closes.
|
|
7704
7704
|
*
|
|
7705
7705
|
* @slot - The default slot.
|
|
7706
|
-
* @slot
|
|
7706
|
+
* @slot filter - Filter definitions used to toggle visibility of content.
|
|
7707
|
+
* @slot dropdown-content - Custom content for the settings panel.
|
|
7708
|
+
* @slot tab - Extra content rendered inside the pull tab next to the chevron.
|
|
7707
7709
|
*
|
|
7708
7710
|
* @csspart base - The component's base wrapper.
|
|
7709
7711
|
*
|
|
@@ -7715,11 +7717,19 @@ declare module "components/settings-container/settings-container.component" {
|
|
|
7715
7717
|
position: 'top-end' | 'top-start' | 'bottom-end' | 'bottom-start';
|
|
7716
7718
|
storeKey: string;
|
|
7717
7719
|
noScroll: boolean;
|
|
7720
|
+
pullTab: boolean;
|
|
7721
|
+
open: boolean;
|
|
7722
|
+
private panelExpanded;
|
|
7718
7723
|
private readonly _mutationObserver;
|
|
7719
7724
|
private _updateFiltersScheduled;
|
|
7720
7725
|
private _store;
|
|
7721
7726
|
private _hiddenElements;
|
|
7722
7727
|
connectedCallback(): void;
|
|
7728
|
+
disconnectedCallback(): void;
|
|
7729
|
+
private handleDocumentMouseDown;
|
|
7730
|
+
private togglePullTab;
|
|
7731
|
+
private hidePullTab;
|
|
7732
|
+
private handlePanelTransitionEnd;
|
|
7723
7733
|
private scheduleUpdateFilters;
|
|
7724
7734
|
private handleContentSlotChange;
|
|
7725
7735
|
private handleFiltersSlotChange;
|
|
@@ -7728,6 +7738,7 @@ declare module "components/settings-container/settings-container.component" {
|
|
|
7728
7738
|
updateFilters(): void;
|
|
7729
7739
|
updateFilter(e: ZnChangeEvent): void;
|
|
7730
7740
|
render(): import("lit-html").TemplateResult<1>;
|
|
7741
|
+
private renderPullTab;
|
|
7731
7742
|
private getDropdownContent;
|
|
7732
7743
|
}
|
|
7733
7744
|
}
|
|
@@ -8442,6 +8453,57 @@ declare module "components/flow-builder/flow.types" {
|
|
|
8442
8453
|
/** Branch configuration (filters / conditions for taking this path), edited via the branch editor. */
|
|
8443
8454
|
data?: Record<string, unknown>;
|
|
8444
8455
|
}
|
|
8456
|
+
/** A choice in a filter field's operator or value dropdown. */
|
|
8457
|
+
export interface FlowFilterOption {
|
|
8458
|
+
value: string;
|
|
8459
|
+
/** Display text; defaults to the value. */
|
|
8460
|
+
label?: string;
|
|
8461
|
+
}
|
|
8462
|
+
/** One control row of a branch filter (e.g. "[in the last ▾] [6] [month(s) ▾]"). */
|
|
8463
|
+
export interface FlowFilterField {
|
|
8464
|
+
id: string;
|
|
8465
|
+
/** Leading text shown before the controls. */
|
|
8466
|
+
label?: string;
|
|
8467
|
+
/** The value control. Defaults to 'select' when `options` are given, else 'text'. */
|
|
8468
|
+
type?: 'select' | 'number' | 'text';
|
|
8469
|
+
/** Operator choices shown before the value (e.g. "at least" / "in the last" / "is equal to"). */
|
|
8470
|
+
operators?: FlowFilterOption[];
|
|
8471
|
+
/** Value choices for a 'select' field. */
|
|
8472
|
+
options?: FlowFilterOption[];
|
|
8473
|
+
/** Choices for an adjustable trailing unit dropdown (e.g. day(s) / month(s)); shown instead of `suffix`. */
|
|
8474
|
+
units?: FlowFilterOption[];
|
|
8475
|
+
/** Trailing unit text (e.g. "time(s)") when the unit isn't adjustable. */
|
|
8476
|
+
suffix?: string;
|
|
8477
|
+
placeholder?: string;
|
|
8478
|
+
/** Initial value when the filter is added to a condition. */
|
|
8479
|
+
value?: string | number;
|
|
8480
|
+
}
|
|
8481
|
+
/** An operator's display label: its own, a well-known default for its value, else the value itself. */
|
|
8482
|
+
export function operatorLabel(option: FlowFilterOption): string;
|
|
8483
|
+
/** A filter offered by the built-in branch conditions editor. */
|
|
8484
|
+
export interface FlowBranchFilter {
|
|
8485
|
+
id: string;
|
|
8486
|
+
label: string;
|
|
8487
|
+
description?: string;
|
|
8488
|
+
fields: FlowFilterField[];
|
|
8489
|
+
}
|
|
8490
|
+
/** One configured condition: a filter plus its per-field operator / value / unit entries. */
|
|
8491
|
+
export interface FlowBranchCondition {
|
|
8492
|
+
/** The `FlowBranchFilter` id this condition uses. */
|
|
8493
|
+
filter: string;
|
|
8494
|
+
values: Record<string, {
|
|
8495
|
+
operator?: string;
|
|
8496
|
+
value?: string | number;
|
|
8497
|
+
unit?: string;
|
|
8498
|
+
}>;
|
|
8499
|
+
}
|
|
8500
|
+
/**
|
|
8501
|
+
* A branch's full condition set as persisted on the output port's
|
|
8502
|
+
* `data.conditions`: the outer array is OR-ed, each inner group AND-ed.
|
|
8503
|
+
*/
|
|
8504
|
+
export type FlowBranchConditions = FlowBranchCondition[][];
|
|
8505
|
+
/** Read the conditions persisted on an output port (`port.data.conditions`). */
|
|
8506
|
+
export function branchConditions(port: FlowPort): FlowBranchConditions;
|
|
8445
8507
|
/**
|
|
8446
8508
|
* Describes a kind of node that can be placed on the canvas. Consumers register
|
|
8447
8509
|
* these with the builder to extend it — the steps panel and inspector are driven
|
|
@@ -8469,6 +8531,12 @@ declare module "components/flow-builder/flow.types" {
|
|
|
8469
8531
|
outputs?: FlowPort[];
|
|
8470
8532
|
/** Initial `data` for a freshly placed node. */
|
|
8471
8533
|
defaultData?: Record<string, unknown>;
|
|
8534
|
+
/**
|
|
8535
|
+
* Filters offered by the built-in branch conditions editor for this type's
|
|
8536
|
+
* output branches (AND/OR groups persisted on the port's `data.conditions`).
|
|
8537
|
+
* Ignored when `renderBranchConfig` is set.
|
|
8538
|
+
*/
|
|
8539
|
+
branchFilters?: FlowBranchFilter[];
|
|
8472
8540
|
/** Renders the inspector body for a selected node of this type. */
|
|
8473
8541
|
renderConfig?: (node: FlowNodeInstance, update: (data: Record<string, unknown>) => void) => TemplateResult;
|
|
8474
8542
|
/** Renders the branch editor body (filters / conditions) for one of this type's output branches. */
|
|
@@ -8534,14 +8602,27 @@ declare module "components/flow-builder/flow.types" {
|
|
|
8534
8602
|
*/
|
|
8535
8603
|
export const NODE_WIDTH = 240;
|
|
8536
8604
|
export const NODE_HEIGHT = 60;
|
|
8537
|
-
/**
|
|
8538
|
-
|
|
8605
|
+
/**
|
|
8606
|
+
* Horizontal spacing between the branches of a multi-output node. Matches the
|
|
8607
|
+
* untangle layer gap (card width + 80) so two sibling children fit side by side
|
|
8608
|
+
* directly under their drops — straight downward wires, no elbows.
|
|
8609
|
+
*/
|
|
8610
|
+
export const BRANCH_SPREAD: number;
|
|
8539
8611
|
export const BUS_OFFSET = 40;
|
|
8540
8612
|
export const PILL_DROP = 40;
|
|
8541
8613
|
export const PILL_HEIGHT = 40;
|
|
8542
8614
|
export const PILL_MAX_WIDTH = 240;
|
|
8543
8615
|
/** Extra pill height per wrapped line (matches the pill's CSS line-height). */
|
|
8544
8616
|
export const PILL_LINE_HEIGHT = 20;
|
|
8617
|
+
/**
|
|
8618
|
+
* Canvas y of a branch pill's top edge. A pill on a wire to a child below is
|
|
8619
|
+
* centred along the run from its node's bottom to the child's top — equal wire
|
|
8620
|
+
* above and below, however long or tight. A sole output's wire is a straight
|
|
8621
|
+
* stem with no bus to respect, so its pill may rise above the bus line to stay
|
|
8622
|
+
* centred; fan branches stop at the bus. Open branches and loop/side wires
|
|
8623
|
+
* keep the fixed drop below the bus.
|
|
8624
|
+
*/
|
|
8625
|
+
export function branchPillTop(node: Pick<FlowNodeInstance, 'y'>, pillH: number, child?: Pick<FlowNodeInstance, 'y'>, soleOutput?: boolean): number;
|
|
8545
8626
|
/**
|
|
8546
8627
|
* Estimated pill box for a branch name: sizes to the text up to the max width,
|
|
8547
8628
|
* then hard-wraps — the height grows a grid unit per extra line. The pill DOM
|
|
@@ -8566,12 +8647,13 @@ declare module "components/flow-builder/flow.types" {
|
|
|
8566
8647
|
/** A function resolving a node type key to its registered type. */
|
|
8567
8648
|
export type FlowTypeOf = (type: string) => FlowNodeType | undefined;
|
|
8568
8649
|
/**
|
|
8569
|
-
* Canvas x for each of a node's branch drops
|
|
8570
|
-
*
|
|
8571
|
-
*
|
|
8572
|
-
*
|
|
8650
|
+
* Canvas x for each of a node's branch drops: the natural fan position under
|
|
8651
|
+
* the source. Pills never shift sideways to chase their child — the wire into
|
|
8652
|
+
* a pill is always a straight vertical, and any lateral offset to the child is
|
|
8653
|
+
* taken up by the elbow below the pill (which still enters the child from
|
|
8654
|
+
* straight above).
|
|
8573
8655
|
*/
|
|
8574
|
-
export function branchDropXs(node: FlowNodeInstance, typeOf: FlowTypeOf
|
|
8656
|
+
export function branchDropXs(node: FlowNodeInstance, typeOf: FlowTypeOf): number[];
|
|
8575
8657
|
/**
|
|
8576
8658
|
* The rects a node occupies on the canvas: its card plus each branch-name pill,
|
|
8577
8659
|
* at the exact positions the canvas draws them.
|
|
@@ -8579,6 +8661,13 @@ declare module "components/flow-builder/flow.types" {
|
|
|
8579
8661
|
export function nodeObstacles(node: FlowNodeInstance, typeOf: FlowTypeOf, nodes: FlowNodeInstance[], connections: FlowConnection[]): Rect[];
|
|
8580
8662
|
/** Whether two nodes' footprints (cards and branch pills) would overlap. */
|
|
8581
8663
|
export function nodesCollide(a: FlowNodeInstance, b: FlowNodeInstance, typeOf: FlowTypeOf, nodes: FlowNodeInstance[], connections: FlowConnection[]): boolean;
|
|
8664
|
+
/**
|
|
8665
|
+
* Whether any of `node`'s branch pills overlap another node's footprint. A
|
|
8666
|
+
* pill centres between its node and the connected child, so moving the CHILD
|
|
8667
|
+
* moves the pill — drags use this to check the moved node's parents, whose
|
|
8668
|
+
* displaced pills could land on a third node.
|
|
8669
|
+
*/
|
|
8670
|
+
export function pillsCollide(node: FlowNodeInstance, typeOf: FlowTypeOf, nodes: FlowNodeInstance[], connections: FlowConnection[]): boolean;
|
|
8582
8671
|
/** Whether a bare card placed at `pos` would hit any of `node`'s footprint. */
|
|
8583
8672
|
export function cardCollides(pos: {
|
|
8584
8673
|
x: number;
|
|
@@ -8623,6 +8712,88 @@ declare module "components/flow-builder/flow.types" {
|
|
|
8623
8712
|
*/
|
|
8624
8713
|
export function loopConnections(nodes: FlowNodeInstance[], connections: FlowConnection[]): Set<FlowConnection>;
|
|
8625
8714
|
}
|
|
8715
|
+
declare module "components/flow-builder/modules/flow-branch-conditions/flow-branch-conditions.component" {
|
|
8716
|
+
import { type CSSResultGroup, type PropertyValues } from 'lit';
|
|
8717
|
+
import ZincElement from "internal/zinc-element";
|
|
8718
|
+
import ZnButton from "components/button/index";
|
|
8719
|
+
import ZnIcon from "components/icon/index";
|
|
8720
|
+
import ZnInput from "components/input/index";
|
|
8721
|
+
import ZnOption from "components/option/index";
|
|
8722
|
+
import ZnSelect from "components/select/index";
|
|
8723
|
+
import { type FlowBranchConditions, type FlowBranchFilter } from "components/flow-builder/flow.types";
|
|
8724
|
+
/**
|
|
8725
|
+
* @summary The built-in branch conditions editor: pick filters from a searchable list, then
|
|
8726
|
+
* combine them into AND groups joined by OR. Rendered by `<zn-flow-builder>`'s branch editor
|
|
8727
|
+
* for node types that declare `branchFilters`; edits are drafted locally and only applied
|
|
8728
|
+
* on Save.
|
|
8729
|
+
* @documentation https://zinc.style/components/flow-branch-conditions
|
|
8730
|
+
* @status experimental
|
|
8731
|
+
* @since 1.0
|
|
8732
|
+
*
|
|
8733
|
+
* @dependency zn-button
|
|
8734
|
+
* @dependency zn-icon
|
|
8735
|
+
* @dependency zn-input
|
|
8736
|
+
* @dependency zn-option
|
|
8737
|
+
* @dependency zn-select
|
|
8738
|
+
*
|
|
8739
|
+
* @event flow-conditions-save - Emitted on Save with `detail.conditions` (OR groups of AND-ed conditions).
|
|
8740
|
+
* @event flow-conditions-cancel - Emitted on Cancel, with the draft discarded.
|
|
8741
|
+
*
|
|
8742
|
+
* @csspart base - The editor wrapper.
|
|
8743
|
+
* @csspart picker - The filter picker (search + list).
|
|
8744
|
+
* @csspart conditions - The configured condition groups.
|
|
8745
|
+
*/
|
|
8746
|
+
export default class ZnFlowBranchConditions extends ZincElement {
|
|
8747
|
+
static styles: CSSResultGroup;
|
|
8748
|
+
static dependencies: {
|
|
8749
|
+
'zn-button': typeof ZnButton;
|
|
8750
|
+
'zn-icon': typeof ZnIcon;
|
|
8751
|
+
'zn-input': typeof ZnInput;
|
|
8752
|
+
'zn-option': typeof ZnOption;
|
|
8753
|
+
'zn-select': typeof ZnSelect;
|
|
8754
|
+
};
|
|
8755
|
+
/** The filters available to build conditions from. */
|
|
8756
|
+
filters: FlowBranchFilter[];
|
|
8757
|
+
/** The saved conditions being edited; changes stay in a local draft until Save. */
|
|
8758
|
+
value: FlowBranchConditions;
|
|
8759
|
+
private _draft;
|
|
8760
|
+
/** Group index the picker adds into (`_draft.length` starts a new OR group), or null when closed. */
|
|
8761
|
+
private _picker;
|
|
8762
|
+
private _search;
|
|
8763
|
+
/** JSON of the last `value` the draft was built from, so re-renders that pass an
|
|
8764
|
+
* equivalent value (fresh array refs) don't wipe in-progress edits. */
|
|
8765
|
+
private _valueJson;
|
|
8766
|
+
protected willUpdate(changed: PropertyValues): void;
|
|
8767
|
+
private _emit;
|
|
8768
|
+
private _save;
|
|
8769
|
+
private _cancel;
|
|
8770
|
+
private _cloneDraft;
|
|
8771
|
+
private _addCondition;
|
|
8772
|
+
private _removeCondition;
|
|
8773
|
+
private _setField;
|
|
8774
|
+
private _renderPicker;
|
|
8775
|
+
/**
|
|
8776
|
+
* A select's minimum width, sized so its longest label never truncates
|
|
8777
|
+
* (estimated per char, plus padding and the chevron). When the row can't
|
|
8778
|
+
* fit it, flex-wrap gives the select its own full-width line instead.
|
|
8779
|
+
*/
|
|
8780
|
+
private static _selectMinWidth;
|
|
8781
|
+
private _renderField;
|
|
8782
|
+
private _renderCondition;
|
|
8783
|
+
private _renderConditions;
|
|
8784
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
8785
|
+
}
|
|
8786
|
+
}
|
|
8787
|
+
declare module "components/flow-builder/modules/flow-branch-conditions/index" {
|
|
8788
|
+
import ZnFlowBranchConditions from "components/flow-builder/modules/flow-branch-conditions/flow-branch-conditions.component";
|
|
8789
|
+
export * from "components/flow-builder/modules/flow-branch-conditions/flow-branch-conditions.component";
|
|
8790
|
+
export default ZnFlowBranchConditions;
|
|
8791
|
+
global {
|
|
8792
|
+
interface HTMLElementTagNameMap {
|
|
8793
|
+
'zn-flow-branch-conditions': ZnFlowBranchConditions;
|
|
8794
|
+
}
|
|
8795
|
+
}
|
|
8796
|
+
}
|
|
8626
8797
|
declare module "components/flow-builder/modules/flow-node/flow-node.component" {
|
|
8627
8798
|
import { type CSSResultGroup, type PropertyValues } from 'lit';
|
|
8628
8799
|
import ZincElement from "internal/zinc-element";
|
|
@@ -8743,6 +8914,7 @@ declare module "components/flow-builder/modules/flow-canvas/flow-canvas.componen
|
|
|
8743
8914
|
*
|
|
8744
8915
|
* @csspart base - The canvas viewport.
|
|
8745
8916
|
* @csspart toolbar - The floating toolbar.
|
|
8917
|
+
* @csspart bin - The delete drop-zone shown bottom-right while dragging a node or step.
|
|
8746
8918
|
*/
|
|
8747
8919
|
export default class ZnFlowCanvas extends ZincElement {
|
|
8748
8920
|
static styles: CSSResultGroup;
|
|
@@ -8767,6 +8939,8 @@ declare module "components/flow-builder/modules/flow-canvas/flow-canvas.componen
|
|
|
8767
8939
|
private panX;
|
|
8768
8940
|
private panY;
|
|
8769
8941
|
private drag;
|
|
8942
|
+
/** Whether the current drag (node or step) is over the delete bin. */
|
|
8943
|
+
private _overBin;
|
|
8770
8944
|
/** Canvas-space top-left where a step, if dropped now, would be placed. */
|
|
8771
8945
|
private _dropGhost;
|
|
8772
8946
|
/** The stray branch being drawn from an output port until it attaches or cancels. */
|
|
@@ -8809,6 +8983,12 @@ declare module "components/flow-builder/modules/flow-canvas/flow-canvas.componen
|
|
|
8809
8983
|
* builder on attach).
|
|
8810
8984
|
*/
|
|
8811
8985
|
private _onPortClick;
|
|
8986
|
+
/**
|
|
8987
|
+
* An orphaned branch pill's port was clicked. If a branch from another node
|
|
8988
|
+
* is already in flight, attach it to this pill's node; otherwise start a
|
|
8989
|
+
* stray branch that continues from this pill.
|
|
8990
|
+
*/
|
|
8991
|
+
private _onBranchPortClick;
|
|
8812
8992
|
private _startLink;
|
|
8813
8993
|
private _onLinkPointerMove;
|
|
8814
8994
|
private _updateLinkFromClient;
|
|
@@ -8822,6 +9002,8 @@ declare module "components/flow-builder/modules/flow-canvas/flow-canvas.componen
|
|
|
8822
9002
|
private _cancelLink;
|
|
8823
9003
|
private _onPointerMove;
|
|
8824
9004
|
private _onPointerUp;
|
|
9005
|
+
/** Whether a client-space point is over the delete bin. */
|
|
9006
|
+
private _binHit;
|
|
8825
9007
|
private _beginMove;
|
|
8826
9008
|
/**
|
|
8827
9009
|
* A node's outputs all leave from a single bottom-centre stem and fan out along a
|
|
@@ -8840,7 +9022,12 @@ declare module "components/flow-builder/modules/flow-canvas/flow-canvas.componen
|
|
|
8840
9022
|
* same input keep sharing a line: their join is real.
|
|
8841
9023
|
*/
|
|
8842
9024
|
private _elbowMidOffsets;
|
|
8843
|
-
/**
|
|
9025
|
+
/**
|
|
9026
|
+
* Whether an orthogonal segment passes through any node card (with margin) —
|
|
9027
|
+
* or the approach zone above one, where incoming arrows land. A foreign wire
|
|
9028
|
+
* running just over a card's input port reads as connecting to it, so routes
|
|
9029
|
+
* keep well clear of that strip too.
|
|
9030
|
+
*/
|
|
8844
9031
|
private _segmentBlocked;
|
|
8845
9032
|
private _routeClear;
|
|
8846
9033
|
/**
|
|
@@ -8869,6 +9056,9 @@ declare module "components/flow-builder/modules/flow-canvas/flow-canvas.componen
|
|
|
8869
9056
|
private _onAddPointDragOver;
|
|
8870
9057
|
private _onAddDrop;
|
|
8871
9058
|
private _onWireDrop;
|
|
9059
|
+
private _onBinDragOver;
|
|
9060
|
+
private _onBinDragLeave;
|
|
9061
|
+
private _onBinDrop;
|
|
8872
9062
|
private _zoomBy;
|
|
8873
9063
|
/** Canvas-space bounding box of the whole flow: nodes, branch drops, and notes. */
|
|
8874
9064
|
private _contentBounds;
|
|
@@ -8940,10 +9130,13 @@ declare module "components/flow-builder/modules/flow-step-group/index" {
|
|
|
8940
9130
|
}
|
|
8941
9131
|
declare module "components/flow-builder/flow-layout" {
|
|
8942
9132
|
import { type FlowNodeType, type FlowState } from "components/flow-builder/flow.types";
|
|
8943
|
-
/** Horizontal gap between node origins within a layer. */
|
|
9133
|
+
/** Horizontal gap between node origins within a layer (= BRANCH_SPREAD, so siblings land under their drops). */
|
|
8944
9134
|
export const LAYOUT_H_GAP: number;
|
|
8945
|
-
/**
|
|
8946
|
-
|
|
9135
|
+
/**
|
|
9136
|
+
* Vertical gap between layers: a 160 card-to-card gap — a centred pill gets 60
|
|
9137
|
+
* of wire above and below — keeping the arranged flow compact.
|
|
9138
|
+
*/
|
|
9139
|
+
export const LAYOUT_V_GAP = 220;
|
|
8947
9140
|
/**
|
|
8948
9141
|
* "Untangle" auto-layout: assigns every node a position in a layered, top-down
|
|
8949
9142
|
* flow. Layers come from the longest path back to a root (the graph is a DAG —
|
|
@@ -8960,6 +9153,7 @@ declare module "components/flow-builder/flow-layout" {
|
|
|
8960
9153
|
declare module "components/flow-builder/flow-builder.component" {
|
|
8961
9154
|
import { type CSSResultGroup, type PropertyValues } from 'lit';
|
|
8962
9155
|
import ZincElement from "internal/zinc-element";
|
|
9156
|
+
import ZnFlowBranchConditions from "components/flow-builder/modules/flow-branch-conditions/index";
|
|
8963
9157
|
import ZnFlowCanvas from "components/flow-builder/modules/flow-canvas/index";
|
|
8964
9158
|
import ZnFlowStepGroup from "components/flow-builder/modules/flow-step-group/index";
|
|
8965
9159
|
import ZnIcon from "components/icon/index";
|
|
@@ -8977,6 +9171,7 @@ declare module "components/flow-builder/flow-builder.component" {
|
|
|
8977
9171
|
* @dependency zn-input
|
|
8978
9172
|
* @dependency zn-tabs
|
|
8979
9173
|
* @dependency zn-navbar
|
|
9174
|
+
* @dependency zn-flow-branch-conditions
|
|
8980
9175
|
* @dependency zn-flow-canvas
|
|
8981
9176
|
* @dependency zn-flow-node
|
|
8982
9177
|
*
|
|
@@ -8985,7 +9180,10 @@ declare module "components/flow-builder/flow-builder.component" {
|
|
|
8985
9180
|
* @event zn-flow-connect - Emitted when a connection is created. `event.detail.connection`.
|
|
8986
9181
|
*
|
|
8987
9182
|
* @slot - `<zn-flow-step>` type declarations; never displayed, each `group`/`category` routes the
|
|
8988
|
-
* step into the right tab and collapsible grouping of the rendered panel.
|
|
9183
|
+
* step into the right tab and collapsible grouping of the rendered panel. A step may nest
|
|
9184
|
+
* `<zn-flow-filter>` declarations (each holding `<zn-flow-filter-field>`s, whose operator /
|
|
9185
|
+
* option choices are nested `<zn-flow-operator>` / `<zn-flow-option>` elements) — or set a
|
|
9186
|
+
* `branch-filters` JSON attribute — to drive the built-in branch conditions editor.
|
|
8989
9187
|
* @slot header-left - Actions shown on the left of the header bar (e.g. Close / Undo All Changes).
|
|
8990
9188
|
* @slot header-right - Actions shown on the right of the header bar (e.g. Apply Changes).
|
|
8991
9189
|
* @slot sidebar - Extra right-panel content (status, version history), below the configuration errors.
|
|
@@ -9002,6 +9200,7 @@ declare module "components/flow-builder/flow-builder.component" {
|
|
|
9002
9200
|
'zn-input': typeof ZnInput;
|
|
9003
9201
|
'zn-tabs': typeof ZnTabs;
|
|
9004
9202
|
'zn-navbar': typeof ZnNavbar;
|
|
9203
|
+
'zn-flow-branch-conditions': typeof ZnFlowBranchConditions;
|
|
9005
9204
|
'zn-flow-canvas': typeof ZnFlowCanvas;
|
|
9006
9205
|
'zn-flow-step-group': typeof ZnFlowStepGroup;
|
|
9007
9206
|
};
|
|
@@ -9011,6 +9210,12 @@ declare module "components/flow-builder/flow-builder.component" {
|
|
|
9011
9210
|
subheading: string;
|
|
9012
9211
|
/** Node ids flagged as having configuration errors (drives the red node styling). */
|
|
9013
9212
|
errorNodes: string[];
|
|
9213
|
+
/**
|
|
9214
|
+
* Auto-save the flow to localStorage (1-day TTL). Omit to disable. A bare
|
|
9215
|
+
* `auto-save` saves every 5 minutes; a numeric value sets the interval in
|
|
9216
|
+
* minutes (`auto-save="5"`). Restore with `restoreAutoSave()`.
|
|
9217
|
+
*/
|
|
9218
|
+
autoSave: number | null;
|
|
9014
9219
|
/** Optional hint shown beneath each steps-panel tab. */
|
|
9015
9220
|
entrypointsHint: string;
|
|
9016
9221
|
triggersHint: string;
|
|
@@ -9025,6 +9230,9 @@ declare module "components/flow-builder/flow-builder.component" {
|
|
|
9025
9230
|
/** The steps-panel tab currently shown; the search only filters this tab. */
|
|
9026
9231
|
private _activeGroup;
|
|
9027
9232
|
private readonly _hasSlot;
|
|
9233
|
+
/** Side panels tucked away via their edge chevrons. */
|
|
9234
|
+
private _stepsCollapsed;
|
|
9235
|
+
private _sideCollapsed;
|
|
9028
9236
|
/** The node being relocated via the MOVE menu action, if any. */
|
|
9029
9237
|
private _movingNodeId;
|
|
9030
9238
|
/** The "+" picker popover target (an open output, or a wire to insert into), if open. */
|
|
@@ -9047,10 +9255,52 @@ declare module "components/flow-builder/flow-builder.component" {
|
|
|
9047
9255
|
private get _listeners();
|
|
9048
9256
|
connectedCallback(): void;
|
|
9049
9257
|
disconnectedCallback(): void;
|
|
9258
|
+
private _autoSaveTimer;
|
|
9259
|
+
private _statusTimer;
|
|
9260
|
+
private _justSavedTimer;
|
|
9261
|
+
/** Guards the restore prompt from re-triggering on restoreAutoSave's own setState. */
|
|
9262
|
+
private _restoring;
|
|
9263
|
+
/** Epoch of the newest auto-save (also picked up from storage on start). */
|
|
9264
|
+
private _lastSavedAt;
|
|
9265
|
+
/** Briefly true right after a save — flashes "Auto-saved" in the status pill. */
|
|
9266
|
+
private _justSaved;
|
|
9267
|
+
/** Re-render clock for the "last saved Xm ago" label. */
|
|
9268
|
+
private _statusNow;
|
|
9269
|
+
/** A fresh auto-save differing from the loaded flow — offer to restore it. */
|
|
9270
|
+
private _restorePrompt;
|
|
9271
|
+
/** localStorage key for this builder's auto-saves — its id, else its heading. */
|
|
9272
|
+
private get _autoSaveKey();
|
|
9273
|
+
private _stopAutoSave;
|
|
9274
|
+
private _restartAutoSave;
|
|
9275
|
+
/** An empty canvas is never saved — it would clobber a stored flow with nothing. */
|
|
9276
|
+
private _autoSaveTick;
|
|
9277
|
+
/** The stored auto-save, purging it when past its TTL (or unreadable). */
|
|
9278
|
+
private _readAutoSave;
|
|
9279
|
+
/** Load the auto-saved flow, if one exists within the 1-day TTL. */
|
|
9280
|
+
restoreAutoSave(): boolean;
|
|
9281
|
+
/**
|
|
9282
|
+
* A flow was just loaded — when a fresh auto-save differs from it, ask the
|
|
9283
|
+
* user whether to pick up their draft instead.
|
|
9284
|
+
*/
|
|
9285
|
+
private _offerRestoreIfNewer;
|
|
9050
9286
|
private _onKeyDown;
|
|
9051
9287
|
protected willUpdate(changed: PropertyValues): void;
|
|
9052
9288
|
protected firstUpdated(changed: PropertyValues): void;
|
|
9053
9289
|
private static _parsePorts;
|
|
9290
|
+
/** Parse an operator / option list: a JSON array (strings or `{value,label}`) or comma-separated values. */
|
|
9291
|
+
private static _parseFilterOptions;
|
|
9292
|
+
/**
|
|
9293
|
+
* Option list declared as child elements — the tidy form. The element's text
|
|
9294
|
+
* is the label; a `value` attribute overrides the stored value:
|
|
9295
|
+
* `<zn-flow-operator value="gte">at least</zn-flow-operator>`.
|
|
9296
|
+
*/
|
|
9297
|
+
private static _nestedFilterOptions;
|
|
9298
|
+
private static _filterFieldFromEl;
|
|
9299
|
+
/**
|
|
9300
|
+
* A step's branch filters: the `branch-filters` JSON attribute, or nested
|
|
9301
|
+
* `<zn-flow-filter>` declarations each holding `<zn-flow-filter-field>`s.
|
|
9302
|
+
*/
|
|
9303
|
+
private static _parseBranchFilters;
|
|
9054
9304
|
private _typeFromStep;
|
|
9055
9305
|
/** Register a FlowNodeType for every slotted <zn-flow-step>. */
|
|
9056
9306
|
private _registerSlottedTypes;
|
|
@@ -9060,6 +9310,12 @@ declare module "components/flow-builder/flow-builder.component" {
|
|
|
9060
9310
|
setState(next: FlowState): void;
|
|
9061
9311
|
get value(): string;
|
|
9062
9312
|
set value(json: string);
|
|
9313
|
+
/**
|
|
9314
|
+
* The full flow state — nodes with their positions, connections, branch
|
|
9315
|
+
* data, and notes — ready for persisting. Lets `JSON.stringify(builder)`
|
|
9316
|
+
* serialize the flow directly, e.g. as a POST body.
|
|
9317
|
+
*/
|
|
9318
|
+
toJSON(): FlowState;
|
|
9063
9319
|
undo: () => void;
|
|
9064
9320
|
redo: () => void;
|
|
9065
9321
|
/**
|
|
@@ -9141,10 +9397,14 @@ declare module "components/flow-builder/flow-builder.component" {
|
|
|
9141
9397
|
private _renderInspector;
|
|
9142
9398
|
/** Replace one of the node's output ports (per-instance override), keeping its id. */
|
|
9143
9399
|
private _updateBranch;
|
|
9400
|
+
/** Persist the built-in conditions editor's draft onto the branch and close it. Undoable. */
|
|
9401
|
+
private _saveBranchConditions;
|
|
9144
9402
|
private _renderBranchEditor;
|
|
9145
9403
|
private _renderRightPanel;
|
|
9146
9404
|
private _renderHeader;
|
|
9147
9405
|
private _renderSidebar;
|
|
9406
|
+
private _renderAutoSaveStatus;
|
|
9407
|
+
private _renderRestorePrompt;
|
|
9148
9408
|
private _renderPicker;
|
|
9149
9409
|
private _pickType;
|
|
9150
9410
|
render(): import("lit-html").TemplateResult<1>;
|
|
@@ -9226,7 +9486,8 @@ declare module "components/flow-builder/modules/flow-step/flow-step.component" {
|
|
|
9226
9486
|
* @event flow-step-drag - Emitted on dragstart with `detail.type`, so the builder can preview the drop.
|
|
9227
9487
|
* @event flow-step-drag-end - Emitted on dragend.
|
|
9228
9488
|
*
|
|
9229
|
-
* @slot - The step's label.
|
|
9489
|
+
* @slot - The step's label. May also hold `<zn-flow-filter>` declarations (never displayed)
|
|
9490
|
+
* that drive the flow builder's built-in branch conditions editor.
|
|
9230
9491
|
*
|
|
9231
9492
|
* @csspart base - The row.
|
|
9232
9493
|
*/
|
|
@@ -9265,6 +9526,386 @@ declare module "components/flow-builder/modules/flow-step/index" {
|
|
|
9265
9526
|
}
|
|
9266
9527
|
}
|
|
9267
9528
|
}
|
|
9529
|
+
declare module "components/page-builder/page.types" {
|
|
9530
|
+
import type { TemplateResult } from 'lit';
|
|
9531
|
+
/** A section placed on a page. */
|
|
9532
|
+
export interface PageSection {
|
|
9533
|
+
id: string;
|
|
9534
|
+
type: string;
|
|
9535
|
+
/** Overrides the type label when set (per-instance rename). */
|
|
9536
|
+
label?: string;
|
|
9537
|
+
/** Section content, keyed by field name (the inspector's `name` attributes). */
|
|
9538
|
+
data: Record<string, unknown>;
|
|
9539
|
+
/** Slot contents for container sections, sized to the type's `slots`. Empty slots are null. */
|
|
9540
|
+
children?: (PageSection | null)[];
|
|
9541
|
+
}
|
|
9542
|
+
/** The complete serialisable state of a page. Order = render order. */
|
|
9543
|
+
export interface PageState {
|
|
9544
|
+
sections: PageSection[];
|
|
9545
|
+
}
|
|
9546
|
+
/**
|
|
9547
|
+
* Describes a kind of section that can be placed on a page. Declared via
|
|
9548
|
+
* `<template type slot="config">` children or registered programmatically —
|
|
9549
|
+
* the palette and inspector are driven entirely by registered types.
|
|
9550
|
+
*/
|
|
9551
|
+
export interface PageSectionType {
|
|
9552
|
+
/** Unique key, persisted on every placed section. */
|
|
9553
|
+
type: string;
|
|
9554
|
+
label: string;
|
|
9555
|
+
/** zn-icon `src`. */
|
|
9556
|
+
icon?: string;
|
|
9557
|
+
iconLibrary?: string;
|
|
9558
|
+
/** Accent colour for the icon tile — any CSS colour. */
|
|
9559
|
+
color?: string;
|
|
9560
|
+
/** Collapsible palette category. */
|
|
9561
|
+
category?: string;
|
|
9562
|
+
description?: string;
|
|
9563
|
+
/** Inspector form markup (from a slotted `<template slot="config">`). */
|
|
9564
|
+
configTemplate?: HTMLTemplateElement;
|
|
9565
|
+
/** Programmatic inspector body — takes precedence over `configTemplate`. */
|
|
9566
|
+
renderConfig?: (section: PageSection, update: (data: Record<string, unknown>) => void) => TemplateResult;
|
|
9567
|
+
/**
|
|
9568
|
+
* Number of child slots this section offers on the canvas (a container tile);
|
|
9569
|
+
* rendered as a 3-column grid. Containers cannot be placed inside other containers.
|
|
9570
|
+
*/
|
|
9571
|
+
slots?: number;
|
|
9572
|
+
/** Section type keys allowed in this container's slots. Omit to allow any non-container type. */
|
|
9573
|
+
accepts?: string[];
|
|
9574
|
+
}
|
|
9575
|
+
/** A container section's slot contents, padded/truncated to the type's slot count. */
|
|
9576
|
+
export function sectionChildren(section: PageSection, type: PageSectionType): (PageSection | null)[];
|
|
9577
|
+
/** Drag-and-drop MIME carrying a section type id from the palette to the canvas. */
|
|
9578
|
+
export const PAGE_TYPE_MIME = "application/x-zn-page-type";
|
|
9579
|
+
/** Drag-and-drop MIME carrying a placed section's id when reordering. */
|
|
9580
|
+
export const PAGE_SECTION_MIME = "application/x-zn-page-section";
|
|
9581
|
+
export function emptyPageState(): PageState;
|
|
9582
|
+
/** Unique-enough id for a new section, stable across edits once assigned. */
|
|
9583
|
+
export function generateSectionId(): string;
|
|
9584
|
+
/** Card summary: the section's first non-empty string value, else the type description. */
|
|
9585
|
+
export function sectionSummary(section: PageSection, type?: PageSectionType): string;
|
|
9586
|
+
}
|
|
9587
|
+
declare module "components/page-builder/page-registry" {
|
|
9588
|
+
import type { PageSectionType } from "components/page-builder/page.types";
|
|
9589
|
+
/**
|
|
9590
|
+
* Holds the set of {@link PageSectionType}s available to a page builder.
|
|
9591
|
+
* Register custom section types here (or via slotted templates) and the
|
|
9592
|
+
* palette and inspector pick them up automatically.
|
|
9593
|
+
*/
|
|
9594
|
+
export class PageSectionRegistry {
|
|
9595
|
+
private types;
|
|
9596
|
+
register(type: PageSectionType): this;
|
|
9597
|
+
registerAll(types: PageSectionType[]): this;
|
|
9598
|
+
get(type: string): PageSectionType | undefined;
|
|
9599
|
+
has(type: string): boolean;
|
|
9600
|
+
all(): PageSectionType[];
|
|
9601
|
+
/** Map of category name -> types, preserving insertion order. Uncategorised under ''. */
|
|
9602
|
+
categories(): Map<string, PageSectionType[]>;
|
|
9603
|
+
clear(): void;
|
|
9604
|
+
}
|
|
9605
|
+
}
|
|
9606
|
+
declare module "components/page-builder/modules/page-palette-item/page-palette-item.component" {
|
|
9607
|
+
import { type CSSResultGroup, type PropertyValues } from 'lit';
|
|
9608
|
+
import ZincElement from "internal/zinc-element";
|
|
9609
|
+
import ZnIcon from "components/icon/index";
|
|
9610
|
+
/**
|
|
9611
|
+
* @summary A draggable palette entry in `<zn-page-builder>`, representing a registered
|
|
9612
|
+
* section type. Drag it onto the canvas to add that section. Unlike zn-page-section-card
|
|
9613
|
+
* (host-wired), this element wires its own drag behaviour so it is draggable standalone.
|
|
9614
|
+
* @documentation https://zinc.style/components/page-palette-item
|
|
9615
|
+
* @status experimental
|
|
9616
|
+
* @since 1.0
|
|
9617
|
+
*
|
|
9618
|
+
* @dependency zn-icon
|
|
9619
|
+
*
|
|
9620
|
+
* @csspart base - The card row.
|
|
9621
|
+
*/
|
|
9622
|
+
export default class ZnPagePaletteItem extends ZincElement {
|
|
9623
|
+
static styles: CSSResultGroup;
|
|
9624
|
+
static dependencies: {
|
|
9625
|
+
'zn-icon': typeof ZnIcon;
|
|
9626
|
+
};
|
|
9627
|
+
/** The section type id this item creates when dropped. */
|
|
9628
|
+
type: string;
|
|
9629
|
+
label: string;
|
|
9630
|
+
description: string;
|
|
9631
|
+
icon: string;
|
|
9632
|
+
iconLibrary: string;
|
|
9633
|
+
color: string;
|
|
9634
|
+
connectedCallback(): void;
|
|
9635
|
+
disconnectedCallback(): void;
|
|
9636
|
+
protected updated(changed: PropertyValues): void;
|
|
9637
|
+
private _onDragStart;
|
|
9638
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
9639
|
+
}
|
|
9640
|
+
}
|
|
9641
|
+
declare module "components/page-builder/modules/page-palette-item/index" {
|
|
9642
|
+
import ZnPagePaletteItem from "components/page-builder/modules/page-palette-item/page-palette-item.component";
|
|
9643
|
+
export * from "components/page-builder/modules/page-palette-item/page-palette-item.component";
|
|
9644
|
+
export default ZnPagePaletteItem;
|
|
9645
|
+
global {
|
|
9646
|
+
interface HTMLElementTagNameMap {
|
|
9647
|
+
'zn-page-palette-item': ZnPagePaletteItem;
|
|
9648
|
+
}
|
|
9649
|
+
}
|
|
9650
|
+
}
|
|
9651
|
+
declare module "components/page-builder/modules/page-section-card/page-section-card.component" {
|
|
9652
|
+
import { type CSSResultGroup, type PropertyValues } from 'lit';
|
|
9653
|
+
import ZincElement from "internal/zinc-element";
|
|
9654
|
+
import ZnButton from "components/button/index";
|
|
9655
|
+
import ZnIcon from "components/icon/index";
|
|
9656
|
+
/**
|
|
9657
|
+
* @summary A section card on the `<zn-page-builder>` canvas: icon tile, label, one-line
|
|
9658
|
+
* summary, and hover actions (duplicate / remove). Purely presentational — the builder
|
|
9659
|
+
* wires up dragging, focus, selection and keyboard handling on the host element.
|
|
9660
|
+
* @documentation https://zinc.style/components/page-section-card
|
|
9661
|
+
* @status experimental
|
|
9662
|
+
* @since 1.0
|
|
9663
|
+
*
|
|
9664
|
+
* @dependency zn-button
|
|
9665
|
+
* @dependency zn-icon
|
|
9666
|
+
*
|
|
9667
|
+
* @event page-card-duplicate - The duplicate action was clicked (internal; not in the typed event map).
|
|
9668
|
+
* @event page-card-remove - The remove action was clicked (internal; not in the typed event map).
|
|
9669
|
+
*
|
|
9670
|
+
* @csspart base - The card row.
|
|
9671
|
+
*/
|
|
9672
|
+
export default class ZnPageSectionCard extends ZincElement {
|
|
9673
|
+
static styles: CSSResultGroup;
|
|
9674
|
+
static dependencies: {
|
|
9675
|
+
'zn-button': typeof ZnButton;
|
|
9676
|
+
'zn-icon': typeof ZnIcon;
|
|
9677
|
+
};
|
|
9678
|
+
label: string;
|
|
9679
|
+
summary: string;
|
|
9680
|
+
icon: string;
|
|
9681
|
+
iconLibrary: string;
|
|
9682
|
+
color: string;
|
|
9683
|
+
selected: boolean;
|
|
9684
|
+
/** Set when the section's type has no registered template — renders greyed. */
|
|
9685
|
+
unknown: boolean;
|
|
9686
|
+
protected updated(changed: PropertyValues): void;
|
|
9687
|
+
private _action;
|
|
9688
|
+
private _actionKeydown;
|
|
9689
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
9690
|
+
}
|
|
9691
|
+
}
|
|
9692
|
+
declare module "components/page-builder/modules/page-section-card/index" {
|
|
9693
|
+
import ZnPageSectionCard from "components/page-builder/modules/page-section-card/page-section-card.component";
|
|
9694
|
+
export * from "components/page-builder/modules/page-section-card/page-section-card.component";
|
|
9695
|
+
export default ZnPageSectionCard;
|
|
9696
|
+
global {
|
|
9697
|
+
interface HTMLElementTagNameMap {
|
|
9698
|
+
'zn-page-section-card': ZnPageSectionCard;
|
|
9699
|
+
}
|
|
9700
|
+
}
|
|
9701
|
+
}
|
|
9702
|
+
declare module "components/page-builder/page-builder.component" {
|
|
9703
|
+
import { type CSSResultGroup, type PropertyValues } from 'lit';
|
|
9704
|
+
import { type PageSection, type PageSectionType, type PageState } from "components/page-builder/page.types";
|
|
9705
|
+
import ZincElement from "internal/zinc-element";
|
|
9706
|
+
import ZnCollapsible from "components/collapsible/index";
|
|
9707
|
+
import ZnIcon from "components/icon/index";
|
|
9708
|
+
import ZnInput from "components/input/index";
|
|
9709
|
+
import ZnPagePaletteItem from "components/page-builder/modules/page-palette-item/index";
|
|
9710
|
+
import ZnPageSectionCard from "components/page-builder/modules/page-section-card/index";
|
|
9711
|
+
/**
|
|
9712
|
+
* @summary A config-driven page composer: a palette of predefined section types, a linear
|
|
9713
|
+
* canvas of section cards, and an inspector for editing each section's content.
|
|
9714
|
+
* @documentation https://zinc.style/components/page-builder
|
|
9715
|
+
* @status experimental
|
|
9716
|
+
* @since 1.0
|
|
9717
|
+
*
|
|
9718
|
+
* @dependency zn-collapsible
|
|
9719
|
+
* @dependency zn-icon
|
|
9720
|
+
* @dependency zn-input
|
|
9721
|
+
* @dependency zn-page-palette-item
|
|
9722
|
+
* @dependency zn-page-section-card
|
|
9723
|
+
*
|
|
9724
|
+
* @event zn-page-change - Emitted whenever the page state changes. `event.detail.state` is the new PageState.
|
|
9725
|
+
* @event zn-page-selection-change - Emitted when the selected section changes. `event.detail.sectionId`.
|
|
9726
|
+
*
|
|
9727
|
+
* @slot config - `<template type="…">` declarations; never displayed. Each template's attributes
|
|
9728
|
+
* (type, label, icon, icon-library, color, category, description, slots, accepts) declare a
|
|
9729
|
+
* palette entry and its content declares the inspector form for that type. `slots` makes the
|
|
9730
|
+
* section a container with that many child slots; `accepts` is a comma-separated list of the
|
|
9731
|
+
* type keys its slots allow.
|
|
9732
|
+
* @slot header-left - Actions shown on the left of the header bar.
|
|
9733
|
+
* @slot header-right - Actions shown on the right of the header bar.
|
|
9734
|
+
*
|
|
9735
|
+
* @csspart base - The grid wrapper.
|
|
9736
|
+
* @csspart header - The full-width header action bar (only rendered when header slots are filled).
|
|
9737
|
+
* @csspart palette - The left palette panel.
|
|
9738
|
+
* @csspart canvas - The centre section-card canvas.
|
|
9739
|
+
* @csspart inspector - The right panel while a section is selected.
|
|
9740
|
+
*/
|
|
9741
|
+
export default class ZnPageBuilder extends ZincElement {
|
|
9742
|
+
static styles: CSSResultGroup;
|
|
9743
|
+
static dependencies: {
|
|
9744
|
+
'zn-collapsible': typeof ZnCollapsible;
|
|
9745
|
+
'zn-icon': typeof ZnIcon;
|
|
9746
|
+
'zn-input': typeof ZnInput;
|
|
9747
|
+
'zn-page-palette-item': typeof ZnPagePaletteItem;
|
|
9748
|
+
'zn-page-section-card': typeof ZnPageSectionCard;
|
|
9749
|
+
};
|
|
9750
|
+
/** The page state as a JSON string. Parsed on set; invalid JSON is ignored with a warning. */
|
|
9751
|
+
config: string;
|
|
9752
|
+
heading: string;
|
|
9753
|
+
subheading: string;
|
|
9754
|
+
/** Section types to make available, registered into the internal registry. */
|
|
9755
|
+
sectionTypes: PageSectionType[];
|
|
9756
|
+
/** Collapses the left palette. Auto-set when the builder becomes narrow. */
|
|
9757
|
+
paletteCollapsed: boolean;
|
|
9758
|
+
/** Collapses the inspector while a section is selected. */
|
|
9759
|
+
inspectorCollapsed: boolean;
|
|
9760
|
+
/**
|
|
9761
|
+
* Auto-save the page to localStorage (1-day TTL). Omit to disable. A bare
|
|
9762
|
+
* `auto-save` saves every 5 minutes; a numeric value sets the interval in
|
|
9763
|
+
* minutes (`auto-save="2"`). Restore with `restoreAutoSave()`.
|
|
9764
|
+
*/
|
|
9765
|
+
autoSave: number | null;
|
|
9766
|
+
private registry;
|
|
9767
|
+
private _state;
|
|
9768
|
+
private _selectedId;
|
|
9769
|
+
private _search;
|
|
9770
|
+
/** Index of the drop zone whose "+" type picker is open, if any. */
|
|
9771
|
+
private _pickerIndex;
|
|
9772
|
+
private _dragOverIndex;
|
|
9773
|
+
/** The container slot a drag is currently over, if any. */
|
|
9774
|
+
private _slotDragOver;
|
|
9775
|
+
/** The container slot whose "+" type picker is open, if any. */
|
|
9776
|
+
private _slotPicker;
|
|
9777
|
+
/** The stamped config form for the selected section; rebuilt on selection change. */
|
|
9778
|
+
private _form;
|
|
9779
|
+
private readonly _hasSlot;
|
|
9780
|
+
private _history;
|
|
9781
|
+
private _redoStack;
|
|
9782
|
+
/** A deep copy of the current page state. */
|
|
9783
|
+
get state(): PageState;
|
|
9784
|
+
/** Replaces the page state wholesale (does not emit zn-page-change). */
|
|
9785
|
+
set state(next: PageState);
|
|
9786
|
+
handleConfigChange(): void;
|
|
9787
|
+
handleSectionTypesChange(): void;
|
|
9788
|
+
registerSectionType(type: PageSectionType): this;
|
|
9789
|
+
registerSectionTypes(types: PageSectionType[]): this;
|
|
9790
|
+
/**
|
|
9791
|
+
* Auto-collapses the palette when the builder crosses into narrow — only on the
|
|
9792
|
+
* crossing, so re-expanding while narrow stays a user choice.
|
|
9793
|
+
*/
|
|
9794
|
+
private _wasNarrow;
|
|
9795
|
+
private _resizeObserver;
|
|
9796
|
+
connectedCallback(): void;
|
|
9797
|
+
disconnectedCallback(): void;
|
|
9798
|
+
private _autoSaveTimer;
|
|
9799
|
+
private _statusTimer;
|
|
9800
|
+
private _justSavedTimer;
|
|
9801
|
+
/** Guards the restore prompt from re-triggering on restoreAutoSave's own state install. */
|
|
9802
|
+
private _restoring;
|
|
9803
|
+
/** Epoch of the newest auto-save (also picked up from storage on start). */
|
|
9804
|
+
private _lastSavedAt;
|
|
9805
|
+
/** Briefly true right after a save — flashes "Auto-saved" in the status pill. */
|
|
9806
|
+
private _justSaved;
|
|
9807
|
+
/** Re-render clock for the "last saved Xm ago" label. */
|
|
9808
|
+
private _statusNow;
|
|
9809
|
+
/** A fresh auto-save differing from the loaded page — offer to restore it. */
|
|
9810
|
+
private _restorePrompt;
|
|
9811
|
+
/** localStorage key for this builder's auto-saves — its id, else its heading. */
|
|
9812
|
+
private get _autoSaveKey();
|
|
9813
|
+
private _stopAutoSave;
|
|
9814
|
+
private _restartAutoSave;
|
|
9815
|
+
/** An empty page is never saved — it would clobber a stored page with nothing. */
|
|
9816
|
+
private _autoSaveTick;
|
|
9817
|
+
/** The stored auto-save, purging it when past its TTL (or unreadable). */
|
|
9818
|
+
private _readAutoSave;
|
|
9819
|
+
/** Load the auto-saved page, if one exists within the 1-day TTL. */
|
|
9820
|
+
restoreAutoSave: () => boolean;
|
|
9821
|
+
/**
|
|
9822
|
+
* A page was just loaded — when a fresh auto-save differs from it, ask the
|
|
9823
|
+
* user whether to pick up their draft instead.
|
|
9824
|
+
*/
|
|
9825
|
+
private _offerRestoreIfNewer;
|
|
9826
|
+
protected willUpdate(changed: PropertyValues): void;
|
|
9827
|
+
private _typeFromTemplate;
|
|
9828
|
+
private _registerSlottedTemplates;
|
|
9829
|
+
/** Normalises and installs an externally provided state; resets selection. */
|
|
9830
|
+
private _applyExternalState;
|
|
9831
|
+
/** Finds a section by id, searching top-level sections and slotted children. */
|
|
9832
|
+
private _findSection;
|
|
9833
|
+
/** New sections array with the section patched wherever it lives (top level or slot). */
|
|
9834
|
+
private _patchSection;
|
|
9835
|
+
/** Detaches a section wherever it lives: removed from the top level, or its slot nulled. */
|
|
9836
|
+
private _extract;
|
|
9837
|
+
/** Installs a new state from a user edit and notifies listeners. */
|
|
9838
|
+
private _commit;
|
|
9839
|
+
private _selectedSection;
|
|
9840
|
+
private _select;
|
|
9841
|
+
private _pushHistory;
|
|
9842
|
+
undo: () => void;
|
|
9843
|
+
redo: () => void;
|
|
9844
|
+
/** Adds a section of a registered type at `index` (default: end). Returns null for unknown types. */
|
|
9845
|
+
addSection(type: string, index?: number): PageSection | null;
|
|
9846
|
+
/** Adds a new section of a registered type into a container's slot. Returns null if not allowed. */
|
|
9847
|
+
addSectionToSlot(type: string, containerId: string, slotIndex: number): PageSection | null;
|
|
9848
|
+
private _removeSection;
|
|
9849
|
+
private _duplicateSection;
|
|
9850
|
+
/** Moves a section (top-level or slotted) to a top-level position. */
|
|
9851
|
+
private _moveSection;
|
|
9852
|
+
/**
|
|
9853
|
+
* Moves a section into a container's slot. Dropping onto an occupied slot swaps
|
|
9854
|
+
* the two children (slot-to-slot reordering); top-level sections and containers
|
|
9855
|
+
* only enter empty slots / never enter slots respectively.
|
|
9856
|
+
*/
|
|
9857
|
+
private _moveToSlot;
|
|
9858
|
+
private _onCardDragStart;
|
|
9859
|
+
/** Whether a drag carries one of the builder's own payloads. */
|
|
9860
|
+
private _isPageDrag;
|
|
9861
|
+
private _onSlotDragOver;
|
|
9862
|
+
private _onSlotDrop;
|
|
9863
|
+
private _onZoneDragOver;
|
|
9864
|
+
private _onZoneDrop;
|
|
9865
|
+
private _onCanvasDragOver;
|
|
9866
|
+
private _onCanvasDrop;
|
|
9867
|
+
private _onCardKeydown;
|
|
9868
|
+
private _renderPalette;
|
|
9869
|
+
private _renderPaletteItem;
|
|
9870
|
+
private _renderAutoSaveStatus;
|
|
9871
|
+
private _renderRestorePrompt;
|
|
9872
|
+
private _renderCanvas;
|
|
9873
|
+
/** The one card template both the page list and slot cells render. */
|
|
9874
|
+
private _renderSectionCard;
|
|
9875
|
+
private _renderCard;
|
|
9876
|
+
private _renderSlot;
|
|
9877
|
+
/** Types allowed in a container's slots: non-containers, filtered by its accepts list. */
|
|
9878
|
+
private _slotTypes;
|
|
9879
|
+
/** The one type-picker template both drop zones and slot cells render. */
|
|
9880
|
+
private _renderTypePicker;
|
|
9881
|
+
private _renderDropZone;
|
|
9882
|
+
/**
|
|
9883
|
+
* Clones the selected type's config template into a live form and prefills each
|
|
9884
|
+
* `[name]` control from the section's data. The element is rendered directly by
|
|
9885
|
+
* Lit (`${this._form}`) so user-entered values survive unrelated re-renders.
|
|
9886
|
+
*/
|
|
9887
|
+
private _buildInspectorForm;
|
|
9888
|
+
private _isBooleanControl;
|
|
9889
|
+
/** Handles change/input events bubbling from stamped form controls. */
|
|
9890
|
+
private _onInspectorInput;
|
|
9891
|
+
private _updateSectionData;
|
|
9892
|
+
private _renameSection;
|
|
9893
|
+
private _renderInspector;
|
|
9894
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
9895
|
+
}
|
|
9896
|
+
}
|
|
9897
|
+
declare module "components/page-builder/index" {
|
|
9898
|
+
import ZnPageBuilder from "components/page-builder/page-builder.component";
|
|
9899
|
+
export * from "components/page-builder/page-builder.component";
|
|
9900
|
+
export * from "components/page-builder/page.types";
|
|
9901
|
+
export * from "components/page-builder/page-registry";
|
|
9902
|
+
export default ZnPageBuilder;
|
|
9903
|
+
global {
|
|
9904
|
+
interface HTMLElementTagNameMap {
|
|
9905
|
+
'zn-page-builder': ZnPageBuilder;
|
|
9906
|
+
}
|
|
9907
|
+
}
|
|
9908
|
+
}
|
|
9268
9909
|
declare module "utilities/form" {
|
|
9269
9910
|
export { clearFormStoreValues } from "internal/form";
|
|
9270
9911
|
}
|
|
@@ -9410,6 +10051,27 @@ declare module "events/zn-flow-connect" {
|
|
|
9410
10051
|
}
|
|
9411
10052
|
}
|
|
9412
10053
|
}
|
|
10054
|
+
declare module "events/zn-page-change" {
|
|
10055
|
+
import type { PageState } from "components/page-builder/page.types";
|
|
10056
|
+
export type ZnPageChangeEvent = CustomEvent<{
|
|
10057
|
+
state: PageState;
|
|
10058
|
+
}>;
|
|
10059
|
+
global {
|
|
10060
|
+
interface GlobalEventHandlersEventMap {
|
|
10061
|
+
'zn-page-change': ZnPageChangeEvent;
|
|
10062
|
+
}
|
|
10063
|
+
}
|
|
10064
|
+
}
|
|
10065
|
+
declare module "events/zn-page-selection-change" {
|
|
10066
|
+
export type ZnPageSelectionChangeEvent = CustomEvent<{
|
|
10067
|
+
sectionId: string | null;
|
|
10068
|
+
}>;
|
|
10069
|
+
global {
|
|
10070
|
+
interface GlobalEventHandlersEventMap {
|
|
10071
|
+
'zn-page-selection-change': ZnPageSelectionChangeEvent;
|
|
10072
|
+
}
|
|
10073
|
+
}
|
|
10074
|
+
}
|
|
9413
10075
|
declare module "events/events" {
|
|
9414
10076
|
export type { ZnAfterHideEvent } from "events/zn-after-hide";
|
|
9415
10077
|
export type { ZnAfterShowEvent } from "events/zn-after-show";
|
|
@@ -9428,6 +10090,8 @@ declare module "events/events" {
|
|
|
9428
10090
|
export type { ZnFlowChangeEvent } from "events/zn-flow-change";
|
|
9429
10091
|
export type { ZnFlowSelectionChangeEvent } from "events/zn-flow-selection-change";
|
|
9430
10092
|
export type { ZnFlowConnectEvent } from "events/zn-flow-connect";
|
|
10093
|
+
export type { ZnPageChangeEvent } from "events/zn-page-change";
|
|
10094
|
+
export type { ZnPageSelectionChangeEvent } from "events/zn-page-selection-change";
|
|
9431
10095
|
}
|
|
9432
10096
|
declare module "zinc" {
|
|
9433
10097
|
export { default as Button } from "components/button/index";
|
|
@@ -9535,6 +10199,10 @@ declare module "zinc" {
|
|
|
9535
10199
|
export { default as FlowSteps } from "components/flow-builder/modules/flow-steps/index";
|
|
9536
10200
|
export { default as FlowStepGroup } from "components/flow-builder/modules/flow-step-group/index";
|
|
9537
10201
|
export { default as FlowStep } from "components/flow-builder/modules/flow-step/index";
|
|
10202
|
+
export { default as FlowBranchConditions } from "components/flow-builder/modules/flow-branch-conditions/index";
|
|
10203
|
+
export { default as PageBuilder } from "components/page-builder/index";
|
|
10204
|
+
export { default as PagePaletteItem } from "components/page-builder/modules/page-palette-item/index";
|
|
10205
|
+
export { default as PageSectionCard } from "components/page-builder/modules/page-section-card/index";
|
|
9538
10206
|
export { default as ZincElement } from "internal/zinc-element";
|
|
9539
10207
|
export * from "utilities/on";
|
|
9540
10208
|
export * from "utilities/query";
|