markdown-flow-ui 0.2.22-dev.1 → 0.2.23
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/_virtual/index.es8.js +2 -2
- package/dist/_virtual/index.es9.js +2 -2
- package/dist/_virtual/index8.cjs +1 -1
- package/dist/_virtual/index9.cjs +1 -1
- package/dist/assets/markdown-flow-ui.css +1 -1
- package/dist/components/Slide/Slide.cjs +1 -1
- package/dist/components/Slide/Slide.cjs.map +1 -1
- package/dist/components/Slide/Slide.es.js +603 -598
- package/dist/components/Slide/Slide.es.js.map +1 -1
- package/dist/components/Slide/SubtitleOverlay.cjs +1 -1
- package/dist/components/Slide/SubtitleOverlay.cjs.map +1 -1
- package/dist/components/Slide/SubtitleOverlay.d.ts +1 -2
- package/dist/components/Slide/SubtitleOverlay.es.js +18 -20
- package/dist/components/Slide/SubtitleOverlay.es.js.map +1 -1
- package/dist/components/Slide/utils/playerVisibility.cjs +1 -1
- package/dist/components/Slide/utils/playerVisibility.cjs.map +1 -1
- package/dist/components/Slide/utils/playerVisibility.d.ts +10 -0
- package/dist/components/Slide/utils/playerVisibility.es.js +14 -6
- package/dist/components/Slide/utils/playerVisibility.es.js.map +1 -1
- package/dist/node_modules/@braintree/sanitize-url/dist/index.cjs +1 -1
- package/dist/node_modules/@braintree/sanitize-url/dist/index.es.js +1 -1
- package/dist/node_modules/classnames/index.cjs +1 -1
- package/dist/node_modules/classnames/index.es.js +1 -1
- package/dist/node_modules/cose-base/cose-base.cjs +1 -1
- package/dist/node_modules/cose-base/cose-base.cjs.map +1 -1
- package/dist/node_modules/cose-base/cose-base.es.js +1 -1
- package/dist/node_modules/cytoscape-fcose/node_modules/cose-base/cose-base.cjs +1 -1
- package/dist/node_modules/cytoscape-fcose/node_modules/cose-base/cose-base.cjs.map +1 -1
- package/dist/node_modules/cytoscape-fcose/node_modules/cose-base/cose-base.es.js +1 -1
- package/dist/node_modules/cytoscape-fcose/node_modules/layout-base/layout-base.cjs +1 -1
- package/dist/node_modules/cytoscape-fcose/node_modules/layout-base/layout-base.cjs.map +1 -1
- package/dist/node_modules/cytoscape-fcose/node_modules/layout-base/layout-base.es.js +1 -1
- package/dist/node_modules/layout-base/layout-base.cjs +1 -1
- package/dist/node_modules/layout-base/layout-base.cjs.map +1 -1
- package/dist/node_modules/layout-base/layout-base.es.js +1 -1
- package/package.json +1 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const l=require("react/jsx-runtime"),s=require("react"),
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const l=require("react/jsx-runtime"),s=require("react"),y=require("../../lib/utils.cjs"),f=require("./utils/subtitleCue.cjs"),S=require("./utils/playbackTimeStore.cjs");;/* empty css */const x=({className:c,extraBottomOffset:n=0,hasPlayerGap:b=!1,isEnabled:e=!0,onVisibilityChange:i,playbackTimeStore:m,style:d,subtitleCues:r=[],...v})=>{const u=S.usePlaybackTimeStore(m),t=s.useMemo(()=>f.getVisibleSubtitleText(r,u),[u,r]),a=!!t;return s.useEffect(()=>{i?.(e&&a)},[a,e,i]),!e||!t?null:l.jsx("div",{"aria-live":"off",className:y.cn("slide-subtitle-overlay",b&&"slide-subtitle-overlay--with-player-gap",c),style:{...d,"--slide-subtitle-extra-offset":`${Math.max(n,0)}px`},...v,children:l.jsx("div",{className:"slide-subtitle-overlay__surface",children:l.jsx("p",{className:"slide-subtitle-overlay__text",children:t})})})},o=s.memo(x);o.displayName="SubtitleOverlay";exports.default=o;
|
|
2
2
|
//# sourceMappingURL=SubtitleOverlay.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SubtitleOverlay.cjs","sources":["../../../src/components/Slide/SubtitleOverlay.tsx"],"sourcesContent":["import React, { memo, useEffect, useMemo } from \"react\";\n\nimport { cn } from \"../../lib/utils\";\nimport { getVisibleSubtitleText } from \"./utils/subtitleCue\";\nimport { usePlaybackTimeStore } from \"./utils/playbackTimeStore\";\nimport type { PlaybackTimeStore } from \"./utils/playbackTimeStore\";\nimport type { ElementSubtitleCue } from \"./types\";\nimport \"./subtitle-overlay.css\";\n\nexport interface SubtitleOverlayProps\n extends Omit<React.ComponentProps<\"div\">, \"children\"> {\n extraBottomOffset?: number;\n hasPlayerGap?: boolean;\n isEnabled?: boolean;\n
|
|
1
|
+
{"version":3,"file":"SubtitleOverlay.cjs","sources":["../../../src/components/Slide/SubtitleOverlay.tsx"],"sourcesContent":["import React, { memo, useEffect, useMemo } from \"react\";\n\nimport { cn } from \"../../lib/utils\";\nimport { getVisibleSubtitleText } from \"./utils/subtitleCue\";\nimport { usePlaybackTimeStore } from \"./utils/playbackTimeStore\";\nimport type { PlaybackTimeStore } from \"./utils/playbackTimeStore\";\nimport type { ElementSubtitleCue } from \"./types\";\nimport \"./subtitle-overlay.css\";\n\nexport interface SubtitleOverlayProps\n extends Omit<React.ComponentProps<\"div\">, \"children\"> {\n extraBottomOffset?: number;\n hasPlayerGap?: boolean;\n isEnabled?: boolean;\n onVisibilityChange?: (visible: boolean) => void;\n playbackTimeStore: PlaybackTimeStore;\n subtitleCues?: ElementSubtitleCue[];\n}\n\nconst SubtitleOverlay = ({\n className,\n extraBottomOffset = 0,\n hasPlayerGap = false,\n isEnabled = true,\n onVisibilityChange,\n playbackTimeStore,\n style,\n subtitleCues = [],\n ...props\n}: SubtitleOverlayProps) => {\n const currentTimeMs = usePlaybackTimeStore(playbackTimeStore);\n const visibleSubtitleText = useMemo(\n () => getVisibleSubtitleText(subtitleCues, currentTimeMs),\n [currentTimeMs, subtitleCues]\n );\n const hasVisibleSubtitle = Boolean(visibleSubtitleText);\n\n useEffect(() => {\n onVisibilityChange?.(isEnabled && hasVisibleSubtitle);\n }, [hasVisibleSubtitle, isEnabled, onVisibilityChange]);\n\n if (!isEnabled || !visibleSubtitleText) {\n return null;\n }\n\n return (\n <div\n aria-live=\"off\"\n className={cn(\n \"slide-subtitle-overlay\",\n hasPlayerGap && \"slide-subtitle-overlay--with-player-gap\",\n className\n )}\n style={\n {\n ...style,\n \"--slide-subtitle-extra-offset\": `${Math.max(extraBottomOffset, 0)}px`,\n } as React.CSSProperties\n }\n {...props}\n >\n <div className=\"slide-subtitle-overlay__surface\">\n <p className=\"slide-subtitle-overlay__text\">{visibleSubtitleText}</p>\n </div>\n </div>\n );\n};\n\nconst MemoizedSubtitleOverlay = memo(SubtitleOverlay);\n\nMemoizedSubtitleOverlay.displayName = \"SubtitleOverlay\";\n\nexport default MemoizedSubtitleOverlay;\n"],"names":["SubtitleOverlay","className","extraBottomOffset","hasPlayerGap","isEnabled","onVisibilityChange","playbackTimeStore","style","subtitleCues","props","currentTimeMs","usePlaybackTimeStore","visibleSubtitleText","useMemo","getVisibleSubtitleText","hasVisibleSubtitle","useEffect","jsx","cn","MemoizedSubtitleOverlay","memo"],"mappings":"2TAmBA,MAAMA,EAAkB,CAAC,CACvB,UAAAC,EACA,kBAAAC,EAAoB,EACpB,aAAAC,EAAe,GACf,UAAAC,EAAY,GACZ,mBAAAC,EAAA,kBACAC,EACA,MAAAC,EACA,aAAAC,EAAe,CAAA,EACf,GAAGC,CACL,IAA4B,CAC1B,MAAMC,EAAgBC,EAAAA,qBAAqBL,CAAiB,EACtDM,EAAsBC,EAAAA,QAC1B,IAAMC,EAAAA,uBAAuBN,EAAcE,CAAa,EACxD,CAACA,EAAeF,CAAY,CAAA,EAExBO,EAAqB,EAAQH,EAMnC,OAJAI,EAAAA,UAAU,IAAM,CACdX,IAAqBD,GAAaW,CAAkB,CACtD,EAAG,CAACA,EAAoBX,EAAWC,CAAkB,CAAC,EAElD,CAACD,GAAa,CAACQ,EACV,KAIPK,EAAAA,IAAC,MAAA,CACC,YAAU,MACV,UAAWC,EAAAA,GACT,yBACAf,GAAgB,0CAChBF,CAAA,EAEF,MACE,CACE,GAAGM,EACH,gCAAiC,GAAG,KAAK,IAAIL,EAAmB,CAAC,CAAC,IAAA,EAGrE,GAAGO,EAEJ,SAAAQ,EAAAA,IAAC,OAAI,UAAU,kCACb,eAAC,IAAA,CAAE,UAAU,+BAAgC,SAAAL,CAAA,CAAoB,CAAA,CACnE,CAAA,CAAA,CAGN,EAEMO,EAA0BC,EAAAA,KAAKpB,CAAe,EAEpDmB,EAAwB,YAAc"}
|
|
@@ -5,10 +5,9 @@ export interface SubtitleOverlayProps extends Omit<React.ComponentProps<"div">,
|
|
|
5
5
|
extraBottomOffset?: number;
|
|
6
6
|
hasPlayerGap?: boolean;
|
|
7
7
|
isEnabled?: boolean;
|
|
8
|
-
isPlayerHidden?: boolean;
|
|
9
8
|
onVisibilityChange?: (visible: boolean) => void;
|
|
10
9
|
playbackTimeStore: PlaybackTimeStore;
|
|
11
10
|
subtitleCues?: ElementSubtitleCue[];
|
|
12
11
|
}
|
|
13
|
-
declare const MemoizedSubtitleOverlay: React.MemoExoticComponent<({ className, extraBottomOffset, hasPlayerGap, isEnabled,
|
|
12
|
+
declare const MemoizedSubtitleOverlay: React.MemoExoticComponent<({ className, extraBottomOffset, hasPlayerGap, isEnabled, onVisibilityChange, playbackTimeStore, style, subtitleCues, ...props }: SubtitleOverlayProps) => React.JSX.Element | null>;
|
|
14
13
|
export default MemoizedSubtitleOverlay;
|
|
@@ -1,48 +1,46 @@
|
|
|
1
1
|
import { jsx as l } from "react/jsx-runtime";
|
|
2
|
-
import { memo as b, useMemo as
|
|
2
|
+
import { memo as b, useMemo as d, useEffect as v } from "react";
|
|
3
3
|
import { cn as n } from "../../lib/utils.es.js";
|
|
4
|
-
import { getVisibleSubtitleText as
|
|
5
|
-
import { usePlaybackTimeStore as
|
|
4
|
+
import { getVisibleSubtitleText as y } from "./utils/subtitleCue.es.js";
|
|
5
|
+
import { usePlaybackTimeStore as x } from "./utils/playbackTimeStore.es.js";
|
|
6
6
|
/* empty css */
|
|
7
|
-
const
|
|
8
|
-
className:
|
|
7
|
+
const S = ({
|
|
8
|
+
className: a,
|
|
9
9
|
extraBottomOffset: m = 0,
|
|
10
10
|
hasPlayerGap: u = !1,
|
|
11
11
|
isEnabled: e = !0,
|
|
12
|
-
isPlayerHidden: c = !1,
|
|
13
12
|
onVisibilityChange: i,
|
|
14
|
-
playbackTimeStore:
|
|
15
|
-
style:
|
|
13
|
+
playbackTimeStore: c,
|
|
14
|
+
style: f,
|
|
16
15
|
subtitleCues: r = [],
|
|
17
16
|
...p
|
|
18
17
|
}) => {
|
|
19
|
-
const s =
|
|
20
|
-
() =>
|
|
18
|
+
const s = x(c), t = d(
|
|
19
|
+
() => y(r, s),
|
|
21
20
|
[s, r]
|
|
22
|
-
),
|
|
23
|
-
return
|
|
24
|
-
i?.(e &&
|
|
25
|
-
}, [
|
|
21
|
+
), o = !!t;
|
|
22
|
+
return v(() => {
|
|
23
|
+
i?.(e && o);
|
|
24
|
+
}, [o, e, i]), !e || !t ? null : /* @__PURE__ */ l(
|
|
26
25
|
"div",
|
|
27
26
|
{
|
|
28
27
|
"aria-live": "off",
|
|
29
28
|
className: n(
|
|
30
29
|
"slide-subtitle-overlay",
|
|
31
30
|
u && "slide-subtitle-overlay--with-player-gap",
|
|
32
|
-
|
|
33
|
-
o
|
|
31
|
+
a
|
|
34
32
|
),
|
|
35
33
|
style: {
|
|
36
|
-
...
|
|
34
|
+
...f,
|
|
37
35
|
"--slide-subtitle-extra-offset": `${Math.max(m, 0)}px`
|
|
38
36
|
},
|
|
39
37
|
...p,
|
|
40
38
|
children: /* @__PURE__ */ l("div", { className: "slide-subtitle-overlay__surface", children: /* @__PURE__ */ l("p", { className: "slide-subtitle-overlay__text", children: t }) })
|
|
41
39
|
}
|
|
42
40
|
);
|
|
43
|
-
},
|
|
44
|
-
|
|
41
|
+
}, h = b(S);
|
|
42
|
+
h.displayName = "SubtitleOverlay";
|
|
45
43
|
export {
|
|
46
|
-
|
|
44
|
+
h as default
|
|
47
45
|
};
|
|
48
46
|
//# sourceMappingURL=SubtitleOverlay.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SubtitleOverlay.es.js","sources":["../../../src/components/Slide/SubtitleOverlay.tsx"],"sourcesContent":["import React, { memo, useEffect, useMemo } from \"react\";\n\nimport { cn } from \"../../lib/utils\";\nimport { getVisibleSubtitleText } from \"./utils/subtitleCue\";\nimport { usePlaybackTimeStore } from \"./utils/playbackTimeStore\";\nimport type { PlaybackTimeStore } from \"./utils/playbackTimeStore\";\nimport type { ElementSubtitleCue } from \"./types\";\nimport \"./subtitle-overlay.css\";\n\nexport interface SubtitleOverlayProps\n extends Omit<React.ComponentProps<\"div\">, \"children\"> {\n extraBottomOffset?: number;\n hasPlayerGap?: boolean;\n isEnabled?: boolean;\n
|
|
1
|
+
{"version":3,"file":"SubtitleOverlay.es.js","sources":["../../../src/components/Slide/SubtitleOverlay.tsx"],"sourcesContent":["import React, { memo, useEffect, useMemo } from \"react\";\n\nimport { cn } from \"../../lib/utils\";\nimport { getVisibleSubtitleText } from \"./utils/subtitleCue\";\nimport { usePlaybackTimeStore } from \"./utils/playbackTimeStore\";\nimport type { PlaybackTimeStore } from \"./utils/playbackTimeStore\";\nimport type { ElementSubtitleCue } from \"./types\";\nimport \"./subtitle-overlay.css\";\n\nexport interface SubtitleOverlayProps\n extends Omit<React.ComponentProps<\"div\">, \"children\"> {\n extraBottomOffset?: number;\n hasPlayerGap?: boolean;\n isEnabled?: boolean;\n onVisibilityChange?: (visible: boolean) => void;\n playbackTimeStore: PlaybackTimeStore;\n subtitleCues?: ElementSubtitleCue[];\n}\n\nconst SubtitleOverlay = ({\n className,\n extraBottomOffset = 0,\n hasPlayerGap = false,\n isEnabled = true,\n onVisibilityChange,\n playbackTimeStore,\n style,\n subtitleCues = [],\n ...props\n}: SubtitleOverlayProps) => {\n const currentTimeMs = usePlaybackTimeStore(playbackTimeStore);\n const visibleSubtitleText = useMemo(\n () => getVisibleSubtitleText(subtitleCues, currentTimeMs),\n [currentTimeMs, subtitleCues]\n );\n const hasVisibleSubtitle = Boolean(visibleSubtitleText);\n\n useEffect(() => {\n onVisibilityChange?.(isEnabled && hasVisibleSubtitle);\n }, [hasVisibleSubtitle, isEnabled, onVisibilityChange]);\n\n if (!isEnabled || !visibleSubtitleText) {\n return null;\n }\n\n return (\n <div\n aria-live=\"off\"\n className={cn(\n \"slide-subtitle-overlay\",\n hasPlayerGap && \"slide-subtitle-overlay--with-player-gap\",\n className\n )}\n style={\n {\n ...style,\n \"--slide-subtitle-extra-offset\": `${Math.max(extraBottomOffset, 0)}px`,\n } as React.CSSProperties\n }\n {...props}\n >\n <div className=\"slide-subtitle-overlay__surface\">\n <p className=\"slide-subtitle-overlay__text\">{visibleSubtitleText}</p>\n </div>\n </div>\n );\n};\n\nconst MemoizedSubtitleOverlay = memo(SubtitleOverlay);\n\nMemoizedSubtitleOverlay.displayName = \"SubtitleOverlay\";\n\nexport default MemoizedSubtitleOverlay;\n"],"names":["SubtitleOverlay","className","extraBottomOffset","hasPlayerGap","isEnabled","onVisibilityChange","playbackTimeStore","style","subtitleCues","props","currentTimeMs","usePlaybackTimeStore","visibleSubtitleText","useMemo","getVisibleSubtitleText","hasVisibleSubtitle","useEffect","jsx","cn","MemoizedSubtitleOverlay","memo"],"mappings":";;;;;;AAmBA,MAAMA,IAAkB,CAAC;AAAA,EACvB,WAAAC;AAAA,EACA,mBAAAC,IAAoB;AAAA,EACpB,cAAAC,IAAe;AAAA,EACf,WAAAC,IAAY;AAAA,EACZ,oBAAAC;AAAA,EACA,mBAAAC;AAAA,EACA,OAAAC;AAAA,EACA,cAAAC,IAAe,CAAA;AAAA,EACf,GAAGC;AACL,MAA4B;AAC1B,QAAMC,IAAgBC,EAAqBL,CAAiB,GACtDM,IAAsBC;AAAA,IAC1B,MAAMC,EAAuBN,GAAcE,CAAa;AAAA,IACxD,CAACA,GAAeF,CAAY;AAAA,EAAA,GAExBO,IAAqB,EAAQH;AAMnC,SAJAI,EAAU,MAAM;AACd,IAAAX,IAAqBD,KAAaW,CAAkB;AAAA,EACtD,GAAG,CAACA,GAAoBX,GAAWC,CAAkB,CAAC,GAElD,CAACD,KAAa,CAACQ,IACV,OAIP,gBAAAK;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,aAAU;AAAA,MACV,WAAWC;AAAA,QACT;AAAA,QACAf,KAAgB;AAAA,QAChBF;AAAA,MAAA;AAAA,MAEF,OACE;AAAA,QACE,GAAGM;AAAA,QACH,iCAAiC,GAAG,KAAK,IAAIL,GAAmB,CAAC,CAAC;AAAA,MAAA;AAAA,MAGrE,GAAGO;AAAA,MAEJ,UAAA,gBAAAQ,EAAC,SAAI,WAAU,mCACb,4BAAC,KAAA,EAAE,WAAU,gCAAgC,UAAAL,EAAA,CAAoB,EAAA,CACnE;AAAA,IAAA;AAAA,EAAA;AAGN,GAEMO,IAA0BC,EAAKpB,CAAe;AAEpDmB,EAAwB,cAAc;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=({playerEnabled:l,playerControlsVisibility:e})=>({playerEnabled:l??!0,playerControlsVisibility:e??"auto"}),r=({isAutoVisible:l,playerControlsVisibility:e,shouldMountPlayer:i})=>({controlsVisible:i&&e!=="hidden"&&(e==="visible"||l),layoutReserved:i});exports.resolveSlidePlayerLayoutState=r;exports.resolveSlidePlayerVisibility=t;
|
|
2
2
|
//# sourceMappingURL=playerVisibility.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"playerVisibility.cjs","sources":["../../../../src/components/Slide/utils/playerVisibility.ts"],"sourcesContent":["export type SlidePlayerControlsVisibility = \"auto\" | \"visible\" | \"hidden\";\n\nexport interface ResolveSlidePlayerVisibilityOptions {\n playerEnabled?: boolean;\n playerControlsVisibility?: SlidePlayerControlsVisibility;\n}\n\nexport interface ResolvedSlidePlayerVisibility {\n playerEnabled: boolean;\n playerControlsVisibility: SlidePlayerControlsVisibility;\n}\n\nexport const resolveSlidePlayerVisibility = ({\n playerEnabled,\n playerControlsVisibility,\n}: ResolveSlidePlayerVisibilityOptions): ResolvedSlidePlayerVisibility => ({\n playerEnabled: playerEnabled ?? true,\n playerControlsVisibility: playerControlsVisibility ?? \"auto\",\n});\n"],"names":["resolveSlidePlayerVisibility","playerEnabled","playerControlsVisibility"],"mappings":"
|
|
1
|
+
{"version":3,"file":"playerVisibility.cjs","sources":["../../../../src/components/Slide/utils/playerVisibility.ts"],"sourcesContent":["export type SlidePlayerControlsVisibility = \"auto\" | \"visible\" | \"hidden\";\n\nexport interface ResolveSlidePlayerVisibilityOptions {\n playerEnabled?: boolean;\n playerControlsVisibility?: SlidePlayerControlsVisibility;\n}\n\nexport interface ResolvedSlidePlayerVisibility {\n playerEnabled: boolean;\n playerControlsVisibility: SlidePlayerControlsVisibility;\n}\n\nexport interface ResolveSlidePlayerLayoutStateOptions {\n isAutoVisible: boolean;\n playerControlsVisibility: SlidePlayerControlsVisibility;\n shouldMountPlayer: boolean;\n}\n\nexport interface ResolvedSlidePlayerLayoutState {\n controlsVisible: boolean;\n layoutReserved: boolean;\n}\n\nexport const resolveSlidePlayerVisibility = ({\n playerEnabled,\n playerControlsVisibility,\n}: ResolveSlidePlayerVisibilityOptions): ResolvedSlidePlayerVisibility => ({\n playerEnabled: playerEnabled ?? true,\n playerControlsVisibility: playerControlsVisibility ?? \"auto\",\n});\n\nexport const resolveSlidePlayerLayoutState = ({\n isAutoVisible,\n playerControlsVisibility,\n shouldMountPlayer,\n}: ResolveSlidePlayerLayoutStateOptions): ResolvedSlidePlayerLayoutState => ({\n controlsVisible:\n shouldMountPlayer &&\n playerControlsVisibility !== \"hidden\" &&\n (playerControlsVisibility === \"visible\" || isAutoVisible),\n layoutReserved: shouldMountPlayer,\n});\n"],"names":["resolveSlidePlayerVisibility","playerEnabled","playerControlsVisibility","resolveSlidePlayerLayoutState","isAutoVisible","shouldMountPlayer"],"mappings":"gFAuBO,MAAMA,EAA+B,CAAC,CAC3C,cAAAC,EACA,yBAAAC,CACF,KAA2E,CACzE,cAAeD,GAAiB,GAChC,yBAA0BC,GAA4B,MACxD,GAEaC,EAAgC,CAAC,CAC5C,cAAAC,EACA,yBAAAF,EACA,kBAAAG,CACF,KAA6E,CAC3E,gBACEA,GACAH,IAA6B,WAC5BA,IAA6B,WAAaE,GAC7C,eAAgBC,CAClB"}
|
|
@@ -7,4 +7,14 @@ export interface ResolvedSlidePlayerVisibility {
|
|
|
7
7
|
playerEnabled: boolean;
|
|
8
8
|
playerControlsVisibility: SlidePlayerControlsVisibility;
|
|
9
9
|
}
|
|
10
|
+
export interface ResolveSlidePlayerLayoutStateOptions {
|
|
11
|
+
isAutoVisible: boolean;
|
|
12
|
+
playerControlsVisibility: SlidePlayerControlsVisibility;
|
|
13
|
+
shouldMountPlayer: boolean;
|
|
14
|
+
}
|
|
15
|
+
export interface ResolvedSlidePlayerLayoutState {
|
|
16
|
+
controlsVisible: boolean;
|
|
17
|
+
layoutReserved: boolean;
|
|
18
|
+
}
|
|
10
19
|
export declare const resolveSlidePlayerVisibility: ({ playerEnabled, playerControlsVisibility, }: ResolveSlidePlayerVisibilityOptions) => ResolvedSlidePlayerVisibility;
|
|
20
|
+
export declare const resolveSlidePlayerLayoutState: ({ isAutoVisible, playerControlsVisibility, shouldMountPlayer, }: ResolveSlidePlayerLayoutStateOptions) => ResolvedSlidePlayerLayoutState;
|
|
@@ -1,11 +1,19 @@
|
|
|
1
|
-
const
|
|
2
|
-
playerEnabled:
|
|
3
|
-
playerControlsVisibility:
|
|
1
|
+
const t = ({
|
|
2
|
+
playerEnabled: i,
|
|
3
|
+
playerControlsVisibility: e
|
|
4
4
|
}) => ({
|
|
5
|
-
playerEnabled:
|
|
6
|
-
playerControlsVisibility:
|
|
5
|
+
playerEnabled: i ?? !0,
|
|
6
|
+
playerControlsVisibility: e ?? "auto"
|
|
7
|
+
}), o = ({
|
|
8
|
+
isAutoVisible: i,
|
|
9
|
+
playerControlsVisibility: e,
|
|
10
|
+
shouldMountPlayer: l
|
|
11
|
+
}) => ({
|
|
12
|
+
controlsVisible: l && e !== "hidden" && (e === "visible" || i),
|
|
13
|
+
layoutReserved: l
|
|
7
14
|
});
|
|
8
15
|
export {
|
|
9
|
-
|
|
16
|
+
o as resolveSlidePlayerLayoutState,
|
|
17
|
+
t as resolveSlidePlayerVisibility
|
|
10
18
|
};
|
|
11
19
|
//# sourceMappingURL=playerVisibility.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"playerVisibility.es.js","sources":["../../../../src/components/Slide/utils/playerVisibility.ts"],"sourcesContent":["export type SlidePlayerControlsVisibility = \"auto\" | \"visible\" | \"hidden\";\n\nexport interface ResolveSlidePlayerVisibilityOptions {\n playerEnabled?: boolean;\n playerControlsVisibility?: SlidePlayerControlsVisibility;\n}\n\nexport interface ResolvedSlidePlayerVisibility {\n playerEnabled: boolean;\n playerControlsVisibility: SlidePlayerControlsVisibility;\n}\n\nexport const resolveSlidePlayerVisibility = ({\n playerEnabled,\n playerControlsVisibility,\n}: ResolveSlidePlayerVisibilityOptions): ResolvedSlidePlayerVisibility => ({\n playerEnabled: playerEnabled ?? true,\n playerControlsVisibility: playerControlsVisibility ?? \"auto\",\n});\n"],"names":["resolveSlidePlayerVisibility","playerEnabled","playerControlsVisibility"],"mappings":"
|
|
1
|
+
{"version":3,"file":"playerVisibility.es.js","sources":["../../../../src/components/Slide/utils/playerVisibility.ts"],"sourcesContent":["export type SlidePlayerControlsVisibility = \"auto\" | \"visible\" | \"hidden\";\n\nexport interface ResolveSlidePlayerVisibilityOptions {\n playerEnabled?: boolean;\n playerControlsVisibility?: SlidePlayerControlsVisibility;\n}\n\nexport interface ResolvedSlidePlayerVisibility {\n playerEnabled: boolean;\n playerControlsVisibility: SlidePlayerControlsVisibility;\n}\n\nexport interface ResolveSlidePlayerLayoutStateOptions {\n isAutoVisible: boolean;\n playerControlsVisibility: SlidePlayerControlsVisibility;\n shouldMountPlayer: boolean;\n}\n\nexport interface ResolvedSlidePlayerLayoutState {\n controlsVisible: boolean;\n layoutReserved: boolean;\n}\n\nexport const resolveSlidePlayerVisibility = ({\n playerEnabled,\n playerControlsVisibility,\n}: ResolveSlidePlayerVisibilityOptions): ResolvedSlidePlayerVisibility => ({\n playerEnabled: playerEnabled ?? true,\n playerControlsVisibility: playerControlsVisibility ?? \"auto\",\n});\n\nexport const resolveSlidePlayerLayoutState = ({\n isAutoVisible,\n playerControlsVisibility,\n shouldMountPlayer,\n}: ResolveSlidePlayerLayoutStateOptions): ResolvedSlidePlayerLayoutState => ({\n controlsVisible:\n shouldMountPlayer &&\n playerControlsVisibility !== \"hidden\" &&\n (playerControlsVisibility === \"visible\" || isAutoVisible),\n layoutReserved: shouldMountPlayer,\n});\n"],"names":["resolveSlidePlayerVisibility","playerEnabled","playerControlsVisibility","resolveSlidePlayerLayoutState","isAutoVisible","shouldMountPlayer"],"mappings":"AAuBO,MAAMA,IAA+B,CAAC;AAAA,EAC3C,eAAAC;AAAA,EACA,0BAAAC;AACF,OAA2E;AAAA,EACzE,eAAeD,KAAiB;AAAA,EAChC,0BAA0BC,KAA4B;AACxD,IAEaC,IAAgC,CAAC;AAAA,EAC5C,eAAAC;AAAA,EACA,0BAAAF;AAAA,EACA,mBAAAG;AACF,OAA6E;AAAA,EAC3E,iBACEA,KACAH,MAA6B,aAC5BA,MAA6B,aAAaE;AAAA,EAC7C,gBAAgBC;AAClB;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("../../../../_virtual/
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("../../../../_virtual/index8.cjs"),v=require("./constants.cjs");var d;function x(){if(d)return c.__exports;d=1,Object.defineProperty(c.__exports,"__esModule",{value:!0}),c.__exports.sanitizeUrl=void 0;var e=v.__require();function m(r){return e.relativeFirstCharacters.indexOf(r[0])>-1}function p(r){var i=r.replace(e.ctrlCharactersRegex,"");return i.replace(e.htmlEntitiesRegex,function(t,a){return String.fromCharCode(a)})}function R(r){return URL.canParse(r)}function l(r){try{return decodeURIComponent(r)}catch{return r}}function f(r){if(!r)return e.BLANK_URL;var i,t=l(r.trim());do t=p(t).replace(e.htmlCtrlEntityRegex,"").replace(e.ctrlCharactersRegex,"").replace(e.whitespaceEscapeCharsRegex,"").trim(),t=l(t),i=t.match(e.ctrlCharactersRegex)||t.match(e.htmlEntitiesRegex)||t.match(e.htmlCtrlEntityRegex)||t.match(e.whitespaceEscapeCharsRegex);while(i&&i.length>0);var a=t;if(!a)return e.BLANK_URL;if(m(a))return a;var u=a.trimStart(),h=u.match(e.urlSchemeRegex);if(!h)return a;var n=h[0].toLowerCase().trim();if(e.invalidProtocolRegex.test(n))return e.BLANK_URL;var s=u.replace(/\\/g,"/");if(n==="mailto:"||n.includes("://"))return s;if(n==="http:"||n==="https:"){if(!R(s))return e.BLANK_URL;var o=new URL(s);return o.protocol=o.protocol.toLowerCase(),o.hostname=o.hostname.toLowerCase(),o.toString()}return s}return c.__exports.sanitizeUrl=f,c.__exports}exports.__require=x;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("../../_virtual/
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("../../_virtual/index9.cjs");/*!
|
|
2
2
|
Copyright (c) 2018 Jed Watson.
|
|
3
3
|
Licensed under the MIT License (MIT), see
|
|
4
4
|
http://jedwatson.github.io/classnames
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const I=require("../../_virtual/cose-base2.cjs"),Q=require("../layout-base/layout-base.cjs");var $=I.__module.exports,X;function J(){return X||(X=1,(function(W,k){(function(y,w){W.exports=w(Q.__require())})($,function(x){return(function(y){var w={};function l(n){if(w[n])return w[n].exports;var g=w[n]={i:n,l:!1,exports:{}};return y[n].call(g.exports,g,g.exports,l),g.l=!0,g.exports}return l.m=y,l.c=w,l.i=function(n){return n},l.d=function(n,g,p){l.o(n,g)||Object.defineProperty(n,g,{configurable:!1,enumerable:!0,get:p})},l.n=function(n){var g=n&&n.__esModule?function(){return n.default}:function(){return n};return l.d(g,"a",g),g},l.o=function(n,g){return Object.prototype.hasOwnProperty.call(n,g)},l.p="",l(l.s=7)})([(function(y,w){y.exports=x}),(function(y,w,l){var n=l(0).FDLayoutConstants;function g(){}for(var p in n)g[p]=n[p];g.DEFAULT_USE_MULTI_LEVEL_SCALING=!1,g.DEFAULT_RADIAL_SEPARATION=n.DEFAULT_EDGE_LENGTH,g.DEFAULT_COMPONENT_SEPERATION=60,g.TILE=!0,g.TILING_PADDING_VERTICAL=10,g.TILING_PADDING_HORIZONTAL=10,g.TREE_REDUCTION_ON_INCREMENTAL=!1,y.exports=g}),(function(y,w,l){var n=l(0).FDLayoutEdge;function g(G,u,E){n.call(this,G,u,E)}g.prototype=Object.create(n.prototype);for(var p in n)g[p]=n[p];y.exports=g}),(function(y,w,l){var n=l(0).LGraph;function g(G,u,E){n.call(this,G,u,E)}g.prototype=Object.create(n.prototype);for(var p in n)g[p]=n[p];y.exports=g}),(function(y,w,l){var n=l(0).LGraphManager;function g(G){n.call(this,G)}g.prototype=Object.create(n.prototype);for(var p in n)g[p]=n[p];y.exports=g}),(function(y,w,l){var n=l(0).FDLayoutNode,g=l(0).IMath;function p(u,E,T,L){n.call(this,u,E,T,L)}p.prototype=Object.create(n.prototype);for(var G in n)p[G]=n[G];p.prototype.move=function(){var u=this.graphManager.getLayout();this.displacementX=u.coolingFactor*(this.springForceX+this.repulsionForceX+this.gravitationForceX)/this.noOfChildren,this.displacementY=u.coolingFactor*(this.springForceY+this.repulsionForceY+this.gravitationForceY)/this.noOfChildren,Math.abs(this.displacementX)>u.coolingFactor*u.maxNodeDisplacement&&(this.displacementX=u.coolingFactor*u.maxNodeDisplacement*g.sign(this.displacementX)),Math.abs(this.displacementY)>u.coolingFactor*u.maxNodeDisplacement&&(this.displacementY=u.coolingFactor*u.maxNodeDisplacement*g.sign(this.displacementY)),this.child==null?this.moveBy(this.displacementX,this.displacementY):this.child.getNodes().length==0?this.moveBy(this.displacementX,this.displacementY):this.propogateDisplacementToChildren(this.displacementX,this.displacementY),u.totalDisplacement+=Math.abs(this.displacementX)+Math.abs(this.displacementY),this.springForceX=0,this.springForceY=0,this.repulsionForceX=0,this.repulsionForceY=0,this.gravitationForceX=0,this.gravitationForceY=0,this.displacementX=0,this.displacementY=0},p.prototype.propogateDisplacementToChildren=function(u,E){for(var T=this.getChild().getNodes(),L,P=0;P<T.length;P++)L=T[P],L.getChild()==null?(L.moveBy(u,E),L.displacementX+=u,L.displacementY+=E):L.propogateDisplacementToChildren(u,E)},p.prototype.setPred1=function(u){this.pred1=u},p.prototype.getPred1=function(){return pred1},p.prototype.getPred2=function(){return pred2},p.prototype.setNext=function(u){this.next=u},p.prototype.getNext=function(){return next},p.prototype.setProcessed=function(u){this.processed=u},p.prototype.isProcessed=function(){return processed},y.exports=p}),(function(y,w,l){var n=l(0).FDLayout,g=l(4),p=l(3),G=l(5),u=l(2),E=l(1),T=l(0).FDLayoutConstants,L=l(0).LayoutConstants,P=l(0).Point,R=l(0).PointD,V=l(0).Layout,B=l(0).Integer,Z=l(0).IGeometry,j=l(0).LGraph,_=l(0).Transform;function d(){n.call(this),this.toBeTiled={}}d.prototype=Object.create(n.prototype);for(var U in n)d[U]=n[U];d.prototype.newGraphManager=function(){var t=new g(this);return this.graphManager=t,t},d.prototype.newGraph=function(t){return new p(null,this.graphManager,t)},d.prototype.newNode=function(t){return new G(this.graphManager,t)},d.prototype.newEdge=function(t){return new u(null,null,t)},d.prototype.initParameters=function(){n.prototype.initParameters.call(this,arguments),this.isSubLayout||(E.DEFAULT_EDGE_LENGTH<10?this.idealEdgeLength=10:this.idealEdgeLength=E.DEFAULT_EDGE_LENGTH,this.useSmartIdealEdgeLengthCalculation=E.DEFAULT_USE_SMART_IDEAL_EDGE_LENGTH_CALCULATION,this.springConstant=T.DEFAULT_SPRING_STRENGTH,this.repulsionConstant=T.DEFAULT_REPULSION_STRENGTH,this.gravityConstant=T.DEFAULT_GRAVITY_STRENGTH,this.compoundGravityConstant=T.DEFAULT_COMPOUND_GRAVITY_STRENGTH,this.gravityRangeFactor=T.DEFAULT_GRAVITY_RANGE_FACTOR,this.compoundGravityRangeFactor=T.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR,this.prunedNodesAll=[],this.growTreeIterations=0,this.afterGrowthIterations=0,this.isTreeGrowing=!1,this.isGrowthFinished=!1,this.coolingCycle=0,this.maxCoolingCycle=this.maxIterations/T.CONVERGENCE_CHECK_PERIOD,this.finalTemperature=T.CONVERGENCE_CHECK_PERIOD/this.maxIterations,this.coolingAdjuster=1)},d.prototype.layout=function(){var t=L.DEFAULT_CREATE_BENDS_AS_NEEDED;return t&&(this.createBendpoints(),this.graphManager.resetAllEdges()),this.level=0,this.classicLayout()},d.prototype.classicLayout=function(){if(this.nodesWithGravity=this.calculateNodesToApplyGravitationTo(),this.graphManager.setAllNodesToApplyGravitation(this.nodesWithGravity),this.calcNoOfChildrenForAllNodes(),this.graphManager.calcLowestCommonAncestors(),this.graphManager.calcInclusionTreeDepths(),this.graphManager.getRoot().calcEstimatedSize(),this.calcIdealEdgeLengths(),this.incremental){if(E.TREE_REDUCTION_ON_INCREMENTAL){this.reduceTrees(),this.graphManager.resetAllNodesToApplyGravitation();var e=new Set(this.getAllNodes()),r=this.nodesWithGravity.filter(function(a){return e.has(a)});this.graphManager.setAllNodesToApplyGravitation(r)}}else{var t=this.getFlatForest();if(t.length>0)this.positionNodesRadially(t);else{this.reduceTrees(),this.graphManager.resetAllNodesToApplyGravitation();var e=new Set(this.getAllNodes()),r=this.nodesWithGravity.filter(function(i){return e.has(i)});this.graphManager.setAllNodesToApplyGravitation(r),this.positionNodesRandomly()}}return this.initSpringEmbedder(),this.runSpringEmbedder(),!0},d.prototype.tick=function(){if(this.totalIterations++,this.totalIterations===this.maxIterations&&!this.isTreeGrowing&&!this.isGrowthFinished)if(this.prunedNodesAll.length>0)this.isTreeGrowing=!0;else return!0;if(this.totalIterations%T.CONVERGENCE_CHECK_PERIOD==0&&!this.isTreeGrowing&&!this.isGrowthFinished){if(this.isConverged())if(this.prunedNodesAll.length>0)this.isTreeGrowing=!0;else return!0;this.coolingCycle++,this.layoutQuality==0?this.coolingAdjuster=this.coolingCycle:this.layoutQuality==1&&(this.coolingAdjuster=this.coolingCycle/3),this.coolingFactor=Math.max(this.initialCoolingFactor-Math.pow(this.coolingCycle,Math.log(100*(this.initialCoolingFactor-this.finalTemperature))/Math.log(this.maxCoolingCycle))/100*this.coolingAdjuster,this.finalTemperature),this.animationPeriod=Math.ceil(this.initialAnimationPeriod*Math.sqrt(this.coolingFactor))}if(this.isTreeGrowing){if(this.growTreeIterations%10==0)if(this.prunedNodesAll.length>0){this.graphManager.updateBounds(),this.updateGrid(),this.growTree(this.prunedNodesAll),this.graphManager.resetAllNodesToApplyGravitation();var t=new Set(this.getAllNodes()),e=this.nodesWithGravity.filter(function(o){return t.has(o)});this.graphManager.setAllNodesToApplyGravitation(e),this.graphManager.updateBounds(),this.updateGrid(),this.coolingFactor=T.DEFAULT_COOLING_FACTOR_INCREMENTAL}else this.isTreeGrowing=!1,this.isGrowthFinished=!0;this.growTreeIterations++}if(this.isGrowthFinished){if(this.isConverged())return!0;this.afterGrowthIterations%10==0&&(this.graphManager.updateBounds(),this.updateGrid()),this.coolingFactor=T.DEFAULT_COOLING_FACTOR_INCREMENTAL*((100-this.afterGrowthIterations)/100),this.afterGrowthIterations++}var r=!this.isTreeGrowing&&!this.isGrowthFinished,i=this.growTreeIterations%10==1&&this.isTreeGrowing||this.afterGrowthIterations%10==1&&this.isGrowthFinished;return this.totalDisplacement=0,this.graphManager.updateBounds(),this.calcSpringForces(),this.calcRepulsionForces(r,i),this.calcGravitationalForces(),this.moveNodes(),this.animate(),!1},d.prototype.getPositionsData=function(){for(var t=this.graphManager.getAllNodes(),e={},r=0;r<t.length;r++){var i=t[r].rect,o=t[r].id;e[o]={id:o,x:i.getCenterX(),y:i.getCenterY(),w:i.width,h:i.height}}return e},d.prototype.runSpringEmbedder=function(){this.initialAnimationPeriod=25,this.animationPeriod=this.initialAnimationPeriod;var t=!1;if(T.ANIMATE==="during")this.emit("layoutstarted");else{for(;!t;)t=this.tick();this.graphManager.updateBounds()}},d.prototype.calculateNodesToApplyGravitationTo=function(){var t=[],e,r=this.graphManager.getGraphs(),i=r.length,o;for(o=0;o<i;o++)e=r[o],e.updateConnected(),e.isConnected||(t=t.concat(e.getNodes()));return t},d.prototype.createBendpoints=function(){var t=[];t=t.concat(this.graphManager.getAllEdges());var e=new Set,r;for(r=0;r<t.length;r++){var i=t[r];if(!e.has(i)){var o=i.getSource(),a=i.getTarget();if(o==a)i.getBendpoints().push(new R),i.getBendpoints().push(new R),this.createDummyNodesForBendpoints(i),e.add(i);else{var s=[];if(s=s.concat(o.getEdgeListToNode(a)),s=s.concat(a.getEdgeListToNode(o)),!e.has(s[0])){if(s.length>1){var h;for(h=0;h<s.length;h++){var f=s[h];f.getBendpoints().push(new R),this.createDummyNodesForBendpoints(f)}}s.forEach(function(C){e.add(C)})}}}if(e.size==t.length)break}},d.prototype.positionNodesRadially=function(t){for(var e=new P(0,0),r=Math.ceil(Math.sqrt(t.length)),i=0,o=0,a=0,s=new R(0,0),h=0;h<t.length;h++){h%r==0&&(a=0,o=i,h!=0&&(o+=E.DEFAULT_COMPONENT_SEPERATION),i=0);var f=t[h],C=V.findCenterOfTree(f);e.x=a,e.y=o,s=d.radialLayout(f,C,e),s.y>i&&(i=Math.floor(s.y)),a=Math.floor(s.x+E.DEFAULT_COMPONENT_SEPERATION)}this.transform(new R(L.WORLD_CENTER_X-s.x/2,L.WORLD_CENTER_Y-s.y/2))},d.radialLayout=function(t,e,r){var i=Math.max(this.maxDiagonalInTree(t),E.DEFAULT_RADIAL_SEPARATION);d.branchRadialLayout(e,null,0,359,0,i);var o=j.calculateBounds(t),a=new _;a.setDeviceOrgX(o.getMinX()),a.setDeviceOrgY(o.getMinY()),a.setWorldOrgX(r.x),a.setWorldOrgY(r.y);for(var s=0;s<t.length;s++){var h=t[s];h.transform(a)}var f=new R(o.getMaxX(),o.getMaxY());return a.inverseTransformPoint(f)},d.branchRadialLayout=function(t,e,r,i,o,a){var s=(i-r+1)/2;s<0&&(s+=180);var h=(s+r)%360,f=h*Z.TWO_PI/360,C=o*Math.cos(f),m=o*Math.sin(f);t.setCenter(C,m);var N=[];N=N.concat(t.getEdges());var c=N.length;e!=null&&c--;for(var v=0,A=N.length,D,O=t.getEdgesBetween(e);O.length>1;){var F=O[0];O.splice(0,1);var M=N.indexOf(F);M>=0&&N.splice(M,1),A--,c--}e!=null?D=(N.indexOf(O[0])+1)%A:D=0;for(var b=Math.abs(i-r)/c,S=D;v!=c;S=++S%A){var Y=N[S].getOtherEnd(t);if(Y!=e){var H=(r+v*b)%360,K=(H+b)%360;d.branchRadialLayout(Y,t,H,K,o+a,a),v++}}},d.maxDiagonalInTree=function(t){for(var e=B.MIN_VALUE,r=0;r<t.length;r++){var i=t[r],o=i.getDiagonal();o>e&&(e=o)}return e},d.prototype.calcRepulsionRange=function(){return 2*(this.level+1)*this.idealEdgeLength},d.prototype.groupZeroDegreeMembers=function(){var t=this,e={};this.memberGroups={},this.idToDummyNode={};for(var r=[],i=this.graphManager.getAllNodes(),o=0;o<i.length;o++){var a=i[o],s=a.getParent();this.getNodeDegreeWithChildren(a)===0&&(s.id==null||!this.getToBeTiled(s))&&r.push(a)}for(var o=0;o<r.length;o++){var a=r[o],h=a.getParent().id;typeof e[h]>"u"&&(e[h]=[]),e[h]=e[h].concat(a)}Object.keys(e).forEach(function(f){if(e[f].length>1){var C="DummyCompound_"+f;t.memberGroups[C]=e[f];var m=e[f][0].getParent(),N=new G(t.graphManager);N.id=C,N.paddingLeft=m.paddingLeft||0,N.paddingRight=m.paddingRight||0,N.paddingBottom=m.paddingBottom||0,N.paddingTop=m.paddingTop||0,t.idToDummyNode[C]=N;var c=t.getGraphManager().add(t.newGraph(),N),v=m.getChild();v.add(N);for(var A=0;A<e[f].length;A++){var D=e[f][A];v.remove(D),c.add(D)}}})},d.prototype.clearCompounds=function(){var t={},e={};this.performDFSOnCompounds();for(var r=0;r<this.compoundOrder.length;r++)e[this.compoundOrder[r].id]=this.compoundOrder[r],t[this.compoundOrder[r].id]=[].concat(this.compoundOrder[r].getChild().getNodes()),this.graphManager.remove(this.compoundOrder[r].getChild()),this.compoundOrder[r].child=null;this.graphManager.resetAllNodes(),this.tileCompoundMembers(t,e)},d.prototype.clearZeroDegreeMembers=function(){var t=this,e=this.tiledZeroDegreePack=[];Object.keys(this.memberGroups).forEach(function(r){var i=t.idToDummyNode[r];e[r]=t.tileNodes(t.memberGroups[r],i.paddingLeft+i.paddingRight),i.rect.width=e[r].width,i.rect.height=e[r].height})},d.prototype.repopulateCompounds=function(){for(var t=this.compoundOrder.length-1;t>=0;t--){var e=this.compoundOrder[t],r=e.id,i=e.paddingLeft,o=e.paddingTop;this.adjustLocations(this.tiledMemberPack[r],e.rect.x,e.rect.y,i,o)}},d.prototype.repopulateZeroDegreeMembers=function(){var t=this,e=this.tiledZeroDegreePack;Object.keys(e).forEach(function(r){var i=t.idToDummyNode[r],o=i.paddingLeft,a=i.paddingTop;t.adjustLocations(e[r],i.rect.x,i.rect.y,o,a)})},d.prototype.getToBeTiled=function(t){var e=t.id;if(this.toBeTiled[e]!=null)return this.toBeTiled[e];var r=t.getChild();if(r==null)return this.toBeTiled[e]=!1,!1;for(var i=r.getNodes(),o=0;o<i.length;o++){var a=i[o];if(this.getNodeDegree(a)>0)return this.toBeTiled[e]=!1,!1;if(a.getChild()==null){this.toBeTiled[a.id]=!1;continue}if(!this.getToBeTiled(a))return this.toBeTiled[e]=!1,!1}return this.toBeTiled[e]=!0,!0},d.prototype.getNodeDegree=function(t){t.id;for(var e=t.getEdges(),r=0,i=0;i<e.length;i++){var o=e[i];o.getSource().id!==o.getTarget().id&&(r=r+1)}return r},d.prototype.getNodeDegreeWithChildren=function(t){var e=this.getNodeDegree(t);if(t.getChild()==null)return e;for(var r=t.getChild().getNodes(),i=0;i<r.length;i++){var o=r[i];e+=this.getNodeDegreeWithChildren(o)}return e},d.prototype.performDFSOnCompounds=function(){this.compoundOrder=[],this.fillCompexOrderByDFS(this.graphManager.getRoot().getNodes())},d.prototype.fillCompexOrderByDFS=function(t){for(var e=0;e<t.length;e++){var r=t[e];r.getChild()!=null&&this.fillCompexOrderByDFS(r.getChild().getNodes()),this.getToBeTiled(r)&&this.compoundOrder.push(r)}},d.prototype.adjustLocations=function(t,e,r,i,o){e+=i,r+=o;for(var a=e,s=0;s<t.rows.length;s++){var h=t.rows[s];e=a;for(var f=0,C=0;C<h.length;C++){var m=h[C];m.rect.x=e,m.rect.y=r,e+=m.rect.width+t.horizontalPadding,m.rect.height>f&&(f=m.rect.height)}r+=f+t.verticalPadding}},d.prototype.tileCompoundMembers=function(t,e){var r=this;this.tiledMemberPack=[],Object.keys(t).forEach(function(i){var o=e[i];r.tiledMemberPack[i]=r.tileNodes(t[i],o.paddingLeft+o.paddingRight),o.rect.width=r.tiledMemberPack[i].width,o.rect.height=r.tiledMemberPack[i].height})},d.prototype.tileNodes=function(t,e){var r=E.TILING_PADDING_VERTICAL,i=E.TILING_PADDING_HORIZONTAL,o={rows:[],rowWidth:[],rowHeight:[],width:0,height:e,verticalPadding:r,horizontalPadding:i};t.sort(function(h,f){return h.rect.width*h.rect.height>f.rect.width*f.rect.height?-1:h.rect.width*h.rect.height<f.rect.width*f.rect.height?1:0});for(var a=0;a<t.length;a++){var s=t[a];o.rows.length==0?this.insertNodeToRow(o,s,0,e):this.canAddHorizontal(o,s.rect.width,s.rect.height)?this.insertNodeToRow(o,s,this.getShortestRowIndex(o),e):this.insertNodeToRow(o,s,o.rows.length,e),this.shiftToLastRow(o)}return o},d.prototype.insertNodeToRow=function(t,e,r,i){var o=i;if(r==t.rows.length){var a=[];t.rows.push(a),t.rowWidth.push(o),t.rowHeight.push(0)}var s=t.rowWidth[r]+e.rect.width;t.rows[r].length>0&&(s+=t.horizontalPadding),t.rowWidth[r]=s,t.width<s&&(t.width=s);var h=e.rect.height;r>0&&(h+=t.verticalPadding);var f=0;h>t.rowHeight[r]&&(f=t.rowHeight[r],t.rowHeight[r]=h,f=t.rowHeight[r]-f),t.height+=f,t.rows[r].push(e)},d.prototype.getShortestRowIndex=function(t){for(var e=-1,r=Number.MAX_VALUE,i=0;i<t.rows.length;i++)t.rowWidth[i]<r&&(e=i,r=t.rowWidth[i]);return e},d.prototype.getLongestRowIndex=function(t){for(var e=-1,r=Number.MIN_VALUE,i=0;i<t.rows.length;i++)t.rowWidth[i]>r&&(e=i,r=t.rowWidth[i]);return e},d.prototype.canAddHorizontal=function(t,e,r){var i=this.getShortestRowIndex(t);if(i<0)return!0;var o=t.rowWidth[i];if(o+t.horizontalPadding+e<=t.width)return!0;var a=0;t.rowHeight[i]<r&&i>0&&(a=r+t.verticalPadding-t.rowHeight[i]);var s;t.width-o>=e+t.horizontalPadding?s=(t.height+a)/(o+e+t.horizontalPadding):s=(t.height+a)/t.width,a=r+t.verticalPadding;var h;return t.width<e?h=(t.height+a)/e:h=(t.height+a)/t.width,h<1&&(h=1/h),s<1&&(s=1/s),s<h},d.prototype.shiftToLastRow=function(t){var e=this.getLongestRowIndex(t),r=t.rowWidth.length-1,i=t.rows[e],o=i[i.length-1],a=o.width+t.horizontalPadding;if(t.width-t.rowWidth[r]>a&&e!=r){i.splice(-1,1),t.rows[r].push(o),t.rowWidth[e]=t.rowWidth[e]-a,t.rowWidth[r]=t.rowWidth[r]+a,t.width=t.rowWidth[instance.getLongestRowIndex(t)];for(var s=Number.MIN_VALUE,h=0;h<i.length;h++)i[h].height>s&&(s=i[h].height);e>0&&(s+=t.verticalPadding);var f=t.rowHeight[e]+t.rowHeight[r];t.rowHeight[e]=s,t.rowHeight[r]<o.height+t.verticalPadding&&(t.rowHeight[r]=o.height+t.verticalPadding);var C=t.rowHeight[e]+t.rowHeight[r];t.height+=C-f,this.shiftToLastRow(t)}},d.prototype.tilingPreLayout=function(){E.TILE&&(this.groupZeroDegreeMembers(),this.clearCompounds(),this.clearZeroDegreeMembers())},d.prototype.tilingPostLayout=function(){E.TILE&&(this.repopulateZeroDegreeMembers(),this.repopulateCompounds())},d.prototype.reduceTrees=function(){for(var t=[],e=!0,r;e;){var i=this.graphManager.getAllNodes(),o=[];e=!1;for(var a=0;a<i.length;a++)r=i[a],r.getEdges().length==1&&!r.getEdges()[0].isInterGraph&&r.getChild()==null&&(o.push([r,r.getEdges()[0],r.getOwner()]),e=!0);if(e==!0){for(var s=[],h=0;h<o.length;h++)o[h][0].getEdges().length==1&&(s.push(o[h]),o[h][0].getOwner().remove(o[h][0]));t.push(s),this.graphManager.resetAllNodes(),this.graphManager.resetAllEdges()}}this.prunedNodesAll=t},d.prototype.growTree=function(t){for(var e=t.length,r=t[e-1],i,o=0;o<r.length;o++)i=r[o],this.findPlaceforPrunedNode(i),i[2].add(i[0]),i[2].add(i[1],i[1].source,i[1].target);t.splice(t.length-1,1),this.graphManager.resetAllNodes(),this.graphManager.resetAllEdges()},d.prototype.findPlaceforPrunedNode=function(t){var e,r,i=t[0];i==t[1].source?r=t[1].target:r=t[1].source;var o=r.startX,a=r.finishX,s=r.startY,h=r.finishY,f=0,C=0,m=0,N=0,c=[f,m,C,N];if(s>0)for(var v=o;v<=a;v++)c[0]+=this.grid[v][s-1].length+this.grid[v][s].length-1;if(a<this.grid.length-1)for(var v=s;v<=h;v++)c[1]+=this.grid[a+1][v].length+this.grid[a][v].length-1;if(h<this.grid[0].length-1)for(var v=o;v<=a;v++)c[2]+=this.grid[v][h+1].length+this.grid[v][h].length-1;if(o>0)for(var v=s;v<=h;v++)c[3]+=this.grid[o-1][v].length+this.grid[o][v].length-1;for(var A=B.MAX_VALUE,D,O,F=0;F<c.length;F++)c[F]<A?(A=c[F],D=1,O=F):c[F]==A&&D++;if(D==3&&A==0)c[0]==0&&c[1]==0&&c[2]==0?e=1:c[0]==0&&c[1]==0&&c[3]==0?e=0:c[0]==0&&c[2]==0&&c[3]==0?e=3:c[1]==0&&c[2]==0&&c[3]==0&&(e=2);else if(D==2&&A==0){var M=Math.floor(Math.random()*2);c[0]==0&&c[1]==0?M==0?e=0:e=1:c[0]==0&&c[2]==0?M==0?e=0:e=2:c[0]==0&&c[3]==0?M==0?e=0:e=3:c[1]==0&&c[2]==0?M==0?e=1:e=2:c[1]==0&&c[3]==0?M==0?e=1:e=3:M==0?e=2:e=3}else if(D==4&&A==0){var M=Math.floor(Math.random()*4);e=M}else e=O;e==0?i.setCenter(r.getCenterX(),r.getCenterY()-r.getHeight()/2-T.DEFAULT_EDGE_LENGTH-i.getHeight()/2):e==1?i.setCenter(r.getCenterX()+r.getWidth()/2+T.DEFAULT_EDGE_LENGTH+i.getWidth()/2,r.getCenterY()):e==2?i.setCenter(r.getCenterX(),r.getCenterY()+r.getHeight()/2+T.DEFAULT_EDGE_LENGTH+i.getHeight()/2):i.setCenter(r.getCenterX()-r.getWidth()/2-T.DEFAULT_EDGE_LENGTH-i.getWidth()/2,r.getCenterY())},y.exports=d}),(function(y,w,l){var n={};n.layoutBase=l(0),n.CoSEConstants=l(1),n.CoSEEdge=l(2),n.CoSEGraph=l(3),n.CoSEGraphManager=l(4),n.CoSELayout=l(6),n.CoSENode=l(5),y.exports=n})])})})(I.__module)),I.__module.exports}exports.__require=J;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const I=require("../../_virtual/cose-base.cjs"),Q=require("../layout-base/layout-base.cjs");var $=I.__module.exports,X;function J(){return X||(X=1,(function(W,k){(function(y,w){W.exports=w(Q.__require())})($,function(x){return(function(y){var w={};function l(n){if(w[n])return w[n].exports;var g=w[n]={i:n,l:!1,exports:{}};return y[n].call(g.exports,g,g.exports,l),g.l=!0,g.exports}return l.m=y,l.c=w,l.i=function(n){return n},l.d=function(n,g,p){l.o(n,g)||Object.defineProperty(n,g,{configurable:!1,enumerable:!0,get:p})},l.n=function(n){var g=n&&n.__esModule?function(){return n.default}:function(){return n};return l.d(g,"a",g),g},l.o=function(n,g){return Object.prototype.hasOwnProperty.call(n,g)},l.p="",l(l.s=7)})([(function(y,w){y.exports=x}),(function(y,w,l){var n=l(0).FDLayoutConstants;function g(){}for(var p in n)g[p]=n[p];g.DEFAULT_USE_MULTI_LEVEL_SCALING=!1,g.DEFAULT_RADIAL_SEPARATION=n.DEFAULT_EDGE_LENGTH,g.DEFAULT_COMPONENT_SEPERATION=60,g.TILE=!0,g.TILING_PADDING_VERTICAL=10,g.TILING_PADDING_HORIZONTAL=10,g.TREE_REDUCTION_ON_INCREMENTAL=!1,y.exports=g}),(function(y,w,l){var n=l(0).FDLayoutEdge;function g(G,u,E){n.call(this,G,u,E)}g.prototype=Object.create(n.prototype);for(var p in n)g[p]=n[p];y.exports=g}),(function(y,w,l){var n=l(0).LGraph;function g(G,u,E){n.call(this,G,u,E)}g.prototype=Object.create(n.prototype);for(var p in n)g[p]=n[p];y.exports=g}),(function(y,w,l){var n=l(0).LGraphManager;function g(G){n.call(this,G)}g.prototype=Object.create(n.prototype);for(var p in n)g[p]=n[p];y.exports=g}),(function(y,w,l){var n=l(0).FDLayoutNode,g=l(0).IMath;function p(u,E,T,L){n.call(this,u,E,T,L)}p.prototype=Object.create(n.prototype);for(var G in n)p[G]=n[G];p.prototype.move=function(){var u=this.graphManager.getLayout();this.displacementX=u.coolingFactor*(this.springForceX+this.repulsionForceX+this.gravitationForceX)/this.noOfChildren,this.displacementY=u.coolingFactor*(this.springForceY+this.repulsionForceY+this.gravitationForceY)/this.noOfChildren,Math.abs(this.displacementX)>u.coolingFactor*u.maxNodeDisplacement&&(this.displacementX=u.coolingFactor*u.maxNodeDisplacement*g.sign(this.displacementX)),Math.abs(this.displacementY)>u.coolingFactor*u.maxNodeDisplacement&&(this.displacementY=u.coolingFactor*u.maxNodeDisplacement*g.sign(this.displacementY)),this.child==null?this.moveBy(this.displacementX,this.displacementY):this.child.getNodes().length==0?this.moveBy(this.displacementX,this.displacementY):this.propogateDisplacementToChildren(this.displacementX,this.displacementY),u.totalDisplacement+=Math.abs(this.displacementX)+Math.abs(this.displacementY),this.springForceX=0,this.springForceY=0,this.repulsionForceX=0,this.repulsionForceY=0,this.gravitationForceX=0,this.gravitationForceY=0,this.displacementX=0,this.displacementY=0},p.prototype.propogateDisplacementToChildren=function(u,E){for(var T=this.getChild().getNodes(),L,P=0;P<T.length;P++)L=T[P],L.getChild()==null?(L.moveBy(u,E),L.displacementX+=u,L.displacementY+=E):L.propogateDisplacementToChildren(u,E)},p.prototype.setPred1=function(u){this.pred1=u},p.prototype.getPred1=function(){return pred1},p.prototype.getPred2=function(){return pred2},p.prototype.setNext=function(u){this.next=u},p.prototype.getNext=function(){return next},p.prototype.setProcessed=function(u){this.processed=u},p.prototype.isProcessed=function(){return processed},y.exports=p}),(function(y,w,l){var n=l(0).FDLayout,g=l(4),p=l(3),G=l(5),u=l(2),E=l(1),T=l(0).FDLayoutConstants,L=l(0).LayoutConstants,P=l(0).Point,R=l(0).PointD,V=l(0).Layout,B=l(0).Integer,Z=l(0).IGeometry,j=l(0).LGraph,_=l(0).Transform;function d(){n.call(this),this.toBeTiled={}}d.prototype=Object.create(n.prototype);for(var U in n)d[U]=n[U];d.prototype.newGraphManager=function(){var t=new g(this);return this.graphManager=t,t},d.prototype.newGraph=function(t){return new p(null,this.graphManager,t)},d.prototype.newNode=function(t){return new G(this.graphManager,t)},d.prototype.newEdge=function(t){return new u(null,null,t)},d.prototype.initParameters=function(){n.prototype.initParameters.call(this,arguments),this.isSubLayout||(E.DEFAULT_EDGE_LENGTH<10?this.idealEdgeLength=10:this.idealEdgeLength=E.DEFAULT_EDGE_LENGTH,this.useSmartIdealEdgeLengthCalculation=E.DEFAULT_USE_SMART_IDEAL_EDGE_LENGTH_CALCULATION,this.springConstant=T.DEFAULT_SPRING_STRENGTH,this.repulsionConstant=T.DEFAULT_REPULSION_STRENGTH,this.gravityConstant=T.DEFAULT_GRAVITY_STRENGTH,this.compoundGravityConstant=T.DEFAULT_COMPOUND_GRAVITY_STRENGTH,this.gravityRangeFactor=T.DEFAULT_GRAVITY_RANGE_FACTOR,this.compoundGravityRangeFactor=T.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR,this.prunedNodesAll=[],this.growTreeIterations=0,this.afterGrowthIterations=0,this.isTreeGrowing=!1,this.isGrowthFinished=!1,this.coolingCycle=0,this.maxCoolingCycle=this.maxIterations/T.CONVERGENCE_CHECK_PERIOD,this.finalTemperature=T.CONVERGENCE_CHECK_PERIOD/this.maxIterations,this.coolingAdjuster=1)},d.prototype.layout=function(){var t=L.DEFAULT_CREATE_BENDS_AS_NEEDED;return t&&(this.createBendpoints(),this.graphManager.resetAllEdges()),this.level=0,this.classicLayout()},d.prototype.classicLayout=function(){if(this.nodesWithGravity=this.calculateNodesToApplyGravitationTo(),this.graphManager.setAllNodesToApplyGravitation(this.nodesWithGravity),this.calcNoOfChildrenForAllNodes(),this.graphManager.calcLowestCommonAncestors(),this.graphManager.calcInclusionTreeDepths(),this.graphManager.getRoot().calcEstimatedSize(),this.calcIdealEdgeLengths(),this.incremental){if(E.TREE_REDUCTION_ON_INCREMENTAL){this.reduceTrees(),this.graphManager.resetAllNodesToApplyGravitation();var e=new Set(this.getAllNodes()),r=this.nodesWithGravity.filter(function(a){return e.has(a)});this.graphManager.setAllNodesToApplyGravitation(r)}}else{var t=this.getFlatForest();if(t.length>0)this.positionNodesRadially(t);else{this.reduceTrees(),this.graphManager.resetAllNodesToApplyGravitation();var e=new Set(this.getAllNodes()),r=this.nodesWithGravity.filter(function(i){return e.has(i)});this.graphManager.setAllNodesToApplyGravitation(r),this.positionNodesRandomly()}}return this.initSpringEmbedder(),this.runSpringEmbedder(),!0},d.prototype.tick=function(){if(this.totalIterations++,this.totalIterations===this.maxIterations&&!this.isTreeGrowing&&!this.isGrowthFinished)if(this.prunedNodesAll.length>0)this.isTreeGrowing=!0;else return!0;if(this.totalIterations%T.CONVERGENCE_CHECK_PERIOD==0&&!this.isTreeGrowing&&!this.isGrowthFinished){if(this.isConverged())if(this.prunedNodesAll.length>0)this.isTreeGrowing=!0;else return!0;this.coolingCycle++,this.layoutQuality==0?this.coolingAdjuster=this.coolingCycle:this.layoutQuality==1&&(this.coolingAdjuster=this.coolingCycle/3),this.coolingFactor=Math.max(this.initialCoolingFactor-Math.pow(this.coolingCycle,Math.log(100*(this.initialCoolingFactor-this.finalTemperature))/Math.log(this.maxCoolingCycle))/100*this.coolingAdjuster,this.finalTemperature),this.animationPeriod=Math.ceil(this.initialAnimationPeriod*Math.sqrt(this.coolingFactor))}if(this.isTreeGrowing){if(this.growTreeIterations%10==0)if(this.prunedNodesAll.length>0){this.graphManager.updateBounds(),this.updateGrid(),this.growTree(this.prunedNodesAll),this.graphManager.resetAllNodesToApplyGravitation();var t=new Set(this.getAllNodes()),e=this.nodesWithGravity.filter(function(o){return t.has(o)});this.graphManager.setAllNodesToApplyGravitation(e),this.graphManager.updateBounds(),this.updateGrid(),this.coolingFactor=T.DEFAULT_COOLING_FACTOR_INCREMENTAL}else this.isTreeGrowing=!1,this.isGrowthFinished=!0;this.growTreeIterations++}if(this.isGrowthFinished){if(this.isConverged())return!0;this.afterGrowthIterations%10==0&&(this.graphManager.updateBounds(),this.updateGrid()),this.coolingFactor=T.DEFAULT_COOLING_FACTOR_INCREMENTAL*((100-this.afterGrowthIterations)/100),this.afterGrowthIterations++}var r=!this.isTreeGrowing&&!this.isGrowthFinished,i=this.growTreeIterations%10==1&&this.isTreeGrowing||this.afterGrowthIterations%10==1&&this.isGrowthFinished;return this.totalDisplacement=0,this.graphManager.updateBounds(),this.calcSpringForces(),this.calcRepulsionForces(r,i),this.calcGravitationalForces(),this.moveNodes(),this.animate(),!1},d.prototype.getPositionsData=function(){for(var t=this.graphManager.getAllNodes(),e={},r=0;r<t.length;r++){var i=t[r].rect,o=t[r].id;e[o]={id:o,x:i.getCenterX(),y:i.getCenterY(),w:i.width,h:i.height}}return e},d.prototype.runSpringEmbedder=function(){this.initialAnimationPeriod=25,this.animationPeriod=this.initialAnimationPeriod;var t=!1;if(T.ANIMATE==="during")this.emit("layoutstarted");else{for(;!t;)t=this.tick();this.graphManager.updateBounds()}},d.prototype.calculateNodesToApplyGravitationTo=function(){var t=[],e,r=this.graphManager.getGraphs(),i=r.length,o;for(o=0;o<i;o++)e=r[o],e.updateConnected(),e.isConnected||(t=t.concat(e.getNodes()));return t},d.prototype.createBendpoints=function(){var t=[];t=t.concat(this.graphManager.getAllEdges());var e=new Set,r;for(r=0;r<t.length;r++){var i=t[r];if(!e.has(i)){var o=i.getSource(),a=i.getTarget();if(o==a)i.getBendpoints().push(new R),i.getBendpoints().push(new R),this.createDummyNodesForBendpoints(i),e.add(i);else{var s=[];if(s=s.concat(o.getEdgeListToNode(a)),s=s.concat(a.getEdgeListToNode(o)),!e.has(s[0])){if(s.length>1){var h;for(h=0;h<s.length;h++){var f=s[h];f.getBendpoints().push(new R),this.createDummyNodesForBendpoints(f)}}s.forEach(function(C){e.add(C)})}}}if(e.size==t.length)break}},d.prototype.positionNodesRadially=function(t){for(var e=new P(0,0),r=Math.ceil(Math.sqrt(t.length)),i=0,o=0,a=0,s=new R(0,0),h=0;h<t.length;h++){h%r==0&&(a=0,o=i,h!=0&&(o+=E.DEFAULT_COMPONENT_SEPERATION),i=0);var f=t[h],C=V.findCenterOfTree(f);e.x=a,e.y=o,s=d.radialLayout(f,C,e),s.y>i&&(i=Math.floor(s.y)),a=Math.floor(s.x+E.DEFAULT_COMPONENT_SEPERATION)}this.transform(new R(L.WORLD_CENTER_X-s.x/2,L.WORLD_CENTER_Y-s.y/2))},d.radialLayout=function(t,e,r){var i=Math.max(this.maxDiagonalInTree(t),E.DEFAULT_RADIAL_SEPARATION);d.branchRadialLayout(e,null,0,359,0,i);var o=j.calculateBounds(t),a=new _;a.setDeviceOrgX(o.getMinX()),a.setDeviceOrgY(o.getMinY()),a.setWorldOrgX(r.x),a.setWorldOrgY(r.y);for(var s=0;s<t.length;s++){var h=t[s];h.transform(a)}var f=new R(o.getMaxX(),o.getMaxY());return a.inverseTransformPoint(f)},d.branchRadialLayout=function(t,e,r,i,o,a){var s=(i-r+1)/2;s<0&&(s+=180);var h=(s+r)%360,f=h*Z.TWO_PI/360,C=o*Math.cos(f),m=o*Math.sin(f);t.setCenter(C,m);var N=[];N=N.concat(t.getEdges());var c=N.length;e!=null&&c--;for(var v=0,A=N.length,D,O=t.getEdgesBetween(e);O.length>1;){var F=O[0];O.splice(0,1);var M=N.indexOf(F);M>=0&&N.splice(M,1),A--,c--}e!=null?D=(N.indexOf(O[0])+1)%A:D=0;for(var b=Math.abs(i-r)/c,S=D;v!=c;S=++S%A){var Y=N[S].getOtherEnd(t);if(Y!=e){var H=(r+v*b)%360,K=(H+b)%360;d.branchRadialLayout(Y,t,H,K,o+a,a),v++}}},d.maxDiagonalInTree=function(t){for(var e=B.MIN_VALUE,r=0;r<t.length;r++){var i=t[r],o=i.getDiagonal();o>e&&(e=o)}return e},d.prototype.calcRepulsionRange=function(){return 2*(this.level+1)*this.idealEdgeLength},d.prototype.groupZeroDegreeMembers=function(){var t=this,e={};this.memberGroups={},this.idToDummyNode={};for(var r=[],i=this.graphManager.getAllNodes(),o=0;o<i.length;o++){var a=i[o],s=a.getParent();this.getNodeDegreeWithChildren(a)===0&&(s.id==null||!this.getToBeTiled(s))&&r.push(a)}for(var o=0;o<r.length;o++){var a=r[o],h=a.getParent().id;typeof e[h]>"u"&&(e[h]=[]),e[h]=e[h].concat(a)}Object.keys(e).forEach(function(f){if(e[f].length>1){var C="DummyCompound_"+f;t.memberGroups[C]=e[f];var m=e[f][0].getParent(),N=new G(t.graphManager);N.id=C,N.paddingLeft=m.paddingLeft||0,N.paddingRight=m.paddingRight||0,N.paddingBottom=m.paddingBottom||0,N.paddingTop=m.paddingTop||0,t.idToDummyNode[C]=N;var c=t.getGraphManager().add(t.newGraph(),N),v=m.getChild();v.add(N);for(var A=0;A<e[f].length;A++){var D=e[f][A];v.remove(D),c.add(D)}}})},d.prototype.clearCompounds=function(){var t={},e={};this.performDFSOnCompounds();for(var r=0;r<this.compoundOrder.length;r++)e[this.compoundOrder[r].id]=this.compoundOrder[r],t[this.compoundOrder[r].id]=[].concat(this.compoundOrder[r].getChild().getNodes()),this.graphManager.remove(this.compoundOrder[r].getChild()),this.compoundOrder[r].child=null;this.graphManager.resetAllNodes(),this.tileCompoundMembers(t,e)},d.prototype.clearZeroDegreeMembers=function(){var t=this,e=this.tiledZeroDegreePack=[];Object.keys(this.memberGroups).forEach(function(r){var i=t.idToDummyNode[r];e[r]=t.tileNodes(t.memberGroups[r],i.paddingLeft+i.paddingRight),i.rect.width=e[r].width,i.rect.height=e[r].height})},d.prototype.repopulateCompounds=function(){for(var t=this.compoundOrder.length-1;t>=0;t--){var e=this.compoundOrder[t],r=e.id,i=e.paddingLeft,o=e.paddingTop;this.adjustLocations(this.tiledMemberPack[r],e.rect.x,e.rect.y,i,o)}},d.prototype.repopulateZeroDegreeMembers=function(){var t=this,e=this.tiledZeroDegreePack;Object.keys(e).forEach(function(r){var i=t.idToDummyNode[r],o=i.paddingLeft,a=i.paddingTop;t.adjustLocations(e[r],i.rect.x,i.rect.y,o,a)})},d.prototype.getToBeTiled=function(t){var e=t.id;if(this.toBeTiled[e]!=null)return this.toBeTiled[e];var r=t.getChild();if(r==null)return this.toBeTiled[e]=!1,!1;for(var i=r.getNodes(),o=0;o<i.length;o++){var a=i[o];if(this.getNodeDegree(a)>0)return this.toBeTiled[e]=!1,!1;if(a.getChild()==null){this.toBeTiled[a.id]=!1;continue}if(!this.getToBeTiled(a))return this.toBeTiled[e]=!1,!1}return this.toBeTiled[e]=!0,!0},d.prototype.getNodeDegree=function(t){t.id;for(var e=t.getEdges(),r=0,i=0;i<e.length;i++){var o=e[i];o.getSource().id!==o.getTarget().id&&(r=r+1)}return r},d.prototype.getNodeDegreeWithChildren=function(t){var e=this.getNodeDegree(t);if(t.getChild()==null)return e;for(var r=t.getChild().getNodes(),i=0;i<r.length;i++){var o=r[i];e+=this.getNodeDegreeWithChildren(o)}return e},d.prototype.performDFSOnCompounds=function(){this.compoundOrder=[],this.fillCompexOrderByDFS(this.graphManager.getRoot().getNodes())},d.prototype.fillCompexOrderByDFS=function(t){for(var e=0;e<t.length;e++){var r=t[e];r.getChild()!=null&&this.fillCompexOrderByDFS(r.getChild().getNodes()),this.getToBeTiled(r)&&this.compoundOrder.push(r)}},d.prototype.adjustLocations=function(t,e,r,i,o){e+=i,r+=o;for(var a=e,s=0;s<t.rows.length;s++){var h=t.rows[s];e=a;for(var f=0,C=0;C<h.length;C++){var m=h[C];m.rect.x=e,m.rect.y=r,e+=m.rect.width+t.horizontalPadding,m.rect.height>f&&(f=m.rect.height)}r+=f+t.verticalPadding}},d.prototype.tileCompoundMembers=function(t,e){var r=this;this.tiledMemberPack=[],Object.keys(t).forEach(function(i){var o=e[i];r.tiledMemberPack[i]=r.tileNodes(t[i],o.paddingLeft+o.paddingRight),o.rect.width=r.tiledMemberPack[i].width,o.rect.height=r.tiledMemberPack[i].height})},d.prototype.tileNodes=function(t,e){var r=E.TILING_PADDING_VERTICAL,i=E.TILING_PADDING_HORIZONTAL,o={rows:[],rowWidth:[],rowHeight:[],width:0,height:e,verticalPadding:r,horizontalPadding:i};t.sort(function(h,f){return h.rect.width*h.rect.height>f.rect.width*f.rect.height?-1:h.rect.width*h.rect.height<f.rect.width*f.rect.height?1:0});for(var a=0;a<t.length;a++){var s=t[a];o.rows.length==0?this.insertNodeToRow(o,s,0,e):this.canAddHorizontal(o,s.rect.width,s.rect.height)?this.insertNodeToRow(o,s,this.getShortestRowIndex(o),e):this.insertNodeToRow(o,s,o.rows.length,e),this.shiftToLastRow(o)}return o},d.prototype.insertNodeToRow=function(t,e,r,i){var o=i;if(r==t.rows.length){var a=[];t.rows.push(a),t.rowWidth.push(o),t.rowHeight.push(0)}var s=t.rowWidth[r]+e.rect.width;t.rows[r].length>0&&(s+=t.horizontalPadding),t.rowWidth[r]=s,t.width<s&&(t.width=s);var h=e.rect.height;r>0&&(h+=t.verticalPadding);var f=0;h>t.rowHeight[r]&&(f=t.rowHeight[r],t.rowHeight[r]=h,f=t.rowHeight[r]-f),t.height+=f,t.rows[r].push(e)},d.prototype.getShortestRowIndex=function(t){for(var e=-1,r=Number.MAX_VALUE,i=0;i<t.rows.length;i++)t.rowWidth[i]<r&&(e=i,r=t.rowWidth[i]);return e},d.prototype.getLongestRowIndex=function(t){for(var e=-1,r=Number.MIN_VALUE,i=0;i<t.rows.length;i++)t.rowWidth[i]>r&&(e=i,r=t.rowWidth[i]);return e},d.prototype.canAddHorizontal=function(t,e,r){var i=this.getShortestRowIndex(t);if(i<0)return!0;var o=t.rowWidth[i];if(o+t.horizontalPadding+e<=t.width)return!0;var a=0;t.rowHeight[i]<r&&i>0&&(a=r+t.verticalPadding-t.rowHeight[i]);var s;t.width-o>=e+t.horizontalPadding?s=(t.height+a)/(o+e+t.horizontalPadding):s=(t.height+a)/t.width,a=r+t.verticalPadding;var h;return t.width<e?h=(t.height+a)/e:h=(t.height+a)/t.width,h<1&&(h=1/h),s<1&&(s=1/s),s<h},d.prototype.shiftToLastRow=function(t){var e=this.getLongestRowIndex(t),r=t.rowWidth.length-1,i=t.rows[e],o=i[i.length-1],a=o.width+t.horizontalPadding;if(t.width-t.rowWidth[r]>a&&e!=r){i.splice(-1,1),t.rows[r].push(o),t.rowWidth[e]=t.rowWidth[e]-a,t.rowWidth[r]=t.rowWidth[r]+a,t.width=t.rowWidth[instance.getLongestRowIndex(t)];for(var s=Number.MIN_VALUE,h=0;h<i.length;h++)i[h].height>s&&(s=i[h].height);e>0&&(s+=t.verticalPadding);var f=t.rowHeight[e]+t.rowHeight[r];t.rowHeight[e]=s,t.rowHeight[r]<o.height+t.verticalPadding&&(t.rowHeight[r]=o.height+t.verticalPadding);var C=t.rowHeight[e]+t.rowHeight[r];t.height+=C-f,this.shiftToLastRow(t)}},d.prototype.tilingPreLayout=function(){E.TILE&&(this.groupZeroDegreeMembers(),this.clearCompounds(),this.clearZeroDegreeMembers())},d.prototype.tilingPostLayout=function(){E.TILE&&(this.repopulateZeroDegreeMembers(),this.repopulateCompounds())},d.prototype.reduceTrees=function(){for(var t=[],e=!0,r;e;){var i=this.graphManager.getAllNodes(),o=[];e=!1;for(var a=0;a<i.length;a++)r=i[a],r.getEdges().length==1&&!r.getEdges()[0].isInterGraph&&r.getChild()==null&&(o.push([r,r.getEdges()[0],r.getOwner()]),e=!0);if(e==!0){for(var s=[],h=0;h<o.length;h++)o[h][0].getEdges().length==1&&(s.push(o[h]),o[h][0].getOwner().remove(o[h][0]));t.push(s),this.graphManager.resetAllNodes(),this.graphManager.resetAllEdges()}}this.prunedNodesAll=t},d.prototype.growTree=function(t){for(var e=t.length,r=t[e-1],i,o=0;o<r.length;o++)i=r[o],this.findPlaceforPrunedNode(i),i[2].add(i[0]),i[2].add(i[1],i[1].source,i[1].target);t.splice(t.length-1,1),this.graphManager.resetAllNodes(),this.graphManager.resetAllEdges()},d.prototype.findPlaceforPrunedNode=function(t){var e,r,i=t[0];i==t[1].source?r=t[1].target:r=t[1].source;var o=r.startX,a=r.finishX,s=r.startY,h=r.finishY,f=0,C=0,m=0,N=0,c=[f,m,C,N];if(s>0)for(var v=o;v<=a;v++)c[0]+=this.grid[v][s-1].length+this.grid[v][s].length-1;if(a<this.grid.length-1)for(var v=s;v<=h;v++)c[1]+=this.grid[a+1][v].length+this.grid[a][v].length-1;if(h<this.grid[0].length-1)for(var v=o;v<=a;v++)c[2]+=this.grid[v][h+1].length+this.grid[v][h].length-1;if(o>0)for(var v=s;v<=h;v++)c[3]+=this.grid[o-1][v].length+this.grid[o][v].length-1;for(var A=B.MAX_VALUE,D,O,F=0;F<c.length;F++)c[F]<A?(A=c[F],D=1,O=F):c[F]==A&&D++;if(D==3&&A==0)c[0]==0&&c[1]==0&&c[2]==0?e=1:c[0]==0&&c[1]==0&&c[3]==0?e=0:c[0]==0&&c[2]==0&&c[3]==0?e=3:c[1]==0&&c[2]==0&&c[3]==0&&(e=2);else if(D==2&&A==0){var M=Math.floor(Math.random()*2);c[0]==0&&c[1]==0?M==0?e=0:e=1:c[0]==0&&c[2]==0?M==0?e=0:e=2:c[0]==0&&c[3]==0?M==0?e=0:e=3:c[1]==0&&c[2]==0?M==0?e=1:e=2:c[1]==0&&c[3]==0?M==0?e=1:e=3:M==0?e=2:e=3}else if(D==4&&A==0){var M=Math.floor(Math.random()*4);e=M}else e=O;e==0?i.setCenter(r.getCenterX(),r.getCenterY()-r.getHeight()/2-T.DEFAULT_EDGE_LENGTH-i.getHeight()/2):e==1?i.setCenter(r.getCenterX()+r.getWidth()/2+T.DEFAULT_EDGE_LENGTH+i.getWidth()/2,r.getCenterY()):e==2?i.setCenter(r.getCenterX(),r.getCenterY()+r.getHeight()/2+T.DEFAULT_EDGE_LENGTH+i.getHeight()/2):i.setCenter(r.getCenterX()-r.getWidth()/2-T.DEFAULT_EDGE_LENGTH-i.getWidth()/2,r.getCenterY())},y.exports=d}),(function(y,w,l){var n={};n.layoutBase=l(0),n.CoSEConstants=l(1),n.CoSEEdge=l(2),n.CoSEGraph=l(3),n.CoSEGraphManager=l(4),n.CoSELayout=l(6),n.CoSENode=l(5),y.exports=n})])})})(I.__module)),I.__module.exports}exports.__require=J;
|
|
2
2
|
//# sourceMappingURL=cose-base.cjs.map
|