@pie-element/fraction-model 6.1.1-next.11 → 6.1.2-next.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 (194) hide show
  1. package/configure.js +2 -0
  2. package/controller.js +1 -0
  3. package/dist/author/card-bar.d.ts +20 -0
  4. package/dist/author/card-bar.js +40 -0
  5. package/dist/author/defaults.d.ts +113 -0
  6. package/dist/author/defaults.js +84 -0
  7. package/dist/author/index.d.ts +44 -0
  8. package/dist/author/index.js +88 -0
  9. package/dist/author/main.d.ts +25 -0
  10. package/dist/author/main.js +156 -0
  11. package/dist/author/model-options.d.ts +32 -0
  12. package/dist/author/model-options.js +85 -0
  13. package/dist/author/number-text-field.d.ts +15 -0
  14. package/dist/author/number-text-field.js +24 -0
  15. package/dist/browser/author/index.js +37287 -0
  16. package/dist/browser/author/index.js.map +1 -0
  17. package/dist/browser/controller/index.js +78 -0
  18. package/dist/browser/controller/index.js.map +1 -0
  19. package/dist/browser/delivery/index.js +2 -0
  20. package/dist/browser/delivery-BSG67wbh.js +28213 -0
  21. package/dist/browser/delivery-BSG67wbh.js.map +1 -0
  22. package/dist/browser/fraction-model.css +2 -0
  23. package/dist/browser/isEmpty-Cj-5W3cl.js +16 -0
  24. package/dist/browser/isEmpty-Cj-5W3cl.js.map +1 -0
  25. package/dist/browser/isTypedArray-yL07_GBh.js +171 -0
  26. package/dist/browser/isTypedArray-yL07_GBh.js.map +1 -0
  27. package/dist/controller/defaults.d.ts +21 -0
  28. package/dist/controller/defaults.js +13 -0
  29. package/dist/controller/index.d.ts +23 -0
  30. package/dist/controller/index.js +68 -0
  31. package/dist/delivery/answer-fraction.d.ts +27 -0
  32. package/dist/delivery/answer-fraction.js +69 -0
  33. package/dist/delivery/fraction-model-chart.d.ts +11 -0
  34. package/dist/delivery/fraction-model-chart.js +154 -0
  35. package/dist/delivery/index.d.ts +22 -0
  36. package/dist/delivery/index.js +54 -0
  37. package/dist/delivery/main.d.ts +38 -0
  38. package/dist/delivery/main.js +136 -0
  39. package/dist/index.d.ts +1 -0
  40. package/dist/index.iife.d.ts +8 -0
  41. package/dist/index.iife.js +179 -0
  42. package/dist/index.js +2 -0
  43. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_DataView.js +6 -0
  44. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Hash.js +16 -0
  45. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_ListCache.js +16 -0
  46. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Map.js +6 -0
  47. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_MapCache.js +16 -0
  48. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Promise.js +6 -0
  49. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Set.js +6 -0
  50. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Stack.js +14 -0
  51. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Symbol.js +5 -0
  52. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Uint8Array.js +5 -0
  53. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_WeakMap.js +6 -0
  54. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_arrayEach.js +7 -0
  55. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_arrayFilter.js +10 -0
  56. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_arrayLikeKeys.js +15 -0
  57. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_arrayPush.js +7 -0
  58. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_assignValue.js +10 -0
  59. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_assocIndexOf.js +8 -0
  60. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseAssign.js +8 -0
  61. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseAssignIn.js +8 -0
  62. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseAssignValue.js +12 -0
  63. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseClone.js +57 -0
  64. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseCreate.js +14 -0
  65. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseGetAllKeys.js +9 -0
  66. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseGetTag.js +10 -0
  67. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseIsArguments.js +9 -0
  68. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseIsMap.js +9 -0
  69. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseIsNative.js +11 -0
  70. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseIsSet.js +9 -0
  71. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseIsTypedArray.js +11 -0
  72. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseKeys.js +12 -0
  73. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseKeysIn.js +13 -0
  74. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseTimes.js +7 -0
  75. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseUnary.js +8 -0
  76. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_cloneArrayBuffer.js +8 -0
  77. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_cloneBuffer.js +10 -0
  78. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_cloneDataView.js +8 -0
  79. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_cloneRegExp.js +8 -0
  80. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_cloneSymbol.js +8 -0
  81. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_cloneTypedArray.js +8 -0
  82. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_copyArray.js +8 -0
  83. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_copyObject.js +14 -0
  84. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_copySymbols.js +8 -0
  85. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_copySymbolsIn.js +8 -0
  86. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_coreJsData.js +5 -0
  87. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_defineProperty.js +10 -0
  88. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_freeGlobal.js +4 -0
  89. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getAllKeys.js +9 -0
  90. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getAllKeysIn.js +9 -0
  91. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getMapData.js +8 -0
  92. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getNative.js +9 -0
  93. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getPrototype.js +5 -0
  94. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getRawTag.js +14 -0
  95. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getSymbols.js +10 -0
  96. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getSymbolsIn.js +11 -0
  97. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getTag.js +23 -0
  98. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getValue.js +6 -0
  99. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_hashClear.js +7 -0
  100. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_hashDelete.js +7 -0
  101. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_hashGet.js +13 -0
  102. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_hashHas.js +9 -0
  103. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_hashSet.js +9 -0
  104. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_initCloneArray.js +8 -0
  105. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_initCloneByTag.js +33 -0
  106. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_initCloneObject.js +9 -0
  107. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_isIndex.js +8 -0
  108. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_isKeyable.js +7 -0
  109. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_isMasked.js +11 -0
  110. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_isPrototype.js +8 -0
  111. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_listCacheClear.js +6 -0
  112. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_listCacheDelete.js +9 -0
  113. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_listCacheGet.js +8 -0
  114. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_listCacheHas.js +7 -0
  115. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_listCacheSet.js +8 -0
  116. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_mapCacheClear.js +13 -0
  117. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_mapCacheDelete.js +8 -0
  118. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_mapCacheGet.js +7 -0
  119. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_mapCacheHas.js +7 -0
  120. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_mapCacheSet.js +8 -0
  121. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_nativeCreate.js +5 -0
  122. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_nativeKeys.js +5 -0
  123. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_nativeKeysIn.js +8 -0
  124. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_nodeUtil.js +9 -0
  125. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_objectToString.js +7 -0
  126. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_overArg.js +8 -0
  127. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_root.js +5 -0
  128. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_stackClear.js +7 -0
  129. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_stackDelete.js +7 -0
  130. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_stackGet.js +6 -0
  131. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_stackHas.js +6 -0
  132. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_stackSet.js +16 -0
  133. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_toSource.js +15 -0
  134. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/cloneDeep.js +8 -0
  135. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/eq.js +6 -0
  136. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isArguments.js +10 -0
  137. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isArray.js +4 -0
  138. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isArrayLike.js +8 -0
  139. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isBuffer.js +6 -0
  140. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isEmpty.js +21 -0
  141. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isFunction.js +11 -0
  142. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isLength.js +7 -0
  143. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isMap.js +7 -0
  144. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isObject.js +7 -0
  145. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isObjectLike.js +6 -0
  146. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isSet.js +7 -0
  147. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isTypedArray.js +7 -0
  148. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/keys.js +9 -0
  149. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/keysIn.js +9 -0
  150. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/stubArray.js +6 -0
  151. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/stubFalse.js +6 -0
  152. package/package.json +79 -19
  153. package/CHANGELOG.json +0 -1
  154. package/CHANGELOG.md +0 -584
  155. package/LICENSE.md +0 -5
  156. package/README.md +0 -18
  157. package/configure/CHANGELOG.json +0 -1
  158. package/configure/CHANGELOG.md +0 -549
  159. package/configure/lib/card-bar.js +0 -57
  160. package/configure/lib/card-bar.js.map +0 -1
  161. package/configure/lib/defaults.js +0 -114
  162. package/configure/lib/defaults.js.map +0 -1
  163. package/configure/lib/index.js +0 -163
  164. package/configure/lib/index.js.map +0 -1
  165. package/configure/lib/main.js +0 -253
  166. package/configure/lib/main.js.map +0 -1
  167. package/configure/lib/model-options.js +0 -144
  168. package/configure/lib/model-options.js.map +0 -1
  169. package/configure/lib/number-text-field.js +0 -47
  170. package/configure/lib/number-text-field.js.map +0 -1
  171. package/configure/package.json +0 -24
  172. package/controller/CHANGELOG.json +0 -1
  173. package/controller/CHANGELOG.md +0 -476
  174. package/controller/lib/defaults.js +0 -20
  175. package/controller/lib/defaults.js.map +0 -1
  176. package/controller/lib/index.js +0 -215
  177. package/controller/lib/index.js.map +0 -1
  178. package/controller/package.json +0 -15
  179. package/docs/config-schema.json +0 -1796
  180. package/docs/config-schema.json.md +0 -1318
  181. package/docs/demo/config.js +0 -8
  182. package/docs/demo/generate.js +0 -6
  183. package/docs/demo/index.html +0 -1
  184. package/docs/demo/session.js +0 -6
  185. package/docs/pie-schema.json +0 -873
  186. package/docs/pie-schema.json.md +0 -639
  187. package/lib/answer-fraction.js +0 -109
  188. package/lib/answer-fraction.js.map +0 -1
  189. package/lib/fraction-model-chart.js +0 -279
  190. package/lib/fraction-model-chart.js.map +0 -1
  191. package/lib/index.js +0 -91
  192. package/lib/index.js.map +0 -1
  193. package/lib/main.js +0 -203
  194. package/lib/main.js.map +0 -1
