@doenet/doenetml 0.7.24-dev.494 → 0.7.24-dev.496

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 (115) hide show
  1. package/{AnswerResponseButton-DbS5sLx6.js → AnswerResponseButton-BrrWb-sk.js} +2 -2
  2. package/{Description-QeBEMMoD.js → Description-BZ8oeOL9.js} +1 -1
  3. package/{DynamicMath-D_z9d2f8.js → DynamicMath-DNJy5-OC.js} +1 -1
  4. package/{EditorViewer-BhbW7rQG.js → EditorViewer-BtN3PY5x.js} +7 -7
  5. package/{GraphFrame-nDdJjXBL.js → GraphFrame-l_fXN6oJ.js} +2 -2
  6. package/{JSXGraphRenderer-BmpW9-68.js → JSXGraphRenderer-xuqNYEMe.js} +1 -1
  7. package/{NonInlineMediaWrapper-DpNtSUi0.js → NonInlineMediaWrapper-CcmkTJmz.js} +1 -1
  8. package/Viewer/DocViewer.d.ts.map +1 -1
  9. package/Viewer/coreWorkerBoot.d.ts +9 -1
  10. package/Viewer/coreWorkerBoot.d.ts.map +1 -1
  11. package/{_error-DY03arsc.js → _error-6wEbVswo.js} +2 -2
  12. package/{alert-CE40EAaj.js → alert-DGIdSxd5.js} +3 -3
  13. package/{angle-DtgrXh9o.js → angle-B_yqY4eA.js} +7 -7
  14. package/{answer-CdNb4LVS.js → answer-CsP3EPMl.js} +6 -6
  15. package/{asList-CCgYctAD.js → asList-DCXp-O5w.js} +2 -2
  16. package/{blockQuote-dlizkObx.js → blockQuote-BdOxQAZX.js} +3 -3
  17. package/{boolean-DSq-0yl8.js → boolean-w9_LHFn2.js} +2 -2
  18. package/{booleanInput-C575Iif6.js → booleanInput-WvLRmRvQ.js} +7 -7
  19. package/{br-Hesq9_-1.js → br-BkZHYEyb.js} +2 -2
  20. package/{button-DDK1iXXi.js → button-eO4GcDK0.js} +5 -5
  21. package/{c-C1ACSsGA.js → c-BQKhLZrA.js} +3 -3
  22. package/{cell-DxZMaDm7.js → cell-C0WBTaNk.js} +3 -3
  23. package/{choiceInput-2tvO5zfR.js → choiceInput-BhxWosVq.js} +4 -4
  24. package/{circle-DA5c5bVo.js → circle-CpKUhiP5.js} +6 -6
  25. package/{cobwebPolyline-DV8KTcv8.js → cobwebPolyline-_r-rG3Nw.js} +4 -4
  26. package/{codeEditor-CKFR1ro-.js → codeEditor-CszCj14f.js} +2 -2
  27. package/{composites-DYsGhK46.js → composites-Bbo8IP1W.js} +1 -1
  28. package/{containerBlock-Br4ZG0x8.js → containerBlock-Dyrio5Dv.js} +4 -4
  29. package/{containerInline-BHZMRPq7.js → containerInline--3XrSLzN.js} +4 -4
  30. package/{curve-CrAuG4JI.js → curve-kTH7dlHM.js} +4 -4
  31. package/{doenetml-C2eD5Aa8.js → doenetml-CJXENjwD.js} +53 -17
  32. package/doenetml-external-worker.js +2 -2
  33. package/doenetml-inline-worker.js +3 -3
  34. package/doenetml-worker/index.esm.js +1 -1
  35. package/doenetml-worker/index.js +1 -1
  36. package/{ellipsis-BfGCMJxK.js → ellipsis-D80KnK2G.js} +2 -2
  37. package/{em-Bv6I9uy0.js → em-TShdxpOF.js} +3 -3
  38. package/{embed-2WESC8CU.js → embed-C-EstgJD.js} +2 -2
  39. package/{feedback-BWshcYtw.js → feedback-Cxw3lzpg.js} +4 -4
  40. package/{figure-DEItZJsK.js → figure--Rh8P7Sz.js} +3 -3
  41. package/{fillPatterns-DzM_3Wyq.js → fillPatterns-B_8jtfYS.js} +1 -1
  42. package/{footnote-DsmeeUYL.js → footnote-DptVzLcw.js} +3 -3
  43. package/{fractionInput-Z4Sw5N8M.js → fractionInput-DuK4ef-d.js} +4 -4
  44. package/{graph-0O58o0CF.js → graph-CJH3fb_9.js} +6 -6
  45. package/{hint-DUlkEqHa.js → hint-B4OYwoCZ.js} +4 -4
  46. package/{hovercard-store-BqNFxG5q.js → hovercard-store-Cor2JG-E.js} +1 -1
  47. package/{hr-Cvey3Fzn.js → hr-DxyxAfyw.js} +2 -2
  48. package/{image-tQrtG_58.js → image-CRE46C0H.js} +7 -7
  49. package/{index-DkBK6rMo.js → index-CBRP4-wN.js} +1 -1
  50. package/{index-BJUAoh-a.js → index-DsDLFuEL.js} +1 -1
  51. package/{index.es-CLBoBt-D.js → index.es-DEOewEZn.js} +1 -1
  52. package/index.js +1 -1
  53. package/{label-DmM5hq0W.js → label-CIpj5Y63.js} +7 -7
  54. package/{labelWithLatex-B8gk0ef2.js → labelWithLatex-BicLyl1D.js} +2 -2
  55. package/{legend-nNh5fEen.js → legend-B6iNoOk3.js} +4 -4
  56. package/{line-CA9CoZCJ.js → line-uTSnEqNp.js} +7 -7
  57. package/{lineFamilyDragHandlers-BW_JhKDK.js → lineFamilyDragHandlers-Df7osYz-.js} +1 -1
  58. package/{lineSegment-REvQQtno.js → lineSegment-Dfyje5QM.js} +5 -5
  59. package/{list-BEXAuGpI.js → list-D9pGeii4.js} +4 -4
  60. package/{lq-CAqSC0MW.js → lq-CZICWXNg.js} +2 -2
  61. package/{lsq-zMKDcEn8.js → lsq-C5DeGe8L.js} +2 -2
  62. package/{markupRenderer-CyrA8hDN.js → markupRenderer-DiDBWayp.js} +1 -1
  63. package/{math-CHMRu96_.js → math--Up--LZT.js} +7 -7
  64. package/{mathInput-3PVX2Q3s.js → mathInput-DiCsw8Xy.js} +7 -7
  65. package/{matrixInput-r5mMKRKW.js → matrixInput-DeDRhwTH.js} +5 -5
  66. package/{mdash-D2LFsAY4.js → mdash-YpMtTzYb.js} +2 -2
  67. package/{nbsp-qfLVHKuI.js → nbsp-CzouLmyA.js} +2 -2
  68. package/{ndash-Dnop8yIV.js → ndash-CesSHMoZ.js} +2 -2
  69. package/{number-dpL0x8wQ.js → number-Dsi8t-oT.js} +7 -7
  70. package/{orbitalDiagram-ooTGY2ll.js → orbitalDiagram-DqW8lDXG.js} +2 -2
  71. package/{orbitalDiagramInput-DR21JRQP.js → orbitalDiagramInput-Ujhexiv5.js} +3 -3
  72. package/{p-CIuOZLUc.js → p-JkDCJkLt.js} +4 -4
  73. package/package.json +1 -1
  74. package/{paginatorControls-e4AXAn5h.js → paginatorControls-zeS4MeYM.js} +3 -3
  75. package/{pegboard-A6wSalQ6.js → pegboard-DzlzO4lr.js} +4 -4
  76. package/{point-zyUQh1rb.js → point-BnRGGL5k.js} +7 -7
  77. package/{polygon-DTfuAUCH.js → polygon-BeS39j3N.js} +6 -6
  78. package/{polyline-Bsa2yfUa.js → polyline-DjMK8sjj.js} +5 -5
  79. package/{pre-C8qDMCqj.js → pre-B9SF1WXw.js} +3 -3
  80. package/{prefigure-Bn3Llqho.js → prefigure-CgQvLn5h.js} +1 -1
  81. package/{pretzel-CiQZK_ZA.js → pretzel-DBniVxdm.js} +4 -4
  82. package/{q-Bk999DnN.js → q-CLzPbBkU.js} +3 -3
  83. package/{ray-D5EDYw_-.js → ray-Bg6L_yXO.js} +5 -5
  84. package/{ref-CSIt1Z4V.js → ref-CCJXcMPu.js} +2 -2
  85. package/{regionBetweenCurveXAxis-DyCVBGYD.js → regionBetweenCurveXAxis-CS_AlIVf.js} +5 -5
  86. package/{regionBetweenCurves-BjWYPoHT.js → regionBetweenCurves-DNvowvoK.js} +5 -5
  87. package/{row-Q58YymOq.js → row-Dle_oVKb.js} +2 -2
  88. package/{rq-BdAg6eNb.js → rq-CI5DfsFj.js} +2 -2
  89. package/{rsq-DlAB9-MR.js → rsq-BB9E3_NA.js} +2 -2
  90. package/{section-BxTY8cWT.js → section-p0dG4GrG.js} +5 -5
  91. package/{sha256-DT5xJ2Hv-CjdmwgT5.js → sha256-DT5xJ2Hv-nRhEg6Iu.js} +1 -1
  92. package/{sideBySide-CYj1a3V_.js → sideBySide-C0hv1H5l.js} +2 -2
  93. package/{slider-A3VwTdl_.js → slider-CvaKYTQl.js} +4 -4
  94. package/{slopeField-DjIUlrk2.js → slopeField-C7IAnOmN.js} +2 -2
  95. package/{solution-Clw7Xziy.js → solution-WX05uux-.js} +4 -4
  96. package/{spreadsheet-BJxu9g-r.js → spreadsheet-YJjdy9w5.js} +2 -2
  97. package/{sq-CI2Vsk5j.js → sq-ChyPDsQB.js} +3 -3
  98. package/{subsetOfRealsInput-laFBI7Xu.js → subsetOfRealsInput-BwDeYfV-.js} +3 -3
  99. package/{summaryStatistics-BzwduqVW.js → summaryStatistics-Dnv8WfMs.js} +2 -2
  100. package/{table-DkgXiBQC.js → table-DgDuWmAc.js} +2 -2
  101. package/{tabular-5c7W6zVm.js → tabular-DCqCE_YP.js} +2 -2
  102. package/{tag-DoTKkltJ.js → tag-Cz5m3LXR.js} +2 -2
  103. package/{text-Dax3EX4d.js → text-BpAMUhHw.js} +6 -6
  104. package/{textInput-Cm0R3eQR.js → textInput-DUcTr-gU.js} +6 -6
  105. package/{tooltip-provider-Cz4xpklc.js → tooltip-provider-C2iQu8q1.js} +2 -2
  106. package/{useAnchoredGraphDragHandler-BHVFbSWy.js → useAnchoredGraphDragHandler-guvyhnhU.js} +1 -1
  107. package/useDoenetRenderer-BAtxQcWU.js +114 -0
  108. package/{useFieldCurve-DH2arzmC.js → useFieldCurve-DTQt88CG.js} +2 -2
  109. package/{useSubmitActionWithDelay-CmWWXUt7.js → useSubmitActionWithDelay-DfA50-Kj.js} +2 -2
  110. package/utils/handshakeCensus.d.ts +52 -10
  111. package/utils/handshakeCensus.d.ts.map +1 -1
  112. package/{vector-BRr9Zppm.js → vector-BWEByhmm.js} +7 -7
  113. package/{vectorField-DQTe6Zcf.js → vectorField-De1Z4iOl.js} +2 -2
  114. package/{video-CtMyJEyY.js → video-BQM_T1_i.js} +4 -4
  115. package/useDoenetRenderer-BDCqlEQN.js +0 -114
