@pie-element/rubric 8.1.2-next.17 → 8.1.2-next.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser/editor-runtime/assets/Symbola-4c507403.woff2 +0 -0
- package/dist/browser/editor-runtime/author/index.js +23275 -0
- package/dist/browser/editor-runtime/author/index.js.map +1 -0
- package/dist/browser/editor-runtime/controller/index.js +41 -0
- package/dist/browser/editor-runtime/controller/index.js.map +1 -0
- package/dist/browser/editor-runtime/delivery/index.js +53 -0
- package/dist/browser/editor-runtime/delivery/index.js.map +1 -0
- package/dist/browser/editor-runtime/dist-B8zq6W6A.js +102 -0
- package/dist/browser/editor-runtime/dist-B8zq6W6A.js.map +1 -0
- package/dist/browser/editor-runtime/dist-ClPxMBUG.js +9029 -0
- package/dist/browser/editor-runtime/dist-ClPxMBUG.js.map +1 -0
- package/dist/browser/editor-runtime/main-sMMMvQIb.js +154 -0
- package/dist/browser/editor-runtime/main-sMMMvQIb.js.map +1 -0
- package/dist/browser/editor-runtime/print/index.js +35 -0
- package/dist/browser/editor-runtime/print/index.js.map +1 -0
- package/dist/browser/editor-runtime/rolldown-runtime-CHQKHQ89.js +32 -0
- package/package.json +12 -2
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
import { a as e } from "./rolldown-runtime-CHQKHQ89.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-ClPxMBUG.js";
|
|
3
|
+
import l from "react";
|
|
4
|
+
import { jsx as u, jsxs as d } from "react/jsx-runtime";
|
|
5
|
+
//#region src/delivery/main.tsx
|
|
6
|
+
var f = /* @__PURE__ */ e(i(), 1);
|
|
7
|
+
function p(e) {
|
|
8
|
+
return typeof e == "function" || typeof e == "object" && !!e && typeof e.$$typeof == "symbol";
|
|
9
|
+
}
|
|
10
|
+
function m(e, t) {
|
|
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;
|
|
12
|
+
}
|
|
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(),
|
|
16
|
+
"&:not(.MathJax) table": { borderCollapse: "collapse" },
|
|
17
|
+
"&:not(.MathJax) table td, &:not(.MathJax) table th": {
|
|
18
|
+
padding: "8px 12px",
|
|
19
|
+
textAlign: "left"
|
|
20
|
+
},
|
|
21
|
+
"& ul p, & ol p": {
|
|
22
|
+
marginBottom: 0,
|
|
23
|
+
marginTop: 0,
|
|
24
|
+
lineHeight: "normal"
|
|
25
|
+
}
|
|
26
|
+
}), b = c(t)({
|
|
27
|
+
display: "flex",
|
|
28
|
+
flexDirection: "column",
|
|
29
|
+
alignItems: "flex-start",
|
|
30
|
+
padding: "12px 0px"
|
|
31
|
+
}), x = c("div")({ color: n.text() }), S = c("h3")({
|
|
32
|
+
color: n.text(),
|
|
33
|
+
fontSize: "16px",
|
|
34
|
+
fontWeight: "700",
|
|
35
|
+
margin: 0,
|
|
36
|
+
paddingBottom: "6px"
|
|
37
|
+
}), C = c("h4")({
|
|
38
|
+
color: n.text(),
|
|
39
|
+
fontSize: "16px",
|
|
40
|
+
fontWeight: "normal",
|
|
41
|
+
margin: 0,
|
|
42
|
+
paddingBottom: "6px"
|
|
43
|
+
}), w = c("h2")(({ theme: e }) => ({
|
|
44
|
+
display: "flex",
|
|
45
|
+
alignItems: "center",
|
|
46
|
+
cursor: "pointer",
|
|
47
|
+
userSelect: "none",
|
|
48
|
+
fontSize: e.typography.fontSize,
|
|
49
|
+
fontWeight: "500",
|
|
50
|
+
color: n.tertiary(),
|
|
51
|
+
margin: 0
|
|
52
|
+
})), T = c("span")({
|
|
53
|
+
display: "inline-flex",
|
|
54
|
+
transition: "transform 0.2s",
|
|
55
|
+
marginLeft: 2,
|
|
56
|
+
alignSelf: "center"
|
|
57
|
+
}), E = c("h2")({
|
|
58
|
+
position: "absolute",
|
|
59
|
+
width: "1px",
|
|
60
|
+
height: "1px",
|
|
61
|
+
padding: 0,
|
|
62
|
+
margin: "-1px",
|
|
63
|
+
overflow: "hidden",
|
|
64
|
+
clip: "rect(0,0,0,0)",
|
|
65
|
+
border: 0,
|
|
66
|
+
whiteSpace: "nowrap"
|
|
67
|
+
}), D = f.default.shape({
|
|
68
|
+
excludeZero: f.default.bool,
|
|
69
|
+
points: f.default.arrayOf(f.default.string),
|
|
70
|
+
sampleAnswers: f.default.arrayOf(f.default.string),
|
|
71
|
+
animationsDisabled: f.default.bool
|
|
72
|
+
}), O = class extends l.Component {
|
|
73
|
+
dudUrl = "javascript:;";
|
|
74
|
+
constructor(e) {
|
|
75
|
+
super(e), this.state = {
|
|
76
|
+
rubricOpen: !1,
|
|
77
|
+
linkPrefix: "Show"
|
|
78
|
+
}, this.toggleRubric = this.toggleRubric.bind(this);
|
|
79
|
+
}
|
|
80
|
+
static propTypes = {
|
|
81
|
+
model: f.default.object.isRequired,
|
|
82
|
+
animationsDisabled: f.default.bool,
|
|
83
|
+
value: D
|
|
84
|
+
};
|
|
85
|
+
toggleRubric() {
|
|
86
|
+
this.setState({ rubricOpen: !this.state.rubricOpen }), this.setState({ linkPrefix: this.state.rubricOpen ? "Show" : "Hide" });
|
|
87
|
+
}
|
|
88
|
+
shouldRenderPoint = (e, t) => !t.excludeZero || e !== 0;
|
|
89
|
+
render() {
|
|
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, {
|
|
93
|
+
component: "nav",
|
|
94
|
+
children: a.slice(0).reverse().map((e, n) => {
|
|
95
|
+
n = a.length - n - 1;
|
|
96
|
+
let r = t.excludeZero ? n + 1 : n;
|
|
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);
|
|
98
|
+
})
|
|
99
|
+
});
|
|
100
|
+
return /* @__PURE__ */ d(y, {
|
|
101
|
+
extraCSSRules: i,
|
|
102
|
+
children: [/* @__PURE__ */ u(E, { children: "Rubric" }), n ? c : /* @__PURE__ */ d(l.Fragment, { children: [/* @__PURE__ */ d(w, {
|
|
103
|
+
id: "rubric-toggle",
|
|
104
|
+
tabIndex: 0,
|
|
105
|
+
role: "button",
|
|
106
|
+
"aria-expanded": this.state.rubricOpen,
|
|
107
|
+
onClick: this.toggleRubric,
|
|
108
|
+
onKeyPress: (e) => {
|
|
109
|
+
(e.key === "Enter" || e.key === " ") && this.toggleRubric();
|
|
110
|
+
},
|
|
111
|
+
children: [
|
|
112
|
+
this.state.linkPrefix,
|
|
113
|
+
" Rubric",
|
|
114
|
+
/* @__PURE__ */ u(T, {
|
|
115
|
+
"aria-hidden": "true",
|
|
116
|
+
children: this.state.rubricOpen ? /* @__PURE__ */ u("svg", {
|
|
117
|
+
width: "20",
|
|
118
|
+
height: "20",
|
|
119
|
+
viewBox: "0 0 24 24",
|
|
120
|
+
fill: "none",
|
|
121
|
+
stroke: "currentColor",
|
|
122
|
+
strokeWidth: "2",
|
|
123
|
+
strokeLinecap: "round",
|
|
124
|
+
strokeLinejoin: "round",
|
|
125
|
+
children: /* @__PURE__ */ u("polyline", { points: "18 15 12 9 6 15" })
|
|
126
|
+
}) : /* @__PURE__ */ u("svg", {
|
|
127
|
+
width: "20",
|
|
128
|
+
height: "20",
|
|
129
|
+
viewBox: "0 0 24 24",
|
|
130
|
+
fill: "none",
|
|
131
|
+
stroke: "currentColor",
|
|
132
|
+
strokeWidth: "2",
|
|
133
|
+
strokeLinecap: "round",
|
|
134
|
+
strokeLinejoin: "round",
|
|
135
|
+
children: /* @__PURE__ */ u("polyline", { points: "6 9 12 15 18 9" })
|
|
136
|
+
})
|
|
137
|
+
})
|
|
138
|
+
]
|
|
139
|
+
}), /* @__PURE__ */ u(o, {
|
|
140
|
+
in: this.state.rubricOpen,
|
|
141
|
+
timeout: {
|
|
142
|
+
enter: 225,
|
|
143
|
+
exit: 195
|
|
144
|
+
},
|
|
145
|
+
children: c
|
|
146
|
+
})] })]
|
|
147
|
+
});
|
|
148
|
+
} else return null;
|
|
149
|
+
}
|
|
150
|
+
};
|
|
151
|
+
//#endregion
|
|
152
|
+
export { O as t };
|
|
153
|
+
|
|
154
|
+
//# sourceMappingURL=main-sMMMvQIb.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"main-sMMMvQIb.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,U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OAAO;MAAK,MAAM;KAAI;eACnE;IACO,CAAA,CACI,EAAA,CAAA,CAIJ;;EAEpB,OACE,OAAO;CAEX;AACF"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { a as e } from "../rolldown-runtime-CHQKHQ89.js";
|
|
2
|
+
import { _ as t, y as n } from "../dist-ClPxMBUG.js";
|
|
3
|
+
import { t as r } from "../main-sMMMvQIb.js";
|
|
4
|
+
import { c as i } from "../dist-B8zq6W6A.js";
|
|
5
|
+
import a from "react";
|
|
6
|
+
import { createRoot as o } from "react-dom/client";
|
|
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 {
|
|
8
|
+
constructor() {
|
|
9
|
+
super(), this._options = null, this._model = null, this._session = [], this._root = null, this._rerender = i(() => {
|
|
10
|
+
if (this._model && this._session) {
|
|
11
|
+
let e = c(this._model, this._options), n = this._options && a.createElement(r, { ...e });
|
|
12
|
+
this._root ||= o(this), this._root.render(n), queueMicrotask(() => {
|
|
13
|
+
s("render complete - render math"), t(this);
|
|
14
|
+
});
|
|
15
|
+
} else s("skip");
|
|
16
|
+
}, 50, {
|
|
17
|
+
leading: !1,
|
|
18
|
+
trailing: !0
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
set options(e) {
|
|
22
|
+
this._options = e;
|
|
23
|
+
}
|
|
24
|
+
set model(e) {
|
|
25
|
+
this._model = e, this._rerender();
|
|
26
|
+
}
|
|
27
|
+
connectedCallback() {}
|
|
28
|
+
disconnectedCallback() {
|
|
29
|
+
this._root && this._root.unmount();
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
//#endregion
|
|
33
|
+
export { l as default };
|
|
34
|
+
|
|
35
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +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,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 = (e, t, n) => (c(e, t, "default"), n && c(n, t, "default")), u = (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)), d = __pieBrowserCjsRequire;
|
|
31
|
+
//#endregion
|
|
32
|
+
export { u as a, d as i, s as n, l as r, o as t };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pie-element/rubric",
|
|
3
|
-
"version": "8.1.2-next.
|
|
3
|
+
"version": "8.1.2-next.18",
|
|
4
4
|
"description": "Rubric Scoring Interaction",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -90,7 +90,7 @@
|
|
|
90
90
|
],
|
|
91
91
|
"sideEffects": false,
|
|
92
92
|
"scripts": {
|
|
93
|
-
"build": "bun x vite build && bun x vite build --config ../../../tools/vite/element-browser.config.ts && bun x vite build --config ../../../tools/vite/element-legacy-print.config.ts && bun x vite build --config vite.config.iife.ts && bun x tsc --emitDeclarationOnly",
|
|
93
|
+
"build": "bun x vite build && bun x vite build --config ../../../tools/vite/element-browser.config.ts && bun x vite build --config ../../../tools/vite/element-browser-editor-runtime.config.ts && bun x vite build --config ../../../tools/vite/element-legacy-print.config.ts && bun x vite build --config vite.config.iife.ts && bun x tsc --emitDeclarationOnly",
|
|
94
94
|
"dev": "bun x vite",
|
|
95
95
|
"demo": "bun x vite --mode demo",
|
|
96
96
|
"test": "bun x vitest run"
|
|
@@ -101,6 +101,16 @@
|
|
|
101
101
|
"browserSharedDependencies": {
|
|
102
102
|
"react": "18.2.0",
|
|
103
103
|
"react-dom": "18.2.0"
|
|
104
|
+
},
|
|
105
|
+
"browserEditorRuntime": {
|
|
106
|
+
"name": "@pie-element/shared-editor-runtime",
|
|
107
|
+
"version": "0.1.1-next.0",
|
|
108
|
+
"views": {
|
|
109
|
+
"delivery": "editor-runtime/delivery",
|
|
110
|
+
"author": "editor-runtime/author",
|
|
111
|
+
"print": "editor-runtime/print",
|
|
112
|
+
"controller": "editor-runtime/controller"
|
|
113
|
+
}
|
|
104
114
|
}
|
|
105
115
|
}
|
|
106
116
|
}
|