@@ -0,0 +1,154 @@
1
+ import { useEffect as e, useRef as t, useState as n } from "react";
2
+ import { styled as r } from "@mui/material/styles";
3
+ import { jsx as i, jsxs as a } from "react/jsx-runtime";
4
+ import { Bar as o, BarChart as s, Cell as c, LabelList as l, Pie as u, PieChart as d, YAxis as f } from "recharts";
5
+ //#region src/delivery/fraction-model-chart.tsx
6
+ var p = r("div")({
7
+ display: "grid",
8
+ gridTemplateColumns: "200px 200px 200px",
9
+ gap: "10px",
10
+ padding: "5px 0"
11
+ }), m = r("div")({
12
+ display: "grid",
13
+ gridTemplateColumns: "200px 200px 200px",
14
+ gap: "20px",
15
+ padding: "10px 0"
16
+ }), h = r(d)({ "& .recharts-pie-sector": {
17
+ outline: "none !important",
18
+ "&:focus": { outline: "none !important" }
19
+ } }), g = (r) => {
20
+ let d = (e, t) => {
21
+ typeof t == "string" && (t = parseInt(t));
22
+ let n = A.findIndex((t) => t.id === e), r;
23
+ r = n >= 0 ? A[n].value === t ? A.filter((e, t) => t !== n) : [
24
+ ...A.slice(0, n),
25
+ {
26
+ id: e,
27
+ value: t
28
+ },
29
+ ...A.slice(n + 1)
30
+ ] : [...A, {
31
+ id: e,
32
+ value: t
33
+ }], D(r), j(r);
34
+ }, g = (e, t) => {
35
+ k(e + "-" + t);
36
+ }, _ = () => {
37
+ k(null);
38
+ }, v = (e, t) => {
39
+ let [n, r] = t.split("-").map(Number), i = A.find((e) => e.id === n);
40
+ if (i && r <= i.value) return "rgb(60, 73, 150, 0.6)";
41
+ if (e) {
42
+ let [t, i] = e.split("-").map(Number);
43
+ if (t === n && i >= r) return "rgb(0, 0, 0, 0.25)";
44
+ }
45
+ return "#FFFFFF";
46
+ }, y = (e) => {
47
+ let { cx: t, cy: n, midAngle: r, outerRadius: a, index: o } = e, s = Math.PI / 180, c = a * 1.13, l = t + c * Math.cos(-r * s);
48
+ return /* @__PURE__ */ i("text", {
49
+ x: l,
50
+ y: n + c * Math.sin(-r * s),
51
+ fill: "#000000",
52
+ textAnchor: l > t ? "start" : "end",
53
+ dominantBaseline: "central",
54
+ children: `${(o + 1).toFixed(0)}`
55
+ });
56
+ }, b = () => (e) => {
57
+ let { fill: t, x: n, y: r, width: a, height: o } = e;
58
+ return /* @__PURE__ */ i("g", { children: /* @__PURE__ */ i("rect", {
59
+ x: n,
60
+ y: r,
61
+ width: a,
62
+ height: o,
63
+ stroke: "#000000",
64
+ fill: t
65
+ }) });
66
+ }, { value: x = [], modelType: S = "bar", noOfModels: C = 0, partsPerModel: w = 0, showLabel: T = !1, disabled: E = !1, onChange: D } = r, [O, k] = n(null), [A, j] = n(x), M = () => {
67
+ let e = [];
68
+ for (let t = 1; t < C + 1; t++) {
69
+ let n = [{ name: t }];
70
+ for (let e = 1; e < w + 1; e++) n[0][`${e}`] = 1;
71
+ e.push(n);
72
+ }
73
+ let t = [];
74
+ return e.forEach((e, n) => {
75
+ t.push(/* @__PURE__ */ a(s, {
76
+ width: 200,
77
+ height: 30 * w,
78
+ data: e,
79
+ children: [/* @__PURE__ */ i(f, {
80
+ hide: !0,
81
+ type: "number",
82
+ domain: [0, w]
83
+ }), Object.keys(e[0]).map((e, t) => {
84
+ if (e !== "name") return /* @__PURE__ */ i(o, {
85
+ dataKey: e,
86
+ stackId: "a",
87
+ onClick: E ? null : () => d(n + 1, e),
88
+ onMouseEnter: E ? null : () => g(n + 1, e),
89
+ onMouseLeave: E ? null : () => _(n + 1, e),
90
+ shape: b(),
91
+ isAnimationActive: !1,
92
+ fill: v(O, `${n + 1}-${e}`),
93
+ children: T && /* @__PURE__ */ i(l, {
94
+ position: "left",
95
+ fill: "#000000"
96
+ })
97
+ }, `bar-${n + 1}-${t + 1}`);
98
+ })]
99
+ }, `bar-chart-${n + 1}`));
100
+ }), /* @__PURE__ */ i(m, { children: t });
101
+ }, N = t(null), P = () => {
102
+ let e = [];
103
+ for (let t = 1; t < C + 1; t++) {
104
+ let t = Array.from({ length: w }, (e, t) => ({
105
+ name: `${t + 1}`,
106
+ value: 1
107
+ }));
108
+ e.push(t);
109
+ }
110
+ let t = [];
111
+ return e.forEach((e, n) => {
112
+ t.push(/* @__PURE__ */ i(h, {
113
+ width: 200,
114
+ height: 200,
115
+ children: /* @__PURE__ */ i(u, {
116
+ data: e,
117
+ fill: "#FFFFFF",
118
+ stroke: "#000000",
119
+ dataKey: "value",
120
+ startAngle: 90,
121
+ endAngle: -270,
122
+ isAnimationActive: !1,
123
+ labelLine: !1,
124
+ label: T && y,
125
+ children: e.map((e, t) => /* @__PURE__ */ i(c, {
126
+ onClick: E ? null : () => d(n + 1, t + 1),
127
+ onMouseEnter: E ? null : () => g(n + 1, t + 1),
128
+ onMouseLeave: E ? null : () => _(n + 1, t + 1),
129
+ fill: v(O, `${n + 1}-${t + 1}`),
130
+ style: {
131
+ outline: "none",
132
+ cursor: E ? "default" : "pointer"
133
+ }
134
+ }, `${n + 1}-${t + 1}`))
135
+ }, `pie-${n + 1}`)
136
+ }, `pie-chart-${n}`));
137
+ }), /* @__PURE__ */ i(p, {
138
+ ref: N,
139
+ children: t
140
+ });
141
+ };
142
+ if (S === "bar") return M();
143
+ if (S === "pie") return e(() => {
144
+ if (N?.current && w === 1) {
145
+ let e = N.current.querySelectorAll("path");
146
+ e.length > 0 && e.forEach((e) => {
147
+ let t = e.getAttribute("d");
148
+ e.setAttribute("d", t.replaceAll("L 100,100", ""));
149
+ });
150
+ }
151
+ }, []), P();
152
+ };
153
+ //#endregion
154
+ export { g as default };
@@ -0,0 +1,22 @@
1
+ /**
2
+ * @synced-from pie-elements/packages/fraction-model/src/index.js
3
+ * @auto-generated
4
+ *
5
+ * This file is automatically synced from pie-elements and converted to TypeScript.
6
+ * Manual edits will be overwritten on next sync.
7
+ * To make changes, edit the upstream JavaScript file and run sync again.
8
+ */
9
+ import FractionModelChart from './fraction-model-chart.js';
10
+ export { FractionModelChart };
11
+ export default class FractionModel extends HTMLElement {
12
+ constructor();
13
+ set model(m: any);
14
+ get model(): any;
15
+ set session(s: any);
16
+ get session(): any;
17
+ isSessionComplete(session: any, model: any): boolean;
18
+ onSessionChange(session: any): void;
19
+ connectedCallback(): void;
20
+ _render(): void;
21
+ disconnectedCallback(): void;
22
+ }
@@ -0,0 +1,54 @@
1
+ import e from "./fraction-model-chart.js";
2
+ import t from "../node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/cloneDeep.js";
3
+ import n from "./main.js";
4
+ import r from "react";
5
+ import { createRoot as i } from "react-dom/client";
6
+ import { SessionChangedEvent as a } from "@pie-element/shared-player-events";
7
+ import { renderMath as o } from "@pie-element/shared-math-rendering-mathjax";
8
+ //#region src/delivery/index.ts
9
+ var s = class extends HTMLElement {
10
+ constructor() {
11
+ super(), this._root = null;
12
+ }
13
+ set model(e) {
14
+ this._model = e, this._render();
15
+ }
16
+ get model() {
17
+ return this._model;
18
+ }
19
+ set session(e) {
20
+ this._session = e, this._render();
21
+ }
22
+ get session() {
23
+ return this._session;
24
+ }
25
+ isSessionComplete(e, t) {
26
+ let n = e && e.answers, r = t.allowedStudentConfig ? n.noOfModel > 0 && n.partsPerModel > 0 : !0, i = Array.isArray(n.response) && n.response.length > 0;
27
+ return r && i;
28
+ }
29
+ onSessionChange(e) {
30
+ this._session.answers = e && e.answers;
31
+ let t = this.isSessionComplete(this._session, this._model);
32
+ this.dispatchEvent(new a(this.tagName.toLowerCase(), t));
33
+ }
34
+ connectedCallback() {
35
+ this._render();
36
+ }
37
+ _render() {
38
+ if (this._model && this._session) {
39
+ let e = t(this._model), a = r.createElement(n, {
40
+ model: e,
41
+ session: this._session,
42
+ onSessionChange: this.onSessionChange.bind(this)
43
+ });
44
+ this._root ||= i(this), this._root.render(a), queueMicrotask(() => {
45
+ o(this);
46
+ });
47
+ }
48
+ }
49
+ disconnectedCallback() {
50
+ this._root && this._root.unmount();
51
+ }
52
+ };
53
+ //#endregion
54
+ export { e as FractionModelChart, s as default };
@@ -0,0 +1,38 @@
1
+ /**
2
+ * @synced-from pie-elements/packages/fraction-model/src/main.jsx
3
+ * @auto-generated
4
+ *
5
+ * This file is automatically synced from pie-elements and converted to TypeScript.
6
+ * Manual edits will be overwritten on next sync.
7
+ * To make changes, edit the upstream JavaScript file and run sync again.
8
+ */
9
+ import React from 'react';
10
+ import PropTypes from 'prop-types';
11
+ export declare class Main extends React.Component {
12
+ static propTypes: {
13
+ model: PropTypes.Requireable<object>;
14
+ session: PropTypes.Requireable<object>;
15
+ onSessionChange: PropTypes.Validator<(...args: any[]) => any>;
16
+ };
17
+ constructor(props: any);
18
+ /**
19
+ * Function to trigger when session value change for fraction model
20
+ */
21
+ callOnSessionChange: any;
22
+ /**
23
+ * Function to generate answers for preview selection
24
+ * @param {object} model contains model object for fraction model
25
+ * @returns answer model
26
+ */
27
+ generateAnswers: any;
28
+ /**
29
+ * Function to trigger when answer change from preview
30
+ * @param {object} newAnswers contains updated answer model
31
+ */
32
+ onAnswerChange: any;
33
+ toggleShowCorrect: any;
34
+ onResponseChange: any;
35
+ generateRandomKey: any;
36
+ render(): React.JSX.Element;
37
+ }
38
+ export default Main;
@@ -0,0 +1,136 @@
1
+ import e from "./answer-fraction.js";
2
+ import t from "./fraction-model-chart.js";
3
+ import n from "../node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/cloneDeep.js";
4
+ import r from "react";
5
+ import i from "prop-types";
6
+ import { styled as a } from "@mui/material/styles";
7
+ import { jsx as o, jsxs as s } from "react/jsx-runtime";
8
+ import c from "@pie-lib/correct-answer-toggle";
9
+ import { AlertDialog as l } from "@pie-lib/config-ui";
10
+ import * as u from "@pie-lib/render-ui";
11
+ import { PreviewPrompt as d, UiLayout as f } from "@pie-lib/render-ui";
12
+ //#region src/delivery/main.tsx
13
+ function p(e) {
14
+ return typeof e == "function" || typeof e == "object" && !!e && typeof e.$$typeof == "symbol";
15
+ }
16
+ function m(e, t) {
17
+ 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;
18
+ }
19
+ var h = m(f, "UiLayout") || m(y.UiLayout, "UiLayout"), g = m(d, "PreviewPrompt") || m(y.PreviewPrompt, "PreviewPrompt"), _ = u, v = _.default, y = v && typeof v == "object" ? v : _, b = a("div")({ padding: "16px" }), x = a("div")({
20
+ textAlign: "center",
21
+ fontSize: "20px"
22
+ }), S = class extends r.Component {
23
+ static propTypes = {
24
+ model: i.object,
25
+ session: i.object,
26
+ onSessionChange: i.func.isRequired
27
+ };
28
+ constructor(e) {
29
+ super(e), this.state = {
30
+ session: {
31
+ ...e.session,
32
+ answers: e.session && e.session.answers || this.generateAnswers(e.model)
33
+ },
34
+ showCorrect: !1,
35
+ answerChangeDialog: {
36
+ open: !1,
37
+ text: ""
38
+ }
39
+ }, this.callOnSessionChange();
40
+ }
41
+ callOnSessionChange = () => {
42
+ let { onSessionChange: e } = this.props;
43
+ e && e(this.state.session);
44
+ };
45
+ generateAnswers = (e) => {
46
+ let t = { response: [] };
47
+ return e.allowedStudentConfig && (t.noOfModel = "", t.partsPerModel = ""), t;
48
+ };
49
+ onAnswerChange = (e) => {
50
+ let t = n(this.state.session), r = {
51
+ ...this.state.session,
52
+ answers: e
53
+ };
54
+ e.response.length > 0 ? this.setState({ answerChangeDialog: {
55
+ open: !0,
56
+ oldSession: t,
57
+ newSession: r,
58
+ text: "Changing either the Number of Models or Parts per Model will remove added answer. Are you sure you want to continue?"
59
+ } }) : this.setState((e) => ({ session: r }), this.callOnSessionChange);
60
+ };
61
+ toggleShowCorrect = (e) => {
62
+ this.setState({ showCorrect: e });
63
+ };
64
+ onResponseChange = (e) => {
65
+ this.setState((t) => ({ session: {
66
+ ...t.session,
67
+ answers: {
68
+ ...t.session.answers,
69
+ response: e
70
+ }
71
+ } }), this.callOnSessionChange);
72
+ };
73
+ generateRandomKey = () => Math.floor(Math.random() * 1e4);
74
+ render() {
75
+ let { model: n } = this.props, { showCorrect: r, session: i, answerChangeDialog: a } = this.state, { prompt: u, title: d, correctness: f = {}, extraCSSRules: p, language: m } = n, _ = f.correctness && f.correctness !== "correct", v = this.generateRandomKey();
76
+ return /* @__PURE__ */ o(h, {
77
+ extraCSSRules: p,
78
+ children: /* @__PURE__ */ s(b, { children: [
79
+ /* @__PURE__ */ o(x, { children: /* @__PURE__ */ o(g, {
80
+ className: "prompt",
81
+ prompt: d,
82
+ tagName: "h3"
83
+ }) }),
84
+ /* @__PURE__ */ o(g, {
85
+ className: "prompt",
86
+ prompt: u,
87
+ tagName: "p"
88
+ }),
89
+ /* @__PURE__ */ o(c, {
90
+ language: m,
91
+ show: _,
92
+ toggled: r,
93
+ onToggle: this.toggleShowCorrect
94
+ }),
95
+ /* @__PURE__ */ o(e, {
96
+ model: n,
97
+ showCorrect: r,
98
+ disabled: n.view,
99
+ onAnswerChange: this.onAnswerChange,
100
+ answers: i.answers
101
+ }),
102
+ /* @__PURE__ */ o(t, {
103
+ disabled: n.view,
104
+ value: r ? n.correctResponse : i.answers.response,
105
+ modelType: n.modelTypeSelected,
106
+ noOfModels: r ? n.maxModelSelected : n.allowedStudentConfig ? i.answers.noOfModel : n.maxModelSelected,
107
+ partsPerModel: r ? n.partsPerModel : n.allowedStudentConfig ? i.answers.partsPerModel : n.partsPerModel,
108
+ showLabel: n.showGraphLabels,
109
+ onChange: this.onResponseChange
110
+ }, v),
111
+ /* @__PURE__ */ o(l, {
112
+ open: a.open,
113
+ title: "Warning",
114
+ text: a.text,
115
+ onConfirm: () => {
116
+ let e = this.state.answerChangeDialog.newSession;
117
+ e.answers.response = [], this.setState(() => ({
118
+ session: e,
119
+ answerChangeDialog: { open: !1 }
120
+ }), this.callOnSessionChange);
121
+ },
122
+ onClose: () => {
123
+ this.setState((e) => ({
124
+ session: e.answerChangeDialog.oldSession,
125
+ answerChangeDialog: { open: !1 }
126
+ }), this.callOnSessionChange);
127
+ },
128
+ onConfirmText: "OK",
129
+ onCloseText: "Cancel"
130
+ })
131
+ ] })
132
+ });
133
+ }
134
+ };
135
+ //#endregion
136
+ export { S as default };
@@ -0,0 +1 @@
1
+ export { default } from './delivery/index.js';
@@ -0,0 +1,8 @@
1
+ /**
2
+ * IIFE entry point for fraction-model element
3
+ * This file is only used for IIFE builds and includes auto-registration
4
+ *
5
+ * @sync-generated - Auto-generated during sync from pie-elements
6
+ */
7
+ import Element from './index.js';
8
+ export default Element;