@@ -24,6 +24,39 @@
24
24
  * Everything here is best-effort. A census that cannot be joined or queried
25
25
  * reads as "no visible contention", which is the behavior that predates it.
26
26
  */
27
+ /**
28
+ * Lock name held — in `shared` mode, so every holder is granted at once — for
29
+ * the duration of a core handshake.
30
+ *
31
+ * Exported so tests can drive the census the way other realms do: seats taken
32
+ * through the lock manager directly are visible to a query but leave this
33
+ * realm's cached count untouched, which is the state a first boot is really
34
+ * in (#1718).
35
+ */
36
+ export declare const HANDSHAKE_CENSUS_LOCK = "doenet-handshake-census";
37
+ /**
38
+ * A realm's place in the census, for as long as it holds the handle.
39
+ */
40
+ export type HandshakeCensusSeat = {
41
+ /** Leave the census. */
42
+ release: () => void;
43
+ /**
44
+ * How many handshakes were in flight — this one included — when the seat
45
+ * was granted, or the neutral 1 wherever the census could not be joined
46
+ * or queried.
47
+ *
48
+ * Counted from inside the grant, which is what makes it usable on a first
49
+ * boot: `concurrentHandshakesSnapshot` answers with the reading before
50
+ * the caller's own refresh, and a realm's first handshake has no reading
51
+ * before it (#1718).
52
+ *
53
+ * A promise, because the count is deliberately NOT what the seat waits
54
+ * for: the handle resolves the moment the lock is granted, and the figure
55
+ * follows a query later. A caller that has already started its handshake
56
+ * consumes it where it lands.
57
+ */
58
+ count: Promise<number>;
59
+ };
27
60
  /**
28
61
  * How many logical cores the browser admits to, or 0 where the hint is
29
62
  * unavailable (no `navigator`, or a browser that withholds it). Callers decide
@@ -43,12 +76,15 @@ export declare function reportedCores(): number;
43
76
  * handshake concludes; if they do not, the browser still drops it when the
44
77
  * realm goes away, so a crashed realm cannot inflate the count forever.
45
78
  *
79
+ * The handle carries the count the seat was granted against — see
80
+ * `HandshakeCensusSeat.count` for why a first handshake has nowhere else to
81
+ * get one (#1718). It is a promise, so taking a seat still resolves as soon as
82
+ * the lock is granted.
83
+ *
46
84
  * Resolves to a no-op handle wherever Web Locks are unavailable — the count
47
85
  * then reads as "no visible contention", which is the pre-#1711 behavior.
48
86
  */
