@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/CHANGELOG.md CHANGED
@@ -2,6 +2,14 @@
2
2
 
3
3
  ## Upcoming
4
4
 
5
+ ## 0.0.22
6
+
7
+ - support for `=Mermaid` block
8
+ - add text search in document / cmd-F
9
+ - support for `=picture` block
10
+ - fix detect markdown context for suggestions
11
+
12
+
5
13
  ## 0.0.20
6
14
 
7
15
  - support for `=toc` block
package/lib/index.cjs CHANGED
@@ -6918,6 +6918,9 @@ var require_AstTree = __commonJS({
6918
6918
  {
6919
6919
  $ref: "#/definitions/BlockImage"
6920
6920
  },
6921
+ {
6922
+ $ref: "#/definitions/BlockPicture"
6923
+ },
6921
6924
  {
6922
6925
  $ref: "#/definitions/BlockCaption"
6923
6926
  },
@@ -7256,6 +7259,71 @@ var require_AstTree = __commonJS({
7256
7259
  "value"
7257
7260
  ]
7258
7261
  },
7262
+ BlockPicture: {
7263
+ type: "object",
7264
+ properties: {
7265
+ name: {
7266
+ type: "string",
7267
+ enum: [
7268
+ "picture"
7269
+ ]
7270
+ },
7271
+ caption: {
7272
+ type: "string"
7273
+ },
7274
+ link: {
7275
+ type: "string"
7276
+ },
7277
+ content: {
7278
+ type: "array",
7279
+ items: [
7280
+ {
7281
+ $ref: "#/definitions/Image"
7282
+ },
7283
+ {
7284
+ $ref: "#/definitions/BlockCaption"
7285
+ }
7286
+ ],
7287
+ minItems: 2,
7288
+ maxItems: 2
7289
+ },
7290
+ type: {
7291
+ type: "string",
7292
+ enum: [
7293
+ "block"
7294
+ ]
7295
+ },
7296
+ location: {
7297
+ $ref: "#/definitions/Location"
7298
+ },
7299
+ margin: {
7300
+ type: "string"
7301
+ },
7302
+ config: {
7303
+ type: "array",
7304
+ items: {
7305
+ anyOf: [
7306
+ {
7307
+ $ref: "#/definitions/BrokenConfigItem"
7308
+ },
7309
+ {
7310
+ $ref: "#/definitions/ConfigItem"
7311
+ }
7312
+ ]
7313
+ }
7314
+ },
7315
+ id: {
7316
+ type: "string"
7317
+ }
7318
+ },
7319
+ required: [
7320
+ "content",
7321
+ "location",
7322
+ "margin",
7323
+ "name",
7324
+ "type"
7325
+ ]
7326
+ },
7259
7327
  RootBlock: {
7260
7328
  type: "object",
7261
7329
  properties: {
@@ -7975,6 +8043,9 @@ var require_AstTree = __commonJS({
7975
8043
  {
7976
8044
  $ref: "#/definitions/BlockImage"
7977
8045
  },
8046
+ {
8047
+ $ref: "#/definitions/BlockPicture"
8048
+ },
7978
8049
  {
7979
8050
  $ref: "#/definitions/BlockCaption"
7980
8051
  },
@@ -9350,6 +9421,9 @@ var require_PodliteDocument = __commonJS({
9350
9421
  {
9351
9422
  $ref: "#/definitions/BlockImage"
9352
9423
  },
9424
+ {
9425
+ $ref: "#/definitions/BlockPicture"
9426
+ },
9353
9427
  {
9354
9428
  $ref: "#/definitions/BlockCaption"
9355
9429
  },
@@ -9688,6 +9762,71 @@ var require_PodliteDocument = __commonJS({
9688
9762
  "value"
9689
9763
  ]
9690
9764
  },
9765
+ BlockPicture: {
9766
+ type: "object",
9767
+ properties: {
9768
+ name: {
9769
+ type: "string",
9770
+ enum: [
9771
+ "picture"
9772
+ ]
9773
+ },
9774
+ caption: {
9775
+ type: "string"
9776
+ },
9777
+ link: {
9778
+ type: "string"
9779
+ },
9780
+ content: {
9781
+ type: "array",
9782
+ items: [
9783
+ {
9784
+ $ref: "#/definitions/Image"
9785
+ },
9786
+ {
9787
+ $ref: "#/definitions/BlockCaption"
9788
+ }
9789
+ ],
9790
+ minItems: 2,
9791
+ maxItems: 2
9792
+ },
9793
+ type: {
9794
+ type: "string",
9795
+ enum: [
9796
+ "block"
9797
+ ]
9798
+ },
9799
+ location: {
9800
+ $ref: "#/definitions/Location"
9801
+ },
9802
+ margin: {
9803
+ type: "string"
9804
+ },
9805
+ config: {
9806
+ type: "array",
9807
+ items: {
9808
+ anyOf: [
9809
+ {
9810
+ $ref: "#/definitions/BrokenConfigItem"
9811
+ },
9812
+ {
9813
+ $ref: "#/definitions/ConfigItem"
9814
+ }
9815
+ ]
9816
+ }
9817
+ },
9818
+ id: {
9819
+ type: "string"
9820
+ }
9821
+ },
9822
+ required: [
9823
+ "content",
9824
+ "location",
9825
+ "margin",
9826
+ "name",
9827
+ "type"
9828
+ ]
9829
+ },
9691
9830
  RootBlock: {
9692
9831
  type: "object",
9693
9832
  properties: {
@@ -10407,6 +10546,9 @@ var require_PodliteDocument = __commonJS({
10407
10546
  {
10408
10547
  $ref: "#/definitions/BlockImage"
10409
10548
  },
10549
+ {
10550
+ $ref: "#/definitions/BlockPicture"
10551
+ },
10410
10552
  {
10411
10553
  $ref: "#/definitions/BlockCaption"
10412
10554
  },
@@ -12232,7 +12374,7 @@ var require_grammar = __commonJS({
12232
12374
  }, peg$c117 = function(number) {
12233
12375
  return parseInt(number, 10);
12234
12376
  }, peg$c118 = function(vmargin, name, config) {
12235
- return name.match(/code|comment|output|input|markdown|toc|data/) || isNamedBlock2(name);
12377
+ return name.match(/code|comment|output|input|markdown|picture|toc|data/) || isNamedBlock2(name);
12236
12378
  }, peg$c119 = function(vmargin, name, config, margins, ename) {
12237
12379
  return vmargin.length === margins.length && name === ename;
12238
12380
  }, peg$c120 = function(vmargin, name, config, margins, line) {
@@ -12381,7 +12523,7 @@ var require_grammar = __commonJS({
12381
12523
  }, peg$c151 = /^[s]/, peg$c152 = peg$classExpectation(["s"], false, false), peg$c153 = function(line) {
12382
12524
  return {text: text(), type: "ambient1"};
12383
12525
  }, peg$c154 = function(vmargin, name) {
12384
- return name.match(/code|comment|output|input|markdown|toc|data/) || isNamedBlock2(name);
12526
+ return name.match(/code|comment|output|input|markdown|picture|toc|data/) || isNamedBlock2(name);
12385
12527
  }, peg$c155 = function(vmargin, name, content2) {
12386
12528
  return {
12387
12529
  margin: vmargin,
@@ -12441,7 +12583,7 @@ var require_grammar = __commonJS({
12441
12583
  margin: vmargin
12442
12584
  };
12443
12585
  }, peg$c168 = function(vmargin, marker, name, config) {
12444
- return name.match(/code|comment|output|input|markdown|toc|data/) || isNamedBlock2(name);
12586
+ return name.match(/code|comment|output|input|markdown|picture|toc|data/) || isNamedBlock2(name);
12445
12587
  }, peg$c169 = function(vmargin, marker, name, config, content2) {
12446
12588
  return {
12447
12589
  type: "block",
@@ -17878,6 +18020,7 @@ var require_grammar = __commonJS({
17878
18020
  "nested",
17879
18021
  "output",
17880
18022
  "para",
18023
+ "picture",
17881
18024
  "pod",
17882
18025
  "table",
17883
18026
  "toc"
@@ -21765,7 +21908,7 @@ var require_package = __commonJS({
21765
21908
  "../podlite-schema/package.json"(exports, module2) {
21766
21909
  module2.exports = {
21767
21910
  name: "@podlite/schema",
21768
- version: "0.0.14",
21911
+ version: "0.0.16",
21769
21912
  description: "AST tools for Podlite markup language",
21770
21913
  main: "./src/index.ts",
21771
21914
  types: "./lib/index.d.ts",
@@ -21773,6 +21916,7 @@ var require_package = __commonJS({
21773
21916
  files: [
21774
21917
  "lib/**/*.js",
21775
21918
  "lib/**/*.d.ts",
21919
+ "esm",
21776
21920
  "schema/*",
21777
21921
  "README.md",
21778
21922
  "CHANGELOG.md"
@@ -21784,14 +21928,14 @@ var require_package = __commonJS({
21784
21928
  publishConfig: {
21785
21929
  access: "public",
21786
21930
  main: "lib/index.js",
21787
- types: "./lib/index.d.ts"
21931
+ types: "./lib/index.d.ts",
21932
+ module: "./esm/index.js"
21788
21933
  },
21789
21934
  scripts: {
21790
- clean: "rm -rf lib esm tsconfig.tsbuildinfo",
21791
- build: "run-s build:pegjs build:ts build:ast ",
21935
+ clean: "rm -rf lib esm *.tsbuildinfo",
21936
+ build: "run-s build:pegjs build_lib build:ast ",
21937
+ build_lib: "yarn g:build",
21792
21938
  "build:ast": "ts-node scripts/make-ast-scheme.ts",
21793
- "build:ts": "yarn g:tsc --build $INIT_CWD",
21794
- "build:esm": "yarn g:tsctest -p tsconfig.esm.json",
21795
21939
  "build:pegjs": "pegjs -o src/grammar.js src/grammar.pegjs && pegjs -o src/grammarfc.js src/grammarfc.pegjs",
21796
21940
  watch: "npx nodemon -e js,ts --exec 'yarn' build",
21797
21941
  "watch:pegjs": "npx nodemon -e pegjs --exec 'yarn' build:pegjs",
@@ -21875,8 +22019,8 @@ var dict = [
21875
22019
  `
21876
22020
  },
21877
22021
  {
21878
- displayText: "Image \u{1F3F7}",
21879
- text: `=Image https://github.com/zag/podlite-desktop/blob/master/dist-assets/linux-icon/256x256.png?raw=true
22022
+ displayText: "picture \u{1F3F7}",
22023
+ text: `=picture https://github.com/zag/podlite-desktop/blob/master/dist-assets/linux-icon/256x256.png?raw=true
21880
22024
  `
21881
22025
  },
21882
22026
  {
@@ -21908,19 +22052,19 @@ Everything else 57
21908
22052
  `
21909
22053
  },
21910
22054
  {
21911
- displayText: "Diagram simple \u{1F3F7}",
21912
- text: `=begin Diagram :caption('Caption of diagram')
22055
+ displayText: "Mermaid diagram simple \u{1F3F7}",
22056
+ text: `=begin Mermaid :caption('Caption of diagram')
21913
22057
  graph LR
21914
22058
  A-->B
21915
22059
  B-->C
21916
22060
  C-->A
21917
22061
  D-->C
21918
- =end Diagram
22062
+ =end Mermaid
21919
22063
  `
21920
22064
  },
21921
22065
  {
21922
- displayText: "Diagram Sequence \u{1F3F7}",
21923
- text: `=for Diagram :caption('Caption of diagram')
22066
+ displayText: "Mermaid diagram Sequence \u{1F3F7}",
22067
+ text: `=for Mermaid :caption('Caption of diagram')
21924
22068
  sequenceDiagram
21925
22069
  autonumber
21926
22070
  Student->>Admin: Can I enrol this semester?
@@ -21935,8 +22079,8 @@ Everything else 57
21935
22079
  `
21936
22080
  },
21937
22081
  {
21938
- displayText: "Diagram flowchart \u{1F3F7}",
21939
- text: `=for Diagram :caption('Caption of diagram')
22082
+ displayText: "Mermaid flowchart \u{1F3F7}",
22083
+ text: `=for Mermaid :caption('Caption of diagram')
21940
22084
  graph LR
21941
22085
  A[Square Rect] -- Link text --> B((Circle))
21942
22086
  A --> C(Round Rect)
@@ -21946,8 +22090,8 @@ Everything else 57
21946
22090
  `
21947
22091
  },
21948
22092
  {
21949
- displayText: "Diagram class \u{1F3F7}",
21950
- text: `=for Diagram :caption('Caption of diagram')
22093
+ displayText: "Mermaid class \u{1F3F7}",
22094
+ text: `=for Mermaid :caption('Caption of diagram')
21951
22095
  classDiagram
21952
22096
  Person <|-- Student
21953
22097
  Person <|-- Professor
@@ -21997,9 +22141,9 @@ head1, head2, head3
21997
22141
  `
21998
22142
  },
21999
22143
  {
22000
- displayText: "toc ( Images, Diagrams ) + tables \u{1F3F7}",
22144
+ displayText: "toc ( picture, Mermaid ) + tables \u{1F3F7}",
22001
22145
  text: `=for toc :title('List of media')
22002
- Image, Diagram
22146
+ picture, Mermaid
22003
22147
  =for toc :title('List of tables')
22004
22148
  table
22005
22149
 
@@ -22040,7 +22184,7 @@ table
22040
22184
  lang: "md"
22041
22185
  },
22042
22186
  {
22043
- displayText: "Image \u{1F3F7}",
22187
+ displayText: "picture \u{1F3F7}",
22044
22188
  text: `![Podlite](https://github.com/zag/podlite-desktop/blob/master/dist-assets/linux-icon/256x256.png?raw=true "Podlite logo")
22045
22189
 
22046
22190
  `,
@@ -22057,8 +22201,8 @@ table
22057
22201
  lang: "md"
22058
22202
  },
22059
22203
  {
22060
- displayText: "Diagram simple \u{1F3F7}",
22061
- text: `\`\`\`diagram
22204
+ displayText: "Mermaid simple \u{1F3F7}",
22205
+ text: `\`\`\`mermaid
22062
22206
  graph LR
22063
22207
  A-->B
22064
22208
  B-->C
@@ -22076,6 +22220,10 @@ var import_react_is = __toModule(require_react_is());
22076
22220
  var import_gfm = __toModule(require("codemirror/mode/gfm/gfm"));
22077
22221
  var import_show_hint = __toModule(require("codemirror/addon/hint/show-hint"));
22078
22222
  var import_show_hint2 = __toModule(require("codemirror/addon/hint/show-hint.css"));
22223
+ var import_search = __toModule(require("codemirror/addon/search/search"));
22224
+ var import_searchcursor = __toModule(require("codemirror/addon/search/searchcursor"));
22225
+ var import_dialog = __toModule(require("codemirror/addon/dialog/dialog"));
22226
+ var import_dialog2 = __toModule(require("codemirror/addon/dialog/dialog.css"));
22079
22227
 
22080
22228
  // ../podlite-schema/src/index.ts
22081
22229
  var import_ajv = __toModule(require_ajv());
@@ -22874,8 +23022,9 @@ var middle2 = () => (tree) => {
22874
23022
  const isCodeBlock = "name" in n && n.name === "code";
22875
23023
  const isDataBlock = "name" in n && n.name === "data";
22876
23024
  const isMarkdownBlock = "name" in n && n.name === "markdown";
23025
+ const isPictureBlock = "name" in n && n.name === "picture";
22877
23026
  const allowValues = conf.getAllValues("allow");
22878
- if ((isCodeBlock || isDataBlock || isMarkdownBlock) && allowValues.length == 0)
23027
+ if ((isCodeBlock || isDataBlock || isMarkdownBlock || isPictureBlock) && allowValues.length == 0)
22879
23028
  return n;
22880
23029
  const allowed = allowValues.sort();
22881
23030
  const transformer = makeTransformer_default({
@@ -23540,7 +23689,7 @@ var parse4 = (str) => {
23540
23689
  };
23541
23690
  var getSuggestionContextForLine = (pod, line) => {
23542
23691
  const tree = parse4(pod);
23543
- const markdownBlocks = getFromTree(tree, "Markdown");
23692
+ const markdownBlocks = getFromTree(tree, "Markdown", "markdown");
23544
23693
  const isMd = markdownBlocks.findIndex(({
23545
23694
  location: {
23546
23695
  start: {line: lineStart},