react-cosmos-ui 6.2.3 → 6.2.4-canary.0ff5b03.0

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.
Files changed (116) hide show
  1. package/dist/components/SidePanel.js +2 -10
  2. package/dist/components/ValueInputTree/ExpandCollapseValues.js +1 -1
  3. package/dist/components/buttons/shared.d.ts +1 -0
  4. package/dist/components/buttons/shared.js +3 -0
  5. package/dist/components/icons/index.d.ts +4 -0
  6. package/dist/components/icons/index.js +12 -0
  7. package/dist/cosmos.decorator.js +1 -2
  8. package/dist/hooks/useDrag.js +19 -4
  9. package/dist/index.d.ts +3 -3
  10. package/dist/index.js +3 -3
  11. package/dist/playground.bundle.js +327 -541
  12. package/dist/playground.bundle.js.LICENSE.txt +18 -8
  13. package/dist/playground.bundle.js.map +1 -1
  14. package/dist/plugins/ClassStatePanel/index.js +1 -1
  15. package/dist/plugins/FixtureBookmark/FixtureBookmarks.js +2 -3
  16. package/dist/plugins/FixtureBookmark/index.js +7 -2
  17. package/dist/plugins/FixtureSearch/FixtureSearchHeader.d.ts +2 -2
  18. package/dist/plugins/FixtureSearch/FixtureSearchHeader.js +4 -3
  19. package/dist/plugins/FixtureSearch/FixtureSearchOverlay.js +1 -1
  20. package/dist/plugins/FixtureSearch/FixtureSearchResult.js +4 -1
  21. package/dist/plugins/FixtureSearch/index.js +3 -3
  22. package/dist/plugins/FixtureTree/FixtureSelectContext.d.ts +11 -0
  23. package/dist/plugins/FixtureTree/FixtureSelectContext.js +11 -0
  24. package/dist/plugins/FixtureTree/FixtureTree/FixtureButton.d.ts +2 -4
  25. package/dist/plugins/FixtureTree/FixtureTree/FixtureButton.js +2 -2
  26. package/dist/plugins/FixtureTree/FixtureTree/FixtureLink.d.ts +2 -2
  27. package/dist/plugins/FixtureTree/FixtureTree/FixtureLink.js +5 -3
  28. package/dist/plugins/FixtureTree/FixtureTree/FixtureTree.d.ts +1 -2
  29. package/dist/plugins/FixtureTree/FixtureTree/FixtureTree.js +3 -3
  30. package/dist/plugins/FixtureTree/FixtureTree/MultiFixtureButton.d.ts +2 -3
  31. package/dist/plugins/FixtureTree/FixtureTree/MultiFixtureButton.js +3 -3
  32. package/dist/plugins/FixtureTree/FixtureTree/MultiFixtureChildButton.d.ts +2 -3
  33. package/dist/plugins/FixtureTree/FixtureTree/MultiFixtureChildButton.js +2 -2
  34. package/dist/plugins/FixtureTree/FixtureTreeContainer.d.ts +1 -2
  35. package/dist/plugins/FixtureTree/FixtureTreeContainer.js +2 -2
  36. package/dist/plugins/FixtureTree/FixtureTreeHeader.js +1 -2
  37. package/dist/plugins/FixtureTree/index.js +11 -3
  38. package/dist/plugins/FixtureTree/useScrollToSelected.d.ts +2 -2
  39. package/dist/plugins/InputsPanel/index.js +1 -1
  40. package/dist/plugins/PluginList/index.js +1 -1
  41. package/dist/plugins/PropsPanel/index.js +2 -2
  42. package/dist/plugins/RendererPreview/RendererOverlay/rendererOverlayShared.js +2 -3
  43. package/dist/plugins/RendererPreview/RendererPreview.d.ts +1 -0
  44. package/dist/plugins/RendererPreview/RendererPreview.js +6 -7
  45. package/dist/plugins/RendererPreview/index.js +4 -1
  46. package/dist/plugins/RendererPreview/spec.d.ts +3 -0
  47. package/dist/plugins/RendererSelect/index.js +1 -1
  48. package/dist/plugins/ResponsivePreview/ResponsivePreview/ResponsivePreview.js +1 -0
  49. package/dist/plugins/ResponsivePreview/index.js +4 -2
  50. package/dist/plugins/Root/{SidePanel.d.ts → ControlPanel.d.ts} +3 -2
  51. package/dist/plugins/Root/ControlPanel.js +49 -0
  52. package/dist/plugins/Root/HomeOverlay/HomeOverlay.d.ts +1 -7
  53. package/dist/plugins/Root/HomeOverlay/HomeOverlay.js +33 -4
  54. package/dist/plugins/Root/NavPanel.d.ts +11 -0
  55. package/dist/plugins/Root/NavPanel.js +56 -0
  56. package/dist/plugins/Root/RendererHeader.d.ts +5 -4
  57. package/dist/plugins/Root/RendererHeader.js +4 -19
  58. package/dist/plugins/Root/Root.d.ts +13 -14
  59. package/dist/plugins/Root/Root.js +68 -52
  60. package/dist/plugins/Root/index.js +24 -20
  61. package/dist/plugins/Root/persistentState/controlPanelOpen.d.ts +3 -0
  62. package/dist/plugins/Root/persistentState/controlPanelOpen.js +11 -0
  63. package/dist/plugins/Root/persistentState/controlPanelWidth.d.ts +3 -0
  64. package/dist/plugins/Root/persistentState/controlPanelWidth.js +16 -0
  65. package/dist/plugins/Root/persistentState/drawerPanels.d.ts +3 -0
  66. package/dist/plugins/Root/persistentState/drawerPanels.js +11 -0
  67. package/dist/plugins/Root/persistentState/navPanelOpen.d.ts +3 -0
  68. package/dist/plugins/Root/persistentState/navPanelOpen.js +11 -0
  69. package/dist/plugins/Root/persistentState/navPanelWidth.d.ts +3 -0
  70. package/dist/plugins/Root/persistentState/navPanelWidth.js +16 -0
  71. package/dist/plugins/Root/spec.d.ts +6 -2
  72. package/dist/plugins/Router/index.js +6 -6
  73. package/dist/shared/defaultPluginConfig.d.ts +2 -2
  74. package/dist/shared/defaultPluginConfig.js +2 -2
  75. package/dist/slots/{SidePanelRowSlot.d.ts → ControlPanelRowSlot.d.ts} +3 -3
  76. package/dist/slots/ControlPanelRowSlot.js +5 -0
  77. package/dist/slots/NavPanelRowSlot.d.ts +10 -0
  78. package/dist/slots/NavPanelRowSlot.js +5 -0
  79. package/dist/style/colors.d.ts +1 -10
  80. package/dist/style/colors.js +1 -12
  81. package/dist/style/globalStyle.d.ts +0 -1
  82. package/dist/style/globalStyle.js +3 -25
  83. package/dist/testHelpers/pluginMocks.d.ts +5 -0
  84. package/dist/testHelpers/pluginMocks.js +9 -0
  85. package/dist/tsconfig.build.tsbuildinfo +1 -1
  86. package/package.json +7 -4
  87. package/dist/components/illustrations/ArtificialIntelligence.d.ts +0 -4
  88. package/dist/components/illustrations/ArtificialIntelligence.js +0 -123
  89. package/dist/components/illustrations/Astronaut.d.ts +0 -4
  90. package/dist/components/illustrations/Astronaut.js +0 -72
  91. package/dist/components/illustrations/BlankCanvas.d.ts +0 -4
  92. package/dist/components/illustrations/BlankCanvas.js +0 -75
  93. package/dist/plugins/Root/GlobalHeader.d.ts +0 -7
  94. package/dist/plugins/Root/GlobalHeader.js +0 -38
  95. package/dist/plugins/Root/HomeOverlay/ContentOverlay.d.ts +0 -6
  96. package/dist/plugins/Root/HomeOverlay/ContentOverlay.js +0 -75
  97. package/dist/plugins/Root/HomeOverlay/KeyShortcut.d.ts +0 -7
  98. package/dist/plugins/Root/HomeOverlay/KeyShortcut.js +0 -30
  99. package/dist/plugins/Root/HomeOverlay/NoFixtureSelected.d.ts +0 -6
  100. package/dist/plugins/Root/HomeOverlay/NoFixtureSelected.js +0 -42
  101. package/dist/plugins/Root/HomeOverlay/WelcomeCosmos.d.ts +0 -6
  102. package/dist/plugins/Root/HomeOverlay/WelcomeCosmos.js +0 -159
  103. package/dist/plugins/Root/HomeOverlay/welcomeDismiss.d.ts +0 -7
  104. package/dist/plugins/Root/HomeOverlay/welcomeDismiss.js +0 -19
  105. package/dist/plugins/Root/SidePanel.js +0 -26
  106. package/dist/plugins/Root/navOpen.d.ts +0 -4
  107. package/dist/plugins/Root/navOpen.js +0 -11
  108. package/dist/plugins/Root/navWidth.d.ts +0 -5
  109. package/dist/plugins/Root/navWidth.js +0 -14
  110. package/dist/plugins/Root/panelOpen.d.ts +0 -4
  111. package/dist/plugins/Root/panelOpen.js +0 -11
  112. package/dist/plugins/Root/panelWidth.d.ts +0 -5
  113. package/dist/plugins/Root/panelWidth.js +0 -14
  114. package/dist/slots/NavRowSlot.d.ts +0 -10
  115. package/dist/slots/NavRowSlot.js +0 -5
  116. package/dist/slots/SidePanelRowSlot.js +0 -5