49
- export declare function joinHandshakeCensus(): Promise<{
50
- release: () => void;
51
- }>;
87
+ export declare function joinHandshakeCensus(): Promise<HandshakeCensusSeat>;
52
88
  /**
53
89
  * How many core handshakes are in flight across every same-origin realm the
54
90
  * browser is running (see the origin-scope note in `webLocks`), including this
@@ -72,6 +108,11 @@ export declare function countConcurrentHandshakes(): Promise<number>;
72
108
  * at all — a `DocViewer/i18n` CI failure bisected to exactly that change. A
73
109
  * count one boot out of date is a perfectly good input to a timeout; a boot
74
110
  * that races itself is not.
111
+ *
112
+ * What a cache costs is a first reading, since a realm's first handshake has
113
+ * no refresh before it. `HandshakeCensusSeat.count` is where that one reading
114
+ * comes from instead (#1718), and it stays off the boot path the same way:
115
+ * arriving mid-handshake, it widens a budget in flight rather than gating one.
75
116
  */
76
117
  export declare function concurrentHandshakesSnapshot(): number;
77
118
  /**
@@ -81,13 +122,14 @@ export declare function concurrentHandshakesSnapshot(): number;
81
122
  *
82
123
  * Because the update lands a turn or more later, the reading a caller gets
83
124
  * from `concurrentHandshakesSnapshot` is always the one *before* its own
84
- * refresh. A boot refreshes once per handshake attempt, and every released
85
- * census seat refreshes as it drops, so each attempt's read is answered by
86
- * the previous attempt's refresh and a first attempt reads the count as of
87
- * the last attempt or last drained seat in this realm. A wave in
88
- * another tab's realm drains invisibly (its releases refresh its own cache,
89
- * not this one), so the first attempt after one can still read high; the
90
- * attempt's own refresh corrects the reading for every attempt after it.
125
+ * refresh. A boot refreshes once per handshake attempt, and a census seat
126
+ * refreshes both as it is taken and as it drops so each attempt's read is
127
+ * answered by the previous attempt's refresh, and a first attempt reads the
128
+ * count as of the last attempt, or the last seat taken or dropped, in this
129
+ * realm. A wave in another tab's realm drains invisibly (its releases refresh
130
+ * its own cache, not this one), so the first attempt after one can still read
131
+ * high; the attempt's own refresh corrects the reading for every attempt
132
+ * after it.
91
133
  */
