@tickernelz/paperclip-pro-server 2026.926.2 → 2026.926.3

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.
Files changed (106) hide show
  1. package/dist/build-info.json +1 -1
  2. package/dist/routes/agents.d.ts.map +1 -1
  3. package/dist/routes/agents.js +18 -4
  4. package/dist/routes/agents.js.map +1 -1
  5. package/dist/routes/issues.d.ts.map +1 -1
  6. package/dist/routes/issues.js +7 -0
  7. package/dist/routes/issues.js.map +1 -1
  8. package/dist/routes/openapi.d.ts.map +1 -1
  9. package/dist/routes/openapi.js +21 -8
  10. package/dist/routes/openapi.js.map +1 -1
  11. package/dist/routes/paperclip-mcp.d.ts.map +1 -1
  12. package/dist/routes/paperclip-mcp.js +23 -2
  13. package/dist/routes/paperclip-mcp.js.map +1 -1
  14. package/dist/services/issues.d.ts +5 -0
  15. package/dist/services/issues.d.ts.map +1 -1
  16. package/dist/services/issues.js +15 -1
  17. package/dist/services/issues.js.map +1 -1
  18. package/node_modules/micromark/dev/lib/compile.d.ts.map +1 -1
  19. package/node_modules/micromark/dev/lib/compile.js +14 -4
  20. package/node_modules/micromark/dev/lib/create-tokenizer.d.ts.map +1 -1
  21. package/node_modules/micromark/dev/lib/create-tokenizer.js +7 -6
  22. package/node_modules/micromark/dev/lib/initialize/document.js +25 -21
  23. package/node_modules/micromark/dev/lib/initialize/text.d.ts.map +1 -1
  24. package/node_modules/micromark/dev/lib/initialize/text.js +10 -6
  25. package/node_modules/micromark/dev/lib/preprocess.d.ts.map +1 -1
  26. package/node_modules/micromark/dev/lib/preprocess.js +19 -21
  27. package/node_modules/micromark/lib/compile.d.ts.map +1 -1
  28. package/node_modules/micromark/lib/compile.js +37 -29
  29. package/node_modules/micromark/lib/create-tokenizer.d.ts.map +1 -1
  30. package/node_modules/micromark/lib/create-tokenizer.js +37 -35
  31. package/node_modules/micromark/lib/initialize/document.js +21 -13
  32. package/node_modules/micromark/lib/initialize/text.d.ts.map +1 -1
  33. package/node_modules/micromark/lib/initialize/text.js +7 -3
  34. package/node_modules/micromark/lib/preprocess.d.ts.map +1 -1
  35. package/node_modules/micromark/lib/preprocess.js +16 -19
  36. package/node_modules/micromark/package.json +2 -15
  37. package/node_modules/micromark-core-commonmark/dev/lib/attention.js +18 -24
  38. package/node_modules/micromark-core-commonmark/dev/lib/code-fenced.d.ts.map +1 -1
  39. package/node_modules/micromark-core-commonmark/dev/lib/code-fenced.js +1 -43
  40. package/node_modules/micromark-core-commonmark/dev/lib/code-indented.js +19 -43
  41. package/node_modules/micromark-core-commonmark/dev/lib/heading-atx.js +2 -6
  42. package/node_modules/micromark-core-commonmark/dev/lib/html-flow.d.ts.map +1 -1
  43. package/node_modules/micromark-core-commonmark/dev/lib/html-flow.js +2 -53
  44. package/node_modules/micromark-core-commonmark/dev/lib/label-end.js +14 -12
  45. package/node_modules/micromark-core-commonmark/dev/lib/label-start-image.d.ts.map +1 -1
  46. package/node_modules/micromark-core-commonmark/dev/lib/label-start-image.js +14 -5
  47. package/node_modules/micromark-core-commonmark/dev/lib/label-start-link.d.ts.map +1 -1
  48. package/node_modules/micromark-core-commonmark/dev/lib/label-start-link.js +14 -5
  49. package/node_modules/micromark-core-commonmark/dev/lib/partial-non-lazy-continuation.d.ts +4 -0
  50. package/node_modules/micromark-core-commonmark/dev/lib/partial-non-lazy-continuation.d.ts.map +1 -0
  51. package/node_modules/micromark-core-commonmark/dev/lib/partial-non-lazy-continuation.js +67 -0
  52. package/node_modules/micromark-core-commonmark/dev/lib/setext-underline.d.ts.map +1 -1
  53. package/node_modules/micromark-core-commonmark/dev/lib/setext-underline.js +8 -5
  54. package/node_modules/micromark-core-commonmark/lib/attention.js +14 -24
  55. package/node_modules/micromark-core-commonmark/lib/code-fenced.d.ts.map +1 -1
  56. package/node_modules/micromark-core-commonmark/lib/code-fenced.js +1 -39
  57. package/node_modules/micromark-core-commonmark/lib/code-indented.js +11 -29
  58. package/node_modules/micromark-core-commonmark/lib/heading-atx.js +2 -6
  59. package/node_modules/micromark-core-commonmark/lib/html-flow.d.ts.map +1 -1
  60. package/node_modules/micromark-core-commonmark/lib/html-flow.js +2 -51
  61. package/node_modules/micromark-core-commonmark/lib/label-end.js +11 -10
  62. package/node_modules/micromark-core-commonmark/lib/label-start-image.d.ts.map +1 -1
  63. package/node_modules/micromark-core-commonmark/lib/label-start-image.js +11 -3
  64. package/node_modules/micromark-core-commonmark/lib/label-start-link.d.ts.map +1 -1
  65. package/node_modules/micromark-core-commonmark/lib/label-start-link.js +11 -3
  66. package/node_modules/micromark-core-commonmark/lib/partial-non-lazy-continuation.d.ts +4 -0
  67. package/node_modules/micromark-core-commonmark/lib/partial-non-lazy-continuation.d.ts.map +1 -0
  68. package/node_modules/micromark-core-commonmark/lib/partial-non-lazy-continuation.js +61 -0
  69. package/node_modules/micromark-core-commonmark/lib/setext-underline.d.ts.map +1 -1
  70. package/node_modules/micromark-core-commonmark/lib/setext-underline.js +7 -5
  71. package/node_modules/micromark-core-commonmark/package.json +4 -16
  72. package/node_modules/micromark-factory-space/dev/index.d.ts +24 -1
  73. package/node_modules/micromark-factory-space/dev/index.d.ts.map +1 -1
  74. package/node_modules/micromark-factory-space/dev/index.js +58 -3
  75. package/node_modules/micromark-factory-space/index.d.ts +24 -1
  76. package/node_modules/micromark-factory-space/index.d.ts.map +1 -1
  77. package/node_modules/micromark-factory-space/index.js +55 -3
  78. package/node_modules/micromark-factory-space/package.json +1 -10
  79. package/node_modules/micromark-factory-space/readme.md +25 -25
  80. package/node_modules/micromark-util-edit-map/dev/index.d.ts +78 -0
  81. package/node_modules/micromark-util-edit-map/dev/index.d.ts.map +1 -0
  82. package/node_modules/micromark-util-edit-map/dev/index.js +237 -0
  83. package/node_modules/micromark-util-edit-map/index.d.ts +78 -0
  84. package/node_modules/micromark-util-edit-map/index.d.ts.map +1 -0
  85. package/node_modules/micromark-util-edit-map/index.js +225 -0
  86. package/node_modules/micromark-util-edit-map/license +22 -0
  87. package/node_modules/micromark-util-edit-map/package.json +48 -0
  88. package/node_modules/micromark-util-edit-map/readme.md +234 -0
  89. package/node_modules/micromark-util-types/index.d.ts +6 -3
  90. package/node_modules/micromark-util-types/package.json +2 -36
  91. package/node_modules/ws/lib/websocket.js +17 -3
  92. package/node_modules/ws/package.json +1 -1
  93. package/package.json +20 -20
  94. package/skills/paperclip/references/api-reference.md +2 -2
  95. package/ui-dist/assets/{Agents.production-5Tba_pW_.js → Agents.production-BGeWxNtU.js} +2 -2
  96. package/ui-dist/assets/{CompanyActivity.production-CONFWTe1.js → CompanyActivity.production-9gzPo_M_.js} +1 -1
  97. package/ui-dist/assets/{CompanyExport-CiOVCS4y.js → CompanyExport-CwCAJj2l.js} +1 -1
  98. package/ui-dist/assets/{CompanySkills.production-gv4ej6PI.js → CompanySkills.production-CiTG4koz.js} +1 -1
  99. package/ui-dist/assets/{Costs.production-C6rOIGNV.js → Costs.production-CFn4Pjkh.js} +1 -1
  100. package/ui-dist/assets/{OrgChart.production-DYeuFtY_.js → OrgChart.production-U1cB4YS_.js} +1 -1
  101. package/ui-dist/assets/{RoutineDetail.production-Bt4IHfSD.js → RoutineDetail.production-oI3mHlKM.js} +1 -1
  102. package/ui-dist/assets/{Routines.production-BBxSwg2A.js → Routines.production-sl1FiAYd.js} +1 -1
  103. package/ui-dist/assets/{definition-B49KTmLW.js → definition-DrGsWdJY.js} +1 -1
  104. package/ui-dist/assets/{index-BRCs87uX.js → index-cwemnRTq.js} +144 -144
  105. package/ui-dist/index.html +1 -1
  106. package/ui-dist/sw.js +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"setext-underline.d.ts","sourceRoot":"","sources":["setext-underline.js"],"names":[],"mappings":"AAgBA,wBAAwB;AACxB,8BADW,SAAS,CAKnB;+BAbS,sBAAsB"}
