@squeed/flow-sdk 2.0.2 → 2.0.4

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/dist/index.d.cts CHANGED
@@ -10,6 +10,7 @@ import { MutableRefObject } from 'react';
10
10
  import { ReactNode } from 'react';
11
11
  import { ReactPortal } from 'react';
12
12
  import { RefAttributes } from 'react';
13
+ import { RefObject } from 'react';
13
14
  import { StyledComponent } from '@emotion/styled';
14
15
  import { Theme } from '@emotion/react';
15
16
 
@@ -138,6 +139,7 @@ export declare const contentObjTheme: (color: any) => {
138
139
 
139
140
  declare interface ContractPort {
140
141
  kind: "input" | "config" | "output" | "error";
142
+ label?: string;
141
143
  resourceType?: string;
142
144
  multiple?: boolean;
143
145
  }
@@ -537,7 +539,7 @@ export declare interface FlowDiagramNode {
537
539
  export declare interface FlowDiagramProps {
538
540
  /** Show the loader while the host fetches data; initial compilation waits until false. */
539
541
  loading?: boolean;
540
- /** Custom loading content. Defaults to an accessible status message. Also shown while new JSON is prepared. */
542
+ /** Custom loading content while fetching or preparing JSON. Set null to hide the overlay; aria-busy and the interaction lock remain active. */
541
543
  loader?: React.ReactNode;
542
544
  /** Title shown on the root node */
543
545
  title?: string;
@@ -634,10 +636,11 @@ export declare interface FlowNodeCreationRequest {
634
636
  };
635
637
  }
636
638
 
637
- export declare function FlowPort({ id, role, side, position, placement, children, style, }: FlowPortProps): JSX_2.Element;
639
+ export declare function FlowPort({ id, label, role, side, position, placement, children, style, }: FlowPortProps): JSX_2.Element;
638
640
 
639
641
  export declare interface FlowPortProps {
640
642
  id: string;
643
+ label?: string;
641
644
  role: "source" | "target";
642
645
  side?: PortSide;
643
646
  position?: number;
@@ -753,6 +756,26 @@ export declare const getColorVariant: (color: string) => {
753
756
 
754
757
  export declare function getDarkerHexColor(hex: string, factor?: number): string;
755
758
 
759
+ /** Flat chrome surface: the border and halo only appear while hovered. Colors are CSS values. */
760
+ export declare function getInteractionSurface(surface: string, border: string): {
761
+ "--flow-start-shadow": string;
762
+ "@media (hover: hover)": {
763
+ "&:hover": {
764
+ borderColor: string;
765
+ "@media (prefers-reduced-motion: no-preference)": {
766
+ animation: string;
767
+ };
768
+ boxShadow: string;
769
+ };
770
+ };
771
+ "--flow-rest-shadow": string;
772
+ "--flow-hover-shadow": string;
773
+ borderWidth: string;
774
+ borderStyle: string;
775
+ borderColor: string;
776
+ boxShadow: string;
777
+ };
778
+
756
779
  export declare function getNode(json: SqueedJson, address: string): any;
757
780
 
758
781
  export declare interface JsonPlaybackState {
@@ -1179,6 +1202,18 @@ export declare function useCustomColors(theme?: any): {
1179
1202
  greenColor: string;
1180
1203
  };
1181
1204
 
1205
+ /**
1206
+ * True while the pointer is within `threshold` px of one edge of `bounds`, or over any `inside`
1207
+ * element. Used to reveal hidden edge toolbars; inactive when disabled or the pointer leaves the page.
1208
+ */
1209
+ export declare function useEdgeProximity({ edge, enabled, bounds, inside, threshold, }: {
1210
+ edge: "top" | "bottom";
1211
+ enabled: boolean;
1212
+ bounds: RefObject<HTMLElement | null>;
1213
+ inside?: RefObject<HTMLElement | null>[];
1214
+ threshold?: number;
1215
+ }): boolean;
1216
+
1182
1217
  export declare function useFlowData(): {
1183
1218
  nodeById: Map<string, FlowDiagramNode>;
1184
1219
  edgeById: Map<string, FlowDiagramEdge>;
package/dist/index.d.ts CHANGED
@@ -10,6 +10,7 @@ import { MutableRefObject } from 'react';
10
10
  import { ReactNode } from 'react';
11
11
  import { ReactPortal } from 'react';
12
12
  import { RefAttributes } from 'react';
13
+ import { RefObject } from 'react';
13
14
  import { StyledComponent } from '@emotion/styled';
14
15
  import { Theme } from '@emotion/react';
15
16
 
@@ -138,6 +139,7 @@ export declare const contentObjTheme: (color: any) => {
138
139
 
139
140
  declare interface ContractPort {
140
141
  kind: "input" | "config" | "output" | "error";
142
+ label?: string;
141
143
  resourceType?: string;
142
144
  multiple?: boolean;
143
145
  }
@@ -537,7 +539,7 @@ export declare interface FlowDiagramNode {
537
539
  export declare interface FlowDiagramProps {
538
540
  /** Show the loader while the host fetches data; initial compilation waits until false. */
539
541
  loading?: boolean;
540
- /** Custom loading content. Defaults to an accessible status message. Also shown while new JSON is prepared. */
542
+ /** Custom loading content while fetching or preparing JSON. Set null to hide the overlay; aria-busy and the interaction lock remain active. */
541
543
  loader?: React.ReactNode;
542
544
  /** Title shown on the root node */
543
545
  title?: string;
@@ -634,10 +636,11 @@ export declare interface FlowNodeCreationRequest {
634
636
  };
635
637
  }
636
638
 
637
- export declare function FlowPort({ id, role, side, position, placement, children, style, }: FlowPortProps): JSX_2.Element;
639
+ export declare function FlowPort({ id, label, role, side, position, placement, children, style, }: FlowPortProps): JSX_2.Element;
638
640
 
639
641
  export declare interface FlowPortProps {
640
642
  id: string;
643
+ label?: string;
641
644
  role: "source" | "target";
642
645
  side?: PortSide;
643
646
  position?: number;
@@ -753,6 +756,26 @@ export declare const getColorVariant: (color: string) => {
753
756
 
754
757
  export declare function getDarkerHexColor(hex: string, factor?: number): string;
755
758
 
759
+ /** Flat chrome surface: the border and halo only appear while hovered. Colors are CSS values. */
760
+ export declare function getInteractionSurface(surface: string, border: string): {
761
+ "--flow-start-shadow": string;
762
+ "@media (hover: hover)": {
763
+ "&:hover": {
764
+ borderColor: string;
765
+ "@media (prefers-reduced-motion: no-preference)": {
766
+ animation: string;
767
+ };
768
+ boxShadow: string;
769
+ };
770
+ };
771
+ "--flow-rest-shadow": string;
772
+ "--flow-hover-shadow": string;
773
+ borderWidth: string;
774
+ borderStyle: string;
775
+ borderColor: string;
776
+ boxShadow: string;
777
+ };
778
+
756
779
  export declare function getNode(json: SqueedJson, address: string): any;
757
780
 
758
781
  export declare interface JsonPlaybackState {
@@ -1179,6 +1202,18 @@ export declare function useCustomColors(theme?: any): {
1179
1202
  greenColor: string;
1180
1203
  };
1181
1204
 
1205
+ /**
1206
+ * True while the pointer is within `threshold` px of one edge of `bounds`, or over any `inside`
1207
+ * element. Used to reveal hidden edge toolbars; inactive when disabled or the pointer leaves the page.
1208
+ */
1209
+ export declare function useEdgeProximity({ edge, enabled, bounds, inside, threshold, }: {
1210
+ edge: "top" | "bottom";
1211
+ enabled: boolean;
1212
+ bounds: RefObject<HTMLElement | null>;
1213
+ inside?: RefObject<HTMLElement | null>[];
1214
+ threshold?: number;
1215
+ }): boolean;
1216
+
1182
1217
  export declare function useFlowData(): {
1183
1218
  nodeById: Map<string, FlowDiagramNode>;
1184
1219
  edgeById: Map<string, FlowDiagramEdge>;