@kubex/zinc 1.1.28 → 1.1.29
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 +1483 -17
- package/dist/vscode.html-custom-data.json +40 -1
- package/dist/web-types.json +124 -3
- package/dist/zn.d.ts +670 -14
- package/dist/zn.min.js +1305 -925
- 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/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/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/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
|
}
|
|
@@ -8442,6 +8441,57 @@ declare module "components/flow-builder/flow.types" {
|
|
|
8442
8441
|
/** Branch configuration (filters / conditions for taking this path), edited via the branch editor. */
|
|
8443
8442
|
data?: Record<string, unknown>;
|
|
8444
8443
|
}
|
|
8444
|
+
/** A choice in a filter field's operator or value dropdown. */
|
|
8445
|
+
export interface FlowFilterOption {
|
|
8446
|
+
value: string;
|
|
8447
|
+
/** Display text; defaults to the value. */
|
|
8448
|
+
label?: string;
|
|
8449
|
+
}
|
|
8450
|
+
/** One control row of a branch filter (e.g. "[in the last ▾] [6] [month(s) ▾]"). */
|
|
8451
|
+
export interface FlowFilterField {
|
|
8452
|
+
id: string;
|
|
8453
|
+
/** Leading text shown before the controls. */
|
|
8454
|
+
label?: string;
|
|
8455
|
+
/** The value control. Defaults to 'select' when `options` are given, else 'text'. */
|
|
8456
|
+
type?: 'select' | 'number' | 'text';
|
|
8457
|
+
/** Operator choices shown before the value (e.g. "at least" / "in the last" / "is equal to"). */
|
|
8458
|
+
operators?: FlowFilterOption[];
|
|
8459
|
+
/** Value choices for a 'select' field. */
|
|
8460
|
+
options?: FlowFilterOption[];
|
|
8461
|
+
/** Choices for an adjustable trailing unit dropdown (e.g. day(s) / month(s)); shown instead of `suffix`. */
|
|
8462
|
+
units?: FlowFilterOption[];
|
|
8463
|
+
/** Trailing unit text (e.g. "time(s)") when the unit isn't adjustable. */
|
|
8464
|
+
suffix?: string;
|
|
8465
|
+
placeholder?: string;
|
|
8466
|
+
/** Initial value when the filter is added to a condition. */
|
|
8467
|
+
value?: string | number;
|
|
8468
|
+
}
|
|
8469
|
+
/** An operator's display label: its own, a well-known default for its value, else the value itself. */
|
|
8470
|
+
export function operatorLabel(option: FlowFilterOption): string;
|
|
8471
|
+
/** A filter offered by the built-in branch conditions editor. */
|
|
8472
|
+
export interface FlowBranchFilter {
|
|
8473
|
+
id: string;
|
|
8474
|
+
label: string;
|
|
8475
|
+
description?: string;
|
|
8476
|
+
fields: FlowFilterField[];
|
|
8477
|
+
}
|
|
8478
|
+
/** One configured condition: a filter plus its per-field operator / value / unit entries. */
|
|
8479
|
+
export interface FlowBranchCondition {
|
|
8480
|
+
/** The `FlowBranchFilter` id this condition uses. */
|
|
8481
|
+
filter: string;
|
|
8482
|
+
values: Record<string, {
|
|
8483
|
+
operator?: string;
|
|
8484
|
+
value?: string | number;
|
|
8485
|
+
unit?: string;
|
|
8486
|
+
}>;
|
|
8487
|
+
}
|
|
8488
|
+
/**
|
|
8489
|
+
* A branch's full condition set as persisted on the output port's
|
|
8490
|
+
* `data.conditions`: the outer array is OR-ed, each inner group AND-ed.
|
|
8491
|
+
*/
|
|
8492
|
+
export type FlowBranchConditions = FlowBranchCondition[][];
|
|
8493
|
+
/** Read the conditions persisted on an output port (`port.data.conditions`). */
|
|
8494
|
+
export function branchConditions(port: FlowPort): FlowBranchConditions;
|
|
8445
8495
|
/**
|
|
8446
8496
|
* Describes a kind of node that can be placed on the canvas. Consumers register
|
|
8447
8497
|
* these with the builder to extend it — the steps panel and inspector are driven
|
|
@@ -8469,6 +8519,12 @@ declare module "components/flow-builder/flow.types" {
|
|
|
8469
8519
|
outputs?: FlowPort[];
|
|
8470
8520
|
/** Initial `data` for a freshly placed node. */
|
|
8471
8521
|
defaultData?: Record<string, unknown>;
|
|
8522
|
+
/**
|
|
8523
|
+
* Filters offered by the built-in branch conditions editor for this type's
|
|
8524
|
+
* output branches (AND/OR groups persisted on the port's `data.conditions`).
|
|
8525
|
+
* Ignored when `renderBranchConfig` is set.
|
|
8526
|
+
*/
|
|
8527
|
+
branchFilters?: FlowBranchFilter[];
|
|
8472
8528
|
/** Renders the inspector body for a selected node of this type. */
|
|
8473
8529
|
renderConfig?: (node: FlowNodeInstance, update: (data: Record<string, unknown>) => void) => TemplateResult;
|
|
8474
8530
|
/** Renders the branch editor body (filters / conditions) for one of this type's output branches. */
|
|
@@ -8534,14 +8590,27 @@ declare module "components/flow-builder/flow.types" {
|
|
|
8534
8590
|
*/
|
|
8535
8591
|
export const NODE_WIDTH = 240;
|
|
8536
8592
|
export const NODE_HEIGHT = 60;
|
|
8537
|
-
/**
|
|
8538
|
-
|
|
8593
|
+
/**
|
|
8594
|
+
* Horizontal spacing between the branches of a multi-output node. Matches the
|
|
8595
|
+
* untangle layer gap (card width + 80) so two sibling children fit side by side
|
|
8596
|
+
* directly under their drops — straight downward wires, no elbows.
|
|
8597
|
+
*/
|
|
8598
|
+
export const BRANCH_SPREAD: number;
|
|
8539
8599
|
export const BUS_OFFSET = 40;
|
|
8540
8600
|
export const PILL_DROP = 40;
|
|
8541
8601
|
export const PILL_HEIGHT = 40;
|
|
8542
8602
|
export const PILL_MAX_WIDTH = 240;
|
|
8543
8603
|
/** Extra pill height per wrapped line (matches the pill's CSS line-height). */
|
|
8544
8604
|
export const PILL_LINE_HEIGHT = 20;
|
|
8605
|
+
/**
|
|
8606
|
+
* Canvas y of a branch pill's top edge. A pill on a wire to a child below is
|
|
8607
|
+
* centred along the run from its node's bottom to the child's top — equal wire
|
|
8608
|
+
* above and below, however long or tight. A sole output's wire is a straight
|
|
8609
|
+
* stem with no bus to respect, so its pill may rise above the bus line to stay
|
|
8610
|
+
* centred; fan branches stop at the bus. Open branches and loop/side wires
|
|
8611
|
+
* keep the fixed drop below the bus.
|
|
8612
|
+
*/
|
|
8613
|
+
export function branchPillTop(node: Pick<FlowNodeInstance, 'y'>, pillH: number, child?: Pick<FlowNodeInstance, 'y'>, soleOutput?: boolean): number;
|
|
8545
8614
|
/**
|
|
8546
8615
|
* Estimated pill box for a branch name: sizes to the text up to the max width,
|
|
8547
8616
|
* then hard-wraps — the height grows a grid unit per extra line. The pill DOM
|
|
@@ -8566,12 +8635,13 @@ declare module "components/flow-builder/flow.types" {
|
|
|
8566
8635
|
/** A function resolving a node type key to its registered type. */
|
|
8567
8636
|
export type FlowTypeOf = (type: string) => FlowNodeType | undefined;
|
|
8568
8637
|
/**
|
|
8569
|
-
* Canvas x for each of a node's branch drops
|
|
8570
|
-
*
|
|
8571
|
-
*
|
|
8572
|
-
*
|
|
8638
|
+
* Canvas x for each of a node's branch drops: the natural fan position under
|
|
8639
|
+
* the source. Pills never shift sideways to chase their child — the wire into
|
|
8640
|
+
* a pill is always a straight vertical, and any lateral offset to the child is
|
|
8641
|
+
* taken up by the elbow below the pill (which still enters the child from
|
|
8642
|
+
* straight above).
|
|
8573
8643
|
*/
|
|
8574
|
-
export function branchDropXs(node: FlowNodeInstance, typeOf: FlowTypeOf
|
|
8644
|
+
export function branchDropXs(node: FlowNodeInstance, typeOf: FlowTypeOf): number[];
|
|
8575
8645
|
/**
|
|
8576
8646
|
* The rects a node occupies on the canvas: its card plus each branch-name pill,
|
|
8577
8647
|
* at the exact positions the canvas draws them.
|
|
@@ -8579,6 +8649,13 @@ declare module "components/flow-builder/flow.types" {
|
|
|
8579
8649
|
export function nodeObstacles(node: FlowNodeInstance, typeOf: FlowTypeOf, nodes: FlowNodeInstance[], connections: FlowConnection[]): Rect[];
|
|
8580
8650
|
/** Whether two nodes' footprints (cards and branch pills) would overlap. */
|
|
8581
8651
|
export function nodesCollide(a: FlowNodeInstance, b: FlowNodeInstance, typeOf: FlowTypeOf, nodes: FlowNodeInstance[], connections: FlowConnection[]): boolean;
|
|
8652
|
+
/**
|
|
8653
|
+
* Whether any of `node`'s branch pills overlap another node's footprint. A
|
|
8654
|
+
* pill centres between its node and the connected child, so moving the CHILD
|
|
8655
|
+
* moves the pill — drags use this to check the moved node's parents, whose
|
|
8656
|
+
* displaced pills could land on a third node.
|
|
8657
|
+
*/
|
|
8658
|
+
export function pillsCollide(node: FlowNodeInstance, typeOf: FlowTypeOf, nodes: FlowNodeInstance[], connections: FlowConnection[]): boolean;
|
|
8582
8659
|
/** Whether a bare card placed at `pos` would hit any of `node`'s footprint. */
|
|
8583
8660
|
export function cardCollides(pos: {
|
|
8584
8661
|
x: number;
|
|
@@ -8623,6 +8700,88 @@ declare module "components/flow-builder/flow.types" {
|
|
|
8623
8700
|
*/
|
|
8624
8701
|
export function loopConnections(nodes: FlowNodeInstance[], connections: FlowConnection[]): Set<FlowConnection>;
|
|
8625
8702
|
}
|
|
8703
|
+
declare module "components/flow-builder/modules/flow-branch-conditions/flow-branch-conditions.component" {
|
|
8704
|
+
import { type CSSResultGroup, type PropertyValues } from 'lit';
|
|
8705
|
+
import ZincElement from "internal/zinc-element";
|
|
8706
|
+
import ZnButton from "components/button/index";
|
|
8707
|
+
import ZnIcon from "components/icon/index";
|
|
8708
|
+
import ZnInput from "components/input/index";
|
|
8709
|
+
import ZnOption from "components/option/index";
|
|
8710
|
+
import ZnSelect from "components/select/index";
|
|
8711
|
+
import { type FlowBranchConditions, type FlowBranchFilter } from "components/flow-builder/flow.types";
|
|
8712
|
+
/**
|
|
8713
|
+
* @summary The built-in branch conditions editor: pick filters from a searchable list, then
|
|
8714
|
+
* combine them into AND groups joined by OR. Rendered by `<zn-flow-builder>`'s branch editor
|
|
8715
|
+
* for node types that declare `branchFilters`; edits are drafted locally and only applied
|
|
8716
|
+
* on Save.
|
|
8717
|
+
* @documentation https://zinc.style/components/flow-branch-conditions
|
|
8718
|
+
* @status experimental
|
|
8719
|
+
* @since 1.0
|
|
8720
|
+
*
|
|
8721
|
+
* @dependency zn-button
|
|
8722
|
+
* @dependency zn-icon
|
|
8723
|
+
* @dependency zn-input
|
|
8724
|
+
* @dependency zn-option
|
|
8725
|
+
* @dependency zn-select
|
|
8726
|
+
*
|
|
8727
|
+
* @event flow-conditions-save - Emitted on Save with `detail.conditions` (OR groups of AND-ed conditions).
|
|
8728
|
+
* @event flow-conditions-cancel - Emitted on Cancel, with the draft discarded.
|
|
8729
|
+
*
|
|
8730
|
+
* @csspart base - The editor wrapper.
|
|
8731
|
+
* @csspart picker - The filter picker (search + list).
|
|
8732
|
+
* @csspart conditions - The configured condition groups.
|
|
8733
|
+
*/
|
|
8734
|
+
export default class ZnFlowBranchConditions extends ZincElement {
|
|
8735
|
+
static styles: CSSResultGroup;
|
|
8736
|
+
static dependencies: {
|
|
8737
|
+
'zn-button': typeof ZnButton;
|
|
8738
|
+
'zn-icon': typeof ZnIcon;
|
|
8739
|
+
'zn-input': typeof ZnInput;
|
|
8740
|
+
'zn-option': typeof ZnOption;
|
|
8741
|
+
'zn-select': typeof ZnSelect;
|
|
8742
|
+
};
|
|
8743
|
+
/** The filters available to build conditions from. */
|
|
8744
|
+
filters: FlowBranchFilter[];
|
|
8745
|
+
/** The saved conditions being edited; changes stay in a local draft until Save. */
|
|
8746
|
+
value: FlowBranchConditions;
|
|
8747
|
+
private _draft;
|
|
8748
|
+
/** Group index the picker adds into (`_draft.length` starts a new OR group), or null when closed. */
|
|
8749
|
+
private _picker;
|
|
8750
|
+
private _search;
|
|
8751
|
+
/** JSON of the last `value` the draft was built from, so re-renders that pass an
|
|
8752
|
+
* equivalent value (fresh array refs) don't wipe in-progress edits. */
|
|
8753
|
+
private _valueJson;
|
|
8754
|
+
protected willUpdate(changed: PropertyValues): void;
|
|
8755
|
+
private _emit;
|
|
8756
|
+
private _save;
|
|
8757
|
+
private _cancel;
|
|
8758
|
+
private _cloneDraft;
|
|
8759
|
+
private _addCondition;
|
|
8760
|
+
private _removeCondition;
|
|
8761
|
+
private _setField;
|
|
8762
|
+
private _renderPicker;
|
|
8763
|
+
/**
|
|
8764
|
+
* A select's minimum width, sized so its longest label never truncates
|
|
8765
|
+
* (estimated per char, plus padding and the chevron). When the row can't
|
|
8766
|
+
* fit it, flex-wrap gives the select its own full-width line instead.
|
|
8767
|
+
*/
|
|
8768
|
+
private static _selectMinWidth;
|
|
8769
|
+
private _renderField;
|
|
8770
|
+
private _renderCondition;
|
|
8771
|
+
private _renderConditions;
|
|
8772
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
8773
|
+
}
|
|
8774
|
+
}
|
|
8775
|
+
declare module "components/flow-builder/modules/flow-branch-conditions/index" {
|
|
8776
|
+
import ZnFlowBranchConditions from "components/flow-builder/modules/flow-branch-conditions/flow-branch-conditions.component";
|
|
8777
|
+
export * from "components/flow-builder/modules/flow-branch-conditions/flow-branch-conditions.component";
|
|
8778
|
+
export default ZnFlowBranchConditions;
|
|
8779
|
+
global {
|
|
8780
|
+
interface HTMLElementTagNameMap {
|
|
8781
|
+
'zn-flow-branch-conditions': ZnFlowBranchConditions;
|
|
8782
|
+
}
|
|
8783
|
+
}
|
|
8784
|
+
}
|
|
8626
8785
|
declare module "components/flow-builder/modules/flow-node/flow-node.component" {
|
|
8627
8786
|
import { type CSSResultGroup, type PropertyValues } from 'lit';
|
|
8628
8787
|
import ZincElement from "internal/zinc-element";
|
|
@@ -8743,6 +8902,7 @@ declare module "components/flow-builder/modules/flow-canvas/flow-canvas.componen
|
|
|
8743
8902
|
*
|
|
8744
8903
|
* @csspart base - The canvas viewport.
|
|
8745
8904
|
* @csspart toolbar - The floating toolbar.
|
|
8905
|
+
* @csspart bin - The delete drop-zone shown bottom-right while dragging a node or step.
|
|
8746
8906
|
*/
|
|
8747
8907
|
export default class ZnFlowCanvas extends ZincElement {
|
|
8748
8908
|
static styles: CSSResultGroup;
|
|
@@ -8767,6 +8927,8 @@ declare module "components/flow-builder/modules/flow-canvas/flow-canvas.componen
|
|
|
8767
8927
|
private panX;
|
|
8768
8928
|
private panY;
|
|
8769
8929
|
private drag;
|
|
8930
|
+
/** Whether the current drag (node or step) is over the delete bin. */
|
|
8931
|
+
private _overBin;
|
|
8770
8932
|
/** Canvas-space top-left where a step, if dropped now, would be placed. */
|
|
8771
8933
|
private _dropGhost;
|
|
8772
8934
|
/** The stray branch being drawn from an output port until it attaches or cancels. */
|
|
@@ -8809,6 +8971,12 @@ declare module "components/flow-builder/modules/flow-canvas/flow-canvas.componen
|
|
|
8809
8971
|
* builder on attach).
|
|
8810
8972
|
*/
|
|
8811
8973
|
private _onPortClick;
|
|
8974
|
+
/**
|
|
8975
|
+
* An orphaned branch pill's port was clicked. If a branch from another node
|
|
8976
|
+
* is already in flight, attach it to this pill's node; otherwise start a
|
|
8977
|
+
* stray branch that continues from this pill.
|
|
8978
|
+
*/
|
|
8979
|
+
private _onBranchPortClick;
|
|
8812
8980
|
private _startLink;
|
|
8813
8981
|
private _onLinkPointerMove;
|
|
8814
8982
|
private _updateLinkFromClient;
|
|
@@ -8822,6 +8990,8 @@ declare module "components/flow-builder/modules/flow-canvas/flow-canvas.componen
|
|
|
8822
8990
|
private _cancelLink;
|
|
8823
8991
|
private _onPointerMove;
|
|
8824
8992
|
private _onPointerUp;
|
|
8993
|
+
/** Whether a client-space point is over the delete bin. */
|
|
8994
|
+
private _binHit;
|
|
8825
8995
|
private _beginMove;
|
|
8826
8996
|
/**
|
|
8827
8997
|
* A node's outputs all leave from a single bottom-centre stem and fan out along a
|
|
@@ -8840,7 +9010,12 @@ declare module "components/flow-builder/modules/flow-canvas/flow-canvas.componen
|
|
|
8840
9010
|
* same input keep sharing a line: their join is real.
|
|
8841
9011
|
*/
|
|
8842
9012
|
private _elbowMidOffsets;
|
|
8843
|
-
/**
|
|
9013
|
+
/**
|
|
9014
|
+
* Whether an orthogonal segment passes through any node card (with margin) —
|
|
9015
|
+
* or the approach zone above one, where incoming arrows land. A foreign wire
|
|
9016
|
+
* running just over a card's input port reads as connecting to it, so routes
|
|
9017
|
+
* keep well clear of that strip too.
|
|
9018
|
+
*/
|
|
8844
9019
|
private _segmentBlocked;
|
|
8845
9020
|
private _routeClear;
|
|
8846
9021
|
/**
|
|
@@ -8869,6 +9044,9 @@ declare module "components/flow-builder/modules/flow-canvas/flow-canvas.componen
|
|
|
8869
9044
|
private _onAddPointDragOver;
|
|
8870
9045
|
private _onAddDrop;
|
|
8871
9046
|
private _onWireDrop;
|
|
9047
|
+
private _onBinDragOver;
|
|
9048
|
+
private _onBinDragLeave;
|
|
9049
|
+
private _onBinDrop;
|
|
8872
9050
|
private _zoomBy;
|
|
8873
9051
|
/** Canvas-space bounding box of the whole flow: nodes, branch drops, and notes. */
|
|
8874
9052
|
private _contentBounds;
|
|
@@ -8940,10 +9118,13 @@ declare module "components/flow-builder/modules/flow-step-group/index" {
|
|
|
8940
9118
|
}
|
|
8941
9119
|
declare module "components/flow-builder/flow-layout" {
|
|
8942
9120
|
import { type FlowNodeType, type FlowState } from "components/flow-builder/flow.types";
|
|
8943
|
-
/** Horizontal gap between node origins within a layer. */
|
|
9121
|
+
/** Horizontal gap between node origins within a layer (= BRANCH_SPREAD, so siblings land under their drops). */
|
|
8944
9122
|
export const LAYOUT_H_GAP: number;
|
|
8945
|
-
/**
|
|
8946
|
-
|
|
9123
|
+
/**
|
|
9124
|
+
* Vertical gap between layers: a 160 card-to-card gap — a centred pill gets 60
|
|
9125
|
+
* of wire above and below — keeping the arranged flow compact.
|
|
9126
|
+
*/
|
|
9127
|
+
export const LAYOUT_V_GAP = 220;
|
|
8947
9128
|
/**
|
|
8948
9129
|
* "Untangle" auto-layout: assigns every node a position in a layered, top-down
|
|
8949
9130
|
* flow. Layers come from the longest path back to a root (the graph is a DAG —
|
|
@@ -8960,6 +9141,7 @@ declare module "components/flow-builder/flow-layout" {
|
|
|
8960
9141
|
declare module "components/flow-builder/flow-builder.component" {
|
|
8961
9142
|
import { type CSSResultGroup, type PropertyValues } from 'lit';
|
|
8962
9143
|
import ZincElement from "internal/zinc-element";
|
|
9144
|
+
import ZnFlowBranchConditions from "components/flow-builder/modules/flow-branch-conditions/index";
|
|
8963
9145
|
import ZnFlowCanvas from "components/flow-builder/modules/flow-canvas/index";
|
|
8964
9146
|
import ZnFlowStepGroup from "components/flow-builder/modules/flow-step-group/index";
|
|
8965
9147
|
import ZnIcon from "components/icon/index";
|
|
@@ -8977,6 +9159,7 @@ declare module "components/flow-builder/flow-builder.component" {
|
|
|
8977
9159
|
* @dependency zn-input
|
|
8978
9160
|
* @dependency zn-tabs
|
|
8979
9161
|
* @dependency zn-navbar
|
|
9162
|
+
* @dependency zn-flow-branch-conditions
|
|
8980
9163
|
* @dependency zn-flow-canvas
|
|
8981
9164
|
* @dependency zn-flow-node
|
|
8982
9165
|
*
|
|
@@ -8985,7 +9168,10 @@ declare module "components/flow-builder/flow-builder.component" {
|
|
|
8985
9168
|
* @event zn-flow-connect - Emitted when a connection is created. `event.detail.connection`.
|
|
8986
9169
|
*
|
|
8987
9170
|
* @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.
|
|
9171
|
+
* step into the right tab and collapsible grouping of the rendered panel. A step may nest
|
|
9172
|
+
* `<zn-flow-filter>` declarations (each holding `<zn-flow-filter-field>`s, whose operator /
|
|
9173
|
+
* option choices are nested `<zn-flow-operator>` / `<zn-flow-option>` elements) — or set a
|
|
9174
|
+
* `branch-filters` JSON attribute — to drive the built-in branch conditions editor.
|
|
8989
9175
|
* @slot header-left - Actions shown on the left of the header bar (e.g. Close / Undo All Changes).
|
|
8990
9176
|
* @slot header-right - Actions shown on the right of the header bar (e.g. Apply Changes).
|
|
8991
9177
|
* @slot sidebar - Extra right-panel content (status, version history), below the configuration errors.
|
|
@@ -9002,6 +9188,7 @@ declare module "components/flow-builder/flow-builder.component" {
|
|
|
9002
9188
|
'zn-input': typeof ZnInput;
|
|
9003
9189
|
'zn-tabs': typeof ZnTabs;
|
|
9004
9190
|
'zn-navbar': typeof ZnNavbar;
|
|
9191
|
+
'zn-flow-branch-conditions': typeof ZnFlowBranchConditions;
|
|
9005
9192
|
'zn-flow-canvas': typeof ZnFlowCanvas;
|
|
9006
9193
|
'zn-flow-step-group': typeof ZnFlowStepGroup;
|
|
9007
9194
|
};
|
|
@@ -9011,6 +9198,12 @@ declare module "components/flow-builder/flow-builder.component" {
|
|
|
9011
9198
|
subheading: string;
|
|
9012
9199
|
/** Node ids flagged as having configuration errors (drives the red node styling). */
|
|
9013
9200
|
errorNodes: string[];
|
|
9201
|
+
/**
|
|
9202
|
+
* Auto-save the flow to localStorage (1-day TTL). Omit to disable. A bare
|
|
9203
|
+
* `auto-save` saves every 5 minutes; a numeric value sets the interval in
|
|
9204
|
+
* minutes (`auto-save="5"`). Restore with `restoreAutoSave()`.
|
|
9205
|
+
*/
|
|
9206
|
+
autoSave: number | null;
|
|
9014
9207
|
/** Optional hint shown beneath each steps-panel tab. */
|
|
9015
9208
|
entrypointsHint: string;
|
|
9016
9209
|
triggersHint: string;
|
|
@@ -9025,6 +9218,9 @@ declare module "components/flow-builder/flow-builder.component" {
|
|
|
9025
9218
|
/** The steps-panel tab currently shown; the search only filters this tab. */
|
|
9026
9219
|
private _activeGroup;
|
|
9027
9220
|
private readonly _hasSlot;
|
|
9221
|
+
/** Side panels tucked away via their edge chevrons. */
|
|
9222
|
+
private _stepsCollapsed;
|
|
9223
|
+
private _sideCollapsed;
|
|
9028
9224
|
/** The node being relocated via the MOVE menu action, if any. */
|
|
9029
9225
|
private _movingNodeId;
|
|
9030
9226
|
/** The "+" picker popover target (an open output, or a wire to insert into), if open. */
|
|
@@ -9047,10 +9243,52 @@ declare module "components/flow-builder/flow-builder.component" {
|
|
|
9047
9243
|
private get _listeners();
|
|
9048
9244
|
connectedCallback(): void;
|
|
9049
9245
|
disconnectedCallback(): void;
|
|
9246
|
+
private _autoSaveTimer;
|
|
9247
|
+
private _statusTimer;
|
|
9248
|
+
private _justSavedTimer;
|
|
9249
|
+
/** Guards the restore prompt from re-triggering on restoreAutoSave's own setState. */
|
|
9250
|
+
private _restoring;
|
|
9251
|
+
/** Epoch of the newest auto-save (also picked up from storage on start). */
|
|
9252
|
+
private _lastSavedAt;
|
|
9253
|
+
/** Briefly true right after a save — flashes "Auto-saved" in the status pill. */
|
|
9254
|
+
private _justSaved;
|
|
9255
|
+
/** Re-render clock for the "last saved Xm ago" label. */
|
|
9256
|
+
private _statusNow;
|
|
9257
|
+
/** A fresh auto-save differing from the loaded flow — offer to restore it. */
|
|
9258
|
+
private _restorePrompt;
|
|
9259
|
+
/** localStorage key for this builder's auto-saves — its id, else its heading. */
|
|
9260
|
+
private get _autoSaveKey();
|
|
9261
|
+
private _stopAutoSave;
|
|
9262
|
+
private _restartAutoSave;
|
|
9263
|
+
/** An empty canvas is never saved — it would clobber a stored flow with nothing. */
|
|
9264
|
+
private _autoSaveTick;
|
|
9265
|
+
/** The stored auto-save, purging it when past its TTL (or unreadable). */
|
|
9266
|
+
private _readAutoSave;
|
|
9267
|
+
/** Load the auto-saved flow, if one exists within the 1-day TTL. */
|
|
9268
|
+
restoreAutoSave(): boolean;
|
|
9269
|
+
/**
|
|
9270
|
+
* A flow was just loaded — when a fresh auto-save differs from it, ask the
|
|
9271
|
+
* user whether to pick up their draft instead.
|
|
9272
|
+
*/
|
|
9273
|
+
private _offerRestoreIfNewer;
|
|
9050
9274
|
private _onKeyDown;
|
|
9051
9275
|
protected willUpdate(changed: PropertyValues): void;
|
|
9052
9276
|
protected firstUpdated(changed: PropertyValues): void;
|
|
9053
9277
|
private static _parsePorts;
|
|
9278
|
+
/** Parse an operator / option list: a JSON array (strings or `{value,label}`) or comma-separated values. */
|
|
9279
|
+
private static _parseFilterOptions;
|
|
9280
|
+
/**
|
|
9281
|
+
* Option list declared as child elements — the tidy form. The element's text
|
|
9282
|
+
* is the label; a `value` attribute overrides the stored value:
|
|
9283
|
+
* `<zn-flow-operator value="gte">at least</zn-flow-operator>`.
|
|
9284
|
+
*/
|
|
9285
|
+
private static _nestedFilterOptions;
|
|
9286
|
+
private static _filterFieldFromEl;
|
|
9287
|
+
/**
|
|
9288
|
+
* A step's branch filters: the `branch-filters` JSON attribute, or nested
|
|
9289
|
+
* `<zn-flow-filter>` declarations each holding `<zn-flow-filter-field>`s.
|
|
9290
|
+
*/
|
|
9291
|
+
private static _parseBranchFilters;
|
|
9054
9292
|
private _typeFromStep;
|
|
9055
9293
|
/** Register a FlowNodeType for every slotted <zn-flow-step>. */
|
|
9056
9294
|
private _registerSlottedTypes;
|
|
@@ -9060,6 +9298,12 @@ declare module "components/flow-builder/flow-builder.component" {
|
|
|
9060
9298
|
setState(next: FlowState): void;
|
|
9061
9299
|
get value(): string;
|
|
9062
9300
|
set value(json: string);
|
|
9301
|
+
/**
|
|
9302
|
+
* The full flow state — nodes with their positions, connections, branch
|
|
9303
|
+
* data, and notes — ready for persisting. Lets `JSON.stringify(builder)`
|
|
9304
|
+
* serialize the flow directly, e.g. as a POST body.
|
|
9305
|
+
*/
|
|
9306
|
+
toJSON(): FlowState;
|
|
9063
9307
|
undo: () => void;
|
|
9064
9308
|
redo: () => void;
|
|
9065
9309
|
/**
|
|
@@ -9141,10 +9385,14 @@ declare module "components/flow-builder/flow-builder.component" {
|
|
|
9141
9385
|
private _renderInspector;
|
|
9142
9386
|
/** Replace one of the node's output ports (per-instance override), keeping its id. */
|
|
9143
9387
|
private _updateBranch;
|
|
9388
|
+
/** Persist the built-in conditions editor's draft onto the branch and close it. Undoable. */
|
|
9389
|
+
private _saveBranchConditions;
|
|
9144
9390
|
private _renderBranchEditor;
|
|
9145
9391
|
private _renderRightPanel;
|
|
9146
9392
|
private _renderHeader;
|
|
9147
9393
|
private _renderSidebar;
|
|
9394
|
+
private _renderAutoSaveStatus;
|
|
9395
|
+
private _renderRestorePrompt;
|
|
9148
9396
|
private _renderPicker;
|
|
9149
9397
|
private _pickType;
|
|
9150
9398
|
render(): import("lit-html").TemplateResult<1>;
|
|
@@ -9226,7 +9474,8 @@ declare module "components/flow-builder/modules/flow-step/flow-step.component" {
|
|
|
9226
9474
|
* @event flow-step-drag - Emitted on dragstart with `detail.type`, so the builder can preview the drop.
|
|
9227
9475
|
* @event flow-step-drag-end - Emitted on dragend.
|
|
9228
9476
|
*
|
|
9229
|
-
* @slot - The step's label.
|
|
9477
|
+
* @slot - The step's label. May also hold `<zn-flow-filter>` declarations (never displayed)
|
|
9478
|
+
* that drive the flow builder's built-in branch conditions editor.
|
|
9230
9479
|
*
|
|
9231
9480
|
* @csspart base - The row.
|
|
9232
9481
|
*/
|
|
@@ -9265,6 +9514,386 @@ declare module "components/flow-builder/modules/flow-step/index" {
|
|
|
9265
9514
|
}
|
|
9266
9515
|
}
|
|
9267
9516
|
}
|
|
9517
|
+
declare module "components/page-builder/page.types" {
|
|
9518
|
+
import type { TemplateResult } from 'lit';
|
|
9519
|
+
/** A section placed on a page. */
|
|
9520
|
+
export interface PageSection {
|
|
9521
|
+
id: string;
|
|
9522
|
+
type: string;
|
|
9523
|
+
/** Overrides the type label when set (per-instance rename). */
|
|
9524
|
+
label?: string;
|
|
9525
|
+
/** Section content, keyed by field name (the inspector's `name` attributes). */
|
|
9526
|
+
data: Record<string, unknown>;
|
|
9527
|
+
/** Slot contents for container sections, sized to the type's `slots`. Empty slots are null. */
|
|
9528
|
+
children?: (PageSection | null)[];
|
|
9529
|
+
}
|
|
9530
|
+
/** The complete serialisable state of a page. Order = render order. */
|
|
9531
|
+
export interface PageState {
|
|
9532
|
+
sections: PageSection[];
|
|
9533
|
+
}
|
|
9534
|
+
/**
|
|
9535
|
+
* Describes a kind of section that can be placed on a page. Declared via
|
|
9536
|
+
* `<template type slot="config">` children or registered programmatically —
|
|
9537
|
+
* the palette and inspector are driven entirely by registered types.
|
|
9538
|
+
*/
|
|
9539
|
+
export interface PageSectionType {
|
|
9540
|
+
/** Unique key, persisted on every placed section. */
|
|
9541
|
+
type: string;
|
|
9542
|
+
label: string;
|
|
9543
|
+
/** zn-icon `src`. */
|
|
9544
|
+
icon?: string;
|
|
9545
|
+
iconLibrary?: string;
|
|
9546
|
+
/** Accent colour for the icon tile — any CSS colour. */
|
|
9547
|
+
color?: string;
|
|
9548
|
+
/** Collapsible palette category. */
|
|
9549
|
+
category?: string;
|
|
9550
|
+
description?: string;
|
|
9551
|
+
/** Inspector form markup (from a slotted `<template slot="config">`). */
|
|
9552
|
+
configTemplate?: HTMLTemplateElement;
|
|
9553
|
+
/** Programmatic inspector body — takes precedence over `configTemplate`. */
|
|
9554
|
+
renderConfig?: (section: PageSection, update: (data: Record<string, unknown>) => void) => TemplateResult;
|
|
9555
|
+
/**
|
|
9556
|
+
* Number of child slots this section offers on the canvas (a container tile);
|
|
9557
|
+
* rendered as a 3-column grid. Containers cannot be placed inside other containers.
|
|
9558
|
+
*/
|
|
9559
|
+
slots?: number;
|
|
9560
|
+
/** Section type keys allowed in this container's slots. Omit to allow any non-container type. */
|
|
9561
|
+
accepts?: string[];
|
|
9562
|
+
}
|
|
9563
|
+
/** A container section's slot contents, padded/truncated to the type's slot count. */
|
|
9564
|
+
export function sectionChildren(section: PageSection, type: PageSectionType): (PageSection | null)[];
|
|
9565
|
+
/** Drag-and-drop MIME carrying a section type id from the palette to the canvas. */
|
|
9566
|
+
export const PAGE_TYPE_MIME = "application/x-zn-page-type";
|
|
9567
|
+
/** Drag-and-drop MIME carrying a placed section's id when reordering. */
|
|
9568
|
+
export const PAGE_SECTION_MIME = "application/x-zn-page-section";
|
|
9569
|
+
export function emptyPageState(): PageState;
|
|
9570
|
+
/** Unique-enough id for a new section, stable across edits once assigned. */
|
|
9571
|
+
export function generateSectionId(): string;
|
|
9572
|
+
/** Card summary: the section's first non-empty string value, else the type description. */
|
|
9573
|
+
export function sectionSummary(section: PageSection, type?: PageSectionType): string;
|
|
9574
|
+
}
|
|
9575
|
+
declare module "components/page-builder/page-registry" {
|
|
9576
|
+
import type { PageSectionType } from "components/page-builder/page.types";
|
|
9577
|
+
/**
|
|
9578
|
+
* Holds the set of {@link PageSectionType}s available to a page builder.
|
|
9579
|
+
* Register custom section types here (or via slotted templates) and the
|
|
9580
|
+
* palette and inspector pick them up automatically.
|
|
9581
|
+
*/
|
|
9582
|
+
export class PageSectionRegistry {
|
|
9583
|
+
private types;
|
|
9584
|
+
register(type: PageSectionType): this;
|
|
9585
|
+
registerAll(types: PageSectionType[]): this;
|
|
9586
|
+
get(type: string): PageSectionType | undefined;
|
|
9587
|
+
has(type: string): boolean;
|
|
9588
|
+
all(): PageSectionType[];
|
|
9589
|
+
/** Map of category name -> types, preserving insertion order. Uncategorised under ''. */
|
|
9590
|
+
categories(): Map<string, PageSectionType[]>;
|
|
9591
|
+
clear(): void;
|
|
9592
|
+
}
|
|
9593
|
+
}
|
|
9594
|
+
declare module "components/page-builder/modules/page-palette-item/page-palette-item.component" {
|
|
9595
|
+
import { type CSSResultGroup, type PropertyValues } from 'lit';
|
|
9596
|
+
import ZincElement from "internal/zinc-element";
|
|
9597
|
+
import ZnIcon from "components/icon/index";
|
|
9598
|
+
/**
|
|
9599
|
+
* @summary A draggable palette entry in `<zn-page-builder>`, representing a registered
|
|
9600
|
+
* section type. Drag it onto the canvas to add that section. Unlike zn-page-section-card
|
|
9601
|
+
* (host-wired), this element wires its own drag behaviour so it is draggable standalone.
|
|
9602
|
+
* @documentation https://zinc.style/components/page-palette-item
|
|
9603
|
+
* @status experimental
|
|
9604
|
+
* @since 1.0
|
|
9605
|
+
*
|
|
9606
|
+
* @dependency zn-icon
|
|
9607
|
+
*
|
|
9608
|
+
* @csspart base - The card row.
|
|
9609
|
+
*/
|
|
9610
|
+
export default class ZnPagePaletteItem extends ZincElement {
|
|
9611
|
+
static styles: CSSResultGroup;
|
|
9612
|
+
static dependencies: {
|
|
9613
|
+
'zn-icon': typeof ZnIcon;
|
|
9614
|
+
};
|
|
9615
|
+
/** The section type id this item creates when dropped. */
|
|
9616
|
+
type: string;
|
|
9617
|
+
label: string;
|
|
9618
|
+
description: string;
|
|
9619
|
+
icon: string;
|
|
9620
|
+
iconLibrary: string;
|
|
9621
|
+
color: string;
|
|
9622
|
+
connectedCallback(): void;
|
|
9623
|
+
disconnectedCallback(): void;
|
|
9624
|
+
protected updated(changed: PropertyValues): void;
|
|
9625
|
+
private _onDragStart;
|
|
9626
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
9627
|
+
}
|
|
9628
|
+
}
|
|
9629
|
+
declare module "components/page-builder/modules/page-palette-item/index" {
|
|
9630
|
+
import ZnPagePaletteItem from "components/page-builder/modules/page-palette-item/page-palette-item.component";
|
|
9631
|
+
export * from "components/page-builder/modules/page-palette-item/page-palette-item.component";
|
|
9632
|
+
export default ZnPagePaletteItem;
|
|
9633
|
+
global {
|
|
9634
|
+
interface HTMLElementTagNameMap {
|
|
9635
|
+
'zn-page-palette-item': ZnPagePaletteItem;
|
|
9636
|
+
}
|
|
9637
|
+
}
|
|
9638
|
+
}
|
|
9639
|
+
declare module "components/page-builder/modules/page-section-card/page-section-card.component" {
|
|
9640
|
+
import { type CSSResultGroup, type PropertyValues } from 'lit';
|
|
9641
|
+
import ZincElement from "internal/zinc-element";
|
|
9642
|
+
import ZnButton from "components/button/index";
|
|
9643
|
+
import ZnIcon from "components/icon/index";
|
|
9644
|
+
/**
|
|
9645
|
+
* @summary A section card on the `<zn-page-builder>` canvas: icon tile, label, one-line
|
|
9646
|
+
* summary, and hover actions (duplicate / remove). Purely presentational — the builder
|
|
9647
|
+
* wires up dragging, focus, selection and keyboard handling on the host element.
|
|
9648
|
+
* @documentation https://zinc.style/components/page-section-card
|
|
9649
|
+
* @status experimental
|
|
9650
|
+
* @since 1.0
|
|
9651
|
+
*
|
|
9652
|
+
* @dependency zn-button
|
|
9653
|
+
* @dependency zn-icon
|
|
9654
|
+
*
|
|
9655
|
+
* @event page-card-duplicate - The duplicate action was clicked (internal; not in the typed event map).
|
|
9656
|
+
* @event page-card-remove - The remove action was clicked (internal; not in the typed event map).
|
|
9657
|
+
*
|
|
9658
|
+
* @csspart base - The card row.
|
|
9659
|
+
*/
|
|
9660
|
+
export default class ZnPageSectionCard extends ZincElement {
|
|
9661
|
+
static styles: CSSResultGroup;
|
|
9662
|
+
static dependencies: {
|
|
9663
|
+
'zn-button': typeof ZnButton;
|
|
9664
|
+
'zn-icon': typeof ZnIcon;
|
|
9665
|
+
};
|
|
9666
|
+
label: string;
|
|
9667
|
+
summary: string;
|
|
9668
|
+
icon: string;
|
|
9669
|
+
iconLibrary: string;
|
|
9670
|
+
color: string;
|
|
9671
|
+
selected: boolean;
|
|
9672
|
+
/** Set when the section's type has no registered template — renders greyed. */
|
|
9673
|
+
unknown: boolean;
|
|
9674
|
+
protected updated(changed: PropertyValues): void;
|
|
9675
|
+
private _action;
|
|
9676
|
+
private _actionKeydown;
|
|
9677
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
9678
|
+
}
|
|
9679
|
+
}
|
|
9680
|
+
declare module "components/page-builder/modules/page-section-card/index" {
|
|
9681
|
+
import ZnPageSectionCard from "components/page-builder/modules/page-section-card/page-section-card.component";
|
|
9682
|
+
export * from "components/page-builder/modules/page-section-card/page-section-card.component";
|
|
9683
|
+
export default ZnPageSectionCard;
|
|
9684
|
+
global {
|
|
9685
|
+
interface HTMLElementTagNameMap {
|
|
9686
|
+
'zn-page-section-card': ZnPageSectionCard;
|
|
9687
|
+
}
|
|
9688
|
+
}
|
|
9689
|
+
}
|
|
9690
|
+
declare module "components/page-builder/page-builder.component" {
|
|
9691
|
+
import { type CSSResultGroup, type PropertyValues } from 'lit';
|
|
9692
|
+
import { type PageSection, type PageSectionType, type PageState } from "components/page-builder/page.types";
|
|
9693
|
+
import ZincElement from "internal/zinc-element";
|
|
9694
|
+
import ZnCollapsible from "components/collapsible/index";
|
|
9695
|
+
import ZnIcon from "components/icon/index";
|
|
9696
|
+
import ZnInput from "components/input/index";
|
|
9697
|
+
import ZnPagePaletteItem from "components/page-builder/modules/page-palette-item/index";
|
|
9698
|
+
import ZnPageSectionCard from "components/page-builder/modules/page-section-card/index";
|
|
9699
|
+
/**
|
|
9700
|
+
* @summary A config-driven page composer: a palette of predefined section types, a linear
|
|
9701
|
+
* canvas of section cards, and an inspector for editing each section's content.
|
|
9702
|
+
* @documentation https://zinc.style/components/page-builder
|
|
9703
|
+
* @status experimental
|
|
9704
|
+
* @since 1.0
|
|
9705
|
+
*
|
|
9706
|
+
* @dependency zn-collapsible
|
|
9707
|
+
* @dependency zn-icon
|
|
9708
|
+
* @dependency zn-input
|
|
9709
|
+
* @dependency zn-page-palette-item
|
|
9710
|
+
* @dependency zn-page-section-card
|
|
9711
|
+
*
|
|
9712
|
+
* @event zn-page-change - Emitted whenever the page state changes. `event.detail.state` is the new PageState.
|
|
9713
|
+
* @event zn-page-selection-change - Emitted when the selected section changes. `event.detail.sectionId`.
|
|
9714
|
+
*
|
|
9715
|
+
* @slot config - `<template type="…">` declarations; never displayed. Each template's attributes
|
|
9716
|
+
* (type, label, icon, icon-library, color, category, description, slots, accepts) declare a
|
|
9717
|
+
* palette entry and its content declares the inspector form for that type. `slots` makes the
|
|
9718
|
+
* section a container with that many child slots; `accepts` is a comma-separated list of the
|
|
9719
|
+
* type keys its slots allow.
|
|
9720
|
+
* @slot header-left - Actions shown on the left of the header bar.
|
|
9721
|
+
* @slot header-right - Actions shown on the right of the header bar.
|
|
9722
|
+
*
|
|
9723
|
+
* @csspart base - The grid wrapper.
|
|
9724
|
+
* @csspart header - The full-width header action bar (only rendered when header slots are filled).
|
|
9725
|
+
* @csspart palette - The left palette panel.
|
|
9726
|
+
* @csspart canvas - The centre section-card canvas.
|
|
9727
|
+
* @csspart inspector - The right panel while a section is selected.
|
|
9728
|
+
*/
|
|
9729
|
+
export default class ZnPageBuilder extends ZincElement {
|
|
9730
|
+
static styles: CSSResultGroup;
|
|
9731
|
+
static dependencies: {
|
|
9732
|
+
'zn-collapsible': typeof ZnCollapsible;
|
|
9733
|
+
'zn-icon': typeof ZnIcon;
|
|
9734
|
+
'zn-input': typeof ZnInput;
|
|
9735
|
+
'zn-page-palette-item': typeof ZnPagePaletteItem;
|
|
9736
|
+
'zn-page-section-card': typeof ZnPageSectionCard;
|
|
9737
|
+
};
|
|
9738
|
+
/** The page state as a JSON string. Parsed on set; invalid JSON is ignored with a warning. */
|
|
9739
|
+
config: string;
|
|
9740
|
+
heading: string;
|
|
9741
|
+
subheading: string;
|
|
9742
|
+
/** Section types to make available, registered into the internal registry. */
|
|
9743
|
+
sectionTypes: PageSectionType[];
|
|
9744
|
+
/** Collapses the left palette. Auto-set when the builder becomes narrow. */
|
|
9745
|
+
paletteCollapsed: boolean;
|
|
9746
|
+
/** Collapses the inspector while a section is selected. */
|
|
9747
|
+
inspectorCollapsed: boolean;
|
|
9748
|
+
/**
|
|
9749
|
+
* Auto-save the page to localStorage (1-day TTL). Omit to disable. A bare
|
|
9750
|
+
* `auto-save` saves every 5 minutes; a numeric value sets the interval in
|
|
9751
|
+
* minutes (`auto-save="2"`). Restore with `restoreAutoSave()`.
|
|
9752
|
+
*/
|
|
9753
|
+
autoSave: number | null;
|
|
9754
|
+
private registry;
|
|
9755
|
+
private _state;
|
|
9756
|
+
private _selectedId;
|
|
9757
|
+
private _search;
|
|
9758
|
+
/** Index of the drop zone whose "+" type picker is open, if any. */
|
|
9759
|
+
private _pickerIndex;
|
|
9760
|
+
private _dragOverIndex;
|
|
9761
|
+
/** The container slot a drag is currently over, if any. */
|
|
9762
|
+
private _slotDragOver;
|
|
9763
|
+
/** The container slot whose "+" type picker is open, if any. */
|
|
9764
|
+
private _slotPicker;
|
|
9765
|
+
/** The stamped config form for the selected section; rebuilt on selection change. */
|
|
9766
|
+
private _form;
|
|
9767
|
+
private readonly _hasSlot;
|
|
9768
|
+
private _history;
|
|
9769
|
+
private _redoStack;
|
|
9770
|
+
/** A deep copy of the current page state. */
|
|
9771
|
+
get state(): PageState;
|
|
9772
|
+
/** Replaces the page state wholesale (does not emit zn-page-change). */
|
|
9773
|
+
set state(next: PageState);
|
|
9774
|
+
handleConfigChange(): void;
|
|
9775
|
+
handleSectionTypesChange(): void;
|
|
9776
|
+
registerSectionType(type: PageSectionType): this;
|
|
9777
|
+
registerSectionTypes(types: PageSectionType[]): this;
|
|
9778
|
+
/**
|
|
9779
|
+
* Auto-collapses the palette when the builder crosses into narrow — only on the
|
|
9780
|
+
* crossing, so re-expanding while narrow stays a user choice.
|
|
9781
|
+
*/
|
|
9782
|
+
private _wasNarrow;
|
|
9783
|
+
private _resizeObserver;
|
|
9784
|
+
connectedCallback(): void;
|
|
9785
|
+
disconnectedCallback(): void;
|
|
9786
|
+
private _autoSaveTimer;
|
|
9787
|
+
private _statusTimer;
|
|
9788
|
+
private _justSavedTimer;
|
|
9789
|
+
/** Guards the restore prompt from re-triggering on restoreAutoSave's own state install. */
|
|
9790
|
+
private _restoring;
|
|
9791
|
+
/** Epoch of the newest auto-save (also picked up from storage on start). */
|
|
9792
|
+
private _lastSavedAt;
|
|
9793
|
+
/** Briefly true right after a save — flashes "Auto-saved" in the status pill. */
|
|
9794
|
+
private _justSaved;
|
|
9795
|
+
/** Re-render clock for the "last saved Xm ago" label. */
|
|
9796
|
+
private _statusNow;
|
|
9797
|
+
/** A fresh auto-save differing from the loaded page — offer to restore it. */
|
|
9798
|
+
private _restorePrompt;
|
|
9799
|
+
/** localStorage key for this builder's auto-saves — its id, else its heading. */
|
|
9800
|
+
private get _autoSaveKey();
|
|
9801
|
+
private _stopAutoSave;
|
|
9802
|
+
private _restartAutoSave;
|
|
9803
|
+
/** An empty page is never saved — it would clobber a stored page with nothing. */
|
|
9804
|
+
private _autoSaveTick;
|
|
9805
|
+
/** The stored auto-save, purging it when past its TTL (or unreadable). */
|
|
9806
|
+
private _readAutoSave;
|
|
9807
|
+
/** Load the auto-saved page, if one exists within the 1-day TTL. */
|
|
9808
|
+
restoreAutoSave: () => boolean;
|
|
9809
|
+
/**
|
|
9810
|
+
* A page was just loaded — when a fresh auto-save differs from it, ask the
|
|
9811
|
+
* user whether to pick up their draft instead.
|
|
9812
|
+
*/
|
|
9813
|
+
private _offerRestoreIfNewer;
|
|
9814
|
+
protected willUpdate(changed: PropertyValues): void;
|
|
9815
|
+
private _typeFromTemplate;
|
|
9816
|
+
private _registerSlottedTemplates;
|
|
9817
|
+
/** Normalises and installs an externally provided state; resets selection. */
|
|
9818
|
+
private _applyExternalState;
|
|
9819
|
+
/** Finds a section by id, searching top-level sections and slotted children. */
|
|
9820
|
+
private _findSection;
|
|
9821
|
+
/** New sections array with the section patched wherever it lives (top level or slot). */
|
|
9822
|
+
private _patchSection;
|
|
9823
|
+
/** Detaches a section wherever it lives: removed from the top level, or its slot nulled. */
|
|
9824
|
+
private _extract;
|
|
9825
|
+
/** Installs a new state from a user edit and notifies listeners. */
|
|
9826
|
+
private _commit;
|
|
9827
|
+
private _selectedSection;
|
|
9828
|
+
private _select;
|
|
9829
|
+
private _pushHistory;
|
|
9830
|
+
undo: () => void;
|
|
9831
|
+
redo: () => void;
|
|
9832
|
+
/** Adds a section of a registered type at `index` (default: end). Returns null for unknown types. */
|
|
9833
|
+
addSection(type: string, index?: number): PageSection | null;
|
|
9834
|
+
/** Adds a new section of a registered type into a container's slot. Returns null if not allowed. */
|
|
9835
|
+
addSectionToSlot(type: string, containerId: string, slotIndex: number): PageSection | null;
|
|
9836
|
+
private _removeSection;
|
|
9837
|
+
private _duplicateSection;
|
|
9838
|
+
/** Moves a section (top-level or slotted) to a top-level position. */
|
|
9839
|
+
private _moveSection;
|
|
9840
|
+
/**
|
|
9841
|
+
* Moves a section into a container's slot. Dropping onto an occupied slot swaps
|
|
9842
|
+
* the two children (slot-to-slot reordering); top-level sections and containers
|
|
9843
|
+
* only enter empty slots / never enter slots respectively.
|
|
9844
|
+
*/
|
|
9845
|
+
private _moveToSlot;
|
|
9846
|
+
private _onCardDragStart;
|
|
9847
|
+
/** Whether a drag carries one of the builder's own payloads. */
|
|
9848
|
+
private _isPageDrag;
|
|
9849
|
+
private _onSlotDragOver;
|
|
9850
|
+
private _onSlotDrop;
|
|
9851
|
+
private _onZoneDragOver;
|
|
9852
|
+
private _onZoneDrop;
|
|
9853
|
+
private _onCanvasDragOver;
|
|
9854
|
+
private _onCanvasDrop;
|
|
9855
|
+
private _onCardKeydown;
|
|
9856
|
+
private _renderPalette;
|
|
9857
|
+
private _renderPaletteItem;
|
|
9858
|
+
private _renderAutoSaveStatus;
|
|
9859
|
+
private _renderRestorePrompt;
|
|
9860
|
+
private _renderCanvas;
|
|
9861
|
+
/** The one card template both the page list and slot cells render. */
|
|
9862
|
+
private _renderSectionCard;
|
|
9863
|
+
private _renderCard;
|
|
9864
|
+
private _renderSlot;
|
|
9865
|
+
/** Types allowed in a container's slots: non-containers, filtered by its accepts list. */
|
|
9866
|
+
private _slotTypes;
|
|
9867
|
+
/** The one type-picker template both drop zones and slot cells render. */
|
|
9868
|
+
private _renderTypePicker;
|
|
9869
|
+
private _renderDropZone;
|
|
9870
|
+
/**
|
|
9871
|
+
* Clones the selected type's config template into a live form and prefills each
|
|
9872
|
+
* `[name]` control from the section's data. The element is rendered directly by
|
|
9873
|
+
* Lit (`${this._form}`) so user-entered values survive unrelated re-renders.
|
|
9874
|
+
*/
|
|
9875
|
+
private _buildInspectorForm;
|
|
9876
|
+
private _isBooleanControl;
|
|
9877
|
+
/** Handles change/input events bubbling from stamped form controls. */
|
|
9878
|
+
private _onInspectorInput;
|
|
9879
|
+
private _updateSectionData;
|
|
9880
|
+
private _renameSection;
|
|
9881
|
+
private _renderInspector;
|
|
9882
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
9883
|
+
}
|
|
9884
|
+
}
|
|
9885
|
+
declare module "components/page-builder/index" {
|
|
9886
|
+
import ZnPageBuilder from "components/page-builder/page-builder.component";
|
|
9887
|
+
export * from "components/page-builder/page-builder.component";
|
|
9888
|
+
export * from "components/page-builder/page.types";
|
|
9889
|
+
export * from "components/page-builder/page-registry";
|
|
9890
|
+
export default ZnPageBuilder;
|
|
9891
|
+
global {
|
|
9892
|
+
interface HTMLElementTagNameMap {
|
|
9893
|
+
'zn-page-builder': ZnPageBuilder;
|
|
9894
|
+
}
|
|
9895
|
+
}
|
|
9896
|
+
}
|
|
9268
9897
|
declare module "utilities/form" {
|
|
9269
9898
|
export { clearFormStoreValues } from "internal/form";
|
|
9270
9899
|
}
|
|
@@ -9410,6 +10039,27 @@ declare module "events/zn-flow-connect" {
|
|
|
9410
10039
|
}
|
|
9411
10040
|
}
|
|
9412
10041
|
}
|
|
10042
|
+
declare module "events/zn-page-change" {
|
|
10043
|
+
import type { PageState } from "components/page-builder/page.types";
|
|
10044
|
+
export type ZnPageChangeEvent = CustomEvent<{
|
|
10045
|
+
state: PageState;
|
|
10046
|
+
}>;
|
|
10047
|
+
global {
|
|
10048
|
+
interface GlobalEventHandlersEventMap {
|
|
10049
|
+
'zn-page-change': ZnPageChangeEvent;
|
|
10050
|
+
}
|
|
10051
|
+
}
|
|
10052
|
+
}
|
|
10053
|
+
declare module "events/zn-page-selection-change" {
|
|
10054
|
+
export type ZnPageSelectionChangeEvent = CustomEvent<{
|
|
10055
|
+
sectionId: string | null;
|
|
10056
|
+
}>;
|
|
10057
|
+
global {
|
|
10058
|
+
interface GlobalEventHandlersEventMap {
|
|
10059
|
+
'zn-page-selection-change': ZnPageSelectionChangeEvent;
|
|
10060
|
+
}
|
|
10061
|
+
}
|
|
10062
|
+
}
|
|
9413
10063
|
declare module "events/events" {
|
|
9414
10064
|
export type { ZnAfterHideEvent } from "events/zn-after-hide";
|
|
9415
10065
|
export type { ZnAfterShowEvent } from "events/zn-after-show";
|
|
@@ -9428,6 +10078,8 @@ declare module "events/events" {
|
|
|
9428
10078
|
export type { ZnFlowChangeEvent } from "events/zn-flow-change";
|
|
9429
10079
|
export type { ZnFlowSelectionChangeEvent } from "events/zn-flow-selection-change";
|
|
9430
10080
|
export type { ZnFlowConnectEvent } from "events/zn-flow-connect";
|
|
10081
|
+
export type { ZnPageChangeEvent } from "events/zn-page-change";
|
|
10082
|
+
export type { ZnPageSelectionChangeEvent } from "events/zn-page-selection-change";
|
|
9431
10083
|
}
|
|
9432
10084
|
declare module "zinc" {
|
|
9433
10085
|
export { default as Button } from "components/button/index";
|
|
@@ -9535,6 +10187,10 @@ declare module "zinc" {
|
|
|
9535
10187
|
export { default as FlowSteps } from "components/flow-builder/modules/flow-steps/index";
|
|
9536
10188
|
export { default as FlowStepGroup } from "components/flow-builder/modules/flow-step-group/index";
|
|
9537
10189
|
export { default as FlowStep } from "components/flow-builder/modules/flow-step/index";
|
|
10190
|
+
export { default as FlowBranchConditions } from "components/flow-builder/modules/flow-branch-conditions/index";
|
|
10191
|
+
export { default as PageBuilder } from "components/page-builder/index";
|
|
10192
|
+
export { default as PagePaletteItem } from "components/page-builder/modules/page-palette-item/index";
|
|
10193
|
+
export { default as PageSectionCard } from "components/page-builder/modules/page-section-card/index";
|
|
9538
10194
|
export { default as ZincElement } from "internal/zinc-element";
|
|
9539
10195
|
export * from "utilities/on";
|
|
9540
10196
|
export * from "utilities/query";
|