@celljs/ta-plot 4.27.0 → 4.29.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.
@@ -118,7 +118,7 @@ var PLOT_PROMPT = `To show the user a function or a curve (a parabola, a hyperbo
118
118
  A param may instead be a slider the user drags, {"c": {"value": 1, "min": -2, "max": 3, "step"?: 0.1, "label"?: string}}, also dragged by moving across the plot; give one whenever the user wants to see how a param changes a curve. A curve with "family": "c" (or {"param": "c", "count": 11}) also draws itself faintly for evenly spaced values of the slider c, the current one bold: a family of curves; add its envelope as a dashed curve when there is one.
119
119
  A curve is {"y": "a*x^2"} (y of x, over the x range) or {"x": "a*cosh(s)", "y": "b*sinh(s)", "s": [-2, 2]} (parametric, s over its range), with "label"?, "dash"?: true (asymptotes, axes of symmetry, guides) and "color"? (a CSS color).
120
120
  In space: "surfaces": [{"z": "sin(x)*cos(y)", "label"?, "color"?}] (z of x and y, over the x and y ranges, colored by height without a color), a curve with "z" too ({"x": "cos(s)", "y": "sin(s)", "z": "s/4", "s": [0, 12]}) and points with "z"; an optional "z": [min, max]. Ta draws it in 3D, turning slowly, the user turns it by dragging; params, sliders and t work the same.
121
- Expressions: numbers, + - * / ^ %, parentheses, x, y (of a surface), s, t (seconds since shown: a param or curve that uses it moves), the params (a param may use the sliders and the params before it), and sin cos tan asin acos atan atan2 sinh cosh tanh asinh acosh atanh sqrt cbrt abs exp log log2 log10 pow min max floor ceil round sign hypot pi e. Curves draw in when shown; dot puts a point running along the solid curves. Point coordinates may be expressions too. Labels and title in the user's language, short.`;
121
+ Expressions: numbers, + - * / ^ %, parentheses, x, y (of a surface), s, t (seconds since shown: a param or curve that uses it moves), the params (a param may use the sliders and the params before it), and sin cos tan asin acos atan atan2 sinh cosh tanh asinh acosh atanh sqrt cbrt abs exp log log2 log10 pow min max floor ceil round sign hypot pi e. Curves draw in when shown; dot puts a point running along the solid curves. Point coordinates may be expressions too. Labels and title in the user's language, short. A figure a card refers to (the figure of a question of a quiz, a block of a card that takes one) goes in its "figure" as {"ta-plot": the JSON}, drawn inside the card, never as a block beside it.`;
122
122
 
123
123
  // web-src/extension.ts
124
124
  function activate(pi) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@celljs/ta-plot",
3
- "version": "4.27.0",
3
+ "version": "4.29.0",
4
4
  "description": "A pi package for Ta: functions and curves of replies drawn as animated plots, with params to drag",
5
5
  "keywords": [
6
6
  "pi-package"
@@ -26,8 +26,8 @@
26
26
  "watch": "tsc -b -w --preserveWatchOutput"
27
27
  },
28
28
  "devDependencies": {
29
- "@celljs/ta-protocol": "4.27.0",
30
- "@celljs/ta-web": "4.27.0",
29
+ "@celljs/ta-protocol": "4.29.0",
30
+ "@celljs/ta-web": "4.29.0",
31
31
  "@types/react": "^19.3.0"
32
32
  },
33
33
  "publishConfig": {
package/web/index.js CHANGED
@@ -436,9 +436,9 @@ class PlotPainter {
436
436
  return;
437
437
  }
438
438
  const eased = 1 - (1 - shown) ** 3;
439
- if (curve.family) {
439
+ const slider = curve.family && plot.params[curve.family.index].slider;
440
+ if (curve.family && slider) {
440
441
  const { index: param, count } = curve.family;
441
- const slider = plot.params[param].slider;
442
442
  for (let k = 0;k < count; k++) {
443
443
  const others = sliders.slice();
444
444
  others[param] = slider.min + (slider.max - slider.min) * k / (count - 1);
@@ -1169,7 +1169,10 @@ function plotView(pi) {
1169
1169
  "data-space": plot.space || undefined
1170
1170
  }, plot.title ? /* @__PURE__ */ React.createElement("div", {
1171
1171
  className: "tpl-title"
1172
- }, plot.title) : null, plot.space ? /* @__PURE__ */ React.createElement(Space, {
1172
+ }, /* @__PURE__ */ React.createElement(Markdown, {
1173
+ inline: true,
1174
+ text: plot.title
1175
+ })) : null, plot.space ? /* @__PURE__ */ React.createElement(Space, {
1173
1176
  plot,
1174
1177
  input
1175
1178
  }) : /* @__PURE__ */ React.createElement(Canvas, {
@@ -1274,6 +1277,8 @@ var STYLE = `
1274
1277
  font-size: calc(13px * var(--tpl-s));
1275
1278
  line-height: 1.5;
1276
1279
  }
1280
+ /* Inside the card of another block (a figure of a question): the card around it is the frame. */
1281
+ .ta-code-embedded > .tpl-card { margin: 0; padding: 0; max-width: none; border: 0; background: none; }
1277
1282
  .tpl-title { font-weight: 600; margin-bottom: 8px; }
1278
1283
  .tpl-canvas { display: block; width: 100%; }
1279
1284
  .tpl-canvas[data-drag] { cursor: ew-resize; touch-action: pan-y; }