92
134
  export declare function refreshHandshakeCensusCount(): void;
93
135
  //# sourceMappingURL=handshakeCensus.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"handshakeCensus.d.ts","sourceRoot":"","sources":["../../src/utils/handshakeCensus.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAuBH;;;;;;;;GAQG;AACH,wBAAgB,aAAa,IAAI,MAAM,CAWtC;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,mBAAmB,IAAI,OAAO,CAAC;IAAE,OAAO,EAAE,MAAM,IAAI,CAAA;CAAE,CAAC,CAgFtE;AAED;;;;;;;;GAQG;AACH,wBAAsB,yBAAyB,IAAI,OAAO,CAAC,MAAM,CAAC,CAcjE;AAQD;;;;;;;;;;;;;GAaG;AACH,wBAAgB,4BAA4B,IAAI,MAAM,CAErD;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,2BAA2B,IAAI,IAAI,CAUlD"}
1
+ {"version":3,"file":"handshakeCensus.d.ts","sourceRoot":"","sources":["../../src/utils/handshakeCensus.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAIH;;;;;;;;GAQG;AACH,eAAO,MAAM,qBAAqB,4BAA4B,CAAC;AAS/D;;GAEG;AACH,MAAM,MAAM,mBAAmB,GAAG;IAC9B,wBAAwB;IACxB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB;;;;;;;;;;;;;;OAcG;IACH,KAAK,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;CAC1B,CAAC;AAYF;;;;;;;;GAQG;AACH,wBAAgB,aAAa,IAAI,MAAM,CAWtC;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,mBAAmB,IAAI,OAAO,CAAC,mBAAmB,CAAC,CAsGlE;AAED;;;;;;;;GAQG;AACH,wBAAsB,yBAAyB,IAAI,OAAO,CAAC,MAAM,CAAC,CAcjE;AAQD;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,4BAA4B,IAAI,MAAM,CAErD;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,2BAA2B,IAAI,IAAI,CAUlD"}
@@ -1,11 +1,11 @@
1
- import { A as DocContext, q as jsxRuntimeExports, B as textRendererStyle } from "./doenetml-C2eD5Aa8.js";
1
+ import { A as DocContext, q as jsxRuntimeExports, B as textRendererStyle } from "./doenetml-CJXENjwD.js";
2
2
  import React__default, { useContext, useRef } from "react";
3
- import { j as jxg, s as syncLayer, g as syncVisPropValues, e as syncLineStrokeStyle, a as syncWithLabelToggle, f as syncLabelStrokeColor, b as syncLabelMaskCssStyle, i as applyLineFamilyLabelPlacement, k as buildLineFamilyLabelAttributes, d as attachLabelHoverHighlight, c as computeLabelMaskCssStyle, l as stabilizeInitialLineFamilyLabelPlacement, r as removeJXGEventHandlers } from "./JSXGraphRenderer-BmpW9-68.js";
4
- import { u as useDoenetRenderer } from "./useDoenetRenderer-BDCqlEQN.js";
5
- import { BoardContext, VERTEX_LAYER_OFFSET, LINE_LAYER_OFFSET } from "./graph-0O58o0CF.js";
6
- import { D as DynamicMath } from "./DynamicMath-D_z9d2f8.js";
7
- import { u as useSourceNavigation, a as attachLineFamilyDragHandlers } from "./lineFamilyDragHandlers-BW_JhKDK.js";
8
- import { ChoiceInputInlineContext } from "./choiceInput-2tvO5zfR.js";
3
+ import { j as jxg, s as syncLayer, g as syncVisPropValues, e as syncLineStrokeStyle, a as syncWithLabelToggle, f as syncLabelStrokeColor, b as syncLabelMaskCssStyle, i as applyLineFamilyLabelPlacement, k as buildLineFamilyLabelAttributes, d as attachLabelHoverHighlight, c as computeLabelMaskCssStyle, l as stabilizeInitialLineFamilyLabelPlacement, r as removeJXGEventHandlers } from "./JSXGraphRenderer-xuqNYEMe.js";
4
+ import { u as useDoenetRenderer } from "./useDoenetRenderer-BAtxQcWU.js";
5
+ import { BoardContext, VERTEX_LAYER_OFFSET, LINE_LAYER_OFFSET } from "./graph-CJH3fb_9.js";
6
+ import { D as DynamicMath } from "./DynamicMath-DNJy5-OC.js";
7
+ import { u as useSourceNavigation, a as attachLineFamilyDragHandlers } from "./lineFamilyDragHandlers-Df7osYz-.js";
8
+ import { ChoiceInputInlineContext } from "./choiceInput-BhxWosVq.js";
9
9
  import { a as buildLineLikeAttributes, c as buildDragHandleAttributes } from "./buildGraphicalAttributes-0RNcbd2S.js";
10
10
  import { u as usePointerDragState, a as useBoardPointerTracking } from "./useBoardPointerTracking-DV6a8Wvg.js";
11
11
  import { p as pointerEventToUserCoords } from "./dragThreshold-DuSSFrIU.js";
@@ -1,6 +1,6 @@
1
1
  import React__default from "react";
2
- import { u as useDoenetRenderer } from "./useDoenetRenderer-BDCqlEQN.js";
3
- import { u as useFieldFunction, a as useFieldCurve, c as buildVectorFieldData } from "./useFieldCurve-DH2arzmC.js";
2
+ import { u as useDoenetRenderer } from "./useDoenetRenderer-BAtxQcWU.js";
3
+ import { u as useFieldFunction, a as useFieldCurve, c as buildVectorFieldData } from "./useFieldCurve-DTQt88CG.js";
4
4
  const vectorField = React__default.memo(function VectorField(props) {
5
5
  let { SVs } = useDoenetRenderer(props);
6
6
  VectorField.ignoreActionsWithoutCore = () => true;
@@ -1,10 +1,10 @@
1
- import { G as useRecordVisibilityChanges, q as jsxRuntimeExports } from "./doenetml-C2eD5Aa8.js";
1
+ import { G as useRecordVisibilityChanges, q as jsxRuntimeExports } from "./doenetml-CJXENjwD.js";
2
2
  import React__default, { useState, useEffect, useRef } from "react";
3
- import { u as useDoenetRenderer } from "./useDoenetRenderer-BDCqlEQN.js";
3
+ import { u as useDoenetRenderer } from "./useDoenetRenderer-BAtxQcWU.js";
4
4
  import { s as sizeToCSS } from "./css-BJLDLYRJ.js";
5
- import { D as DescriptionPopover, a as DescriptionAsDetails } from "./Description-QeBEMMoD.js";
5
+ import { D as DescriptionPopover, a as DescriptionAsDetails } from "./Description-BZ8oeOL9.js";
6
6
  import { g as getNonInlineMediaLayoutStyles } from "./nonInlineMediaLayout-CkXHaqzo.js";
7
- import { N as NonInlineMediaWrapper } from "./NonInlineMediaWrapper-DpNtSUi0.js";
7
+ import { N as NonInlineMediaWrapper } from "./NonInlineMediaWrapper-CcmkTJmz.js";
8
8
  const YT_API_SRC = "https://www.youtube.com/iframe_api";
9
9
  const listeners = /* @__PURE__ */ new Set();
10
10
  let installed = false;
@@ -1,114 +0,0 @@
1
- import { x as useAppSelector, y as mainSlice, z as renderersLoadComponent, _ as __variableDynamicImportRuntimeHelper } from "./doenetml-C2eD5Aa8.js";
2
- import React__default, { useState, useEffect } from "react";
3
- function useDoenetRenderer(props, initializeChildrenOnConstruction = true) {
4
- const actions = props.componentInstructions.actions;
5
- const componentIdx = props.componentInstructions.componentIdx;
6
- const effectiveIdx = props.componentInstructions.effectiveIdx;
7
- const id = props.componentInstructions.id;
8
- const rendererName = props.coreId + componentIdx;
9
- const [renderersToLoad, setRenderersToLoad] = useState({});
10
- const componentInfo = useAppSelector(
11
- (state) => mainSlice.selectors.componentInfo(state)[rendererName]
12
- );
13
- const {
14
- stateValues,
15
- sourceOfUpdate = {},
16
- ignoreUpdate,
17
- childrenInstructions,
18
- prefixForIds
19
- } = componentInfo || {
20
- stateValues: {},
21
- sourceOfUpdate: {},
22
- ignoreUpdate: false,
23
- childrenInstructions: [],
24
- prefixForIds: ""
25
- };
26
- let children = [];
27
- const loadMoreRenderers = Object.keys(renderersToLoad).length === 0;
28
- for (let childInstructions of childrenInstructions) {
29
- let child = createChildFromInstructions(
30
- childInstructions,
31
- loadMoreRenderers
32
- );
33
- children.push(child);
34
- }
35
- useEffect(() => {
36
- const entries = Object.entries(renderersToLoad);
37
- if (entries.length > 0) {
38
- const names = entries.map(([name]) => name);
39
- const loaders = entries.map(([, loader]) => loader);
40
- renderersLoadComponent(loaders, names).then(
41
- ({ rendererClasses: newRendererClasses }) => {
42
- Object.assign(props.rendererClasses, newRendererClasses);
43
- setRenderersToLoad({});
44
- }
45
- );
46
- }
47
- }, [renderersToLoad, props.rendererClasses]);
48
- function createChildFromInstructions(childInstructions, loadMoreRenderers2) {
49
- if (typeof childInstructions === "string" || childInstructions === null) {
50
- return childInstructions;
51
- }
52
- let propsForChild = {
53
- key: props.coreId + childInstructions.componentIdx,
54
- componentInstructions: childInstructions,
55
- rendererClasses: props.rendererClasses,
56
- coreId: props.coreId,
57
- docId: props.docId,
58
- activityId: props.activityId,
59
- callAction: props.callAction,
60
- fetchExternalDoenetML: props.fetchExternalDoenetML,
61
- requestScrollTo: props.requestScrollTo,
62
- flags: props.flags
63
- };
64
- let rendererClass = props.rendererClasses[childInstructions.rendererType];
65
- if (!rendererClass) {
66
- if (loadMoreRenderers2) {
67
- setRenderersToLoad((old) => {
68
- let rendererLoaders = { ...old };
69
- if (!(childInstructions.rendererType in rendererLoaders)) {
70
- rendererLoaders[childInstructions.rendererType] = () => __variableDynamicImportRuntimeHelper(/* @__PURE__ */ Object.assign({ "./renderers/GraphFrame.tsx": () => import("./GraphFrame-nDdJjXBL.js"), "./renderers/JSXGraphRenderer.tsx": () => import("./JSXGraphRenderer-BmpW9-68.js").then((n) => n.m), "./renderers/_error.tsx": () => import("./_error-DY03arsc.js"), "./renderers/alert.tsx": () => import("./alert-CE40EAaj.js"), "./renderers/angle.tsx": () => import("./angle-DtgrXh9o.js"), "./renderers/answer.tsx": () => import("./answer-CdNb4LVS.js"), "./renderers/asList.tsx": () => import("./asList-CCgYctAD.js"), "./renderers/blockQuote.tsx": () => import("./blockQuote-dlizkObx.js"), "./renderers/boolean.tsx": () => import("./boolean-DSq-0yl8.js"), "./renderers/booleanInput.tsx": () => import("./booleanInput-C575Iif6.js"), "./renderers/br.tsx": () => import("./br-Hesq9_-1.js"), "./renderers/button.tsx": () => import("./button-DDK1iXXi.js"), "./renderers/c.tsx": () => import("./c-C1ACSsGA.js"), "./renderers/cell.tsx": () => import("./cell-DxZMaDm7.js"), "./renderers/choiceInput.tsx": () => import("./choiceInput-2tvO5zfR.js"), "./renderers/circle.tsx": () => import("./circle-DA5c5bVo.js"), "./renderers/cobwebPolyline.tsx": () => import("./cobwebPolyline-DV8KTcv8.js"), "./renderers/codeEditor.tsx": () => import("./codeEditor-CKFR1ro-.js"), "./renderers/containerBlock.tsx": () => import("./containerBlock-Br4ZG0x8.js"), "./renderers/containerInline.tsx": () => import("./containerInline-BHZMRPq7.js"), "./renderers/curve.tsx": () => import("./curve-CrAuG4JI.js"), "./renderers/ellipsis.tsx": () => import("./ellipsis-BfGCMJxK.js"), "./renderers/em.tsx": () => import("./em-Bv6I9uy0.js"), "./renderers/embed.tsx": () => import("./embed-2WESC8CU.js"), "./renderers/feedback.tsx": () => import("./feedback-BWshcYtw.js"), "./renderers/figure.tsx": () => import("./figure-DEItZJsK.js"), "./renderers/footnote.tsx": () => import("./footnote-DsmeeUYL.js"), "./renderers/fractionInput.tsx": () => import("./fractionInput-Z4Sw5N8M.js"), "./renderers/graph.tsx": () => import("./graph-0O58o0CF.js"), "./renderers/hint.tsx": () => import("./hint-DUlkEqHa.js"), "./renderers/hr.tsx": () => import("./hr-Cvey3Fzn.js"), "./renderers/image.tsx": () => import("./image-tQrtG_58.js"), "./renderers/label.tsx": () => import("./label-DmM5hq0W.js"), "./renderers/legend.tsx": () => import("./legend-nNh5fEen.js"), "./renderers/line.tsx": () => import("./line-CA9CoZCJ.js"), "./renderers/lineSegment.tsx": () => import("./lineSegment-REvQQtno.js"), "./renderers/list.tsx": () => import("./list-BEXAuGpI.js"), "./renderers/lq.tsx": () => import("./lq-CAqSC0MW.js"), "./renderers/lsq.tsx": () => import("./lsq-zMKDcEn8.js"), "./renderers/math.tsx": () => import("./math-CHMRu96_.js"), "./renderers/mathInput.tsx": () => import("./mathInput-3PVX2Q3s.js"), "./renderers/matrixInput.tsx": () => import("./matrixInput-r5mMKRKW.js"), "./renderers/mdash.tsx": () => import("./mdash-D2LFsAY4.js"), "./renderers/nbsp.tsx": () => import("./nbsp-qfLVHKuI.js"), "./renderers/ndash.tsx": () => import("./ndash-Dnop8yIV.js"), "./renderers/number.tsx": () => import("./number-dpL0x8wQ.js"), "./renderers/orbitalDiagram.tsx": () => import("./orbitalDiagram-ooTGY2ll.js"), "./renderers/orbitalDiagramInput.tsx": () => import("./orbitalDiagramInput-DR21JRQP.js"), "./renderers/p.tsx": () => import("./p-CIuOZLUc.js"), "./renderers/paginatorControls.tsx": () => import("./paginatorControls-e4AXAn5h.js"), "./renderers/pegboard.tsx": () => import("./pegboard-A6wSalQ6.js"), "./renderers/point.tsx": () => import("./point-zyUQh1rb.js"), "./renderers/polygon.tsx": () => import("./polygon-DTfuAUCH.js"), "./renderers/polyline.tsx": () => import("./polyline-Bsa2yfUa.js"), "./renderers/pre.tsx": () => import("./pre-C8qDMCqj.js"), "./renderers/prefigure.tsx": () => import("./prefigure-Bn3Llqho.js"), "./renderers/pretzel.tsx": () => import("./pretzel-CiQZK_ZA.js"), "./renderers/q.tsx": () => import("./q-Bk999DnN.js"), "./renderers/ray.tsx": () => import("./ray-D5EDYw_-.js"), "./renderers/ref.tsx": () => import("./ref-CSIt1Z4V.js"), "./renderers/regionBetweenCurveXAxis.tsx": () => import("./regionBetweenCurveXAxis-DyCVBGYD.js"), "./renderers/regionBetweenCurves.tsx": () => import("./regionBetweenCurves-BjWYPoHT.js"), "./renderers/row.tsx": () => import("./row-Q58YymOq.js"), "./renderers/rq.tsx": () => import("./rq-BdAg6eNb.js"), "./renderers/rsq.tsx": () => import("./rsq-DlAB9-MR.js"), "./renderers/section.tsx": () => import("./section-BxTY8cWT.js"), "./renderers/sideBySide.tsx": () => import("./sideBySide-CYj1a3V_.js"), "./renderers/slider.tsx": () => import("./slider-A3VwTdl_.js"), "./renderers/slopeField.tsx": () => import("./slopeField-DjIUlrk2.js"), "./renderers/solution.tsx": () => import("./solution-Clw7Xziy.js"), "./renderers/spreadsheet.tsx": () => import("./spreadsheet-BJxu9g-r.js"), "./renderers/sq.tsx": () => import("./sq-CI2Vsk5j.js"), "./renderers/subsetOfRealsInput.tsx": () => import("./subsetOfRealsInput-laFBI7Xu.js"), "./renderers/summaryStatistics.tsx": () => import("./summaryStatistics-BzwduqVW.js"), "./renderers/table.tsx": () => import("./table-DkgXiBQC.js"), "./renderers/tabular.tsx": () => import("./tabular-5c7W6zVm.js"), "./renderers/tag.tsx": () => import("./tag-DoTKkltJ.js"), "./renderers/text.tsx": () => import("./text-Dax3EX4d.js"), "./renderers/textInput.tsx": () => import("./textInput-Cm0R3eQR.js"), "./renderers/vector.tsx": () => import("./vector-BRr9Zppm.js"), "./renderers/vectorField.tsx": () => import("./vectorField-DQTe6Zcf.js"), "./renderers/video.tsx": () => import("./video-CtMyJEyY.js") }), `./renderers/${childInstructions.rendererType}.tsx`, 3);
71
- }
72
- return rendererLoaders;
73
- });
74
- }
75
- return null;
76
- }
77
- let child = React__default.createElement(rendererClass, propsForChild);
78
- return child;
79
- }
80
- let rendererType = props.componentInstructions.rendererType;
81
- const callAction = (argObj) => {
82
- if (!argObj.componentIdx) {
83
- argObj = { ...argObj };
84
- argObj.componentIdx = componentIdx;
85
- }
86
- if (!argObj.rendererType) {
87
- argObj = { ...argObj };
88
- argObj.rendererType = rendererType;
89
- }
90
- return props.callAction(argObj);
91
- };
92
- return {
93
- componentIdx: effectiveIdx,
94
- id: prefixForIds + id,
95
- SVs: stateValues,
96
- docId: props.docId,
97
- activityId: props.activityId,
98
- actions,
99
- children,
100
- sourceOfUpdate,
101
- ignoreUpdate,
102
- rendererName,
103
- initializeChildren: () => {
104
- },
105
- callAction,
106
- doenetViewerUrl: props.doenetViewerUrl,
107
- fetchExternalDoenetML: props.fetchExternalDoenetML,
108
- requestScrollTo: props.requestScrollTo,
109
- flags: props.flags
110
- };
111
- }
112
- export {
113
- useDoenetRenderer as u
114
- };