@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.cjs CHANGED
@@ -93,6 +93,7 @@ var BitType = (0, import_superenum.superenum)({
93
93
  appAiPrompt: "app-ai-prompt",
94
94
  appBitmarkFromEditor: "app-bitmark-from-editor",
95
95
  appBitmarkFromJavascript: "app-bitmark-from-javascript",
96
+ appCalculatorLatex: "app-calculator-latex",
96
97
  appCodeCell: "app-code-cell",
97
98
  appCodeEditor: "app-code-editor",
98
99
  appCodeIde: "app-code-ide",
@@ -512,6 +513,10 @@ var BitType = (0, import_superenum.superenum)({
512
513
  reviewRequestForReviewNote: "review-request-for-review-note",
513
514
  reviewReviewerNote: "review-reviewer-note",
514
515
  sampleSolution: "sample-solution",
516
+ sandbox: "sandbox",
517
+ sandboxOutputJson: "sandbox-output-json",
518
+ sandboxOutputMarkup: "sandbox-output-markup",
519
+ sandboxOutputRender: "sandbox-output-render",
515
520
  scorm: "scorm",
516
521
  screenshot: "screenshot",
517
522
  selfAssessment: "self-assessment",
@@ -1213,6 +1218,7 @@ var propertyKeys = {
1213
1218
  property_focusX: "@focusX",
1214
1219
  property_focusY: "@focusY",
1215
1220
  property_format: "@format",
1221
+ property_formula: "@formula",
1216
1222
  property_fullName: "@fullName",
1217
1223
  property_groupTag: "@groupTag",
1218
1224
  property_handInAcceptFileType: "@handInAcceptFileType",
@@ -1316,6 +1322,7 @@ var propertyKeys = {
1316
1322
  property_siteName: "@siteName",
1317
1323
  property_size: "@size",
1318
1324
  property_slug: "@slug",
1325
+ property_sourceDocument: "@sourceDocument",
1319
1326
  property_spaceId: "@spaceId",
1320
1327
  property_src1x: "@src1x",
1321
1328
  property_src2x: "@src2x",
@@ -2868,7 +2875,7 @@ var GROUPS = {
2868
2875
  },
2869
2876
  [ConfigKey.group_standardItemLeadInstructionHint]: {
2870
2877
  type: GroupConfigType.standard,
2871
- description: "Standard group for item, lead, page number, margin number, instruction and hint tags",
2878
+ description: "Standard group for item, lead, page number, source page number, margin number, instruction and hint tags",
2872
2879
  tags: [
2873
2880
  {
2874
2881
  key: ConfigKey.tag_item,
@@ -2876,8 +2883,8 @@ var GROUPS = {
2876
2883
  chain: [
2877
2884
  {
2878
2885
  key: ConfigKey.tag_item,
2879
- description: "The lead, page number, and margin number for the bit",
2880
- maxCount: 3
2886
+ description: "The lead, page number, source page number, and margin number for the bit",
2887
+ maxCount: 4
2881
2888
  }
2882
2889
  ]
2883
2890
  },
@@ -3272,6 +3279,11 @@ var GROUPS = {
3272
3279
  key: ConfigKey.property_maxTocChapterLevel,
3273
3280
  description: "The maximum table of contents chapter level",
3274
3281
  format: TagFormat.number
3282
+ },
3283
+ {
3284
+ key: ConfigKey.property_sourceDocument,
3285
+ description: "Url of the source document for the book (for example, a PDF file)",
3286
+ format: TagFormat.plainText
3275
3287
  }
3276
3288
  ]
3277
3289
  },
@@ -5137,6 +5149,26 @@ var BITS = {
5137
5149
  baseBitType: BitType.code,
5138
5150
  description: "Standard output bit, used to display standard output from code snippets"
5139
5151
  },
5152
+ [BitType.sandbox]: {
5153
+ since: "4.10.0",
5154
+ baseBitType: BitType.code,
5155
+ description: "A sandbox bit, used to create a sandboxed environment for code execution"
5156
+ },
5157
+ [BitType.sandboxOutputJson]: {
5158
+ since: "4.10.0",
5159
+ baseBitType: BitType.code,
5160
+ description: "A sandbox output JSON bit, used to display JSON output from sandboxed code"
5161
+ },
5162
+ [BitType.sandboxOutputMarkup]: {
5163
+ since: "4.10.0",
5164
+ baseBitType: BitType.code,
5165
+ description: "A sandbox output markup bit, used to display markup output from sandboxed code"
5166
+ },
5167
+ [BitType.sandboxOutputRender]: {
5168
+ since: "4.10.0",
5169
+ baseBitType: BitType.code,
5170
+ description: "A sandbox output render bit, used to display rendered output from sandboxed code"
5171
+ },
5140
5172
  [BitType.step]: {
5141
5173
  since: "1.5.1",
5142
5174
  baseBitType: BitType.article,
@@ -6132,6 +6164,18 @@ var BITS = {
6132
6164
  }
6133
6165
  ]
6134
6166
  },
6167
+ [BitType.appCalculatorLatex]: {
6168
+ since: "4.10.0",
6169
+ baseBitType: BitType.article,
6170
+ description: "A LaTeX calculator bit, used to create a calculator that can interpret LaTeX expressions",
6171
+ tags: [
6172
+ {
6173
+ key: ConfigKey.property_formula,
6174
+ description: "The LaTeX formula for the calculator, used to define the calculation logic",
6175
+ format: TagFormat.plainText
6176
+ }
6177
+ ]
6178
+ },
6135
6179
  [BitType.container]: {
6136
6180
  since: "1.9.0",
6137
6181
  baseBitType: BitType.article,
@@ -9147,7 +9191,7 @@ var instance2 = new Config();
9147
9191
  // src/generated/package_info.ts
9148
9192
  var PACKAGE_INFO = {
9149
9193
  "name": "@gmb/bitmark-parser-generator",
9150
- "version": "4.9.0",
9194
+ "version": "4.11.0",
9151
9195
  "author": "Get More Brain Ltd",
9152
9196
  "license": "ISC",
9153
9197
  "description": "A bitmark parser and generator using Peggy.js"
@@ -9555,8 +9599,6 @@ var NodeType = (0, import_superenum20.superenum)({
9555
9599
  botValue: "botValue",
9556
9600
  bubbleTag: "bubbleTag",
9557
9601
  bubbleTagValue: "bubbleTagValue",
9558
- extractorTag: "extractorTag",
9559
- extractorTagValue: "extractorTagValue",
9560
9602
  buttonCaption: "buttonCaption",
9561
9603
  buttonCaptionValue: "buttonCaptionValue",
9562
9604
  callToActionUrl: "callToActionUrl",
@@ -9654,6 +9696,8 @@ var NodeType = (0, import_superenum20.superenum)({
9654
9696
  externalIdValue: "externalIdValue",
9655
9697
  externalLink: "externalLink",
9656
9698
  externalLinkText: "externalLinkText",
9699
+ extractorTag: "extractorTag",
9700
+ extractorTagValue: "extractorTagValue",
9657
9701
  extraProperties: "extraProperties",
9658
9702
  feedback: "feedback",
9659
9703
  feedbackEngine: "feedbackEngine",
@@ -9673,6 +9717,8 @@ var NodeType = (0, import_superenum20.superenum)({
9673
9717
  footerText: "footerText",
9674
9718
  forKeys: "forKeys",
9675
9719
  format: "format",
9720
+ formula: "formula",
9721
+ formulaValue: "formulaValue",
9676
9722
  forValues: "forValues",
9677
9723
  forValuesValue: "forValuesValue",
9678
9724
  fullName: "fullName",
@@ -9936,15 +9982,18 @@ var NodeType = (0, import_superenum20.superenum)({
9936
9982
  solution: "solution",
9937
9983
  solutions: "solutions",
9938
9984
  solutionsValue: "solutionsValue",
9985
+ sourceDocument: "sourceDocument",
9986
+ sourceDocumentValue: "sourceDocumentValue",
9987
+ sourcePageNumber: "sourcePageNumber",
9939
9988
  spaceId: "spaceId",
9940
9989
  spaceIdValue: "spaceIdValue",
9941
9990
  src: "src",
9942
- srcAlt: "srcAlt",
9943
- srcAltValue: "srcAltValue",
9944
9991
  src1x: "src1x",
9945
9992
  src2x: "src2x",
9946
9993
  src3x: "src3x",
9947
9994
  src4x: "src4x",
9995
+ srcAlt: "srcAlt",
9996
+ srcAltValue: "srcAltValue",
9948
9997
  start: "start",
9949
9998
  statement: "statement",
9950
9999
  statements: "statements",
@@ -22944,6 +22993,12 @@ var Builder = class extends BaseBuilder {
22944
22993
  data.maxTocChapterLevel,
22945
22994
  options
22946
22995
  ),
22996
+ sourceDocument: this.toAstProperty(
22997
+ bitType,
22998
+ ConfigKey.property_sourceDocument,
22999
+ data.sourceDocument,
23000
+ options
23001
+ ),
22947
23002
  tocResource: this.toAstProperty(
22948
23003
  bitType,
22949
23004
  ConfigKey.property_tocResource,
@@ -22993,6 +23048,7 @@ var Builder = class extends BaseBuilder {
22993
23048
  data.ratingLevelSelected,
22994
23049
  options
22995
23050
  ),
23051
+ formula: this.toAstProperty(bitType, ConfigKey.property_formula, data.formula, options),
22996
23052
  markConfig: this.buildMarkConfigs(context, data.markConfig),
22997
23053
  imageSource: this.buildImageSource(context, data.imageSource),
22998
23054
  person: this.buildPerson(context, data.person),
@@ -23027,6 +23083,7 @@ var Builder = class extends BaseBuilder {
23027
23083
  item: this.handleJsonText(context, TextLocation.tag, data.item),
23028
23084
  lead: this.handleJsonText(context, TextLocation.tag, data.lead),
23029
23085
  pageNumber: this.handleJsonText(context, TextLocation.tag, data.pageNumber),
23086
+ sourcePageNumber: this.handleJsonText(context, TextLocation.tag, data.sourcePageNumber),
23030
23087
  marginNumber: this.handleJsonText(context, TextLocation.tag, data.marginNumber),
23031
23088
  hint: this.handleJsonText(context, TextLocation.tag, data.hint),
23032
23089
  instruction: this.handleJsonText(context, TextLocation.tag, data.instruction),
@@ -23129,7 +23186,15 @@ var Builder = class extends BaseBuilder {
23129
23186
  objectUtils.removeUnwantedProperties(node, {
23130
23187
  ignoreAllFalse: true,
23131
23188
  ignoreUndefined: ["example"],
23132
- ignoreEmptyArrays: ["item", "lead", "pageNumber", "marginNumber", "hint", "instruction"]
23189
+ ignoreEmptyArrays: [
23190
+ "item",
23191
+ "lead",
23192
+ "pageNumber",
23193
+ "sourcePageNumber",
23194
+ "marginNumber",
23195
+ "hint",
23196
+ "instruction"
23197
+ ]
23133
23198
  });
23134
23199
  return nodeValidator.validateBit(node);
23135
23200
  }
@@ -25442,6 +25507,7 @@ var BitmarkGenerator = class extends AstWalkerGenerator {
25442
25507
  if (this.isEmptyText(item)) return false;
25443
25508
  if (!this.isEmptyText(parent?.value?.lead)) return true;
25444
25509
  if (!this.isEmptyText(parent?.value?.pageNumber)) return true;
25510
+ if (!this.isEmptyText(parent?.value?.sourcePageNumber)) return true;
25445
25511
  if (!this.isEmptyText(parent?.value?.marginNumber)) return true;
25446
25512
  this.writeNL_IfNotChain(route);
25447
25513
  this.writeOPC();
@@ -25455,6 +25521,7 @@ var BitmarkGenerator = class extends AstWalkerGenerator {
25455
25521
  const parent = this.getParentNode(route);
25456
25522
  if (this.isEmptyText(lead)) return false;
25457
25523
  if (!this.isEmptyText(parent?.value?.pageNumber)) return true;
25524
+ if (!this.isEmptyText(parent?.value?.sourcePageNumber)) return true;
25458
25525
  if (!this.isEmptyText(parent?.value?.marginNumber)) return true;
25459
25526
  this.writeNL_IfNotChain(route);
25460
25527
  this.writeOPC();
@@ -25470,6 +25537,7 @@ var BitmarkGenerator = class extends AstWalkerGenerator {
25470
25537
  const pageNumber = node.value;
25471
25538
  const parent = this.getParentNode(route);
25472
25539
  if (this.isEmptyText(pageNumber)) return false;
25540
+ if (!this.isEmptyText(parent?.value?.sourcePageNumber)) return true;
25473
25541
  if (!this.isEmptyText(parent?.value?.marginNumber)) return true;
25474
25542
  this.writeNL_IfNotChain(route);
25475
25543
  this.writeOPC();
@@ -25483,6 +25551,31 @@ var BitmarkGenerator = class extends AstWalkerGenerator {
25483
25551
  this.writeCL();
25484
25552
  return true;
25485
25553
  }
25554
+ // bitmarkAst -> bits -> bitsValue -> sourcePageNumber
25555
+ enter_sourcePageNumber(node, route) {
25556
+ const sourcePageNumber = node.value;
25557
+ const parent = this.getParentNode(route);
25558
+ if (this.isEmptyText(sourcePageNumber)) return false;
25559
+ if (!this.isEmptyText(parent?.value?.marginNumber)) return true;
25560
+ this.writeNL_IfNotChain(route);
25561
+ this.writeOPC();
25562
+ this.writeTextOrValue(parent?.value?.item ?? "", TextFormat.bitmarkText, TextLocation.tag);
25563
+ this.writeCL();
25564
+ this.writeOPC();
25565
+ this.writeTextOrValue(parent?.value?.lead ?? "", TextFormat.bitmarkText, TextLocation.tag);
25566
+ this.writeCL();
25567
+ this.writeOPC();
25568
+ this.writeTextOrValue(
25569
+ parent?.value?.pageNumber ?? "",
25570
+ TextFormat.bitmarkText,
25571
+ TextLocation.tag
25572
+ );
25573
+ this.writeCL();
25574
+ this.writeOPC();
25575
+ this.writeTextOrValue(sourcePageNumber ?? "", TextFormat.bitmarkText, TextLocation.tag);
25576
+ this.writeCL();
25577
+ return true;
25578
+ }
25486
25579
  // bitmarkAst -> bits -> bitsValue -> marginNumber
25487
25580
  enter_marginNumber(node, route) {
25488
25581
  const marginNumber = node.value;
@@ -25503,6 +25596,13 @@ var BitmarkGenerator = class extends AstWalkerGenerator {
25503
25596
  );
25504
25597
  this.writeCL();
25505
25598
  this.writeOPC();
25599
+ this.writeTextOrValue(
25600
+ parent?.value?.sourcePageNumber ?? "",
25601
+ TextFormat.bitmarkText,
25602
+ TextLocation.tag
25603
+ );
25604
+ this.writeCL();
25605
+ this.writeOPC();
25506
25606
  this.writeTextOrValue(marginNumber, TextFormat.bitmarkText, TextLocation.tag);
25507
25607
  this.writeCL();
25508
25608
  return true;
@@ -27327,6 +27427,10 @@ var JsonGenerator = class extends AstWalkerGenerator {
27327
27427
  enter_pageNumber(node, route) {
27328
27428
  return this.standardHandler(node, route, NodeType.bitsValue, { array: true });
27329
27429
  }
27430
+ // bitmarkAst -> bits -> bitsValue -> sourcePageNumber
27431
+ enter_sourcePageNumber(node, route) {
27432
+ return this.standardHandler(node, route, NodeType.bitsValue, { array: true });
27433
+ }
27330
27434
  // bitmarkAst -> bits -> bitsValue -> marginNumber
27331
27435
  enter_marginNumber(node, route) {
27332
27436
  return this.standardHandler(node, route, NodeType.bitsValue, { array: true });
@@ -28049,6 +28153,7 @@ var JsonGenerator = class extends AstWalkerGenerator {
28049
28153
  delete bitJson.item;
28050
28154
  delete bitJson.lead;
28051
28155
  delete bitJson.pageNumber;
28156
+ delete bitJson.sourcePageNumber;
28052
28157
  delete bitJson.marginNumber;
28053
28158
  delete bitJson.hint;
28054
28159
  delete bitJson.instruction;
@@ -28060,6 +28165,8 @@ var JsonGenerator = class extends AstWalkerGenerator {
28060
28165
  if (bitJson.lead == null || bitJson.lead?.length === 0) delete bitJson.lead;
28061
28166
  if (bitJson.pageNumber == null || bitJson.pageNumber?.length === 0)
28062
28167
  delete bitJson.pageNumber;
28168
+ if (bitJson.sourcePageNumber == null || bitJson.sourcePageNumber?.length === 0)
28169
+ delete bitJson.sourcePageNumber;
28063
28170
  if (bitJson.marginNumber == null || bitJson.marginNumber?.length === 0)
28064
28171
  delete bitJson.marginNumber;
28065
28172
  if (bitJson.hint == null || bitJson.hint?.length === 0) delete bitJson.hint;
@@ -28071,6 +28178,7 @@ var JsonGenerator = class extends AstWalkerGenerator {
28071
28178
  if (bitJson.hint == null) bitJson.hint = this.textDefault;
28072
28179
  if (bitJson.instruction == null) bitJson.instruction = this.textDefault;
28073
28180
  if (bitJson.pageNumber == null) bitJson.pageNumber = this.textDefault;
28181
+ if (bitJson.sourcePageNumber == null) bitJson.sourcePageNumber = this.textDefault;
28074
28182
  if (bitJson.marginNumber == null) bitJson.marginNumber = this.textDefault;
28075
28183
  }
28076
28184
  if (bitJson.body == null) bitJson.body = this.bodyDefault;
@@ -32532,7 +32640,8 @@ var BitmarkPegParserProcessor = class {
32532
32640
  if (l > 0) result.item = result.itemLead[0];
32533
32641
  if (l > 1) result.lead = result.itemLead[1];
32534
32642
  if (l > 2) result.pageNumber = result.itemLead[2];
32535
- if (l > 3) result.marginNumber = result.itemLead[l - 1];
32643
+ if (l > 3) result.sourcePageNumber = result.itemLead[3];
32644
+ if (l > 4) result.marginNumber = result.itemLead[l - 1];
32536
32645
  }
32537
32646
  if (inBit) {
32538
32647
  result.body = instance11.process(