@@ -1,9 +1,8 @@
1
1
  import React from 'react';
2
2
  import styled from 'styled-components';
3
- import { grey128, grey160, grey32, white10 } from '../style/colors.js';
3
+ import { grey128, grey160, grey32 } from '../style/colors.js';
4
4
  export const SidePanelContainer = styled.div `
5
5
  background: ${grey32};
6
- border-top: 1px solid ${white10};
7
6
 
8
7
  :first-child {
9
8
  border-top: none;
@@ -25,14 +24,7 @@ export function SidePanelTitle({ label, componentName }) {
25
24
  export const SidePanelActions = styled.div `
26
25
  display: flex;
27
26
  flex-direction: row;
28
-
29
- > button {
30
- margin-left: 4px;
31
-
32
- :first-child {
33
- margin-left: 0;
34
- }
35
- }
27
+ gap: 4px;
36
28
  `;
37
29
  export const SidePanelBody = styled.div `
38
30
  padding: 0 4px 8px 4px;
@@ -7,5 +7,5 @@ export function ExpandCollapseValues({ values, expansion, setExpansion, }) {
7
7
  const rootNode = createValueTree(values);
8
8
  if (!hasExpandableNodes(rootNode))
9
9
  return null;
10
- return isTreeFullyCollapsed(expansion) ? (React.createElement(IconButton32, { title: "Expand all fixture tree folders", icon: React.createElement(PlusSquareIcon, null), onClick: () => setExpansion(getFullTreeExpansion(rootNode)) })) : (React.createElement(IconButton32, { title: "Collapse all fixture tree folders", icon: React.createElement(MinusSquareIcon, null), onClick: () => setExpansion({}) }));
10
+ return isTreeFullyCollapsed(expansion) ? (React.createElement(IconButton32, { title: "Expand all nested values", icon: React.createElement(PlusSquareIcon, null), onClick: () => setExpansion(getFullTreeExpansion(rootNode)) })) : (React.createElement(IconButton32, { title: "Collapse all nested values", icon: React.createElement(MinusSquareIcon, null), onClick: () => setExpansion({}) }));
11
11
  }