1
+ {"version":3,"file":"setext-underline.d.ts","sourceRoot":"","sources":["setext-underline.js"],"names":[],"mappings":"AAiBA,wBAAwB;AACxB,8BADW,SAAS,CAKnB;+BAdS,sBAAsB"}
@@ -11,6 +11,7 @@
11
11
 
12
12
  import { factorySpace } from 'micromark-factory-space';
13
13
  import { markdownLineEnding, markdownSpace } from 'micromark-util-character';
14
+ import { EditMap } from 'micromark-util-edit-map';
14
15
  /** @type {Construct} */
15
16
  export const setextUnderline = {
16
17
  name: 'setextUnderline',
@@ -20,7 +21,7 @@ export const setextUnderline = {
20
21
 
21
22
  /** @type {Resolver} */
22
23
  function resolveToSetextUnderline(events, context) {
23
- // To do: resolve like `markdown-rs`.
24
+ const editMap = new EditMap();
24
25
  let index = events.length;
25
26
  /** @type {number | undefined} */
26
27
  let content;
@@ -45,7 +46,7 @@ function resolveToSetextUnderline(events, context) {
45
46
  else {
46
47
  if (events[index][1].type === "content") {
47
48
  // Remove the content end (if needed we’ll add it later)
48
- events.splice(index, 1);
49
+ editMap.add(index, 1, []);
49
50
  }
50
51
  if (!definition && events[index][1].type === "definition") {
51
52
  definition = index;
@@ -68,8 +69,8 @@ function resolveToSetextUnderline(events, context) {
68
69
  // If we have definitions in the content, we’ll keep on having content,
69
70
  // but we need move it.
70
71
  if (definition) {
71
- events.splice(text, 0, ['enter', heading, context]);
72
- events.splice(definition + 1, 0, ['exit', events[content][1], context]);
72
+ editMap.add(text, 0, [['enter', heading, context]]);
73
+ editMap.add(definition + 1, 0, [['exit', events[content][1], context]]);
73
74
  events[content][1].end = {
74
75
  ...events[definition][1].end
75
76
  };
@@ -78,7 +79,8 @@ function resolveToSetextUnderline(events, context) {
78
79
  }
79
80
 
80
81
  // Add the heading exit at the end.
81
- events.push(['exit', heading, context]);
82
+ editMap.add(events.length, 0, [['exit', heading, context]]);
83
+ editMap.consume(events);
82
84
  return events;
83
85
  }
84
86
 
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "micromark-core-commonmark",
3
- "version": "2.0.3",
3
+ "version": "2.0.4",
4
4
  "description": "The CommonMark markdown constructs",
5
5
  "license": "MIT",
6
6
  "keywords": [
@@ -42,33 +42,21 @@
42
42
  "devlop": "^1.0.0",
43
43
  "micromark-factory-destination": "^2.0.0",
44
44
  "micromark-factory-label": "^2.0.0",
45
- "micromark-factory-space": "^2.0.0",
45
+ "micromark-factory-space": "^2.1.0",
46
46
  "micromark-factory-title": "^2.0.0",
47
47
  "micromark-factory-whitespace": "^2.0.0",
48
48
  "micromark-util-character": "^2.0.0",
49
49
  "micromark-util-chunked": "^2.0.0",
50
50
  "micromark-util-classify-character": "^2.0.0",
51
+ "micromark-util-edit-map": "^1.0.0",
51
52
  "micromark-util-html-tag-name": "^2.0.0",
52
53
  "micromark-util-normalize-identifier": "^2.0.0",
53
54
  "micromark-util-resolve-all": "^2.0.0",
54
55
  "micromark-util-subtokenize": "^2.0.0",
55
56
  "micromark-util-symbol": "^2.0.0",
56
- "micromark-util-types": "^2.0.0"
57
+ "micromark-util-types": "^2.0.3"
57
58
  },
58
59
  "scripts": {
59
60
  "build": "micromark-build"
60
- },
61
- "xo": {
62
- "envs": [
63
- "shared-node-browser"
64
- ],
65
- "prettier": true,
66
- "rules": {
67
- "logical-assignment-operators": "off",
68
- "max-depth": "off",
69
- "unicorn/no-this-assignment": "off",
70
- "unicorn/prefer-at": "off",
71
- "unicorn/prefer-code-point": "off"
72
- }
73
61
  }
74
62
  }
@@ -24,13 +24,36 @@
24
24
  * @param {State} ok
25
25
  * State switched to when successful.
26
26
  * @param {TokenType} type
27
- * Type (`' \t'`).
27
+ * Type of the whole whitespace.
28
28
  * @param {number | undefined} [max=Infinity]
29
29
  * Max (exclusive).
30
30
  * @returns {State}
31
31
  * Start state.
32
32
  */
33
33
  export function factorySpace(effects: Effects, ok: State, type: TokenType, max?: number | undefined): State;
34
+ /**
35
+ * Parse spaces and tabs, with a required minimum and maximum, matching
36
+ * `markdown-rs`’s `space_or_tab_min_max`.
37
+ *
38
+ * Unlike `factorySpace`, this can fail: `nok` is used when fewer than
39
+ * `min` spaces or tabs are found.
40
+ *
41
+ * @param {Effects} effects
42
+ * Context.
43
+ * @param {State} ok
44
+ * State switched to when successful.
45
+ * @param {State} nok
46
+ * State switched to when unsuccessful.
47
+ * @param {TokenType} type
48
+ * Type of the whole whitespace.
49
+ * @param {number} min
50
+ * Minimum allowed characters (inclusive).
51
+ * @param {number} max
52
+ * Maximum allowed characters (inclusive).
53
+ * @returns {State}
54
+ * Start state.
55
+ */
56
+ export function factorySpaceMinMax(effects: Effects, ok: State, nok: State, type: TokenType, min: number, max: number): State;
34
57
  import type { Effects } from 'micromark-util-types';
35
58
  import type { State } from 'micromark-util-types';
36
59
  import type { TokenType } from 'micromark-util-types';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.js"],"names":[],"mappings":"AAQA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,sCAXW,OAAO,MAEP,KAAK,QAEL,SAAS,QAET,MAAM,GAAG,SAAS,GAEhB,KAAK,CA6BjB;6BAjE2C,sBAAsB;2BAAtB,sBAAsB;+BAAtB,sBAAsB"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.js"],"names":[],"mappings":"AAQA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,sCAXW,OAAO,MAEP,KAAK,QAEL,SAAS,QAET,MAAM,GAAG,SAAS,GAEhB,KAAK,CA6BjB;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,4CAfW,OAAO,MAEP,KAAK,OAEL,KAAK,QAEL,SAAS,OAET,MAAM,OAEN,MAAM,GAEJ,KAAK,CAkCjB;6BAxH2C,sBAAsB;2BAAtB,sBAAsB;+BAAtB,sBAAsB"}
@@ -4,7 +4,7 @@
4
4
 
5
5
  import {markdownSpace} from 'micromark-util-character'
6
6
 
7
- // To do: implement `spaceOrTab`, `spaceOrTabMinMax`, `spaceOrTabWithOptions`.
7
+ // To do: implement `spaceOrTabWithOptions` (`connect`, `content`).
8
8
 
9
9
  /**
10
10
  * Parse spaces and tabs.
@@ -32,14 +32,14 @@ import {markdownSpace} from 'micromark-util-character'
32
32
  * @param {State} ok
33
33
  * State switched to when successful.
34
34
  * @param {TokenType} type
35
- * Type (`' \t'`).
35
+ * Type of the whole whitespace.
36
36
  * @param {number | undefined} [max=Infinity]
37
37
  * Max (exclusive).
38
38
  * @returns {State}
39
39
  * Start state.
40
40
  */
41
41
  export function factorySpace(effects, ok, type, max) {
42
- const limit = max ? max - 1 : Number.POSITIVE_INFINITY
42
+ const limit = max ? max - 1 : Infinity
43
43
  let size = 0
44
44
 
45
45
  return start
@@ -65,3 +65,58 @@ export function factorySpace(effects, ok, type, max) {
65
65
  return ok(code)
66
66
  }
67
67
  }
68
+
69
+ /**
70
+ * Parse spaces and tabs, with a required minimum and maximum, matching
71
+ * `markdown-rs`’s `space_or_tab_min_max`.
72
+ *
73
+ * Unlike `factorySpace`, this can fail: `nok` is used when fewer than
74
+ * `min` spaces or tabs are found.
75
+ *
76
+ * @param {Effects} effects
77
+ * Context.
78
+ * @param {State} ok
79
+ * State switched to when successful.
80
+ * @param {State} nok
81
+ * State switched to when unsuccessful.
82
+ * @param {TokenType} type
83
+ * Type of the whole whitespace.
84
+ * @param {number} min
85
+ * Minimum allowed characters (inclusive).
86
+ * @param {number} max
87
+ * Maximum allowed characters (inclusive).
88
+ * @returns {State}
89
+ * Start state.
90
+ */
91
+ export function factorySpaceMinMax(effects, ok, nok, type, min, max) {
92
+ let size = 0
93
+
94
+ return start
95
+
96
+ /** @type {State} */
97
+ function start(code) {
98
+ if (max > 0 && markdownSpace(code)) {
99
+ effects.enter(type)
100
+ return prefix(code)
101
+ }
102
+
103
+ return after(code)
104
+ }
105
+
106
+ /** @type {State} */
107
+ function prefix(code) {
108
+ if (markdownSpace(code) && size < max) {
109
+ effects.consume(code)
110
+ size++
111
+ return prefix
112
+ }
113
+
114
+ effects.exit(type)
115
+ return after(code)
116
+ }
117
+
118
+ /** @type {State} */
119
+ function after(code) {
120
+ return size >= min ? ok(code) : nok(code)
121
+ }
122
+ }
@@ -24,13 +24,36 @@
24
24
  * @param {State} ok
25
25
  * State switched to when successful.
26
26
  * @param {TokenType} type
27
- * Type (`' \t'`).
27
+ * Type of the whole whitespace.
28
28
  * @param {number | undefined} [max=Infinity]
29
29
  * Max (exclusive).
30
30
  * @returns {State}
31
31
  * Start state.
32
32
  */
33
33
  export function factorySpace(effects: Effects, ok: State, type: TokenType, max?: number | undefined): State;
34
+ /**
35
+ * Parse spaces and tabs, with a required minimum and maximum, matching
36
+ * `markdown-rs`’s `space_or_tab_min_max`.
37
+ *
38
+ * Unlike `factorySpace`, this can fail: `nok` is used when fewer than
39
+ * `min` spaces or tabs are found.
40
+ *
41
+ * @param {Effects} effects
42
+ * Context.
43
+ * @param {State} ok
44
+ * State switched to when successful.
45
+ * @param {State} nok
46
+ * State switched to when unsuccessful.
47
+ * @param {TokenType} type
48
+ * Type of the whole whitespace.
49
+ * @param {number} min
50
+ * Minimum allowed characters (inclusive).
51
+ * @param {number} max
52
+ * Maximum allowed characters (inclusive).
53
+ * @returns {State}
54
+ * Start state.
55
+ */
56
+ export function factorySpaceMinMax(effects: Effects, ok: State, nok: State, type: TokenType, min: number, max: number): State;
34
57
  import type { Effects } from 'micromark-util-types';
35
58
  import type { State } from 'micromark-util-types';
36
59
  import type { TokenType } from 'micromark-util-types';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.js"],"names":[],"mappings":"AAQA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,sCAXW,OAAO,MAEP,KAAK,QAEL,SAAS,QAET,MAAM,GAAG,SAAS,GAEhB,KAAK,CA6BjB;6BAjE2C,sBAAsB;2BAAtB,sBAAsB;+BAAtB,sBAAsB"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.js"],"names":[],"mappings":"AAQA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,sCAXW,OAAO,MAEP,KAAK,QAEL,SAAS,QAET,MAAM,GAAG,SAAS,GAEhB,KAAK,CA6BjB;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,4CAfW,OAAO,MAEP,KAAK,OAEL,KAAK,QAEL,SAAS,OAET,MAAM,OAEN,MAAM,GAEJ,KAAK,CAkCjB;6BAxH2C,sBAAsB;2BAAtB,sBAAsB;+BAAtB,sBAAsB"}
@@ -4,7 +4,7 @@
4
4
 
5
5
  import { markdownSpace } from 'micromark-util-character';
6
6
 
7
- // To do: implement `spaceOrTab`, `spaceOrTabMinMax`, `spaceOrTabWithOptions`.
7
+ // To do: implement `spaceOrTabWithOptions` (`connect`, `content`).
8
8
 
9
9
  /**
10
10
  * Parse spaces and tabs.
@@ -32,14 +32,14 @@ import { markdownSpace } from 'micromark-util-character';
32
32
  * @param {State} ok
33
33
  * State switched to when successful.
34
34
  * @param {TokenType} type
35
- * Type (`' \t'`).
35
+ * Type of the whole whitespace.
36
36
  * @param {number | undefined} [max=Infinity]
37
37
  * Max (exclusive).
38
38
  * @returns {State}
39
39
  * Start state.
40
40
  */
41
41
  export function factorySpace(effects, ok, type, max) {
42
- const limit = max ? max - 1 : Number.POSITIVE_INFINITY;
42
+ const limit = max ? max - 1 : Infinity;
43
43
  let size = 0;
44
44
  return start;
45
45
 
@@ -61,4 +61,56 @@ export function factorySpace(effects, ok, type, max) {
61
61
  effects.exit(type);
62
62
  return ok(code);
63
63
  }
64
+ }
65
+
66
+ /**
67
+ * Parse spaces and tabs, with a required minimum and maximum, matching
68
+ * `markdown-rs`’s `space_or_tab_min_max`.
69
+ *
70
+ * Unlike `factorySpace`, this can fail: `nok` is used when fewer than
71
+ * `min` spaces or tabs are found.
72
+ *
73
+ * @param {Effects} effects
74
+ * Context.
75
+ * @param {State} ok
76
+ * State switched to when successful.
77
+ * @param {State} nok
78
+ * State switched to when unsuccessful.
79
+ * @param {TokenType} type
80
+ * Type of the whole whitespace.
81
+ * @param {number} min
82
+ * Minimum allowed characters (inclusive).
83
+ * @param {number} max
84
+ * Maximum allowed characters (inclusive).
85
+ * @returns {State}
86
+ * Start state.
87
+ */
88
+ export function factorySpaceMinMax(effects, ok, nok, type, min, max) {
89
+ let size = 0;
90
+ return start;
91
+
92
+ /** @type {State} */
93
+ function start(code) {
94
+ if (max > 0 && markdownSpace(code)) {
95
+ effects.enter(type);
96
+ return prefix(code);
97
+ }
98
+ return after(code);
99
+ }
100
+
101
+ /** @type {State} */
102
+ function prefix(code) {
103
+ if (markdownSpace(code) && size < max) {
104
+ effects.consume(code);
105
+ size++;
106
+ return prefix;
107
+ }
108
+ effects.exit(type);
109
+ return after(code);
110
+ }
111
+
112
+ /** @type {State} */
113
+ function after(code) {
114
+ return size >= min ? ok(code) : nok(code);
115
+ }
64
116
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "micromark-factory-space",
3
- "version": "2.0.1",
3
+ "version": "2.1.0",
4
4
  "description": "micromark factory to parse markdown space (found in lots of places)",
5
5
  "license": "MIT",
6
6
  "keywords": [
@@ -42,14 +42,5 @@
42
42
  },
43
43
  "scripts": {
44
44
  "build": "micromark-build"
45
- },
46
- "xo": {
47
- "envs": [
48
- "shared-node-browser"
49
- ],
50
- "prettier": true,
51
- "rules": {
52
- "unicorn/prefer-code-point": "off"
53
- }
54
45
  }
55
46
  }
@@ -170,56 +170,56 @@ abide by its terms.
170
170
 
171
171
  <!-- Definitions -->
172
172
 
173
- [build-badge]: https://github.com/micromark/micromark/workflows/main/badge.svg
173
+ [api-factory-space]: #factoryspace
174
174
 
175
- [build]: https://github.com/micromark/micromark/actions
175
+ [author]: https://wooorm.com
176
176
 
177
- [coverage-badge]: https://img.shields.io/codecov/c/github/micromark/micromark.svg
177
+ [backers-badge]: https://opencollective.com/unified/backers/badge.svg
178
178
 
179
- [coverage]: https://codecov.io/github/micromark/micromark
179
+ [build]: https://github.com/micromark/micromark/actions
180
180
 
181
- [downloads-badge]: https://img.shields.io/npm/dm/micromark-factory-space.svg
181
+ [build-badge]: https://github.com/micromark/micromark/workflows/main/badge.svg
182
182
 
183
- [downloads]: https://www.npmjs.com/package/micromark-factory-space
183
+ [bundle-size]: https://bundlejs.com/?q=micromark-factory-space
184
184
 
185
185
  [bundle-size-badge]: https://img.shields.io/badge/dynamic/json?label=minzipped%20size&query=$.size.compressedSize&url=https://deno.bundlejs.com/?q=micromark-factory-space
186
186
 
187
- [bundle-size]: https://bundlejs.com/?q=micromark-factory-space
187
+ [chat]: https://github.com/micromark/micromark/discussions
188
188
 
189
- [sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg
189
+ [chat-badge]: https://img.shields.io/badge/chat-discussions-success.svg
190
190
 
191
- [backers-badge]: https://opencollective.com/unified/backers/badge.svg
191
+ [coc]: https://github.com/micromark/.github/blob/main/code-of-conduct.md
192
192
 
193
- [opencollective]: https://opencollective.com/unified
193
+ [contributing]: https://github.com/micromark/.github/blob/main/contributing.md
194
194
 
195
- [npm]: https://docs.npmjs.com/cli/install
195
+ [coverage]: https://codecov.io/github/micromark/micromark
196
+
197
+ [coverage-badge]: https://img.shields.io/codecov/c/github/micromark/micromark.svg
198
+
199
+ [downloads]: https://www.npmjs.com/package/micromark-factory-space
200
+
201
+ [downloads-badge]: https://img.shields.io/npm/dm/micromark-factory-space.svg
196
202
 
197
203
  [esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c
198
204
 
199
205
  [esmsh]: https://esm.sh
200
206
 
201
- [chat-badge]: https://img.shields.io/badge/chat-discussions-success.svg
202
-
203
- [chat]: https://github.com/micromark/micromark/discussions
207
+ [health]: https://github.com/micromark/.github
204
208
 
205
209
  [license]: https://github.com/micromark/micromark/blob/main/license
206
210
 
207
- [author]: https://wooorm.com
211
+ [markdown-space]: https://github.com/micromark/micromark/tree/main/packages/micromark-util-character#markdownspacecode
208
212
 
209
- [health]: https://github.com/micromark/.github
213
+ [micromark]: https://github.com/micromark/micromark
210
214
 
211
- [securitymd]: https://github.com/micromark/.github/blob/main/security.md
215
+ [npm]: https://docs.npmjs.com/cli/install
212
216
 
213
- [contributing]: https://github.com/micromark/.github/blob/main/contributing.md
217
+ [opencollective]: https://opencollective.com/unified
214
218
 
215
- [support]: https://github.com/micromark/.github/blob/main/support.md
219
+ [securitymd]: https://github.com/micromark/.github/blob/main/security.md
216
220
 
217
- [coc]: https://github.com/micromark/.github/blob/main/code-of-conduct.md
221
+ [sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg
218
222
 
219
- [markdown-space]: https://github.com/micromark/micromark/tree/main/packages/micromark-util-character#markdownspacecode
223
+ [support]: https://github.com/micromark/.github/blob/main/support.md
220
224
 
221
225
  [typescript]: https://www.typescriptlang.org
222
-
223
- [micromark]: https://github.com/micromark/micromark
224
-
225
- [api-factory-space]: #factoryspace
@@ -0,0 +1,78 @@
1
+ /**
2
+ * @import {Event} from 'micromark-util-types'
3
+ */
4
+ /**
5
+ * @typedef {[number, number, Array<Event>]} Change
6
+ * @typedef {[number, number, number]} Jump
7
+ */
8
+ /**
9
+ * Tracks a bunch of edits.
10
+ *
11
+ * Port of `edit_map.rs` from `markdown-rs`:
12
+ * <https://github.com/wooorm/markdown-rs/blob/1506572f/src/util/edit_map.rs>.
13
+ *
14
+ * Deal with several changes in events, batching them together.
15
+ *
16
+ * Preferably, changes should be kept to a minimum.
17
+ * Sometimes, it’s needed to change the list of events, because parsing can be
18
+ * messy, and it helps to expose a cleaner interface of events to the compiler
19
+ * and other users.
20
+ * It can also help to merge many adjacent similar events.
21
+ * And, in other cases, it’s needed to parse subcontent: pass some events
22
+ * through another tokenizer and inject the result.
23
+ */
24
+ export class EditMap {
25
+ /**
26
+ * Changes by index, so `add` does not need to scan `map` (which is
27
+ * quadratic for documents with many edits at different places).
28
+ *
29
+ * @type {Map<number, Change>}
30
+ */
31
+ index: Map<number, Change>;
32
+ /**
33
+ * Record of changes.
34
+ *
35
+ * @type {Array<Change>}
36
+ */
37
+ map: Array<Change>;
38
+ /**
39
+ * Create an edit: a remove and/or add at a certain place.
40
+ *
41
+ * @param {number} index
42
+ * Index at which to apply the edit.
43
+ * @param {number} remove
44
+ * Count of items to remove at the index.
45
+ * @param {Array<Event>} add
46
+ * Items to add at the index.
47
+ * @returns {undefined}
48
+ * Nothing.
49
+ */
50
+ add(index: number, remove: number, add: Array<Event>): undefined;
51
+ /**
52
+ * Create an edit: but insert `add` before existing additions, instead of
53
+ * after them.
54
+ *
55
+ * @param {number} index
56
+ * Index at which to apply the edit.
57
+ * @param {number} remove
58
+ * Count of items to remove at the index.
59
+ * @param {Array<Event>} add
60
+ * Items to add at the index.
61
+ * @returns {undefined}
62
+ * Nothing.
63
+ */
64
+ addBefore(index: number, remove: number, add: Array<Event>): undefined;
65
+ /**
66
+ * Done, change the events.
67
+ *
68
+ * @param {Array<Event>} events
69
+ * List of events to apply the edits to.
70
+ * @returns {undefined}
71
+ * Nothing.
72
+ */
73
+ consume(events: Array<Event>): undefined;
74
+ }
75
+ export type Change = [number, number, Array<Event>];
76
+ export type Jump = [number, number, number];
77
+ import type { Event } from 'micromark-util-types';
78
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.js"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;;GAGG;AAEH;;;;;;;;;;;;;;;GAeG;AACH;IAQI;;;;;OAKG;IACH,OAFU,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAEP;IAEtB;;;;OAIG;IACH,KAFU,KAAK,CAAC,MAAM,CAAC,CAEV;IAGf;;;;;;;;;;;OAWG;IACH,WATW,MAAM,UAEN,MAAM,OAEN,KAAK,CAAC,KAAK,CAAC,GAEV,SAAS,CAKrB;IAED;;;;;;;;;;;;OAYG;IACH,iBATW,MAAM,UAEN,MAAM,OAEN,KAAK,CAAC,KAAK,CAAC,GAEV,SAAS,CAKrB;IAED;;;;;;;OAOG;IACH,gBALW,KAAK,CAAC,KAAK,CAAC,GAEV,SAAS,CA4DrB;CACF;qBA/IY,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC;mBAC9B,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC;2BALb,sBAAsB"}