markdown-flow-ui 0.2.21 → 0.2.22-dev.1
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.es3.js +5 -4
- package/dist/_virtual/index.es3.js.map +1 -1
- package/dist/_virtual/index.es4.js +4 -5
- package/dist/_virtual/index.es4.js.map +1 -1
- package/dist/_virtual/index3.cjs +1 -1
- package/dist/_virtual/index4.cjs +1 -1
- package/dist/assets/markdown-flow-ui.css +1 -1
- package/dist/components/Slide/Player.cjs +1 -1
- package/dist/components/Slide/Player.cjs.map +1 -1
- package/dist/components/Slide/Player.d.ts +3 -1
- package/dist/components/Slide/Player.es.js +457 -488
- package/dist/components/Slide/Player.es.js.map +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 +593 -584
- package/dist/components/Slide/Slide.es.js.map +1 -1
- package/dist/components/Slide/slideI18n.cjs.map +1 -1
- package/dist/components/Slide/slideI18n.d.ts +1 -0
- package/dist/components/Slide/slideI18n.es.js.map +1 -1
- package/dist/components/Slide/utils/interactionPlayback.cjs +1 -1
- package/dist/components/Slide/utils/interactionPlayback.cjs.map +1 -1
- package/dist/components/Slide/utils/interactionPlayback.d.ts +2 -1
- package/dist/components/Slide/utils/interactionPlayback.es.js +8 -7
- package/dist/components/Slide/utils/interactionPlayback.es.js.map +1 -1
- package/dist/components/Slide/utils/playerCustomActions.cjs +1 -1
- package/dist/components/Slide/utils/playerCustomActions.cjs.map +1 -1
- package/dist/components/Slide/utils/playerCustomActions.d.ts +1 -1
- package/dist/components/Slide/utils/playerCustomActions.es.js +18 -14
- package/dist/components/Slide/utils/playerCustomActions.es.js.map +1 -1
- package/dist/components/Slide/utils/playerKeyboardShortcuts.cjs +1 -1
- package/dist/components/Slide/utils/playerKeyboardShortcuts.cjs.map +1 -1
- package/dist/components/Slide/utils/playerKeyboardShortcuts.d.ts +1 -1
- package/dist/components/Slide/utils/playerKeyboardShortcuts.es.js +0 -2
- package/dist/components/Slide/utils/playerKeyboardShortcuts.es.js.map +1 -1
- package/dist/components/ui/inputGroup/textarea.cjs +1 -1
- package/dist/components/ui/inputGroup/textarea.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/dist/node_modules/rc-input/es/BaseInput.cjs +1 -1
- package/dist/node_modules/rc-input/es/BaseInput.es.js +1 -1
- package/dist/node_modules/rc-textarea/es/ResizableTextArea.cjs +1 -1
- package/dist/node_modules/rc-textarea/es/ResizableTextArea.es.js +1 -1
- package/dist/node_modules/rc-textarea/es/TextArea.cjs +1 -1
- package/dist/node_modules/rc-textarea/es/TextArea.es.js +1 -1
- package/dist/node_modules/rc-textarea/es/index.cjs +1 -1
- package/dist/node_modules/rc-textarea/es/index.es.js +1 -1
- package/dist/node_modules/remark-flow/dist/interaction-plugin-core.cjs +1 -1
- package/dist/node_modules/remark-flow/dist/interaction-plugin-core.es.js +1 -1
- package/package.json +1 -1
- package/dist/node_modules/lucide-react/dist/esm/icons/file-pen-line.cjs +0 -7
- package/dist/node_modules/lucide-react/dist/esm/icons/file-pen-line.cjs.map +0 -1
- package/dist/node_modules/lucide-react/dist/esm/icons/file-pen-line.es.js +0 -29
- package/dist/node_modules/lucide-react/dist/esm/icons/file-pen-line.es.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"slideI18n.cjs","sources":["../../../src/components/Slide/slideI18n.ts"],"sourcesContent":["import {\n normalizeMarkdownFlowLocale,\n type MarkdownFlowLocale,\n} from \"../../lib/locale\";\nimport localeTexts from \"./locales/slide.json\";\n\nexport interface SlidePlayerLocaleTexts {\n closeSettingsLabel: string;\n enterFullscreenLabel: string;\n exitFullscreenLabel: string;\n moreOptionsAriaLabel: string;\n nextLabel: string;\n nextSubtitleLabel: string;\n notesLabel: string;\n pauseAutoplayLabel: string;\n pauseLabel: string;\n playAutoplayLabel: string;\n playLabel: string;\n /** Display name of the spacebar in playback hints; does not change the key binding. */\n playbackShortcutLabel: string;\n previousLabel: string;\n previousSubtitleLabel: string;\n screenModeLabel: string;\n settingsTitle: string;\n subtitleLabel: string;\n subtitleToggleAriaLabel: string;\n volumeAriaLabel: string;\n screenLabel: string;\n nonFullscreenLabel: string;\n fullscreenLabel: string;\n fullscreenHintText: string;\n}\n\nexport interface SlideInteractionLocaleTexts {\n title: string;\n confirmButtonText: string;\n copyButtonText: string;\n copiedButtonText: string;\n dragHandleAriaLabel: string;\n}\n\nexport type SlideBufferingReason =\n | \"waitingForAudio\"\n | import(\"./Player\").SlidePlayerLoadingReason;\n\nexport interface SlideLocaleTexts {\n bufferingText: Record<SlideBufferingReason, string>;\n fullscreenBackAriaLabel: string;\n interactionTexts: SlideInteractionLocaleTexts;\n playerTexts: SlidePlayerLocaleTexts;\n}\n\nexport const SLIDE_LOCALE_TEXTS: Record<MarkdownFlowLocale, SlideLocaleTexts> =\n localeTexts;\n\nexport const DEFAULT_SLIDE_PLAYER_TEXTS: SlidePlayerLocaleTexts =\n SLIDE_LOCALE_TEXTS[\"en-US\"].playerTexts;\n\nexport const DEFAULT_SLIDE_INTERACTION_TEXTS: SlideInteractionLocaleTexts =\n SLIDE_LOCALE_TEXTS[\"en-US\"].interactionTexts;\n\nexport const DEFAULT_SLIDE_BUFFERING_TEXTS: Record<\n SlideBufferingReason,\n string\n> = SLIDE_LOCALE_TEXTS[\"en-US\"].bufferingText;\n\nexport const getSlideLocaleTexts = (locale?: string | null): SlideLocaleTexts =>\n SLIDE_LOCALE_TEXTS[normalizeMarkdownFlowLocale(locale)];\n\nexport const getSlidePlayerTexts = (\n locale?: string | null\n): SlidePlayerLocaleTexts => getSlideLocaleTexts(locale).playerTexts;\n"],"names":["SLIDE_LOCALE_TEXTS","localeTexts","DEFAULT_SLIDE_BUFFERING_TEXTS","getSlideLocaleTexts","locale","normalizeMarkdownFlowLocale","getSlidePlayerTexts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"slideI18n.cjs","sources":["../../../src/components/Slide/slideI18n.ts"],"sourcesContent":["import {\n normalizeMarkdownFlowLocale,\n type MarkdownFlowLocale,\n} from \"../../lib/locale\";\nimport localeTexts from \"./locales/slide.json\";\n\nexport interface SlidePlayerLocaleTexts {\n closeSettingsLabel: string;\n enterFullscreenLabel: string;\n exitFullscreenLabel: string;\n moreOptionsAriaLabel: string;\n nextLabel: string;\n nextSubtitleLabel: string;\n /** @deprecated The player no longer renders a manual interaction action. */\n notesLabel: string;\n pauseAutoplayLabel: string;\n pauseLabel: string;\n playAutoplayLabel: string;\n playLabel: string;\n /** Display name of the spacebar in playback hints; does not change the key binding. */\n playbackShortcutLabel: string;\n previousLabel: string;\n previousSubtitleLabel: string;\n screenModeLabel: string;\n settingsTitle: string;\n subtitleLabel: string;\n subtitleToggleAriaLabel: string;\n volumeAriaLabel: string;\n screenLabel: string;\n nonFullscreenLabel: string;\n fullscreenLabel: string;\n fullscreenHintText: string;\n}\n\nexport interface SlideInteractionLocaleTexts {\n title: string;\n confirmButtonText: string;\n copyButtonText: string;\n copiedButtonText: string;\n dragHandleAriaLabel: string;\n}\n\nexport type SlideBufferingReason =\n | \"waitingForAudio\"\n | import(\"./Player\").SlidePlayerLoadingReason;\n\nexport interface SlideLocaleTexts {\n bufferingText: Record<SlideBufferingReason, string>;\n fullscreenBackAriaLabel: string;\n interactionTexts: SlideInteractionLocaleTexts;\n playerTexts: SlidePlayerLocaleTexts;\n}\n\nexport const SLIDE_LOCALE_TEXTS: Record<MarkdownFlowLocale, SlideLocaleTexts> =\n localeTexts;\n\nexport const DEFAULT_SLIDE_PLAYER_TEXTS: SlidePlayerLocaleTexts =\n SLIDE_LOCALE_TEXTS[\"en-US\"].playerTexts;\n\nexport const DEFAULT_SLIDE_INTERACTION_TEXTS: SlideInteractionLocaleTexts =\n SLIDE_LOCALE_TEXTS[\"en-US\"].interactionTexts;\n\nexport const DEFAULT_SLIDE_BUFFERING_TEXTS: Record<\n SlideBufferingReason,\n string\n> = SLIDE_LOCALE_TEXTS[\"en-US\"].bufferingText;\n\nexport const getSlideLocaleTexts = (locale?: string | null): SlideLocaleTexts =>\n SLIDE_LOCALE_TEXTS[normalizeMarkdownFlowLocale(locale)];\n\nexport const getSlidePlayerTexts = (\n locale?: string | null\n): SlidePlayerLocaleTexts => getSlideLocaleTexts(locale).playerTexts;\n"],"names":["SLIDE_LOCALE_TEXTS","localeTexts","DEFAULT_SLIDE_BUFFERING_TEXTS","getSlideLocaleTexts","locale","normalizeMarkdownFlowLocale","getSlidePlayerTexts"],"mappings":"8JAqDaA,EACXC,EAAAA,QAGAD,EAAmB,OAAO,EAAE,YAG5BA,EAAmB,OAAO,EAAE,iBAEvB,MAAME,EAGTF,EAAmB,OAAO,EAAE,cAEnBG,EAAuBC,GAClCJ,EAAmBK,EAAAA,4BAA4BD,CAAM,CAAC,EAE3CE,EACXF,GAC2BD,EAAoBC,CAAM,EAAE"}
|
|
@@ -6,6 +6,7 @@ export interface SlidePlayerLocaleTexts {
|
|
|
6
6
|
moreOptionsAriaLabel: string;
|
|
7
7
|
nextLabel: string;
|
|
8
8
|
nextSubtitleLabel: string;
|
|
9
|
+
/** @deprecated The player no longer renders a manual interaction action. */
|
|
9
10
|
notesLabel: string;
|
|
10
11
|
pauseAutoplayLabel: string;
|
|
11
12
|
pauseLabel: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"slideI18n.es.js","sources":["../../../src/components/Slide/slideI18n.ts"],"sourcesContent":["import {\n normalizeMarkdownFlowLocale,\n type MarkdownFlowLocale,\n} from \"../../lib/locale\";\nimport localeTexts from \"./locales/slide.json\";\n\nexport interface SlidePlayerLocaleTexts {\n closeSettingsLabel: string;\n enterFullscreenLabel: string;\n exitFullscreenLabel: string;\n moreOptionsAriaLabel: string;\n nextLabel: string;\n nextSubtitleLabel: string;\n notesLabel: string;\n pauseAutoplayLabel: string;\n pauseLabel: string;\n playAutoplayLabel: string;\n playLabel: string;\n /** Display name of the spacebar in playback hints; does not change the key binding. */\n playbackShortcutLabel: string;\n previousLabel: string;\n previousSubtitleLabel: string;\n screenModeLabel: string;\n settingsTitle: string;\n subtitleLabel: string;\n subtitleToggleAriaLabel: string;\n volumeAriaLabel: string;\n screenLabel: string;\n nonFullscreenLabel: string;\n fullscreenLabel: string;\n fullscreenHintText: string;\n}\n\nexport interface SlideInteractionLocaleTexts {\n title: string;\n confirmButtonText: string;\n copyButtonText: string;\n copiedButtonText: string;\n dragHandleAriaLabel: string;\n}\n\nexport type SlideBufferingReason =\n | \"waitingForAudio\"\n | import(\"./Player\").SlidePlayerLoadingReason;\n\nexport interface SlideLocaleTexts {\n bufferingText: Record<SlideBufferingReason, string>;\n fullscreenBackAriaLabel: string;\n interactionTexts: SlideInteractionLocaleTexts;\n playerTexts: SlidePlayerLocaleTexts;\n}\n\nexport const SLIDE_LOCALE_TEXTS: Record<MarkdownFlowLocale, SlideLocaleTexts> =\n localeTexts;\n\nexport const DEFAULT_SLIDE_PLAYER_TEXTS: SlidePlayerLocaleTexts =\n SLIDE_LOCALE_TEXTS[\"en-US\"].playerTexts;\n\nexport const DEFAULT_SLIDE_INTERACTION_TEXTS: SlideInteractionLocaleTexts =\n SLIDE_LOCALE_TEXTS[\"en-US\"].interactionTexts;\n\nexport const DEFAULT_SLIDE_BUFFERING_TEXTS: Record<\n SlideBufferingReason,\n string\n> = SLIDE_LOCALE_TEXTS[\"en-US\"].bufferingText;\n\nexport const getSlideLocaleTexts = (locale?: string | null): SlideLocaleTexts =>\n SLIDE_LOCALE_TEXTS[normalizeMarkdownFlowLocale(locale)];\n\nexport const getSlidePlayerTexts = (\n locale?: string | null\n): SlidePlayerLocaleTexts => getSlideLocaleTexts(locale).playerTexts;\n"],"names":["SLIDE_LOCALE_TEXTS","localeTexts","DEFAULT_SLIDE_BUFFERING_TEXTS","getSlideLocaleTexts","locale","normalizeMarkdownFlowLocale","getSlidePlayerTexts"],"mappings":";;
|
|
1
|
+
{"version":3,"file":"slideI18n.es.js","sources":["../../../src/components/Slide/slideI18n.ts"],"sourcesContent":["import {\n normalizeMarkdownFlowLocale,\n type MarkdownFlowLocale,\n} from \"../../lib/locale\";\nimport localeTexts from \"./locales/slide.json\";\n\nexport interface SlidePlayerLocaleTexts {\n closeSettingsLabel: string;\n enterFullscreenLabel: string;\n exitFullscreenLabel: string;\n moreOptionsAriaLabel: string;\n nextLabel: string;\n nextSubtitleLabel: string;\n /** @deprecated The player no longer renders a manual interaction action. */\n notesLabel: string;\n pauseAutoplayLabel: string;\n pauseLabel: string;\n playAutoplayLabel: string;\n playLabel: string;\n /** Display name of the spacebar in playback hints; does not change the key binding. */\n playbackShortcutLabel: string;\n previousLabel: string;\n previousSubtitleLabel: string;\n screenModeLabel: string;\n settingsTitle: string;\n subtitleLabel: string;\n subtitleToggleAriaLabel: string;\n volumeAriaLabel: string;\n screenLabel: string;\n nonFullscreenLabel: string;\n fullscreenLabel: string;\n fullscreenHintText: string;\n}\n\nexport interface SlideInteractionLocaleTexts {\n title: string;\n confirmButtonText: string;\n copyButtonText: string;\n copiedButtonText: string;\n dragHandleAriaLabel: string;\n}\n\nexport type SlideBufferingReason =\n | \"waitingForAudio\"\n | import(\"./Player\").SlidePlayerLoadingReason;\n\nexport interface SlideLocaleTexts {\n bufferingText: Record<SlideBufferingReason, string>;\n fullscreenBackAriaLabel: string;\n interactionTexts: SlideInteractionLocaleTexts;\n playerTexts: SlidePlayerLocaleTexts;\n}\n\nexport const SLIDE_LOCALE_TEXTS: Record<MarkdownFlowLocale, SlideLocaleTexts> =\n localeTexts;\n\nexport const DEFAULT_SLIDE_PLAYER_TEXTS: SlidePlayerLocaleTexts =\n SLIDE_LOCALE_TEXTS[\"en-US\"].playerTexts;\n\nexport const DEFAULT_SLIDE_INTERACTION_TEXTS: SlideInteractionLocaleTexts =\n SLIDE_LOCALE_TEXTS[\"en-US\"].interactionTexts;\n\nexport const DEFAULT_SLIDE_BUFFERING_TEXTS: Record<\n SlideBufferingReason,\n string\n> = SLIDE_LOCALE_TEXTS[\"en-US\"].bufferingText;\n\nexport const getSlideLocaleTexts = (locale?: string | null): SlideLocaleTexts =>\n SLIDE_LOCALE_TEXTS[normalizeMarkdownFlowLocale(locale)];\n\nexport const getSlidePlayerTexts = (\n locale?: string | null\n): SlidePlayerLocaleTexts => getSlideLocaleTexts(locale).playerTexts;\n"],"names":["SLIDE_LOCALE_TEXTS","localeTexts","DEFAULT_SLIDE_BUFFERING_TEXTS","getSlideLocaleTexts","locale","normalizeMarkdownFlowLocale","getSlidePlayerTexts"],"mappings":";;AAqDO,MAAMA,IACXC;AAGAD,EAAmB,OAAO,EAAE;AAG5BA,EAAmB,OAAO,EAAE;AAEvB,MAAME,IAGTF,EAAmB,OAAO,EAAE,eAEnBG,IAAsB,CAACC,MAClCJ,EAAmBK,EAA4BD,CAAM,CAAC,GAE3CE,IAAsB,CACjCF,MAC2BD,EAAoBC,CAAM,EAAE;"}
|
|
@@ -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 c=({hasInteraction:r,shouldBlockPlaybackForInteraction:e,shouldOpenInteractionOverlayAfterAudio:t,hasPlaybackContextChanged:a,hasResolvedCurrentInteraction:l,currentStepHasSpeakableElement:i,isPlayerCustomActionActive:u})=>!r||u?!1:e||t||a?!0:l?!i:!1,o=({hasActiveInteraction:r,isInteractionOverlayOpen:e})=>!(!r||!e),n=(r,e,t)=>Math.min(Math.max(r,e),t),s=(r,e)=>({x:n(r.x,e.minX,e.maxX),y:n(r.y,e.minY,e.maxY)});exports.clampInteractionOverlayDragOffset=s;exports.shouldPresentInteractionOverlay=c;exports.shouldRenderInteractionOverlay=o;
|
|
2
2
|
//# sourceMappingURL=interactionPlayback.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interactionPlayback.cjs","sources":["../../../../src/components/Slide/utils/interactionPlayback.ts"],"sourcesContent":["interface ShouldPresentInteractionOverlayParams {\n hasInteraction: boolean;\n shouldBlockPlaybackForInteraction: boolean;\n shouldOpenInteractionOverlayAfterAudio: boolean;\n hasPlaybackContextChanged: boolean;\n hasResolvedCurrentInteraction: boolean;\n currentStepHasSpeakableElement: boolean;\n}\n\nexport const shouldPresentInteractionOverlay = ({\n hasInteraction,\n shouldBlockPlaybackForInteraction,\n shouldOpenInteractionOverlayAfterAudio,\n hasPlaybackContextChanged,\n hasResolvedCurrentInteraction,\n currentStepHasSpeakableElement,\n}: ShouldPresentInteractionOverlayParams) => {\n if (!hasInteraction) {\n return false;\n }\n\n if (shouldBlockPlaybackForInteraction) {\n return true;\n }\n\n if (shouldOpenInteractionOverlayAfterAudio) {\n return true;\n }\n\n // Re-open the interaction entry state whenever playback navigates into\n //
|
|
1
|
+
{"version":3,"file":"interactionPlayback.cjs","sources":["../../../../src/components/Slide/utils/interactionPlayback.ts"],"sourcesContent":["interface ShouldPresentInteractionOverlayParams {\n hasInteraction: boolean;\n shouldBlockPlaybackForInteraction: boolean;\n shouldOpenInteractionOverlayAfterAudio: boolean;\n hasPlaybackContextChanged: boolean;\n hasResolvedCurrentInteraction: boolean;\n currentStepHasSpeakableElement: boolean;\n isPlayerCustomActionActive: boolean;\n}\n\nexport const shouldPresentInteractionOverlay = ({\n hasInteraction,\n shouldBlockPlaybackForInteraction,\n shouldOpenInteractionOverlayAfterAudio,\n hasPlaybackContextChanged,\n hasResolvedCurrentInteraction,\n currentStepHasSpeakableElement,\n isPlayerCustomActionActive,\n}: ShouldPresentInteractionOverlayParams) => {\n if (!hasInteraction || isPlayerCustomActionActive) {\n return false;\n }\n\n if (shouldBlockPlaybackForInteraction) {\n return true;\n }\n\n if (shouldOpenInteractionOverlayAfterAudio) {\n return true;\n }\n\n // Re-open the interaction entry state whenever playback navigates into the\n // interaction step so history and manual prev/next navigation surface it.\n if (hasPlaybackContextChanged) {\n return true;\n }\n\n if (!hasResolvedCurrentInteraction) {\n return false;\n }\n\n // Once a resolved interaction step starts receiving follow-up speech,\n // keep the overlay closed so the step can continue as normal playback.\n return !currentStepHasSpeakableElement;\n};\n\nexport interface ShouldRenderInteractionOverlayParams {\n hasActiveInteraction: boolean;\n isInteractionOverlayOpen: boolean;\n}\n\nexport const shouldRenderInteractionOverlay = ({\n hasActiveInteraction,\n isInteractionOverlayOpen,\n}: ShouldRenderInteractionOverlayParams) => {\n if (!hasActiveInteraction || !isInteractionOverlayOpen) {\n return false;\n }\n\n return true;\n};\n\nexport interface InteractionOverlayDragOffset {\n x: number;\n y: number;\n}\n\nexport interface InteractionOverlayDragBounds {\n minX: number;\n maxX: number;\n minY: number;\n maxY: number;\n}\n\nconst clampNumber = (value: number, min: number, max: number) =>\n Math.min(Math.max(value, min), max);\n\nexport const clampInteractionOverlayDragOffset = (\n offset: InteractionOverlayDragOffset,\n bounds: InteractionOverlayDragBounds\n): InteractionOverlayDragOffset => ({\n x: clampNumber(offset.x, bounds.minX, bounds.maxX),\n y: clampNumber(offset.y, bounds.minY, bounds.maxY),\n});\n"],"names":["shouldPresentInteractionOverlay","hasInteraction","shouldBlockPlaybackForInteraction","shouldOpenInteractionOverlayAfterAudio","hasPlaybackContextChanged","hasResolvedCurrentInteraction","currentStepHasSpeakableElement","isPlayerCustomActionActive","shouldRenderInteractionOverlay","hasActiveInteraction","isInteractionOverlayOpen","clampNumber","value","min","max","clampInteractionOverlayDragOffset","offset","bounds"],"mappings":"gFAUO,MAAMA,EAAkC,CAAC,CAC9C,eAAAC,EACA,kCAAAC,EACA,uCAAAC,EACA,0BAAAC,EACA,8BAAAC,EACA,+BAAAC,EACA,2BAAAC,CACF,IACM,CAACN,GAAkBM,EACd,GAGLL,GAIAC,GAMAC,EACK,GAGJC,EAME,CAACC,EALC,GAaEE,EAAiC,CAAC,CAC7C,qBAAAC,EACA,yBAAAC,CACF,IACM,GAACD,GAAwB,CAACC,GAmB1BC,EAAc,CAACC,EAAeC,EAAaC,IAC/C,KAAK,IAAI,KAAK,IAAIF,EAAOC,CAAG,EAAGC,CAAG,EAEvBC,EAAoC,CAC/CC,EACAC,KACkC,CAClC,EAAGN,EAAYK,EAAO,EAAGC,EAAO,KAAMA,EAAO,IAAI,EACjD,EAAGN,EAAYK,EAAO,EAAGC,EAAO,KAAMA,EAAO,IAAI,CACnD"}
|
|
@@ -5,8 +5,9 @@ interface ShouldPresentInteractionOverlayParams {
|
|
|
5
5
|
hasPlaybackContextChanged: boolean;
|
|
6
6
|
hasResolvedCurrentInteraction: boolean;
|
|
7
7
|
currentStepHasSpeakableElement: boolean;
|
|
8
|
+
isPlayerCustomActionActive: boolean;
|
|
8
9
|
}
|
|
9
|
-
export declare const shouldPresentInteractionOverlay: ({ hasInteraction, shouldBlockPlaybackForInteraction, shouldOpenInteractionOverlayAfterAudio, hasPlaybackContextChanged, hasResolvedCurrentInteraction, currentStepHasSpeakableElement, }: ShouldPresentInteractionOverlayParams) => boolean;
|
|
10
|
+
export declare const shouldPresentInteractionOverlay: ({ hasInteraction, shouldBlockPlaybackForInteraction, shouldOpenInteractionOverlayAfterAudio, hasPlaybackContextChanged, hasResolvedCurrentInteraction, currentStepHasSpeakableElement, isPlayerCustomActionActive, }: ShouldPresentInteractionOverlayParams) => boolean;
|
|
10
11
|
export interface ShouldRenderInteractionOverlayParams {
|
|
11
12
|
hasActiveInteraction: boolean;
|
|
12
13
|
isInteractionOverlayOpen: boolean;
|
|
@@ -1,20 +1,21 @@
|
|
|
1
|
-
const
|
|
1
|
+
const c = ({
|
|
2
2
|
hasInteraction: e,
|
|
3
3
|
shouldBlockPlaybackForInteraction: r,
|
|
4
4
|
shouldOpenInteractionOverlayAfterAudio: t,
|
|
5
5
|
hasPlaybackContextChanged: a,
|
|
6
6
|
hasResolvedCurrentInteraction: i,
|
|
7
|
-
currentStepHasSpeakableElement: u
|
|
8
|
-
|
|
7
|
+
currentStepHasSpeakableElement: u,
|
|
8
|
+
isPlayerCustomActionActive: l
|
|
9
|
+
}) => !e || l ? !1 : r || t || a ? !0 : i ? !u : !1, f = ({
|
|
9
10
|
hasActiveInteraction: e,
|
|
10
11
|
isInteractionOverlayOpen: r
|
|
11
|
-
}) => !(!e || !r), n = (e, r, t) => Math.min(Math.max(e, r), t),
|
|
12
|
+
}) => !(!e || !r), n = (e, r, t) => Math.min(Math.max(e, r), t), m = (e, r) => ({
|
|
12
13
|
x: n(e.x, r.minX, r.maxX),
|
|
13
14
|
y: n(e.y, r.minY, r.maxY)
|
|
14
15
|
});
|
|
15
16
|
export {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
m as clampInteractionOverlayDragOffset,
|
|
18
|
+
c as shouldPresentInteractionOverlay,
|
|
19
|
+
f as shouldRenderInteractionOverlay
|
|
19
20
|
};
|
|
20
21
|
//# sourceMappingURL=interactionPlayback.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interactionPlayback.es.js","sources":["../../../../src/components/Slide/utils/interactionPlayback.ts"],"sourcesContent":["interface ShouldPresentInteractionOverlayParams {\n hasInteraction: boolean;\n shouldBlockPlaybackForInteraction: boolean;\n shouldOpenInteractionOverlayAfterAudio: boolean;\n hasPlaybackContextChanged: boolean;\n hasResolvedCurrentInteraction: boolean;\n currentStepHasSpeakableElement: boolean;\n}\n\nexport const shouldPresentInteractionOverlay = ({\n hasInteraction,\n shouldBlockPlaybackForInteraction,\n shouldOpenInteractionOverlayAfterAudio,\n hasPlaybackContextChanged,\n hasResolvedCurrentInteraction,\n currentStepHasSpeakableElement,\n}: ShouldPresentInteractionOverlayParams) => {\n if (!hasInteraction) {\n return false;\n }\n\n if (shouldBlockPlaybackForInteraction) {\n return true;\n }\n\n if (shouldOpenInteractionOverlayAfterAudio) {\n return true;\n }\n\n // Re-open the interaction entry state whenever playback navigates into\n //
|
|
1
|
+
{"version":3,"file":"interactionPlayback.es.js","sources":["../../../../src/components/Slide/utils/interactionPlayback.ts"],"sourcesContent":["interface ShouldPresentInteractionOverlayParams {\n hasInteraction: boolean;\n shouldBlockPlaybackForInteraction: boolean;\n shouldOpenInteractionOverlayAfterAudio: boolean;\n hasPlaybackContextChanged: boolean;\n hasResolvedCurrentInteraction: boolean;\n currentStepHasSpeakableElement: boolean;\n isPlayerCustomActionActive: boolean;\n}\n\nexport const shouldPresentInteractionOverlay = ({\n hasInteraction,\n shouldBlockPlaybackForInteraction,\n shouldOpenInteractionOverlayAfterAudio,\n hasPlaybackContextChanged,\n hasResolvedCurrentInteraction,\n currentStepHasSpeakableElement,\n isPlayerCustomActionActive,\n}: ShouldPresentInteractionOverlayParams) => {\n if (!hasInteraction || isPlayerCustomActionActive) {\n return false;\n }\n\n if (shouldBlockPlaybackForInteraction) {\n return true;\n }\n\n if (shouldOpenInteractionOverlayAfterAudio) {\n return true;\n }\n\n // Re-open the interaction entry state whenever playback navigates into the\n // interaction step so history and manual prev/next navigation surface it.\n if (hasPlaybackContextChanged) {\n return true;\n }\n\n if (!hasResolvedCurrentInteraction) {\n return false;\n }\n\n // Once a resolved interaction step starts receiving follow-up speech,\n // keep the overlay closed so the step can continue as normal playback.\n return !currentStepHasSpeakableElement;\n};\n\nexport interface ShouldRenderInteractionOverlayParams {\n hasActiveInteraction: boolean;\n isInteractionOverlayOpen: boolean;\n}\n\nexport const shouldRenderInteractionOverlay = ({\n hasActiveInteraction,\n isInteractionOverlayOpen,\n}: ShouldRenderInteractionOverlayParams) => {\n if (!hasActiveInteraction || !isInteractionOverlayOpen) {\n return false;\n }\n\n return true;\n};\n\nexport interface InteractionOverlayDragOffset {\n x: number;\n y: number;\n}\n\nexport interface InteractionOverlayDragBounds {\n minX: number;\n maxX: number;\n minY: number;\n maxY: number;\n}\n\nconst clampNumber = (value: number, min: number, max: number) =>\n Math.min(Math.max(value, min), max);\n\nexport const clampInteractionOverlayDragOffset = (\n offset: InteractionOverlayDragOffset,\n bounds: InteractionOverlayDragBounds\n): InteractionOverlayDragOffset => ({\n x: clampNumber(offset.x, bounds.minX, bounds.maxX),\n y: clampNumber(offset.y, bounds.minY, bounds.maxY),\n});\n"],"names":["shouldPresentInteractionOverlay","hasInteraction","shouldBlockPlaybackForInteraction","shouldOpenInteractionOverlayAfterAudio","hasPlaybackContextChanged","hasResolvedCurrentInteraction","currentStepHasSpeakableElement","isPlayerCustomActionActive","shouldRenderInteractionOverlay","hasActiveInteraction","isInteractionOverlayOpen","clampNumber","value","min","max","clampInteractionOverlayDragOffset","offset","bounds"],"mappings":"AAUO,MAAMA,IAAkC,CAAC;AAAA,EAC9C,gBAAAC;AAAA,EACA,mCAAAC;AAAA,EACA,wCAAAC;AAAA,EACA,2BAAAC;AAAA,EACA,+BAAAC;AAAA,EACA,gCAAAC;AAAA,EACA,4BAAAC;AACF,MACM,CAACN,KAAkBM,IACd,KAGLL,KAIAC,KAMAC,IACK,KAGJC,IAME,CAACC,IALC,IAaEE,IAAiC,CAAC;AAAA,EAC7C,sBAAAC;AAAA,EACA,0BAAAC;AACF,MACM,GAACD,KAAwB,CAACC,IAmB1BC,IAAc,CAACC,GAAeC,GAAaC,MAC/C,KAAK,IAAI,KAAK,IAAIF,GAAOC,CAAG,GAAGC,CAAG,GAEvBC,IAAoC,CAC/CC,GACAC,OACkC;AAAA,EAClC,GAAGN,EAAYK,EAAO,GAAGC,EAAO,MAAMA,EAAO,IAAI;AAAA,EACjD,GAAGN,EAAYK,EAAO,GAAGC,EAAO,MAAMA,EAAO,IAAI;AACnD;"}
|
|
@@ -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 n=require("react"),l=()=>{},y={currentElement:void 0,currentIndex:-1,currentStepElement:void 0,isActive:!1,setActive:l,toggleActive:l},C=(e,t=y)=>typeof e=="function"?e(t):e,s=e=>n.Children.toArray(e).flatMap(t=>n.isValidElement(t)&&t.type===n.Fragment?s(t.props.children):t),d=({currentAudioIndex:e,currentAudioSequenceIndexes:t,audioList:o,currentStepElement:i,currentInteractionElement:u})=>{const a=e>=0?o[e]?.element:void 0,r=t[0],m=typeof r=="number"?o[r]?.element:void 0;return a??m??u??i},c=(e,t)=>s(C(e,t)),A=(e,t)=>c(e,t).length;exports.getPlayerCustomActionCount=A;exports.resolvePlayerCustomActionElement=d;exports.toPlayerCustomActionList=c;
|
|
2
2
|
//# sourceMappingURL=playerCustomActions.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"playerCustomActions.cjs","sources":["../../../../src/components/Slide/utils/playerCustomActions.ts"],"sourcesContent":["import React from \"react\";\nimport type {\n Element,\n SlidePlayerCustomActionContext,\n SlidePlayerCustomActions,\n} from \"../types\";\nimport type { SlideAudioItem } from \"../useSlide\";\n\nconst noop = () => {};\n\nconst DEFAULT_PLAYER_CUSTOM_ACTION_CONTEXT: SlidePlayerCustomActionContext = {\n currentElement: undefined,\n currentIndex: -1,\n currentStepElement: undefined,\n isActive: false,\n setActive: noop,\n toggleActive: noop,\n};\n\nconst resolvePlayerCustomActions = (\n customActions?: SlidePlayerCustomActions,\n context: SlidePlayerCustomActionContext = DEFAULT_PLAYER_CUSTOM_ACTION_CONTEXT\n) =>\n typeof customActions === \"function\" ? customActions(context) : customActions;\n\ntype ResolvePlayerCustomActionElementParams = {\n currentAudioIndex: number;\n currentAudioSequenceIndexes: number[];\n audioList: SlideAudioItem[];\n currentStepElement?: Element;\n currentInteractionElement?: Element;\n};\n\nexport const resolvePlayerCustomActionElement = ({\n currentAudioIndex,\n currentAudioSequenceIndexes,\n audioList,\n currentStepElement,\n currentInteractionElement,\n}: ResolvePlayerCustomActionElementParams) => {\n const currentAudioElement =\n currentAudioIndex >= 0 ? audioList[currentAudioIndex]?.element : undefined;\n const currentSequenceAudioIndex = currentAudioSequenceIndexes[0];\n const currentSequenceAudioElement =\n typeof currentSequenceAudioIndex === \"number\"\n ? audioList[currentSequenceAudioIndex]?.element\n : undefined;\n\n return (\n currentAudioElement ??\n currentSequenceAudioElement ??\n currentInteractionElement ??\n currentStepElement\n );\n};\n\nexport const toPlayerCustomActionList = (\n customActions?: SlidePlayerCustomActions,\n context?: SlidePlayerCustomActionContext\n)
|
|
1
|
+
{"version":3,"file":"playerCustomActions.cjs","sources":["../../../../src/components/Slide/utils/playerCustomActions.ts"],"sourcesContent":["import React from \"react\";\nimport type {\n Element,\n SlidePlayerCustomActionContext,\n SlidePlayerCustomActions,\n} from \"../types\";\nimport type { SlideAudioItem } from \"../useSlide\";\n\nconst noop = () => {};\n\nconst DEFAULT_PLAYER_CUSTOM_ACTION_CONTEXT: SlidePlayerCustomActionContext = {\n currentElement: undefined,\n currentIndex: -1,\n currentStepElement: undefined,\n isActive: false,\n setActive: noop,\n toggleActive: noop,\n};\n\nconst resolvePlayerCustomActions = (\n customActions?: SlidePlayerCustomActions,\n context: SlidePlayerCustomActionContext = DEFAULT_PLAYER_CUSTOM_ACTION_CONTEXT\n) =>\n typeof customActions === \"function\" ? customActions(context) : customActions;\n\nconst toRenderablePlayerCustomActionList = (\n customActions: React.ReactNode\n): React.ReactNode[] =>\n React.Children.toArray(customActions).flatMap((customAction) => {\n if (\n React.isValidElement(customAction) &&\n customAction.type === React.Fragment\n ) {\n return toRenderablePlayerCustomActionList(\n (customAction.props as { children?: React.ReactNode }).children\n );\n }\n\n return customAction;\n });\n\ntype ResolvePlayerCustomActionElementParams = {\n currentAudioIndex: number;\n currentAudioSequenceIndexes: number[];\n audioList: SlideAudioItem[];\n currentStepElement?: Element;\n currentInteractionElement?: Element;\n};\n\nexport const resolvePlayerCustomActionElement = ({\n currentAudioIndex,\n currentAudioSequenceIndexes,\n audioList,\n currentStepElement,\n currentInteractionElement,\n}: ResolvePlayerCustomActionElementParams) => {\n const currentAudioElement =\n currentAudioIndex >= 0 ? audioList[currentAudioIndex]?.element : undefined;\n const currentSequenceAudioIndex = currentAudioSequenceIndexes[0];\n const currentSequenceAudioElement =\n typeof currentSequenceAudioIndex === \"number\"\n ? audioList[currentSequenceAudioIndex]?.element\n : undefined;\n\n return (\n currentAudioElement ??\n currentSequenceAudioElement ??\n currentInteractionElement ??\n currentStepElement\n );\n};\n\nexport const toPlayerCustomActionList = (\n customActions?: SlidePlayerCustomActions,\n context?: SlidePlayerCustomActionContext\n) =>\n toRenderablePlayerCustomActionList(\n resolvePlayerCustomActions(customActions, context)\n );\n\nexport const getPlayerCustomActionCount = (\n customActions?: SlidePlayerCustomActions,\n context?: SlidePlayerCustomActionContext\n) => toPlayerCustomActionList(customActions, context).length;\n"],"names":["noop","DEFAULT_PLAYER_CUSTOM_ACTION_CONTEXT","resolvePlayerCustomActions","customActions","context","toRenderablePlayerCustomActionList","React","customAction","resolvePlayerCustomActionElement","currentAudioIndex","currentAudioSequenceIndexes","audioList","currentStepElement","currentInteractionElement","currentAudioElement","currentSequenceAudioIndex","currentSequenceAudioElement","toPlayerCustomActionList","getPlayerCustomActionCount"],"mappings":"yGAQMA,EAAO,IAAM,CAAC,EAEdC,EAAuE,CAC3E,eAAgB,OAChB,aAAc,GACd,mBAAoB,OACpB,SAAU,GACV,UAAWD,EACX,aAAcA,CAChB,EAEME,EAA6B,CACjCC,EACAC,EAA0CH,IAE1C,OAAOE,GAAkB,WAAaA,EAAcC,CAAO,EAAID,EAE3DE,EACJF,GAEAG,EAAM,SAAS,QAAQH,CAAa,EAAE,QAASI,GAE3CD,EAAM,eAAeC,CAAY,GACjCA,EAAa,OAASD,EAAM,SAErBD,EACJE,EAAa,MAAyC,QAAA,EAIpDA,CACR,EAUUC,EAAmC,CAAC,CAC/C,kBAAAC,EACA,4BAAAC,EACA,UAAAC,EACA,mBAAAC,EACA,0BAAAC,CACF,IAA8C,CAC5C,MAAMC,EACJL,GAAqB,EAAIE,EAAUF,CAAiB,GAAG,QAAU,OAC7DM,EAA4BL,EAA4B,CAAC,EACzDM,EACJ,OAAOD,GAA8B,SACjCJ,EAAUI,CAAyB,GAAG,QACtC,OAEN,OACED,GACAE,GACAH,GACAD,CAEJ,EAEaK,EAA2B,CACtCd,EACAC,IAEAC,EACEH,EAA2BC,EAAeC,CAAO,CACnD,EAEWc,EAA6B,CACxCf,EACAC,IACGa,EAAyBd,EAAeC,CAAO,EAAE"}
|
|
@@ -9,6 +9,6 @@ type ResolvePlayerCustomActionElementParams = {
|
|
|
9
9
|
currentInteractionElement?: Element;
|
|
10
10
|
};
|
|
11
11
|
export declare const resolvePlayerCustomActionElement: ({ currentAudioIndex, currentAudioSequenceIndexes, audioList, currentStepElement, currentInteractionElement, }: ResolvePlayerCustomActionElementParams) => Element | undefined;
|
|
12
|
-
export declare const toPlayerCustomActionList: (customActions?: SlidePlayerCustomActions, context?: SlidePlayerCustomActionContext) =>
|
|
12
|
+
export declare const toPlayerCustomActionList: (customActions?: SlidePlayerCustomActions, context?: SlidePlayerCustomActionContext) => React.ReactNode[];
|
|
13
13
|
export declare const getPlayerCustomActionCount: (customActions?: SlidePlayerCustomActions, context?: SlidePlayerCustomActionContext) => number;
|
|
14
14
|
export {};
|
|
@@ -1,25 +1,29 @@
|
|
|
1
|
-
import
|
|
2
|
-
const
|
|
1
|
+
import n from "react";
|
|
2
|
+
const l = () => {
|
|
3
3
|
}, m = {
|
|
4
4
|
currentElement: void 0,
|
|
5
5
|
currentIndex: -1,
|
|
6
6
|
currentStepElement: void 0,
|
|
7
7
|
isActive: !1,
|
|
8
|
-
setActive:
|
|
9
|
-
toggleActive:
|
|
10
|
-
},
|
|
8
|
+
setActive: l,
|
|
9
|
+
toggleActive: l
|
|
10
|
+
}, d = (e, t = m) => typeof e == "function" ? e(t) : e, c = (e) => n.Children.toArray(e).flatMap((t) => n.isValidElement(t) && t.type === n.Fragment ? c(
|
|
11
|
+
t.props.children
|
|
12
|
+
) : t), v = ({
|
|
11
13
|
currentAudioIndex: e,
|
|
12
14
|
currentAudioSequenceIndexes: t,
|
|
13
|
-
audioList:
|
|
14
|
-
currentStepElement:
|
|
15
|
-
currentInteractionElement:
|
|
15
|
+
audioList: r,
|
|
16
|
+
currentStepElement: i,
|
|
17
|
+
currentInteractionElement: s
|
|
16
18
|
}) => {
|
|
17
|
-
const
|
|
18
|
-
return
|
|
19
|
-
},
|
|
19
|
+
const u = e >= 0 ? r[e]?.element : void 0, o = t[0], a = typeof o == "number" ? r[o]?.element : void 0;
|
|
20
|
+
return u ?? a ?? s ?? i;
|
|
21
|
+
}, p = (e, t) => c(
|
|
22
|
+
d(e, t)
|
|
23
|
+
), y = (e, t) => p(e, t).length;
|
|
20
24
|
export {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
25
|
+
y as getPlayerCustomActionCount,
|
|
26
|
+
v as resolvePlayerCustomActionElement,
|
|
27
|
+
p as toPlayerCustomActionList
|
|
24
28
|
};
|
|
25
29
|
//# sourceMappingURL=playerCustomActions.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"playerCustomActions.es.js","sources":["../../../../src/components/Slide/utils/playerCustomActions.ts"],"sourcesContent":["import React from \"react\";\nimport type {\n Element,\n SlidePlayerCustomActionContext,\n SlidePlayerCustomActions,\n} from \"../types\";\nimport type { SlideAudioItem } from \"../useSlide\";\n\nconst noop = () => {};\n\nconst DEFAULT_PLAYER_CUSTOM_ACTION_CONTEXT: SlidePlayerCustomActionContext = {\n currentElement: undefined,\n currentIndex: -1,\n currentStepElement: undefined,\n isActive: false,\n setActive: noop,\n toggleActive: noop,\n};\n\nconst resolvePlayerCustomActions = (\n customActions?: SlidePlayerCustomActions,\n context: SlidePlayerCustomActionContext = DEFAULT_PLAYER_CUSTOM_ACTION_CONTEXT\n) =>\n typeof customActions === \"function\" ? customActions(context) : customActions;\n\ntype ResolvePlayerCustomActionElementParams = {\n currentAudioIndex: number;\n currentAudioSequenceIndexes: number[];\n audioList: SlideAudioItem[];\n currentStepElement?: Element;\n currentInteractionElement?: Element;\n};\n\nexport const resolvePlayerCustomActionElement = ({\n currentAudioIndex,\n currentAudioSequenceIndexes,\n audioList,\n currentStepElement,\n currentInteractionElement,\n}: ResolvePlayerCustomActionElementParams) => {\n const currentAudioElement =\n currentAudioIndex >= 0 ? audioList[currentAudioIndex]?.element : undefined;\n const currentSequenceAudioIndex = currentAudioSequenceIndexes[0];\n const currentSequenceAudioElement =\n typeof currentSequenceAudioIndex === \"number\"\n ? audioList[currentSequenceAudioIndex]?.element\n : undefined;\n\n return (\n currentAudioElement ??\n currentSequenceAudioElement ??\n currentInteractionElement ??\n currentStepElement\n );\n};\n\nexport const toPlayerCustomActionList = (\n customActions?: SlidePlayerCustomActions,\n context?: SlidePlayerCustomActionContext\n)
|
|
1
|
+
{"version":3,"file":"playerCustomActions.es.js","sources":["../../../../src/components/Slide/utils/playerCustomActions.ts"],"sourcesContent":["import React from \"react\";\nimport type {\n Element,\n SlidePlayerCustomActionContext,\n SlidePlayerCustomActions,\n} from \"../types\";\nimport type { SlideAudioItem } from \"../useSlide\";\n\nconst noop = () => {};\n\nconst DEFAULT_PLAYER_CUSTOM_ACTION_CONTEXT: SlidePlayerCustomActionContext = {\n currentElement: undefined,\n currentIndex: -1,\n currentStepElement: undefined,\n isActive: false,\n setActive: noop,\n toggleActive: noop,\n};\n\nconst resolvePlayerCustomActions = (\n customActions?: SlidePlayerCustomActions,\n context: SlidePlayerCustomActionContext = DEFAULT_PLAYER_CUSTOM_ACTION_CONTEXT\n) =>\n typeof customActions === \"function\" ? customActions(context) : customActions;\n\nconst toRenderablePlayerCustomActionList = (\n customActions: React.ReactNode\n): React.ReactNode[] =>\n React.Children.toArray(customActions).flatMap((customAction) => {\n if (\n React.isValidElement(customAction) &&\n customAction.type === React.Fragment\n ) {\n return toRenderablePlayerCustomActionList(\n (customAction.props as { children?: React.ReactNode }).children\n );\n }\n\n return customAction;\n });\n\ntype ResolvePlayerCustomActionElementParams = {\n currentAudioIndex: number;\n currentAudioSequenceIndexes: number[];\n audioList: SlideAudioItem[];\n currentStepElement?: Element;\n currentInteractionElement?: Element;\n};\n\nexport const resolvePlayerCustomActionElement = ({\n currentAudioIndex,\n currentAudioSequenceIndexes,\n audioList,\n currentStepElement,\n currentInteractionElement,\n}: ResolvePlayerCustomActionElementParams) => {\n const currentAudioElement =\n currentAudioIndex >= 0 ? audioList[currentAudioIndex]?.element : undefined;\n const currentSequenceAudioIndex = currentAudioSequenceIndexes[0];\n const currentSequenceAudioElement =\n typeof currentSequenceAudioIndex === \"number\"\n ? audioList[currentSequenceAudioIndex]?.element\n : undefined;\n\n return (\n currentAudioElement ??\n currentSequenceAudioElement ??\n currentInteractionElement ??\n currentStepElement\n );\n};\n\nexport const toPlayerCustomActionList = (\n customActions?: SlidePlayerCustomActions,\n context?: SlidePlayerCustomActionContext\n) =>\n toRenderablePlayerCustomActionList(\n resolvePlayerCustomActions(customActions, context)\n );\n\nexport const getPlayerCustomActionCount = (\n customActions?: SlidePlayerCustomActions,\n context?: SlidePlayerCustomActionContext\n) => toPlayerCustomActionList(customActions, context).length;\n"],"names":["noop","DEFAULT_PLAYER_CUSTOM_ACTION_CONTEXT","resolvePlayerCustomActions","customActions","context","toRenderablePlayerCustomActionList","React","customAction","resolvePlayerCustomActionElement","currentAudioIndex","currentAudioSequenceIndexes","audioList","currentStepElement","currentInteractionElement","currentAudioElement","currentSequenceAudioIndex","currentSequenceAudioElement","toPlayerCustomActionList","getPlayerCustomActionCount"],"mappings":";AAQA,MAAMA,IAAO,MAAM;AAAC,GAEdC,IAAuE;AAAA,EAC3E,gBAAgB;AAAA,EAChB,cAAc;AAAA,EACd,oBAAoB;AAAA,EACpB,UAAU;AAAA,EACV,WAAWD;AAAA,EACX,cAAcA;AAChB,GAEME,IAA6B,CACjCC,GACAC,IAA0CH,MAE1C,OAAOE,KAAkB,aAAaA,EAAcC,CAAO,IAAID,GAE3DE,IAAqC,CACzCF,MAEAG,EAAM,SAAS,QAAQH,CAAa,EAAE,QAAQ,CAACI,MAE3CD,EAAM,eAAeC,CAAY,KACjCA,EAAa,SAASD,EAAM,WAErBD;AAAA,EACJE,EAAa,MAAyC;AAAA,IAIpDA,CACR,GAUUC,IAAmC,CAAC;AAAA,EAC/C,mBAAAC;AAAA,EACA,6BAAAC;AAAA,EACA,WAAAC;AAAA,EACA,oBAAAC;AAAA,EACA,2BAAAC;AACF,MAA8C;AAC5C,QAAMC,IACJL,KAAqB,IAAIE,EAAUF,CAAiB,GAAG,UAAU,QAC7DM,IAA4BL,EAA4B,CAAC,GACzDM,IACJ,OAAOD,KAA8B,WACjCJ,EAAUI,CAAyB,GAAG,UACtC;AAEN,SACED,KACAE,KACAH,KACAD;AAEJ,GAEaK,IAA2B,CACtCd,GACAC,MAEAC;AAAA,EACEH,EAA2BC,GAAeC,CAAO;AACnD,GAEWc,IAA6B,CACxCf,GACAC,MACGa,EAAyBd,GAAeC,CAAO,EAAE;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s='input, textarea, select, [contenteditable]:not([contenteditable="false"]), [role="textbox"], [role="slider"], [role="listbox"], [role="combobox"], [role="tablist"], [role="menu"], [role="tree"], [role="grid"], [data-player-keyboard-shortcuts-ignore="true"]',i="button, [role='button']",o=new Set;let a=null;const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s='input, textarea, select, [contenteditable]:not([contenteditable="false"]), [role="textbox"], [role="slider"], [role="listbox"], [role="combobox"], [role="tablist"], [role="menu"], [role="tree"], [role="grid"], [data-player-keyboard-shortcuts-ignore="true"]',i="button, [role='button']",o=new Set;let a=null;const n=e=>{if(!e||typeof e!="object")return null;const t=e;return t.nodeType===3?t.parentElement??null:t},y=(e,t="ltr")=>{if(e.altKey||e.ctrlKey||e.metaKey)return null;const r=e.key.toLowerCase();if(e.shiftKey)switch(r){case"arrowleft":return"previousSubtitle";case"arrowright":return"nextSubtitle";default:return null}if(e.code==="Space"||r===" "||r==="spacebar")return"togglePlayback";switch(r){case"arrowleft":return t==="rtl"?"next":"previous";case"arrowright":return t==="rtl"?"previous":"next";case"f":return"fullscreen";case"c":return"subtitle";default:return null}},u=e=>{const t=n(e);if(!t)return!1;const r=t.tagName?.toLowerCase();if(r==="input"||r==="textarea"||r==="select"||t.isContentEditable)return!0;const l=t.getAttribute?.("contenteditable");return l!=null?l.toLowerCase()!=="false":!!t.closest?.(s)},c=e=>{const t=n(e);return t?t.tagName?.toLowerCase()==="button"?!0:!!t.closest?.(i):!1},d=(e,t)=>e.defaultPrevented||!t||u(e.target)?!0:t==="togglePlayback"&&c(e.target),b=e=>(o.add(e),(!a||!o.has(a))&&(a=e),()=>{o.delete(e),a===e&&(a=o.values().next().value??null)}),f=e=>{if(o.size===0){a=e;return}o.has(e)&&(a=e)},g=e=>a===e;exports.activatePlayerKeyboardShortcutOwner=f;exports.getPlayerKeyboardShortcutAction=y;exports.isActivePlayerKeyboardShortcutOwner=g;exports.isPlayerKeyboardShortcutEditableTarget=u;exports.isPlayerKeyboardShortcutNativeSpaceTarget=c;exports.registerPlayerKeyboardShortcutOwner=b;exports.shouldIgnorePlayerKeyboardShortcutEvent=d;
|
|
2
2
|
//# sourceMappingURL=playerKeyboardShortcuts.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"playerKeyboardShortcuts.cjs","sources":["../../../../src/components/Slide/utils/playerKeyboardShortcuts.ts"],"sourcesContent":["export type PlayerKeyboardShortcutAction =\n | \"togglePlayback\"\n | \"previous\"\n | \"next\"\n | \"previousSubtitle\"\n | \"nextSubtitle\"\n | \"fullscreen\"\n | \"subtitle\"
|
|
1
|
+
{"version":3,"file":"playerKeyboardShortcuts.cjs","sources":["../../../../src/components/Slide/utils/playerKeyboardShortcuts.ts"],"sourcesContent":["export type PlayerKeyboardShortcutAction =\n | \"togglePlayback\"\n | \"previous\"\n | \"next\"\n | \"previousSubtitle\"\n | \"nextSubtitle\"\n | \"fullscreen\"\n | \"subtitle\";\n\nexport interface PlayerKeyboardShortcutEventLike {\n altKey?: boolean;\n code?: string;\n ctrlKey?: boolean;\n defaultPrevented?: boolean;\n key: string;\n metaKey?: boolean;\n shiftKey?: boolean;\n target?: EventTarget | null;\n}\n\ntype KeyboardShortcutTarget = EventTarget & {\n closest?: (selectors: string) => unknown;\n getAttribute?: (qualifiedName: string) => string | null;\n isContentEditable?: boolean;\n nodeType?: number;\n parentElement?: Element | null;\n tagName?: string;\n};\n\nconst EDITABLE_SELECTOR =\n 'input, textarea, select, [contenteditable]:not([contenteditable=\"false\"]), [role=\"textbox\"], [role=\"slider\"], [role=\"listbox\"], [role=\"combobox\"], [role=\"tablist\"], [role=\"menu\"], [role=\"tree\"], [role=\"grid\"], [data-player-keyboard-shortcuts-ignore=\"true\"]';\n\nconst NATIVE_SPACE_TARGET_SELECTOR = \"button, [role='button']\";\n\nconst playerKeyboardShortcutOwners = new Set<string>();\nlet activePlayerKeyboardShortcutOwnerId: string | null = null;\n\nconst getTargetCandidate = (\n target: EventTarget | null | undefined\n): KeyboardShortcutTarget | null => {\n if (!target || typeof target !== \"object\") {\n return null;\n }\n\n const candidate = target as KeyboardShortcutTarget;\n\n if (candidate.nodeType === 3) {\n return (candidate.parentElement as KeyboardShortcutTarget | null) ?? null;\n }\n\n return candidate;\n};\n\nexport const getPlayerKeyboardShortcutAction = (\n event: PlayerKeyboardShortcutEventLike,\n direction: \"ltr\" | \"rtl\" = \"ltr\"\n): PlayerKeyboardShortcutAction | null => {\n if (event.altKey || event.ctrlKey || event.metaKey) {\n return null;\n }\n\n const normalizedKey = event.key.toLowerCase();\n\n if (event.shiftKey) {\n switch (normalizedKey) {\n case \"arrowleft\":\n return \"previousSubtitle\";\n case \"arrowright\":\n return \"nextSubtitle\";\n default:\n return null;\n }\n }\n\n if (\n event.code === \"Space\" ||\n normalizedKey === \" \" ||\n normalizedKey === \"spacebar\"\n ) {\n return \"togglePlayback\";\n }\n\n switch (normalizedKey) {\n case \"arrowleft\":\n return direction === \"rtl\" ? \"next\" : \"previous\";\n case \"arrowright\":\n return direction === \"rtl\" ? \"previous\" : \"next\";\n case \"f\":\n return \"fullscreen\";\n case \"c\":\n return \"subtitle\";\n default:\n return null;\n }\n};\n\nexport const isPlayerKeyboardShortcutEditableTarget = (\n target: EventTarget | null | undefined\n) => {\n const candidate = getTargetCandidate(target);\n\n if (!candidate) {\n return false;\n }\n\n const tagName = candidate.tagName?.toLowerCase();\n\n if (tagName === \"input\" || tagName === \"textarea\" || tagName === \"select\") {\n return true;\n }\n\n if (candidate.isContentEditable) {\n return true;\n }\n\n const contentEditable = candidate.getAttribute?.(\"contenteditable\");\n\n if (contentEditable !== undefined && contentEditable !== null) {\n return contentEditable.toLowerCase() !== \"false\";\n }\n\n return Boolean(candidate.closest?.(EDITABLE_SELECTOR));\n};\n\nexport const isPlayerKeyboardShortcutNativeSpaceTarget = (\n target: EventTarget | null | undefined\n) => {\n const candidate = getTargetCandidate(target);\n\n if (!candidate) {\n return false;\n }\n\n const tagName = candidate.tagName?.toLowerCase();\n\n if (tagName === \"button\") {\n return true;\n }\n\n return Boolean(candidate.closest?.(NATIVE_SPACE_TARGET_SELECTOR));\n};\n\nexport const shouldIgnorePlayerKeyboardShortcutEvent = (\n event: PlayerKeyboardShortcutEventLike,\n action: PlayerKeyboardShortcutAction | null\n) => {\n if (event.defaultPrevented || !action) {\n return true;\n }\n\n if (isPlayerKeyboardShortcutEditableTarget(event.target)) {\n return true;\n }\n\n return (\n action === \"togglePlayback\" &&\n isPlayerKeyboardShortcutNativeSpaceTarget(event.target)\n );\n};\n\nexport const registerPlayerKeyboardShortcutOwner = (ownerId: string) => {\n playerKeyboardShortcutOwners.add(ownerId);\n\n if (\n !activePlayerKeyboardShortcutOwnerId ||\n !playerKeyboardShortcutOwners.has(activePlayerKeyboardShortcutOwnerId)\n ) {\n activePlayerKeyboardShortcutOwnerId = ownerId;\n }\n\n return () => {\n playerKeyboardShortcutOwners.delete(ownerId);\n\n if (activePlayerKeyboardShortcutOwnerId !== ownerId) {\n return;\n }\n\n activePlayerKeyboardShortcutOwnerId =\n playerKeyboardShortcutOwners.values().next().value ?? null;\n };\n};\n\nexport const activatePlayerKeyboardShortcutOwner = (ownerId: string) => {\n if (playerKeyboardShortcutOwners.size === 0) {\n activePlayerKeyboardShortcutOwnerId = ownerId;\n return;\n }\n\n if (playerKeyboardShortcutOwners.has(ownerId)) {\n activePlayerKeyboardShortcutOwnerId = ownerId;\n }\n};\n\nexport const isActivePlayerKeyboardShortcutOwner = (ownerId: string) =>\n activePlayerKeyboardShortcutOwnerId === ownerId;\n\nexport const resetPlayerKeyboardShortcutOwnersForTest = () => {\n playerKeyboardShortcutOwners.clear();\n activePlayerKeyboardShortcutOwnerId = null;\n};\n"],"names":["EDITABLE_SELECTOR","NATIVE_SPACE_TARGET_SELECTOR","playerKeyboardShortcutOwners","activePlayerKeyboardShortcutOwnerId","getTargetCandidate","target","candidate","getPlayerKeyboardShortcutAction","event","direction","normalizedKey","isPlayerKeyboardShortcutEditableTarget","tagName","contentEditable","isPlayerKeyboardShortcutNativeSpaceTarget","shouldIgnorePlayerKeyboardShortcutEvent","action","registerPlayerKeyboardShortcutOwner","ownerId","activatePlayerKeyboardShortcutOwner","isActivePlayerKeyboardShortcutOwner"],"mappings":"gFA6BA,MAAMA,EACJ,mQAEIC,EAA+B,0BAE/BC,MAAmC,IACzC,IAAIC,EAAqD,KAEzD,MAAMC,EACJC,GACkC,CAClC,GAAI,CAACA,GAAU,OAAOA,GAAW,SAC/B,OAAO,KAGT,MAAMC,EAAYD,EAElB,OAAIC,EAAU,WAAa,EACjBA,EAAU,eAAmD,KAGhEA,CACT,EAEaC,EAAkC,CAC7CC,EACAC,EAA2B,QACa,CACxC,GAAID,EAAM,QAAUA,EAAM,SAAWA,EAAM,QACzC,OAAO,KAGT,MAAME,EAAgBF,EAAM,IAAI,YAAA,EAEhC,GAAIA,EAAM,SACR,OAAQE,EAAA,CACN,IAAK,YACH,MAAO,mBACT,IAAK,aACH,MAAO,eACT,QACE,OAAO,IAAA,CAIb,GACEF,EAAM,OAAS,SACfE,IAAkB,KAClBA,IAAkB,WAElB,MAAO,iBAGT,OAAQA,EAAA,CACN,IAAK,YACH,OAAOD,IAAc,MAAQ,OAAS,WACxC,IAAK,aACH,OAAOA,IAAc,MAAQ,WAAa,OAC5C,IAAK,IACH,MAAO,aACT,IAAK,IACH,MAAO,WACT,QACE,OAAO,IAAA,CAEb,EAEaE,EACXN,GACG,CACH,MAAMC,EAAYF,EAAmBC,CAAM,EAE3C,GAAI,CAACC,EACH,MAAO,GAGT,MAAMM,EAAUN,EAAU,SAAS,YAAA,EAMnC,GAJIM,IAAY,SAAWA,IAAY,YAAcA,IAAY,UAI7DN,EAAU,kBACZ,MAAO,GAGT,MAAMO,EAAkBP,EAAU,eAAe,iBAAiB,EAElE,OAAqCO,GAAoB,KAChDA,EAAgB,gBAAkB,QAGpC,EAAQP,EAAU,UAAUN,CAAiB,CACtD,EAEac,EACXT,GACG,CACH,MAAMC,EAAYF,EAAmBC,CAAM,EAE3C,OAAKC,EAIWA,EAAU,SAAS,YAAA,IAEnB,SACP,GAGF,EAAQA,EAAU,UAAUL,CAA4B,EATtD,EAUX,EAEac,EAA0C,CACrDP,EACAQ,IAEIR,EAAM,kBAAoB,CAACQ,GAI3BL,EAAuCH,EAAM,MAAM,EAC9C,GAIPQ,IAAW,kBACXF,EAA0CN,EAAM,MAAM,EAI7CS,EAAuCC,IAClDhB,EAA6B,IAAIgB,CAAO,GAGtC,CAACf,GACD,CAACD,EAA6B,IAAIC,CAAmC,KAErEA,EAAsCe,GAGjC,IAAM,CACXhB,EAA6B,OAAOgB,CAAO,EAEvCf,IAAwCe,IAI5Cf,EACED,EAA6B,OAAA,EAAS,KAAA,EAAO,OAAS,KAC1D,GAGWiB,EAAuCD,GAAoB,CACtE,GAAIhB,EAA6B,OAAS,EAAG,CAC3CC,EAAsCe,EACtC,MACF,CAEIhB,EAA6B,IAAIgB,CAAO,IAC1Cf,EAAsCe,EAE1C,EAEaE,EAAuCF,GAClDf,IAAwCe"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type PlayerKeyboardShortcutAction = "togglePlayback" | "previous" | "next" | "previousSubtitle" | "nextSubtitle" | "fullscreen" | "subtitle"
|
|
1
|
+
export type PlayerKeyboardShortcutAction = "togglePlayback" | "previous" | "next" | "previousSubtitle" | "nextSubtitle" | "fullscreen" | "subtitle";
|
|
2
2
|
export interface PlayerKeyboardShortcutEventLike {
|
|
3
3
|
altKey?: boolean;
|
|
4
4
|
code?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"playerKeyboardShortcuts.es.js","sources":["../../../../src/components/Slide/utils/playerKeyboardShortcuts.ts"],"sourcesContent":["export type PlayerKeyboardShortcutAction =\n | \"togglePlayback\"\n | \"previous\"\n | \"next\"\n | \"previousSubtitle\"\n | \"nextSubtitle\"\n | \"fullscreen\"\n | \"subtitle\"
|
|
1
|
+
{"version":3,"file":"playerKeyboardShortcuts.es.js","sources":["../../../../src/components/Slide/utils/playerKeyboardShortcuts.ts"],"sourcesContent":["export type PlayerKeyboardShortcutAction =\n | \"togglePlayback\"\n | \"previous\"\n | \"next\"\n | \"previousSubtitle\"\n | \"nextSubtitle\"\n | \"fullscreen\"\n | \"subtitle\";\n\nexport interface PlayerKeyboardShortcutEventLike {\n altKey?: boolean;\n code?: string;\n ctrlKey?: boolean;\n defaultPrevented?: boolean;\n key: string;\n metaKey?: boolean;\n shiftKey?: boolean;\n target?: EventTarget | null;\n}\n\ntype KeyboardShortcutTarget = EventTarget & {\n closest?: (selectors: string) => unknown;\n getAttribute?: (qualifiedName: string) => string | null;\n isContentEditable?: boolean;\n nodeType?: number;\n parentElement?: Element | null;\n tagName?: string;\n};\n\nconst EDITABLE_SELECTOR =\n 'input, textarea, select, [contenteditable]:not([contenteditable=\"false\"]), [role=\"textbox\"], [role=\"slider\"], [role=\"listbox\"], [role=\"combobox\"], [role=\"tablist\"], [role=\"menu\"], [role=\"tree\"], [role=\"grid\"], [data-player-keyboard-shortcuts-ignore=\"true\"]';\n\nconst NATIVE_SPACE_TARGET_SELECTOR = \"button, [role='button']\";\n\nconst playerKeyboardShortcutOwners = new Set<string>();\nlet activePlayerKeyboardShortcutOwnerId: string | null = null;\n\nconst getTargetCandidate = (\n target: EventTarget | null | undefined\n): KeyboardShortcutTarget | null => {\n if (!target || typeof target !== \"object\") {\n return null;\n }\n\n const candidate = target as KeyboardShortcutTarget;\n\n if (candidate.nodeType === 3) {\n return (candidate.parentElement as KeyboardShortcutTarget | null) ?? null;\n }\n\n return candidate;\n};\n\nexport const getPlayerKeyboardShortcutAction = (\n event: PlayerKeyboardShortcutEventLike,\n direction: \"ltr\" | \"rtl\" = \"ltr\"\n): PlayerKeyboardShortcutAction | null => {\n if (event.altKey || event.ctrlKey || event.metaKey) {\n return null;\n }\n\n const normalizedKey = event.key.toLowerCase();\n\n if (event.shiftKey) {\n switch (normalizedKey) {\n case \"arrowleft\":\n return \"previousSubtitle\";\n case \"arrowright\":\n return \"nextSubtitle\";\n default:\n return null;\n }\n }\n\n if (\n event.code === \"Space\" ||\n normalizedKey === \" \" ||\n normalizedKey === \"spacebar\"\n ) {\n return \"togglePlayback\";\n }\n\n switch (normalizedKey) {\n case \"arrowleft\":\n return direction === \"rtl\" ? \"next\" : \"previous\";\n case \"arrowright\":\n return direction === \"rtl\" ? \"previous\" : \"next\";\n case \"f\":\n return \"fullscreen\";\n case \"c\":\n return \"subtitle\";\n default:\n return null;\n }\n};\n\nexport const isPlayerKeyboardShortcutEditableTarget = (\n target: EventTarget | null | undefined\n) => {\n const candidate = getTargetCandidate(target);\n\n if (!candidate) {\n return false;\n }\n\n const tagName = candidate.tagName?.toLowerCase();\n\n if (tagName === \"input\" || tagName === \"textarea\" || tagName === \"select\") {\n return true;\n }\n\n if (candidate.isContentEditable) {\n return true;\n }\n\n const contentEditable = candidate.getAttribute?.(\"contenteditable\");\n\n if (contentEditable !== undefined && contentEditable !== null) {\n return contentEditable.toLowerCase() !== \"false\";\n }\n\n return Boolean(candidate.closest?.(EDITABLE_SELECTOR));\n};\n\nexport const isPlayerKeyboardShortcutNativeSpaceTarget = (\n target: EventTarget | null | undefined\n) => {\n const candidate = getTargetCandidate(target);\n\n if (!candidate) {\n return false;\n }\n\n const tagName = candidate.tagName?.toLowerCase();\n\n if (tagName === \"button\") {\n return true;\n }\n\n return Boolean(candidate.closest?.(NATIVE_SPACE_TARGET_SELECTOR));\n};\n\nexport const shouldIgnorePlayerKeyboardShortcutEvent = (\n event: PlayerKeyboardShortcutEventLike,\n action: PlayerKeyboardShortcutAction | null\n) => {\n if (event.defaultPrevented || !action) {\n return true;\n }\n\n if (isPlayerKeyboardShortcutEditableTarget(event.target)) {\n return true;\n }\n\n return (\n action === \"togglePlayback\" &&\n isPlayerKeyboardShortcutNativeSpaceTarget(event.target)\n );\n};\n\nexport const registerPlayerKeyboardShortcutOwner = (ownerId: string) => {\n playerKeyboardShortcutOwners.add(ownerId);\n\n if (\n !activePlayerKeyboardShortcutOwnerId ||\n !playerKeyboardShortcutOwners.has(activePlayerKeyboardShortcutOwnerId)\n ) {\n activePlayerKeyboardShortcutOwnerId = ownerId;\n }\n\n return () => {\n playerKeyboardShortcutOwners.delete(ownerId);\n\n if (activePlayerKeyboardShortcutOwnerId !== ownerId) {\n return;\n }\n\n activePlayerKeyboardShortcutOwnerId =\n playerKeyboardShortcutOwners.values().next().value ?? null;\n };\n};\n\nexport const activatePlayerKeyboardShortcutOwner = (ownerId: string) => {\n if (playerKeyboardShortcutOwners.size === 0) {\n activePlayerKeyboardShortcutOwnerId = ownerId;\n return;\n }\n\n if (playerKeyboardShortcutOwners.has(ownerId)) {\n activePlayerKeyboardShortcutOwnerId = ownerId;\n }\n};\n\nexport const isActivePlayerKeyboardShortcutOwner = (ownerId: string) =>\n activePlayerKeyboardShortcutOwnerId === ownerId;\n\nexport const resetPlayerKeyboardShortcutOwnersForTest = () => {\n playerKeyboardShortcutOwners.clear();\n activePlayerKeyboardShortcutOwnerId = null;\n};\n"],"names":["EDITABLE_SELECTOR","NATIVE_SPACE_TARGET_SELECTOR","playerKeyboardShortcutOwners","activePlayerKeyboardShortcutOwnerId","getTargetCandidate","target","candidate","getPlayerKeyboardShortcutAction","event","direction","normalizedKey","isPlayerKeyboardShortcutEditableTarget","tagName","contentEditable","isPlayerKeyboardShortcutNativeSpaceTarget","shouldIgnorePlayerKeyboardShortcutEvent","action","registerPlayerKeyboardShortcutOwner","ownerId","activatePlayerKeyboardShortcutOwner","isActivePlayerKeyboardShortcutOwner"],"mappings":"AA6BA,MAAMA,IACJ,oQAEIC,IAA+B,2BAE/BC,wBAAmC,IAAA;AACzC,IAAIC,IAAqD;AAEzD,MAAMC,IAAqB,CACzBC,MACkC;AAClC,MAAI,CAACA,KAAU,OAAOA,KAAW;AAC/B,WAAO;AAGT,QAAMC,IAAYD;AAElB,SAAIC,EAAU,aAAa,IACjBA,EAAU,iBAAmD,OAGhEA;AACT,GAEaC,IAAkC,CAC7CC,GACAC,IAA2B,UACa;AACxC,MAAID,EAAM,UAAUA,EAAM,WAAWA,EAAM;AACzC,WAAO;AAGT,QAAME,IAAgBF,EAAM,IAAI,YAAA;AAEhC,MAAIA,EAAM;AACR,YAAQE,GAAA;AAAA,MACN,KAAK;AACH,eAAO;AAAA,MACT,KAAK;AACH,eAAO;AAAA,MACT;AACE,eAAO;AAAA,IAAA;AAIb,MACEF,EAAM,SAAS,WACfE,MAAkB,OAClBA,MAAkB;AAElB,WAAO;AAGT,UAAQA,GAAA;AAAA,IACN,KAAK;AACH,aAAOD,MAAc,QAAQ,SAAS;AAAA,IACxC,KAAK;AACH,aAAOA,MAAc,QAAQ,aAAa;AAAA,IAC5C,KAAK;AACH,aAAO;AAAA,IACT,KAAK;AACH,aAAO;AAAA,IACT;AACE,aAAO;AAAA,EAAA;AAEb,GAEaE,IAAyC,CACpDN,MACG;AACH,QAAMC,IAAYF,EAAmBC,CAAM;AAE3C,MAAI,CAACC;AACH,WAAO;AAGT,QAAMM,IAAUN,EAAU,SAAS,YAAA;AAMnC,MAJIM,MAAY,WAAWA,MAAY,cAAcA,MAAY,YAI7DN,EAAU;AACZ,WAAO;AAGT,QAAMO,IAAkBP,EAAU,eAAe,iBAAiB;AAElE,SAAqCO,KAAoB,OAChDA,EAAgB,kBAAkB,UAGpC,EAAQP,EAAU,UAAUN,CAAiB;AACtD,GAEac,IAA4C,CACvDT,MACG;AACH,QAAMC,IAAYF,EAAmBC,CAAM;AAE3C,SAAKC,IAIWA,EAAU,SAAS,YAAA,MAEnB,WACP,KAGF,EAAQA,EAAU,UAAUL,CAA4B,IATtD;AAUX,GAEac,IAA0C,CACrDP,GACAQ,MAEIR,EAAM,oBAAoB,CAACQ,KAI3BL,EAAuCH,EAAM,MAAM,IAC9C,KAIPQ,MAAW,oBACXF,EAA0CN,EAAM,MAAM,GAI7CS,IAAsC,CAACC,OAClDhB,EAA6B,IAAIgB,CAAO,IAGtC,CAACf,KACD,CAACD,EAA6B,IAAIC,CAAmC,OAErEA,IAAsCe,IAGjC,MAAM;AAGX,EAFAhB,EAA6B,OAAOgB,CAAO,GAEvCf,MAAwCe,MAI5Cf,IACED,EAA6B,OAAA,EAAS,KAAA,EAAO,SAAS;AAC1D,IAGWiB,IAAsC,CAACD,MAAoB;AACtE,MAAIhB,EAA6B,SAAS,GAAG;AAC3C,IAAAC,IAAsCe;AACtC;AAAA,EACF;AAEA,EAAIhB,EAA6B,IAAIgB,CAAO,MAC1Cf,IAAsCe;AAE1C,GAEaE,IAAsC,CAACF,MAClDf,MAAwCe;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("react/jsx-runtime"),d=require("react"),u=require("../../../node_modules/rc-textarea/es/TextArea.cjs");require("../../../_virtual/
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("react/jsx-runtime"),d=require("react"),u=require("../../../node_modules/rc-textarea/es/TextArea.cjs");require("../../../_virtual/index3.cjs");require("../../../node_modules/rc-resize-observer/es/index.cjs");require("../../../node_modules/rc-util/es/hooks/useLayoutEffect.cjs");require("../../../node_modules/rc-util/es/raf.cjs");const s=require("../../../lib/utils.cjs");function c(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const r in e)if(r!=="default"){const a=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,a.get?a:{enumerable:!0,get:()=>e[r]})}}return t.default=e,Object.freeze(t)}const l=c(d),i=l.forwardRef(({className:e,autoSize:t={minRows:1},style:r,...a},n)=>o.jsx(u.default,{ref:n,autoSize:t,className:s.cn("border-input placeholder:text-muted-foreground aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 w-full rounded-md border bg-transparent pl-3 py-1.5 text-base shadow-xs transition-[color,box-shadow] outline-none disabled:cursor-not-allowed disabled:opacity-50","resize-none",e),style:{whiteSpace:"pre-wrap",wordBreak:"break-word",...r},...a}));i.displayName="Textarea";exports.Textarea=i;
|
|
2
2
|
//# sourceMappingURL=textarea.cjs.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as i } from "react/jsx-runtime";
|
|
2
2
|
import * as d from "react";
|
|
3
3
|
import n from "../../../node_modules/rc-textarea/es/TextArea.es.js";
|
|
4
|
-
import "../../../_virtual/index.
|
|
4
|
+
import "../../../_virtual/index.es3.js";
|
|
5
5
|
import "../../../node_modules/rc-resize-observer/es/index.es.js";
|
|
6
6
|
import "../../../node_modules/rc-util/es/hooks/useLayoutEffect.es.js";
|
|
7
7
|
import "../../../node_modules/rc-util/es/raf.es.js";
|
|
@@ -1,2 +1,2 @@
|
|
|
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;
|
|
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;
|
|
2
2
|
//# sourceMappingURL=cose-base.cjs.map
|