@cuemath/leap 3.1.8-aa2 → 3.1.8-aa3
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.
@@ -1,20 +1,20 @@
|
|
1
|
-
import { jsx as
|
2
|
-
import { memo as
|
1
|
+
import { jsx as n, jsxs as c } from "react/jsx-runtime";
|
2
|
+
import { memo as m, useEffect as f } from "react";
|
3
3
|
import u from "../../ui/layout/flex-view.js";
|
4
4
|
import { getColorsForUser as C, getUserTools as p } from "../cue-canvas-helpers.js";
|
5
|
-
import { useCueCanvasActions as
|
6
|
-
import
|
7
|
-
import
|
8
|
-
import
|
9
|
-
const
|
10
|
-
const
|
5
|
+
import { useCueCanvasActions as d } from "../hooks/use-cue-canvas-actions.js";
|
6
|
+
import v from "./color-picker-menu.js";
|
7
|
+
import g from "./tool.js";
|
8
|
+
import x from "./whiteboard-toolbar.js";
|
9
|
+
const b = m(({ userType: t, renderAs: e }) => {
|
10
|
+
const i = p(t, e), { activeInstance: o, activeTool: a, activeColor: r } = d(), s = C(t, e);
|
11
11
|
return f(() => {
|
12
|
-
o && (!
|
13
|
-
}, [o]),
|
14
|
-
|
15
|
-
/* @__PURE__ */
|
12
|
+
console.log("cueCanvas instance changed, setting tool and color", r, a), o && (!s.includes(r) && s[0] ? o.setColor(s[0]) : o.setColor(r), o.setTool(a));
|
13
|
+
}, [o]), e === "whiteboard" ? /* @__PURE__ */ n(x, { tools: i, userType: t }) : /* @__PURE__ */ c(u, { $flexDirection: "row", $alignItems: "center", $justifyContent: "center", $flexGapX: 0.5, children: [
|
14
|
+
i.map((l) => /* @__PURE__ */ n(g, { tool: l, shouldAnimate: !0 }, l)),
|
15
|
+
/* @__PURE__ */ n(v, { userType: t, renderAs: "canvas" })
|
16
16
|
] });
|
17
|
-
}), k =
|
17
|
+
}), k = b;
|
18
18
|
export {
|
19
19
|
k as default
|
20
20
|
};
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"toolbar.js","sources":["../../../../src/features/cue-canvas/toolbar/toolbar.tsx"],"sourcesContent":["import type { IToolbarProps } from '../types/toolbar';\n\nimport React, { memo, useEffect } from 'react';\n\nimport FlexView from '../../ui/layout/flex-view';\nimport { getColorsForUser, getUserTools } from '../cue-canvas-helpers';\nimport { useCueCanvasActions } from '../hooks/use-cue-canvas-actions';\nimport ColorPickerMenu from './color-picker-menu';\nimport Tool from './tool';\nimport WhiteboardToolbar from './whiteboard-toolbar';\n\nconst Toolbar: React.FC<IToolbarProps> = memo(({ userType, renderAs }) => {\n const tools = getUserTools(userType, renderAs);\n const { activeInstance: cueCanvas, activeTool, activeColor } = useCueCanvasActions();\n const colors = getColorsForUser(userType, renderAs);\n\n // This effect ensures that the selected tool and color are applied to the cueCanvas instance\n // whenever it changes. For example, if a user selects a tool and color, then navigates to a\n // different question (causing a new cueCanvas instance), the same tool and color will be set\n // on the new instance.\n useEffect(() => {\n if (cueCanvas) {\n if (!colors.includes(activeColor) && colors[0]) {\n cueCanvas.setColor(colors[0]);\n } else {\n cueCanvas.setColor(activeColor);\n }\n cueCanvas.setTool(activeTool);\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [cueCanvas]);\n\n if (renderAs === 'whiteboard') {\n return <WhiteboardToolbar tools={tools} userType={userType} />;\n }\n\n return (\n <FlexView $flexDirection=\"row\" $alignItems=\"center\" $justifyContent=\"center\" $flexGapX={0.5}>\n {tools.map(tool => (\n <Tool tool={tool} key={tool} shouldAnimate />\n ))}\n <ColorPickerMenu userType={userType} renderAs=\"canvas\" />\n </FlexView>\n );\n});\n\nexport default Toolbar;\n"],"names":["Toolbar","memo","userType","renderAs","tools","getUserTools","cueCanvas","activeTool","activeColor","useCueCanvasActions","colors","getColorsForUser","useEffect","jsx","WhiteboardToolbar","jsxs","FlexView","Tool","tool","ColorPickerMenu","Toolbar$1"],"mappings":";;;;;;;;AAWA,MAAMA,IAAmCC,EAAK,CAAC,EAAE,UAAAC,GAAU,UAAAC,QAAe;AAClE,QAAAC,IAAQC,EAAaH,GAAUC,CAAQ,GACvC,EAAE,gBAAgBG,GAAW,YAAAC,GAAY,aAAAC,EAAA,IAAgBC,KACzDC,IAASC,EAAiBT,GAAUC,CAAQ;
|
1
|
+
{"version":3,"file":"toolbar.js","sources":["../../../../src/features/cue-canvas/toolbar/toolbar.tsx"],"sourcesContent":["import type { IToolbarProps } from '../types/toolbar';\n\nimport React, { memo, useEffect } from 'react';\n\nimport FlexView from '../../ui/layout/flex-view';\nimport { getColorsForUser, getUserTools } from '../cue-canvas-helpers';\nimport { useCueCanvasActions } from '../hooks/use-cue-canvas-actions';\nimport ColorPickerMenu from './color-picker-menu';\nimport Tool from './tool';\nimport WhiteboardToolbar from './whiteboard-toolbar';\n\nconst Toolbar: React.FC<IToolbarProps> = memo(({ userType, renderAs }) => {\n const tools = getUserTools(userType, renderAs);\n const { activeInstance: cueCanvas, activeTool, activeColor } = useCueCanvasActions();\n const colors = getColorsForUser(userType, renderAs);\n\n // This effect ensures that the selected tool and color are applied to the cueCanvas instance\n // whenever it changes. For example, if a user selects a tool and color, then navigates to a\n // different question (causing a new cueCanvas instance), the same tool and color will be set\n // on the new instance.\n useEffect(() => {\n console.log('cueCanvas instance changed, setting tool and color', activeColor, activeTool);\n if (cueCanvas) {\n if (!colors.includes(activeColor) && colors[0]) {\n cueCanvas.setColor(colors[0]);\n } else {\n cueCanvas.setColor(activeColor);\n }\n cueCanvas.setTool(activeTool);\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [cueCanvas]);\n\n if (renderAs === 'whiteboard') {\n return <WhiteboardToolbar tools={tools} userType={userType} />;\n }\n\n return (\n <FlexView $flexDirection=\"row\" $alignItems=\"center\" $justifyContent=\"center\" $flexGapX={0.5}>\n {tools.map(tool => (\n <Tool tool={tool} key={tool} shouldAnimate />\n ))}\n <ColorPickerMenu userType={userType} renderAs=\"canvas\" />\n </FlexView>\n );\n});\n\nexport default Toolbar;\n"],"names":["Toolbar","memo","userType","renderAs","tools","getUserTools","cueCanvas","activeTool","activeColor","useCueCanvasActions","colors","getColorsForUser","useEffect","jsx","WhiteboardToolbar","jsxs","FlexView","Tool","tool","ColorPickerMenu","Toolbar$1"],"mappings":";;;;;;;;AAWA,MAAMA,IAAmCC,EAAK,CAAC,EAAE,UAAAC,GAAU,UAAAC,QAAe;AAClE,QAAAC,IAAQC,EAAaH,GAAUC,CAAQ,GACvC,EAAE,gBAAgBG,GAAW,YAAAC,GAAY,aAAAC,EAAA,IAAgBC,KACzDC,IAASC,EAAiBT,GAAUC,CAAQ;AAmBlD,SAbAS,EAAU,MAAM;AACN,YAAA,IAAI,sDAAsDJ,GAAaD,CAAU,GACrFD,MACE,CAACI,EAAO,SAASF,CAAW,KAAKE,EAAO,CAAC,IACjCJ,EAAA,SAASI,EAAO,CAAC,CAAC,IAE5BJ,EAAU,SAASE,CAAW,GAEhCF,EAAU,QAAQC,CAAU;AAAA,EAC9B,GAEC,CAACD,CAAS,CAAC,GAEVH,MAAa,eACR,gBAAAU,EAACC,GAAkB,EAAA,OAAAV,GAAc,UAAAF,EAAoB,CAAA,IAI5D,gBAAAa,EAACC,KAAS,gBAAe,OAAM,aAAY,UAAS,iBAAgB,UAAS,WAAW,KACrF,UAAA;AAAA,IAAMZ,EAAA,IAAI,OACR,gBAAAS,EAAAI,GAAA,EAAK,MAAAC,GAAuB,eAAa,GAAA,GAAnBA,CAAoB,CAC5C;AAAA,IACA,gBAAAL,EAAAM,GAAA,EAAgB,UAAAjB,GAAoB,UAAS,SAAS,CAAA;AAAA,EACzD,EAAA,CAAA;AAEJ,CAAC,GAEDkB,IAAepB;"}
|