securemark 0.221.0 → 0.222.0

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,9 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.222.0
4
+
5
+ - Change link parser to trim the content.
6
+
3
7
  ## 0.221.0
4
8
 
5
9
  - Change ulist, olist, and ilist parsers to disallow fullwidth space indent.
@@ -1,4 +1,4 @@
1
- /*! securemark v0.221.0 https://github.com/falsandtru/securemark | (c) 2017, falsandtru | UNLICENSED */
1
+ /*! securemark v0.222.0 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) {
@@ -869,10 +869,11 @@ require = function () {
869
869
  function (_dereq_, module, exports) {
870
870
  'use strict';
871
871
  Object.defineProperty(exports, '__esModule', { value: true });
872
- exports.run = exports.clear = exports.mapReturn = exports.mapParameters = exports.once = void 0;
872
+ exports.run = exports.clear = exports.mapReturn = exports.mapParameters = exports.singleton = void 0;
873
873
  const global_1 = _dereq_('./global');
874
+ const exception_1 = _dereq_('./exception');
874
875
  const noop_1 = _dereq_('./noop');
875
- function once(f) {
876
+ function singleton(f) {
876
877
  let result;
877
878
  return function (...as) {
878
879
  if (f === noop_1.noop)
@@ -882,7 +883,7 @@ require = function () {
882
883
  return result;
883
884
  };
884
885
  }
885
- exports.once = once;
886
+ exports.singleton = singleton;
886
887
  function mapParameters(f, g) {
887
888
  return (...as) => f(...g(...as));
888
889
  }
@@ -903,19 +904,32 @@ require = function () {
903
904
  }
904
905
  } catch (reason) {
905
906
  for (let i = 0; gs[i]; ++i) {
906
- gs[i]();
907
+ try {
908
+ gs[i]();
909
+ } catch (reason) {
910
+ (0, exception_1.causeAsyncException)(reason);
911
+ }
907
912
  }
908
913
  throw reason;
909
914
  }
910
- return once(() => {
915
+ return singleton(() => {
916
+ const rs = [];
911
917
  for (let i = 0; gs[i]; ++i) {
912
- gs[i]();
918
+ try {
919
+ gs[i]();
920
+ } catch (reason) {
921
+ rs.push(reason);
922
+ }
923
+ }
924
+ if (rs.length > 0) {
925
+ throw new AggregateError(rs);
913
926
  }
914
927
  });
915
928
  }
916
929
  exports.run = run;
917
930
  },
918
931
  {
932
+ './exception': 14,
919
933
  './global': 17,
920
934
  './noop': 22
921
935
  }
@@ -2151,7 +2165,7 @@ require = function () {
2151
2165
  }
2152
2166
  exports.join = join;
2153
2167
  },
2154
- { './global': 8 }
2168
+ { './global': 9 }
2155
2169
  ],
2156
2170
  6: [
2157
2171
  function (_dereq_, module, exports) {
@@ -2169,10 +2183,23 @@ require = function () {
2169
2183
  function (_dereq_, module, exports) {
2170
2184
  'use strict';
2171
2185
  Object.defineProperty(exports, '__esModule', { value: true });
2172
- exports.run = exports.clear = exports.mapReturn = exports.mapParameters = exports.once = void 0;
2186
+ exports.causeAsyncException = void 0;
2187
+ function causeAsyncException(reason) {
2188
+ void Promise.reject(reason);
2189
+ }
2190
+ exports.causeAsyncException = causeAsyncException;
2191
+ },
2192
+ {}
2193
+ ],
2194
+ 8: [
2195
+ function (_dereq_, module, exports) {
2196
+ 'use strict';
2197
+ Object.defineProperty(exports, '__esModule', { value: true });
2198
+ exports.run = exports.clear = exports.mapReturn = exports.mapParameters = exports.singleton = void 0;
2173
2199
  const global_1 = _dereq_('./global');
2200
+ const exception_1 = _dereq_('./exception');
2174
2201
  const noop_1 = _dereq_('./noop');
2175
- function once(f) {
2202
+ function singleton(f) {
2176
2203
  let result;
2177
2204
  return function (...as) {
2178
2205
  if (f === noop_1.noop)
@@ -2182,7 +2209,7 @@ require = function () {
2182
2209
  return result;
2183
2210
  };
2184
2211
  }
2185
- exports.once = once;
2212
+ exports.singleton = singleton;
2186
2213
  function mapParameters(f, g) {
2187
2214
  return (...as) => f(...g(...as));
2188
2215
  }
@@ -2203,24 +2230,37 @@ require = function () {
2203
2230
  }
2204
2231
  } catch (reason) {
2205
2232
  for (let i = 0; gs[i]; ++i) {
2206
- gs[i]();
2233
+ try {
2234
+ gs[i]();
2235
+ } catch (reason) {
2236
+ (0, exception_1.causeAsyncException)(reason);
2237
+ }
2207
2238
  }
2208
2239
  throw reason;
2209
2240
  }
2210
- return once(() => {
2241
+ return singleton(() => {
2242
+ const rs = [];
2211
2243
  for (let i = 0; gs[i]; ++i) {
2212
- gs[i]();
2244
+ try {
2245
+ gs[i]();
2246
+ } catch (reason) {
2247
+ rs.push(reason);
2248
+ }
2249
+ }
2250
+ if (rs.length > 0) {
2251
+ throw new AggregateError(rs);
2213
2252
  }
2214
2253
  });
2215
2254
  }
2216
2255
  exports.run = run;
2217
2256
  },
2218
2257
  {
2219
- './global': 8,
2220
- './noop': 10
2258
+ './exception': 7,
2259
+ './global': 9,
2260
+ './noop': 11
2221
2261
  }
2222
2262
  ],
2223
- 8: [
2263
+ 9: [
2224
2264
  function (_dereq_, module, exports) {
2225
2265
  'use strict';
2226
2266
  const global = void 0 || typeof globalThis !== 'undefined' && globalThis || typeof self !== 'undefined' && self || Function('return this')();
@@ -2229,7 +2269,7 @@ require = function () {
2229
2269
  },
2230
2270
  {}
2231
2271
  ],
2232
- 9: [
2272
+ 10: [
2233
2273
  function (_dereq_, module, exports) {
2234
2274
  'use strict';
2235
2275
  Object.defineProperty(exports, '__esModule', { value: true });
@@ -2270,10 +2310,10 @@ require = function () {
2270
2310
  },
2271
2311
  {
2272
2312
  './compare': 6,
2273
- './global': 8
2313
+ './global': 9
2274
2314
  }
2275
2315
  ],
2276
- 10: [
2316
+ 11: [
2277
2317
  function (_dereq_, module, exports) {
2278
2318
  'use strict';
2279
2319
  Object.defineProperty(exports, '__esModule', { value: true });
@@ -2284,7 +2324,7 @@ require = function () {
2284
2324
  },
2285
2325
  {}
2286
2326
  ],
2287
- 11: [
2327
+ 12: [
2288
2328
  function (_dereq_, module, exports) {
2289
2329
  'use strict';
2290
2330
  var _a, _b;
@@ -2631,11 +2671,11 @@ require = function () {
2631
2671
  },
2632
2672
  {
2633
2673
  './alias': 4,
2634
- './global': 8,
2635
- './noop': 10
2674
+ './global': 9,
2675
+ './noop': 11
2636
2676
  }
2637
2677
  ],
2638
- 12: [
2678
+ 13: [
2639
2679
  function (_dereq_, module, exports) {
2640
2680
  'use strict';
2641
2681
  Object.defineProperty(exports, '__esModule', { value: true });
@@ -2717,9 +2757,9 @@ require = function () {
2717
2757
  }
2718
2758
  }
2719
2759
  },
2720
- { './global': 8 }
2760
+ { './global': 9 }
2721
2761
  ],
2722
- 13: [
2762
+ 14: [
2723
2763
  function (_dereq_, module, exports) {
2724
2764
  'use strict';
2725
2765
  Object.defineProperty(exports, '__esModule', { value: true });
@@ -2763,7 +2803,7 @@ require = function () {
2763
2803
  return true;
2764
2804
  }
2765
2805
  function elem(factory, attrs, children) {
2766
- const el = factory ? (0, dom_1.define)(factory(baseFactory, tag, attrs || {}, children), attrs) : baseFactory(tag, attrs);
2806
+ const el = factory ? (0, dom_1.define)(factory(baseFactory, tag, attrs !== null && attrs !== void 0 ? attrs : {}, children), attrs) : baseFactory(tag, attrs);
2767
2807
  if (tag !== el.tagName.toLowerCase())
2768
2808
  throw new Error(`TypedDOM: Expected tag name is "${ tag }" but actually "${ el.tagName.toLowerCase() }".`);
2769
2809
  return el;
@@ -2772,12 +2812,12 @@ require = function () {
2772
2812
  }
2773
2813
  },
2774
2814
  {
2775
- './proxy': 14,
2776
- './util/dom': 15,
2815
+ './proxy': 15,
2816
+ './util/dom': 16,
2777
2817
  'spica/alias': 4
2778
2818
  }
2779
2819
  ],
2780
- 14: [
2820
+ 15: [
2781
2821
  function (_dereq_, module, exports) {
2782
2822
  'use strict';
2783
2823
  var _a, _b, _c, _d;
@@ -3081,14 +3121,14 @@ require = function () {
3081
3121
  }
3082
3122
  },
3083
3123
  {
3084
- './util/dom': 15,
3085
- './util/identity': 16,
3124
+ './util/dom': 16,
3125
+ './util/identity': 17,
3086
3126
  'spica/alias': 4,
3087
3127
  'spica/array': 5,
3088
- 'spica/global': 8
3128
+ 'spica/global': 9
3089
3129
  }
3090
3130
  ],
3091
- 15: [
3131
+ 16: [
3092
3132
  function (_dereq_, module, exports) {
3093
3133
  'use strict';
3094
3134
  Object.defineProperty(exports, '__esModule', { value: true });
@@ -3096,19 +3136,19 @@ require = function () {
3096
3136
  const global_1 = _dereq_('spica/global');
3097
3137
  const alias_1 = _dereq_('spica/alias');
3098
3138
  const memoize_1 = _dereq_('spica/memoize');
3099
- const array_1 = _dereq_('spica/array');
3100
3139
  var caches;
3101
3140
  (function (caches) {
3102
3141
  caches.shadows = new WeakMap();
3103
3142
  caches.fragment = global_1.document.createDocumentFragment();
3104
3143
  }(caches || (caches = {})));
3105
3144
  function shadow(el, children, opts) {
3145
+ var _a, _b;
3106
3146
  if (typeof el === 'string')
3107
3147
  return shadow((0, exports.html)(el), children, opts);
3108
3148
  if (children && !isChildren(children))
3109
3149
  return shadow(el, void 0, children);
3110
- const root = opts === void 0 ? el.shadowRoot || caches.shadows.get(el) : opts.mode === 'open' ? el.shadowRoot || void 0 : caches.shadows.get(el);
3111
- return defineChildren(!opts || opts.mode === 'open' ? root || el.attachShadow(opts || { mode: 'open' }) : root || caches.shadows.set(el, el.attachShadow(opts)).get(el), !root && children == void 0 ? el.childNodes : children);
3150
+ const root = opts === void 0 ? (_a = el.shadowRoot) !== null && _a !== void 0 ? _a : caches.shadows.get(el) : opts.mode === 'open' ? (_b = el.shadowRoot) !== null && _b !== void 0 ? _b : void 0 : caches.shadows.get(el);
3151
+ return defineChildren(!opts || opts.mode === 'open' ? root !== null && root !== void 0 ? root : el.attachShadow(opts !== null && opts !== void 0 ? opts : { mode: 'open' }) : root !== null && root !== void 0 ? root : caches.shadows.set(el, el.attachShadow(opts)).get(el), !root && children === void 0 ? el.childNodes : children);
3112
3152
  }
3113
3153
  exports.shadow = shadow;
3114
3154
  function frag(children) {
@@ -3179,7 +3219,9 @@ require = function () {
3179
3219
  return el;
3180
3220
  }
3181
3221
  function defineChildren(node, children) {
3182
- children && node.replaceChildren(...typeof children === 'string' ? [children] : children);
3222
+ if (children === void 0)
3223
+ return node;
3224
+ node.replaceChildren(...typeof children === 'string' ? [children] : children);
3183
3225
  return node;
3184
3226
  }
3185
3227
  function isChildren(o) {
@@ -3200,12 +3242,11 @@ require = function () {
3200
3242
  },
3201
3243
  {
3202
3244
  'spica/alias': 4,
3203
- 'spica/array': 5,
3204
- 'spica/global': 8,
3205
- 'spica/memoize': 9
3245
+ 'spica/global': 9,
3246
+ 'spica/memoize': 10
3206
3247
  }
3207
3248
  ],
3208
- 16: [
3249
+ 17: [
3209
3250
  function (_dereq_, module, exports) {
3210
3251
  'use strict';
3211
3252
  var _a;
@@ -3217,11 +3258,11 @@ require = function () {
3217
3258
  exports.identity = (0, random_1.unique)(random_1.rnd0Z, 2, (_a = global_1.global[ids]) !== null && _a !== void 0 ? _a : global_1.global[ids] = new global_1.Set());
3218
3259
  },
3219
3260
  {
3220
- 'spica/global': 8,
3221
- 'spica/random': 12
3261
+ 'spica/global': 9,
3262
+ 'spica/random': 13
3222
3263
  }
3223
3264
  ],
3224
- 17: [
3265
+ 18: [
3225
3266
  function (_dereq_, module, exports) {
3226
3267
  'use strict';
3227
3268
  Object.defineProperty(exports, '__esModule', { value: true });
@@ -3254,7 +3295,7 @@ require = function () {
3254
3295
  var _a, _b;
3255
3296
  unbind();
3256
3297
  const cx = ev.target.shadowRoot ? (_a = ev.composedPath()[0]) === null || _a === void 0 ? void 0 : _a.closest(selector) : (_b = ev.target) === null || _b === void 0 ? void 0 : _b.closest(selector);
3257
- return cx ? unbind = once(cx, type, listener, option) : void 0, ev.returnValue;
3298
+ return cx ? unbind = once(cx, type, listener, option) : void 0;
3258
3299
  }, {
3259
3300
  ...option,
3260
3301
  capture: true
@@ -3263,20 +3304,21 @@ require = function () {
3263
3304
  exports.delegate = delegate;
3264
3305
  function bind(target, type, listener, option = false) {
3265
3306
  target.addEventListener(type, handler, option);
3266
- return (0, function_1.once)(() => void target.removeEventListener(type, handler, option));
3307
+ return (0, function_1.singleton)(() => void target.removeEventListener(type, handler, option));
3267
3308
  function handler(ev) {
3268
- return exports.currentTarget in ev && !ev[exports.currentTarget] ? void 0 : ev[exports.currentTarget] = ev.currentTarget, listener(ev);
3309
+ ev[exports.currentTarget] = ev.currentTarget;
3310
+ return listener(ev);
3269
3311
  }
3270
3312
  }
3271
3313
  exports.bind = bind;
3272
3314
  },
3273
3315
  {
3274
- 'spica/function': 7,
3275
- 'spica/noop': 10,
3276
- 'spica/promise': 11
3316
+ 'spica/function': 8,
3317
+ 'spica/noop': 11,
3318
+ 'spica/promise': 12
3277
3319
  }
3278
3320
  ],
3279
- 18: [
3321
+ 19: [
3280
3322
  function (_dereq_, module, exports) {
3281
3323
  'use strict';
3282
3324
  Object.defineProperty(exports, '__esModule', { value: true });
@@ -3291,7 +3333,7 @@ require = function () {
3291
3333
  }
3292
3334
  exports.apply = apply;
3293
3335
  },
3294
- { './dom': 15 }
3336
+ { './dom': 16 }
3295
3337
  ],
3296
3338
  'typed-dom': [
3297
3339
  function (_dereq_, module, exports) {
@@ -3433,13 +3475,13 @@ require = function () {
3433
3475
  });
3434
3476
  },
3435
3477
  {
3436
- './src/builder': 13,
3437
- './src/proxy': 14,
3438
- './src/util/dom': 15,
3439
- './src/util/identity': 16,
3440
- './src/util/listener': 17,
3441
- './src/util/query': 18,
3442
- 'spica/global': 8
3478
+ './src/builder': 14,
3479
+ './src/proxy': 15,
3480
+ './src/util/dom': 16,
3481
+ './src/util/identity': 17,
3482
+ './src/util/listener': 18,
3483
+ './src/util/query': 19,
3484
+ 'spica/global': 9
3443
3485
  }
3444
3486
  ]
3445
3487
  }, {}, [
@@ -6201,10 +6243,10 @@ require = function () {
6201
6243
  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)([
6202
6244
  (0, source_1.str)(/^>*(?=>>)/),
6203
6245
  anchor_1.anchor
6204
- ]))), ([el, str = '']) => [
6246
+ ]))), ([el, quotes = '']) => [
6205
6247
  (0, typed_dom_1.html)('span', { class: 'cite' }, (0, typed_dom_1.defrag)([
6206
- str + '>',
6207
- (0, typed_dom_1.define)(el, { 'data-depth': `${ str.length + 1 }` }, el.innerText.slice(1))
6248
+ quotes + '>',
6249
+ (0, typed_dom_1.define)(el, { 'data-depth': `${ quotes.length + 1 }` }, el.innerText.slice(1))
6208
6250
  ])),
6209
6251
  (0, typed_dom_1.html)('br')
6210
6252
  ])));
@@ -7652,7 +7694,7 @@ require = function () {
7652
7694
  if ((0, parser_1.eval)((0, combinator_1.some)(autolink_1.autolink)((0, util_1.stringify)(content), context), []).some(node => typeof node === 'object'))
7653
7695
  return;
7654
7696
  const INSECURE_URI = params.shift();
7655
- const el = create(INSECURE_URI, (0, typed_dom_1.defrag)(content), new url_1.ReadonlyURL(resolve(INSECURE_URI, context.host || global_1.location, context.url || global_1.location), ((_a = context.host) === null || _a === void 0 ? void 0 : _a.href) || global_1.location.href), ((_b = context.host) === null || _b === void 0 ? void 0 : _b.origin) || global_1.location.origin);
7697
+ const el = create(INSECURE_URI, (0, util_1.trimEnd)((0, typed_dom_1.defrag)(content)), new url_1.ReadonlyURL(resolve(INSECURE_URI, context.host || global_1.location, context.url || global_1.location), ((_a = context.host) === null || _a === void 0 ? void 0 : _a.href) || global_1.location.href), ((_b = context.host) === null || _b === void 0 ? void 0 : _b.origin) || global_1.location.origin);
7656
7698
  if (el.classList.contains('invalid'))
7657
7699
  return [
7658
7700
  [el],
@@ -9019,7 +9061,7 @@ require = function () {
9019
9061
  function verifyStartTight(nodes) {
9020
9062
  if (nodes.length === 0)
9021
9063
  return true;
9022
- return isVisible(nodes[0]);
9064
+ return isVisible(nodes[0], 0);
9023
9065
  }
9024
9066
  exports.verifyStartTight = verifyStartTight;
9025
9067
  function verifyEndTight(nodes) {
@@ -9029,7 +9071,7 @@ require = function () {
9029
9071
  return typeof nodes[last] === 'string' && nodes[last].length > 1 ? isVisible(nodes[last], -1) || isVisible(nodes[last], -2) : isVisible(nodes[last], -1) || last === 0 || isVisible(nodes[last - 1], -1);
9030
9072
  }
9031
9073
  exports.verifyEndTight = verifyEndTight;
9032
- function isVisible(node, position = 0) {
9074
+ function isVisible(node, position) {
9033
9075
  if (!node)
9034
9076
  return false;
9035
9077
  switch (typeof node) {
@@ -9252,7 +9294,7 @@ require = function () {
9252
9294
  }
9253
9295
  exports.math = math;
9254
9296
  async function queue(target, callback = () => global_1.undefined) {
9255
- MathJax.typesetPromise || await MathJax.startup.promise;
9297
+ !MathJax.typesetPromise && await MathJax.startup.promise;
9256
9298
  MathJax.typesetPromise([target]).then(callback);
9257
9299
  }
9258
9300
  },