@podlite/schema 0.0.9 → 0.0.11

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
@@ -1,6 +1,12 @@
1
1
  # @podlite/schema
2
2
 
3
3
  ## Upcoming
4
+ ## 0.0.11
5
+ - extend API by context for react component wrap function
6
+ ## 0.0.10
7
+ - fix helper for mkBlock
8
+ - add Strikethrough inline element support
9
+ - add JSX handler for plugins
4
10
  ## 0.0.9
5
11
  - fix null elements in
6
12
  ## 0.0.8
@@ -1 +1,2 @@
1
1
  export declare const getNodeId: (node: any, ctx: any) => any;
2
+ export declare const makeAttrs: (node: any, ctx?: import("pod6/built/helpers/config").Context) => import("pod6/built/helpers/config").Attr;
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.getNodeId = void 0;
6
+ exports.makeAttrs = exports.getNodeId = void 0;
7
7
  const config_1 = __importDefault(require("pod6/built/helpers/config"));
8
8
  const getNodeId = (node, ctx) => {
9
9
  const conf = (0, config_1.default)(node, ctx);
@@ -13,3 +13,4 @@ const getNodeId = (node, ctx) => {
13
13
  return node.id;
14
14
  };
15
15
  exports.getNodeId = getNodeId;
16
+ exports.makeAttrs = config_1.default;
@@ -7,6 +7,11 @@ export declare const mkBlankline: () => {
7
7
  };
8
8
  export declare const mkFomattingCode: (attrs: any, content: any) => any;
9
9
  export declare const mkFomattingCodeL: (attrs: any, content: any) => any;
10
+ export declare const mkFomattingCodeDelete: (content: any) => {
11
+ type: string;
12
+ name: string;
13
+ content: any[];
14
+ };
10
15
  export declare const mkVerbatim: (text: any) => {
11
16
  type: string;
12
17
  value: any;
@@ -17,7 +22,7 @@ export declare const mkTocItem: (content: PodNode) => TocItem;
17
22
  export declare const mkCaption: (content: Array<Node>) => BlockCaption;
18
23
  export declare const mkImage: (src: string, alt?: string) => Image;
19
24
  export declare const mkRootBlock: ({ margin }: {
20
- margin: any;
25
+ margin?: string;
21
26
  }, content: any) => RootBlock;
22
27
  export interface mkBlockItemParams {
23
28
  level: number;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.mkItemBlock = exports.mkRootBlock = exports.mkImage = exports.mkCaption = exports.mkTocItem = exports.mkTocList = exports.mkToc = exports.mkVerbatim = exports.mkFomattingCodeL = exports.mkFomattingCode = exports.mkBlankline = exports.mkBlock = exports.filterNulls = exports.mkNode = void 0;
3
+ exports.mkItemBlock = exports.mkRootBlock = exports.mkImage = exports.mkCaption = exports.mkTocItem = exports.mkTocList = exports.mkToc = exports.mkVerbatim = exports.mkFomattingCodeDelete = exports.mkFomattingCodeL = exports.mkFomattingCode = exports.mkBlankline = exports.mkBlock = exports.filterNulls = exports.mkNode = void 0;
4
4
  const nanoid_1 = require("nanoid");
5
5
  const mkNode = (attr) => {
6
6
  return { ...attr };
@@ -16,7 +16,7 @@ exports.filterNulls = filterNulls;
16
16
  const mkBlock = (attrs, content) => {
17
17
  const type = "block";
18
18
  const name = attrs.name;
19
- const attributes = { id: (0, nanoid_1.nanoid)(), ...attrs };
19
+ const attributes = { id: (0, nanoid_1.nanoid)(), margin: "", ...attrs };
20
20
  var result = (0, exports.mkNode)({ type, ...attributes, content: (0, exports.filterNulls)(content) });
21
21
  return result;
22
22
  };
@@ -32,6 +32,11 @@ const mkFomattingCodeL = (attrs, content) => {
32
32
  return res;
33
33
  };
34
34
  exports.mkFomattingCodeL = mkFomattingCodeL;
35
+ const mkFomattingCodeDelete = (content) => {
36
+ let res = (0, exports.mkNode)({ type: 'fcode', name: "Delete", content: (0, exports.filterNulls)(content) });
37
+ return res;
38
+ };
39
+ exports.mkFomattingCodeDelete = mkFomattingCodeDelete;
35
40
  const mkVerbatim = (text) => {
36
41
  return (0, exports.mkNode)({ "type": "verbatim", "value": text });
37
42
  };
@@ -65,7 +70,7 @@ const mkImage = (src, alt) => {
65
70
  };
66
71
  };
67
72
  exports.mkImage = mkImage;
68
- const mkRootBlock = ({ margin }, content) => {
73
+ const mkRootBlock = ({ margin = "" }, content) => {
69
74
  return (0, exports.mkBlock)({ name: 'root', margin }, content);
70
75
  };
71
76
  exports.mkRootBlock = mkRootBlock;
@@ -114,7 +114,7 @@ const getFromTree = (tree, ...queries) => {
114
114
  const queryAtoms = [];
115
115
  queries.forEach(q => {
116
116
  if (typeof q === 'string') {
117
- const getNameLevel = q.match(/^(?<name>(item|head|.*))(?<level>(\d+)?)$/);
117
+ const getNameLevel = q.match(/^(?<name>(item|head))(?<level>(\d+)?)$/);
118
118
  if (getNameLevel) {
119
119
  let { name, level } = getNameLevel.groups;
120
120
  if (name === 'item' && !level) {
@@ -123,6 +123,9 @@ const getFromTree = (tree, ...queries) => {
123
123
  const levelNum = level ? parseInt(level, 10) : undefined;
124
124
  queryAtoms.push({ name, ...(levelNum ? { level: levelNum } : {}) });
125
125
  }
126
+ else {
127
+ queryAtoms.push({ name: q });
128
+ }
126
129
  }
127
130
  else {
128
131
  queryAtoms.push(q);
package/lib/types.d.ts CHANGED
@@ -5,6 +5,7 @@ export interface Plugin {
5
5
  toAst?: RuleHandler;
6
6
  toAstAfter?: RuleHandler;
7
7
  toHtml?: RuleHandler;
8
+ toJSX?: (helper: any) => RuleHandler;
8
9
  }
9
10
  export interface Plugins {
10
11
  [name: string]: Plugin;
@@ -13,8 +14,8 @@ export interface RulesStrict {
13
14
  'A<>': RuleHandler<FormattingCodeA>;
14
15
  'B<>': RuleHandler<FormattingCodeB>;
15
16
  'C<>': RuleHandler<FormattingCodeC>;
16
- 'E<>': RuleHandler<FormattingCodeE>;
17
17
  'D<>': RuleHandler<FormattingCodeD>;
18
+ 'E<>': RuleHandler<FormattingCodeE>;
18
19
  'I<>': RuleHandler<FormattingCodeI>;
19
20
  'K<>': RuleHandler<FormattingCodeAny>;
20
21
  'R<>': RuleHandler<FormattingCodeAny>;
@@ -26,6 +27,7 @@ export interface RulesStrict {
26
27
  'L<>': RuleHandler<FormattingCodeL>;
27
28
  'U<>': RuleHandler<FormattingCodeAny>;
28
29
  'Z<>': RuleHandler<FormattingCodeAny>;
30
+ 'Delete<>': RuleHandler<FormattingCodeAny>;
29
31
  'pod': RuleHandler<Para>;
30
32
  'root': RuleHandler<RootBlock>;
31
33
  ':para': RuleHandler<Para>;
@@ -316,7 +318,7 @@ export interface TableSeparator {
316
318
  export declare type BlockAny = BlockNamed;
317
319
  export interface BlockNamed extends Omit<Block, 'content'> {
318
320
  name: Capitalize<string>;
319
- content: [(Verbatim | Para | Code)?] | Array<Image | BlockCaption>;
321
+ content: [(Verbatim | Para | Code)?] | Array<Image | BlockCaption> | RootBlock;
320
322
  }
321
323
  export interface BlockDiagram extends Omit<BlockNamed, 'content'> {
322
324
  name: 'Diagram';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@podlite/schema",
3
- "version": "0.0.9",
3
+ "version": "0.0.11",
4
4
  "description": "podlite schema",
5
5
  "main": "index.js",
6
6
  "types": "./lib/index.d.ts",
@@ -33,8 +33,8 @@
33
33
  "dependencies": {
34
34
  "ajv": "^7.2.3",
35
35
  "json-pointer": "^0.6.1",
36
- "nanoid": "^3.1.30",
37
- "pod6": "^0.0.44"
36
+ "nanoid": "3.1.30",
37
+ "pod6": "^0.0.48"
38
38
  },
39
39
  "devDependencies": {
40
40
  "@types/node": "^17.0.7",
@@ -2230,6 +2230,9 @@
2230
2230
  },
2231
2231
  "content": {
2232
2232
  "anyOf": [
2233
+ {
2234
+ "$ref": "#/definitions/RootBlock"
2235
+ },
2233
2236
  {
2234
2237
  "type": "array",
2235
2238
  "items": [
@@ -2230,6 +2230,9 @@
2230
2230
  },
2231
2231
  "content": {
2232
2232
  "anyOf": [
2233
+ {
2234
+ "$ref": "#/definitions/RootBlock"
2235
+ },
2233
2236
  {
2234
2237
  "type": "array",
2235
2238
  "items": [