@@ -8,6 +8,7 @@ type StyledButtonProps = {
8
8
  disabled: boolean;
9
9
  };
10
10
  export declare const StyledButton: import("styled-components").StyledComponent<"button", any, StyledButtonProps, never>;
11
+ export declare const StyledLink: import("styled-components").StyledComponent<"a", any, StyledButtonProps, never>;
11
12
  export declare const StyledIcon: import("styled-components").StyledComponent<"span", any, {
12
13
  color: string;
13
14
  }, never>;
@@ -37,6 +37,9 @@ export const StyledButton = styled.button `
37
37
  border: 0;
38
38
  }
39
39
  `;
40
+ export const StyledLink = styled(StyledButton.withComponent('a')) `
41
+ text-decoration: none;
42
+ `;
40
43
  const iconSize = 16;
41
44
  export const StyledIcon = styled.span `
42
45
  width: ${iconSize}px;
@@ -29,3 +29,7 @@ export declare const HelpCircleIcon: () => React.JSX.Element;
29
29
  export declare const MinusSquareIcon: () => React.JSX.Element;
30
30
  export declare const PlusSquareIcon: () => React.JSX.Element;
31
31
  export declare const StarIcon: () => React.JSX.Element;
32
+ export declare const LockIcon: () => React.JSX.Element;
33
+ export declare const UnlockIcon: () => React.JSX.Element;
34
+ export declare const LayersIcon: () => React.JSX.Element;
35
+ export declare const MessageSquareIcon: () => React.JSX.Element;
@@ -105,3 +105,15 @@ export const PlusSquareIcon = () => (React.createElement(Icon, null,
105
105
  React.createElement("line", { x1: "8", y1: "12", x2: "16", y2: "12" })));
106
106
  export const StarIcon = () => (React.createElement(Icon, null,
107
107
  React.createElement("polygon", { points: "12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2" })));
108
+ export const LockIcon = () => (React.createElement(Icon, null,
109
+ React.createElement("rect", { x: "3", y: "11", width: "18", height: "11", rx: "2", ry: "2" }),
110
+ React.createElement("path", { d: "M7 11V7a5 5 0 0 1 10 0v4" })));
111
+ export const UnlockIcon = () => (React.createElement(Icon, null,
112
+ React.createElement("rect", { x: "3", y: "11", width: "18", height: "11", rx: "2", ry: "2" }),
113
+ React.createElement("path", { d: "M7 11V7a5 5 0 0 1 9.9-1" })));
114
+ export const LayersIcon = () => (React.createElement(Icon, null,
115
+ React.createElement("polygon", { points: "12 2 2 7 12 12 22 7 12 2" }),
116
+ React.createElement("polyline", { points: "2 17 12 22 22 17" }),
117
+ React.createElement("polyline", { points: "2 12 12 17 22 12" })));
118
+ export const MessageSquareIcon = () => (React.createElement(Icon, null,
119
+ React.createElement("path", { d: "M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z" })));
@@ -1,6 +1,5 @@
1
1
  import React from 'react';
2
- import { CosmosGlobalStyle, GlobalStyle } from './style/globalStyle.js';
2
+ import { GlobalStyle } from './style/globalStyle.js';
3
3
  export default ({ children }) => (React.createElement(React.Fragment, null,
4
4
  React.createElement(GlobalStyle, null),
5
- React.createElement(CosmosGlobalStyle, null),
6
5
  children));
@@ -4,9 +4,10 @@ export function useDrag({ value, direction = 'horizontal', reverse = false, doub
4
4
  const handleDrag = useCallback((e) => {
5
5
  if (dragState) {
6
6
  const { startValue, startOffset } = dragState;
7
+ const coords = getEventCoords(e);
7
8
  let diff = direction === 'horizontal'
8
- ? e.clientX - startOffset
9
- : e.clientY - startOffset;
9
+ ? coords.x - startOffset
10
+ : coords.y - startOffset;
10
11
  if (reverse)
11
12
  diff *= -1;
12
13
  if (double)
@@ -19,18 +20,23 @@ export function useDrag({ value, direction = 'horizontal', reverse = false, doub
19
20
  setDragState(null);
20
21
  }, []);
21
22
  const handleDragStart = useCallback((e) => {
23
+ const coords = getEventCoords(e);
22
24
  setDragState({
23
25
  startValue: value,
24
- startOffset: direction === 'horizontal' ? e.clientX : e.clientY,
26
+ startOffset: direction === 'horizontal' ? coords.x : coords.y,
25
27
  });
26
28
  }, [direction, value]);
27
29
  useEffect(() => {
28
30
  if (dragState) {
29
31
  document.addEventListener('mousemove', handleDrag);
32
+ document.addEventListener('touchmove', handleDrag);
30
33
  document.addEventListener('mouseup', handleDragEnd);
34
+ document.addEventListener('touchend', handleDragEnd);
31
35
  return () => {
32
36
  document.removeEventListener('mousemove', handleDrag);
37
+ document.removeEventListener('touchmove', handleDrag);
33
38
  document.removeEventListener('mouseup', handleDragEnd);
39
+ document.removeEventListener('touchend', handleDragEnd);
34
40
  };
35
41
  }
36
42
  }, [dragState, handleDrag, handleDragEnd]);
@@ -47,7 +53,11 @@ export function useDrag({ value, direction = 'horizontal', reverse = false, doub
47
53
  const dragElRef = useCallback((elRef) => {
48
54
  if (elRef) {
49
55
  elRef.addEventListener('mousedown', handleDragStart);
50
- onUnmount.current = () => elRef.removeEventListener('mousedown', handleDragStart);
56
+ elRef.addEventListener('touchstart', handleDragStart);
57
+ onUnmount.current = () => {
58
+ elRef.removeEventListener('mousedown', handleDragStart);
59
+ elRef.removeEventListener('touchstart', handleDragStart);
60
+ };
51
61
  }
52
62
  else if (onUnmount.current) {
53
63
  onUnmount.current();
@@ -56,3 +66,8 @@ export function useDrag({ value, direction = 'horizontal', reverse = false, doub
56
66
  }, [handleDragStart]);
57
67
  return { dragElRef, dragging: dragState !== null };
58
68
  }
69
+ function getEventCoords(e) {
70
+ if ('touches' in e)
71
+ return { x: e.touches[0].clientX, y: e.touches[0].clientY };
72
+ return { x: e.clientX, y: e.clientY };
73
+ }
package/dist/index.d.ts CHANGED
@@ -23,12 +23,12 @@ export * from './plugins/Router/spec.js';
23
23
  export * from './plugins/SelectInput/spec.js';
24
24
  export * from './plugins/StandardInput/spec.js';
25
25
  export * from './plugins/Storage/spec.js';
26
+ export * from './slots/ControlPanelRowSlot.js';
26
27
  export * from './slots/FixtureActionSlot.js';
27
- export * from './slots/InputSlot.js';
28
28
  export * from './slots/InputsActionSlot.js';
29
- export * from './slots/NavRowSlot.js';
29
+ export * from './slots/InputSlot.js';
30
+ export * from './slots/NavPanelRowSlot.js';
30
31
  export * from './slots/RendererActionSlot.js';
31
- export * from './slots/SidePanelRowSlot.js';
32
32
  export * from './slots/ValueInputSlot.js';
33
33
  export * from './style/colors.js';
34
34
  export * from './style/vars.js';
package/dist/index.js CHANGED
@@ -23,12 +23,12 @@ export * from './plugins/Router/spec.js';
23
23
  export * from './plugins/SelectInput/spec.js';
24
24
  export * from './plugins/StandardInput/spec.js';
25
25
  export * from './plugins/Storage/spec.js';
26
+ export * from './slots/ControlPanelRowSlot.js';
26
27
  export * from './slots/FixtureActionSlot.js';
27
- export * from './slots/InputSlot.js';
28
28
  export * from './slots/InputsActionSlot.js';
29
- export * from './slots/NavRowSlot.js';
29
+ export * from './slots/InputSlot.js';
30
+ export * from './slots/NavPanelRowSlot.js';
30
31
  export * from './slots/RendererActionSlot.js';
31
- export * from './slots/SidePanelRowSlot.js';
32
32
  export * from './slots/ValueInputSlot.js';
33
33
  export * from './style/colors.js';
34
34
  export * from './style/vars.js';