@gmb/bitmark-parser-generator 4.9.0 → 4.11.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.
package/dist/index.js CHANGED
@@ -34,6 +34,7 @@ var BitType = superenum({
34
34
  appAiPrompt: "app-ai-prompt",
35
35
  appBitmarkFromEditor: "app-bitmark-from-editor",
36
36
  appBitmarkFromJavascript: "app-bitmark-from-javascript",
37
+ appCalculatorLatex: "app-calculator-latex",
37
38
  appCodeCell: "app-code-cell",
38
39
  appCodeEditor: "app-code-editor",
39
40
  appCodeIde: "app-code-ide",
@@ -453,6 +454,10 @@ var BitType = superenum({
453
454
  reviewRequestForReviewNote: "review-request-for-review-note",
454
455
  reviewReviewerNote: "review-reviewer-note",
455
456
  sampleSolution: "sample-solution",
457
+ sandbox: "sandbox",
458
+ sandboxOutputJson: "sandbox-output-json",
459
+ sandboxOutputMarkup: "sandbox-output-markup",
460
+ sandboxOutputRender: "sandbox-output-render",
456
461
  scorm: "scorm",
457
462
  screenshot: "screenshot",
458
463
  selfAssessment: "self-assessment",
@@ -1154,6 +1159,7 @@ var propertyKeys = {
1154
1159
  property_focusX: "@focusX",
1155
1160
  property_focusY: "@focusY",
1156
1161
  property_format: "@format",
1162
+ property_formula: "@formula",
1157
1163
  property_fullName: "@fullName",
1158
1164
  property_groupTag: "@groupTag",
1159
1165
  property_handInAcceptFileType: "@handInAcceptFileType",
@@ -1257,6 +1263,7 @@ var propertyKeys = {
1257
1263
  property_siteName: "@siteName",
1258
1264
  property_size: "@size",
1259
1265
  property_slug: "@slug",
1266
+ property_sourceDocument: "@sourceDocument",
1260
1267
  property_spaceId: "@spaceId",
1261
1268
  property_src1x: "@src1x",
1262
1269
  property_src2x: "@src2x",
@@ -2809,7 +2816,7 @@ var GROUPS = {
2809
2816
  },
2810
2817
  [ConfigKey.group_standardItemLeadInstructionHint]: {
2811
2818
  type: GroupConfigType.standard,
2812
- description: "Standard group for item, lead, page number, margin number, instruction and hint tags",
2819
+ description: "Standard group for item, lead, page number, source page number, margin number, instruction and hint tags",
2813
2820
  tags: [
2814
2821
  {
2815
2822
  key: ConfigKey.tag_item,
@@ -2817,8 +2824,8 @@ var GROUPS = {
2817
2824
  chain: [
2818
2825
  {
2819
2826
  key: ConfigKey.tag_item,
2820
- description: "The lead, page number, and margin number for the bit",
2821
- maxCount: 3
2827
+ description: "The lead, page number, source page number, and margin number for the bit",
2828
+ maxCount: 4
2822
2829
  }
2823
2830
  ]
2824
2831
  },
@@ -3213,6 +3220,11 @@ var GROUPS = {
3213
3220
  key: ConfigKey.property_maxTocChapterLevel,
3214
3221
  description: "The maximum table of contents chapter level",
3215
3222
  format: TagFormat.number
3223
+ },
3224
+ {
3225
+ key: ConfigKey.property_sourceDocument,
3226
+ description: "Url of the source document for the book (for example, a PDF file)",
3227
+ format: TagFormat.plainText
3216
3228
  }
3217
3229
  ]
3218
3230
  },
@@ -5078,6 +5090,26 @@ var BITS = {
5078
5090
  baseBitType: BitType.code,
5079
5091
  description: "Standard output bit, used to display standard output from code snippets"
5080
5092
  },
5093
+ [BitType.sandbox]: {
5094
+ since: "4.10.0",
5095
+ baseBitType: BitType.code,
5096
+ description: "A sandbox bit, used to create a sandboxed environment for code execution"
5097
+ },
5098
+ [BitType.sandboxOutputJson]: {
5099
+ since: "4.10.0",
5100
+ baseBitType: BitType.code,
5101
+ description: "A sandbox output JSON bit, used to display JSON output from sandboxed code"
5102
+ },
5103
+ [BitType.sandboxOutputMarkup]: {
5104
+ since: "4.10.0",
5105
+ baseBitType: BitType.code,
5106
+ description: "A sandbox output markup bit, used to display markup output from sandboxed code"
5107
+ },
5108
+ [BitType.sandboxOutputRender]: {
5109
+ since: "4.10.0",
5110
+ baseBitType: BitType.code,
5111
+ description: "A sandbox output render bit, used to display rendered output from sandboxed code"
5112
+ },
5081
5113
  [BitType.step]: {
5082
5114
  since: "1.5.1",
5083
5115
  baseBitType: BitType.article,
@@ -6073,6 +6105,18 @@ var BITS = {
6073
6105
  }
6074
6106
  ]
6075
6107
  },
6108
+ [BitType.appCalculatorLatex]: {
6109
+ since: "4.10.0",
6110
+ baseBitType: BitType.article,
6111
+ description: "A LaTeX calculator bit, used to create a calculator that can interpret LaTeX expressions",
6112
+ tags: [
6113
+ {
6114
+ key: ConfigKey.property_formula,
6115
+ description: "The LaTeX formula for the calculator, used to define the calculation logic",
6116
+ format: TagFormat.plainText
6117
+ }
6118
+ ]
6119
+ },
6076
6120
  [BitType.container]: {
6077
6121
  since: "1.9.0",
6078
6122
  baseBitType: BitType.article,
@@ -9088,7 +9132,7 @@ var instance2 = new Config();
9088
9132
  // src/generated/package_info.ts
9089
9133
  var PACKAGE_INFO = {
9090
9134
  "name": "@gmb/bitmark-parser-generator",
9091
- "version": "4.9.0",
9135
+ "version": "4.11.0",
9092
9136
  "author": "Get More Brain Ltd",
9093
9137
  "license": "ISC",
9094
9138
  "description": "A bitmark parser and generator using Peggy.js"
@@ -9496,8 +9540,6 @@ var NodeType = superenum20({
9496
9540
  botValue: "botValue",
9497
9541
  bubbleTag: "bubbleTag",
9498
9542
  bubbleTagValue: "bubbleTagValue",
9499
- extractorTag: "extractorTag",
9500
- extractorTagValue: "extractorTagValue",
9501
9543
  buttonCaption: "buttonCaption",
9502
9544
  buttonCaptionValue: "buttonCaptionValue",
9503
9545
  callToActionUrl: "callToActionUrl",
@@ -9595,6 +9637,8 @@ var NodeType = superenum20({
9595
9637
  externalIdValue: "externalIdValue",
9596
9638
  externalLink: "externalLink",
9597
9639
  externalLinkText: "externalLinkText",
9640
+ extractorTag: "extractorTag",
9641
+ extractorTagValue: "extractorTagValue",
9598
9642
  extraProperties: "extraProperties",
9599
9643
  feedback: "feedback",
9600
9644
  feedbackEngine: "feedbackEngine",
@@ -9614,6 +9658,8 @@ var NodeType = superenum20({
9614
9658
  footerText: "footerText",
9615
9659
  forKeys: "forKeys",
9616
9660
  format: "format",
9661
+ formula: "formula",
9662
+ formulaValue: "formulaValue",
9617
9663
  forValues: "forValues",
9618
9664
  forValuesValue: "forValuesValue",
9619
9665
  fullName: "fullName",
@@ -9877,15 +9923,18 @@ var NodeType = superenum20({
9877
9923
  solution: "solution",
9878
9924
  solutions: "solutions",
9879
9925
  solutionsValue: "solutionsValue",
9926
+ sourceDocument: "sourceDocument",
9927
+ sourceDocumentValue: "sourceDocumentValue",
9928
+ sourcePageNumber: "sourcePageNumber",
9880
9929
  spaceId: "spaceId",
9881
9930
  spaceIdValue: "spaceIdValue",
9882
9931
  src: "src",
9883
- srcAlt: "srcAlt",
9884
- srcAltValue: "srcAltValue",
9885
9932
  src1x: "src1x",
9886
9933
  src2x: "src2x",
9887
9934
  src3x: "src3x",
9888
9935
  src4x: "src4x",
9936
+ srcAlt: "srcAlt",
9937
+ srcAltValue: "srcAltValue",
9889
9938
  start: "start",
9890
9939
  statement: "statement",
9891
9940
  statements: "statements",
@@ -22885,6 +22934,12 @@ var Builder = class extends BaseBuilder {
22885
22934
  data.maxTocChapterLevel,
22886
22935
  options
22887
22936
  ),
22937
+ sourceDocument: this.toAstProperty(
22938
+ bitType,
22939
+ ConfigKey.property_sourceDocument,
22940
+ data.sourceDocument,
22941
+ options
22942
+ ),
22888
22943
  tocResource: this.toAstProperty(
22889
22944
  bitType,
22890
22945
  ConfigKey.property_tocResource,
@@ -22934,6 +22989,7 @@ var Builder = class extends BaseBuilder {
22934
22989
  data.ratingLevelSelected,
22935
22990
  options
22936
22991
  ),
22992
+ formula: this.toAstProperty(bitType, ConfigKey.property_formula, data.formula, options),
22937
22993
  markConfig: this.buildMarkConfigs(context, data.markConfig),
22938
22994
  imageSource: this.buildImageSource(context, data.imageSource),
22939
22995
  person: this.buildPerson(context, data.person),
@@ -22968,6 +23024,7 @@ var Builder = class extends BaseBuilder {
22968
23024
  item: this.handleJsonText(context, TextLocation.tag, data.item),
22969
23025
  lead: this.handleJsonText(context, TextLocation.tag, data.lead),
22970
23026
  pageNumber: this.handleJsonText(context, TextLocation.tag, data.pageNumber),
23027
+ sourcePageNumber: this.handleJsonText(context, TextLocation.tag, data.sourcePageNumber),
22971
23028
  marginNumber: this.handleJsonText(context, TextLocation.tag, data.marginNumber),
22972
23029
  hint: this.handleJsonText(context, TextLocation.tag, data.hint),
22973
23030
  instruction: this.handleJsonText(context, TextLocation.tag, data.instruction),
@@ -23070,7 +23127,15 @@ var Builder = class extends BaseBuilder {
23070
23127
  objectUtils.removeUnwantedProperties(node, {
23071
23128
  ignoreAllFalse: true,
23072
23129
  ignoreUndefined: ["example"],
23073
- ignoreEmptyArrays: ["item", "lead", "pageNumber", "marginNumber", "hint", "instruction"]
23130
+ ignoreEmptyArrays: [
23131
+ "item",
23132
+ "lead",
23133
+ "pageNumber",
23134
+ "sourcePageNumber",
23135
+ "marginNumber",
23136
+ "hint",
23137
+ "instruction"
23138
+ ]
23074
23139
  });
23075
23140
  return nodeValidator.validateBit(node);
23076
23141
  }
@@ -25383,6 +25448,7 @@ var BitmarkGenerator = class extends AstWalkerGenerator {
25383
25448
  if (this.isEmptyText(item)) return false;
25384
25449
  if (!this.isEmptyText(parent?.value?.lead)) return true;
25385
25450
  if (!this.isEmptyText(parent?.value?.pageNumber)) return true;
25451
+ if (!this.isEmptyText(parent?.value?.sourcePageNumber)) return true;
25386
25452
  if (!this.isEmptyText(parent?.value?.marginNumber)) return true;
25387
25453
  this.writeNL_IfNotChain(route);
25388
25454
  this.writeOPC();
@@ -25396,6 +25462,7 @@ var BitmarkGenerator = class extends AstWalkerGenerator {
25396
25462
  const parent = this.getParentNode(route);
25397
25463
  if (this.isEmptyText(lead)) return false;
25398
25464
  if (!this.isEmptyText(parent?.value?.pageNumber)) return true;
25465
+ if (!this.isEmptyText(parent?.value?.sourcePageNumber)) return true;
25399
25466
  if (!this.isEmptyText(parent?.value?.marginNumber)) return true;
25400
25467
  this.writeNL_IfNotChain(route);
25401
25468
  this.writeOPC();
@@ -25411,6 +25478,7 @@ var BitmarkGenerator = class extends AstWalkerGenerator {
25411
25478
  const pageNumber = node.value;
25412
25479
  const parent = this.getParentNode(route);
25413
25480
  if (this.isEmptyText(pageNumber)) return false;
25481
+ if (!this.isEmptyText(parent?.value?.sourcePageNumber)) return true;
25414
25482
  if (!this.isEmptyText(parent?.value?.marginNumber)) return true;
25415
25483
  this.writeNL_IfNotChain(route);
25416
25484
  this.writeOPC();
@@ -25424,6 +25492,31 @@ var BitmarkGenerator = class extends AstWalkerGenerator {
25424
25492
  this.writeCL();
25425
25493
  return true;
25426
25494
  }
25495
+ // bitmarkAst -> bits -> bitsValue -> sourcePageNumber
25496
+ enter_sourcePageNumber(node, route) {
25497
+ const sourcePageNumber = node.value;
25498
+ const parent = this.getParentNode(route);
25499
+ if (this.isEmptyText(sourcePageNumber)) return false;
25500
+ if (!this.isEmptyText(parent?.value?.marginNumber)) return true;
25501
+ this.writeNL_IfNotChain(route);
25502
+ this.writeOPC();
25503
+ this.writeTextOrValue(parent?.value?.item ?? "", TextFormat.bitmarkText, TextLocation.tag);
25504
+ this.writeCL();
25505
+ this.writeOPC();
25506
+ this.writeTextOrValue(parent?.value?.lead ?? "", TextFormat.bitmarkText, TextLocation.tag);
25507
+ this.writeCL();
25508
+ this.writeOPC();
25509
+ this.writeTextOrValue(
25510
+ parent?.value?.pageNumber ?? "",
25511
+ TextFormat.bitmarkText,
25512
+ TextLocation.tag
25513
+ );
25514
+ this.writeCL();
25515
+ this.writeOPC();
25516
+ this.writeTextOrValue(sourcePageNumber ?? "", TextFormat.bitmarkText, TextLocation.tag);
25517
+ this.writeCL();
25518
+ return true;
25519
+ }
25427
25520
  // bitmarkAst -> bits -> bitsValue -> marginNumber
25428
25521
  enter_marginNumber(node, route) {
25429
25522
  const marginNumber = node.value;
@@ -25444,6 +25537,13 @@ var BitmarkGenerator = class extends AstWalkerGenerator {
25444
25537
  );
25445
25538
  this.writeCL();
25446
25539
  this.writeOPC();
25540
+ this.writeTextOrValue(
25541
+ parent?.value?.sourcePageNumber ?? "",
25542
+ TextFormat.bitmarkText,
25543
+ TextLocation.tag
25544
+ );
25545
+ this.writeCL();
25546
+ this.writeOPC();
25447
25547
  this.writeTextOrValue(marginNumber, TextFormat.bitmarkText, TextLocation.tag);
25448
25548
  this.writeCL();
25449
25549
  return true;
@@ -27268,6 +27368,10 @@ var JsonGenerator = class extends AstWalkerGenerator {
27268
27368
  enter_pageNumber(node, route) {
27269
27369
  return this.standardHandler(node, route, NodeType.bitsValue, { array: true });
27270
27370
  }
27371
+ // bitmarkAst -> bits -> bitsValue -> sourcePageNumber
27372
+ enter_sourcePageNumber(node, route) {
27373
+ return this.standardHandler(node, route, NodeType.bitsValue, { array: true });
27374
+ }
27271
27375
  // bitmarkAst -> bits -> bitsValue -> marginNumber
27272
27376
  enter_marginNumber(node, route) {
27273
27377
  return this.standardHandler(node, route, NodeType.bitsValue, { array: true });
@@ -27990,6 +28094,7 @@ var JsonGenerator = class extends AstWalkerGenerator {
27990
28094
  delete bitJson.item;
27991
28095
  delete bitJson.lead;
27992
28096
  delete bitJson.pageNumber;
28097
+ delete bitJson.sourcePageNumber;
27993
28098
  delete bitJson.marginNumber;
27994
28099
  delete bitJson.hint;
27995
28100
  delete bitJson.instruction;
@@ -28001,6 +28106,8 @@ var JsonGenerator = class extends AstWalkerGenerator {
28001
28106
  if (bitJson.lead == null || bitJson.lead?.length === 0) delete bitJson.lead;
28002
28107
  if (bitJson.pageNumber == null || bitJson.pageNumber?.length === 0)
28003
28108
  delete bitJson.pageNumber;
28109
+ if (bitJson.sourcePageNumber == null || bitJson.sourcePageNumber?.length === 0)
28110
+ delete bitJson.sourcePageNumber;
28004
28111
  if (bitJson.marginNumber == null || bitJson.marginNumber?.length === 0)
28005
28112
  delete bitJson.marginNumber;
28006
28113
  if (bitJson.hint == null || bitJson.hint?.length === 0) delete bitJson.hint;
@@ -28012,6 +28119,7 @@ var JsonGenerator = class extends AstWalkerGenerator {
28012
28119
  if (bitJson.hint == null) bitJson.hint = this.textDefault;
28013
28120
  if (bitJson.instruction == null) bitJson.instruction = this.textDefault;
28014
28121
  if (bitJson.pageNumber == null) bitJson.pageNumber = this.textDefault;
28122
+ if (bitJson.sourcePageNumber == null) bitJson.sourcePageNumber = this.textDefault;
28015
28123
  if (bitJson.marginNumber == null) bitJson.marginNumber = this.textDefault;
28016
28124
  }
28017
28125
  if (bitJson.body == null) bitJson.body = this.bodyDefault;
@@ -32473,7 +32581,8 @@ var BitmarkPegParserProcessor = class {
32473
32581
  if (l > 0) result.item = result.itemLead[0];
32474
32582
  if (l > 1) result.lead = result.itemLead[1];
32475
32583
  if (l > 2) result.pageNumber = result.itemLead[2];
32476
- if (l > 3) result.marginNumber = result.itemLead[l - 1];
32584
+ if (l > 3) result.sourcePageNumber = result.itemLead[3];
32585
+ if (l > 4) result.marginNumber = result.itemLead[l - 1];
32477
32586
  }
32478
32587
  if (inBit) {
32479
32588
  result.body = instance11.process(