@podlite/editor-react 0.0.20 → 0.0.22

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/lib/index.d.ts CHANGED
@@ -2,6 +2,10 @@ import React from 'react';
2
2
  import 'codemirror/mode/gfm/gfm';
3
3
  import 'codemirror/addon/hint/show-hint';
4
4
  import 'codemirror/addon/hint/show-hint.css';
5
+ import 'codemirror/addon/search/search';
6
+ import 'codemirror/addon/search/searchcursor';
7
+ import 'codemirror/addon/dialog/dialog';
8
+ import 'codemirror/addon/dialog/dialog.css';
5
9
  import './Editor.css';
6
10
  export interface ConverterResult {
7
11
  errors?: any;
package/lib/index.esm.js CHANGED
@@ -6914,6 +6914,9 @@ var require_AstTree = __commonJS({
6914
6914
  {
6915
6915
  $ref: "#/definitions/BlockImage"
6916
6916
  },
6917
+ {
6918
+ $ref: "#/definitions/BlockPicture"
6919
+ },
6917
6920
  {
6918
6921
  $ref: "#/definitions/BlockCaption"
6919
6922
  },
@@ -7252,6 +7255,71 @@ var require_AstTree = __commonJS({
7252
7255
  "value"
7253
7256
  ]
7254
7257
  },
7258
+ BlockPicture: {
7259
+ type: "object",
7260
+ properties: {
7261
+ name: {
7262
+ type: "string",
7263
+ enum: [
7264
+ "picture"
7265
+ ]
7266
+ },
7267
+ caption: {
7268
+ type: "string"
7269
+ },
7270
+ link: {
7271
+ type: "string"
7272
+ },
7273
+ content: {
7274
+ type: "array",
7275
+ items: [
7276
+ {
7277
+ $ref: "#/definitions/Image"
7278
+ },
7279
+ {
7280
+ $ref: "#/definitions/BlockCaption"
7281
+ }
7282
+ ],
7283
+ minItems: 2,
7284
+ maxItems: 2
7285
+ },
7286
+ type: {
7287
+ type: "string",
7288
+ enum: [
7289
+ "block"
7290
+ ]
7291
+ },
7292
+ location: {
7293
+ $ref: "#/definitions/Location"
7294
+ },
7295
+ margin: {
7296
+ type: "string"
7297
+ },
7298
+ config: {
7299
+ type: "array",
7300
+ items: {
7301
+ anyOf: [
7302
+ {
7303
+ $ref: "#/definitions/BrokenConfigItem"
7304
+ },
7305
+ {
7306
+ $ref: "#/definitions/ConfigItem"
7307
+ }
7308
+ ]
7309
+ }
7310
+ },
7311
+ id: {
7312
+ type: "string"
7313
+ }
7314
+ },
7315
+ required: [
7316
+ "content",
7317
+ "location",
7318
+ "margin",
7319
+ "name",
7320
+ "type"
7321
+ ]
7322
+ },
7255
7323
  RootBlock: {
7256
7324
  type: "object",
7257
7325
  properties: {
@@ -7971,6 +8039,9 @@ var require_AstTree = __commonJS({
7971
8039
  {
7972
8040
  $ref: "#/definitions/BlockImage"
7973
8041
  },
8042
+ {
8043
+ $ref: "#/definitions/BlockPicture"
8044
+ },
7974
8045
  {
7975
8046
  $ref: "#/definitions/BlockCaption"
7976
8047
  },
@@ -9346,6 +9417,9 @@ var require_PodliteDocument = __commonJS({
9346
9417
  {
9347
9418
  $ref: "#/definitions/BlockImage"
9348
9419
  },
9420
+ {
9421
+ $ref: "#/definitions/BlockPicture"
9422
+ },
9349
9423
  {
9350
9424
  $ref: "#/definitions/BlockCaption"
9351
9425
  },
@@ -9684,6 +9758,71 @@ var require_PodliteDocument = __commonJS({
9684
9758
  "value"
9685
9759
  ]
9686
9760
  },
9761
+ BlockPicture: {
9762
+ type: "object",
9763
+ properties: {
9764
+ name: {
9765
+ type: "string",
9766
+ enum: [
9767
+ "picture"
9768
+ ]
9769
+ },
9770
+ caption: {
9771
+ type: "string"
9772
+ },
9773
+ link: {
9774
+ type: "string"
9775
+ },
9776
+ content: {
9777
+ type: "array",
9778
+ items: [
9779
+ {
9780
+ $ref: "#/definitions/Image"
9781
+ },
9782
+ {
9783
+ $ref: "#/definitions/BlockCaption"
9784
+ }
9785
+ ],
9786
+ minItems: 2,
9787
+ maxItems: 2
9788
+ },
9789
+ type: {
9790
+ type: "string",
9791
+ enum: [
9792
+ "block"
9793
+ ]
9794
+ },
9795
+ location: {
9796
+ $ref: "#/definitions/Location"
9797
+ },
9798
+ margin: {
9799
+ type: "string"
9800
+ },
9801
+ config: {
9802
+ type: "array",
9803
+ items: {
9804
+ anyOf: [
9805
+ {
9806
+ $ref: "#/definitions/BrokenConfigItem"
9807
+ },
9808
+ {
9809
+ $ref: "#/definitions/ConfigItem"
9810
+ }
9811
+ ]
9812
+ }
9813
+ },
9814
+ id: {
9815
+ type: "string"
9816
+ }
9817
+ },
9818
+ required: [
9819
+ "content",
9820
+ "location",
9821
+ "margin",
9822
+ "name",
9823
+ "type"
9824
+ ]
9825
+ },
9687
9826
  RootBlock: {
9688
9827
  type: "object",
9689
9828
  properties: {
@@ -10403,6 +10542,9 @@ var require_PodliteDocument = __commonJS({
10403
10542
  {
10404
10543
  $ref: "#/definitions/BlockImage"
10405
10544
  },
10545
+ {
10546
+ $ref: "#/definitions/BlockPicture"
10547
+ },
10406
10548
  {
10407
10549
  $ref: "#/definitions/BlockCaption"
10408
10550
  },
@@ -12228,7 +12370,7 @@ var require_grammar = __commonJS({
12228
12370
  }, peg$c117 = function(number) {
12229
12371
  return parseInt(number, 10);
12230
12372
  }, peg$c118 = function(vmargin, name, config) {
12231
- return name.match(/code|comment|output|input|markdown|toc|data/) || isNamedBlock2(name);
12373
+ return name.match(/code|comment|output|input|markdown|picture|toc|data/) || isNamedBlock2(name);
12232
12374
  }, peg$c119 = function(vmargin, name, config, margins, ename) {
12233
12375
  return vmargin.length === margins.length && name === ename;
12234
12376
  }, peg$c120 = function(vmargin, name, config, margins, line) {
@@ -12377,7 +12519,7 @@ var require_grammar = __commonJS({
12377
12519
  }, peg$c151 = /^[s]/, peg$c152 = peg$classExpectation(["s"], false, false), peg$c153 = function(line) {
12378
12520
  return {text: text(), type: "ambient1"};
12379
12521
  }, peg$c154 = function(vmargin, name) {
12380
- return name.match(/code|comment|output|input|markdown|toc|data/) || isNamedBlock2(name);
12522
+ return name.match(/code|comment|output|input|markdown|picture|toc|data/) || isNamedBlock2(name);
12381
12523
  }, peg$c155 = function(vmargin, name, content2) {
12382
12524
  return {
12383
12525
  margin: vmargin,
@@ -12437,7 +12579,7 @@ var require_grammar = __commonJS({
12437
12579
  margin: vmargin
12438
12580
  };
12439
12581
  }, peg$c168 = function(vmargin, marker, name, config) {
12440
- return name.match(/code|comment|output|input|markdown|toc|data/) || isNamedBlock2(name);
12582
+ return name.match(/code|comment|output|input|markdown|picture|toc|data/) || isNamedBlock2(name);
12441
12583
  }, peg$c169 = function(vmargin, marker, name, config, content2) {
12442
12584
  return {
12443
12585
  type: "block",
@@ -17874,6 +18016,7 @@ var require_grammar = __commonJS({
17874
18016
  "nested",
17875
18017
  "output",
17876
18018
  "para",
18019
+ "picture",
17877
18020
  "pod",
17878
18021
  "table",
17879
18022
  "toc"
@@ -21761,7 +21904,7 @@ var require_package = __commonJS({
21761
21904
  "../podlite-schema/package.json"(exports, module) {
21762
21905
  module.exports = {
21763
21906
  name: "@podlite/schema",
21764
- version: "0.0.14",
21907
+ version: "0.0.16",
21765
21908
  description: "AST tools for Podlite markup language",
21766
21909
  main: "./src/index.ts",
21767
21910
  types: "./lib/index.d.ts",
@@ -21769,6 +21912,7 @@ var require_package = __commonJS({
21769
21912
  files: [
21770
21913
  "lib/**/*.js",
21771
21914
  "lib/**/*.d.ts",
21915
+ "esm",
21772
21916
  "schema/*",
21773
21917
  "README.md",
21774
21918
  "CHANGELOG.md"
@@ -21780,14 +21924,14 @@ var require_package = __commonJS({
21780
21924
  publishConfig: {
21781
21925
  access: "public",
21782
21926
  main: "lib/index.js",
21783
- types: "./lib/index.d.ts"
21927
+ types: "./lib/index.d.ts",
21928
+ module: "./esm/index.js"
21784
21929
  },
21785
21930
  scripts: {
21786
- clean: "rm -rf lib esm tsconfig.tsbuildinfo",
21787
- build: "run-s build:pegjs build:ts build:ast ",
21931
+ clean: "rm -rf lib esm *.tsbuildinfo",
21932
+ build: "run-s build:pegjs build_lib build:ast ",
21933
+ build_lib: "yarn g:build",
21788
21934
  "build:ast": "ts-node scripts/make-ast-scheme.ts",
21789
- "build:ts": "yarn g:tsc --build $INIT_CWD",
21790
- "build:esm": "yarn g:tsctest -p tsconfig.esm.json",
21791
21935
  "build:pegjs": "pegjs -o src/grammar.js src/grammar.pegjs && pegjs -o src/grammarfc.js src/grammarfc.pegjs",
21792
21936
  watch: "npx nodemon -e js,ts --exec 'yarn' build",
21793
21937
  "watch:pegjs": "npx nodemon -e pegjs --exec 'yarn' build:pegjs",
@@ -21866,8 +22010,8 @@ var dict = [
21866
22010
  `
21867
22011
  },
21868
22012
  {
21869
- displayText: "Image \u{1F3F7}",
21870
- text: `=Image https://github.com/zag/podlite-desktop/blob/master/dist-assets/linux-icon/256x256.png?raw=true
22013
+ displayText: "picture \u{1F3F7}",
22014
+ text: `=picture https://github.com/zag/podlite-desktop/blob/master/dist-assets/linux-icon/256x256.png?raw=true
21871
22015
  `
21872
22016
  },
21873
22017
  {
@@ -21899,19 +22043,19 @@ Everything else 57
21899
22043
  `
21900
22044
  },
21901
22045
  {
21902
- displayText: "Diagram simple \u{1F3F7}",
21903
- text: `=begin Diagram :caption('Caption of diagram')
22046
+ displayText: "Mermaid diagram simple \u{1F3F7}",
22047
+ text: `=begin Mermaid :caption('Caption of diagram')
21904
22048
  graph LR
21905
22049
  A-->B
21906
22050
  B-->C
21907
22051
  C-->A
21908
22052
  D-->C
21909
- =end Diagram
22053
+ =end Mermaid
21910
22054
  `
21911
22055
  },
21912
22056
  {
21913
- displayText: "Diagram Sequence \u{1F3F7}",
21914
- text: `=for Diagram :caption('Caption of diagram')
22057
+ displayText: "Mermaid diagram Sequence \u{1F3F7}",
22058
+ text: `=for Mermaid :caption('Caption of diagram')
21915
22059
  sequenceDiagram
21916
22060
  autonumber
21917
22061
  Student->>Admin: Can I enrol this semester?
@@ -21926,8 +22070,8 @@ Everything else 57
21926
22070
  `
21927
22071
  },
21928
22072
  {
21929
- displayText: "Diagram flowchart \u{1F3F7}",
21930
- text: `=for Diagram :caption('Caption of diagram')
22073
+ displayText: "Mermaid flowchart \u{1F3F7}",
22074
+ text: `=for Mermaid :caption('Caption of diagram')
21931
22075
  graph LR
21932
22076
  A[Square Rect] -- Link text --> B((Circle))
21933
22077
  A --> C(Round Rect)
@@ -21937,8 +22081,8 @@ Everything else 57
21937
22081
  `
21938
22082
  },
21939
22083
  {
21940
- displayText: "Diagram class \u{1F3F7}",
21941
- text: `=for Diagram :caption('Caption of diagram')
22084
+ displayText: "Mermaid class \u{1F3F7}",
22085
+ text: `=for Mermaid :caption('Caption of diagram')
21942
22086
  classDiagram
21943
22087
  Person <|-- Student
21944
22088
  Person <|-- Professor
@@ -21988,9 +22132,9 @@ head1, head2, head3
21988
22132
  `
21989
22133
  },
21990
22134
  {
21991
- displayText: "toc ( Images, Diagrams ) + tables \u{1F3F7}",
22135
+ displayText: "toc ( picture, Mermaid ) + tables \u{1F3F7}",
21992
22136
  text: `=for toc :title('List of media')
21993
- Image, Diagram
22137
+ picture, Mermaid
21994
22138
  =for toc :title('List of tables')
21995
22139
  table
21996
22140
 
@@ -22031,7 +22175,7 @@ table
22031
22175
  lang: "md"
22032
22176
  },
22033
22177
  {
22034
- displayText: "Image \u{1F3F7}",
22178
+ displayText: "picture \u{1F3F7}",
22035
22179
  text: `![Podlite](https://github.com/zag/podlite-desktop/blob/master/dist-assets/linux-icon/256x256.png?raw=true "Podlite logo")
22036
22180
 
22037
22181
  `,
@@ -22048,8 +22192,8 @@ table
22048
22192
  lang: "md"
22049
22193
  },
22050
22194
  {
22051
- displayText: "Diagram simple \u{1F3F7}",
22052
- text: `\`\`\`diagram
22195
+ displayText: "Mermaid simple \u{1F3F7}",
22196
+ text: `\`\`\`mermaid
22053
22197
  graph LR
22054
22198
  A-->B
22055
22199
  B-->C
@@ -22067,6 +22211,10 @@ import {useState, useEffect, useRef} from "react";
22067
22211
  import "codemirror/mode/gfm/gfm";
22068
22212
  import "codemirror/addon/hint/show-hint";
22069
22213
  import "codemirror/addon/hint/show-hint.css";
22214
+ import "codemirror/addon/search/search";
22215
+ import "codemirror/addon/search/searchcursor";
22216
+ import "codemirror/addon/dialog/dialog";
22217
+ import "codemirror/addon/dialog/dialog.css";
22070
22218
 
22071
22219
  // ../podlite-schema/src/index.ts
22072
22220
  var import_ajv = __toModule(require_ajv());
@@ -22865,8 +23013,9 @@ var middle2 = () => (tree) => {
22865
23013
  const isCodeBlock = "name" in n && n.name === "code";
22866
23014
  const isDataBlock = "name" in n && n.name === "data";
22867
23015
  const isMarkdownBlock = "name" in n && n.name === "markdown";
23016
+ const isPictureBlock = "name" in n && n.name === "picture";
22868
23017
  const allowValues = conf.getAllValues("allow");
22869
- if ((isCodeBlock || isDataBlock || isMarkdownBlock) && allowValues.length == 0)
23018
+ if ((isCodeBlock || isDataBlock || isMarkdownBlock || isPictureBlock) && allowValues.length == 0)
22870
23019
  return n;
22871
23020
  const allowed = allowValues.sort();
22872
23021
  const transformer = makeTransformer_default({
@@ -23531,7 +23680,7 @@ var parse4 = (str) => {
23531
23680
  };
23532
23681
  var getSuggestionContextForLine = (pod, line) => {
23533
23682
  const tree = parse4(pod);
23534
- const markdownBlocks = getFromTree(tree, "Markdown");
23683
+ const markdownBlocks = getFromTree(tree, "Markdown", "markdown");
23535
23684
  const isMd = markdownBlocks.findIndex(({
23536
23685
  location: {
23537
23686
  start: {line: lineStart},