@vuu-ui/vuu-layout 0.5.5 → 0.5.6
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/cjs/index.js +4 -4
- package/cjs/index.js.map +4 -4
- package/esm/index.js +4 -4
- package/esm/index.js.map +4 -4
- package/index.css +1 -1
- package/index.css.map +3 -3
- package/package.json +2 -3
package/cjs/index.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../../../packages/vuu-layout/src/index.ts", "../../../packages/vuu-layout/src/chest-of-drawers/Chest.tsx", "../../../packages/vuu-layout/src/chest-of-drawers/Drawer.tsx", "../../../packages/vuu-layout/src/registry/ComponentRegistry.ts", "../../../packages/vuu-layout/src/Component.tsx", "../../../packages/vuu-
|
|
4
|
-
"sourcesContent": ["export * from \"./chest-of-drawers\";\nexport { default as Component } from \"./Component\";\nexport * from \"./common-types\";\nexport * from \"./dialog\";\nexport * from \"./menu\";\nexport * from \"./popup\";\nexport * from \"./DraggableLayout\";\nexport * from \"./drag-drop\";\nexport * from \"./flexbox\";\nexport { Action } from \"./layout-action\";\nexport * from \"./layout-header\";\nexport * from \"./layout-provider\";\nexport * from \"./palette\";\nexport * from \"./placeholder\";\nexport * from \"./registry\";\nexport * from \"./responsive\";\nexport * from \"./stack\";\nexport * from \"./tools\";\nexport * from \"./use-persistent-state\";\nexport * from \"./utils\";\nexport * from \"./layout-view\";\n", "import React, { HTMLAttributes, ReactElement } from \"react\";\nimport cx from \"classnames\";\nimport Drawer from \"./Drawer\";\nimport { partition } from \"@vuu-ui/vuu-utils\";\nimport { registerComponent } from \"../registry/ComponentRegistry\";\n\nimport \"./Chest.css\";\n\nconst isDrawer = (component: ReactElement) => component.type === Drawer;\nconst isVertical = ({ props: { position = \"left\" } }: ReactElement) =>\n position.match(/top|bottom/);\n\nexport interface ChestProps extends HTMLAttributes<HTMLDivElement> {\n children: ReactElement[];\n}\n\nconst Chest = (props: ChestProps) => {\n const { children, className: classNameProp, id, style } = props;\n const classBase = \"hwChest\";\n const [drawers, content] = partition(children, isDrawer);\n const [verticalDrawers, horizontalDrawers] = partition(drawers, isVertical);\n const orientation =\n verticalDrawers.length === 0\n ? \"horizontal\"\n : horizontalDrawers.length === 0\n ? \"vertical\"\n : \"both\";\n\n const className = cx(classBase, classNameProp, `${classBase}-${orientation}`);\n\n return (\n <div className={className} id={id} style={style}>\n {drawers}\n <div className={`${classBase}-content`}>{content}</div>\n </div>\n );\n};\nChest.displayName = \"Chest\";\n\nexport default Chest;\n\nregisterComponent(\"Chest\", Chest, \"container\");\n", "import React, { CSSProperties, HTMLAttributes, useCallback } from \"react\";\nimport cx from \"classnames\";\nimport { Button, useControlled } from \"@salt-ds/core\";\n\nimport \"./Drawer.css\";\n\nconst classBase = \"vuuDrawer\";\n\nconst sizeAttribute = (value: string | number) => {\n return typeof value === \"string\" ? value : value + \"px\";\n};\n\nconst getStyle = (\n styleProp?: CSSProperties,\n sizeOpen?: number,\n sizeClosed?: number\n) => {\n const hasSizeOpen = sizeOpen !== undefined;\n const hasSizeClosed = sizeClosed !== undefined;\n\n if (!styleProp && !hasSizeClosed && !hasSizeOpen) {\n return undefined;\n }\n\n if (!hasSizeClosed && !hasSizeOpen) {\n return styleProp;\n }\n\n return {\n ...styleProp,\n \"--drawer-size\": hasSizeOpen ? sizeAttribute(sizeOpen) : undefined,\n \"--drawer-peek-size\": hasSizeClosed ? sizeAttribute(sizeClosed) : undefined,\n };\n};\n\nexport interface DrawerProps extends HTMLAttributes<HTMLDivElement> {\n clickToOpen?: boolean;\n defaultOpen: boolean;\n inline?: boolean;\n open?: boolean;\n peekaboo?: boolean;\n position?: \"left\" | \"right\" | \"top\" | \"bottom\";\n sizeOpen?: number;\n sizeClosed?: number;\n toggleButton?: \"start\" | \"end\";\n}\nconst Drawer = ({\n children,\n className: classNameProp,\n clickToOpen,\n defaultOpen,\n sizeOpen,\n sizeClosed,\n style: styleProp,\n open: openProp,\n position = \"left\",\n inline,\n onClick,\n peekaboo = false,\n toggleButton,\n ...props\n}: DrawerProps) => {\n const [open, setOpen] = useControlled({\n controlled: openProp,\n default: defaultOpen ?? false,\n name: \"Drawer\",\n state: \"open\",\n });\n\n const className = cx(classBase, classNameProp, `${classBase}-${position}`, {\n [`${classBase}-open`]: open,\n [`${classBase}-inline`]: inline,\n [`${classBase}-over`]: !inline,\n [`${classBase}-peekaboo`]: peekaboo,\n });\n\n const toggleDrawer = useCallback(() => {\n console.log(\"toggleDrawer\");\n setOpen(!open);\n }, [open, setOpen]);\n\n const style = getStyle(styleProp, sizeOpen, sizeClosed);\n\n const handleClick = clickToOpen ? toggleDrawer : onClick;\n\n const renderToggleButton = () => (\n <div className={cx(\"vuuToggleButton-container\")}>\n {open ? (\n <Button\n aria-label=\"close\"\n onClick={toggleDrawer}\n data-icon=\"close\"\n variant=\"secondary\"\n />\n ) : (\n <Button\n aria-label=\"open\"\n onClick={toggleDrawer}\n data-icon=\"close\"\n variant=\"secondary\"\n />\n )}\n </div>\n );\n\n return (\n <div {...props} className={className} onClick={handleClick} style={style}>\n {toggleButton == \"start\" ? renderToggleButton() : null}\n <div className={`${classBase}-liner`}>\n <div className={`${classBase}-content`}>{children}</div>\n </div>\n {toggleButton == \"end\" ? renderToggleButton() : null}\n </div>\n );\n};\nDrawer.displayName = \"Drawer\";\n\nexport default Drawer;\n", "import React, { FunctionComponent } from 'react';\n\nconst _containers: { [key: string]: boolean } = {};\nconst _views: { [key: string]: boolean } = {};\n\nexport type layoutComponentType = 'component' | 'container' | 'view';\n\nexport const ComponentRegistry: { [key: string]: FunctionComponent } = {};\n\nexport function isContainer(componentType: string) {\n return _containers[componentType] === true;\n}\n\nexport function isView(componentType: string) {\n return _views[componentType] === true;\n}\n\nexport const isLayoutComponent = (type: string) => isContainer(type) || isView(type);\n\nexport const isRegistered = (className: string) => !!ComponentRegistry[className];\n\n// We could check and set displayName in here\nexport function registerComponent(\n componentName: string,\n component: FunctionComponent<any>,\n type: layoutComponentType = 'component'\n) {\n ComponentRegistry[componentName] = component;\n\n if (type === 'container') {\n _containers[componentName] = true;\n } else if (type === 'view') {\n _views[componentName] = true;\n }\n}\n", "import React, { forwardRef, HTMLAttributes } from 'react';\nimport { registerComponent } from './registry/ComponentRegistry';\n\nimport './Component.css';\n\nexport interface ComponentProps extends HTMLAttributes<HTMLDivElement> {\n resizeable?: boolean;\n}\n\nconst Component = forwardRef(function Component(\n { resizeable, ...props }: ComponentProps,\n ref: React.ForwardedRef<HTMLDivElement>\n) {\n return <div {...props} className=\"Component\" ref={ref} />;\n}) as React.FunctionComponent<ComponentProps>;\nComponent.displayName = 'Component';\n\nexport default Component;\n\nregisterComponent('Component', Component);\n", "import React, { HTMLAttributes, useCallback, useRef, useState } from \"react\";\nimport cx from \"classnames\";\nimport { Flexbox } from \"../flexbox\";\nimport { View } from \"../layout-view\";\nimport { Portal } from \"../portal\";\nimport { Scrim } from \"@heswell/salt-lab\";\n\nimport { Toolbar, ToolbarButton } from \"@heswell/salt-lab\";\nimport { CloseIcon } from \"@salt-ds/icons\";\n\nimport \"./Dialog.css\";\n\nconst classBase = \"vuuDialog\";\n\nexport interface DialogProps extends HTMLAttributes<HTMLDivElement> {\n isOpen?: boolean;\n onClose?: () => void;\n}\n\nexport const Dialog = ({\n children,\n className,\n isOpen = false,\n onClose,\n title,\n ...props\n}: DialogProps) => {\n const root = useRef<HTMLDivElement>(null);\n const [posX, setPosX] = useState(0);\n const [posY, setPosY] = useState(0);\n\n const close = useCallback(() => {\n // TODO\n onClose?.();\n }, [onClose]);\n\n const handleRender = useCallback(() => {\n // if (center && isOpen && root.current) {\n // const { width, height } = root.current.getBoundingClientRect();\n // const { innerWidth, innerHeight } = window;\n // const x = innerWidth / 2 - width / 2;\n // const y = innerHeight / 2 - height / 2;\n // setPosX(x);\n // setPosY(y);\n // }\n }, []);\n\n if (!isOpen) {\n return null;\n }\n\n return (\n <Portal onRender={handleRender} x={posX} y={posY}>\n <Scrim className={`${classBase}-scrim`} open={isOpen}>\n <div {...props} className={cx(classBase, className)} ref={root}>\n <Flexbox\n style={{ flexDirection: \"column\", width: \"100%\", height: \"100%\" }}\n >\n <Toolbar style={{ height: 32 }}>\n <span>{title}</span>\n <ToolbarButton key=\"close\" onClick={close} data-align-end>\n <CloseIcon /> Close\n </ToolbarButton>\n </Toolbar>\n <View style={{ flex: 1 }}>{children}</View>\n </Flexbox>\n </div>\n </Scrim>\n </Portal>\n );\n};\n", "import { useForkRef } from \"@salt-ds/core\";\nimport cx from \"classnames\";\nimport { CSSProperties, ForwardedRef, forwardRef } from \"react\";\nimport { FlexboxProps } from \"./flexboxTypes\";\nimport { useSplitterResizing } from \"./useSplitterResizing\";\n\nimport \"./Flexbox.css\";\n\nconst classBase = \"hwFlexbox\";\n\nconst Flexbox = forwardRef(function Flexbox(\n props: FlexboxProps,\n ref: ForwardedRef<HTMLDivElement>\n) {\n const {\n breakPoints,\n children,\n // cols: colsProp,\n column,\n className: classNameProp,\n flexFill,\n gap,\n fullPage,\n id,\n onSplitterMoved,\n resizeable,\n row,\n spacing,\n splitterSize,\n style,\n ...rest\n } = props;\n\n const { content, rootRef } = useSplitterResizing({\n children,\n // cols: colsProp,\n onSplitterMoved,\n style,\n });\n\n const className = cx(classBase, classNameProp, {\n [`${classBase}-column`]: column,\n [`${classBase}-row`]: row,\n \"flex-fill\": flexFill,\n \"full-page\": fullPage,\n });\n\n return (\n <div\n {...rest}\n className={className}\n // data-cols={cols}\n data-resizeable={resizeable || undefined}\n id={id}\n ref={useForkRef(rootRef, ref)}\n style={\n {\n ...style,\n gap,\n \"--spacing\": spacing,\n } as CSSProperties\n }\n >\n {content}\n </div>\n );\n});\nFlexbox.displayName = \"Flexbox\";\n\nexport default Flexbox;\n", "import React, {\n ReactElement,\n useCallback,\n useMemo,\n useRef,\n useState,\n} from \"react\";\nimport { getUniqueId } from \"@vuu-ui/vuu-utils\";\nimport { Splitter } from \"./Splitter\";\nimport { Placeholder } from \"../placeholder\";\n\nimport {\n findSplitterAndPlaceholderPositions,\n gatherChildMeta,\n identifyResizeParties,\n PLACEHOLDER,\n SPLITTER,\n} from \"./flexbox-utils\";\nimport {\n ContentMeta,\n FlexSize,\n SplitterFactory,\n SplitterHookProps,\n SplitterHookResult,\n} from \"./flexboxTypes\";\n\nconst originalContentOnly = (meta: ContentMeta) =>\n !meta.splitter && !meta.placeholder;\n\nexport const useSplitterResizing = ({\n children: childrenProp,\n onSplitterMoved,\n style,\n}: SplitterHookProps): SplitterHookResult => {\n const rootRef = useRef<HTMLDivElement>();\n const metaRef = useRef<ContentMeta[]>();\n const contentRef = useRef<ReactElement[]>();\n const assignedKeys = useRef([]);\n const [, forceUpdate] = useState({});\n\n const setContent = (content: ReactElement[]) => {\n contentRef.current = content;\n forceUpdate({});\n };\n\n const isColumn = style?.flexDirection === \"column\";\n const dimension = isColumn ? \"height\" : \"width\";\n const children = useMemo(\n () =>\n Array.isArray(childrenProp)\n ? childrenProp\n : React.isValidElement(childrenProp)\n ? [childrenProp]\n : [],\n [childrenProp]\n );\n\n const handleDragStart = useCallback(\n (index) => {\n const { current: contentMeta } = metaRef;\n if (contentMeta) {\n const [participants, bystanders] = identifyResizeParties(\n contentMeta,\n index\n );\n if (participants) {\n participants.forEach((index) => {\n const el = rootRef.current?.childNodes[index] as HTMLElement;\n if (el) {\n const { size, minSize } = measureElement(el, dimension);\n contentMeta[index].currentSize = size;\n contentMeta[index].minSize = minSize;\n }\n });\n if (bystanders) {\n bystanders.forEach((index) => {\n const el = rootRef.current?.childNodes[index] as HTMLElement;\n if (el) {\n const { [dimension]: size } = el.getBoundingClientRect();\n contentMeta[index].flexBasis = size;\n }\n });\n }\n }\n }\n },\n [dimension]\n );\n\n const handleDrag = useCallback(\n (idx, distance) => {\n if (contentRef.current && metaRef.current) {\n setContent(\n resizeContent(\n contentRef.current,\n metaRef.current,\n distance,\n dimension\n )\n );\n }\n },\n [dimension]\n );\n\n const handleDragEnd = useCallback(() => {\n const contentMeta = metaRef.current;\n if (contentMeta) {\n onSplitterMoved?.(contentMeta.filter(originalContentOnly));\n }\n contentMeta?.forEach((meta) => {\n meta.currentSize = undefined;\n meta.flexBasis = undefined;\n meta.flexOpen = false;\n });\n }, [onSplitterMoved]);\n\n const createSplitter: SplitterFactory = useCallback(\n (i) => {\n return React.createElement(Splitter, {\n column: isColumn,\n index: i,\n key: `splitter-${i}`,\n onDrag: handleDrag,\n onDragEnd: handleDragEnd,\n onDragStart: handleDragStart,\n });\n },\n [handleDrag, handleDragEnd, handleDragStart, isColumn]\n );\n\n useMemo(() => {\n // This will always fire when Flexbox has rendered, but nor during splitter resize\n const [content, meta] = buildContent(\n children,\n dimension,\n createSplitter,\n assignedKeys.current\n );\n metaRef.current = meta;\n contentRef.current = content;\n }, [children, createSplitter, dimension]);\n\n return {\n content: contentRef.current || [],\n rootRef,\n };\n};\n\nfunction buildContent(\n children: ReactElement[],\n dimension: \"width\" | \"height\",\n createSplitter: SplitterFactory,\n keys: any[]\n): [any[], ContentMeta[]] {\n const childMeta = gatherChildMeta(children, dimension);\n const splitterAndPlaceholderPositions =\n findSplitterAndPlaceholderPositions(childMeta);\n const content = [];\n const meta: ContentMeta[] = [];\n for (let i = 0; i < children.length; i++) {\n const child = children[i];\n if (i === 0 && splitterAndPlaceholderPositions[i] & PLACEHOLDER) {\n //TODO need to assign an id to placeholder\n content.push(createPlaceholder(i));\n meta.push({ placeholder: true, shim: true });\n }\n if (child.key == null) {\n const key = keys[i] || (keys[i] = getUniqueId());\n content.push(React.cloneElement(child, { key }));\n } else {\n content.push(child);\n }\n meta.push(childMeta[i]);\n\n if (i > 0 && splitterAndPlaceholderPositions[i] & PLACEHOLDER) {\n content.push(createPlaceholder(i));\n meta.push({ placeholder: true });\n } else if (splitterAndPlaceholderPositions[i] & SPLITTER) {\n content.push(createSplitter(content.length));\n meta.push({ splitter: true });\n }\n }\n return [content, meta];\n}\n\nfunction resizeContent(\n content: ReactElement[],\n contentMeta: ContentMeta[],\n distance: number,\n dimension: \"width\" | \"height\"\n) {\n const metaUpdated = updateMeta(contentMeta, distance);\n if (!metaUpdated) {\n return content;\n }\n\n return content.map((child, idx) => {\n const meta = contentMeta[idx];\n let { currentSize, flexOpen, flexBasis } = meta;\n const hasCurrentSize = currentSize !== undefined;\n if (hasCurrentSize || flexOpen) {\n const { flexBasis: actualFlexBasis } = child.props.style || {};\n const size = hasCurrentSize ? meta.currentSize : flexBasis;\n if (size !== actualFlexBasis) {\n return React.cloneElement(child, {\n style: {\n ...child.props.style,\n flexBasis: size,\n [dimension]: \"auto\",\n },\n });\n } else {\n return child;\n }\n } else {\n return child;\n }\n });\n}\n\n//TODO detect cursor move beyond drag limit and suspend further resize until cursoe re-engages with splitter\nfunction updateMeta(contentMeta: ContentMeta[], distance: number) {\n const resizeTargets: number[] = [];\n\n contentMeta.forEach((meta, idx) => {\n if (meta.currentSize !== undefined) {\n resizeTargets.push(idx);\n }\n });\n\n // we want the target being reduced first, this may limit the distance we can apply\n let target1 = distance < 0 ? resizeTargets[0] : resizeTargets[1];\n\n const { currentSize = 0, minSize = 0 } = contentMeta[target1];\n if (currentSize === minSize) {\n // size is already 0, we cannot go further\n return false;\n } else if (Math.abs(distance) > currentSize - minSize) {\n // reduce to 0\n const multiplier = distance < 0 ? -1 : 1;\n distance = Math.max(0, currentSize - minSize) * multiplier;\n }\n\n const leadingItem = contentMeta[resizeTargets[0]] as ContentMeta;\n const { currentSize: leadingSize = 0 } = leadingItem;\n leadingItem.currentSize = leadingSize + distance;\n\n const trailingItem = contentMeta[resizeTargets[1]] as ContentMeta;\n const { currentSize: trailingSize = 0 } = trailingItem;\n trailingItem.currentSize = trailingSize - distance;\n\n return true;\n}\n\nfunction createPlaceholder(index: number) {\n return React.createElement(Placeholder, {\n shim: index === 0,\n key: `placeholder-${index}`,\n } as any);\n}\n\nfunction measureElement(\n el: HTMLElement,\n dimension: \"width\" | \"height\"\n): FlexSize {\n const { [dimension]: size } = el.getBoundingClientRect();\n const style = getComputedStyle(el);\n const minSizeVal = style.getPropertyValue(`min-${dimension}`);\n const minSize = minSizeVal.endsWith(\"px\") ? parseInt(minSizeVal, 10) : 0;\n return { size, minSize };\n}\n", "import React, { HTMLAttributes, KeyboardEvent, useCallback, useRef, useState } from 'react';\nimport cx from 'classnames';\n\nimport './Splitter.css';\n\nexport type SplitterDragStartHandler = (index: number) => void;\nexport type SplitterDragHandler = (index: number, distance: number) => void;\nexport type SplitterDragEndHandler = () => void;\n\nexport interface SplitterProps\n extends Omit<HTMLAttributes<HTMLDivElement>, 'onDrag' | 'onDragStart'> {\n column: boolean;\n index: number;\n onDragStart: SplitterDragStartHandler;\n onDrag: SplitterDragHandler;\n onDragEnd: SplitterDragEndHandler;\n}\n\nexport const Splitter = React.memo(function Splitter({\n column,\n index,\n onDrag,\n onDragEnd,\n onDragStart,\n style\n}: SplitterProps) {\n const ignoreClick = useRef<boolean>();\n const rootRef = useRef<HTMLDivElement>(null);\n const lastPos = useRef<number>(0);\n\n const [active, setActive] = useState(false);\n\n const handleKeyDownDrag = useCallback(\n ({ key, shiftKey }) => {\n // TODO calc max distance\n const distance = shiftKey ? 10 : 1;\n if (column && key === 'ArrowDown') {\n onDrag(index, distance);\n } else if (column && key === 'ArrowUp') {\n onDrag(index, -distance);\n } else if (!column && key === 'ArrowLeft') {\n onDrag(index, -distance);\n } else if (!column && key === 'ArrowRight') {\n onDrag(index, distance);\n }\n },\n [column, index, onDrag]\n );\n\n const handleKeyDownInitDrag = useCallback(\n (evt) => {\n const { key } = evt;\n const horizontalMove = key === 'ArrowLeft' || key === 'ArrowRIght';\n const verticalMove = key === 'ArrowUp' || key === 'ArrowDown';\n if ((column && verticalMove) || (!column && horizontalMove)) {\n onDragStart(index);\n handleKeyDownDrag(evt);\n keyDownHandlerRef.current = handleKeyDownDrag;\n }\n },\n [column, handleKeyDownDrag, index, onDragStart]\n );\n\n const keyDownHandlerRef = useRef(handleKeyDownInitDrag);\n const handleKeyDown = (evt: KeyboardEvent) => keyDownHandlerRef.current(evt);\n\n const handleMouseMove = useCallback(\n (e) => {\n ignoreClick.current = true;\n const pos = e[column ? 'clientY' : 'clientX'];\n const diff = pos - lastPos.current;\n // we seem to get a final value of zero\n if (pos && pos !== lastPos.current) {\n onDrag(index, diff);\n }\n lastPos.current = pos;\n },\n [column, index, onDrag]\n );\n\n const handleMouseUp = useCallback(() => {\n window.removeEventListener('mousemove', handleMouseMove, false);\n window.removeEventListener('mouseup', handleMouseUp, false);\n onDragEnd();\n setActive(false);\n rootRef.current?.focus();\n }, [handleMouseMove, onDragEnd, setActive]);\n\n const handleMouseDown = useCallback(\n (e) => {\n lastPos.current = column ? e.clientY : e.clientX;\n onDragStart(index);\n window.addEventListener('mousemove', handleMouseMove, false);\n window.addEventListener('mouseup', handleMouseUp, false);\n e.preventDefault();\n setActive(true);\n },\n [column, handleMouseMove, handleMouseUp, index, onDragStart, setActive]\n );\n\n const handleFocus = () => {\n // TODO\n };\n\n const handleClick = () => {\n if (ignoreClick.current) {\n ignoreClick.current = false;\n } else {\n rootRef.current?.focus();\n }\n };\n\n const handleBlur = () => {\n // TODO\n keyDownHandlerRef.current = handleKeyDownInitDrag;\n };\n\n const className = cx('Splitter', 'focusable', { active, column });\n return (\n <div\n className={className}\n data-splitter\n ref={rootRef}\n role=\"separator\"\n style={style}\n onBlur={handleBlur}\n onClick={handleClick}\n onFocus={handleFocus}\n onKeyDown={handleKeyDown}\n onMouseDown={handleMouseDown}\n tabIndex={0}>\n <div className=\"grab-zone\" />\n </div>\n );\n});\n", "import React, { HTMLAttributes } from \"react\";\nimport cx from \"classnames\";\nimport { registerComponent } from \"../registry/ComponentRegistry\";\n\nimport \"./Placeholder.css\";\n\nconst classBase = \"vuuPlaceholder\";\n\nexport interface PlaceholderProps extends HTMLAttributes<HTMLDivElement> {\n closeable?: boolean;\n flexFill?: boolean;\n resizeable?: boolean;\n shim?: boolean;\n}\n\nexport const Placeholder = ({\n className,\n closeable,\n flexFill,\n resizeable,\n shim,\n ...props\n}: PlaceholderProps) => {\n return (\n <div\n className={cx(classBase, className, {\n [`${classBase}-shim`]: shim,\n })}\n {...props}\n data-placeholder\n data-resizeable\n >\n {/* <LayoutProviderVersion /> */}\n </div>\n );\n};\n\nPlaceholder.displayName = \"Placeholder\";\nregisterComponent(\"Placeholder\", Placeholder);\n", "import { CSSProperties } from 'react';\nexport type CSSFlexProperties = Pick<CSSProperties, 'flexBasis' | 'flexGrow' | 'flexShrink'>;\n\nexport const expandFlex = (flex: number | CSSFlexProperties): CSSFlexProperties => {\n if (typeof flex === 'number') {\n return {\n flexBasis: 0,\n flexGrow: 1,\n flexShrink: 1\n };\n } else {\n throw Error(`\"no support yet for flex value ${flex}`);\n }\n};\n", "import React, { ReactElement } from \"react\";\nimport { LayoutModel } from \"../layout-reducer\";\nimport { isContainer } from \"../registry/ComponentRegistry\";\nimport { getProp, getProps } from \"./propUtils\";\nimport { typeOf } from \"./typeOf\";\n\nconst removeFinalPathSegment = (path: string) => {\n const pos = path.lastIndexOf(\".\");\n if (pos === -1) {\n return path;\n } else {\n return path.slice(0, pos);\n }\n};\n\n// TODO isn't this equivalent to containerOf ?\nexport function followPathToParent(\n source: ReactElement,\n path: string\n): ReactElement | null {\n const { \"data-path\": dataPath, path: sourcePath = dataPath } =\n getProps(source);\n\n if (path === \"0\") return null;\n if (path === sourcePath) return null;\n\n return followPath(source, removeFinalPathSegment(path), true);\n}\n\nexport function findTarget(\n source: LayoutModel,\n test: (props: any) => boolean\n): LayoutModel | undefined {\n const { children, ...props } = getProps(source);\n if (test(props)) {\n return source;\n } else if (React.Children.count(children) > 0) {\n const array = React.isValidElement(children) ? [children] : children;\n for (let child of array) {\n const target = findTarget(child, test);\n if (target) {\n return target;\n }\n }\n }\n}\n\nexport function containerOf(\n source: LayoutModel,\n target: LayoutModel\n): LayoutModel | null {\n if (target === source) {\n return null;\n } else {\n const { path: sourcePath, children } = getProps(source);\n\n let { idx, finalStep } = nextStep(sourcePath, getProp(target, \"path\"));\n if (finalStep) {\n return source;\n } else if (children === undefined || children[idx] === undefined) {\n return null;\n } else {\n return containerOf(children[idx], target);\n }\n }\n}\n\n// Do not use React.Children.toArray,\n// it does not preserve keys\nexport const getChild = (\n children: ReactElement[],\n idx: number\n): ReactElement | undefined => {\n // idx may be a nu,mber or string\n if (React.isValidElement(children) && idx == 0) {\n return children;\n } else if (Array.isArray(children)) {\n return children[idx];\n }\n};\n\n// Use a path only to identify a component\nexport function followPathToComponent(component: ReactElement, path: string) {\n var paths = path.split(\".\");\n let children = [component];\n\n const getChildren = (c: ReactElement) =>\n React.isValidElement(c.props.children)\n ? [c.props.children]\n : c.props.children;\n\n for (let i = 0; i < paths.length; i++) {\n const idx = parseInt(paths[i]);\n const child = children[idx];\n if (i === paths.length - 1) {\n return child;\n } else {\n children = getChildren(child);\n }\n }\n}\n\nexport function followPath(\n source: LayoutModel,\n path: string\n): LayoutModel | undefined;\nexport function followPath(\n source: ReactElement,\n path: string,\n throwIfNotFound: true\n): ReactElement;\nexport function followPath(source: any, path: any, throwIfNotFound = false) {\n const { \"data-path\": dataPath, path: sourcePath = dataPath } =\n getProps(source);\n if (path.indexOf(sourcePath) !== 0) {\n throw Error(\n `pathUtils.followPath path ${path} is not within source path ${sourcePath}`\n );\n }\n const route = path.slice(sourcePath.length + 1);\n if (route === \"\") {\n return source;\n }\n\n let target = source;\n const paths = route.split(\".\");\n\n for (var i = 0; i < paths.length; i++) {\n if (React.Children.count(target.props.children) === 0) {\n const message = `element at 0.${paths\n .slice(0, i)\n .join(\".\")} has no children, so cannot fulfill rest of path ${paths\n .slice(i)\n .join(\".\")}`;\n\n if (throwIfNotFound) {\n throw Error(message);\n } else {\n console.warn(message);\n return;\n }\n }\n\n target = getChild(target.props.children, parseInt(paths[i]));\n\n if (target === undefined) {\n const message = `model at 0.${paths\n .slice(0, i)\n .join(\".\")} has no children that fulfill next step of path ${paths\n .slice(i)\n .join(\".\")}`;\n\n if (throwIfNotFound) {\n throw Error(message);\n } else {\n console.warn(message);\n }\n }\n }\n return target;\n}\n\nexport function nextLeaf(root: ReactElement, path: string) {\n const parent = followPathToParent(root, path);\n let pathIndices = path.split(\".\").map((idx) => parseInt(idx, 10));\n if (parent) {\n const lastIdx = pathIndices.pop();\n const { children } = parent.props;\n if (children.length - 1 > lastIdx!) {\n return firstLeaf(children[lastIdx! + 1]);\n } else {\n const parentIdx = pathIndices.pop();\n const nextParent = followPathToParent(root, getProp(parent, \"path\"));\n if (nextParent && typeof parentIdx === \"number\") {\n pathIndices = nextParent.props.path\n .split(\".\")\n .map((idx: string) => parseInt(idx, 10));\n if (nextParent.props.children.length - 1 > parentIdx) {\n const nextStep = nextParent.props.children[parentIdx + 1];\n if (isContainer(typeOf(nextStep) as string)) {\n return firstLeaf(nextStep);\n } else {\n return nextStep;\n }\n }\n }\n }\n }\n\n return firstLeaf(root);\n}\n\nexport function previousLeaf(root: ReactElement, path: string) {\n let pathIndices = path.split(\".\").map((idx) => parseInt(idx, 10));\n let lastIdx = pathIndices.pop();\n let parent = followPathToParent(root, path);\n if (parent != null && typeof lastIdx === \"number\") {\n const { children } = parent.props;\n if (lastIdx > 0) {\n return lastLeaf(children[lastIdx - 1]);\n } else {\n while (pathIndices.length > 1) {\n lastIdx = pathIndices.pop() as number;\n parent = followPathToParent(\n root,\n getProp(parent, \"path\")\n ) as ReactElement;\n // pathIndices = nextParent.props.path\n // .split(\".\")\n // .map((idx) => parseInt(idx, 10));\n if (lastIdx > 0) {\n const nextStep = parent.props.children[lastIdx - 1];\n if (isContainer(typeOf(nextStep) as string)) {\n return lastLeaf(nextStep);\n } else {\n return nextStep;\n }\n }\n }\n }\n }\n return lastLeaf(root);\n}\n\nfunction firstLeaf(layoutRoot: ReactElement): ReactElement {\n if (isContainer(typeOf(layoutRoot) as string)) {\n const { children } = layoutRoot.props || layoutRoot;\n return firstLeaf(children[0]);\n } else {\n return layoutRoot;\n }\n}\n\nfunction lastLeaf(root: ReactElement): ReactElement {\n if (isContainer(typeOf(root) as string)) {\n const { children } = root.props || root;\n return lastLeaf(children[children.length - 1]);\n } else {\n return root;\n }\n}\n\ntype NextStepResult = {\n idx: number;\n finalStep: boolean;\n};\n\nexport function nextStep(\n pathSoFar: string,\n targetPath: string,\n followPathToEnd = false\n): NextStepResult {\n if (pathSoFar === targetPath) {\n return { idx: -1, finalStep: true };\n }\n\n const pathVisited = `${pathSoFar}.`;\n if (!targetPath.startsWith(pathVisited)) {\n throw Error(\"pathUtils nextStep has strayed from the path\");\n }\n\n const endOfTheLine = followPathToEnd ? 0 : 1;\n // check that pathSoFar startsWith targetPath and if not, throw\n const paths = targetPath\n .replace(pathVisited, \"\")\n .split(\".\")\n .map((n) => parseInt(n, 10));\n return { idx: paths[0], finalStep: paths.length === endOfTheLine };\n}\n\nexport function resetPath(\n model: ReactElement,\n path: string,\n additionalProps?: any\n): ReactElement {\n if (getProp(model, \"path\") === path) {\n return model;\n }\n const children: ReactElement[] = [];\n // React.Children.map rewrites keys, forEach does not\n React.Children.forEach(model.props.children, (child, i) => {\n if (!getProp(child, \"path\")) {\n children.push(child);\n } else {\n children.push(resetPath(child, `${path}.${i}`));\n }\n });\n const pathPropName = model.props[\"data-path\"] ? \"data-path\" : \"path\";\n return React.cloneElement(\n model,\n { [pathPropName]: path, ...additionalProps },\n children\n );\n}\n", "import { ReactElement } from 'react';\nimport { LayoutModel } from '../layout-reducer';\n\nconst NO_PROPS = {};\nexport const getProp = (component: LayoutModel, propName: string) => {\n const props = getProps(component);\n return props[propName] ?? props[`data-${propName}`];\n};\n\nexport const getProps = (component?: LayoutModel) => component?.props || component || NO_PROPS;\n\n// Used when a container is expected to have a single child\nexport const getChildProp = (container: LayoutModel) => {\n const props = getProps(container);\n if (props.children) {\n const {\n children: [target, ...rest]\n } = props;\n if (rest.length > 0) {\n console.warn(`getChild expected a single child, found ${rest.length + 1}`);\n }\n return target as ReactElement;\n }\n};\n", "import { ReactElement } from 'react';\nimport { LayoutModel, WithType } from '../layout-reducer';\n\n//TODO this should throw if we cannot identify a type\nexport function typeOf(element?: LayoutModel | WithType): string | undefined {\n if (element) {\n const type = element.type as any;\n if (typeof type === 'function' || typeof type === 'object') {\n const elementName = type.displayName || type.name || type.type?.name;\n if (typeof elementName === 'string') {\n return elementName;\n }\n } else if (typeof element.type === 'string') {\n return element.type;\n } else if (element.constructor) {\n return (element.constructor as any).displayName as string;\n }\n throw Error(`typeOf unable to determine type of element`);\n }\n}\n\nexport const isTypeOf = (element: ReactElement, type: string) => typeOf(element) === type;\n", "import React from 'react';\nimport { LayoutJSON } from '../layout-reducer';\nimport { ComponentRegistry } from '../registry/ComponentRegistry';\n\nexport function componentFromLayout(layoutModel: LayoutJSON) {\n\n const { id, type, props, children: layoutChildren } = layoutModel;\n const ReactType = getComponentType(type);\n let children =\n !layoutChildren || layoutChildren.length === 0\n ? null\n : layoutChildren.length === 1\n ? componentFromLayout(layoutChildren[0])\n : layoutChildren.map(componentFromLayout);\n\n return (\n <ReactType {...props} key={id}>\n {children}\n </ReactType>\n );\n}\n\n// support for built-in react ttpes (div etc) removed here\nfunction getComponentType(type: string) {\n const reactType = ComponentRegistry[type];\n if (reactType === undefined){\n throw Error('componentFromLayout: unknown component type: ' + type);\n }\n return reactType;\n}\n", "import { MutableRefObject } from \"react\";\n\nexport function setRef<T>(\n ref:\n | MutableRefObject<T | null>\n | ((instance: T | null) => void)\n | null\n | undefined,\n value: T | null\n): void {\n if (typeof ref === \"function\") {\n ref(value);\n } else if (ref) {\n ref.current = value;\n }\n}\n", "import React from \"react\";\nimport { CSSProperties, ReactElement, ReactNode } from \"react\";\nimport { uuid } from \"@vuu-ui/vuu-utils\";\nimport { ComponentRegistry } from \"../registry/ComponentRegistry\";\nimport { getProps, resetPath } from \"../utils\";\nimport { dimension, rect, rectTuple } from \"../common-types\";\nimport { DropPos } from \"../drag-drop/dragDropTypes\";\nconst placeHolderProps = { \"data-placeholder\": true, \"data-resizeable\": true };\n\nconst NO_STYLE = {};\nconst auto = \"auto\";\nconst defaultFlexStyle = {\n flexBasis: 0,\n flexGrow: 1,\n flexShrink: 1,\n height: auto,\n width: auto,\n};\n\nconst CROSS_DIMENSION = {\n height: \"width\",\n width: \"height\",\n};\n\nexport type flexDirection = \"row\" | \"column\";\n\ntype contraDimension = dimension;\ntype flexDimensionTuple = [dimension, contraDimension, flexDirection];\nexport type position = {\n height?: number;\n width?: number;\n};\n\nexport const getFlexDimensions = (flexDirection: flexDirection = \"row\") => {\n if (flexDirection === \"row\") {\n return [\"width\", \"height\", \"column\"] as flexDimensionTuple;\n } else {\n return [\"height\", \"width\", \"row\"] as flexDimensionTuple;\n }\n};\n\nconst isPercentageSize = (value: string | number) =>\n typeof value === \"string\" && value.endsWith(\"%\");\n\nexport const getIntrinsicSize = (\n component: ReactElement\n): { height?: number; width?: number } | undefined => {\n const { style: { width = auto, height = auto } = NO_STYLE } = component.props;\n\n // Eliminate 'auto' and percentage sizes\n const numHeight = typeof height === \"number\";\n const numWidth = typeof width === \"number\";\n\n if (numHeight && numWidth) {\n return { height, width };\n } else if (numHeight) {\n return { height };\n } else if (numWidth) {\n return { width };\n } else {\n return undefined;\n }\n};\n\nexport function getFlexStyle(\n component: ReactElement,\n dimension: dimension,\n pos?: DropPos\n) {\n const crossDimension = CROSS_DIMENSION[dimension];\n const {\n style: {\n [crossDimension]: intrinsicCrossSize = auto,\n ...intrinsicStyles\n } = NO_STYLE,\n } = component.props;\n\n if (pos && pos[dimension]) {\n return {\n ...intrinsicStyles,\n ...defaultFlexStyle,\n flexBasis: pos[dimension],\n flexGrow: 0,\n flexShrink: 0,\n };\n } else {\n return {\n ...intrinsicStyles,\n ...defaultFlexStyle,\n [crossDimension]: intrinsicCrossSize,\n };\n }\n}\n\n//TODO this is not comprehensive\nexport function hasUnboundedFlexStyle(component: ReactElement) {\n const { style: { flex, flexGrow, flexShrink, flexBasis } = NO_STYLE } =\n component.props;\n // console.log(`flex ${flex}, flexBasis ${flexBasis}, flexShrink ${flexShrink}, flexGrow ${flexGrow}`)\n if (typeof flex === \"number\") {\n return true;\n } else if (flexBasis === 0 && flexGrow === 1 && flexShrink === 1) {\n return true;\n } else if (typeof flexBasis === \"number\") {\n return false;\n } else {\n return true;\n }\n}\n\nexport function getFlexOrIntrinsicStyle(\n component: ReactElement,\n dimension: dimension,\n pos: position\n) {\n const crossDimension = CROSS_DIMENSION[dimension];\n const {\n style: {\n [dimension]: intrinsicSize = auto,\n [crossDimension]: intrinsicCrossSize = auto,\n ...intrinsicStyles\n } = NO_STYLE,\n } = component.props;\n\n if (intrinsicSize !== auto) {\n if (isPercentageSize(intrinsicSize)) {\n return {\n // Is this right? discrad the percenbtage size ?\n flexBasis: 0,\n flexGrow: 1,\n flexShrink: 1,\n [dimension]: undefined,\n [crossDimension]: intrinsicCrossSize,\n };\n } else {\n return {\n // or should we leave this as auto until user resizes ?\n flexBasis: intrinsicSize,\n flexGrow: 0,\n flexShrink: 0,\n [dimension]: intrinsicSize,\n [crossDimension]: intrinsicCrossSize,\n };\n }\n } else if (pos && pos[dimension]) {\n return {\n ...intrinsicStyles,\n ...defaultFlexStyle,\n flexBasis: pos[dimension],\n flexGrow: 0,\n flexShrink: 0,\n };\n } else {\n return {\n ...intrinsicStyles,\n // ...defaultFlexStyle,\n [crossDimension]: intrinsicCrossSize,\n };\n }\n}\n\nexport function wrapIntrinsicSizeComponentWithFlexbox(\n component: ReactElement,\n flexDirection: flexDirection,\n path: string,\n clientRect?: rect,\n dropRect?: rectTuple\n) {\n const wrappedChildren = [];\n let pathIndex = 0;\n let endPlaceholder;\n\n if (clientRect && dropRect) {\n let startPlaceholder;\n const [dropLeft, dropTop, dropRight, dropBottom] = dropRect;\n [startPlaceholder, endPlaceholder] =\n flexDirection === \"column\"\n ? [dropTop - clientRect.top, clientRect.bottom - dropBottom]\n : [dropLeft - clientRect.left, clientRect.right - dropRight];\n\n if (startPlaceholder) {\n wrappedChildren.push(\n createPlaceHolder(`${path}.${pathIndex++}`, startPlaceholder, {\n flexGrow: 0,\n flexShrink: 0,\n })\n );\n }\n } else {\n // If we don't pass the rect values, we are wrapping an existing child, this is always a trailing placeholder\n endPlaceholder = true;\n }\n\n const { version = 0, style } = getProps(component);\n\n wrappedChildren.push(\n resetPath(component, `${path}.${pathIndex++}`, {\n version: version + 1,\n style: {\n ...style,\n flexBasis: \"auto\",\n flexGrow: 0,\n flexShrink: 0,\n },\n })\n );\n\n if (endPlaceholder) {\n wrappedChildren.push(\n createPlaceHolder(`${path}.${pathIndex++}`, 0, undefined, {\n [`data-${flexDirection}-placeholder`]: true,\n })\n );\n }\n\n return createFlexbox(\n flexDirection,\n { resizeable: false, style: { flexBasis: \"auto\" } },\n wrappedChildren,\n path\n );\n}\n\nconst getFlexValue = (flexBasis: number, flexFill: boolean) => {\n if (flexFill) {\n return undefined;\n } else if (flexBasis === 0) {\n return 1;\n } else {\n return 0;\n }\n};\n\nexport function createFlexbox(\n flexDirection: flexDirection,\n props: any,\n children: ReactNode,\n path: string\n) {\n const id = uuid();\n const { flexFill, style, resizeable = true } = props;\n const { flexBasis = flexFill ? undefined : \"auto\" } = style;\n const flex = getFlexValue(flexBasis, flexFill);\n return React.createElement<any>(\n ComponentRegistry.Flexbox,\n {\n id,\n key: id,\n path,\n flexFill,\n style: {\n ...style,\n flexDirection,\n flexBasis,\n flexGrow: flex,\n flexShrink: flex,\n },\n resizeable,\n },\n children\n );\n}\n\nconst baseStyle = { flexGrow: 1, flexShrink: 1 };\n\nexport function createPlaceHolder(\n path: string,\n size: number,\n style?: CSSProperties,\n props?: any\n) {\n const id = uuid();\n return React.createElement(\"div\", {\n ...placeHolderProps,\n ...props,\n \"data-path\": path,\n id,\n key: id,\n style: { ...baseStyle, ...style, flexBasis: size },\n });\n}\n", "import { getProp } from '../utils';\nimport { getIntrinsicSize, hasUnboundedFlexStyle } from '../layout-reducer/flexUtils';\nimport { ReactElement } from 'react';\nimport type { BreakPoint, ContentMeta } from './flexboxTypes';\n\nconst NO_INTRINSIC_SIZE: {\n height?: number;\n width?: number;\n} = {};\n\nexport const SPLITTER = 1;\nexport const PLACEHOLDER = 2;\n\nconst isIntrinsicallySized = (item: ContentMeta) => typeof item.intrinsicSize === 'number';\n\nconst getBreakPointValues = (breakPoints: BreakPoint[], component: ReactElement) => {\n const values: { [key: string]: number | undefined } = {};\n breakPoints.forEach((breakPoint) => {\n values[breakPoint] = getProp(component, breakPoint);\n });\n return values;\n};\n\nexport const gatherChildMeta = (\n children: ReactElement[],\n dimension: 'width' | 'height',\n breakPoints?: BreakPoint[]\n) => {\n return children.map((child, index) => {\n const resizeable = getProp(child, 'resizeable');\n const { [dimension]: intrinsicSize } = getIntrinsicSize(child) ?? NO_INTRINSIC_SIZE;\n const flexOpen = hasUnboundedFlexStyle(child);\n if (breakPoints) {\n return {\n index,\n flexOpen,\n intrinsicSize,\n resizeable,\n ...getBreakPointValues(breakPoints, child)\n };\n } else {\n return { index, flexOpen, intrinsicSize, resizeable };\n }\n });\n};\n\n// Splitters are inserted AFTER the associated index, so\n// never a splitter in last position.\n// Placeholder goes before (first) OR after(last) index\nexport const findSplitterAndPlaceholderPositions = (childMeta: ContentMeta[]) => {\n const count = childMeta.length;\n const allIntrinsic = childMeta.every(isIntrinsicallySized);\n const splitterPositions = Array(count).fill(0);\n if (allIntrinsic) {\n splitterPositions[0] = PLACEHOLDER;\n splitterPositions[count - 1] = PLACEHOLDER;\n }\n if (count < 2) {\n return splitterPositions;\n } else {\n // 1) From the left, check each item.\n // Once we hit a resizable item, set this index and all subsequent indices,\n // except for last, to SPLITTER\n for (let i = 0, resizeablesLeft = 0; i < count - 1; i++) {\n if (childMeta[i].resizeable && !resizeablesLeft) {\n resizeablesLeft = SPLITTER;\n }\n splitterPositions[i] += resizeablesLeft;\n }\n // 2) Now check from the right. Undo splitter insertion until we reach a point\n // where there is a resizeable to our right.\n for (let i = count - 1; i > 0; i--) {\n if (splitterPositions[i] & SPLITTER) {\n splitterPositions[i] -= SPLITTER;\n }\n if (childMeta[i].resizeable) {\n break;\n }\n }\n return splitterPositions;\n }\n};\n\nexport const identifyResizeParties = (contentMeta: ContentMeta[], idx: number) => {\n const idx1 = getLeadingResizeablePos(contentMeta, idx);\n const idx2 = getTrailingResizeablePos(contentMeta, idx);\n const participants = idx1 !== -1 && idx2 !== -1 ? [idx1, idx2] : undefined;\n const bystanders = identifyResizeBystanders(contentMeta, participants);\n return [participants, bystanders];\n};\n\nfunction identifyResizeBystanders(contentMeta: ContentMeta[], participants?: number[]) {\n if (participants) {\n let bystanders = [];\n for (let i = 0; i < contentMeta.length; i++) {\n if (contentMeta[i].flexOpen && !participants.includes(i)) {\n bystanders.push(i);\n }\n }\n return bystanders;\n }\n}\n\nfunction getLeadingResizeablePos(contentMeta: ContentMeta[], idx: number) {\n let pos = idx,\n resizeable = false;\n while (pos >= 1 && !resizeable) {\n pos = pos - 1;\n resizeable = isResizeable(contentMeta, pos);\n }\n return pos;\n}\n\nfunction getTrailingResizeablePos(contentMeta: ContentMeta[], idx: number) {\n let pos = idx,\n resizeable = false,\n count = contentMeta.length;\n while (pos < count && !resizeable) {\n pos = pos + 1;\n resizeable = isResizeable(contentMeta, pos);\n }\n return pos === count ? -1 : pos;\n}\n\nfunction isResizeable(contentMeta: ContentMeta[], idx: number): boolean {\n const { placeholder, splitter, resizeable, intrinsicSize } = contentMeta[idx];\n return Boolean(!splitter && !intrinsicSize && (placeholder || resizeable));\n}\n", "import React, { useCallback } from 'react';\nimport Flexbox from './Flexbox';\nimport { Action } from '../layout-action';\nimport { registerComponent } from '../registry/ComponentRegistry';\nimport { useLayoutProviderDispatch } from '../layout-provider';\n\nexport const FlexboxLayout = function FlexboxLayout(props) {\n const { path } = props;\n const dispatch = useLayoutProviderDispatch();\n\n const handleSplitterMoved = useCallback(\n (sizes) => {\n dispatch({\n type: Action.SPLITTER_RESIZE,\n path,\n sizes\n });\n },\n [dispatch, path]\n );\n\n return <Flexbox {...props} onSplitterMoved={handleSplitterMoved} />;\n};\nFlexboxLayout.displayName = 'Flexbox';\n\nregisterComponent('Flexbox', FlexboxLayout, 'container');\n", "export const Action = {\n ADD: 'add',\n BLUR: 'blur',\n BLUR_SPLITTER: 'blur-splitter',\n DRAG_START: 'drag-start',\n DRAG_STARTED: 'drag-started',\n DRAG_DROP: 'drag-drop',\n FOCUS: 'focus',\n FOCUS_SPLITTER: 'focus-splitter',\n INITIALIZE: 'initialize',\n MAXIMIZE: 'maximize',\n MINIMIZE: 'minimize',\n REMOVE: 'remove',\n REPLACE: 'replace',\n RESTORE: 'restore',\n SAVE: 'save',\n SET_TITLE: 'set-title',\n SPLITTER_RESIZE: 'splitter-resize',\n SWITCH_TAB: 'switch-tab',\n TEAR_OUT: 'tear-out'\n};\n", "import React, {\n MutableRefObject,\n ReactElement,\n useCallback,\n useContext,\n useEffect,\n useRef,\n useState,\n} from \"react\";\nimport {\n LayoutActionType,\n layoutFromJson,\n LayoutJSON,\n layoutReducer,\n LayoutReducerAction,\n layoutToJSON,\n processLayoutElement,\n} from \"../layout-reducer\";\nimport { findTarget, getChildProp, getProps, typeOf } from \"../utils\";\nimport {\n LayoutProviderContext,\n LayoutProviderDispatch,\n} from \"./LayoutProviderContext\";\nimport { useLayoutDragDrop } from \"./useLayoutDragDrop\";\n\nconst withDropTarget = (props: any) => props.dropTarget;\nconst shouldSave = (action: LayoutReducerAction) =>\n [\n \"drag-drop\",\n \"remove\",\n \"set-title\",\n \"splitter-resize\",\n \"switch-tab\",\n ].includes(action.type);\n\ntype LayoutChangeHandler = (layout: LayoutJSON, source: string) => void;\n\nexport interface LayoutProviderProps {\n children: ReactElement;\n layout?: LayoutJSON;\n onLayoutChange?: LayoutChangeHandler;\n}\n\nexport const LayoutProviderVersion = () => {\n const version = useLayoutProviderVersion();\n return <div>{`Context: ${version} `}</div>;\n};\n\nexport const LayoutProvider = (props: LayoutProviderProps): ReactElement => {\n const { children, layout, onLayoutChange } = props;\n const state = useRef<ReactElement | undefined>(undefined);\n const childrenRef = useRef<ReactElement>(children);\n\n const [, forceRefresh] = useState<any>(null);\n\n const serializeState = useCallback(\n (source) => {\n if (onLayoutChange) {\n const targetContainer =\n findTarget(source, withDropTarget) || state.current;\n const isDraggableLayout = typeOf(targetContainer) === \"DraggableLayout\";\n const target = isDraggableLayout\n ? getProps(targetContainer).children[0]\n : targetContainer;\n const serializedModel = layoutToJSON(target);\n onLayoutChange(serializedModel, \"drag-root\");\n }\n },\n [onLayoutChange]\n );\n\n const dispatchLayoutAction = useCallback(\n (action: LayoutReducerAction, suppressSave = false) => {\n const nextState = layoutReducer(state.current as ReactElement, action);\n if (nextState !== state.current) {\n state.current = nextState;\n forceRefresh({});\n if (!suppressSave && shouldSave(action)) {\n serializeState(nextState);\n }\n }\n },\n [serializeState]\n );\n\n const layoutActionDispatcher: LayoutProviderDispatch = useCallback(\n (action) => {\n // onsole.log(\n // `%cdispatchLayoutProviderAction ${action.type}`,\n // \"color: blue; font-weight: bold;\"\n // );\n\n if (action.type === \"drag-start\") {\n prepareToDragLayout(action);\n } else if (action.type === \"save\") {\n serializeState(state.current);\n } else if (state.current) {\n dispatchLayoutAction(action);\n }\n },\n [dispatchLayoutAction, serializeState]\n );\n\n const prepareToDragLayout = useLayoutDragDrop(\n state as MutableRefObject<ReactElement>,\n layoutActionDispatcher\n );\n\n useEffect(() => {\n if (layout) {\n const targetContainer = findTarget(\n state.current as any,\n withDropTarget\n ) as ReactElement;\n const target = getChildProp(targetContainer);\n const newLayout = layoutFromJson(\n layout,\n `${targetContainer.props.path}.0`\n );\n const action = target\n ? {\n type: LayoutActionType.REPLACE,\n target,\n replacement: newLayout,\n }\n : {\n type: LayoutActionType.ADD,\n path: targetContainer.props.path,\n component: newLayout,\n };\n dispatchLayoutAction(action, true);\n }\n }, [dispatchLayoutAction, layout]);\n\n if (state.current === undefined) {\n state.current = processLayoutElement(children);\n } else if (children !== childrenRef.current) {\n state.current = processLayoutElement(children, state.current);\n childrenRef.current = children;\n }\n\n return (\n <LayoutProviderContext.Provider\n value={{ dispatchLayoutProvider: layoutActionDispatcher, version: 0 }}\n >\n {state.current}\n </LayoutProviderContext.Provider>\n );\n};\n\nexport const useLayoutProviderDispatch = () => {\n const { dispatchLayoutProvider } = useContext(LayoutProviderContext);\n return dispatchLayoutProvider;\n};\n\nexport const useLayoutProviderVersion = () => {\n console.log({ LayoutProviderContext });\n const { version } = useContext(LayoutProviderContext);\n return version;\n};\n", "import React, { ReactElement } from \"react\";\nimport { isContainer } from \"../registry/ComponentRegistry\";\nimport {\n findTarget,\n followPath,\n followPathToParent,\n getProp,\n getProps,\n typeOf,\n} from \"../utils\";\nimport { getIntrinsicSize } from \"./flexUtils\";\nimport {\n getInsertTabBeforeAfter,\n insertBesideChild,\n insertIntoContainer,\n} from \"./insert-layout-element\";\nimport {\n AddAction,\n DragDropAction,\n LayoutReducerAction,\n LayoutActionType,\n SetTitleAction,\n SwitchTabAction,\n MaximizeAction,\n} from \"./layoutTypes\";\nimport { LayoutProps } from \"./layoutUtils\";\nimport { removeChild } from \"./remove-layout-element\";\nimport {\n replaceChild,\n swapChild,\n _replaceChild,\n} from \"./replace-layout-element\";\nimport { resizeFlexChildren } from \"./resize-flex-children\";\nimport { wrap } from \"./wrap-layout-element\";\nimport { DropPos } from \"../drag-drop/dragDropTypes\";\nimport { DropTarget } from \"../drag-drop/DropTarget\";\n\n// const handlers: Handlers = {\n// [Action.MAXIMIZE]: setChildProps,\n// [Action.MINIMIZE]: setChildProps,\n// [Action.RESTORE]: setChildProps,\n// };\n\nexport const layoutReducer = (\n state: ReactElement,\n action: LayoutReducerAction\n): ReactElement => {\n switch (action.type) {\n case LayoutActionType.ADD:\n return addChild(state, action);\n case LayoutActionType.DRAG_DROP:\n return dragDrop(state, action);\n case LayoutActionType.MAXIMIZE:\n return setChildProps(state, action);\n case LayoutActionType.REMOVE:\n return removeChild(state, action);\n case LayoutActionType.REPLACE:\n return replaceChild(state, action);\n case LayoutActionType.SET_TITLE:\n return setTitle(state, action);\n case LayoutActionType.SPLITTER_RESIZE:\n return resizeFlexChildren(state, action);\n case LayoutActionType.SWITCH_TAB:\n return switchTab(state, action);\n default:\n console.warn(\n `layoutActionHandlers. No handler for action.type ${\n (action as any).type\n }`\n );\n return state;\n }\n};\n\nfunction switchTab(state: ReactElement, { path, nextIdx }: SwitchTabAction) {\n var target = followPath(state, path, true);\n const replacement = React.cloneElement<any>(target, {\n active: nextIdx,\n });\n return swapChild(state, target, replacement);\n}\n\nfunction setTitle(state: ReactElement, { path, title }: SetTitleAction) {\n var target = followPath(state, path, true);\n const replacement = React.cloneElement(target, {\n title,\n });\n return swapChild(state, target, replacement);\n}\n\nfunction setChildProps(state: ReactElement, { path, type }: MaximizeAction) {\n if (path) {\n // path will always be set here. Need to distinguisj ViewAction from LayoutAction\n var target = followPath(state, path, true);\n return swapChild(state, target, target, type);\n } else {\n return state;\n }\n}\n\nfunction dragDrop(\n layoutRoot: ReactElement,\n action: DragDropAction\n): ReactElement {\n console.log(\"drag drop\");\n const {\n draggedReactElement: newComponent,\n dragInstructions,\n dropTarget,\n } = action;\n const existingComponent = dropTarget.component as ReactElement;\n const { pos } = dropTarget;\n const destinationTabstrip =\n pos?.position?.Header && typeOf(existingComponent) === \"Stack\";\n const { id, version } = getProps(newComponent);\n const intrinsicSize = getIntrinsicSize(newComponent);\n let newLayoutRoot: ReactElement;\n if (destinationTabstrip) {\n const [targetTab, insertionPosition] = getInsertTabBeforeAfter(\n existingComponent!,\n pos\n );\n if (targetTab === undefined) {\n newLayoutRoot = insertIntoContainer(\n layoutRoot,\n existingComponent,\n newComponent\n );\n } else {\n newLayoutRoot = insertBesideChild(\n layoutRoot,\n targetTab,\n newComponent,\n insertionPosition\n );\n }\n } else if (!intrinsicSize && pos?.position?.Centre) {\n newLayoutRoot = _replaceChild(\n layoutRoot,\n existingComponent as ReactElement,\n newComponent\n );\n } else {\n newLayoutRoot = dropLayoutIntoContainer(\n layoutRoot,\n dropTarget as DropTarget,\n newComponent\n );\n }\n\n // return newLayoutRoot\n\n if (dragInstructions.DoNotRemove) {\n return newLayoutRoot;\n } else {\n const finalTarget = findTarget(\n newLayoutRoot,\n (props: LayoutProps) => props.id === id && props.version === version\n ) as ReactElement;\n const finalPath = getProp(finalTarget, \"path\");\n return removeChild(newLayoutRoot, { path: finalPath, type: \"remove\" });\n }\n}\n\nfunction addChild(\n layoutRoot: ReactElement,\n { path: containerPath, component }: AddAction\n) {\n return insertIntoContainer(\n layoutRoot,\n followPath(layoutRoot, containerPath) as ReactElement,\n component\n );\n}\n\nfunction dropLayoutIntoContainer(\n layoutRoot: ReactElement,\n dropTarget: DropTarget,\n newComponent: ReactElement\n): ReactElement {\n const {\n component: existingComponent,\n pos,\n clientRect,\n dropRect,\n } = dropTarget;\n const existingComponentPath = getProp(existingComponent, \"path\");\n // In a Draggable layout, 0.n is the top-level layout\n if (\n /* existingComponent.path === '0.0' || */ existingComponentPath === \"0.0\"\n ) {\n return wrap(layoutRoot, existingComponent, newComponent, pos);\n } else {\n var targetContainer = followPathToParent(\n layoutRoot,\n existingComponentPath\n ) as ReactElement;\n\n if (withTheGrain(pos, targetContainer)) {\n const insertionPosition = pos.position.SouthOrEast ? \"after\" : \"before\";\n return insertBesideChild(\n layoutRoot,\n existingComponent,\n newComponent,\n insertionPosition,\n pos,\n clientRect,\n dropRect\n );\n } else if (!withTheGrain(pos, targetContainer)) {\n return wrap(\n layoutRoot,\n existingComponent,\n newComponent,\n pos,\n clientRect,\n dropRect\n );\n } else if (isContainer(typeOf(targetContainer) as string)) {\n return wrap(layoutRoot, existingComponent, newComponent, pos);\n } else {\n throw Error(`no support right now for position = ${pos.position}`);\n }\n }\n\n return layoutRoot;\n}\n\n// Note: withTheGrain is not the negative of againstTheGrain - the difference lies in the\n// handling of non-Flexible containers, the response for which is always false;\nfunction withTheGrain(pos: DropPos, container: ReactElement) {\n if (pos.position.Centre) {\n return isTerrace(container) || isTower(container);\n }\n\n return pos.position.NorthOrSouth\n ? isTower(container)\n : pos.position.EastOrWest\n ? isTerrace(container)\n : false;\n}\n\nfunction isTower(container: ReactElement) {\n return (\n typeOf(container) === \"Flexbox\" &&\n container.props.style.flexDirection === \"column\"\n );\n}\n\nfunction isTerrace(container: ReactElement) {\n return (\n typeOf(container) === \"Flexbox\" &&\n container.props.style.flexDirection !== \"column\"\n );\n}\n", "import React, { ReactElement } from \"react\";\nimport { uuid } from \"@vuu-ui/vuu-utils\";\nimport { getManagedDimension, LayoutProps } from \"./layoutUtils\";\nimport { getProp, getProps, nextStep, resetPath, typeOf } from \"../utils\";\nimport {\n createPlaceHolder,\n flexDirection,\n getFlexDimensions,\n getFlexOrIntrinsicStyle,\n getIntrinsicSize,\n wrapIntrinsicSizeComponentWithFlexbox,\n} from \"./flexUtils\";\nimport { LayoutModel, LayoutRoot } from \"./layoutTypes\";\nimport { DropPos } from \"../drag-drop\";\nimport { DropTarget } from \"../drag-drop/DropTarget\";\nimport { rectTuple } from \"../common-types\";\n\ntype insertionPosition = \"before\" | \"after\";\n\nexport function getInsertTabBeforeAfter(stack: LayoutModel, pos: DropPos) {\n const tabs = stack.props.children;\n const tabCount = tabs.length;\n const { index = -1, positionRelativeToTab = \"after\" } = pos.tab || {};\n return index === -1 || index >= tabCount\n ? [tabs[tabCount - 1], \"after\"]\n : [tabs[index] ?? null, positionRelativeToTab];\n}\n\nexport function insertIntoContainer(\n container: ReactElement,\n targetContainer: ReactElement,\n newComponent: ReactElement\n): ReactElement {\n const {\n active: containerActive,\n children: containerChildren = [],\n path: containerPath,\n } = getProps(container) as LayoutProps;\n\n const existingComponentPath = getProp(targetContainer, \"path\");\n const { idx, finalStep } = nextStep(\n containerPath!,\n existingComponentPath,\n true\n );\n const [insertedIdx, children] = finalStep\n ? insertIntoChildren(container, containerChildren, newComponent)\n : [\n containerActive,\n containerChildren?.map((child, index) =>\n index === idx\n ? (insertIntoContainer(\n child,\n targetContainer,\n newComponent\n ) as ReactElement)\n : child\n ),\n ];\n const active =\n typeOf(container) === \"Stack\"\n ? Array.isArray(insertedIdx)\n ? (insertedIdx[0] as number)\n : insertedIdx\n : containerActive;\n\n return React.cloneElement(container, { active }, children);\n}\nfunction insertIntoChildren(\n container: LayoutModel,\n containerChildren: ReactElement[],\n newComponent: ReactElement\n): [number, ReactElement[]] {\n const containerPath = getProp(container, \"path\");\n const count = containerChildren?.length;\n const { id = uuid() } = getProps(newComponent);\n\n if (count) {\n return [\n count,\n containerChildren.concat(\n resetPath(newComponent, `${containerPath}.${count}`, { id, key: id })\n ),\n ];\n } else {\n return [0, [resetPath(newComponent, `${containerPath}.0`, { id })]];\n }\n}\n\nexport function insertBesideChild(\n container: ReactElement,\n existingComponent: any,\n newComponent: any,\n insertionPosition: insertionPosition,\n pos?: DropPos,\n clientRect?: any,\n dropRect?: any\n): ReactElement {\n const {\n active: containerActive,\n children: containerChildren,\n path: containerPath,\n } = getProps(container);\n\n const existingComponentPath = getProp(existingComponent, \"path\");\n const { idx, finalStep } = nextStep(containerPath, existingComponentPath);\n const [insertedIdx, children] = finalStep\n ? updateChildren(\n container,\n containerChildren,\n idx,\n newComponent,\n insertionPosition,\n pos!,\n clientRect,\n dropRect\n )\n : [\n containerActive,\n containerChildren.map((child: ReactElement, index: number) =>\n index === idx\n ? insertBesideChild(\n child,\n existingComponent,\n newComponent,\n insertionPosition,\n pos,\n clientRect,\n dropRect\n )\n : child\n ),\n ];\n\n const active = typeOf(container) === \"Stack\" ? insertedIdx : containerActive;\n return React.cloneElement(container, { active }, children);\n}\n\nfunction updateChildren(\n container: LayoutModel,\n containerChildren: ReactElement[],\n idx: number,\n newComponent: ReactElement,\n insertionPosition: insertionPosition,\n pos: DropPos,\n clientRect: DropTarget[\"clientRect\"],\n dropRect: DropTarget[\"dropRect\"]\n) {\n const intrinsicSize = getIntrinsicSize(newComponent);\n if (intrinsicSize?.width && intrinsicSize?.height) {\n return insertIntrinsicSizedComponent(\n container,\n containerChildren,\n idx,\n newComponent,\n insertionPosition,\n clientRect,\n dropRect!\n );\n } else {\n return insertFlexComponent(\n container,\n containerChildren,\n idx,\n newComponent,\n insertionPosition,\n pos?.width || pos?.height,\n clientRect\n );\n }\n}\n\nconst getLeadingPlaceholderSize = (\n flexDirection: flexDirection,\n insertionPosition: insertionPosition,\n { top, right, bottom, left }: DropTarget[\"clientRect\"],\n [rectLeft, rectTop, rectRight, rectBottom]: rectTuple\n) => {\n if (flexDirection === \"column\" && insertionPosition === \"before\") {\n return rectTop - top;\n } else if (flexDirection === \"column\") {\n return bottom - rectBottom;\n } else if (flexDirection === \"row\" && insertionPosition === \"before\") {\n return rectLeft - left;\n } else if (flexDirection === \"row\") {\n return right - rectRight;\n }\n};\n\nfunction insertIntrinsicSizedComponent(\n container: LayoutModel,\n containerChildren: ReactElement[],\n idx: number,\n newComponent: ReactElement,\n insertionPosition: insertionPosition,\n clientRect: DropTarget[\"clientRect\"],\n dropRect: rectTuple\n) {\n const {\n style: { flexDirection },\n } = getProps(container);\n const [dimension, crossDimension, contraDirection] =\n getFlexDimensions(flexDirection);\n const { [crossDimension]: intrinsicCrossSize, [dimension]: intrinsicSize } =\n getIntrinsicSize(newComponent) as { height: number; width: number };\n const path = getProp(containerChildren[idx], \"path\");\n\n // If we are introducing a new item into a row/column, but it is not flush against existing child, we will insert\n // a leading placeholder ...\n const placeholderSize = getLeadingPlaceholderSize(\n flexDirection,\n insertionPosition,\n clientRect,\n dropRect\n );\n\n const [itemToInsert, size] =\n intrinsicCrossSize < clientRect[crossDimension]\n ? [\n wrapIntrinsicSizeComponentWithFlexbox(\n newComponent,\n contraDirection,\n path,\n clientRect,\n dropRect\n ),\n intrinsicSize,\n ]\n : [newComponent, undefined];\n\n const placeholder = placeholderSize\n ? createPlaceHolder(path, placeholderSize, { flexGrow: 0, flexShrink: 0 })\n : undefined;\n\n if (intrinsicCrossSize > clientRect[crossDimension]) {\n containerChildren = containerChildren.map((child) => {\n if (getProp(child, \"placeholder\")) {\n return child;\n } else {\n const { [crossDimension]: intrinsicCrossChildSize } = getIntrinsicSize(\n child\n ) as {\n height: number;\n width: number;\n };\n if (\n intrinsicCrossChildSize &&\n intrinsicCrossChildSize < intrinsicCrossSize\n ) {\n return wrapIntrinsicSizeComponentWithFlexbox(\n child,\n contraDirection,\n getProp(child, \"path\")\n );\n } else {\n return child;\n }\n }\n });\n }\n\n return insertFlexComponent(\n container,\n containerChildren,\n idx,\n itemToInsert,\n insertionPosition,\n size,\n clientRect,\n placeholder\n );\n}\n\nfunction insertFlexComponent(\n container: LayoutModel,\n containerChildren: ReactElement[],\n idx: number,\n newComponent: ReactElement,\n insertionPosition: \"before\" | \"after\",\n size: number | undefined,\n targetRect: DropTarget[\"clientRect\"],\n placeholder?: ReactElement\n) {\n const containerPath = getProp(container, \"path\");\n let insertedIdx = 0;\n const children =\n !containerChildren || containerChildren.length === 0\n ? [newComponent]\n : containerChildren\n .reduce<ReactElement[]>((arr, child, i) => {\n if (idx === i) {\n const [existingComponent, insertedComponent] =\n getStyledComponents(container, child, newComponent, targetRect);\n if (insertionPosition === \"before\") {\n if (placeholder) {\n arr.push(placeholder, insertedComponent, existingComponent);\n } else {\n arr.push(insertedComponent, existingComponent);\n }\n } else {\n if (placeholder) {\n arr.push(existingComponent, insertedComponent, placeholder);\n } else {\n arr.push(existingComponent, insertedComponent);\n }\n }\n insertedIdx = arr.indexOf(insertedComponent);\n } else {\n arr.push(child);\n }\n return arr;\n }, [])\n .map((child, i) =>\n i < insertedIdx ? child : resetPath(child, `${containerPath}.${i}`)\n );\n\n return [insertedIdx, children];\n}\n\nfunction getStyledComponents(\n container: LayoutModel,\n existingComponent: ReactElement,\n newComponent: ReactElement,\n targetRect: DropTarget[\"clientRect\"]\n): [ReactElement, ReactElement] {\n let { id = uuid(), version = 0 } = getProps(newComponent);\n version += 1;\n if (typeOf(container) === \"Flexbox\") {\n const [dim] = getManagedDimension(container.props.style);\n const splitterSize = 6;\n const size = { [dim]: (targetRect[dim] - splitterSize) / 2 };\n const existingComponentStyle = getFlexOrIntrinsicStyle(\n existingComponent,\n dim,\n size\n );\n const newComponentStyle = getFlexOrIntrinsicStyle(newComponent, dim, size);\n\n return [\n React.cloneElement(existingComponent, {\n style: existingComponentStyle,\n }),\n React.cloneElement(newComponent, {\n id,\n version,\n style: newComponentStyle,\n }),\n ];\n } else {\n const {\n style: { left: _1, top: _2, flex: _3, ...style } = {\n left: undefined,\n top: undefined,\n flex: undefined,\n },\n } = getProps(newComponent);\n // TODO why would we strip out width, height if resizeable\n // we might need these if in a Stack, for example\n // const dimensions = source.props.resizeable ? {} : { width, height };\n return [\n existingComponent,\n React.cloneElement(newComponent, { id, version, style }),\n ];\n }\n}\n", "import { uuid } from \"@vuu-ui/vuu-utils\";\nimport { CSSProperties, ReactElement } from \"react\";\nimport React, { cloneElement } from \"react\";\nimport { dimension } from \"../common-types\";\nimport {\n ComponentRegistry,\n isContainer,\n isLayoutComponent,\n} from \"../registry/ComponentRegistry\";\nimport {\n getPersistentState,\n hasPersistentState,\n setPersistentState,\n} from \"../use-persistent-state\";\nimport { expandFlex, getProps, typeOf } from \"../utils\";\nimport { LayoutJSON, LayoutModel, layoutType } from \"./layoutTypes\";\n\nexport const getManagedDimension = (\n style: CSSProperties\n): [dimension, dimension] =>\n style.flexDirection === \"column\" ? [\"height\", \"width\"] : [\"width\", \"height\"];\n\nconst theKidHasNoStyle: CSSProperties = {};\n\nexport const applyLayoutProps = (component: ReactElement, path = \"0\") => {\n const [layoutProps, children] = getChildLayoutProps(\n typeOf(component) as string,\n component.props,\n path\n );\n return React.cloneElement(component, layoutProps, children);\n};\n\nexport interface LayoutProps {\n active?: number;\n \"data-path\"?: string;\n children?: ReactElement[];\n column?: any;\n dropTarget?: any;\n id: string;\n key: string;\n layout?: any;\n path?: string;\n resizeable?: boolean;\n style: CSSProperties;\n type?: string;\n version?: number;\n}\n\nexport const processLayoutElement = (\n layoutElement: ReactElement,\n previousLayout?: ReactElement\n): ReactElement => {\n const type = typeOf(layoutElement) as string;\n const [layoutProps, children] = getChildLayoutProps(\n type,\n layoutElement.props,\n \"0\",\n undefined,\n previousLayout\n );\n return cloneElement(layoutElement, layoutProps, children);\n};\n\nexport const applyLayout = (\n type: layoutType,\n props: LayoutProps,\n previousLayout?: LayoutModel\n): LayoutModel => {\n // This works if the root layout is itself loaded from JSON\n const [layoutProps, children] = getChildLayoutProps(\n type,\n props,\n \"0\",\n undefined,\n previousLayout\n );\n return {\n ...props,\n ...layoutProps,\n type,\n children,\n };\n};\n\nfunction getLayoutProps(\n type: string,\n props: LayoutProps,\n path = \"0\",\n parentType: string | null = null,\n previousLayout?: LayoutModel\n): LayoutProps {\n const {\n active: prevActive = 0,\n \"data-path\": dataPath,\n path: prevPath = dataPath,\n id: prevId,\n style: prevStyle,\n } = getProps(previousLayout);\n\n const prevMatch = typeOf(previousLayout) === type && path === prevPath;\n // TODO is there anything else we can re-use from previousType ?\n const id = prevMatch ? prevId : props.id ?? uuid();\n const active = type === \"Stack\" ? props.active ?? prevActive : undefined;\n\n const key = id;\n //TODO this might be wrong if client has updated style ?\n const style = prevMatch ? prevStyle : getStyle(type, props, parentType);\n // TODO need two interfaces to cover these two scenarios\n return isLayoutComponent(type)\n ? { id, key, path, style, type, active }\n : { id, key, style, \"data-path\": path };\n}\n\nfunction getChildLayoutProps(\n type: string,\n props: LayoutProps,\n path: string,\n parentType: string | null = null,\n previousLayout?: LayoutModel\n): [LayoutProps, ReactElement[]] {\n const layoutProps = getLayoutProps(\n type,\n props,\n path,\n parentType,\n previousLayout\n );\n\n if (props.layout && !previousLayout) {\n // reconstitute children from layout. Will always be a single child,\n // but return as array to make subsequent processing more consistent\n return [layoutProps, [layoutFromJson(props.layout, `${path}.0`)]];\n }\n\n const previousChildren =\n (previousLayout as any)?.children ?? previousLayout?.props?.children;\n const hasDynamicChildren = props.dropTarget && previousChildren;\n const children = hasDynamicChildren\n ? previousChildren\n : getLayoutChildren(type, props.children, path, previousChildren);\n return [layoutProps, children];\n}\n\nfunction getLayoutChildren(\n type: string,\n children?: ReactElement[],\n path = \"0\",\n previousChildren?: ReactElement[]\n) {\n // Avoid React.Children.map here, it messes with the keys.\n const kids = Array.isArray(children)\n ? children\n : React.isValidElement(children)\n ? [children]\n : [];\n return isContainer(type) /*|| isView(type)*/\n ? kids.map((child, i) => {\n const childType = typeOf(child) as string;\n const previousType = typeOf(previousChildren?.[i]);\n if (!previousType || childType === previousType) {\n const [layoutProps, children] = getChildLayoutProps(\n childType,\n child.props,\n `${path}.${i}`,\n type,\n previousChildren?.[i]\n );\n return React.cloneElement(child, layoutProps, children);\n } else {\n //TODO is this always correct ?\n return previousChildren?.[i];\n }\n })\n : // TODO should we check the types of children ?\n // : previousChildren ?? children;\n //TODO this is new - is it dangerous ?\n children;\n}\n\nconst getStyle = (\n type: string,\n props: LayoutProps,\n parentType?: string | null\n) => {\n let { style = theKidHasNoStyle } = props;\n if (type === \"Flexbox\") {\n style = {\n flexDirection: props.column ? \"column\" : \"row\",\n ...style,\n display: \"flex\",\n };\n }\n\n if (style.flex) {\n const { flex, ...otherStyles } = style;\n style = {\n ...otherStyles,\n ...expandFlex(flex),\n };\n } else if (parentType === \"Stack\") {\n style = {\n ...style,\n ...expandFlex(1),\n };\n } else if (\n parentType === \"Flexbox\" &&\n (style.width || style.height) &&\n style.flexBasis === undefined\n ) {\n // strictly, this should depend on flexDirection\n style = {\n ...style,\n flexBasis: \"auto\",\n flexGrow: 0,\n flexShrink: 0,\n };\n }\n\n return style;\n};\n\n//TODO we don't need id beyond view\nexport function layoutFromJson(\n { id = uuid(), type, children, props, state }: LayoutJSON,\n path: string\n): ReactElement {\n // if (type === \"DraggableLayout\") {\n // return layoutFromJson(children[0], \"0\");\n // }\n\n const componentType = type.match(/^[a-z]/) ? type : ComponentRegistry[type];\n\n if (componentType === undefined) {\n throw Error(`Unable to create component from JSON, unknown type ${type}`);\n }\n\n if (state) {\n setPersistentState(id, state);\n }\n\n return React.createElement(\n componentType,\n {\n ...props,\n id,\n key: id,\n path,\n },\n children\n ? children.map((child, i) => layoutFromJson(child, `${path}.${i}`))\n : undefined\n );\n}\n\nexport function layoutToJSON(component: ReactElement) {\n return componentToJson(component);\n}\n\nexport function componentToJson(component: ReactElement): LayoutJSON {\n const type = typeOf(component) as string;\n const { id, children, type: _omit, ...props } = getProps(component);\n\n const state = hasPersistentState(id) ? getPersistentState(id) : undefined;\n\n return {\n id,\n type,\n props: serializeProps(props as LayoutProps),\n state,\n children: React.Children.map(children, componentToJson),\n };\n}\n\nexport function serializeProps(props?: LayoutProps) {\n if (props) {\n const { path, ...otherProps } = props;\n const result: { [key: string]: any } = {};\n for (let [key, value] of Object.entries(otherProps)) {\n result[key] = serializeValue(value);\n }\n return result;\n }\n}\n\nfunction serializeValue(value: unknown): any {\n if (\n typeof value === \"string\" ||\n typeof value === \"number\" ||\n typeof value === \"boolean\"\n ) {\n return value;\n } else if (Array.isArray(value)) {\n return value.map(serializeValue);\n } else if (typeof value === \"object\" && value !== null) {\n const result: { [key: string]: any } = {};\n for (let [k, v] of Object.entries(value)) {\n result[k] = serializeValue(v);\n }\n return result;\n }\n}\n", "import { useCallback } from \"react\";\n\nconst persistentState = new Map<string, any>();\nconst sessionState = new Map<string, any>();\n\n// These is not exported by package, only available within\n// layout. Used by LayoutProvider for layout serialization.\nexport const getPersistentState = (id: string) => persistentState.get(id);\nexport const hasPersistentState = (id: string) => persistentState.has(id);\nexport const setPersistentState = (id: string, value: any) =>\n persistentState.set(id, value);\n\nexport const usePersistentState = () => {\n //TODO create single set of methods that operate on either session or state\n\n const loadSessionState = useCallback((id, key) => {\n const state = sessionState.get(id);\n if (state) {\n if (key !== undefined && state[key] !== undefined) {\n return state[key];\n } else if (key !== undefined) {\n return undefined;\n } else {\n return state;\n }\n }\n }, []);\n\n const saveSessionState = useCallback((id, key, data) => {\n if (key === undefined) {\n sessionState.set(id, data);\n } else if (sessionState.has(id)) {\n const state = sessionState.get(id);\n sessionState.set(id, {\n ...state,\n [key]: data,\n });\n } else {\n sessionState.set(id, { [key]: data });\n }\n }, []);\n\n const purgeSessionState = useCallback((id: string, key?: string) => {\n if (sessionState.has(id)) {\n if (key === undefined) {\n sessionState.delete(id);\n } else {\n const state = sessionState.get(id);\n if (state[key]) {\n const { [key]: _doomedState, ...rest } = sessionState.get(id);\n if (Object.keys(rest).length > 0) {\n sessionState.set(id, rest);\n } else {\n sessionState.delete(id);\n }\n }\n }\n }\n }, []);\n\n const loadState = useCallback((id: string, key?: string) => {\n const state = persistentState.get(id);\n if (state) {\n if (key !== undefined) {\n return state[key];\n } else {\n return state;\n }\n }\n }, []);\n\n const saveState = useCallback(\n (id: string, key: string | undefined, data: any) => {\n if (key === undefined) {\n persistentState.set(id, data);\n } else if (persistentState.has(id)) {\n const state = persistentState.get(id);\n persistentState.set(id, {\n ...state,\n [key]: data,\n });\n } else {\n persistentState.set(id, { [key]: data });\n }\n },\n []\n );\n\n const purgeState = useCallback((id: string, key?: string) => {\n if (persistentState.has(id)) {\n if (key === undefined) {\n persistentState.delete(id);\n } else {\n const state = persistentState.get(id);\n if (state[key]) {\n const { [key]: _doomedState, ...rest } = persistentState.get(id);\n if (Object.keys(rest).length > 0) {\n persistentState.set(id, rest);\n } else {\n persistentState.delete(id);\n }\n }\n }\n }\n }, []);\n\n return {\n loadSessionState,\n loadState,\n saveSessionState,\n saveState,\n purgeState,\n purgeSessionState,\n };\n};\n", "import { ReactElement } from \"react\";\nimport { DropTarget } from \"../drag-drop/DropTarget\";\nimport { DragDropRect, DragInstructions, DropPos } from \"../drag-drop\";\n\nexport interface WithProps {\n props?: { [key: string]: any };\n}\n\nexport interface WithType {\n props?: any;\n title?: string;\n type: string;\n}\n\nexport interface LayoutRoot extends WithProps {\n active?: number;\n children?: ReactElement[];\n type: string;\n}\n\nexport interface LayoutJSON extends WithType {\n children?: LayoutJSON[];\n id?: string;\n props?: { [key: string]: any };\n state?: any;\n type: string;\n}\n\nexport interface WithActive {\n active?: number;\n}\n\nexport type LayoutModel = LayoutRoot | ReactElement | WithType;\n\nexport type layoutType = \"Flexbox\" | \"View\" | \"DraggableLayout\" | \"Stack\";\n\nexport const LayoutActionType = {\n ADD: \"add\",\n DRAG_START: \"drag-start\",\n DRAG_DROP: \"drag-drop\",\n MAXIMIZE: \"maximize\",\n MINIMIZE: \"minimize\",\n REMOVE: \"remove\",\n REPLACE: \"replace\",\n RESTORE: \"restore\",\n SAVE: \"save\",\n SET_TITLE: \"set-title\",\n SPLITTER_RESIZE: \"splitter-resize\",\n SWITCH_TAB: \"switch-tab\",\n TEAROUT: \"tearout\",\n} as const;\n\nexport type AddAction = {\n component: any;\n path: string;\n type: typeof LayoutActionType.ADD;\n};\n\nexport type DragDropAction = {\n draggedReactElement: ReactElement;\n dragInstructions: any;\n dropTarget: Partial<DropTarget>;\n type: typeof LayoutActionType.DRAG_DROP;\n};\n\nexport type MaximizeAction = {\n path?: string;\n type: typeof LayoutActionType.MAXIMIZE;\n};\nexport type MinimizeAction = {\n path?: string;\n type: typeof LayoutActionType.MINIMIZE;\n};\nexport type RemoveAction = {\n path?: string;\n type: typeof LayoutActionType.REMOVE;\n};\nexport type ReplaceAction = {\n replacement: any;\n target: any;\n type: typeof LayoutActionType.REPLACE;\n};\nexport type RestoreAction = {\n path?: string;\n type: typeof LayoutActionType.RESTORE;\n};\nexport type SetTitleAction = {\n path: string;\n title: string;\n type: typeof LayoutActionType.SET_TITLE;\n};\nexport type SplitterResizeAction = {\n path: string;\n sizes: { currentSize: number; flexBasis: number }[];\n type: typeof LayoutActionType.SPLITTER_RESIZE;\n};\nexport type SwitchTabAction = {\n nextIdx: number;\n path: string;\n type: typeof LayoutActionType.SWITCH_TAB;\n};\nexport type TearoutAction = {\n path?: string;\n type: typeof LayoutActionType.TEAROUT;\n};\n\nexport type LayoutReducerAction =\n | AddAction\n | DragDropAction\n | MaximizeAction\n | MinimizeAction\n | RemoveAction\n | ReplaceAction\n | RestoreAction\n | SetTitleAction\n | SplitterResizeAction\n | SwitchTabAction;\n\nexport type SaveAction = {\n type: typeof LayoutActionType.SAVE;\n};\n\nexport type AddToolbarContributionViewAction = {\n content: ReactElement;\n location: string;\n type: \"add-toolbar-contribution\";\n};\n\nexport type RemoveToolbarContributionViewAction = {\n location: string;\n type: \"remove-toolbar-contribution\";\n};\n\nexport type MousedownViewAction = {\n preDragActivity?: any;\n index?: number;\n type: \"mousedown\";\n};\n\n// TODO split this out into separate actions for different drag scenarios\nexport type DragStartAction = {\n payload?: ReactElement;\n dragContainerPath?: string;\n dragElement?: HTMLElement;\n dragRect: DragDropRect;\n dropTargets?: string[];\n evt: MouseEvent;\n instructions?: DragInstructions;\n path: string;\n type: typeof LayoutActionType.DRAG_START;\n};\n", "import React, { ReactElement } from 'react';\nimport { createPlaceHolder } from './flexUtils';\nimport { swapChild } from './replace-layout-element';\n\nimport {\n followPath,\n followPathToParent,\n getProp,\n getProps,\n nextStep,\n resetPath,\n typeOf\n} from '../utils';\nimport { RemoveAction } from './layoutTypes';\n\nexport function removeChild(layoutRoot: ReactElement, { path }: RemoveAction) {\n const target = followPath(layoutRoot, path!) as ReactElement;\n let targetParent = followPathToParent(layoutRoot, path!);\n if (targetParent === null) {\n return layoutRoot;\n }\n const { children } = getProps(targetParent);\n if (children.length > 1 && allOtherChildrenArePlaceholders(children, path)) {\n // eslint-disable-next-line no-unused-vars\n const {\n style: { flexBasis, display, flexDirection, ...style }\n } = getProps(targetParent);\n let containerPath = getProp(targetParent, 'path');\n let newLayout = swapChild(\n layoutRoot,\n targetParent,\n createPlaceHolder(containerPath, flexBasis, style)\n );\n // eslint-disable-next-line no-cond-assign\n while ((targetParent = followPathToParent(newLayout, containerPath))) {\n if (getProp(targetParent, 'path') === '0') {\n break;\n }\n const { children } = getProps(targetParent);\n if (allOtherChildrenArePlaceholders(children)) {\n containerPath = getProp(targetParent, 'path');\n // eslint-disable-next-line no-unused-vars\n const {\n style: { flexBasis, display, flexDirection, ...style }\n } = getProps(targetParent);\n newLayout = swapChild(\n layoutRoot,\n targetParent,\n createPlaceHolder(containerPath, flexBasis, style)\n );\n } else if (hasAdjacentPlaceholders(children)) {\n newLayout = collapsePlaceholders(layoutRoot, targetParent as ReactElement);\n // } else if (hasRedundantPlaceholders(children)){\n /*\n We may have redundany placeholders for example where we have a tower containing a Terrace and a placeholder\n If all the components bordering on the lower placeholder are themselves placeholders, the lower placeholder\n is redundant\n */\n } else {\n break;\n }\n }\n return newLayout;\n // return removeChild(rootProps, {path: targetParent.props.path});\n // return removeChildAndPlaceholder(rootProps, {path: targetParent.props.path});\n } else {\n return _removeChild(layoutRoot, target);\n }\n}\n\nfunction _removeChild(container: ReactElement, child: ReactElement): ReactElement {\n let { active, children: componentChildren, path, preserve } = getProps(container);\n const { idx, finalStep } = nextStep(path, getProp(child, 'path'));\n const type = typeOf(container) as string;\n let children = componentChildren.slice() as ReactElement[];\n if (finalStep) {\n children.splice(idx, 1);\n if (active !== undefined && active >= idx) {\n active = Math.max(0, active - 1);\n }\n\n if (children.length === 1 && !preserve && path !== '0' && type.match(/Flexbox|Stack/)) {\n return unwrap(container, children[0]);\n }\n\n // Not 100% sure we should do this, unless configured to\n if (!children.some(isFlexible) && children.some(canBeMadeFlexible)) {\n children = makeFlexible(children);\n }\n } else {\n children[idx] = _removeChild(children[idx], child) as ReactElement;\n }\n\n children = children.map((child, i) => resetPath(child, `${path}.${i}`));\n return React.cloneElement(container, { active }, children);\n}\n\nfunction unwrap(container: ReactElement, child: ReactElement) {\n const type = typeOf(container);\n const {\n path,\n style: { flexBasis, flexGrow, flexShrink, width, height }\n } = getProps(container);\n\n let unwrappedChild = resetPath(child, path);\n if (path === '0') {\n unwrappedChild = React.cloneElement(unwrappedChild, {\n style: {\n ...child.props.style,\n width,\n height\n }\n });\n } else if (type === 'Flexbox') {\n const dim = container.props.style.flexDirection === 'column' ? 'height' : 'width';\n const {\n // eslint-disable-next-line no-unused-vars\n style: { [dim]: size, ...style }\n } = unwrappedChild.props;\n // Need to overwrite key\n unwrappedChild = React.cloneElement(unwrappedChild, {\n // Need to assign key\n flexFill: undefined,\n style: {\n ...style,\n // flexFill, if present described the childs relationship to the doomed flexbox,\n // must not be applied to new parent\n flexGrow,\n flexShrink,\n flexBasis,\n width,\n height\n }\n });\n }\n return unwrappedChild;\n}\n\nfunction isFlexible(element: ReactElement) {\n return element.props.style.flexGrow > 0;\n}\n\nfunction canBeMadeFlexible(element: ReactElement) {\n const { width, height, flexGrow } = element.props.style;\n return flexGrow === 0 && typeof width !== 'number' && typeof height !== 'number';\n}\n\nfunction makeFlexible(children: ReactElement[]) {\n return children.map((child) =>\n canBeMadeFlexible(child)\n ? React.cloneElement(child, {\n style: {\n ...child.props.style,\n flexGrow: 1\n }\n })\n : child\n );\n}\n\nconst hasAdjacentPlaceholders = (children: ReactElement[]) => {\n if (children && children.length > 0) {\n let wasPlaceholder = getProp(children[0], 'placeholder');\n let isPlaceholder = false;\n for (let i = 1; i < children.length; i++) {\n isPlaceholder = getProp(children[i], 'placeholder');\n if (wasPlaceholder && isPlaceholder) {\n return true;\n }\n wasPlaceholder = isPlaceholder;\n }\n }\n};\n\nconst collapsePlaceholders = (container: ReactElement, target: ReactElement) => {\n let { children: componentChildren, path } = getProps(container);\n const { idx, finalStep } = nextStep(path, getProp(target, 'path'));\n let children = componentChildren.slice() as ReactElement[];\n if (finalStep) {\n children[idx] = _collapsePlaceHolders(target);\n } else {\n children[idx] = collapsePlaceholders(children[idx], target) as ReactElement;\n }\n\n children = children.map((child, i) => resetPath(child, `${path}.${i}`));\n return React.cloneElement(container, undefined, children);\n};\n\nconst _collapsePlaceHolders = (container: ReactElement) => {\n const { children } = getProps(container);\n const newChildren = [];\n const placeholders: ReactElement[] = [];\n\n for (let i = 0; i < children.length; i++) {\n if (getProp(children[i], 'placeholder')) {\n placeholders.push(children[i]);\n } else {\n if (placeholders.length === 1) {\n newChildren.push(placeholders.pop());\n } else if (placeholders.length > 0) {\n newChildren.push(mergePlaceholders(placeholders));\n placeholders.length = 0;\n }\n newChildren.push(children[i]);\n }\n }\n\n if (placeholders.length === 1) {\n newChildren.push(placeholders.pop());\n } else if (placeholders.length > 0) {\n newChildren.push(mergePlaceholders(placeholders));\n }\n\n const containerPath = getProp(container, 'path');\n return React.cloneElement(\n container,\n undefined,\n newChildren.map((child, i) => resetPath(child, `${containerPath}.${i}`))\n );\n};\n\nconst mergePlaceholders = ([placeholder, ...placeholders]: ReactElement[]) => {\n const targetStyle = getProp(placeholder, 'style');\n let { flexBasis, flexGrow, flexShrink } = targetStyle;\n for (let {\n props: { style }\n } of placeholders) {\n flexBasis += style.flexBasis;\n flexGrow = Math.max(flexGrow, style.flexGrow);\n flexShrink = Math.max(flexShrink, style.flexShrink);\n }\n return React.cloneElement(placeholder, {\n style: { ...targetStyle, flexBasis, flexGrow, flexShrink }\n });\n};\n\nconst allOtherChildrenArePlaceholders = (children: ReactElement[], path?: string) =>\n children.every(\n (child) => getProp(child, 'placeholder') || (path && getProp(child, 'path') === path)\n );\n", "import React, { ReactElement } from 'react';\nimport { getProp, getProps, nextStep } from '../utils';\nimport { Action } from '../layout-action';\nimport { applyLayoutProps, LayoutProps } from './layoutUtils';\nimport { ReplaceAction } from './layoutTypes';\n\nexport function replaceChild(model: ReactElement, { target, replacement }: ReplaceAction) {\n return _replaceChild(model, target, replacement);\n}\n\nexport function _replaceChild(\n model: ReactElement,\n child: ReactElement,\n replacement: ReactElement<LayoutProps>\n) {\n const path = getProp(child, 'path');\n const resizeable = getProp(child, 'resizeable');\n const { style } = getProps(child);\n const newChild =\n // applyLayoutProps is a bit heavy here - it supports the scenario\n // where we drop/replace a template. Might want to make it somehow\n // an opt-in option\n applyLayoutProps(\n React.cloneElement(replacement, {\n resizeable,\n style: {\n ...style,\n ...replacement.props.style\n }\n }),\n path\n );\n\n return swapChild(model, child, newChild);\n}\n\nexport function swapChild(\n model: ReactElement,\n child: ReactElement,\n replacement: ReactElement,\n op?: 'maximize' | 'minimize' | 'restore'\n): ReactElement {\n if (model === child) {\n return replacement as any;\n } else {\n const { idx, finalStep } = nextStep(getProp(model, 'path'), getProp(child, 'path'));\n const children = model.props.children.slice();\n if (finalStep) {\n if (!op) {\n children[idx] = replacement;\n } else if (op === Action.MINIMIZE) {\n children[idx] = minimize(model, children[idx]);\n } else if (op === Action.RESTORE) {\n children[idx] = restore(children[idx]);\n }\n } else {\n children[idx] = swapChild(children[idx], child, replacement, op);\n }\n return React.cloneElement(model, undefined, children);\n }\n}\n\nfunction minimize(parent: ReactElement, child: ReactElement) {\n // Right now, parent is always going to be a FLexbox, but might not always be the case\n const { style: parentStyle } = getProps(parent);\n const { style: childStyle } = getProps(child);\n\n const { width, height, flexBasis, flexShrink, flexGrow, ...rest } = childStyle;\n\n const restoreStyle = {\n width,\n height,\n flexBasis,\n flexShrink,\n flexGrow\n };\n\n const style = {\n ...rest,\n flexBasis: 0,\n flexGrow: 0,\n flexShrink: 0\n };\n const collapsed =\n parentStyle.flexDirection === 'row'\n ? 'vertical'\n : parentStyle.flexDirection === 'column'\n ? 'horizontal'\n : false;\n\n if (collapsed) {\n return React.cloneElement(child, {\n collapsed,\n restoreStyle,\n style\n });\n } else {\n return child;\n }\n}\n\nfunction restore(child: ReactElement) {\n // Right now, parent is always going to be a FLexbox, but might not always be the case\n const { style: childStyle, restoreStyle } = getProps(child);\n\n const { flexBasis, flexShrink, flexGrow, ...rest } = childStyle;\n\n const style = {\n ...rest,\n ...restoreStyle\n };\n\n return React.cloneElement(child, {\n collapsed: false,\n style,\n restoreStyle: undefined\n });\n}\n", "import React, { CSSProperties, ReactElement } from 'react';\nimport { followPath, getProps } from '../utils';\nimport { swapChild } from './replace-layout-element';\nimport { SplitterResizeAction } from './layoutTypes';\nimport { dimension } from '../common-types';\n\nexport function resizeFlexChildren(\n layoutRoot: ReactElement,\n { path, sizes }: SplitterResizeAction\n) {\n const target = followPath(layoutRoot, path, true);\n const { children, style } = getProps(target);\n\n const dimension = style.flexDirection === 'column' ? 'height' : 'width';\n const replacementChildren = applySizesToChildren(children, sizes, dimension);\n\n const replacement = React.cloneElement(target, undefined, replacementChildren);\n\n return swapChild(layoutRoot, target, replacement);\n}\n\nfunction applySizesToChildren(\n children: ReactElement[],\n sizes: { currentSize: number; flexBasis: number }[],\n dimension: dimension\n) {\n return children.map((child, i) => {\n const {\n style: { [dimension]: size, flexBasis: actualFlexBasis }\n } = getProps(child);\n const meta = sizes[i];\n let { currentSize, flexBasis } = meta;\n const hasCurrentSize = currentSize !== undefined;\n const newSize = hasCurrentSize ? meta.currentSize : flexBasis;\n\n if (newSize === undefined || size === newSize || actualFlexBasis === newSize) {\n return child;\n } else {\n return React.cloneElement(child, {\n style: applySizeToChild(child.props.style, dimension, newSize)\n });\n }\n });\n}\n\nfunction applySizeToChild(style: CSSProperties, dimension: dimension, newSize: number) {\n const hasSize = typeof style[dimension] === 'number';\n const { flexShrink = 1, flexGrow = 1 } = style;\n return {\n ...style,\n [dimension]: hasSize ? newSize : 'auto',\n flexBasis: hasSize ? 'auto' : newSize,\n flexShrink,\n flexGrow\n };\n}\n", "import React, { ReactElement } from \"react\";\nimport { uuid } from \"@vuu-ui/vuu-utils\";\nimport { getProp, getProps, nextStep, resetPath, typeOf } from \"../utils\";\nimport { ComponentRegistry } from \"../registry/ComponentRegistry\";\nimport {\n createFlexbox,\n createPlaceHolder,\n flexDirection,\n getFlexStyle,\n getIntrinsicSize,\n wrapIntrinsicSizeComponentWithFlexbox,\n} from \"./flexUtils\";\nimport { applyLayoutProps, LayoutProps } from \"./layoutUtils\";\nimport { LayoutModel } from \"./layoutTypes\";\nimport { DropPos } from \"../drag-drop/dragDropTypes\";\nimport { rectTuple } from \"../common-types\";\nimport { DropTarget } from \"../drag-drop/DropTarget\";\n\nexport interface LayoutSpec {\n type: \"Stack\" | \"Flexbox\";\n flexDirection: \"column\" | \"row\";\n showTabs?: boolean;\n}\n\nconst isHtmlElement = (component: LayoutModel) => {\n const [firstLetter] = typeOf(component) as string;\n return firstLetter === firstLetter.toLowerCase();\n};\n\n// newComponent has been dropped onto an existingComponent. A wrapper container will be inserted\n// into the layout tree, wrapping the existingComponent. newComponent will be injected into the\n// new wrapper, so existingComponent and newComponent will be siblings. Putting it another way,\n// wrapper will replace existingComponent in the layout tree and it will contain existingComponent\n// and newComponent.\nexport function wrap(\n container: ReactElement,\n existingComponent: any,\n newComponent: any,\n pos: DropPos,\n clientRect?: DropTarget[\"clientRect\"],\n dropRect?: DropTarget[\"dropRect\"]\n): ReactElement {\n const { children: containerChildren, path: containerPath } =\n getProps(container);\n\n const existingComponentPath = getProp(existingComponent, \"path\");\n const { idx, finalStep } = nextStep(containerPath, existingComponentPath);\n const children = finalStep\n ? updateChildren(\n container,\n containerChildren,\n existingComponent,\n newComponent,\n pos,\n clientRect,\n dropRect\n )\n : containerChildren.map((child: ReactElement, index: number) =>\n index === idx\n ? wrap(\n child,\n existingComponent,\n newComponent,\n pos,\n clientRect,\n dropRect\n )\n : child\n );\n\n return React.cloneElement(container, undefined, children);\n}\n\nfunction updateChildren(\n container: LayoutModel,\n containerChildren: ReactElement[],\n existingComponent: ReactElement,\n newComponent: ReactElement,\n pos: DropPos,\n clientRect?: DropTarget[\"clientRect\"],\n dropRect?: rectTuple\n) {\n const intrinsicSize = getIntrinsicSize(newComponent);\n\n if (intrinsicSize?.width && intrinsicSize?.height) {\n if (clientRect === undefined || dropRect === undefined) {\n throw Error(\n \"wrap-layout-element, updateChildren clientRect and dropRect must both be available\"\n );\n }\n return wrapIntrinsicSizedComponent(\n containerChildren,\n existingComponent,\n newComponent,\n pos,\n clientRect,\n dropRect\n );\n } else {\n return wrapFlexComponent(\n container,\n containerChildren,\n existingComponent,\n newComponent,\n pos\n );\n }\n}\n\nfunction wrapFlexComponent(\n container: LayoutModel,\n containerChildren: ReactElement[],\n existingComponent: ReactElement,\n newComponent: ReactElement,\n pos: DropPos\n) {\n const { version = 0 } = getProps(newComponent);\n const existingComponentPath = getProp(existingComponent, \"path\");\n const {\n type,\n flexDirection,\n showTabs: showTabsProp,\n } = getLayoutSpecForWrapper(pos);\n const [style, existingComponentStyle, newComponentStyle] =\n getWrappedFlexStyles(\n type,\n existingComponent,\n newComponent,\n flexDirection,\n pos\n );\n const targetFirst = isTargetFirst(pos);\n const active = targetFirst ? 1 : 0; // double check this\n\n // TODO how do we decide whether children should be resizable ?\n const newComponentProps = {\n resizeable: true,\n style: newComponentStyle,\n version: version + 1,\n };\n const resizeProp = isHtmlElement(existingComponent)\n ? \"data-resizeable\"\n : \"resizeable\";\n const existingComponentProps = {\n [resizeProp]: true,\n style: existingComponentStyle,\n };\n\n const showTabs = type === \"Stack\" ? { showTabs: showTabsProp } : undefined;\n const splitterSize =\n type === \"Flexbox\"\n ? {\n splitterSize:\n (typeOf(container) === \"Flexbox\" && container.props.splitterSize) ??\n undefined,\n }\n : undefined;\n\n const id = uuid();\n var wrapper = React.createElement(\n ComponentRegistry[type],\n {\n active,\n id,\n key: id,\n path: getProp(existingComponent, \"path\"),\n flexFill: getProp(existingComponent, \"flexFill\"),\n // TODO we should be able to configure this in setDefaultLayoutProps\n ...splitterSize,\n ...showTabs,\n style,\n resizeable: getProp(existingComponent, \"resizeable\"),\n } as LayoutProps,\n targetFirst\n ? [\n resetPath(\n existingComponent,\n `${existingComponentPath}.0`,\n existingComponentProps\n ),\n // resetPath(newComponent, `${existingComponentPath}.1`, newComponentProps),\n applyLayoutProps(\n React.cloneElement(newComponent, newComponentProps),\n `${existingComponentPath}.1`\n ),\n ]\n : [\n applyLayoutProps(\n React.cloneElement(newComponent, newComponentProps),\n `${existingComponentPath}.0`\n ),\n // resetPath(newComponent, `${existingComponentPath}.0`, newComponentProps),\n resetPath(\n existingComponent,\n `${existingComponentPath}.1`,\n existingComponentProps\n ),\n ]\n );\n return containerChildren.map((child: ReactElement) =>\n child === existingComponent ? wrapper : child\n );\n}\n\nfunction wrapIntrinsicSizedComponent(\n containerChildren: ReactElement[],\n existingComponent: ReactElement,\n newComponent: ReactElement,\n pos: DropPos,\n clientRect: DropTarget[\"clientRect\"],\n dropRect: rectTuple\n) {\n const { flexDirection } = getLayoutSpecForWrapper(pos);\n const contraDirection = flexDirection === \"column\" ? \"row\" : \"column\";\n const targetFirst = isTargetFirst(pos);\n\n const [dropLeft, dropTop, dropRight, dropBottom] = dropRect;\n const [startPlaceholder, endPlaceholder] =\n flexDirection === \"column\"\n ? [dropTop - clientRect.top, clientRect.bottom - dropBottom]\n : [dropLeft - clientRect.left, clientRect.right - dropRight];\n const pathRoot = getProp(existingComponent, \"path\");\n let pathIndex = 0;\n\n const resizeProp = isHtmlElement(existingComponent)\n ? \"data-resizeable\"\n : \"resizeable\";\n\n const wrappedChildren = [];\n if (startPlaceholder) {\n wrappedChildren.push(\n targetFirst\n ? resetPath(existingComponent, `${pathRoot}.${pathIndex++}`, {\n [resizeProp]: true,\n style: { flexBasis: startPlaceholder, flexGrow: 1, flexShrink: 1 },\n })\n : createPlaceHolder(`${pathRoot}.${pathIndex++}`, startPlaceholder, {\n flexGrow: 0,\n flexShrink: 0,\n })\n );\n }\n wrappedChildren.push(\n wrapIntrinsicSizeComponentWithFlexbox(\n newComponent,\n contraDirection,\n `${pathRoot}.${pathIndex++}`,\n clientRect,\n dropRect\n )\n );\n if (endPlaceholder) {\n wrappedChildren.push(\n targetFirst\n ? createPlaceHolder(`${pathRoot}.${pathIndex++}`, 0)\n : resetPath(existingComponent, `${pathRoot}.${pathIndex++}`, {\n [resizeProp]: true,\n style: { flexBasis: 0, flexGrow: 1, flexShrink: 1 },\n })\n );\n }\n\n const wrapper = createFlexbox(\n flexDirection,\n existingComponent.props,\n wrappedChildren,\n pathRoot\n );\n return containerChildren.map((child) =>\n child === existingComponent ? wrapper : child\n );\n}\n\n//TODO we need to respect styles on the source, full-on flex might not be appropriate\nfunction getWrappedFlexStyles(\n type: string,\n existingComponent: ReactElement,\n newComponent: ReactElement,\n flexDirection: flexDirection,\n pos: DropPos\n) {\n const style = {\n ...existingComponent.props.style,\n flexDirection,\n };\n\n const dimension =\n type === \"Flexbox\" && flexDirection === \"column\" ? \"height\" : \"width\";\n const newComponentStyle = getFlexStyle(newComponent, dimension, pos);\n const existingComponentStyle = getFlexStyle(existingComponent, dimension);\n\n return [style, existingComponentStyle, newComponentStyle];\n}\n\nconst isTargetFirst = (pos: DropPos) =>\n pos.position.SouthOrEast\n ? true\n : pos?.tab?.positionRelativeToTab === \"before\"\n ? false\n : pos.position.Header\n ? true\n : false;\n\nfunction getLayoutSpecForWrapper(pos: DropPos): LayoutSpec {\n if (pos.position.Header) {\n return {\n type: \"Stack\",\n flexDirection: \"column\",\n showTabs: true,\n };\n } else {\n return {\n type: \"Flexbox\",\n flexDirection: pos.position.EastOrWest ? \"row\" : \"column\",\n };\n }\n}\n", "import { createContext, Dispatch } from 'react';\nimport { DragStartAction, LayoutReducerAction, SaveAction } from '../layout-reducer';\n\nconst unconfiguredLayoutProviderDispatch: LayoutProviderDispatch = (action) =>\n console.log(`dispatch ${action.type}, have you forgotten to provide a LayoutProvider ?`);\n\nexport type LayoutProviderDispatch = Dispatch<LayoutReducerAction | SaveAction | DragStartAction>;\n\nexport interface LayoutProviderContextProps {\n dispatchLayoutProvider: LayoutProviderDispatch;\n version: number;\n}\n\nexport const LayoutProviderContext = createContext<LayoutProviderContextProps>({\n dispatchLayoutProvider: unconfiguredLayoutProviderDispatch,\n version: -1\n});\n", "import { MutableRefObject, ReactElement, useCallback, useRef } from \"react\";\nimport {\n DragDropRect,\n DragEndCallback,\n Draggable,\n DragInstructions,\n} from \"../drag-drop\";\nimport { DragStartAction } from \"../layout-reducer\";\nimport { getIntrinsicSize } from \"../layout-reducer/flexUtils\";\nimport { followPath } from \"../utils\";\nimport { LayoutProviderDispatch } from \"./LayoutProviderContext\";\n\nconst NO_INSTRUCTIONS = {} as DragInstructions;\nconst NO_OFFSETS: [number, number] = [0, 0];\n\ninterface CurrentDragAction extends Omit<DragStartAction, \"evt\" | \"type\"> {\n dragContainerPath: string;\n}\n\ninterface DragOperation {\n payload: ReactElement;\n originalCSS: string;\n dragRect: any;\n dragInstructions: DragInstructions;\n dragOffsets: [number, number];\n targetPosition: { left: number; top: number };\n}\n\n// Create a temporary object for dragging, where we don not have an existing object\n// e.g dragging a non-selected tab from a Stack or an item from Palette\nconst getDragElement = (\n rect: DragDropRect,\n id: string,\n dragElement?: HTMLElement\n): [HTMLElement, string, number, number] => {\n const wrapper = document.createElement(\"div\");\n wrapper.className = \"vuuSimpleDraggableWrapper\";\n // TODO caller needs to supply the salt classes\n wrapper.classList.add(\n \"vuuSimpleDraggableWrapper\",\n \"salt-theme\",\n \"salt-density-medium\"\n );\n wrapper.dataset.dragging = \"true\";\n\n const div = dragElement ?? document.createElement(\"div\");\n // this seems wrong the id is the payload id\n div.id = id;\n\n wrapper.appendChild(div);\n document.body.appendChild(wrapper);\n const cssText = `top:${rect.top}px;left:${rect.left}px;width:${rect.width}px;height:${rect.height}px;`;\n return [wrapper, cssText, rect.left, rect.top];\n};\n\nconst determineDragOffsets = (\n draggedElement: HTMLElement\n): [number, number] => {\n const { offsetParent } = draggedElement;\n if (offsetParent === null) {\n return NO_OFFSETS;\n } else {\n const { left: offsetLeft, top: offsetTop } =\n offsetParent.getBoundingClientRect();\n return [offsetLeft, offsetTop];\n }\n};\n\nexport const useLayoutDragDrop = (\n rootLayoutRef: MutableRefObject<ReactElement>,\n dispatch: LayoutProviderDispatch\n) => {\n const dragActionRef = useRef<CurrentDragAction>();\n const dragOperationRef = useRef<DragOperation>();\n const draggableHTMLElementRef = useRef<HTMLElement>();\n\n const handleDrag = useCallback((x, y) => {\n if (dragOperationRef.current && draggableHTMLElementRef.current) {\n const {\n dragOffsets: [offsetX, offsetY],\n targetPosition,\n } = dragOperationRef.current;\n const left = typeof x === \"number\" ? x - offsetX : targetPosition.left;\n const top = typeof y === \"number\" ? y - offsetY : targetPosition.top;\n if (left !== targetPosition.left || top !== targetPosition.top) {\n dragOperationRef.current.targetPosition.left = left;\n dragOperationRef.current.targetPosition.top = top;\n draggableHTMLElementRef.current.style.top = top + \"px\";\n draggableHTMLElementRef.current.style.left = left + \"px\";\n }\n }\n }, []);\n\n const handleDrop: DragEndCallback = useCallback((dropTarget) => {\n if (dragOperationRef.current) {\n const {\n dragInstructions,\n payload: draggedReactElement,\n originalCSS,\n } = dragOperationRef.current;\n dispatch({\n type: \"drag-drop\",\n draggedReactElement,\n dragInstructions,\n dropTarget,\n });\n\n console.log(`[useLayoutDragDrop]`, {\n dragInstructions,\n });\n if (draggableHTMLElementRef.current) {\n if (dragInstructions.RemoveDraggableOnDragEnd) {\n document.body.removeChild(draggableHTMLElementRef.current);\n } else {\n draggableHTMLElementRef.current.style.cssText = originalCSS;\n delete draggableHTMLElementRef.current.dataset.dragging;\n }\n }\n\n dragActionRef.current = undefined;\n dragOperationRef.current = undefined;\n draggableHTMLElementRef.current = undefined;\n }\n }, []);\n\n /**\n * This will be called when Draggable has established that a drag operation is\n * underway. There may be a delay between the initial mousedown and the call to\n * this function - while we wait for either a drag timeout to fire or a minumum\n * mouse move threshold to be reached.\n */\n const handleDragStart = useCallback(\n (evt: MouseEvent) => {\n if (dragActionRef.current) {\n const {\n payload: component,\n dragContainerPath,\n dragElement,\n dragRect,\n // dropTargets,\n instructions = NO_INSTRUCTIONS,\n path,\n // preDragActivity,\n // resolveDragStart // see View drag\n } = dragActionRef.current;\n const { current: rootLayout } = rootLayoutRef;\n const dragPos = { x: evt.clientX, y: evt.clientY };\n const dragPayload = component ?? followPath(rootLayout, path, true);\n const { id: dragPayloadId } = dragPayload.props;\n const intrinsicSize = getIntrinsicSize(dragPayload);\n let originalCSS = \"\",\n dragCSS = \"\",\n dragTransform = \"\";\n let dragInstructions = instructions;\n\n let dragStartLeft = -1;\n let dragStartTop = -1;\n let dragOffsets: [number, number] = NO_OFFSETS;\n\n // TODO this has a bearing on offsets we apply to (absolutely positioned) dragged element.\n // If we are creating the element here, offset parent will be document body.\n let element = document.getElementById(dragPayloadId);\n\n if (element === null) {\n // This may bew the case where, for example, we drag a Tab (non selected) from a Tabstrip.\n [element, dragCSS, dragStartLeft, dragStartTop] = getDragElement(\n dragRect,\n dragPayloadId,\n dragElement\n );\n dragInstructions = {\n ...dragInstructions,\n RemoveDraggableOnDragEnd: true,\n };\n } else {\n dragOffsets = determineDragOffsets(element);\n const [offsetLeft, offsetTop] = dragOffsets;\n const { width, height, left, top } = element.getBoundingClientRect();\n dragStartLeft = left - offsetLeft;\n dragStartTop = top - offsetTop;\n dragCSS = `width:${width}px;height:${height}px;left:${dragStartLeft}px;top:${dragStartTop}px;z-index: 100;background-color:#ccc;opacity: 0.6;`;\n // Important that this is set before we call initDrag\n // this just enables position: absolute\n element.dataset.dragging = \"true\";\n\n // resolveDragStart && resolveDragStart(true);\n\n // if (preDragActivity) {\n // await preDragActivity();\n // }\n\n originalCSS = element.style.cssText;\n }\n\n dragTransform = Draggable.initDrag(\n rootLayoutRef.current,\n dragContainerPath,\n dragRect,\n dragPos,\n {\n drag: handleDrag,\n drop: handleDrop,\n },\n intrinsicSize\n // dropTargets\n );\n\n element.style.cssText = dragCSS + dragTransform;\n draggableHTMLElementRef.current = element;\n\n dragOperationRef.current = {\n payload: dragPayload,\n originalCSS,\n dragRect,\n dragOffsets,\n dragInstructions: instructions,\n targetPosition: { left: dragStartLeft, top: dragStartTop },\n };\n }\n },\n [handleDrag, handleDrop, rootLayoutRef]\n );\n\n const prepareToDrag = useCallback(\n (action: DragStartAction) => {\n const { evt, ...options } = action;\n console.log(`prepare to drag`, {\n options,\n });\n dragActionRef.current = {\n ...options,\n dragContainerPath: \"\",\n // dragContainerPath: '0.0.1.1'\n };\n Draggable.handleMousedown(evt, handleDragStart, options.instructions);\n },\n [handleDragStart]\n );\n\n return prepareToDrag;\n};\n", "import { ReactElement } from \"react\";\nimport { getProps, typeOf } from \"../utils\";\nimport { isContainer } from \"../registry/ComponentRegistry\";\nimport { LayoutModel } from \"../layout-reducer\";\nimport { DragDropRect, DropPos, RelativePosition } from \"./dragDropTypes\";\nimport { rect } from \"../common-types\";\n\nexport var positionValues = {\n north: 1,\n east: 2,\n south: 4,\n west: 8,\n header: 16,\n centre: 32,\n absolute: 64,\n};\n\nexport const RelativeDropPosition = {\n AFTER: \"after\" as RelativePosition,\n BEFORE: \"before\" as RelativePosition,\n};\n\nexport var Position = Object.freeze({\n North: _position(\"north\"),\n East: _position(\"east\"),\n South: _position(\"south\"),\n West: _position(\"west\"),\n Header: _position(\"header\"),\n Centre: _position(\"centre\"),\n Absolute: _position(\"absolute\"),\n});\n\nfunction _position(str: keyof typeof positionValues) {\n return Object.freeze({\n offset:\n str === \"north\" || str === \"west\"\n ? 0\n : str === \"south\" || str === \"east\"\n ? 1\n : NaN,\n valueOf: function () {\n return positionValues[str];\n },\n toString: function () {\n return str;\n },\n North: str === \"north\",\n South: str === \"south\",\n East: str === \"east\",\n West: str === \"west\",\n Header: str === \"header\",\n Centre: str === \"centre\",\n NorthOrSouth: str === \"north\" || str === \"south\",\n EastOrWest: str === \"east\" || str === \"west\",\n NorthOrWest: str === \"north\" || str === \"west\",\n SouthOrEast: str === \"east\" || str === \"south\",\n Absolute: str === \"absolute\",\n });\n}\n\nvar NORTH = Position.North,\n SOUTH = Position.South,\n EAST = Position.East,\n WEST = Position.West,\n HEADER = Position.Header,\n CENTRE = Position.Centre;\n\nexport interface Measurements {\n [key: string]: DragDropRect;\n}\n\nexport class BoxModel {\n //TODO we should accept initial let,top offsets here\n // if dropTargets are supplied, we will only allow drop operations directly on these targets\n // TODO we will need to make this more flexible e.g allowing drop anywhere within these target\n static measure(\n model: ReactElement,\n dropTargetPaths: string[] = []\n ): Measurements {\n var measurements: Measurements = {};\n measureRootComponent(model, measurements, dropTargetPaths);\n return measurements;\n }\n\n static allBoxesContainingPoint(\n layout: LayoutModel,\n measurements: Measurements,\n x: number,\n y: number,\n validDropTargets?: string[]\n ) {\n return allBoxesContainingPoint(\n layout,\n measurements,\n x,\n y,\n validDropTargets\n ).reverse();\n }\n}\n\nexport function pointPositionWithinRect(\n x: number,\n y: number,\n rect: DragDropRect,\n borderZone = 30\n) {\n const width = rect.right - rect.left;\n const height = rect.bottom - rect.top;\n const posX = x - rect.left;\n const posY = y - rect.top;\n let closeToTheEdge = 0;\n\n if (posX < borderZone) closeToTheEdge += 8;\n if (posX > width - borderZone) closeToTheEdge += 2;\n if (posY < borderZone) closeToTheEdge += 1;\n if (posY > height - borderZone) closeToTheEdge += 4;\n\n return { pctX: posX / width, pctY: posY / height, closeToTheEdge };\n}\n\nexport function getPosition(\n x: number,\n y: number,\n rect: DragDropRect,\n targetOrientation?: \"row\" | \"column\"\n): DropPos {\n const { BEFORE, AFTER } = RelativeDropPosition;\n const { pctX, pctY, closeToTheEdge } = pointPositionWithinRect(x, y, rect);\n let position;\n let tab;\n\n if (targetOrientation === \"row\") {\n position = pctX < 0.5 ? WEST : EAST;\n } else if (rect.header && containsPoint(rect.header, x, y)) {\n position = HEADER;\n\n if (rect.Stack) {\n const tabCount = rect.Stack.length;\n if (tabCount === 0) {\n tab = {\n index: -1,\n left: rect.left,\n positionRelativeToTab: AFTER,\n width: 0,\n };\n } else {\n //TODO account for gaps between tabs\n const targetTab = rect.Stack.find(\n ({ left, right }) => x >= left && x <= right\n );\n if (targetTab) {\n const tabWidth = targetTab.right - targetTab.left;\n tab = {\n index: rect.Stack.indexOf(targetTab),\n left: targetTab.left,\n positionRelativeToTab:\n (x - targetTab.left) / tabWidth < 0.5 ? BEFORE : AFTER,\n width: tabWidth,\n };\n } else {\n const lastTab = rect.Stack[tabCount - 1];\n tab = {\n left: lastTab.right,\n width: 0,\n index: tabCount,\n positionRelativeToTab: AFTER,\n };\n }\n }\n } else if (rect.header.titleWidth) {\n const tabWidth = rect.header.titleWidth;\n tab = {\n index: -1,\n left: rect.left,\n positionRelativeToTab:\n (x - rect.left) / tabWidth < 0.5 ? BEFORE : AFTER,\n width: tabWidth,\n };\n } else {\n tab = {\n left: rect.left,\n width: 0,\n positionRelativeToTab: BEFORE,\n index: -1,\n };\n }\n } else {\n position = getPositionWithinBox(x, y, rect, pctX, pctY);\n }\n\n return { position: position!, x, y, closeToTheEdge, tab };\n}\n\nfunction getPositionWithinBox(\n x: number,\n y: number,\n rect: DragDropRect,\n pctX: number,\n pctY: number\n) {\n const centerBox = getCenteredBox(rect, 0.2);\n if (containsPoint(centerBox, x, y)) {\n return CENTRE;\n } else {\n const quadrant = `${pctY < 0.5 ? \"north\" : \"south\"}${\n pctX < 0.5 ? \"west\" : \"east\"\n }`;\n\n switch (quadrant) {\n case \"northwest\":\n return pctX > pctY ? NORTH : WEST;\n case \"northeast\":\n return 1 - pctX > pctY ? NORTH : EAST;\n case \"southeast\":\n return pctX > pctY ? EAST : SOUTH;\n case \"southwest\":\n return 1 - pctX > pctY ? WEST : SOUTH;\n default:\n }\n }\n}\n\nfunction getCenteredBox(\n { right, left, top, bottom }: DragDropRect,\n pctSize: number\n) {\n const pctOffset = (1 - pctSize) / 2;\n const w = (right - left) * pctOffset;\n const h = (bottom - top) * pctOffset;\n return { left: left + w, top: top + h, right: right - w, bottom: bottom - h };\n}\n\nfunction measureRootComponent(\n rootComponent: ReactElement,\n measurements: Measurements,\n dropTargets: any[]\n) {\n const {\n id,\n \"data-path\": dataPath,\n path = dataPath,\n } = getProps(rootComponent);\n const type = typeOf(rootComponent) as string;\n\n if (id && path) {\n const [rect, el] = measureComponentDomElement(rootComponent);\n measureComponent(rootComponent, rect, el, measurements);\n if (isContainer(type)) {\n collectChildMeasurements(rootComponent, measurements, dropTargets);\n }\n }\n}\n\nfunction measureComponent(\n component: LayoutModel,\n rect: DragDropRect,\n el: HTMLElement,\n measurements: Measurements\n) {\n const {\n \"data-path\": dataPath,\n path = dataPath,\n header,\n } = getProps(component);\n\n measurements[path] = rect;\n\n const type = typeOf(component);\n if (header || type === \"Stack\") {\n const headerEl = el.querySelector(\".vuuHeader\");\n if (headerEl) {\n const { top, left, right, bottom } = headerEl.getBoundingClientRect();\n measurements[path].header = {\n top: Math.round(top),\n left: Math.round(left),\n right: Math.round(right),\n bottom: Math.round(bottom),\n };\n if (type === \"Stack\") {\n measurements[path].Stack = Array.from(\n headerEl.querySelectorAll(\".saltTab\")\n )\n .map((tab) => tab.getBoundingClientRect())\n .map(({ left, right }) => ({ left, right }));\n } else {\n const titleEl = headerEl.querySelector('[class^=\"vuuHeader-title\"]');\n const { header } = measurements[path];\n if (titleEl && header) {\n header.titleWidth = titleEl.clientWidth;\n }\n }\n }\n }\n\n return measurements[path];\n}\n\nfunction collectChildMeasurements(\n component: LayoutModel,\n measurements: Measurements,\n dropTargets: string[],\n preX = 0,\n posX = 0,\n preY = 0,\n posY = 0\n) {\n const {\n children,\n \"data-path\": dataPath,\n path = dataPath,\n style,\n active = 0,\n } = getProps(component);\n\n const type = typeOf(component);\n const isFlexbox = type === \"Flexbox\";\n const isStack = type === \"Stack\";\n const isTower = isFlexbox && style.flexDirection === \"column\";\n const isTerrace = isFlexbox && style.flexDirection === \"row\";\n\n const childrenToMeasure = isStack\n ? children.filter((_child: ReactElement, idx: number) => idx === active)\n : children.filter(omitDragging);\n\n type measuredTuple = [DragDropRect, HTMLElement, ReactElement];\n // Collect all the measurements in first pass ...\n const childMeasurements: measuredTuple[] = childrenToMeasure.map(\n (child: ReactElement) => {\n const [rect, el] = measureComponentDomElement(child);\n\n return [\n {\n ...rect,\n top: rect.top - preY,\n right: rect.right + posX,\n bottom: rect.bottom + posY,\n left: rect.left - preX,\n },\n el,\n child,\n ];\n }\n );\n\n // ...so that, in the second pass, we can identify gaps ...\n const expandedMeasurements = childMeasurements.map(\n ([rect, el, child], i, all) => {\n // generate a 'local' splitter adjustment for children adjacent to splitters\n let localPreX;\n let localPosX;\n let localPreY;\n let localPosY;\n let gapPre;\n let gapPos;\n const n = all.length - 1;\n if (isTerrace) {\n gapPre = i === 0 ? 0 : rect.left - all[i - 1][0].right;\n gapPos = i === n ? 0 : all[i + 1][0].left - rect.right;\n // we don't need to divide the leading gap, as half the gap will\n // already have been assigned to the preceeding child in the\n // previous loop iteration.\n localPreX = i === 0 ? 0 : gapPre === 0 ? 0 : gapPre;\n localPosX = i === n ? 0 : gapPos === 0 ? 0 : gapPos - gapPos / 2;\n rect.left -= localPreX;\n rect.right += localPosX;\n localPreY = preY;\n localPosY = posY;\n } else if (isTower) {\n gapPre = i === 0 ? 0 : rect.top - all[i - 1][0].bottom;\n gapPos = i === n ? 0 : all[i + 1][0].top - rect.bottom;\n // we don't need to divide the leading gap, as half the gap will\n // already have been assigned to the preceeding child in the\n // previous loop iteration.\n localPreY = i === 0 ? 0 : gapPre === 0 ? 0 : gapPre;\n localPosY = i === n ? 0 : gapPos === 0 ? 0 : gapPos - gapPos / 2;\n rect.top -= localPreY;\n rect.bottom += localPosY;\n localPreX = preX;\n localPosX = posX;\n }\n\n const componentMeasurements = measureComponent(\n child,\n rect,\n el,\n measurements\n );\n\n const childType = typeOf(child) as string;\n if (isContainer(childType)) {\n collectChildMeasurements(\n child,\n measurements,\n dropTargets,\n localPreX,\n localPosX,\n localPreY,\n localPosY\n );\n }\n return componentMeasurements;\n }\n );\n if (childMeasurements.length) {\n measurements[path].children = expandedMeasurements;\n }\n}\n\nfunction omitDragging(component: ReactElement) {\n const { id } = getProps(component);\n const el = document.getElementById(id);\n if (el) {\n return el.dataset.dragging !== \"true\";\n } else {\n console.warn(`BoxModel: no element found with id #${id}`);\n return false;\n }\n}\n\nfunction measureComponentDomElement(\n component: LayoutModel\n): [DragDropRect, HTMLElement, LayoutModel] {\n const { id } = getProps(component);\n const type = typeOf(component) as string;\n const el = document.getElementById(id);\n if (!el) {\n throw Error(`No DOM for ${type} ${id}`);\n }\n // Note: height and width are not required for dropTarget identification, but\n // are used in sizing calculations on drop\n let { top, left, right, bottom, height, width } = el.getBoundingClientRect();\n let scrolling = undefined;\n if (isContainer(type)) {\n const scrollHeight = el.scrollHeight;\n if (scrollHeight > height) {\n scrolling = { id, scrollHeight, scrollTop: el.scrollTop };\n }\n }\n return [\n {\n top: Math.round(top),\n left: Math.round(left),\n right: Math.round(right),\n bottom: Math.round(bottom),\n height: Math.round(height),\n width: Math.round(width),\n scrolling,\n },\n el,\n component,\n ];\n}\n\nfunction allBoxesContainingPoint(\n component: LayoutModel,\n measurements: Measurements,\n x: number,\n y: number,\n dropTargets?: string[],\n boxes: LayoutModel[] = []\n): LayoutModel[] {\n const {\n children,\n \"data-path\": dataPath,\n path = dataPath,\n } = getProps(component);\n\n const type = typeOf(component) as string;\n var rect = measurements[path];\n if (!containsPoint(rect, x, y)) return boxes;\n\n if (dropTargets && dropTargets.length) {\n if (dropTargets.includes(path)) {\n boxes.push(component);\n } else if (\n dropTargets.some((dropTargetPath) => dropTargetPath.startsWith(path))\n ) {\n // keep going\n } else {\n return boxes;\n }\n } else {\n boxes.push(component);\n }\n\n if (!isContainer(type)) {\n return boxes;\n }\n\n if (rect.header && containsPoint(rect.header, x, y)) {\n return boxes;\n }\n\n if (rect.scrolling) {\n scrollIntoViewIfNeccesary(rect, x, y);\n }\n\n for (var i = 0; i < children.length; i++) {\n if (type === \"Stack\" && component.props.active !== i) {\n continue;\n }\n const nestedBoxes = allBoxesContainingPoint(\n children[i],\n measurements,\n x,\n y,\n dropTargets\n );\n if (nestedBoxes.length) {\n return boxes.concat(nestedBoxes);\n }\n }\n return boxes;\n}\n\nfunction containsPoint(rect: rect, x: number, y: number) {\n if (rect) {\n return x >= rect.left && x < rect.right && y >= rect.top && y < rect.bottom;\n }\n}\n\nfunction scrollIntoViewIfNeccesary(\n { top, bottom, scrolling }: DragDropRect,\n x: number,\n y: number\n) {\n if (scrolling) {\n const { id, scrollTop, scrollHeight } = scrolling;\n const height = bottom - top;\n if (scrollTop === 0 && bottom - y < 50) {\n const scrollMax = scrollHeight - height;\n const el = document.getElementById(id) as HTMLElement;\n el.scrollTo({ left: 0, top: scrollMax, behavior: \"smooth\" });\n scrolling.scrollTop = scrollMax;\n } else if (scrollTop > 0 && y - top < 50) {\n const el = document.getElementById(id) as HTMLElement;\n el.scrollTo({ left: 0, top: 0, behavior: \"smooth\" });\n scrolling.scrollTop = 0;\n } else {\n return false;\n }\n } else {\n return false;\n }\n}\n", "import { rect } from '../common-types';\nimport { Measurements, pointPositionWithinRect } from './BoxModel';\nimport { DragDropRect } from './dragDropTypes';\n\nvar SCALE_FACTOR = 0.4;\n\nexport type IntrinsicSizes = {\n height?: number;\n width?: number;\n};\n\ninterface ZoneRange {\n hi: number;\n lo: number;\n}\ntype DragConstraint = {\n zone: {\n x: ZoneRange;\n y: ZoneRange;\n };\n pos: {\n x: ZoneRange;\n y: ZoneRange;\n };\n mouse: {\n x: ZoneRange;\n y: ZoneRange;\n };\n};\n\ninterface ExtendedZoneRange {\n lo: boolean;\n hi: boolean;\n mousePct: number;\n mousePos: number;\n pos: number;\n}\n\nexport class DragState {\n public constraint!: DragConstraint;\n public x!: ExtendedZoneRange;\n public y!: ExtendedZoneRange;\n public intrinsicSize: IntrinsicSizes | undefined;\n\n constructor(\n zone: DragDropRect,\n mouseX: number,\n mouseY: number,\n measurements: DragDropRect,\n intrinsicSize?: IntrinsicSizes\n ) {\n this.init(zone, mouseX, mouseY, measurements, intrinsicSize);\n }\n\n init(\n zone: DragDropRect,\n mouseX: number,\n mouseY: number,\n rect: DragDropRect,\n intrinsicSize?: IntrinsicSizes\n ) {\n var { left: x, top: y } = rect;\n\n var { pctX, pctY } = pointPositionWithinRect(mouseX, mouseY, rect);\n\n // We are applying a scale factor of 0.4 to the draggee. This is purely a visual\n // effect - the actual box size remains the original size. The 'leading' values\n // represent the difference between the visual scaled down box and the actual box.\n\n var scaleFactor = SCALE_FACTOR;\n\n var leadX = pctX * rect.width;\n var trailX = rect.width - leadX;\n var leadY = pctY * rect.height;\n var trailY = rect.height - leadY;\n\n // When we assign position to rect using css. positioning units are applied to the\n // unscaled shape, so we have to adjust values to take scaling into account.\n var scaledWidth = rect.width * scaleFactor,\n scaledHeight = rect.height * scaleFactor;\n\n var scaleDiff = 1 - scaleFactor;\n var leadXScaleDiff = leadX * scaleDiff;\n var leadYScaleDiff = leadY * scaleDiff;\n var trailXScaleDiff = trailX * scaleDiff;\n var trailYScaleDiff = trailY * scaleDiff;\n\n this.intrinsicSize = intrinsicSize;\n\n this.constraint = {\n zone: {\n x: {\n lo: zone.left,\n hi: zone.right\n },\n y: {\n lo: zone.top,\n hi: zone.bottom\n }\n },\n\n pos: {\n x: {\n lo: /* left */ zone.left - leadXScaleDiff,\n hi: /* right */ zone.right - rect.width + trailXScaleDiff\n },\n y: {\n lo: /* top */ zone.top - leadYScaleDiff,\n hi: /* bottom */ zone.bottom - rect.height + trailYScaleDiff\n }\n },\n mouse: {\n x: {\n lo: /* left */ zone.left + scaledWidth * pctX,\n hi: /* right */ zone.right - scaledWidth * (1 - pctX)\n },\n y: {\n lo: /* top */ zone.top + scaledHeight * pctY,\n hi: /* bottom */ zone.bottom - scaledHeight * (1 - pctY)\n }\n }\n };\n\n // onsole.log(`DragState: constraint ${JSON.stringify(this.constraint, null, 2)}`);\n\n this.x = {\n pos: x,\n lo: false,\n hi: false,\n mousePos: mouseX,\n mousePct: pctX\n };\n this.y = {\n pos: y,\n lo: false,\n hi: false,\n mousePos: mouseY,\n mousePct: pctY\n };\n }\n\n outOfBounds() {\n return this.x.lo || this.x.hi || this.y.lo || this.y.hi;\n }\n\n inBounds() {\n return !this.outOfBounds();\n }\n\n dropX() {\n return this.dropXY('x');\n }\n\n dropY() {\n return this.dropXY('y');\n }\n\n hasIntrinsicSize(): number | undefined {\n return this?.intrinsicSize?.height && this?.intrinsicSize?.width;\n }\n\n /*\n * diff = mouse movement, signed int\n * xy = 'x' or 'y'\n */\n //todo, diff can be calculated in here\n update(xy: 'x' | 'y', mousePos: number) {\n var state = this[xy],\n mouseConstraint = this.constraint.mouse[xy],\n posConstraint = this.constraint.pos[xy],\n previousPos = state.pos;\n\n var diff = mousePos - state.mousePos;\n\n //xy==='x' && console.log(`update: state.lo=${state.lo}, mPos=${mousePos}, mC.lo=${mouseConstraint.lo}, prevPos=${previousPos}, diff=${diff} ` );\n\n if (diff < 0) {\n if (state.lo) {\n /* do nothing */\n } else if (mousePos < mouseConstraint.lo) {\n state.lo = true;\n state.pos = posConstraint.lo;\n } else if (state.hi) {\n if (mousePos < mouseConstraint.hi) {\n state.hi = false;\n state.pos += diff;\n }\n } else {\n state.pos += diff;\n }\n } else if (diff > 0) {\n if (state.hi) {\n /* do nothing */\n } else if (mousePos > mouseConstraint.hi) {\n state.hi = true;\n state.pos = posConstraint.hi;\n } else if (state.lo) {\n if (mousePos > mouseConstraint.lo) {\n state.lo = false;\n state.pos += diff;\n }\n } else {\n state.pos += diff;\n }\n }\n\n state.mousePos = mousePos;\n\n return previousPos !== state.pos;\n }\n\n private dropXY(this: DragState, dir: 'x' | 'y') {\n var pos = this[dir],\n rect = this.constraint.zone[dir];\n // why not do the rounding +/- 1 on the rect initially - this is all it is usef for\n return pos.lo\n ? Math.max(rect.lo, pos.mousePos)\n : pos.hi\n ? Math.min(pos.mousePos, Math.round(rect.hi) - 1)\n : pos.mousePos;\n }\n}\n", "import {\n BoxModel,\n positionValues,\n getPosition,\n Position,\n RelativeDropPosition,\n Measurements,\n} from \"./BoxModel\";\nimport { getProps, typeOf } from \"../utils\";\nimport { DragDropRect, DropPos, DropPosTab } from \"./dragDropTypes\";\nimport { LayoutModel } from \"../layout-reducer\";\nimport { DragState } from \"./DragState\";\nimport { rect, rectTuple } from \"../common-types\";\n\nexport const isTabstrip = (dropTarget: DropTarget) =>\n dropTarget.pos.tab &&\n typeOf(dropTarget.component) === \"Stack\" &&\n dropTarget.pos.position.Header;\n\nconst { north, south, east, west } = positionValues;\nconst eastwest = east + west;\nconst northsouth = north + south;\n\nexport interface DropTargetProps {\n component: LayoutModel;\n pos: DropPos;\n clientRect: DragDropRect;\n nextDropTarget: DropTarget | null;\n}\n\nexport type GuideLine = [\n number,\n number,\n number,\n number,\n number,\n number,\n number,\n number\n];\nexport interface TargetDropOutline {\n l: number;\n r: number;\n t: number;\n b: number;\n tabLeft?: number;\n tabWidth?: number;\n tabHeight?: number;\n guideLines?: GuideLine;\n}\n\nexport class DropTarget {\n private active: boolean;\n\n public box: any;\n public clientRect: DragDropRect;\n public component: LayoutModel;\n public dropRect: rectTuple | undefined;\n public nextDropTarget: DropTarget | null;\n public pos: DropPos;\n\n constructor({\n component,\n pos,\n clientRect /*, closeToTheEdge*/,\n nextDropTarget,\n }: DropTargetProps) {\n this.component = component;\n this.pos = pos;\n this.clientRect = clientRect;\n this.nextDropTarget = nextDropTarget;\n this.active = false;\n this.dropRect = undefined;\n }\n\n targetTabPos(tab: DropPosTab) {\n const { left: tabLeft, width: tabWidth, positionRelativeToTab } = tab;\n return positionRelativeToTab === RelativeDropPosition.BEFORE\n ? tabLeft\n : tabLeft + tabWidth;\n }\n\n /**\n * Determine what will be rendered by the dropTargetRenderer\n *\n * @param {*} lineWidth\n * @param {*} dragState\n * @returns {l, t, r, b, tabLeft, tabWidth, tabHeight}\n */\n getTargetDropOutline(\n lineWidth: number,\n dragState?: DragState\n ): TargetDropOutline {\n if (this.pos.tab) {\n return this.getDropTabOutline(lineWidth, this.pos.tab);\n } else if (dragState && dragState.hasIntrinsicSize()) {\n return this.getIntrinsicDropRect(dragState);\n } else {\n const [l, t, r, b] = this.getDropRectOutline(\n lineWidth,\n dragState\n ) as rectTuple;\n return { l, t, r, b };\n }\n }\n\n getDropTabOutline(lineWidth: number, tab: DropPosTab): TargetDropOutline {\n const {\n clientRect: { top, left, right, bottom, header },\n } = this;\n\n const inset = 0;\n const gap = Math.round(lineWidth / 2) + inset;\n\n const t = Math.round(top);\n const l = Math.round(left + gap);\n const r = Math.round(right - gap);\n const b = Math.round(bottom - gap);\n const tabLeft = this.targetTabPos(tab);\n const tabWidth = 60; // should really measure text\n const tabHeight = header!.bottom - header!.top;\n return { l, t, r, b, tabLeft, tabWidth, tabHeight };\n }\n\n getIntrinsicDropRect(dragState: DragState): TargetDropOutline {\n const { pos, clientRect: rect } = this;\n\n let { x, y } = dragState;\n\n let height = dragState.intrinsicSize?.height ?? 0;\n let width = dragState.intrinsicSize?.height ?? 0;\n\n if (height && height > rect.height) {\n console.log(`DropTarget: we're going to blow the gaff`);\n height = rect.height;\n } else if (width && width > rect.width) {\n console.log(`DropTarget: we're going to blow the gaff`);\n width = rect.width;\n }\n\n const left = Math.min(\n rect.right - width,\n Math.max(rect.left, Math.round(pos.x - x.mousePct * width))\n );\n const top = Math.min(\n rect.bottom - height,\n Math.max(rect.top, Math.round(pos.y - y.mousePct * height))\n );\n const [l, t, r, b] = (this.dropRect = [\n left,\n top,\n left + width,\n top + height,\n ]);\n\n const guideLines: GuideLine = pos.position.EastOrWest\n ? [l, rect.top, l, rect.bottom, r, rect.top, r, rect.bottom]\n : [rect.left, t, rect.right, t, rect.left, b, rect.right, b];\n\n return { l, r, t, b, guideLines };\n }\n\n /**\n * @returns [left, top, right, bottom]\n */\n getDropRectOutline(lineWidth: number, dragState?: DragState) {\n const { pos, clientRect: rect } = this;\n const { width: suggestedWidth, height: suggestedHeight, position } = pos;\n\n const { width: intrinsicWidth, height: intrinsicHeight } =\n dragState?.intrinsicSize ?? {};\n const sizeHeight = intrinsicHeight ?? suggestedHeight ?? 0;\n const sizeWidth = intrinsicWidth ?? suggestedWidth ?? 0;\n\n this.dropRect = undefined;\n\n const { top: t, left: l, right: r, bottom: b } = rect;\n\n const inset = 0;\n const gap = Math.round(lineWidth / 2) + inset;\n\n switch (position) {\n case Position.North:\n case Position.Header: {\n const halfHeight = Math.round((b - t) / 2);\n const height = sizeHeight\n ? Math.min(halfHeight, Math.round(sizeHeight))\n : halfHeight;\n return sizeWidth && l + sizeWidth < r\n ? [l + gap, t + gap, l + sizeWidth - gap, t + gap + height] // need flex direction indicator\n : [l + gap, t + gap, r - gap, t + gap + height];\n }\n case Position.West: {\n const halfWidth = Math.round((r - l) / 2);\n const width = sizeWidth\n ? Math.min(halfWidth, Math.round(sizeWidth))\n : halfWidth;\n return sizeHeight && t + sizeHeight < b\n ? [l + gap, t + gap, l - gap + width, t + sizeHeight + gap] // need flex direction indicator\n : [l + gap, t + gap, l - gap + width, b - gap];\n }\n case Position.East: {\n const halfWidth = Math.round((r - l) / 2);\n const width = sizeWidth\n ? Math.min(halfWidth, Math.round(sizeWidth))\n : halfWidth;\n return sizeHeight && t + sizeHeight < b\n ? [r - gap - width, t + gap, r - gap, t + sizeHeight + gap] // need flex direction indicator\n : [r - gap - width, t + gap, r - gap, b - gap];\n }\n case Position.South: {\n const halfHeight = Math.round((b - t) / 2);\n const height = sizeHeight\n ? Math.min(halfHeight, Math.round(sizeHeight))\n : halfHeight;\n\n return sizeWidth && l + sizeWidth < r\n ? [l + gap, b - gap - height, l + sizeWidth - gap, b - gap] // need flex direction indicator\n : [l + gap, b - gap - height, r - gap, b - gap];\n }\n case Position.Centre: {\n return [l + gap, t + gap, r - gap, b - gap];\n }\n default:\n console.warn(`DropTarget does not recognize position ${position}`);\n return null;\n }\n }\n\n activate() {\n this.active = true;\n return this;\n }\n\n toArray(this: DropTarget) {\n let dropTarget: DropTarget | null = this;\n const dropTargets = [dropTarget];\n // eslint-disable-next-line no-cond-assign\n while ((dropTarget = dropTarget.nextDropTarget)) {\n dropTargets.push(dropTarget);\n }\n return dropTargets;\n }\n\n static getActiveDropTarget(dropTarget: DropTarget | null): DropTarget | null {\n return dropTarget === null\n ? null\n : dropTarget?.active\n ? dropTarget\n : DropTarget.getActiveDropTarget(dropTarget.nextDropTarget);\n }\n}\n\n// Initial entry to this method is always via the app (may be it should be *on* the app)\nexport function identifyDropTarget(\n x: number,\n y: number,\n rootLayout: LayoutModel,\n measurements: Measurements,\n intrinsicSize?: number,\n validDropTargets?: string[]\n) {\n let dropTarget = null;\n\n const allBoxesContainingPoint = BoxModel.allBoxesContainingPoint(\n rootLayout,\n measurements,\n x,\n y,\n validDropTargets\n );\n\n if (allBoxesContainingPoint.length) {\n const [component, ...containers] = allBoxesContainingPoint;\n const {\n \"data-path\": dataPath,\n path = dataPath,\n \"data-row-placeholder\": isRowPlaceholder,\n } = getProps(component);\n const clientRect = measurements[path];\n const placeholderOrientation =\n intrinsicSize && isRowPlaceholder ? \"row\" : undefined;\n const pos = getPosition(x, y, clientRect, placeholderOrientation);\n const box = measurements[path];\n\n const nextDropTarget = ([nextTarget, ...targets]: LayoutModel[]):\n | DropTarget\n | undefined => {\n if (pos.position?.Header || pos.closeToTheEdge) {\n const targetPosition = getTargetPosition(\n nextTarget,\n pos,\n box,\n measurements,\n x,\n y\n );\n if (targetPosition) {\n const [containerPos, clientRect] = targetPosition;\n\n return new DropTarget({\n component: nextTarget,\n pos: containerPos,\n clientRect,\n nextDropTarget: nextDropTarget(targets) ?? null,\n });\n } else if (targets.length) {\n return nextDropTarget(targets);\n }\n }\n };\n dropTarget = new DropTarget({\n component,\n pos,\n clientRect,\n nextDropTarget: nextDropTarget(containers) ?? null,\n }).activate();\n }\n\n return dropTarget;\n}\n\nfunction getTargetPosition(\n container: LayoutModel,\n { closeToTheEdge, position }: DropPos,\n box: rect,\n measurements: Measurements,\n x: number,\n y: number\n): [DropPos, DragDropRect] | undefined {\n if (!container || container.type === \"DraggableLayout\") {\n return;\n }\n\n const containingBox = measurements[container.props.path];\n const closeToTop = closeToTheEdge & positionValues.north;\n const closeToRight = closeToTheEdge & positionValues.east;\n const closeToBottom = closeToTheEdge & positionValues.south;\n const closeToLeft = closeToTheEdge & positionValues.west;\n\n const atTop =\n (closeToTop || position.Header) &&\n Math.round(box.top) === Math.round(containingBox.top);\n const atRight =\n closeToRight && Math.round(box.right) === Math.round(containingBox.right);\n const atBottom =\n closeToBottom &&\n Math.round(box.bottom) === Math.round(containingBox.bottom);\n const atLeft =\n closeToLeft && Math.round(box.left) === Math.round(containingBox.left);\n\n if (atTop || atRight || atBottom || atLeft) {\n const { \"data-path\": dataPath, path = dataPath } = container.props;\n const clientRect = measurements[path];\n const containerPos = getPosition(x, y, clientRect);\n\n // if its a VBox and we're close to left or right ...\n if (\n (isVBox(container) || isTabbedContainer(container)) &&\n closeToTheEdge & eastwest\n ) {\n containerPos.width = 120;\n return [containerPos, clientRect];\n }\n // if it's a HBox and we're close to top or bottom ...\n else if (\n (isHBox(container) || isTabbedContainer(container)) &&\n (position.Header || closeToTheEdge & northsouth)\n ) {\n containerPos.height = 120;\n return [containerPos, clientRect];\n }\n }\n}\n\nfunction isTabbedContainer(component: LayoutModel) {\n return typeOf(component) === \"Stack\";\n}\n\nfunction isVBox(component: LayoutModel) {\n return (\n typeOf(component) === \"Flexbox\" &&\n component.props.style.flexDirection === \"column\"\n );\n}\n\nfunction isHBox(component: LayoutModel) {\n return (\n typeOf(component) === \"Flexbox\" &&\n component.props.style.flexDirection === \"row\"\n );\n}\n", "import React, { createElement, useEffect, useRef } from \"react\";\nimport ReactDOM from \"react-dom\";\nimport { renderPortal } from \"../portal\";\nimport cx from \"classnames\";\n\nimport \"./popup-service.css\";\nwindow.popupReact = React;\n\nlet _dialogOpen = false;\nconst _popups = [];\n\nfunction specialKeyHandler(e) {\n if (e.keyCode === 27 /* ESC */) {\n if (_popups.length) {\n closeAllPopups();\n } else if (_dialogOpen) {\n ReactDOM.unmountComponentAtNode(\n document.body.querySelector(\".vuuDialog\")\n );\n }\n }\n}\n\nfunction outsideClickHandler(e) {\n if (_popups.length) {\n // onsole.log(`Popup.outsideClickHandler`);\n const popupContainers = document.body.querySelectorAll(\".vuuPopup\");\n for (let i = 0; i < popupContainers.length; i++) {\n if (popupContainers[i].contains(e.target)) {\n return;\n }\n }\n closeAllPopups();\n }\n}\n\nfunction closeAllPopups() {\n if (_popups.length) {\n // onsole.log(`closeAllPopups`);\n const popupContainers = document.body.querySelectorAll(\".vuuPopup\");\n for (let i = 0; i < popupContainers.length; i++) {\n ReactDOM.unmountComponentAtNode(popupContainers[i]);\n }\n popupClosed(\"*\");\n }\n}\n\nfunction dialogOpened() {\n if (_dialogOpen === false) {\n _dialogOpen = true;\n window.addEventListener(\"keydown\", specialKeyHandler, true);\n }\n}\n\nfunction dialogClosed() {\n if (_dialogOpen) {\n _dialogOpen = false;\n window.removeEventListener(\"keydown\", specialKeyHandler, true);\n }\n}\n\nfunction popupOpened(name /*, group*/) {\n if (_popups.indexOf(name) === -1) {\n _popups.push(name);\n //onsole.log('PopupService, popup opened ' + name + ' popups : ' + _popups);\n if (_dialogOpen === false) {\n window.addEventListener(\"keydown\", specialKeyHandler, true);\n window.addEventListener(\"click\", outsideClickHandler, true);\n }\n }\n}\n\nfunction popupClosed(name /*, group=null*/) {\n if (_popups.length) {\n if (name === \"*\") {\n _popups.length = 0;\n } else {\n const pos = _popups.indexOf(name);\n if (pos !== -1) {\n _popups.splice(pos, 1);\n }\n }\n //onsole.log('PopupService, popup closed ' + name + ' popups : ' + _popups);\n if (_popups.length === 0 && _dialogOpen === false) {\n window.removeEventListener(\"keydown\", specialKeyHandler, true);\n window.removeEventListener(\"click\", outsideClickHandler, true);\n }\n }\n}\n\nconst PopupComponent = ({ children, position, style }) => {\n const className = cx(\"hwPopup\", \"hwPopupContainer\", position);\n return createElement(\"div\", { className, style }, children);\n};\n\nlet incrementingKey = 1;\n\nexport class PopupService {\n static showPopup({\n name = \"anon\",\n group = \"all\",\n position = \"\",\n left = 0,\n right = \"auto\",\n top = 0,\n width = \"auto\",\n component,\n }) {\n if (!component) {\n throw Error(`PopupService showPopup, no component supplied`);\n }\n popupOpened(name, group);\n let el = document.body.querySelector(\".vuuPopup.\" + group);\n if (el === null) {\n el = document.createElement(\"div\");\n el.className = \"vuuPopup \" + group;\n document.body.appendChild(el);\n }\n\n const style = { width };\n\n renderPortal(\n createElement(\n PopupComponent,\n { key: incrementingKey++, position, style },\n component\n ),\n el,\n left,\n top,\n () => {\n PopupService.keepWithinThePage(el, right);\n }\n );\n }\n\n static hidePopup(name = \"anon\", group = \"all\") {\n //onsole.log('PopupService.hidePopup name=' + name + ', group=' + group)\n\n if (_popups.indexOf(name) !== -1) {\n popupClosed(name, group);\n ReactDOM.unmountComponentAtNode(\n document.body.querySelector(`.vuuPopup.${group}`)\n );\n }\n }\n\n static keepWithinThePage(el, right = \"auto\") {\n const target = el.querySelector(\".vuuPopupContainer > *\");\n if (target) {\n const {\n top,\n left,\n width,\n height,\n right: currentRight,\n } = target.getBoundingClientRect();\n\n const w = window.innerWidth;\n const h = window.innerHeight;\n\n const overflowH = h - (top + height);\n if (overflowH < 0) {\n target.style.top = parseInt(top, 10) + overflowH + \"px\";\n }\n\n const overflowW = w - (left + width);\n if (overflowW < 0) {\n target.style.left = parseInt(left, 10) + overflowW + \"px\";\n }\n\n if (typeof right === \"number\" && right !== currentRight) {\n const adjustment = right - currentRight;\n target.style.left = left + adjustment + \"px\";\n }\n }\n }\n}\n\nexport class DialogService {\n static showDialog(dialog) {\n const containerEl = \".vuuDialog\";\n const onClose = dialog.props.onClose;\n\n dialogOpened();\n\n ReactDOM.render(\n React.cloneElement(dialog, {\n container: containerEl,\n onClose: () => {\n DialogService.closeDialog();\n if (onClose) {\n onClose();\n }\n },\n }),\n document.body.querySelector(containerEl)\n );\n }\n\n static closeDialog() {\n dialogClosed();\n ReactDOM.unmountComponentAtNode(document.body.querySelector(\".vuuDialog\"));\n }\n}\n\nexport const Popup = (props) => {\n const pendingTask = useRef(null);\n const ref = useRef(null);\n\n const show = (props, boundingClientRect) => {\n const { name, group, depth, width } = props;\n let left, top;\n\n if (pendingTask.current) {\n clearTimeout(pendingTask.current);\n pendingTask.current = null;\n }\n\n if (props.close === true) {\n PopupService.hidePopup(name, group);\n } else {\n const { position, children: component } = props;\n const {\n left: targetLeft,\n top: targetTop,\n width: clientWidth,\n bottom: targetBottom,\n } = boundingClientRect;\n\n if (position === \"below\") {\n left = targetLeft;\n top = targetBottom;\n } else if (position === \"above\") {\n left = targetLeft;\n top = targetTop;\n }\n\n pendingTask.current = setTimeout(() => {\n PopupService.showPopup({\n name,\n group,\n depth,\n position,\n left,\n top,\n width: width || clientWidth,\n component,\n });\n }, 10);\n }\n };\n\n useEffect(() => {\n if (ref.current) {\n const el = ref.current.parentElement;\n const boundingClientRect = el.getBoundingClientRect();\n //onsole.log(`%cPopup.componentDidMount about to call show`,'color:green');\n show(props, boundingClientRect);\n }\n\n return () => {\n PopupService.hidePopup(props.name, props.group);\n };\n }, [props]);\n\n return React.createElement(\"div\", { className: \"popup-proxy\", ref });\n\n // componentWillReceiveProps(nextProps) {\n\n // const domNode = ReactDOM.findDOMNode(this);\n // if (domNode) {\n // const el = domNode.parentElement;\n // const boundingClientRect = el.getBoundingClientRect();\n // //onsole.log(`%cPopup.componentWillReceiveProps about to call show`,'color:green');\n // this.show(nextProps, boundingClientRect);\n // }\n // }\n};\n", "import { ReactElement, useLayoutEffect, useMemo } from \"react\";\nimport * as ReactDOM from \"react-dom\";\nimport { createContainer, renderPortal } from \"./render-portal\";\n\nexport interface PortalProps {\n children: ReactElement;\n onRender?: () => void;\n x?: number;\n y?: number;\n}\n\nexport const Portal = function Portal({\n children,\n x = 0,\n y = 0,\n onRender,\n}: PortalProps) {\n // Do we need to accept container here as a prop ?\n const renderContainer = useMemo(() => {\n return createContainer();\n }, []);\n\n useLayoutEffect(() => {\n renderPortal(children, renderContainer, x, y, onRender);\n }, [children, onRender, renderContainer, x, y]);\n\n useLayoutEffect(() => {\n return () => {\n if (renderContainer) {\n ReactDOM.unmountComponentAtNode(renderContainer);\n if (renderContainer.classList.contains(\"vuuPopup\")) {\n renderContainer.parentElement?.removeChild(renderContainer);\n }\n }\n };\n }, [renderContainer]);\n\n // useLayoutEffect(() => {\n // renderContainer.current = renderPortal(children, x, y, container)\n // return () => {\n // if (renderContainer.current){\n // console.log('EXPLICIT UNMOUNT')\n // ReactDOM.unmountComponentAtNode(renderContainer.current);\n // if (renderContainer.current.classList.contains('hwReactPopup')){\n // renderContainer.current.parentElement.removeChild(renderContainer.current);\n // renderContainer.current = null;\n // }\n // }\n // }\n // },[])\n return null;\n};\n", "import * as ReactDOM from \"react-dom\";\nimport { SaltProvider } from \"@salt-ds/core\";\nimport { ReactElement } from \"react\";\n\nlet containerId = 1;\n\nconst getPortalContainer = (x = 0, y = 0, win = window) => {\n const el = win.document.createElement(\"div\");\n el.className = \"vuuPopup \" + containerId++;\n el.style.cssText = `left:${x}px; top:${y}px;`;\n win.document.body.appendChild(el);\n return el;\n};\n\nconst createDOMContainer = (x?: number, y?: number) => getPortalContainer(x, y);\n\nexport const renderPortal = (\n component: ReactElement,\n container: HTMLElement,\n x: number,\n y: number,\n onRender?: () => void\n) => {\n // check this first to see if position has changed\n container.style.cssText = `left:${x}px; top:${y}px;position: absolute;`;\n\n ReactDOM.render(\n <SaltProvider applyClassesTo=\"child\">{component}</SaltProvider>,\n container,\n onRender\n );\n};\n\nexport const createContainer = createDOMContainer;\n", "import cx from \"classnames\";\nimport { HTMLAttributes } from \"react\";\nimport { DropTarget } from \"./DropTarget\";\n\nimport \"./DropMenu.css\";\n\nexport function computeMenuPosition(\n dropTarget: DropTarget,\n offsetTop = 0,\n offsetLeft = 0\n): [number, number, \"left\" | \"bottom\" | \"right\" | \"top\"] {\n const { pos, clientRect: box } = dropTarget;\n const menuOffset = 20;\n\n return pos.position.West\n ? [box.left - offsetLeft + menuOffset, pos.y - offsetTop, \"left\"]\n : pos.position.South\n ? [pos.x - offsetLeft, box.bottom - offsetTop - menuOffset, \"bottom\"]\n : pos.position.East\n ? [box.right - offsetLeft - menuOffset, pos.y - offsetTop, \"right\"]\n : /* North | Header*/ [\n pos.x - offsetLeft,\n box.top - offsetTop + menuOffset,\n \"top\",\n ];\n}\n\nconst classBase = \"vuuDropMenu\";\n\nexport interface DropMenuProps extends HTMLAttributes<HTMLDivElement> {\n dropTarget: DropTarget;\n onHover: (target: DropTarget | null) => void;\n orientation?: \"left\" | \"top\" | \"right\" | \"bottom\";\n}\n\nexport const DropMenu = ({\n className,\n dropTarget,\n onHover,\n orientation,\n}: DropMenuProps) => {\n const dropTargets = dropTarget.toArray();\n // TODO we have all the information here to draw a mini target map\n // but maybe thats overkill ...\n\n return (\n <div\n className={cx(classBase, className, `${classBase}-${orientation}`)}\n onMouseLeave={() => onHover(null)}\n >\n {dropTargets.map((target, i) => (\n <div\n key={i}\n className={`${classBase}-item`}\n data-icon={i === 0 ? \"column-2A\" : \"column-2B\"}\n onMouseEnter={() => onHover(target)}\n />\n ))}\n </div>\n );\n};\n", "import { PopupService } from \"../popup\";\nimport { RelativeDropPosition } from \"./BoxModel\";\nimport { DragDropRect } from \"./dragDropTypes\";\nimport { DragState } from \"./DragState\";\nimport { computeMenuPosition, DropMenu } from \"./DropMenu\";\nimport { DropTarget, GuideLine } from \"./DropTarget\";\n\nimport \"./DropTargetRenderer.css\";\n\ntype Point = [number, number];\ntype TabMode = \"full-view\" | \"tab-only\";\n\nlet _multiDropOptions = false;\nlet _hoverDropTarget: DropTarget | null = null;\nlet _shiftedTab: HTMLElement | null = null;\n\nconst onHoverDropTarget = (dropTarget: DropTarget | null) =>\n (_hoverDropTarget = dropTarget);\n\nconst start = ([x, y]: Point) => `M${x},${y}`;\nconst point = ([x, y]: Point) => `L${x},${y}`;\nconst pathFromPoints = ([p1, ...points]: Point[]) =>\n `${start(p1)} ${points.map(point)}Z`;\n\nconst pathFromGuideLines = (guideLines?: GuideLine) => {\n if (guideLines) {\n const [x1, y1, x2, y2, x3, y3, x4, y4] = guideLines;\n return `M${x1},${y1} L${x2},${y2} M${x3},${y3} L${x4},${y4}`;\n } else {\n return \"\";\n }\n};\n\nfunction insertSVGRoot() {\n if (document.getElementById(\"hw-drag-canvas\") === null) {\n const root = document.getElementById(\"root\");\n const container = document.createElement(\"div\");\n container.id = \"hw-drag-canvas\";\n container.innerHTML = `\n <svg width=\"100%\" height=\"100%\">\n <path id=\"hw-drop-guides\" />\n <path\n id=\"vuu-drop-outline\"\n d=\"M300,132 L380,132 L380,100 L460,100 L460,132, L550,132 L550,350 L300,350z\">\n <animate\n attributeName=\"d\"\n id=\"hw-drop-outline-animate\"\n begin=\"indefinite\"\n dur=\"300ms\"\n fill=\"freeze\"\n to=\"M255,33 L255,33,L255,1,L315,1,L315,1,L794,1,L794,164,L255,164Z\"\n />\n </path>\n </svg>\n `;\n document.body.insertBefore(container, root);\n }\n}\nexport default class DropTargetCanvas {\n private currentPath: string | null = null;\n private tabMode: TabMode | null = null;\n\n constructor() {\n insertSVGRoot();\n }\n\n prepare(dragRect: DragDropRect, tabMode: TabMode = \"full-view\") {\n // don't do this on body\n document.body.classList.add(\"drawing\");\n this.currentPath = null;\n this.tabMode = tabMode;\n\n const points = this.getPoints(0, 0, 0, 0);\n // const points = this.getPoints(left, top, width, height);\n const d = pathFromPoints(points);\n\n const dropOutlinePath = document.getElementById(\"vuu-drop-outline\");\n dropOutlinePath?.setAttribute(\"d\", d);\n this.currentPath = d;\n }\n\n clear() {\n // don't do this on body\n _hoverDropTarget = null;\n clearShiftedTab();\n document.body.classList.remove(\"drawing\");\n PopupService.hidePopup();\n }\n\n get hoverDropTarget() {\n return _hoverDropTarget;\n }\n\n getPoints(\n x: number,\n y: number,\n width: number,\n height: number,\n tabLeft = 0,\n tabWidth = 0,\n tabHeight = 0\n ): Point[] {\n const tabOnly = this.tabMode === \"tab-only\";\n if (tabWidth === 0) {\n return [\n [x, y + tabHeight],\n [x, y + tabHeight],\n [x, y],\n [x + tabWidth, y],\n [x + tabWidth, y],\n [x + width, y],\n [x + width, y + height],\n [x, y + height],\n ];\n } else if (tabOnly) {\n const left = tabLeft;\n return [\n [left, y],\n [left, y],\n [left + tabWidth, y],\n [left + tabWidth, y],\n [left + tabWidth, y + tabHeight],\n [left + tabWidth, y + tabHeight],\n [left, y + tabHeight],\n [left, y + tabHeight],\n ];\n } else if (tabLeft === 0) {\n return [\n [x, y + tabHeight],\n [x, y + tabHeight],\n [x, y],\n [x + tabWidth, y],\n [x + tabWidth, y + tabHeight],\n [x + width, y + tabHeight],\n [x + width, y + height],\n [x, y + height],\n ];\n } else {\n return [\n [x, y + tabHeight],\n [x + tabLeft, y + tabHeight],\n [x + tabLeft, y],\n [x + tabLeft, y],\n [x + tabLeft, y + tabHeight],\n [x + width, y + tabHeight],\n [x + width, y + height],\n [x, y + height],\n ];\n }\n }\n\n draw(dropTarget: DropTarget, dragState: DragState) {\n const sameDropTarget = false;\n const wasMultiDrop = _multiDropOptions;\n\n if (_hoverDropTarget !== null) {\n this.drawTarget(_hoverDropTarget);\n } else {\n if (sameDropTarget === false) {\n _multiDropOptions = dropTarget.nextDropTarget != null;\n if (dropTarget.pos.tab) {\n moveExistingTabs(dropTarget);\n } else if (_shiftedTab) {\n clearShiftedTab();\n }\n this.drawTarget(dropTarget, dragState);\n }\n\n if (_multiDropOptions) {\n const [left, top, orientation] = computeMenuPosition(dropTarget);\n if (!wasMultiDrop || !sameDropTarget) {\n const component = (\n <DropMenu\n dropTarget={dropTarget}\n onHover={onHoverDropTarget}\n orientation={orientation}\n />\n );\n PopupService.showPopup({\n left,\n top,\n component,\n });\n } else {\n PopupService.movePopupTo(left, top);\n }\n } else {\n PopupService.hidePopup();\n }\n }\n }\n\n drawTarget(dropTarget: DropTarget, dragState?: DragState) {\n const lineWidth = 6;\n\n const targetDropOutline = dropTarget.getTargetDropOutline(\n lineWidth,\n dragState\n );\n\n if (targetDropOutline) {\n const { l, t, r, b, tabLeft, tabWidth, tabHeight, guideLines } =\n targetDropOutline;\n const w = r - l;\n const h = b - t;\n\n if (this.currentPath) {\n const path = document.getElementById(\"vuu-drop-outline\");\n path?.setAttribute(\"d\", this.currentPath);\n }\n\n const points = this.getPoints(l, t, w, h, tabLeft, tabWidth, tabHeight);\n const path = pathFromPoints(points);\n const animation = document.getElementById(\n \"hw-drop-outline-animate\"\n ) as unknown as SVGAnimateElement;\n animation?.setAttribute(\"to\", path);\n animation?.beginElement();\n this.currentPath = path;\n\n const dropGuidePath = document.getElementById(\"hw-drop-guides\");\n dropGuidePath?.setAttribute(\"d\", pathFromGuideLines(guideLines));\n }\n }\n}\n\nconst cssShiftRight = \"transition:margin-left .4s ease-out;margin-left: 63px\";\nconst cssShiftBack = \"transition:margin-left .4s ease-out;margin-left: 0px\";\n\nfunction moveExistingTabs(dropTarget: DropTarget) {\n const { AFTER, BEFORE } = RelativeDropPosition;\n const {\n clientRect: { Stack },\n pos: {\n // tab: { index: tabIndex, positionRelativeToTab }\n tab,\n },\n } = dropTarget;\n\n const { id } = dropTarget.component.props;\n let tabEl = null;\n // console.log(`tabPos = ${tabPos} (width=${tabWidth}) x=${x}`)\n if (Stack && tab && tab.positionRelativeToTab !== AFTER) {\n const tabOffset = tab.positionRelativeToTab === BEFORE ? 1 : 2;\n const selector = `:scope .hwTabstrip > .hwTabstrip-inner > .hwTab:nth-child(${\n tab.index + tabOffset\n })`;\n tabEl = document.getElementById(id)?.querySelector(selector) as HTMLElement;\n if (tabEl) {\n if (_shiftedTab === null || _shiftedTab !== tabEl) {\n tabEl.style.cssText = cssShiftRight;\n if (_shiftedTab) {\n _shiftedTab.style.cssText = cssShiftBack;\n }\n _shiftedTab = tabEl;\n }\n } else {\n clearShiftedTab();\n }\n } else if (tab?.positionRelativeToTab === BEFORE) {\n if (_shiftedTab === null) {\n const selector = \".vuuHeader-title\";\n tabEl = document\n .getElementById(id)\n ?.querySelector(selector) as HTMLElement;\n tabEl.style.cssText = cssShiftRight;\n _shiftedTab = tabEl;\n }\n } else {\n clearShiftedTab();\n }\n}\n\nfunction clearShiftedTab() {\n if (_shiftedTab) {\n _shiftedTab.style.cssText = cssShiftBack;\n _shiftedTab = null;\n }\n}\n", "import { ReactElement } from \"react\";\nimport { rect } from \"../common-types\";\nimport { LayoutModel } from \"../layout-reducer\";\nimport { findTarget, followPath, getProps } from \"../utils\";\nimport { BoxModel, Measurements, Position } from \"./BoxModel\";\nimport { DragDropRect } from \"./dragDropTypes\";\nimport { DragState, IntrinsicSizes } from \"./DragState\";\nimport { DropTarget, identifyDropTarget } from \"./DropTarget\";\nimport DropTargetRenderer from \"./DropTargetRenderer\";\n\nexport type DragStartCallback = (e: MouseEvent, x: number, y: number) => void;\nexport type DragMoveCallback = (\n x: number | undefined,\n y: number | undefined\n) => void;\nexport type DragEndCallback = (droppedTarget: Partial<DropTarget>) => void;\nexport type DragInstructions = {\n DoNotRemove?: boolean;\n DoNotTransform?: boolean;\n dragThreshold?: number;\n RemoveDraggableOnDragEnd?: boolean;\n};\n\nlet _dragStartCallback: DragStartCallback | null;\nlet _dragMoveCallback: DragMoveCallback | null;\nlet _dragEndCallback: DragEndCallback | null;\n\nlet _dragStartX: number;\nlet _dragStartY: number;\nlet _dragContainer: ReactElement | null;\nlet _dragState: DragState;\nlet _dropTarget: DropTarget | null = null;\nlet _validDropTargetPaths: string[] | null;\nlet _dragInstructions: DragInstructions;\nlet _measurements: Measurements;\nlet _simpleDrag: boolean;\nlet _dragThreshold: number;\nlet _mouseDownTimer: number | null = null;\n\nconst DEFAULT_DRAG_THRESHOLD = 3;\nconst _dropTargetRenderer = new DropTargetRenderer();\nconst SCALE_FACTOR = 0.4;\n\nfunction getDragContainer(\n rootContainer: ReactElement,\n dragContainerPath: string\n) {\n if (dragContainerPath) {\n return followPath(rootContainer, dragContainerPath) as ReactElement;\n } else {\n return findTarget(\n rootContainer,\n (props) => props.dropTarget\n ) as ReactElement;\n }\n}\n\nexport const Draggable = {\n handleMousedown(\n e: MouseEvent,\n dragStartCallback: DragStartCallback,\n dragInstructions: DragInstructions = {}\n ) {\n _dragStartCallback = dragStartCallback;\n _dragInstructions = dragInstructions;\n\n _dragStartX = e.clientX;\n _dragStartY = e.clientY;\n\n _dragThreshold =\n dragInstructions.dragThreshold === undefined\n ? DEFAULT_DRAG_THRESHOLD\n : dragInstructions.dragThreshold;\n\n if (_dragThreshold === 0) {\n // maybe this should be -1\n _dragStartCallback(e, 0, 0);\n } else {\n window.addEventListener(\"mousemove\", preDragMousemoveHandler, false);\n window.addEventListener(\"mouseup\", preDragMouseupHandler, false);\n\n _mouseDownTimer = window.setTimeout(() => {\n console.log(\"mousedownTimer fires\");\n window.removeEventListener(\"mousemove\", preDragMousemoveHandler, false);\n window.removeEventListener(\"mouseup\", preDragMouseupHandler, false);\n _dragStartCallback?.(e, 0, 0);\n }, 500);\n }\n\n e.preventDefault();\n },\n\n // called from handleDragStart (_dragCallback)\n initDrag(\n rootContainer: ReactElement,\n dragContainerPath: string,\n { top, left, right, bottom }: rect,\n dragPos: { x: number; y: number },\n dragHandler: {\n drag: DragMoveCallback;\n drop: DragEndCallback;\n },\n intrinsicSize?: IntrinsicSizes,\n dropTargets?: string[]\n ) {\n ({ drag: _dragMoveCallback, drop: _dragEndCallback } = dragHandler);\n return initDrag(\n rootContainer,\n dragContainerPath,\n { top, left, right, bottom } as DragDropRect,\n dragPos,\n intrinsicSize,\n dropTargets\n );\n },\n};\n\nfunction preDragMousemoveHandler(e: MouseEvent) {\n var x = true;\n var y = true;\n\n let x_diff = x ? e.clientX - _dragStartX : 0;\n let y_diff = y ? e.clientY - _dragStartY : 0;\n let mouseMoveDistance = Math.max(Math.abs(x_diff), Math.abs(y_diff));\n\n // when we do finally move the draggee, we are going to 'jump' by the amount of the drag threshold, should we\n // attempt to animate this ?\n if (mouseMoveDistance > _dragThreshold) {\n window.removeEventListener(\"mousemove\", preDragMousemoveHandler, false);\n window.removeEventListener(\"mouseup\", preDragMouseupHandler, false);\n _dragStartCallback?.(e, x_diff, y_diff);\n _dragStartCallback = null;\n }\n}\n\nfunction preDragMouseupHandler() {\n if (_mouseDownTimer) {\n window.clearTimeout(_mouseDownTimer);\n _mouseDownTimer = null;\n }\n window.removeEventListener(\"mousemove\", preDragMousemoveHandler, false);\n window.removeEventListener(\"mouseup\", preDragMouseupHandler, false);\n}\n\nfunction initDrag(\n rootContainer: ReactElement,\n dragContainerPath: string,\n dragRect: DragDropRect,\n dragPos: { x: number; y: number },\n intrinsicSize?: IntrinsicSizes,\n dropTargets?: string[]\n) {\n _dragContainer = getDragContainer(rootContainer, dragContainerPath);\n const { \"data-path\": dataPath, path = dataPath } = getProps(_dragContainer);\n\n if (dropTargets) {\n const dropPaths = dropTargets\n .map((id) => findTarget(rootContainer, (props) => props.id === id))\n .map((target) => (target as LayoutModel).props.path);\n _validDropTargetPaths = dropPaths;\n }\n\n // var start = window.performance.now();\n // translate the layout $position to drag-oriented co-ordinates, ignoring splitters\n _measurements = BoxModel.measure(_dragContainer, dropTargets);\n console.log({ _measurements });\n // onsole.log({ measurements: _measurements });\n // var end = window.performance.now();\n // onsole.log(`[Draggable] measurements took ${end - start}ms`, _measurements);\n\n const dragZone = _measurements[path];\n\n _dragState = new DragState(\n dragZone,\n dragPos.x,\n dragPos.y,\n dragRect,\n intrinsicSize\n );\n\n const pctX = Math.round(_dragState.x.mousePct * 100);\n const pctY = Math.round(_dragState.y.mousePct * 100);\n\n window.addEventListener(\"mousemove\", dragMousemoveHandler, false);\n window.addEventListener(\"mouseup\", dragMouseupHandler, false);\n\n _simpleDrag = false;\n\n _dropTargetRenderer.prepare(dragRect, \"tab-only\");\n\n return _dragInstructions.DoNotTransform\n ? \"transform:none\"\n : // scale factor should be applied in caller, not here\n `transform:scale(${SCALE_FACTOR},${SCALE_FACTOR});transform-origin:${pctX}% ${pctY}%;`;\n}\n\nfunction dragMousemoveHandler(evt: MouseEvent) {\n const x = evt.clientX;\n const y = evt.clientY;\n const dragState = _dragState;\n const currentDropTarget = _dropTarget;\n let dropTarget;\n let newX, newY;\n\n if (dragState.update(\"x\", x)) {\n newX = dragState.x.pos;\n }\n\n if (dragState.update(\"y\", y)) {\n newY = dragState.y.pos;\n }\n\n if (newX === undefined && newY === undefined) {\n //onsole.log('both x and y are unchanged');\n } else {\n _dragMoveCallback?.(newX, newY);\n }\n\n if (_simpleDrag) {\n return;\n }\n\n if (dragState.inBounds()) {\n dropTarget = identifyDropTarget(\n x,\n y,\n _dragContainer!,\n _measurements,\n dragState.hasIntrinsicSize(),\n _validDropTargetPaths!\n );\n } else {\n dropTarget = identifyDropTarget(\n dragState.dropX(),\n dragState.dropY(),\n _dragContainer!,\n _measurements\n );\n }\n\n // did we have an existing droptarget which is no longer such ...\n if (currentDropTarget) {\n if (dropTarget == null || dropTarget.box !== currentDropTarget.box) {\n _dropTarget = null;\n }\n }\n\n if (dropTarget) {\n _dropTargetRenderer.draw(dropTarget, dragState);\n _dropTarget = dropTarget;\n }\n}\n\nfunction dragMouseupHandler() {\n onDragEnd();\n}\n\nfunction onDragEnd() {\n if (_dropTarget) {\n const dropTarget =\n _dropTargetRenderer.hoverDropTarget ||\n DropTarget.getActiveDropTarget(_dropTarget);\n\n _dragEndCallback?.(dropTarget as DropTarget);\n\n _dropTarget = null;\n } else {\n _dragEndCallback?.({\n component: _dragContainer!,\n pos: { position: Position.Absolute } as any,\n });\n }\n\n _dragMoveCallback = null;\n _dragEndCallback = null;\n\n _dragContainer = null;\n _dropTargetRenderer.clear();\n _validDropTargetPaths = null;\n window.removeEventListener(\"mousemove\", dragMousemoveHandler, false);\n window.removeEventListener(\"mouseup\", dragMouseupHandler, false);\n}\n", "import { useForkRef } from \"@salt-ds/core\";\nimport cx from \"classnames\";\nimport { ForwardedRef, forwardRef } from \"react\";\nimport { useBreakpoints } from \"../responsive\";\nimport { FlexboxProps } from \"./flexboxTypes\";\nimport \"./FluidGrid.css\";\nimport { useResponsiveSizing } from \"./useResponsiveSizing\";\n\nconst classBase = \"hwFluidGrid\";\n\nexport interface FluidGridProps extends FlexboxProps {\n showGrid?: boolean;\n}\n\nexport const FluidGrid = forwardRef(function FluidGrid(\n props: FluidGridProps,\n ref: ForwardedRef<HTMLDivElement>\n) {\n const {\n breakPoints,\n children,\n column,\n cols: colsProp = 12,\n className: classNameProp,\n flexFill,\n gap = 3,\n fullPage,\n id,\n onSplitterMoved,\n resizeable,\n row,\n showGrid,\n spacing,\n splitterSize,\n style: styleProp,\n ...rest\n } = props;\n\n const { cols, content, rootRef } = useResponsiveSizing({\n children,\n cols: colsProp,\n // onSplitterMoved,\n style: styleProp,\n });\n\n const breakpoint = useBreakpoints(\n {\n breakPoints,\n },\n rootRef\n );\n\n const className = cx(classBase, classNameProp, {\n [`${classBase}-column`]: column,\n [`${classBase}-row`]: row,\n [`${classBase}-show-grid`]: showGrid,\n \"flex-fill\": flexFill,\n \"full-page\": fullPage,\n });\n\n const style = {\n ...styleProp,\n \"--spacing\": spacing,\n // only needed to display the cols\n \"--grid-col-count\": cols,\n \"--grid-gap\": gap,\n };\n\n return (\n <div\n {...rest}\n className={className}\n data-breakpoint={breakpoint}\n data-cols={cols}\n data-resizeable={resizeable || undefined}\n id={id}\n ref={useForkRef(rootRef, ref)}\n style={style}\n >\n {content}\n </div>\n );\n});\nFluidGrid.displayName = \"FluidGrid\";\n", "import { RefObject, useCallback, useEffect, useRef, useState } from 'react';\nimport { useResizeObserver } from './useResizeObserver';\nimport {\n BreakPointRamp,\n breakpointRamp,\n getBreakPoints as getDocumentBreakpoints\n} from './breakpoints';\nimport { BreakPoint, BreakPointsProp } from '../flexbox/flexboxTypes';\nimport { ExecFileOptionsWithStringEncoding } from 'child_process';\n\nconst EMPTY_ARRAY: BreakPoint[] = [];\n\nexport interface BreakpointsHookProps {\n breakPoints?: BreakPointsProp;\n smallerThan?: string;\n}\n\n// TODO how do we cater for smallerThan/greaterThan breakpoints\nexport const useBreakpoints = (\n { breakPoints: breakPointsProp, smallerThan }: BreakpointsHookProps,\n ref: RefObject<any>\n) => {\n const [breakpointMatch, setBreakpointmatch] = useState(smallerThan ? false : 'lg');\n const bodyRef = useRef(document.body);\n const breakPointsRef = useRef(\n breakPointsProp ? breakpointRamp(breakPointsProp) : getDocumentBreakpoints()\n );\n\n // TODO how do we identify the default\n const sizeRef = useRef('lg');\n\n const stopFromMinWidth = useCallback(\n (w) => {\n if (breakPointsRef.current) {\n for (let [name, size] of breakPointsRef.current) {\n if (w >= size) {\n return name;\n }\n }\n }\n },\n [breakPointsRef]\n );\n\n const matchSizeAgainstBreakpoints = useCallback(\n (width) => {\n if (smallerThan) {\n const breakPointRamp = breakPointsRef.current.find(\n ([name]: BreakPointRamp) => name === smallerThan\n );\n if (breakPointRamp) {\n const [, , maxValue] = breakPointRamp;\n return width < maxValue;\n }\n } else {\n return stopFromMinWidth(width);\n }\n // is this right ?\n return width;\n },\n [smallerThan, stopFromMinWidth]\n );\n\n // TODO need to make the dimension a config\n useResizeObserver(\n ref || bodyRef,\n breakPointsRef.current ? ['width'] : EMPTY_ARRAY,\n ({ width: measuredWidth }: { width: number }) => {\n const result = matchSizeAgainstBreakpoints(measuredWidth);\n if (result !== sizeRef.current) {\n sizeRef.current = result;\n setBreakpointmatch(result);\n }\n },\n true\n );\n\n useEffect(() => {\n const target = ref || bodyRef;\n if (target.current) {\n const prevSize = sizeRef.current;\n if (breakPointsRef.current) {\n // We're measuring here when the resizeObserver has also measured\n // There isn't a convenient way to get the Resizeobserver to\n // notify initial size - that's not really its job, unless we\n // set a flag ?\n const { clientWidth } = target.current;\n const result = matchSizeAgainstBreakpoints(clientWidth);\n sizeRef.current = result;\n // If initial size of ref does not match the default, notify client after render\n if (result !== prevSize) {\n setBreakpointmatch(result);\n }\n }\n }\n }, [setBreakpointmatch, matchSizeAgainstBreakpoints, ref]);\n\n // No, just ass the class directly to the ref, no need to render\n return breakpointMatch;\n};\n", "/* eslint-disable no-restricted-syntax */\nimport { useCallback, useLayoutEffect, useRef, RefObject } from 'react';\nexport const WidthHeight = ['height', 'width'];\nexport const HeightOnly = ['height'];\nexport const WidthOnly = ['width'];\n\nexport type measurements<T = string | number> = {\n height?: T;\n scrollHeight?: T;\n scrollWidth?: T;\n width?: T;\n};\ntype measuredDimension = keyof measurements<number>;\n\nexport type ResizeHandler = (measurements: measurements<number>) => void;\n\ntype observedDetails = {\n onResize?: ResizeHandler;\n measurements: measurements<number>;\n};\nconst observedMap = new WeakMap<HTMLElement, observedDetails>();\n\nconst getTargetSize = (\n element: HTMLElement,\n contentRect: DOMRectReadOnly,\n dimension: measuredDimension\n): number => {\n switch (dimension) {\n case 'height':\n return contentRect.height;\n case 'scrollHeight':\n return element.scrollHeight;\n case 'scrollWidth':\n return element.scrollWidth;\n case 'width':\n return contentRect.width;\n default:\n return 0;\n }\n};\n\nconst resizeObserver = new ResizeObserver((entries: ResizeObserverEntry[]) => {\n for (const entry of entries) {\n const { target, contentRect } = entry;\n const observedTarget = observedMap.get(target as HTMLElement);\n if (observedTarget) {\n const { onResize, measurements } = observedTarget;\n let sizeChanged = false;\n for (const [dimension, size] of Object.entries(measurements)) {\n const newSize = getTargetSize(\n target as HTMLElement,\n contentRect,\n dimension as measuredDimension\n );\n if (newSize !== size) {\n sizeChanged = true;\n measurements[dimension as measuredDimension] = newSize;\n }\n }\n if (sizeChanged) {\n onResize && onResize(measurements);\n }\n }\n }\n});\n\n// TODO use an optional lag (default to false) to ask to fire onResize\n// with initial size\n// Note asking for scrollHeight alone will not trigger onResize, this is only triggered by height,\n// with scrollHeight returned as an auxilliary value\nexport function useResizeObserver(\n ref: RefObject<Element | HTMLElement | null>,\n dimensions: string[],\n onResize: ResizeHandler,\n reportInitialSize = false\n): void {\n const dimensionsRef = useRef(dimensions);\n const measure = useCallback((target: HTMLElement): measurements<number> => {\n const rect = target.getBoundingClientRect();\n return dimensionsRef.current.reduce((map: { [key: string]: number }, dim) => {\n map[dim] = getTargetSize(target, rect, dim as measuredDimension);\n return map;\n }, {});\n }, []);\n\n // TODO use ref to store resizeHandler here\n // resize handler registered with REsizeObserver will never change\n // use ref to store user onResize callback here\n // resizeHandler will call user callback.current\n\n // Keep this effect separate in case user inadvertently passes different\n // dimensions or callback instance each time - we only ever want to\n // initiate new observation when ref changes.\n useLayoutEffect(() => {\n const target = ref.current as HTMLElement;\n let cleanedUp = false;\n\n async function registerObserver() {\n // Create the map entry immediately. useEffect may fire below\n // before fonts are ready and attempt to update entry\n observedMap.set(target, { measurements: {} as measurements<number> });\n cleanedUp = false;\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n const { fonts } = document as any;\n if (fonts) {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n await fonts.ready;\n }\n if (!cleanedUp) {\n const observedTarget = observedMap.get(target);\n if (observedTarget) {\n const measurements = measure(target);\n observedTarget.measurements = measurements;\n resizeObserver.observe(target);\n if (reportInitialSize) {\n onResize(measurements);\n }\n }\n }\n }\n\n if (target) {\n // TODO might we want multiple callers to attach a listener to the same element ?\n if (observedMap.has(target)) {\n throw Error('useResizeObserver attemping to observe same element twice');\n }\n void registerObserver();\n }\n return () => {\n if (target && observedMap.has(target)) {\n resizeObserver.unobserve(target);\n observedMap.delete(target);\n cleanedUp = true;\n }\n };\n }, [ref, measure]);\n\n useLayoutEffect(() => {\n const target = ref.current as HTMLElement;\n const record = observedMap.get(target);\n if (record) {\n if (dimensionsRef.current !== dimensions) {\n dimensionsRef.current = dimensions;\n const measurements = measure(target);\n record.measurements = measurements;\n }\n // Might not have changed, but no harm ...\n record.onResize = onResize;\n }\n }, [dimensions, measure, ref, onResize]);\n\n // TODO might be a good idea to ref and return the current measurememnts. That way, derived hooks\n // e.g useBreakpoints don't have to measure and client cn make onResize callback simpler\n}\n", "// should we have some global; defaults ?\n\nimport { BreakPointsProp } from \"../flexbox/flexboxTypes\";\n\nexport type BreakPointRamp = [string, number, number];\n\nfunction breakpointReader(\n themeName: string,\n defaultBreakpoints?: BreakPointsProp\n) {\n //TODO ownerDocument\n const themeRoot = document.body.querySelector(`.${themeName}`);\n const handler = {\n get: function (style: CSSStyleDeclaration, stopName: string) {\n const val = style.getPropertyValue(\n // lets assume we have the following naming convention\n `--${themeName}-breakpoint-${stopName}`\n );\n return val ? parseInt(val) : undefined;\n },\n };\n\n return themeRoot\n ? new Proxy(getComputedStyle(themeRoot), handler)\n : defaultBreakpoints ?? {};\n}\n\nconst byDescendingStopSize = (\n [, s1]: [string, number],\n [, s2]: [string, number]\n) => s2 - s1;\n\n// These are assumed to be min-width (aka mobile-first) stops, we could take a\n// paramneter to support max-width as well ?\n// return [stopName, minWidth, maxWidth]\nexport const breakpointRamp = (\n breakpoints: BreakPointsProp\n): BreakPointRamp[] =>\n Object.entries(breakpoints)\n .sort(byDescendingStopSize)\n .map(([name, value], i, all) => [\n name,\n value,\n i < all.length - 1 ? all[i + 1][1] : 9999,\n ]);\n\nlet documentBreakpoints: BreakPointRamp[] | null = null;\n\nconst loadBreakpoints = (themeName = \"salt\") => {\n // TODO would be nice to read these breakpoint labels from a css variable to\n // avoid hard-coding them here ?\n const { xs, sm, md, lg, xl } = breakpointReader(themeName) as BreakPointsProp;\n return breakpointRamp({ xs, sm, md, lg, xl });\n};\n\n//TODO support multiple themes loaded\nexport const getBreakPoints = (themeName?: string) => {\n if (documentBreakpoints === null) {\n documentBreakpoints = loadBreakpoints(themeName);\n }\n return documentBreakpoints;\n};\n", "import { useCallback, useLayoutEffect, useRef, useState } from \"react\";\nimport { useResizeObserver } from \"./useResizeObserver\";\nimport { measureMinimumNodeSize } from \"./measureMinimumNodeSize\";\n\nconst MONITORED_DIMENSIONS = {\n horizontal: [\"width\", \"scrollHeight\"],\n vertical: [\"height\", \"scrollWidth\"],\n none: [],\n};\nconst NO_OVERFLOW_INDICATOR = {};\nconst NO_DATA = {};\n\nconst UNCOLLAPSED_DYNAMIC_ITEMS =\n '[data-collapsible=\"dynamic\"]:not([data-collapsed=\"true\"]):not([data-collapsing=\"true\"])';\n\nconst addAll = (sum: number, m: any) => sum + m.size;\nconst addAllExceptOverflowIndicator = (sum: number, m: any) =>\n sum + (m.isOverflowIndicator ? 0 : m.size);\n\n// There should be no collapsible items here that are not already collapsed\n// otherwise we would be collapsing, not overflowing\nconst lastOverflowableItem = (arr) => {\n for (let i = arr.length - 1; i >= 0; i--) {\n const item = arr[i];\n // TODO should we support a no-overflow attribute (maybe a priority 0)\n // to prevent an item from overflowing ?\n // TODO when all collapsible items are collapsed and we start overflowing,\n // should we leave collapsed items to last in the overflow priority ?\n if (!item.isOverflowIndicator) {\n return item;\n }\n }\n return null;\n};\nconst OVERFLOWING = 1000;\nconst collapsedOnly = (status) => status > 0 && status < 1000;\nconst includesOverflow = (status) => status >= OVERFLOWING;\nconst lastListItem = (listRef) => listRef.current[listRef.current.length - 1];\n\nconst newlyCollapsed = (visibleItems) =>\n visibleItems.some((item) => item.collapsed && item.fullWidth === null);\n\nconst hasUncollapsedDynamicItems = (containerRef) =>\n containerRef.current.querySelector(UNCOLLAPSED_DYNAMIC_ITEMS) !== null;\n\nconst moveOverflowItem = (fromStack, toStack) => {\n const item = lastOverflowableItem(fromStack.current);\n if (item) {\n fromStack.current = fromStack.current.filter((i) => i !== item);\n toStack.current = toStack.current.concat(item);\n return item;\n } else {\n return null;\n }\n};\n\nconst byDescendingPriority = (m1, m2) => {\n let result = m1.priority - m2.priority;\n if (result === 0) {\n result = m1.index - m2.index;\n }\n return result;\n};\n\nconst getOverflowIndicator = (visibleRef) =>\n visibleRef.current.find((item) => item.isOverflowIndicator);\n\nconst Dimensions = {\n horizontal: {\n size: \"clientWidth\",\n depth: \"clientHeight\",\n scrollDepth: \"scrollHeight\",\n },\n vertical: {\n size: \"clientHeight\",\n depth: \"clientWidth\",\n scrollDepth: \"scrollWidth\",\n },\n};\n\nconst measureContainerOverflow = (\n { current: innerEl },\n orientation = \"horizontal\"\n) => {\n const dim = Dimensions[orientation];\n const { [dim.depth]: containerDepth } = innerEl.parentNode;\n const { [dim.scrollDepth]: scrollDepth, [dim.size]: contentSize } = innerEl;\n const isOverflowing = containerDepth < scrollDepth;\n return [isOverflowing, contentSize, containerDepth];\n};\n\nconst useOverflowStatus = () => {\n const [, forceUpdate] = useState(null);\n // TODO make this easier to understand by storing the overflow and\n // collapse status as separate reference count fields\n const [overflowing, _setOverflowing] = useState(0);\n const overflowingRef = useRef(0);\n const setOverflowing = useCallback(\n (value) => {\n _setOverflowing((overflowingRef.current = value));\n },\n [_setOverflowing]\n );\n\n const updateOverflowStatus = useCallback(\n (value, force) => {\n if (Math.abs(value) === OVERFLOWING) {\n if (value > 0 && !includesOverflow(overflowingRef.current)) {\n setOverflowing(overflowingRef.current + value);\n } else if (value < 0 && includesOverflow(overflowingRef.current)) {\n setOverflowing(overflowingRef.current + value);\n } else {\n forceUpdate({});\n }\n } else if (value !== 0) {\n setOverflowing(overflowingRef.current + value);\n } else if (force) {\n forceUpdate({});\n }\n },\n [forceUpdate, overflowingRef, setOverflowing]\n );\n\n return [overflowingRef, overflowing, updateOverflowStatus];\n};\n\nconst measureChildNodes = ({ current: innerEl }, dimension) => {\n const measurements = Array.from(innerEl.childNodes).reduce(\n (list, node: Node) => {\n const {\n collapsible,\n collapsed,\n collapsing,\n index,\n priority = \"1\",\n overflowIndicator,\n overflowed,\n } = node?.dataset ?? NO_DATA;\n if (index) {\n const size = measureMinimumNodeSize(node, dimension);\n if (overflowed) {\n delete node.dataset.overflowed;\n }\n list.push({\n collapsible,\n collapsed: collapsible ? collapsed === \"true\" : undefined,\n collapsing,\n // only to be populated in case of collapse\n // TODO check the role of this - especially the way we check it in useEffect\n // to detect collapse\n fullSize: null,\n index: parseInt(index, 10),\n isOverflowIndicator: overflowIndicator,\n label: node.title || node.innerText,\n priority: parseInt(priority, 10),\n size,\n });\n }\n return list;\n },\n []\n );\n\n return measurements.sort(byDescendingPriority);\n};\n\nconst getElementForItem = (ref, item) =>\n ref.current.querySelector(`:scope > [data-idx='${item.index}']`);\n\n// value could be anything which might require a re-evaluation. In the case of tabs\n// we might have selected an overflowed tab. Can we make this more efficient, only\n// needs action if an overflowed item re-enters the visible section\nexport function useOverflowObserver(orientation = \"horizontal\", label = \"\") {\n const ref = useRef(null);\n const [overflowingRef, overflowing, updateOverflowStatus] =\n useOverflowStatus();\n // const [, forceUpdate] = useState();\n const visibleRef = useRef([]);\n const overflowedRef = useRef([]);\n const collapsedRef = useRef([]);\n const collapsingRef = useRef(false);\n const rootDepthRef = useRef(null);\n const containerSizeRef = useRef(null);\n const horizontalRef = useRef(orientation === \"horizontal\");\n const overflowIndicatorSizeRef = useRef(36); // should default by density\n const minSizeRef = useRef(0);\n\n const setContainerMinSize = useCallback(\n (size) => {\n const isHorizontal = horizontalRef.current;\n if (size === undefined) {\n const dimension = isHorizontal ? \"width\" : \"height\";\n ({ [dimension]: size } = ref.current.getBoundingClientRect());\n }\n minSizeRef.current = size;\n const styleDimension = isHorizontal ? \"minWidth\" : \"minHeight\";\n ref.current.style[styleDimension] = size + \"px\";\n },\n [ref]\n );\n\n const markOverflowingItems = useCallback(\n (visibleContentSize, containerSize) => {\n let result = 0;\n // First pass, see if there is a collapsible item we can collapse. We won't\n // know how much space this frees up until the thing has re-rendered, so this\n // may kick off a chain of renders and remeasures if there are multiple collapsible\n // items and each yields only a part of the shrinkage we need to apply.\n // That's the worst case scenario.\n if (\n visibleRef.current.some((item) => item.collapsible && !item.collapsed)\n ) {\n for (let i = visibleRef.current.length - 1; i >= 0; i--) {\n const item = visibleRef.current[i];\n if (item.collapsible === \"instant\" && !item.collapsed) {\n item.collapsed = true;\n const target = getElementForItem(ref, item);\n target.dataset.collapsed = true;\n collapsedRef.current.push(item);\n // We only ever collapse 1 item at a time. We now need to wait for\n // it to render, so we can re-measure and determine how much space\n // this has saved.\n return 1;\n } else if (\n item.collapsible === \"dynamic\" &&\n !item.collapsed &&\n !item.collapsing\n ) {\n item.collapsing = true;\n const target = getElementForItem(ref, item);\n target.dataset.collapsing = true;\n collapsedRef.current.push(item);\n ref.current.dataset.collapsing = true;\n // We only ever collapse 1 item at a time. We now need to wait for\n // it to render, so we can re-measure and determine how much space\n // this has saved.\n return 1;\n }\n }\n }\n\n // If no collapsible items, movin items from visible to overflowed queues\n while (visibleContentSize > containerSize) {\n const overflowedItem = moveOverflowItem(visibleRef, overflowedRef);\n if (overflowedItem === null) {\n // unable to overflow, all items are collapsed, this is our minimum width,\n // enforce it ...\n // TODO what if density changes\n //TODO probably not right, now we overflow even collapsed items, min width should be\n // overflow indicator width plus width of any non-overflowable items\n setContainerMinSize(visibleContentSize);\n break;\n }\n visibleContentSize -= overflowedItem.size;\n const target = getElementForItem(ref, overflowedItem);\n target.dataset.overflowed = true;\n result = OVERFLOWING;\n }\n return result;\n },\n [setContainerMinSize]\n );\n\n const removeOverflowIfSpaceAllows = useCallback(\n (containerSize) => {\n let result = 0;\n // TODO calculate this without using fullWidth if we have OVERFLOW\n // Need a loop here where we first remove OVERFLOW, then potentially remove\n // COLLAPSE too\n // We want to re-introduce overflowed items before we start to restore collapsed items\n // When we are dealing with overflowed items, we just use the current width of collapsed items.\n let visibleContentSize = visibleRef.current.reduce(\n addAllExceptOverflowIndicator,\n 0\n );\n let diff = containerSize - visibleContentSize;\n\n if (collapsedOnly(overflowingRef.current)) {\n // find the next collapsed item, see how much extra space it would\n // occupy if restored. If we have enough space, restore it.\n while (collapsedRef.current.length) {\n const item = lastListItem(collapsedRef);\n const itemDiff = item.fullSize - item.size;\n if (diff >= itemDiff) {\n item.collapsed = false;\n item.size = item.fullSize;\n // Be careful before setting this to null, check the code in useEffect\n delete item.fullSize;\n const target = getElementForItem(ref, item);\n collapsedRef.current.pop();\n delete target.dataset.collapsed;\n diff = diff - itemDiff;\n result += 1;\n } else {\n break;\n }\n }\n return result;\n } else {\n while (overflowedRef.current.length > 0) {\n const { size: nextSize } = lastListItem(overflowedRef);\n\n if (diff >= nextSize) {\n const { size: overflowSize = 0 } =\n getOverflowIndicator(visibleRef) || NO_OVERFLOW_INDICATOR;\n // we can only ignore the width of overflow Indicator if either there is only one remaining\n // overflow item (so overflowIndicator will be removed) or diff is big enough to accommodate\n // the overflow Ind.\n if (\n overflowedRef.current.length === 1 ||\n diff >= nextSize + overflowSize\n ) {\n const overflowedItem = moveOverflowItem(\n overflowedRef,\n visibleRef\n );\n visibleContentSize += overflowedItem.size;\n const target = getElementForItem(ref, overflowedItem);\n delete target.dataset.overflowed;\n diff = diff - overflowedItem.size;\n result = OVERFLOWING;\n } else {\n break;\n }\n } else {\n break;\n }\n }\n }\n // DOn't return OVERFLOWING unless there is no more overflow\n return result;\n },\n [overflowingRef]\n );\n\n const initializeDynamicContent = useCallback(() => {\n let renderedSize = visibleRef.current.reduce(addAll, 0);\n let diff = renderedSize - containerSizeRef.current;\n for (let i = visibleRef.current.length - 1; i >= 0; i--) {\n const item = visibleRef.current[i];\n if (item.collapsible && !item.collapsed) {\n const target = getElementForItem(ref, item);\n // TODO where do we derive min width 28 + 8\n if (diff > item.size - 36) {\n // We really want to know if it has reached min-width, but we will have to\n // wait for it to render\n target.dataset.collapsed = item.collapsed = true;\n diff -= item.size;\n } else {\n target.dataset.collapsing = item.collapsing = true;\n break;\n }\n }\n }\n }, [containerSizeRef, ref, visibleRef]);\n\n const collapseCollapsingItem = useCallback(\n (item, target) => {\n target.dataset.collapsing = item.collapsing = false;\n target.dataset.collapsed = item.collapsed = true;\n\n const rest = visibleRef.current.filter(\n ({ collapsible, collapsed }) => collapsible === \"dynamic\" && !collapsed\n );\n const last = rest.pop();\n if (last) {\n const lastTarget = getElementForItem(ref, last);\n lastTarget.dataset.collapsing = last.collapsing = true;\n } else {\n // Set minSize to current measured size\n // TODO check that this makes sense...suspect it doesn't\n setContainerMinSize();\n }\n },\n [setContainerMinSize]\n );\n\n const restoreCollapsingItem = useCallback((item, target) => {\n target.dataset.collapsing = item.collapsing = false;\n // we might have an opportunity to switch the next collapsed item to\n // collapsing here. If we don't do this, it will ge handled in the next resize\n }, []);\n\n const checkDynamicContent = useCallback(\n (containerHasGrown) => {\n // The order must matter here\n const collapsingItem = visibleRef.current.find(\n ({ collapsible, collapsing }) => collapsible === \"dynamic\" && collapsing\n );\n const collapsedItem = visibleRef.current.find(\n ({ collapsible, collapsed }) => collapsible === \"dynamic\" && collapsed\n );\n\n if (collapsingItem === undefined && collapsedItem === undefined) {\n return;\n }\n\n if (collapsingItem === undefined) {\n const target = getElementForItem(ref, collapsedItem);\n target.dataset.collapsed = collapsedItem.collapsed = false;\n target.dataset.collapsing = collapsedItem.collapsing = true;\n return;\n }\n\n const target = getElementForItem(ref, collapsingItem);\n const dimension = horizontalRef.current ? \"width\" : \"height\";\n\n if (containerHasGrown && collapsedItem) {\n const size = measureMinimumNodeSize(target, dimension);\n // We don't restore a collapsing item unless there is at least one collapsed item\n if (collapsedItem && size === collapsingItem.size) {\n restoreCollapsingItem(collapsingItem, target);\n }\n } else {\n // Note we are going to compare width with minWidth. Margin is ignored here, so we\n // use getBoundingClientRect rather than measureNode\n const { [dimension]: size } = target.getBoundingClientRect();\n const style = getComputedStyle(target);\n const minSize = parseInt(style.getPropertyValue(`min-${dimension}`));\n if (size === minSize) {\n collapseCollapsingItem(collapsingItem, target);\n }\n }\n },\n [collapseCollapsingItem, restoreCollapsingItem]\n );\n\n const resetMeasurements = useCallback(() => {\n const [isOverflowing, innerContainerSize, rootContainerDepth] =\n measureContainerOverflow(ref, orientation);\n\n containerSizeRef.current = innerContainerSize;\n rootDepthRef.current = rootContainerDepth;\n\n const hasDynamicItems = hasUncollapsedDynamicItems(ref);\n\n if (hasDynamicItems || isOverflowing) {\n const dimension = horizontalRef.current ? \"width\" : \"height\";\n const measurements = measureChildNodes(ref, dimension);\n visibleRef.current = measurements;\n overflowedRef.current = [];\n }\n\n if (hasDynamicItems) {\n // if we don't have overflow, but we do have dynamic collapse items, we need to monitor resize events\n // to determine when the collapsing item reaches min-width. At which point it becomes collapsed, and\n // the next dynanic collapse item assumes collapsing status\n collapsingRef.current = true;\n ref.current.dataset.collapsing = true;\n\n if (isOverflowing) {\n // We will only encounter this scenario first-time in. Once we initialize for dynamic content,\n // there will be no more overflow (unless we decide to re-enable overflow once all dynamic\n // items are collapsed ).\n initializeDynamicContent();\n } else {\n const collapsingItem = lastListItem(visibleRef);\n const element = getElementForItem(ref, collapsingItem);\n element.dataset.collapsing = collapsingItem.collapsing = true;\n }\n } else if (isOverflowing) {\n // We may already have an overflowIndicator here, if caller is Tabstrip\n let renderedSize = visibleRef.current.reduce(\n addAllExceptOverflowIndicator,\n 0\n );\n const result = markOverflowingItems(\n renderedSize,\n innerContainerSize - overflowIndicatorSizeRef.current\n );\n updateOverflowStatus(+result);\n }\n }, [\n initializeDynamicContent,\n markOverflowingItems,\n orientation,\n updateOverflowStatus,\n ]);\n\n const resizeHandler = useCallback(\n ({\n scrollHeight,\n height = scrollHeight,\n scrollWidth,\n width = scrollWidth,\n }) => {\n const [size, depth] = horizontalRef.current\n ? [width, height]\n : [height, width];\n\n const wasFullSize = overflowingRef.current === 0;\n const overflowDetected = depth > rootDepthRef.current;\n const containerHasGrown = size > containerSizeRef.current;\n\n containerSizeRef.current = size;\n\n if (containerHasGrown && size === minSizeRef.current) {\n // ignore\n } else if (collapsingRef.current) {\n checkDynamicContent(containerHasGrown);\n } else if (!wasFullSize && containerHasGrown) {\n const result = removeOverflowIfSpaceAllows(size);\n // Don't remove the overflowing status if there are remaining overflowed item(s).\n // Unlike collapsed items, overflowed is not a reference count.\n if (result !== OVERFLOWING || overflowedRef.current.length === 0) {\n updateOverflowStatus(-result);\n } else if (result === OVERFLOWING) {\n updateOverflowStatus(0, true);\n }\n } else if (wasFullSize && overflowDetected) {\n // TODO if client is not using an overflow indicator, there is nothing to do here,\n // just let nature take its course. How do we know this ?\n // This is when we need to add width to measurements we are tracking\n resetMeasurements();\n } else if (!wasFullSize && overflowDetected) {\n // we're still overflowing\n let renderedSize = visibleRef.current.reduce(addAll, 0);\n if (size < renderedSize) {\n const result = markOverflowingItems(renderedSize, size);\n updateOverflowStatus(+result);\n }\n }\n },\n [\n checkDynamicContent,\n removeOverflowIfSpaceAllows,\n resetMeasurements,\n markOverflowingItems,\n overflowingRef,\n updateOverflowStatus,\n ]\n );\n\n useLayoutEffect(() => {\n const dimension = horizontalRef.current ? \"width\" : \"height\";\n if (newlyCollapsed(visibleRef.current)) {\n // These are in reverse priority order, so last collapsed will always be first\n const [collapsedItem] = visibleRef.current.filter(\n (item) => item.collapsed\n );\n if (collapsedItem.fullSize === null) {\n const target = getElementForItem(ref, collapsedItem);\n if (target) {\n const collapsedSize = measureMinimumNodeSize(target, dimension);\n collapsedItem.fullSize = collapsedItem.size;\n collapsedItem.size = collapsedSize;\n // is the difference between collapsed size and original size enough ?\n // TODO we repeat this code a lot, factoer it out\n const renderedSize = visibleRef.current.reduce(addAll, 0);\n if (renderedSize > containerSizeRef.current) {\n const strategy = markOverflowingItems(\n renderedSize,\n containerSizeRef.current - overflowIndicatorSizeRef.current\n );\n updateOverflowStatus(+strategy);\n }\n }\n }\n } else if (includesOverflow(overflowing)) {\n const target = ref.current.querySelector(\n `:scope > [data-overflow-indicator='true']`\n );\n if (target) {\n const { index, priority = \"1\" } = target?.dataset ?? NO_DATA;\n const item = {\n index: parseInt(index, 10),\n isOverflowIndicator: true,\n priority: parseInt(priority, 10),\n label: target.innerText,\n size: measureMinimumNodeSize(target, dimension),\n };\n overflowIndicatorSizeRef.current = item.size;\n visibleRef.current = visibleRef.current\n .concat(item)\n .sort(byDescendingPriority);\n }\n } else if (getOverflowIndicator(visibleRef)) {\n visibleRef.current = visibleRef.current.filter(\n (item) => !item.isOverflowIndicator\n );\n }\n }, [\n markOverflowingItems,\n overflowing,\n ref,\n updateOverflowStatus,\n visibleRef,\n ]);\n\n // Measurement occurs post-render, by necessity, need to trigger a render\n useLayoutEffect(() => {\n async function measure() {\n await document.fonts.ready;\n if (ref.current !== null) {\n resetMeasurements();\n }\n }\n if (orientation !== \"none\") {\n measure();\n }\n }, [label, orientation, resetMeasurements]);\n\n useResizeObserver(ref, MONITORED_DIMENSIONS[orientation], resizeHandler);\n\n return [ref, overflowedRef.current, collapsedRef.current, resetMeasurements];\n}\n", "const LEFT_RIGHT = ['left', 'right'];\nconst TOP_BOTTOM = ['top', 'bottom'];\n\nexport function measureMinimumNodeSize(node: HTMLElement, dimension: 'width' | 'height' = 'width') {\n const { [dimension]: size } = node.getBoundingClientRect();\n const { padRight = false, padLeft = false } = node.dataset;\n const style = getComputedStyle(node);\n const [start, end] = dimension === 'width' ? LEFT_RIGHT : TOP_BOTTOM;\n const marginStart = padLeft ? 0 : parseInt(style.getPropertyValue(`margin-${start}`), 10);\n const marginEnd = padRight ? 0 : parseInt(style.getPropertyValue(`margin-${end}`), 10);\n\n let minWidth = size;\n const flexShrink = parseInt(style.getPropertyValue('flex-shrink'), 10);\n if (flexShrink > 0) {\n const flexBasis = parseInt(style.getPropertyValue('flex-basis'), 10);\n // TODO what about percentage values ?\n if (!isNaN(flexBasis)) {\n minWidth = flexBasis;\n }\n }\n\n return marginStart + minWidth + marginEnd;\n}\n", "const COLLAPSIBLE = 'data-collapsible';\n\nconst RESPONSIVE_ATTRIBUTE: { [key: string]: boolean } = {\n [COLLAPSIBLE]: true,\n 'data-pad-start': true,\n 'data-pad-end': true\n};\n\nexport const isResponsiveAttribute = (propName: string): boolean =>\n RESPONSIVE_ATTRIBUTE[propName] ?? false;\n\nconst isCollapsible = (propName: string) => propName === COLLAPSIBLE;\n\nconst COLLAPSIBLE_VALUE: { [key: string]: string } = {\n dynamic: 'dynamic',\n instant: 'instant',\n true: 'instant'\n};\n\nconst collapsibleValue = (value: string) => COLLAPSIBLE_VALUE[value] ?? 'none';\n\ntype Props = { [key: string]: any };\nexport const extractResponsiveProps = (props: Props) => {\n return Object.keys(props).reduce<[Props, Props]>(\n (result, propName) => {\n const [toolbarProps, rest] = result;\n if (isResponsiveAttribute(propName)) {\n const value = isCollapsible(propName) ? collapsibleValue(props[propName]) : props[propName];\n\n toolbarProps[propName] = value;\n rest[propName] = undefined;\n }\n return result;\n },\n [{}, {}]\n );\n};\n", "import {\n cloneElement,\n CSSProperties,\n isValidElement,\n ReactElement,\n useCallback,\n useMemo,\n useRef,\n} from \"react\";\nimport { getUniqueId } from \"@vuu-ui/vuu-utils\";\nimport { gatherChildMeta } from \"./flexbox-utils\";\nimport { BreakPoint } from \"./flexboxTypes\";\n\nconst breakPoints: BreakPoint[] = [\"xs\", \"sm\", \"md\", \"lg\", \"xl\"];\n\nconst DEFAULT_COLS = 12;\n\nexport const useResponsiveSizing = ({\n children: childrenProp,\n cols: colsProp,\n style,\n}: {\n children: ReactElement[];\n cols?: number;\n style?: CSSProperties;\n}) => {\n const rootRef = useRef(null);\n const metaRef = useRef(null);\n const contentRef = useRef<ReactElement[]>();\n const cols = colsProp ?? DEFAULT_COLS;\n\n const isColumn = style?.flexDirection === \"column\";\n const dimension = isColumn ? \"height\" : \"width\";\n\n const children = useMemo(\n () =>\n Array.isArray(childrenProp)\n ? childrenProp\n : isValidElement(childrenProp)\n ? [childrenProp]\n : [],\n [childrenProp]\n );\n\n const buildContent = useCallback(\n (children, dimension): [ReactElement[], any] => {\n const childMeta = gatherChildMeta(children, dimension, breakPoints);\n const content = [];\n const meta = [];\n for (let i = 0; i < children.length; i++) {\n const child = children[i];\n const {\n style: { flex, ...rest },\n } = child.props;\n // TODO do we always need to clone ?\n // TODO emit the --col-span based on media query\n content.push(\n cloneElement(child, {\n key: getUniqueId(), // need to store these\n style: {\n ...rest,\n \"--parent-col-count\": cols,\n },\n })\n );\n meta.push(childMeta[i]);\n }\n return [content, meta];\n },\n [cols]\n );\n\n useMemo(() => {\n // console.log(`useMemo<initialCotent>`, children)\n const [content, meta] = buildContent(children, dimension);\n metaRef.current = meta;\n contentRef.current = content;\n }, [buildContent, children, dimension]);\n\n return {\n cols,\n content: contentRef.current,\n rootRef,\n };\n};\n", "import React from 'react';\nimport {FluidGrid, FluidGridProps} from './FluidGrid';\nimport { registerComponent } from '../registry/ComponentRegistry';\n\nexport const FluidGridLayout = function FluidGridLayout(props: FluidGridProps) {\n return <FluidGrid {...props} />;\n};\nFluidGridLayout.displayName = 'FluidGrid';\n\nregisterComponent('FluidGrid', FluidGridLayout, 'container');\n", "import path from \"path\";\nimport React, { SyntheticEvent, useContext } from \"react\";\nimport { ViewAction } from \"./viewTypes\";\n\nexport type ViewDispatch = <Action extends ViewAction = ViewAction>(\n action: Action,\n evt?: SyntheticEvent\n) => Promise<boolean | void>;\n\nexport interface ViewContextProps {\n dispatch: ViewDispatch | null;\n id: string;\n load: (key?: string) => any;\n loadSession: (key?: string) => any;\n onConfigChange?: (config: any) => void;\n path?: string;\n purge: (key: string) => void;\n save: (state: any, key: string) => void;\n saveSession: (state: any, key: string) => void;\n title?: string;\n}\n\nconst NO_CONTEXT = { dispatch: null } as ViewContextProps;\nexport const ViewContext = React.createContext<ViewContextProps>(NO_CONTEXT);\n\nexport const useViewDispatch = () => {\n const context = useContext(ViewContext);\n return context?.dispatch ?? null;\n};\n\nexport const useViewContext = () => useContext(ViewContext);\n", "import { useForkRef, useIdMemo as useId } from \"@salt-ds/core\";\nimport cx from \"classnames\";\nimport React, { ForwardedRef, forwardRef, useMemo, useRef } from \"react\";\nimport { Header } from \"../layout-header/Header\";\nimport { registerComponent } from \"../registry/ComponentRegistry\";\nimport { ViewContext } from \"./ViewContext\";\nimport { ViewProps } from \"./viewTypes\";\nimport { useView } from \"./useView\";\nimport { useViewResize } from \"./useViewResize\";\n\nimport \"./View.css\";\n\nconst View = forwardRef(function View(\n props: ViewProps,\n forwardedRef: ForwardedRef<HTMLDivElement>\n) {\n const {\n children,\n className,\n collapsed, // \"vertical\" | \"horizontal\" | false | undefined\n closeable,\n \"data-resizeable\": dataResizeable,\n dropTargets,\n expanded,\n flexFill, // use data-flexfill instead\n id: idProp,\n header,\n orientation = \"horizontal\",\n path,\n resize = \"responsive\", // maybe throttle or debounce ?\n resizeable = dataResizeable,\n tearOut,\n style = {},\n title: titleProp,\n ...restProps\n } = props;\n\n // A View within a managed layout will always be passed an id\n const id = useId(idProp);\n const rootRef = useRef<HTMLDivElement>(null);\n const mainRef = useRef<HTMLDivElement>(null);\n\n const {\n contributions,\n dispatchViewAction,\n load,\n loadSession,\n onConfigChange,\n onEditTitle,\n purge,\n restoredState,\n save,\n saveSession,\n title,\n } = useView({\n id,\n rootRef,\n path,\n dropTargets,\n title: titleProp,\n });\n\n useViewResize({ mainRef, resize, rootRef });\n\n const classBase = \"vuuView\";\n\n const getContent = () => {\n // We only inject restored state as props if child is a single element. Maybe we\n // should take this further and only do it if the component has opted into this\n // behaviour.\n if (React.isValidElement(children) && restoredState) {\n return React.cloneElement(children, restoredState);\n } else {\n return children;\n }\n };\n\n const viewContextValue = useMemo(\n () => ({\n dispatch: dispatchViewAction,\n id,\n path,\n title,\n load,\n loadSession,\n onConfigChange,\n purge,\n save,\n saveSession,\n }),\n [\n dispatchViewAction,\n id,\n load,\n loadSession,\n onConfigChange,\n path,\n purge,\n save,\n saveSession,\n title,\n ]\n );\n\n const headerProps = typeof header === \"object\" ? header : {};\n\n return (\n <div\n {...restProps}\n className={cx(classBase, className, {\n [`${classBase}-collapsed`]: collapsed,\n [`${classBase}-expanded`]: expanded,\n [`${classBase}-resize-defer`]: resize === \"defer\",\n })}\n data-resizeable={resizeable}\n id={id}\n ref={useForkRef(forwardedRef, rootRef)}\n style={style}\n tabIndex={-1}\n >\n <ViewContext.Provider value={viewContextValue}>\n {header ? (\n <Header\n {...headerProps}\n collapsed={collapsed}\n contributions={contributions}\n expanded={expanded}\n closeable={closeable}\n onEditTitle={onEditTitle}\n orientation={/*collapsed || */ orientation}\n tearOut={tearOut}\n // title={`${title} v${version} #${id}`}\n title={title}\n />\n ) : null}\n <div className={`${classBase}-main`} ref={mainRef}>\n {getContent()}\n </div>\n </ViewContext.Provider>\n </div>\n );\n});\nView.displayName = \"View\";\n\nconst MemoView = React.memo(View) as React.FunctionComponent<ViewProps>;\nMemoView.displayName = \"View\";\nregisterComponent(\"View\", MemoView, \"view\");\n\nexport { MemoView as View };\n", "import classnames from \"classnames\";\nimport React, {\n HTMLAttributes,\n KeyboardEvent,\n MouseEvent,\n ReactElement,\n useRef,\n useState,\n} from \"react\";\nimport { Contribution, useViewDispatch } from \"../layout-view\";\n\nimport {\n EditableLabel,\n Toolbar,\n ToolbarButton,\n ToolbarField,\n Tooltray,\n} from \"@heswell/salt-lab\";\nimport { CloseIcon } from \"@salt-ds/icons\";\n\nimport \"./Header.css\";\n\nexport interface HeaderProps extends HTMLAttributes<HTMLDivElement> {\n collapsed?: boolean;\n contributions?: Contribution[];\n expanded?: boolean;\n closeable?: boolean;\n onEditTitle: (value: string) => void;\n orientation?: \"horizontal\" | \"vertical\";\n tearOut?: boolean;\n}\n\nexport const Header = ({\n className: classNameProp,\n contributions,\n collapsed,\n expanded,\n closeable,\n onEditTitle,\n orientation: orientationProp = \"horizontal\",\n style,\n tearOut,\n title = \"Untitled\",\n}: HeaderProps) => {\n const labelFieldRef = useRef<HTMLDivElement>(null);\n const [value, setValue] = useState<string>(title);\n const [editing, setEditing] = useState<boolean>(false);\n\n const viewDispatch = useViewDispatch();\n const handleAction = (\n evt: MouseEvent,\n actionId: \"maximize\" | \"restore\" | \"minimize\" | \"tearout\"\n ) => viewDispatch?.({ type: actionId }, evt);\n const handleClose = (evt: MouseEvent) =>\n viewDispatch?.({ type: \"remove\" }, evt);\n const classBase = \"vuuHeader\";\n\n const handleTitleMouseDown = (e: MouseEvent) => {\n labelFieldRef.current?.focus();\n };\n\n const handleButtonMouseDown = (evt: MouseEvent) => {\n // do not allow drag to be initiated\n evt.stopPropagation();\n };\n\n const orientation = collapsed || orientationProp;\n\n const className = classnames(\n classBase,\n classNameProp,\n `${classBase}-${orientation}`\n );\n\n const handleEnterEditMode = () => {\n setEditing(true);\n };\n\n const handleTitleKeyDown = (evt: KeyboardEvent<HTMLDivElement>) => {\n if (evt.key === \"Enter\") {\n setEditing(true);\n }\n };\n\n const handleExitEditMode = (\n originalValue = \"\",\n finalValue = \"\",\n allowDeactivation = true,\n editCancelled = false\n ) => {\n setEditing(false);\n if (editCancelled) {\n setValue(originalValue);\n } else if (finalValue !== originalValue) {\n setValue(finalValue);\n onEditTitle?.(finalValue);\n }\n if (allowDeactivation === false) {\n labelFieldRef.current?.focus();\n }\n };\n\n const handleMouseDown = (e: MouseEvent) => {\n viewDispatch?.({ type: \"mousedown\" }, e);\n };\n\n const toolbarItems: ReactElement[] = [];\n const contributedItems: ReactElement[] = [];\n const actionButtons: ReactElement[] = [];\n\n title &&\n toolbarItems.push(\n <ToolbarField className=\"vuuHeader-title\" key=\"title\">\n <EditableLabel\n editing={editing}\n key=\"title\"\n value={value}\n onChange={setValue}\n onMouseDownCapture={handleTitleMouseDown}\n onEnterEditMode={handleEnterEditMode}\n onExitEditMode={handleExitEditMode}\n onKeyDown={handleTitleKeyDown}\n ref={labelFieldRef}\n tabIndex={0}\n />\n </ToolbarField>\n );\n\n contributions?.forEach((contribution, i) => {\n contributedItems.push(React.cloneElement(contribution.content, { key: i }));\n });\n\n closeable &&\n actionButtons.push(\n <ToolbarButton\n key=\"close\"\n onClick={handleClose}\n onMouseDown={handleButtonMouseDown}\n >\n <CloseIcon /> Close\n </ToolbarButton>\n );\n\n contributedItems.length > 0 &&\n toolbarItems.push(\n <Tooltray data-align-end key=\"contributions\">\n {contributedItems}\n </Tooltray>\n );\n\n actionButtons.length > 0 &&\n toolbarItems.push(\n <Tooltray data-align-end key=\"actions\">\n {actionButtons}\n </Tooltray>\n );\n\n return (\n <Toolbar\n className={className}\n orientation={orientationProp}\n style={style}\n onMouseDown={handleMouseDown}\n >\n {toolbarItems}\n {/* \n {collapsed === false ? (\n <ActionButton\n aria-label=\"Minimize View\"\n actionId=\"minimize\"\n iconName=\"minimize\"\n onClick={handleAction}\n onMouseDown={handleButtonMouseDown}\n />\n ) : null}\n {collapsed ? (\n <ActionButton\n aria-label=\"Restore View\"\n actionId=\"restore\"\n iconName=\"double-chevron-right\"\n onClick={handleAction}\n onMouseDown={handleButtonMouseDown}\n />\n ) : null}\n {expanded === false ? (\n <ActionButton\n aria-label=\"Maximize View\"\n actionId=\"maximize\"\n iconName=\"maximize\"\n onClick={handleAction}\n onMouseDown={handleButtonMouseDown}\n />\n ) : null}\n {expanded ? (\n <ActionButton\n aria-label=\"Restore View\"\n actionId=\"restore\"\n iconName=\"restore\"\n onClick={handleAction}\n onMouseDown={handleButtonMouseDown}\n />\n ) : null}\n {tearOut ? (\n <ActionButton\n aria-label=\"Tear out View\"\n actionId=\"tearout\"\n iconName=\"tear-out\"\n onClick={handleAction}\n onMouseDown={handleButtonMouseDown}\n />\n ) : null}\n {closeable ? (\n <Button\n aria-label=\"close\"\n data-icon\n onClick={handleClose}\n onMouseDown={handleButtonMouseDown}\n />\n ) : null} */}\n </Toolbar>\n );\n};\n", "import { RefObject, useCallback, useMemo } from \"react\";\nimport { useLayoutProviderDispatch } from \"../layout-provider\";\nimport { usePersistentState } from \"../use-persistent-state\";\nimport { useViewActionDispatcher } from \"./useViewActionDispatcher\";\n\nexport interface ViewHookProps {\n id: string;\n rootRef: RefObject<HTMLDivElement>;\n path?: string;\n dropTargets?: string[];\n title?: string;\n}\n\nexport const useView = ({\n id,\n rootRef,\n path,\n dropTargets,\n title: titleProp,\n}: ViewHookProps) => {\n const layoutDispatch = useLayoutProviderDispatch();\n\n const {\n loadState,\n loadSessionState,\n purgeState,\n saveState,\n saveSessionState,\n } = usePersistentState();\n\n const [dispatchViewAction, contributions] = useViewActionDispatcher(\n id,\n rootRef,\n path,\n dropTargets\n );\n\n const title = useMemo(\n () => loadState(\"view-title\") ?? titleProp,\n [loadState, titleProp]\n );\n\n const onEditTitle = useCallback(\n (title: string) => {\n if (path) {\n layoutDispatch({ type: \"set-title\", path, title });\n }\n },\n [layoutDispatch, path]\n );\n\n const restoredState = useMemo(() => loadState(id), [id, loadState]);\n\n const load = useCallback(\n (key?: string) => loadState(id, key),\n [id, loadState]\n );\n\n const purge = useCallback(\n (key) => {\n purgeState(id, key);\n layoutDispatch({ type: \"save\" });\n },\n [id, purgeState]\n );\n\n const save = useCallback(\n (state, key) => {\n saveState(id, key, state);\n layoutDispatch({ type: \"save\" });\n },\n [id, layoutDispatch, saveState]\n );\n const loadSession = useCallback(\n (key?: string) => loadSessionState(id, key),\n [id, loadSessionState]\n );\n const saveSession = useCallback(\n (state, key) => saveSessionState(id, key, state),\n [id, saveSessionState]\n );\n\n const onConfigChange = useCallback(\n ({ type: key, ...config }) => {\n const { [key]: data } = config;\n save(data, key);\n },\n [save]\n );\n\n return {\n contributions,\n dispatchViewAction,\n load,\n loadSession,\n onConfigChange,\n onEditTitle,\n purge,\n restoredState,\n save,\n saveSession,\n title,\n };\n};\n", "import {\n ReactElement,\n RefObject,\n SyntheticEvent,\n useCallback,\n useState,\n} from \"react\";\nimport { useLayoutProviderDispatch } from \"../layout-provider\";\nimport { DragStartAction } from \"../layout-reducer\";\nimport { ViewDispatch } from \"./ViewContext\";\nimport { ViewAction } from \"./viewTypes\";\nimport { usePersistentState } from \"../use-persistent-state\";\nimport { DataSource } from \"@vuu-ui/vuu-data\";\n\nexport type Contribution = {\n index?: number;\n location?: string;\n content: ReactElement;\n};\n\nexport const useViewActionDispatcher = (\n id: string,\n root: RefObject<HTMLDivElement>,\n viewPath?: string,\n dropTargets?: string[]\n): [ViewDispatch, Contribution[] | undefined] => {\n const { loadSessionState, purgeSessionState, purgeState, saveSessionState } =\n usePersistentState();\n\n const [contributions, setContributions] = useState<Contribution[]>(\n loadSessionState(id, \"contributions\") ?? []\n );\n const dispatchLayoutAction = useLayoutProviderDispatch();\n const updateContributions = useCallback(\n (location: string, content: ReactElement) => {\n const updatedContributions = contributions.concat([\n { location, content },\n ]);\n saveSessionState(id, \"contributions\", updatedContributions);\n setContributions(updatedContributions);\n },\n [contributions, id, saveSessionState]\n );\n\n const clearContributions = useCallback(() => {\n purgeSessionState(id, \"contributions\");\n setContributions([]);\n }, [id, purgeSessionState]);\n\n const handleRemove = useCallback(() => {\n // TODO this requires a bit more thought. I works BECAUSE filteredGrid has\n // stored its datasource in sessionState. It is highly pretty much a\n // requirement for features to do so - how do we enforce it.\n const ds = loadSessionState(id, \"data-source\") as DataSource;\n if (ds) {\n ds.unsubscribe();\n }\n purgeSessionState(id);\n purgeState(id);\n dispatchLayoutAction({ type: \"remove\", path: viewPath });\n }, [\n dispatchLayoutAction,\n id,\n loadSessionState,\n purgeSessionState,\n purgeState,\n viewPath,\n ]);\n\n const handleMouseDown = useCallback(\n async (evt, index, preDragActivity): Promise<boolean> => {\n evt.stopPropagation();\n const dragRect = root.current?.getBoundingClientRect();\n return new Promise((resolve, reject) => {\n // TODO should we check if we are allowed to drag ?\n dispatchLayoutAction({\n type: \"drag-start\",\n evt,\n path: index === undefined ? viewPath : `${viewPath}.${index}`,\n dragRect,\n preDragActivity,\n dropTargets,\n resolveDragStart: resolve,\n rejectDragStart: reject,\n } as DragStartAction);\n });\n },\n [root, dispatchLayoutAction, viewPath, dropTargets]\n );\n\n // TODO should be event, action, then this method can bea assigned directly to a html element\n // as an event hander\n const dispatchAction = useCallback(\n async <A extends ViewAction = ViewAction>(\n action: A,\n evt?: SyntheticEvent\n ): Promise<boolean | void> => {\n const { type } = action;\n switch (type) {\n case \"maximize\":\n case \"minimize\":\n case \"restore\":\n // case Action.TEAR_OUT:\n return dispatchLayoutAction({ type, path: action.path ?? viewPath });\n case \"remove\":\n return handleRemove();\n case \"mousedown\":\n console.log(\"2) ViewActionDispatch Hook dispatch Action mousedown\");\n return handleMouseDown(evt, action.index, action.preDragActivity);\n case \"add-toolbar-contribution\":\n return updateContributions(action.location, action.content);\n case \"remove-toolbar-contribution\":\n return clearContributions();\n default: {\n // if (Object.values(Action).includes(type)) {\n // dispatch(action);\n // }\n return undefined;\n }\n }\n },\n [\n dispatchLayoutAction,\n viewPath,\n handleRemove,\n handleMouseDown,\n updateContributions,\n clearContributions,\n ]\n );\n\n return [dispatchAction, contributions];\n};\n", "import { useResizeObserver, WidthHeight } from \"@heswell/salt-lab\";\nimport { RefObject, useCallback, useRef } from \"react\";\n\nconst NO_MEASUREMENT: string[] = [];\n\ntype size = {\n height?: number;\n width?: number;\n};\n\nexport interface ViewResizeHookProps {\n mainRef: RefObject<HTMLDivElement>;\n resize?: \"defer\" | \"responsive\";\n rootRef: RefObject<HTMLDivElement>;\n}\n\nexport const useViewResize = ({\n mainRef,\n resize = \"responsive\",\n rootRef,\n}: ViewResizeHookProps) => {\n const deferResize = resize === \"defer\";\n\n const mainSize = useRef<size>({});\n const resizeHandle = useRef<number>();\n\n const setMainSize = useCallback(() => {\n if (mainRef.current) {\n mainRef.current.style.height = mainSize.current.height + \"px\";\n mainRef.current.style.width = mainSize.current.width + \"px\";\n }\n resizeHandle.current = undefined;\n }, []);\n\n const onResize = useCallback(\n ({ height, width }) => {\n mainSize.current.height = height;\n mainSize.current.width = width;\n if (resizeHandle.current !== null) {\n clearTimeout(resizeHandle.current);\n }\n resizeHandle.current = window.setTimeout(setMainSize, 40);\n },\n [setMainSize]\n );\n\n useResizeObserver(\n rootRef,\n deferResize ? WidthHeight : NO_MEASUREMENT,\n onResize,\n deferResize\n );\n};\n", "import { useIdMemo as useId } from \"@salt-ds/core\";\nimport { useCallback, useRef } from \"react\";\nimport { Portal } from \"../portal\";\n\nimport { getItemId, getMenuId, useCascade } from \"./use-cascade\";\nimport { useItemsWithIds } from \"./use-items-with-ids\";\n\nimport MenuList from \"./MenuList\";\n\nimport \"./ContextMenu.css\";\nimport { useClickAway } from \"./use-click-away\";\n\nconst ContextMenu = ({\n activatedWithKeyboard = false,\n children: childrenProp,\n id: idProp,\n onClose = () => undefined,\n position = { x: 0, y: 0 },\n source: sourceProp,\n style,\n}) => {\n const id = useId(idProp);\n const closeMenuRef = useRef(null);\n const [menus, actions] = useItemsWithIds(sourceProp, childrenProp);\n const navigatingWithKeyboard = useRef(activatedWithKeyboard);\n const handleMouseEnterItem = useCallback(() => {\n navigatingWithKeyboard.current = false;\n }, []);\n\n const handleActivate = useCallback(\n (menuId) => {\n const { action, options } = actions[menuId];\n closeMenuRef.current(\"root\");\n onClose(action, options);\n },\n [actions, onClose]\n );\n\n const { closeMenu, listItemProps, openMenu, openMenus, handleRender } =\n useCascade({\n id,\n onActivate: handleActivate,\n onMouseEnterItem: handleMouseEnterItem,\n position,\n });\n closeMenuRef.current = closeMenu;\n\n console.log({ openMenus });\n\n const handleClose = useCallback(() => {\n closeMenu();\n onClose();\n }, [closeMenu, onClose]);\n\n useClickAway({\n containerClassName: \"hwMenuList\",\n onClose: handleClose,\n isOpen: openMenus.length > 0,\n });\n\n const handleOpenMenu = (id) => {\n const itemId = getItemId(id);\n const menuId = getMenuId(itemId);\n navigatingWithKeyboard.current = true;\n openMenu(menuId, itemId);\n };\n const handleCloseMenu = () => {\n navigatingWithKeyboard.current = true;\n closeMenu();\n };\n\n const handleHighlightMenuItem = () => {\n // console.log(`highlight ${idx}`);\n };\n\n const lastMenu = openMenus.length - 1;\n\n const getChildMenuIndex = (i) => {\n if (i >= lastMenu) {\n return -1;\n } else {\n const { id: menuId } = openMenus[i + 1];\n const pos = menuId.lastIndexOf(\".\");\n const idx =\n pos === -1 ? parseInt(menuId, 10) : parseInt(menuId.slice(-pos), 10);\n return idx;\n }\n };\n\n return (\n <>\n {openMenus.map(({ id: menuId, left, top }, i) => {\n const childMenuIndex = getChildMenuIndex(i);\n\n return (\n <Portal key={i} x={left} y={top} onRender={handleRender}>\n <MenuList\n activatedByKeyboard={navigatingWithKeyboard.current}\n childMenuShowing={childMenuIndex}\n id={id}\n menuId={menuId}\n isRoot={i === 0}\n key={i}\n listItemProps={listItemProps}\n onActivate={handleActivate}\n onHighlightMenuItem={handleHighlightMenuItem}\n onCloseMenu={handleCloseMenu}\n onOpenMenu={handleOpenMenu}\n style={style}\n >\n {menus[menuId]}\n </MenuList>\n </Portal>\n );\n })}\n </>\n );\n};\n\nContextMenu.displayName = \"ContextMenu\";\nexport default ContextMenu;\n", "import { useCallback, useMemo, useRef, useState } from \"react\";\n\nimport { closestListItem, listItemIndex } from \"./list-dom-utils\";\n// import {mousePosition} from './aim/utils';\n// import {aiming} from './aim/aim';\n\nconst nudge = (menus, distance, pos) => {\n return menus.map((m, i) =>\n i === menus.length - 1\n ? {\n ...m,\n [pos]: m[pos] - distance,\n }\n : m\n );\n};\nconst nudgeLeft = (menus, distance) => nudge(menus, distance, \"left\");\nconst nudgeUp = (menus, distance) => nudge(menus, distance, \"top\");\n\nconst flipSides = (id, menus) => {\n const [parentMenu, menu] = menus.slice(-2);\n const el = document.getElementById(`${id}-${menu.id}`);\n const { width } = el.getBoundingClientRect();\n return menus.map((m) =>\n m === menu\n ? {\n ...m,\n left: parentMenu.left - (width - 2),\n }\n : m\n );\n};\n\nconst closedNode = (el) =>\n el.ariaHasPopup === \"true\" && el.ariaExpanded !== \"true\";\nconst getPosition = (el, openMenus) => {\n const [{ left, top: menuTop }] = openMenus.slice(-1);\n // const {top, right, bottom, left} = el.getBoundingClientRect();\n // this will not work for MenuList within window, we need the\n // const {offsetLeft: left, offsetTop: menuTop} = el.closest('.hwMenuList');\n const { offsetWidth: width, offsetTop: top } = el;\n return { left: left + width, top: top + menuTop };\n};\n\nexport const getItemId = (id) => {\n let pos = id.lastIndexOf(\"-\");\n return pos === -1 ? id : id.slice(pos + 1);\n};\n\nexport const getMenuId = (id) => {\n const itemId = getItemId(id);\n const pos = itemId.lastIndexOf(\".\");\n return pos > -1 ? itemId.slice(0, pos) : \"root\";\n};\n\nconst getMenuDepth = (id) => {\n let count = 0,\n pos = id.indexOf(\".\", 0);\n while (pos !== -1) {\n count += 1;\n pos = id.indexOf(\".\", pos + 1);\n }\n return count;\n};\nconst identifyItem = (el) => [\n getMenuId(el.id),\n getItemId(el.id),\n el.ariaHasPopup === \"true\",\n el.ariaExpanded === \"true\",\n getMenuDepth(el.id),\n];\n\nexport const useCascade = ({\n id,\n onActivate,\n onMouseEnterItem,\n position: { x: posX, y: posY },\n}) => {\n const [, forceRefresh] = useState({});\n const openMenus = useRef([{ id: \"root\", left: posX, top: posY }]);\n\n const setOpenMenus = useCallback((menus) => {\n openMenus.current = menus;\n forceRefresh({});\n }, []);\n\n const menuOpenPendingTimeout = useRef(null);\n const menuClosePendingTimeout = useRef(null);\n const menuState = useRef({ root: \"no-popup\" });\n const prevLevel = useRef(0);\n\n // const prevAim = useRef({mousePos: null, distance: true});\n\n const openMenu = useCallback(\n (menuId = \"root\", itemId = null, listItemEl = null) => {\n if (menuId === \"root\" && itemId === null) {\n setOpenMenus([{ id: \"root\", left: posX, top: posY }]);\n } else {\n menuState.current[menuId] = \"popup-open\";\n const doc = listItemEl ? listItemEl.ownerDocument : document;\n const el = doc.getElementById(`${id}-${menuId}-${itemId}`);\n const { left, top } = getPosition(el, openMenus.current);\n setOpenMenus(openMenus.current.concat({ id: itemId, left, top }));\n }\n },\n [id, posX, posY, setOpenMenus]\n );\n\n const closeMenu = useCallback(\n (menuId) => {\n if (menuId === \"root\") {\n setOpenMenus([]);\n } else {\n setOpenMenus(openMenus.current.slice(0, -1));\n }\n },\n [setOpenMenus]\n );\n\n const closeMenus = useCallback(\n (menuId, itemId) => {\n const menus = openMenus.current.slice();\n let { id: lastMenuId } = menus[menus.length - 1];\n while (menus.length > 1 && !itemId.startsWith(lastMenuId)) {\n const parentMenuId = getMenuId(lastMenuId);\n menus.pop();\n menuState.current[lastMenuId] = \"no-popup\";\n menuState.current[parentMenuId] = \"no-popup\";\n ({ id: lastMenuId } = menus[menus.length - 1]);\n }\n if (menus.length < openMenus.current.length) {\n setOpenMenus(menus);\n }\n },\n [setOpenMenus]\n );\n\n const scheduleOpen = useCallback(\n (menuId, itemId, listItemEl) => {\n if (menuOpenPendingTimeout.current) {\n clearTimeout(menuOpenPendingTimeout.current);\n }\n menuOpenPendingTimeout.current = setTimeout(() => {\n console.log(`scheduleOpen timed out opening ${itemId}`);\n closeMenus(menuId, itemId);\n menuState.current[menuId] = \"popup-open\";\n menuState.current[itemId] = \"no-popup\";\n openMenu(menuId, itemId, listItemEl);\n }, 400);\n },\n [closeMenus, openMenu]\n );\n\n const scheduleClose = useCallback(\n (openMenuId, menuId, itemId) => {\n console.log(\n `scheduleClose openMenuId ${openMenuId} menuId ${menuId} itemId ${itemId}`\n );\n menuState.current[openMenuId] = \"pending-close\";\n menuClosePendingTimeout.current = setTimeout(() => {\n closeMenus(menuId, itemId);\n }, 400);\n },\n [closeMenus]\n );\n\n const handleRender = useCallback(() => {\n const { current: menus } = openMenus;\n const [menu] = menus.slice(-1);\n const el = document.getElementById(`${id}-${menu.id}`);\n if (el) {\n const { right, bottom } = el.getBoundingClientRect();\n const { clientHeight, clientWidth } = document.body;\n if (right > clientWidth) {\n const newMenus =\n menus.length > 1\n ? flipSides(id, menus)\n : nudgeLeft(menus, right - clientWidth);\n setOpenMenus(newMenus);\n } else if (bottom > clientHeight) {\n const newMenus = nudgeUp(menus, bottom - clientHeight);\n setOpenMenus(newMenus);\n }\n }\n }, [id, setOpenMenus]);\n\n const listItemProps = useMemo(\n () => ({\n onMouseEnter: (evt) => {\n const listItemEl = closestListItem(evt.target);\n const [menuId, itemId, isGroup, isOpen, level] =\n identifyItem(listItemEl);\n const sameLevel = prevLevel.current === level;\n const {\n current: { [menuId]: state },\n } = menuState;\n prevLevel.current = level;\n\n // console.log(\n // `%conMouseEnter #${menuId}[${itemId}] @${level}\n // isGroup ${isGroup} isOpen ${isOpen}\n // openMenus [${openMenus.current.join(',')}]\n // state='${JSON.stringify(menuState.current)}`,\n // 'color: green; font-weight: bold;'\n // );\n\n if (state === \"no-popup\" && isGroup) {\n // Shouldn;t we always set this ?\n menuState.current[menuId] = \"popup-pending\";\n scheduleOpen(menuId, itemId, listItemEl);\n } else if (state === \"popup-pending\" && !isGroup) {\n menuState.current[menuId] = \"no-popup\";\n clearTimeout(menuOpenPendingTimeout.current);\n menuOpenPendingTimeout.current = null;\n } else if (state === \"popup-pending\" && isGroup) {\n clearTimeout(menuOpenPendingTimeout.current);\n scheduleOpen(menuId, itemId, listItemEl);\n } else if (state === \"popup-open\") {\n const [{ id: parentMenuId }, { id: openMenuId }] =\n openMenus.current.slice(-2);\n if (\n parentMenuId === menuId &&\n menuState.current[openMenuId] !== \"pending-close\" &&\n sameLevel\n ) {\n scheduleClose(openMenuId, menuId, itemId);\n if (isGroup && !isOpen) {\n scheduleOpen(menuId, itemId, listItemEl);\n }\n } else if (\n parentMenuId === menuId &&\n isGroup &&\n itemId !== openMenuId &&\n menuState.current[openMenuId] === \"pending-close\"\n ) {\n // if there is already an item queued for opening cancel it\n scheduleOpen(menuId, itemId, listItemEl);\n } else if (isGroup) {\n closeMenus(menuId, itemId);\n scheduleOpen(menuId, itemId, listItemEl);\n } else if (\n !(menuState.current[openMenuId] === \"pending-close\" && sameLevel)\n ) {\n closeMenus(menuId, itemId);\n }\n }\n\n if (state === \"pending-close\") {\n if (menuOpenPendingTimeout.current) {\n clearTimeout(menuOpenPendingTimeout.current);\n menuOpenPendingTimeout.current = null;\n }\n clearTimeout(menuClosePendingTimeout.current);\n menuClosePendingTimeout.current = null;\n menuState.current[menuId] = \"popup-open\";\n }\n\n onMouseEnterItem(evt, itemId);\n },\n\n onClick: (evt) => {\n const listItemEl = closestListItem(evt.target);\n const idx = listItemIndex(listItemEl);\n if (closedNode(listItemEl).ariaHasPopup === \"true\") {\n if (listItemEl.ariaExpanded !== \"true\") {\n openMenu(idx);\n } else {\n // do nothing\n }\n } else {\n onActivate(getItemId(listItemEl.id));\n }\n },\n }),\n [\n closeMenus,\n onActivate,\n onMouseEnterItem,\n openMenu,\n scheduleClose,\n scheduleOpen,\n ]\n );\n\n return {\n closeMenu,\n handleRender,\n listItemProps,\n openMenu,\n openMenus: openMenus.current,\n };\n};\n", "export const listItemElement = (listEl, listItemIdx) =>\n listEl.querySelector(`:scope > [data-idx=\"${listItemIdx}\"]`);\n\nexport function listItemIndex(listItemEl) {\n if (listItemEl) {\n let idx = listItemEl.dataset.idx;\n if (idx) {\n return parseInt(idx, 10);\n // eslint-disable-next-line no-cond-assign\n } else if ((idx = listItemEl.ariaPosInSet)) {\n return parseInt(idx, 10) - 1;\n }\n }\n}\n\nexport const listItemId = (el) => el?.id;\n\nexport const closestListItem = (el) => el.closest('[data-idx],[aria-posinset]');\n\nexport const closestListItemId = (el) => listItemId(closestListItem(el));\n\nexport const closestListItemIndex = (el) => listItemIndex(closestListItem(el));\n", "import React, { useCallback, useMemo } from \"react\";\nimport { MenuItemGroup, Separator } from \"./MenuList\";\n\nexport const isMenuItemGroup = (child) =>\n child.type === MenuItemGroup || !!child.props[\"data-group\"];\n\nexport const useItemsWithIds = (sourceProp, childrenProp) => {\n const normalizeChildren = useCallback(() => {\n if (childrenProp === undefined) {\n return;\n }\n\n const collectChildren = (\n children,\n path = \"root\",\n menus = {},\n actions = {}\n ) => {\n const list = (menus[path] = []);\n let idx = 0;\n let hasSeparator = false;\n\n React.Children.forEach(children, (child) => {\n if (child.type === Separator) {\n hasSeparator = true;\n } else {\n const group = isMenuItemGroup(child);\n const childPath = path === \"root\" ? `${idx}` : `${path}.${idx}`;\n const {\n props: { action, options },\n } = child;\n const [childWithId, grandChildren] = assignId(\n child,\n childPath,\n group,\n hasSeparator\n );\n list.push(childWithId);\n if (grandChildren) {\n collectChildren(grandChildren, childPath, menus, actions);\n } else {\n actions[childPath] = { action, options };\n }\n idx += 1;\n hasSeparator = false;\n }\n });\n return [menus, actions];\n };\n\n const assignId = (child, path, group, hasSeparator = false) => {\n const {\n props: { children },\n } = child;\n return [\n React.cloneElement(child, {\n hasSeparator,\n id: `${path}`,\n key: path,\n children: group ? undefined : children,\n }),\n group ? children : undefined,\n ];\n };\n\n return collectChildren(childrenProp);\n }, [childrenProp]);\n\n const [children, actions] = useMemo(\n () => normalizeChildren(),\n [normalizeChildren]\n );\n\n return [children, actions];\n};\n", "import React, { useLayoutEffect, useMemo, useRef } from \"react\";\nimport cx from \"classnames\";\nimport { useIdMemo as useId } from \"@salt-ds/core\";\nimport { useKeyboardNavigation } from \"./use-keyboard-navigation\";\nimport { isMenuItemGroup } from \"./use-items-with-ids\";\n\nimport \"./MenuList.css\";\n\nconst classBase = \"hwMenuList\";\n\nexport const Separator = () => <li className=\"hwMenuItem-divider\" />;\n\n// Purely used as markers, props will be extracted\nexport const MenuItemGroup = () => null;\n// eslint-disable-next-line no-unused-vars\nexport const MenuItem = ({ children, idx, ...props }) => {\n return <div {...props}>{children}</div>;\n};\n\nconst hasIcon = (child) => child.props[\"data-icon\"];\n\nconst MenuList = ({\n activatedByKeyboard,\n childMenuShowing = -1,\n children,\n highlightedIdx: highlightedIdxProp,\n id: idProp,\n isRoot,\n listItemProps,\n menuId,\n onHighlightMenuItem,\n onActivate,\n onCloseMenu,\n onOpenMenu,\n ...props\n}) => {\n const id = useId(idProp);\n const root = useRef(null);\n\n // The id generation be,ongs in useIttemsWithIds\n const mapIdxToId = useMemo(() => new Map(), []);\n\n const handleOpenMenu = (idx) => {\n const el = root.current.querySelector(`:scope > [data-idx='${idx}']`);\n onOpenMenu(el.id);\n };\n\n const handleActivate = (idx) => {\n const el = root.current.querySelector(`:scope > [data-idx='${idx}']`);\n onActivate(el.id);\n };\n\n const { focusVisible, highlightedIdx, listProps } = useKeyboardNavigation({\n count: children.length,\n highlightedIdx: highlightedIdxProp,\n onActivate: handleActivate,\n onHighlight: onHighlightMenuItem,\n onOpenMenu: handleOpenMenu,\n onCloseMenu,\n id,\n });\n\n const appliedFocusVisible = childMenuShowing == -1 ? focusVisible : -1;\n\n useLayoutEffect(() => {\n if (childMenuShowing === -1 && activatedByKeyboard) {\n root.current.focus();\n }\n }, [activatedByKeyboard, childMenuShowing]);\n\n const getActiveDescendant = () =>\n highlightedIdx === undefined || highlightedIdx === -1\n ? undefined\n : mapIdxToId.get(highlightedIdx);\n\n return (\n <div\n {...props}\n {...listProps}\n aria-activedescendant={getActiveDescendant()}\n className={cx(classBase, {\n [`${classBase}-childMenuShowing`]: childMenuShowing !== -1,\n })}\n data-root={isRoot || undefined}\n id={`${id}-${menuId}`}\n ref={root}\n role=\"menu\"\n tabIndex={0}\n >\n {renderContent()}\n </div>\n );\n\n function renderContent() {\n const propsCommonToAllListItems = {\n ...listItemProps,\n role: \"menuitem\",\n };\n\n const maybeIcon = (children, withIcon) =>\n withIcon\n ? [<span className=\"hwIconContainer\" key=\"icon\" />].concat(children)\n : children;\n\n function addClonedChild(list, child, idx, withIcon) {\n const {\n children,\n className,\n id: itemId,\n hasSeparator,\n label,\n ...props\n } = child.props;\n const hasSubMenu = isMenuItemGroup(child);\n const subMenuShowing = hasSubMenu && childMenuShowing === idx;\n const ariaControls = subMenuShowing ? `${id}-${itemId}` : undefined;\n\n list.push(\n <MenuItem\n {...props}\n {...propsCommonToAllListItems}\n {...getMenuItemProps(\n `${id}-${menuId}`,\n itemId,\n idx,\n child.key,\n highlightedIdx,\n appliedFocusVisible,\n className,\n hasSeparator\n )}\n aria-controls={ariaControls}\n aria-haspopup={hasSubMenu || undefined}\n aria-expanded={subMenuShowing || undefined}\n >\n {hasSubMenu\n ? maybeIcon(label, withIcon)\n : maybeIcon(children, withIcon)}\n </MenuItem>\n );\n // mapIdxToId.set(idx, itemId);\n }\n\n const listItems = [];\n\n if (children && children.length > 0) {\n const withIcon = children.some(hasIcon);\n\n children.forEach((child, idx) => {\n addClonedChild(listItems, child, idx, withIcon);\n });\n }\n\n return listItems;\n }\n};\n\nconst getMenuItemProps = (\n baseId,\n itemId,\n idx,\n key,\n highlightedIdx,\n focusVisible,\n className,\n hasSeparator\n) => ({\n id: `${baseId}-${itemId}`,\n key: key ?? idx,\n \"data-idx\": idx,\n \"data-highlighted\": idx === highlightedIdx || undefined,\n className: cx(\"hwMenuItem\", className, {\n \"hwMenuItem-separator\": hasSeparator,\n focusVisible: focusVisible === idx,\n }),\n});\n\nMenuList.displayName = \"MenuList\";\nexport default MenuList;\n", "import { useCallback, useRef, useState } from \"react\";\nimport { hasPopup, isRoot } from \"./utils\";\nimport { applyHandlers } from \"../utils/apply-handlers\";\nimport { isNavigationKey } from \"./key-code\";\n\n// we need a way to set highlightedIdx when selection changes\nexport const useKeyboardNavigation = (\n {\n autoHighlightFirstItem = false,\n count,\n highlightedIdx: highlightedIdxProp,\n onActivate,\n onHighlight,\n onKeyDown,\n onCloseMenu,\n onOpenMenu,\n },\n ...additionalHandlers\n) => {\n // const prevCount = useRef(count);\n const highlightedIndexRef = useRef(\n highlightedIdxProp ?? autoHighlightFirstItem ? 0 : -1\n );\n const [, forceRefresh] = useState(null);\n const controlledHighlighting = highlightedIdxProp !== undefined;\n\n // count will not work for this, as it will change when we expand collapse groups\n // if (count !== prevCount.current) {\n // prevCount.current = count;\n // if (highlightedIndexRef.current !== -1){\n // highlightedIndexRef.current = autoHighlightFirstItem ? 0 : -1;\n // }\n // }\n\n const setHighlightedIndex = useCallback(\n (idx) => {\n highlightedIndexRef.current = idx;\n onHighlight && onHighlight(idx);\n applyHandlers(additionalHandlers, \"onHighlight\", idx);\n forceRefresh({});\n },\n [additionalHandlers, onHighlight]\n );\n\n // does this belong here or should it be a method passed in?\n const keyBoardNavigation = useRef(true);\n const ignoreFocus = useRef(false);\n const setIgnoreFocus = (value) => (ignoreFocus.current = value);\n\n const hiliteItemAtIndex = useCallback(\n (idx) => {\n if (idx !== highlightedIndexRef.current) {\n if (!controlledHighlighting) {\n setHighlightedIndex(idx);\n }\n }\n },\n [controlledHighlighting, setHighlightedIndex]\n );\n\n const highlightedIdx = controlledHighlighting\n ? highlightedIdxProp\n : highlightedIndexRef.current;\n\n const listProps = {\n onFocus: () => {\n if (highlightedIdx === -1) {\n setHighlightedIndex(0);\n }\n },\n onKeyDown: (e) => {\n if (isNavigationKey(e)) {\n e.preventDefault();\n e.stopPropagation();\n keyBoardNavigation.current = true;\n navigateChildldItems(e);\n } else if (\n (e.key === \"ArrowRight\" || e.key === \"Enter\") &&\n hasPopup(e.target, highlightedIdx)\n ) {\n onOpenMenu(highlightedIdx);\n } else if (e.key === \"ArrowLeft\" && !isRoot(e.target)) {\n onCloseMenu(highlightedIdx);\n } else if (e.key === \"Enter\") {\n onActivate && onActivate(highlightedIdx);\n }\n // Is there any harm in allowing other keyDown Handlers to fire ?\n // TODO this is out of date - use additionalHandlers\n if (Array.isArray(onKeyDown)) {\n for (let handleEvent of onKeyDown) {\n if (e.isPropagationStopped()) {\n break;\n }\n handleEvent(e);\n }\n } else if (onKeyDown && !e.isPropagationStopped()) {\n onKeyDown(e);\n }\n\n applyHandlers(additionalHandlers, \"onKeyDown\", e);\n },\n onMouseDownCapture: () => {\n keyBoardNavigation.current = false;\n setIgnoreFocus(true);\n },\n\n // onMouseEnter would seem less expensive but it misses some cases\n onMouseMove: () => {\n if (keyBoardNavigation.current) {\n keyBoardNavigation.current = false;\n }\n },\n onMouseLeave: () => {\n // label === 'ParsedInput' && console.log(`%c[useKeyboardNavigationHook]<${label}> onMouseLeave`,'color:brown')\n keyBoardNavigation.current = true;\n setIgnoreFocus(false);\n hiliteItemAtIndex(-1);\n },\n };\n\n const navigateChildldItems = (e) => {\n const nextIdx = nextItemIdx(count, e.key, highlightedIndexRef.current);\n if (nextIdx !== highlightedIndexRef.current) {\n hiliteItemAtIndex(nextIdx);\n applyHandlers(additionalHandlers, \"onKeyboardNavigation\", e, nextIdx);\n }\n };\n\n // label === 'ParsedInput' && console.log(`%cuseNavigationHook<${label}>\n // highlightedIdxProp= ${highlightedIdxProp},\n // highlightedIndexRef= ${highlightedIndexRef.current},\n // %chighlightedIdx= ${highlightedIdx}`, 'color: brown','color: brown;font-weight: bold;')\n\n return {\n focusVisible: keyBoardNavigation.current ? highlightedIdx : -1,\n controlledHighlighting,\n highlightedIdx,\n hiliteItemAtIndex,\n keyBoardNavigation,\n listProps,\n setIgnoreFocus,\n };\n};\n\n// need to be able to accommodate disabled items\nfunction nextItemIdx(count, key, idx) {\n if (key === \"Up\") {\n if (idx > 0) {\n return idx - 1;\n } else {\n return idx;\n }\n } else {\n if (idx === null) {\n return 0;\n } else if (idx === count - 1) {\n return idx;\n } else {\n return idx + 1;\n }\n }\n}\n", "export const isRoot = (el) => el.closest(`[data-root='true']`) !== null;\n\nexport const hasPopup = (el, idx) =>\n (el.ariaHasPopup === 'true' && el.dataset?.idx === `${idx}`) ||\n el.querySelector(`:scope > [data-idx='${idx}'][aria-haspopup='true']`) !== null;\n", "export const applyHandlers = (props, evtName, ...params) => {\n const isPropagationStopped = () => params?.[0].isPropagationStopped?.();\n\n if (props.length > 0 && !isPropagationStopped()) {\n const additionalHandlers = props\n .filter((props) => props[evtName])\n .map((props) => props[evtName]);\n for (let handleEvent of additionalHandlers) {\n if (isPropagationStopped()) {\n break;\n }\n handleEvent(...params);\n }\n }\n};\n", "function union(set1, ...sets) {\n const result = new Set(set1);\n for (let set of sets) {\n for (let element of set) {\n result.add(element);\n }\n }\n return result;\n}\n\nexport const ArrowUp = 'ArrowUp';\nexport const ArrowDown = 'ArrowDown';\nexport const ArrowLeft = 'ArrowLeft';\nexport const Backspace = 'Backspace';\nexport const ArrowRight = 'ArrowRight';\nexport const Enter = 'Enter';\nexport const Escape = 'Escape';\nexport const Delete = 'Delete';\n\nconst actionKeys = new Set([Enter, Delete]);\nconst focusKeys = new Set(['Tab']);\n// const navigationKeys = new Set([\"Home\", \"End\", \"ArrowRight\", \"ArrowLeft\",\"ArrowDown\", \"ArrowUp\"]);\nconst arrowLeftRightKeys = new Set(['ArrowRight', 'ArrowLeft']);\nconst verticalNavigationKeys = new Set(['Home', 'End', 'ArrowDown', 'ArrowUp']);\nconst horizontalNavigationKeys = new Set(['Home', 'End', 'ArrowRight', 'ArrowLeft']);\nconst functionKeys = new Set([\n 'F1',\n 'F2',\n 'F3',\n 'F4',\n 'F5',\n 'F6',\n 'F7',\n 'F8',\n 'F9',\n 'F10',\n 'F11',\n 'F12'\n]);\nconst specialKeys = union(\n actionKeys,\n horizontalNavigationKeys,\n verticalNavigationKeys,\n arrowLeftRightKeys,\n functionKeys,\n focusKeys\n);\nexport const isCharacterKey = (evt) => {\n if (specialKeys.has(evt.key)) {\n return false;\n }\n if (typeof evt.which === 'number' && evt.which > 0) {\n return !evt.ctrlKey && !evt.metaKey && !evt.altKey && evt.which !== 8;\n }\n};\n\nexport const isNavigationKey = ({ key }, orientation = 'vertical') => {\n const navigationKeys =\n orientation === 'vertical' ? verticalNavigationKeys : horizontalNavigationKeys;\n return navigationKeys.has(key);\n};\n", "import { useEffect } from 'react';\n\nexport const useClickAway = ({ containerClassName, isOpen, onClose }) => {\n useEffect(() => {\n const clickHandler = isOpen\n ? (evt) => {\n const container = evt.target.closest(`.${containerClassName}`);\n if (container === null) {\n onClose('root');\n }\n }\n : null;\n\n document.body.addEventListener('click', clickHandler, true);\n\n return () => {\n if (clickHandler) {\n document.body.removeEventListener('click', clickHandler, true);\n }\n };\n }, [containerClassName, isOpen, onClose]);\n};\n", "import React, { useCallback, useContext, useMemo } from 'react';\nimport { PopupService } from '../popup';\nimport ContextMenu from './ContextMenu';\nimport { MenuItem, MenuItemGroup } from './MenuList';\n\nconst showContextMenu = (e, menuDescriptors, handleContextMenuAction) => {\n const { clientX: left, clientY: top } = e;\n const menuItems = (menuDescriptors) => {\n const fromDescriptor = ({ children, label, icon, action, options }, i) =>\n children ? (\n <MenuItemGroup key={i} label={label}>\n {children.map(fromDescriptor)}\n </MenuItemGroup>\n ) : (\n <MenuItem key={i} action={action} data-icon={icon} options={options}>\n {label}\n </MenuItem>\n );\n\n return menuDescriptors.map(fromDescriptor);\n };\n\n const handleClose = (menuId, options) => {\n if (menuId) {\n handleContextMenuAction(menuId, options);\n PopupService.hidePopup();\n }\n };\n\n const component = (\n <ContextMenu onClose={handleClose} position={{ x: left, y: top }}>\n {menuItems(menuDescriptors)}\n </ContextMenu>\n );\n PopupService.showPopup({ left: 0, top: 0, component });\n};\n\nexport const ContextMenuContext = React.createContext(null);\n\nconst NO_INHERITED_CONTEXT = {\n menuItemDescriptors: []\n};\n\n// The menuBuilder will always be supplied by the code that will display the local\n// context menu. It will be passed all configured menu descriptors. It is free to\n// augment, replace or ignore the existing menu descriptors.\nexport const useContextMenu = () => {\n const { menuActionHandler, menuBuilders } = useContext(ContextMenuContext);\n\n const buildMenuOptions = useCallback((menuBuilders, location, options) => {\n let results = [];\n for (const menuBuilder of menuBuilders) {\n // Maybe we should leave the concatenation to the menuBuilder, then it can control menuItem order\n results = results.concat(menuBuilder(location, options));\n }\n return results;\n }, []);\n\n const handleShowContextMenu = (e, location, options) => {\n e.stopPropagation();\n e.preventDefault();\n const menuItemDescriptors = buildMenuOptions(menuBuilders, location, options);\n if (menuItemDescriptors.length) {\n showContextMenu(e, menuItemDescriptors, menuActionHandler);\n }\n };\n\n return handleShowContextMenu;\n};\n\nconst Provider = ({\n children,\n context: { menuBuilders: inheritedMenuBuilders, menuActionHandler: inheritedMenuActionHandler },\n menuActionHandler,\n menuBuilder\n}) => {\n const menuBuilders = useMemo(() => {\n if (inheritedMenuBuilders && menuBuilder) {\n return inheritedMenuBuilders.concat(menuBuilder);\n } else if (menuBuilder) {\n return [menuBuilder];\n } else {\n return inheritedMenuBuilders || [];\n }\n }, [inheritedMenuBuilders, menuBuilder]);\n\n const handleMenuAction = useCallback(\n (type, options) => {\n if (menuActionHandler && menuActionHandler(type, options)) {\n return true;\n }\n\n if (inheritedMenuActionHandler && inheritedMenuActionHandler(type, options)) {\n return true;\n }\n },\n [inheritedMenuActionHandler, menuActionHandler]\n );\n\n return (\n <ContextMenuContext.Provider\n value={{\n menuActionHandler: handleMenuAction,\n menuBuilders\n }}\n >\n {children}\n </ContextMenuContext.Provider>\n );\n};\n\n// Need an option for local menu to override higher-level menu, rather than extend\nexport const ContextMenuProvider = ({\n children,\n menuActionHandler,\n menuBuilder,\n menuItemDescriptors,\n label\n}) => {\n return (\n <ContextMenuContext.Consumer>\n {(parentContext) => (\n <Provider\n context={parentContext || NO_INHERITED_CONTEXT}\n label={label}\n menuActionHandler={menuActionHandler}\n menuBuilder={menuBuilder}\n menuItemDescriptors={menuItemDescriptors}\n >\n {children}\n </Provider>\n )}\n </ContextMenuContext.Consumer>\n );\n};\n", "import classnames from 'classnames';\nimport React, { useRef } from 'react';\nimport { registerComponent } from './registry/ComponentRegistry';\n\nimport './DraggableLayout.css';\n\n// We need to add props to restrict drag behaviour to, for example, popups only\nexport const DraggableLayout = function DraggableLayout(props) {\n // We shouldn't need this but somewhere the customDispatcher/handleDragStart callback is not\n // being updated and preserves stale ref to props.children, so DragDrop from within a nested\n // LatoutContext (Stack or DraggableLayout) fails.\n const sourceRef = useRef();\n sourceRef.current = props;\n\n const { className: classNameProp, id, style } = props;\n\n const className = classnames('DraggableLayout', classNameProp);\n return (\n <div className={className} id={id} style={style}>\n {props.children}\n </div>\n );\n};\n\nconst componentName = 'DraggableLayout';\n\nDraggableLayout.displayName = componentName;\n\nregisterComponent(componentName, DraggableLayout, 'container');\n", "import { List, ListItem, ListItemProps } from \"@heswell/salt-lab\";\nimport { uuid } from \"@vuu-ui/vuu-utils\";\nimport cx from \"classnames\";\nimport {\n cloneElement,\n HTMLAttributes,\n memo,\n MouseEvent,\n ReactElement,\n} from \"react\";\nimport { useLayoutProviderDispatch } from \"../layout-provider\";\nimport { View } from \"../layout-view\";\nimport { registerComponent } from \"../registry/ComponentRegistry\";\n\nimport \"./Palette.css\";\n\nconst clonePaletteItem = (paletteItem: HTMLElement) => {\n const dolly = paletteItem.cloneNode(true) as HTMLElement;\n dolly.id = \"\";\n delete dolly.dataset.idx;\n return dolly;\n};\n\nexport interface PaletteItemProps extends ListItemProps {\n children: ReactElement;\n closeable?: boolean;\n header?: boolean;\n idx?: number;\n resize?: \"defer\";\n resizeable?: boolean;\n}\n\nexport const PaletteItem = memo(\n ({\n className,\n children: component,\n idx,\n resizeable,\n header,\n closeable,\n ...props\n }: PaletteItemProps) => {\n return (\n <ListItem\n className={cx(\"vuuPaletteItem\", className)}\n data-icon=\"grab-handle\"\n {...props}\n />\n );\n }\n);\n\nPaletteItem.displayName = \"PaletteItem\";\n\nexport interface PaletteProps\n extends Omit<HTMLAttributes<HTMLDivElement>, \"onSelect\"> {\n children: ReactElement[];\n orientation: \"horizontal\" | \"vertical\";\n selection?: string;\n}\n\nexport const Palette = ({\n children,\n className,\n orientation = \"horizontal\",\n ...props\n}: PaletteProps) => {\n const dispatch = useLayoutProviderDispatch();\n const classBase = \"vuuPalette\";\n\n function handleMouseDown(evt: MouseEvent) {\n const target = evt.target as HTMLElement;\n const listItemElement = target.closest(\".vuuPaletteItem\") as HTMLElement;\n const idx = parseInt(listItemElement.dataset.idx ?? \"-1\");\n if (idx !== -1) {\n console.log({\n children,\n idx,\n listItemElement,\n });\n }\n const {\n props: { caption, children: payload, template, ...props },\n } = children[idx];\n const { height, left, top, width } =\n listItemElement.getBoundingClientRect();\n const id = uuid();\n const identifiers = { id, key: id };\n const component = template ? (\n payload\n ) : (\n <View {...identifiers} {...props} title={props.label}>\n {payload}\n </View>\n );\n\n dispatch({\n dragRect: {\n left,\n top,\n right: left + width,\n bottom: top + 150,\n width,\n height,\n },\n dragElement: clonePaletteItem(listItemElement),\n evt: evt.nativeEvent,\n instructions: {\n DoNotRemove: true,\n DoNotTransform: true,\n RemoveDraggableOnDragEnd: true,\n dragThreshold: 10,\n },\n path: \"*\",\n payload: component,\n type: \"drag-start\",\n });\n }\n\n return (\n <List\n {...props}\n borderless\n className={cx(classBase, className, `${classBase}-${orientation}`)}\n maxHeight={800}\n selected={null}\n >\n {children.map((child, idx) =>\n child.type === PaletteItem\n ? cloneElement(child, {\n key: idx,\n onMouseDown: handleMouseDown,\n })\n : child\n )}\n </List>\n );\n};\n\nregisterComponent(\"Palette\", Palette, \"view\");\n", "import { List, ListItem, ListItemProps, ListProps } from \"@heswell/salt-lab\";\nimport { uuid } from \"@vuu-ui/vuu-utils\";\nimport cx from \"classnames\";\nimport { MouseEvent, ReactElement } from \"react\";\nimport { useLayoutProviderDispatch } from \"../layout-provider\";\nimport { View } from \"../layout-view\";\nimport { registerComponent } from \"../registry/ComponentRegistry\";\n\nimport \"./PaletteSalt.css\";\n\nconst classBase = \"vuuPalette\";\n\nexport interface PaletteListItemProps extends ListItemProps {\n children: ReactElement;\n ViewProps: {\n header?: boolean;\n closeable?: boolean;\n resizeable?: boolean;\n };\n template: boolean;\n}\n\nexport const PaletteListItem = (props: PaletteListItemProps) => {\n const { children, ViewProps, label, onMouseDown, template, ...restProps } =\n props;\n const dispatch = useLayoutProviderDispatch();\n\n const handleMouseDown = (evt: MouseEvent<HTMLDivElement>) => {\n const { left, top, width } = evt.currentTarget.getBoundingClientRect();\n const id = uuid();\n const identifiers = { id, key: id };\n const component = template ? (\n children\n ) : (\n <View {...identifiers} {...ViewProps} title={props.label}>\n {children}\n </View>\n );\n\n dispatch({\n type: \"drag-start\",\n evt: evt.nativeEvent,\n path: \"*\",\n payload: component,\n instructions: {\n DoNotRemove: true,\n DoNotTransform: true,\n RemoveDraggableOnDragEnd: true,\n dragThreshold: 10,\n },\n dragRect: {\n left,\n top,\n right: left + width,\n bottom: top + 150,\n width,\n height: 100,\n },\n });\n };\n return (\n <ListItem onMouseDown={handleMouseDown} {...restProps}>\n {label}\n </ListItem>\n );\n};\n\nexport const PaletteSalt = ({ className, ...props }: ListProps) => {\n return (\n <List\n {...props}\n className={cx(classBase, className)}\n height=\"100%\"\n selectionStrategy=\"none\"\n />\n );\n};\n\nregisterComponent(\"PaletteSalt\", PaletteSalt, \"view\");\n", "import { useIdMemo as useId } from \"@salt-ds/core\";\nimport cx from \"classnames\";\nimport { Tab, Tabstrip, Toolbar, ToolbarField } from \"@heswell/salt-lab\";\nimport React, {\n ForwardedRef,\n forwardRef,\n MouseEvent,\n ReactElement,\n ReactNode,\n useCallback,\n} from \"react\";\nimport { StackProps } from \"./stackTypes\";\n\nimport \"./Stack.css\";\n\nconst classBase = \"Tabs\";\n\nconst getDefaultTabLabel = (component: ReactElement, tabIndex: number) =>\n component.props?.title ?? `Tab ${tabIndex + 1}`;\n\nconst getChildElements = <T extends ReactElement = ReactElement>(\n children: ReactNode\n): T[] => {\n const elements: T[] = [];\n React.Children.forEach(children, (child) => {\n if (React.isValidElement(child)) {\n elements.push(child as T);\n } else {\n console.warn(`Stack has unexpected child element type`);\n }\n });\n return elements;\n};\n\nexport const Stack = forwardRef(function Stack(\n {\n active = 0,\n children,\n className: classNameProp,\n enableAddTab,\n enableCloseTabs,\n getTabLabel = getDefaultTabLabel,\n id: idProp,\n keyBoardActivation = \"manual\",\n onMouseDown,\n onTabAdd,\n onTabClose,\n onTabEdit,\n onTabSelectionChanged,\n showTabs,\n style,\n TabstripProps,\n }: StackProps,\n ref: ForwardedRef<HTMLDivElement>\n) {\n const id = useId(idProp);\n\n const handleTabSelection = (nextIdx: number) => {\n // if uncontrolled, handle it internally\n onTabSelectionChanged?.(nextIdx);\n };\n\n const handleTabClose = (tabIndex: number) => {\n // if uncontrolled, handle it internally\n onTabClose?.(tabIndex);\n };\n\n const handleAddTab = () => {\n // if uncontrolled, handle it internally\n onTabAdd?.(React.Children.count(children));\n };\n\n const handleMouseDown = (e: MouseEvent<HTMLDivElement>) => {\n // if uncontrolled, handle it internally\n const target = e.target as HTMLElement;\n const tabElement = target.closest('[role^=\"tab\"]') as HTMLDivElement;\n const role = tabElement?.getAttribute(\"role\");\n if (role === \"tab\") {\n const tabIndex = parseInt(tabElement.dataset.idx ?? \"-1\");\n if (tabIndex !== -1) {\n onMouseDown?.(e, tabIndex);\n } else {\n throw Error(\"Stack: mousedown on tab with unknown index\");\n }\n } else if (role === \"tablist\") {\n console.log(`Stack mousedown on tabstrip`);\n }\n };\n\n const handleExitEditMode = useCallback(\n (\n _oldText: string,\n newText: string,\n _allowDeactivation: boolean,\n tabIndex: number\n ) => {\n onTabEdit?.(tabIndex, newText);\n },\n [onTabEdit]\n );\n\n const activeChild = () => {\n if (React.isValidElement(children)) {\n return children;\n } else if (Array.isArray(children)) {\n return children[active] ?? null;\n } else {\n return null;\n }\n };\n\n const renderTabs = () =>\n getChildElements(children).map((child, idx) => {\n const rootId = `${id}-${idx}`;\n const { closeable, id: childId } = child.props;\n return (\n <Tab\n ariaControls={`${rootId}-tab`}\n draggable\n key={childId ?? idx} // Important that we key by child identifier, not using index\n id={rootId}\n label={getTabLabel(child, idx)}\n closeable={closeable}\n editable={true}\n // onEdit={handleTabEdit}\n />\n );\n });\n\n const child = activeChild();\n\n return (\n <div\n className={cx(classBase, classNameProp)}\n style={style}\n id={id}\n ref={ref}\n >\n {showTabs ? (\n <Toolbar\n className=\"vuuTabHeader vuuHeader\"\n // onMouseDown={handleMouseDown}\n >\n <ToolbarField\n disableFocusRing\n data-collapsible=\"dynamic\"\n data-priority=\"3\"\n style={{ alignSelf: \"flex-end\" }}\n >\n <Tabstrip\n {...TabstripProps}\n enableRenameTab\n enableAddTab={enableAddTab}\n enableCloseTab={enableCloseTabs}\n keyBoardActivation={keyBoardActivation}\n onActiveChange={handleTabSelection}\n onAddTab={handleAddTab}\n onCloseTab={handleTabClose}\n onExitEditMode={handleExitEditMode}\n onMouseDown={handleMouseDown}\n activeTabIndex={active || (child === null ? -1 : 0)}\n >\n {renderTabs()}\n </Tabstrip>\n </ToolbarField>\n </Toolbar>\n ) : null}\n {child}\n </div>\n );\n});\nStack.displayName = \"Stack\";\n", "import { useIdMemo as useId } from \"@salt-ds/core\";\nimport React, { ReactElement, useRef } from \"react\";\nimport { Stack } from \"./Stack\";\n// import { Tooltray } from \"../toolbar\";\n// import { CloseButton, MinimizeButton, MaximizeButton } from \"../action-buttons\";\nimport Component from \"../Component\";\nimport { useLayoutProviderDispatch } from \"../layout-provider\";\nimport { useViewActionDispatcher, View } from \"../layout-view\";\nimport { registerComponent } from \"../registry/ComponentRegistry\";\nimport { usePersistentState } from \"../use-persistent-state\";\nimport { StackProps } from \"./stackTypes\";\n\nimport \"./Stack.css\";\n\nconst defaultCreateNewChild = (index: number) => (\n // Note make this width 100% and height 100% and we get a weird error where view continually resizes - growing\n <View\n resizeable\n title={`Tab ${index}`}\n style={{ flexGrow: 1, flexShrink: 0, flexBasis: 0 }}\n header\n closeable\n >\n <Component style={{ flex: 1 }} />\n </View>\n);\n\nexport const StackLayout = (props: StackProps) => {\n const ref = useRef<HTMLDivElement>(null);\n const dispatch = useLayoutProviderDispatch();\n const { loadState, saveState } = usePersistentState();\n\n const {\n createNewChild = defaultCreateNewChild,\n id: idProp,\n onTabSelectionChanged,\n path,\n ...restProps\n } = props;\n\n const { children } = props;\n\n const id = useId(idProp);\n\n const [dispatchViewAction] = useViewActionDispatcher(id, ref, path);\n\n const handleTabSelection = (nextIdx: number) => {\n console.log(`StackLayout handleTabSelection nextTab = ${nextIdx}`);\n if (path) {\n dispatch({ type: \"switch-tab\", path, nextIdx });\n onTabSelectionChanged?.(nextIdx);\n }\n };\n\n const handleTabClose = (tabIndex: number) => {\n if (Array.isArray(children)) {\n const {\n props: { \"data-path\": dataPath, path = dataPath },\n } = children[tabIndex];\n dispatch({ type: \"remove\", path });\n }\n };\n\n const handleTabAdd = (e: any, tabIndex = React.Children.count(children)) => {\n if (path) {\n console.log(`[StackLayout] handleTabAdd`);\n const component = createNewChild(tabIndex);\n console.log({ component });\n dispatch({\n type: \"add\",\n path,\n component,\n });\n }\n };\n\n const handleMouseDown = async (e: any, index: number) => {\n // If user drags the selected Tab, we need to select another Tab and re-render.\n // This needs to be co-ordinated with drag Tab within Tabstrip, whcih can\n // be handles within The Tabstrip until final release - much like Splitter\n // dragging in Flexbox.\n let readyToDrag: undefined | ((value: unknown) => void);\n\n // Experimental\n const preDragActivity = async () =>\n new Promise((resolve) => {\n console.log(\"preDragActivity: Ok, gonna release the drag\");\n readyToDrag = resolve;\n });\n\n const dragging = await dispatchViewAction(\n { type: \"mousedown\", index, preDragActivity },\n e\n );\n\n if (dragging) {\n readyToDrag?.(undefined);\n }\n };\n\n const handleTabEdit = (tabIndex: number, text: string) => {\n // Save into state on behalf of the associated View\n // Do we need a mechanism to get this into the JSPOMN when we serialize ?\n // const { id } = children[tabIndex].props;\n // saveState(id, 'view-title', text);\n dispatch({ type: \"set-title\", path: `${path}.${tabIndex}`, title: text });\n };\n\n const getTabLabel = (component: ReactElement, idx: number) => {\n const { id, title } = component.props;\n return loadState(id, \"view-title\") || title || `Tab ${idx + 1}`;\n };\n\n return (\n <Stack\n {...restProps}\n id={id}\n getTabLabel={getTabLabel}\n onMouseDown={handleMouseDown}\n onTabAdd={handleTabAdd}\n onTabClose={handleTabClose}\n onTabEdit={handleTabEdit}\n onTabSelectionChanged={handleTabSelection}\n ref={ref}\n // toolbarContent={\n // <Tooltray data-align=\"right\" className=\"layout-buttons\">\n // <MinimizeButton />\n // <MaximizeButton />\n // <CloseButton />\n // </Tooltray>\n // }\n />\n );\n};\nStackLayout.displayName = \"Stack\";\n\nregisterComponent(\"Stack\", StackLayout, \"container\");\n", "import React, { useState } from 'react';\n\nimport { LayoutConfigurator, LayoutTreeViewer } from '..';\nimport { followPathToComponent } from '../..';\n\nexport const ConfigWrapper = ({ children }) => {\n const designMode = false;\n // const [designMode, setDesignMode] = useState(false);\n const [layout, setLayout] = useState(children);\n const [selectedComponent, setSelectedComponent] = useState(children);\n\n const handleSelection = (selectedPath) => {\n const targetComponent = followPathToComponent(layout, selectedPath);\n setSelectedComponent(targetComponent);\n };\n\n const handleChange = (property, value) => {\n console.log(`change ${property} -> ${value}`);\n\n // 2) replace selectedComponent and set layout\n const newComponent = React.cloneElement(selectedComponent, {\n style: {\n ...selectedComponent.props.style,\n [property]: value\n }\n });\n setSelectedComponent(newComponent);\n setLayout(React.cloneElement(layout, null, newComponent));\n };\n\n return (\n <div data-design-mode={`${designMode}`}>\n {layout}\n <br />\n <div style={{ display: 'flex' }}>\n <LayoutConfigurator\n height={300}\n managedStyle={selectedComponent.props.style}\n width={300}\n onChange={handleChange}\n />\n <LayoutTreeViewer\n layout={layout}\n onSelect={handleSelection}\n style={{ width: 300, height: 300, backgroundColor: '#ccc' }}\n />\n </div>\n {/* <StateButton\n defaultChecked={false}\n onChange={(e, value) => setDesignMode(value)}>Design Mode</StateButton> */}\n </div>\n );\n};\n", "import \"./layout-configurator.css\";\nimport { FormField, Input } from \"@heswell/salt-lab\";\n\nconst NO_STYLE = {};\n\nconst DIMENSIONS = {\n margin: {\n top: \"marginTop\",\n right: \"marginRight\",\n bottom: \"marginBottom\",\n left: \"marginLeft\",\n },\n border: {\n top: \"borderTopWidth\",\n right: \"borderRightWidth\",\n bottom: \"borderBottomWidth\",\n left: \"borderLeftWidth\",\n },\n padding: {\n top: \"paddingTop\",\n right: \"paddingRight\",\n bottom: \"paddingBottom\",\n left: \"paddingLeft\",\n },\n};\n\nconst LayoutBox = ({ feature, children, style, onChange }) => {\n return (\n <div className={`LayoutBox layout-${feature} layout-outer`}>\n <div className={`layout-top`}>\n <span className=\"layout-title\">{feature}</span>\n <FormField className=\"layout-input\" style={{ width: 30 }}>\n <Input\n value={style.top}\n onChange={(evt, value) => onChange(feature, \"top\", value)}\n />\n </FormField>\n </div>\n <div className={`layout-inner`}>\n <div className={`layout-left`}>\n <FormField className=\"layout-input\" style={{ width: 30 }}>\n <Input\n value={style.left}\n onChange={(evt, value) => onChange(feature, \"left\", value)}\n />\n </FormField>\n </div>\n {children}\n <div className={`layout-right`}>\n <FormField className=\"layout-input\" style={{ width: 30 }}>\n <Input\n value={style.right}\n onChange={(evt, value) => onChange(feature, \"right\", value)}\n />\n </FormField>\n </div>\n </div>\n <div className={`layout-bottom`}>\n <FormField className=\"layout-input\" style={{ width: 30 }}>\n <Input\n value={style.bottom}\n onChange={(evt, value) => onChange(feature, \"bottom\", value)}\n />\n </FormField>\n </div>\n </div>\n );\n};\n\nexport const MARGIN_STYLES = {\n margin: true,\n marginTop: true,\n marginRight: true,\n marginBottom: true,\n marginLeft: true,\n};\n\nexport const PADDING_STYLES = {\n padding: true,\n paddingTop: true,\n paddingRight: true,\n paddingBottom: true,\n paddingLeft: true,\n};\n\nexport const BORDER_STYLES = {\n border: true,\n borderColor: true,\n borderWidth: true,\n borderTopWidth: true,\n borderRightWidth: true,\n borderBottomWidth: true,\n borderLeftWidth: true,\n};\n\nconst CSS_DIGIT = \"(\\\\d+)(?:px)?\";\nconst CSS_MEASURE = `^(?:${CSS_DIGIT}(?:\\\\s${CSS_DIGIT}(?:\\\\s${CSS_DIGIT}(?:\\\\s${CSS_DIGIT})?)?)?)$`;\nconst CSS_REX = new RegExp(CSS_MEASURE);\nconst BORDER_REX = /^(?:(\\d+)(?:px)\\ssolid\\s([a-zA-Z,0-9().]+))$/;\n\nexport const LayoutConfigurator = ({\n height,\n managedStyle,\n onChange,\n style,\n width,\n}) => {\n const state = normalizeStyle(managedStyle);\n\n const handleChange = (feature, dimension, strValue) => {\n const value = parseInt(strValue || \"0\", 10);\n const property = DIMENSIONS[feature][dimension];\n onChange(property, value);\n };\n\n const {\n marginTop: mt = 0,\n marginRight: mr = 0,\n marginBottom: mb = 0,\n marginLeft: ml = 0,\n } = state;\n const {\n borderTopWidth: bt = 0,\n borderRightWidth: br = 0,\n borderBottomWidth: bb = 0,\n borderLeftWidth: bl = 0,\n } = state;\n const {\n paddingTop: pt = 0,\n paddingRight: pr = 0,\n paddingBottom: pb = 0,\n paddingLeft: pl = 0,\n } = state;\n return (\n <div className=\"LayoutConfigurator\" style={{ width, height, ...style }}>\n <LayoutBox\n feature=\"margin\"\n style={{ top: mt, right: mr, bottom: mb, left: ml }}\n onChange={handleChange}\n >\n <LayoutBox\n feature=\"border\"\n style={{ top: bt, right: br, bottom: bb, left: bl }}\n onChange={handleChange}\n >\n <LayoutBox\n feature=\"padding\"\n style={{ top: pt, right: pr, bottom: pb, left: pl }}\n onChange={handleChange}\n >\n <div className=\"layout-content\" />\n </LayoutBox>\n </LayoutBox>\n </LayoutBox>\n </div>\n );\n};\n\n// TODO merge the following two functions\nexport function XXXnormalizeStyles(\n layoutStyle = NO_STYLE,\n visualStyle = NO_STYLE\n) {\n const {\n margin,\n marginTop,\n marginRight,\n marginBottom,\n marginLeft,\n padding,\n paddingTop,\n paddingRight,\n paddingBottom,\n paddingLeft,\n ...style\n } = layoutStyle;\n\n if (typeof margin === \"number\") {\n style.marginTop =\n style.marginRight =\n style.marginBottom =\n style.marginLeft =\n margin;\n } else if (typeof margin === \"string\") {\n const match = CSS_REX.exec(margin);\n if (match === null) {\n console.error(`Invalid css value for margin '${margin}'`);\n } else {\n const [, pos1, pos2, pos3, pos4] = match;\n const pos123 = pos1 && pos2 && pos3;\n if (pos123 && pos4) {\n style.marginTop = parseInt(pos1, 10);\n style.marginRight = parseInt(pos2, 10);\n style.marginBottom = parseInt(pos3, 10);\n style.marginLeft = parseInt(pos4, 10);\n } else if (pos123) {\n style.marginTop = parseInt(pos1, 10);\n style.marginRight = style.marginLeft = parseInt(pos2, 10);\n style.marginBottom = parseInt(pos3, 10);\n } else if (pos1 && pos2) {\n style.marginTop = style.marginBottom = parseInt(pos1, 10);\n style.marginRight = style.marginLeft = parseInt(pos2, 10);\n } else {\n style.marginTop =\n style.marginRight =\n style.marginBottom =\n style.marginLeft =\n parseInt(pos1, 10);\n }\n }\n }\n if (typeof marginTop === \"number\") style.marginTop = marginTop;\n if (typeof marginRight === \"number\") style.marginRight = marginRight;\n if (typeof marginBottom === \"number\") style.marginBottom = marginBottom;\n if (typeof marginLeft === \"number\") style.marginLeft = marginLeft;\n\n if (typeof padding === \"number\") {\n style.paddingTop =\n style.paddingRight =\n style.paddingBottom =\n style.paddingLeft =\n padding;\n } else if (typeof padding === \"string\") {\n const match = CSS_REX.exec(padding);\n if (match === null) {\n console.error(`Invalid css value for padding '${padding}'`);\n } else {\n const [, pos1, pos2, pos3, pos4] = match;\n const pos123 = pos1 && pos2 && pos3;\n if (pos123 && pos4) {\n style.paddingTop = parseInt(pos1, 10);\n style.paddingRight = parseInt(pos2, 10);\n style.paddingBottom = parseInt(pos3, 10);\n style.paddingLeft = parseInt(pos4, 10);\n } else if (pos123) {\n style.paddingTop = parseInt(pos1, 10);\n style.paddingRight = style.paddingLeft = parseInt(pos2, 10);\n style.paddingBottom = parseInt(pos3, 10);\n } else if (pos1 && pos2) {\n style.paddingTop = style.paddingBottom = parseInt(pos1, 10);\n style.paddingRight = style.paddingLeft = parseInt(pos2, 10);\n } else {\n style.paddingTop =\n style.paddingRight =\n style.paddingBottom =\n style.paddinggLeft =\n parseInt(pos1, 10);\n }\n }\n }\n if (typeof paddingTop === \"number\") style.paddingTop = paddingTop;\n if (typeof paddingRight === \"number\") style.paddingRight = paddingRight;\n if (typeof paddingBottom === \"number\") style.paddingBottom = paddingBottom;\n if (typeof paddingLeft === \"number\") style.paddingLeft = paddingLeft;\n\n return normalizeStyle(style, visualStyle);\n}\n\nfunction normalizeStyle(managedStyle = NO_STYLE) {\n const style = { ...managedStyle };\n\n // if (BORDER_LIST.some(bs => style[bs])) {\n let match;\n\n let {\n border,\n borderWidth,\n borderTopWidth,\n borderRightWidth,\n borderBottomWidth,\n borderLeftWidth,\n borderColor,\n margin,\n marginTop,\n marginRight,\n marginBottom,\n marginLeft,\n padding,\n paddingTop,\n paddingRight,\n paddingBottom,\n paddingLeft,\n ...rest\n } = style;\n\n let marginStyles = {};\n let paddingStyles = {};\n\n if (typeof margin === \"number\") {\n style.marginTop =\n style.marginRight =\n style.marginBottom =\n style.marginLeft =\n margin;\n marginStyles = {\n marginTop: margin,\n marginRight: margin,\n marginBottom: margin,\n marginLeft: margin,\n };\n }\n\n if (typeof padding === \"number\") {\n style.paddingTop =\n style.paddingRight =\n style.paddingBottom =\n style.paddingLeft =\n padding;\n paddingStyles = {\n paddingTop: padding,\n paddingRight: padding,\n paddingBottom: padding,\n paddingLeft: padding,\n };\n }\n\n if (\n border ||\n borderWidth ||\n borderTopWidth ||\n borderRightWidth ||\n borderBottomWidth ||\n borderLeftWidth\n ) {\n if (typeof border === \"string\" && (match = BORDER_REX.exec(border))) {\n // what if both border and borderWidth are specified ?\n [, borderWidth, borderColor] = match;\n borderWidth = parseInt(borderWidth, 10);\n }\n\n if (borderWidth) {\n borderTopWidth =\n borderTopWidth === undefined ? borderWidth : borderTopWidth;\n borderRightWidth =\n borderRightWidth === undefined ? borderWidth : borderRightWidth;\n borderBottomWidth =\n borderBottomWidth === undefined ? borderWidth : borderBottomWidth;\n borderLeftWidth =\n borderLeftWidth === undefined ? borderWidth : borderLeftWidth;\n }\n\n borderColor = borderColor || \"black\";\n const boxShadow = `\n ${borderColor} ${borderLeftWidth || 0}px ${\n borderTopWidth || 0\n }px 0 0 inset,\n ${borderColor} ${-borderRightWidth || 0}px ${\n -borderBottomWidth || 0\n }px 0 0 inset`;\n\n return {\n ...rest,\n ...marginStyles,\n ...paddingStyles,\n borderTopWidth,\n borderRightWidth,\n borderBottomWidth,\n borderLeftWidth,\n borderColor,\n borderStyle: \"solid\",\n boxShadow,\n };\n } else {\n return style;\n }\n // } else {\n // return style;\n // }\n}\n", "import React from \"react\";\nimport cx from \"classnames\";\nimport { typeOf } from \"../../utils\";\n\nimport \"./layout-tree-viewer.css\";\nimport { Tree } from \"@heswell/salt-lab\";\n\nconst classBaseTree = \"hwLayoutTreeViewer\";\n\nconst toTreeJson = (component, path = \"0\") => {\n return {\n label: typeOf(component),\n path,\n childNodes: React.Children.map(component.props.children, (child, i) =>\n toTreeJson(child, path ? `${path}.${i}` : `${i}`)\n ),\n };\n};\n\nexport const LayoutTreeViewer = ({ layout, onSelect, style }) => {\n const treeJson = [toTreeJson(layout)];\n\n const handleSelection = (evt, [{ path }]) => {\n onSelect(path);\n };\n\n return (\n <div className={cx(classBaseTree)} style={style}>\n <Tree\n source={treeJson}\n groupSelection=\"single\"\n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YH,EAAcG,EAClDC,EACEA,IAAoB,OAAYJ,EAAcI,GAGlDC,EAAcA,GAAe,QAC7B,IAAMI,EAAY;AAAA,kBACJJ,KAAeD,GAAmB,OAC9CH,GAAkB;AAAA,kBAENI,KAAe,CAACH,GAAoB,OAChD,CAACC,GAAqB,gBAGxB,MAAO,CACL,GAAGG,EACH,GAAGC,EACH,GAAGC,EACH,eAAAP,EACA,iBAAAC,EACA,kBAAAC,EACA,gBAAAC,EACA,YAAAC,EACA,YAAa,QACb,UAAAI,CACF,CACF,KACE,QAAO9D,CAKX,CChXA,IAAA+D,GAAkB,oBAClBC,GAAe,yBAIf,IAAAC,GAAqB,6BAuBfC,GAAA,6BArBAC,GAAgB,qBAEhBC,GAAa,CAACC,EAAWC,EAAO,OAC7B,CACL,MAAOC,EAAOF,CAAS,EACvB,KAAAC,EACA,WAAY,GAAAE,QAAM,SAAS,IAAIH,EAAU,MAAM,SAAU,CAACI,EAAOC,IAC/DN,GAAWK,EAAOH,EAAO,GAAGA,KAAQI,IAAM,GAAGA,GAAG,CAClD,CACF,GAGWC,GAAmB,CAAC,CAAE,OAAAC,EAAQ,SAAAC,EAAU,MAAAC,CAAM,IAAM,CAC/D,IAAMC,EAAW,CAACX,GAAWQ,CAAM,CAAC,EAE9BI,EAAkB,CAACC,EAAK,CAAC,CAAE,KAAAX,CAAK,CAAC,IAAM,CAC3CO,EAASP,CAAI,CACf,EAEA,SACE,QAAC,OAAI,aAAW,GAAAY,SAAGf,EAAa,EAAG,MAAOW,EACxC,oBAAC,SACC,OAAQC,EACR,eAAe,SACf,kBAAmBC,EACrB,EACF,CAEJ",
|
|
6
|
-
"names": ["src_exports", "__export", "Action", "BORDER_STYLES", "Chest_default", "Component_default", "ComponentRegistry", "ConfigWrapper", "ContextMenu_default", "ContextMenuContext", "ContextMenuProvider", "Dialog", "DialogService", "Draggable", "DraggableLayout", "Drawer_default", "DropMenu", "DropTarget", "Flexbox_default", "FlexboxLayout", "FluidGrid", "FluidGridLayout", "Header", "HeightOnly", "LayoutConfigurator", "LayoutProvider", "LayoutProviderContext", "LayoutProviderVersion", "LayoutTreeViewer", "MARGIN_STYLES", "MenuItem", "MenuItemGroup", "MenuList_default", "PADDING_STYLES", "Palette", "PaletteItem", "PaletteListItem", "PaletteSalt", "Placeholder", "Popup", "PopupService", "Separator", "Stack", "StackLayout", "MemoView", "ViewContext", "WidthHeight", "WidthOnly", "XXXnormalizeStyles", "componentFromLayout", "computeMenuPosition", "containerOf", "expandFlex", "extractResponsiveProps", "findTarget", "followPath", "followPathToComponent", "followPathToParent", "getChild", "getChildProp", "getPersistentState", "getProp", "getProps", "hasPersistentState", "identifyDropTarget", "isContainer", "isLayoutComponent", "isRegistered", "isResponsiveAttribute", "isTabstrip", "isTypeOf", "isView", "nextLeaf", "nextStep", "previousLeaf", "registerComponent", "resetPath", "setPersistentState", "setRef", "typeOf", "useBreakpoints", "useContextMenu", "useLayoutProviderDispatch", "useLayoutProviderVersion", "useOverflowObserver", "usePersistentState", "useResizeObserver", "useViewActionDispatcher", "useViewContext", "useViewDispatch", "__toCommonJS", "import_classnames", "import_react", "import_classnames", "import_core", "import_jsx_runtime", "classBase", "sizeAttribute", "value", "getStyle", "styleProp", "sizeOpen", "sizeClosed", "hasSizeOpen", "hasSizeClosed", "Drawer", "children", "classNameProp", "clickToOpen", "defaultOpen", "openProp", "position", "inline", "onClick", "peekaboo", "toggleButton", "props", "open", "setOpen", "className", "cx", "toggleDrawer", "style", "handleClick", "renderToggleButton", "Drawer_default", "import_vuu_utils", "_containers", "_views", "ComponentRegistry", "isContainer", "componentType", "isView", "isLayoutComponent", "type", "isRegistered", "className", "registerComponent", "componentName", "component", "import_jsx_runtime", "isDrawer", "component", "Drawer_default", "isVertical", "position", "Chest", "props", "children", "classNameProp", "id", "style", "classBase", "drawers", "content", "verticalDrawers", "horizontalDrawers", "orientation", "className", "cx", "Chest_default", "registerComponent", "import_react", "import_jsx_runtime", "Component", "resizeable", "props", "ref", "Component_default", "registerComponent", "import_react", "import_classnames", "import_core", "import_classnames", "import_react", "import_react", "import_vuu_utils", "import_react", "import_classnames", "import_jsx_runtime", "Splitter", "React", "column", "index", "onDrag", "onDragEnd", "onDragStart", "style", "ignoreClick", "rootRef", "lastPos", "active", "setActive", "handleKeyDownDrag", "key", "shiftKey", "distance", "handleKeyDownInitDrag", "evt", "keyDownHandlerRef", "handleKeyDown", "handleMouseMove", "e", "pos", "diff", "handleMouseUp", "_a", "handleMouseDown", "handleFocus", "handleClick", "handleBlur", "className", "cx", "import_classnames", "import_jsx_runtime", "classBase", "Placeholder", "className", "closeable", "flexFill", "resizeable", "shim", "props", "cx", "registerComponent", "expandFlex", "flex", "import_react", "NO_PROPS", "getProp", "component", "propName", "_a", "props", "getProps", "getChildProp", "container", "target", "rest", "typeOf", "element", "_a", "type", "elementName", "isTypeOf", "removeFinalPathSegment", "path", "pos", "followPathToParent", "source", "dataPath", "sourcePath", "getProps", "followPath", "findTarget", "test", "children", "props", "React", "array", "child", "target", "containerOf", "idx", "finalStep", "nextStep", "getProp", "getChild", "followPathToComponent", "component", "paths", "getChildren", "c", "i", "throwIfNotFound", "route", "message", "nextLeaf", "root", "parent", "pathIndices", "lastIdx", "firstLeaf", "parentIdx", "nextParent", "isContainer", "typeOf", "previousLeaf", "lastLeaf", "layoutRoot", "pathSoFar", "targetPath", "followPathToEnd", "pathVisited", "endOfTheLine", "n", "resetPath", "model", "additionalProps", "pathPropName", "import_react", "componentFromLayout", "layoutModel", "id", "type", "props", "layoutChildren", "ReactType", "getComponentType", "children", "reactType", "ComponentRegistry", "setRef", "ref", "value", "import_react", "import_vuu_utils", "placeHolderProps", "NO_STYLE", "auto", "defaultFlexStyle", "CROSS_DIMENSION", "getFlexDimensions", "flexDirection", "isPercentageSize", "value", "getIntrinsicSize", "component", "width", "height", "numHeight", "numWidth", "getFlexStyle", "dimension", "pos", "crossDimension", "intrinsicCrossSize", "intrinsicStyles", "hasUnboundedFlexStyle", "flex", "flexGrow", "flexShrink", "flexBasis", "getFlexOrIntrinsicStyle", "intrinsicSize", "wrapIntrinsicSizeComponentWithFlexbox", "path", "clientRect", "dropRect", "wrappedChildren", "pathIndex", "endPlaceholder", "startPlaceholder", "dropLeft", "dropTop", "dropRight", "dropBottom", "createPlaceHolder", "version", "style", "getProps", "resetPath", "createFlexbox", "getFlexValue", "flexFill", "props", "children", "id", "resizeable", "React", "ComponentRegistry", "baseStyle", "size", "NO_INTRINSIC_SIZE", "SPLITTER", "PLACEHOLDER", "isIntrinsicallySized", "item", "getBreakPointValues", "breakPoints", "component", "values", "breakPoint", "getProp", "gatherChildMeta", "children", "dimension", "child", "index", "_a", "resizeable", "intrinsicSize", "getIntrinsicSize", "flexOpen", "hasUnboundedFlexStyle", "findSplitterAndPlaceholderPositions", "childMeta", "count", "allIntrinsic", "splitterPositions", "i", "resizeablesLeft", "identifyResizeParties", "contentMeta", "idx", "idx1", "getLeadingResizeablePos", "idx2", "getTrailingResizeablePos", "participants", "bystanders", "identifyResizeBystanders", "pos", "isResizeable", "placeholder", "splitter", "originalContentOnly", "meta", "useSplitterResizing", "childrenProp", "onSplitterMoved", "style", "rootRef", "metaRef", "contentRef", "assignedKeys", "forceUpdate", "setContent", "content", "isColumn", "dimension", "children", "React", "handleDragStart", "index", "contentMeta", "participants", "bystanders", "identifyResizeParties", "_a", "el", "size", "minSize", "measureElement", "handleDrag", "idx", "distance", "resizeContent", "handleDragEnd", "createSplitter", "i", "Splitter", "buildContent", "keys", "childMeta", "gatherChildMeta", "splitterAndPlaceholderPositions", "findSplitterAndPlaceholderPositions", "child", "PLACEHOLDER", "createPlaceholder", "key", "SPLITTER", "updateMeta", "currentSize", "flexOpen", "flexBasis", "hasCurrentSize", "actualFlexBasis", "resizeTargets", "target1", "multiplier", "leadingItem", "leadingSize", "trailingItem", "trailingSize", "Placeholder", "minSizeVal", "import_jsx_runtime", "classBase", "Flexbox", "props", "ref", "breakPoints", "children", "column", "classNameProp", "flexFill", "gap", "fullPage", "id", "onSplitterMoved", "resizeable", "row", "spacing", "splitterSize", "style", "rest", "content", "rootRef", "useSplitterResizing", "className", "cx", "Flexbox_default", "import_react", "Action", "import_react", "import_react", "import_react", "import_vuu_utils", "import_vuu_utils", "import_react", "import_react", "persistentState", "sessionState", "getPersistentState", "id", "hasPersistentState", "setPersistentState", "value", "usePersistentState", "loadSessionState", "key", "state", "saveSessionState", "data", "purgeSessionState", "_doomedState", "rest", "loadState", "saveState", "purgeState", "getManagedDimension", "style", "theKidHasNoStyle", "applyLayoutProps", "component", "path", "layoutProps", "children", "getChildLayoutProps", "typeOf", "React", "processLayoutElement", "layoutElement", "previousLayout", "type", "getLayoutProps", "type", "props", "path", "parentType", "previousLayout", "_a", "_b", "prevActive", "dataPath", "prevPath", "prevId", "prevStyle", "getProps", "prevMatch", "typeOf", "id", "active", "key", "style", "getStyle", "isLayoutComponent", "getChildLayoutProps", "layoutProps", "layoutFromJson", "previousChildren", "children", "getLayoutChildren", "kids", "React", "isContainer", "child", "childType", "previousType", "theKidHasNoStyle", "flex", "otherStyles", "expandFlex", "state", "componentType", "ComponentRegistry", "setPersistentState", "i", "layoutToJSON", "component", "componentToJson", "_omit", "hasPersistentState", "getPersistentState", "serializeProps", "otherProps", "result", "value", "serializeValue", "k", "v", "getInsertTabBeforeAfter", "stack", "pos", "_a", "tabs", "tabCount", "index", "positionRelativeToTab", "insertIntoContainer", "container", "targetContainer", "newComponent", "containerActive", "containerChildren", "containerPath", "getProps", "existingComponentPath", "getProp", "idx", "finalStep", "nextStep", "insertedIdx", "children", "insertIntoChildren", "child", "active", "typeOf", "React", "count", "id", "resetPath", "insertBesideChild", "existingComponent", "insertionPosition", "clientRect", "dropRect", "updateChildren", "intrinsicSize", "getIntrinsicSize", "insertIntrinsicSizedComponent", "insertFlexComponent", "getLeadingPlaceholderSize", "flexDirection", "top", "right", "bottom", "left", "rectLeft", "rectTop", "rectRight", "rectBottom", "dimension", "crossDimension", "contraDirection", "getFlexDimensions", "intrinsicCrossSize", "path", "placeholderSize", "itemToInsert", "size", "wrapIntrinsicSizeComponentWithFlexbox", "placeholder", "createPlaceHolder", "intrinsicCrossChildSize", "targetRect", "arr", "i", "insertedComponent", "getStyledComponents", "version", "dim", "getManagedDimension", "splitterSize", "existingComponentStyle", "getFlexOrIntrinsicStyle", "newComponentStyle", "_1", "_2", "_3", "style", "LayoutActionType", "import_react", "import_react", "replaceChild", "model", "target", "replacement", "_replaceChild", "child", "path", "getProp", "resizeable", "style", "getProps", "newChild", "applyLayoutProps", "React", "swapChild", "op", "idx", "finalStep", "nextStep", "children", "Action", "minimize", "restore", "parent", "parentStyle", "childStyle", "width", "height", "flexBasis", "flexShrink", "flexGrow", "rest", "restoreStyle", "collapsed", "removeChild", "layoutRoot", "path", "target", "followPath", "targetParent", "followPathToParent", "children", "getProps", "allOtherChildrenArePlaceholders", "flexBasis", "display", "flexDirection", "style", "containerPath", "getProp", "newLayout", "swapChild", "createPlaceHolder", "hasAdjacentPlaceholders", "collapsePlaceholders", "_removeChild", "container", "child", "active", "componentChildren", "preserve", "idx", "finalStep", "nextStep", "type", "typeOf", "unwrap", "isFlexible", "canBeMadeFlexible", "makeFlexible", "i", "resetPath", "React", "flexGrow", "flexShrink", "width", "height", "unwrappedChild", "dim", "size", "element", "wasPlaceholder", "isPlaceholder", "_collapsePlaceHolders", "newChildren", "placeholders", "mergePlaceholders", "placeholder", "targetStyle", "import_react", "resizeFlexChildren", "layoutRoot", "path", "sizes", "target", "followPath", "children", "style", "getProps", "dimension", "replacementChildren", "applySizesToChildren", "replacement", "React", "swapChild", "child", "i", "size", "actualFlexBasis", "meta", "currentSize", "flexBasis", "newSize", "applySizeToChild", "hasSize", "flexShrink", "flexGrow", "import_react", "import_vuu_utils", "isHtmlElement", "component", "firstLetter", "typeOf", "wrap", "container", "existingComponent", "newComponent", "pos", "clientRect", "dropRect", "containerChildren", "containerPath", "getProps", "existingComponentPath", "getProp", "idx", "finalStep", "nextStep", "children", "updateChildren", "child", "index", "React", "intrinsicSize", "getIntrinsicSize", "wrapIntrinsicSizedComponent", "wrapFlexComponent", "_a", "version", "type", "flexDirection", "showTabsProp", "getLayoutSpecForWrapper", "style", "existingComponentStyle", "newComponentStyle", "getWrappedFlexStyles", "targetFirst", "isTargetFirst", "active", "newComponentProps", "existingComponentProps", "showTabs", "splitterSize", "id", "wrapper", "ComponentRegistry", "resetPath", "applyLayoutProps", "contraDirection", "dropLeft", "dropTop", "dropRight", "dropBottom", "startPlaceholder", "endPlaceholder", "pathRoot", "pathIndex", "resizeProp", "wrappedChildren", "createPlaceHolder", "wrapIntrinsicSizeComponentWithFlexbox", "createFlexbox", "dimension", "getFlexStyle", "layoutReducer", "state", "action", "LayoutActionType", "addChild", "dragDrop", "setChildProps", "removeChild", "replaceChild", "setTitle", "resizeFlexChildren", "switchTab", "path", "nextIdx", "target", "followPath", "replacement", "React", "swapChild", "title", "type", "layoutRoot", "_a", "_b", "newComponent", "dragInstructions", "dropTarget", "existingComponent", "pos", "destinationTabstrip", "typeOf", "id", "version", "getProps", "intrinsicSize", "getIntrinsicSize", "newLayoutRoot", "targetTab", "insertionPosition", "getInsertTabBeforeAfter", "insertIntoContainer", "insertBesideChild", "_replaceChild", "dropLayoutIntoContainer", "finalTarget", "findTarget", "props", "finalPath", "getProp", "containerPath", "component", "clientRect", "dropRect", "existingComponentPath", "wrap", "targetContainer", "followPathToParent", "withTheGrain", "isContainer", "container", "isTerrace", "isTower", "import_react", "unconfiguredLayoutProviderDispatch", "action", "LayoutProviderContext", "import_react", "positionValues", "RelativeDropPosition", "Position", "_position", "str", "NORTH", "SOUTH", "EAST", "WEST", "HEADER", "CENTRE", "BoxModel", "model", "dropTargetPaths", "measurements", "measureRootComponent", "layout", "x", "y", "validDropTargets", "allBoxesContainingPoint", "pointPositionWithinRect", "rect", "borderZone", "width", "height", "posX", "posY", "closeToTheEdge", "getPosition", "targetOrientation", "BEFORE", "AFTER", "pctX", "pctY", "position", "tab", "containsPoint", "tabCount", "targetTab", "left", "right", "tabWidth", "getPositionWithinBox", "centerBox", "getCenteredBox", "top", "bottom", "pctSize", "pctOffset", "w", "h", "rootComponent", "dropTargets", "id", "dataPath", "path", "getProps", "type", "typeOf", "el", "measureComponentDomElement", "measureComponent", "isContainer", "collectChildMeasurements", "component", "header", "headerEl", "titleEl", "preX", "preY", "children", "style", "active", "isFlexbox", "isStack", "isTower", "isTerrace", "childMeasurements", "_child", "idx", "omitDragging", "child", "expandedMeasurements", "i", "all", "localPreX", "localPosX", "localPreY", "localPosY", "gapPre", "gapPos", "n", "componentMeasurements", "childType", "scrolling", "scrollHeight", "boxes", "dropTargetPath", "scrollIntoViewIfNeccesary", "nestedBoxes", "scrollTop", "scrollMax", "SCALE_FACTOR", "DragState", "zone", "mouseX", "mouseY", "measurements", "intrinsicSize", "rect", "x", "y", "pctX", "pctY", "pointPositionWithinRect", "scaleFactor", "leadX", "trailX", "leadY", "trailY", "scaledWidth", "scaledHeight", "scaleDiff", "leadXScaleDiff", "leadYScaleDiff", "trailXScaleDiff", "trailYScaleDiff", "_a", "_b", "xy", "mousePos", "state", "mouseConstraint", "posConstraint", "previousPos", "diff", "dir", "pos", "isTabstrip", "dropTarget", "typeOf", "north", "south", "east", "west", "positionValues", "eastwest", "northsouth", "DropTarget", "component", "pos", "clientRect", "nextDropTarget", "tab", "tabLeft", "tabWidth", "positionRelativeToTab", "RelativeDropPosition", "lineWidth", "dragState", "l", "t", "r", "b", "top", "left", "right", "bottom", "header", "inset", "gap", "tabHeight", "_a", "_b", "_c", "_d", "rect", "x", "y", "height", "width", "guideLines", "suggestedWidth", "suggestedHeight", "position", "intrinsicWidth", "intrinsicHeight", "sizeHeight", "sizeWidth", "Position", "halfHeight", "halfWidth", "dropTargets", "identifyDropTarget", "rootLayout", "measurements", "intrinsicSize", "validDropTargets", "allBoxesContainingPoint", "BoxModel", "containers", "dataPath", "path", "isRowPlaceholder", "getProps", "getPosition", "box", "nextTarget", "targets", "targetPosition", "getTargetPosition", "containerPos", "container", "closeToTheEdge", "containingBox", "closeToTop", "closeToRight", "closeToBottom", "closeToLeft", "atTop", "atRight", "atBottom", "atLeft", "isVBox", "isTabbedContainer", "isHBox", "import_react", "import_react_dom", "import_react", "ReactDOM", "ReactDOM", "import_core", "import_jsx_runtime", "containerId", "getPortalContainer", "x", "y", "win", "el", "createDOMContainer", "renderPortal", "component", "container", "onRender", "createContainer", "Portal", "children", "x", "y", "onRender", "renderContainer", "createContainer", "renderPortal", "_a", "import_classnames", "React", "_dialogOpen", "_popups", "specialKeyHandler", "closeAllPopups", "ReactDOM", "outsideClickHandler", "popupContainers", "i", "popupClosed", "dialogOpened", "dialogClosed", "popupOpened", "name", "pos", "PopupComponent", "children", "position", "style", "className", "cx", "incrementingKey", "PopupService", "group", "left", "right", "top", "width", "component", "el", "renderPortal", "target", "height", "currentRight", "w", "overflowH", "overflowW", "adjustment", "DialogService", "dialog", "containerEl", "onClose", "Popup", "props", "pendingTask", "ref", "show", "boundingClientRect", "depth", "targetLeft", "targetTop", "clientWidth", "targetBottom", "import_classnames", "import_jsx_runtime", "computeMenuPosition", "dropTarget", "offsetTop", "offsetLeft", "pos", "box", "menuOffset", "classBase", "DropMenu", "className", "onHover", "orientation", "dropTargets", "cx", "target", "import_jsx_runtime", "_multiDropOptions", "_hoverDropTarget", "_shiftedTab", "onHoverDropTarget", "dropTarget", "start", "x", "y", "point", "pathFromPoints", "p1", "points", "pathFromGuideLines", "guideLines", "x1", "y1", "x2", "y2", "x3", "y3", "x4", "y4", "insertSVGRoot", "root", "container", "DropTargetCanvas", "dragRect", "tabMode", "d", "dropOutlinePath", "clearShiftedTab", "PopupService", "width", "height", "tabLeft", "tabWidth", "tabHeight", "tabOnly", "left", "dragState", "wasMultiDrop", "moveExistingTabs", "top", "orientation", "computeMenuPosition", "component", "DropMenu", "targetDropOutline", "l", "t", "r", "b", "w", "h", "path", "animation", "dropGuidePath", "cssShiftRight", "cssShiftBack", "_a", "_b", "AFTER", "BEFORE", "RelativeDropPosition", "Stack", "tab", "id", "tabEl", "tabOffset", "selector", "_dragStartCallback", "_dragMoveCallback", "_dragEndCallback", "_dragStartX", "_dragStartY", "_dragContainer", "_dragState", "_dropTarget", "_validDropTargetPaths", "_dragInstructions", "_measurements", "_simpleDrag", "_dragThreshold", "_mouseDownTimer", "DEFAULT_DRAG_THRESHOLD", "_dropTargetRenderer", "DropTargetCanvas", "SCALE_FACTOR", "getDragContainer", "rootContainer", "dragContainerPath", "followPath", "findTarget", "props", "Draggable", "dragStartCallback", "dragInstructions", "preDragMousemoveHandler", "preDragMouseupHandler", "top", "left", "right", "bottom", "dragPos", "dragHandler", "intrinsicSize", "dropTargets", "initDrag", "x", "y", "x_diff", "y_diff", "dragRect", "dataPath", "path", "getProps", "id", "target", "BoxModel", "dragZone", "DragState", "pctX", "pctY", "dragMousemoveHandler", "dragMouseupHandler", "evt", "dragState", "currentDropTarget", "dropTarget", "newX", "newY", "identifyDropTarget", "onDragEnd", "DropTarget", "Position", "NO_INSTRUCTIONS", "NO_OFFSETS", "getDragElement", "rect", "id", "dragElement", "wrapper", "div", "cssText", "determineDragOffsets", "draggedElement", "offsetParent", "offsetLeft", "offsetTop", "useLayoutDragDrop", "rootLayoutRef", "dispatch", "dragActionRef", "dragOperationRef", "draggableHTMLElementRef", "handleDrag", "x", "y", "offsetX", "offsetY", "targetPosition", "left", "top", "handleDrop", "dropTarget", "dragInstructions", "draggedReactElement", "originalCSS", "handleDragStart", "evt", "component", "dragContainerPath", "dragRect", "instructions", "path", "rootLayout", "dragPos", "dragPayload", "followPath", "dragPayloadId", "intrinsicSize", "getIntrinsicSize", "dragCSS", "dragTransform", "dragStartLeft", "dragStartTop", "dragOffsets", "element", "width", "height", "Draggable", "action", "options", "import_jsx_runtime", "withDropTarget", "props", "shouldSave", "action", "LayoutProviderVersion", "version", "useLayoutProviderVersion", "LayoutProvider", "children", "layout", "onLayoutChange", "state", "childrenRef", "forceRefresh", "serializeState", "source", "targetContainer", "findTarget", "target", "typeOf", "getProps", "serializedModel", "layoutToJSON", "dispatchLayoutAction", "suppressSave", "nextState", "layoutReducer", "layoutActionDispatcher", "prepareToDragLayout", "useLayoutDragDrop", "getChildProp", "newLayout", "layoutFromJson", "LayoutActionType", "processLayoutElement", "LayoutProviderContext", "useLayoutProviderDispatch", "dispatchLayoutProvider", "import_jsx_runtime", "FlexboxLayout", "props", "path", "dispatch", "useLayoutProviderDispatch", "handleSplitterMoved", "sizes", "Action", "Flexbox_default", "registerComponent", "import_core", "import_classnames", "import_react", "import_react", "import_react", "WidthHeight", "HeightOnly", "WidthOnly", "observedMap", "getTargetSize", "element", "contentRect", "dimension", "resizeObserver", "entries", "entry", "target", "observedTarget", "onResize", "measurements", "sizeChanged", "size", "newSize", "useResizeObserver", "ref", "dimensions", "reportInitialSize", "dimensionsRef", "measure", "rect", "map", "dim", "cleanedUp", "registerObserver", "fonts", "record", "breakpointReader", "themeName", "defaultBreakpoints", "themeRoot", "handler", "style", "stopName", "val", "byDescendingStopSize", "s1", "s2", "breakpointRamp", "breakpoints", "name", "value", "i", "all", "documentBreakpoints", "loadBreakpoints", "xs", "sm", "md", "lg", "xl", "getBreakPoints", "EMPTY_ARRAY", "useBreakpoints", "breakPointsProp", "smallerThan", "ref", "breakpointMatch", "setBreakpointmatch", "bodyRef", "breakPointsRef", "breakpointRamp", "getBreakPoints", "sizeRef", "stopFromMinWidth", "w", "name", "size", "matchSizeAgainstBreakpoints", "width", "breakPointRamp", "maxValue", "useResizeObserver", "measuredWidth", "result", "target", "prevSize", "clientWidth", "import_react", "LEFT_RIGHT", "TOP_BOTTOM", "measureMinimumNodeSize", "node", "dimension", "size", "padRight", "padLeft", "style", "start", "end", "marginStart", "marginEnd", "minWidth", "flexBasis", "MONITORED_DIMENSIONS", "NO_OVERFLOW_INDICATOR", "NO_DATA", "UNCOLLAPSED_DYNAMIC_ITEMS", "addAll", "sum", "m", "addAllExceptOverflowIndicator", "lastOverflowableItem", "arr", "i", "item", "OVERFLOWING", "collapsedOnly", "status", "includesOverflow", "lastListItem", "listRef", "newlyCollapsed", "visibleItems", "hasUncollapsedDynamicItems", "containerRef", "moveOverflowItem", "fromStack", "toStack", "byDescendingPriority", "m1", "m2", "result", "getOverflowIndicator", "visibleRef", "Dimensions", "measureContainerOverflow", "innerEl", "orientation", "dim", "containerDepth", "scrollDepth", "contentSize", "useOverflowStatus", "forceUpdate", "overflowing", "_setOverflowing", "overflowingRef", "setOverflowing", "value", "updateOverflowStatus", "force", "measureChildNodes", "dimension", "list", "node", "_a", "collapsible", "collapsed", "collapsing", "index", "priority", "overflowIndicator", "overflowed", "size", "measureMinimumNodeSize", "getElementForItem", "ref", "useOverflowObserver", "label", "overflowedRef", "collapsedRef", "collapsingRef", "rootDepthRef", "containerSizeRef", "horizontalRef", "overflowIndicatorSizeRef", "minSizeRef", "setContainerMinSize", "isHorizontal", "styleDimension", "markOverflowingItems", "visibleContentSize", "containerSize", "target", "overflowedItem", "removeOverflowIfSpaceAllows", "diff", "itemDiff", "nextSize", "overflowSize", "initializeDynamicContent", "collapseCollapsingItem", "last", "lastTarget", "restoreCollapsingItem", "checkDynamicContent", "containerHasGrown", "collapsingItem", "collapsedItem", "style", "minSize", "resetMeasurements", "isOverflowing", "innerContainerSize", "rootContainerDepth", "hasDynamicItems", "measurements", "element", "renderedSize", "resizeHandler", "scrollHeight", "height", "scrollWidth", "width", "depth", "wasFullSize", "overflowDetected", "collapsedSize", "strategy", "measure", "useResizeObserver", "COLLAPSIBLE", "RESPONSIVE_ATTRIBUTE", "isResponsiveAttribute", "propName", "_a", "isCollapsible", "COLLAPSIBLE_VALUE", "collapsibleValue", "value", "extractResponsiveProps", "props", "result", "toolbarProps", "rest", "import_react", "import_vuu_utils", "breakPoints", "DEFAULT_COLS", "useResponsiveSizing", "childrenProp", "colsProp", "style", "rootRef", "metaRef", "contentRef", "cols", "dimension", "children", "buildContent", "childMeta", "gatherChildMeta", "content", "meta", "i", "child", "flex", "rest", "import_jsx_runtime", "classBase", "FluidGrid", "props", "ref", "breakPoints", "children", "column", "colsProp", "classNameProp", "flexFill", "gap", "fullPage", "id", "onSplitterMoved", "resizeable", "row", "showGrid", "spacing", "splitterSize", "styleProp", "rest", "cols", "content", "rootRef", "useResponsiveSizing", "breakpoint", "useBreakpoints", "className", "cx", "style", "import_jsx_runtime", "FluidGridLayout", "props", "FluidGrid", "registerComponent", "import_react", "NO_CONTEXT", "ViewContext", "React", "useViewDispatch", "_a", "context", "useViewContext", "import_core", "import_classnames", "import_react", "import_classnames", "import_react", "import_salt_lab", "import_icons", "import_jsx_runtime", "Header", "classNameProp", "contributions", "collapsed", "expanded", "closeable", "onEditTitle", "orientationProp", "style", "tearOut", "title", "labelFieldRef", "value", "setValue", "editing", "setEditing", "viewDispatch", "useViewDispatch", "handleAction", "evt", "actionId", "handleClose", "classBase", "handleTitleMouseDown", "e", "_a", "handleButtonMouseDown", "className", "classnames", "handleEnterEditMode", "handleTitleKeyDown", "handleExitEditMode", "originalValue", "finalValue", "allowDeactivation", "editCancelled", "handleMouseDown", "toolbarItems", "contributedItems", "actionButtons", "contribution", "i", "React", "import_react", "import_react", "useViewActionDispatcher", "id", "root", "viewPath", "dropTargets", "_a", "loadSessionState", "purgeSessionState", "purgeState", "saveSessionState", "usePersistentState", "contributions", "setContributions", "dispatchLayoutAction", "useLayoutProviderDispatch", "updateContributions", "location", "content", "updatedContributions", "clearContributions", "handleRemove", "ds", "handleMouseDown", "evt", "index", "preDragActivity", "dragRect", "resolve", "reject", "action", "type", "useView", "id", "rootRef", "path", "dropTargets", "titleProp", "layoutDispatch", "useLayoutProviderDispatch", "loadState", "loadSessionState", "purgeState", "saveState", "saveSessionState", "usePersistentState", "dispatchViewAction", "contributions", "useViewActionDispatcher", "title", "_a", "onEditTitle", "restoredState", "load", "key", "purge", "save", "state", "loadSession", "saveSession", "onConfigChange", "config", "data", "import_salt_lab", "import_react", "NO_MEASUREMENT", "useViewResize", "mainRef", "resize", "rootRef", "deferResize", "mainSize", "resizeHandle", "setMainSize", "onResize", "height", "width", "import_jsx_runtime", "View", "props", "forwardedRef", "children", "className", "collapsed", "closeable", "dataResizeable", "dropTargets", "expanded", "flexFill", "idProp", "header", "orientation", "path", "resize", "resizeable", "tearOut", "style", "titleProp", "restProps", "id", "useId", "rootRef", "mainRef", "contributions", "dispatchViewAction", "load", "loadSession", "onConfigChange", "onEditTitle", "purge", "restoredState", "save", "saveSession", "title", "useView", "useViewResize", "classBase", "getContent", "React", "viewContextValue", "headerProps", "cx", "ViewContext", "Header", "MemoView", "registerComponent", "import_salt_lab", "import_icons", "import_jsx_runtime", "classBase", "Dialog", "children", "className", "isOpen", "onClose", "title", "props", "root", "posX", "setPosX", "posY", "setPosY", "close", "handleRender", "Portal", "cx", "Flexbox_default", "MemoView", "import_core", "import_react", "import_react", "listItemIndex", "listItemEl", "idx", "closestListItem", "el", "nudge", "menus", "distance", "pos", "m", "i", "nudgeLeft", "nudgeUp", "flipSides", "id", "parentMenu", "menu", "el", "width", "closedNode", "getPosition", "openMenus", "left", "menuTop", "top", "getItemId", "getMenuId", "itemId", "getMenuDepth", "count", "identifyItem", "useCascade", "onActivate", "onMouseEnterItem", "posX", "posY", "forceRefresh", "setOpenMenus", "menuOpenPendingTimeout", "menuClosePendingTimeout", "menuState", "prevLevel", "openMenu", "menuId", "listItemEl", "closeMenu", "closeMenus", "lastMenuId", "parentMenuId", "scheduleOpen", "scheduleClose", "openMenuId", "handleRender", "right", "bottom", "clientHeight", "clientWidth", "newMenus", "listItemProps", "evt", "closestListItem", "isGroup", "isOpen", "level", "sameLevel", "state", "idx", "listItemIndex", "import_react", "import_react", "import_classnames", "import_core", "import_react", "isRoot", "el", "hasPopup", "idx", "_a", "applyHandlers", "props", "evtName", "params", "isPropagationStopped", "_a", "_b", "additionalHandlers", "handleEvent", "union", "set1", "sets", "result", "set", "element", "Enter", "Delete", "actionKeys", "Enter", "focusKeys", "arrowLeftRightKeys", "verticalNavigationKeys", "horizontalNavigationKeys", "functionKeys", "specialKeys", "union", "isNavigationKey", "key", "orientation", "verticalNavigationKeys", "horizontalNavigationKeys", "useKeyboardNavigation", "autoHighlightFirstItem", "count", "highlightedIdxProp", "onActivate", "onHighlight", "onKeyDown", "onCloseMenu", "onOpenMenu", "additionalHandlers", "highlightedIndexRef", "forceRefresh", "controlledHighlighting", "setHighlightedIndex", "idx", "applyHandlers", "keyBoardNavigation", "ignoreFocus", "setIgnoreFocus", "value", "hiliteItemAtIndex", "highlightedIdx", "listProps", "e", "isNavigationKey", "navigateChildldItems", "hasPopup", "isRoot", "handleEvent", "nextIdx", "nextItemIdx", "key", "import_jsx_runtime", "classBase", "Separator", "MenuItemGroup", "MenuItem", "children", "idx", "props", "hasIcon", "child", "MenuList", "activatedByKeyboard", "childMenuShowing", "highlightedIdxProp", "idProp", "isRoot", "listItemProps", "menuId", "onHighlightMenuItem", "onActivate", "onCloseMenu", "onOpenMenu", "id", "useId", "root", "mapIdxToId", "handleOpenMenu", "el", "handleActivate", "focusVisible", "highlightedIdx", "listProps", "useKeyboardNavigation", "appliedFocusVisible", "cx", "renderContent", "propsCommonToAllListItems", "maybeIcon", "withIcon", "addClonedChild", "list", "className", "itemId", "hasSeparator", "label", "hasSubMenu", "isMenuItemGroup", "subMenuShowing", "ariaControls", "getMenuItemProps", "listItems", "baseId", "key", "MenuList_default", "isMenuItemGroup", "child", "MenuItemGroup", "useItemsWithIds", "sourceProp", "childrenProp", "normalizeChildren", "collectChildren", "children", "path", "menus", "actions", "list", "idx", "hasSeparator", "React", "Separator", "group", "childPath", "action", "options", "childWithId", "grandChildren", "assignId", "import_react", "useClickAway", "containerClassName", "isOpen", "onClose", "clickHandler", "evt", "import_jsx_runtime", "ContextMenu", "activatedWithKeyboard", "childrenProp", "idProp", "onClose", "position", "sourceProp", "style", "id", "useId", "closeMenuRef", "menus", "actions", "useItemsWithIds", "navigatingWithKeyboard", "handleMouseEnterItem", "handleActivate", "menuId", "action", "options", "closeMenu", "listItemProps", "openMenu", "openMenus", "handleRender", "useCascade", "handleClose", "useClickAway", "handleOpenMenu", "itemId", "getItemId", "getMenuId", "handleCloseMenu", "handleHighlightMenuItem", "lastMenu", "getChildMenuIndex", "i", "pos", "left", "top", "childMenuIndex", "Portal", "MenuList_default", "ContextMenu_default", "import_react", "import_jsx_runtime", "showContextMenu", "menuDescriptors", "handleContextMenuAction", "left", "top", "component", "ContextMenu_default", "menuId", "options", "PopupService", "fromDescriptor", "children", "label", "icon", "action", "i", "MenuItemGroup", "MenuItem", "ContextMenuContext", "React", "NO_INHERITED_CONTEXT", "useContextMenu", "menuActionHandler", "menuBuilders", "buildMenuOptions", "location", "results", "menuBuilder", "e", "menuItemDescriptors", "Provider", "inheritedMenuBuilders", "inheritedMenuActionHandler", "handleMenuAction", "type", "ContextMenuProvider", "parentContext", "import_classnames", "import_react", "import_jsx_runtime", "DraggableLayout", "props", "sourceRef", "classNameProp", "id", "style", "className", "classnames", "componentName", "registerComponent", "import_salt_lab", "import_vuu_utils", "import_classnames", "import_react", "import_jsx_runtime", "clonePaletteItem", "paletteItem", "dolly", "PaletteItem", "className", "component", "idx", "resizeable", "header", "closeable", "props", "cx", "Palette", "children", "orientation", "dispatch", "useLayoutProviderDispatch", "classBase", "handleMouseDown", "evt", "_a", "listItemElement", "caption", "payload", "template", "height", "left", "top", "width", "id", "MemoView", "child", "registerComponent", "import_salt_lab", "import_vuu_utils", "import_classnames", "import_jsx_runtime", "classBase", "PaletteListItem", "props", "children", "ViewProps", "label", "onMouseDown", "template", "restProps", "dispatch", "useLayoutProviderDispatch", "evt", "left", "top", "width", "id", "component", "MemoView", "PaletteSalt", "className", "cx", "registerComponent", "import_core", "import_classnames", "import_salt_lab", "import_react", "import_jsx_runtime", "classBase", "getDefaultTabLabel", "component", "tabIndex", "_a", "_b", "getChildElements", "children", "elements", "React", "child", "Stack", "active", "classNameProp", "enableAddTab", "enableCloseTabs", "getTabLabel", "idProp", "keyBoardActivation", "onMouseDown", "onTabAdd", "onTabClose", "onTabEdit", "onTabSelectionChanged", "showTabs", "style", "TabstripProps", "ref", "id", "useId", "handleTabSelection", "nextIdx", "handleTabClose", "handleAddTab", "handleMouseDown", "e", "tabElement", "role", "handleExitEditMode", "_oldText", "newText", "_allowDeactivation", "activeChild", "renderTabs", "idx", "rootId", "closeable", "childId", "cx", "import_core", "import_react", "import_jsx_runtime", "defaultCreateNewChild", "index", "MemoView", "Component_default", "StackLayout", "props", "ref", "dispatch", "useLayoutProviderDispatch", "loadState", "saveState", "usePersistentState", "createNewChild", "idProp", "onTabSelectionChanged", "path", "restProps", "children", "id", "useId", "dispatchViewAction", "useViewActionDispatcher", "Stack", "component", "idx", "title", "e", "readyToDrag", "resolve", "tabIndex", "React", "dataPath", "text", "nextIdx", "registerComponent", "import_react", "import_jsx_runtime", "ConfigWrapper", "children", "layout", "setLayout", "selectedComponent", "setSelectedComponent", "handleSelection", "selectedPath", "targetComponent", "followPathToComponent", "handleChange", "property", "value", "newComponent", "React", "LayoutConfigurator", "LayoutTreeViewer", "import_salt_lab", "import_jsx_runtime", "NO_STYLE", "DIMENSIONS", "LayoutBox", "feature", "children", "style", "onChange", "evt", "value", "MARGIN_STYLES", "PADDING_STYLES", "BORDER_STYLES", "CSS_DIGIT", "CSS_MEASURE", "CSS_REX", "BORDER_REX", "LayoutConfigurator", "height", "managedStyle", "width", "state", "normalizeStyle", "handleChange", "dimension", "strValue", "property", "mt", "mr", "mb", "ml", "bt", "br", "bb", "bl", "pt", "pr", "pb", "pl", "XXXnormalizeStyles", "layoutStyle", "visualStyle", "margin", "marginTop", "marginRight", "marginBottom", "marginLeft", "padding", "paddingTop", "paddingRight", "paddingBottom", "paddingLeft", "match", "pos1", "pos2", "pos3", "pos4", "pos123", "border", "borderWidth", "borderTopWidth", "borderRightWidth", "borderBottomWidth", "borderLeftWidth", "borderColor", "rest", "marginStyles", "paddingStyles", "boxShadow", "import_react", "import_classnames", "import_salt_lab", "import_jsx_runtime", "classBaseTree", "toTreeJson", "component", "path", "typeOf", "React", "child", "i", "LayoutTreeViewer", "layout", "onSelect", "style", "treeJson", "handleSelection", "evt", "cx"]
|
|
3
|
+
"sources": ["../../../packages/vuu-layout/src/index.ts", "../../../packages/vuu-layout/src/chest-of-drawers/Chest.tsx", "../../../packages/vuu-layout/src/chest-of-drawers/Drawer.tsx", "../../../packages/vuu-layout/src/registry/ComponentRegistry.ts", "../../../packages/vuu-layout/src/Component.tsx", "../../../packages/vuu-popups/src/dialog/Dialog.tsx", "../../../packages/vuu-popups/src/portal/Portal.tsx", "../../../packages/vuu-popups/src/portal/render-portal.tsx", "../../../packages/vuu-layout/src/DraggableLayout.tsx", "../../../packages/vuu-layout/src/utils/styleUtils.ts", "../../../packages/vuu-layout/src/utils/pathUtils.ts", "../../../packages/vuu-layout/src/utils/propUtils.ts", "../../../packages/vuu-layout/src/utils/typeOf.ts", "../../../packages/vuu-layout/src/utils/componentFromLayout.tsx", "../../../packages/vuu-layout/src/utils/refUtils.ts", "../../../packages/vuu-layout/src/drag-drop/BoxModel.ts", "../../../packages/vuu-layout/src/drag-drop/DragState.ts", "../../../packages/vuu-layout/src/drag-drop/DropTarget.ts", "../../../packages/vuu-popups/src/popup/popup-service.js", "../../../packages/vuu-layout/src/drag-drop/DropMenu.tsx", "../../../packages/vuu-layout/src/drag-drop/DropTargetRenderer.tsx", "../../../packages/vuu-layout/src/drag-drop/Draggable.ts", "../../../packages/vuu-layout/src/flexbox/Flexbox.tsx", "../../../packages/vuu-layout/src/flexbox/useSplitterResizing.ts", "../../../packages/vuu-layout/src/flexbox/Splitter.tsx", "../../../packages/vuu-layout/src/placeholder/Placeholder.tsx", "../../../packages/vuu-layout/src/layout-reducer/flexUtils.ts", "../../../packages/vuu-layout/src/flexbox/flexbox-utils.ts", "../../../packages/vuu-layout/src/flexbox/FlexboxLayout.jsx", "../../../packages/vuu-layout/src/layout-action.ts", "../../../packages/vuu-layout/src/layout-provider/LayoutProvider.tsx", "../../../packages/vuu-layout/src/layout-reducer/layout-reducer.ts", "../../../packages/vuu-layout/src/layout-reducer/insert-layout-element.ts", "../../../packages/vuu-layout/src/layout-reducer/layoutUtils.ts", "../../../packages/vuu-layout/src/use-persistent-state.ts", "../../../packages/vuu-layout/src/layout-reducer/layoutTypes.ts", "../../../packages/vuu-layout/src/layout-reducer/remove-layout-element.ts", "../../../packages/vuu-layout/src/layout-reducer/replace-layout-element.ts", "../../../packages/vuu-layout/src/layout-reducer/resize-flex-children.ts", "../../../packages/vuu-layout/src/layout-reducer/wrap-layout-element.ts", "../../../packages/vuu-layout/src/layout-provider/LayoutProviderContext.ts", "../../../packages/vuu-layout/src/layout-provider/useLayoutDragDrop.ts", "../../../packages/vuu-layout/src/flexbox/FluidGrid.tsx", "../../../packages/vuu-layout/src/responsive/use-breakpoints.ts", "../../../packages/vuu-layout/src/responsive/useResizeObserver.ts", "../../../packages/vuu-layout/src/responsive/breakpoints.ts", "../../../packages/vuu-layout/src/responsive/useOverflowObserver.ts", "../../../packages/vuu-layout/src/responsive/measureMinimumNodeSize.ts", "../../../packages/vuu-layout/src/responsive/utils.ts", "../../../packages/vuu-layout/src/flexbox/useResponsiveSizing.ts", "../../../packages/vuu-layout/src/flexbox/FluidGridLayout.tsx", "../../../packages/vuu-layout/src/layout-header/Header.tsx", "../../../packages/vuu-layout/src/layout-view/ViewContext.ts", "../../../packages/vuu-layout/src/layout-view/View.tsx", "../../../packages/vuu-layout/src/layout-view/useView.tsx", "../../../packages/vuu-layout/src/layout-view/useViewActionDispatcher.ts", "../../../packages/vuu-layout/src/layout-view/useViewResize.ts", "../../../packages/vuu-layout/src/palette/Palette.tsx", "../../../packages/vuu-layout/src/palette/PaletteSalt.tsx", "../../../packages/vuu-layout/src/stack/Stack.tsx", "../../../packages/vuu-layout/src/stack/StackLayout.tsx", "../../../packages/vuu-layout/src/tools/config-wrapper/ConfigWrapper.jsx", "../../../packages/vuu-layout/src/tools/devtools-box/layout-configurator.jsx", "../../../packages/vuu-layout/src/tools/devtools-tree/layout-tree-viewer.jsx"],
|
|
4
|
+
"sourcesContent": ["export * from \"./chest-of-drawers\";\nexport { default as Component } from \"./Component\";\nexport * from \"./common-types\";\nexport * from \"@vuu-ui/vuu-popups/src/dialog\";\nexport * from \"./DraggableLayout\";\nexport * from \"./drag-drop\";\nexport * from \"./flexbox\";\nexport { Action } from \"./layout-action\";\nexport * from \"./layout-header\";\nexport * from \"./layout-provider\";\nexport * from \"./palette\";\nexport * from \"./placeholder\";\nexport * from \"./registry\";\nexport * from \"./responsive\";\nexport * from \"./stack\";\nexport * from \"./tools\";\nexport * from \"./use-persistent-state\";\nexport * from \"./utils\";\nexport * from \"./layout-view\";\n", "import React, { HTMLAttributes, ReactElement } from \"react\";\nimport cx from \"classnames\";\nimport Drawer from \"./Drawer\";\nimport { partition } from \"@vuu-ui/vuu-utils\";\nimport { registerComponent } from \"../registry/ComponentRegistry\";\n\nimport \"./Chest.css\";\n\nconst isDrawer = (component: ReactElement) => component.type === Drawer;\nconst isVertical = ({ props: { position = \"left\" } }: ReactElement) =>\n position.match(/top|bottom/);\n\nexport interface ChestProps extends HTMLAttributes<HTMLDivElement> {\n children: ReactElement[];\n}\n\nconst Chest = (props: ChestProps) => {\n const { children, className: classNameProp, id, style } = props;\n const classBase = \"hwChest\";\n const [drawers, content] = partition(children, isDrawer);\n const [verticalDrawers, horizontalDrawers] = partition(drawers, isVertical);\n const orientation =\n verticalDrawers.length === 0\n ? \"horizontal\"\n : horizontalDrawers.length === 0\n ? \"vertical\"\n : \"both\";\n\n const className = cx(classBase, classNameProp, `${classBase}-${orientation}`);\n\n return (\n <div className={className} id={id} style={style}>\n {drawers}\n <div className={`${classBase}-content`}>{content}</div>\n </div>\n );\n};\nChest.displayName = \"Chest\";\n\nexport default Chest;\n\nregisterComponent(\"Chest\", Chest, \"container\");\n", "import React, { CSSProperties, HTMLAttributes, useCallback } from \"react\";\nimport cx from \"classnames\";\nimport { Button, useControlled } from \"@salt-ds/core\";\n\nimport \"./Drawer.css\";\n\nconst classBase = \"vuuDrawer\";\n\nconst sizeAttribute = (value: string | number) => {\n return typeof value === \"string\" ? value : value + \"px\";\n};\n\nconst getStyle = (\n styleProp?: CSSProperties,\n sizeOpen?: number,\n sizeClosed?: number\n) => {\n const hasSizeOpen = sizeOpen !== undefined;\n const hasSizeClosed = sizeClosed !== undefined;\n\n if (!styleProp && !hasSizeClosed && !hasSizeOpen) {\n return undefined;\n }\n\n if (!hasSizeClosed && !hasSizeOpen) {\n return styleProp;\n }\n\n return {\n ...styleProp,\n \"--drawer-size\": hasSizeOpen ? sizeAttribute(sizeOpen) : undefined,\n \"--drawer-peek-size\": hasSizeClosed ? sizeAttribute(sizeClosed) : undefined,\n };\n};\n\nexport interface DrawerProps extends HTMLAttributes<HTMLDivElement> {\n clickToOpen?: boolean;\n defaultOpen: boolean;\n inline?: boolean;\n open?: boolean;\n peekaboo?: boolean;\n position?: \"left\" | \"right\" | \"top\" | \"bottom\";\n sizeOpen?: number;\n sizeClosed?: number;\n toggleButton?: \"start\" | \"end\";\n}\nconst Drawer = ({\n children,\n className: classNameProp,\n clickToOpen,\n defaultOpen,\n sizeOpen,\n sizeClosed,\n style: styleProp,\n open: openProp,\n position = \"left\",\n inline,\n onClick,\n peekaboo = false,\n toggleButton,\n ...props\n}: DrawerProps) => {\n const [open, setOpen] = useControlled({\n controlled: openProp,\n default: defaultOpen ?? false,\n name: \"Drawer\",\n state: \"open\",\n });\n\n const className = cx(classBase, classNameProp, `${classBase}-${position}`, {\n [`${classBase}-open`]: open,\n [`${classBase}-inline`]: inline,\n [`${classBase}-over`]: !inline,\n [`${classBase}-peekaboo`]: peekaboo,\n });\n\n const toggleDrawer = useCallback(() => {\n console.log(\"toggleDrawer\");\n setOpen(!open);\n }, [open, setOpen]);\n\n const style = getStyle(styleProp, sizeOpen, sizeClosed);\n\n const handleClick = clickToOpen ? toggleDrawer : onClick;\n\n const renderToggleButton = () => (\n <div className={cx(\"vuuToggleButton-container\")}>\n {open ? (\n <Button\n aria-label=\"close\"\n onClick={toggleDrawer}\n data-icon=\"close\"\n variant=\"secondary\"\n />\n ) : (\n <Button\n aria-label=\"open\"\n onClick={toggleDrawer}\n data-icon=\"close\"\n variant=\"secondary\"\n />\n )}\n </div>\n );\n\n return (\n <div {...props} className={className} onClick={handleClick} style={style}>\n {toggleButton == \"start\" ? renderToggleButton() : null}\n <div className={`${classBase}-liner`}>\n <div className={`${classBase}-content`}>{children}</div>\n </div>\n {toggleButton == \"end\" ? renderToggleButton() : null}\n </div>\n );\n};\nDrawer.displayName = \"Drawer\";\n\nexport default Drawer;\n", "import React, { FunctionComponent } from 'react';\n\nconst _containers: { [key: string]: boolean } = {};\nconst _views: { [key: string]: boolean } = {};\n\nexport type layoutComponentType = 'component' | 'container' | 'view';\n\nexport const ComponentRegistry: { [key: string]: FunctionComponent } = {};\n\nexport function isContainer(componentType: string) {\n return _containers[componentType] === true;\n}\n\nexport function isView(componentType: string) {\n return _views[componentType] === true;\n}\n\nexport const isLayoutComponent = (type: string) => isContainer(type) || isView(type);\n\nexport const isRegistered = (className: string) => !!ComponentRegistry[className];\n\n// We could check and set displayName in here\nexport function registerComponent(\n componentName: string,\n component: FunctionComponent<any>,\n type: layoutComponentType = 'component'\n) {\n ComponentRegistry[componentName] = component;\n\n if (type === 'container') {\n _containers[componentName] = true;\n } else if (type === 'view') {\n _views[componentName] = true;\n }\n}\n", "import React, { forwardRef, HTMLAttributes } from 'react';\nimport { registerComponent } from './registry/ComponentRegistry';\n\nimport './Component.css';\n\nexport interface ComponentProps extends HTMLAttributes<HTMLDivElement> {\n resizeable?: boolean;\n}\n\nconst Component = forwardRef(function Component(\n { resizeable, ...props }: ComponentProps,\n ref: React.ForwardedRef<HTMLDivElement>\n) {\n return <div {...props} className=\"Component\" ref={ref} />;\n}) as React.FunctionComponent<ComponentProps>;\nComponent.displayName = 'Component';\n\nexport default Component;\n\nregisterComponent('Component', Component);\n", "import React, { HTMLAttributes, useCallback, useRef, useState } from \"react\";\nimport cx from \"classnames\";\nimport { Portal } from \"../portal\";\nimport { Scrim } from \"@heswell/salt-lab\";\n\nimport { Text } from \"@salt-ds/core\";\nimport { Toolbar, ToolbarButton } from \"@heswell/salt-lab\";\n\nimport \"./Dialog.css\";\n\nconst classBase = \"vuuDialog\";\n\nexport interface DialogProps extends HTMLAttributes<HTMLDivElement> {\n isOpen?: boolean;\n onClose?: () => void;\n}\n\nexport const Dialog = ({\n children,\n className,\n isOpen = false,\n onClose,\n title,\n ...props\n}: DialogProps) => {\n const root = useRef<HTMLDivElement>(null);\n const [posX, setPosX] = useState(0);\n const [posY, setPosY] = useState(0);\n\n const close = useCallback(() => {\n // TODO\n onClose?.();\n }, [onClose]);\n\n const handleRender = useCallback(() => {\n // if (center && isOpen && root.current) {\n // const { width, height } = root.current.getBoundingClientRect();\n // const { innerWidth, innerHeight } = window;\n // const x = innerWidth / 2 - width / 2;\n // const y = innerHeight / 2 - height / 2;\n // setPosX(x);\n // setPosY(y);\n // }\n }, []);\n\n if (!isOpen) {\n return null;\n }\n\n return (\n <Portal onRender={handleRender} x={posX} y={posY}>\n <Scrim className={`${classBase}-scrim`} open={isOpen}>\n <div {...props} className={cx(classBase, className)} ref={root}>\n <Toolbar className={`${classBase}-header`}>\n <Text>{title}</Text>\n <ToolbarButton\n key=\"close\"\n onClick={close}\n data-align-end\n data-icon=\"close\"\n />\n </Toolbar>\n {children}\n </div>\n </Scrim>\n </Portal>\n );\n};\n", "import { ReactElement, useLayoutEffect, useMemo } from \"react\";\nimport * as ReactDOM from \"react-dom\";\nimport { createContainer, renderPortal } from \"./render-portal\";\n\nexport interface PortalProps {\n children: ReactElement;\n onRender?: () => void;\n x?: number;\n y?: number;\n}\n\nexport const Portal = function Portal({\n children,\n x = 0,\n y = 0,\n onRender,\n}: PortalProps) {\n // Do we need to accept container here as a prop ?\n const renderContainer = useMemo(() => {\n return createContainer();\n }, []);\n\n useLayoutEffect(() => {\n renderPortal(children, renderContainer, x, y, onRender);\n }, [children, onRender, renderContainer, x, y]);\n\n useLayoutEffect(() => {\n return () => {\n if (renderContainer) {\n ReactDOM.unmountComponentAtNode(renderContainer);\n if (renderContainer.classList.contains(\"vuuPopup\")) {\n renderContainer.parentElement?.removeChild(renderContainer);\n }\n }\n };\n }, [renderContainer]);\n\n // useLayoutEffect(() => {\n // renderContainer.current = renderPortal(children, x, y, container)\n // return () => {\n // if (renderContainer.current){\n // console.log('EXPLICIT UNMOUNT')\n // ReactDOM.unmountComponentAtNode(renderContainer.current);\n // if (renderContainer.current.classList.contains('hwReactPopup')){\n // renderContainer.current.parentElement.removeChild(renderContainer.current);\n // renderContainer.current = null;\n // }\n // }\n // }\n // },[])\n return null;\n};\n", "import * as ReactDOM from \"react-dom\";\nimport { SaltProvider } from \"@salt-ds/core\";\nimport { ReactElement } from \"react\";\n\nlet containerId = 1;\n\nconst getPortalContainer = (x = 0, y = 0, win = window) => {\n const el = win.document.createElement(\"div\");\n el.className = \"vuuPopup \" + containerId++;\n el.style.cssText = `left:${x}px; top:${y}px;`;\n win.document.body.appendChild(el);\n return el;\n};\n\nconst createDOMContainer = (x?: number, y?: number) => getPortalContainer(x, y);\n\nexport const renderPortal = (\n component: ReactElement,\n container: HTMLElement,\n x: number,\n y: number,\n onRender?: () => void\n) => {\n // check this first to see if position has changed\n container.style.cssText = `left:${x}px; top:${y}px;position: absolute;`;\n\n ReactDOM.render(\n <SaltProvider applyClassesTo=\"child\">{component}</SaltProvider>,\n container,\n onRender\n );\n};\n\nexport const createContainer = createDOMContainer;\n", "import classnames from 'classnames';\nimport React, { useRef } from 'react';\nimport { registerComponent } from './registry/ComponentRegistry';\n\nimport './DraggableLayout.css';\n\n// We need to add props to restrict drag behaviour to, for example, popups only\nexport const DraggableLayout = function DraggableLayout(props) {\n // We shouldn't need this but somewhere the customDispatcher/handleDragStart callback is not\n // being updated and preserves stale ref to props.children, so DragDrop from within a nested\n // LatoutContext (Stack or DraggableLayout) fails.\n const sourceRef = useRef();\n sourceRef.current = props;\n\n const { className: classNameProp, id, style } = props;\n\n const className = classnames('DraggableLayout', classNameProp);\n return (\n <div className={className} id={id} style={style}>\n {props.children}\n </div>\n );\n};\n\nconst componentName = 'DraggableLayout';\n\nDraggableLayout.displayName = componentName;\n\nregisterComponent(componentName, DraggableLayout, 'container');\n", "import { CSSProperties } from 'react';\nexport type CSSFlexProperties = Pick<CSSProperties, 'flexBasis' | 'flexGrow' | 'flexShrink'>;\n\nexport const expandFlex = (flex: number | CSSFlexProperties): CSSFlexProperties => {\n if (typeof flex === 'number') {\n return {\n flexBasis: 0,\n flexGrow: 1,\n flexShrink: 1\n };\n } else {\n throw Error(`\"no support yet for flex value ${flex}`);\n }\n};\n", "import React, { ReactElement } from \"react\";\nimport { LayoutModel } from \"../layout-reducer\";\nimport { isContainer } from \"../registry/ComponentRegistry\";\nimport { getProp, getProps } from \"./propUtils\";\nimport { typeOf } from \"./typeOf\";\n\nconst removeFinalPathSegment = (path: string) => {\n const pos = path.lastIndexOf(\".\");\n if (pos === -1) {\n return path;\n } else {\n return path.slice(0, pos);\n }\n};\n\n// TODO isn't this equivalent to containerOf ?\nexport function followPathToParent(\n source: ReactElement,\n path: string\n): ReactElement | null {\n const { \"data-path\": dataPath, path: sourcePath = dataPath } =\n getProps(source);\n\n if (path === \"0\") return null;\n if (path === sourcePath) return null;\n\n return followPath(source, removeFinalPathSegment(path), true);\n}\n\nexport function findTarget(\n source: LayoutModel,\n test: (props: any) => boolean\n): LayoutModel | undefined {\n const { children, ...props } = getProps(source);\n if (test(props)) {\n return source;\n } else if (React.Children.count(children) > 0) {\n const array = React.isValidElement(children) ? [children] : children;\n for (let child of array) {\n const target = findTarget(child, test);\n if (target) {\n return target;\n }\n }\n }\n}\n\nexport function containerOf(\n source: LayoutModel,\n target: LayoutModel\n): LayoutModel | null {\n if (target === source) {\n return null;\n } else {\n const { path: sourcePath, children } = getProps(source);\n\n let { idx, finalStep } = nextStep(sourcePath, getProp(target, \"path\"));\n if (finalStep) {\n return source;\n } else if (children === undefined || children[idx] === undefined) {\n return null;\n } else {\n return containerOf(children[idx], target);\n }\n }\n}\n\n// Do not use React.Children.toArray,\n// it does not preserve keys\nexport const getChild = (\n children: ReactElement[],\n idx: number\n): ReactElement | undefined => {\n // idx may be a nu,mber or string\n if (React.isValidElement(children) && idx == 0) {\n return children;\n } else if (Array.isArray(children)) {\n return children[idx];\n }\n};\n\n// Use a path only to identify a component\nexport function followPathToComponent(component: ReactElement, path: string) {\n var paths = path.split(\".\");\n let children = [component];\n\n const getChildren = (c: ReactElement) =>\n React.isValidElement(c.props.children)\n ? [c.props.children]\n : c.props.children;\n\n for (let i = 0; i < paths.length; i++) {\n const idx = parseInt(paths[i]);\n const child = children[idx];\n if (i === paths.length - 1) {\n return child;\n } else {\n children = getChildren(child);\n }\n }\n}\n\nexport function followPath(\n source: LayoutModel,\n path: string\n): LayoutModel | undefined;\nexport function followPath(\n source: ReactElement,\n path: string,\n throwIfNotFound: true\n): ReactElement;\nexport function followPath(source: any, path: any, throwIfNotFound = false) {\n const { \"data-path\": dataPath, path: sourcePath = dataPath } =\n getProps(source);\n if (path.indexOf(sourcePath) !== 0) {\n throw Error(\n `pathUtils.followPath path ${path} is not within source path ${sourcePath}`\n );\n }\n const route = path.slice(sourcePath.length + 1);\n if (route === \"\") {\n return source;\n }\n\n let target = source;\n const paths = route.split(\".\");\n\n for (var i = 0; i < paths.length; i++) {\n if (React.Children.count(target.props.children) === 0) {\n const message = `element at 0.${paths\n .slice(0, i)\n .join(\".\")} has no children, so cannot fulfill rest of path ${paths\n .slice(i)\n .join(\".\")}`;\n\n if (throwIfNotFound) {\n throw Error(message);\n } else {\n console.warn(message);\n return;\n }\n }\n\n target = getChild(target.props.children, parseInt(paths[i]));\n\n if (target === undefined) {\n const message = `model at 0.${paths\n .slice(0, i)\n .join(\".\")} has no children that fulfill next step of path ${paths\n .slice(i)\n .join(\".\")}`;\n\n if (throwIfNotFound) {\n throw Error(message);\n } else {\n console.warn(message);\n }\n }\n }\n return target;\n}\n\nexport function nextLeaf(root: ReactElement, path: string) {\n const parent = followPathToParent(root, path);\n let pathIndices = path.split(\".\").map((idx) => parseInt(idx, 10));\n if (parent) {\n const lastIdx = pathIndices.pop();\n const { children } = parent.props;\n if (children.length - 1 > lastIdx!) {\n return firstLeaf(children[lastIdx! + 1]);\n } else {\n const parentIdx = pathIndices.pop();\n const nextParent = followPathToParent(root, getProp(parent, \"path\"));\n if (nextParent && typeof parentIdx === \"number\") {\n pathIndices = nextParent.props.path\n .split(\".\")\n .map((idx: string) => parseInt(idx, 10));\n if (nextParent.props.children.length - 1 > parentIdx) {\n const nextStep = nextParent.props.children[parentIdx + 1];\n if (isContainer(typeOf(nextStep) as string)) {\n return firstLeaf(nextStep);\n } else {\n return nextStep;\n }\n }\n }\n }\n }\n\n return firstLeaf(root);\n}\n\nexport function previousLeaf(root: ReactElement, path: string) {\n let pathIndices = path.split(\".\").map((idx) => parseInt(idx, 10));\n let lastIdx = pathIndices.pop();\n let parent = followPathToParent(root, path);\n if (parent != null && typeof lastIdx === \"number\") {\n const { children } = parent.props;\n if (lastIdx > 0) {\n return lastLeaf(children[lastIdx - 1]);\n } else {\n while (pathIndices.length > 1) {\n lastIdx = pathIndices.pop() as number;\n parent = followPathToParent(\n root,\n getProp(parent, \"path\")\n ) as ReactElement;\n // pathIndices = nextParent.props.path\n // .split(\".\")\n // .map((idx) => parseInt(idx, 10));\n if (lastIdx > 0) {\n const nextStep = parent.props.children[lastIdx - 1];\n if (isContainer(typeOf(nextStep) as string)) {\n return lastLeaf(nextStep);\n } else {\n return nextStep;\n }\n }\n }\n }\n }\n return lastLeaf(root);\n}\n\nfunction firstLeaf(layoutRoot: ReactElement): ReactElement {\n if (isContainer(typeOf(layoutRoot) as string)) {\n const { children } = layoutRoot.props || layoutRoot;\n return firstLeaf(children[0]);\n } else {\n return layoutRoot;\n }\n}\n\nfunction lastLeaf(root: ReactElement): ReactElement {\n if (isContainer(typeOf(root) as string)) {\n const { children } = root.props || root;\n return lastLeaf(children[children.length - 1]);\n } else {\n return root;\n }\n}\n\ntype NextStepResult = {\n idx: number;\n finalStep: boolean;\n};\n\nexport function nextStep(\n pathSoFar: string,\n targetPath: string,\n followPathToEnd = false\n): NextStepResult {\n if (pathSoFar === targetPath) {\n return { idx: -1, finalStep: true };\n }\n\n const pathVisited = `${pathSoFar}.`;\n if (!targetPath.startsWith(pathVisited)) {\n throw Error(\"pathUtils nextStep has strayed from the path\");\n }\n\n const endOfTheLine = followPathToEnd ? 0 : 1;\n // check that pathSoFar startsWith targetPath and if not, throw\n const paths = targetPath\n .replace(pathVisited, \"\")\n .split(\".\")\n .map((n) => parseInt(n, 10));\n return { idx: paths[0], finalStep: paths.length === endOfTheLine };\n}\n\nexport function resetPath(\n model: ReactElement,\n path: string,\n additionalProps?: any\n): ReactElement {\n if (getProp(model, \"path\") === path) {\n return model;\n }\n const children: ReactElement[] = [];\n // React.Children.map rewrites keys, forEach does not\n React.Children.forEach(model.props.children, (child, i) => {\n if (!getProp(child, \"path\")) {\n children.push(child);\n } else {\n children.push(resetPath(child, `${path}.${i}`));\n }\n });\n const pathPropName = model.props[\"data-path\"] ? \"data-path\" : \"path\";\n return React.cloneElement(\n model,\n { [pathPropName]: path, ...additionalProps },\n children\n );\n}\n", "import { ReactElement } from 'react';\nimport { LayoutModel } from '../layout-reducer';\n\nconst NO_PROPS = {};\nexport const getProp = (component: LayoutModel, propName: string) => {\n const props = getProps(component);\n return props[propName] ?? props[`data-${propName}`];\n};\n\nexport const getProps = (component?: LayoutModel) => component?.props || component || NO_PROPS;\n\n// Used when a container is expected to have a single child\nexport const getChildProp = (container: LayoutModel) => {\n const props = getProps(container);\n if (props.children) {\n const {\n children: [target, ...rest]\n } = props;\n if (rest.length > 0) {\n console.warn(`getChild expected a single child, found ${rest.length + 1}`);\n }\n return target as ReactElement;\n }\n};\n", "import { ReactElement } from 'react';\nimport { LayoutModel, WithType } from '../layout-reducer';\n\n//TODO this should throw if we cannot identify a type\nexport function typeOf(element?: LayoutModel | WithType): string | undefined {\n if (element) {\n const type = element.type as any;\n if (typeof type === 'function' || typeof type === 'object') {\n const elementName = type.displayName || type.name || type.type?.name;\n if (typeof elementName === 'string') {\n return elementName;\n }\n } else if (typeof element.type === 'string') {\n return element.type;\n } else if (element.constructor) {\n return (element.constructor as any).displayName as string;\n }\n throw Error(`typeOf unable to determine type of element`);\n }\n}\n\nexport const isTypeOf = (element: ReactElement, type: string) => typeOf(element) === type;\n", "import React from 'react';\nimport { LayoutJSON } from '../layout-reducer';\nimport { ComponentRegistry } from '../registry/ComponentRegistry';\n\nexport function componentFromLayout(layoutModel: LayoutJSON) {\n\n const { id, type, props, children: layoutChildren } = layoutModel;\n const ReactType = getComponentType(type);\n let children =\n !layoutChildren || layoutChildren.length === 0\n ? null\n : layoutChildren.length === 1\n ? componentFromLayout(layoutChildren[0])\n : layoutChildren.map(componentFromLayout);\n\n return (\n <ReactType {...props} key={id}>\n {children}\n </ReactType>\n );\n}\n\n// support for built-in react ttpes (div etc) removed here\nfunction getComponentType(type: string) {\n const reactType = ComponentRegistry[type];\n if (reactType === undefined){\n throw Error('componentFromLayout: unknown component type: ' + type);\n }\n return reactType;\n}\n", "import { MutableRefObject } from \"react\";\n\nexport function setRef<T>(\n ref:\n | MutableRefObject<T | null>\n | ((instance: T | null) => void)\n | null\n | undefined,\n value: T | null\n): void {\n if (typeof ref === \"function\") {\n ref(value);\n } else if (ref) {\n ref.current = value;\n }\n}\n", "import { ReactElement } from \"react\";\nimport { getProps, typeOf } from \"../utils\";\nimport { isContainer } from \"../registry/ComponentRegistry\";\nimport { LayoutModel } from \"../layout-reducer\";\nimport { DragDropRect, DropPos, RelativePosition } from \"./dragDropTypes\";\nimport { rect } from \"../common-types\";\n\nexport var positionValues = {\n north: 1,\n east: 2,\n south: 4,\n west: 8,\n header: 16,\n centre: 32,\n absolute: 64,\n};\n\nexport const RelativeDropPosition = {\n AFTER: \"after\" as RelativePosition,\n BEFORE: \"before\" as RelativePosition,\n};\n\nexport var Position = Object.freeze({\n North: _position(\"north\"),\n East: _position(\"east\"),\n South: _position(\"south\"),\n West: _position(\"west\"),\n Header: _position(\"header\"),\n Centre: _position(\"centre\"),\n Absolute: _position(\"absolute\"),\n});\n\nfunction _position(str: keyof typeof positionValues) {\n return Object.freeze({\n offset:\n str === \"north\" || str === \"west\"\n ? 0\n : str === \"south\" || str === \"east\"\n ? 1\n : NaN,\n valueOf: function () {\n return positionValues[str];\n },\n toString: function () {\n return str;\n },\n North: str === \"north\",\n South: str === \"south\",\n East: str === \"east\",\n West: str === \"west\",\n Header: str === \"header\",\n Centre: str === \"centre\",\n NorthOrSouth: str === \"north\" || str === \"south\",\n EastOrWest: str === \"east\" || str === \"west\",\n NorthOrWest: str === \"north\" || str === \"west\",\n SouthOrEast: str === \"east\" || str === \"south\",\n Absolute: str === \"absolute\",\n });\n}\n\nvar NORTH = Position.North,\n SOUTH = Position.South,\n EAST = Position.East,\n WEST = Position.West,\n HEADER = Position.Header,\n CENTRE = Position.Centre;\n\nexport interface Measurements {\n [key: string]: DragDropRect;\n}\n\nexport class BoxModel {\n //TODO we should accept initial let,top offsets here\n // if dropTargets are supplied, we will only allow drop operations directly on these targets\n // TODO we will need to make this more flexible e.g allowing drop anywhere within these target\n static measure(\n model: ReactElement,\n dropTargetPaths: string[] = []\n ): Measurements {\n var measurements: Measurements = {};\n measureRootComponent(model, measurements, dropTargetPaths);\n return measurements;\n }\n\n static allBoxesContainingPoint(\n layout: LayoutModel,\n measurements: Measurements,\n x: number,\n y: number,\n validDropTargets?: string[]\n ) {\n return allBoxesContainingPoint(\n layout,\n measurements,\n x,\n y,\n validDropTargets\n ).reverse();\n }\n}\n\nexport function pointPositionWithinRect(\n x: number,\n y: number,\n rect: DragDropRect,\n borderZone = 30\n) {\n const width = rect.right - rect.left;\n const height = rect.bottom - rect.top;\n const posX = x - rect.left;\n const posY = y - rect.top;\n let closeToTheEdge = 0;\n\n if (posX < borderZone) closeToTheEdge += 8;\n if (posX > width - borderZone) closeToTheEdge += 2;\n if (posY < borderZone) closeToTheEdge += 1;\n if (posY > height - borderZone) closeToTheEdge += 4;\n\n return { pctX: posX / width, pctY: posY / height, closeToTheEdge };\n}\n\nexport function getPosition(\n x: number,\n y: number,\n rect: DragDropRect,\n targetOrientation?: \"row\" | \"column\"\n): DropPos {\n const { BEFORE, AFTER } = RelativeDropPosition;\n const { pctX, pctY, closeToTheEdge } = pointPositionWithinRect(x, y, rect);\n let position;\n let tab;\n\n if (targetOrientation === \"row\") {\n position = pctX < 0.5 ? WEST : EAST;\n } else if (rect.header && containsPoint(rect.header, x, y)) {\n position = HEADER;\n\n if (rect.Stack) {\n const tabCount = rect.Stack.length;\n if (tabCount === 0) {\n tab = {\n index: -1,\n left: rect.left,\n positionRelativeToTab: AFTER,\n width: 0,\n };\n } else {\n //TODO account for gaps between tabs\n const targetTab = rect.Stack.find(\n ({ left, right }) => x >= left && x <= right\n );\n if (targetTab) {\n const tabWidth = targetTab.right - targetTab.left;\n tab = {\n index: rect.Stack.indexOf(targetTab),\n left: targetTab.left,\n positionRelativeToTab:\n (x - targetTab.left) / tabWidth < 0.5 ? BEFORE : AFTER,\n width: tabWidth,\n };\n } else {\n const lastTab = rect.Stack[tabCount - 1];\n tab = {\n left: lastTab.right,\n width: 0,\n index: tabCount,\n positionRelativeToTab: AFTER,\n };\n }\n }\n } else if (rect.header.titleWidth) {\n const tabWidth = rect.header.titleWidth;\n tab = {\n index: -1,\n left: rect.left,\n positionRelativeToTab:\n (x - rect.left) / tabWidth < 0.5 ? BEFORE : AFTER,\n width: tabWidth,\n };\n } else {\n tab = {\n left: rect.left,\n width: 0,\n positionRelativeToTab: BEFORE,\n index: -1,\n };\n }\n } else {\n position = getPositionWithinBox(x, y, rect, pctX, pctY);\n }\n\n return { position: position!, x, y, closeToTheEdge, tab };\n}\n\nfunction getPositionWithinBox(\n x: number,\n y: number,\n rect: DragDropRect,\n pctX: number,\n pctY: number\n) {\n const centerBox = getCenteredBox(rect, 0.2);\n if (containsPoint(centerBox, x, y)) {\n return CENTRE;\n } else {\n const quadrant = `${pctY < 0.5 ? \"north\" : \"south\"}${\n pctX < 0.5 ? \"west\" : \"east\"\n }`;\n\n switch (quadrant) {\n case \"northwest\":\n return pctX > pctY ? NORTH : WEST;\n case \"northeast\":\n return 1 - pctX > pctY ? NORTH : EAST;\n case \"southeast\":\n return pctX > pctY ? EAST : SOUTH;\n case \"southwest\":\n return 1 - pctX > pctY ? WEST : SOUTH;\n default:\n }\n }\n}\n\nfunction getCenteredBox(\n { right, left, top, bottom }: DragDropRect,\n pctSize: number\n) {\n const pctOffset = (1 - pctSize) / 2;\n const w = (right - left) * pctOffset;\n const h = (bottom - top) * pctOffset;\n return { left: left + w, top: top + h, right: right - w, bottom: bottom - h };\n}\n\nfunction measureRootComponent(\n rootComponent: ReactElement,\n measurements: Measurements,\n dropTargets: any[]\n) {\n const {\n id,\n \"data-path\": dataPath,\n path = dataPath,\n } = getProps(rootComponent);\n const type = typeOf(rootComponent) as string;\n\n if (id && path) {\n const [rect, el] = measureComponentDomElement(rootComponent);\n measureComponent(rootComponent, rect, el, measurements);\n if (isContainer(type)) {\n collectChildMeasurements(rootComponent, measurements, dropTargets);\n }\n }\n}\n\nfunction measureComponent(\n component: LayoutModel,\n rect: DragDropRect,\n el: HTMLElement,\n measurements: Measurements\n) {\n const {\n \"data-path\": dataPath,\n path = dataPath,\n header,\n } = getProps(component);\n\n measurements[path] = rect;\n\n const type = typeOf(component);\n if (header || type === \"Stack\") {\n const headerEl = el.querySelector(\".vuuHeader\");\n if (headerEl) {\n const { top, left, right, bottom } = headerEl.getBoundingClientRect();\n measurements[path].header = {\n top: Math.round(top),\n left: Math.round(left),\n right: Math.round(right),\n bottom: Math.round(bottom),\n };\n if (type === \"Stack\") {\n measurements[path].Stack = Array.from(\n headerEl.querySelectorAll(\".saltTab\")\n )\n .map((tab) => tab.getBoundingClientRect())\n .map(({ left, right }) => ({ left, right }));\n } else {\n const titleEl = headerEl.querySelector('[class^=\"vuuHeader-title\"]');\n const { header } = measurements[path];\n if (titleEl && header) {\n header.titleWidth = titleEl.clientWidth;\n }\n }\n }\n }\n\n return measurements[path];\n}\n\nfunction collectChildMeasurements(\n component: LayoutModel,\n measurements: Measurements,\n dropTargets: string[],\n preX = 0,\n posX = 0,\n preY = 0,\n posY = 0\n) {\n const {\n children,\n \"data-path\": dataPath,\n path = dataPath,\n style,\n active = 0,\n } = getProps(component);\n\n const type = typeOf(component);\n const isFlexbox = type === \"Flexbox\";\n const isStack = type === \"Stack\";\n const isTower = isFlexbox && style.flexDirection === \"column\";\n const isTerrace = isFlexbox && style.flexDirection === \"row\";\n\n const childrenToMeasure = isStack\n ? children.filter((_child: ReactElement, idx: number) => idx === active)\n : children.filter(omitDragging);\n\n type measuredTuple = [DragDropRect, HTMLElement, ReactElement];\n // Collect all the measurements in first pass ...\n const childMeasurements: measuredTuple[] = childrenToMeasure.map(\n (child: ReactElement) => {\n const [rect, el] = measureComponentDomElement(child);\n\n return [\n {\n ...rect,\n top: rect.top - preY,\n right: rect.right + posX,\n bottom: rect.bottom + posY,\n left: rect.left - preX,\n },\n el,\n child,\n ];\n }\n );\n\n // ...so that, in the second pass, we can identify gaps ...\n const expandedMeasurements = childMeasurements.map(\n ([rect, el, child], i, all) => {\n // generate a 'local' splitter adjustment for children adjacent to splitters\n let localPreX;\n let localPosX;\n let localPreY;\n let localPosY;\n let gapPre;\n let gapPos;\n const n = all.length - 1;\n if (isTerrace) {\n gapPre = i === 0 ? 0 : rect.left - all[i - 1][0].right;\n gapPos = i === n ? 0 : all[i + 1][0].left - rect.right;\n // we don't need to divide the leading gap, as half the gap will\n // already have been assigned to the preceeding child in the\n // previous loop iteration.\n localPreX = i === 0 ? 0 : gapPre === 0 ? 0 : gapPre;\n localPosX = i === n ? 0 : gapPos === 0 ? 0 : gapPos - gapPos / 2;\n rect.left -= localPreX;\n rect.right += localPosX;\n localPreY = preY;\n localPosY = posY;\n } else if (isTower) {\n gapPre = i === 0 ? 0 : rect.top - all[i - 1][0].bottom;\n gapPos = i === n ? 0 : all[i + 1][0].top - rect.bottom;\n // we don't need to divide the leading gap, as half the gap will\n // already have been assigned to the preceeding child in the\n // previous loop iteration.\n localPreY = i === 0 ? 0 : gapPre === 0 ? 0 : gapPre;\n localPosY = i === n ? 0 : gapPos === 0 ? 0 : gapPos - gapPos / 2;\n rect.top -= localPreY;\n rect.bottom += localPosY;\n localPreX = preX;\n localPosX = posX;\n }\n\n const componentMeasurements = measureComponent(\n child,\n rect,\n el,\n measurements\n );\n\n const childType = typeOf(child) as string;\n if (isContainer(childType)) {\n collectChildMeasurements(\n child,\n measurements,\n dropTargets,\n localPreX,\n localPosX,\n localPreY,\n localPosY\n );\n }\n return componentMeasurements;\n }\n );\n if (childMeasurements.length) {\n measurements[path].children = expandedMeasurements;\n }\n}\n\nfunction omitDragging(component: ReactElement) {\n const { id } = getProps(component);\n const el = document.getElementById(id);\n if (el) {\n return el.dataset.dragging !== \"true\";\n } else {\n console.warn(`BoxModel: no element found with id #${id}`);\n return false;\n }\n}\n\nfunction measureComponentDomElement(\n component: LayoutModel\n): [DragDropRect, HTMLElement, LayoutModel] {\n const { id } = getProps(component);\n const type = typeOf(component) as string;\n const el = document.getElementById(id);\n if (!el) {\n throw Error(`No DOM for ${type} ${id}`);\n }\n // Note: height and width are not required for dropTarget identification, but\n // are used in sizing calculations on drop\n let { top, left, right, bottom, height, width } = el.getBoundingClientRect();\n let scrolling = undefined;\n if (isContainer(type)) {\n const scrollHeight = el.scrollHeight;\n if (scrollHeight > height) {\n scrolling = { id, scrollHeight, scrollTop: el.scrollTop };\n }\n }\n return [\n {\n top: Math.round(top),\n left: Math.round(left),\n right: Math.round(right),\n bottom: Math.round(bottom),\n height: Math.round(height),\n width: Math.round(width),\n scrolling,\n },\n el,\n component,\n ];\n}\n\nfunction allBoxesContainingPoint(\n component: LayoutModel,\n measurements: Measurements,\n x: number,\n y: number,\n dropTargets?: string[],\n boxes: LayoutModel[] = []\n): LayoutModel[] {\n const {\n children,\n \"data-path\": dataPath,\n path = dataPath,\n } = getProps(component);\n\n const type = typeOf(component) as string;\n var rect = measurements[path];\n if (!containsPoint(rect, x, y)) return boxes;\n\n if (dropTargets && dropTargets.length) {\n if (dropTargets.includes(path)) {\n boxes.push(component);\n } else if (\n dropTargets.some((dropTargetPath) => dropTargetPath.startsWith(path))\n ) {\n // keep going\n } else {\n return boxes;\n }\n } else {\n boxes.push(component);\n }\n\n if (!isContainer(type)) {\n return boxes;\n }\n\n if (rect.header && containsPoint(rect.header, x, y)) {\n return boxes;\n }\n\n if (rect.scrolling) {\n scrollIntoViewIfNeccesary(rect, x, y);\n }\n\n for (var i = 0; i < children.length; i++) {\n if (type === \"Stack\" && component.props.active !== i) {\n continue;\n }\n const nestedBoxes = allBoxesContainingPoint(\n children[i],\n measurements,\n x,\n y,\n dropTargets\n );\n if (nestedBoxes.length) {\n return boxes.concat(nestedBoxes);\n }\n }\n return boxes;\n}\n\nfunction containsPoint(rect: rect, x: number, y: number) {\n if (rect) {\n return x >= rect.left && x < rect.right && y >= rect.top && y < rect.bottom;\n }\n}\n\nfunction scrollIntoViewIfNeccesary(\n { top, bottom, scrolling }: DragDropRect,\n x: number,\n y: number\n) {\n if (scrolling) {\n const { id, scrollTop, scrollHeight } = scrolling;\n const height = bottom - top;\n if (scrollTop === 0 && bottom - y < 50) {\n const scrollMax = scrollHeight - height;\n const el = document.getElementById(id) as HTMLElement;\n el.scrollTo({ left: 0, top: scrollMax, behavior: \"smooth\" });\n scrolling.scrollTop = scrollMax;\n } else if (scrollTop > 0 && y - top < 50) {\n const el = document.getElementById(id) as HTMLElement;\n el.scrollTo({ left: 0, top: 0, behavior: \"smooth\" });\n scrolling.scrollTop = 0;\n } else {\n return false;\n }\n } else {\n return false;\n }\n}\n", "import { rect } from '../common-types';\nimport { Measurements, pointPositionWithinRect } from './BoxModel';\nimport { DragDropRect } from './dragDropTypes';\n\nvar SCALE_FACTOR = 0.4;\n\nexport type IntrinsicSizes = {\n height?: number;\n width?: number;\n};\n\ninterface ZoneRange {\n hi: number;\n lo: number;\n}\ntype DragConstraint = {\n zone: {\n x: ZoneRange;\n y: ZoneRange;\n };\n pos: {\n x: ZoneRange;\n y: ZoneRange;\n };\n mouse: {\n x: ZoneRange;\n y: ZoneRange;\n };\n};\n\ninterface ExtendedZoneRange {\n lo: boolean;\n hi: boolean;\n mousePct: number;\n mousePos: number;\n pos: number;\n}\n\nexport class DragState {\n public constraint!: DragConstraint;\n public x!: ExtendedZoneRange;\n public y!: ExtendedZoneRange;\n public intrinsicSize: IntrinsicSizes | undefined;\n\n constructor(\n zone: DragDropRect,\n mouseX: number,\n mouseY: number,\n measurements: DragDropRect,\n intrinsicSize?: IntrinsicSizes\n ) {\n this.init(zone, mouseX, mouseY, measurements, intrinsicSize);\n }\n\n init(\n zone: DragDropRect,\n mouseX: number,\n mouseY: number,\n rect: DragDropRect,\n intrinsicSize?: IntrinsicSizes\n ) {\n var { left: x, top: y } = rect;\n\n var { pctX, pctY } = pointPositionWithinRect(mouseX, mouseY, rect);\n\n // We are applying a scale factor of 0.4 to the draggee. This is purely a visual\n // effect - the actual box size remains the original size. The 'leading' values\n // represent the difference between the visual scaled down box and the actual box.\n\n var scaleFactor = SCALE_FACTOR;\n\n var leadX = pctX * rect.width;\n var trailX = rect.width - leadX;\n var leadY = pctY * rect.height;\n var trailY = rect.height - leadY;\n\n // When we assign position to rect using css. positioning units are applied to the\n // unscaled shape, so we have to adjust values to take scaling into account.\n var scaledWidth = rect.width * scaleFactor,\n scaledHeight = rect.height * scaleFactor;\n\n var scaleDiff = 1 - scaleFactor;\n var leadXScaleDiff = leadX * scaleDiff;\n var leadYScaleDiff = leadY * scaleDiff;\n var trailXScaleDiff = trailX * scaleDiff;\n var trailYScaleDiff = trailY * scaleDiff;\n\n this.intrinsicSize = intrinsicSize;\n\n this.constraint = {\n zone: {\n x: {\n lo: zone.left,\n hi: zone.right\n },\n y: {\n lo: zone.top,\n hi: zone.bottom\n }\n },\n\n pos: {\n x: {\n lo: /* left */ zone.left - leadXScaleDiff,\n hi: /* right */ zone.right - rect.width + trailXScaleDiff\n },\n y: {\n lo: /* top */ zone.top - leadYScaleDiff,\n hi: /* bottom */ zone.bottom - rect.height + trailYScaleDiff\n }\n },\n mouse: {\n x: {\n lo: /* left */ zone.left + scaledWidth * pctX,\n hi: /* right */ zone.right - scaledWidth * (1 - pctX)\n },\n y: {\n lo: /* top */ zone.top + scaledHeight * pctY,\n hi: /* bottom */ zone.bottom - scaledHeight * (1 - pctY)\n }\n }\n };\n\n // onsole.log(`DragState: constraint ${JSON.stringify(this.constraint, null, 2)}`);\n\n this.x = {\n pos: x,\n lo: false,\n hi: false,\n mousePos: mouseX,\n mousePct: pctX\n };\n this.y = {\n pos: y,\n lo: false,\n hi: false,\n mousePos: mouseY,\n mousePct: pctY\n };\n }\n\n outOfBounds() {\n return this.x.lo || this.x.hi || this.y.lo || this.y.hi;\n }\n\n inBounds() {\n return !this.outOfBounds();\n }\n\n dropX() {\n return this.dropXY('x');\n }\n\n dropY() {\n return this.dropXY('y');\n }\n\n hasIntrinsicSize(): number | undefined {\n return this?.intrinsicSize?.height && this?.intrinsicSize?.width;\n }\n\n /*\n * diff = mouse movement, signed int\n * xy = 'x' or 'y'\n */\n //todo, diff can be calculated in here\n update(xy: 'x' | 'y', mousePos: number) {\n var state = this[xy],\n mouseConstraint = this.constraint.mouse[xy],\n posConstraint = this.constraint.pos[xy],\n previousPos = state.pos;\n\n var diff = mousePos - state.mousePos;\n\n //xy==='x' && console.log(`update: state.lo=${state.lo}, mPos=${mousePos}, mC.lo=${mouseConstraint.lo}, prevPos=${previousPos}, diff=${diff} ` );\n\n if (diff < 0) {\n if (state.lo) {\n /* do nothing */\n } else if (mousePos < mouseConstraint.lo) {\n state.lo = true;\n state.pos = posConstraint.lo;\n } else if (state.hi) {\n if (mousePos < mouseConstraint.hi) {\n state.hi = false;\n state.pos += diff;\n }\n } else {\n state.pos += diff;\n }\n } else if (diff > 0) {\n if (state.hi) {\n /* do nothing */\n } else if (mousePos > mouseConstraint.hi) {\n state.hi = true;\n state.pos = posConstraint.hi;\n } else if (state.lo) {\n if (mousePos > mouseConstraint.lo) {\n state.lo = false;\n state.pos += diff;\n }\n } else {\n state.pos += diff;\n }\n }\n\n state.mousePos = mousePos;\n\n return previousPos !== state.pos;\n }\n\n private dropXY(this: DragState, dir: 'x' | 'y') {\n var pos = this[dir],\n rect = this.constraint.zone[dir];\n // why not do the rounding +/- 1 on the rect initially - this is all it is usef for\n return pos.lo\n ? Math.max(rect.lo, pos.mousePos)\n : pos.hi\n ? Math.min(pos.mousePos, Math.round(rect.hi) - 1)\n : pos.mousePos;\n }\n}\n", "import {\n BoxModel,\n positionValues,\n getPosition,\n Position,\n RelativeDropPosition,\n Measurements,\n} from \"./BoxModel\";\nimport { getProps, typeOf } from \"../utils\";\nimport { DragDropRect, DropPos, DropPosTab } from \"./dragDropTypes\";\nimport { LayoutModel } from \"../layout-reducer\";\nimport { DragState } from \"./DragState\";\nimport { rect, rectTuple } from \"../common-types\";\n\nexport const isTabstrip = (dropTarget: DropTarget) =>\n dropTarget.pos.tab &&\n typeOf(dropTarget.component) === \"Stack\" &&\n dropTarget.pos.position.Header;\n\nconst { north, south, east, west } = positionValues;\nconst eastwest = east + west;\nconst northsouth = north + south;\n\nexport interface DropTargetProps {\n component: LayoutModel;\n pos: DropPos;\n clientRect: DragDropRect;\n nextDropTarget: DropTarget | null;\n}\n\nexport type GuideLine = [\n number,\n number,\n number,\n number,\n number,\n number,\n number,\n number\n];\nexport interface TargetDropOutline {\n l: number;\n r: number;\n t: number;\n b: number;\n tabLeft?: number;\n tabWidth?: number;\n tabHeight?: number;\n guideLines?: GuideLine;\n}\n\nexport class DropTarget {\n private active: boolean;\n\n public box: any;\n public clientRect: DragDropRect;\n public component: LayoutModel;\n public dropRect: rectTuple | undefined;\n public nextDropTarget: DropTarget | null;\n public pos: DropPos;\n\n constructor({\n component,\n pos,\n clientRect /*, closeToTheEdge*/,\n nextDropTarget,\n }: DropTargetProps) {\n this.component = component;\n this.pos = pos;\n this.clientRect = clientRect;\n this.nextDropTarget = nextDropTarget;\n this.active = false;\n this.dropRect = undefined;\n }\n\n targetTabPos(tab: DropPosTab) {\n const { left: tabLeft, width: tabWidth, positionRelativeToTab } = tab;\n return positionRelativeToTab === RelativeDropPosition.BEFORE\n ? tabLeft\n : tabLeft + tabWidth;\n }\n\n /**\n * Determine what will be rendered by the dropTargetRenderer\n *\n * @param {*} lineWidth\n * @param {*} dragState\n * @returns {l, t, r, b, tabLeft, tabWidth, tabHeight}\n */\n getTargetDropOutline(\n lineWidth: number,\n dragState?: DragState\n ): TargetDropOutline {\n if (this.pos.tab) {\n return this.getDropTabOutline(lineWidth, this.pos.tab);\n } else if (dragState && dragState.hasIntrinsicSize()) {\n return this.getIntrinsicDropRect(dragState);\n } else {\n const [l, t, r, b] = this.getDropRectOutline(\n lineWidth,\n dragState\n ) as rectTuple;\n return { l, t, r, b };\n }\n }\n\n getDropTabOutline(lineWidth: number, tab: DropPosTab): TargetDropOutline {\n const {\n clientRect: { top, left, right, bottom, header },\n } = this;\n\n const inset = 0;\n const gap = Math.round(lineWidth / 2) + inset;\n\n const t = Math.round(top);\n const l = Math.round(left + gap);\n const r = Math.round(right - gap);\n const b = Math.round(bottom - gap);\n const tabLeft = this.targetTabPos(tab);\n const tabWidth = 60; // should really measure text\n const tabHeight = header!.bottom - header!.top;\n return { l, t, r, b, tabLeft, tabWidth, tabHeight };\n }\n\n getIntrinsicDropRect(dragState: DragState): TargetDropOutline {\n const { pos, clientRect: rect } = this;\n\n let { x, y } = dragState;\n\n let height = dragState.intrinsicSize?.height ?? 0;\n let width = dragState.intrinsicSize?.height ?? 0;\n\n if (height && height > rect.height) {\n console.log(`DropTarget: we're going to blow the gaff`);\n height = rect.height;\n } else if (width && width > rect.width) {\n console.log(`DropTarget: we're going to blow the gaff`);\n width = rect.width;\n }\n\n const left = Math.min(\n rect.right - width,\n Math.max(rect.left, Math.round(pos.x - x.mousePct * width))\n );\n const top = Math.min(\n rect.bottom - height,\n Math.max(rect.top, Math.round(pos.y - y.mousePct * height))\n );\n const [l, t, r, b] = (this.dropRect = [\n left,\n top,\n left + width,\n top + height,\n ]);\n\n const guideLines: GuideLine = pos.position.EastOrWest\n ? [l, rect.top, l, rect.bottom, r, rect.top, r, rect.bottom]\n : [rect.left, t, rect.right, t, rect.left, b, rect.right, b];\n\n return { l, r, t, b, guideLines };\n }\n\n /**\n * @returns [left, top, right, bottom]\n */\n getDropRectOutline(lineWidth: number, dragState?: DragState) {\n const { pos, clientRect: rect } = this;\n const { width: suggestedWidth, height: suggestedHeight, position } = pos;\n\n const { width: intrinsicWidth, height: intrinsicHeight } =\n dragState?.intrinsicSize ?? {};\n const sizeHeight = intrinsicHeight ?? suggestedHeight ?? 0;\n const sizeWidth = intrinsicWidth ?? suggestedWidth ?? 0;\n\n this.dropRect = undefined;\n\n const { top: t, left: l, right: r, bottom: b } = rect;\n\n const inset = 0;\n const gap = Math.round(lineWidth / 2) + inset;\n\n switch (position) {\n case Position.North:\n case Position.Header: {\n const halfHeight = Math.round((b - t) / 2);\n const height = sizeHeight\n ? Math.min(halfHeight, Math.round(sizeHeight))\n : halfHeight;\n return sizeWidth && l + sizeWidth < r\n ? [l + gap, t + gap, l + sizeWidth - gap, t + gap + height] // need flex direction indicator\n : [l + gap, t + gap, r - gap, t + gap + height];\n }\n case Position.West: {\n const halfWidth = Math.round((r - l) / 2);\n const width = sizeWidth\n ? Math.min(halfWidth, Math.round(sizeWidth))\n : halfWidth;\n return sizeHeight && t + sizeHeight < b\n ? [l + gap, t + gap, l - gap + width, t + sizeHeight + gap] // need flex direction indicator\n : [l + gap, t + gap, l - gap + width, b - gap];\n }\n case Position.East: {\n const halfWidth = Math.round((r - l) / 2);\n const width = sizeWidth\n ? Math.min(halfWidth, Math.round(sizeWidth))\n : halfWidth;\n return sizeHeight && t + sizeHeight < b\n ? [r - gap - width, t + gap, r - gap, t + sizeHeight + gap] // need flex direction indicator\n : [r - gap - width, t + gap, r - gap, b - gap];\n }\n case Position.South: {\n const halfHeight = Math.round((b - t) / 2);\n const height = sizeHeight\n ? Math.min(halfHeight, Math.round(sizeHeight))\n : halfHeight;\n\n return sizeWidth && l + sizeWidth < r\n ? [l + gap, b - gap - height, l + sizeWidth - gap, b - gap] // need flex direction indicator\n : [l + gap, b - gap - height, r - gap, b - gap];\n }\n case Position.Centre: {\n return [l + gap, t + gap, r - gap, b - gap];\n }\n default:\n console.warn(`DropTarget does not recognize position ${position}`);\n return null;\n }\n }\n\n activate() {\n this.active = true;\n return this;\n }\n\n toArray(this: DropTarget) {\n let dropTarget: DropTarget | null = this;\n const dropTargets = [dropTarget];\n // eslint-disable-next-line no-cond-assign\n while ((dropTarget = dropTarget.nextDropTarget)) {\n dropTargets.push(dropTarget);\n }\n return dropTargets;\n }\n\n static getActiveDropTarget(dropTarget: DropTarget | null): DropTarget | null {\n return dropTarget === null\n ? null\n : dropTarget?.active\n ? dropTarget\n : DropTarget.getActiveDropTarget(dropTarget.nextDropTarget);\n }\n}\n\n// Initial entry to this method is always via the app (may be it should be *on* the app)\nexport function identifyDropTarget(\n x: number,\n y: number,\n rootLayout: LayoutModel,\n measurements: Measurements,\n intrinsicSize?: number,\n validDropTargets?: string[]\n) {\n let dropTarget = null;\n\n const allBoxesContainingPoint = BoxModel.allBoxesContainingPoint(\n rootLayout,\n measurements,\n x,\n y,\n validDropTargets\n );\n\n if (allBoxesContainingPoint.length) {\n const [component, ...containers] = allBoxesContainingPoint;\n const {\n \"data-path\": dataPath,\n path = dataPath,\n \"data-row-placeholder\": isRowPlaceholder,\n } = getProps(component);\n const clientRect = measurements[path];\n const placeholderOrientation =\n intrinsicSize && isRowPlaceholder ? \"row\" : undefined;\n const pos = getPosition(x, y, clientRect, placeholderOrientation);\n const box = measurements[path];\n\n const nextDropTarget = ([nextTarget, ...targets]: LayoutModel[]):\n | DropTarget\n | undefined => {\n if (pos.position?.Header || pos.closeToTheEdge) {\n const targetPosition = getTargetPosition(\n nextTarget,\n pos,\n box,\n measurements,\n x,\n y\n );\n if (targetPosition) {\n const [containerPos, clientRect] = targetPosition;\n\n return new DropTarget({\n component: nextTarget,\n pos: containerPos,\n clientRect,\n nextDropTarget: nextDropTarget(targets) ?? null,\n });\n } else if (targets.length) {\n return nextDropTarget(targets);\n }\n }\n };\n dropTarget = new DropTarget({\n component,\n pos,\n clientRect,\n nextDropTarget: nextDropTarget(containers) ?? null,\n }).activate();\n }\n\n return dropTarget;\n}\n\nfunction getTargetPosition(\n container: LayoutModel,\n { closeToTheEdge, position }: DropPos,\n box: rect,\n measurements: Measurements,\n x: number,\n y: number\n): [DropPos, DragDropRect] | undefined {\n if (!container || container.type === \"DraggableLayout\") {\n return;\n }\n\n const containingBox = measurements[container.props.path];\n const closeToTop = closeToTheEdge & positionValues.north;\n const closeToRight = closeToTheEdge & positionValues.east;\n const closeToBottom = closeToTheEdge & positionValues.south;\n const closeToLeft = closeToTheEdge & positionValues.west;\n\n const atTop =\n (closeToTop || position.Header) &&\n Math.round(box.top) === Math.round(containingBox.top);\n const atRight =\n closeToRight && Math.round(box.right) === Math.round(containingBox.right);\n const atBottom =\n closeToBottom &&\n Math.round(box.bottom) === Math.round(containingBox.bottom);\n const atLeft =\n closeToLeft && Math.round(box.left) === Math.round(containingBox.left);\n\n if (atTop || atRight || atBottom || atLeft) {\n const { \"data-path\": dataPath, path = dataPath } = container.props;\n const clientRect = measurements[path];\n const containerPos = getPosition(x, y, clientRect);\n\n // if its a VBox and we're close to left or right ...\n if (\n (isVBox(container) || isTabbedContainer(container)) &&\n closeToTheEdge & eastwest\n ) {\n containerPos.width = 120;\n return [containerPos, clientRect];\n }\n // if it's a HBox and we're close to top or bottom ...\n else if (\n (isHBox(container) || isTabbedContainer(container)) &&\n (position.Header || closeToTheEdge & northsouth)\n ) {\n containerPos.height = 120;\n return [containerPos, clientRect];\n }\n }\n}\n\nfunction isTabbedContainer(component: LayoutModel) {\n return typeOf(component) === \"Stack\";\n}\n\nfunction isVBox(component: LayoutModel) {\n return (\n typeOf(component) === \"Flexbox\" &&\n component.props.style.flexDirection === \"column\"\n );\n}\n\nfunction isHBox(component: LayoutModel) {\n return (\n typeOf(component) === \"Flexbox\" &&\n component.props.style.flexDirection === \"row\"\n );\n}\n", "import cx from \"classnames\";\nimport React, { createElement, useEffect, useRef } from \"react\";\nimport ReactDOM from \"react-dom\";\nimport { renderPortal } from \"../portal\";\n\nimport \"./popup-service.css\";\n// TODO what !\nwindow.popupReact = React;\n\nlet _dialogOpen = false;\nconst _popups = [];\n\nfunction specialKeyHandler(e) {\n if (e.keyCode === 27 /* ESC */) {\n if (_popups.length) {\n closeAllPopups();\n } else if (_dialogOpen) {\n ReactDOM.unmountComponentAtNode(\n document.body.querySelector(\".vuuDialog\")\n );\n }\n }\n}\n\nfunction outsideClickHandler(e) {\n if (_popups.length) {\n // onsole.log(`Popup.outsideClickHandler`);\n const popupContainers = document.body.querySelectorAll(\".vuuPopup\");\n for (let i = 0; i < popupContainers.length; i++) {\n if (popupContainers[i].contains(e.target)) {\n return;\n }\n }\n closeAllPopups();\n }\n}\n\nfunction closeAllPopups() {\n if (_popups.length) {\n // onsole.log(`closeAllPopups`);\n const popupContainers = document.body.querySelectorAll(\".vuuPopup\");\n for (let i = 0; i < popupContainers.length; i++) {\n ReactDOM.unmountComponentAtNode(popupContainers[i]);\n }\n popupClosed(\"*\");\n }\n}\n\nfunction dialogOpened() {\n if (_dialogOpen === false) {\n _dialogOpen = true;\n window.addEventListener(\"keydown\", specialKeyHandler, true);\n }\n}\n\nfunction dialogClosed() {\n if (_dialogOpen) {\n _dialogOpen = false;\n window.removeEventListener(\"keydown\", specialKeyHandler, true);\n }\n}\n\nfunction popupOpened(name /*, group*/) {\n if (_popups.indexOf(name) === -1) {\n _popups.push(name);\n //onsole.log('PopupService, popup opened ' + name + ' popups : ' + _popups);\n if (_dialogOpen === false) {\n window.addEventListener(\"keydown\", specialKeyHandler, true);\n window.addEventListener(\"click\", outsideClickHandler, true);\n }\n }\n}\n\nfunction popupClosed(name /*, group=null*/) {\n if (_popups.length) {\n if (name === \"*\") {\n _popups.length = 0;\n } else {\n const pos = _popups.indexOf(name);\n if (pos !== -1) {\n _popups.splice(pos, 1);\n }\n }\n //onsole.log('PopupService, popup closed ' + name + ' popups : ' + _popups);\n if (_popups.length === 0 && _dialogOpen === false) {\n window.removeEventListener(\"keydown\", specialKeyHandler, true);\n window.removeEventListener(\"click\", outsideClickHandler, true);\n }\n }\n}\n\nconst PopupComponent = ({ children, position, style }) => {\n const className = cx(\"hwPopup\", \"hwPopupContainer\", position);\n return createElement(\"div\", { className, style }, children);\n};\n\nlet incrementingKey = 1;\n\nexport class PopupService {\n static showPopup({\n name = \"anon\",\n group = \"all\",\n position = \"\",\n left = 0,\n right = \"auto\",\n top = 0,\n width = \"auto\",\n component,\n }) {\n if (!component) {\n throw Error(`PopupService showPopup, no component supplied`);\n }\n popupOpened(name, group);\n let el = document.body.querySelector(\".vuuPopup.\" + group);\n if (el === null) {\n el = document.createElement(\"div\");\n el.className = \"vuuPopup \" + group;\n document.body.appendChild(el);\n }\n\n const style = { width };\n\n renderPortal(\n createElement(\n PopupComponent,\n { key: incrementingKey++, position, style },\n component\n ),\n el,\n left,\n top,\n () => {\n PopupService.keepWithinThePage(el, right);\n }\n );\n }\n\n static hidePopup(name = \"anon\", group = \"all\") {\n //onsole.log('PopupService.hidePopup name=' + name + ', group=' + group)\n\n if (_popups.indexOf(name) !== -1) {\n popupClosed(name, group);\n ReactDOM.unmountComponentAtNode(\n document.body.querySelector(`.vuuPopup.${group}`)\n );\n }\n }\n\n static keepWithinThePage(el, right = \"auto\") {\n const target = el.querySelector(\".vuuPopupContainer > *\");\n if (target) {\n const {\n top,\n left,\n width,\n height,\n right: currentRight,\n } = target.getBoundingClientRect();\n\n const w = window.innerWidth;\n const h = window.innerHeight;\n\n const overflowH = h - (top + height);\n if (overflowH < 0) {\n target.style.top = parseInt(top, 10) + overflowH + \"px\";\n }\n\n const overflowW = w - (left + width);\n if (overflowW < 0) {\n target.style.left = parseInt(left, 10) + overflowW + \"px\";\n }\n\n if (typeof right === \"number\" && right !== currentRight) {\n const adjustment = right - currentRight;\n target.style.left = left + adjustment + \"px\";\n }\n }\n }\n}\n\nexport class DialogService {\n static showDialog(dialog) {\n const containerEl = \".vuuDialog\";\n const onClose = dialog.props.onClose;\n\n dialogOpened();\n\n ReactDOM.render(\n React.cloneElement(dialog, {\n container: containerEl,\n onClose: () => {\n DialogService.closeDialog();\n if (onClose) {\n onClose();\n }\n },\n }),\n document.body.querySelector(containerEl)\n );\n }\n\n static closeDialog() {\n dialogClosed();\n ReactDOM.unmountComponentAtNode(document.body.querySelector(\".vuuDialog\"));\n }\n}\n\nexport const Popup = (props) => {\n const pendingTask = useRef(null);\n const ref = useRef(null);\n\n const show = (props, boundingClientRect) => {\n const { name, group, depth, width } = props;\n let left, top;\n\n if (pendingTask.current) {\n clearTimeout(pendingTask.current);\n pendingTask.current = null;\n }\n\n if (props.close === true) {\n PopupService.hidePopup(name, group);\n } else {\n const { position, children: component } = props;\n const {\n left: targetLeft,\n top: targetTop,\n width: clientWidth,\n bottom: targetBottom,\n } = boundingClientRect;\n\n if (position === \"below\") {\n left = targetLeft;\n top = targetBottom;\n } else if (position === \"above\") {\n left = targetLeft;\n top = targetTop;\n }\n\n pendingTask.current = setTimeout(() => {\n PopupService.showPopup({\n name,\n group,\n depth,\n position,\n left,\n top,\n width: width || clientWidth,\n component,\n });\n }, 10);\n }\n };\n\n useEffect(() => {\n if (ref.current) {\n const el = ref.current.parentElement;\n const boundingClientRect = el.getBoundingClientRect();\n //onsole.log(`%cPopup.componentDidMount about to call show`,'color:green');\n show(props, boundingClientRect);\n }\n\n return () => {\n PopupService.hidePopup(props.name, props.group);\n };\n }, [props]);\n\n return React.createElement(\"div\", { className: \"popup-proxy\", ref });\n\n // componentWillReceiveProps(nextProps) {\n\n // const domNode = ReactDOM.findDOMNode(this);\n // if (domNode) {\n // const el = domNode.parentElement;\n // const boundingClientRect = el.getBoundingClientRect();\n // //onsole.log(`%cPopup.componentWillReceiveProps about to call show`,'color:green');\n // this.show(nextProps, boundingClientRect);\n // }\n // }\n};\n", "import cx from \"classnames\";\nimport { HTMLAttributes } from \"react\";\nimport { DropTarget } from \"./DropTarget\";\n\nimport \"./DropMenu.css\";\n\nexport function computeMenuPosition(\n dropTarget: DropTarget,\n offsetTop = 0,\n offsetLeft = 0\n): [number, number, \"left\" | \"bottom\" | \"right\" | \"top\"] {\n const { pos, clientRect: box } = dropTarget;\n const menuOffset = 20;\n\n return pos.position.West\n ? [box.left - offsetLeft + menuOffset, pos.y - offsetTop, \"left\"]\n : pos.position.South\n ? [pos.x - offsetLeft, box.bottom - offsetTop - menuOffset, \"bottom\"]\n : pos.position.East\n ? [box.right - offsetLeft - menuOffset, pos.y - offsetTop, \"right\"]\n : /* North | Header*/ [\n pos.x - offsetLeft,\n box.top - offsetTop + menuOffset,\n \"top\",\n ];\n}\n\nconst classBase = \"vuuDropMenu\";\n\nexport interface DropMenuProps extends HTMLAttributes<HTMLDivElement> {\n dropTarget: DropTarget;\n onHover: (target: DropTarget | null) => void;\n orientation?: \"left\" | \"top\" | \"right\" | \"bottom\";\n}\n\nexport const DropMenu = ({\n className,\n dropTarget,\n onHover,\n orientation,\n}: DropMenuProps) => {\n const dropTargets = dropTarget.toArray();\n // TODO we have all the information here to draw a mini target map\n // but maybe thats overkill ...\n\n return (\n <div\n className={cx(classBase, className, `${classBase}-${orientation}`)}\n onMouseLeave={() => onHover(null)}\n >\n {dropTargets.map((target, i) => (\n <div\n key={i}\n className={`${classBase}-item`}\n data-icon={i === 0 ? \"column-2A\" : \"column-2B\"}\n onMouseEnter={() => onHover(target)}\n />\n ))}\n </div>\n );\n};\n", "import { PopupService } from \"../../../vuu-popups/src/popup\";\nimport { RelativeDropPosition } from \"./BoxModel\";\nimport { DragDropRect } from \"./dragDropTypes\";\nimport { DragState } from \"./DragState\";\nimport { computeMenuPosition, DropMenu } from \"./DropMenu\";\nimport { DropTarget, GuideLine } from \"./DropTarget\";\n\nimport \"./DropTargetRenderer.css\";\n\ntype Point = [number, number];\ntype TabMode = \"full-view\" | \"tab-only\";\n\nlet _multiDropOptions = false;\nlet _hoverDropTarget: DropTarget | null = null;\nlet _shiftedTab: HTMLElement | null = null;\n\nconst onHoverDropTarget = (dropTarget: DropTarget | null) =>\n (_hoverDropTarget = dropTarget);\n\nconst start = ([x, y]: Point) => `M${x},${y}`;\nconst point = ([x, y]: Point) => `L${x},${y}`;\nconst pathFromPoints = ([p1, ...points]: Point[]) =>\n `${start(p1)} ${points.map(point)}Z`;\n\nconst pathFromGuideLines = (guideLines?: GuideLine) => {\n if (guideLines) {\n const [x1, y1, x2, y2, x3, y3, x4, y4] = guideLines;\n return `M${x1},${y1} L${x2},${y2} M${x3},${y3} L${x4},${y4}`;\n } else {\n return \"\";\n }\n};\n\nfunction insertSVGRoot() {\n if (document.getElementById(\"hw-drag-canvas\") === null) {\n const root = document.getElementById(\"root\");\n const container = document.createElement(\"div\");\n container.id = \"hw-drag-canvas\";\n container.innerHTML = `\n <svg width=\"100%\" height=\"100%\">\n <path id=\"hw-drop-guides\" />\n <path\n id=\"vuu-drop-outline\"\n d=\"M300,132 L380,132 L380,100 L460,100 L460,132, L550,132 L550,350 L300,350z\">\n <animate\n attributeName=\"d\"\n id=\"hw-drop-outline-animate\"\n begin=\"indefinite\"\n dur=\"300ms\"\n fill=\"freeze\"\n to=\"M255,33 L255,33,L255,1,L315,1,L315,1,L794,1,L794,164,L255,164Z\"\n />\n </path>\n </svg>\n `;\n document.body.insertBefore(container, root);\n }\n}\nexport default class DropTargetCanvas {\n private currentPath: string | null = null;\n private tabMode: TabMode | null = null;\n\n constructor() {\n insertSVGRoot();\n }\n\n prepare(dragRect: DragDropRect, tabMode: TabMode = \"full-view\") {\n // don't do this on body\n document.body.classList.add(\"drawing\");\n this.currentPath = null;\n this.tabMode = tabMode;\n\n const points = this.getPoints(0, 0, 0, 0);\n // const points = this.getPoints(left, top, width, height);\n const d = pathFromPoints(points);\n\n const dropOutlinePath = document.getElementById(\"vuu-drop-outline\");\n dropOutlinePath?.setAttribute(\"d\", d);\n this.currentPath = d;\n }\n\n clear() {\n // don't do this on body\n _hoverDropTarget = null;\n clearShiftedTab();\n document.body.classList.remove(\"drawing\");\n PopupService.hidePopup();\n }\n\n get hoverDropTarget() {\n return _hoverDropTarget;\n }\n\n getPoints(\n x: number,\n y: number,\n width: number,\n height: number,\n tabLeft = 0,\n tabWidth = 0,\n tabHeight = 0\n ): Point[] {\n const tabOnly = this.tabMode === \"tab-only\";\n if (tabWidth === 0) {\n return [\n [x, y + tabHeight],\n [x, y + tabHeight],\n [x, y],\n [x + tabWidth, y],\n [x + tabWidth, y],\n [x + width, y],\n [x + width, y + height],\n [x, y + height],\n ];\n } else if (tabOnly) {\n const left = tabLeft;\n return [\n [left, y],\n [left, y],\n [left + tabWidth, y],\n [left + tabWidth, y],\n [left + tabWidth, y + tabHeight],\n [left + tabWidth, y + tabHeight],\n [left, y + tabHeight],\n [left, y + tabHeight],\n ];\n } else if (tabLeft === 0) {\n return [\n [x, y + tabHeight],\n [x, y + tabHeight],\n [x, y],\n [x + tabWidth, y],\n [x + tabWidth, y + tabHeight],\n [x + width, y + tabHeight],\n [x + width, y + height],\n [x, y + height],\n ];\n } else {\n return [\n [x, y + tabHeight],\n [x + tabLeft, y + tabHeight],\n [x + tabLeft, y],\n [x + tabLeft, y],\n [x + tabLeft, y + tabHeight],\n [x + width, y + tabHeight],\n [x + width, y + height],\n [x, y + height],\n ];\n }\n }\n\n draw(dropTarget: DropTarget, dragState: DragState) {\n const sameDropTarget = false;\n const wasMultiDrop = _multiDropOptions;\n\n if (_hoverDropTarget !== null) {\n this.drawTarget(_hoverDropTarget);\n } else {\n if (sameDropTarget === false) {\n _multiDropOptions = dropTarget.nextDropTarget != null;\n if (dropTarget.pos.tab) {\n moveExistingTabs(dropTarget);\n } else if (_shiftedTab) {\n clearShiftedTab();\n }\n this.drawTarget(dropTarget, dragState);\n }\n\n if (_multiDropOptions) {\n const [left, top, orientation] = computeMenuPosition(dropTarget);\n if (!wasMultiDrop || !sameDropTarget) {\n const component = (\n <DropMenu\n dropTarget={dropTarget}\n onHover={onHoverDropTarget}\n orientation={orientation}\n />\n );\n PopupService.showPopup({\n left,\n top,\n component,\n });\n } else {\n PopupService.movePopupTo(left, top);\n }\n } else {\n PopupService.hidePopup();\n }\n }\n }\n\n drawTarget(dropTarget: DropTarget, dragState?: DragState) {\n const lineWidth = 6;\n\n const targetDropOutline = dropTarget.getTargetDropOutline(\n lineWidth,\n dragState\n );\n\n if (targetDropOutline) {\n const { l, t, r, b, tabLeft, tabWidth, tabHeight, guideLines } =\n targetDropOutline;\n const w = r - l;\n const h = b - t;\n\n if (this.currentPath) {\n const path = document.getElementById(\"vuu-drop-outline\");\n path?.setAttribute(\"d\", this.currentPath);\n }\n\n const points = this.getPoints(l, t, w, h, tabLeft, tabWidth, tabHeight);\n const path = pathFromPoints(points);\n const animation = document.getElementById(\n \"hw-drop-outline-animate\"\n ) as unknown as SVGAnimateElement;\n animation?.setAttribute(\"to\", path);\n animation?.beginElement();\n this.currentPath = path;\n\n const dropGuidePath = document.getElementById(\"hw-drop-guides\");\n dropGuidePath?.setAttribute(\"d\", pathFromGuideLines(guideLines));\n }\n }\n}\n\nconst cssShiftRight = \"transition:margin-left .4s ease-out;margin-left: 63px\";\nconst cssShiftBack = \"transition:margin-left .4s ease-out;margin-left: 0px\";\n\nfunction moveExistingTabs(dropTarget: DropTarget) {\n const { AFTER, BEFORE } = RelativeDropPosition;\n const {\n clientRect: { Stack },\n pos: {\n // tab: { index: tabIndex, positionRelativeToTab }\n tab,\n },\n } = dropTarget;\n\n const { id } = dropTarget.component.props;\n let tabEl = null;\n // console.log(`tabPos = ${tabPos} (width=${tabWidth}) x=${x}`)\n if (Stack && tab && tab.positionRelativeToTab !== AFTER) {\n const tabOffset = tab.positionRelativeToTab === BEFORE ? 1 : 2;\n const selector = `:scope .hwTabstrip > .hwTabstrip-inner > .hwTab:nth-child(${\n tab.index + tabOffset\n })`;\n tabEl = document.getElementById(id)?.querySelector(selector) as HTMLElement;\n if (tabEl) {\n if (_shiftedTab === null || _shiftedTab !== tabEl) {\n tabEl.style.cssText = cssShiftRight;\n if (_shiftedTab) {\n _shiftedTab.style.cssText = cssShiftBack;\n }\n _shiftedTab = tabEl;\n }\n } else {\n clearShiftedTab();\n }\n } else if (tab?.positionRelativeToTab === BEFORE) {\n if (_shiftedTab === null) {\n const selector = \".vuuHeader-title\";\n tabEl = document\n .getElementById(id)\n ?.querySelector(selector) as HTMLElement;\n tabEl.style.cssText = cssShiftRight;\n _shiftedTab = tabEl;\n }\n } else {\n clearShiftedTab();\n }\n}\n\nfunction clearShiftedTab() {\n if (_shiftedTab) {\n _shiftedTab.style.cssText = cssShiftBack;\n _shiftedTab = null;\n }\n}\n", "import { ReactElement } from \"react\";\nimport { rect } from \"../common-types\";\nimport { LayoutModel } from \"../layout-reducer\";\nimport { findTarget, followPath, getProps } from \"../utils\";\nimport { BoxModel, Measurements, Position } from \"./BoxModel\";\nimport { DragDropRect } from \"./dragDropTypes\";\nimport { DragState, IntrinsicSizes } from \"./DragState\";\nimport { DropTarget, identifyDropTarget } from \"./DropTarget\";\nimport DropTargetRenderer from \"./DropTargetRenderer\";\n\nexport type DragStartCallback = (e: MouseEvent, x: number, y: number) => void;\nexport type DragMoveCallback = (\n x: number | undefined,\n y: number | undefined\n) => void;\nexport type DragEndCallback = (droppedTarget: Partial<DropTarget>) => void;\nexport type DragInstructions = {\n DoNotRemove?: boolean;\n DoNotTransform?: boolean;\n dragThreshold?: number;\n RemoveDraggableOnDragEnd?: boolean;\n};\n\nlet _dragStartCallback: DragStartCallback | null;\nlet _dragMoveCallback: DragMoveCallback | null;\nlet _dragEndCallback: DragEndCallback | null;\n\nlet _dragStartX: number;\nlet _dragStartY: number;\nlet _dragContainer: ReactElement | null;\nlet _dragState: DragState;\nlet _dropTarget: DropTarget | null = null;\nlet _validDropTargetPaths: string[] | null;\nlet _dragInstructions: DragInstructions;\nlet _measurements: Measurements;\nlet _simpleDrag: boolean;\nlet _dragThreshold: number;\nlet _mouseDownTimer: number | null = null;\n\nconst DEFAULT_DRAG_THRESHOLD = 3;\nconst _dropTargetRenderer = new DropTargetRenderer();\nconst SCALE_FACTOR = 0.4;\n\nfunction getDragContainer(\n rootContainer: ReactElement,\n dragContainerPath: string\n) {\n if (dragContainerPath) {\n return followPath(rootContainer, dragContainerPath) as ReactElement;\n } else {\n return findTarget(\n rootContainer,\n (props) => props.dropTarget\n ) as ReactElement;\n }\n}\n\nexport const Draggable = {\n handleMousedown(\n e: MouseEvent,\n dragStartCallback: DragStartCallback,\n dragInstructions: DragInstructions = {}\n ) {\n _dragStartCallback = dragStartCallback;\n _dragInstructions = dragInstructions;\n\n _dragStartX = e.clientX;\n _dragStartY = e.clientY;\n\n _dragThreshold =\n dragInstructions.dragThreshold === undefined\n ? DEFAULT_DRAG_THRESHOLD\n : dragInstructions.dragThreshold;\n\n if (_dragThreshold === 0) {\n // maybe this should be -1\n _dragStartCallback(e, 0, 0);\n } else {\n window.addEventListener(\"mousemove\", preDragMousemoveHandler, false);\n window.addEventListener(\"mouseup\", preDragMouseupHandler, false);\n\n _mouseDownTimer = window.setTimeout(() => {\n console.log(\"mousedownTimer fires\");\n window.removeEventListener(\"mousemove\", preDragMousemoveHandler, false);\n window.removeEventListener(\"mouseup\", preDragMouseupHandler, false);\n _dragStartCallback?.(e, 0, 0);\n }, 500);\n }\n\n e.preventDefault();\n },\n\n // called from handleDragStart (_dragCallback)\n initDrag(\n rootContainer: ReactElement,\n dragContainerPath: string,\n { top, left, right, bottom }: rect,\n dragPos: { x: number; y: number },\n dragHandler: {\n drag: DragMoveCallback;\n drop: DragEndCallback;\n },\n intrinsicSize?: IntrinsicSizes,\n dropTargets?: string[]\n ) {\n ({ drag: _dragMoveCallback, drop: _dragEndCallback } = dragHandler);\n return initDrag(\n rootContainer,\n dragContainerPath,\n { top, left, right, bottom } as DragDropRect,\n dragPos,\n intrinsicSize,\n dropTargets\n );\n },\n};\n\nfunction preDragMousemoveHandler(e: MouseEvent) {\n var x = true;\n var y = true;\n\n let x_diff = x ? e.clientX - _dragStartX : 0;\n let y_diff = y ? e.clientY - _dragStartY : 0;\n let mouseMoveDistance = Math.max(Math.abs(x_diff), Math.abs(y_diff));\n\n // when we do finally move the draggee, we are going to 'jump' by the amount of the drag threshold, should we\n // attempt to animate this ?\n if (mouseMoveDistance > _dragThreshold) {\n window.removeEventListener(\"mousemove\", preDragMousemoveHandler, false);\n window.removeEventListener(\"mouseup\", preDragMouseupHandler, false);\n _dragStartCallback?.(e, x_diff, y_diff);\n _dragStartCallback = null;\n }\n}\n\nfunction preDragMouseupHandler() {\n if (_mouseDownTimer) {\n window.clearTimeout(_mouseDownTimer);\n _mouseDownTimer = null;\n }\n window.removeEventListener(\"mousemove\", preDragMousemoveHandler, false);\n window.removeEventListener(\"mouseup\", preDragMouseupHandler, false);\n}\n\nfunction initDrag(\n rootContainer: ReactElement,\n dragContainerPath: string,\n dragRect: DragDropRect,\n dragPos: { x: number; y: number },\n intrinsicSize?: IntrinsicSizes,\n dropTargets?: string[]\n) {\n _dragContainer = getDragContainer(rootContainer, dragContainerPath);\n const { \"data-path\": dataPath, path = dataPath } = getProps(_dragContainer);\n\n if (dropTargets) {\n const dropPaths = dropTargets\n .map((id) => findTarget(rootContainer, (props) => props.id === id))\n .map((target) => (target as LayoutModel).props.path);\n _validDropTargetPaths = dropPaths;\n }\n\n // var start = window.performance.now();\n // translate the layout $position to drag-oriented co-ordinates, ignoring splitters\n _measurements = BoxModel.measure(_dragContainer, dropTargets);\n console.log({ _measurements });\n // onsole.log({ measurements: _measurements });\n // var end = window.performance.now();\n // onsole.log(`[Draggable] measurements took ${end - start}ms`, _measurements);\n\n const dragZone = _measurements[path];\n\n _dragState = new DragState(\n dragZone,\n dragPos.x,\n dragPos.y,\n dragRect,\n intrinsicSize\n );\n\n const pctX = Math.round(_dragState.x.mousePct * 100);\n const pctY = Math.round(_dragState.y.mousePct * 100);\n\n window.addEventListener(\"mousemove\", dragMousemoveHandler, false);\n window.addEventListener(\"mouseup\", dragMouseupHandler, false);\n\n _simpleDrag = false;\n\n _dropTargetRenderer.prepare(dragRect, \"tab-only\");\n\n return _dragInstructions.DoNotTransform\n ? \"transform:none\"\n : // scale factor should be applied in caller, not here\n `transform:scale(${SCALE_FACTOR},${SCALE_FACTOR});transform-origin:${pctX}% ${pctY}%;`;\n}\n\nfunction dragMousemoveHandler(evt: MouseEvent) {\n const x = evt.clientX;\n const y = evt.clientY;\n const dragState = _dragState;\n const currentDropTarget = _dropTarget;\n let dropTarget;\n let newX, newY;\n\n if (dragState.update(\"x\", x)) {\n newX = dragState.x.pos;\n }\n\n if (dragState.update(\"y\", y)) {\n newY = dragState.y.pos;\n }\n\n if (newX === undefined && newY === undefined) {\n //onsole.log('both x and y are unchanged');\n } else {\n _dragMoveCallback?.(newX, newY);\n }\n\n if (_simpleDrag) {\n return;\n }\n\n if (dragState.inBounds()) {\n dropTarget = identifyDropTarget(\n x,\n y,\n _dragContainer!,\n _measurements,\n dragState.hasIntrinsicSize(),\n _validDropTargetPaths!\n );\n } else {\n dropTarget = identifyDropTarget(\n dragState.dropX(),\n dragState.dropY(),\n _dragContainer!,\n _measurements\n );\n }\n\n // did we have an existing droptarget which is no longer such ...\n if (currentDropTarget) {\n if (dropTarget == null || dropTarget.box !== currentDropTarget.box) {\n _dropTarget = null;\n }\n }\n\n if (dropTarget) {\n _dropTargetRenderer.draw(dropTarget, dragState);\n _dropTarget = dropTarget;\n }\n}\n\nfunction dragMouseupHandler() {\n onDragEnd();\n}\n\nfunction onDragEnd() {\n if (_dropTarget) {\n const dropTarget =\n _dropTargetRenderer.hoverDropTarget ||\n DropTarget.getActiveDropTarget(_dropTarget);\n\n _dragEndCallback?.(dropTarget as DropTarget);\n\n _dropTarget = null;\n } else {\n _dragEndCallback?.({\n component: _dragContainer!,\n pos: { position: Position.Absolute } as any,\n });\n }\n\n _dragMoveCallback = null;\n _dragEndCallback = null;\n\n _dragContainer = null;\n _dropTargetRenderer.clear();\n _validDropTargetPaths = null;\n window.removeEventListener(\"mousemove\", dragMousemoveHandler, false);\n window.removeEventListener(\"mouseup\", dragMouseupHandler, false);\n}\n", "import { useForkRef } from \"@salt-ds/core\";\nimport cx from \"classnames\";\nimport { CSSProperties, ForwardedRef, forwardRef } from \"react\";\nimport { FlexboxProps } from \"./flexboxTypes\";\nimport { useSplitterResizing } from \"./useSplitterResizing\";\n\nimport \"./Flexbox.css\";\n\nconst classBase = \"hwFlexbox\";\n\nconst Flexbox = forwardRef(function Flexbox(\n props: FlexboxProps,\n ref: ForwardedRef<HTMLDivElement>\n) {\n const {\n breakPoints,\n children,\n // cols: colsProp,\n column,\n className: classNameProp,\n flexFill,\n gap,\n fullPage,\n id,\n onSplitterMoved,\n resizeable,\n row,\n spacing,\n splitterSize,\n style,\n ...rest\n } = props;\n\n const { content, rootRef } = useSplitterResizing({\n children,\n // cols: colsProp,\n onSplitterMoved,\n style,\n });\n\n const className = cx(classBase, classNameProp, {\n [`${classBase}-column`]: column,\n [`${classBase}-row`]: row,\n \"flex-fill\": flexFill,\n \"full-page\": fullPage,\n });\n\n return (\n <div\n {...rest}\n className={className}\n // data-cols={cols}\n data-resizeable={resizeable || undefined}\n id={id}\n ref={useForkRef(rootRef, ref)}\n style={\n {\n ...style,\n gap,\n \"--spacing\": spacing,\n } as CSSProperties\n }\n >\n {content}\n </div>\n );\n});\nFlexbox.displayName = \"Flexbox\";\n\nexport default Flexbox;\n", "import React, {\n ReactElement,\n useCallback,\n useMemo,\n useRef,\n useState,\n} from \"react\";\nimport { getUniqueId } from \"@vuu-ui/vuu-utils\";\nimport { Splitter } from \"./Splitter\";\nimport { Placeholder } from \"../placeholder\";\n\nimport {\n findSplitterAndPlaceholderPositions,\n gatherChildMeta,\n identifyResizeParties,\n PLACEHOLDER,\n SPLITTER,\n} from \"./flexbox-utils\";\nimport {\n ContentMeta,\n FlexSize,\n SplitterFactory,\n SplitterHookProps,\n SplitterHookResult,\n} from \"./flexboxTypes\";\n\nconst originalContentOnly = (meta: ContentMeta) =>\n !meta.splitter && !meta.placeholder;\n\nexport const useSplitterResizing = ({\n children: childrenProp,\n onSplitterMoved,\n style,\n}: SplitterHookProps): SplitterHookResult => {\n const rootRef = useRef<HTMLDivElement>();\n const metaRef = useRef<ContentMeta[]>();\n const contentRef = useRef<ReactElement[]>();\n const assignedKeys = useRef([]);\n const [, forceUpdate] = useState({});\n\n const setContent = (content: ReactElement[]) => {\n contentRef.current = content;\n forceUpdate({});\n };\n\n const isColumn = style?.flexDirection === \"column\";\n const dimension = isColumn ? \"height\" : \"width\";\n const children = useMemo(\n () =>\n Array.isArray(childrenProp)\n ? childrenProp\n : React.isValidElement(childrenProp)\n ? [childrenProp]\n : [],\n [childrenProp]\n );\n\n const handleDragStart = useCallback(\n (index) => {\n const { current: contentMeta } = metaRef;\n if (contentMeta) {\n const [participants, bystanders] = identifyResizeParties(\n contentMeta,\n index\n );\n if (participants) {\n participants.forEach((index) => {\n const el = rootRef.current?.childNodes[index] as HTMLElement;\n if (el) {\n const { size, minSize } = measureElement(el, dimension);\n contentMeta[index].currentSize = size;\n contentMeta[index].minSize = minSize;\n }\n });\n if (bystanders) {\n bystanders.forEach((index) => {\n const el = rootRef.current?.childNodes[index] as HTMLElement;\n if (el) {\n const { [dimension]: size } = el.getBoundingClientRect();\n contentMeta[index].flexBasis = size;\n }\n });\n }\n }\n }\n },\n [dimension]\n );\n\n const handleDrag = useCallback(\n (idx, distance) => {\n if (contentRef.current && metaRef.current) {\n setContent(\n resizeContent(\n contentRef.current,\n metaRef.current,\n distance,\n dimension\n )\n );\n }\n },\n [dimension]\n );\n\n const handleDragEnd = useCallback(() => {\n const contentMeta = metaRef.current;\n if (contentMeta) {\n onSplitterMoved?.(contentMeta.filter(originalContentOnly));\n }\n contentMeta?.forEach((meta) => {\n meta.currentSize = undefined;\n meta.flexBasis = undefined;\n meta.flexOpen = false;\n });\n }, [onSplitterMoved]);\n\n const createSplitter: SplitterFactory = useCallback(\n (i) => {\n return React.createElement(Splitter, {\n column: isColumn,\n index: i,\n key: `splitter-${i}`,\n onDrag: handleDrag,\n onDragEnd: handleDragEnd,\n onDragStart: handleDragStart,\n });\n },\n [handleDrag, handleDragEnd, handleDragStart, isColumn]\n );\n\n useMemo(() => {\n // This will always fire when Flexbox has rendered, but nor during splitter resize\n const [content, meta] = buildContent(\n children,\n dimension,\n createSplitter,\n assignedKeys.current\n );\n metaRef.current = meta;\n contentRef.current = content;\n }, [children, createSplitter, dimension]);\n\n return {\n content: contentRef.current || [],\n rootRef,\n };\n};\n\nfunction buildContent(\n children: ReactElement[],\n dimension: \"width\" | \"height\",\n createSplitter: SplitterFactory,\n keys: any[]\n): [any[], ContentMeta[]] {\n const childMeta = gatherChildMeta(children, dimension);\n const splitterAndPlaceholderPositions =\n findSplitterAndPlaceholderPositions(childMeta);\n const content = [];\n const meta: ContentMeta[] = [];\n for (let i = 0; i < children.length; i++) {\n const child = children[i];\n if (i === 0 && splitterAndPlaceholderPositions[i] & PLACEHOLDER) {\n //TODO need to assign an id to placeholder\n content.push(createPlaceholder(i));\n meta.push({ placeholder: true, shim: true });\n }\n if (child.key == null) {\n const key = keys[i] || (keys[i] = getUniqueId());\n content.push(React.cloneElement(child, { key }));\n } else {\n content.push(child);\n }\n meta.push(childMeta[i]);\n\n if (i > 0 && splitterAndPlaceholderPositions[i] & PLACEHOLDER) {\n content.push(createPlaceholder(i));\n meta.push({ placeholder: true });\n } else if (splitterAndPlaceholderPositions[i] & SPLITTER) {\n content.push(createSplitter(content.length));\n meta.push({ splitter: true });\n }\n }\n return [content, meta];\n}\n\nfunction resizeContent(\n content: ReactElement[],\n contentMeta: ContentMeta[],\n distance: number,\n dimension: \"width\" | \"height\"\n) {\n const metaUpdated = updateMeta(contentMeta, distance);\n if (!metaUpdated) {\n return content;\n }\n\n return content.map((child, idx) => {\n const meta = contentMeta[idx];\n let { currentSize, flexOpen, flexBasis } = meta;\n const hasCurrentSize = currentSize !== undefined;\n if (hasCurrentSize || flexOpen) {\n const { flexBasis: actualFlexBasis } = child.props.style || {};\n const size = hasCurrentSize ? meta.currentSize : flexBasis;\n if (size !== actualFlexBasis) {\n return React.cloneElement(child, {\n style: {\n ...child.props.style,\n flexBasis: size,\n [dimension]: \"auto\",\n },\n });\n } else {\n return child;\n }\n } else {\n return child;\n }\n });\n}\n\n//TODO detect cursor move beyond drag limit and suspend further resize until cursoe re-engages with splitter\nfunction updateMeta(contentMeta: ContentMeta[], distance: number) {\n const resizeTargets: number[] = [];\n\n contentMeta.forEach((meta, idx) => {\n if (meta.currentSize !== undefined) {\n resizeTargets.push(idx);\n }\n });\n\n // we want the target being reduced first, this may limit the distance we can apply\n let target1 = distance < 0 ? resizeTargets[0] : resizeTargets[1];\n\n const { currentSize = 0, minSize = 0 } = contentMeta[target1];\n if (currentSize === minSize) {\n // size is already 0, we cannot go further\n return false;\n } else if (Math.abs(distance) > currentSize - minSize) {\n // reduce to 0\n const multiplier = distance < 0 ? -1 : 1;\n distance = Math.max(0, currentSize - minSize) * multiplier;\n }\n\n const leadingItem = contentMeta[resizeTargets[0]] as ContentMeta;\n const { currentSize: leadingSize = 0 } = leadingItem;\n leadingItem.currentSize = leadingSize + distance;\n\n const trailingItem = contentMeta[resizeTargets[1]] as ContentMeta;\n const { currentSize: trailingSize = 0 } = trailingItem;\n trailingItem.currentSize = trailingSize - distance;\n\n return true;\n}\n\nfunction createPlaceholder(index: number) {\n return React.createElement(Placeholder, {\n shim: index === 0,\n key: `placeholder-${index}`,\n } as any);\n}\n\nfunction measureElement(\n el: HTMLElement,\n dimension: \"width\" | \"height\"\n): FlexSize {\n const { [dimension]: size } = el.getBoundingClientRect();\n const style = getComputedStyle(el);\n const minSizeVal = style.getPropertyValue(`min-${dimension}`);\n const minSize = minSizeVal.endsWith(\"px\") ? parseInt(minSizeVal, 10) : 0;\n return { size, minSize };\n}\n", "import React, { HTMLAttributes, KeyboardEvent, useCallback, useRef, useState } from 'react';\nimport cx from 'classnames';\n\nimport './Splitter.css';\n\nexport type SplitterDragStartHandler = (index: number) => void;\nexport type SplitterDragHandler = (index: number, distance: number) => void;\nexport type SplitterDragEndHandler = () => void;\n\nexport interface SplitterProps\n extends Omit<HTMLAttributes<HTMLDivElement>, 'onDrag' | 'onDragStart'> {\n column: boolean;\n index: number;\n onDragStart: SplitterDragStartHandler;\n onDrag: SplitterDragHandler;\n onDragEnd: SplitterDragEndHandler;\n}\n\nexport const Splitter = React.memo(function Splitter({\n column,\n index,\n onDrag,\n onDragEnd,\n onDragStart,\n style\n}: SplitterProps) {\n const ignoreClick = useRef<boolean>();\n const rootRef = useRef<HTMLDivElement>(null);\n const lastPos = useRef<number>(0);\n\n const [active, setActive] = useState(false);\n\n const handleKeyDownDrag = useCallback(\n ({ key, shiftKey }) => {\n // TODO calc max distance\n const distance = shiftKey ? 10 : 1;\n if (column && key === 'ArrowDown') {\n onDrag(index, distance);\n } else if (column && key === 'ArrowUp') {\n onDrag(index, -distance);\n } else if (!column && key === 'ArrowLeft') {\n onDrag(index, -distance);\n } else if (!column && key === 'ArrowRight') {\n onDrag(index, distance);\n }\n },\n [column, index, onDrag]\n );\n\n const handleKeyDownInitDrag = useCallback(\n (evt) => {\n const { key } = evt;\n const horizontalMove = key === 'ArrowLeft' || key === 'ArrowRIght';\n const verticalMove = key === 'ArrowUp' || key === 'ArrowDown';\n if ((column && verticalMove) || (!column && horizontalMove)) {\n onDragStart(index);\n handleKeyDownDrag(evt);\n keyDownHandlerRef.current = handleKeyDownDrag;\n }\n },\n [column, handleKeyDownDrag, index, onDragStart]\n );\n\n const keyDownHandlerRef = useRef(handleKeyDownInitDrag);\n const handleKeyDown = (evt: KeyboardEvent) => keyDownHandlerRef.current(evt);\n\n const handleMouseMove = useCallback(\n (e) => {\n ignoreClick.current = true;\n const pos = e[column ? 'clientY' : 'clientX'];\n const diff = pos - lastPos.current;\n // we seem to get a final value of zero\n if (pos && pos !== lastPos.current) {\n onDrag(index, diff);\n }\n lastPos.current = pos;\n },\n [column, index, onDrag]\n );\n\n const handleMouseUp = useCallback(() => {\n window.removeEventListener('mousemove', handleMouseMove, false);\n window.removeEventListener('mouseup', handleMouseUp, false);\n onDragEnd();\n setActive(false);\n rootRef.current?.focus();\n }, [handleMouseMove, onDragEnd, setActive]);\n\n const handleMouseDown = useCallback(\n (e) => {\n lastPos.current = column ? e.clientY : e.clientX;\n onDragStart(index);\n window.addEventListener('mousemove', handleMouseMove, false);\n window.addEventListener('mouseup', handleMouseUp, false);\n e.preventDefault();\n setActive(true);\n },\n [column, handleMouseMove, handleMouseUp, index, onDragStart, setActive]\n );\n\n const handleFocus = () => {\n // TODO\n };\n\n const handleClick = () => {\n if (ignoreClick.current) {\n ignoreClick.current = false;\n } else {\n rootRef.current?.focus();\n }\n };\n\n const handleBlur = () => {\n // TODO\n keyDownHandlerRef.current = handleKeyDownInitDrag;\n };\n\n const className = cx('Splitter', 'focusable', { active, column });\n return (\n <div\n className={className}\n data-splitter\n ref={rootRef}\n role=\"separator\"\n style={style}\n onBlur={handleBlur}\n onClick={handleClick}\n onFocus={handleFocus}\n onKeyDown={handleKeyDown}\n onMouseDown={handleMouseDown}\n tabIndex={0}>\n <div className=\"grab-zone\" />\n </div>\n );\n});\n", "import React, { HTMLAttributes } from \"react\";\nimport cx from \"classnames\";\nimport { registerComponent } from \"../registry/ComponentRegistry\";\n\nimport \"./Placeholder.css\";\n\nconst classBase = \"vuuPlaceholder\";\n\nexport interface PlaceholderProps extends HTMLAttributes<HTMLDivElement> {\n closeable?: boolean;\n flexFill?: boolean;\n resizeable?: boolean;\n shim?: boolean;\n}\n\nexport const Placeholder = ({\n className,\n closeable,\n flexFill,\n resizeable,\n shim,\n ...props\n}: PlaceholderProps) => {\n return (\n <div\n className={cx(classBase, className, {\n [`${classBase}-shim`]: shim,\n })}\n {...props}\n data-placeholder\n data-resizeable\n >\n {/* <LayoutProviderVersion /> */}\n </div>\n );\n};\n\nPlaceholder.displayName = \"Placeholder\";\nregisterComponent(\"Placeholder\", Placeholder);\n", "import React from \"react\";\nimport { CSSProperties, ReactElement, ReactNode } from \"react\";\nimport { uuid } from \"@vuu-ui/vuu-utils\";\nimport { ComponentRegistry } from \"../registry/ComponentRegistry\";\nimport { getProps, resetPath } from \"../utils\";\nimport { dimension, rect, rectTuple } from \"../common-types\";\nimport { DropPos } from \"../drag-drop/dragDropTypes\";\nconst placeHolderProps = { \"data-placeholder\": true, \"data-resizeable\": true };\n\nconst NO_STYLE = {};\nconst auto = \"auto\";\nconst defaultFlexStyle = {\n flexBasis: 0,\n flexGrow: 1,\n flexShrink: 1,\n height: auto,\n width: auto,\n};\n\nconst CROSS_DIMENSION = {\n height: \"width\",\n width: \"height\",\n};\n\nexport type flexDirection = \"row\" | \"column\";\n\ntype contraDimension = dimension;\ntype flexDimensionTuple = [dimension, contraDimension, flexDirection];\nexport type position = {\n height?: number;\n width?: number;\n};\n\nexport const getFlexDimensions = (flexDirection: flexDirection = \"row\") => {\n if (flexDirection === \"row\") {\n return [\"width\", \"height\", \"column\"] as flexDimensionTuple;\n } else {\n return [\"height\", \"width\", \"row\"] as flexDimensionTuple;\n }\n};\n\nconst isPercentageSize = (value: string | number) =>\n typeof value === \"string\" && value.endsWith(\"%\");\n\nexport const getIntrinsicSize = (\n component: ReactElement\n): { height?: number; width?: number } | undefined => {\n const { style: { width = auto, height = auto } = NO_STYLE } = component.props;\n\n // Eliminate 'auto' and percentage sizes\n const numHeight = typeof height === \"number\";\n const numWidth = typeof width === \"number\";\n\n if (numHeight && numWidth) {\n return { height, width };\n } else if (numHeight) {\n return { height };\n } else if (numWidth) {\n return { width };\n } else {\n return undefined;\n }\n};\n\nexport function getFlexStyle(\n component: ReactElement,\n dimension: dimension,\n pos?: DropPos\n) {\n const crossDimension = CROSS_DIMENSION[dimension];\n const {\n style: {\n [crossDimension]: intrinsicCrossSize = auto,\n ...intrinsicStyles\n } = NO_STYLE,\n } = component.props;\n\n if (pos && pos[dimension]) {\n return {\n ...intrinsicStyles,\n ...defaultFlexStyle,\n flexBasis: pos[dimension],\n flexGrow: 0,\n flexShrink: 0,\n };\n } else {\n return {\n ...intrinsicStyles,\n ...defaultFlexStyle,\n [crossDimension]: intrinsicCrossSize,\n };\n }\n}\n\n//TODO this is not comprehensive\nexport function hasUnboundedFlexStyle(component: ReactElement) {\n const { style: { flex, flexGrow, flexShrink, flexBasis } = NO_STYLE } =\n component.props;\n // console.log(`flex ${flex}, flexBasis ${flexBasis}, flexShrink ${flexShrink}, flexGrow ${flexGrow}`)\n if (typeof flex === \"number\") {\n return true;\n } else if (flexBasis === 0 && flexGrow === 1 && flexShrink === 1) {\n return true;\n } else if (typeof flexBasis === \"number\") {\n return false;\n } else {\n return true;\n }\n}\n\nexport function getFlexOrIntrinsicStyle(\n component: ReactElement,\n dimension: dimension,\n pos: position\n) {\n const crossDimension = CROSS_DIMENSION[dimension];\n const {\n style: {\n [dimension]: intrinsicSize = auto,\n [crossDimension]: intrinsicCrossSize = auto,\n ...intrinsicStyles\n } = NO_STYLE,\n } = component.props;\n\n if (intrinsicSize !== auto) {\n if (isPercentageSize(intrinsicSize)) {\n return {\n // Is this right? discrad the percenbtage size ?\n flexBasis: 0,\n flexGrow: 1,\n flexShrink: 1,\n [dimension]: undefined,\n [crossDimension]: intrinsicCrossSize,\n };\n } else {\n return {\n // or should we leave this as auto until user resizes ?\n flexBasis: intrinsicSize,\n flexGrow: 0,\n flexShrink: 0,\n [dimension]: intrinsicSize,\n [crossDimension]: intrinsicCrossSize,\n };\n }\n } else if (pos && pos[dimension]) {\n return {\n ...intrinsicStyles,\n ...defaultFlexStyle,\n flexBasis: pos[dimension],\n flexGrow: 0,\n flexShrink: 0,\n };\n } else {\n return {\n ...intrinsicStyles,\n // ...defaultFlexStyle,\n [crossDimension]: intrinsicCrossSize,\n };\n }\n}\n\nexport function wrapIntrinsicSizeComponentWithFlexbox(\n component: ReactElement,\n flexDirection: flexDirection,\n path: string,\n clientRect?: rect,\n dropRect?: rectTuple\n) {\n const wrappedChildren = [];\n let pathIndex = 0;\n let endPlaceholder;\n\n if (clientRect && dropRect) {\n let startPlaceholder;\n const [dropLeft, dropTop, dropRight, dropBottom] = dropRect;\n [startPlaceholder, endPlaceholder] =\n flexDirection === \"column\"\n ? [dropTop - clientRect.top, clientRect.bottom - dropBottom]\n : [dropLeft - clientRect.left, clientRect.right - dropRight];\n\n if (startPlaceholder) {\n wrappedChildren.push(\n createPlaceHolder(`${path}.${pathIndex++}`, startPlaceholder, {\n flexGrow: 0,\n flexShrink: 0,\n })\n );\n }\n } else {\n // If we don't pass the rect values, we are wrapping an existing child, this is always a trailing placeholder\n endPlaceholder = true;\n }\n\n const { version = 0, style } = getProps(component);\n\n wrappedChildren.push(\n resetPath(component, `${path}.${pathIndex++}`, {\n version: version + 1,\n style: {\n ...style,\n flexBasis: \"auto\",\n flexGrow: 0,\n flexShrink: 0,\n },\n })\n );\n\n if (endPlaceholder) {\n wrappedChildren.push(\n createPlaceHolder(`${path}.${pathIndex++}`, 0, undefined, {\n [`data-${flexDirection}-placeholder`]: true,\n })\n );\n }\n\n return createFlexbox(\n flexDirection,\n { resizeable: false, style: { flexBasis: \"auto\" } },\n wrappedChildren,\n path\n );\n}\n\nconst getFlexValue = (flexBasis: number, flexFill: boolean) => {\n if (flexFill) {\n return undefined;\n } else if (flexBasis === 0) {\n return 1;\n } else {\n return 0;\n }\n};\n\nexport function createFlexbox(\n flexDirection: flexDirection,\n props: any,\n children: ReactNode,\n path: string\n) {\n const id = uuid();\n const { flexFill, style, resizeable = true } = props;\n const { flexBasis = flexFill ? undefined : \"auto\" } = style;\n const flex = getFlexValue(flexBasis, flexFill);\n return React.createElement<any>(\n ComponentRegistry.Flexbox,\n {\n id,\n key: id,\n path,\n flexFill,\n style: {\n ...style,\n flexDirection,\n flexBasis,\n flexGrow: flex,\n flexShrink: flex,\n },\n resizeable,\n },\n children\n );\n}\n\nconst baseStyle = { flexGrow: 1, flexShrink: 1 };\n\nexport function createPlaceHolder(\n path: string,\n size: number,\n style?: CSSProperties,\n props?: any\n) {\n const id = uuid();\n return React.createElement(\"div\", {\n ...placeHolderProps,\n ...props,\n \"data-path\": path,\n id,\n key: id,\n style: { ...baseStyle, ...style, flexBasis: size },\n });\n}\n", "import { getProp } from '../utils';\nimport { getIntrinsicSize, hasUnboundedFlexStyle } from '../layout-reducer/flexUtils';\nimport { ReactElement } from 'react';\nimport type { BreakPoint, ContentMeta } from './flexboxTypes';\n\nconst NO_INTRINSIC_SIZE: {\n height?: number;\n width?: number;\n} = {};\n\nexport const SPLITTER = 1;\nexport const PLACEHOLDER = 2;\n\nconst isIntrinsicallySized = (item: ContentMeta) => typeof item.intrinsicSize === 'number';\n\nconst getBreakPointValues = (breakPoints: BreakPoint[], component: ReactElement) => {\n const values: { [key: string]: number | undefined } = {};\n breakPoints.forEach((breakPoint) => {\n values[breakPoint] = getProp(component, breakPoint);\n });\n return values;\n};\n\nexport const gatherChildMeta = (\n children: ReactElement[],\n dimension: 'width' | 'height',\n breakPoints?: BreakPoint[]\n) => {\n return children.map((child, index) => {\n const resizeable = getProp(child, 'resizeable');\n const { [dimension]: intrinsicSize } = getIntrinsicSize(child) ?? NO_INTRINSIC_SIZE;\n const flexOpen = hasUnboundedFlexStyle(child);\n if (breakPoints) {\n return {\n index,\n flexOpen,\n intrinsicSize,\n resizeable,\n ...getBreakPointValues(breakPoints, child)\n };\n } else {\n return { index, flexOpen, intrinsicSize, resizeable };\n }\n });\n};\n\n// Splitters are inserted AFTER the associated index, so\n// never a splitter in last position.\n// Placeholder goes before (first) OR after(last) index\nexport const findSplitterAndPlaceholderPositions = (childMeta: ContentMeta[]) => {\n const count = childMeta.length;\n const allIntrinsic = childMeta.every(isIntrinsicallySized);\n const splitterPositions = Array(count).fill(0);\n if (allIntrinsic) {\n splitterPositions[0] = PLACEHOLDER;\n splitterPositions[count - 1] = PLACEHOLDER;\n }\n if (count < 2) {\n return splitterPositions;\n } else {\n // 1) From the left, check each item.\n // Once we hit a resizable item, set this index and all subsequent indices,\n // except for last, to SPLITTER\n for (let i = 0, resizeablesLeft = 0; i < count - 1; i++) {\n if (childMeta[i].resizeable && !resizeablesLeft) {\n resizeablesLeft = SPLITTER;\n }\n splitterPositions[i] += resizeablesLeft;\n }\n // 2) Now check from the right. Undo splitter insertion until we reach a point\n // where there is a resizeable to our right.\n for (let i = count - 1; i > 0; i--) {\n if (splitterPositions[i] & SPLITTER) {\n splitterPositions[i] -= SPLITTER;\n }\n if (childMeta[i].resizeable) {\n break;\n }\n }\n return splitterPositions;\n }\n};\n\nexport const identifyResizeParties = (contentMeta: ContentMeta[], idx: number) => {\n const idx1 = getLeadingResizeablePos(contentMeta, idx);\n const idx2 = getTrailingResizeablePos(contentMeta, idx);\n const participants = idx1 !== -1 && idx2 !== -1 ? [idx1, idx2] : undefined;\n const bystanders = identifyResizeBystanders(contentMeta, participants);\n return [participants, bystanders];\n};\n\nfunction identifyResizeBystanders(contentMeta: ContentMeta[], participants?: number[]) {\n if (participants) {\n let bystanders = [];\n for (let i = 0; i < contentMeta.length; i++) {\n if (contentMeta[i].flexOpen && !participants.includes(i)) {\n bystanders.push(i);\n }\n }\n return bystanders;\n }\n}\n\nfunction getLeadingResizeablePos(contentMeta: ContentMeta[], idx: number) {\n let pos = idx,\n resizeable = false;\n while (pos >= 1 && !resizeable) {\n pos = pos - 1;\n resizeable = isResizeable(contentMeta, pos);\n }\n return pos;\n}\n\nfunction getTrailingResizeablePos(contentMeta: ContentMeta[], idx: number) {\n let pos = idx,\n resizeable = false,\n count = contentMeta.length;\n while (pos < count && !resizeable) {\n pos = pos + 1;\n resizeable = isResizeable(contentMeta, pos);\n }\n return pos === count ? -1 : pos;\n}\n\nfunction isResizeable(contentMeta: ContentMeta[], idx: number): boolean {\n const { placeholder, splitter, resizeable, intrinsicSize } = contentMeta[idx];\n return Boolean(!splitter && !intrinsicSize && (placeholder || resizeable));\n}\n", "import React, { useCallback } from 'react';\nimport Flexbox from './Flexbox';\nimport { Action } from '../layout-action';\nimport { registerComponent } from '../registry/ComponentRegistry';\nimport { useLayoutProviderDispatch } from '../layout-provider';\n\nexport const FlexboxLayout = function FlexboxLayout(props) {\n const { path } = props;\n const dispatch = useLayoutProviderDispatch();\n\n const handleSplitterMoved = useCallback(\n (sizes) => {\n dispatch({\n type: Action.SPLITTER_RESIZE,\n path,\n sizes\n });\n },\n [dispatch, path]\n );\n\n return <Flexbox {...props} onSplitterMoved={handleSplitterMoved} />;\n};\nFlexboxLayout.displayName = 'Flexbox';\n\nregisterComponent('Flexbox', FlexboxLayout, 'container');\n", "export const Action = {\n ADD: 'add',\n BLUR: 'blur',\n BLUR_SPLITTER: 'blur-splitter',\n DRAG_START: 'drag-start',\n DRAG_STARTED: 'drag-started',\n DRAG_DROP: 'drag-drop',\n FOCUS: 'focus',\n FOCUS_SPLITTER: 'focus-splitter',\n INITIALIZE: 'initialize',\n MAXIMIZE: 'maximize',\n MINIMIZE: 'minimize',\n REMOVE: 'remove',\n REPLACE: 'replace',\n RESTORE: 'restore',\n SAVE: 'save',\n SET_TITLE: 'set-title',\n SPLITTER_RESIZE: 'splitter-resize',\n SWITCH_TAB: 'switch-tab',\n TEAR_OUT: 'tear-out'\n};\n", "import React, {\n MutableRefObject,\n ReactElement,\n useCallback,\n useContext,\n useEffect,\n useRef,\n useState,\n} from \"react\";\nimport {\n LayoutActionType,\n layoutFromJson,\n LayoutJSON,\n layoutReducer,\n LayoutReducerAction,\n layoutToJSON,\n processLayoutElement,\n} from \"../layout-reducer\";\nimport { findTarget, getChildProp, getProps, typeOf } from \"../utils\";\nimport {\n LayoutProviderContext,\n LayoutProviderDispatch,\n} from \"./LayoutProviderContext\";\nimport { useLayoutDragDrop } from \"./useLayoutDragDrop\";\n\nconst withDropTarget = (props: any) => props.dropTarget;\nconst shouldSave = (action: LayoutReducerAction) =>\n [\n \"drag-drop\",\n \"remove\",\n \"set-title\",\n \"splitter-resize\",\n \"switch-tab\",\n ].includes(action.type);\n\ntype LayoutChangeHandler = (layout: LayoutJSON, source: string) => void;\n\nexport interface LayoutProviderProps {\n children: ReactElement;\n layout?: LayoutJSON;\n onLayoutChange?: LayoutChangeHandler;\n}\n\nexport const LayoutProviderVersion = () => {\n const version = useLayoutProviderVersion();\n return <div>{`Context: ${version} `}</div>;\n};\n\nexport const LayoutProvider = (props: LayoutProviderProps): ReactElement => {\n const { children, layout, onLayoutChange } = props;\n const state = useRef<ReactElement | undefined>(undefined);\n const childrenRef = useRef<ReactElement>(children);\n\n const [, forceRefresh] = useState<any>(null);\n\n const serializeState = useCallback(\n (source) => {\n if (onLayoutChange) {\n const targetContainer =\n findTarget(source, withDropTarget) || state.current;\n const isDraggableLayout = typeOf(targetContainer) === \"DraggableLayout\";\n const target = isDraggableLayout\n ? getProps(targetContainer).children[0]\n : targetContainer;\n const serializedModel = layoutToJSON(target);\n onLayoutChange(serializedModel, \"drag-root\");\n }\n },\n [onLayoutChange]\n );\n\n const dispatchLayoutAction = useCallback(\n (action: LayoutReducerAction, suppressSave = false) => {\n const nextState = layoutReducer(state.current as ReactElement, action);\n if (nextState !== state.current) {\n state.current = nextState;\n forceRefresh({});\n if (!suppressSave && shouldSave(action)) {\n serializeState(nextState);\n }\n }\n },\n [serializeState]\n );\n\n const layoutActionDispatcher: LayoutProviderDispatch = useCallback(\n (action) => {\n // onsole.log(\n // `%cdispatchLayoutProviderAction ${action.type}`,\n // \"color: blue; font-weight: bold;\"\n // );\n\n if (action.type === \"drag-start\") {\n prepareToDragLayout(action);\n } else if (action.type === \"save\") {\n serializeState(state.current);\n } else if (state.current) {\n dispatchLayoutAction(action);\n }\n },\n [dispatchLayoutAction, serializeState]\n );\n\n const prepareToDragLayout = useLayoutDragDrop(\n state as MutableRefObject<ReactElement>,\n layoutActionDispatcher\n );\n\n useEffect(() => {\n if (layout) {\n const targetContainer = findTarget(\n state.current as any,\n withDropTarget\n ) as ReactElement;\n const target = getChildProp(targetContainer);\n const newLayout = layoutFromJson(\n layout,\n `${targetContainer.props.path}.0`\n );\n const action = target\n ? {\n type: LayoutActionType.REPLACE,\n target,\n replacement: newLayout,\n }\n : {\n type: LayoutActionType.ADD,\n path: targetContainer.props.path,\n component: newLayout,\n };\n dispatchLayoutAction(action, true);\n }\n }, [dispatchLayoutAction, layout]);\n\n if (state.current === undefined) {\n state.current = processLayoutElement(children);\n } else if (children !== childrenRef.current) {\n state.current = processLayoutElement(children, state.current);\n childrenRef.current = children;\n }\n\n return (\n <LayoutProviderContext.Provider\n value={{ dispatchLayoutProvider: layoutActionDispatcher, version: 0 }}\n >\n {state.current}\n </LayoutProviderContext.Provider>\n );\n};\n\nexport const useLayoutProviderDispatch = () => {\n const { dispatchLayoutProvider } = useContext(LayoutProviderContext);\n return dispatchLayoutProvider;\n};\n\nexport const useLayoutProviderVersion = () => {\n console.log({ LayoutProviderContext });\n const { version } = useContext(LayoutProviderContext);\n return version;\n};\n", "import React, { ReactElement } from \"react\";\nimport { isContainer } from \"../registry/ComponentRegistry\";\nimport {\n findTarget,\n followPath,\n followPathToParent,\n getProp,\n getProps,\n typeOf,\n} from \"../utils\";\nimport { getIntrinsicSize } from \"./flexUtils\";\nimport {\n getInsertTabBeforeAfter,\n insertBesideChild,\n insertIntoContainer,\n} from \"./insert-layout-element\";\nimport {\n AddAction,\n DragDropAction,\n LayoutReducerAction,\n LayoutActionType,\n SetTitleAction,\n SwitchTabAction,\n MaximizeAction,\n} from \"./layoutTypes\";\nimport { LayoutProps } from \"./layoutUtils\";\nimport { removeChild } from \"./remove-layout-element\";\nimport {\n replaceChild,\n swapChild,\n _replaceChild,\n} from \"./replace-layout-element\";\nimport { resizeFlexChildren } from \"./resize-flex-children\";\nimport { wrap } from \"./wrap-layout-element\";\nimport { DropPos } from \"../drag-drop/dragDropTypes\";\nimport { DropTarget } from \"../drag-drop/DropTarget\";\n\n// const handlers: Handlers = {\n// [Action.MAXIMIZE]: setChildProps,\n// [Action.MINIMIZE]: setChildProps,\n// [Action.RESTORE]: setChildProps,\n// };\n\nexport const layoutReducer = (\n state: ReactElement,\n action: LayoutReducerAction\n): ReactElement => {\n switch (action.type) {\n case LayoutActionType.ADD:\n return addChild(state, action);\n case LayoutActionType.DRAG_DROP:\n return dragDrop(state, action);\n case LayoutActionType.MAXIMIZE:\n return setChildProps(state, action);\n case LayoutActionType.REMOVE:\n return removeChild(state, action);\n case LayoutActionType.REPLACE:\n return replaceChild(state, action);\n case LayoutActionType.SET_TITLE:\n return setTitle(state, action);\n case LayoutActionType.SPLITTER_RESIZE:\n return resizeFlexChildren(state, action);\n case LayoutActionType.SWITCH_TAB:\n return switchTab(state, action);\n default:\n console.warn(\n `layoutActionHandlers. No handler for action.type ${\n (action as any).type\n }`\n );\n return state;\n }\n};\n\nfunction switchTab(state: ReactElement, { path, nextIdx }: SwitchTabAction) {\n var target = followPath(state, path, true);\n const replacement = React.cloneElement<any>(target, {\n active: nextIdx,\n });\n return swapChild(state, target, replacement);\n}\n\nfunction setTitle(state: ReactElement, { path, title }: SetTitleAction) {\n var target = followPath(state, path, true);\n const replacement = React.cloneElement(target, {\n title,\n });\n return swapChild(state, target, replacement);\n}\n\nfunction setChildProps(state: ReactElement, { path, type }: MaximizeAction) {\n if (path) {\n // path will always be set here. Need to distinguisj ViewAction from LayoutAction\n var target = followPath(state, path, true);\n return swapChild(state, target, target, type);\n } else {\n return state;\n }\n}\n\nfunction dragDrop(\n layoutRoot: ReactElement,\n action: DragDropAction\n): ReactElement {\n console.log(\"drag drop\");\n const {\n draggedReactElement: newComponent,\n dragInstructions,\n dropTarget,\n } = action;\n const existingComponent = dropTarget.component as ReactElement;\n const { pos } = dropTarget;\n const destinationTabstrip =\n pos?.position?.Header && typeOf(existingComponent) === \"Stack\";\n const { id, version } = getProps(newComponent);\n const intrinsicSize = getIntrinsicSize(newComponent);\n let newLayoutRoot: ReactElement;\n if (destinationTabstrip) {\n const [targetTab, insertionPosition] = getInsertTabBeforeAfter(\n existingComponent!,\n pos\n );\n if (targetTab === undefined) {\n newLayoutRoot = insertIntoContainer(\n layoutRoot,\n existingComponent,\n newComponent\n );\n } else {\n newLayoutRoot = insertBesideChild(\n layoutRoot,\n targetTab,\n newComponent,\n insertionPosition\n );\n }\n } else if (!intrinsicSize && pos?.position?.Centre) {\n newLayoutRoot = _replaceChild(\n layoutRoot,\n existingComponent as ReactElement,\n newComponent\n );\n } else {\n newLayoutRoot = dropLayoutIntoContainer(\n layoutRoot,\n dropTarget as DropTarget,\n newComponent\n );\n }\n\n // return newLayoutRoot\n\n if (dragInstructions.DoNotRemove) {\n return newLayoutRoot;\n } else {\n const finalTarget = findTarget(\n newLayoutRoot,\n (props: LayoutProps) => props.id === id && props.version === version\n ) as ReactElement;\n const finalPath = getProp(finalTarget, \"path\");\n return removeChild(newLayoutRoot, { path: finalPath, type: \"remove\" });\n }\n}\n\nfunction addChild(\n layoutRoot: ReactElement,\n { path: containerPath, component }: AddAction\n) {\n return insertIntoContainer(\n layoutRoot,\n followPath(layoutRoot, containerPath) as ReactElement,\n component\n );\n}\n\nfunction dropLayoutIntoContainer(\n layoutRoot: ReactElement,\n dropTarget: DropTarget,\n newComponent: ReactElement\n): ReactElement {\n const {\n component: existingComponent,\n pos,\n clientRect,\n dropRect,\n } = dropTarget;\n const existingComponentPath = getProp(existingComponent, \"path\");\n // In a Draggable layout, 0.n is the top-level layout\n if (\n /* existingComponent.path === '0.0' || */ existingComponentPath === \"0.0\"\n ) {\n return wrap(layoutRoot, existingComponent, newComponent, pos);\n } else {\n var targetContainer = followPathToParent(\n layoutRoot,\n existingComponentPath\n ) as ReactElement;\n\n if (withTheGrain(pos, targetContainer)) {\n const insertionPosition = pos.position.SouthOrEast ? \"after\" : \"before\";\n return insertBesideChild(\n layoutRoot,\n existingComponent,\n newComponent,\n insertionPosition,\n pos,\n clientRect,\n dropRect\n );\n } else if (!withTheGrain(pos, targetContainer)) {\n return wrap(\n layoutRoot,\n existingComponent,\n newComponent,\n pos,\n clientRect,\n dropRect\n );\n } else if (isContainer(typeOf(targetContainer) as string)) {\n return wrap(layoutRoot, existingComponent, newComponent, pos);\n } else {\n throw Error(`no support right now for position = ${pos.position}`);\n }\n }\n\n return layoutRoot;\n}\n\n// Note: withTheGrain is not the negative of againstTheGrain - the difference lies in the\n// handling of non-Flexible containers, the response for which is always false;\nfunction withTheGrain(pos: DropPos, container: ReactElement) {\n if (pos.position.Centre) {\n return isTerrace(container) || isTower(container);\n }\n\n return pos.position.NorthOrSouth\n ? isTower(container)\n : pos.position.EastOrWest\n ? isTerrace(container)\n : false;\n}\n\nfunction isTower(container: ReactElement) {\n return (\n typeOf(container) === \"Flexbox\" &&\n container.props.style.flexDirection === \"column\"\n );\n}\n\nfunction isTerrace(container: ReactElement) {\n return (\n typeOf(container) === \"Flexbox\" &&\n container.props.style.flexDirection !== \"column\"\n );\n}\n", "import React, { ReactElement } from \"react\";\nimport { uuid } from \"@vuu-ui/vuu-utils\";\nimport { getManagedDimension, LayoutProps } from \"./layoutUtils\";\nimport { getProp, getProps, nextStep, resetPath, typeOf } from \"../utils\";\nimport {\n createPlaceHolder,\n flexDirection,\n getFlexDimensions,\n getFlexOrIntrinsicStyle,\n getIntrinsicSize,\n wrapIntrinsicSizeComponentWithFlexbox,\n} from \"./flexUtils\";\nimport { LayoutModel, LayoutRoot } from \"./layoutTypes\";\nimport { DropPos } from \"../drag-drop\";\nimport { DropTarget } from \"../drag-drop/DropTarget\";\nimport { rectTuple } from \"../common-types\";\n\ntype insertionPosition = \"before\" | \"after\";\n\nexport function getInsertTabBeforeAfter(stack: LayoutModel, pos: DropPos) {\n const tabs = stack.props.children;\n const tabCount = tabs.length;\n const { index = -1, positionRelativeToTab = \"after\" } = pos.tab || {};\n return index === -1 || index >= tabCount\n ? [tabs[tabCount - 1], \"after\"]\n : [tabs[index] ?? null, positionRelativeToTab];\n}\n\nexport function insertIntoContainer(\n container: ReactElement,\n targetContainer: ReactElement,\n newComponent: ReactElement\n): ReactElement {\n const {\n active: containerActive,\n children: containerChildren = [],\n path: containerPath,\n } = getProps(container) as LayoutProps;\n\n const existingComponentPath = getProp(targetContainer, \"path\");\n const { idx, finalStep } = nextStep(\n containerPath!,\n existingComponentPath,\n true\n );\n const [insertedIdx, children] = finalStep\n ? insertIntoChildren(container, containerChildren, newComponent)\n : [\n containerActive,\n containerChildren?.map((child, index) =>\n index === idx\n ? (insertIntoContainer(\n child,\n targetContainer,\n newComponent\n ) as ReactElement)\n : child\n ),\n ];\n const active =\n typeOf(container) === \"Stack\"\n ? Array.isArray(insertedIdx)\n ? (insertedIdx[0] as number)\n : insertedIdx\n : containerActive;\n\n return React.cloneElement(container, { active }, children);\n}\nfunction insertIntoChildren(\n container: LayoutModel,\n containerChildren: ReactElement[],\n newComponent: ReactElement\n): [number, ReactElement[]] {\n const containerPath = getProp(container, \"path\");\n const count = containerChildren?.length;\n const { id = uuid() } = getProps(newComponent);\n\n if (count) {\n return [\n count,\n containerChildren.concat(\n resetPath(newComponent, `${containerPath}.${count}`, { id, key: id })\n ),\n ];\n } else {\n return [0, [resetPath(newComponent, `${containerPath}.0`, { id })]];\n }\n}\n\nexport function insertBesideChild(\n container: ReactElement,\n existingComponent: any,\n newComponent: any,\n insertionPosition: insertionPosition,\n pos?: DropPos,\n clientRect?: any,\n dropRect?: any\n): ReactElement {\n const {\n active: containerActive,\n children: containerChildren,\n path: containerPath,\n } = getProps(container);\n\n const existingComponentPath = getProp(existingComponent, \"path\");\n const { idx, finalStep } = nextStep(containerPath, existingComponentPath);\n const [insertedIdx, children] = finalStep\n ? updateChildren(\n container,\n containerChildren,\n idx,\n newComponent,\n insertionPosition,\n pos!,\n clientRect,\n dropRect\n )\n : [\n containerActive,\n containerChildren.map((child: ReactElement, index: number) =>\n index === idx\n ? insertBesideChild(\n child,\n existingComponent,\n newComponent,\n insertionPosition,\n pos,\n clientRect,\n dropRect\n )\n : child\n ),\n ];\n\n const active = typeOf(container) === \"Stack\" ? insertedIdx : containerActive;\n return React.cloneElement(container, { active }, children);\n}\n\nfunction updateChildren(\n container: LayoutModel,\n containerChildren: ReactElement[],\n idx: number,\n newComponent: ReactElement,\n insertionPosition: insertionPosition,\n pos: DropPos,\n clientRect: DropTarget[\"clientRect\"],\n dropRect: DropTarget[\"dropRect\"]\n) {\n const intrinsicSize = getIntrinsicSize(newComponent);\n if (intrinsicSize?.width && intrinsicSize?.height) {\n return insertIntrinsicSizedComponent(\n container,\n containerChildren,\n idx,\n newComponent,\n insertionPosition,\n clientRect,\n dropRect!\n );\n } else {\n return insertFlexComponent(\n container,\n containerChildren,\n idx,\n newComponent,\n insertionPosition,\n pos?.width || pos?.height,\n clientRect\n );\n }\n}\n\nconst getLeadingPlaceholderSize = (\n flexDirection: flexDirection,\n insertionPosition: insertionPosition,\n { top, right, bottom, left }: DropTarget[\"clientRect\"],\n [rectLeft, rectTop, rectRight, rectBottom]: rectTuple\n) => {\n if (flexDirection === \"column\" && insertionPosition === \"before\") {\n return rectTop - top;\n } else if (flexDirection === \"column\") {\n return bottom - rectBottom;\n } else if (flexDirection === \"row\" && insertionPosition === \"before\") {\n return rectLeft - left;\n } else if (flexDirection === \"row\") {\n return right - rectRight;\n }\n};\n\nfunction insertIntrinsicSizedComponent(\n container: LayoutModel,\n containerChildren: ReactElement[],\n idx: number,\n newComponent: ReactElement,\n insertionPosition: insertionPosition,\n clientRect: DropTarget[\"clientRect\"],\n dropRect: rectTuple\n) {\n const {\n style: { flexDirection },\n } = getProps(container);\n const [dimension, crossDimension, contraDirection] =\n getFlexDimensions(flexDirection);\n const { [crossDimension]: intrinsicCrossSize, [dimension]: intrinsicSize } =\n getIntrinsicSize(newComponent) as { height: number; width: number };\n const path = getProp(containerChildren[idx], \"path\");\n\n // If we are introducing a new item into a row/column, but it is not flush against existing child, we will insert\n // a leading placeholder ...\n const placeholderSize = getLeadingPlaceholderSize(\n flexDirection,\n insertionPosition,\n clientRect,\n dropRect\n );\n\n const [itemToInsert, size] =\n intrinsicCrossSize < clientRect[crossDimension]\n ? [\n wrapIntrinsicSizeComponentWithFlexbox(\n newComponent,\n contraDirection,\n path,\n clientRect,\n dropRect\n ),\n intrinsicSize,\n ]\n : [newComponent, undefined];\n\n const placeholder = placeholderSize\n ? createPlaceHolder(path, placeholderSize, { flexGrow: 0, flexShrink: 0 })\n : undefined;\n\n if (intrinsicCrossSize > clientRect[crossDimension]) {\n containerChildren = containerChildren.map((child) => {\n if (getProp(child, \"placeholder\")) {\n return child;\n } else {\n const { [crossDimension]: intrinsicCrossChildSize } = getIntrinsicSize(\n child\n ) as {\n height: number;\n width: number;\n };\n if (\n intrinsicCrossChildSize &&\n intrinsicCrossChildSize < intrinsicCrossSize\n ) {\n return wrapIntrinsicSizeComponentWithFlexbox(\n child,\n contraDirection,\n getProp(child, \"path\")\n );\n } else {\n return child;\n }\n }\n });\n }\n\n return insertFlexComponent(\n container,\n containerChildren,\n idx,\n itemToInsert,\n insertionPosition,\n size,\n clientRect,\n placeholder\n );\n}\n\nfunction insertFlexComponent(\n container: LayoutModel,\n containerChildren: ReactElement[],\n idx: number,\n newComponent: ReactElement,\n insertionPosition: \"before\" | \"after\",\n size: number | undefined,\n targetRect: DropTarget[\"clientRect\"],\n placeholder?: ReactElement\n) {\n const containerPath = getProp(container, \"path\");\n let insertedIdx = 0;\n const children =\n !containerChildren || containerChildren.length === 0\n ? [newComponent]\n : containerChildren\n .reduce<ReactElement[]>((arr, child, i) => {\n if (idx === i) {\n const [existingComponent, insertedComponent] =\n getStyledComponents(container, child, newComponent, targetRect);\n if (insertionPosition === \"before\") {\n if (placeholder) {\n arr.push(placeholder, insertedComponent, existingComponent);\n } else {\n arr.push(insertedComponent, existingComponent);\n }\n } else {\n if (placeholder) {\n arr.push(existingComponent, insertedComponent, placeholder);\n } else {\n arr.push(existingComponent, insertedComponent);\n }\n }\n insertedIdx = arr.indexOf(insertedComponent);\n } else {\n arr.push(child);\n }\n return arr;\n }, [])\n .map((child, i) =>\n i < insertedIdx ? child : resetPath(child, `${containerPath}.${i}`)\n );\n\n return [insertedIdx, children];\n}\n\nfunction getStyledComponents(\n container: LayoutModel,\n existingComponent: ReactElement,\n newComponent: ReactElement,\n targetRect: DropTarget[\"clientRect\"]\n): [ReactElement, ReactElement] {\n let { id = uuid(), version = 0 } = getProps(newComponent);\n version += 1;\n if (typeOf(container) === \"Flexbox\") {\n const [dim] = getManagedDimension(container.props.style);\n const splitterSize = 6;\n const size = { [dim]: (targetRect[dim] - splitterSize) / 2 };\n const existingComponentStyle = getFlexOrIntrinsicStyle(\n existingComponent,\n dim,\n size\n );\n const newComponentStyle = getFlexOrIntrinsicStyle(newComponent, dim, size);\n\n return [\n React.cloneElement(existingComponent, {\n style: existingComponentStyle,\n }),\n React.cloneElement(newComponent, {\n id,\n version,\n style: newComponentStyle,\n }),\n ];\n } else {\n const {\n style: { left: _1, top: _2, flex: _3, ...style } = {\n left: undefined,\n top: undefined,\n flex: undefined,\n },\n } = getProps(newComponent);\n // TODO why would we strip out width, height if resizeable\n // we might need these if in a Stack, for example\n // const dimensions = source.props.resizeable ? {} : { width, height };\n return [\n existingComponent,\n React.cloneElement(newComponent, { id, version, style }),\n ];\n }\n}\n", "import { uuid } from \"@vuu-ui/vuu-utils\";\nimport { CSSProperties, ReactElement } from \"react\";\nimport React, { cloneElement } from \"react\";\nimport { dimension } from \"../common-types\";\nimport {\n ComponentRegistry,\n isContainer,\n isLayoutComponent,\n} from \"../registry/ComponentRegistry\";\nimport {\n getPersistentState,\n hasPersistentState,\n setPersistentState,\n} from \"../use-persistent-state\";\nimport { expandFlex, getProps, typeOf } from \"../utils\";\nimport { LayoutJSON, LayoutModel, layoutType } from \"./layoutTypes\";\n\nexport const getManagedDimension = (\n style: CSSProperties\n): [dimension, dimension] =>\n style.flexDirection === \"column\" ? [\"height\", \"width\"] : [\"width\", \"height\"];\n\nconst theKidHasNoStyle: CSSProperties = {};\n\nexport const applyLayoutProps = (component: ReactElement, path = \"0\") => {\n const [layoutProps, children] = getChildLayoutProps(\n typeOf(component) as string,\n component.props,\n path\n );\n return React.cloneElement(component, layoutProps, children);\n};\n\nexport interface LayoutProps {\n active?: number;\n \"data-path\"?: string;\n children?: ReactElement[];\n column?: any;\n dropTarget?: any;\n id: string;\n key: string;\n layout?: any;\n path?: string;\n resizeable?: boolean;\n style: CSSProperties;\n type?: string;\n version?: number;\n}\n\nexport const processLayoutElement = (\n layoutElement: ReactElement,\n previousLayout?: ReactElement\n): ReactElement => {\n const type = typeOf(layoutElement) as string;\n const [layoutProps, children] = getChildLayoutProps(\n type,\n layoutElement.props,\n \"0\",\n undefined,\n previousLayout\n );\n return cloneElement(layoutElement, layoutProps, children);\n};\n\nexport const applyLayout = (\n type: layoutType,\n props: LayoutProps,\n previousLayout?: LayoutModel\n): LayoutModel => {\n // This works if the root layout is itself loaded from JSON\n const [layoutProps, children] = getChildLayoutProps(\n type,\n props,\n \"0\",\n undefined,\n previousLayout\n );\n return {\n ...props,\n ...layoutProps,\n type,\n children,\n };\n};\n\nfunction getLayoutProps(\n type: string,\n props: LayoutProps,\n path = \"0\",\n parentType: string | null = null,\n previousLayout?: LayoutModel\n): LayoutProps {\n const {\n active: prevActive = 0,\n \"data-path\": dataPath,\n path: prevPath = dataPath,\n id: prevId,\n style: prevStyle,\n } = getProps(previousLayout);\n\n const prevMatch = typeOf(previousLayout) === type && path === prevPath;\n // TODO is there anything else we can re-use from previousType ?\n const id = prevMatch ? prevId : props.id ?? uuid();\n const active = type === \"Stack\" ? props.active ?? prevActive : undefined;\n\n const key = id;\n //TODO this might be wrong if client has updated style ?\n const style = prevMatch ? prevStyle : getStyle(type, props, parentType);\n // TODO need two interfaces to cover these two scenarios\n return isLayoutComponent(type)\n ? { id, key, path, style, type, active }\n : { id, key, style, \"data-path\": path };\n}\n\nfunction getChildLayoutProps(\n type: string,\n props: LayoutProps,\n path: string,\n parentType: string | null = null,\n previousLayout?: LayoutModel\n): [LayoutProps, ReactElement[]] {\n const layoutProps = getLayoutProps(\n type,\n props,\n path,\n parentType,\n previousLayout\n );\n\n if (props.layout && !previousLayout) {\n // reconstitute children from layout. Will always be a single child,\n // but return as array to make subsequent processing more consistent\n return [layoutProps, [layoutFromJson(props.layout, `${path}.0`)]];\n }\n\n const previousChildren =\n (previousLayout as any)?.children ?? previousLayout?.props?.children;\n const hasDynamicChildren = props.dropTarget && previousChildren;\n const children = hasDynamicChildren\n ? previousChildren\n : getLayoutChildren(type, props.children, path, previousChildren);\n return [layoutProps, children];\n}\n\nfunction getLayoutChildren(\n type: string,\n children?: ReactElement[],\n path = \"0\",\n previousChildren?: ReactElement[]\n) {\n // Avoid React.Children.map here, it messes with the keys.\n const kids = Array.isArray(children)\n ? children\n : React.isValidElement(children)\n ? [children]\n : [];\n return isContainer(type) /*|| isView(type)*/\n ? kids.map((child, i) => {\n const childType = typeOf(child) as string;\n const previousType = typeOf(previousChildren?.[i]);\n if (!previousType || childType === previousType) {\n const [layoutProps, children] = getChildLayoutProps(\n childType,\n child.props,\n `${path}.${i}`,\n type,\n previousChildren?.[i]\n );\n return React.cloneElement(child, layoutProps, children);\n } else {\n //TODO is this always correct ?\n return previousChildren?.[i];\n }\n })\n : // TODO should we check the types of children ?\n // : previousChildren ?? children;\n //TODO this is new - is it dangerous ?\n children;\n}\n\nconst getStyle = (\n type: string,\n props: LayoutProps,\n parentType?: string | null\n) => {\n let { style = theKidHasNoStyle } = props;\n if (type === \"Flexbox\") {\n style = {\n flexDirection: props.column ? \"column\" : \"row\",\n ...style,\n display: \"flex\",\n };\n }\n\n if (style.flex) {\n const { flex, ...otherStyles } = style;\n style = {\n ...otherStyles,\n ...expandFlex(flex),\n };\n } else if (parentType === \"Stack\") {\n style = {\n ...style,\n ...expandFlex(1),\n };\n } else if (\n parentType === \"Flexbox\" &&\n (style.width || style.height) &&\n style.flexBasis === undefined\n ) {\n // strictly, this should depend on flexDirection\n style = {\n ...style,\n flexBasis: \"auto\",\n flexGrow: 0,\n flexShrink: 0,\n };\n }\n\n return style;\n};\n\n//TODO we don't need id beyond view\nexport function layoutFromJson(\n { id = uuid(), type, children, props, state }: LayoutJSON,\n path: string\n): ReactElement {\n // if (type === \"DraggableLayout\") {\n // return layoutFromJson(children[0], \"0\");\n // }\n\n const componentType = type.match(/^[a-z]/) ? type : ComponentRegistry[type];\n\n if (componentType === undefined) {\n throw Error(`Unable to create component from JSON, unknown type ${type}`);\n }\n\n if (state) {\n setPersistentState(id, state);\n }\n\n return React.createElement(\n componentType,\n {\n ...props,\n id,\n key: id,\n path,\n },\n children\n ? children.map((child, i) => layoutFromJson(child, `${path}.${i}`))\n : undefined\n );\n}\n\nexport function layoutToJSON(component: ReactElement) {\n return componentToJson(component);\n}\n\nexport function componentToJson(component: ReactElement): LayoutJSON {\n const type = typeOf(component) as string;\n const { id, children, type: _omit, ...props } = getProps(component);\n\n const state = hasPersistentState(id) ? getPersistentState(id) : undefined;\n\n return {\n id,\n type,\n props: serializeProps(props as LayoutProps),\n state,\n children: React.Children.map(children, componentToJson),\n };\n}\n\nexport function serializeProps(props?: LayoutProps) {\n if (props) {\n const { path, ...otherProps } = props;\n const result: { [key: string]: any } = {};\n for (let [key, value] of Object.entries(otherProps)) {\n result[key] = serializeValue(value);\n }\n return result;\n }\n}\n\nfunction serializeValue(value: unknown): any {\n if (\n typeof value === \"string\" ||\n typeof value === \"number\" ||\n typeof value === \"boolean\"\n ) {\n return value;\n } else if (Array.isArray(value)) {\n return value.map(serializeValue);\n } else if (typeof value === \"object\" && value !== null) {\n const result: { [key: string]: any } = {};\n for (let [k, v] of Object.entries(value)) {\n result[k] = serializeValue(v);\n }\n return result;\n }\n}\n", "import { useCallback } from \"react\";\n\nconst persistentState = new Map<string, any>();\nconst sessionState = new Map<string, any>();\n\n// These is not exported by package, only available within\n// layout. Used by LayoutProvider for layout serialization.\nexport const getPersistentState = (id: string) => persistentState.get(id);\nexport const hasPersistentState = (id: string) => persistentState.has(id);\nexport const setPersistentState = (id: string, value: any) =>\n persistentState.set(id, value);\n\nexport const usePersistentState = () => {\n //TODO create single set of methods that operate on either session or state\n\n const loadSessionState = useCallback((id, key) => {\n const state = sessionState.get(id);\n if (state) {\n if (key !== undefined && state[key] !== undefined) {\n return state[key];\n } else if (key !== undefined) {\n return undefined;\n } else {\n return state;\n }\n }\n }, []);\n\n const saveSessionState = useCallback((id, key, data) => {\n if (key === undefined) {\n sessionState.set(id, data);\n } else if (sessionState.has(id)) {\n const state = sessionState.get(id);\n sessionState.set(id, {\n ...state,\n [key]: data,\n });\n } else {\n sessionState.set(id, { [key]: data });\n }\n }, []);\n\n const purgeSessionState = useCallback((id: string, key?: string) => {\n if (sessionState.has(id)) {\n if (key === undefined) {\n sessionState.delete(id);\n } else {\n const state = sessionState.get(id);\n if (state[key]) {\n const { [key]: _doomedState, ...rest } = sessionState.get(id);\n if (Object.keys(rest).length > 0) {\n sessionState.set(id, rest);\n } else {\n sessionState.delete(id);\n }\n }\n }\n }\n }, []);\n\n const loadState = useCallback((id: string, key?: string) => {\n const state = persistentState.get(id);\n if (state) {\n if (key !== undefined) {\n return state[key];\n } else {\n return state;\n }\n }\n }, []);\n\n const saveState = useCallback(\n (id: string, key: string | undefined, data: any) => {\n if (key === undefined) {\n persistentState.set(id, data);\n } else if (persistentState.has(id)) {\n const state = persistentState.get(id);\n persistentState.set(id, {\n ...state,\n [key]: data,\n });\n } else {\n persistentState.set(id, { [key]: data });\n }\n },\n []\n );\n\n const purgeState = useCallback((id: string, key?: string) => {\n if (persistentState.has(id)) {\n if (key === undefined) {\n persistentState.delete(id);\n } else {\n const state = persistentState.get(id);\n if (state[key]) {\n const { [key]: _doomedState, ...rest } = persistentState.get(id);\n if (Object.keys(rest).length > 0) {\n persistentState.set(id, rest);\n } else {\n persistentState.delete(id);\n }\n }\n }\n }\n }, []);\n\n return {\n loadSessionState,\n loadState,\n saveSessionState,\n saveState,\n purgeState,\n purgeSessionState,\n };\n};\n", "import { ReactElement } from \"react\";\nimport { DropTarget } from \"../drag-drop/DropTarget\";\nimport { DragDropRect, DragInstructions, DropPos } from \"../drag-drop\";\n\nexport interface WithProps {\n props?: { [key: string]: any };\n}\n\nexport interface WithType {\n props?: any;\n title?: string;\n type: string;\n}\n\nexport interface LayoutRoot extends WithProps {\n active?: number;\n children?: ReactElement[];\n type: string;\n}\n\nexport interface LayoutJSON extends WithType {\n children?: LayoutJSON[];\n id?: string;\n props?: { [key: string]: any };\n state?: any;\n type: string;\n}\n\nexport interface WithActive {\n active?: number;\n}\n\nexport type LayoutModel = LayoutRoot | ReactElement | WithType;\n\nexport type layoutType = \"Flexbox\" | \"View\" | \"DraggableLayout\" | \"Stack\";\n\nexport const LayoutActionType = {\n ADD: \"add\",\n DRAG_START: \"drag-start\",\n DRAG_DROP: \"drag-drop\",\n MAXIMIZE: \"maximize\",\n MINIMIZE: \"minimize\",\n REMOVE: \"remove\",\n REPLACE: \"replace\",\n RESTORE: \"restore\",\n SAVE: \"save\",\n SET_TITLE: \"set-title\",\n SPLITTER_RESIZE: \"splitter-resize\",\n SWITCH_TAB: \"switch-tab\",\n TEAROUT: \"tearout\",\n} as const;\n\nexport type AddAction = {\n component: any;\n path: string;\n type: typeof LayoutActionType.ADD;\n};\n\nexport type DragDropAction = {\n draggedReactElement: ReactElement;\n dragInstructions: any;\n dropTarget: Partial<DropTarget>;\n type: typeof LayoutActionType.DRAG_DROP;\n};\n\nexport type MaximizeAction = {\n path?: string;\n type: typeof LayoutActionType.MAXIMIZE;\n};\nexport type MinimizeAction = {\n path?: string;\n type: typeof LayoutActionType.MINIMIZE;\n};\nexport type RemoveAction = {\n path?: string;\n type: typeof LayoutActionType.REMOVE;\n};\nexport type ReplaceAction = {\n replacement: any;\n target: any;\n type: typeof LayoutActionType.REPLACE;\n};\nexport type RestoreAction = {\n path?: string;\n type: typeof LayoutActionType.RESTORE;\n};\nexport type SetTitleAction = {\n path: string;\n title: string;\n type: typeof LayoutActionType.SET_TITLE;\n};\nexport type SplitterResizeAction = {\n path: string;\n sizes: { currentSize: number; flexBasis: number }[];\n type: typeof LayoutActionType.SPLITTER_RESIZE;\n};\nexport type SwitchTabAction = {\n nextIdx: number;\n path: string;\n type: typeof LayoutActionType.SWITCH_TAB;\n};\nexport type TearoutAction = {\n path?: string;\n type: typeof LayoutActionType.TEAROUT;\n};\n\nexport type LayoutReducerAction =\n | AddAction\n | DragDropAction\n | MaximizeAction\n | MinimizeAction\n | RemoveAction\n | ReplaceAction\n | RestoreAction\n | SetTitleAction\n | SplitterResizeAction\n | SwitchTabAction;\n\nexport type SaveAction = {\n type: typeof LayoutActionType.SAVE;\n};\n\nexport type AddToolbarContributionViewAction = {\n content: ReactElement;\n location: string;\n type: \"add-toolbar-contribution\";\n};\n\nexport type RemoveToolbarContributionViewAction = {\n location: string;\n type: \"remove-toolbar-contribution\";\n};\n\nexport type MousedownViewAction = {\n preDragActivity?: any;\n index?: number;\n type: \"mousedown\";\n};\n\n// TODO split this out into separate actions for different drag scenarios\nexport type DragStartAction = {\n payload?: ReactElement;\n dragContainerPath?: string;\n dragElement?: HTMLElement;\n dragRect: DragDropRect;\n dropTargets?: string[];\n evt: MouseEvent;\n instructions?: DragInstructions;\n path: string;\n type: typeof LayoutActionType.DRAG_START;\n};\n", "import React, { ReactElement } from 'react';\nimport { createPlaceHolder } from './flexUtils';\nimport { swapChild } from './replace-layout-element';\n\nimport {\n followPath,\n followPathToParent,\n getProp,\n getProps,\n nextStep,\n resetPath,\n typeOf\n} from '../utils';\nimport { RemoveAction } from './layoutTypes';\n\nexport function removeChild(layoutRoot: ReactElement, { path }: RemoveAction) {\n const target = followPath(layoutRoot, path!) as ReactElement;\n let targetParent = followPathToParent(layoutRoot, path!);\n if (targetParent === null) {\n return layoutRoot;\n }\n const { children } = getProps(targetParent);\n if (children.length > 1 && allOtherChildrenArePlaceholders(children, path)) {\n // eslint-disable-next-line no-unused-vars\n const {\n style: { flexBasis, display, flexDirection, ...style }\n } = getProps(targetParent);\n let containerPath = getProp(targetParent, 'path');\n let newLayout = swapChild(\n layoutRoot,\n targetParent,\n createPlaceHolder(containerPath, flexBasis, style)\n );\n // eslint-disable-next-line no-cond-assign\n while ((targetParent = followPathToParent(newLayout, containerPath))) {\n if (getProp(targetParent, 'path') === '0') {\n break;\n }\n const { children } = getProps(targetParent);\n if (allOtherChildrenArePlaceholders(children)) {\n containerPath = getProp(targetParent, 'path');\n // eslint-disable-next-line no-unused-vars\n const {\n style: { flexBasis, display, flexDirection, ...style }\n } = getProps(targetParent);\n newLayout = swapChild(\n layoutRoot,\n targetParent,\n createPlaceHolder(containerPath, flexBasis, style)\n );\n } else if (hasAdjacentPlaceholders(children)) {\n newLayout = collapsePlaceholders(layoutRoot, targetParent as ReactElement);\n // } else if (hasRedundantPlaceholders(children)){\n /*\n We may have redundany placeholders for example where we have a tower containing a Terrace and a placeholder\n If all the components bordering on the lower placeholder are themselves placeholders, the lower placeholder\n is redundant\n */\n } else {\n break;\n }\n }\n return newLayout;\n // return removeChild(rootProps, {path: targetParent.props.path});\n // return removeChildAndPlaceholder(rootProps, {path: targetParent.props.path});\n } else {\n return _removeChild(layoutRoot, target);\n }\n}\n\nfunction _removeChild(container: ReactElement, child: ReactElement): ReactElement {\n let { active, children: componentChildren, path, preserve } = getProps(container);\n const { idx, finalStep } = nextStep(path, getProp(child, 'path'));\n const type = typeOf(container) as string;\n let children = componentChildren.slice() as ReactElement[];\n if (finalStep) {\n children.splice(idx, 1);\n if (active !== undefined && active >= idx) {\n active = Math.max(0, active - 1);\n }\n\n if (children.length === 1 && !preserve && path !== '0' && type.match(/Flexbox|Stack/)) {\n return unwrap(container, children[0]);\n }\n\n // Not 100% sure we should do this, unless configured to\n if (!children.some(isFlexible) && children.some(canBeMadeFlexible)) {\n children = makeFlexible(children);\n }\n } else {\n children[idx] = _removeChild(children[idx], child) as ReactElement;\n }\n\n children = children.map((child, i) => resetPath(child, `${path}.${i}`));\n return React.cloneElement(container, { active }, children);\n}\n\nfunction unwrap(container: ReactElement, child: ReactElement) {\n const type = typeOf(container);\n const {\n path,\n style: { flexBasis, flexGrow, flexShrink, width, height }\n } = getProps(container);\n\n let unwrappedChild = resetPath(child, path);\n if (path === '0') {\n unwrappedChild = React.cloneElement(unwrappedChild, {\n style: {\n ...child.props.style,\n width,\n height\n }\n });\n } else if (type === 'Flexbox') {\n const dim = container.props.style.flexDirection === 'column' ? 'height' : 'width';\n const {\n // eslint-disable-next-line no-unused-vars\n style: { [dim]: size, ...style }\n } = unwrappedChild.props;\n // Need to overwrite key\n unwrappedChild = React.cloneElement(unwrappedChild, {\n // Need to assign key\n flexFill: undefined,\n style: {\n ...style,\n // flexFill, if present described the childs relationship to the doomed flexbox,\n // must not be applied to new parent\n flexGrow,\n flexShrink,\n flexBasis,\n width,\n height\n }\n });\n }\n return unwrappedChild;\n}\n\nfunction isFlexible(element: ReactElement) {\n return element.props.style.flexGrow > 0;\n}\n\nfunction canBeMadeFlexible(element: ReactElement) {\n const { width, height, flexGrow } = element.props.style;\n return flexGrow === 0 && typeof width !== 'number' && typeof height !== 'number';\n}\n\nfunction makeFlexible(children: ReactElement[]) {\n return children.map((child) =>\n canBeMadeFlexible(child)\n ? React.cloneElement(child, {\n style: {\n ...child.props.style,\n flexGrow: 1\n }\n })\n : child\n );\n}\n\nconst hasAdjacentPlaceholders = (children: ReactElement[]) => {\n if (children && children.length > 0) {\n let wasPlaceholder = getProp(children[0], 'placeholder');\n let isPlaceholder = false;\n for (let i = 1; i < children.length; i++) {\n isPlaceholder = getProp(children[i], 'placeholder');\n if (wasPlaceholder && isPlaceholder) {\n return true;\n }\n wasPlaceholder = isPlaceholder;\n }\n }\n};\n\nconst collapsePlaceholders = (container: ReactElement, target: ReactElement) => {\n let { children: componentChildren, path } = getProps(container);\n const { idx, finalStep } = nextStep(path, getProp(target, 'path'));\n let children = componentChildren.slice() as ReactElement[];\n if (finalStep) {\n children[idx] = _collapsePlaceHolders(target);\n } else {\n children[idx] = collapsePlaceholders(children[idx], target) as ReactElement;\n }\n\n children = children.map((child, i) => resetPath(child, `${path}.${i}`));\n return React.cloneElement(container, undefined, children);\n};\n\nconst _collapsePlaceHolders = (container: ReactElement) => {\n const { children } = getProps(container);\n const newChildren = [];\n const placeholders: ReactElement[] = [];\n\n for (let i = 0; i < children.length; i++) {\n if (getProp(children[i], 'placeholder')) {\n placeholders.push(children[i]);\n } else {\n if (placeholders.length === 1) {\n newChildren.push(placeholders.pop());\n } else if (placeholders.length > 0) {\n newChildren.push(mergePlaceholders(placeholders));\n placeholders.length = 0;\n }\n newChildren.push(children[i]);\n }\n }\n\n if (placeholders.length === 1) {\n newChildren.push(placeholders.pop());\n } else if (placeholders.length > 0) {\n newChildren.push(mergePlaceholders(placeholders));\n }\n\n const containerPath = getProp(container, 'path');\n return React.cloneElement(\n container,\n undefined,\n newChildren.map((child, i) => resetPath(child, `${containerPath}.${i}`))\n );\n};\n\nconst mergePlaceholders = ([placeholder, ...placeholders]: ReactElement[]) => {\n const targetStyle = getProp(placeholder, 'style');\n let { flexBasis, flexGrow, flexShrink } = targetStyle;\n for (let {\n props: { style }\n } of placeholders) {\n flexBasis += style.flexBasis;\n flexGrow = Math.max(flexGrow, style.flexGrow);\n flexShrink = Math.max(flexShrink, style.flexShrink);\n }\n return React.cloneElement(placeholder, {\n style: { ...targetStyle, flexBasis, flexGrow, flexShrink }\n });\n};\n\nconst allOtherChildrenArePlaceholders = (children: ReactElement[], path?: string) =>\n children.every(\n (child) => getProp(child, 'placeholder') || (path && getProp(child, 'path') === path)\n );\n", "import React, { ReactElement } from 'react';\nimport { getProp, getProps, nextStep } from '../utils';\nimport { Action } from '../layout-action';\nimport { applyLayoutProps, LayoutProps } from './layoutUtils';\nimport { ReplaceAction } from './layoutTypes';\n\nexport function replaceChild(model: ReactElement, { target, replacement }: ReplaceAction) {\n return _replaceChild(model, target, replacement);\n}\n\nexport function _replaceChild(\n model: ReactElement,\n child: ReactElement,\n replacement: ReactElement<LayoutProps>\n) {\n const path = getProp(child, 'path');\n const resizeable = getProp(child, 'resizeable');\n const { style } = getProps(child);\n const newChild =\n // applyLayoutProps is a bit heavy here - it supports the scenario\n // where we drop/replace a template. Might want to make it somehow\n // an opt-in option\n applyLayoutProps(\n React.cloneElement(replacement, {\n resizeable,\n style: {\n ...style,\n ...replacement.props.style\n }\n }),\n path\n );\n\n return swapChild(model, child, newChild);\n}\n\nexport function swapChild(\n model: ReactElement,\n child: ReactElement,\n replacement: ReactElement,\n op?: 'maximize' | 'minimize' | 'restore'\n): ReactElement {\n if (model === child) {\n return replacement as any;\n } else {\n const { idx, finalStep } = nextStep(getProp(model, 'path'), getProp(child, 'path'));\n const children = model.props.children.slice();\n if (finalStep) {\n if (!op) {\n children[idx] = replacement;\n } else if (op === Action.MINIMIZE) {\n children[idx] = minimize(model, children[idx]);\n } else if (op === Action.RESTORE) {\n children[idx] = restore(children[idx]);\n }\n } else {\n children[idx] = swapChild(children[idx], child, replacement, op);\n }\n return React.cloneElement(model, undefined, children);\n }\n}\n\nfunction minimize(parent: ReactElement, child: ReactElement) {\n // Right now, parent is always going to be a FLexbox, but might not always be the case\n const { style: parentStyle } = getProps(parent);\n const { style: childStyle } = getProps(child);\n\n const { width, height, flexBasis, flexShrink, flexGrow, ...rest } = childStyle;\n\n const restoreStyle = {\n width,\n height,\n flexBasis,\n flexShrink,\n flexGrow\n };\n\n const style = {\n ...rest,\n flexBasis: 0,\n flexGrow: 0,\n flexShrink: 0\n };\n const collapsed =\n parentStyle.flexDirection === 'row'\n ? 'vertical'\n : parentStyle.flexDirection === 'column'\n ? 'horizontal'\n : false;\n\n if (collapsed) {\n return React.cloneElement(child, {\n collapsed,\n restoreStyle,\n style\n });\n } else {\n return child;\n }\n}\n\nfunction restore(child: ReactElement) {\n // Right now, parent is always going to be a FLexbox, but might not always be the case\n const { style: childStyle, restoreStyle } = getProps(child);\n\n const { flexBasis, flexShrink, flexGrow, ...rest } = childStyle;\n\n const style = {\n ...rest,\n ...restoreStyle\n };\n\n return React.cloneElement(child, {\n collapsed: false,\n style,\n restoreStyle: undefined\n });\n}\n", "import React, { CSSProperties, ReactElement } from 'react';\nimport { followPath, getProps } from '../utils';\nimport { swapChild } from './replace-layout-element';\nimport { SplitterResizeAction } from './layoutTypes';\nimport { dimension } from '../common-types';\n\nexport function resizeFlexChildren(\n layoutRoot: ReactElement,\n { path, sizes }: SplitterResizeAction\n) {\n const target = followPath(layoutRoot, path, true);\n const { children, style } = getProps(target);\n\n const dimension = style.flexDirection === 'column' ? 'height' : 'width';\n const replacementChildren = applySizesToChildren(children, sizes, dimension);\n\n const replacement = React.cloneElement(target, undefined, replacementChildren);\n\n return swapChild(layoutRoot, target, replacement);\n}\n\nfunction applySizesToChildren(\n children: ReactElement[],\n sizes: { currentSize: number; flexBasis: number }[],\n dimension: dimension\n) {\n return children.map((child, i) => {\n const {\n style: { [dimension]: size, flexBasis: actualFlexBasis }\n } = getProps(child);\n const meta = sizes[i];\n let { currentSize, flexBasis } = meta;\n const hasCurrentSize = currentSize !== undefined;\n const newSize = hasCurrentSize ? meta.currentSize : flexBasis;\n\n if (newSize === undefined || size === newSize || actualFlexBasis === newSize) {\n return child;\n } else {\n return React.cloneElement(child, {\n style: applySizeToChild(child.props.style, dimension, newSize)\n });\n }\n });\n}\n\nfunction applySizeToChild(style: CSSProperties, dimension: dimension, newSize: number) {\n const hasSize = typeof style[dimension] === 'number';\n const { flexShrink = 1, flexGrow = 1 } = style;\n return {\n ...style,\n [dimension]: hasSize ? newSize : 'auto',\n flexBasis: hasSize ? 'auto' : newSize,\n flexShrink,\n flexGrow\n };\n}\n", "import React, { ReactElement } from \"react\";\nimport { uuid } from \"@vuu-ui/vuu-utils\";\nimport { getProp, getProps, nextStep, resetPath, typeOf } from \"../utils\";\nimport { ComponentRegistry } from \"../registry/ComponentRegistry\";\nimport {\n createFlexbox,\n createPlaceHolder,\n flexDirection,\n getFlexStyle,\n getIntrinsicSize,\n wrapIntrinsicSizeComponentWithFlexbox,\n} from \"./flexUtils\";\nimport { applyLayoutProps, LayoutProps } from \"./layoutUtils\";\nimport { LayoutModel } from \"./layoutTypes\";\nimport { DropPos } from \"../drag-drop/dragDropTypes\";\nimport { rectTuple } from \"../common-types\";\nimport { DropTarget } from \"../drag-drop/DropTarget\";\n\nexport interface LayoutSpec {\n type: \"Stack\" | \"Flexbox\";\n flexDirection: \"column\" | \"row\";\n showTabs?: boolean;\n}\n\nconst isHtmlElement = (component: LayoutModel) => {\n const [firstLetter] = typeOf(component) as string;\n return firstLetter === firstLetter.toLowerCase();\n};\n\n// newComponent has been dropped onto an existingComponent. A wrapper container will be inserted\n// into the layout tree, wrapping the existingComponent. newComponent will be injected into the\n// new wrapper, so existingComponent and newComponent will be siblings. Putting it another way,\n// wrapper will replace existingComponent in the layout tree and it will contain existingComponent\n// and newComponent.\nexport function wrap(\n container: ReactElement,\n existingComponent: any,\n newComponent: any,\n pos: DropPos,\n clientRect?: DropTarget[\"clientRect\"],\n dropRect?: DropTarget[\"dropRect\"]\n): ReactElement {\n const { children: containerChildren, path: containerPath } =\n getProps(container);\n\n const existingComponentPath = getProp(existingComponent, \"path\");\n const { idx, finalStep } = nextStep(containerPath, existingComponentPath);\n const children = finalStep\n ? updateChildren(\n container,\n containerChildren,\n existingComponent,\n newComponent,\n pos,\n clientRect,\n dropRect\n )\n : containerChildren.map((child: ReactElement, index: number) =>\n index === idx\n ? wrap(\n child,\n existingComponent,\n newComponent,\n pos,\n clientRect,\n dropRect\n )\n : child\n );\n\n return React.cloneElement(container, undefined, children);\n}\n\nfunction updateChildren(\n container: LayoutModel,\n containerChildren: ReactElement[],\n existingComponent: ReactElement,\n newComponent: ReactElement,\n pos: DropPos,\n clientRect?: DropTarget[\"clientRect\"],\n dropRect?: rectTuple\n) {\n const intrinsicSize = getIntrinsicSize(newComponent);\n\n if (intrinsicSize?.width && intrinsicSize?.height) {\n if (clientRect === undefined || dropRect === undefined) {\n throw Error(\n \"wrap-layout-element, updateChildren clientRect and dropRect must both be available\"\n );\n }\n return wrapIntrinsicSizedComponent(\n containerChildren,\n existingComponent,\n newComponent,\n pos,\n clientRect,\n dropRect\n );\n } else {\n return wrapFlexComponent(\n container,\n containerChildren,\n existingComponent,\n newComponent,\n pos\n );\n }\n}\n\nfunction wrapFlexComponent(\n container: LayoutModel,\n containerChildren: ReactElement[],\n existingComponent: ReactElement,\n newComponent: ReactElement,\n pos: DropPos\n) {\n const { version = 0 } = getProps(newComponent);\n const existingComponentPath = getProp(existingComponent, \"path\");\n const {\n type,\n flexDirection,\n showTabs: showTabsProp,\n } = getLayoutSpecForWrapper(pos);\n const [style, existingComponentStyle, newComponentStyle] =\n getWrappedFlexStyles(\n type,\n existingComponent,\n newComponent,\n flexDirection,\n pos\n );\n const targetFirst = isTargetFirst(pos);\n const active = targetFirst ? 1 : 0; // double check this\n\n // TODO how do we decide whether children should be resizable ?\n const newComponentProps = {\n resizeable: true,\n style: newComponentStyle,\n version: version + 1,\n };\n const resizeProp = isHtmlElement(existingComponent)\n ? \"data-resizeable\"\n : \"resizeable\";\n const existingComponentProps = {\n [resizeProp]: true,\n style: existingComponentStyle,\n };\n\n const showTabs = type === \"Stack\" ? { showTabs: showTabsProp } : undefined;\n const splitterSize =\n type === \"Flexbox\"\n ? {\n splitterSize:\n (typeOf(container) === \"Flexbox\" && container.props.splitterSize) ??\n undefined,\n }\n : undefined;\n\n const id = uuid();\n var wrapper = React.createElement(\n ComponentRegistry[type],\n {\n active,\n id,\n key: id,\n path: getProp(existingComponent, \"path\"),\n flexFill: getProp(existingComponent, \"flexFill\"),\n // TODO we should be able to configure this in setDefaultLayoutProps\n ...splitterSize,\n ...showTabs,\n style,\n resizeable: getProp(existingComponent, \"resizeable\"),\n } as LayoutProps,\n targetFirst\n ? [\n resetPath(\n existingComponent,\n `${existingComponentPath}.0`,\n existingComponentProps\n ),\n // resetPath(newComponent, `${existingComponentPath}.1`, newComponentProps),\n applyLayoutProps(\n React.cloneElement(newComponent, newComponentProps),\n `${existingComponentPath}.1`\n ),\n ]\n : [\n applyLayoutProps(\n React.cloneElement(newComponent, newComponentProps),\n `${existingComponentPath}.0`\n ),\n // resetPath(newComponent, `${existingComponentPath}.0`, newComponentProps),\n resetPath(\n existingComponent,\n `${existingComponentPath}.1`,\n existingComponentProps\n ),\n ]\n );\n return containerChildren.map((child: ReactElement) =>\n child === existingComponent ? wrapper : child\n );\n}\n\nfunction wrapIntrinsicSizedComponent(\n containerChildren: ReactElement[],\n existingComponent: ReactElement,\n newComponent: ReactElement,\n pos: DropPos,\n clientRect: DropTarget[\"clientRect\"],\n dropRect: rectTuple\n) {\n const { flexDirection } = getLayoutSpecForWrapper(pos);\n const contraDirection = flexDirection === \"column\" ? \"row\" : \"column\";\n const targetFirst = isTargetFirst(pos);\n\n const [dropLeft, dropTop, dropRight, dropBottom] = dropRect;\n const [startPlaceholder, endPlaceholder] =\n flexDirection === \"column\"\n ? [dropTop - clientRect.top, clientRect.bottom - dropBottom]\n : [dropLeft - clientRect.left, clientRect.right - dropRight];\n const pathRoot = getProp(existingComponent, \"path\");\n let pathIndex = 0;\n\n const resizeProp = isHtmlElement(existingComponent)\n ? \"data-resizeable\"\n : \"resizeable\";\n\n const wrappedChildren = [];\n if (startPlaceholder) {\n wrappedChildren.push(\n targetFirst\n ? resetPath(existingComponent, `${pathRoot}.${pathIndex++}`, {\n [resizeProp]: true,\n style: { flexBasis: startPlaceholder, flexGrow: 1, flexShrink: 1 },\n })\n : createPlaceHolder(`${pathRoot}.${pathIndex++}`, startPlaceholder, {\n flexGrow: 0,\n flexShrink: 0,\n })\n );\n }\n wrappedChildren.push(\n wrapIntrinsicSizeComponentWithFlexbox(\n newComponent,\n contraDirection,\n `${pathRoot}.${pathIndex++}`,\n clientRect,\n dropRect\n )\n );\n if (endPlaceholder) {\n wrappedChildren.push(\n targetFirst\n ? createPlaceHolder(`${pathRoot}.${pathIndex++}`, 0)\n : resetPath(existingComponent, `${pathRoot}.${pathIndex++}`, {\n [resizeProp]: true,\n style: { flexBasis: 0, flexGrow: 1, flexShrink: 1 },\n })\n );\n }\n\n const wrapper = createFlexbox(\n flexDirection,\n existingComponent.props,\n wrappedChildren,\n pathRoot\n );\n return containerChildren.map((child) =>\n child === existingComponent ? wrapper : child\n );\n}\n\n//TODO we need to respect styles on the source, full-on flex might not be appropriate\nfunction getWrappedFlexStyles(\n type: string,\n existingComponent: ReactElement,\n newComponent: ReactElement,\n flexDirection: flexDirection,\n pos: DropPos\n) {\n const style = {\n ...existingComponent.props.style,\n flexDirection,\n };\n\n const dimension =\n type === \"Flexbox\" && flexDirection === \"column\" ? \"height\" : \"width\";\n const newComponentStyle = getFlexStyle(newComponent, dimension, pos);\n const existingComponentStyle = getFlexStyle(existingComponent, dimension);\n\n return [style, existingComponentStyle, newComponentStyle];\n}\n\nconst isTargetFirst = (pos: DropPos) =>\n pos.position.SouthOrEast\n ? true\n : pos?.tab?.positionRelativeToTab === \"before\"\n ? false\n : pos.position.Header\n ? true\n : false;\n\nfunction getLayoutSpecForWrapper(pos: DropPos): LayoutSpec {\n if (pos.position.Header) {\n return {\n type: \"Stack\",\n flexDirection: \"column\",\n showTabs: true,\n };\n } else {\n return {\n type: \"Flexbox\",\n flexDirection: pos.position.EastOrWest ? \"row\" : \"column\",\n };\n }\n}\n", "import { createContext, Dispatch } from 'react';\nimport { DragStartAction, LayoutReducerAction, SaveAction } from '../layout-reducer';\n\nconst unconfiguredLayoutProviderDispatch: LayoutProviderDispatch = (action) =>\n console.log(`dispatch ${action.type}, have you forgotten to provide a LayoutProvider ?`);\n\nexport type LayoutProviderDispatch = Dispatch<LayoutReducerAction | SaveAction | DragStartAction>;\n\nexport interface LayoutProviderContextProps {\n dispatchLayoutProvider: LayoutProviderDispatch;\n version: number;\n}\n\nexport const LayoutProviderContext = createContext<LayoutProviderContextProps>({\n dispatchLayoutProvider: unconfiguredLayoutProviderDispatch,\n version: -1\n});\n", "import { MutableRefObject, ReactElement, useCallback, useRef } from \"react\";\nimport {\n DragDropRect,\n DragEndCallback,\n Draggable,\n DragInstructions,\n} from \"../drag-drop\";\nimport { DragStartAction } from \"../layout-reducer\";\nimport { getIntrinsicSize } from \"../layout-reducer/flexUtils\";\nimport { followPath } from \"../utils\";\nimport { LayoutProviderDispatch } from \"./LayoutProviderContext\";\n\nconst NO_INSTRUCTIONS = {} as DragInstructions;\nconst NO_OFFSETS: [number, number] = [0, 0];\n\ninterface CurrentDragAction extends Omit<DragStartAction, \"evt\" | \"type\"> {\n dragContainerPath: string;\n}\n\ninterface DragOperation {\n payload: ReactElement;\n originalCSS: string;\n dragRect: any;\n dragInstructions: DragInstructions;\n dragOffsets: [number, number];\n targetPosition: { left: number; top: number };\n}\n\n// Create a temporary object for dragging, where we don not have an existing object\n// e.g dragging a non-selected tab from a Stack or an item from Palette\nconst getDragElement = (\n rect: DragDropRect,\n id: string,\n dragElement?: HTMLElement\n): [HTMLElement, string, number, number] => {\n const wrapper = document.createElement(\"div\");\n wrapper.className = \"vuuSimpleDraggableWrapper\";\n // TODO caller needs to supply the salt classes\n wrapper.classList.add(\n \"vuuSimpleDraggableWrapper\",\n \"salt-theme\",\n \"salt-density-medium\"\n );\n wrapper.dataset.dragging = \"true\";\n\n const div = dragElement ?? document.createElement(\"div\");\n // this seems wrong the id is the payload id\n div.id = id;\n\n wrapper.appendChild(div);\n document.body.appendChild(wrapper);\n const cssText = `top:${rect.top}px;left:${rect.left}px;width:${rect.width}px;height:${rect.height}px;`;\n return [wrapper, cssText, rect.left, rect.top];\n};\n\nconst determineDragOffsets = (\n draggedElement: HTMLElement\n): [number, number] => {\n const { offsetParent } = draggedElement;\n if (offsetParent === null) {\n return NO_OFFSETS;\n } else {\n const { left: offsetLeft, top: offsetTop } =\n offsetParent.getBoundingClientRect();\n return [offsetLeft, offsetTop];\n }\n};\n\nexport const useLayoutDragDrop = (\n rootLayoutRef: MutableRefObject<ReactElement>,\n dispatch: LayoutProviderDispatch\n) => {\n const dragActionRef = useRef<CurrentDragAction>();\n const dragOperationRef = useRef<DragOperation>();\n const draggableHTMLElementRef = useRef<HTMLElement>();\n\n const handleDrag = useCallback((x, y) => {\n if (dragOperationRef.current && draggableHTMLElementRef.current) {\n const {\n dragOffsets: [offsetX, offsetY],\n targetPosition,\n } = dragOperationRef.current;\n const left = typeof x === \"number\" ? x - offsetX : targetPosition.left;\n const top = typeof y === \"number\" ? y - offsetY : targetPosition.top;\n if (left !== targetPosition.left || top !== targetPosition.top) {\n dragOperationRef.current.targetPosition.left = left;\n dragOperationRef.current.targetPosition.top = top;\n draggableHTMLElementRef.current.style.top = top + \"px\";\n draggableHTMLElementRef.current.style.left = left + \"px\";\n }\n }\n }, []);\n\n const handleDrop: DragEndCallback = useCallback((dropTarget) => {\n if (dragOperationRef.current) {\n const {\n dragInstructions,\n payload: draggedReactElement,\n originalCSS,\n } = dragOperationRef.current;\n dispatch({\n type: \"drag-drop\",\n draggedReactElement,\n dragInstructions,\n dropTarget,\n });\n\n console.log(`[useLayoutDragDrop]`, {\n dragInstructions,\n });\n if (draggableHTMLElementRef.current) {\n if (dragInstructions.RemoveDraggableOnDragEnd) {\n document.body.removeChild(draggableHTMLElementRef.current);\n } else {\n draggableHTMLElementRef.current.style.cssText = originalCSS;\n delete draggableHTMLElementRef.current.dataset.dragging;\n }\n }\n\n dragActionRef.current = undefined;\n dragOperationRef.current = undefined;\n draggableHTMLElementRef.current = undefined;\n }\n }, []);\n\n /**\n * This will be called when Draggable has established that a drag operation is\n * underway. There may be a delay between the initial mousedown and the call to\n * this function - while we wait for either a drag timeout to fire or a minumum\n * mouse move threshold to be reached.\n */\n const handleDragStart = useCallback(\n (evt: MouseEvent) => {\n if (dragActionRef.current) {\n const {\n payload: component,\n dragContainerPath,\n dragElement,\n dragRect,\n // dropTargets,\n instructions = NO_INSTRUCTIONS,\n path,\n // preDragActivity,\n // resolveDragStart // see View drag\n } = dragActionRef.current;\n const { current: rootLayout } = rootLayoutRef;\n const dragPos = { x: evt.clientX, y: evt.clientY };\n const dragPayload = component ?? followPath(rootLayout, path, true);\n const { id: dragPayloadId } = dragPayload.props;\n const intrinsicSize = getIntrinsicSize(dragPayload);\n let originalCSS = \"\",\n dragCSS = \"\",\n dragTransform = \"\";\n let dragInstructions = instructions;\n\n let dragStartLeft = -1;\n let dragStartTop = -1;\n let dragOffsets: [number, number] = NO_OFFSETS;\n\n // TODO this has a bearing on offsets we apply to (absolutely positioned) dragged element.\n // If we are creating the element here, offset parent will be document body.\n let element = document.getElementById(dragPayloadId);\n\n if (element === null) {\n // This may bew the case where, for example, we drag a Tab (non selected) from a Tabstrip.\n [element, dragCSS, dragStartLeft, dragStartTop] = getDragElement(\n dragRect,\n dragPayloadId,\n dragElement\n );\n dragInstructions = {\n ...dragInstructions,\n RemoveDraggableOnDragEnd: true,\n };\n } else {\n dragOffsets = determineDragOffsets(element);\n const [offsetLeft, offsetTop] = dragOffsets;\n const { width, height, left, top } = element.getBoundingClientRect();\n dragStartLeft = left - offsetLeft;\n dragStartTop = top - offsetTop;\n dragCSS = `width:${width}px;height:${height}px;left:${dragStartLeft}px;top:${dragStartTop}px;z-index: 100;background-color:#ccc;opacity: 0.6;`;\n // Important that this is set before we call initDrag\n // this just enables position: absolute\n element.dataset.dragging = \"true\";\n\n // resolveDragStart && resolveDragStart(true);\n\n // if (preDragActivity) {\n // await preDragActivity();\n // }\n\n originalCSS = element.style.cssText;\n }\n\n dragTransform = Draggable.initDrag(\n rootLayoutRef.current,\n dragContainerPath,\n dragRect,\n dragPos,\n {\n drag: handleDrag,\n drop: handleDrop,\n },\n intrinsicSize\n // dropTargets\n );\n\n element.style.cssText = dragCSS + dragTransform;\n draggableHTMLElementRef.current = element;\n\n dragOperationRef.current = {\n payload: dragPayload,\n originalCSS,\n dragRect,\n dragOffsets,\n dragInstructions: instructions,\n targetPosition: { left: dragStartLeft, top: dragStartTop },\n };\n }\n },\n [handleDrag, handleDrop, rootLayoutRef]\n );\n\n const prepareToDrag = useCallback(\n (action: DragStartAction) => {\n const { evt, ...options } = action;\n console.log(`prepare to drag`, {\n options,\n });\n dragActionRef.current = {\n ...options,\n dragContainerPath: \"\",\n // dragContainerPath: '0.0.1.1'\n };\n Draggable.handleMousedown(evt, handleDragStart, options.instructions);\n },\n [handleDragStart]\n );\n\n return prepareToDrag;\n};\n", "import { useForkRef } from \"@salt-ds/core\";\nimport cx from \"classnames\";\nimport { ForwardedRef, forwardRef } from \"react\";\nimport { useBreakpoints } from \"../responsive\";\nimport { FlexboxProps } from \"./flexboxTypes\";\nimport \"./FluidGrid.css\";\nimport { useResponsiveSizing } from \"./useResponsiveSizing\";\n\nconst classBase = \"hwFluidGrid\";\n\nexport interface FluidGridProps extends FlexboxProps {\n showGrid?: boolean;\n}\n\nexport const FluidGrid = forwardRef(function FluidGrid(\n props: FluidGridProps,\n ref: ForwardedRef<HTMLDivElement>\n) {\n const {\n breakPoints,\n children,\n column,\n cols: colsProp = 12,\n className: classNameProp,\n flexFill,\n gap = 3,\n fullPage,\n id,\n onSplitterMoved,\n resizeable,\n row,\n showGrid,\n spacing,\n splitterSize,\n style: styleProp,\n ...rest\n } = props;\n\n const { cols, content, rootRef } = useResponsiveSizing({\n children,\n cols: colsProp,\n // onSplitterMoved,\n style: styleProp,\n });\n\n const breakpoint = useBreakpoints(\n {\n breakPoints,\n },\n rootRef\n );\n\n const className = cx(classBase, classNameProp, {\n [`${classBase}-column`]: column,\n [`${classBase}-row`]: row,\n [`${classBase}-show-grid`]: showGrid,\n \"flex-fill\": flexFill,\n \"full-page\": fullPage,\n });\n\n const style = {\n ...styleProp,\n \"--spacing\": spacing,\n // only needed to display the cols\n \"--grid-col-count\": cols,\n \"--grid-gap\": gap,\n };\n\n return (\n <div\n {...rest}\n className={className}\n data-breakpoint={breakpoint}\n data-cols={cols}\n data-resizeable={resizeable || undefined}\n id={id}\n ref={useForkRef(rootRef, ref)}\n style={style}\n >\n {content}\n </div>\n );\n});\nFluidGrid.displayName = \"FluidGrid\";\n", "import { RefObject, useCallback, useEffect, useRef, useState } from 'react';\nimport { useResizeObserver } from './useResizeObserver';\nimport {\n BreakPointRamp,\n breakpointRamp,\n getBreakPoints as getDocumentBreakpoints\n} from './breakpoints';\nimport { BreakPoint, BreakPointsProp } from '../flexbox/flexboxTypes';\nimport { ExecFileOptionsWithStringEncoding } from 'child_process';\n\nconst EMPTY_ARRAY: BreakPoint[] = [];\n\nexport interface BreakpointsHookProps {\n breakPoints?: BreakPointsProp;\n smallerThan?: string;\n}\n\n// TODO how do we cater for smallerThan/greaterThan breakpoints\nexport const useBreakpoints = (\n { breakPoints: breakPointsProp, smallerThan }: BreakpointsHookProps,\n ref: RefObject<any>\n) => {\n const [breakpointMatch, setBreakpointmatch] = useState(smallerThan ? false : 'lg');\n const bodyRef = useRef(document.body);\n const breakPointsRef = useRef(\n breakPointsProp ? breakpointRamp(breakPointsProp) : getDocumentBreakpoints()\n );\n\n // TODO how do we identify the default\n const sizeRef = useRef('lg');\n\n const stopFromMinWidth = useCallback(\n (w) => {\n if (breakPointsRef.current) {\n for (let [name, size] of breakPointsRef.current) {\n if (w >= size) {\n return name;\n }\n }\n }\n },\n [breakPointsRef]\n );\n\n const matchSizeAgainstBreakpoints = useCallback(\n (width) => {\n if (smallerThan) {\n const breakPointRamp = breakPointsRef.current.find(\n ([name]: BreakPointRamp) => name === smallerThan\n );\n if (breakPointRamp) {\n const [, , maxValue] = breakPointRamp;\n return width < maxValue;\n }\n } else {\n return stopFromMinWidth(width);\n }\n // is this right ?\n return width;\n },\n [smallerThan, stopFromMinWidth]\n );\n\n // TODO need to make the dimension a config\n useResizeObserver(\n ref || bodyRef,\n breakPointsRef.current ? ['width'] : EMPTY_ARRAY,\n ({ width: measuredWidth }: { width: number }) => {\n const result = matchSizeAgainstBreakpoints(measuredWidth);\n if (result !== sizeRef.current) {\n sizeRef.current = result;\n setBreakpointmatch(result);\n }\n },\n true\n );\n\n useEffect(() => {\n const target = ref || bodyRef;\n if (target.current) {\n const prevSize = sizeRef.current;\n if (breakPointsRef.current) {\n // We're measuring here when the resizeObserver has also measured\n // There isn't a convenient way to get the Resizeobserver to\n // notify initial size - that's not really its job, unless we\n // set a flag ?\n const { clientWidth } = target.current;\n const result = matchSizeAgainstBreakpoints(clientWidth);\n sizeRef.current = result;\n // If initial size of ref does not match the default, notify client after render\n if (result !== prevSize) {\n setBreakpointmatch(result);\n }\n }\n }\n }, [setBreakpointmatch, matchSizeAgainstBreakpoints, ref]);\n\n // No, just ass the class directly to the ref, no need to render\n return breakpointMatch;\n};\n", "/* eslint-disable no-restricted-syntax */\nimport { useCallback, useLayoutEffect, useRef, RefObject } from 'react';\nexport const WidthHeight = ['height', 'width'];\nexport const HeightOnly = ['height'];\nexport const WidthOnly = ['width'];\n\nexport type measurements<T = string | number> = {\n height?: T;\n scrollHeight?: T;\n scrollWidth?: T;\n width?: T;\n};\ntype measuredDimension = keyof measurements<number>;\n\nexport type ResizeHandler = (measurements: measurements<number>) => void;\n\ntype observedDetails = {\n onResize?: ResizeHandler;\n measurements: measurements<number>;\n};\nconst observedMap = new WeakMap<HTMLElement, observedDetails>();\n\nconst getTargetSize = (\n element: HTMLElement,\n contentRect: DOMRectReadOnly,\n dimension: measuredDimension\n): number => {\n switch (dimension) {\n case 'height':\n return contentRect.height;\n case 'scrollHeight':\n return element.scrollHeight;\n case 'scrollWidth':\n return element.scrollWidth;\n case 'width':\n return contentRect.width;\n default:\n return 0;\n }\n};\n\nconst resizeObserver = new ResizeObserver((entries: ResizeObserverEntry[]) => {\n for (const entry of entries) {\n const { target, contentRect } = entry;\n const observedTarget = observedMap.get(target as HTMLElement);\n if (observedTarget) {\n const { onResize, measurements } = observedTarget;\n let sizeChanged = false;\n for (const [dimension, size] of Object.entries(measurements)) {\n const newSize = getTargetSize(\n target as HTMLElement,\n contentRect,\n dimension as measuredDimension\n );\n if (newSize !== size) {\n sizeChanged = true;\n measurements[dimension as measuredDimension] = newSize;\n }\n }\n if (sizeChanged) {\n onResize && onResize(measurements);\n }\n }\n }\n});\n\n// TODO use an optional lag (default to false) to ask to fire onResize\n// with initial size\n// Note asking for scrollHeight alone will not trigger onResize, this is only triggered by height,\n// with scrollHeight returned as an auxilliary value\nexport function useResizeObserver(\n ref: RefObject<Element | HTMLElement | null>,\n dimensions: string[],\n onResize: ResizeHandler,\n reportInitialSize = false\n): void {\n const dimensionsRef = useRef(dimensions);\n const measure = useCallback((target: HTMLElement): measurements<number> => {\n const rect = target.getBoundingClientRect();\n return dimensionsRef.current.reduce((map: { [key: string]: number }, dim) => {\n map[dim] = getTargetSize(target, rect, dim as measuredDimension);\n return map;\n }, {});\n }, []);\n\n // TODO use ref to store resizeHandler here\n // resize handler registered with REsizeObserver will never change\n // use ref to store user onResize callback here\n // resizeHandler will call user callback.current\n\n // Keep this effect separate in case user inadvertently passes different\n // dimensions or callback instance each time - we only ever want to\n // initiate new observation when ref changes.\n useLayoutEffect(() => {\n const target = ref.current as HTMLElement;\n let cleanedUp = false;\n\n async function registerObserver() {\n // Create the map entry immediately. useEffect may fire below\n // before fonts are ready and attempt to update entry\n observedMap.set(target, { measurements: {} as measurements<number> });\n cleanedUp = false;\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n const { fonts } = document as any;\n if (fonts) {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n await fonts.ready;\n }\n if (!cleanedUp) {\n const observedTarget = observedMap.get(target);\n if (observedTarget) {\n const measurements = measure(target);\n observedTarget.measurements = measurements;\n resizeObserver.observe(target);\n if (reportInitialSize) {\n onResize(measurements);\n }\n }\n }\n }\n\n if (target) {\n // TODO might we want multiple callers to attach a listener to the same element ?\n if (observedMap.has(target)) {\n throw Error('useResizeObserver attemping to observe same element twice');\n }\n void registerObserver();\n }\n return () => {\n if (target && observedMap.has(target)) {\n resizeObserver.unobserve(target);\n observedMap.delete(target);\n cleanedUp = true;\n }\n };\n }, [ref, measure]);\n\n useLayoutEffect(() => {\n const target = ref.current as HTMLElement;\n const record = observedMap.get(target);\n if (record) {\n if (dimensionsRef.current !== dimensions) {\n dimensionsRef.current = dimensions;\n const measurements = measure(target);\n record.measurements = measurements;\n }\n // Might not have changed, but no harm ...\n record.onResize = onResize;\n }\n }, [dimensions, measure, ref, onResize]);\n\n // TODO might be a good idea to ref and return the current measurememnts. That way, derived hooks\n // e.g useBreakpoints don't have to measure and client cn make onResize callback simpler\n}\n", "// should we have some global; defaults ?\n\nimport { BreakPointsProp } from \"../flexbox/flexboxTypes\";\n\nexport type BreakPointRamp = [string, number, number];\n\nfunction breakpointReader(\n themeName: string,\n defaultBreakpoints?: BreakPointsProp\n) {\n //TODO ownerDocument\n const themeRoot = document.body.querySelector(`.${themeName}`);\n const handler = {\n get: function (style: CSSStyleDeclaration, stopName: string) {\n const val = style.getPropertyValue(\n // lets assume we have the following naming convention\n `--${themeName}-breakpoint-${stopName}`\n );\n return val ? parseInt(val) : undefined;\n },\n };\n\n return themeRoot\n ? new Proxy(getComputedStyle(themeRoot), handler)\n : defaultBreakpoints ?? {};\n}\n\nconst byDescendingStopSize = (\n [, s1]: [string, number],\n [, s2]: [string, number]\n) => s2 - s1;\n\n// These are assumed to be min-width (aka mobile-first) stops, we could take a\n// paramneter to support max-width as well ?\n// return [stopName, minWidth, maxWidth]\nexport const breakpointRamp = (\n breakpoints: BreakPointsProp\n): BreakPointRamp[] =>\n Object.entries(breakpoints)\n .sort(byDescendingStopSize)\n .map(([name, value], i, all) => [\n name,\n value,\n i < all.length - 1 ? all[i + 1][1] : 9999,\n ]);\n\nlet documentBreakpoints: BreakPointRamp[] | null = null;\n\nconst loadBreakpoints = (themeName = \"salt\") => {\n // TODO would be nice to read these breakpoint labels from a css variable to\n // avoid hard-coding them here ?\n const { xs, sm, md, lg, xl } = breakpointReader(themeName) as BreakPointsProp;\n return breakpointRamp({ xs, sm, md, lg, xl });\n};\n\n//TODO support multiple themes loaded\nexport const getBreakPoints = (themeName?: string) => {\n if (documentBreakpoints === null) {\n documentBreakpoints = loadBreakpoints(themeName);\n }\n return documentBreakpoints;\n};\n", "import { useCallback, useLayoutEffect, useRef, useState } from \"react\";\nimport { useResizeObserver } from \"./useResizeObserver\";\nimport { measureMinimumNodeSize } from \"./measureMinimumNodeSize\";\n\nconst MONITORED_DIMENSIONS = {\n horizontal: [\"width\", \"scrollHeight\"],\n vertical: [\"height\", \"scrollWidth\"],\n none: [],\n};\nconst NO_OVERFLOW_INDICATOR = {};\nconst NO_DATA = {};\n\nconst UNCOLLAPSED_DYNAMIC_ITEMS =\n '[data-collapsible=\"dynamic\"]:not([data-collapsed=\"true\"]):not([data-collapsing=\"true\"])';\n\nconst addAll = (sum: number, m: any) => sum + m.size;\nconst addAllExceptOverflowIndicator = (sum: number, m: any) =>\n sum + (m.isOverflowIndicator ? 0 : m.size);\n\n// There should be no collapsible items here that are not already collapsed\n// otherwise we would be collapsing, not overflowing\nconst lastOverflowableItem = (arr) => {\n for (let i = arr.length - 1; i >= 0; i--) {\n const item = arr[i];\n // TODO should we support a no-overflow attribute (maybe a priority 0)\n // to prevent an item from overflowing ?\n // TODO when all collapsible items are collapsed and we start overflowing,\n // should we leave collapsed items to last in the overflow priority ?\n if (!item.isOverflowIndicator) {\n return item;\n }\n }\n return null;\n};\nconst OVERFLOWING = 1000;\nconst collapsedOnly = (status) => status > 0 && status < 1000;\nconst includesOverflow = (status) => status >= OVERFLOWING;\nconst lastListItem = (listRef) => listRef.current[listRef.current.length - 1];\n\nconst newlyCollapsed = (visibleItems) =>\n visibleItems.some((item) => item.collapsed && item.fullWidth === null);\n\nconst hasUncollapsedDynamicItems = (containerRef) =>\n containerRef.current.querySelector(UNCOLLAPSED_DYNAMIC_ITEMS) !== null;\n\nconst moveOverflowItem = (fromStack, toStack) => {\n const item = lastOverflowableItem(fromStack.current);\n if (item) {\n fromStack.current = fromStack.current.filter((i) => i !== item);\n toStack.current = toStack.current.concat(item);\n return item;\n } else {\n return null;\n }\n};\n\nconst byDescendingPriority = (m1, m2) => {\n let result = m1.priority - m2.priority;\n if (result === 0) {\n result = m1.index - m2.index;\n }\n return result;\n};\n\nconst getOverflowIndicator = (visibleRef) =>\n visibleRef.current.find((item) => item.isOverflowIndicator);\n\nconst Dimensions = {\n horizontal: {\n size: \"clientWidth\",\n depth: \"clientHeight\",\n scrollDepth: \"scrollHeight\",\n },\n vertical: {\n size: \"clientHeight\",\n depth: \"clientWidth\",\n scrollDepth: \"scrollWidth\",\n },\n};\n\nconst measureContainerOverflow = (\n { current: innerEl },\n orientation = \"horizontal\"\n) => {\n const dim = Dimensions[orientation];\n const { [dim.depth]: containerDepth } = innerEl.parentNode;\n const { [dim.scrollDepth]: scrollDepth, [dim.size]: contentSize } = innerEl;\n const isOverflowing = containerDepth < scrollDepth;\n return [isOverflowing, contentSize, containerDepth];\n};\n\nconst useOverflowStatus = () => {\n const [, forceUpdate] = useState(null);\n // TODO make this easier to understand by storing the overflow and\n // collapse status as separate reference count fields\n const [overflowing, _setOverflowing] = useState(0);\n const overflowingRef = useRef(0);\n const setOverflowing = useCallback(\n (value) => {\n _setOverflowing((overflowingRef.current = value));\n },\n [_setOverflowing]\n );\n\n const updateOverflowStatus = useCallback(\n (value, force) => {\n if (Math.abs(value) === OVERFLOWING) {\n if (value > 0 && !includesOverflow(overflowingRef.current)) {\n setOverflowing(overflowingRef.current + value);\n } else if (value < 0 && includesOverflow(overflowingRef.current)) {\n setOverflowing(overflowingRef.current + value);\n } else {\n forceUpdate({});\n }\n } else if (value !== 0) {\n setOverflowing(overflowingRef.current + value);\n } else if (force) {\n forceUpdate({});\n }\n },\n [forceUpdate, overflowingRef, setOverflowing]\n );\n\n return [overflowingRef, overflowing, updateOverflowStatus];\n};\n\nconst measureChildNodes = ({ current: innerEl }, dimension) => {\n const measurements = Array.from(innerEl.childNodes).reduce(\n (list, node: Node) => {\n const {\n collapsible,\n collapsed,\n collapsing,\n index,\n priority = \"1\",\n overflowIndicator,\n overflowed,\n } = node?.dataset ?? NO_DATA;\n if (index) {\n const size = measureMinimumNodeSize(node, dimension);\n if (overflowed) {\n delete node.dataset.overflowed;\n }\n list.push({\n collapsible,\n collapsed: collapsible ? collapsed === \"true\" : undefined,\n collapsing,\n // only to be populated in case of collapse\n // TODO check the role of this - especially the way we check it in useEffect\n // to detect collapse\n fullSize: null,\n index: parseInt(index, 10),\n isOverflowIndicator: overflowIndicator,\n label: node.title || node.innerText,\n priority: parseInt(priority, 10),\n size,\n });\n }\n return list;\n },\n []\n );\n\n return measurements.sort(byDescendingPriority);\n};\n\nconst getElementForItem = (ref, item) =>\n ref.current.querySelector(`:scope > [data-idx='${item.index}']`);\n\n// value could be anything which might require a re-evaluation. In the case of tabs\n// we might have selected an overflowed tab. Can we make this more efficient, only\n// needs action if an overflowed item re-enters the visible section\nexport function useOverflowObserver(orientation = \"horizontal\", label = \"\") {\n const ref = useRef(null);\n const [overflowingRef, overflowing, updateOverflowStatus] =\n useOverflowStatus();\n // const [, forceUpdate] = useState();\n const visibleRef = useRef([]);\n const overflowedRef = useRef([]);\n const collapsedRef = useRef([]);\n const collapsingRef = useRef(false);\n const rootDepthRef = useRef(null);\n const containerSizeRef = useRef(null);\n const horizontalRef = useRef(orientation === \"horizontal\");\n const overflowIndicatorSizeRef = useRef(36); // should default by density\n const minSizeRef = useRef(0);\n\n const setContainerMinSize = useCallback(\n (size) => {\n const isHorizontal = horizontalRef.current;\n if (size === undefined) {\n const dimension = isHorizontal ? \"width\" : \"height\";\n ({ [dimension]: size } = ref.current.getBoundingClientRect());\n }\n minSizeRef.current = size;\n const styleDimension = isHorizontal ? \"minWidth\" : \"minHeight\";\n ref.current.style[styleDimension] = size + \"px\";\n },\n [ref]\n );\n\n const markOverflowingItems = useCallback(\n (visibleContentSize, containerSize) => {\n let result = 0;\n // First pass, see if there is a collapsible item we can collapse. We won't\n // know how much space this frees up until the thing has re-rendered, so this\n // may kick off a chain of renders and remeasures if there are multiple collapsible\n // items and each yields only a part of the shrinkage we need to apply.\n // That's the worst case scenario.\n if (\n visibleRef.current.some((item) => item.collapsible && !item.collapsed)\n ) {\n for (let i = visibleRef.current.length - 1; i >= 0; i--) {\n const item = visibleRef.current[i];\n if (item.collapsible === \"instant\" && !item.collapsed) {\n item.collapsed = true;\n const target = getElementForItem(ref, item);\n target.dataset.collapsed = true;\n collapsedRef.current.push(item);\n // We only ever collapse 1 item at a time. We now need to wait for\n // it to render, so we can re-measure and determine how much space\n // this has saved.\n return 1;\n } else if (\n item.collapsible === \"dynamic\" &&\n !item.collapsed &&\n !item.collapsing\n ) {\n item.collapsing = true;\n const target = getElementForItem(ref, item);\n target.dataset.collapsing = true;\n collapsedRef.current.push(item);\n ref.current.dataset.collapsing = true;\n // We only ever collapse 1 item at a time. We now need to wait for\n // it to render, so we can re-measure and determine how much space\n // this has saved.\n return 1;\n }\n }\n }\n\n // If no collapsible items, movin items from visible to overflowed queues\n while (visibleContentSize > containerSize) {\n const overflowedItem = moveOverflowItem(visibleRef, overflowedRef);\n if (overflowedItem === null) {\n // unable to overflow, all items are collapsed, this is our minimum width,\n // enforce it ...\n // TODO what if density changes\n //TODO probably not right, now we overflow even collapsed items, min width should be\n // overflow indicator width plus width of any non-overflowable items\n setContainerMinSize(visibleContentSize);\n break;\n }\n visibleContentSize -= overflowedItem.size;\n const target = getElementForItem(ref, overflowedItem);\n target.dataset.overflowed = true;\n result = OVERFLOWING;\n }\n return result;\n },\n [setContainerMinSize]\n );\n\n const removeOverflowIfSpaceAllows = useCallback(\n (containerSize) => {\n let result = 0;\n // TODO calculate this without using fullWidth if we have OVERFLOW\n // Need a loop here where we first remove OVERFLOW, then potentially remove\n // COLLAPSE too\n // We want to re-introduce overflowed items before we start to restore collapsed items\n // When we are dealing with overflowed items, we just use the current width of collapsed items.\n let visibleContentSize = visibleRef.current.reduce(\n addAllExceptOverflowIndicator,\n 0\n );\n let diff = containerSize - visibleContentSize;\n\n if (collapsedOnly(overflowingRef.current)) {\n // find the next collapsed item, see how much extra space it would\n // occupy if restored. If we have enough space, restore it.\n while (collapsedRef.current.length) {\n const item = lastListItem(collapsedRef);\n const itemDiff = item.fullSize - item.size;\n if (diff >= itemDiff) {\n item.collapsed = false;\n item.size = item.fullSize;\n // Be careful before setting this to null, check the code in useEffect\n delete item.fullSize;\n const target = getElementForItem(ref, item);\n collapsedRef.current.pop();\n delete target.dataset.collapsed;\n diff = diff - itemDiff;\n result += 1;\n } else {\n break;\n }\n }\n return result;\n } else {\n while (overflowedRef.current.length > 0) {\n const { size: nextSize } = lastListItem(overflowedRef);\n\n if (diff >= nextSize) {\n const { size: overflowSize = 0 } =\n getOverflowIndicator(visibleRef) || NO_OVERFLOW_INDICATOR;\n // we can only ignore the width of overflow Indicator if either there is only one remaining\n // overflow item (so overflowIndicator will be removed) or diff is big enough to accommodate\n // the overflow Ind.\n if (\n overflowedRef.current.length === 1 ||\n diff >= nextSize + overflowSize\n ) {\n const overflowedItem = moveOverflowItem(\n overflowedRef,\n visibleRef\n );\n visibleContentSize += overflowedItem.size;\n const target = getElementForItem(ref, overflowedItem);\n delete target.dataset.overflowed;\n diff = diff - overflowedItem.size;\n result = OVERFLOWING;\n } else {\n break;\n }\n } else {\n break;\n }\n }\n }\n // DOn't return OVERFLOWING unless there is no more overflow\n return result;\n },\n [overflowingRef]\n );\n\n const initializeDynamicContent = useCallback(() => {\n let renderedSize = visibleRef.current.reduce(addAll, 0);\n let diff = renderedSize - containerSizeRef.current;\n for (let i = visibleRef.current.length - 1; i >= 0; i--) {\n const item = visibleRef.current[i];\n if (item.collapsible && !item.collapsed) {\n const target = getElementForItem(ref, item);\n // TODO where do we derive min width 28 + 8\n if (diff > item.size - 36) {\n // We really want to know if it has reached min-width, but we will have to\n // wait for it to render\n target.dataset.collapsed = item.collapsed = true;\n diff -= item.size;\n } else {\n target.dataset.collapsing = item.collapsing = true;\n break;\n }\n }\n }\n }, [containerSizeRef, ref, visibleRef]);\n\n const collapseCollapsingItem = useCallback(\n (item, target) => {\n target.dataset.collapsing = item.collapsing = false;\n target.dataset.collapsed = item.collapsed = true;\n\n const rest = visibleRef.current.filter(\n ({ collapsible, collapsed }) => collapsible === \"dynamic\" && !collapsed\n );\n const last = rest.pop();\n if (last) {\n const lastTarget = getElementForItem(ref, last);\n lastTarget.dataset.collapsing = last.collapsing = true;\n } else {\n // Set minSize to current measured size\n // TODO check that this makes sense...suspect it doesn't\n setContainerMinSize();\n }\n },\n [setContainerMinSize]\n );\n\n const restoreCollapsingItem = useCallback((item, target) => {\n target.dataset.collapsing = item.collapsing = false;\n // we might have an opportunity to switch the next collapsed item to\n // collapsing here. If we don't do this, it will ge handled in the next resize\n }, []);\n\n const checkDynamicContent = useCallback(\n (containerHasGrown) => {\n // The order must matter here\n const collapsingItem = visibleRef.current.find(\n ({ collapsible, collapsing }) => collapsible === \"dynamic\" && collapsing\n );\n const collapsedItem = visibleRef.current.find(\n ({ collapsible, collapsed }) => collapsible === \"dynamic\" && collapsed\n );\n\n if (collapsingItem === undefined && collapsedItem === undefined) {\n return;\n }\n\n if (collapsingItem === undefined) {\n const target = getElementForItem(ref, collapsedItem);\n target.dataset.collapsed = collapsedItem.collapsed = false;\n target.dataset.collapsing = collapsedItem.collapsing = true;\n return;\n }\n\n const target = getElementForItem(ref, collapsingItem);\n const dimension = horizontalRef.current ? \"width\" : \"height\";\n\n if (containerHasGrown && collapsedItem) {\n const size = measureMinimumNodeSize(target, dimension);\n // We don't restore a collapsing item unless there is at least one collapsed item\n if (collapsedItem && size === collapsingItem.size) {\n restoreCollapsingItem(collapsingItem, target);\n }\n } else {\n // Note we are going to compare width with minWidth. Margin is ignored here, so we\n // use getBoundingClientRect rather than measureNode\n const { [dimension]: size } = target.getBoundingClientRect();\n const style = getComputedStyle(target);\n const minSize = parseInt(style.getPropertyValue(`min-${dimension}`));\n if (size === minSize) {\n collapseCollapsingItem(collapsingItem, target);\n }\n }\n },\n [collapseCollapsingItem, restoreCollapsingItem]\n );\n\n const resetMeasurements = useCallback(() => {\n const [isOverflowing, innerContainerSize, rootContainerDepth] =\n measureContainerOverflow(ref, orientation);\n\n containerSizeRef.current = innerContainerSize;\n rootDepthRef.current = rootContainerDepth;\n\n const hasDynamicItems = hasUncollapsedDynamicItems(ref);\n\n if (hasDynamicItems || isOverflowing) {\n const dimension = horizontalRef.current ? \"width\" : \"height\";\n const measurements = measureChildNodes(ref, dimension);\n visibleRef.current = measurements;\n overflowedRef.current = [];\n }\n\n if (hasDynamicItems) {\n // if we don't have overflow, but we do have dynamic collapse items, we need to monitor resize events\n // to determine when the collapsing item reaches min-width. At which point it becomes collapsed, and\n // the next dynanic collapse item assumes collapsing status\n collapsingRef.current = true;\n ref.current.dataset.collapsing = true;\n\n if (isOverflowing) {\n // We will only encounter this scenario first-time in. Once we initialize for dynamic content,\n // there will be no more overflow (unless we decide to re-enable overflow once all dynamic\n // items are collapsed ).\n initializeDynamicContent();\n } else {\n const collapsingItem = lastListItem(visibleRef);\n const element = getElementForItem(ref, collapsingItem);\n element.dataset.collapsing = collapsingItem.collapsing = true;\n }\n } else if (isOverflowing) {\n // We may already have an overflowIndicator here, if caller is Tabstrip\n let renderedSize = visibleRef.current.reduce(\n addAllExceptOverflowIndicator,\n 0\n );\n const result = markOverflowingItems(\n renderedSize,\n innerContainerSize - overflowIndicatorSizeRef.current\n );\n updateOverflowStatus(+result);\n }\n }, [\n initializeDynamicContent,\n markOverflowingItems,\n orientation,\n updateOverflowStatus,\n ]);\n\n const resizeHandler = useCallback(\n ({\n scrollHeight,\n height = scrollHeight,\n scrollWidth,\n width = scrollWidth,\n }) => {\n const [size, depth] = horizontalRef.current\n ? [width, height]\n : [height, width];\n\n const wasFullSize = overflowingRef.current === 0;\n const overflowDetected = depth > rootDepthRef.current;\n const containerHasGrown = size > containerSizeRef.current;\n\n containerSizeRef.current = size;\n\n if (containerHasGrown && size === minSizeRef.current) {\n // ignore\n } else if (collapsingRef.current) {\n checkDynamicContent(containerHasGrown);\n } else if (!wasFullSize && containerHasGrown) {\n const result = removeOverflowIfSpaceAllows(size);\n // Don't remove the overflowing status if there are remaining overflowed item(s).\n // Unlike collapsed items, overflowed is not a reference count.\n if (result !== OVERFLOWING || overflowedRef.current.length === 0) {\n updateOverflowStatus(-result);\n } else if (result === OVERFLOWING) {\n updateOverflowStatus(0, true);\n }\n } else if (wasFullSize && overflowDetected) {\n // TODO if client is not using an overflow indicator, there is nothing to do here,\n // just let nature take its course. How do we know this ?\n // This is when we need to add width to measurements we are tracking\n resetMeasurements();\n } else if (!wasFullSize && overflowDetected) {\n // we're still overflowing\n let renderedSize = visibleRef.current.reduce(addAll, 0);\n if (size < renderedSize) {\n const result = markOverflowingItems(renderedSize, size);\n updateOverflowStatus(+result);\n }\n }\n },\n [\n checkDynamicContent,\n removeOverflowIfSpaceAllows,\n resetMeasurements,\n markOverflowingItems,\n overflowingRef,\n updateOverflowStatus,\n ]\n );\n\n useLayoutEffect(() => {\n const dimension = horizontalRef.current ? \"width\" : \"height\";\n if (newlyCollapsed(visibleRef.current)) {\n // These are in reverse priority order, so last collapsed will always be first\n const [collapsedItem] = visibleRef.current.filter(\n (item) => item.collapsed\n );\n if (collapsedItem.fullSize === null) {\n const target = getElementForItem(ref, collapsedItem);\n if (target) {\n const collapsedSize = measureMinimumNodeSize(target, dimension);\n collapsedItem.fullSize = collapsedItem.size;\n collapsedItem.size = collapsedSize;\n // is the difference between collapsed size and original size enough ?\n // TODO we repeat this code a lot, factoer it out\n const renderedSize = visibleRef.current.reduce(addAll, 0);\n if (renderedSize > containerSizeRef.current) {\n const strategy = markOverflowingItems(\n renderedSize,\n containerSizeRef.current - overflowIndicatorSizeRef.current\n );\n updateOverflowStatus(+strategy);\n }\n }\n }\n } else if (includesOverflow(overflowing)) {\n const target = ref.current.querySelector(\n `:scope > [data-overflow-indicator='true']`\n );\n if (target) {\n const { index, priority = \"1\" } = target?.dataset ?? NO_DATA;\n const item = {\n index: parseInt(index, 10),\n isOverflowIndicator: true,\n priority: parseInt(priority, 10),\n label: target.innerText,\n size: measureMinimumNodeSize(target, dimension),\n };\n overflowIndicatorSizeRef.current = item.size;\n visibleRef.current = visibleRef.current\n .concat(item)\n .sort(byDescendingPriority);\n }\n } else if (getOverflowIndicator(visibleRef)) {\n visibleRef.current = visibleRef.current.filter(\n (item) => !item.isOverflowIndicator\n );\n }\n }, [\n markOverflowingItems,\n overflowing,\n ref,\n updateOverflowStatus,\n visibleRef,\n ]);\n\n // Measurement occurs post-render, by necessity, need to trigger a render\n useLayoutEffect(() => {\n async function measure() {\n await document.fonts.ready;\n if (ref.current !== null) {\n resetMeasurements();\n }\n }\n if (orientation !== \"none\") {\n measure();\n }\n }, [label, orientation, resetMeasurements]);\n\n useResizeObserver(ref, MONITORED_DIMENSIONS[orientation], resizeHandler);\n\n return [ref, overflowedRef.current, collapsedRef.current, resetMeasurements];\n}\n", "const LEFT_RIGHT = ['left', 'right'];\nconst TOP_BOTTOM = ['top', 'bottom'];\n\nexport function measureMinimumNodeSize(node: HTMLElement, dimension: 'width' | 'height' = 'width') {\n const { [dimension]: size } = node.getBoundingClientRect();\n const { padRight = false, padLeft = false } = node.dataset;\n const style = getComputedStyle(node);\n const [start, end] = dimension === 'width' ? LEFT_RIGHT : TOP_BOTTOM;\n const marginStart = padLeft ? 0 : parseInt(style.getPropertyValue(`margin-${start}`), 10);\n const marginEnd = padRight ? 0 : parseInt(style.getPropertyValue(`margin-${end}`), 10);\n\n let minWidth = size;\n const flexShrink = parseInt(style.getPropertyValue('flex-shrink'), 10);\n if (flexShrink > 0) {\n const flexBasis = parseInt(style.getPropertyValue('flex-basis'), 10);\n // TODO what about percentage values ?\n if (!isNaN(flexBasis)) {\n minWidth = flexBasis;\n }\n }\n\n return marginStart + minWidth + marginEnd;\n}\n", "const COLLAPSIBLE = 'data-collapsible';\n\nconst RESPONSIVE_ATTRIBUTE: { [key: string]: boolean } = {\n [COLLAPSIBLE]: true,\n 'data-pad-start': true,\n 'data-pad-end': true\n};\n\nexport const isResponsiveAttribute = (propName: string): boolean =>\n RESPONSIVE_ATTRIBUTE[propName] ?? false;\n\nconst isCollapsible = (propName: string) => propName === COLLAPSIBLE;\n\nconst COLLAPSIBLE_VALUE: { [key: string]: string } = {\n dynamic: 'dynamic',\n instant: 'instant',\n true: 'instant'\n};\n\nconst collapsibleValue = (value: string) => COLLAPSIBLE_VALUE[value] ?? 'none';\n\ntype Props = { [key: string]: any };\nexport const extractResponsiveProps = (props: Props) => {\n return Object.keys(props).reduce<[Props, Props]>(\n (result, propName) => {\n const [toolbarProps, rest] = result;\n if (isResponsiveAttribute(propName)) {\n const value = isCollapsible(propName) ? collapsibleValue(props[propName]) : props[propName];\n\n toolbarProps[propName] = value;\n rest[propName] = undefined;\n }\n return result;\n },\n [{}, {}]\n );\n};\n", "import {\n cloneElement,\n CSSProperties,\n isValidElement,\n ReactElement,\n useCallback,\n useMemo,\n useRef,\n} from \"react\";\nimport { getUniqueId } from \"@vuu-ui/vuu-utils\";\nimport { gatherChildMeta } from \"./flexbox-utils\";\nimport { BreakPoint } from \"./flexboxTypes\";\n\nconst breakPoints: BreakPoint[] = [\"xs\", \"sm\", \"md\", \"lg\", \"xl\"];\n\nconst DEFAULT_COLS = 12;\n\nexport const useResponsiveSizing = ({\n children: childrenProp,\n cols: colsProp,\n style,\n}: {\n children: ReactElement[];\n cols?: number;\n style?: CSSProperties;\n}) => {\n const rootRef = useRef(null);\n const metaRef = useRef(null);\n const contentRef = useRef<ReactElement[]>();\n const cols = colsProp ?? DEFAULT_COLS;\n\n const isColumn = style?.flexDirection === \"column\";\n const dimension = isColumn ? \"height\" : \"width\";\n\n const children = useMemo(\n () =>\n Array.isArray(childrenProp)\n ? childrenProp\n : isValidElement(childrenProp)\n ? [childrenProp]\n : [],\n [childrenProp]\n );\n\n const buildContent = useCallback(\n (children, dimension): [ReactElement[], any] => {\n const childMeta = gatherChildMeta(children, dimension, breakPoints);\n const content = [];\n const meta = [];\n for (let i = 0; i < children.length; i++) {\n const child = children[i];\n const {\n style: { flex, ...rest },\n } = child.props;\n // TODO do we always need to clone ?\n // TODO emit the --col-span based on media query\n content.push(\n cloneElement(child, {\n key: getUniqueId(), // need to store these\n style: {\n ...rest,\n \"--parent-col-count\": cols,\n },\n })\n );\n meta.push(childMeta[i]);\n }\n return [content, meta];\n },\n [cols]\n );\n\n useMemo(() => {\n // console.log(`useMemo<initialCotent>`, children)\n const [content, meta] = buildContent(children, dimension);\n metaRef.current = meta;\n contentRef.current = content;\n }, [buildContent, children, dimension]);\n\n return {\n cols,\n content: contentRef.current,\n rootRef,\n };\n};\n", "import React from 'react';\nimport {FluidGrid, FluidGridProps} from './FluidGrid';\nimport { registerComponent } from '../registry/ComponentRegistry';\n\nexport const FluidGridLayout = function FluidGridLayout(props: FluidGridProps) {\n return <FluidGrid {...props} />;\n};\nFluidGridLayout.displayName = 'FluidGrid';\n\nregisterComponent('FluidGrid', FluidGridLayout, 'container');\n", "import classnames from \"classnames\";\nimport React, {\n HTMLAttributes,\n KeyboardEvent,\n MouseEvent,\n ReactElement,\n useRef,\n useState,\n} from \"react\";\nimport { Contribution, useViewDispatch } from \"../layout-view\";\n\nimport {\n EditableLabel,\n Toolbar,\n ToolbarButton,\n ToolbarField,\n Tooltray,\n} from \"@heswell/salt-lab\";\nimport { CloseIcon } from \"@salt-ds/icons\";\n\nimport \"./Header.css\";\n\nexport interface HeaderProps extends HTMLAttributes<HTMLDivElement> {\n collapsed?: boolean;\n contributions?: Contribution[];\n expanded?: boolean;\n closeable?: boolean;\n onEditTitle: (value: string) => void;\n orientation?: \"horizontal\" | \"vertical\";\n tearOut?: boolean;\n}\n\nexport const Header = ({\n className: classNameProp,\n contributions,\n collapsed,\n expanded,\n closeable,\n onEditTitle,\n orientation: orientationProp = \"horizontal\",\n style,\n tearOut,\n title = \"Untitled\",\n}: HeaderProps) => {\n const labelFieldRef = useRef<HTMLDivElement>(null);\n const [value, setValue] = useState<string>(title);\n const [editing, setEditing] = useState<boolean>(false);\n\n const viewDispatch = useViewDispatch();\n const handleAction = (\n evt: MouseEvent,\n actionId: \"maximize\" | \"restore\" | \"minimize\" | \"tearout\"\n ) => viewDispatch?.({ type: actionId }, evt);\n const handleClose = (evt: MouseEvent) =>\n viewDispatch?.({ type: \"remove\" }, evt);\n const classBase = \"vuuHeader\";\n\n const handleTitleMouseDown = (e: MouseEvent) => {\n labelFieldRef.current?.focus();\n };\n\n const handleButtonMouseDown = (evt: MouseEvent) => {\n // do not allow drag to be initiated\n evt.stopPropagation();\n };\n\n const orientation = collapsed || orientationProp;\n\n const className = classnames(\n classBase,\n classNameProp,\n `${classBase}-${orientation}`\n );\n\n const handleEnterEditMode = () => {\n setEditing(true);\n };\n\n const handleTitleKeyDown = (evt: KeyboardEvent<HTMLDivElement>) => {\n if (evt.key === \"Enter\") {\n setEditing(true);\n }\n };\n\n const handleExitEditMode = (\n originalValue = \"\",\n finalValue = \"\",\n allowDeactivation = true,\n editCancelled = false\n ) => {\n setEditing(false);\n if (editCancelled) {\n setValue(originalValue);\n } else if (finalValue !== originalValue) {\n setValue(finalValue);\n onEditTitle?.(finalValue);\n }\n if (allowDeactivation === false) {\n labelFieldRef.current?.focus();\n }\n };\n\n const handleMouseDown = (e: MouseEvent) => {\n viewDispatch?.({ type: \"mousedown\" }, e);\n };\n\n const toolbarItems: ReactElement[] = [];\n const contributedItems: ReactElement[] = [];\n const actionButtons: ReactElement[] = [];\n\n title &&\n toolbarItems.push(\n <ToolbarField className=\"vuuHeader-title\" key=\"title\">\n <EditableLabel\n editing={editing}\n key=\"title\"\n value={value}\n onChange={setValue}\n onMouseDownCapture={handleTitleMouseDown}\n onEnterEditMode={handleEnterEditMode}\n onExitEditMode={handleExitEditMode}\n onKeyDown={handleTitleKeyDown}\n ref={labelFieldRef}\n tabIndex={0}\n />\n </ToolbarField>\n );\n\n contributions?.forEach((contribution, i) => {\n contributedItems.push(React.cloneElement(contribution.content, { key: i }));\n });\n\n closeable &&\n actionButtons.push(\n <ToolbarButton\n key=\"close\"\n onClick={handleClose}\n onMouseDown={handleButtonMouseDown}\n >\n <CloseIcon /> Close\n </ToolbarButton>\n );\n\n contributedItems.length > 0 &&\n toolbarItems.push(\n <Tooltray data-align-end key=\"contributions\">\n {contributedItems}\n </Tooltray>\n );\n\n actionButtons.length > 0 &&\n toolbarItems.push(\n <Tooltray data-align-end key=\"actions\">\n {actionButtons}\n </Tooltray>\n );\n\n return (\n <Toolbar\n className={className}\n orientation={orientationProp}\n style={style}\n onMouseDown={handleMouseDown}\n >\n {toolbarItems}\n {/* \n {collapsed === false ? (\n <ActionButton\n aria-label=\"Minimize View\"\n actionId=\"minimize\"\n iconName=\"minimize\"\n onClick={handleAction}\n onMouseDown={handleButtonMouseDown}\n />\n ) : null}\n {collapsed ? (\n <ActionButton\n aria-label=\"Restore View\"\n actionId=\"restore\"\n iconName=\"double-chevron-right\"\n onClick={handleAction}\n onMouseDown={handleButtonMouseDown}\n />\n ) : null}\n {expanded === false ? (\n <ActionButton\n aria-label=\"Maximize View\"\n actionId=\"maximize\"\n iconName=\"maximize\"\n onClick={handleAction}\n onMouseDown={handleButtonMouseDown}\n />\n ) : null}\n {expanded ? (\n <ActionButton\n aria-label=\"Restore View\"\n actionId=\"restore\"\n iconName=\"restore\"\n onClick={handleAction}\n onMouseDown={handleButtonMouseDown}\n />\n ) : null}\n {tearOut ? (\n <ActionButton\n aria-label=\"Tear out View\"\n actionId=\"tearout\"\n iconName=\"tear-out\"\n onClick={handleAction}\n onMouseDown={handleButtonMouseDown}\n />\n ) : null}\n {closeable ? (\n <Button\n aria-label=\"close\"\n data-icon\n onClick={handleClose}\n onMouseDown={handleButtonMouseDown}\n />\n ) : null} */}\n </Toolbar>\n );\n};\n", "import path from \"path\";\nimport React, { SyntheticEvent, useContext } from \"react\";\nimport { ViewAction } from \"./viewTypes\";\n\nexport type ViewDispatch = <Action extends ViewAction = ViewAction>(\n action: Action,\n evt?: SyntheticEvent\n) => Promise<boolean | void>;\n\nexport interface ViewContextProps {\n dispatch?: ViewDispatch | null;\n id?: string;\n load?: (key?: string) => unknown;\n loadSession?: (key?: string) => unknown;\n onConfigChange?: (config: unknown) => void;\n path?: string;\n purge?: (key: string) => void;\n save?: (state: unknown, key: string) => void;\n saveSession?: (state: unknown, key: string) => void;\n title?: string;\n}\n\nconst NO_CONTEXT = { dispatch: null } as ViewContextProps;\nexport const ViewContext = React.createContext<ViewContextProps>(NO_CONTEXT);\n\nexport const useViewDispatch = () => {\n const context = useContext(ViewContext);\n return context?.dispatch ?? null;\n};\n\nexport const useViewContext = () => useContext(ViewContext);\n", "import { useForkRef, useIdMemo as useId } from \"@salt-ds/core\";\nimport cx from \"classnames\";\nimport React, { ForwardedRef, forwardRef, useMemo, useRef } from \"react\";\nimport { Header } from \"../layout-header/Header\";\nimport { registerComponent } from \"../registry/ComponentRegistry\";\nimport { ViewContext } from \"./ViewContext\";\nimport { ViewProps } from \"./viewTypes\";\nimport { useView } from \"./useView\";\nimport { useViewResize } from \"./useViewResize\";\n\nimport \"./View.css\";\n\nconst View = forwardRef(function View(\n props: ViewProps,\n forwardedRef: ForwardedRef<HTMLDivElement>\n) {\n const {\n children,\n className,\n collapsed, // \"vertical\" | \"horizontal\" | false | undefined\n closeable,\n \"data-resizeable\": dataResizeable,\n dropTargets,\n expanded,\n flexFill, // use data-flexfill instead\n id: idProp,\n header,\n orientation = \"horizontal\",\n path,\n resize = \"responsive\", // maybe throttle or debounce ?\n resizeable = dataResizeable,\n tearOut,\n style = {},\n title: titleProp,\n ...restProps\n } = props;\n\n // A View within a managed layout will always be passed an id\n const id = useId(idProp);\n const rootRef = useRef<HTMLDivElement>(null);\n const mainRef = useRef<HTMLDivElement>(null);\n\n const {\n contributions,\n dispatchViewAction,\n load,\n loadSession,\n onConfigChange,\n onEditTitle,\n purge,\n restoredState,\n save,\n saveSession,\n title,\n } = useView({\n id,\n rootRef,\n path,\n dropTargets,\n title: titleProp,\n });\n\n useViewResize({ mainRef, resize, rootRef });\n\n const classBase = \"vuuView\";\n\n const getContent = () => {\n // We only inject restored state as props if child is a single element. Maybe we\n // should take this further and only do it if the component has opted into this\n // behaviour.\n if (React.isValidElement(children) && restoredState) {\n return React.cloneElement(children, restoredState);\n } else {\n return children;\n }\n };\n\n const viewContextValue = useMemo(\n () => ({\n dispatch: dispatchViewAction,\n id,\n path,\n title,\n load,\n loadSession,\n onConfigChange,\n purge,\n save,\n saveSession,\n }),\n [\n dispatchViewAction,\n id,\n load,\n loadSession,\n onConfigChange,\n path,\n purge,\n save,\n saveSession,\n title,\n ]\n );\n\n const headerProps = typeof header === \"object\" ? header : {};\n\n return (\n <div\n {...restProps}\n className={cx(classBase, className, {\n [`${classBase}-collapsed`]: collapsed,\n [`${classBase}-expanded`]: expanded,\n [`${classBase}-resize-defer`]: resize === \"defer\",\n })}\n data-resizeable={resizeable}\n id={id}\n ref={useForkRef(forwardedRef, rootRef)}\n style={style}\n tabIndex={-1}\n >\n <ViewContext.Provider value={viewContextValue}>\n {header ? (\n <Header\n {...headerProps}\n collapsed={collapsed}\n contributions={contributions}\n expanded={expanded}\n closeable={closeable}\n onEditTitle={onEditTitle}\n orientation={/*collapsed || */ orientation}\n tearOut={tearOut}\n // title={`${title} v${version} #${id}`}\n title={title}\n />\n ) : null}\n <div className={`${classBase}-main`} ref={mainRef}>\n {getContent()}\n </div>\n </ViewContext.Provider>\n </div>\n );\n});\nView.displayName = \"View\";\n\nconst MemoView = React.memo(View) as React.FunctionComponent<ViewProps>;\nMemoView.displayName = \"View\";\nregisterComponent(\"View\", MemoView, \"view\");\n\nexport { MemoView as View };\n", "import { RefObject, useCallback, useMemo } from \"react\";\nimport { useLayoutProviderDispatch } from \"../layout-provider\";\nimport { usePersistentState } from \"../use-persistent-state\";\nimport { useViewActionDispatcher } from \"./useViewActionDispatcher\";\n\nexport interface ViewHookProps {\n id: string;\n rootRef: RefObject<HTMLDivElement>;\n path?: string;\n dropTargets?: string[];\n title?: string;\n}\n\nexport const useView = ({\n id,\n rootRef,\n path,\n dropTargets,\n title: titleProp,\n}: ViewHookProps) => {\n const layoutDispatch = useLayoutProviderDispatch();\n\n const {\n loadState,\n loadSessionState,\n purgeState,\n saveState,\n saveSessionState,\n } = usePersistentState();\n\n const [dispatchViewAction, contributions] = useViewActionDispatcher(\n id,\n rootRef,\n path,\n dropTargets\n );\n\n const title = useMemo(\n () => loadState(\"view-title\") ?? titleProp,\n [loadState, titleProp]\n );\n\n const onEditTitle = useCallback(\n (title: string) => {\n if (path) {\n layoutDispatch({ type: \"set-title\", path, title });\n }\n },\n [layoutDispatch, path]\n );\n\n const restoredState = useMemo(() => loadState(id), [id, loadState]);\n\n const load = useCallback(\n (key?: string) => loadState(id, key),\n [id, loadState]\n );\n\n const purge = useCallback(\n (key) => {\n purgeState(id, key);\n layoutDispatch({ type: \"save\" });\n },\n [id, purgeState]\n );\n\n const save = useCallback(\n (state, key) => {\n saveState(id, key, state);\n layoutDispatch({ type: \"save\" });\n },\n [id, layoutDispatch, saveState]\n );\n const loadSession = useCallback(\n (key?: string) => loadSessionState(id, key),\n [id, loadSessionState]\n );\n const saveSession = useCallback(\n (state, key) => saveSessionState(id, key, state),\n [id, saveSessionState]\n );\n\n const onConfigChange = useCallback(\n ({ type: key, ...config }) => {\n const { [key]: data } = config;\n save(data, key);\n },\n [save]\n );\n\n return {\n contributions,\n dispatchViewAction,\n load,\n loadSession,\n onConfigChange,\n onEditTitle,\n purge,\n restoredState,\n save,\n saveSession,\n title,\n };\n};\n", "import {\n ReactElement,\n RefObject,\n SyntheticEvent,\n useCallback,\n useState,\n} from \"react\";\nimport { useLayoutProviderDispatch } from \"../layout-provider\";\nimport { DragStartAction } from \"../layout-reducer\";\nimport { ViewDispatch } from \"./ViewContext\";\nimport { ViewAction } from \"./viewTypes\";\nimport { usePersistentState } from \"../use-persistent-state\";\nimport { DataSource } from \"@vuu-ui/vuu-data\";\n\nexport type Contribution = {\n index?: number;\n location?: string;\n content: ReactElement;\n};\n\nexport const useViewActionDispatcher = (\n id: string,\n root: RefObject<HTMLDivElement>,\n viewPath?: string,\n dropTargets?: string[]\n): [ViewDispatch, Contribution[] | undefined] => {\n const { loadSessionState, purgeSessionState, purgeState, saveSessionState } =\n usePersistentState();\n\n const [contributions, setContributions] = useState<Contribution[]>(\n loadSessionState(id, \"contributions\") ?? []\n );\n const dispatchLayoutAction = useLayoutProviderDispatch();\n const updateContributions = useCallback(\n (location: string, content: ReactElement) => {\n const updatedContributions = contributions.concat([\n { location, content },\n ]);\n saveSessionState(id, \"contributions\", updatedContributions);\n setContributions(updatedContributions);\n },\n [contributions, id, saveSessionState]\n );\n\n const clearContributions = useCallback(() => {\n purgeSessionState(id, \"contributions\");\n setContributions([]);\n }, [id, purgeSessionState]);\n\n const handleRemove = useCallback(() => {\n // TODO this requires a bit more thought. I works BECAUSE filteredGrid has\n // stored its datasource in sessionState. It is highly pretty much a\n // requirement for features to do so - how do we enforce it.\n const ds = loadSessionState(id, \"data-source\") as DataSource;\n if (ds) {\n ds.unsubscribe();\n }\n purgeSessionState(id);\n purgeState(id);\n dispatchLayoutAction({ type: \"remove\", path: viewPath });\n }, [\n dispatchLayoutAction,\n id,\n loadSessionState,\n purgeSessionState,\n purgeState,\n viewPath,\n ]);\n\n const handleMouseDown = useCallback(\n async (evt, index, preDragActivity): Promise<boolean> => {\n evt.stopPropagation();\n const dragRect = root.current?.getBoundingClientRect();\n return new Promise((resolve, reject) => {\n // TODO should we check if we are allowed to drag ?\n dispatchLayoutAction({\n type: \"drag-start\",\n evt,\n path: index === undefined ? viewPath : `${viewPath}.${index}`,\n dragRect,\n preDragActivity,\n dropTargets,\n resolveDragStart: resolve,\n rejectDragStart: reject,\n } as DragStartAction);\n });\n },\n [root, dispatchLayoutAction, viewPath, dropTargets]\n );\n\n // TODO should be event, action, then this method can bea assigned directly to a html element\n // as an event hander\n const dispatchAction = useCallback(\n async <A extends ViewAction = ViewAction>(\n action: A,\n evt?: SyntheticEvent\n ): Promise<boolean | void> => {\n const { type } = action;\n switch (type) {\n case \"maximize\":\n case \"minimize\":\n case \"restore\":\n // case Action.TEAR_OUT:\n return dispatchLayoutAction({ type, path: action.path ?? viewPath });\n case \"remove\":\n return handleRemove();\n case \"mousedown\":\n console.log(\"2) ViewActionDispatch Hook dispatch Action mousedown\");\n return handleMouseDown(evt, action.index, action.preDragActivity);\n case \"add-toolbar-contribution\":\n return updateContributions(action.location, action.content);\n case \"remove-toolbar-contribution\":\n return clearContributions();\n default: {\n // if (Object.values(Action).includes(type)) {\n // dispatch(action);\n // }\n return undefined;\n }\n }\n },\n [\n dispatchLayoutAction,\n viewPath,\n handleRemove,\n handleMouseDown,\n updateContributions,\n clearContributions,\n ]\n );\n\n return [dispatchAction, contributions];\n};\n", "import { useResizeObserver, WidthHeight } from \"@heswell/salt-lab\";\nimport { RefObject, useCallback, useRef } from \"react\";\n\nconst NO_MEASUREMENT: string[] = [];\n\ntype size = {\n height?: number;\n width?: number;\n};\n\nexport interface ViewResizeHookProps {\n mainRef: RefObject<HTMLDivElement>;\n resize?: \"defer\" | \"responsive\";\n rootRef: RefObject<HTMLDivElement>;\n}\n\nexport const useViewResize = ({\n mainRef,\n resize = \"responsive\",\n rootRef,\n}: ViewResizeHookProps) => {\n const deferResize = resize === \"defer\";\n\n const mainSize = useRef<size>({});\n const resizeHandle = useRef<number>();\n\n const setMainSize = useCallback(() => {\n if (mainRef.current) {\n mainRef.current.style.height = mainSize.current.height + \"px\";\n mainRef.current.style.width = mainSize.current.width + \"px\";\n }\n resizeHandle.current = undefined;\n }, []);\n\n const onResize = useCallback(\n ({ height, width }) => {\n mainSize.current.height = height;\n mainSize.current.width = width;\n if (resizeHandle.current !== null) {\n clearTimeout(resizeHandle.current);\n }\n resizeHandle.current = window.setTimeout(setMainSize, 40);\n },\n [setMainSize]\n );\n\n useResizeObserver(\n rootRef,\n deferResize ? WidthHeight : NO_MEASUREMENT,\n onResize,\n deferResize\n );\n};\n", "import { List, ListItem, ListItemProps } from \"@heswell/salt-lab\";\nimport { uuid } from \"@vuu-ui/vuu-utils\";\nimport cx from \"classnames\";\nimport {\n cloneElement,\n HTMLAttributes,\n memo,\n MouseEvent,\n ReactElement,\n} from \"react\";\nimport { useLayoutProviderDispatch } from \"../layout-provider\";\nimport { View } from \"../layout-view\";\nimport { registerComponent } from \"../registry/ComponentRegistry\";\n\nimport \"./Palette.css\";\n\nconst clonePaletteItem = (paletteItem: HTMLElement) => {\n const dolly = paletteItem.cloneNode(true) as HTMLElement;\n dolly.id = \"\";\n delete dolly.dataset.idx;\n return dolly;\n};\n\nexport interface PaletteItemProps extends ListItemProps {\n children: ReactElement;\n closeable?: boolean;\n header?: boolean;\n idx?: number;\n resize?: \"defer\";\n resizeable?: boolean;\n}\n\nexport const PaletteItem = memo(\n ({\n className,\n children: component,\n idx,\n resizeable,\n header,\n closeable,\n ...props\n }: PaletteItemProps) => {\n return (\n <ListItem\n className={cx(\"vuuPaletteItem\", className)}\n data-icon=\"grab-handle\"\n {...props}\n />\n );\n }\n);\n\nPaletteItem.displayName = \"PaletteItem\";\n\nexport interface PaletteProps\n extends Omit<HTMLAttributes<HTMLDivElement>, \"onSelect\"> {\n children: ReactElement[];\n orientation: \"horizontal\" | \"vertical\";\n selection?: string;\n}\n\nexport const Palette = ({\n children,\n className,\n orientation = \"horizontal\",\n ...props\n}: PaletteProps) => {\n const dispatch = useLayoutProviderDispatch();\n const classBase = \"vuuPalette\";\n\n function handleMouseDown(evt: MouseEvent) {\n const target = evt.target as HTMLElement;\n const listItemElement = target.closest(\".vuuPaletteItem\") as HTMLElement;\n const idx = parseInt(listItemElement.dataset.idx ?? \"-1\");\n if (idx !== -1) {\n console.log({\n children,\n idx,\n listItemElement,\n });\n }\n const {\n props: { caption, children: payload, template, ...props },\n } = children[idx];\n const { height, left, top, width } =\n listItemElement.getBoundingClientRect();\n const id = uuid();\n const identifiers = { id, key: id };\n const component = template ? (\n payload\n ) : (\n <View {...identifiers} {...props} title={props.label}>\n {payload}\n </View>\n );\n\n dispatch({\n dragRect: {\n left,\n top,\n right: left + width,\n bottom: top + 150,\n width,\n height,\n },\n dragElement: clonePaletteItem(listItemElement),\n evt: evt.nativeEvent,\n instructions: {\n DoNotRemove: true,\n DoNotTransform: true,\n RemoveDraggableOnDragEnd: true,\n dragThreshold: 10,\n },\n path: \"*\",\n payload: component,\n type: \"drag-start\",\n });\n }\n\n return (\n <List\n {...props}\n borderless\n className={cx(classBase, className, `${classBase}-${orientation}`)}\n maxHeight={800}\n selected={null}\n >\n {children.map((child, idx) =>\n child.type === PaletteItem\n ? cloneElement(child, {\n key: idx,\n onMouseDown: handleMouseDown,\n })\n : child\n )}\n </List>\n );\n};\n\nregisterComponent(\"Palette\", Palette, \"view\");\n", "import { List, ListItem, ListItemProps, ListProps } from \"@heswell/salt-lab\";\nimport { uuid } from \"@vuu-ui/vuu-utils\";\nimport cx from \"classnames\";\nimport { MouseEvent, ReactElement } from \"react\";\nimport { useLayoutProviderDispatch } from \"../layout-provider\";\nimport { View } from \"../layout-view\";\nimport { registerComponent } from \"../registry/ComponentRegistry\";\n\nimport \"./PaletteSalt.css\";\n\nconst classBase = \"vuuPalette\";\n\nexport interface PaletteListItemProps extends ListItemProps {\n children: ReactElement;\n ViewProps: {\n header?: boolean;\n closeable?: boolean;\n resizeable?: boolean;\n };\n template: boolean;\n}\n\nexport const PaletteListItem = (props: PaletteListItemProps) => {\n const { children, ViewProps, label, onMouseDown, template, ...restProps } =\n props;\n const dispatch = useLayoutProviderDispatch();\n\n const handleMouseDown = (evt: MouseEvent<HTMLDivElement>) => {\n const { left, top, width } = evt.currentTarget.getBoundingClientRect();\n const id = uuid();\n const identifiers = { id, key: id };\n const component = template ? (\n children\n ) : (\n <View {...identifiers} {...ViewProps} title={props.label}>\n {children}\n </View>\n );\n\n dispatch({\n type: \"drag-start\",\n evt: evt.nativeEvent,\n path: \"*\",\n payload: component,\n instructions: {\n DoNotRemove: true,\n DoNotTransform: true,\n RemoveDraggableOnDragEnd: true,\n dragThreshold: 10,\n },\n dragRect: {\n left,\n top,\n right: left + width,\n bottom: top + 150,\n width,\n height: 100,\n },\n });\n };\n return (\n <ListItem onMouseDown={handleMouseDown} {...restProps}>\n {label}\n </ListItem>\n );\n};\n\nexport const PaletteSalt = ({ className, ...props }: ListProps) => {\n return (\n <List\n {...props}\n className={cx(classBase, className)}\n height=\"100%\"\n selectionStrategy=\"none\"\n />\n );\n};\n\nregisterComponent(\"PaletteSalt\", PaletteSalt, \"view\");\n", "import { useIdMemo as useId } from \"@salt-ds/core\";\nimport cx from \"classnames\";\nimport { Tab, Tabstrip, Toolbar, ToolbarField } from \"@heswell/salt-lab\";\nimport React, {\n ForwardedRef,\n forwardRef,\n MouseEvent,\n ReactElement,\n ReactNode,\n useCallback,\n} from \"react\";\nimport { StackProps } from \"./stackTypes\";\n\nimport \"./Stack.css\";\n\nconst classBase = \"Tabs\";\n\nconst getDefaultTabIcon = (component: ReactElement, tabIndex: number) =>\n undefined;\n\nconst getDefaultTabLabel = (component: ReactElement, tabIndex: number) =>\n component.props?.title ?? `Tab ${tabIndex + 1}`;\n\nconst getChildElements = <T extends ReactElement = ReactElement>(\n children: ReactNode\n): T[] => {\n const elements: T[] = [];\n React.Children.forEach(children, (child) => {\n if (React.isValidElement(child)) {\n elements.push(child as T);\n } else {\n console.warn(`Stack has unexpected child element type`);\n }\n });\n return elements;\n};\n\nexport const Stack = forwardRef(function Stack(\n {\n active = 0,\n children,\n className: classNameProp,\n enableAddTab,\n enableCloseTabs,\n getTabIcon = getDefaultTabIcon,\n getTabLabel = getDefaultTabLabel,\n id: idProp,\n keyBoardActivation = \"manual\",\n onMouseDown,\n onTabAdd,\n onTabClose,\n onTabEdit,\n onTabSelectionChanged,\n showTabs,\n style,\n TabstripProps,\n }: StackProps,\n ref: ForwardedRef<HTMLDivElement>\n) {\n const id = useId(idProp);\n\n const handleTabSelection = (nextIdx: number) => {\n // if uncontrolled, handle it internally\n onTabSelectionChanged?.(nextIdx);\n };\n\n const handleTabClose = (tabIndex: number) => {\n // if uncontrolled, handle it internally\n onTabClose?.(tabIndex);\n };\n\n const handleAddTab = () => {\n // if uncontrolled, handle it internally\n onTabAdd?.(React.Children.count(children));\n };\n\n const handleMouseDown = (e: MouseEvent<HTMLDivElement>) => {\n // if uncontrolled, handle it internally\n const target = e.target as HTMLElement;\n const tabElement = target.closest('[role^=\"tab\"]') as HTMLDivElement;\n const role = tabElement?.getAttribute(\"role\");\n if (role === \"tab\") {\n const tabIndex = parseInt(tabElement.dataset.idx ?? \"-1\");\n if (tabIndex !== -1) {\n onMouseDown?.(e, tabIndex);\n } else {\n throw Error(\"Stack: mousedown on tab with unknown index\");\n }\n } else if (role === \"tablist\") {\n console.log(`Stack mousedown on tabstrip`);\n }\n };\n\n const handleExitEditMode = useCallback(\n (\n _oldText: string,\n newText: string,\n _allowDeactivation: boolean,\n tabIndex: number\n ) => {\n onTabEdit?.(tabIndex, newText);\n },\n [onTabEdit]\n );\n\n const activeChild = () => {\n if (React.isValidElement(children)) {\n return children;\n } else if (Array.isArray(children)) {\n return children[active] ?? null;\n } else {\n return null;\n }\n };\n\n const renderTabs = () =>\n getChildElements(children).map((child, idx) => {\n const rootId = `${id}-${idx}`;\n const { closeable, id: childId } = child.props;\n return (\n <Tab\n ariaControls={`${rootId}-tab`}\n data-icon={getTabIcon(child, idx)}\n draggable\n key={childId ?? idx} // Important that we key by child identifier, not using index\n id={rootId}\n label={getTabLabel(child, idx)}\n closeable={closeable}\n editable={TabstripProps?.enableRenameTab !== false}\n // onEdit={handleTabEdit}\n />\n );\n });\n\n const child = activeChild();\n\n return (\n <div\n className={cx(classBase, classNameProp, {\n [`${classBase}-horizontal`]: TabstripProps?.orientation === \"vertical\",\n })}\n style={style}\n id={id}\n ref={ref}\n >\n {showTabs ? (\n <Toolbar\n className=\"vuuTabHeader vuuHeader\"\n orientation={TabstripProps?.orientation}\n // onMouseDown={handleMouseDown}\n >\n <ToolbarField\n disableFocusRing\n data-collapsible=\"dynamic\"\n data-priority=\"3\"\n style={{ alignSelf: \"flex-end\" }}\n >\n <Tabstrip\n {...TabstripProps}\n enableRenameTab={TabstripProps?.enableRenameTab !== false}\n enableAddTab={enableAddTab}\n enableCloseTab={enableCloseTabs}\n keyBoardActivation={keyBoardActivation}\n onActiveChange={handleTabSelection}\n onAddTab={handleAddTab}\n onCloseTab={handleTabClose}\n onExitEditMode={handleExitEditMode}\n onMouseDown={handleMouseDown}\n activeTabIndex={\n TabstripProps?.activeTabIndex ?? (child === null ? -1 : active)\n }\n >\n {renderTabs()}\n </Tabstrip>\n </ToolbarField>\n </Toolbar>\n ) : null}\n {child}\n </div>\n );\n});\nStack.displayName = \"Stack\";\n", "import { useIdMemo as useId } from \"@salt-ds/core\";\nimport React, { ReactElement, useRef } from \"react\";\nimport { Stack } from \"./Stack\";\n// import { Tooltray } from \"../toolbar\";\n// import { CloseButton, MinimizeButton, MaximizeButton } from \"../action-buttons\";\nimport Component from \"../Component\";\nimport { useLayoutProviderDispatch } from \"../layout-provider\";\nimport { useViewActionDispatcher, View } from \"../layout-view\";\nimport { registerComponent } from \"../registry/ComponentRegistry\";\nimport { usePersistentState } from \"../use-persistent-state\";\nimport { StackProps } from \"./stackTypes\";\n\nimport \"./Stack.css\";\n\nconst defaultCreateNewChild = (index: number) => (\n // Note make this width 100% and height 100% and we get a weird error where view continually resizes - growing\n <View\n resizeable\n title={`Tab ${index}`}\n style={{ flexGrow: 1, flexShrink: 0, flexBasis: 0 }}\n header\n closeable\n >\n <Component style={{ flex: 1 }} />\n </View>\n);\n\nexport const StackLayout = (props: StackProps) => {\n const ref = useRef<HTMLDivElement>(null);\n const dispatch = useLayoutProviderDispatch();\n const { loadState, saveState } = usePersistentState();\n\n const {\n createNewChild = defaultCreateNewChild,\n id: idProp,\n onTabSelectionChanged,\n path,\n ...restProps\n } = props;\n\n const { children } = props;\n\n const id = useId(idProp);\n\n const [dispatchViewAction] = useViewActionDispatcher(id, ref, path);\n\n const handleTabSelection = (nextIdx: number) => {\n console.log(`StackLayout handleTabSelection nextTab = ${nextIdx}`);\n if (path) {\n dispatch({ type: \"switch-tab\", path, nextIdx });\n onTabSelectionChanged?.(nextIdx);\n }\n };\n\n const handleTabClose = (tabIndex: number) => {\n if (Array.isArray(children)) {\n const {\n props: { \"data-path\": dataPath, path = dataPath },\n } = children[tabIndex];\n dispatch({ type: \"remove\", path });\n }\n };\n\n const handleTabAdd = (e: any, tabIndex = React.Children.count(children)) => {\n if (path) {\n console.log(`[StackLayout] handleTabAdd`);\n const component = createNewChild(tabIndex);\n console.log({ component });\n dispatch({\n type: \"add\",\n path,\n component,\n });\n }\n };\n\n const handleMouseDown = async (e: any, index: number) => {\n // If user drags the selected Tab, we need to select another Tab and re-render.\n // This needs to be co-ordinated with drag Tab within Tabstrip, whcih can\n // be handles within The Tabstrip until final release - much like Splitter\n // dragging in Flexbox.\n let readyToDrag: undefined | ((value: unknown) => void);\n\n // Experimental\n const preDragActivity = async () =>\n new Promise((resolve) => {\n console.log(\"preDragActivity: Ok, gonna release the drag\");\n readyToDrag = resolve;\n });\n\n const dragging = await dispatchViewAction(\n { type: \"mousedown\", index, preDragActivity },\n e\n );\n\n if (dragging) {\n readyToDrag?.(undefined);\n }\n };\n\n const handleTabEdit = (tabIndex: number, text: string) => {\n // Save into state on behalf of the associated View\n // Do we need a mechanism to get this into the JSPOMN when we serialize ?\n // const { id } = children[tabIndex].props;\n // saveState(id, 'view-title', text);\n dispatch({ type: \"set-title\", path: `${path}.${tabIndex}`, title: text });\n };\n\n const getTabLabel = (component: ReactElement, idx: number) => {\n const { id, title } = component.props;\n return loadState(id, \"view-title\") || title || `Tab ${idx + 1}`;\n };\n\n return (\n <Stack\n {...restProps}\n id={id}\n getTabLabel={getTabLabel}\n onMouseDown={handleMouseDown}\n onTabAdd={handleTabAdd}\n onTabClose={handleTabClose}\n onTabEdit={handleTabEdit}\n onTabSelectionChanged={handleTabSelection}\n ref={ref}\n // toolbarContent={\n // <Tooltray data-align=\"right\" className=\"layout-buttons\">\n // <MinimizeButton />\n // <MaximizeButton />\n // <CloseButton />\n // </Tooltray>\n // }\n />\n );\n};\nStackLayout.displayName = \"Stack\";\n\nregisterComponent(\"Stack\", StackLayout, \"container\");\n", "import React, { useState } from 'react';\n\nimport { LayoutConfigurator, LayoutTreeViewer } from '..';\nimport { followPathToComponent } from '../..';\n\nexport const ConfigWrapper = ({ children }) => {\n const designMode = false;\n // const [designMode, setDesignMode] = useState(false);\n const [layout, setLayout] = useState(children);\n const [selectedComponent, setSelectedComponent] = useState(children);\n\n const handleSelection = (selectedPath) => {\n const targetComponent = followPathToComponent(layout, selectedPath);\n setSelectedComponent(targetComponent);\n };\n\n const handleChange = (property, value) => {\n console.log(`change ${property} -> ${value}`);\n\n // 2) replace selectedComponent and set layout\n const newComponent = React.cloneElement(selectedComponent, {\n style: {\n ...selectedComponent.props.style,\n [property]: value\n }\n });\n setSelectedComponent(newComponent);\n setLayout(React.cloneElement(layout, null, newComponent));\n };\n\n return (\n <div data-design-mode={`${designMode}`}>\n {layout}\n <br />\n <div style={{ display: 'flex' }}>\n <LayoutConfigurator\n height={300}\n managedStyle={selectedComponent.props.style}\n width={300}\n onChange={handleChange}\n />\n <LayoutTreeViewer\n layout={layout}\n onSelect={handleSelection}\n style={{ width: 300, height: 300, backgroundColor: '#ccc' }}\n />\n </div>\n {/* <StateButton\n defaultChecked={false}\n onChange={(e, value) => setDesignMode(value)}>Design Mode</StateButton> */}\n </div>\n );\n};\n", "import \"./layout-configurator.css\";\nimport { FormField, Input } from \"@heswell/salt-lab\";\n\nconst NO_STYLE = {};\n\nconst DIMENSIONS = {\n margin: {\n top: \"marginTop\",\n right: \"marginRight\",\n bottom: \"marginBottom\",\n left: \"marginLeft\",\n },\n border: {\n top: \"borderTopWidth\",\n right: \"borderRightWidth\",\n bottom: \"borderBottomWidth\",\n left: \"borderLeftWidth\",\n },\n padding: {\n top: \"paddingTop\",\n right: \"paddingRight\",\n bottom: \"paddingBottom\",\n left: \"paddingLeft\",\n },\n};\n\nconst LayoutBox = ({ feature, children, style, onChange }) => {\n return (\n <div className={`LayoutBox layout-${feature} layout-outer`}>\n <div className={`layout-top`}>\n <span className=\"layout-title\">{feature}</span>\n <FormField className=\"layout-input\" style={{ width: 30 }}>\n <Input\n value={style.top}\n onChange={(evt, value) => onChange(feature, \"top\", value)}\n />\n </FormField>\n </div>\n <div className={`layout-inner`}>\n <div className={`layout-left`}>\n <FormField className=\"layout-input\" style={{ width: 30 }}>\n <Input\n value={style.left}\n onChange={(evt, value) => onChange(feature, \"left\", value)}\n />\n </FormField>\n </div>\n {children}\n <div className={`layout-right`}>\n <FormField className=\"layout-input\" style={{ width: 30 }}>\n <Input\n value={style.right}\n onChange={(evt, value) => onChange(feature, \"right\", value)}\n />\n </FormField>\n </div>\n </div>\n <div className={`layout-bottom`}>\n <FormField className=\"layout-input\" style={{ width: 30 }}>\n <Input\n value={style.bottom}\n onChange={(evt, value) => onChange(feature, \"bottom\", value)}\n />\n </FormField>\n </div>\n </div>\n );\n};\n\nexport const MARGIN_STYLES = {\n margin: true,\n marginTop: true,\n marginRight: true,\n marginBottom: true,\n marginLeft: true,\n};\n\nexport const PADDING_STYLES = {\n padding: true,\n paddingTop: true,\n paddingRight: true,\n paddingBottom: true,\n paddingLeft: true,\n};\n\nexport const BORDER_STYLES = {\n border: true,\n borderColor: true,\n borderWidth: true,\n borderTopWidth: true,\n borderRightWidth: true,\n borderBottomWidth: true,\n borderLeftWidth: true,\n};\n\nconst CSS_DIGIT = \"(\\\\d+)(?:px)?\";\nconst CSS_MEASURE = `^(?:${CSS_DIGIT}(?:\\\\s${CSS_DIGIT}(?:\\\\s${CSS_DIGIT}(?:\\\\s${CSS_DIGIT})?)?)?)$`;\nconst CSS_REX = new RegExp(CSS_MEASURE);\nconst BORDER_REX = /^(?:(\\d+)(?:px)\\ssolid\\s([a-zA-Z,0-9().]+))$/;\n\nexport const LayoutConfigurator = ({\n height,\n managedStyle,\n onChange,\n style,\n width,\n}) => {\n const state = normalizeStyle(managedStyle);\n\n const handleChange = (feature, dimension, strValue) => {\n const value = parseInt(strValue || \"0\", 10);\n const property = DIMENSIONS[feature][dimension];\n onChange(property, value);\n };\n\n const {\n marginTop: mt = 0,\n marginRight: mr = 0,\n marginBottom: mb = 0,\n marginLeft: ml = 0,\n } = state;\n const {\n borderTopWidth: bt = 0,\n borderRightWidth: br = 0,\n borderBottomWidth: bb = 0,\n borderLeftWidth: bl = 0,\n } = state;\n const {\n paddingTop: pt = 0,\n paddingRight: pr = 0,\n paddingBottom: pb = 0,\n paddingLeft: pl = 0,\n } = state;\n return (\n <div className=\"LayoutConfigurator\" style={{ width, height, ...style }}>\n <LayoutBox\n feature=\"margin\"\n style={{ top: mt, right: mr, bottom: mb, left: ml }}\n onChange={handleChange}\n >\n <LayoutBox\n feature=\"border\"\n style={{ top: bt, right: br, bottom: bb, left: bl }}\n onChange={handleChange}\n >\n <LayoutBox\n feature=\"padding\"\n style={{ top: pt, right: pr, bottom: pb, left: pl }}\n onChange={handleChange}\n >\n <div className=\"layout-content\" />\n </LayoutBox>\n </LayoutBox>\n </LayoutBox>\n </div>\n );\n};\n\n// TODO merge the following two functions\nexport function XXXnormalizeStyles(\n layoutStyle = NO_STYLE,\n visualStyle = NO_STYLE\n) {\n const {\n margin,\n marginTop,\n marginRight,\n marginBottom,\n marginLeft,\n padding,\n paddingTop,\n paddingRight,\n paddingBottom,\n paddingLeft,\n ...style\n } = layoutStyle;\n\n if (typeof margin === \"number\") {\n style.marginTop =\n style.marginRight =\n style.marginBottom =\n style.marginLeft =\n margin;\n } else if (typeof margin === \"string\") {\n const match = CSS_REX.exec(margin);\n if (match === null) {\n console.error(`Invalid css value for margin '${margin}'`);\n } else {\n const [, pos1, pos2, pos3, pos4] = match;\n const pos123 = pos1 && pos2 && pos3;\n if (pos123 && pos4) {\n style.marginTop = parseInt(pos1, 10);\n style.marginRight = parseInt(pos2, 10);\n style.marginBottom = parseInt(pos3, 10);\n style.marginLeft = parseInt(pos4, 10);\n } else if (pos123) {\n style.marginTop = parseInt(pos1, 10);\n style.marginRight = style.marginLeft = parseInt(pos2, 10);\n style.marginBottom = parseInt(pos3, 10);\n } else if (pos1 && pos2) {\n style.marginTop = style.marginBottom = parseInt(pos1, 10);\n style.marginRight = style.marginLeft = parseInt(pos2, 10);\n } else {\n style.marginTop =\n style.marginRight =\n style.marginBottom =\n style.marginLeft =\n parseInt(pos1, 10);\n }\n }\n }\n if (typeof marginTop === \"number\") style.marginTop = marginTop;\n if (typeof marginRight === \"number\") style.marginRight = marginRight;\n if (typeof marginBottom === \"number\") style.marginBottom = marginBottom;\n if (typeof marginLeft === \"number\") style.marginLeft = marginLeft;\n\n if (typeof padding === \"number\") {\n style.paddingTop =\n style.paddingRight =\n style.paddingBottom =\n style.paddingLeft =\n padding;\n } else if (typeof padding === \"string\") {\n const match = CSS_REX.exec(padding);\n if (match === null) {\n console.error(`Invalid css value for padding '${padding}'`);\n } else {\n const [, pos1, pos2, pos3, pos4] = match;\n const pos123 = pos1 && pos2 && pos3;\n if (pos123 && pos4) {\n style.paddingTop = parseInt(pos1, 10);\n style.paddingRight = parseInt(pos2, 10);\n style.paddingBottom = parseInt(pos3, 10);\n style.paddingLeft = parseInt(pos4, 10);\n } else if (pos123) {\n style.paddingTop = parseInt(pos1, 10);\n style.paddingRight = style.paddingLeft = parseInt(pos2, 10);\n style.paddingBottom = parseInt(pos3, 10);\n } else if (pos1 && pos2) {\n style.paddingTop = style.paddingBottom = parseInt(pos1, 10);\n style.paddingRight = style.paddingLeft = parseInt(pos2, 10);\n } else {\n style.paddingTop =\n style.paddingRight =\n style.paddingBottom =\n style.paddinggLeft =\n parseInt(pos1, 10);\n }\n }\n }\n if (typeof paddingTop === \"number\") style.paddingTop = paddingTop;\n if (typeof paddingRight === \"number\") style.paddingRight = paddingRight;\n if (typeof paddingBottom === \"number\") style.paddingBottom = paddingBottom;\n if (typeof paddingLeft === \"number\") style.paddingLeft = paddingLeft;\n\n return normalizeStyle(style, visualStyle);\n}\n\nfunction normalizeStyle(managedStyle = NO_STYLE) {\n const style = { ...managedStyle };\n\n // if (BORDER_LIST.some(bs => style[bs])) {\n let match;\n\n let {\n border,\n borderWidth,\n borderTopWidth,\n borderRightWidth,\n borderBottomWidth,\n borderLeftWidth,\n borderColor,\n margin,\n marginTop,\n marginRight,\n marginBottom,\n marginLeft,\n padding,\n paddingTop,\n paddingRight,\n paddingBottom,\n paddingLeft,\n ...rest\n } = style;\n\n let marginStyles = {};\n let paddingStyles = {};\n\n if (typeof margin === \"number\") {\n style.marginTop =\n style.marginRight =\n style.marginBottom =\n style.marginLeft =\n margin;\n marginStyles = {\n marginTop: margin,\n marginRight: margin,\n marginBottom: margin,\n marginLeft: margin,\n };\n }\n\n if (typeof padding === \"number\") {\n style.paddingTop =\n style.paddingRight =\n style.paddingBottom =\n style.paddingLeft =\n padding;\n paddingStyles = {\n paddingTop: padding,\n paddingRight: padding,\n paddingBottom: padding,\n paddingLeft: padding,\n };\n }\n\n if (\n border ||\n borderWidth ||\n borderTopWidth ||\n borderRightWidth ||\n borderBottomWidth ||\n borderLeftWidth\n ) {\n if (typeof border === \"string\" && (match = BORDER_REX.exec(border))) {\n // what if both border and borderWidth are specified ?\n [, borderWidth, borderColor] = match;\n borderWidth = parseInt(borderWidth, 10);\n }\n\n if (borderWidth) {\n borderTopWidth =\n borderTopWidth === undefined ? borderWidth : borderTopWidth;\n borderRightWidth =\n borderRightWidth === undefined ? borderWidth : borderRightWidth;\n borderBottomWidth =\n borderBottomWidth === undefined ? borderWidth : borderBottomWidth;\n borderLeftWidth =\n borderLeftWidth === undefined ? borderWidth : borderLeftWidth;\n }\n\n borderColor = borderColor || \"black\";\n const boxShadow = `\n ${borderColor} ${borderLeftWidth || 0}px ${\n borderTopWidth || 0\n }px 0 0 inset,\n ${borderColor} ${-borderRightWidth || 0}px ${\n -borderBottomWidth || 0\n }px 0 0 inset`;\n\n return {\n ...rest,\n ...marginStyles,\n ...paddingStyles,\n borderTopWidth,\n borderRightWidth,\n borderBottomWidth,\n borderLeftWidth,\n borderColor,\n borderStyle: \"solid\",\n boxShadow,\n };\n } else {\n return style;\n }\n // } else {\n // return style;\n // }\n}\n", "import React from \"react\";\nimport cx from \"classnames\";\nimport { typeOf } from \"../../utils\";\n\nimport \"./layout-tree-viewer.css\";\nimport { Tree } from \"@heswell/salt-lab\";\n\nconst classBaseTree = \"hwLayoutTreeViewer\";\n\nconst toTreeJson = (component, path = \"0\") => {\n return {\n label: typeOf(component),\n path,\n childNodes: React.Children.map(component.props.children, (child, i) =>\n toTreeJson(child, path ? `${path}.${i}` : `${i}`)\n ),\n };\n};\n\nexport const LayoutTreeViewer = ({ layout, onSelect, style }) => {\n const treeJson = [toTreeJson(layout)];\n\n const handleSelection = (evt, [{ path }]) => {\n onSelect(path);\n };\n\n return (\n <div className={cx(classBaseTree)} style={style}>\n <Tree\n source={treeJson}\n groupSelection=\"single\"\n onSelectionChange={handleSelection}\n />\n </div>\n );\n};\n"],
|
|
5
|
+
"mappings": "8kBAAA,IAAAA,GAAA,GAAAC,GAAAD,GAAA,YAAAE,GAAA,kBAAAC,GAAA,UAAAC,GAAA,cAAAC,GAAA,sBAAAC,GAAA,kBAAAC,GAAA,WAAAC,GAAA,cAAAC,GAAA,oBAAAC,GAAA,WAAAC,GAAA,aAAAC,GAAA,eAAAC,GAAA,YAAAC,GAAA,kBAAAC,GAAA,cAAAC,GAAA,oBAAAC,GAAA,WAAAC,GAAA,eAAAC,GAAA,uBAAAC,GAAA,mBAAAC,GAAA,0BAAAC,GAAA,0BAAAC,GAAA,qBAAAC,GAAA,kBAAAC,GAAA,mBAAAC,GAAA,YAAAC,GAAA,gBAAAC,GAAA,oBAAAC,GAAA,gBAAAC,GAAA,gBAAAC,GAAA,UAAAC,GAAA,gBAAAC,GAAA,SAAAC,GAAA,gBAAAC,GAAA,gBAAAC,GAAA,cAAAC,GAAA,uBAAAC,GAAA,wBAAAC,GAAA,wBAAAC,GAAA,gBAAAC,GAAA,eAAAC,GAAA,2BAAAC,GAAA,eAAAC,GAAA,eAAAC,EAAA,0BAAAC,GAAA,uBAAAC,GAAA,aAAAC,GAAA,iBAAAC,GAAA,uBAAAC,GAAA,YAAAC,EAAA,aAAAC,EAAA,uBAAAC,GAAA,uBAAAC,GAAA,gBAAAC,EAAA,sBAAAC,GAAA,iBAAAC,GAAA,0BAAAC,GAAA,eAAAC,GAAA,aAAAC,GAAA,WAAAC,GAA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pCA,IACFC,EACEA,IAAmB,OAAYD,EAAcC,EAC/CC,EACEA,IAAqB,OAAYF,EAAcE,EACjDC,EACEA,IAAsB,OAAYH,EAAcG,EAClDC,EACEA,IAAoB,OAAYJ,EAAcI,GAGlDC,EAAcA,GAAe,QAC7B,IAAMI,EAAY;AAAA,kBACJJ,KAAeD,GAAmB,OAC9CH,GAAkB;AAAA,kBAENI,KAAe,CAACH,GAAoB,OAChD,CAACC,GAAqB,gBAGxB,MAAO,CACL,GAAGG,EACH,GAAGC,EACH,GAAGC,EACH,eAAAP,EACA,iBAAAC,EACA,kBAAAC,EACA,gBAAAC,EACA,YAAAC,EACA,YAAa,QACb,UAAAI,CACF,CACF,KACE,QAAO9D,CAKX,CChXA,IAAA+D,GAAkB,oBAClBC,GAAe,yBAIf,IAAAC,GAAqB,6BAuBfC,GAAA,6BArBAC,GAAgB,qBAEhBC,GAAa,CAACC,EAAWC,EAAO,OAC7B,CACL,MAAOC,EAAOF,CAAS,EACvB,KAAAC,EACA,WAAY,GAAAE,QAAM,SAAS,IAAIH,EAAU,MAAM,SAAU,CAACI,EAAOC,IAC/DN,GAAWK,EAAOH,EAAO,GAAGA,KAAQI,IAAM,GAAGA,GAAG,CAClD,CACF,GAGWC,GAAmB,CAAC,CAAE,OAAAC,EAAQ,SAAAC,EAAU,MAAAC,CAAM,IAAM,CAC/D,IAAMC,EAAW,CAACX,GAAWQ,CAAM,CAAC,EAE9BI,EAAkB,CAACC,EAAK,CAAC,CAAE,KAAAX,CAAK,CAAC,IAAM,CAC3CO,EAASP,CAAI,CACf,EAEA,SACE,QAAC,OAAI,aAAW,GAAAY,SAAGf,EAAa,EAAG,MAAOW,EACxC,oBAAC,SACC,OAAQC,EACR,eAAe,SACf,kBAAmBC,EACrB,EACF,CAEJ",
|
|
6
|
+
"names": ["src_exports", "__export", "Action", "BORDER_STYLES", "Chest_default", "Component_default", "ComponentRegistry", "ConfigWrapper", "Dialog", "Draggable", "DraggableLayout", "Drawer_default", "DropMenu", "DropTarget", "Flexbox_default", "FlexboxLayout", "FluidGrid", "FluidGridLayout", "Header", "HeightOnly", "LayoutConfigurator", "LayoutProvider", "LayoutProviderContext", "LayoutProviderVersion", "LayoutTreeViewer", "MARGIN_STYLES", "PADDING_STYLES", "Palette", "PaletteItem", "PaletteListItem", "PaletteSalt", "Placeholder", "Stack", "StackLayout", "MemoView", "ViewContext", "WidthHeight", "WidthOnly", "XXXnormalizeStyles", "componentFromLayout", "computeMenuPosition", "containerOf", "expandFlex", "extractResponsiveProps", "findTarget", "followPath", "followPathToComponent", "followPathToParent", "getChild", "getChildProp", "getPersistentState", "getProp", "getProps", "hasPersistentState", "identifyDropTarget", "isContainer", "isLayoutComponent", "isRegistered", "isResponsiveAttribute", "isTabstrip", "isTypeOf", "isView", "nextLeaf", "nextStep", "previousLeaf", "registerComponent", "resetPath", "setPersistentState", "setRef", "typeOf", "useBreakpoints", "useLayoutProviderDispatch", "useLayoutProviderVersion", "useOverflowObserver", "usePersistentState", "useResizeObserver", "useViewActionDispatcher", "useViewContext", "useViewDispatch", "__toCommonJS", "import_classnames", "import_react", "import_classnames", "import_core", "import_jsx_runtime", "classBase", "sizeAttribute", "value", "getStyle", "styleProp", "sizeOpen", "sizeClosed", "hasSizeOpen", "hasSizeClosed", "Drawer", "children", "classNameProp", "clickToOpen", "defaultOpen", "openProp", "position", "inline", "onClick", "peekaboo", "toggleButton", "props", "open", "setOpen", "className", "cx", "toggleDrawer", "style", "handleClick", "renderToggleButton", "Drawer_default", "import_vuu_utils", "_containers", "_views", "ComponentRegistry", "isContainer", "componentType", "isView", "isLayoutComponent", "type", "isRegistered", "className", "registerComponent", "componentName", "component", "import_jsx_runtime", "isDrawer", "component", "Drawer_default", "isVertical", "position", "Chest", "props", "children", "classNameProp", "id", "style", "classBase", "drawers", "content", "verticalDrawers", "horizontalDrawers", "orientation", "className", "cx", "Chest_default", "registerComponent", "import_react", "import_jsx_runtime", "Component", "resizeable", "props", "ref", "Component_default", "registerComponent", "import_react", "import_classnames", "import_react", "ReactDOM", "ReactDOM", "import_core", "import_jsx_runtime", "containerId", "getPortalContainer", "x", "y", "win", "el", "createDOMContainer", "renderPortal", "component", "container", "onRender", "createContainer", "Portal", "children", "x", "y", "onRender", "renderContainer", "createContainer", "renderPortal", "_a", "import_salt_lab", "import_core", "import_jsx_runtime", "classBase", "Dialog", "children", "className", "isOpen", "onClose", "title", "props", "root", "posX", "setPosX", "posY", "setPosY", "close", "handleRender", "Portal", "cx", "import_classnames", "import_react", "import_jsx_runtime", "DraggableLayout", "props", "sourceRef", "classNameProp", "id", "style", "className", "classnames", "componentName", "registerComponent", "expandFlex", "flex", "import_react", "NO_PROPS", "getProp", "component", "propName", "_a", "props", "getProps", "getChildProp", "container", "target", "rest", "typeOf", "element", "_a", "type", "elementName", "isTypeOf", "removeFinalPathSegment", "path", "pos", "followPathToParent", "source", "dataPath", "sourcePath", "getProps", "followPath", "findTarget", "test", "children", "props", "React", "array", "child", "target", "containerOf", "idx", "finalStep", "nextStep", "getProp", "getChild", "followPathToComponent", "component", "paths", "getChildren", "c", "throwIfNotFound", "route", "i", "message", "nextLeaf", "root", "parent", "pathIndices", "lastIdx", "firstLeaf", "parentIdx", "nextParent", "isContainer", "typeOf", "previousLeaf", "lastLeaf", "layoutRoot", "pathSoFar", "targetPath", "followPathToEnd", "pathVisited", "endOfTheLine", "n", "resetPath", "model", "additionalProps", "pathPropName", "import_react", "componentFromLayout", "layoutModel", "id", "type", "props", "layoutChildren", "ReactType", "getComponentType", "children", "reactType", "ComponentRegistry", "setRef", "ref", "value", "positionValues", "RelativeDropPosition", "Position", "_position", "str", "NORTH", "SOUTH", "EAST", "WEST", "HEADER", "CENTRE", "BoxModel", "model", "dropTargetPaths", "measurements", "measureRootComponent", "layout", "x", "y", "validDropTargets", "allBoxesContainingPoint", "pointPositionWithinRect", "rect", "borderZone", "width", "height", "posX", "posY", "closeToTheEdge", "getPosition", "targetOrientation", "BEFORE", "AFTER", "pctX", "pctY", "position", "tab", "containsPoint", "tabCount", "targetTab", "left", "right", "tabWidth", "getPositionWithinBox", "centerBox", "getCenteredBox", "top", "bottom", "pctSize", "pctOffset", "w", "h", "rootComponent", "dropTargets", "id", "dataPath", "path", "getProps", "type", "typeOf", "el", "measureComponentDomElement", "measureComponent", "isContainer", "collectChildMeasurements", "component", "header", "headerEl", "titleEl", "preX", "preY", "children", "style", "active", "isFlexbox", "isStack", "isTower", "isTerrace", "childMeasurements", "_child", "idx", "omitDragging", "child", "expandedMeasurements", "i", "all", "localPreX", "localPosX", "localPreY", "localPosY", "gapPre", "gapPos", "n", "componentMeasurements", "childType", "scrolling", "scrollHeight", "boxes", "dropTargetPath", "scrollIntoViewIfNeccesary", "nestedBoxes", "scrollTop", "scrollMax", "SCALE_FACTOR", "DragState", "zone", "mouseX", "mouseY", "measurements", "intrinsicSize", "rect", "x", "y", "pctX", "pctY", "pointPositionWithinRect", "scaleFactor", "leadX", "trailX", "leadY", "trailY", "scaledWidth", "scaledHeight", "scaleDiff", "leadXScaleDiff", "leadYScaleDiff", "trailXScaleDiff", "trailYScaleDiff", "_a", "_b", "xy", "mousePos", "state", "mouseConstraint", "posConstraint", "previousPos", "diff", "dir", "pos", "isTabstrip", "dropTarget", "typeOf", "north", "south", "east", "west", "positionValues", "eastwest", "northsouth", "DropTarget", "component", "pos", "clientRect", "nextDropTarget", "tab", "tabLeft", "tabWidth", "positionRelativeToTab", "RelativeDropPosition", "lineWidth", "dragState", "l", "t", "r", "b", "top", "left", "right", "bottom", "header", "inset", "gap", "tabHeight", "_a", "_b", "_c", "_d", "rect", "x", "y", "height", "width", "guideLines", "suggestedWidth", "suggestedHeight", "position", "intrinsicWidth", "intrinsicHeight", "sizeHeight", "sizeWidth", "Position", "halfHeight", "halfWidth", "dropTargets", "identifyDropTarget", "rootLayout", "measurements", "intrinsicSize", "validDropTargets", "allBoxesContainingPoint", "BoxModel", "containers", "dataPath", "path", "isRowPlaceholder", "getProps", "getPosition", "box", "nextTarget", "targets", "targetPosition", "getTargetPosition", "containerPos", "container", "closeToTheEdge", "containingBox", "closeToTop", "closeToRight", "closeToBottom", "closeToLeft", "atTop", "atRight", "atBottom", "atLeft", "isVBox", "isTabbedContainer", "isHBox", "import_classnames", "import_react", "import_react_dom", "React", "_dialogOpen", "_popups", "specialKeyHandler", "closeAllPopups", "ReactDOM", "outsideClickHandler", "popupContainers", "i", "popupClosed", "popupOpened", "name", "_popups", "_dialogOpen", "specialKeyHandler", "outsideClickHandler", "popupClosed", "pos", "PopupComponent", "children", "position", "style", "className", "cx", "incrementingKey", "PopupService", "group", "left", "right", "top", "width", "component", "el", "renderPortal", "ReactDOM", "target", "height", "currentRight", "w", "overflowH", "overflowW", "adjustment", "import_classnames", "import_jsx_runtime", "computeMenuPosition", "dropTarget", "offsetTop", "offsetLeft", "pos", "box", "menuOffset", "classBase", "DropMenu", "className", "onHover", "orientation", "dropTargets", "cx", "target", "i", "import_jsx_runtime", "_multiDropOptions", "_hoverDropTarget", "_shiftedTab", "onHoverDropTarget", "dropTarget", "start", "x", "y", "point", "pathFromPoints", "p1", "points", "pathFromGuideLines", "guideLines", "x1", "y1", "x2", "y2", "x3", "y3", "x4", "y4", "insertSVGRoot", "root", "container", "DropTargetCanvas", "dragRect", "tabMode", "d", "dropOutlinePath", "clearShiftedTab", "PopupService", "width", "height", "tabLeft", "tabWidth", "tabHeight", "tabOnly", "left", "dragState", "wasMultiDrop", "moveExistingTabs", "top", "orientation", "computeMenuPosition", "component", "DropMenu", "targetDropOutline", "l", "t", "r", "b", "w", "path", "animation", "dropGuidePath", "cssShiftRight", "cssShiftBack", "_a", "_b", "AFTER", "BEFORE", "RelativeDropPosition", "Stack", "tab", "id", "tabEl", "tabOffset", "selector", "_dragStartCallback", "_dragMoveCallback", "_dragEndCallback", "_dragStartX", "_dragStartY", "_dragContainer", "_dragState", "_dropTarget", "_validDropTargetPaths", "_dragInstructions", "_measurements", "_simpleDrag", "_dragThreshold", "_mouseDownTimer", "DEFAULT_DRAG_THRESHOLD", "_dropTargetRenderer", "DropTargetCanvas", "SCALE_FACTOR", "getDragContainer", "rootContainer", "dragContainerPath", "followPath", "findTarget", "props", "Draggable", "dragStartCallback", "dragInstructions", "preDragMousemoveHandler", "preDragMouseupHandler", "top", "left", "right", "bottom", "dragPos", "dragHandler", "intrinsicSize", "dropTargets", "initDrag", "x", "y", "x_diff", "y_diff", "dragRect", "dataPath", "path", "getProps", "id", "target", "BoxModel", "dragZone", "DragState", "pctX", "pctY", "dragMousemoveHandler", "dragMouseupHandler", "evt", "dragState", "currentDropTarget", "dropTarget", "newX", "newY", "identifyDropTarget", "onDragEnd", "DropTarget", "Position", "import_core", "import_classnames", "import_react", "import_react", "import_vuu_utils", "import_react", "import_classnames", "import_jsx_runtime", "Splitter", "React", "column", "index", "onDrag", "onDragEnd", "onDragStart", "style", "ignoreClick", "rootRef", "lastPos", "active", "setActive", "handleKeyDownDrag", "key", "shiftKey", "distance", "handleKeyDownInitDrag", "evt", "keyDownHandlerRef", "handleKeyDown", "handleMouseMove", "e", "pos", "diff", "handleMouseUp", "_a", "handleMouseDown", "handleFocus", "handleClick", "handleBlur", "className", "cx", "import_classnames", "import_jsx_runtime", "classBase", "Placeholder", "className", "closeable", "flexFill", "resizeable", "shim", "props", "cx", "registerComponent", "import_react", "import_vuu_utils", "placeHolderProps", "NO_STYLE", "auto", "defaultFlexStyle", "CROSS_DIMENSION", "getFlexDimensions", "flexDirection", "isPercentageSize", "value", "getIntrinsicSize", "component", "width", "height", "numHeight", "numWidth", "getFlexStyle", "dimension", "pos", "crossDimension", "intrinsicCrossSize", "intrinsicStyles", "hasUnboundedFlexStyle", "flex", "flexGrow", "flexShrink", "flexBasis", "getFlexOrIntrinsicStyle", "intrinsicSize", "wrapIntrinsicSizeComponentWithFlexbox", "path", "clientRect", "dropRect", "wrappedChildren", "pathIndex", "endPlaceholder", "startPlaceholder", "dropLeft", "dropTop", "dropRight", "dropBottom", "createPlaceHolder", "version", "style", "getProps", "resetPath", "createFlexbox", "getFlexValue", "flexFill", "props", "children", "id", "resizeable", "React", "ComponentRegistry", "baseStyle", "size", "NO_INTRINSIC_SIZE", "SPLITTER", "PLACEHOLDER", "isIntrinsicallySized", "item", "getBreakPointValues", "breakPoints", "component", "values", "breakPoint", "getProp", "gatherChildMeta", "children", "dimension", "child", "index", "_a", "resizeable", "intrinsicSize", "getIntrinsicSize", "flexOpen", "hasUnboundedFlexStyle", "findSplitterAndPlaceholderPositions", "childMeta", "count", "allIntrinsic", "splitterPositions", "i", "resizeablesLeft", "identifyResizeParties", "contentMeta", "idx", "idx1", "getLeadingResizeablePos", "idx2", "getTrailingResizeablePos", "participants", "bystanders", "identifyResizeBystanders", "pos", "isResizeable", "placeholder", "splitter", "originalContentOnly", "meta", "useSplitterResizing", "childrenProp", "onSplitterMoved", "style", "rootRef", "metaRef", "contentRef", "assignedKeys", "forceUpdate", "setContent", "content", "isColumn", "dimension", "children", "React", "handleDragStart", "index", "contentMeta", "participants", "bystanders", "identifyResizeParties", "_a", "el", "size", "minSize", "measureElement", "handleDrag", "idx", "distance", "resizeContent", "handleDragEnd", "createSplitter", "i", "Splitter", "buildContent", "keys", "childMeta", "gatherChildMeta", "splitterAndPlaceholderPositions", "findSplitterAndPlaceholderPositions", "child", "PLACEHOLDER", "createPlaceholder", "key", "SPLITTER", "updateMeta", "currentSize", "flexOpen", "flexBasis", "hasCurrentSize", "actualFlexBasis", "resizeTargets", "target1", "multiplier", "leadingItem", "leadingSize", "trailingItem", "trailingSize", "Placeholder", "minSizeVal", "import_jsx_runtime", "classBase", "Flexbox", "props", "ref", "breakPoints", "children", "column", "classNameProp", "flexFill", "gap", "fullPage", "id", "onSplitterMoved", "resizeable", "row", "spacing", "splitterSize", "style", "rest", "content", "rootRef", "useSplitterResizing", "className", "cx", "Flexbox_default", "import_react", "Action", "import_react", "import_react", "import_react", "import_vuu_utils", "import_vuu_utils", "import_react", "import_react", "persistentState", "sessionState", "getPersistentState", "id", "hasPersistentState", "setPersistentState", "value", "usePersistentState", "loadSessionState", "key", "state", "saveSessionState", "data", "purgeSessionState", "_doomedState", "rest", "loadState", "saveState", "purgeState", "getManagedDimension", "style", "theKidHasNoStyle", "applyLayoutProps", "component", "path", "layoutProps", "children", "getChildLayoutProps", "typeOf", "React", "processLayoutElement", "layoutElement", "previousLayout", "type", "getLayoutProps", "type", "props", "path", "parentType", "previousLayout", "_a", "_b", "prevActive", "dataPath", "prevPath", "prevId", "prevStyle", "getProps", "prevMatch", "typeOf", "id", "active", "key", "style", "getStyle", "isLayoutComponent", "getChildLayoutProps", "layoutProps", "layoutFromJson", "previousChildren", "children", "getLayoutChildren", "kids", "React", "isContainer", "child", "i", "childType", "previousType", "theKidHasNoStyle", "flex", "otherStyles", "expandFlex", "state", "componentType", "ComponentRegistry", "setPersistentState", "layoutToJSON", "component", "componentToJson", "_omit", "hasPersistentState", "getPersistentState", "serializeProps", "otherProps", "result", "value", "serializeValue", "k", "v", "getInsertTabBeforeAfter", "stack", "pos", "_a", "tabs", "tabCount", "index", "positionRelativeToTab", "insertIntoContainer", "container", "targetContainer", "newComponent", "containerActive", "containerChildren", "containerPath", "getProps", "existingComponentPath", "getProp", "idx", "finalStep", "nextStep", "insertedIdx", "children", "insertIntoChildren", "child", "active", "typeOf", "React", "count", "id", "resetPath", "insertBesideChild", "existingComponent", "insertionPosition", "clientRect", "dropRect", "updateChildren", "intrinsicSize", "getIntrinsicSize", "insertIntrinsicSizedComponent", "insertFlexComponent", "getLeadingPlaceholderSize", "flexDirection", "top", "right", "bottom", "left", "rectLeft", "rectTop", "rectRight", "rectBottom", "dimension", "crossDimension", "contraDirection", "getFlexDimensions", "intrinsicCrossSize", "path", "placeholderSize", "itemToInsert", "size", "wrapIntrinsicSizeComponentWithFlexbox", "placeholder", "createPlaceHolder", "intrinsicCrossChildSize", "targetRect", "arr", "i", "insertedComponent", "getStyledComponents", "version", "dim", "getManagedDimension", "splitterSize", "existingComponentStyle", "getFlexOrIntrinsicStyle", "newComponentStyle", "_1", "_2", "_3", "style", "LayoutActionType", "import_react", "import_react", "replaceChild", "model", "target", "replacement", "_replaceChild", "child", "path", "getProp", "resizeable", "style", "getProps", "newChild", "applyLayoutProps", "React", "swapChild", "op", "idx", "finalStep", "nextStep", "children", "Action", "minimize", "restore", "parent", "parentStyle", "childStyle", "width", "height", "flexBasis", "flexShrink", "flexGrow", "rest", "restoreStyle", "collapsed", "removeChild", "layoutRoot", "path", "target", "followPath", "targetParent", "followPathToParent", "children", "getProps", "allOtherChildrenArePlaceholders", "flexBasis", "display", "flexDirection", "style", "containerPath", "getProp", "newLayout", "swapChild", "createPlaceHolder", "hasAdjacentPlaceholders", "collapsePlaceholders", "_removeChild", "container", "child", "active", "componentChildren", "preserve", "idx", "finalStep", "nextStep", "type", "typeOf", "unwrap", "isFlexible", "canBeMadeFlexible", "makeFlexible", "i", "resetPath", "React", "flexGrow", "flexShrink", "width", "height", "unwrappedChild", "dim", "size", "element", "wasPlaceholder", "isPlaceholder", "_collapsePlaceHolders", "newChildren", "placeholders", "mergePlaceholders", "placeholder", "targetStyle", "import_react", "resizeFlexChildren", "layoutRoot", "path", "sizes", "target", "followPath", "children", "style", "getProps", "dimension", "replacementChildren", "applySizesToChildren", "replacement", "React", "swapChild", "child", "i", "size", "actualFlexBasis", "meta", "currentSize", "flexBasis", "newSize", "applySizeToChild", "hasSize", "flexShrink", "flexGrow", "import_react", "import_vuu_utils", "isHtmlElement", "component", "firstLetter", "typeOf", "wrap", "container", "existingComponent", "newComponent", "pos", "clientRect", "dropRect", "containerChildren", "containerPath", "getProps", "existingComponentPath", "getProp", "idx", "finalStep", "nextStep", "children", "updateChildren", "child", "index", "React", "intrinsicSize", "getIntrinsicSize", "wrapIntrinsicSizedComponent", "wrapFlexComponent", "_a", "version", "type", "flexDirection", "showTabsProp", "getLayoutSpecForWrapper", "style", "existingComponentStyle", "newComponentStyle", "getWrappedFlexStyles", "targetFirst", "isTargetFirst", "active", "newComponentProps", "existingComponentProps", "showTabs", "splitterSize", "id", "wrapper", "ComponentRegistry", "resetPath", "applyLayoutProps", "contraDirection", "dropLeft", "dropTop", "dropRight", "dropBottom", "startPlaceholder", "endPlaceholder", "pathRoot", "pathIndex", "resizeProp", "wrappedChildren", "createPlaceHolder", "wrapIntrinsicSizeComponentWithFlexbox", "createFlexbox", "dimension", "getFlexStyle", "layoutReducer", "state", "action", "LayoutActionType", "addChild", "dragDrop", "setChildProps", "removeChild", "replaceChild", "setTitle", "resizeFlexChildren", "switchTab", "path", "nextIdx", "target", "followPath", "replacement", "React", "swapChild", "title", "type", "layoutRoot", "_a", "_b", "newComponent", "dragInstructions", "dropTarget", "existingComponent", "pos", "destinationTabstrip", "typeOf", "id", "version", "getProps", "intrinsicSize", "getIntrinsicSize", "newLayoutRoot", "targetTab", "insertionPosition", "getInsertTabBeforeAfter", "insertIntoContainer", "insertBesideChild", "_replaceChild", "dropLayoutIntoContainer", "finalTarget", "findTarget", "props", "finalPath", "getProp", "containerPath", "component", "clientRect", "dropRect", "existingComponentPath", "wrap", "targetContainer", "followPathToParent", "withTheGrain", "isContainer", "container", "isTerrace", "isTower", "import_react", "unconfiguredLayoutProviderDispatch", "action", "LayoutProviderContext", "import_react", "NO_INSTRUCTIONS", "NO_OFFSETS", "getDragElement", "rect", "id", "dragElement", "wrapper", "div", "cssText", "determineDragOffsets", "draggedElement", "offsetParent", "offsetLeft", "offsetTop", "useLayoutDragDrop", "rootLayoutRef", "dispatch", "dragActionRef", "dragOperationRef", "draggableHTMLElementRef", "handleDrag", "x", "y", "offsetX", "offsetY", "targetPosition", "left", "top", "handleDrop", "dropTarget", "dragInstructions", "draggedReactElement", "originalCSS", "handleDragStart", "evt", "component", "dragContainerPath", "dragRect", "instructions", "path", "rootLayout", "dragPos", "dragPayload", "followPath", "dragPayloadId", "intrinsicSize", "getIntrinsicSize", "dragCSS", "dragTransform", "dragStartLeft", "dragStartTop", "dragOffsets", "element", "width", "height", "Draggable", "action", "options", "import_jsx_runtime", "withDropTarget", "props", "shouldSave", "action", "LayoutProviderVersion", "version", "useLayoutProviderVersion", "LayoutProvider", "children", "layout", "onLayoutChange", "state", "childrenRef", "forceRefresh", "serializeState", "source", "targetContainer", "findTarget", "target", "typeOf", "getProps", "serializedModel", "layoutToJSON", "dispatchLayoutAction", "suppressSave", "nextState", "layoutReducer", "layoutActionDispatcher", "prepareToDragLayout", "useLayoutDragDrop", "getChildProp", "newLayout", "layoutFromJson", "LayoutActionType", "processLayoutElement", "LayoutProviderContext", "useLayoutProviderDispatch", "dispatchLayoutProvider", "import_jsx_runtime", "FlexboxLayout", "props", "path", "dispatch", "useLayoutProviderDispatch", "handleSplitterMoved", "sizes", "Action", "Flexbox_default", "registerComponent", "import_core", "import_classnames", "import_react", "import_react", "import_react", "WidthHeight", "HeightOnly", "WidthOnly", "observedMap", "getTargetSize", "element", "contentRect", "dimension", "resizeObserver", "entries", "entry", "target", "observedTarget", "onResize", "measurements", "sizeChanged", "size", "newSize", "useResizeObserver", "ref", "dimensions", "reportInitialSize", "dimensionsRef", "measure", "rect", "map", "dim", "cleanedUp", "registerObserver", "fonts", "record", "breakpointReader", "themeName", "defaultBreakpoints", "themeRoot", "handler", "style", "stopName", "val", "byDescendingStopSize", "s1", "s2", "breakpointRamp", "breakpoints", "name", "value", "i", "all", "documentBreakpoints", "loadBreakpoints", "xs", "sm", "md", "lg", "xl", "getBreakPoints", "EMPTY_ARRAY", "useBreakpoints", "breakPointsProp", "smallerThan", "ref", "breakpointMatch", "setBreakpointmatch", "bodyRef", "breakPointsRef", "breakpointRamp", "getBreakPoints", "sizeRef", "stopFromMinWidth", "w", "name", "size", "matchSizeAgainstBreakpoints", "width", "breakPointRamp", "maxValue", "useResizeObserver", "measuredWidth", "result", "target", "prevSize", "clientWidth", "import_react", "LEFT_RIGHT", "TOP_BOTTOM", "measureMinimumNodeSize", "node", "dimension", "size", "padRight", "padLeft", "style", "start", "end", "marginStart", "marginEnd", "minWidth", "flexBasis", "MONITORED_DIMENSIONS", "NO_OVERFLOW_INDICATOR", "NO_DATA", "UNCOLLAPSED_DYNAMIC_ITEMS", "addAll", "sum", "m", "addAllExceptOverflowIndicator", "lastOverflowableItem", "arr", "i", "item", "OVERFLOWING", "collapsedOnly", "status", "includesOverflow", "lastListItem", "listRef", "newlyCollapsed", "visibleItems", "hasUncollapsedDynamicItems", "containerRef", "moveOverflowItem", "fromStack", "toStack", "byDescendingPriority", "m1", "m2", "result", "getOverflowIndicator", "visibleRef", "Dimensions", "measureContainerOverflow", "innerEl", "orientation", "dim", "containerDepth", "scrollDepth", "contentSize", "useOverflowStatus", "forceUpdate", "overflowing", "_setOverflowing", "overflowingRef", "setOverflowing", "value", "updateOverflowStatus", "force", "measureChildNodes", "dimension", "list", "node", "_a", "collapsible", "collapsed", "collapsing", "index", "priority", "overflowIndicator", "overflowed", "size", "measureMinimumNodeSize", "getElementForItem", "ref", "useOverflowObserver", "label", "overflowedRef", "collapsedRef", "collapsingRef", "rootDepthRef", "containerSizeRef", "horizontalRef", "overflowIndicatorSizeRef", "minSizeRef", "setContainerMinSize", "isHorizontal", "styleDimension", "markOverflowingItems", "visibleContentSize", "containerSize", "target", "overflowedItem", "removeOverflowIfSpaceAllows", "diff", "itemDiff", "nextSize", "overflowSize", "initializeDynamicContent", "collapseCollapsingItem", "last", "lastTarget", "restoreCollapsingItem", "checkDynamicContent", "containerHasGrown", "collapsingItem", "collapsedItem", "style", "minSize", "resetMeasurements", "isOverflowing", "innerContainerSize", "rootContainerDepth", "hasDynamicItems", "measurements", "element", "renderedSize", "resizeHandler", "scrollHeight", "height", "scrollWidth", "width", "depth", "wasFullSize", "overflowDetected", "collapsedSize", "strategy", "measure", "useResizeObserver", "COLLAPSIBLE", "RESPONSIVE_ATTRIBUTE", "isResponsiveAttribute", "propName", "_a", "isCollapsible", "COLLAPSIBLE_VALUE", "collapsibleValue", "value", "extractResponsiveProps", "props", "result", "toolbarProps", "rest", "import_react", "import_vuu_utils", "breakPoints", "DEFAULT_COLS", "useResponsiveSizing", "childrenProp", "colsProp", "style", "rootRef", "metaRef", "contentRef", "cols", "dimension", "children", "buildContent", "childMeta", "gatherChildMeta", "content", "meta", "i", "child", "flex", "rest", "import_jsx_runtime", "classBase", "FluidGrid", "props", "ref", "breakPoints", "children", "column", "colsProp", "classNameProp", "flexFill", "gap", "fullPage", "id", "onSplitterMoved", "resizeable", "row", "showGrid", "spacing", "splitterSize", "styleProp", "rest", "cols", "content", "rootRef", "useResponsiveSizing", "breakpoint", "useBreakpoints", "className", "cx", "style", "import_jsx_runtime", "FluidGridLayout", "props", "FluidGrid", "registerComponent", "import_classnames", "import_react", "import_react", "NO_CONTEXT", "ViewContext", "React", "useViewDispatch", "_a", "context", "useViewContext", "import_core", "import_classnames", "import_react", "import_react", "import_react", "useViewActionDispatcher", "id", "root", "viewPath", "dropTargets", "_a", "loadSessionState", "purgeSessionState", "purgeState", "saveSessionState", "usePersistentState", "contributions", "setContributions", "dispatchLayoutAction", "useLayoutProviderDispatch", "updateContributions", "location", "content", "updatedContributions", "clearContributions", "handleRemove", "ds", "handleMouseDown", "evt", "index", "preDragActivity", "dragRect", "resolve", "reject", "action", "type", "useView", "id", "rootRef", "path", "dropTargets", "titleProp", "layoutDispatch", "useLayoutProviderDispatch", "loadState", "loadSessionState", "purgeState", "saveState", "saveSessionState", "usePersistentState", "dispatchViewAction", "contributions", "useViewActionDispatcher", "title", "_a", "onEditTitle", "restoredState", "load", "key", "purge", "save", "state", "loadSession", "saveSession", "onConfigChange", "config", "data", "import_salt_lab", "import_react", "NO_MEASUREMENT", "useViewResize", "mainRef", "resize", "rootRef", "deferResize", "mainSize", "resizeHandle", "setMainSize", "onResize", "height", "width", "import_jsx_runtime", "View", "props", "forwardedRef", "children", "className", "collapsed", "closeable", "dataResizeable", "dropTargets", "expanded", "flexFill", "idProp", "header", "orientation", "path", "resize", "resizeable", "tearOut", "style", "titleProp", "restProps", "id", "useId", "rootRef", "mainRef", "contributions", "dispatchViewAction", "load", "loadSession", "onConfigChange", "onEditTitle", "purge", "restoredState", "save", "saveSession", "title", "useView", "useViewResize", "classBase", "getContent", "React", "viewContextValue", "headerProps", "cx", "ViewContext", "Header", "MemoView", "registerComponent", "import_salt_lab", "import_icons", "import_jsx_runtime", "Header", "classNameProp", "contributions", "collapsed", "expanded", "closeable", "onEditTitle", "orientationProp", "style", "tearOut", "title", "labelFieldRef", "value", "setValue", "editing", "setEditing", "viewDispatch", "useViewDispatch", "handleAction", "evt", "actionId", "handleClose", "classBase", "handleTitleMouseDown", "e", "_a", "handleButtonMouseDown", "className", "classnames", "handleEnterEditMode", "handleTitleKeyDown", "handleExitEditMode", "originalValue", "finalValue", "allowDeactivation", "editCancelled", "handleMouseDown", "toolbarItems", "contributedItems", "actionButtons", "contribution", "i", "React", "import_salt_lab", "import_vuu_utils", "import_classnames", "import_react", "import_jsx_runtime", "clonePaletteItem", "paletteItem", "dolly", "PaletteItem", "className", "component", "idx", "resizeable", "header", "closeable", "props", "cx", "Palette", "children", "orientation", "dispatch", "useLayoutProviderDispatch", "classBase", "handleMouseDown", "evt", "_a", "listItemElement", "caption", "payload", "template", "height", "left", "top", "width", "id", "MemoView", "child", "registerComponent", "import_salt_lab", "import_vuu_utils", "import_classnames", "import_jsx_runtime", "classBase", "PaletteListItem", "props", "children", "ViewProps", "label", "onMouseDown", "template", "restProps", "dispatch", "useLayoutProviderDispatch", "evt", "left", "top", "width", "id", "component", "MemoView", "PaletteSalt", "className", "cx", "registerComponent", "import_core", "import_classnames", "import_salt_lab", "import_react", "import_jsx_runtime", "classBase", "getDefaultTabIcon", "component", "tabIndex", "getDefaultTabLabel", "_a", "_b", "getChildElements", "children", "elements", "React", "child", "Stack", "active", "classNameProp", "enableAddTab", "enableCloseTabs", "getTabIcon", "getTabLabel", "idProp", "keyBoardActivation", "onMouseDown", "onTabAdd", "onTabClose", "onTabEdit", "onTabSelectionChanged", "showTabs", "style", "TabstripProps", "ref", "id", "useId", "handleTabSelection", "nextIdx", "handleTabClose", "handleAddTab", "handleMouseDown", "e", "tabElement", "role", "handleExitEditMode", "_oldText", "newText", "_allowDeactivation", "activeChild", "renderTabs", "idx", "rootId", "closeable", "childId", "cx", "import_core", "import_react", "import_jsx_runtime", "defaultCreateNewChild", "index", "MemoView", "Component_default", "StackLayout", "props", "ref", "dispatch", "useLayoutProviderDispatch", "loadState", "saveState", "usePersistentState", "createNewChild", "idProp", "onTabSelectionChanged", "path", "restProps", "children", "id", "useId", "dispatchViewAction", "useViewActionDispatcher", "Stack", "component", "idx", "title", "e", "readyToDrag", "resolve", "tabIndex", "React", "dataPath", "text", "nextIdx", "registerComponent", "import_react", "import_jsx_runtime", "ConfigWrapper", "children", "layout", "setLayout", "selectedComponent", "setSelectedComponent", "handleSelection", "selectedPath", "targetComponent", "followPathToComponent", "handleChange", "property", "value", "newComponent", "React", "LayoutConfigurator", "LayoutTreeViewer", "import_salt_lab", "import_jsx_runtime", "NO_STYLE", "DIMENSIONS", "LayoutBox", "feature", "children", "style", "onChange", "evt", "value", "MARGIN_STYLES", "PADDING_STYLES", "BORDER_STYLES", "CSS_DIGIT", "CSS_MEASURE", "CSS_REX", "BORDER_REX", "LayoutConfigurator", "height", "managedStyle", "width", "state", "normalizeStyle", "handleChange", "dimension", "strValue", "property", "mt", "mr", "mb", "ml", "bt", "br", "bb", "bl", "pt", "pr", "pb", "pl", "XXXnormalizeStyles", "layoutStyle", "visualStyle", "margin", "marginTop", "marginRight", "marginBottom", "marginLeft", "padding", "paddingTop", "paddingRight", "paddingBottom", "paddingLeft", "match", "pos1", "pos2", "pos3", "pos4", "pos123", "border", "borderWidth", "borderTopWidth", "borderRightWidth", "borderBottomWidth", "borderLeftWidth", "borderColor", "rest", "marginStyles", "paddingStyles", "boxShadow", "import_react", "import_classnames", "import_salt_lab", "import_jsx_runtime", "classBaseTree", "toTreeJson", "component", "path", "typeOf", "React", "child", "i", "LayoutTreeViewer", "layout", "onSelect", "style", "treeJson", "handleSelection", "evt", "cx"]
|
|
7
7
|
}
|