@uiw/react-md-editor 3.20.6 → 3.20.7

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/mdeditor.js CHANGED
@@ -19842,8 +19842,13 @@ function looksLikeAVFileValue(value) {
19842
19842
  * Configuration (optional).
19843
19843
  * @property {boolean | null | undefined} [includeImageAlt=true]
19844
19844
  * Whether to use `alt` for `image`s.
19845
+ * @property {boolean | null | undefined} [includeHtml=true]
19846
+ * Whether to use `value` of HTML.
19845
19847
  */
19846
19848
 
19849
+ /** @type {Options} */
19850
+ const emptyOptions = {}
19851
+
19847
19852
  /**
19848
19853
  * Get the text content of a node or list of nodes.
19849
19854
  *
@@ -19858,11 +19863,15 @@ function looksLikeAVFileValue(value) {
19858
19863
  * Serialized `value`.
19859
19864
  */
19860
19865
  function lib_toString(value, options) {
19861
- const includeImageAlt = (options || {}).includeImageAlt
19862
- return one(
19863
- value,
19864
- typeof includeImageAlt === 'boolean' ? includeImageAlt : true
19865
- )
19866
+ const settings = options || emptyOptions
19867
+ const includeImageAlt =
19868
+ typeof settings.includeImageAlt === 'boolean'
19869
+ ? settings.includeImageAlt
19870
+ : true
19871
+ const includeHtml =
19872
+ typeof settings.includeHtml === 'boolean' ? settings.includeHtml : true
19873
+
19874
+ return one(value, includeImageAlt, includeHtml)
19866
19875
  }
19867
19876
 
19868
19877
  /**
@@ -19872,18 +19881,31 @@ function lib_toString(value, options) {
19872
19881
  * Thing to serialize.
19873
19882
  * @param {boolean} includeImageAlt
19874
19883
  * Include image `alt`s.
19884
+ * @param {boolean} includeHtml
19885
+ * Include HTML.
19875
19886
  * @returns {string}
19876
19887
  * Serialized node.
19877
19888
  */
19878
- function one(value, includeImageAlt) {
19879
- return (
19880
- (node(value) &&
19881
- (('value' in value && value.value) ||
19882
- (includeImageAlt && 'alt' in value && value.alt) ||
19883
- ('children' in value && lib_all(value.children, includeImageAlt)))) ||
19884
- (Array.isArray(value) && lib_all(value, includeImageAlt)) ||
19885
- ''
19886
- )
19889
+ function one(value, includeImageAlt, includeHtml) {
19890
+ if (node(value)) {
19891
+ if ('value' in value) {
19892
+ return value.type === 'html' && !includeHtml ? '' : value.value
19893
+ }
19894
+
19895
+ if (includeImageAlt && 'alt' in value && value.alt) {
19896
+ return value.alt
19897
+ }
19898
+
19899
+ if ('children' in value) {
19900
+ return lib_all(value.children, includeImageAlt, includeHtml)
19901
+ }
19902
+ }
19903
+
19904
+ if (Array.isArray(value)) {
19905
+ return lib_all(value, includeImageAlt, includeHtml)
19906
+ }
19907
+
19908
+ return ''
19887
19909
  }
19888
19910
 
19889
19911
  /**
@@ -19893,16 +19915,18 @@ function one(value, includeImageAlt) {
19893
19915
  * Thing to serialize.
19894
19916
  * @param {boolean} includeImageAlt
19895
19917
  * Include image `alt`s.
19918
+ * @param {boolean} includeHtml
19919
+ * Include HTML.
19896
19920
  * @returns {string}
19897
19921
  * Serialized nodes.
19898
19922
  */
19899
- function lib_all(values, includeImageAlt) {
19923
+ function lib_all(values, includeImageAlt, includeHtml) {
19900
19924
  /** @type {Array<string>} */
19901
19925
  const result = []
19902
19926
  let index = -1
19903
19927
 
19904
19928
  while (++index < values.length) {
19905
- result[index] = one(values[index], includeImageAlt)
19929
+ result[index] = one(values[index], includeImageAlt, includeHtml)
19906
19930
  }
19907
19931
 
19908
19932
  return result.join('')
@@ -33957,26 +33981,38 @@ function previousUnbalanced(events) {
33957
33981
 
33958
33982
  ;// CONCATENATED MODULE: ../node_modules/micromark-extension-gfm-footnote/lib/syntax.js
33959
33983
  /**
33984
+ * @typedef {import('micromark-util-types').Event} Event
33985
+ * @typedef {import('micromark-util-types').Exiter} Exiter
33960
33986
  * @typedef {import('micromark-util-types').Extension} Extension
33961
33987
  * @typedef {import('micromark-util-types').Resolver} Resolver
33988
+ * @typedef {import('micromark-util-types').State} State
33962
33989
  * @typedef {import('micromark-util-types').Token} Token
33990
+ * @typedef {import('micromark-util-types').TokenizeContext} TokenizeContext
33963
33991
  * @typedef {import('micromark-util-types').Tokenizer} Tokenizer
33964
- * @typedef {import('micromark-util-types').Exiter} Exiter
33965
- * @typedef {import('micromark-util-types').State} State
33966
- * @typedef {import('micromark-util-types').Event} Event
33967
33992
  */
33968
33993
 
33969
33994
 
33970
33995
 
33971
33996
 
33997
+
33972
33998
  const indent = {
33973
33999
  tokenize: syntax_tokenizeIndent,
33974
34000
  partial: true
33975
34001
  }
34002
+
34003
+ // To do: micromark should support a `_hiddenGfmFootnoteSupport`, which only
34004
+ // affects label start (image).
34005
+ // That will let us drop `tokenizePotentialGfmFootnote*`.
34006
+ // It currently has a `_hiddenFootnoteSupport`, which affects that and more.
34007
+ // That can be removed when `micromark-extension-footnote` is archived.
34008
+
33976
34009
  /**
34010
+ * Create an extension for `micromark` to enable GFM footnote syntax.
34011
+ *
33977
34012
  * @returns {Extension}
34013
+ * Extension for `micromark` that can be passed in `extensions` to
34014
+ * enable GFM footnote syntax.
33978
34015
  */
33979
-
33980
34016
  function gfmFootnote() {
33981
34017
  /** @type {Extension} */
33982
34018
  return {
@@ -34001,27 +34037,30 @@ function gfmFootnote() {
34001
34037
  }
34002
34038
  }
34003
34039
  }
34004
- /** @type {Tokenizer} */
34005
34040
 
34041
+ // To do: remove after micromark update.
34042
+ /**
34043
+ * @this {TokenizeContext}
34044
+ * @type {Tokenizer}
34045
+ */
34006
34046
  function tokenizePotentialGfmFootnoteCall(effects, ok, nok) {
34007
34047
  const self = this
34008
34048
  let index = self.events.length
34009
34049
  /** @type {Array<string>} */
34010
34050
  // @ts-expect-error It’s fine!
34011
-
34012
34051
  const defined = self.parser.gfmFootnotes || (self.parser.gfmFootnotes = [])
34013
34052
  /** @type {Token} */
34053
+ let labelStart
34014
34054
 
34015
- let labelStart // Find an opening.
34016
-
34055
+ // Find an opening.
34017
34056
  while (index--) {
34018
34057
  const token = self.events[index][1]
34019
-
34020
34058
  if (token.type === 'labelImage') {
34021
34059
  labelStart = token
34022
34060
  break
34023
- } // Exit if we’ve walked far enough.
34061
+ }
34024
34062
 
34063
+ // Exit if we’ve walked far enough.
34025
34064
  if (
34026
34065
  token.type === 'gfmFootnoteCall' ||
34027
34066
  token.type === 'labelLink' ||
@@ -34032,40 +34071,39 @@ function tokenizePotentialGfmFootnoteCall(effects, ok, nok) {
34032
34071
  break
34033
34072
  }
34034
34073
  }
34035
-
34036
34074
  return start
34037
- /** @type {State} */
34038
34075
 
34076
+ /**
34077
+ * @type {State}
34078
+ */
34039
34079
  function start(code) {
34040
34080
  if (!labelStart || !labelStart._balanced) {
34041
34081
  return nok(code)
34042
34082
  }
34043
-
34044
34083
  const id = normalizeIdentifier(
34045
34084
  self.sliceSerialize({
34046
34085
  start: labelStart.end,
34047
34086
  end: self.now()
34048
34087
  })
34049
34088
  )
34050
-
34051
- if (id.charCodeAt(0) !== 94 || !defined.includes(id.slice(1))) {
34089
+ if (id.codePointAt(0) !== 94 || !defined.includes(id.slice(1))) {
34052
34090
  return nok(code)
34053
34091
  }
34054
-
34055
34092
  effects.enter('gfmFootnoteCallLabelMarker')
34056
34093
  effects.consume(code)
34057
34094
  effects.exit('gfmFootnoteCallLabelMarker')
34058
34095
  return ok(code)
34059
34096
  }
34060
34097
  }
34061
- /** @type {Resolver} */
34062
34098
 
34099
+ // To do: remove after micromark update.
34100
+ /** @type {Resolver} */
34063
34101
  function resolveToPotentialGfmFootnoteCall(events, context) {
34064
34102
  let index = events.length
34065
- /** @type {Token|undefined} */
34066
-
34067
- let labelStart // Find an opening.
34103
+ /** @type {Token | undefined} */
34104
+ let labelStart
34068
34105
 
34106
+ // Find an opening.
34069
34107
  while (index--) {
34070
34108
  if (
34071
34109
  events[index][1].type === 'labelImage' &&
@@ -34075,23 +34113,23 @@ function resolveToPotentialGfmFootnoteCall(events, context) {
34075
34113
  break
34076
34114
  }
34077
34115
  }
34078
-
34079
34116
  // Change the `labelImageMarker` to a `data`.
34080
34117
  events[index + 1][1].type = 'data'
34081
- events[index + 3][1].type = 'gfmFootnoteCallLabelMarker' // The whole (without `!`):
34118
+ events[index + 3][1].type = 'gfmFootnoteCallLabelMarker'
34082
34119
 
34120
+ // The whole (without `!`):
34083
34121
  const call = {
34084
34122
  type: 'gfmFootnoteCall',
34085
34123
  start: Object.assign({}, events[index + 3][1].start),
34086
34124
  end: Object.assign({}, events[events.length - 1][1].end)
34087
- } // The `^` marker
34088
-
34125
+ }
34126
+ // The `^` marker
34089
34127
  const marker = {
34090
34128
  type: 'gfmFootnoteCallMarker',
34091
34129
  start: Object.assign({}, events[index + 3][1].end),
34092
34130
  end: Object.assign({}, events[index + 3][1].end)
34093
- } // Increment the end 1 character.
34094
-
34131
+ }
34132
+ // Increment the end 1 character.
34095
34133
  marker.end.column++
34096
34134
  marker.end.offset++
34097
34135
  marker.end._bufferIndex++
@@ -34106,21 +34144,25 @@ function resolveToPotentialGfmFootnoteCall(events, context) {
34106
34144
  start: Object.assign({}, string.start),
34107
34145
  end: Object.assign({}, string.end)
34108
34146
  }
34109
- /** @type {Array<Event>} */
34110
34147
 
34148
+ /** @type {Array<Event>} */
34111
34149
  const replacement = [
34112
34150
  // Take the `labelImageMarker` (now `data`, the `!`)
34113
34151
  events[index + 1],
34114
34152
  events[index + 2],
34115
- ['enter', call, context], // The `[`
34153
+ ['enter', call, context],
34154
+ // The `[`
34116
34155
  events[index + 3],
34117
- events[index + 4], // The `^`.
34156
+ events[index + 4],
34157
+ // The `^`.
34118
34158
  ['enter', marker, context],
34119
- ['exit', marker, context], // Everything in between.
34159
+ ['exit', marker, context],
34160
+ // Everything in between.
34120
34161
  ['enter', string, context],
34121
34162
  ['enter', chunk, context],
34122
34163
  ['exit', chunk, context],
34123
- ['exit', string, context], // The ending (`]`, properly parsed and labelled).
34164
+ ['exit', string, context],
34165
+ // The ending (`]`, properly parsed and labelled).
34124
34166
  events[events.length - 2],
34125
34167
  events[events.length - 1],
34126
34168
  ['exit', call, context]
@@ -34128,21 +34170,37 @@ function resolveToPotentialGfmFootnoteCall(events, context) {
34128
34170
  events.splice(index, events.length - index + 1, ...replacement)
34129
34171
  return events
34130
34172
  }
34131
- /** @type {Tokenizer} */
34132
34173
 
34174
+ /**
34175
+ * @this {TokenizeContext}
34176
+ * @type {Tokenizer}
34177
+ */
34133
34178
  function tokenizeGfmFootnoteCall(effects, ok, nok) {
34134
34179
  const self = this
34135
34180
  /** @type {Array<string>} */
34136
34181
  // @ts-expect-error It’s fine!
34137
-
34138
34182
  const defined = self.parser.gfmFootnotes || (self.parser.gfmFootnotes = [])
34139
34183
  let size = 0
34140
34184
  /** @type {boolean} */
34141
-
34142
34185
  let data
34186
+
34187
+ // Note: the implementation of `markdown-rs` is different, because it houses
34188
+ // core *and* extensions in one project.
34189
+ // Therefore, it can include footnote logic inside `label-end`.
34190
+ // We can’t do that, but luckily, we can parse footnotes in a simpler way than
34191
+ // needed for labels.
34143
34192
  return start
34144
- /** @type {State} */
34145
34193
 
34194
+ /**
34195
+ * Start of footnote label.
34196
+ *
34197
+ * ```markdown
34198
+ * > | a [^b] c
34199
+ * ^
34200
+ * ```
34201
+ *
34202
+ * @type {State}
34203
+ */
34146
34204
  function start(code) {
34147
34205
  effects.enter('gfmFootnoteCall')
34148
34206
  effects.enter('gfmFootnoteCallLabelMarker')
@@ -34150,8 +34208,17 @@ function tokenizeGfmFootnoteCall(effects, ok, nok) {
34150
34208
  effects.exit('gfmFootnoteCallLabelMarker')
34151
34209
  return callStart
34152
34210
  }
34153
- /** @type {State} */
34154
34211
 
34212
+ /**
34213
+ * After `[`, at `^`.
34214
+ *
34215
+ * ```markdown
34216
+ * > | a [^b] c
34217
+ * ^
34218
+ * ```
34219
+ *
34220
+ * @type {State}
34221
+ */
34155
34222
  function callStart(code) {
34156
34223
  if (code !== 94) return nok(code)
34157
34224
  effects.enter('gfmFootnoteCallMarker')
@@ -34161,112 +34228,158 @@ function tokenizeGfmFootnoteCall(effects, ok, nok) {
34161
34228
  effects.enter('chunkString').contentType = 'string'
34162
34229
  return callData
34163
34230
  }
34164
- /** @type {State} */
34165
34231
 
34232
+ /**
34233
+ * In label.
34234
+ *
34235
+ * ```markdown
34236
+ * > | a [^b] c
34237
+ * ^
34238
+ * ```
34239
+ *
34240
+ * @type {State}
34241
+ */
34166
34242
  function callData(code) {
34167
- /** @type {Token} */
34168
- let token
34169
-
34170
- if (code === null || code === 91 || size++ > 999) {
34243
+ if (
34244
+ // Too long.
34245
+ size > 999 ||
34246
+ // Closing brace with nothing.
34247
+ (code === 93 && !data) ||
34248
+ // Space or tab is not supported by GFM for some reason.
34249
+ // `\n` and `[` not being supported makes sense.
34250
+ code === null ||
34251
+ code === 91 ||
34252
+ markdownLineEndingOrSpace(code)
34253
+ ) {
34171
34254
  return nok(code)
34172
34255
  }
34173
-
34174
34256
  if (code === 93) {
34175
- if (!data) {
34257
+ effects.exit('chunkString')
34258
+ const token = effects.exit('gfmFootnoteCallString')
34259
+ if (!defined.includes(normalizeIdentifier(self.sliceSerialize(token)))) {
34176
34260
  return nok(code)
34177
34261
  }
34178
-
34179
- effects.exit('chunkString')
34180
- token = effects.exit('gfmFootnoteCallString')
34181
- return defined.includes(normalizeIdentifier(self.sliceSerialize(token)))
34182
- ? end(code)
34183
- : nok(code)
34262
+ effects.enter('gfmFootnoteCallLabelMarker')
34263
+ effects.consume(code)
34264
+ effects.exit('gfmFootnoteCallLabelMarker')
34265
+ effects.exit('gfmFootnoteCall')
34266
+ return ok
34184
34267
  }
34185
-
34186
- effects.consume(code)
34187
-
34188
34268
  if (!markdownLineEndingOrSpace(code)) {
34189
34269
  data = true
34190
34270
  }
34191
-
34271
+ size++
34272
+ effects.consume(code)
34192
34273
  return code === 92 ? callEscape : callData
34193
34274
  }
34194
- /** @type {State} */
34195
34275
 
34276
+ /**
34277
+ * On character after escape.
34278
+ *
34279
+ * ```markdown
34280
+ * > | a [^b\c] d
34281
+ * ^
34282
+ * ```
34283
+ *
34284
+ * @type {State}
34285
+ */
34196
34286
  function callEscape(code) {
34197
34287
  if (code === 91 || code === 92 || code === 93) {
34198
34288
  effects.consume(code)
34199
34289
  size++
34200
34290
  return callData
34201
34291
  }
34202
-
34203
34292
  return callData(code)
34204
34293
  }
34205
- /** @type {State} */
34206
-
34207
- function end(code) {
34208
- effects.enter('gfmFootnoteCallLabelMarker')
34209
- effects.consume(code)
34210
- effects.exit('gfmFootnoteCallLabelMarker')
34211
- effects.exit('gfmFootnoteCall')
34212
- return ok
34213
- }
34214
34294
  }
34215
- /** @type {Tokenizer} */
34216
34295
 
34296
+ /**
34297
+ * @this {TokenizeContext}
34298
+ * @type {Tokenizer}
34299
+ */
34217
34300
  function tokenizeDefinitionStart(effects, ok, nok) {
34218
34301
  const self = this
34219
34302
  /** @type {Array<string>} */
34220
34303
  // @ts-expect-error It’s fine!
34221
-
34222
34304
  const defined = self.parser.gfmFootnotes || (self.parser.gfmFootnotes = [])
34223
34305
  /** @type {string} */
34224
-
34225
34306
  let identifier
34226
34307
  let size = 0
34227
- /** @type {boolean|undefined} */
34228
-
34308
+ /** @type {boolean | undefined} */
34229
34309
  let data
34230
34310
  return start
34231
- /** @type {State} */
34232
34311
 
34312
+ /**
34313
+ * Start of GFM footnote definition.
34314
+ *
34315
+ * ```markdown
34316
+ * > | [^a]: b
34317
+ * ^
34318
+ * ```
34319
+ *
34320
+ * @type {State}
34321
+ */
34233
34322
  function start(code) {
34234
34323
  effects.enter('gfmFootnoteDefinition')._container = true
34235
34324
  effects.enter('gfmFootnoteDefinitionLabel')
34236
34325
  effects.enter('gfmFootnoteDefinitionLabelMarker')
34237
34326
  effects.consume(code)
34238
34327
  effects.exit('gfmFootnoteDefinitionLabelMarker')
34239
- return labelStart
34328
+ return labelAtMarker
34240
34329
  }
34241
- /** @type {State} */
34242
34330
 
34243
- function labelStart(code) {
34331
+ /**
34332
+ * In label, at caret.
34333
+ *
34334
+ * ```markdown
34335
+ * > | [^a]: b
34336
+ * ^
34337
+ * ```
34338
+ *
34339
+ * @type {State}
34340
+ */
34341
+ function labelAtMarker(code) {
34244
34342
  if (code === 94) {
34245
34343
  effects.enter('gfmFootnoteDefinitionMarker')
34246
34344
  effects.consume(code)
34247
34345
  effects.exit('gfmFootnoteDefinitionMarker')
34248
34346
  effects.enter('gfmFootnoteDefinitionLabelString')
34249
- return atBreak
34347
+ effects.enter('chunkString').contentType = 'string'
34348
+ return labelInside
34250
34349
  }
34251
-
34252
34350
  return nok(code)
34253
34351
  }
34254
- /** @type {State} */
34255
34352
 
34256
- function atBreak(code) {
34257
- /** @type {Token} */
34258
- let token
34259
-
34260
- if (code === null || code === 91 || size > 999) {
34353
+ /**
34354
+ * In label.
34355
+ *
34356
+ * > 👉 **Note**: `cmark-gfm` prevents whitespace from occurring in footnote
34357
+ * > definition labels.
34358
+ *
34359
+ * ```markdown
34360
+ * > | [^a]: b
34361
+ * ^
34362
+ * ```
34363
+ *
34364
+ * @type {State}
34365
+ */
34366
+ function labelInside(code) {
34367
+ if (
34368
+ // Too long.
34369
+ size > 999 ||
34370
+ // Closing brace with nothing.
34371
+ (code === 93 && !data) ||
34372
+ // Space or tab is not supported by GFM for some reason.
34373
+ // `\n` and `[` not being supported makes sense.
34374
+ code === null ||
34375
+ code === 91 ||
34376
+ markdownLineEndingOrSpace(code)
34377
+ ) {
34261
34378
  return nok(code)
34262
34379
  }
34263
-
34264
34380
  if (code === 93) {
34265
- if (!data) {
34266
- return nok(code)
34267
- }
34268
-
34269
- token = effects.exit('gfmFootnoteDefinitionLabelString')
34381
+ effects.exit('chunkString')
34382
+ const token = effects.exit('gfmFootnoteDefinitionLabelString')
34270
34383
  identifier = normalizeIdentifier(self.sliceSerialize(token))
34271
34384
  effects.enter('gfmFootnoteDefinitionLabelMarker')
34272
34385
  effects.consume(code)
@@ -34274,89 +34387,109 @@ function tokenizeDefinitionStart(effects, ok, nok) {
34274
34387
  effects.exit('gfmFootnoteDefinitionLabel')
34275
34388
  return labelAfter
34276
34389
  }
34277
-
34278
- if (markdownLineEnding(code)) {
34279
- effects.enter('lineEnding')
34280
- effects.consume(code)
34281
- effects.exit('lineEnding')
34282
- size++
34283
- return atBreak
34284
- }
34285
-
34286
- effects.enter('chunkString').contentType = 'string'
34287
- return label(code)
34288
- }
34289
- /** @type {State} */
34290
-
34291
- function label(code) {
34292
- if (
34293
- code === null ||
34294
- markdownLineEnding(code) ||
34295
- code === 91 ||
34296
- code === 93 ||
34297
- size > 999
34298
- ) {
34299
- effects.exit('chunkString')
34300
- return atBreak(code)
34301
- }
34302
-
34303
34390
  if (!markdownLineEndingOrSpace(code)) {
34304
34391
  data = true
34305
34392
  }
34306
-
34307
34393
  size++
34308
34394
  effects.consume(code)
34309
- return code === 92 ? labelEscape : label
34395
+ return code === 92 ? labelEscape : labelInside
34310
34396
  }
34311
- /** @type {State} */
34312
34397
 
34398
+ /**
34399
+ * After `\`, at a special character.
34400
+ *
34401
+ * > 👉 **Note**: `cmark-gfm` currently does not support escaped brackets:
34402
+ * > <https://github.com/github/cmark-gfm/issues/240>
34403
+ *
34404
+ * ```markdown
34405
+ * > | [^a\*b]: c
34406
+ * ^
34407
+ * ```
34408
+ *
34409
+ * @type {State}
34410
+ */
34313
34411
  function labelEscape(code) {
34314
34412
  if (code === 91 || code === 92 || code === 93) {
34315
34413
  effects.consume(code)
34316
34414
  size++
34317
- return label
34415
+ return labelInside
34318
34416
  }
34319
-
34320
- return label(code)
34417
+ return labelInside(code)
34321
34418
  }
34322
- /** @type {State} */
34323
34419
 
34420
+ /**
34421
+ * After definition label.
34422
+ *
34423
+ * ```markdown
34424
+ * > | [^a]: b
34425
+ * ^
34426
+ * ```
34427
+ *
34428
+ * @type {State}
34429
+ */
34324
34430
  function labelAfter(code) {
34325
34431
  if (code === 58) {
34326
34432
  effects.enter('definitionMarker')
34327
34433
  effects.consume(code)
34328
- effects.exit('definitionMarker') // Any whitespace after the marker is eaten, forming indented code
34434
+ effects.exit('definitionMarker')
34435
+ if (!defined.includes(identifier)) {
34436
+ defined.push(identifier)
34437
+ }
34438
+
34439
+ // Any whitespace after the marker is eaten, forming indented code
34329
34440
  // is not possible.
34330
34441
  // No space is also fine, just like a block quote marker.
34331
-
34332
- return factorySpace(effects, done, 'gfmFootnoteDefinitionWhitespace')
34442
+ return factorySpace(
34443
+ effects,
34444
+ whitespaceAfter,
34445
+ 'gfmFootnoteDefinitionWhitespace'
34446
+ )
34333
34447
  }
34334
-
34335
34448
  return nok(code)
34336
34449
  }
34337
- /** @type {State} */
34338
-
34339
- function done(code) {
34340
- if (!defined.includes(identifier)) {
34341
- defined.push(identifier)
34342
- }
34343
34450
 
34451
+ /**
34452
+ * After definition prefix.
34453
+ *
34454
+ * ```markdown
34455
+ * > | [^a]: b
34456
+ * ^
34457
+ * ```
34458
+ *
34459
+ * @type {State}
34460
+ */
34461
+ function whitespaceAfter(code) {
34462
+ // `markdown-rs` has a wrapping token for the prefix that is closed here.
34344
34463
  return ok(code)
34345
34464
  }
34346
34465
  }
34347
- /** @type {Tokenizer} */
34348
34466
 
34467
+ /**
34468
+ * @this {TokenizeContext}
34469
+ * @type {Tokenizer}
34470
+ */
34349
34471
  function tokenizeDefinitionContinuation(effects, ok, nok) {
34472
+ /// Start of footnote definition continuation.
34473
+ ///
34474
+ /// ```markdown
34475
+ /// | [^a]: b
34476
+ /// > | c
34477
+ /// ^
34478
+ /// ```
34479
+ //
34350
34480
  // Either a blank line, which is okay, or an indented thing.
34351
34481
  return effects.check(blankLine, ok, effects.attempt(indent, ok, nok))
34352
34482
  }
34353
- /** @type {Exiter} */
34354
34483
 
34484
+ /** @type {Exiter} */
34355
34485
  function gfmFootnoteDefinitionEnd(effects) {
34356
34486
  effects.exit('gfmFootnoteDefinition')
34357
34487
  }
34358
- /** @type {Tokenizer} */
34359
34488
 
34489
+ /**
34490
+ * @this {TokenizeContext}
34491
+ * @type {Tokenizer}
34492
+ */
34360
34493
  function syntax_tokenizeIndent(effects, ok, nok) {
34361
34494
  const self = this
34362
34495
  return factorySpace(
@@ -34365,8 +34498,10 @@ function syntax_tokenizeIndent(effects, ok, nok) {
34365
34498
  'gfmFootnoteDefinitionIndent',
34366
34499
  4 + 1
34367
34500
  )
34368
- /** @type {State} */
34369
34501
 
34502
+ /**
34503
+ * @type {State}
34504
+ */
34370
34505
  function afterPrefix(code) {
34371
34506
  const tail = self.events[self.events.length - 1]
34372
34507
  return tail &&
@@ -35160,106 +35295,165 @@ function tokenizeNextPrefixedOrBlank(effects, ok, nok) {
35160
35295
  ;// CONCATENATED MODULE: ../node_modules/micromark-extension-gfm-task-list-item/lib/syntax.js
35161
35296
  /**
35162
35297
  * @typedef {import('micromark-util-types').Extension} Extension
35163
- * @typedef {import('micromark-util-types').ConstructRecord} ConstructRecord
35164
- * @typedef {import('micromark-util-types').Tokenizer} Tokenizer
35165
- * @typedef {import('micromark-util-types').Previous} Previous
35166
35298
  * @typedef {import('micromark-util-types').State} State
35167
- * @typedef {import('micromark-util-types').Event} Event
35168
- * @typedef {import('micromark-util-types').Code} Code
35299
+ * @typedef {import('micromark-util-types').TokenizeContext} TokenizeContext
35300
+ * @typedef {import('micromark-util-types').Tokenizer} Tokenizer
35169
35301
  */
35170
35302
 
35171
35303
 
35304
+
35172
35305
  const tasklistCheck = {
35173
35306
  tokenize: tokenizeTasklistCheck
35174
35307
  }
35308
+
35309
+ // To do: next major: expose function to make extension.
35310
+
35311
+ /**
35312
+ * Extension for `micromark` that can be passed in `extensions`, to
35313
+ * enable GFM task list items syntax.
35314
+ *
35315
+ * @type {Extension}
35316
+ */
35175
35317
  const gfmTaskListItem = {
35176
35318
  text: {
35177
35319
  [91]: tasklistCheck
35178
35320
  }
35179
35321
  }
35180
- /** @type {Tokenizer} */
35181
35322
 
35323
+ /**
35324
+ * @this {TokenizeContext}
35325
+ * @type {Tokenizer}
35326
+ */
35182
35327
  function tokenizeTasklistCheck(effects, ok, nok) {
35183
35328
  const self = this
35184
35329
  return open
35185
- /** @type {State} */
35186
35330
 
35331
+ /**
35332
+ * At start of task list item check.
35333
+ *
35334
+ * ```markdown
35335
+ * > | * [x] y.
35336
+ * ^
35337
+ * ```
35338
+ *
35339
+ * @type {State}
35340
+ */
35187
35341
  function open(code) {
35188
35342
  if (
35189
35343
  // Exit if there’s stuff before.
35190
- self.previous !== null || // Exit if not in the first content that is the first child of a list
35344
+ self.previous !== null ||
35345
+ // Exit if not in the first content that is the first child of a list
35191
35346
  // item.
35192
35347
  !self._gfmTasklistFirstContentOfListItem
35193
35348
  ) {
35194
35349
  return nok(code)
35195
35350
  }
35196
-
35197
35351
  effects.enter('taskListCheck')
35198
35352
  effects.enter('taskListCheckMarker')
35199
35353
  effects.consume(code)
35200
35354
  effects.exit('taskListCheckMarker')
35201
35355
  return inside
35202
35356
  }
35203
- /** @type {State} */
35204
35357
 
35358
+ /**
35359
+ * In task list item check.
35360
+ *
35361
+ * ```markdown
35362
+ * > | * [x] y.
35363
+ * ^
35364
+ * ```
35365
+ *
35366
+ * @type {State}
35367
+ */
35205
35368
  function inside(code) {
35206
- // To match how GH works in comments, use `markdownSpace` (`[ \t]`) instead
35207
- // of `markdownLineEndingOrSpace` (`[ \t\r\n]`).
35369
+ // Currently we match how GH works in files.
35370
+ // To match how GH works in comments, use `markdownSpace` (`[\t ]`) instead
35371
+ // of `markdownLineEndingOrSpace` (`[\t\n\r ]`).
35208
35372
  if (markdownLineEndingOrSpace(code)) {
35209
35373
  effects.enter('taskListCheckValueUnchecked')
35210
35374
  effects.consume(code)
35211
35375
  effects.exit('taskListCheckValueUnchecked')
35212
35376
  return close
35213
35377
  }
35214
-
35215
35378
  if (code === 88 || code === 120) {
35216
35379
  effects.enter('taskListCheckValueChecked')
35217
35380
  effects.consume(code)
35218
35381
  effects.exit('taskListCheckValueChecked')
35219
35382
  return close
35220
35383
  }
35221
-
35222
35384
  return nok(code)
35223
35385
  }
35224
- /** @type {State} */
35225
35386
 
35387
+ /**
35388
+ * At close of task list item check.
35389
+ *
35390
+ * ```markdown
35391
+ * > | * [x] y.
35392
+ * ^
35393
+ * ```
35394
+ *
35395
+ * @type {State}
35396
+ */
35226
35397
  function close(code) {
35227
35398
  if (code === 93) {
35228
35399
  effects.enter('taskListCheckMarker')
35229
35400
  effects.consume(code)
35230
35401
  effects.exit('taskListCheckMarker')
35231
35402
  effects.exit('taskListCheck')
35403
+ return after
35404
+ }
35405
+ return nok(code)
35406
+ }
35407
+
35408
+ /**
35409
+ * @type {State}
35410
+ */
35411
+ function after(code) {
35412
+ // EOL in paragraph means there must be something else after it.
35413
+ if (markdownLineEnding(code)) {
35414
+ return ok(code)
35415
+ }
35416
+
35417
+ // Space or tab?
35418
+ // Check what comes after.
35419
+ if (markdownSpace(code)) {
35232
35420
  return effects.check(
35233
35421
  {
35234
35422
  tokenize: spaceThenNonSpace
35235
35423
  },
35236
35424
  ok,
35237
35425
  nok
35238
- )
35426
+ )(code)
35239
35427
  }
35240
35428
 
35429
+ // EOF, or non-whitespace, both wrong.
35241
35430
  return nok(code)
35242
35431
  }
35243
35432
  }
35244
- /** @type {Tokenizer} */
35245
35433
 
35434
+ /**
35435
+ * @this {TokenizeContext}
35436
+ * @type {Tokenizer}
35437
+ */
35246
35438
  function spaceThenNonSpace(effects, ok, nok) {
35247
- const self = this
35248
35439
  return factorySpace(effects, after, 'whitespace')
35249
- /** @type {State} */
35250
35440
 
35441
+ /**
35442
+ * After whitespace, after task list item check.
35443
+ *
35444
+ * ```markdown
35445
+ * > | * [x] y.
35446
+ * ^
35447
+ * ```
35448
+ *
35449
+ * @type {State}
35450
+ */
35251
35451
  function after(code) {
35252
- const tail = self.events[self.events.length - 1]
35253
- return (
35254
- // We either found spaces
35255
- ((tail && tail[1].type === 'whitespace') || // …or it was followed by a line ending, in which case, there has to be
35256
- // non-whitespace after that line ending, because otherwise we’d get an
35257
- // EOF as the content is closed with blank lines.
35258
- markdownLineEnding(code)) &&
35259
- code !== null
35260
- ? ok(code)
35261
- : nok(code)
35262
- )
35452
+ // EOF means there was nothing, so bad.
35453
+ // EOL means there’s content after it, so good.
35454
+ // Impossible to have more spaces.
35455
+ // Anything else is good.
35456
+ return code === null ? nok(code) : ok(code)
35263
35457
  }
35264
35458
  }
35265
35459
 
@@ -72725,7 +72919,7 @@ document.body.style.overflow=originalOverflow.current;}}},[fullscreen,originalOv
72725
72919
  // extracted by mini-css-extract-plugin
72726
72920
  /* harmony default export */ const DragBar = ({});
72727
72921
  ;// CONCATENATED MODULE: ./src/components/DragBar/index.tsx
72728
- var DragBar_DragBar=function DragBar(props){var _ref=props||{},prefixCls=_ref.prefixCls,onChange=_ref.onChange;var $dom=(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(null);var dragRef=(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)();function handleMouseMove(event){if(dragRef.current){var _changedTouches$;var clientY=event.clientY||((_changedTouches$=event.changedTouches[0])===null||_changedTouches$===void 0?void 0:_changedTouches$.clientY);var newHeight=dragRef.current.height+clientY-dragRef.current.dragY;if(newHeight>=props.minHeight&&newHeight<=props.maxHeight){onChange&&onChange(dragRef.current.height+(clientY-dragRef.current.dragY));}}}function handleMouseUp(){var _$dom$current,_$dom$current2;dragRef.current=undefined;document.removeEventListener('mousemove',handleMouseMove);document.removeEventListener('mouseup',handleMouseUp);(_$dom$current=$dom.current)===null||_$dom$current===void 0?void 0:_$dom$current.removeEventListener('touchmove',handleMouseMove);(_$dom$current2=$dom.current)===null||_$dom$current2===void 0?void 0:_$dom$current2.removeEventListener('touchend',handleMouseUp);}function handleMouseDown(event){var _changedTouches$2,_$dom$current3,_$dom$current4;event.preventDefault();var clientY=event.clientY||((_changedTouches$2=event.changedTouches[0])===null||_changedTouches$2===void 0?void 0:_changedTouches$2.clientY);dragRef.current={height:props.height,dragY:clientY};document.addEventListener('mousemove',handleMouseMove);document.addEventListener('mouseup',handleMouseUp);(_$dom$current3=$dom.current)===null||_$dom$current3===void 0?void 0:_$dom$current3.addEventListener('touchmove',handleMouseMove,{passive:false});(_$dom$current4=$dom.current)===null||_$dom$current4===void 0?void 0:_$dom$current4.addEventListener('touchend',handleMouseUp,{passive:false});}(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(function(){if(document){var _$dom$current5,_$dom$current6;(_$dom$current5=$dom.current)===null||_$dom$current5===void 0?void 0:_$dom$current5.addEventListener('touchstart',handleMouseDown,{passive:false});(_$dom$current6=$dom.current)===null||_$dom$current6===void 0?void 0:_$dom$current6.addEventListener('mousedown',handleMouseDown);}return function(){if(document){var _$dom$current7;(_$dom$current7=$dom.current)===null||_$dom$current7===void 0?void 0:_$dom$current7.removeEventListener('touchstart',handleMouseDown);document.removeEventListener('mousemove',handleMouseMove);}};// eslint-disable-next-line react-hooks/exhaustive-deps
72922
+ var DragBar_DragBar=function DragBar(props){var _ref=props||{},prefixCls=_ref.prefixCls,onChange=_ref.onChange;var $dom=(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(null);var dragRef=(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)();var heightRef=(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(props.height);(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(function(){if(heightRef.current!==props.height){heightRef.current=props.height;}},[props.height]);function handleMouseMove(event){if(dragRef.current){var _changedTouches$;var clientY=event.clientY||((_changedTouches$=event.changedTouches[0])===null||_changedTouches$===void 0?void 0:_changedTouches$.clientY);var newHeight=dragRef.current.height+clientY-dragRef.current.dragY;if(newHeight>=props.minHeight&&newHeight<=props.maxHeight){onChange&&onChange(dragRef.current.height+(clientY-dragRef.current.dragY));}}}function handleMouseUp(){var _$dom$current,_$dom$current2;dragRef.current=undefined;document.removeEventListener('mousemove',handleMouseMove);document.removeEventListener('mouseup',handleMouseUp);(_$dom$current=$dom.current)===null||_$dom$current===void 0?void 0:_$dom$current.removeEventListener('touchmove',handleMouseMove);(_$dom$current2=$dom.current)===null||_$dom$current2===void 0?void 0:_$dom$current2.removeEventListener('touchend',handleMouseUp);}function handleMouseDown(event){var _changedTouches$2,_$dom$current3,_$dom$current4;event.preventDefault();var clientY=event.clientY||((_changedTouches$2=event.changedTouches[0])===null||_changedTouches$2===void 0?void 0:_changedTouches$2.clientY);dragRef.current={height:heightRef.current,dragY:clientY};document.addEventListener('mousemove',handleMouseMove);document.addEventListener('mouseup',handleMouseUp);(_$dom$current3=$dom.current)===null||_$dom$current3===void 0?void 0:_$dom$current3.addEventListener('touchmove',handleMouseMove,{passive:false});(_$dom$current4=$dom.current)===null||_$dom$current4===void 0?void 0:_$dom$current4.addEventListener('touchend',handleMouseUp,{passive:false});}(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(function(){if(document){var _$dom$current5,_$dom$current6;(_$dom$current5=$dom.current)===null||_$dom$current5===void 0?void 0:_$dom$current5.addEventListener('touchstart',handleMouseDown,{passive:false});(_$dom$current6=$dom.current)===null||_$dom$current6===void 0?void 0:_$dom$current6.addEventListener('mousedown',handleMouseDown);}return function(){if(document){var _$dom$current7;(_$dom$current7=$dom.current)===null||_$dom$current7===void 0?void 0:_$dom$current7.removeEventListener('touchstart',handleMouseDown);document.removeEventListener('mousemove',handleMouseMove);}};// eslint-disable-next-line react-hooks/exhaustive-deps
72729
72923
  },[]);var svg=(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo)(function(){return/*#__PURE__*/(0,jsx_runtime.jsx)("svg",{viewBox:"0 0 512 512",height:"100%",children:/*#__PURE__*/(0,jsx_runtime.jsx)("path",{fill:"currentColor",d:"M304 256c0 26.5-21.5 48-48 48s-48-21.5-48-48 21.5-48 48-48 48 21.5 48 48zm120-48c-26.5 0-48 21.5-48 48s21.5 48 48 48 48-21.5 48-48-21.5-48-48-48zm-336 0c-26.5 0-48 21.5-48 48s21.5 48 48 48 48-21.5 48-48-21.5-48-48-48z"})});},[]);return/*#__PURE__*/(0,jsx_runtime.jsx)("div",{className:"".concat(prefixCls,"-bar"),ref:$dom,children:svg});};/* harmony default export */ const components_DragBar = (DragBar_DragBar);
72730
72924
  ;// CONCATENATED MODULE: ./src/index.less
72731
72925
  // extracted by mini-css-extract-plugin