@pie-element/rubric 8.1.2-next.1 → 8.1.2-next.11

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,17 +1,18 @@
1
- import { H as e, O as t, V as n, f as r, k as i, rt as a, t as o, vt as s, wt as c } from "./dist-DESt1KeY.js";
1
+ import { i as e } from "./rolldown-runtime-CWhphoD1.js";
2
+ import { H as t, O as n, V as r, bt as i, f as a, k as o, t as s, tt as c } from "./dist-DxOJn-ON.js";
2
3
  import l from "react";
3
4
  import { jsx as u, jsxs as d } from "react/jsx-runtime";
4
5
  //#region src/delivery/main.tsx
5
- var f = /* @__PURE__ */ c(s(), 1);
6
+ var f = /* @__PURE__ */ e(i(), 1);
6
7
  function p(e) {
7
8
  return typeof e == "function" || typeof e == "object" && !!e && typeof e.$$typeof == "symbol";
8
9
  }
9
10
  function m(e, t) {
10
11
  return !e || p(e) ? e : p(e.default) ? e.default : t && p(e[t]) ? e[t] : t && p(e[t]?.default) ? e[t].default : e;
11
12
  }
12
- var h = m(r, "UiLayout") || m(v.UiLayout, "UiLayout"), g = o, _ = g.default, v = _ && typeof _ == "object" ? _ : g, y = a(h)({
13
- color: t.text(),
14
- backgroundColor: t.background(),
13
+ var h = m(a, "UiLayout") || m(v.UiLayout, "UiLayout"), g = s, _ = g.default, v = _ && typeof _ == "object" ? _ : g, y = c(h)({
14
+ color: n.text(),
15
+ backgroundColor: n.background(),
15
16
  "&:not(.MathJax) table": { borderCollapse: "collapse" },
16
17
  "&:not(.MathJax) table td, &:not(.MathJax) table th": {
17
18
  padding: "8px 12px",
@@ -22,38 +23,38 @@ var h = m(r, "UiLayout") || m(v.UiLayout, "UiLayout"), g = o, _ = g.default, v =
22
23
  marginTop: 0,
23
24
  lineHeight: "normal"
24
25
  }
25
- }), b = a(e)({
26
+ }), b = c(t)({
26
27
  display: "flex",
27
28
  flexDirection: "column",
28
29
  alignItems: "flex-start",
29
30
  padding: "12px 0px"
30
- }), x = a("div")({ color: t.text() }), S = a("h3")({
31
- color: t.text(),
31
+ }), x = c("div")({ color: n.text() }), S = c("h3")({
32
+ color: n.text(),
32
33
  fontSize: "16px",
33
34
  fontWeight: "700",
34
35
  margin: 0,
35
36
  paddingBottom: "6px"
36
- }), C = a("h4")({
37
- color: t.text(),
37
+ }), C = c("h4")({
38
+ color: n.text(),
38
39
  fontSize: "16px",
39
40
  fontWeight: "normal",
40
41
  margin: 0,
41
42
  paddingBottom: "6px"
42
- }), w = a("h2")(({ theme: e }) => ({
43
+ }), w = c("h2")(({ theme: e }) => ({
43
44
  display: "flex",
44
45
  alignItems: "center",
45
46
  cursor: "pointer",
46
47
  userSelect: "none",
47
48
  fontSize: e.typography.fontSize,
48
49
  fontWeight: "500",
49
- color: t.tertiary(),
50
+ color: n.tertiary(),
50
51
  margin: 0
51
- })), T = a("span")({
52
+ })), T = c("span")({
52
53
  display: "inline-flex",
53
54
  transition: "transform 0.2s",
54
55
  marginLeft: 2,
55
56
  alignSelf: "center"
56
- }), E = a("h2")({
57
+ }), E = c("h2")({
57
58
  position: "absolute",
58
59
  width: "1px",
59
60
  height: "1px",
@@ -84,21 +85,21 @@ var h = m(r, "UiLayout") || m(v.UiLayout, "UiLayout"), g = o, _ = g.default, v =
84
85
  toggleRubric() {
85
86
  this.setState({ rubricOpen: !this.state.rubricOpen }), this.setState({ linkPrefix: this.state.rubricOpen ? "Show" : "Hide" });
86
87
  }
87
- shouldRenderPoint = (e, t) => t.excludeZero ? e !== 0 : !0;
88
+ shouldRenderPoint = (e, t) => !t.excludeZero || e !== 0;
88
89
  render() {
89
- let { model: e, value: t } = this.props, { animationsDisabled: r } = this.props;
90
- if (r ||= t.animationsDisabled, t && t.points) {
91
- let { extraCSSRules: a } = e || {}, { points: o, sampleAnswers: s } = t, c = /* @__PURE__ */ u(n, {
90
+ let { model: e, value: t } = this.props, { animationsDisabled: n } = this.props;
91
+ if (n ||= t.animationsDisabled, t && t.points) {
92
+ let { extraCSSRules: i } = e || {}, { points: a, sampleAnswers: s } = t, c = /* @__PURE__ */ u(r, {
92
93
  component: "nav",
93
- children: o.slice(0).reverse().map((e, n) => {
94
- n = o.length - n - 1;
94
+ children: a.slice(0).reverse().map((e, n) => {
95
+ n = a.length - n - 1;
95
96
  let r = t.excludeZero ? n + 1 : n;
96
97
  return /* @__PURE__ */ d(l.Fragment, { children: [/* @__PURE__ */ d(b, { children: [/* @__PURE__ */ u(S, { children: r === 1 ? `${r} PT` : `${r} PTS` }), /* @__PURE__ */ u(x, { dangerouslySetInnerHTML: { __html: e } })] }, `P${n}`), s && s[n] && /* @__PURE__ */ d(b, { children: [/* @__PURE__ */ u(C, { children: "Sample Answer" }), /* @__PURE__ */ u(x, { dangerouslySetInnerHTML: { __html: s[n] } })] }, `S${n}`)] }, n);
97
98
  })
98
99
  });
99
100
  return /* @__PURE__ */ d(y, {
100
- extraCSSRules: a,
101
- children: [/* @__PURE__ */ u(E, { children: "Rubric" }), r ? c : /* @__PURE__ */ d(l.Fragment, { children: [/* @__PURE__ */ d(w, {
101
+ extraCSSRules: i,
102
+ children: [/* @__PURE__ */ u(E, { children: "Rubric" }), n ? c : /* @__PURE__ */ d(l.Fragment, { children: [/* @__PURE__ */ d(w, {
102
103
  id: "rubric-toggle",
103
104
  tabIndex: 0,
104
105
  role: "button",
@@ -135,7 +136,7 @@ var h = m(r, "UiLayout") || m(v.UiLayout, "UiLayout"), g = o, _ = g.default, v =
135
136
  })
136
137
  })
137
138
  ]
138
- }), /* @__PURE__ */ u(i, {
139
+ }), /* @__PURE__ */ u(o, {
139
140
  in: this.state.rubricOpen,
140
141
  timeout: {
141
142
  enter: 225,
@@ -150,4 +151,4 @@ var h = m(r, "UiLayout") || m(v.UiLayout, "UiLayout"), g = o, _ = g.default, v =
150
151
  //#endregion
151
152
  export { O as t };
152
153
 
153
- //# sourceMappingURL=main-wvVb2SYi.js.map
154
+ //# sourceMappingURL=main-Cwy1SrBq.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"main-wvVb2SYi.js","names":[],"sources":["../../src/delivery/main.tsx"],"sourcesContent":["// @ts-nocheck\n/**\n * @synced-from pie-elements/packages/rubric/src/main.jsx\n * @auto-generated\n *\n * This file is automatically synced from pie-elements and converted to TypeScript.\n * Manual edits will be overwritten on next sync.\n * To make changes, edit the upstream JavaScript file and run sync again.\n */\n\nimport React from 'react';\nimport { styled } from '@mui/material/styles';\nimport ListItem from '@mui/material/ListItem';\nimport List from '@mui/material/List';\nimport Collapse from '@mui/material/Collapse';\nimport { color, UiLayout as UiLayoutImport } from '@pie-lib/render-ui';\n\nfunction isRenderableReactInteropType(value: any) {\n return (\n typeof value === 'function' ||\n (typeof value === 'object' && value !== null && typeof value.$$typeof === 'symbol')\n );\n}\n\nfunction unwrapReactInteropSymbol(maybeSymbol: any, namedExport?: string) {\n if (!maybeSymbol) return maybeSymbol;\n if (isRenderableReactInteropType(maybeSymbol)) return maybeSymbol;\n if (isRenderableReactInteropType(maybeSymbol.default)) return maybeSymbol.default;\n if (namedExport && isRenderableReactInteropType(maybeSymbol[namedExport])) {\n return maybeSymbol[namedExport];\n }\n if (namedExport && isRenderableReactInteropType(maybeSymbol[namedExport]?.default)) {\n return maybeSymbol[namedExport].default;\n }\n return maybeSymbol;\n}\nconst UiLayout = unwrapReactInteropSymbol(UiLayoutImport, 'UiLayout') || unwrapReactInteropSymbol(renderUi.UiLayout, 'UiLayout');\nimport * as RenderUiNamespace from '@pie-lib/render-ui';\nconst renderUiNamespaceAny = RenderUiNamespace as any;\nconst renderUiDefaultMaybe = renderUiNamespaceAny['default'];\nconst renderUi =\n renderUiDefaultMaybe && typeof renderUiDefaultMaybe === 'object'\n ? renderUiDefaultMaybe\n : renderUiNamespaceAny;\nimport PropTypes from 'prop-types';\n\nconst StyledUiLayout: any = styled(UiLayout)({\n color: color.text(),\n backgroundColor: color.background(),\n // apply styles to tables to match the rest of the UI\n '&:not(.MathJax) table': {\n borderCollapse: 'collapse',\n },\n '&:not(.MathJax) table td, &:not(.MathJax) table th': {\n padding: '8px 12px',\n textAlign: 'left',\n },\n // reset paragraph margins and line-height inside lists to override client styles\n '& ul p, & ol p': {\n marginBottom: 0,\n marginTop: 0,\n lineHeight: 'normal',\n },\n});\n\nconst StyledListItem: any = styled(ListItem)({\n display: 'flex',\n flexDirection: 'column',\n alignItems: 'flex-start',\n padding: '12px 0px',\n});\n\nconst Text: any = styled('div')({\n color: color.text(),\n});\n\nconst TitleText: any = styled('h3')({\n color: color.text(),\n fontSize: '16px',\n fontWeight: '700',\n margin: 0,\n paddingBottom: '6px',\n});\n\nconst SampleTitleText: any = styled('h4')({\n color: color.text(),\n fontSize: '16px',\n fontWeight: 'normal',\n margin: 0,\n paddingBottom: '6px',\n});\n\nconst RubricToggle: any = styled('h2')(({ theme }) => ({\n display: 'flex',\n alignItems: 'center',\n cursor: 'pointer',\n userSelect: 'none',\n fontSize: theme.typography.fontSize,\n fontWeight: '500',\n color: color.tertiary(),\n margin: 0,\n}));\n\nconst ChevronStyle: any = styled('span')({\n display: 'inline-flex',\n transition: 'transform 0.2s',\n marginLeft: 2,\n alignSelf: 'center',\n});\n\nconst HiddenScreenReader: any = styled('h2')({\n position: 'absolute',\n width: '1px',\n height: '1px',\n padding: 0,\n margin: '-1px',\n overflow: 'hidden',\n clip: 'rect(0,0,0,0)',\n border: 0,\n whiteSpace: 'nowrap',\n});\n\nexport const RubricType = PropTypes.shape({\n excludeZero: PropTypes.bool,\n points: PropTypes.arrayOf(PropTypes.string),\n sampleAnswers: PropTypes.arrayOf(PropTypes.string),\n animationsDisabled: PropTypes.bool,\n});\n\nclass Rubric extends React.Component {\n dudUrl = 'javascript:;';\n\n constructor(props) {\n super(props);\n this.state = {\n rubricOpen: false,\n linkPrefix: 'Show',\n };\n this.toggleRubric = this.toggleRubric.bind(this);\n }\n\n static propTypes = {\n model: PropTypes.object.isRequired,\n animationsDisabled: PropTypes.bool,\n value: RubricType,\n };\n\n toggleRubric() {\n this.setState({ rubricOpen: !this.state.rubricOpen });\n this.setState({ linkPrefix: this.state.rubricOpen ? 'Show' : 'Hide' });\n }\n\n shouldRenderPoint: any = (index, value) => {\n if (!value.excludeZero) {\n return true;\n } else {\n return index !== 0;\n }\n };\n\n render() {\n const { model, value } = this.props;\n let { animationsDisabled } = this.props;\n animationsDisabled = animationsDisabled || value.animationsDisabled;\n\n if (value && value.points) {\n const { extraCSSRules } = model || {};\n const { points, sampleAnswers } = value;\n\n const rubricList = (\n <List component=\"nav\">\n {points\n .slice(0)\n .reverse()\n .map((desc, index) => {\n index = points.length - index - 1;\n const pointsLabel = value.excludeZero ? index + 1 : index;\n\n return (\n <React.Fragment key={index}>\n <StyledListItem key={`P${index}`}>\n <TitleText>\n {pointsLabel === 1 ? `${pointsLabel} PT` : `${pointsLabel} PTS`}\n </TitleText>\n <Text dangerouslySetInnerHTML={{ __html: desc }} />\n </StyledListItem>\n\n {sampleAnswers && sampleAnswers[index] && (\n <StyledListItem key={`S${index}`}>\n <SampleTitleText>\n Sample Answer\n </SampleTitleText>\n <Text dangerouslySetInnerHTML={{ __html: sampleAnswers[index] }} />\n </StyledListItem>\n )}\n </React.Fragment>\n );\n })}\n </List>\n );\n\n return (\n <StyledUiLayout extraCSSRules={extraCSSRules}>\n {/* screen reader only heading for navigation as per PD-5057 */}\n <HiddenScreenReader>Rubric</HiddenScreenReader>\n {!animationsDisabled ? (\n <React.Fragment>\n <RubricToggle\n id={'rubric-toggle'}\n tabIndex={0}\n role=\"button\"\n aria-expanded={this.state.rubricOpen}\n onClick={this.toggleRubric}\n onKeyPress={(e) => {\n if (e.key === 'Enter' || e.key === ' ') this.toggleRubric();\n }}\n >\n {this.state.linkPrefix} Rubric\n <ChevronStyle aria-hidden=\"true\">\n {this.state.rubricOpen ? (\n <svg\n width=\"20\"\n height=\"20\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n >\n <polyline points=\"18 15 12 9 6 15\"></polyline>\n </svg>\n ) : (\n <svg\n width=\"20\"\n height=\"20\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n >\n <polyline points=\"6 9 12 15 18 9\"></polyline>\n </svg>\n )}\n </ChevronStyle>\n </RubricToggle>\n <Collapse in={this.state.rubricOpen} timeout={{ enter: 225, exit: 195 }}>\n {rubricList}\n </Collapse>\n </React.Fragment>\n ) : (\n rubricList\n )}\n </StyledUiLayout>\n );\n } else {\n return null;\n }\n }\n}\n\nexport default Rubric;\n"],"mappings":";;;;;AAiBA,SAAS,EAA6B,GAAY;CAChD,OACE,OAAO,KAAU,cAChB,OAAO,KAAU,cAAY,KAAkB,OAAO,EAAM,YAAa;AAE9E;AAEA,SAAS,EAAyB,GAAkB,GAAsB;CAUxE,OATI,CAAC,KACD,EAA6B,CAAW,IAAU,IAClD,EAA6B,EAAY,OAAO,IAAU,EAAY,UACtE,KAAe,EAA6B,EAAY,EAAY,IAC/D,EAAY,KAEjB,KAAe,EAA6B,EAAY,IAAc,OAAO,IACxE,EAAY,GAAa,UAE3B;AACT;AACA,IAAM,IAAW,EAAyB,GAAgB,UAAU,KAAK,EAAyB,EAAS,UAAU,UAAU,GAEzH,IAAuB,GACvB,IAAuB,EAAqB,SAC5C,IACJ,KAAwB,OAAO,KAAyB,WACpD,IACA,GAGA,IAAsB,EAAO,CAAQ,EAAE;CAC3C,OAAO,EAAM,KAAK;CAClB,iBAAiB,EAAM,WAAW;CAElC,yBAAyB,EACvB,gBAAgB,WAClB;CACA,sDAAsD;EACpD,SAAS;EACT,WAAW;CACb;CAEA,kBAAkB;EAChB,cAAc;EACd,WAAW;EACX,YAAY;CACd;AACF,CAAC,GAEK,IAAsB,EAAO,CAAQ,EAAE;CAC3C,SAAS;CACT,eAAe;CACf,YAAY;CACZ,SAAS;AACX,CAAC,GAEK,IAAY,EAAO,KAAK,EA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,CAAI,EAAE,QAAQ,WAAW,EAAE,QAAQ,QAAK,KAAK,aAAa;KAC5D;eARF;MAUG,KAAK,MAAM;MAAW;MACvB,kBAAC,GAAD;OAAc,eAAY;iBACvB,KAAK,MAAM,aACV,kBAAC,OAAD;QACE,OAAM;QACN,QAAO;QACP,SAAQ;QACR,MAAK;QACL,QAAO;QACP,aAAY;QACZ,eAAc;QACd,gBAAe;kBAEf,kBAAC,YAAD,EAAU,QAAO,kBAA4B,CAAA;OAC1C,CAAA,IAEL,kBAAC,OAAD;QACE,OAAM;QACN,QAAO;QACP,SAAQ;QACR,MAAK;QACL,QAAO;QACP,aAAY;QACZ,eAAc;QACd,gBAAe;kBAEf,kBAAC,YAAD,EAAU,QAAO,iBAA2B,CAAA;OACzC,CAAA;MAEK,CAAA;KACF;QACd,kBAAC,GAAD;KAAU,IAAI,KAAK,MAAM;KAAY,SAAS;MAAE,OAAO;MAAK,MAAM;KAAI;eACnE;IACO,CAAA,CACI,EAAA,CAAA,CAIJ;;EAEpB,OACE,OAAO;CAEX;AACF"}
1
+ {"version":3,"file":"main-Cwy1SrBq.js","names":[],"sources":["../../src/delivery/main.tsx"],"sourcesContent":["// @ts-nocheck\n/**\n * @synced-from pie-elements/packages/rubric/src/main.jsx\n * @auto-generated\n *\n * This file is automatically synced from pie-elements and converted to TypeScript.\n * Manual edits will be overwritten on next sync.\n * To make changes, edit the upstream JavaScript file and run sync again.\n */\n\nimport React from 'react';\nimport { styled } from '@mui/material/styles';\nimport ListItem from '@mui/material/ListItem';\nimport List from '@mui/material/List';\nimport Collapse from '@mui/material/Collapse';\nimport { color, UiLayout as UiLayoutImport } from '@pie-lib/render-ui';\n\nfunction isRenderableReactInteropType(value: any) {\n return (\n typeof value === 'function' ||\n (typeof value === 'object' && value !== null && typeof value.$$typeof === 'symbol')\n );\n}\n\nfunction unwrapReactInteropSymbol(maybeSymbol: any, namedExport?: string) {\n if (!maybeSymbol) return maybeSymbol;\n if (isRenderableReactInteropType(maybeSymbol)) return maybeSymbol;\n if (isRenderableReactInteropType(maybeSymbol.default)) return maybeSymbol.default;\n if (namedExport && isRenderableReactInteropType(maybeSymbol[namedExport])) {\n return maybeSymbol[namedExport];\n }\n if (namedExport && isRenderableReactInteropType(maybeSymbol[namedExport]?.default)) {\n return maybeSymbol[namedExport].default;\n }\n return maybeSymbol;\n}\nconst UiLayout = unwrapReactInteropSymbol(UiLayoutImport, 'UiLayout') || unwrapReactInteropSymbol(renderUi.UiLayout, 'UiLayout');\nimport * as RenderUiNamespace from '@pie-lib/render-ui';\nconst renderUiNamespaceAny = RenderUiNamespace as any;\nconst renderUiDefaultMaybe = renderUiNamespaceAny['default'];\nconst renderUi =\n renderUiDefaultMaybe && typeof renderUiDefaultMaybe === 'object'\n ? renderUiDefaultMaybe\n : renderUiNamespaceAny;\nimport PropTypes from 'prop-types';\n\nconst StyledUiLayout: any = styled(UiLayout)({\n color: color.text(),\n backgroundColor: color.background(),\n // apply styles to tables to match the rest of the UI\n '&:not(.MathJax) table': {\n borderCollapse: 'collapse',\n },\n '&:not(.MathJax) table td, &:not(.MathJax) table th': {\n padding: '8px 12px',\n textAlign: 'left',\n },\n // reset paragraph margins and line-height inside lists to override client styles\n '& ul p, & ol p': {\n marginBottom: 0,\n marginTop: 0,\n lineHeight: 'normal',\n },\n});\n\nconst StyledListItem: any = styled(ListItem)({\n display: 'flex',\n flexDirection: 'column',\n alignItems: 'flex-start',\n padding: '12px 0px',\n});\n\nconst Text: any = styled('div')({\n color: color.text(),\n});\n\nconst TitleText: any = styled('h3')({\n color: color.text(),\n fontSize: '16px',\n fontWeight: '700',\n margin: 0,\n paddingBottom: '6px',\n});\n\nconst SampleTitleText: any = styled('h4')({\n color: color.text(),\n fontSize: '16px',\n fontWeight: 'normal',\n margin: 0,\n paddingBottom: '6px',\n});\n\nconst RubricToggle: any = styled('h2')(({ theme }) => ({\n display: 'flex',\n alignItems: 'center',\n cursor: 'pointer',\n userSelect: 'none',\n fontSize: theme.typography.fontSize,\n fontWeight: '500',\n color: color.tertiary(),\n margin: 0,\n}));\n\nconst ChevronStyle: any = styled('span')({\n display: 'inline-flex',\n transition: 'transform 0.2s',\n marginLeft: 2,\n alignSelf: 'center',\n});\n\nconst HiddenScreenReader: any = styled('h2')({\n position: 'absolute',\n width: '1px',\n height: '1px',\n padding: 0,\n margin: '-1px',\n overflow: 'hidden',\n clip: 'rect(0,0,0,0)',\n border: 0,\n whiteSpace: 'nowrap',\n});\n\nexport const RubricType = PropTypes.shape({\n excludeZero: PropTypes.bool,\n points: PropTypes.arrayOf(PropTypes.string),\n sampleAnswers: PropTypes.arrayOf(PropTypes.string),\n animationsDisabled: PropTypes.bool,\n});\n\nclass Rubric extends React.Component {\n dudUrl = 'javascript:;';\n\n constructor(props) {\n super(props);\n this.state = {\n rubricOpen: false,\n linkPrefix: 'Show',\n };\n this.toggleRubric = this.toggleRubric.bind(this);\n }\n\n static propTypes = {\n model: PropTypes.object.isRequired,\n animationsDisabled: PropTypes.bool,\n value: RubricType,\n };\n\n toggleRubric() {\n this.setState({ rubricOpen: !this.state.rubricOpen });\n this.setState({ linkPrefix: this.state.rubricOpen ? 'Show' : 'Hide' });\n }\n\n shouldRenderPoint: any = (index, value) => {\n if (!value.excludeZero) {\n return true;\n } else {\n return index !== 0;\n }\n };\n\n render() {\n const { model, value } = this.props;\n let { animationsDisabled } = this.props;\n animationsDisabled = animationsDisabled || value.animationsDisabled;\n\n if (value && value.points) {\n const { extraCSSRules } = model || {};\n const { points, sampleAnswers } = value;\n\n const rubricList = (\n <List component=\"nav\">\n {points\n .slice(0)\n .reverse()\n .map((desc, index) => {\n index = points.length - index - 1;\n const pointsLabel = value.excludeZero ? index + 1 : index;\n\n return (\n <React.Fragment key={index}>\n <StyledListItem key={`P${index}`}>\n <TitleText>\n {pointsLabel === 1 ? `${pointsLabel} PT` : `${pointsLabel} PTS`}\n </TitleText>\n <Text dangerouslySetInnerHTML={{ __html: desc }} />\n </StyledListItem>\n\n {sampleAnswers && sampleAnswers[index] && (\n <StyledListItem key={`S${index}`}>\n <SampleTitleText>\n Sample Answer\n </SampleTitleText>\n <Text dangerouslySetInnerHTML={{ __html: sampleAnswers[index] }} />\n </StyledListItem>\n )}\n </React.Fragment>\n );\n })}\n </List>\n );\n\n return (\n <StyledUiLayout extraCSSRules={extraCSSRules}>\n {/* screen reader only heading for navigation as per PD-5057 */}\n <HiddenScreenReader>Rubric</HiddenScreenReader>\n {!animationsDisabled ? (\n <React.Fragment>\n <RubricToggle\n id={'rubric-toggle'}\n tabIndex={0}\n role=\"button\"\n aria-expanded={this.state.rubricOpen}\n onClick={this.toggleRubric}\n onKeyPress={(e) => {\n if (e.key === 'Enter' || e.key === ' ') this.toggleRubric();\n }}\n >\n {this.state.linkPrefix} Rubric\n <ChevronStyle aria-hidden=\"true\">\n {this.state.rubricOpen ? (\n <svg\n width=\"20\"\n height=\"20\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n >\n <polyline points=\"18 15 12 9 6 15\"></polyline>\n </svg>\n ) : (\n <svg\n width=\"20\"\n height=\"20\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n >\n <polyline points=\"6 9 12 15 18 9\"></polyline>\n </svg>\n )}\n </ChevronStyle>\n </RubricToggle>\n <Collapse in={this.state.rubricOpen} timeout={{ enter: 225, exit: 195 }}>\n {rubricList}\n </Collapse>\n </React.Fragment>\n ) : (\n rubricList\n )}\n </StyledUiLayout>\n );\n } else {\n return null;\n }\n }\n}\n\nexport default Rubric;\n"],"mappings":";;;;;;AAiBA,SAAS,EAA6B,GAAY;CAChD,OACE,OAAO,KAAU,cAChB,OAAO,KAAU,cAAY,KAAkB,OAAO,EAAM,YAAa;AAE9E;AAEA,SAAS,EAAyB,GAAkB,GAAsB;CAUxE,OAT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CAAA;KACF;QACd,kBAAC,GAAD;KAAU,IAAI,KAAK,MAAM;KAAY,SAAS;MAAE,OAAO;MAAK,MAAM;KAAI;eACnE;IACO,CAAA,CACI,EAAA,CAAA,CAIJ;;EAEpB,OACE,OAAO;CAEX;AACF"}
@@ -1,15 +1,16 @@
1
- import { _ as e, wt as t, y as n } from "../dist-DESt1KeY.js";
2
- import { t as r } from "../main-wvVb2SYi.js";
3
- import { c as i } from "../dist-DnnL1HSL.js";
1
+ import { i as e } from "../rolldown-runtime-CWhphoD1.js";
2
+ import { _ as t, y as n } from "../dist-DxOJn-ON.js";
3
+ import { t as r } from "../main-Cwy1SrBq.js";
4
+ import { c as i } from "../dist-B8zq6W6A.js";
4
5
  import a from "react";
5
6
  import { createRoot as o } from "react-dom/client";
6
- var s = (0, (/* @__PURE__ */ t(n(), 1)).default)("pie-element:rubric:print"), c = (e, t) => t.role === "instructor" ? (e.value = { ...e }, e.mode = "evaluate", e.animationsDisabled = !0, e) : {}, l = class extends HTMLElement {
7
+ var s = (0, (/* @__PURE__ */ e(n(), 1)).default)("pie-element:rubric:print"), c = (e, t) => t.role === "instructor" ? (e.value = { ...e }, e.mode = "evaluate", e.animationsDisabled = !0, e) : {}, l = class extends HTMLElement {
7
8
  constructor() {
8
9
  super(), this._options = null, this._model = null, this._session = [], this._root = null, this._rerender = i(() => {
9
10
  if (this._model && this._session) {
10
- let t = c(this._model, this._options), n = this._options && a.createElement(r, { ...t });
11
+ let e = c(this._model, this._options), n = this._options && a.createElement(r, { ...e });
11
12
  this._root ||= o(this), this._root.render(n), queueMicrotask(() => {
12
- s("render complete - render math"), e(this);
13
+ s("render complete - render math"), t(this);
13
14
  });
14
15
  } else s("skip");
15
16
  }, 50, {
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../../../src/print/index.tsx"],"sourcesContent":["// @ts-nocheck\n/**\n * @synced-from pie-elements/packages/rubric/src/print.js\n * @auto-generated\n *\n * This file is automatically synced from pie-elements and converted to TypeScript.\n * Manual edits will be overwritten on next sync.\n * To make changes, edit the upstream JavaScript file and run sync again.\n */\n\nimport React from 'react';\nimport { createRoot } from 'react-dom/client';\nimport { debounce } from '@pie-element/shared-lodash';\nimport Main from '../delivery/main.js';\nimport { renderMath } from '@pie-element/shared-math-rendering-mathjax';\nimport debug from 'debug';\n\nconst log = debug('pie-element:rubric:print');\n\nconst preparePrintModel = (model, opts) => {\n const instr = opts.role === 'instructor';\n\n if (!instr) {\n return {};\n }\n\n model.value = { ...model };\n model.mode = 'evaluate';\n model.animationsDisabled = true;\n\n return model;\n};\n\nexport default class RubricPrint extends HTMLElement {\n constructor() {\n super();\n this._options = null;\n this._model = null;\n this._session = [];\n this._root = null;\n this._rerender = debounce(\n () => {\n if (this._model && this._session) {\n const printModel = preparePrintModel(this._model, this._options);\n\n const element =\n this._options &&\n React.createElement(Main, {\n ...printModel,\n });\n\n if (!this._root) {\n this._root = createRoot(this);\n }\n this._root.render(element);\n queueMicrotask(() => {\n log('render complete - render math');\n renderMath(this);\n });\n } else {\n log('skip');\n }\n },\n 50,\n { leading: false, trailing: true },\n );\n }\n set options(o) {\n this._options = o;\n }\n\n set model(s) {\n this._model = s;\n this._rerender();\n }\n\n connectedCallback() {}\n\n disconnectedCallback() {\n if (this._root) {\n this._root.unmount();\n }\n }\n}\n"],"mappings":";;;;;AAiBA,IAAM,KAAA,IAAA,wBAAA,GAAA,SAAY,0BAA0B,GAEtC,KAAqB,GAAO,MAClB,EAAK,SAAS,gBAM5B,EAAM,QAAQ,EAAE,GAAG,EAAM,GACzB,EAAM,OAAO,YACb,EAAM,qBAAqB,IAEpB,KAPE,CAAC,GAUS,IAArB,cAAyC,YAAY;CACnD,cAAc;EAMZ,AALA,MAAM,GACN,KAAK,WAAW,MAChB,KAAK,SAAS,MACd,KAAK,WAAW,CAAC,GACjB,KAAK,QAAQ,MACb,KAAK,YAAY,QACT;GACJ,IAAI,KAAK,UAAU,KAAK,UAAU;IAChC,IAAM,IAAa,EAAkB,KAAK,QAAQ,KAAK,QAAQ,GAEzD,IACJ,KAAK,YACL,EAAM,cAAc,GAAM,EACxB,GAAG,EACL,CAAC;IAMH,AAJA,AACE,KAAK,UAAQ,EAAW,IAAI,GAE9B,KAAK,MAAM,OAAO,CAAO,GACzB,qBAAqB;KAEnB,AADA,EAAI,+BAA+B,GACnC,EAAW,IAAI;IACjB,CAAC;GACH,OACE,EAAI,MAAM;EAEd,GACA,IACA;GAAE,SAAS;GAAO,UAAU;EAAK,CACnC;CACF;CACA,IAAI,QAAQ,GAAG;EACb,KAAK,WAAW;CAClB;CAEA,IAAI,MAAM,GAAG;EAEX,AADA,KAAK,SAAS,GACd,KAAK,UAAU;CACjB;CAEA,oBAAoB,CAAC;CAErB,uBAAuB;EACrB,AAAI,KAAK,SACP,KAAK,MAAM,QAAQ;CAEvB;AACF"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../../src/print/index.tsx"],"sourcesContent":["// @ts-nocheck\n/**\n * @synced-from pie-elements/packages/rubric/src/print.js\n * @auto-generated\n *\n * This file is automatically synced from pie-elements and converted to TypeScript.\n * Manual edits will be overwritten on next sync.\n * To make changes, edit the upstream JavaScript file and run sync again.\n */\n\nimport React from 'react';\nimport { createRoot } from 'react-dom/client';\nimport { debounce } from '@pie-element/shared-lodash';\nimport Main from '../delivery/main.js';\nimport { renderMath } from '@pie-element/shared-math-rendering-mathjax';\nimport debug from 'debug';\n\nconst log = debug('pie-element:rubric:print');\n\nconst preparePrintModel = (model, opts) => {\n const instr = opts.role === 'instructor';\n\n if (!instr) {\n return {};\n }\n\n model.value = { ...model };\n model.mode = 'evaluate';\n model.animationsDisabled = true;\n\n return model;\n};\n\nexport default class RubricPrint extends HTMLElement {\n constructor() {\n super();\n this._options = null;\n this._model = null;\n this._session = [];\n this._root = null;\n this._rerender = debounce(\n () => {\n if (this._model && this._session) {\n const printModel = preparePrintModel(this._model, this._options);\n\n const element =\n this._options &&\n React.createElement(Main, {\n ...printModel,\n });\n\n if (!this._root) {\n this._root = createRoot(this);\n }\n this._root.render(element);\n queueMicrotask(() => {\n log('render complete - render math');\n renderMath(this);\n });\n } else {\n log('skip');\n }\n },\n 50,\n { leading: false, trailing: true },\n );\n }\n set options(o) {\n this._options = o;\n }\n\n set model(s) {\n this._model = s;\n this._rerender();\n }\n\n connectedCallback() {}\n\n disconnectedCallback() {\n if (this._root) {\n this._root.unmount();\n }\n }\n}\n"],"mappings":";;;;;;AAiBA,IAAM,KAAA,IAAA,wBAAA,EAAA,CAAA,QAAA,CAAY,0BAA0B,GAEtC,KAAqB,GAAO,MAClB,EAAK,SAAS,gBAM5B,EAAM,QAAQ,EAAE,GAAG,EAAM,GACzB,EAAM,OAAO,YACb,EAAM,qBAAqB,IAEpB,KAPE,CAAC,GAUS,IAArB,cAAyC,YAAY;CACnD,cAAc;EAMZ,AALA,MAAM,GACN,KAAK,WAAW,MAChB,KAAK,SAAS,MACd,KAAK,WAAW,CAAC,GACjB,KAAK,QAAQ,MACb,KAAK,YAAY,QACT;GACJ,IAAI,KAAK,UAAU,KAAK,UAAU;IAChC,IAAM,IAAa,EAAkB,KAAK,QAAQ,KAAK,QAAQ,GAEzD,IACJ,KAAK,YACL,EAAM,cAAc,GAAM,EACxB,GAAG,EACL,CAAC;IAMH,AAJA,AACE,KAAK,UAAQ,EAAW,IAAI,GAE9B,KAAK,MAAM,OAAO,CAAO,GACzB,qBAAqB;KAEnB,AADA,EAAI,+BAA+B,GACnC,EAAW,IAAI;IACjB,CAAC;GACH,OACE,EAAI,MAAM;EAEd,GACA,IACA;GAAE,SAAS;GAAO,UAAU;EAAK,CACnC;CACF;CACA,IAAI,QAAQ,GAAG;EACb,KAAK,WAAW;CAClB;CAEA,IAAI,MAAM,GAAG;EAEX,AADA,KAAK,SAAS,GACd,KAAK,UAAU;CACjB;CAEA,oBAAoB,CAAC;CAErB,uBAAuB;EACrB,AAAI,KAAK,SACP,KAAK,MAAM,QAAQ;CAEvB;AACF"}
@@ -0,0 +1,32 @@
1
+ import * as __pieBrowserCjsReactRequire from "react";
2
+ const __pieBrowserCjsRequire = (specifier) => {
3
+ switch (specifier) {
4
+ case "react": return __pieBrowserCjsReactRequire;
5
+
6
+
7
+
8
+
9
+ default:
10
+ throw new Error(`Unsupported browser CJS require: ${specifier}`);
11
+ }
12
+ };
13
+ //#region \0rolldown/runtime.js
14
+ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescriptor, r = Object.getOwnPropertyNames, i = Object.getPrototypeOf, a = Object.prototype.hasOwnProperty, o = (e, t) => () => (t || (e((t = { exports: {} }).exports, t), e = null), t.exports), s = (e, n) => {
15
+ let r = {};
16
+ for (var i in e) t(r, i, {
17
+ get: e[i],
18
+ enumerable: !0
19
+ });
20
+ return n || t(r, Symbol.toStringTag, { value: "Module" }), r;
21
+ }, c = (e, i, o, s) => {
22
+ if (i && typeof i == "object" || typeof i == "function") for (var c = r(i), l = 0, u = c.length, d; l < u; l++) d = c[l], !a.call(e, d) && d !== o && t(e, d, {
23
+ get: ((e) => i[e]).bind(null, d),
24
+ enumerable: !(s = n(i, d)) || s.enumerable
25
+ });
26
+ return e;
27
+ }, l = (n, r, a) => (a = n == null ? {} : e(i(n)), c(r || !n || !n.__esModule ? t(a, "default", {
28
+ value: n,
29
+ enumerable: !0
30
+ }) : a, n)), u = __pieBrowserCjsRequire;
31
+ //#endregion
32
+ export { l as i, s as n, u as r, o as t };
@@ -8,6 +8,9 @@
8
8
  */
9
9
  export default class RubricRender extends HTMLElement {
10
10
  constructor();
11
+ _scheduleMathRender: any;
12
+ _initMathObserver(): void;
13
+ _disconnectMathObserver(): void;
11
14
  set model(s: any);
12
15
  onModelChanged(m: any): void;
13
16
  connectedCallback(): void;
@@ -6,7 +6,26 @@ import { renderMath as i } from "@pie-element/shared-math-rendering-mathjax";
6
6
  //#region src/delivery/index.ts
7
7
  var a = class extends HTMLElement {
8
8
  constructor() {
9
- super(), r.log("constructor called"), this.onModelChanged = this.onModelChanged.bind(this), this._root = null;
9
+ super(), r.log("constructor called"), this.onModelChanged = this.onModelChanged.bind(this), this._root = null, this._mathObserver = null, this._mathRenderPending = !1;
10
+ }
11
+ _scheduleMathRender = () => {
12
+ this._mathRenderPending || (this._mathRenderPending = !0, requestAnimationFrame(() => {
13
+ this._mathObserver && this._mathObserver.disconnect(), i(this), this._mathRenderPending = !1, setTimeout(() => {
14
+ this._mathObserver && this._mathObserver.observe(this, {
15
+ childList: !0,
16
+ subtree: !0
17
+ });
18
+ }, 50);
19
+ }));
20
+ };
21
+ _initMathObserver() {
22
+ this._mathObserver || (this._mathObserver = new MutationObserver(this._scheduleMathRender), this._mathObserver.observe(this, {
23
+ childList: !0,
24
+ subtree: !0
25
+ }));
26
+ }
27
+ _disconnectMathObserver() {
28
+ this._mathObserver &&= (this._mathObserver.disconnect(), null);
10
29
  }
11
30
  set model(e) {
12
31
  this._model = e, this._render();
@@ -15,18 +34,17 @@ var a = class extends HTMLElement {
15
34
  this._model = e, this._render();
16
35
  }
17
36
  connectedCallback() {
18
- this._render();
37
+ this._initMathObserver(), this._render();
19
38
  }
20
39
  _render() {
21
40
  if (this._model) {
41
+ this._initMathObserver();
22
42
  let r = t.createElement(e, { value: this._model });
23
- this._root ||= n(this), this._root.render(r), queueMicrotask(() => {
24
- i(this);
25
- });
43
+ this._root ||= n(this), this._root.render(r);
26
44
  }
27
45
  }
28
46
  disconnectedCallback() {
29
- this._root && this._root.unmount();
47
+ this._disconnectMathObserver(), this._root && this._root.unmount();
30
48
  }
31
49
  };
32
50
  //#endregion
@@ -89,7 +89,7 @@ var p = f(o, "UiLayout") || f(g.UiLayout, "UiLayout"), m = a, h = m.default, g =
89
89
  toggleRubric() {
90
90
  this.setState({ rubricOpen: !this.state.rubricOpen }), this.setState({ linkPrefix: this.state.rubricOpen ? "Show" : "Hide" });
91
91
  }
92
- shouldRenderPoint = (e, t) => t.excludeZero ? e !== 0 : !0;
92
+ shouldRenderPoint = (e, t) => !t.excludeZero || e !== 0;
93
93
  render() {
94
94
  let { model: t, value: n } = this.props, { animationsDisabled: a } = this.props;
95
95
  if (a ||= n.animationsDisabled, n && n.points) {
@@ -153,4 +153,4 @@ var p = f(o, "UiLayout") || f(g.UiLayout, "UiLayout"), m = a, h = m.default, g =
153
153
  }
154
154
  };
155
155
  //#endregion
156
- export { E as default };
156
+ export { T as RubricType, E as default };