figureone 1.4.0 → 1.4.1

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/index.js CHANGED
@@ -17227,7 +17227,7 @@ function offsetLocationForGlyphs(glyphs, offset) {
17227
17227
  var BaseAnnotationFunction = /*#__PURE__*/function () {
17228
17228
  // Optional caller-supplied identifier, assigned post-dispatch by
17229
17229
  // EquationFunctions.eqnMethod. Has no layout effect; used by
17230
- // Equation.getElementsInForm to look up the contents of a sub-tree.
17230
+ // Equation.getFunctionElements to look up the contents of a sub-tree.
17231
17231
 
17232
17232
  function BaseAnnotationFunction(content, annotations, glyphs, options) {
17233
17233
  var showContent = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : true;
@@ -17877,7 +17877,7 @@ function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf
17877
17877
  var BaseEquationFunction = /*#__PURE__*/function (_Elements) {
17878
17878
  // Optional caller-supplied identifier, assigned post-dispatch by
17879
17879
  // EquationFunctions.eqnMethod. Has no layout effect; used by
17880
- // Equation.getElementsInForm to look up the contents of a sub-tree.
17880
+ // Equation.getFunctionElements to look up the contents of a sub-tree.
17881
17881
 
17882
17882
  function BaseEquationFunction(content, glyph, options) {
17883
17883
  var _this;
@@ -21282,34 +21282,37 @@ var Equation = /*#__PURE__*/function (_FigureElementCollect) {
21282
21282
  }
21283
21283
 
21284
21284
  /**
21285
- * Return all the elements inside the named equation function within a given
21286
- * form.
21285
+ * Return all the elements inside the named equation function within a form.
21287
21286
  *
21288
21287
  * Any equation function (container, fraction, matrix, etc.) can be tagged
21289
21288
  * with a `name` property in its options — this has no layout effect, but
21290
21289
  * makes the function's sub-tree addressable here.
21291
21290
  *
21292
- * With `mode: 'first'` (default), returns the elements inside the first
21293
- * matching function found by a depth-first traversal. With `mode: 'all'`,
21294
- * walks the entire tree, collects every matching function (including those
21295
- * nested inside other matches), and returns the de-duplicated union of
21296
- * their elements.
21291
+ * With `mode: 'all'` (default), walks the entire tree, collects every
21292
+ * matching function (including those nested inside other matches), and
21293
+ * returns the de-duplicated union of their elements. With `mode: 'first'`,
21294
+ * returns only the elements inside the first matching function found by a
21295
+ * depth-first traversal.
21296
+ *
21297
+ * If `formName` is `null` (default), the current form is used.
21297
21298
  *
21298
21299
  * Returns an empty array if the form does not exist, or no matching
21299
21300
  * function is found.
21300
21301
  *
21301
- * @param {string} formName
21302
21302
  * @param {string} name
21303
- * @param {'first' | 'all'} [mode] (`'first'`)
21303
+ * @param {string | null} [formName] (`null` — uses current form)
21304
+ * @param {'first' | 'all'} [mode] (`'all'`)
21304
21305
  * @param {boolean} [includeHidden] (`false`)
21305
21306
  * @return {Array<FigureElement>}
21306
21307
  */
21307
21308
  }, {
21308
- key: "getElementsInForm",
21309
- value: function getElementsInForm(formName, name) {
21310
- var mode = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'first';
21309
+ key: "getFunctionElements",
21310
+ value: function getFunctionElements(name) {
21311
+ var formName = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
21312
+ var mode = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'all';
21311
21313
  var includeHidden = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
21312
- var form = this.eqn.forms[formName];
21314
+ var resolvedFormName = formName == null ? this.eqn.currentForm : formName;
21315
+ var form = this.eqn.forms[resolvedFormName];
21313
21316
  if (form == null) {
21314
21317
  return [];
21315
21318
  }
@@ -22990,7 +22993,7 @@ function getFigureElement(elementsObject, name) {
22990
22993
  * around the content, but the content will not be shown (`true`)
22991
22994
  * @property {string} [name] - optional identifier (available on every equation
22992
22995
  * function). Has no effect on layout, but allows the function's contents to be
22993
- * looked up later with {@link Equation.getElementsInForm} (`null`)
22996
+ * looked up later with {@link Equation.getFunctionElements} (`null`)
22994
22997
  *
22995
22998
  * @see To test examples, append them to the
22996
22999
  * <a href="#drawing-boilerplate">boilerplate</a>
@@ -25630,7 +25633,7 @@ var EquationFunctions = /*#__PURE__*/function () {
25630
25633
  var result = this.dispatchEqnMethod(name, params);
25631
25634
  // Allow any equation function to be tagged with a caller-supplied
25632
25635
  // `name` via its options object. The tag has no layout effect; it's
25633
- // used by Equation.getElementsInForm to look up the function's sub-tree.
25636
+ // used by Equation.getFunctionElements to look up the function's sub-tree.
25634
25637
  if (result != null && params != null && !Array.isArray(params) && _typeof(params) === 'object' && params.name != null && (result instanceof _Elements_BaseEquationFunction__WEBPACK_IMPORTED_MODULE_10__["default"] || result instanceof _Elements_BaseAnnotationFunction__WEBPACK_IMPORTED_MODULE_9__["default"])) {
25635
25638
  result.functionName = params.name;
25636
25639
  }
@@ -80792,8 +80795,8 @@ var tools = {
80792
80795
  */
80793
80796
 
80794
80797
  var Fig = {
80795
- version: "1.4.0",
80796
- gitHash: "77f124c53",
80798
+ version: "1.4.1",
80799
+ gitHash: "2fa15b061",
80797
80800
  tools: tools,
80798
80801
  Figure: _js_figure_Figure__WEBPACK_IMPORTED_MODULE_5__["default"],
80799
80802
  Recorder: _js_figure_Recorder_Recorder__WEBPACK_IMPORTED_MODULE_7__.Recorder,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "figureone",
3
- "version": "1.4.0",
3
+ "version": "1.4.1",
4
4
  "description": "Draw, animate and interact with shapes, text, plots and equations in Javascript. Create interactive slide shows, and interactive videos.",
5
5
  "main": "index.js",
6
6
  "types": "types/index.d.ts",
@@ -907,29 +907,30 @@ export declare class Equation extends FigureElementCollection {
907
907
  */
908
908
  getFormElements(form: string, includeHidden?: boolean): (FigureElementCollection | FigureElementPrimitive | ElementInterface)[];
909
909
  /**
910
- * Return all the elements inside the named equation function within a given
911
- * form.
910
+ * Return all the elements inside the named equation function within a form.
912
911
  *
913
912
  * Any equation function (container, fraction, matrix, etc.) can be tagged
914
913
  * with a `name` property in its options — this has no layout effect, but
915
914
  * makes the function's sub-tree addressable here.
916
915
  *
917
- * With `mode: 'first'` (default), returns the elements inside the first
918
- * matching function found by a depth-first traversal. With `mode: 'all'`,
919
- * walks the entire tree, collects every matching function (including those
920
- * nested inside other matches), and returns the de-duplicated union of
921
- * their elements.
916
+ * With `mode: 'all'` (default), walks the entire tree, collects every
917
+ * matching function (including those nested inside other matches), and
918
+ * returns the de-duplicated union of their elements. With `mode: 'first'`,
919
+ * returns only the elements inside the first matching function found by a
920
+ * depth-first traversal.
921
+ *
922
+ * If `formName` is `null` (default), the current form is used.
922
923
  *
923
924
  * Returns an empty array if the form does not exist, or no matching
924
925
  * function is found.
925
926
  *
926
- * @param {string} formName
927
927
  * @param {string} name
928
- * @param {'first' | 'all'} [mode] (`'first'`)
928
+ * @param {string | null} [formName] (`null` — uses current form)
929
+ * @param {'first' | 'all'} [mode] (`'all'`)
929
930
  * @param {boolean} [includeHidden] (`false`)
930
931
  * @return {Array<FigureElement>}
931
932
  */
932
- getElementsInForm(formName: string, name: string, mode?: 'first' | 'all', includeHidden?: boolean): any[];
933
+ getFunctionElements(name: string, formName?: string | null, mode?: 'first' | 'all', includeHidden?: boolean): any[];
933
934
  /**
934
935
  * Return all the elements that are used in an equation phrase.
935
936
  * @param {TypeEquationPhrase} phrase
@@ -172,7 +172,7 @@ export type TypeEquationPhrase = string | number | {
172
172
  * around the content, but the content will not be shown (`true`)
173
173
  * @property {string} [name] - optional identifier (available on every equation
174
174
  * function). Has no effect on layout, but allows the function's contents to be
175
- * looked up later with {@link Equation.getElementsInForm} (`null`)
175
+ * looked up later with {@link Equation.getFunctionElements} (`null`)
176
176
  *
177
177
  * @see To test examples, append them to the
178
178
  * <a href="#drawing-boilerplate">boilerplate</a>