securemark 0.268.1 → 0.268.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,9 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.268.2
4
+
5
+ - Refactoring.
6
+
3
7
  ## 0.268.1
4
8
 
5
9
  - Refactoring.
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! securemark v0.268.1 https://github.com/falsandtru/securemark | (c) 2017, falsandtru | UNLICENSED License */
1
+ /*! securemark v0.268.2 https://github.com/falsandtru/securemark | (c) 2017, falsandtru | UNLICENSED License */
2
2
  (function webpackUniversalModuleDefinition(root, factory) {
3
3
  if(typeof exports === 'object' && typeof module === 'object')
4
4
  module.exports = factory(require("Prism"), require("DOMPurify"));
@@ -6143,12 +6143,13 @@ function identity(id, text, name = 'index') {
6143
6143
  if (id === '') return undefined;
6144
6144
  text &&= text.trim().replace(/\s+/g, '_');
6145
6145
  if (text === '') return undefined;
6146
- if (text.length <= 100) return `${name}:${id ?? ''}:${text}`;
6146
+ const cs = [...text];
6147
+ if (cs.length <= 100) return `${name}:${id ?? ''}:${text}`;
6147
6148
  switch (name) {
6148
6149
  case 'index':
6149
- return `${name}:${id ?? ''}:${text.slice(0, 97)}...`;
6150
+ return `${name}:${id ?? ''}:${cs.slice(0, 97).join('')}...`;
6150
6151
  case 'mark':
6151
- return `${name}:${id ?? ''}:${text.slice(0, 50)}...${text.slice(-47)}`;
6152
+ return `${name}:${id ?? ''}:${cs.slice(0, 50).join('')}...${cs.slice(-47).join('')}`;
6152
6153
  }
6153
6154
  }
6154
6155
  exports.identity = identity;
@@ -8388,7 +8389,7 @@ function unlink(h) {
8388
8389
  /***/ 3252:
8389
8390
  /***/ (function(module) {
8390
8391
 
8391
- /*! typed-dom v0.0.316 https://github.com/falsandtru/typed-dom | (c) 2016, falsandtru | (Apache-2.0 AND MPL-2.0) License */
8392
+ /*! typed-dom v0.0.317 https://github.com/falsandtru/typed-dom | (c) 2016, falsandtru | (Apache-2.0 AND MPL-2.0) License */
8392
8393
  (function webpackUniversalModuleDefinition(root, factory) {
8393
8394
  if(true)
8394
8395
  module.exports = factory();
@@ -8719,7 +8720,7 @@ exports.defrag = defrag;
8719
8720
  /***/ 6120:
8720
8721
  /***/ (function(module) {
8721
8722
 
8722
- /*! typed-dom v0.0.316 https://github.com/falsandtru/typed-dom | (c) 2016, falsandtru | (Apache-2.0 AND MPL-2.0) License */
8723
+ /*! typed-dom v0.0.317 https://github.com/falsandtru/typed-dom | (c) 2016, falsandtru | (Apache-2.0 AND MPL-2.0) License */
8723
8724
  (function webpackUniversalModuleDefinition(root, factory) {
8724
8725
  if(true)
8725
8726
  module.exports = factory();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "securemark",
3
- "version": "0.268.1",
3
+ "version": "0.268.2",
4
4
  "description": "Secure markdown renderer working on browsers for user input data.",
5
5
  "private": false,
6
6
  "homepage": "https://github.com/falsandtru/securemark",
@@ -34,7 +34,7 @@
34
34
  "@types/mocha": "10.0.1",
35
35
  "@types/power-assert": "1.5.8",
36
36
  "@types/prismjs": "1.26.0",
37
- "@typescript-eslint/parser": "^5.53.0",
37
+ "@typescript-eslint/parser": "^5.54.0",
38
38
  "babel-loader": "^9.1.2",
39
39
  "babel-plugin-unassert": "^3.2.0",
40
40
  "concurrently": "^7.6.0",
@@ -49,11 +49,11 @@
49
49
  "karma-mocha": "^2.0.1",
50
50
  "karma-power-assert": "^1.0.0",
51
51
  "mocha": "^10.2.0",
52
- "npm-check-updates": "^16.7.9",
52
+ "npm-check-updates": "^16.7.10",
53
53
  "semver": "^7.3.8",
54
54
  "spica": "0.0.719",
55
55
  "ts-loader": "^9.4.2",
56
- "typed-dom": "^0.0.316",
56
+ "typed-dom": "^0.0.317",
57
57
  "typescript": "4.9.5",
58
58
  "webpack": "^5.75.0",
59
59
  "webpack-cli": "^5.0.1",
@@ -14,12 +14,13 @@ export function identity(id: string | undefined, text: string, name: 'index' | '
14
14
  if (id === '') return undefined;
15
15
  text &&= text.trim().replace(/\s+/g, '_');
16
16
  if (text === '') return undefined;
17
- if (text.length <= 100) return `${name}:${id ?? ''}:${text}`;
17
+ const cs = [...text];
18
+ if (cs.length <= 100) return `${name}:${id ?? ''}:${text}`;
18
19
  switch (name) {
19
20
  case 'index':
20
- return `${name}:${id ?? ''}:${text.slice(0, 97)}...`;
21
+ return `${name}:${id ?? ''}:${cs.slice(0, 97).join('')}...`;
21
22
  case 'mark':
22
- return `${name}:${id ?? ''}:${text.slice(0, 50)}...${text.slice(-47)}`;
23
+ return `${name}:${id ?? ''}:${cs.slice(0, 50).join('')}...${cs.slice(-47).join('')}`;
23
24
  }
24
25
  assert(false);
25
26
  }
package/src/util/info.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import type { ParseSelector } from 'typed-query-selector/parser';
1
2
  import { Info } from '../..';
2
3
  import { scope } from './scope';
3
4
 
@@ -16,9 +17,10 @@ export function info(source: DocumentFragment | HTMLElement | ShadowRoot): Info
16
17
  media: find('.media[data-src]'),
17
18
  };
18
19
 
19
- function find<T extends HTMLElement>(selector: string): T[] {
20
- const acc: T[] = [];
21
- for (let es = source.querySelectorAll<T>(selector),
20
+ function find<T extends string>(selector: T): ParseSelector<T, HTMLElement>[];
21
+ function find(selector: string): HTMLElement[] {
22
+ const acc = [];
23
+ for (let es = source.querySelectorAll<HTMLElement>(selector),
22
24
  len = es.length, i = 0; i < len; ++i) {
23
25
  const el = es[i];
24
26
  match(el) && acc.push(el);