securemark 0.231.2 → 0.232.2

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,5 +1,18 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.232.2
4
+
5
+ - Refactoring.
6
+
7
+ ## 0.232.1
8
+
9
+ - Refactoring.
10
+
11
+ ## 0.232.0
12
+
13
+ - Refine paragraph syntax to separate mention syntax.
14
+ - Rename mention syntax to reply syntax.
15
+
3
16
  ## 0.231.2
4
17
 
5
18
  - Refactoring.
package/design.md CHANGED
@@ -293,3 +293,7 @@ MarkdownはGFMのように最初から高機能で完成度の高い拡張不要
293
293
  ### トランスクルージョン
294
294
 
295
295
  分散的に管理される情報のトランスクルージョンは権利関係の不明瞭さおよびリンク先の消失によりリンク元の情報に欠損が生じるなどの脆さから壊れやすいウェブ上の情報を扱う方法として既存の方法より劣っておりWikipediaのように中央集権的管理を実施できる場合にのみ有用となる。
296
+
297
+ ### Data URI
298
+
299
+ Data URIは保存および転送容量削減ならびに集約的管理のためサポートしない。
@@ -1,4 +1,4 @@
1
- /*! securemark v0.231.2 https://github.com/falsandtru/securemark | (c) 2017, falsandtru | UNLICENSED */
1
+ /*! securemark v0.232.2 https://github.com/falsandtru/securemark | (c) 2017, falsandtru | UNLICENSED */
2
2
  require = function () {
3
3
  function r(e, n, t) {
4
4
  function o(i, f) {
@@ -427,7 +427,7 @@ require = function () {
427
427
  this.indexes = {
428
428
  LRU: new invlist_1.List(),
429
429
  LFU: new invlist_1.List(),
430
- OVF: new invlist_1.List()
430
+ OVL: new invlist_1.List()
431
431
  };
432
432
  this.stats = {
433
433
  LRU: (0, tuple_1.tuple)(0, 0),
@@ -470,7 +470,7 @@ require = function () {
470
470
  callback && (callback = !!this.settings.disposer);
471
471
  record = callback ? record !== null && record !== void 0 ? record : this.memory.get(index.key) : record;
472
472
  node.delete();
473
- (_a = node.value.overflow) === null || _a === void 0 ? void 0 : _a.delete();
473
+ (_a = node.value.overlap) === null || _a === void 0 ? void 0 : _a.delete();
474
474
  this.memory.delete(index.key);
475
475
  this.SIZE -= index.size;
476
476
  callback && ((_c = (_b = this.settings).disposer) === null || _c === void 0 ? void 0 : _c.call(_b, record.value, index.key));
@@ -484,25 +484,30 @@ require = function () {
484
484
  let size = (_a = skip === null || skip === void 0 ? void 0 : skip.value.size) !== null && _a !== void 0 ? _a : 0;
485
485
  if (margin - size <= 0)
486
486
  return;
487
- const {LRU, LFU, OVF} = this.indexes;
487
+ const {LRU, LFU, OVL} = this.indexes;
488
488
  while (this.length === this.capacity || this.size + margin - size > this.space) {
489
- const lastNode = (_b = OVF.last) !== null && _b !== void 0 ? _b : LFU.last;
489
+ const lastNode = (_b = OVL.last) !== null && _b !== void 0 ? _b : LFU.last;
490
490
  const lastIndex = lastNode === null || lastNode === void 0 ? void 0 : lastNode.value;
491
491
  let target;
492
492
  switch (true) {
493
493
  case lastIndex && lastIndex.clock < this.clock - this.life:
494
494
  case lastIndex && lastIndex.expiry !== global_1.Infinity && lastIndex.expiry < (0, clock_1.now)():
495
- target = lastNode.list === OVF ? lastNode.value.parent : lastNode;
495
+ target = lastNode.list === OVL ? lastNode.value.node : lastNode;
496
496
  break;
497
497
  case LRU.length === 0:
498
498
  target = LFU.last !== skip ? LFU.last : LFU.last.prev;
499
499
  break;
500
500
  case LFU.length > this.capacity * this.ratio / 100:
501
- LRU.unshiftNode(LFU.last);
502
- LRU.head.value.parent = LRU.head;
503
- LRU.head.value.overflow = OVF.unshift(LRU.head.value);
501
+ target = LFU.last !== skip ? LFU.last : LFU.length >= 2 ? LFU.last.prev : skip;
502
+ if (target !== skip) {
503
+ if (this.ratio > 50)
504
+ break;
505
+ LRU.unshiftNode(target);
506
+ LRU.head.value.node = LRU.head;
507
+ LRU.head.value.overlap = OVL.unshift(LRU.head.value);
508
+ }
504
509
  default:
505
- target = LRU.last !== skip ? LRU.last : LRU.last.prev !== skip ? LRU.last.prev : LFU.last;
510
+ target = LRU.last !== skip ? LRU.last : LRU.length >= 2 ? LRU.last.prev : LFU.last;
506
511
  }
507
512
  this.evict(target, void 0, true);
508
513
  skip = (skip === null || skip === void 0 ? void 0 : skip.list) && skip;
@@ -593,7 +598,7 @@ require = function () {
593
598
  this.stats.clear();
594
599
  this.indexes.LRU.clear();
595
600
  this.indexes.LFU.clear();
596
- this.indexes.OVF.clear();
601
+ this.indexes.OVL.clear();
597
602
  if (!this.settings.disposer || !this.settings.capture.clear)
598
603
  return void this.memory.clear();
599
604
  const memory = this.memory;
@@ -620,7 +625,7 @@ require = function () {
620
625
  return;
621
626
  const lenR = indexes.LRU.length;
622
627
  const lenF = indexes.LFU.length;
623
- const lenV = indexes.OVF.length;
628
+ const lenV = indexes.OVL.length;
624
629
  const r = (lenF + lenV) * 1000 / (lenR + lenF) | 0;
625
630
  const rateR0 = rate(window, LRU[0], LRU[0] + LFU[0], LRU[1], LRU[1] + LFU[1], 0) * (1 + r);
626
631
  const rateF0 = rate(window, LFU[0], LRU[0] + LFU[0], LFU[1], LRU[1] + LFU[1], 0) * (1001 - r);
@@ -643,14 +648,14 @@ require = function () {
643
648
  const index = node.value;
644
649
  const {LRU, LFU} = this.indexes;
645
650
  ++this.stats[index.region][0];
646
- if (!index.overflow && index.clock >= this.clockR - LRU.length / 3 && this.capacity > 3) {
651
+ if (!index.overlap && index.clock >= this.clockR - LRU.length / 3 && this.capacity > 3) {
647
652
  index.clock = ++this.clockR;
648
653
  node.moveToHead();
649
654
  return true;
650
655
  }
651
656
  index.clock = ++this.clock;
652
657
  index.region = 'LFU';
653
- (_a = index.overflow) === null || _a === void 0 ? void 0 : _a.delete();
658
+ (_a = index.overlap) === null || _a === void 0 ? void 0 : _a.delete();
654
659
  LFU.unshiftNode(node);
655
660
  return true;
656
661
  }
@@ -3651,6 +3656,7 @@ require = function () {
3651
3656
  const global_1 = _dereq_('spica/global');
3652
3657
  const parser_1 = _dereq_('../../data/parser');
3653
3658
  const fmap_1 = _dereq_('../monad/fmap');
3659
+ const resource_1 = _dereq_('./resource');
3654
3660
  const array_1 = _dereq_('spica/array');
3655
3661
  function surround(opener, parser, closer, optional = false, f, g) {
3656
3662
  switch (typeof opener) {
@@ -3698,18 +3704,18 @@ require = function () {
3698
3704
  function match(pattern) {
3699
3705
  switch (typeof pattern) {
3700
3706
  case 'string':
3701
- return source => source.slice(0, pattern.length) === pattern ? [
3707
+ return (0, resource_1.creator)(source => source.slice(0, pattern.length) === pattern ? [
3702
3708
  [],
3703
3709
  source.slice(pattern.length)
3704
- ] : global_1.undefined;
3710
+ ] : global_1.undefined);
3705
3711
  case 'object':
3706
- return source => {
3712
+ return (0, resource_1.creator)(source => {
3707
3713
  const m = source.match(pattern);
3708
3714
  return m ? [
3709
3715
  [],
3710
3716
  source.slice(m[0].length)
3711
3717
  ] : global_1.undefined;
3712
- };
3718
+ });
3713
3719
  }
3714
3720
  }
3715
3721
  function open(opener, parser, optional = false) {
@@ -3728,6 +3734,7 @@ require = function () {
3728
3734
  {
3729
3735
  '../../data/parser': 47,
3730
3736
  '../monad/fmap': 46,
3737
+ './resource': 40,
3731
3738
  'spica/array': 6,
3732
3739
  'spica/global': 15
3733
3740
  }
@@ -4544,6 +4551,7 @@ require = function () {
4544
4551
  const codeblock_1 = _dereq_('./block/codeblock');
4545
4552
  const mathblock_1 = _dereq_('./block/mathblock');
4546
4553
  const extension_1 = _dereq_('./block/extension');
4554
+ const reply_1 = _dereq_('./block/reply');
4547
4555
  const paragraph_1 = _dereq_('./block/paragraph');
4548
4556
  const typed_dom_1 = _dereq_('typed-dom');
4549
4557
  const random_1 = _dereq_('spica/random');
@@ -4560,6 +4568,7 @@ require = function () {
4560
4568
  mathblock_1.mathblock,
4561
4569
  extension_1.extension,
4562
4570
  blockquote_1.blockquote,
4571
+ reply_1.reply,
4563
4572
  paragraph_1.paragraph
4564
4573
  ]))));
4565
4574
  function error(parser) {
@@ -4593,6 +4602,7 @@ require = function () {
4593
4602
  './block/mathblock': 79,
4594
4603
  './block/olist': 80,
4595
4604
  './block/paragraph': 81,
4605
+ './block/reply': 82,
4596
4606
  './block/table': 85,
4597
4607
  './block/ulist': 86,
4598
4608
  './source': 128,
@@ -5307,7 +5317,7 @@ require = function () {
5307
5317
  colspan,
5308
5318
  ...valid ? { 'data-highlight-level': +highlight > 1 ? highlight : global_1.undefined } : {
5309
5319
  'data-invalid-syntax': 'table',
5310
- 'data-invalid-type': 'highlight',
5320
+ 'data-invalid-type': 'syntax',
5311
5321
  'data-invalid-description': 'Too much highlight level.'
5312
5322
  }
5313
5323
  };
@@ -5776,31 +5786,17 @@ require = function () {
5776
5786
  Object.defineProperty(exports, '__esModule', { value: true });
5777
5787
  exports.paragraph = void 0;
5778
5788
  const combinator_1 = _dereq_('../../combinator');
5779
- const mention_1 = _dereq_('./paragraph/mention');
5780
- const quote_1 = _dereq_('./paragraph/mention/quote');
5781
5789
  const inline_1 = _dereq_('../inline');
5782
- const source_1 = _dereq_('../source');
5783
5790
  const locale_1 = _dereq_('../locale');
5784
5791
  const util_1 = _dereq_('../util');
5785
5792
  const typed_dom_1 = _dereq_('typed-dom');
5786
- const array_1 = _dereq_('spica/array');
5787
- exports.paragraph = (0, combinator_1.block)((0, locale_1.localize)((0, combinator_1.fmap)((0, combinator_1.subsequence)([
5788
- (0, combinator_1.some)(mention_1.mention),
5789
- (0, combinator_1.some)((0, combinator_1.union)([
5790
- quote_1.quote,
5791
- (0, combinator_1.fmap)((0, combinator_1.rewrite)((0, combinator_1.some)(source_1.anyline, quote_1.syntax), (0, combinator_1.trim)((0, util_1.visualize)((0, combinator_1.some)(inline_1.inline)))), ns => (0, array_1.push)(ns, [(0, typed_dom_1.html)('br')]))
5792
- ]))
5793
- ]), ns => [(0, typed_dom_1.html)('p', (0, typed_dom_1.defrag)((0, array_1.pop)(ns)[0]))])));
5793
+ exports.paragraph = (0, combinator_1.block)((0, locale_1.localize)((0, combinator_1.fmap)((0, combinator_1.trim)((0, util_1.visualize)((0, combinator_1.some)((0, combinator_1.union)([inline_1.inline])))), ns => [(0, typed_dom_1.html)('p', (0, typed_dom_1.defrag)(ns))])));
5794
5794
  },
5795
5795
  {
5796
5796
  '../../combinator': 27,
5797
5797
  '../inline': 88,
5798
5798
  '../locale': 123,
5799
- '../source': 128,
5800
5799
  '../util': 134,
5801
- './paragraph/mention': 82,
5802
- './paragraph/mention/quote': 84,
5803
- 'spica/array': 6,
5804
5800
  'typed-dom': 26
5805
5801
  }
5806
5802
  ],
@@ -5808,19 +5804,37 @@ require = function () {
5808
5804
  function (_dereq_, module, exports) {
5809
5805
  'use strict';
5810
5806
  Object.defineProperty(exports, '__esModule', { value: true });
5811
- exports.mention = void 0;
5812
- const combinator_1 = _dereq_('../../../combinator');
5813
- const cite_1 = _dereq_('./mention/cite');
5814
- const quote_1 = _dereq_('./mention/quote');
5815
- exports.mention = (0, combinator_1.validate)('>', (0, combinator_1.inits)([
5816
- (0, combinator_1.some)(cite_1.cite),
5817
- quote_1.quote
5818
- ]));
5807
+ exports.reply = void 0;
5808
+ const combinator_1 = _dereq_('../../combinator');
5809
+ const cite_1 = _dereq_('./reply/cite');
5810
+ const quote_1 = _dereq_('./reply/quote');
5811
+ const inline_1 = _dereq_('../inline');
5812
+ const source_1 = _dereq_('../source');
5813
+ const locale_1 = _dereq_('../locale');
5814
+ const util_1 = _dereq_('../util');
5815
+ const typed_dom_1 = _dereq_('typed-dom');
5816
+ const array_1 = _dereq_('spica/array');
5817
+ exports.reply = (0, combinator_1.block)((0, combinator_1.validate)('>', (0, locale_1.localize)((0, combinator_1.fmap)((0, combinator_1.inits)([
5818
+ (0, combinator_1.some)((0, combinator_1.inits)([
5819
+ cite_1.cite,
5820
+ quote_1.quote
5821
+ ])),
5822
+ (0, combinator_1.some)((0, combinator_1.subsequence)([
5823
+ (0, combinator_1.some)(quote_1.quote),
5824
+ (0, combinator_1.fmap)((0, combinator_1.rewrite)((0, combinator_1.some)(source_1.anyline, quote_1.syntax), (0, combinator_1.trim)((0, util_1.visualize)((0, combinator_1.some)(inline_1.inline)))), ns => (0, array_1.push)(ns, [(0, typed_dom_1.html)('br')]))
5825
+ ]))
5826
+ ]), ns => [(0, typed_dom_1.html)('p', (0, typed_dom_1.defrag)((0, array_1.pop)(ns)[0]))]))));
5819
5827
  },
5820
5828
  {
5821
- '../../../combinator': 27,
5822
- './mention/cite': 83,
5823
- './mention/quote': 84
5829
+ '../../combinator': 27,
5830
+ '../inline': 88,
5831
+ '../locale': 123,
5832
+ '../source': 128,
5833
+ '../util': 134,
5834
+ './reply/cite': 83,
5835
+ './reply/quote': 84,
5836
+ 'spica/array': 6,
5837
+ 'typed-dom': 26
5824
5838
  }
5825
5839
  ],
5826
5840
  83: [
@@ -5828,13 +5842,13 @@ require = function () {
5828
5842
  'use strict';
5829
5843
  Object.defineProperty(exports, '__esModule', { value: true });
5830
5844
  exports.cite = void 0;
5831
- const combinator_1 = _dereq_('../../../../combinator');
5832
- const anchor_1 = _dereq_('../../../inline/autolink/anchor');
5833
- const source_1 = _dereq_('../../../source');
5845
+ const combinator_1 = _dereq_('../../../combinator');
5846
+ const anchor_1 = _dereq_('../../inline/autolink/anchor');
5847
+ const source_1 = _dereq_('../../source');
5834
5848
  const typed_dom_1 = _dereq_('typed-dom');
5835
5849
  exports.cite = (0, combinator_1.creator)((0, combinator_1.line)((0, combinator_1.fmap)((0, combinator_1.validate)('>>', (0, combinator_1.reverse)((0, combinator_1.tails)([
5836
5850
  (0, source_1.str)(/^>*(?=>>)/),
5837
- anchor_1.anchor
5851
+ (0, combinator_1.validate)(new RegExp(`${ anchor_1.syntax.source }[^\S\n]*(?:$|\n)`), anchor_1.anchor)
5838
5852
  ]))), ([el, quotes = '']) => [
5839
5853
  (0, typed_dom_1.html)('span', { class: 'cite' }, (0, typed_dom_1.defrag)([
5840
5854
  quotes + '>',
@@ -5844,9 +5858,9 @@ require = function () {
5844
5858
  ])));
5845
5859
  },
5846
5860
  {
5847
- '../../../../combinator': 27,
5848
- '../../../inline/autolink/anchor': 92,
5849
- '../../../source': 128,
5861
+ '../../../combinator': 27,
5862
+ '../../inline/autolink/anchor': 92,
5863
+ '../../source': 128,
5850
5864
  'typed-dom': 26
5851
5865
  }
5852
5866
  ],
@@ -5855,23 +5869,23 @@ require = function () {
5855
5869
  'use strict';
5856
5870
  Object.defineProperty(exports, '__esModule', { value: true });
5857
5871
  exports.quote = exports.syntax = void 0;
5858
- const parser_1 = _dereq_('../../../../combinator/data/parser');
5859
- const combinator_1 = _dereq_('../../../../combinator');
5860
- const math_1 = _dereq_('../../../inline/math');
5861
- const source_1 = _dereq_('../../../source');
5862
- const autolink_1 = _dereq_('../../../autolink');
5872
+ const parser_1 = _dereq_('../../../combinator/data/parser');
5873
+ const combinator_1 = _dereq_('../../../combinator');
5874
+ const math_1 = _dereq_('../../inline/math');
5875
+ const source_1 = _dereq_('../../source');
5876
+ const autolink_1 = _dereq_('../../autolink');
5863
5877
  const typed_dom_1 = _dereq_('typed-dom');
5864
5878
  exports.syntax = /^>+(?=[^\S\n])|^>(?=[^\s>])|^>+(?=[^\s>])(?![0-9a-z]+(?:-[0-9a-z]+)*(?![0-9A-Za-z@#:]))/;
5865
5879
  exports.quote = (0, combinator_1.lazy)(() => (0, combinator_1.creator)((0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.validate)('>', (0, combinator_1.union)([
5866
5880
  (0, combinator_1.rewrite)((0, combinator_1.some)((0, combinator_1.validate)(new RegExp(exports.syntax.source.split('|')[0]), source_1.anyline)), qblock),
5867
5881
  (0, combinator_1.rewrite)((0, combinator_1.validate)(new RegExp(exports.syntax.source.split('|').slice(1).join('|')), source_1.anyline), (0, combinator_1.line)((0, combinator_1.union)([(0, source_1.str)(/^.+/)])))
5868
5882
  ])), ns => [
5869
- (0, typed_dom_1.html)('span', ns.length > 1 || /^>+(?=[^\S\n])/.test(ns[0]) ? { class: 'quote' } : {
5883
+ (0, typed_dom_1.html)('span', ns.length > 1 ? { class: 'quote' } : {
5870
5884
  class: 'quote invalid',
5871
5885
  'data-invalid-syntax': 'quote',
5872
5886
  'data-invalid-type': 'syntax',
5873
5887
  'data-invalid-description': `Missing the whitespace after "${ ns[0].split(/[^>]/, 1)[0] }".`
5874
- }, ns),
5888
+ }, (0, typed_dom_1.defrag)(ns)),
5875
5889
  (0, typed_dom_1.html)('br')
5876
5890
  ]), false)));
5877
5891
  const qblock = (source, context) => {
@@ -5901,8 +5915,9 @@ require = function () {
5901
5915
  continue;
5902
5916
  }
5903
5917
  }
5918
+ nodes.unshift('');
5904
5919
  return [
5905
- (0, typed_dom_1.defrag)(nodes),
5920
+ nodes,
5906
5921
  ''
5907
5922
  ];
5908
5923
  };
@@ -5912,11 +5927,11 @@ require = function () {
5912
5927
  ]);
5913
5928
  },
5914
5929
  {
5915
- '../../../../combinator': 27,
5916
- '../../../../combinator/data/parser': 47,
5917
- '../../../autolink': 62,
5918
- '../../../inline/math': 116,
5919
- '../../../source': 128,
5930
+ '../../../combinator': 27,
5931
+ '../../../combinator/data/parser': 47,
5932
+ '../../autolink': 62,
5933
+ '../../inline/math': 116,
5934
+ '../../source': 128,
5920
5935
  'typed-dom': 26
5921
5936
  }
5922
5937
  ],
@@ -6325,12 +6340,13 @@ require = function () {
6325
6340
  function (_dereq_, module, exports) {
6326
6341
  'use strict';
6327
6342
  Object.defineProperty(exports, '__esModule', { value: true });
6328
- exports.anchor = void 0;
6343
+ exports.anchor = exports.syntax = void 0;
6329
6344
  const combinator_1 = _dereq_('../../../combinator');
6330
6345
  const link_1 = _dereq_('../link');
6331
6346
  const source_1 = _dereq_('../../source');
6332
6347
  const typed_dom_1 = _dereq_('typed-dom');
6333
- exports.anchor = (0, combinator_1.lazy)(() => (0, combinator_1.validate)('>>', (0, combinator_1.fmap)((0, combinator_1.rewrite)((0, source_1.str)(/^>>[0-9a-z]+(?:-[0-9a-z]+)*(?![0-9A-Za-z@#:])/), (0, combinator_1.context)({
6348
+ exports.syntax = /^>>[0-9a-z]+(?:-[0-9a-z]+)*(?![0-9A-Za-z@#:])/;
6349
+ exports.anchor = (0, combinator_1.lazy)(() => (0, combinator_1.validate)('>>', (0, combinator_1.fmap)((0, combinator_1.rewrite)((0, source_1.str)(exports.syntax), (0, combinator_1.context)({
6334
6350
  syntax: {
6335
6351
  inline: {
6336
6352
  link: true,
@@ -7598,6 +7614,15 @@ require = function () {
7598
7614
  switch (uri.protocol) {
7599
7615
  case 'http:':
7600
7616
  case 'https:':
7617
+ if (/\/\.\.?(?:\/|$)/.test('/' + uri.source.slice(0, uri.source.search(/[?#]|$/)))) {
7618
+ (0, typed_dom_1.define)(target, {
7619
+ class: void target.classList.add('invalid'),
7620
+ 'data-invalid-syntax': 'media',
7621
+ 'data-invalid-type': 'argument',
7622
+ 'data-invalid-description': 'Dot-segments cannot be used in media paths; use subresource paths instead.'
7623
+ });
7624
+ return false;
7625
+ }
7601
7626
  break;
7602
7627
  default:
7603
7628
  (0, typed_dom_1.define)(target, {
@@ -7608,15 +7633,6 @@ require = function () {
7608
7633
  });
7609
7634
  return false;
7610
7635
  }
7611
- if (/\/\.\.?(?:\/|$)/.test('/' + uri.source.slice(0, uri.source.search(/[?#]|$/)))) {
7612
- (0, typed_dom_1.define)(target, {
7613
- class: void target.classList.add('invalid'),
7614
- 'data-invalid-syntax': 'media',
7615
- 'data-invalid-type': 'argument',
7616
- 'data-invalid-description': 'Dot-segments cannot be used in media paths; use subresource paths instead.'
7617
- });
7618
- return false;
7619
- }
7620
7636
  if (alt.includes('\0')) {
7621
7637
  (0, typed_dom_1.define)(target, {
7622
7638
  class: void target.classList.add('invalid'),
@@ -8066,7 +8082,7 @@ require = function () {
8066
8082
  !(0, label_1.isFixed)(label) && numbers.set(group, number);
8067
8083
  opts.id !== '' && def.setAttribute('id', `label:${ opts.id ? `${ opts.id }:` : '' }${ label }`);
8068
8084
  const figindex = group === '$' ? `(${ number })` : `${ capitalize(group) }${ group === 'fig' ? '.' : '' } ${ number }`;
8069
- (0, typed_dom_1.define)(def.querySelector(':scope > .figindex'), group === '$' ? figindex : `${ figindex }: `);
8085
+ (0, typed_dom_1.define)(def.querySelector(':scope > .figindex'), group === '$' ? figindex : `${ figindex }. `);
8070
8086
  for (const ref of refs.take(label, global_1.Infinity)) {
8071
8087
  if (ref.hash.slice(1) === def.id && ref.innerText === figindex)
8072
8088
  continue;
@@ -9350,7 +9366,7 @@ require = function () {
9350
9366
  exports.info = void 0;
9351
9367
  const scope_1 = _dereq_('./scope');
9352
9368
  function info(source) {
9353
- const match = (0, scope_1.scope)(source, 'section, article, aside, blockquote, .quote, pre, .math, .media');
9369
+ const match = (0, scope_1.scope)(source, '.invalid');
9354
9370
  return {
9355
9371
  url: find('a:not(.email):not(.account):not(.channel):not(.hashtag):not(.hashnum):not(.anchor)').filter(el => [
9356
9372
  'http:',
@@ -9362,7 +9378,7 @@ require = function () {
9362
9378
  channel: find('a.channel'),
9363
9379
  hashtag: find('a.hashtag'),
9364
9380
  hashnum: find('a.hashnum'),
9365
- mention: find('.cite > a.anchor'),
9381
+ reply: find('.cite > a.anchor'),
9366
9382
  anchor: find(':not(.cite) > a.anchor'),
9367
9383
  media: find('.media[data-src]')
9368
9384
  };
@@ -9387,7 +9403,7 @@ require = function () {
9387
9403
  Object.defineProperty(exports, '__esModule', { value: true });
9388
9404
  exports.quote = void 0;
9389
9405
  const parser_1 = _dereq_('../combinator/data/parser');
9390
- const cite_1 = _dereq_('../parser/block/paragraph/mention/cite');
9406
+ const cite_1 = _dereq_('../parser/block/reply/cite');
9391
9407
  const typed_dom_1 = _dereq_('typed-dom');
9392
9408
  function quote(anchor, range) {
9393
9409
  var _a, _b;
@@ -9466,7 +9482,7 @@ require = function () {
9466
9482
  },
9467
9483
  {
9468
9484
  '../combinator/data/parser': 47,
9469
- '../parser/block/paragraph/mention/cite': 83,
9485
+ '../parser/block/reply/cite': 83,
9470
9486
  'typed-dom': 26
9471
9487
  }
9472
9488
  ],
@@ -9476,7 +9492,8 @@ require = function () {
9476
9492
  Object.defineProperty(exports, '__esModule', { value: true });
9477
9493
  exports.scope = void 0;
9478
9494
  const global_1 = _dereq_('spica/global');
9479
- function scope(base, bound = `${ 'id' in base && base.id ? `#${ base.id }, ` : '' }section, article, aside, blockquote`) {
9495
+ function scope(base, filter = '', bound = `${ 'id' in base && base.id ? `#${ base.id }, ` : '' }section, article, aside, blockquote, pre, .quote, .math, .media`) {
9496
+ bound += filter && `, ${ filter }`;
9480
9497
  const memory = new global_1.WeakMap();
9481
9498
  const context = 'id' in base && base.closest(bound) || null;
9482
9499
  return el => {
package/index.d.ts CHANGED
@@ -22,7 +22,7 @@ export function normalize(source: string): string;
22
22
  export function quote(anchor: string, range: Range): string;
23
23
  export function toc(source: DocumentFragment | HTMLElement | ShadowRoot): HTMLUListElement;
24
24
  export function info(source: DocumentFragment | HTMLElement | ShadowRoot): Info;
25
- export function scope(base: DocumentFragment | HTMLElement | ShadowRoot, bound?: string): (el: Element) => boolean;
25
+ export function scope(base: DocumentFragment | HTMLElement | ShadowRoot, filter?: string, bound?: string): (el: Element) => boolean;
26
26
  export function sync(editor: HTMLElement, viewer: HTMLElement, bottom?: Element | null): () => void;
27
27
 
28
28
  export type ParserOptions = Omit<Partial<ParserSettings>, 'chunk'>;
@@ -76,7 +76,7 @@ export interface Info {
76
76
  readonly channel: HTMLAnchorElement[];
77
77
  readonly hashtag: HTMLAnchorElement[];
78
78
  readonly hashnum: HTMLAnchorElement[];
79
- readonly mention: HTMLAnchorElement[];
79
+ readonly reply: HTMLAnchorElement[];
80
80
  readonly anchor: HTMLAnchorElement[];
81
81
  readonly media: HTMLElement[];
82
82
  }
package/markdown.d.ts CHANGED
@@ -87,6 +87,7 @@ export namespace MarkdownParser {
87
87
  BlockParser.MathBlockParser,
88
88
  BlockParser.ExtensionParser,
89
89
  BlockParser.BlockquoteParser,
90
+ BlockParser.ReplyParser,
90
91
  BlockParser.ParagraphParser,
91
92
  ]> {
92
93
  }
@@ -550,65 +551,66 @@ export namespace MarkdownParser {
550
551
  }
551
552
  }
552
553
  }
553
- export interface ParagraphParser extends
554
+ export interface ReplyParser extends
555
+ // >>1
556
+ // > text
554
557
  // abc
555
- Block<'paragraph'>,
558
+ Block<'reply'>,
556
559
  Parser<HTMLParagraphElement, Context, [
557
- ParagraphParser.MentionParser,
558
560
  Parser<string | HTMLElement, Context, [
559
- ParagraphParser.MentionParser.QuoteParser,
561
+ ReplyParser.CiteParser,
562
+ ReplyParser.QuoteParser,
563
+ ]>,
564
+ Parser<string | HTMLElement, Context, [
565
+ ReplyParser.QuoteParser,
560
566
  InlineParser,
561
567
  ]>,
562
568
  ]> {
563
569
  }
564
- export namespace ParagraphParser {
565
- export interface MentionParser extends
566
- // >>1
567
- // > text
568
- Block<'paragraph/mention'>,
570
+ export namespace ReplyParser {
571
+ export interface CiteParser extends
572
+ Block<'reply/cite'>,
569
573
  Parser<HTMLSpanElement | HTMLBRElement, Context, [
570
- ParagraphParser.MentionParser.CiteParser,
571
- ParagraphParser.MentionParser.QuoteParser,
574
+ SourceParser.StrParser,
575
+ InlineParser.AutolinkParser.AnchorParser,
572
576
  ]> {
573
577
  }
574
- export namespace MentionParser {
575
- export interface CiteParser extends
576
- Block<'paragraph/mention/cite'>,
577
- Parser<HTMLSpanElement | HTMLBRElement, Context, [
578
- SourceParser.StrParser,
579
- InlineParser.AutolinkParser.AnchorParser,
578
+ export interface QuoteParser extends
579
+ Block<'reply/quote'>,
580
+ Parser<HTMLSpanElement | HTMLBRElement, Context, [
581
+ QuoteParser.BlockParser,
582
+ QuoteParser.PlaceholderParser,
583
+ ]> {
584
+ }
585
+ export namespace QuoteParser {
586
+ export interface BlockParser extends
587
+ Block<'reply/quote/block'>,
588
+ Parser<string | HTMLElement, Context, [
589
+ TextParser,
580
590
  ]> {
581
591
  }
582
- export interface QuoteParser extends
583
- Block<'paragraph/mention/quote'>,
584
- Parser<HTMLSpanElement | HTMLBRElement, Context, [
585
- QuoteParser.BlockParser,
586
- QuoteParser.PlaceholderParser,
592
+ export interface TextParser extends
593
+ Block<'reply/quote/text'>,
594
+ Parser<string | HTMLElement, Context, [
595
+ InlineParser.MathParser,
596
+ AutolinkParser,
587
597
  ]> {
588
598
  }
589
- export namespace QuoteParser {
590
- export interface BlockParser extends
591
- Block<'paragraph/mention/quote/block'>,
592
- Parser<string | HTMLElement, Context, [
593
- TextParser,
594
- ]> {
595
- }
596
- export interface TextParser extends
597
- Block<'paragraph/mention/quote/text'>,
598
- Parser<string | HTMLElement, Context, [
599
- InlineParser.MathParser,
600
- AutolinkParser,
601
- ]> {
602
- }
603
- export interface PlaceholderParser extends
604
- Block<'paragraph/mention/quote/placeholder'>,
605
- Parser<string | HTMLElement, Context, [
606
- SourceParser.StrParser,
607
- ]> {
608
- }
599
+ export interface PlaceholderParser extends
600
+ Block<'reply/quote/placeholder'>,
601
+ Parser<string | HTMLElement, Context, [
602
+ SourceParser.StrParser,
603
+ ]> {
609
604
  }
610
605
  }
611
606
  }
607
+ export interface ParagraphParser extends
608
+ // abc
609
+ Block<'paragraph'>,
610
+ Parser<HTMLParagraphElement, Context, [
611
+ InlineParser,
612
+ ]> {
613
+ }
612
614
  }
613
615
  export interface InlineParser extends
614
616
  Markdown<'inline'>,