@bpmn-io/form-js-playground 1.11.2 → 1.12.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/dist/form-playground.umd.js +1288 -1325
- package/dist/index.cjs.map +1 -1
- package/dist/index.es.js.map +1 -1
- package/package.json +7 -7
|
@@ -461,18 +461,6 @@
|
|
|
461
461
|
ClassList.prototype.has = ClassList.prototype.contains = function (name) {
|
|
462
462
|
return this.list.contains(name);
|
|
463
463
|
};
|
|
464
|
-
|
|
465
|
-
/**
|
|
466
|
-
* Closest
|
|
467
|
-
*
|
|
468
|
-
* @param {Element} el
|
|
469
|
-
* @param {string} selector
|
|
470
|
-
* @param {boolean} checkYourSelf (optional)
|
|
471
|
-
*/
|
|
472
|
-
function closest(element, selector, checkYourSelf) {
|
|
473
|
-
var actualElement = element ;
|
|
474
|
-
return actualElement && typeof actualElement.closest === 'function' && actualElement.closest(selector) || null;
|
|
475
|
-
}
|
|
476
464
|
var componentEvent = {};
|
|
477
465
|
var bind$1, unbind$1, prefix;
|
|
478
466
|
function detect() {
|
|
@@ -613,16 +601,6 @@
|
|
|
613
601
|
return fragment;
|
|
614
602
|
}
|
|
615
603
|
var domify$1 = domify;
|
|
616
|
-
|
|
617
|
-
/**
|
|
618
|
-
* @param { HTMLElement } element
|
|
619
|
-
* @param { String } selector
|
|
620
|
-
*
|
|
621
|
-
* @return { boolean }
|
|
622
|
-
*/
|
|
623
|
-
function matches$2(element, selector) {
|
|
624
|
-
return element && typeof element.matches === 'function' && element.matches(selector) || false;
|
|
625
|
-
}
|
|
626
604
|
function query(selector, el) {
|
|
627
605
|
el = el || document;
|
|
628
606
|
return el.querySelector(selector);
|
|
@@ -15799,7 +15777,7 @@
|
|
|
15799
15777
|
null != e && "textarea" === n.type && "value" in t && t.value !== e.value && (e.value = null == t.value ? "" : t.value);
|
|
15800
15778
|
};
|
|
15801
15779
|
|
|
15802
|
-
/*! @license DOMPurify 3.
|
|
15780
|
+
/*! @license DOMPurify 3.2.0 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.2.0/LICENSE */
|
|
15803
15781
|
|
|
15804
15782
|
const {
|
|
15805
15783
|
entries,
|
|
@@ -15849,12 +15827,11 @@
|
|
|
15849
15827
|
const objectHasOwnProperty = unapply(Object.prototype.hasOwnProperty);
|
|
15850
15828
|
const regExpTest = unapply(RegExp.prototype.test);
|
|
15851
15829
|
const typeErrorCreate = unconstruct(TypeError);
|
|
15852
|
-
|
|
15853
15830
|
/**
|
|
15854
15831
|
* Creates a new function that calls the given function with a specified thisArg and arguments.
|
|
15855
15832
|
*
|
|
15856
|
-
* @param
|
|
15857
|
-
* @returns
|
|
15833
|
+
* @param func - The function to be wrapped and called.
|
|
15834
|
+
* @returns A new function that calls the given function with a specified thisArg and arguments.
|
|
15858
15835
|
*/
|
|
15859
15836
|
function unapply(func) {
|
|
15860
15837
|
return function (thisArg) {
|
|
@@ -15864,12 +15841,11 @@
|
|
|
15864
15841
|
return apply(func, thisArg, args);
|
|
15865
15842
|
};
|
|
15866
15843
|
}
|
|
15867
|
-
|
|
15868
15844
|
/**
|
|
15869
15845
|
* Creates a new function that constructs an instance of the given constructor function with the provided arguments.
|
|
15870
15846
|
*
|
|
15871
|
-
* @param
|
|
15872
|
-
* @returns
|
|
15847
|
+
* @param func - The constructor function to be wrapped and called.
|
|
15848
|
+
* @returns A new function that constructs an instance of the given constructor function with the provided arguments.
|
|
15873
15849
|
*/
|
|
15874
15850
|
function unconstruct(func) {
|
|
15875
15851
|
return function () {
|
|
@@ -15879,14 +15855,13 @@
|
|
|
15879
15855
|
return construct(func, args);
|
|
15880
15856
|
};
|
|
15881
15857
|
}
|
|
15882
|
-
|
|
15883
15858
|
/**
|
|
15884
15859
|
* Add properties to a lookup table
|
|
15885
15860
|
*
|
|
15886
|
-
* @param
|
|
15887
|
-
* @param
|
|
15888
|
-
* @param
|
|
15889
|
-
* @returns
|
|
15861
|
+
* @param set - The set to which elements will be added.
|
|
15862
|
+
* @param array - The array containing elements to be added to the set.
|
|
15863
|
+
* @param transformCaseFunc - An optional function to transform the case of each element before adding to the set.
|
|
15864
|
+
* @returns The modified set with added elements.
|
|
15890
15865
|
*/
|
|
15891
15866
|
function addToSet(set, array) {
|
|
15892
15867
|
let transformCaseFunc = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : stringToLowerCase;
|
|
@@ -15913,12 +15888,11 @@
|
|
|
15913
15888
|
}
|
|
15914
15889
|
return set;
|
|
15915
15890
|
}
|
|
15916
|
-
|
|
15917
15891
|
/**
|
|
15918
15892
|
* Clean up an array to harden against CSPP
|
|
15919
15893
|
*
|
|
15920
|
-
* @param
|
|
15921
|
-
* @returns
|
|
15894
|
+
* @param array - The array to be cleaned.
|
|
15895
|
+
* @returns The cleaned version of the array
|
|
15922
15896
|
*/
|
|
15923
15897
|
function cleanArray(array) {
|
|
15924
15898
|
for (let index = 0; index < array.length; index++) {
|
|
@@ -15929,12 +15903,11 @@
|
|
|
15929
15903
|
}
|
|
15930
15904
|
return array;
|
|
15931
15905
|
}
|
|
15932
|
-
|
|
15933
15906
|
/**
|
|
15934
15907
|
* Shallow clone an object
|
|
15935
15908
|
*
|
|
15936
|
-
* @param
|
|
15937
|
-
* @returns
|
|
15909
|
+
* @param object - The object to be cloned.
|
|
15910
|
+
* @returns A new object that copies the original.
|
|
15938
15911
|
*/
|
|
15939
15912
|
function clone$1(object) {
|
|
15940
15913
|
const newObject = create(null);
|
|
@@ -15952,13 +15925,12 @@
|
|
|
15952
15925
|
}
|
|
15953
15926
|
return newObject;
|
|
15954
15927
|
}
|
|
15955
|
-
|
|
15956
15928
|
/**
|
|
15957
15929
|
* This method automatically checks if the prop is function or getter and behaves accordingly.
|
|
15958
15930
|
*
|
|
15959
|
-
* @param
|
|
15960
|
-
* @param
|
|
15961
|
-
* @returns
|
|
15931
|
+
* @param object - The object to look up the getter function in its prototype chain.
|
|
15932
|
+
* @param prop - The property name for which to find the getter function.
|
|
15933
|
+
* @returns The getter function found in the prototype chain or a fallback function.
|
|
15962
15934
|
*/
|
|
15963
15935
|
function lookupGetter(object, prop) {
|
|
15964
15936
|
while (object !== null) {
|
|
@@ -15979,24 +15951,21 @@
|
|
|
15979
15951
|
return fallbackValue;
|
|
15980
15952
|
}
|
|
15981
15953
|
const html$1 = freeze(['a', 'abbr', 'acronym', 'address', 'area', 'article', 'aside', 'audio', 'b', 'bdi', 'bdo', 'big', 'blink', 'blockquote', 'body', 'br', 'button', 'canvas', 'caption', 'center', 'cite', 'code', 'col', 'colgroup', 'content', 'data', 'datalist', 'dd', 'decorator', 'del', 'details', 'dfn', 'dialog', 'dir', 'div', 'dl', 'dt', 'element', 'em', 'fieldset', 'figcaption', 'figure', 'font', 'footer', 'form', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'head', 'header', 'hgroup', 'hr', 'html', 'i', 'img', 'input', 'ins', 'kbd', 'label', 'legend', 'li', 'main', 'map', 'mark', 'marquee', 'menu', 'menuitem', 'meter', 'nav', 'nobr', 'ol', 'optgroup', 'option', 'output', 'p', 'picture', 'pre', 'progress', 'q', 'rp', 'rt', 'ruby', 's', 'samp', 'section', 'select', 'shadow', 'small', 'source', 'spacer', 'span', 'strike', 'strong', 'style', 'sub', 'summary', 'sup', 'table', 'tbody', 'td', 'template', 'textarea', 'tfoot', 'th', 'thead', 'time', 'tr', 'track', 'tt', 'u', 'ul', 'var', 'video', 'wbr']);
|
|
15982
|
-
|
|
15983
15954
|
// SVG
|
|
15984
15955
|
const svg$1 = freeze(['svg', 'a', 'altglyph', 'altglyphdef', 'altglyphitem', 'animatecolor', 'animatemotion', 'animatetransform', 'circle', 'clippath', 'defs', 'desc', 'ellipse', 'filter', 'font', 'g', 'glyph', 'glyphref', 'hkern', 'image', 'line', 'lineargradient', 'marker', 'mask', 'metadata', 'mpath', 'path', 'pattern', 'polygon', 'polyline', 'radialgradient', 'rect', 'stop', 'style', 'switch', 'symbol', 'text', 'textpath', 'title', 'tref', 'tspan', 'view', 'vkern']);
|
|
15985
15956
|
const svgFilters = freeze(['feBlend', 'feColorMatrix', 'feComponentTransfer', 'feComposite', 'feConvolveMatrix', 'feDiffuseLighting', 'feDisplacementMap', 'feDistantLight', 'feDropShadow', 'feFlood', 'feFuncA', 'feFuncB', 'feFuncG', 'feFuncR', 'feGaussianBlur', 'feImage', 'feMerge', 'feMergeNode', 'feMorphology', 'feOffset', 'fePointLight', 'feSpecularLighting', 'feSpotLight', 'feTile', 'feTurbulence']);
|
|
15986
|
-
|
|
15987
15957
|
// List of SVG elements that are disallowed by default.
|
|
15988
15958
|
// We still need to know them so that we can do namespace
|
|
15989
15959
|
// checks properly in case one wants to add them to
|
|
15990
15960
|
// allow-list.
|
|
15991
15961
|
const svgDisallowed = freeze(['animate', 'color-profile', 'cursor', 'discard', 'font-face', 'font-face-format', 'font-face-name', 'font-face-src', 'font-face-uri', 'foreignobject', 'hatch', 'hatchpath', 'mesh', 'meshgradient', 'meshpatch', 'meshrow', 'missing-glyph', 'script', 'set', 'solidcolor', 'unknown', 'use']);
|
|
15992
15962
|
const mathMl$1 = freeze(['math', 'menclose', 'merror', 'mfenced', 'mfrac', 'mglyph', 'mi', 'mlabeledtr', 'mmultiscripts', 'mn', 'mo', 'mover', 'mpadded', 'mphantom', 'mroot', 'mrow', 'ms', 'mspace', 'msqrt', 'mstyle', 'msub', 'msup', 'msubsup', 'mtable', 'mtd', 'mtext', 'mtr', 'munder', 'munderover', 'mprescripts']);
|
|
15993
|
-
|
|
15994
15963
|
// Similarly to SVG, we want to know all MathML elements,
|
|
15995
15964
|
// even those that we disallow by default.
|
|
15996
15965
|
const mathMlDisallowed = freeze(['maction', 'maligngroup', 'malignmark', 'mlongdiv', 'mscarries', 'mscarry', 'msgroup', 'mstack', 'msline', 'msrow', 'semantics', 'annotation', 'annotation-xml', 'mprescripts', 'none']);
|
|
15997
15966
|
const text = freeze(['#text']);
|
|
15998
15967
|
const html$2 = freeze(['accept', 'action', 'align', 'alt', 'autocapitalize', 'autocomplete', 'autopictureinpicture', 'autoplay', 'background', 'bgcolor', 'border', 'capture', 'cellpadding', 'cellspacing', 'checked', 'cite', 'class', 'clear', 'color', 'cols', 'colspan', 'controls', 'controlslist', 'coords', 'crossorigin', 'datetime', 'decoding', 'default', 'dir', 'disabled', 'disablepictureinpicture', 'disableremoteplayback', 'download', 'draggable', 'enctype', 'enterkeyhint', 'face', 'for', 'headers', 'height', 'hidden', 'high', 'href', 'hreflang', 'id', 'inputmode', 'integrity', 'ismap', 'kind', 'label', 'lang', 'list', 'loading', 'loop', 'low', 'max', 'maxlength', 'media', 'method', 'min', 'minlength', 'multiple', 'muted', 'name', 'nonce', 'noshade', 'novalidate', 'nowrap', 'open', 'optimum', 'pattern', 'placeholder', 'playsinline', 'popover', 'popovertarget', 'popovertargetaction', 'poster', 'preload', 'pubdate', 'radiogroup', 'readonly', 'rel', 'required', 'rev', 'reversed', 'role', 'rows', 'rowspan', 'spellcheck', 'scope', 'selected', 'shape', 'size', 'sizes', 'span', 'srclang', 'start', 'src', 'srcset', 'step', 'style', 'summary', 'tabindex', 'title', 'translate', 'type', 'usemap', 'valign', 'value', 'width', 'wrap', 'xmlns', 'slot']);
|
|
15999
|
-
const svg$2 = freeze(['accent-height', 'accumulate', 'additive', 'alignment-baseline', 'ascent', 'attributename', 'attributetype', 'azimuth', 'basefrequency', 'baseline-shift', 'begin', 'bias', 'by', 'class', 'clip', 'clippathunits', 'clip-path', 'clip-rule', 'color', 'color-interpolation', 'color-interpolation-filters', 'color-profile', 'color-rendering', 'cx', 'cy', 'd', 'dx', 'dy', 'diffuseconstant', 'direction', 'display', 'divisor', 'dur', 'edgemode', 'elevation', 'end', 'fill', 'fill-opacity', 'fill-rule', 'filter', 'filterunits', 'flood-color', 'flood-opacity', 'font-family', 'font-size', 'font-size-adjust', 'font-stretch', 'font-style', 'font-variant', 'font-weight', 'fx', 'fy', 'g1', 'g2', 'glyph-name', 'glyphref', 'gradientunits', 'gradienttransform', 'height', 'href', 'id', 'image-rendering', 'in', 'in2', 'k', 'k1', 'k2', 'k3', 'k4', 'kerning', 'keypoints', 'keysplines', 'keytimes', 'lang', 'lengthadjust', 'letter-spacing', 'kernelmatrix', 'kernelunitlength', 'lighting-color', 'local', 'marker-end', 'marker-mid', 'marker-start', 'markerheight', 'markerunits', 'markerwidth', 'maskcontentunits', 'maskunits', 'max', 'mask', 'media', 'method', 'mode', 'min', 'name', 'numoctaves', 'offset', 'operator', 'opacity', 'order', 'orient', 'orientation', 'origin', 'overflow', 'paint-order', 'path', 'pathlength', 'patterncontentunits', 'patterntransform', 'patternunits', 'points', 'preservealpha', 'preserveaspectratio', 'primitiveunits', 'r', 'rx', 'ry', 'radius', 'refx', 'refy', 'repeatcount', 'repeatdur', 'restart', 'result', 'rotate', 'scale', 'seed', 'shape-rendering', 'specularconstant', 'specularexponent', 'spreadmethod', 'startoffset', 'stddeviation', 'stitchtiles', 'stop-color', 'stop-opacity', 'stroke-dasharray', 'stroke-dashoffset', 'stroke-linecap', 'stroke-linejoin', 'stroke-miterlimit', 'stroke-opacity', 'stroke', 'stroke-width', 'style', 'surfacescale', 'systemlanguage', 'tabindex', 'targetx', 'targety', 'transform', 'transform-origin', 'text-anchor', 'text-decoration', 'text-rendering', 'textlength', 'type', 'u1', 'u2', 'unicode', 'values', 'viewbox', 'visibility', 'version', 'vert-adv-y', 'vert-origin-x', 'vert-origin-y', 'width', 'word-spacing', 'wrap', 'writing-mode', 'xchannelselector', 'ychannelselector', 'x', 'x1', 'x2', 'xmlns', 'y', 'y1', 'y2', 'z', 'zoomandpan']);
|
|
15968
|
+
const svg$2 = freeze(['accent-height', 'accumulate', 'additive', 'alignment-baseline', 'amplitude', 'ascent', 'attributename', 'attributetype', 'azimuth', 'basefrequency', 'baseline-shift', 'begin', 'bias', 'by', 'class', 'clip', 'clippathunits', 'clip-path', 'clip-rule', 'color', 'color-interpolation', 'color-interpolation-filters', 'color-profile', 'color-rendering', 'cx', 'cy', 'd', 'dx', 'dy', 'diffuseconstant', 'direction', 'display', 'divisor', 'dur', 'edgemode', 'elevation', 'end', 'exponent', 'fill', 'fill-opacity', 'fill-rule', 'filter', 'filterunits', 'flood-color', 'flood-opacity', 'font-family', 'font-size', 'font-size-adjust', 'font-stretch', 'font-style', 'font-variant', 'font-weight', 'fx', 'fy', 'g1', 'g2', 'glyph-name', 'glyphref', 'gradientunits', 'gradienttransform', 'height', 'href', 'id', 'image-rendering', 'in', 'in2', 'intercept', 'k', 'k1', 'k2', 'k3', 'k4', 'kerning', 'keypoints', 'keysplines', 'keytimes', 'lang', 'lengthadjust', 'letter-spacing', 'kernelmatrix', 'kernelunitlength', 'lighting-color', 'local', 'marker-end', 'marker-mid', 'marker-start', 'markerheight', 'markerunits', 'markerwidth', 'maskcontentunits', 'maskunits', 'max', 'mask', 'media', 'method', 'mode', 'min', 'name', 'numoctaves', 'offset', 'operator', 'opacity', 'order', 'orient', 'orientation', 'origin', 'overflow', 'paint-order', 'path', 'pathlength', 'patterncontentunits', 'patterntransform', 'patternunits', 'points', 'preservealpha', 'preserveaspectratio', 'primitiveunits', 'r', 'rx', 'ry', 'radius', 'refx', 'refy', 'repeatcount', 'repeatdur', 'restart', 'result', 'rotate', 'scale', 'seed', 'shape-rendering', 'slope', 'specularconstant', 'specularexponent', 'spreadmethod', 'startoffset', 'stddeviation', 'stitchtiles', 'stop-color', 'stop-opacity', 'stroke-dasharray', 'stroke-dashoffset', 'stroke-linecap', 'stroke-linejoin', 'stroke-miterlimit', 'stroke-opacity', 'stroke', 'stroke-width', 'style', 'surfacescale', 'systemlanguage', 'tabindex', 'tablevalues', 'targetx', 'targety', 'transform', 'transform-origin', 'text-anchor', 'text-decoration', 'text-rendering', 'textlength', 'type', 'u1', 'u2', 'unicode', 'values', 'viewbox', 'visibility', 'version', 'vert-adv-y', 'vert-origin-x', 'vert-origin-y', 'width', 'word-spacing', 'wrap', 'writing-mode', 'xchannelselector', 'ychannelselector', 'x', 'x1', 'x2', 'xmlns', 'y', 'y1', 'y2', 'z', 'zoomandpan']);
|
|
16000
15969
|
const mathMl = freeze(['accent', 'accentunder', 'align', 'bevelled', 'close', 'columnsalign', 'columnlines', 'columnspan', 'denomalign', 'depth', 'dir', 'display', 'displaystyle', 'encoding', 'fence', 'frame', 'height', 'href', 'id', 'largeop', 'length', 'linethickness', 'lspace', 'lquote', 'mathbackground', 'mathcolor', 'mathsize', 'mathvariant', 'maxsize', 'minsize', 'movablelimits', 'notation', 'numalign', 'open', 'rowalign', 'rowlines', 'rowspacing', 'rowspan', 'rspace', 'rquote', 'scriptlevel', 'scriptminsize', 'scriptsizemultiplier', 'selection', 'separator', 'separators', 'stretchy', 'subscriptshift', 'supscriptshift', 'symmetric', 'voffset', 'width', 'xmlns']);
|
|
16001
15970
|
const xml = freeze(['xlink:href', 'xml:id', 'xlink:title', 'xml:space', 'xmlns:xlink']);
|
|
16002
15971
|
|
|
@@ -16015,18 +15984,19 @@
|
|
|
16015
15984
|
const CUSTOM_ELEMENT = seal(/^[a-z][.\w]*(-[.\w]+)+$/i);
|
|
16016
15985
|
var EXPRESSIONS = /*#__PURE__*/Object.freeze({
|
|
16017
15986
|
__proto__: null,
|
|
16018
|
-
MUSTACHE_EXPR: MUSTACHE_EXPR,
|
|
16019
|
-
ERB_EXPR: ERB_EXPR,
|
|
16020
|
-
TMPLIT_EXPR: TMPLIT_EXPR,
|
|
16021
|
-
DATA_ATTR: DATA_ATTR,
|
|
16022
15987
|
ARIA_ATTR: ARIA_ATTR,
|
|
16023
|
-
IS_ALLOWED_URI: IS_ALLOWED_URI,
|
|
16024
|
-
IS_SCRIPT_OR_DATA: IS_SCRIPT_OR_DATA,
|
|
16025
15988
|
ATTR_WHITESPACE: ATTR_WHITESPACE,
|
|
15989
|
+
CUSTOM_ELEMENT: CUSTOM_ELEMENT,
|
|
15990
|
+
DATA_ATTR: DATA_ATTR,
|
|
16026
15991
|
DOCTYPE_NAME: DOCTYPE_NAME,
|
|
16027
|
-
|
|
15992
|
+
ERB_EXPR: ERB_EXPR,
|
|
15993
|
+
IS_ALLOWED_URI: IS_ALLOWED_URI,
|
|
15994
|
+
IS_SCRIPT_OR_DATA: IS_SCRIPT_OR_DATA,
|
|
15995
|
+
MUSTACHE_EXPR: MUSTACHE_EXPR,
|
|
15996
|
+
TMPLIT_EXPR: TMPLIT_EXPR
|
|
16028
15997
|
});
|
|
16029
15998
|
|
|
15999
|
+
/* eslint-disable @typescript-eslint/indent */
|
|
16030
16000
|
// https://developer.mozilla.org/en-US/docs/Web/API/Node/nodeType
|
|
16031
16001
|
const NODE_TYPE = {
|
|
16032
16002
|
element: 1,
|
|
@@ -16047,20 +16017,18 @@
|
|
|
16047
16017
|
const getGlobal = function getGlobal() {
|
|
16048
16018
|
return typeof window === 'undefined' ? null : window;
|
|
16049
16019
|
};
|
|
16050
|
-
|
|
16051
16020
|
/**
|
|
16052
16021
|
* Creates a no-op policy for internal use only.
|
|
16053
16022
|
* Don't export this function outside this module!
|
|
16054
|
-
* @param
|
|
16055
|
-
* @param
|
|
16056
|
-
* @return
|
|
16023
|
+
* @param trustedTypes The policy factory.
|
|
16024
|
+
* @param purifyHostElement The Script element used to load DOMPurify (to determine policy name suffix).
|
|
16025
|
+
* @return The policy created (or null, if Trusted Types
|
|
16057
16026
|
* are not supported or creating the policy failed).
|
|
16058
16027
|
*/
|
|
16059
16028
|
const _createTrustedTypesPolicy = function _createTrustedTypesPolicy(trustedTypes, purifyHostElement) {
|
|
16060
16029
|
if (typeof trustedTypes !== 'object' || typeof trustedTypes.createPolicy !== 'function') {
|
|
16061
16030
|
return null;
|
|
16062
16031
|
}
|
|
16063
|
-
|
|
16064
16032
|
// Allow the callers to control the unique policy name
|
|
16065
16033
|
// by adding a data-tt-policy-suffix to the script element with the DOMPurify.
|
|
16066
16034
|
// Policy creation with duplicate names throws in Trusted Types.
|
|
@@ -16090,17 +16058,7 @@
|
|
|
16090
16058
|
function createDOMPurify() {
|
|
16091
16059
|
let window = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : getGlobal();
|
|
16092
16060
|
const DOMPurify = root => createDOMPurify(root);
|
|
16093
|
-
|
|
16094
|
-
/**
|
|
16095
|
-
* Version label, exposed for easier checks
|
|
16096
|
-
* if DOMPurify is up to date or not
|
|
16097
|
-
*/
|
|
16098
|
-
DOMPurify.version = '3.1.6';
|
|
16099
|
-
|
|
16100
|
-
/**
|
|
16101
|
-
* Array of elements that DOMPurify removed during sanitation.
|
|
16102
|
-
* Empty if nothing was removed.
|
|
16103
|
-
*/
|
|
16061
|
+
DOMPurify.version = '3.2.0';
|
|
16104
16062
|
DOMPurify.removed = [];
|
|
16105
16063
|
if (!window || !window.document || window.document.nodeType !== NODE_TYPE.document) {
|
|
16106
16064
|
// Not running in a browser, provide a factory function
|
|
@@ -16130,7 +16088,6 @@
|
|
|
16130
16088
|
const getNextSibling = lookupGetter(ElementPrototype, 'nextSibling');
|
|
16131
16089
|
const getChildNodes = lookupGetter(ElementPrototype, 'childNodes');
|
|
16132
16090
|
const getParentNode = lookupGetter(ElementPrototype, 'parentNode');
|
|
16133
|
-
|
|
16134
16091
|
// As per issue #47, the web-components registry is inherited by a
|
|
16135
16092
|
// new document created via createHTMLDocument. As per the spec
|
|
16136
16093
|
// (http://w3c.github.io/webcomponents/spec/custom/#creating-and-passing-registries)
|
|
@@ -16155,7 +16112,6 @@
|
|
|
16155
16112
|
importNode
|
|
16156
16113
|
} = originalDocument;
|
|
16157
16114
|
let hooks = {};
|
|
16158
|
-
|
|
16159
16115
|
/**
|
|
16160
16116
|
* Expose whether this browser supports running the full DOMPurify.
|
|
16161
16117
|
*/
|
|
@@ -16173,22 +16129,18 @@
|
|
|
16173
16129
|
let {
|
|
16174
16130
|
IS_ALLOWED_URI: IS_ALLOWED_URI$1
|
|
16175
16131
|
} = EXPRESSIONS;
|
|
16176
|
-
|
|
16177
16132
|
/**
|
|
16178
16133
|
* We consider the elements and attributes below to be safe. Ideally
|
|
16179
16134
|
* don't add any new ones but feel free to remove unwanted ones.
|
|
16180
16135
|
*/
|
|
16181
|
-
|
|
16182
16136
|
/* allowed element names */
|
|
16183
16137
|
let ALLOWED_TAGS = null;
|
|
16184
16138
|
const DEFAULT_ALLOWED_TAGS = addToSet({}, [...html$1, ...svg$1, ...svgFilters, ...mathMl$1, ...text]);
|
|
16185
|
-
|
|
16186
16139
|
/* Allowed attribute names */
|
|
16187
16140
|
let ALLOWED_ATTR = null;
|
|
16188
16141
|
const DEFAULT_ALLOWED_ATTR = addToSet({}, [...html$2, ...svg$2, ...mathMl, ...xml]);
|
|
16189
|
-
|
|
16190
16142
|
/*
|
|
16191
|
-
* Configure how
|
|
16143
|
+
* Configure how DOMPurify should handle custom elements and their attributes as well as customized built-in elements.
|
|
16192
16144
|
* @property {RegExp|Function|null} tagNameCheck one of [null, regexPattern, predicate]. Default: `null` (disallow any custom elements)
|
|
16193
16145
|
* @property {RegExp|Function|null} attributeNameCheck one of [null, regexPattern, predicate]. Default: `null` (disallow any attributes not on the allow list)
|
|
16194
16146
|
* @property {boolean} allowCustomizedBuiltInElements allow custom elements derived from built-ins if they pass CUSTOM_ELEMENT_HANDLING.tagNameCheck. Default: `false`.
|
|
@@ -16213,65 +16165,49 @@
|
|
|
16213
16165
|
value: false
|
|
16214
16166
|
}
|
|
16215
16167
|
}));
|
|
16216
|
-
|
|
16217
16168
|
/* Explicitly forbidden tags (overrides ALLOWED_TAGS/ADD_TAGS) */
|
|
16218
16169
|
let FORBID_TAGS = null;
|
|
16219
|
-
|
|
16220
16170
|
/* Explicitly forbidden attributes (overrides ALLOWED_ATTR/ADD_ATTR) */
|
|
16221
16171
|
let FORBID_ATTR = null;
|
|
16222
|
-
|
|
16223
16172
|
/* Decide if ARIA attributes are okay */
|
|
16224
16173
|
let ALLOW_ARIA_ATTR = true;
|
|
16225
|
-
|
|
16226
16174
|
/* Decide if custom data attributes are okay */
|
|
16227
16175
|
let ALLOW_DATA_ATTR = true;
|
|
16228
|
-
|
|
16229
16176
|
/* Decide if unknown protocols are okay */
|
|
16230
16177
|
let ALLOW_UNKNOWN_PROTOCOLS = false;
|
|
16231
|
-
|
|
16232
16178
|
/* Decide if self-closing tags in attributes are allowed.
|
|
16233
16179
|
* Usually removed due to a mXSS issue in jQuery 3.0 */
|
|
16234
16180
|
let ALLOW_SELF_CLOSE_IN_ATTR = true;
|
|
16235
|
-
|
|
16236
16181
|
/* Output should be safe for common template engines.
|
|
16237
16182
|
* This means, DOMPurify removes data attributes, mustaches and ERB
|
|
16238
16183
|
*/
|
|
16239
16184
|
let SAFE_FOR_TEMPLATES = false;
|
|
16240
|
-
|
|
16241
16185
|
/* Output should be safe even for XML used within HTML and alike.
|
|
16242
16186
|
* This means, DOMPurify removes comments when containing risky content.
|
|
16243
16187
|
*/
|
|
16244
16188
|
let SAFE_FOR_XML = true;
|
|
16245
|
-
|
|
16246
16189
|
/* Decide if document with <html>... should be returned */
|
|
16247
16190
|
let WHOLE_DOCUMENT = false;
|
|
16248
|
-
|
|
16249
16191
|
/* Track whether config is already set on this instance of DOMPurify. */
|
|
16250
16192
|
let SET_CONFIG = false;
|
|
16251
|
-
|
|
16252
16193
|
/* Decide if all elements (e.g. style, script) must be children of
|
|
16253
16194
|
* document.body. By default, browsers might move them to document.head */
|
|
16254
16195
|
let FORCE_BODY = false;
|
|
16255
|
-
|
|
16256
16196
|
/* Decide if a DOM `HTMLBodyElement` should be returned, instead of a html
|
|
16257
16197
|
* string (or a TrustedHTML object if Trusted Types are supported).
|
|
16258
16198
|
* If `WHOLE_DOCUMENT` is enabled a `HTMLHtmlElement` will be returned instead
|
|
16259
16199
|
*/
|
|
16260
16200
|
let RETURN_DOM = false;
|
|
16261
|
-
|
|
16262
16201
|
/* Decide if a DOM `DocumentFragment` should be returned, instead of a html
|
|
16263
16202
|
* string (or a TrustedHTML object if Trusted Types are supported) */
|
|
16264
16203
|
let RETURN_DOM_FRAGMENT = false;
|
|
16265
|
-
|
|
16266
16204
|
/* Try to return a Trusted Type object instead of a string, return a string in
|
|
16267
16205
|
* case Trusted Types are not supported */
|
|
16268
16206
|
let RETURN_TRUSTED_TYPE = false;
|
|
16269
|
-
|
|
16270
16207
|
/* Output should be free from DOM clobbering attacks?
|
|
16271
16208
|
* This sanitizes markups named with colliding, clobberable built-in DOM APIs.
|
|
16272
16209
|
*/
|
|
16273
16210
|
let SANITIZE_DOM = true;
|
|
16274
|
-
|
|
16275
16211
|
/* Achieve full DOM Clobbering protection by isolating the namespace of named
|
|
16276
16212
|
* properties and JS variables, mitigating attacks that abuse the HTML/DOM spec rules.
|
|
16277
16213
|
*
|
|
@@ -16287,25 +16223,19 @@
|
|
|
16287
16223
|
*/
|
|
16288
16224
|
let SANITIZE_NAMED_PROPS = false;
|
|
16289
16225
|
const SANITIZE_NAMED_PROPS_PREFIX = 'user-content-';
|
|
16290
|
-
|
|
16291
16226
|
/* Keep element content when removing element? */
|
|
16292
16227
|
let KEEP_CONTENT = true;
|
|
16293
|
-
|
|
16294
16228
|
/* If a `Node` is passed to sanitize(), then performs sanitization in-place instead
|
|
16295
16229
|
* of importing it into a new Document and returning a sanitized copy */
|
|
16296
16230
|
let IN_PLACE = false;
|
|
16297
|
-
|
|
16298
16231
|
/* Allow usage of profiles like html, svg and mathMl */
|
|
16299
16232
|
let USE_PROFILES = {};
|
|
16300
|
-
|
|
16301
16233
|
/* Tags to ignore content of when KEEP_CONTENT is true */
|
|
16302
16234
|
let FORBID_CONTENTS = null;
|
|
16303
16235
|
const DEFAULT_FORBID_CONTENTS = addToSet({}, ['annotation-xml', 'audio', 'colgroup', 'desc', 'foreignobject', 'head', 'iframe', 'math', 'mi', 'mn', 'mo', 'ms', 'mtext', 'noembed', 'noframes', 'noscript', 'plaintext', 'script', 'style', 'svg', 'template', 'thead', 'title', 'video', 'xmp']);
|
|
16304
|
-
|
|
16305
16236
|
/* Tags that are safe for data: URIs */
|
|
16306
16237
|
let DATA_URI_TAGS = null;
|
|
16307
16238
|
const DEFAULT_DATA_URI_TAGS = addToSet({}, ['audio', 'video', 'img', 'source', 'image', 'track']);
|
|
16308
|
-
|
|
16309
16239
|
/* Attributes safe for values like "javascript:" */
|
|
16310
16240
|
let URI_SAFE_ATTRIBUTES = null;
|
|
16311
16241
|
const DEFAULT_URI_SAFE_ATTRIBUTES = addToSet({}, ['alt', 'class', 'for', 'id', 'label', 'name', 'pattern', 'placeholder', 'role', 'summary', 'title', 'value', 'style', 'xmlns']);
|
|
@@ -16315,32 +16245,33 @@
|
|
|
16315
16245
|
/* Document namespace */
|
|
16316
16246
|
let NAMESPACE = HTML_NAMESPACE;
|
|
16317
16247
|
let IS_EMPTY_INPUT = false;
|
|
16318
|
-
|
|
16319
16248
|
/* Allowed XHTML+XML namespaces */
|
|
16320
16249
|
let ALLOWED_NAMESPACES = null;
|
|
16321
16250
|
const DEFAULT_ALLOWED_NAMESPACES = addToSet({}, [MATHML_NAMESPACE, SVG_NAMESPACE, HTML_NAMESPACE], stringToString);
|
|
16322
|
-
|
|
16251
|
+
let MATHML_TEXT_INTEGRATION_POINTS = addToSet({}, ['mi', 'mo', 'mn', 'ms', 'mtext']);
|
|
16252
|
+
let HTML_INTEGRATION_POINTS = addToSet({}, ['annotation-xml']);
|
|
16253
|
+
// Certain elements are allowed in both SVG and HTML
|
|
16254
|
+
// namespace. We need to specify them explicitly
|
|
16255
|
+
// so that they don't get erroneously deleted from
|
|
16256
|
+
// HTML namespace.
|
|
16257
|
+
const COMMON_SVG_AND_HTML_ELEMENTS = addToSet({}, ['title', 'style', 'font', 'a', 'script']);
|
|
16323
16258
|
/* Parsing of strict XHTML documents */
|
|
16324
16259
|
let PARSER_MEDIA_TYPE = null;
|
|
16325
16260
|
const SUPPORTED_PARSER_MEDIA_TYPES = ['application/xhtml+xml', 'text/html'];
|
|
16326
16261
|
const DEFAULT_PARSER_MEDIA_TYPE = 'text/html';
|
|
16327
16262
|
let transformCaseFunc = null;
|
|
16328
|
-
|
|
16329
16263
|
/* Keep a reference to config to pass to hooks */
|
|
16330
16264
|
let CONFIG = null;
|
|
16331
|
-
|
|
16332
16265
|
/* Ideally, do not touch anything below this line */
|
|
16333
16266
|
/* ______________________________________________ */
|
|
16334
|
-
|
|
16335
16267
|
const formElement = document.createElement('form');
|
|
16336
16268
|
const isRegexOrFunction = function isRegexOrFunction(testValue) {
|
|
16337
16269
|
return testValue instanceof RegExp || testValue instanceof Function;
|
|
16338
16270
|
};
|
|
16339
|
-
|
|
16340
16271
|
/**
|
|
16341
16272
|
* _parseConfig
|
|
16342
16273
|
*
|
|
16343
|
-
* @param
|
|
16274
|
+
* @param cfg optional config literal
|
|
16344
16275
|
*/
|
|
16345
16276
|
// eslint-disable-next-line complexity
|
|
16346
16277
|
const _parseConfig = function _parseConfig() {
|
|
@@ -16348,39 +16279,23 @@
|
|
|
16348
16279
|
if (CONFIG && CONFIG === cfg) {
|
|
16349
16280
|
return;
|
|
16350
16281
|
}
|
|
16351
|
-
|
|
16352
16282
|
/* Shield configuration object from tampering */
|
|
16353
16283
|
if (!cfg || typeof cfg !== 'object') {
|
|
16354
16284
|
cfg = {};
|
|
16355
16285
|
}
|
|
16356
|
-
|
|
16357
16286
|
/* Shield configuration object from prototype pollution */
|
|
16358
16287
|
cfg = clone$1(cfg);
|
|
16359
16288
|
PARSER_MEDIA_TYPE =
|
|
16360
16289
|
// eslint-disable-next-line unicorn/prefer-includes
|
|
16361
16290
|
SUPPORTED_PARSER_MEDIA_TYPES.indexOf(cfg.PARSER_MEDIA_TYPE) === -1 ? DEFAULT_PARSER_MEDIA_TYPE : cfg.PARSER_MEDIA_TYPE;
|
|
16362
|
-
|
|
16363
16291
|
// HTML tags and attributes are not case-sensitive, converting to lowercase. Keeping XHTML as is.
|
|
16364
16292
|
transformCaseFunc = PARSER_MEDIA_TYPE === 'application/xhtml+xml' ? stringToString : stringToLowerCase;
|
|
16365
|
-
|
|
16366
16293
|
/* Set configuration parameters */
|
|
16367
16294
|
ALLOWED_TAGS = objectHasOwnProperty(cfg, 'ALLOWED_TAGS') ? addToSet({}, cfg.ALLOWED_TAGS, transformCaseFunc) : DEFAULT_ALLOWED_TAGS;
|
|
16368
16295
|
ALLOWED_ATTR = objectHasOwnProperty(cfg, 'ALLOWED_ATTR') ? addToSet({}, cfg.ALLOWED_ATTR, transformCaseFunc) : DEFAULT_ALLOWED_ATTR;
|
|
16369
16296
|
ALLOWED_NAMESPACES = objectHasOwnProperty(cfg, 'ALLOWED_NAMESPACES') ? addToSet({}, cfg.ALLOWED_NAMESPACES, stringToString) : DEFAULT_ALLOWED_NAMESPACES;
|
|
16370
|
-
URI_SAFE_ATTRIBUTES = objectHasOwnProperty(cfg, 'ADD_URI_SAFE_ATTR') ? addToSet(clone$1(DEFAULT_URI_SAFE_ATTRIBUTES),
|
|
16371
|
-
|
|
16372
|
-
cfg.ADD_URI_SAFE_ATTR,
|
|
16373
|
-
// eslint-disable-line indent
|
|
16374
|
-
transformCaseFunc // eslint-disable-line indent
|
|
16375
|
-
) // eslint-disable-line indent
|
|
16376
|
-
: DEFAULT_URI_SAFE_ATTRIBUTES;
|
|
16377
|
-
DATA_URI_TAGS = objectHasOwnProperty(cfg, 'ADD_DATA_URI_TAGS') ? addToSet(clone$1(DEFAULT_DATA_URI_TAGS),
|
|
16378
|
-
// eslint-disable-line indent
|
|
16379
|
-
cfg.ADD_DATA_URI_TAGS,
|
|
16380
|
-
// eslint-disable-line indent
|
|
16381
|
-
transformCaseFunc // eslint-disable-line indent
|
|
16382
|
-
) // eslint-disable-line indent
|
|
16383
|
-
: DEFAULT_DATA_URI_TAGS;
|
|
16297
|
+
URI_SAFE_ATTRIBUTES = objectHasOwnProperty(cfg, 'ADD_URI_SAFE_ATTR') ? addToSet(clone$1(DEFAULT_URI_SAFE_ATTRIBUTES), cfg.ADD_URI_SAFE_ATTR, transformCaseFunc) : DEFAULT_URI_SAFE_ATTRIBUTES;
|
|
16298
|
+
DATA_URI_TAGS = objectHasOwnProperty(cfg, 'ADD_DATA_URI_TAGS') ? addToSet(clone$1(DEFAULT_DATA_URI_TAGS), cfg.ADD_DATA_URI_TAGS, transformCaseFunc) : DEFAULT_DATA_URI_TAGS;
|
|
16384
16299
|
FORBID_CONTENTS = objectHasOwnProperty(cfg, 'FORBID_CONTENTS') ? addToSet({}, cfg.FORBID_CONTENTS, transformCaseFunc) : DEFAULT_FORBID_CONTENTS;
|
|
16385
16300
|
FORBID_TAGS = objectHasOwnProperty(cfg, 'FORBID_TAGS') ? addToSet({}, cfg.FORBID_TAGS, transformCaseFunc) : {};
|
|
16386
16301
|
FORBID_ATTR = objectHasOwnProperty(cfg, 'FORBID_ATTR') ? addToSet({}, cfg.FORBID_ATTR, transformCaseFunc) : {};
|
|
@@ -16402,6 +16317,8 @@
|
|
|
16402
16317
|
IN_PLACE = cfg.IN_PLACE || false; // Default false
|
|
16403
16318
|
IS_ALLOWED_URI$1 = cfg.ALLOWED_URI_REGEXP || IS_ALLOWED_URI;
|
|
16404
16319
|
NAMESPACE = cfg.NAMESPACE || HTML_NAMESPACE;
|
|
16320
|
+
MATHML_TEXT_INTEGRATION_POINTS = cfg.MATHML_TEXT_INTEGRATION_POINTS || MATHML_TEXT_INTEGRATION_POINTS;
|
|
16321
|
+
HTML_INTEGRATION_POINTS = cfg.HTML_INTEGRATION_POINTS || HTML_INTEGRATION_POINTS;
|
|
16405
16322
|
CUSTOM_ELEMENT_HANDLING = cfg.CUSTOM_ELEMENT_HANDLING || {};
|
|
16406
16323
|
if (cfg.CUSTOM_ELEMENT_HANDLING && isRegexOrFunction(cfg.CUSTOM_ELEMENT_HANDLING.tagNameCheck)) {
|
|
16407
16324
|
CUSTOM_ELEMENT_HANDLING.tagNameCheck = cfg.CUSTOM_ELEMENT_HANDLING.tagNameCheck;
|
|
@@ -16418,7 +16335,6 @@
|
|
|
16418
16335
|
if (RETURN_DOM_FRAGMENT) {
|
|
16419
16336
|
RETURN_DOM = true;
|
|
16420
16337
|
}
|
|
16421
|
-
|
|
16422
16338
|
/* Parse profile info */
|
|
16423
16339
|
if (USE_PROFILES) {
|
|
16424
16340
|
ALLOWED_TAGS = addToSet({}, text);
|
|
@@ -16443,7 +16359,6 @@
|
|
|
16443
16359
|
addToSet(ALLOWED_ATTR, xml);
|
|
16444
16360
|
}
|
|
16445
16361
|
}
|
|
16446
|
-
|
|
16447
16362
|
/* Merge configuration parameters */
|
|
16448
16363
|
if (cfg.ADD_TAGS) {
|
|
16449
16364
|
if (ALLOWED_TAGS === DEFAULT_ALLOWED_TAGS) {
|
|
@@ -16466,17 +16381,14 @@
|
|
|
16466
16381
|
}
|
|
16467
16382
|
addToSet(FORBID_CONTENTS, cfg.FORBID_CONTENTS, transformCaseFunc);
|
|
16468
16383
|
}
|
|
16469
|
-
|
|
16470
16384
|
/* Add #text in case KEEP_CONTENT is set to true */
|
|
16471
16385
|
if (KEEP_CONTENT) {
|
|
16472
16386
|
ALLOWED_TAGS['#text'] = true;
|
|
16473
16387
|
}
|
|
16474
|
-
|
|
16475
16388
|
/* Add html, head and body to ALLOWED_TAGS in case WHOLE_DOCUMENT is true */
|
|
16476
16389
|
if (WHOLE_DOCUMENT) {
|
|
16477
16390
|
addToSet(ALLOWED_TAGS, ['html', 'head', 'body']);
|
|
16478
16391
|
}
|
|
16479
|
-
|
|
16480
16392
|
/* Add tbody to ALLOWED_TAGS in case tables are permitted, see #286, #365 */
|
|
16481
16393
|
if (ALLOWED_TAGS.table) {
|
|
16482
16394
|
addToSet(ALLOWED_TAGS, ['tbody']);
|
|
@@ -16489,10 +16401,8 @@
|
|
|
16489
16401
|
if (typeof cfg.TRUSTED_TYPES_POLICY.createScriptURL !== 'function') {
|
|
16490
16402
|
throw typeErrorCreate('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');
|
|
16491
16403
|
}
|
|
16492
|
-
|
|
16493
16404
|
// Overwrite existing TrustedTypes policy.
|
|
16494
16405
|
trustedTypesPolicy = cfg.TRUSTED_TYPES_POLICY;
|
|
16495
|
-
|
|
16496
16406
|
// Sign local variables required by `sanitize`.
|
|
16497
16407
|
emptyHTML = trustedTypesPolicy.createHTML('');
|
|
16498
16408
|
} else {
|
|
@@ -16500,13 +16410,11 @@
|
|
|
16500
16410
|
if (trustedTypesPolicy === undefined) {
|
|
16501
16411
|
trustedTypesPolicy = _createTrustedTypesPolicy(trustedTypes, currentScript);
|
|
16502
16412
|
}
|
|
16503
|
-
|
|
16504
16413
|
// If creating the internal policy succeeded sign internal variables.
|
|
16505
16414
|
if (trustedTypesPolicy !== null && typeof emptyHTML === 'string') {
|
|
16506
16415
|
emptyHTML = trustedTypesPolicy.createHTML('');
|
|
16507
16416
|
}
|
|
16508
16417
|
}
|
|
16509
|
-
|
|
16510
16418
|
// Prevent further manipulation of configuration.
|
|
16511
16419
|
// Not available in IE8, Safari 5, etc.
|
|
16512
16420
|
if (freeze) {
|
|
@@ -16514,30 +16422,19 @@
|
|
|
16514
16422
|
}
|
|
16515
16423
|
CONFIG = cfg;
|
|
16516
16424
|
};
|
|
16517
|
-
const MATHML_TEXT_INTEGRATION_POINTS = addToSet({}, ['mi', 'mo', 'mn', 'ms', 'mtext']);
|
|
16518
|
-
const HTML_INTEGRATION_POINTS = addToSet({}, ['foreignobject', 'annotation-xml']);
|
|
16519
|
-
|
|
16520
|
-
// Certain elements are allowed in both SVG and HTML
|
|
16521
|
-
// namespace. We need to specify them explicitly
|
|
16522
|
-
// so that they don't get erroneously deleted from
|
|
16523
|
-
// HTML namespace.
|
|
16524
|
-
const COMMON_SVG_AND_HTML_ELEMENTS = addToSet({}, ['title', 'style', 'font', 'a', 'script']);
|
|
16525
|
-
|
|
16526
16425
|
/* Keep track of all possible SVG and MathML tags
|
|
16527
16426
|
* so that we can perform the namespace checks
|
|
16528
16427
|
* correctly. */
|
|
16529
16428
|
const ALL_SVG_TAGS = addToSet({}, [...svg$1, ...svgFilters, ...svgDisallowed]);
|
|
16530
16429
|
const ALL_MATHML_TAGS = addToSet({}, [...mathMl$1, ...mathMlDisallowed]);
|
|
16531
|
-
|
|
16532
16430
|
/**
|
|
16533
|
-
* @param
|
|
16534
|
-
* @returns
|
|
16431
|
+
* @param element a DOM element whose namespace is being checked
|
|
16432
|
+
* @returns Return false if the element has a
|
|
16535
16433
|
* namespace that a spec-compliant parser would never
|
|
16536
16434
|
* return. Return true otherwise.
|
|
16537
16435
|
*/
|
|
16538
16436
|
const _checkValidNamespace = function _checkValidNamespace(element) {
|
|
16539
16437
|
let parent = getParentNode(element);
|
|
16540
|
-
|
|
16541
16438
|
// In JSDOM, if we're inside shadow DOM, then parentNode
|
|
16542
16439
|
// can be null. We just simulate parent in this case.
|
|
16543
16440
|
if (!parent || !parent.tagName) {
|
|
@@ -16558,14 +16455,12 @@
|
|
|
16558
16455
|
if (parent.namespaceURI === HTML_NAMESPACE) {
|
|
16559
16456
|
return tagName === 'svg';
|
|
16560
16457
|
}
|
|
16561
|
-
|
|
16562
16458
|
// The only way to switch from MathML to SVG is via`
|
|
16563
16459
|
// svg if parent is either <annotation-xml> or MathML
|
|
16564
16460
|
// text integration points.
|
|
16565
16461
|
if (parent.namespaceURI === MATHML_NAMESPACE) {
|
|
16566
16462
|
return tagName === 'svg' && (parentTagName === 'annotation-xml' || MATHML_TEXT_INTEGRATION_POINTS[parentTagName]);
|
|
16567
16463
|
}
|
|
16568
|
-
|
|
16569
16464
|
// We only allow elements that are defined in SVG
|
|
16570
16465
|
// spec. All others are disallowed in SVG namespace.
|
|
16571
16466
|
return Boolean(ALL_SVG_TAGS[tagName]);
|
|
@@ -16577,13 +16472,11 @@
|
|
|
16577
16472
|
if (parent.namespaceURI === HTML_NAMESPACE) {
|
|
16578
16473
|
return tagName === 'math';
|
|
16579
16474
|
}
|
|
16580
|
-
|
|
16581
16475
|
// The only way to switch from SVG to MathML is via
|
|
16582
16476
|
// <math> and HTML integration points
|
|
16583
16477
|
if (parent.namespaceURI === SVG_NAMESPACE) {
|
|
16584
16478
|
return tagName === 'math' && HTML_INTEGRATION_POINTS[parentTagName];
|
|
16585
16479
|
}
|
|
16586
|
-
|
|
16587
16480
|
// We only allow elements that are defined in MathML
|
|
16588
16481
|
// spec. All others are disallowed in MathML namespace.
|
|
16589
16482
|
return Boolean(ALL_MATHML_TAGS[tagName]);
|
|
@@ -16598,28 +16491,24 @@
|
|
|
16598
16491
|
if (parent.namespaceURI === MATHML_NAMESPACE && !MATHML_TEXT_INTEGRATION_POINTS[parentTagName]) {
|
|
16599
16492
|
return false;
|
|
16600
16493
|
}
|
|
16601
|
-
|
|
16602
16494
|
// We disallow tags that are specific for MathML
|
|
16603
16495
|
// or SVG and should never appear in HTML namespace
|
|
16604
16496
|
return !ALL_MATHML_TAGS[tagName] && (COMMON_SVG_AND_HTML_ELEMENTS[tagName] || !ALL_SVG_TAGS[tagName]);
|
|
16605
16497
|
}
|
|
16606
|
-
|
|
16607
16498
|
// For XHTML and XML documents that support custom namespaces
|
|
16608
16499
|
if (PARSER_MEDIA_TYPE === 'application/xhtml+xml' && ALLOWED_NAMESPACES[element.namespaceURI]) {
|
|
16609
16500
|
return true;
|
|
16610
16501
|
}
|
|
16611
|
-
|
|
16612
16502
|
// The code should never reach this place (this means
|
|
16613
16503
|
// that the element somehow got namespace that is not
|
|
16614
16504
|
// HTML, SVG, MathML or allowed via ALLOWED_NAMESPACES).
|
|
16615
16505
|
// Return false just in case.
|
|
16616
16506
|
return false;
|
|
16617
16507
|
};
|
|
16618
|
-
|
|
16619
16508
|
/**
|
|
16620
16509
|
* _forceRemove
|
|
16621
16510
|
*
|
|
16622
|
-
* @param
|
|
16511
|
+
* @param node a DOM node
|
|
16623
16512
|
*/
|
|
16624
16513
|
const _forceRemove = function _forceRemove(node) {
|
|
16625
16514
|
arrayPush(DOMPurify.removed, {
|
|
@@ -16632,46 +16521,43 @@
|
|
|
16632
16521
|
remove(node);
|
|
16633
16522
|
}
|
|
16634
16523
|
};
|
|
16635
|
-
|
|
16636
16524
|
/**
|
|
16637
16525
|
* _removeAttribute
|
|
16638
16526
|
*
|
|
16639
|
-
* @param
|
|
16640
|
-
* @param
|
|
16527
|
+
* @param name an Attribute name
|
|
16528
|
+
* @param element a DOM node
|
|
16641
16529
|
*/
|
|
16642
|
-
const _removeAttribute = function _removeAttribute(name,
|
|
16530
|
+
const _removeAttribute = function _removeAttribute(name, element) {
|
|
16643
16531
|
try {
|
|
16644
16532
|
arrayPush(DOMPurify.removed, {
|
|
16645
|
-
attribute:
|
|
16646
|
-
from:
|
|
16533
|
+
attribute: element.getAttributeNode(name),
|
|
16534
|
+
from: element
|
|
16647
16535
|
});
|
|
16648
16536
|
} catch (_) {
|
|
16649
16537
|
arrayPush(DOMPurify.removed, {
|
|
16650
16538
|
attribute: null,
|
|
16651
|
-
from:
|
|
16539
|
+
from: element
|
|
16652
16540
|
});
|
|
16653
16541
|
}
|
|
16654
|
-
|
|
16655
|
-
|
|
16542
|
+
element.removeAttribute(name);
|
|
16656
16543
|
// We void attribute values for unremovable "is"" attributes
|
|
16657
16544
|
if (name === 'is' && !ALLOWED_ATTR[name]) {
|
|
16658
16545
|
if (RETURN_DOM || RETURN_DOM_FRAGMENT) {
|
|
16659
16546
|
try {
|
|
16660
|
-
_forceRemove(
|
|
16547
|
+
_forceRemove(element);
|
|
16661
16548
|
} catch (_) {}
|
|
16662
16549
|
} else {
|
|
16663
16550
|
try {
|
|
16664
|
-
|
|
16551
|
+
element.setAttribute(name, '');
|
|
16665
16552
|
} catch (_) {}
|
|
16666
16553
|
}
|
|
16667
16554
|
}
|
|
16668
16555
|
};
|
|
16669
|
-
|
|
16670
16556
|
/**
|
|
16671
16557
|
* _initDocument
|
|
16672
16558
|
*
|
|
16673
|
-
* @param
|
|
16674
|
-
* @return
|
|
16559
|
+
* @param dirty - a string of dirty markup
|
|
16560
|
+
* @return a DOM, filled with the dirty markup
|
|
16675
16561
|
*/
|
|
16676
16562
|
const _initDocument = function _initDocument(dirty) {
|
|
16677
16563
|
/* Create a HTML document */
|
|
@@ -16698,7 +16584,6 @@
|
|
|
16698
16584
|
doc = new DOMParser().parseFromString(dirtyPayload, PARSER_MEDIA_TYPE);
|
|
16699
16585
|
} catch (_) {}
|
|
16700
16586
|
}
|
|
16701
|
-
|
|
16702
16587
|
/* Use createHTMLDocument in case DOMParser is not available */
|
|
16703
16588
|
if (!doc || !doc.documentElement) {
|
|
16704
16589
|
doc = implementation.createDocument(NAMESPACE, 'template', null);
|
|
@@ -16712,112 +16597,89 @@
|
|
|
16712
16597
|
if (dirty && leadingWhitespace) {
|
|
16713
16598
|
body.insertBefore(document.createTextNode(leadingWhitespace), body.childNodes[0] || null);
|
|
16714
16599
|
}
|
|
16715
|
-
|
|
16716
16600
|
/* Work on whole document or just its body */
|
|
16717
16601
|
if (NAMESPACE === HTML_NAMESPACE) {
|
|
16718
16602
|
return getElementsByTagName.call(doc, WHOLE_DOCUMENT ? 'html' : 'body')[0];
|
|
16719
16603
|
}
|
|
16720
16604
|
return WHOLE_DOCUMENT ? doc.documentElement : body;
|
|
16721
16605
|
};
|
|
16722
|
-
|
|
16723
16606
|
/**
|
|
16724
16607
|
* Creates a NodeIterator object that you can use to traverse filtered lists of nodes or elements in a document.
|
|
16725
16608
|
*
|
|
16726
|
-
* @param
|
|
16727
|
-
* @return
|
|
16609
|
+
* @param root The root element or node to start traversing on.
|
|
16610
|
+
* @return The created NodeIterator
|
|
16728
16611
|
*/
|
|
16729
16612
|
const _createNodeIterator = function _createNodeIterator(root) {
|
|
16730
16613
|
return createNodeIterator.call(root.ownerDocument || root, root,
|
|
16731
16614
|
// eslint-disable-next-line no-bitwise
|
|
16732
16615
|
NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_COMMENT | NodeFilter.SHOW_TEXT | NodeFilter.SHOW_PROCESSING_INSTRUCTION | NodeFilter.SHOW_CDATA_SECTION, null);
|
|
16733
16616
|
};
|
|
16734
|
-
|
|
16735
16617
|
/**
|
|
16736
16618
|
* _isClobbered
|
|
16737
16619
|
*
|
|
16738
|
-
* @param
|
|
16739
|
-
* @return
|
|
16620
|
+
* @param element element to check for clobbering attacks
|
|
16621
|
+
* @return true if clobbered, false if safe
|
|
16740
16622
|
*/
|
|
16741
|
-
const _isClobbered = function _isClobbered(
|
|
16742
|
-
return
|
|
16623
|
+
const _isClobbered = function _isClobbered(element) {
|
|
16624
|
+
return element instanceof HTMLFormElement && (typeof element.nodeName !== 'string' || typeof element.textContent !== 'string' || typeof element.removeChild !== 'function' || !(element.attributes instanceof NamedNodeMap) || typeof element.removeAttribute !== 'function' || typeof element.setAttribute !== 'function' || typeof element.namespaceURI !== 'string' || typeof element.insertBefore !== 'function' || typeof element.hasChildNodes !== 'function');
|
|
16743
16625
|
};
|
|
16744
|
-
|
|
16745
16626
|
/**
|
|
16746
16627
|
* Checks whether the given object is a DOM node.
|
|
16747
16628
|
*
|
|
16748
|
-
* @param
|
|
16749
|
-
* @return
|
|
16629
|
+
* @param value object to check whether it's a DOM node
|
|
16630
|
+
* @return true is object is a DOM node
|
|
16750
16631
|
*/
|
|
16751
|
-
const _isNode = function _isNode(
|
|
16752
|
-
return typeof Node === 'function' &&
|
|
16632
|
+
const _isNode = function _isNode(value) {
|
|
16633
|
+
return typeof Node === 'function' && value instanceof Node;
|
|
16753
16634
|
};
|
|
16754
|
-
|
|
16755
|
-
/**
|
|
16756
|
-
* _executeHook
|
|
16757
|
-
* Execute user configurable hooks
|
|
16758
|
-
*
|
|
16759
|
-
* @param {String} entryPoint Name of the hook's entry point
|
|
16760
|
-
* @param {Node} currentNode node to work on with the hook
|
|
16761
|
-
* @param {Object} data additional hook parameters
|
|
16762
|
-
*/
|
|
16763
|
-
const _executeHook = function _executeHook(entryPoint, currentNode, data) {
|
|
16635
|
+
function _executeHook(entryPoint, currentNode, data) {
|
|
16764
16636
|
if (!hooks[entryPoint]) {
|
|
16765
16637
|
return;
|
|
16766
16638
|
}
|
|
16767
16639
|
arrayForEach(hooks[entryPoint], hook => {
|
|
16768
16640
|
hook.call(DOMPurify, currentNode, data, CONFIG);
|
|
16769
16641
|
});
|
|
16770
|
-
}
|
|
16771
|
-
|
|
16642
|
+
}
|
|
16772
16643
|
/**
|
|
16773
16644
|
* _sanitizeElements
|
|
16774
16645
|
*
|
|
16775
16646
|
* @protect nodeName
|
|
16776
16647
|
* @protect textContent
|
|
16777
16648
|
* @protect removeChild
|
|
16778
|
-
*
|
|
16779
|
-
* @
|
|
16780
|
-
* @return {Boolean} true if node was killed, false if left alive
|
|
16649
|
+
* @param currentNode to check for permission to exist
|
|
16650
|
+
* @return true if node was killed, false if left alive
|
|
16781
16651
|
*/
|
|
16782
16652
|
const _sanitizeElements = function _sanitizeElements(currentNode) {
|
|
16783
16653
|
let content = null;
|
|
16784
|
-
|
|
16785
16654
|
/* Execute a hook if present */
|
|
16786
16655
|
_executeHook('beforeSanitizeElements', currentNode, null);
|
|
16787
|
-
|
|
16788
16656
|
/* Check if element is clobbered or can clobber */
|
|
16789
16657
|
if (_isClobbered(currentNode)) {
|
|
16790
16658
|
_forceRemove(currentNode);
|
|
16791
16659
|
return true;
|
|
16792
16660
|
}
|
|
16793
|
-
|
|
16794
16661
|
/* Now let's check the element's type and name */
|
|
16795
16662
|
const tagName = transformCaseFunc(currentNode.nodeName);
|
|
16796
|
-
|
|
16797
16663
|
/* Execute a hook if present */
|
|
16798
16664
|
_executeHook('uponSanitizeElement', currentNode, {
|
|
16799
16665
|
tagName,
|
|
16800
16666
|
allowedTags: ALLOWED_TAGS
|
|
16801
16667
|
});
|
|
16802
|
-
|
|
16803
16668
|
/* Detect mXSS attempts abusing namespace confusion */
|
|
16804
16669
|
if (currentNode.hasChildNodes() && !_isNode(currentNode.firstElementChild) && regExpTest(/<[/\w]/g, currentNode.innerHTML) && regExpTest(/<[/\w]/g, currentNode.textContent)) {
|
|
16805
16670
|
_forceRemove(currentNode);
|
|
16806
16671
|
return true;
|
|
16807
16672
|
}
|
|
16808
|
-
|
|
16809
16673
|
/* Remove any occurrence of processing instructions */
|
|
16810
16674
|
if (currentNode.nodeType === NODE_TYPE.progressingInstruction) {
|
|
16811
16675
|
_forceRemove(currentNode);
|
|
16812
16676
|
return true;
|
|
16813
16677
|
}
|
|
16814
|
-
|
|
16815
16678
|
/* Remove any kind of possibly harmful comments */
|
|
16816
16679
|
if (SAFE_FOR_XML && currentNode.nodeType === NODE_TYPE.comment && regExpTest(/<[/\w]/g, currentNode.data)) {
|
|
16817
16680
|
_forceRemove(currentNode);
|
|
16818
16681
|
return true;
|
|
16819
16682
|
}
|
|
16820
|
-
|
|
16821
16683
|
/* Remove element if anything forbids its presence */
|
|
16822
16684
|
if (!ALLOWED_TAGS[tagName] || FORBID_TAGS[tagName]) {
|
|
16823
16685
|
/* Check if we have a custom element to handle */
|
|
@@ -16829,7 +16691,6 @@
|
|
|
16829
16691
|
return false;
|
|
16830
16692
|
}
|
|
16831
16693
|
}
|
|
16832
|
-
|
|
16833
16694
|
/* Keep content except for bad-listed elements */
|
|
16834
16695
|
if (KEEP_CONTENT && !FORBID_CONTENTS[tagName]) {
|
|
16835
16696
|
const parentNode = getParentNode(currentNode) || currentNode.parentNode;
|
|
@@ -16846,19 +16707,16 @@
|
|
|
16846
16707
|
_forceRemove(currentNode);
|
|
16847
16708
|
return true;
|
|
16848
16709
|
}
|
|
16849
|
-
|
|
16850
16710
|
/* Check whether element has a valid namespace */
|
|
16851
16711
|
if (currentNode instanceof Element && !_checkValidNamespace(currentNode)) {
|
|
16852
16712
|
_forceRemove(currentNode);
|
|
16853
16713
|
return true;
|
|
16854
16714
|
}
|
|
16855
|
-
|
|
16856
16715
|
/* Make sure that older browsers don't get fallback-tag mXSS */
|
|
16857
16716
|
if ((tagName === 'noscript' || tagName === 'noembed' || tagName === 'noframes') && regExpTest(/<\/no(script|embed|frames)/i, currentNode.innerHTML)) {
|
|
16858
16717
|
_forceRemove(currentNode);
|
|
16859
16718
|
return true;
|
|
16860
16719
|
}
|
|
16861
|
-
|
|
16862
16720
|
/* Sanitize element content to be template-safe */
|
|
16863
16721
|
if (SAFE_FOR_TEMPLATES && currentNode.nodeType === NODE_TYPE.text) {
|
|
16864
16722
|
/* Get the element's text content */
|
|
@@ -16873,19 +16731,17 @@
|
|
|
16873
16731
|
currentNode.textContent = content;
|
|
16874
16732
|
}
|
|
16875
16733
|
}
|
|
16876
|
-
|
|
16877
16734
|
/* Execute a hook if present */
|
|
16878
16735
|
_executeHook('afterSanitizeElements', currentNode, null);
|
|
16879
16736
|
return false;
|
|
16880
16737
|
};
|
|
16881
|
-
|
|
16882
16738
|
/**
|
|
16883
16739
|
* _isValidAttribute
|
|
16884
16740
|
*
|
|
16885
|
-
* @param
|
|
16886
|
-
* @param
|
|
16887
|
-
* @param
|
|
16888
|
-
* @return
|
|
16741
|
+
* @param lcTag Lowercase tag name of containing element.
|
|
16742
|
+
* @param lcName Lowercase attribute name.
|
|
16743
|
+
* @param value Attribute value.
|
|
16744
|
+
* @return Returns true if `value` is valid, otherwise false.
|
|
16889
16745
|
*/
|
|
16890
16746
|
// eslint-disable-next-line complexity
|
|
16891
16747
|
const _isValidAttribute = function _isValidAttribute(lcTag, lcName, value) {
|
|
@@ -16893,7 +16749,6 @@
|
|
|
16893
16749
|
if (SANITIZE_DOM && (lcName === 'id' || lcName === 'name') && (value in document || value in formElement)) {
|
|
16894
16750
|
return false;
|
|
16895
16751
|
}
|
|
16896
|
-
|
|
16897
16752
|
/* Allow valid data-* attributes: At least one character after "-"
|
|
16898
16753
|
(https://html.spec.whatwg.org/multipage/dom.html#embedding-custom-non-visible-data-with-the-data-*-attributes)
|
|
16899
16754
|
XML-compatible (https://html.spec.whatwg.org/multipage/infrastructure.html#xml-compatible and http://www.w3.org/TR/xml/#d0e804)
|
|
@@ -16915,19 +16770,17 @@
|
|
|
16915
16770
|
} else ;
|
|
16916
16771
|
return true;
|
|
16917
16772
|
};
|
|
16918
|
-
|
|
16919
16773
|
/**
|
|
16920
16774
|
* _isBasicCustomElement
|
|
16921
16775
|
* checks if at least one dash is included in tagName, and it's not the first char
|
|
16922
16776
|
* for more sophisticated checking see https://github.com/sindresorhus/validate-element-name
|
|
16923
16777
|
*
|
|
16924
|
-
* @param
|
|
16925
|
-
* @returns
|
|
16778
|
+
* @param tagName name of the tag of the node to sanitize
|
|
16779
|
+
* @returns Returns true if the tag name meets the basic criteria for a custom element, otherwise false.
|
|
16926
16780
|
*/
|
|
16927
16781
|
const _isBasicCustomElement = function _isBasicCustomElement(tagName) {
|
|
16928
16782
|
return tagName !== 'annotation-xml' && stringMatch(tagName, CUSTOM_ELEMENT);
|
|
16929
16783
|
};
|
|
16930
|
-
|
|
16931
16784
|
/**
|
|
16932
16785
|
* _sanitizeAttributes
|
|
16933
16786
|
*
|
|
@@ -16936,7 +16789,7 @@
|
|
|
16936
16789
|
* @protect removeAttribute
|
|
16937
16790
|
* @protect setAttribute
|
|
16938
16791
|
*
|
|
16939
|
-
* @param
|
|
16792
|
+
* @param currentNode to sanitize
|
|
16940
16793
|
*/
|
|
16941
16794
|
const _sanitizeAttributes = function _sanitizeAttributes(currentNode) {
|
|
16942
16795
|
/* Execute a hook if present */
|
|
@@ -16944,7 +16797,6 @@
|
|
|
16944
16797
|
const {
|
|
16945
16798
|
attributes
|
|
16946
16799
|
} = currentNode;
|
|
16947
|
-
|
|
16948
16800
|
/* Check if we have attributes; if not we might have a text node */
|
|
16949
16801
|
if (!attributes) {
|
|
16950
16802
|
return;
|
|
@@ -16953,10 +16805,10 @@
|
|
|
16953
16805
|
attrName: '',
|
|
16954
16806
|
attrValue: '',
|
|
16955
16807
|
keepAttr: true,
|
|
16956
|
-
allowedAttributes: ALLOWED_ATTR
|
|
16808
|
+
allowedAttributes: ALLOWED_ATTR,
|
|
16809
|
+
forceKeepAttr: undefined
|
|
16957
16810
|
};
|
|
16958
16811
|
let l = attributes.length;
|
|
16959
|
-
|
|
16960
16812
|
/* Go backwards over all attributes; safely remove bad ones */
|
|
16961
16813
|
while (l--) {
|
|
16962
16814
|
const attr = attributes[l];
|
|
@@ -16967,7 +16819,6 @@
|
|
|
16967
16819
|
} = attr;
|
|
16968
16820
|
const lcName = transformCaseFunc(name);
|
|
16969
16821
|
let value = name === 'value' ? attrValue : stringTrim(attrValue);
|
|
16970
|
-
|
|
16971
16822
|
/* Execute a hook if present */
|
|
16972
16823
|
hookEvent.attrName = lcName;
|
|
16973
16824
|
hookEvent.attrValue = value;
|
|
@@ -16975,56 +16826,46 @@
|
|
|
16975
16826
|
hookEvent.forceKeepAttr = undefined; // Allows developers to see this is a property they can set
|
|
16976
16827
|
_executeHook('uponSanitizeAttribute', currentNode, hookEvent);
|
|
16977
16828
|
value = hookEvent.attrValue;
|
|
16978
|
-
|
|
16829
|
+
/* Full DOM Clobbering protection via namespace isolation,
|
|
16830
|
+
* Prefix id and name attributes with `user-content-`
|
|
16831
|
+
*/
|
|
16832
|
+
if (SANITIZE_NAMED_PROPS && (lcName === 'id' || lcName === 'name')) {
|
|
16833
|
+
// Remove the attribute with this value
|
|
16834
|
+
_removeAttribute(name, currentNode);
|
|
16835
|
+
// Prefix the value and later re-create the attribute with the sanitized value
|
|
16836
|
+
value = SANITIZE_NAMED_PROPS_PREFIX + value;
|
|
16837
|
+
}
|
|
16979
16838
|
/* Work around a security issue with comments inside attributes */
|
|
16980
16839
|
if (SAFE_FOR_XML && regExpTest(/((--!?|])>)|<\/(style|title)/i, value)) {
|
|
16981
16840
|
_removeAttribute(name, currentNode);
|
|
16982
16841
|
continue;
|
|
16983
16842
|
}
|
|
16984
|
-
|
|
16985
16843
|
/* Did the hooks approve of the attribute? */
|
|
16986
16844
|
if (hookEvent.forceKeepAttr) {
|
|
16987
16845
|
continue;
|
|
16988
16846
|
}
|
|
16989
|
-
|
|
16990
16847
|
/* Remove attribute */
|
|
16991
16848
|
_removeAttribute(name, currentNode);
|
|
16992
|
-
|
|
16993
16849
|
/* Did the hooks approve of the attribute? */
|
|
16994
16850
|
if (!hookEvent.keepAttr) {
|
|
16995
16851
|
continue;
|
|
16996
16852
|
}
|
|
16997
|
-
|
|
16998
16853
|
/* Work around a security issue in jQuery 3.0 */
|
|
16999
16854
|
if (!ALLOW_SELF_CLOSE_IN_ATTR && regExpTest(/\/>/i, value)) {
|
|
17000
16855
|
_removeAttribute(name, currentNode);
|
|
17001
16856
|
continue;
|
|
17002
16857
|
}
|
|
17003
|
-
|
|
17004
16858
|
/* Sanitize attribute content to be template-safe */
|
|
17005
16859
|
if (SAFE_FOR_TEMPLATES) {
|
|
17006
16860
|
arrayForEach([MUSTACHE_EXPR, ERB_EXPR, TMPLIT_EXPR], expr => {
|
|
17007
16861
|
value = stringReplace(value, expr, ' ');
|
|
17008
16862
|
});
|
|
17009
16863
|
}
|
|
17010
|
-
|
|
17011
16864
|
/* Is `value` valid for this attribute? */
|
|
17012
16865
|
const lcTag = transformCaseFunc(currentNode.nodeName);
|
|
17013
16866
|
if (!_isValidAttribute(lcTag, lcName, value)) {
|
|
17014
16867
|
continue;
|
|
17015
16868
|
}
|
|
17016
|
-
|
|
17017
|
-
/* Full DOM Clobbering protection via namespace isolation,
|
|
17018
|
-
* Prefix id and name attributes with `user-content-`
|
|
17019
|
-
*/
|
|
17020
|
-
if (SANITIZE_NAMED_PROPS && (lcName === 'id' || lcName === 'name')) {
|
|
17021
|
-
// Remove the attribute with this value
|
|
17022
|
-
_removeAttribute(name, currentNode);
|
|
17023
|
-
|
|
17024
|
-
// Prefix the value and later re-create the attribute with the sanitized value
|
|
17025
|
-
value = SANITIZE_NAMED_PROPS_PREFIX + value;
|
|
17026
|
-
}
|
|
17027
|
-
|
|
17028
16869
|
/* Handle attributes that require Trusted Types */
|
|
17029
16870
|
if (trustedTypesPolicy && typeof trustedTypes === 'object' && typeof trustedTypes.getAttributeType === 'function') {
|
|
17030
16871
|
if (namespaceURI) ;else {
|
|
@@ -17042,7 +16883,6 @@
|
|
|
17042
16883
|
}
|
|
17043
16884
|
}
|
|
17044
16885
|
}
|
|
17045
|
-
|
|
17046
16886
|
/* Handle invalid data-* attribute set by try-catching it */
|
|
17047
16887
|
try {
|
|
17048
16888
|
if (namespaceURI) {
|
|
@@ -17058,51 +16898,36 @@
|
|
|
17058
16898
|
}
|
|
17059
16899
|
} catch (_) {}
|
|
17060
16900
|
}
|
|
17061
|
-
|
|
17062
16901
|
/* Execute a hook if present */
|
|
17063
16902
|
_executeHook('afterSanitizeAttributes', currentNode, null);
|
|
17064
16903
|
};
|
|
17065
|
-
|
|
17066
16904
|
/**
|
|
17067
16905
|
* _sanitizeShadowDOM
|
|
17068
16906
|
*
|
|
17069
|
-
* @param
|
|
16907
|
+
* @param fragment to iterate over recursively
|
|
17070
16908
|
*/
|
|
17071
16909
|
const _sanitizeShadowDOM = function _sanitizeShadowDOM(fragment) {
|
|
17072
16910
|
let shadowNode = null;
|
|
17073
16911
|
const shadowIterator = _createNodeIterator(fragment);
|
|
17074
|
-
|
|
17075
16912
|
/* Execute a hook if present */
|
|
17076
16913
|
_executeHook('beforeSanitizeShadowDOM', fragment, null);
|
|
17077
16914
|
while (shadowNode = shadowIterator.nextNode()) {
|
|
17078
16915
|
/* Execute a hook if present */
|
|
17079
16916
|
_executeHook('uponSanitizeShadowNode', shadowNode, null);
|
|
17080
|
-
|
|
17081
16917
|
/* Sanitize tags and elements */
|
|
17082
16918
|
if (_sanitizeElements(shadowNode)) {
|
|
17083
16919
|
continue;
|
|
17084
16920
|
}
|
|
17085
|
-
|
|
17086
16921
|
/* Deep shadow DOM detected */
|
|
17087
16922
|
if (shadowNode.content instanceof DocumentFragment) {
|
|
17088
16923
|
_sanitizeShadowDOM(shadowNode.content);
|
|
17089
16924
|
}
|
|
17090
|
-
|
|
17091
16925
|
/* Check attributes, sanitize if necessary */
|
|
17092
16926
|
_sanitizeAttributes(shadowNode);
|
|
17093
16927
|
}
|
|
17094
|
-
|
|
17095
16928
|
/* Execute a hook if present */
|
|
17096
16929
|
_executeHook('afterSanitizeShadowDOM', fragment, null);
|
|
17097
16930
|
};
|
|
17098
|
-
|
|
17099
|
-
/**
|
|
17100
|
-
* Sanitize
|
|
17101
|
-
* Public method providing core sanitation functionality
|
|
17102
|
-
*
|
|
17103
|
-
* @param {String|Node} dirty string or DOM node
|
|
17104
|
-
* @param {Object} cfg object
|
|
17105
|
-
*/
|
|
17106
16931
|
// eslint-disable-next-line complexity
|
|
17107
16932
|
DOMPurify.sanitize = function (dirty) {
|
|
17108
16933
|
let cfg = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
@@ -17117,7 +16942,6 @@
|
|
|
17117
16942
|
if (IS_EMPTY_INPUT) {
|
|
17118
16943
|
dirty = '<!-->';
|
|
17119
16944
|
}
|
|
17120
|
-
|
|
17121
16945
|
/* Stringify, in case dirty is an object */
|
|
17122
16946
|
if (typeof dirty !== 'string' && !_isNode(dirty)) {
|
|
17123
16947
|
if (typeof dirty.toString === 'function') {
|
|
@@ -17129,20 +16953,16 @@
|
|
|
17129
16953
|
throw typeErrorCreate('toString is not a function');
|
|
17130
16954
|
}
|
|
17131
16955
|
}
|
|
17132
|
-
|
|
17133
16956
|
/* Return dirty HTML if DOMPurify cannot run */
|
|
17134
16957
|
if (!DOMPurify.isSupported) {
|
|
17135
16958
|
return dirty;
|
|
17136
16959
|
}
|
|
17137
|
-
|
|
17138
16960
|
/* Assign config vars */
|
|
17139
16961
|
if (!SET_CONFIG) {
|
|
17140
16962
|
_parseConfig(cfg);
|
|
17141
16963
|
}
|
|
17142
|
-
|
|
17143
16964
|
/* Clean up removed elements */
|
|
17144
16965
|
DOMPurify.removed = [];
|
|
17145
|
-
|
|
17146
16966
|
/* Check if dirty is correctly typed for IN_PLACE */
|
|
17147
16967
|
if (typeof dirty === 'string') {
|
|
17148
16968
|
IN_PLACE = false;
|
|
@@ -17176,45 +16996,36 @@
|
|
|
17176
16996
|
dirty.indexOf('<') === -1) {
|
|
17177
16997
|
return trustedTypesPolicy && RETURN_TRUSTED_TYPE ? trustedTypesPolicy.createHTML(dirty) : dirty;
|
|
17178
16998
|
}
|
|
17179
|
-
|
|
17180
16999
|
/* Initialize the document to work on */
|
|
17181
17000
|
body = _initDocument(dirty);
|
|
17182
|
-
|
|
17183
17001
|
/* Check we have a DOM node from the data */
|
|
17184
17002
|
if (!body) {
|
|
17185
17003
|
return RETURN_DOM ? null : RETURN_TRUSTED_TYPE ? emptyHTML : '';
|
|
17186
17004
|
}
|
|
17187
17005
|
}
|
|
17188
|
-
|
|
17189
17006
|
/* Remove first element node (ours) if FORCE_BODY is set */
|
|
17190
17007
|
if (body && FORCE_BODY) {
|
|
17191
17008
|
_forceRemove(body.firstChild);
|
|
17192
17009
|
}
|
|
17193
|
-
|
|
17194
17010
|
/* Get node iterator */
|
|
17195
17011
|
const nodeIterator = _createNodeIterator(IN_PLACE ? dirty : body);
|
|
17196
|
-
|
|
17197
17012
|
/* Now start iterating over the created document */
|
|
17198
17013
|
while (currentNode = nodeIterator.nextNode()) {
|
|
17199
17014
|
/* Sanitize tags and elements */
|
|
17200
17015
|
if (_sanitizeElements(currentNode)) {
|
|
17201
17016
|
continue;
|
|
17202
17017
|
}
|
|
17203
|
-
|
|
17204
17018
|
/* Shadow DOM detected, sanitize it */
|
|
17205
17019
|
if (currentNode.content instanceof DocumentFragment) {
|
|
17206
17020
|
_sanitizeShadowDOM(currentNode.content);
|
|
17207
17021
|
}
|
|
17208
|
-
|
|
17209
17022
|
/* Check attributes, sanitize if necessary */
|
|
17210
17023
|
_sanitizeAttributes(currentNode);
|
|
17211
17024
|
}
|
|
17212
|
-
|
|
17213
17025
|
/* If we sanitized `dirty` in-place, return it. */
|
|
17214
17026
|
if (IN_PLACE) {
|
|
17215
17027
|
return dirty;
|
|
17216
17028
|
}
|
|
17217
|
-
|
|
17218
17029
|
/* Return sanitized string or DOM */
|
|
17219
17030
|
if (RETURN_DOM) {
|
|
17220
17031
|
if (RETURN_DOM_FRAGMENT) {
|
|
@@ -17239,12 +17050,10 @@
|
|
|
17239
17050
|
return returnNode;
|
|
17240
17051
|
}
|
|
17241
17052
|
let serializedHTML = WHOLE_DOCUMENT ? body.outerHTML : body.innerHTML;
|
|
17242
|
-
|
|
17243
17053
|
/* Serialize doctype if allowed */
|
|
17244
17054
|
if (WHOLE_DOCUMENT && ALLOWED_TAGS['!doctype'] && body.ownerDocument && body.ownerDocument.doctype && body.ownerDocument.doctype.name && regExpTest(DOCTYPE_NAME, body.ownerDocument.doctype.name)) {
|
|
17245
17055
|
serializedHTML = '<!DOCTYPE ' + body.ownerDocument.doctype.name + '>\n' + serializedHTML;
|
|
17246
17056
|
}
|
|
17247
|
-
|
|
17248
17057
|
/* Sanitize final string template-safe */
|
|
17249
17058
|
if (SAFE_FOR_TEMPLATES) {
|
|
17250
17059
|
arrayForEach([MUSTACHE_EXPR, ERB_EXPR, TMPLIT_EXPR], expr => {
|
|
@@ -17253,39 +17062,15 @@
|
|
|
17253
17062
|
}
|
|
17254
17063
|
return trustedTypesPolicy && RETURN_TRUSTED_TYPE ? trustedTypesPolicy.createHTML(serializedHTML) : serializedHTML;
|
|
17255
17064
|
};
|
|
17256
|
-
|
|
17257
|
-
/**
|
|
17258
|
-
* Public method to set the configuration once
|
|
17259
|
-
* setConfig
|
|
17260
|
-
*
|
|
17261
|
-
* @param {Object} cfg configuration object
|
|
17262
|
-
*/
|
|
17263
17065
|
DOMPurify.setConfig = function () {
|
|
17264
17066
|
let cfg = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
17265
17067
|
_parseConfig(cfg);
|
|
17266
17068
|
SET_CONFIG = true;
|
|
17267
17069
|
};
|
|
17268
|
-
|
|
17269
|
-
/**
|
|
17270
|
-
* Public method to remove the configuration
|
|
17271
|
-
* clearConfig
|
|
17272
|
-
*
|
|
17273
|
-
*/
|
|
17274
17070
|
DOMPurify.clearConfig = function () {
|
|
17275
17071
|
CONFIG = null;
|
|
17276
17072
|
SET_CONFIG = false;
|
|
17277
17073
|
};
|
|
17278
|
-
|
|
17279
|
-
/**
|
|
17280
|
-
* Public method to check if an attribute value is valid.
|
|
17281
|
-
* Uses last set config, if any. Otherwise, uses config defaults.
|
|
17282
|
-
* isValidAttribute
|
|
17283
|
-
*
|
|
17284
|
-
* @param {String} tag Tag name of containing element.
|
|
17285
|
-
* @param {String} attr Attribute name.
|
|
17286
|
-
* @param {String} value Attribute value.
|
|
17287
|
-
* @return {Boolean} Returns true if `value` is valid. Otherwise, returns false.
|
|
17288
|
-
*/
|
|
17289
17074
|
DOMPurify.isValidAttribute = function (tag, attr, value) {
|
|
17290
17075
|
/* Initialize shared config vars if necessary. */
|
|
17291
17076
|
if (!CONFIG) {
|
|
@@ -17295,14 +17080,6 @@
|
|
|
17295
17080
|
const lcName = transformCaseFunc(attr);
|
|
17296
17081
|
return _isValidAttribute(lcTag, lcName, value);
|
|
17297
17082
|
};
|
|
17298
|
-
|
|
17299
|
-
/**
|
|
17300
|
-
* AddHook
|
|
17301
|
-
* Public method to add DOMPurify hooks
|
|
17302
|
-
*
|
|
17303
|
-
* @param {String} entryPoint entry point for the hook to add
|
|
17304
|
-
* @param {Function} hookFunction function to execute
|
|
17305
|
-
*/
|
|
17306
17083
|
DOMPurify.addHook = function (entryPoint, hookFunction) {
|
|
17307
17084
|
if (typeof hookFunction !== 'function') {
|
|
17308
17085
|
return;
|
|
@@ -17310,37 +17087,16 @@
|
|
|
17310
17087
|
hooks[entryPoint] = hooks[entryPoint] || [];
|
|
17311
17088
|
arrayPush(hooks[entryPoint], hookFunction);
|
|
17312
17089
|
};
|
|
17313
|
-
|
|
17314
|
-
/**
|
|
17315
|
-
* RemoveHook
|
|
17316
|
-
* Public method to remove a DOMPurify hook at a given entryPoint
|
|
17317
|
-
* (pops it from the stack of hooks if more are present)
|
|
17318
|
-
*
|
|
17319
|
-
* @param {String} entryPoint entry point for the hook to remove
|
|
17320
|
-
* @return {Function} removed(popped) hook
|
|
17321
|
-
*/
|
|
17322
17090
|
DOMPurify.removeHook = function (entryPoint) {
|
|
17323
17091
|
if (hooks[entryPoint]) {
|
|
17324
17092
|
return arrayPop(hooks[entryPoint]);
|
|
17325
17093
|
}
|
|
17326
17094
|
};
|
|
17327
|
-
|
|
17328
|
-
/**
|
|
17329
|
-
* RemoveHooks
|
|
17330
|
-
* Public method to remove all DOMPurify hooks at a given entryPoint
|
|
17331
|
-
*
|
|
17332
|
-
* @param {String} entryPoint entry point for the hooks to remove
|
|
17333
|
-
*/
|
|
17334
17095
|
DOMPurify.removeHooks = function (entryPoint) {
|
|
17335
17096
|
if (hooks[entryPoint]) {
|
|
17336
17097
|
hooks[entryPoint] = [];
|
|
17337
17098
|
}
|
|
17338
17099
|
};
|
|
17339
|
-
|
|
17340
|
-
/**
|
|
17341
|
-
* RemoveAllHooks
|
|
17342
|
-
* Public method to remove all DOMPurify hooks
|
|
17343
|
-
*/
|
|
17344
17100
|
DOMPurify.removeAllHooks = function () {
|
|
17345
17101
|
hooks = {};
|
|
17346
17102
|
};
|
|
@@ -31199,6 +30955,10 @@
|
|
|
31199
30955
|
*/
|
|
31200
30956
|
constructor(
|
|
31201
30957
|
/**
|
|
30958
|
+
The optional name of the base tag @internal
|
|
30959
|
+
*/
|
|
30960
|
+
name,
|
|
30961
|
+
/**
|
|
31202
30962
|
The set of this tag and all its parent tags, starting with
|
|
31203
30963
|
this one itself and sorted in order of decreasing specificity.
|
|
31204
30964
|
*/
|
|
@@ -31212,6 +30972,7 @@
|
|
|
31212
30972
|
The modifiers applied to this.base @internal
|
|
31213
30973
|
*/
|
|
31214
30974
|
modified) {
|
|
30975
|
+
this.name = name;
|
|
31215
30976
|
this.set = set;
|
|
31216
30977
|
this.base = base;
|
|
31217
30978
|
this.modified = modified;
|
|
@@ -31220,16 +30981,18 @@
|
|
|
31220
30981
|
*/
|
|
31221
30982
|
this.id = nextTagID++;
|
|
31222
30983
|
}
|
|
31223
|
-
|
|
31224
|
-
|
|
31225
|
-
|
|
31226
|
-
|
|
31227
|
-
|
|
31228
|
-
|
|
31229
|
-
|
|
31230
|
-
static define(parent) {
|
|
30984
|
+
toString() {
|
|
30985
|
+
let {
|
|
30986
|
+
name
|
|
30987
|
+
} = this;
|
|
30988
|
+
for (let mod of this.modified) if (mod.name) name = `${mod.name}(${name})`;
|
|
30989
|
+
return name;
|
|
30990
|
+
}
|
|
30991
|
+
static define(nameOrParent, parent) {
|
|
30992
|
+
let name = typeof nameOrParent == "string" ? nameOrParent : "?";
|
|
30993
|
+
if (nameOrParent instanceof Tag) parent = nameOrParent;
|
|
31231
30994
|
if (parent === null || parent === void 0 ? void 0 : parent.base) throw new Error("Can not derive from a modified tag");
|
|
31232
|
-
let tag = new Tag([], null, []);
|
|
30995
|
+
let tag = new Tag(name, [], null, []);
|
|
31233
30996
|
tag.set.push(tag);
|
|
31234
30997
|
if (parent) for (let t of parent.set) tag.set.push(t);
|
|
31235
30998
|
return tag;
|
|
@@ -31246,8 +31009,8 @@
|
|
|
31246
31009
|
example `m1(m2(m3(t1)))` is a subtype of `m1(m2(t1))`,
|
|
31247
31010
|
`m1(m3(t1)`, and so on.
|
|
31248
31011
|
*/
|
|
31249
|
-
static defineModifier() {
|
|
31250
|
-
let mod = new Modifier();
|
|
31012
|
+
static defineModifier(name) {
|
|
31013
|
+
let mod = new Modifier(name);
|
|
31251
31014
|
return tag => {
|
|
31252
31015
|
if (tag.modified.indexOf(mod) > -1) return tag;
|
|
31253
31016
|
return Modifier.get(tag.base || tag, tag.modified.concat(mod).sort((a, b) => a.id - b.id));
|
|
@@ -31256,7 +31019,8 @@
|
|
|
31256
31019
|
}
|
|
31257
31020
|
let nextModifierID = 0;
|
|
31258
31021
|
class Modifier {
|
|
31259
|
-
constructor() {
|
|
31022
|
+
constructor(name) {
|
|
31023
|
+
this.name = name;
|
|
31260
31024
|
this.instances = [];
|
|
31261
31025
|
this.id = nextModifierID++;
|
|
31262
31026
|
}
|
|
@@ -31265,7 +31029,7 @@
|
|
|
31265
31029
|
let exists = mods[0].instances.find(t => t.base == base && sameArray$1(mods, t.modified));
|
|
31266
31030
|
if (exists) return exists;
|
|
31267
31031
|
let set = [],
|
|
31268
|
-
tag = new Tag(set, base, mods);
|
|
31032
|
+
tag = new Tag(base.name, set, base, mods);
|
|
31269
31033
|
for (let m of mods) m.instances.push(tag);
|
|
31270
31034
|
let configs = powerSet(mods);
|
|
31271
31035
|
for (let parent of base.set) if (!parent.modified.length) for (let config of configs) set.push(Modifier.get(parent, config));
|
|
@@ -31837,7 +31601,7 @@
|
|
|
31837
31601
|
*/
|
|
31838
31602
|
heading6: t(heading$1),
|
|
31839
31603
|
/**
|
|
31840
|
-
A prose separator (such as a horizontal rule).
|
|
31604
|
+
A prose [content](#highlight.tags.content) separator (such as a horizontal rule).
|
|
31841
31605
|
*/
|
|
31842
31606
|
contentSeparator: t(content),
|
|
31843
31607
|
/**
|
|
@@ -31910,31 +31674,31 @@
|
|
|
31910
31674
|
given element is being defined. Expected to be used with the
|
|
31911
31675
|
various [name](#highlight.tags.name) tags.
|
|
31912
31676
|
*/
|
|
31913
|
-
definition: Tag.defineModifier(),
|
|
31677
|
+
definition: Tag.defineModifier("definition"),
|
|
31914
31678
|
/**
|
|
31915
31679
|
[Modifier](#highlight.Tag^defineModifier) that indicates that
|
|
31916
31680
|
something is constant. Mostly expected to be used with
|
|
31917
31681
|
[variable names](#highlight.tags.variableName).
|
|
31918
31682
|
*/
|
|
31919
|
-
constant: Tag.defineModifier(),
|
|
31683
|
+
constant: Tag.defineModifier("constant"),
|
|
31920
31684
|
/**
|
|
31921
31685
|
[Modifier](#highlight.Tag^defineModifier) used to indicate that
|
|
31922
31686
|
a [variable](#highlight.tags.variableName) or [property
|
|
31923
31687
|
name](#highlight.tags.propertyName) is being called or defined
|
|
31924
31688
|
as a function.
|
|
31925
31689
|
*/
|
|
31926
|
-
function: Tag.defineModifier(),
|
|
31690
|
+
function: Tag.defineModifier("function"),
|
|
31927
31691
|
/**
|
|
31928
31692
|
[Modifier](#highlight.Tag^defineModifier) that can be applied to
|
|
31929
31693
|
[names](#highlight.tags.name) to indicate that they belong to
|
|
31930
31694
|
the language's standard environment.
|
|
31931
31695
|
*/
|
|
31932
|
-
standard: Tag.defineModifier(),
|
|
31696
|
+
standard: Tag.defineModifier("standard"),
|
|
31933
31697
|
/**
|
|
31934
31698
|
[Modifier](#highlight.Tag^defineModifier) that indicates a given
|
|
31935
31699
|
[names](#highlight.tags.name) is local to some scope.
|
|
31936
31700
|
*/
|
|
31937
|
-
local: Tag.defineModifier(),
|
|
31701
|
+
local: Tag.defineModifier("local"),
|
|
31938
31702
|
/**
|
|
31939
31703
|
A generic variant [modifier](#highlight.Tag^defineModifier) that
|
|
31940
31704
|
can be used to tag language-specific alternative variants of
|
|
@@ -31943,8 +31707,12 @@
|
|
|
31943
31707
|
[variable name](#highlight.tags.variableName) tags, since those
|
|
31944
31708
|
come up a lot.
|
|
31945
31709
|
*/
|
|
31946
|
-
special: Tag.defineModifier()
|
|
31710
|
+
special: Tag.defineModifier("special")
|
|
31947
31711
|
};
|
|
31712
|
+
for (let name in tags) {
|
|
31713
|
+
let val = tags[name];
|
|
31714
|
+
if (val instanceof Tag) val.name = name;
|
|
31715
|
+
}
|
|
31948
31716
|
/**
|
|
31949
31717
|
This is a highlighter that adds stable, predictable classes to
|
|
31950
31718
|
tokens, for styling with external CSS.
|
|
@@ -32196,8 +31964,6 @@
|
|
|
32196
31964
|
function isSpace(ch) {
|
|
32197
31965
|
return spaceChars.includes(ch);
|
|
32198
31966
|
}
|
|
32199
|
-
|
|
32200
|
-
// eslint-disable-next-line
|
|
32201
31967
|
function indent(str, spaces) {
|
|
32202
31968
|
return spaces.concat(str.split(/\n/g).join('\n' + spaces));
|
|
32203
31969
|
}
|
|
@@ -32413,6 +32179,11 @@
|
|
|
32413
32179
|
[FilterExpression]: 'FilterExpression',
|
|
32414
32180
|
[ArithmeticExpression]: 'ArithmeticExpression'
|
|
32415
32181
|
};
|
|
32182
|
+
|
|
32183
|
+
/**
|
|
32184
|
+
* A simple producer that retrievs a value from
|
|
32185
|
+
* a given context. Used to lazily take things.
|
|
32186
|
+
*/
|
|
32416
32187
|
class ValueProducer {
|
|
32417
32188
|
/**
|
|
32418
32189
|
* @param { Function } fn
|
|
@@ -32448,7 +32219,7 @@
|
|
|
32448
32219
|
/**
|
|
32449
32220
|
* Creates a new context from a JavaScript object.
|
|
32450
32221
|
*
|
|
32451
|
-
* @param {any} value
|
|
32222
|
+
* @param {any} [value]
|
|
32452
32223
|
*/
|
|
32453
32224
|
constructor(value = {}) {
|
|
32454
32225
|
/**
|
|
@@ -32500,6 +32271,19 @@
|
|
|
32500
32271
|
});
|
|
32501
32272
|
}
|
|
32502
32273
|
|
|
32274
|
+
/**
|
|
32275
|
+
* Non-destructively merge another context into this one,
|
|
32276
|
+
* and return the result.
|
|
32277
|
+
*
|
|
32278
|
+
* @param {ContextValue} other
|
|
32279
|
+
*
|
|
32280
|
+
* @return {VariableContext}
|
|
32281
|
+
*/
|
|
32282
|
+
merge(other) {
|
|
32283
|
+
const constructor = /** @type { typeof VariableContext } */this.constructor;
|
|
32284
|
+
return new constructor(constructor.__merge(this.value, other));
|
|
32285
|
+
}
|
|
32286
|
+
|
|
32503
32287
|
/**
|
|
32504
32288
|
* Wether the given value is atomic. Non-atomic values need to be wrapped in a
|
|
32505
32289
|
* context Class.
|
|
@@ -32512,42 +32296,89 @@
|
|
|
32512
32296
|
}
|
|
32513
32297
|
|
|
32514
32298
|
/**
|
|
32515
|
-
* Takes any number of Contexts and merges them into a single
|
|
32299
|
+
* Takes any number of Contexts and merges them into a single context.
|
|
32516
32300
|
*
|
|
32517
|
-
* @param
|
|
32518
|
-
* @returns {VariableContext}
|
|
32301
|
+
* @param { ...VariableContext } contexts
|
|
32302
|
+
* @returns { VariableContext }
|
|
32519
32303
|
*/
|
|
32520
32304
|
static of(...contexts) {
|
|
32521
|
-
|
|
32522
|
-
|
|
32523
|
-
|
|
32305
|
+
return contexts.reduce((context, otherContext) => {
|
|
32306
|
+
return context.merge(otherContext);
|
|
32307
|
+
}, new this({}));
|
|
32308
|
+
}
|
|
32309
|
+
|
|
32310
|
+
/**
|
|
32311
|
+
* Returns the raw representation of the given context.
|
|
32312
|
+
*
|
|
32313
|
+
* @param {VariableContext | any} context
|
|
32314
|
+
*
|
|
32315
|
+
* @return {any}
|
|
32316
|
+
*/
|
|
32317
|
+
static __unwrap(context) {
|
|
32318
|
+
if (!context) {
|
|
32319
|
+
return {};
|
|
32320
|
+
}
|
|
32321
|
+
if (context instanceof this) {
|
|
32322
|
+
return context.value;
|
|
32323
|
+
}
|
|
32324
|
+
if (typeof context !== 'object') {
|
|
32325
|
+
return {};
|
|
32326
|
+
}
|
|
32327
|
+
return {
|
|
32328
|
+
...context
|
|
32329
|
+
};
|
|
32330
|
+
}
|
|
32331
|
+
|
|
32332
|
+
/**
|
|
32333
|
+
* Non-destructively merges two contexts (or their values)
|
|
32334
|
+
* with each other, returning the result.
|
|
32335
|
+
*
|
|
32336
|
+
* @param {ContextValue} context
|
|
32337
|
+
* @param {ContextValue} other
|
|
32338
|
+
*
|
|
32339
|
+
* @return {any}
|
|
32340
|
+
*/
|
|
32341
|
+
static __merge(context, other) {
|
|
32342
|
+
return reduce(this.__unwrap(other), (merged, value, key) => {
|
|
32343
|
+
if (value instanceof ValueProducer) {
|
|
32344
|
+
// keep value producers in tact
|
|
32345
|
+
return {
|
|
32346
|
+
...merged,
|
|
32347
|
+
[key]: value
|
|
32348
|
+
};
|
|
32524
32349
|
}
|
|
32525
|
-
|
|
32526
|
-
|
|
32350
|
+
value = this.__unwrap(value);
|
|
32351
|
+
if (has(merged, key)) {
|
|
32352
|
+
value = this.__merge(this.__unwrap(merged[key]), value);
|
|
32527
32353
|
}
|
|
32528
|
-
return {
|
|
32529
|
-
...context
|
|
32530
|
-
};
|
|
32531
|
-
};
|
|
32532
|
-
const merged = contexts.reduce((merged, context) => {
|
|
32533
32354
|
return {
|
|
32534
32355
|
...merged,
|
|
32535
|
-
|
|
32356
|
+
[key]: value
|
|
32536
32357
|
};
|
|
32537
|
-
},
|
|
32538
|
-
return new this(merged);
|
|
32358
|
+
}, this.__unwrap(context));
|
|
32539
32359
|
}
|
|
32540
32360
|
}
|
|
32541
32361
|
class Variables {
|
|
32362
|
+
/**
|
|
32363
|
+
* @param { {
|
|
32364
|
+
* name?: string,
|
|
32365
|
+
* tokens?: string[],
|
|
32366
|
+
* children?: Variables[],
|
|
32367
|
+
* parent: Variables | null
|
|
32368
|
+
* context: VariableContext,
|
|
32369
|
+
* value?: any,
|
|
32370
|
+
* raw?: any
|
|
32371
|
+
* } } options
|
|
32372
|
+
*/
|
|
32542
32373
|
constructor({
|
|
32543
32374
|
name = 'Expressions',
|
|
32544
32375
|
tokens = [],
|
|
32545
32376
|
children = [],
|
|
32546
32377
|
parent = null,
|
|
32547
|
-
context
|
|
32548
|
-
value
|
|
32549
|
-
raw
|
|
32550
|
-
}
|
|
32378
|
+
context,
|
|
32379
|
+
value,
|
|
32380
|
+
raw
|
|
32381
|
+
}) {
|
|
32551
32382
|
this.name = name;
|
|
32552
32383
|
this.tokens = tokens;
|
|
32553
32384
|
this.children = children;
|
|
@@ -32714,6 +32545,20 @@
|
|
|
32714
32545
|
...options
|
|
32715
32546
|
});
|
|
32716
32547
|
}
|
|
32548
|
+
|
|
32549
|
+
/**
|
|
32550
|
+
* @param { {
|
|
32551
|
+
* name?: string,
|
|
32552
|
+
* tokens?: string[],
|
|
32553
|
+
* children?: Variables[],
|
|
32554
|
+
* parent?: Variables | null
|
|
32555
|
+
* context: VariableContext,
|
|
32556
|
+
* value?: any,
|
|
32557
|
+
* raw?: any
|
|
32558
|
+
* } } options
|
|
32559
|
+
*
|
|
32560
|
+
* @return {Variables}
|
|
32561
|
+
*/
|
|
32717
32562
|
static of(options) {
|
|
32718
32563
|
const {
|
|
32719
32564
|
name,
|
|
@@ -34124,16 +33969,18 @@
|
|
|
34124
33969
|
function ifValid(o) {
|
|
34125
33970
|
return o.isValid ? o : null;
|
|
34126
33971
|
}
|
|
34127
|
-
function parseExpression(expression, context = {}) {
|
|
33972
|
+
function parseExpression(expression, context = {}, dialect) {
|
|
34128
33973
|
return parser$3.configure({
|
|
34129
33974
|
top: 'Expression',
|
|
34130
|
-
contextTracker: trackVariables(context)
|
|
33975
|
+
contextTracker: trackVariables(context),
|
|
33976
|
+
dialect
|
|
34131
33977
|
}).parse(expression);
|
|
34132
33978
|
}
|
|
34133
|
-
function parseUnaryTests(expression, context = {}) {
|
|
33979
|
+
function parseUnaryTests(expression, context = {}, dialect) {
|
|
34134
33980
|
return parser$3.configure({
|
|
34135
33981
|
top: 'UnaryTests',
|
|
34136
|
-
contextTracker: trackVariables(context)
|
|
33982
|
+
contextTracker: trackVariables(context),
|
|
33983
|
+
dialect
|
|
34137
33984
|
}).parse(expression);
|
|
34138
33985
|
}
|
|
34139
33986
|
let SyntaxError$1 = class SyntaxError extends Error {
|
|
@@ -34197,16 +34044,16 @@
|
|
|
34197
34044
|
});
|
|
34198
34045
|
return root.args[root.args.length - 1];
|
|
34199
34046
|
}
|
|
34200
|
-
evaluate(expression, context = {}) {
|
|
34201
|
-
const parseTree = parseExpression(expression, context);
|
|
34047
|
+
evaluate(expression, context = {}, dialect) {
|
|
34048
|
+
const parseTree = parseExpression(expression, context, dialect);
|
|
34202
34049
|
const root = this._buildExecutionTree(parseTree, expression);
|
|
34203
34050
|
return {
|
|
34204
34051
|
parseTree,
|
|
34205
34052
|
root
|
|
34206
34053
|
};
|
|
34207
34054
|
}
|
|
34208
|
-
unaryTest(expression, context = {}) {
|
|
34209
|
-
const parseTree = parseUnaryTests(expression, context);
|
|
34055
|
+
unaryTest(expression, context = {}, dialect) {
|
|
34056
|
+
const parseTree = parseUnaryTests(expression, context, dialect);
|
|
34210
34057
|
const root = this._buildExecutionTree(parseTree, expression);
|
|
34211
34058
|
return {
|
|
34212
34059
|
parseTree,
|
|
@@ -34215,20 +34062,20 @@
|
|
|
34215
34062
|
}
|
|
34216
34063
|
}
|
|
34217
34064
|
const interpreter = new Interpreter();
|
|
34218
|
-
function unaryTest(expression, context = {}) {
|
|
34065
|
+
function unaryTest(expression, context = {}, dialect) {
|
|
34219
34066
|
const value = context['?'] !== undefined ? context['?'] : null;
|
|
34220
34067
|
const {
|
|
34221
34068
|
root
|
|
34222
|
-
} = interpreter.unaryTest(expression, context);
|
|
34069
|
+
} = interpreter.unaryTest(expression, context, dialect);
|
|
34223
34070
|
// root = fn(ctx) => test(val)
|
|
34224
34071
|
const test = root(context);
|
|
34225
34072
|
return test(value);
|
|
34226
34073
|
}
|
|
34227
34074
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
34228
|
-
function evaluate$1(expression, context = {}) {
|
|
34075
|
+
function evaluate$1(expression, context = {}, dialect) {
|
|
34229
34076
|
const {
|
|
34230
34077
|
root
|
|
34231
|
-
} = interpreter.evaluate(expression, context);
|
|
34078
|
+
} = interpreter.evaluate(expression, context, dialect);
|
|
34232
34079
|
// root = Expression :: fn(ctx)
|
|
34233
34080
|
return root(context);
|
|
34234
34081
|
}
|
|
@@ -34325,6 +34172,8 @@
|
|
|
34325
34172
|
return b => a => !equals(a, b);
|
|
34326
34173
|
}
|
|
34327
34174
|
}, Test('boolean'));
|
|
34175
|
+
case 'BacktickIdentifier':
|
|
34176
|
+
return input.replace(/`/g, '');
|
|
34328
34177
|
case 'Wildcard':
|
|
34329
34178
|
return _context => true;
|
|
34330
34179
|
case 'null':
|
|
@@ -34638,7 +34487,7 @@
|
|
|
34638
34487
|
if (isNumber(value)) {
|
|
34639
34488
|
filterFn.type = 'number';
|
|
34640
34489
|
}
|
|
34641
|
-
} catch (
|
|
34490
|
+
} catch (_err) {
|
|
34642
34491
|
// ignore
|
|
34643
34492
|
}
|
|
34644
34493
|
}
|
|
@@ -35009,7 +34858,6 @@
|
|
|
35009
34858
|
if (str.endsWith('"')) {
|
|
35010
34859
|
str = str.slice(0, -1);
|
|
35011
34860
|
}
|
|
35012
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
35013
34861
|
return str.replace(/(\\")|(\\\\)|(\\u[a-fA-F0-9]{5,6})|((?:\\u[a-fA-F0-9]{1,4})+)/ig, function (substring, ...groups) {
|
|
35014
34862
|
const [quotes, escape, codePoint, charCodes] = groups;
|
|
35015
34863
|
if (quotes) {
|
|
@@ -39683,7 +39531,7 @@
|
|
|
39683
39531
|
let child = this.children[i];
|
|
39684
39532
|
if (child.parent == this && children.indexOf(child) < 0) child.destroy();
|
|
39685
39533
|
}
|
|
39686
|
-
this.children.splice(from, to - from, ...children);
|
|
39534
|
+
if (children.length < 250) this.children.splice(from, to - from, ...children);else this.children = [].concat(this.children.slice(0, from), children, this.children.slice(to));
|
|
39687
39535
|
for (let i = 0; i < children.length; i++) children[i].setParent(this);
|
|
39688
39536
|
}
|
|
39689
39537
|
ignoreMutation(_rec) {
|
|
@@ -44826,10 +44674,11 @@
|
|
|
44826
44674
|
// lines within the viewport, as a kludge to keep the editor
|
|
44827
44675
|
// responsive when a ridiculously long line is loaded into it.
|
|
44828
44676
|
class LineGap {
|
|
44829
|
-
constructor(from, to, size) {
|
|
44677
|
+
constructor(from, to, size, displaySize) {
|
|
44830
44678
|
this.from = from;
|
|
44831
44679
|
this.to = to;
|
|
44832
44680
|
this.size = size;
|
|
44681
|
+
this.displaySize = displaySize;
|
|
44833
44682
|
}
|
|
44834
44683
|
static same(a, b) {
|
|
44835
44684
|
if (a.length != b.length) return false;
|
|
@@ -44842,7 +44691,7 @@
|
|
|
44842
44691
|
}
|
|
44843
44692
|
draw(viewState, wrapping) {
|
|
44844
44693
|
return Decoration.replace({
|
|
44845
|
-
widget: new LineGapWidget(this.
|
|
44694
|
+
widget: new LineGapWidget(this.displaySize * (wrapping ? viewState.scaleY : viewState.scaleX), wrapping)
|
|
44846
44695
|
}).range(this.from, this.to);
|
|
44847
44696
|
}
|
|
44848
44697
|
}
|
|
@@ -45155,7 +45004,7 @@
|
|
|
45155
45004
|
mapLineGaps(gaps, changes) {
|
|
45156
45005
|
if (!gaps.length || changes.empty) return gaps;
|
|
45157
45006
|
let mapped = [];
|
|
45158
|
-
for (let gap of gaps) if (!changes.touchesRange(gap.from, gap.to)) mapped.push(new LineGap(changes.mapPos(gap.from), changes.mapPos(gap.to), gap.size));
|
|
45007
|
+
for (let gap of gaps) if (!changes.touchesRange(gap.from, gap.to)) mapped.push(new LineGap(changes.mapPos(gap.from), changes.mapPos(gap.to), gap.size, gap.displaySize));
|
|
45159
45008
|
return mapped;
|
|
45160
45009
|
}
|
|
45161
45010
|
// Computes positions in the viewport where the start or end of a
|
|
@@ -45192,7 +45041,9 @@
|
|
|
45192
45041
|
let lineStart = mayMeasure.moveToLineBoundary(EditorSelection.cursor(to), false, true).head;
|
|
45193
45042
|
if (lineStart > from) to = lineStart;
|
|
45194
45043
|
}
|
|
45195
|
-
|
|
45044
|
+
let size = this.gapSize(line, from, to, structure);
|
|
45045
|
+
let displaySize = wrapping || size < 2000000 /* VP.MaxHorizGap */ ? size : 2000000 /* VP.MaxHorizGap */;
|
|
45046
|
+
gap = new LineGap(from, to, size, displaySize);
|
|
45196
45047
|
}
|
|
45197
45048
|
gaps.push(gap);
|
|
45198
45049
|
};
|
|
@@ -45219,15 +45070,21 @@
|
|
|
45219
45070
|
} else {
|
|
45220
45071
|
let totalWidth = structure.total * this.heightOracle.charWidth;
|
|
45221
45072
|
let marginWidth = margin * this.heightOracle.charWidth;
|
|
45073
|
+
let horizOffset = 0;
|
|
45074
|
+
if (totalWidth > 2000000 /* VP.MaxHorizGap */) for (let old of current) {
|
|
45075
|
+
if (old.from >= line.from && old.from < line.to && old.size != old.displaySize && old.from * this.heightOracle.charWidth + horizOffset < this.pixelViewport.left) horizOffset = old.size - old.displaySize;
|
|
45076
|
+
}
|
|
45077
|
+
let pxLeft = this.pixelViewport.left + horizOffset,
|
|
45078
|
+
pxRight = this.pixelViewport.right + horizOffset;
|
|
45222
45079
|
let left, right;
|
|
45223
45080
|
if (target != null) {
|
|
45224
45081
|
let targetFrac = findFraction(structure, target);
|
|
45225
|
-
let spaceFrac = ((
|
|
45082
|
+
let spaceFrac = ((pxRight - pxLeft) / 2 + marginWidth) / totalWidth;
|
|
45226
45083
|
left = targetFrac - spaceFrac;
|
|
45227
45084
|
right = targetFrac + spaceFrac;
|
|
45228
45085
|
} else {
|
|
45229
|
-
left = (
|
|
45230
|
-
right = (
|
|
45086
|
+
left = (pxLeft - marginWidth) / totalWidth;
|
|
45087
|
+
right = (pxRight + marginWidth) / totalWidth;
|
|
45231
45088
|
}
|
|
45232
45089
|
viewFrom = findPosition(structure, left);
|
|
45233
45090
|
viewTo = findPosition(structure, right);
|
|
@@ -45576,7 +45433,7 @@
|
|
|
45576
45433
|
display: "none"
|
|
45577
45434
|
},
|
|
45578
45435
|
"&dark .cm-cursor": {
|
|
45579
|
-
borderLeftColor: "#
|
|
45436
|
+
borderLeftColor: "#ddd"
|
|
45580
45437
|
},
|
|
45581
45438
|
".cm-dropCursor": {
|
|
45582
45439
|
position: "absolute"
|
|
@@ -46217,6 +46074,9 @@
|
|
|
46217
46074
|
// user action on some Android keyboards)
|
|
46218
46075
|
this.pendingContextChange = null;
|
|
46219
46076
|
this.handlers = Object.create(null);
|
|
46077
|
+
// Kludge to work around the fact that EditContext does not respond
|
|
46078
|
+
// well to having its content updated during a composition (see #1472)
|
|
46079
|
+
this.composing = null;
|
|
46220
46080
|
this.resetRange(view.state);
|
|
46221
46081
|
let context = this.editContext = new window.EditContext({
|
|
46222
46082
|
text: view.state.doc.sliceString(this.from, this.to),
|
|
@@ -46227,9 +46087,16 @@
|
|
|
46227
46087
|
let {
|
|
46228
46088
|
anchor
|
|
46229
46089
|
} = view.state.selection.main;
|
|
46090
|
+
let from = this.toEditorPos(e.updateRangeStart),
|
|
46091
|
+
to = this.toEditorPos(e.updateRangeEnd);
|
|
46092
|
+
if (view.inputState.composing >= 0 && !this.composing) this.composing = {
|
|
46093
|
+
contextBase: e.updateRangeStart,
|
|
46094
|
+
editorBase: from,
|
|
46095
|
+
drifted: false
|
|
46096
|
+
};
|
|
46230
46097
|
let change = {
|
|
46231
|
-
from
|
|
46232
|
-
to
|
|
46098
|
+
from,
|
|
46099
|
+
to,
|
|
46233
46100
|
insert: Text$2.of(e.text.split("\n"))
|
|
46234
46101
|
};
|
|
46235
46102
|
// If the window doesn't include the anchor, assume changes
|
|
@@ -46283,6 +46150,13 @@
|
|
|
46283
46150
|
this.handlers.compositionend = () => {
|
|
46284
46151
|
view.inputState.composing = -1;
|
|
46285
46152
|
view.inputState.compositionFirstChange = null;
|
|
46153
|
+
if (this.composing) {
|
|
46154
|
+
let {
|
|
46155
|
+
drifted
|
|
46156
|
+
} = this.composing;
|
|
46157
|
+
this.composing = null;
|
|
46158
|
+
if (drifted) this.reset(view.state);
|
|
46159
|
+
}
|
|
46286
46160
|
};
|
|
46287
46161
|
for (let event in this.handlers) context.addEventListener(event, this.handlers[event]);
|
|
46288
46162
|
this.measureReq = {
|
|
@@ -46334,11 +46208,12 @@
|
|
|
46334
46208
|
}
|
|
46335
46209
|
update(update) {
|
|
46336
46210
|
let reverted = this.pendingContextChange;
|
|
46337
|
-
if (
|
|
46211
|
+
if (this.composing && (this.composing.drifted || update.transactions.some(tr => !tr.isUserEvent("input.type") && tr.changes.touchesRange(this.from, this.to)))) {
|
|
46212
|
+
this.composing.drifted = true;
|
|
46213
|
+
this.composing.editorBase = update.changes.mapPos(this.composing.editorBase);
|
|
46214
|
+
} else if (!this.applyEdits(update) || !this.rangeIsValid(update.state)) {
|
|
46338
46215
|
this.pendingContextChange = null;
|
|
46339
|
-
this.
|
|
46340
|
-
this.editContext.updateText(0, this.editContext.text.length, update.state.doc.sliceString(this.from, this.to));
|
|
46341
|
-
this.setSelection(update.state);
|
|
46216
|
+
this.reset(update.state);
|
|
46342
46217
|
} else if (update.docChanged || update.selectionSet || reverted) {
|
|
46343
46218
|
this.setSelection(update.state);
|
|
46344
46219
|
}
|
|
@@ -46351,6 +46226,11 @@
|
|
|
46351
46226
|
this.from = Math.max(0, head - 10000 /* CxVp.Margin */);
|
|
46352
46227
|
this.to = Math.min(state.doc.length, head + 10000 /* CxVp.Margin */);
|
|
46353
46228
|
}
|
|
46229
|
+
reset(state) {
|
|
46230
|
+
this.resetRange(state);
|
|
46231
|
+
this.editContext.updateText(0, this.editContext.text.length, state.doc.sliceString(this.from, this.to));
|
|
46232
|
+
this.setSelection(state);
|
|
46233
|
+
}
|
|
46354
46234
|
revertPending(state) {
|
|
46355
46235
|
let pending = this.pendingContextChange;
|
|
46356
46236
|
this.pendingContextChange = null;
|
|
@@ -46371,10 +46251,12 @@
|
|
|
46371
46251
|
return !(this.from > 0 && head - this.from < 500 /* CxVp.MinMargin */ || this.to < state.doc.length && this.to - head < 500 /* CxVp.MinMargin */ || this.to - this.from > 10000 /* CxVp.Margin */ * 3);
|
|
46372
46252
|
}
|
|
46373
46253
|
toEditorPos(contextPos) {
|
|
46374
|
-
|
|
46254
|
+
let c = this.composing;
|
|
46255
|
+
return c && c.drifted ? c.editorBase + (contextPos - c.contextBase) : contextPos + this.from;
|
|
46375
46256
|
}
|
|
46376
46257
|
toContextPos(editorPos) {
|
|
46377
|
-
|
|
46258
|
+
let c = this.composing;
|
|
46259
|
+
return c && c.drifted ? c.contextBase + (editorPos - c.editorBase) : editorPos - this.from;
|
|
46378
46260
|
}
|
|
46379
46261
|
destroy() {
|
|
46380
46262
|
for (let event in this.handlers) this.editContext.removeEventListener(event, this.handlers[event]);
|
|
@@ -48859,7 +48741,6 @@
|
|
|
48859
48741
|
clearTimeout(this.measureTimeout);
|
|
48860
48742
|
}
|
|
48861
48743
|
readMeasure() {
|
|
48862
|
-
let editor = this.view.dom.getBoundingClientRect();
|
|
48863
48744
|
let scaleX = 1,
|
|
48864
48745
|
scaleY = 1,
|
|
48865
48746
|
makeAbsolute = false;
|
|
@@ -48893,9 +48774,16 @@
|
|
|
48893
48774
|
} = this.view.viewState);
|
|
48894
48775
|
}
|
|
48895
48776
|
}
|
|
48777
|
+
let visible = this.view.scrollDOM.getBoundingClientRect(),
|
|
48778
|
+
margins = getScrollMargins(this.view);
|
|
48896
48779
|
return {
|
|
48897
|
-
|
|
48898
|
-
|
|
48780
|
+
visible: {
|
|
48781
|
+
left: visible.left + margins.left,
|
|
48782
|
+
top: visible.top + margins.top,
|
|
48783
|
+
right: visible.right - margins.right,
|
|
48784
|
+
bottom: visible.bottom - margins.bottom
|
|
48785
|
+
},
|
|
48786
|
+
parent: this.parent ? this.container.getBoundingClientRect() : this.view.dom.getBoundingClientRect(),
|
|
48899
48787
|
pos: this.manager.tooltips.map((t, i) => {
|
|
48900
48788
|
let tv = this.manager.tooltipViews[i];
|
|
48901
48789
|
return tv.getCoords ? tv.getCoords(t.pos) : this.view.coordsAtPos(t.pos);
|
|
@@ -48917,7 +48805,7 @@
|
|
|
48917
48805
|
for (let t of this.manager.tooltipViews) t.dom.style.position = "absolute";
|
|
48918
48806
|
}
|
|
48919
48807
|
let {
|
|
48920
|
-
|
|
48808
|
+
visible,
|
|
48921
48809
|
space,
|
|
48922
48810
|
scaleX,
|
|
48923
48811
|
scaleY
|
|
@@ -48932,7 +48820,7 @@
|
|
|
48932
48820
|
let pos = measured.pos[i],
|
|
48933
48821
|
size = measured.size[i];
|
|
48934
48822
|
// Hide tooltips that are outside of the editor.
|
|
48935
|
-
if (!pos || pos.bottom <= Math.max(
|
|
48823
|
+
if (!pos || pos.bottom <= Math.max(visible.top, space.top) || pos.top >= Math.min(visible.bottom, space.bottom) || pos.right < Math.max(visible.left, space.left) - .1 || pos.left > Math.min(visible.right, space.right) + .1) {
|
|
48936
48824
|
dom.style.top = Outside;
|
|
48937
48825
|
continue;
|
|
48938
48826
|
}
|
|
@@ -48944,7 +48832,7 @@
|
|
|
48944
48832
|
ltr = this.view.textDirection == Direction.LTR;
|
|
48945
48833
|
let left = size.width > space.right - space.left ? ltr ? space.left : space.right - size.width : ltr ? Math.max(space.left, Math.min(pos.left - (arrow ? 14 /* Arrow.Offset */ : 0) + offset.x, space.right - width)) : Math.min(Math.max(space.left, pos.left - width + (arrow ? 14 /* Arrow.Offset */ : 0) - offset.x), space.right - width);
|
|
48946
48834
|
let above = this.above[i];
|
|
48947
|
-
if (!tooltip.strictSide && (above ? pos.top -
|
|
48835
|
+
if (!tooltip.strictSide && (above ? pos.top - height - arrowHeight - offset.y < space.top : pos.bottom + height + arrowHeight + offset.y > space.bottom) && above == space.bottom - pos.bottom > pos.top - space.top) above = this.above[i] = !above;
|
|
48948
48836
|
let spaceVert = (above ? pos.top - space.top : space.bottom - pos.bottom) - arrowHeight;
|
|
48949
48837
|
if (spaceVert < height && tView.resize !== false) {
|
|
48950
48838
|
if (spaceVert < this.view.defaultLineHeight) {
|
|
@@ -48999,7 +48887,7 @@
|
|
|
48999
48887
|
});
|
|
49000
48888
|
const baseTheme$6 = /*@__PURE__*/EditorView.baseTheme({
|
|
49001
48889
|
".cm-tooltip": {
|
|
49002
|
-
zIndex:
|
|
48890
|
+
zIndex: 500,
|
|
49003
48891
|
boxSizing: "border-box"
|
|
49004
48892
|
},
|
|
49005
48893
|
"&light .cm-tooltip": {
|
|
@@ -52779,11 +52667,10 @@
|
|
|
52779
52667
|
setSelected(selected, id) {
|
|
52780
52668
|
return selected == this.selected || selected >= this.options.length ? this : new CompletionDialog(this.options, makeAttrs(id, selected), this.tooltip, this.timestamp, selected, this.disabled);
|
|
52781
52669
|
}
|
|
52782
|
-
static build(active, state, id, prev, conf) {
|
|
52670
|
+
static build(active, state, id, prev, conf, didSetActive) {
|
|
52671
|
+
if (prev && !didSetActive && active.some(s => s.isPending)) return prev.setDisabled();
|
|
52783
52672
|
let options = sortOptions(active, state);
|
|
52784
|
-
if (!options.length)
|
|
52785
|
-
return prev && active.some(a => a.state == 1 /* State.Pending */) ? new CompletionDialog(prev.options, prev.attrs, prev.tooltip, prev.timestamp, prev.selected, true) : null;
|
|
52786
|
-
}
|
|
52673
|
+
if (!options.length) return prev && active.some(a => a.isPending) ? prev.setDisabled() : null;
|
|
52787
52674
|
let selected = state.facet(completionConfig).selectOnOpen ? 0 : -1;
|
|
52788
52675
|
if (prev && prev.selected != selected && prev.selected != -1) {
|
|
52789
52676
|
let selectedValue = prev.options[prev.selected].completion;
|
|
@@ -52803,6 +52690,9 @@
|
|
|
52803
52690
|
pos: changes.mapPos(this.tooltip.pos)
|
|
52804
52691
|
}), this.timestamp, this.selected, this.disabled);
|
|
52805
52692
|
}
|
|
52693
|
+
setDisabled() {
|
|
52694
|
+
return new CompletionDialog(this.options, this.attrs, this.tooltip, this.timestamp, this.selected, true);
|
|
52695
|
+
}
|
|
52806
52696
|
}
|
|
52807
52697
|
class CompletionState {
|
|
52808
52698
|
constructor(active, id, open) {
|
|
@@ -52824,10 +52714,11 @@
|
|
|
52824
52714
|
return value.update(tr, conf);
|
|
52825
52715
|
});
|
|
52826
52716
|
if (active.length == this.active.length && active.every((a, i) => a == this.active[i])) active = this.active;
|
|
52827
|
-
let open = this.open
|
|
52717
|
+
let open = this.open,
|
|
52718
|
+
didSet = tr.effects.some(e => e.is(setActiveEffect));
|
|
52828
52719
|
if (open && tr.docChanged) open = open.map(tr.changes);
|
|
52829
|
-
if (tr.selection || active.some(a => a.hasResult() && tr.changes.touchesRange(a.from, a.to)) || !sameResults(active, this.active)) open = CompletionDialog.build(active, state, this.id, open, conf);else if (open && open.disabled && !active.some(a => a.
|
|
52830
|
-
if (!open && active.every(a => a.
|
|
52720
|
+
if (tr.selection || active.some(a => a.hasResult() && tr.changes.touchesRange(a.from, a.to)) || !sameResults(active, this.active) || didSet) open = CompletionDialog.build(active, state, this.id, open, conf, didSet);else if (open && open.disabled && !active.some(a => a.isPending)) open = null;
|
|
52721
|
+
if (!open && active.every(a => !a.isPending) && active.some(a => a.hasResult())) active = active.map(a => a.hasResult() ? new ActiveSource(a.source, 0 /* State.Inactive */) : a);
|
|
52831
52722
|
for (let effect of tr.effects) if (effect.is(setSelectedEffect)) open = open && open.setSelected(effect.value, this.id);
|
|
52832
52723
|
return active == this.active && open == this.open ? this : new CompletionState(active, this.id, open);
|
|
52833
52724
|
}
|
|
@@ -52841,8 +52732,8 @@
|
|
|
52841
52732
|
function sameResults(a, b) {
|
|
52842
52733
|
if (a == b) return true;
|
|
52843
52734
|
for (let iA = 0, iB = 0;;) {
|
|
52844
|
-
while (iA < a.length && !a[iA].hasResult) iA++;
|
|
52845
|
-
while (iB < b.length && !b[iB].hasResult) iB++;
|
|
52735
|
+
while (iA < a.length && !a[iA].hasResult()) iA++;
|
|
52736
|
+
while (iB < b.length && !b[iB].hasResult()) iB++;
|
|
52846
52737
|
let endA = iA == a.length,
|
|
52847
52738
|
endB = iB == b.length;
|
|
52848
52739
|
if (endA || endB) return endA == endB;
|
|
@@ -52872,14 +52763,17 @@
|
|
|
52872
52763
|
return typing && conf.activateOnTyping ? 4 /* UpdateType.Activate */ | 1 /* UpdateType.Typing */ : typing ? 1 /* UpdateType.Typing */ : tr.isUserEvent("delete.backward") ? 2 /* UpdateType.Backspacing */ : tr.selection ? 8 /* UpdateType.Reset */ : tr.docChanged ? 16 /* UpdateType.ResetIfTouching */ : 0 /* UpdateType.None */;
|
|
52873
52764
|
}
|
|
52874
52765
|
class ActiveSource {
|
|
52875
|
-
constructor(source, state,
|
|
52766
|
+
constructor(source, state, explicit = false) {
|
|
52876
52767
|
this.source = source;
|
|
52877
52768
|
this.state = state;
|
|
52878
|
-
this.
|
|
52769
|
+
this.explicit = explicit;
|
|
52879
52770
|
}
|
|
52880
52771
|
hasResult() {
|
|
52881
52772
|
return false;
|
|
52882
52773
|
}
|
|
52774
|
+
get isPending() {
|
|
52775
|
+
return this.state == 1 /* State.Pending */;
|
|
52776
|
+
}
|
|
52883
52777
|
update(tr, conf) {
|
|
52884
52778
|
let type = getUpdateType(tr, conf),
|
|
52885
52779
|
value = this;
|
|
@@ -52887,7 +52781,7 @@
|
|
|
52887
52781
|
if (type & 4 /* UpdateType.Activate */ && value.state == 0 /* State.Inactive */) value = new ActiveSource(this.source, 1 /* State.Pending */);
|
|
52888
52782
|
value = value.updateFor(tr, type);
|
|
52889
52783
|
for (let effect of tr.effects) {
|
|
52890
|
-
if (effect.is(startCompletionEffect)) value = new ActiveSource(value.source, 1 /* State.Pending */, effect.value
|
|
52784
|
+
if (effect.is(startCompletionEffect)) value = new ActiveSource(value.source, 1 /* State.Pending */, effect.value);else if (effect.is(closeCompletionEffect)) value = new ActiveSource(value.source, 0 /* State.Inactive */);else if (effect.is(setActiveEffect)) for (let active of effect.value) if (active.source == value.source) value = active;
|
|
52891
52785
|
}
|
|
52892
52786
|
return value;
|
|
52893
52787
|
}
|
|
@@ -52895,15 +52789,16 @@
|
|
|
52895
52789
|
return this.map(tr.changes);
|
|
52896
52790
|
}
|
|
52897
52791
|
map(changes) {
|
|
52898
|
-
return
|
|
52792
|
+
return this;
|
|
52899
52793
|
}
|
|
52900
52794
|
touches(tr) {
|
|
52901
52795
|
return tr.changes.touchesRange(cur(tr.state));
|
|
52902
52796
|
}
|
|
52903
52797
|
}
|
|
52904
52798
|
class ActiveResult extends ActiveSource {
|
|
52905
|
-
constructor(source,
|
|
52906
|
-
super(source,
|
|
52799
|
+
constructor(source, explicit, limit, result, from, to) {
|
|
52800
|
+
super(source, 3 /* State.Result */, explicit);
|
|
52801
|
+
this.limit = limit;
|
|
52907
52802
|
this.result = result;
|
|
52908
52803
|
this.from = from;
|
|
52909
52804
|
this.to = to;
|
|
@@ -52919,17 +52814,17 @@
|
|
|
52919
52814
|
let from = tr.changes.mapPos(this.from),
|
|
52920
52815
|
to = tr.changes.mapPos(this.to, 1);
|
|
52921
52816
|
let pos = cur(tr.state);
|
|
52922
|
-
if (
|
|
52923
|
-
let
|
|
52924
|
-
if (checkValid(result.validFor, tr.state, from, to)) return new ActiveResult(this.source,
|
|
52925
|
-
if (result.update && (result = result.update(result, from, to, new CompletionContext(tr.state, pos,
|
|
52926
|
-
return new ActiveSource(this.source, 1 /* State.Pending */,
|
|
52817
|
+
if (pos > to || !result || type & 2 /* UpdateType.Backspacing */ && (cur(tr.startState) == this.from || pos < this.limit)) return new ActiveSource(this.source, type & 4 /* UpdateType.Activate */ ? 1 /* State.Pending */ : 0 /* State.Inactive */);
|
|
52818
|
+
let limit = tr.changes.mapPos(this.limit);
|
|
52819
|
+
if (checkValid(result.validFor, tr.state, from, to)) return new ActiveResult(this.source, this.explicit, limit, result, from, to);
|
|
52820
|
+
if (result.update && (result = result.update(result, from, to, new CompletionContext(tr.state, pos, false)))) return new ActiveResult(this.source, this.explicit, limit, result, result.from, (_a = result.to) !== null && _a !== void 0 ? _a : cur(tr.state));
|
|
52821
|
+
return new ActiveSource(this.source, 1 /* State.Pending */, this.explicit);
|
|
52927
52822
|
}
|
|
52928
52823
|
map(mapping) {
|
|
52929
52824
|
if (mapping.empty) return this;
|
|
52930
52825
|
let result = this.result.map ? this.result.map(this.result, mapping) : this.result;
|
|
52931
52826
|
if (!result) return new ActiveSource(this.source, 0 /* State.Inactive */);
|
|
52932
|
-
return new ActiveResult(this.source, this.
|
|
52827
|
+
return new ActiveResult(this.source, this.explicit, mapping.mapPos(this.limit), this.result, mapping.mapPos(this.from), mapping.mapPos(this.to, 1));
|
|
52933
52828
|
}
|
|
52934
52829
|
touches(tr) {
|
|
52935
52830
|
return tr.changes.touchesRange(this.from, this.to);
|
|
@@ -53039,7 +52934,7 @@
|
|
|
53039
52934
|
this.debounceAccept = -1;
|
|
53040
52935
|
this.pendingStart = false;
|
|
53041
52936
|
this.composing = 0 /* CompositionState.None */;
|
|
53042
|
-
for (let active of view.state.field(completionState).active) if (active.
|
|
52937
|
+
for (let active of view.state.field(completionState).active) if (active.isPending) this.startQuery(active);
|
|
53043
52938
|
}
|
|
53044
52939
|
update(update) {
|
|
53045
52940
|
let cState = update.state.field(completionState);
|
|
@@ -53068,7 +52963,7 @@
|
|
|
53068
52963
|
if (this.debounceUpdate > -1) clearTimeout(this.debounceUpdate);
|
|
53069
52964
|
if (update.transactions.some(tr => tr.effects.some(e => e.is(startCompletionEffect)))) this.pendingStart = true;
|
|
53070
52965
|
let delay = this.pendingStart ? 50 : conf.activateOnTypingDelay;
|
|
53071
|
-
this.debounceUpdate = cState.active.some(a => a.
|
|
52966
|
+
this.debounceUpdate = cState.active.some(a => a.isPending && !this.running.some(q => q.active.source == a.source)) ? setTimeout(() => this.startUpdate(), delay) : -1;
|
|
53072
52967
|
if (this.composing != 0 /* CompositionState.None */) for (let tr of update.transactions) {
|
|
53073
52968
|
if (tr.isUserEvent("input.type")) this.composing = 2 /* CompositionState.Changed */;else if (this.composing == 2 /* CompositionState.Changed */ && tr.selection) this.composing = 3 /* CompositionState.ChangedAndMoved */;
|
|
53074
52969
|
}
|
|
@@ -53081,15 +52976,16 @@
|
|
|
53081
52976
|
} = this.view,
|
|
53082
52977
|
cState = state.field(completionState);
|
|
53083
52978
|
for (let active of cState.active) {
|
|
53084
|
-
if (active.
|
|
52979
|
+
if (active.isPending && !this.running.some(r => r.active.source == active.source)) this.startQuery(active);
|
|
53085
52980
|
}
|
|
52981
|
+
if (this.running.length && cState.open && cState.open.disabled) this.debounceAccept = setTimeout(() => this.accept(), this.view.state.facet(completionConfig).updateSyncTime);
|
|
53086
52982
|
}
|
|
53087
52983
|
startQuery(active) {
|
|
53088
52984
|
let {
|
|
53089
52985
|
state
|
|
53090
52986
|
} = this.view,
|
|
53091
52987
|
pos = cur(state);
|
|
53092
|
-
let context = new CompletionContext(state, pos, active.
|
|
52988
|
+
let context = new CompletionContext(state, pos, active.explicit, this.view);
|
|
53093
52989
|
let pending = new RunningQuery(active, context);
|
|
53094
52990
|
this.running.push(pending);
|
|
53095
52991
|
Promise.resolve(active.source(context)).then(result => {
|
|
@@ -53114,13 +53010,16 @@
|
|
|
53114
53010
|
if (this.debounceAccept > -1) clearTimeout(this.debounceAccept);
|
|
53115
53011
|
this.debounceAccept = -1;
|
|
53116
53012
|
let updated = [];
|
|
53117
|
-
let conf = this.view.state.facet(completionConfig)
|
|
53013
|
+
let conf = this.view.state.facet(completionConfig),
|
|
53014
|
+
cState = this.view.state.field(completionState);
|
|
53118
53015
|
for (let i = 0; i < this.running.length; i++) {
|
|
53119
53016
|
let query = this.running[i];
|
|
53120
53017
|
if (query.done === undefined) continue;
|
|
53121
53018
|
this.running.splice(i--, 1);
|
|
53122
53019
|
if (query.done) {
|
|
53123
|
-
let
|
|
53020
|
+
let pos = cur(query.updates.length ? query.updates[0].startState : this.view.state);
|
|
53021
|
+
let limit = Math.min(pos, query.done.from + (query.active.explicit ? 0 : 1));
|
|
53022
|
+
let active = new ActiveResult(query.active.source, query.active.explicit, limit, query.done, query.done.from, (_a = query.done.to) !== null && _a !== void 0 ? _a : pos);
|
|
53124
53023
|
// Replay the transactions that happened since the start of
|
|
53125
53024
|
// the request and see if that preserves the result
|
|
53126
53025
|
for (let tr of query.updates) active = active.update(tr, conf);
|
|
@@ -53129,21 +53028,21 @@
|
|
|
53129
53028
|
continue;
|
|
53130
53029
|
}
|
|
53131
53030
|
}
|
|
53132
|
-
let current =
|
|
53133
|
-
if (current && current.
|
|
53031
|
+
let current = cState.active.find(a => a.source == query.active.source);
|
|
53032
|
+
if (current && current.isPending) {
|
|
53134
53033
|
if (query.done == null) {
|
|
53135
53034
|
// Explicitly failed. Should clear the pending status if it
|
|
53136
53035
|
// hasn't been re-set in the meantime.
|
|
53137
53036
|
let active = new ActiveSource(query.active.source, 0 /* State.Inactive */);
|
|
53138
53037
|
for (let tr of query.updates) active = active.update(tr, conf);
|
|
53139
|
-
if (active.
|
|
53038
|
+
if (!active.isPending) updated.push(active);
|
|
53140
53039
|
} else {
|
|
53141
53040
|
// Cleared by subsequent transactions. Restart.
|
|
53142
53041
|
this.startQuery(current);
|
|
53143
53042
|
}
|
|
53144
53043
|
}
|
|
53145
53044
|
}
|
|
53146
|
-
if (updated.length) this.view.dispatch({
|
|
53045
|
+
if (updated.length || cState.open && cState.open.disabled) this.view.dispatch({
|
|
53147
53046
|
effects: setActiveEffect.of(updated)
|
|
53148
53047
|
});
|
|
53149
53048
|
}
|
|
@@ -54072,6 +53971,7 @@
|
|
|
54072
53971
|
for (let r of state.selection.ranges) {
|
|
54073
53972
|
let fromLine = state.doc.lineAt(r.from);
|
|
54074
53973
|
let toLine = r.to <= fromLine.to ? fromLine : state.doc.lineAt(r.to);
|
|
53974
|
+
if (toLine.from > fromLine.from && toLine.from == r.to) toLine = r.to == fromLine.to + 1 ? fromLine : state.doc.lineAt(r.to - 1);
|
|
54075
53975
|
let last = ranges.length - 1;
|
|
54076
53976
|
if (last >= 0 && ranges[last].to > fromLine.from) ranges[last].to = toLine.to;else ranges.push({
|
|
54077
53977
|
from: fromLine.from + /^\s*/.exec(fromLine.text)[0].length,
|
|
@@ -54743,13 +54643,13 @@
|
|
|
54743
54643
|
state,
|
|
54744
54644
|
dispatch
|
|
54745
54645
|
}) => toMatchingBracket(state, dispatch);
|
|
54746
|
-
function extendSel(
|
|
54747
|
-
let selection = updateSel(
|
|
54646
|
+
function extendSel(target, how) {
|
|
54647
|
+
let selection = updateSel(target.state.selection, range => {
|
|
54748
54648
|
let head = how(range);
|
|
54749
54649
|
return EditorSelection.range(range.anchor, head.head, head.goalColumn, head.bidiLevel || undefined);
|
|
54750
54650
|
});
|
|
54751
|
-
if (selection.eq(
|
|
54752
|
-
|
|
54651
|
+
if (selection.eq(target.state.selection)) return false;
|
|
54652
|
+
target.dispatch(setSel(target.state, selection));
|
|
54753
54653
|
return true;
|
|
54754
54654
|
}
|
|
54755
54655
|
function selectByChar(view, forward) {
|
|
@@ -55563,7 +55463,7 @@
|
|
|
55563
55463
|
- End: [`cursorLineBoundaryForward`](https://codemirror.net/6/docs/ref/#commands.cursorLineBoundaryForward) ([`selectLineBoundaryForward`](https://codemirror.net/6/docs/ref/#commands.selectLineBoundaryForward) with Shift)
|
|
55564
55464
|
- Ctrl-Home (Cmd-Home on macOS): [`cursorDocStart`](https://codemirror.net/6/docs/ref/#commands.cursorDocStart) ([`selectDocStart`](https://codemirror.net/6/docs/ref/#commands.selectDocStart) with Shift)
|
|
55565
55465
|
- Ctrl-End (Cmd-Home on macOS): [`cursorDocEnd`](https://codemirror.net/6/docs/ref/#commands.cursorDocEnd) ([`selectDocEnd`](https://codemirror.net/6/docs/ref/#commands.selectDocEnd) with Shift)
|
|
55566
|
-
- Enter: [`insertNewlineAndIndent`](https://codemirror.net/6/docs/ref/#commands.insertNewlineAndIndent)
|
|
55466
|
+
- Enter and Shift-Enter: [`insertNewlineAndIndent`](https://codemirror.net/6/docs/ref/#commands.insertNewlineAndIndent)
|
|
55567
55467
|
- Ctrl-a (Cmd-a on macOS): [`selectAll`](https://codemirror.net/6/docs/ref/#commands.selectAll)
|
|
55568
55468
|
- Backspace: [`deleteCharBackward`](https://codemirror.net/6/docs/ref/#commands.deleteCharBackward)
|
|
55569
55469
|
- Delete: [`deleteCharForward`](https://codemirror.net/6/docs/ref/#commands.deleteCharForward)
|
|
@@ -55658,7 +55558,8 @@
|
|
|
55658
55558
|
shift: selectDocEnd
|
|
55659
55559
|
}, {
|
|
55660
55560
|
key: "Enter",
|
|
55661
|
-
run: insertNewlineAndIndent
|
|
55561
|
+
run: insertNewlineAndIndent,
|
|
55562
|
+
shift: insertNewlineAndIndent
|
|
55662
55563
|
}, {
|
|
55663
55564
|
key: "Mod-a",
|
|
55664
55565
|
run: selectAll
|
|
@@ -59575,7 +59476,7 @@
|
|
|
59575
59476
|
};
|
|
59576
59477
|
|
|
59577
59478
|
/**
|
|
59578
|
-
* marked
|
|
59479
|
+
* marked v15.0.1 - a markdown parser
|
|
59579
59480
|
* Copyright (c) 2011-2024, Christopher Jeffrey. (MIT Licensed)
|
|
59580
59481
|
* https://github.com/markedjs/marked
|
|
59581
59482
|
*/
|
|
@@ -59606,14 +59507,285 @@
|
|
|
59606
59507
|
function changeDefaults(newDefaults) {
|
|
59607
59508
|
_defaults = newDefaults;
|
|
59608
59509
|
}
|
|
59510
|
+
const noopTest = {
|
|
59511
|
+
exec: () => null
|
|
59512
|
+
};
|
|
59513
|
+
function edit(regex, opt = '') {
|
|
59514
|
+
let source = typeof regex === 'string' ? regex : regex.source;
|
|
59515
|
+
const obj = {
|
|
59516
|
+
replace: (name, val) => {
|
|
59517
|
+
let valSource = typeof val === 'string' ? val : val.source;
|
|
59518
|
+
valSource = valSource.replace(other.caret, '$1');
|
|
59519
|
+
source = source.replace(name, valSource);
|
|
59520
|
+
return obj;
|
|
59521
|
+
},
|
|
59522
|
+
getRegex: () => {
|
|
59523
|
+
return new RegExp(source, opt);
|
|
59524
|
+
}
|
|
59525
|
+
};
|
|
59526
|
+
return obj;
|
|
59527
|
+
}
|
|
59528
|
+
const other = {
|
|
59529
|
+
codeRemoveIndent: /^(?: {1,4}| {0,3}\t)/gm,
|
|
59530
|
+
outputLinkReplace: /\\([\[\]])/g,
|
|
59531
|
+
indentCodeCompensation: /^(\s+)(?:```)/,
|
|
59532
|
+
beginningSpace: /^\s+/,
|
|
59533
|
+
endingHash: /#$/,
|
|
59534
|
+
startingSpaceChar: /^ /,
|
|
59535
|
+
endingSpaceChar: / $/,
|
|
59536
|
+
nonSpaceChar: /[^ ]/,
|
|
59537
|
+
newLineCharGlobal: /\n/g,
|
|
59538
|
+
tabCharGlobal: /\t/g,
|
|
59539
|
+
multipleSpaceGlobal: /\s+/g,
|
|
59540
|
+
blankLine: /^[ \t]*$/,
|
|
59541
|
+
doubleBlankLine: /\n[ \t]*\n[ \t]*$/,
|
|
59542
|
+
blockquoteStart: /^ {0,3}>/,
|
|
59543
|
+
blockquoteSetextReplace: /\n {0,3}((?:=+|-+) *)(?=\n|$)/g,
|
|
59544
|
+
blockquoteSetextReplace2: /^ {0,3}>[ \t]?/gm,
|
|
59545
|
+
listReplaceTabs: /^\t+/,
|
|
59546
|
+
listReplaceNesting: /^ {1,4}(?=( {4})*[^ ])/g,
|
|
59547
|
+
listIsTask: /^\[[ xX]\] /,
|
|
59548
|
+
listReplaceTask: /^\[[ xX]\] +/,
|
|
59549
|
+
anyLine: /\n.*\n/,
|
|
59550
|
+
hrefBrackets: /^<(.*)>$/,
|
|
59551
|
+
tableDelimiter: /[:|]/,
|
|
59552
|
+
tableAlignChars: /^\||\| *$/g,
|
|
59553
|
+
tableRowBlankLine: /\n[ \t]*$/,
|
|
59554
|
+
tableAlignRight: /^ *-+: *$/,
|
|
59555
|
+
tableAlignCenter: /^ *:-+: *$/,
|
|
59556
|
+
tableAlignLeft: /^ *:-+ *$/,
|
|
59557
|
+
startATag: /^<a /i,
|
|
59558
|
+
endATag: /^<\/a>/i,
|
|
59559
|
+
startPreScriptTag: /^<(pre|code|kbd|script)(\s|>)/i,
|
|
59560
|
+
endPreScriptTag: /^<\/(pre|code|kbd|script)(\s|>)/i,
|
|
59561
|
+
startAngleBracket: /^</,
|
|
59562
|
+
endAngleBracket: />$/,
|
|
59563
|
+
pedanticHrefTitle: /^([^'"]*[^\s])\s+(['"])(.*)\2/,
|
|
59564
|
+
unicodeAlphaNumeric: /[\p{L}\p{N}]/u,
|
|
59565
|
+
escapeTest: /[&<>"']/,
|
|
59566
|
+
escapeReplace: /[&<>"']/g,
|
|
59567
|
+
escapeTestNoEncode: /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,
|
|
59568
|
+
escapeReplaceNoEncode: /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,
|
|
59569
|
+
unescapeTest: /&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig,
|
|
59570
|
+
caret: /(^|[^\[])\^/g,
|
|
59571
|
+
percentDecode: /%25/g,
|
|
59572
|
+
findPipe: /\|/g,
|
|
59573
|
+
splitPipe: / \|/,
|
|
59574
|
+
slashPipe: /\\\|/g,
|
|
59575
|
+
carriageReturn: /\r\n|\r/g,
|
|
59576
|
+
spaceLine: /^ +$/gm,
|
|
59577
|
+
notSpaceStart: /^\S*/,
|
|
59578
|
+
endingNewline: /\n$/,
|
|
59579
|
+
listItemRegex: bull => new RegExp(`^( {0,3}${bull})((?:[\t ][^\\n]*)?(?:\\n|$))`),
|
|
59580
|
+
nextBulletRegex: indent => new RegExp(`^ {0,${Math.min(3, indent - 1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ \t][^\\n]*)?(?:\\n|$))`),
|
|
59581
|
+
hrRegex: indent => new RegExp(`^ {0,${Math.min(3, indent - 1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),
|
|
59582
|
+
fencesBeginRegex: indent => new RegExp(`^ {0,${Math.min(3, indent - 1)}}(?:\`\`\`|~~~)`),
|
|
59583
|
+
headingBeginRegex: indent => new RegExp(`^ {0,${Math.min(3, indent - 1)}}#`),
|
|
59584
|
+
htmlBeginRegex: indent => new RegExp(`^ {0,${Math.min(3, indent - 1)}}<(?:[a-z].*>|!--)`, 'i')
|
|
59585
|
+
};
|
|
59586
|
+
/**
|
|
59587
|
+
* Block-Level Grammar
|
|
59588
|
+
*/
|
|
59589
|
+
const newline = /^(?:[ \t]*(?:\n|$))+/;
|
|
59590
|
+
const blockCode = /^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/;
|
|
59591
|
+
const fences = /^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/;
|
|
59592
|
+
const hr = /^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/;
|
|
59593
|
+
const heading = /^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/;
|
|
59594
|
+
const bullet = /(?:[*+-]|\d{1,9}[.)])/;
|
|
59595
|
+
const lheading = edit(/^(?!bull |blockCode|fences|blockquote|heading|html)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html))+?)\n {0,3}(=+|-+) *(?:\n+|$)/).replace(/bull/g, bullet) // lists can interrupt
|
|
59596
|
+
.replace(/blockCode/g, /(?: {4}| {0,3}\t)/) // indented code blocks can interrupt
|
|
59597
|
+
.replace(/fences/g, / {0,3}(?:`{3,}|~{3,})/) // fenced code blocks can interrupt
|
|
59598
|
+
.replace(/blockquote/g, / {0,3}>/) // blockquote can interrupt
|
|
59599
|
+
.replace(/heading/g, / {0,3}#{1,6}/) // ATX heading can interrupt
|
|
59600
|
+
.replace(/html/g, / {0,3}<[^\n>]+>\n/) // block html can interrupt
|
|
59601
|
+
.getRegex();
|
|
59602
|
+
const _paragraph = /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/;
|
|
59603
|
+
const blockText = /^[^\n]+/;
|
|
59604
|
+
const _blockLabel = /(?!\s*\])(?:\\.|[^\[\]\\])+/;
|
|
59605
|
+
const def = edit(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace('label', _blockLabel).replace('title', /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex();
|
|
59606
|
+
const list = edit(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g, bullet).getRegex();
|
|
59607
|
+
const _tag = 'address|article|aside|base|basefont|blockquote|body|caption' + '|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption' + '|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe' + '|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option' + '|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title' + '|tr|track|ul';
|
|
59608
|
+
const _comment = /<!--(?:-?>|[\s\S]*?(?:-->|$))/;
|
|
59609
|
+
const html = edit('^ {0,3}(?:' // optional indentation
|
|
59610
|
+
+ '<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)' // (1)
|
|
59611
|
+
+ '|comment[^\\n]*(\\n+|$)' // (2)
|
|
59612
|
+
+ '|<\\?[\\s\\S]*?(?:\\?>\\n*|$)' // (3)
|
|
59613
|
+
+ '|<![A-Z][\\s\\S]*?(?:>\\n*|$)' // (4)
|
|
59614
|
+
+ '|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)' // (5)
|
|
59615
|
+
+ '|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ \t]*)+\\n|$)' // (6)
|
|
59616
|
+
+ '|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ \t]*)+\\n|$)' // (7) open tag
|
|
59617
|
+
+ '|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ \t]*)+\\n|$)' // (7) closing tag
|
|
59618
|
+
+ ')', 'i').replace('comment', _comment).replace('tag', _tag).replace('attribute', / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex();
|
|
59619
|
+
const paragraph = edit(_paragraph).replace('hr', hr).replace('heading', ' {0,3}#{1,6}(?:\\s|$)').replace('|lheading', '') // setext headings don't interrupt commonmark paragraphs
|
|
59620
|
+
.replace('|table', '').replace('blockquote', ' {0,3}>').replace('fences', ' {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n').replace('list', ' {0,3}(?:[*+-]|1[.)]) ') // only lists starting from 1 can interrupt
|
|
59621
|
+
.replace('html', '</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)').replace('tag', _tag) // pars can be interrupted by type (6) html blocks
|
|
59622
|
+
.getRegex();
|
|
59623
|
+
const blockquote = edit(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace('paragraph', paragraph).getRegex();
|
|
59624
|
+
/**
|
|
59625
|
+
* Normal Block Grammar
|
|
59626
|
+
*/
|
|
59627
|
+
const blockNormal = {
|
|
59628
|
+
blockquote,
|
|
59629
|
+
code: blockCode,
|
|
59630
|
+
def,
|
|
59631
|
+
fences,
|
|
59632
|
+
heading,
|
|
59633
|
+
hr,
|
|
59634
|
+
html,
|
|
59635
|
+
lheading,
|
|
59636
|
+
list,
|
|
59637
|
+
newline,
|
|
59638
|
+
paragraph,
|
|
59639
|
+
table: noopTest,
|
|
59640
|
+
text: blockText
|
|
59641
|
+
};
|
|
59642
|
+
/**
|
|
59643
|
+
* GFM Block Grammar
|
|
59644
|
+
*/
|
|
59645
|
+
const gfmTable = edit('^ *([^\\n ].*)\\n' // Header
|
|
59646
|
+
+ ' {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)' // Align
|
|
59647
|
+
+ '(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)') // Cells
|
|
59648
|
+
.replace('hr', hr).replace('heading', ' {0,3}#{1,6}(?:\\s|$)').replace('blockquote', ' {0,3}>').replace('code', '(?: {4}| {0,3}\t)[^\\n]').replace('fences', ' {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n').replace('list', ' {0,3}(?:[*+-]|1[.)]) ') // only lists starting from 1 can interrupt
|
|
59649
|
+
.replace('html', '</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)').replace('tag', _tag) // tables can be interrupted by type (6) html blocks
|
|
59650
|
+
.getRegex();
|
|
59651
|
+
const blockGfm = {
|
|
59652
|
+
...blockNormal,
|
|
59653
|
+
table: gfmTable,
|
|
59654
|
+
paragraph: edit(_paragraph).replace('hr', hr).replace('heading', ' {0,3}#{1,6}(?:\\s|$)').replace('|lheading', '') // setext headings don't interrupt commonmark paragraphs
|
|
59655
|
+
.replace('table', gfmTable) // interrupt paragraphs with table
|
|
59656
|
+
.replace('blockquote', ' {0,3}>').replace('fences', ' {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n').replace('list', ' {0,3}(?:[*+-]|1[.)]) ') // only lists starting from 1 can interrupt
|
|
59657
|
+
.replace('html', '</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)').replace('tag', _tag) // pars can be interrupted by type (6) html blocks
|
|
59658
|
+
.getRegex()
|
|
59659
|
+
};
|
|
59660
|
+
/**
|
|
59661
|
+
* Pedantic grammar (original John Gruber's loose markdown specification)
|
|
59662
|
+
*/
|
|
59663
|
+
const blockPedantic = {
|
|
59664
|
+
...blockNormal,
|
|
59665
|
+
html: edit('^ *(?:comment *(?:\\n|\\s*$)' + '|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)' // closed tag
|
|
59666
|
+
+ '|<tag(?:"[^"]*"|\'[^\']*\'|\\s[^\'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))').replace('comment', _comment).replace(/tag/g, '(?!(?:' + 'a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub' + '|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)' + '\\b)\\w+(?!:|[^\\w\\s@]*@)\\b').getRegex(),
|
|
59667
|
+
def: /^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,
|
|
59668
|
+
heading: /^(#{1,6})(.*)(?:\n+|$)/,
|
|
59669
|
+
fences: noopTest,
|
|
59670
|
+
// fences not supported
|
|
59671
|
+
lheading: /^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,
|
|
59672
|
+
paragraph: edit(_paragraph).replace('hr', hr).replace('heading', ' *#{1,6} *[^\n]').replace('lheading', lheading).replace('|table', '').replace('blockquote', ' {0,3}>').replace('|fences', '').replace('|list', '').replace('|html', '').replace('|tag', '').getRegex()
|
|
59673
|
+
};
|
|
59674
|
+
/**
|
|
59675
|
+
* Inline-Level Grammar
|
|
59676
|
+
*/
|
|
59677
|
+
const escape$1 = /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/;
|
|
59678
|
+
const inlineCode = /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/;
|
|
59679
|
+
const br = /^( {2,}|\\)\n(?!\s*$)/;
|
|
59680
|
+
const inlineText = /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/;
|
|
59681
|
+
// list of unicode punctuation marks, plus any missing characters from CommonMark spec
|
|
59682
|
+
const _punctuation = '\\p{P}\\p{S}';
|
|
59683
|
+
const punctuation = edit(/^((?![*_])[\spunctuation])/, 'u').replace(/punctuation/g, _punctuation).getRegex();
|
|
59684
|
+
// sequences em should skip over [title](link), `code`, <html>
|
|
59685
|
+
const blockSkip = /\[[^[\]]*?\]\((?:\\.|[^\\\(\)]|\((?:\\.|[^\\\(\)])*\))*\)|`[^`]*?`|<[^<>]*?>/g;
|
|
59686
|
+
const emStrongLDelim = edit(/^(?:\*+(?:((?!\*)[punct])|[^\s*]))|^_+(?:((?!_)[punct])|([^\s_]))/, 'u').replace(/punct/g, _punctuation).getRegex();
|
|
59687
|
+
const emStrongRDelimAst = edit('^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)' // Skip orphan inside strong
|
|
59688
|
+
+ '|[^*]+(?=[^*])' // Consume to delim
|
|
59689
|
+
+ '|(?!\\*)[punct](\\*+)(?=[\\s]|$)' // (1) #*** can only be a Right Delimiter
|
|
59690
|
+
+ '|[^punct\\s](\\*+)(?!\\*)(?=[punct\\s]|$)' // (2) a***#, a*** can only be a Right Delimiter
|
|
59691
|
+
+ '|(?!\\*)[punct\\s](\\*+)(?=[^punct\\s])' // (3) #***a, ***a can only be Left Delimiter
|
|
59692
|
+
+ '|[\\s](\\*+)(?!\\*)(?=[punct])' // (4) ***# can only be Left Delimiter
|
|
59693
|
+
+ '|(?!\\*)[punct](\\*+)(?!\\*)(?=[punct])' // (5) #***# can be either Left or Right Delimiter
|
|
59694
|
+
+ '|[^punct\\s](\\*+)(?=[^punct\\s])', 'gu') // (6) a***a can be either Left or Right Delimiter
|
|
59695
|
+
.replace(/punct/g, _punctuation).getRegex();
|
|
59696
|
+
// (6) Not allowed for _
|
|
59697
|
+
const emStrongRDelimUnd = edit('^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)' // Skip orphan inside strong
|
|
59698
|
+
+ '|[^_]+(?=[^_])' // Consume to delim
|
|
59699
|
+
+ '|(?!_)[punct](_+)(?=[\\s]|$)' // (1) #___ can only be a Right Delimiter
|
|
59700
|
+
+ '|[^punct\\s](_+)(?!_)(?=[punct\\s]|$)' // (2) a___#, a___ can only be a Right Delimiter
|
|
59701
|
+
+ '|(?!_)[punct\\s](_+)(?=[^punct\\s])' // (3) #___a, ___a can only be Left Delimiter
|
|
59702
|
+
+ '|[\\s](_+)(?!_)(?=[punct])' // (4) ___# can only be Left Delimiter
|
|
59703
|
+
+ '|(?!_)[punct](_+)(?!_)(?=[punct])', 'gu') // (5) #___# can be either Left or Right Delimiter
|
|
59704
|
+
.replace(/punct/g, _punctuation).getRegex();
|
|
59705
|
+
const anyPunctuation = edit(/\\([punct])/, 'gu').replace(/punct/g, _punctuation).getRegex();
|
|
59706
|
+
const autolink = edit(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace('scheme', /[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace('email', /[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex();
|
|
59707
|
+
const _inlineComment = edit(_comment).replace('(?:-->|$)', '-->').getRegex();
|
|
59708
|
+
const tag = edit('^comment' + '|^</[a-zA-Z][\\w:-]*\\s*>' // self-closing tag
|
|
59709
|
+
+ '|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>' // open tag
|
|
59710
|
+
+ '|^<\\?[\\s\\S]*?\\?>' // processing instruction, e.g. <?php ?>
|
|
59711
|
+
+ '|^<![a-zA-Z]+\\s[\\s\\S]*?>' // declaration, e.g. <!DOCTYPE html>
|
|
59712
|
+
+ '|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>') // CDATA section
|
|
59713
|
+
.replace('comment', _inlineComment).replace('attribute', /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex();
|
|
59714
|
+
const _inlineLabel = /(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/;
|
|
59715
|
+
const link = edit(/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/).replace('label', _inlineLabel).replace('href', /<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/).replace('title', /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex();
|
|
59716
|
+
const reflink = edit(/^!?\[(label)\]\[(ref)\]/).replace('label', _inlineLabel).replace('ref', _blockLabel).getRegex();
|
|
59717
|
+
const nolink = edit(/^!?\[(ref)\](?:\[\])?/).replace('ref', _blockLabel).getRegex();
|
|
59718
|
+
const reflinkSearch = edit('reflink|nolink(?!\\()', 'g').replace('reflink', reflink).replace('nolink', nolink).getRegex();
|
|
59719
|
+
/**
|
|
59720
|
+
* Normal Inline Grammar
|
|
59721
|
+
*/
|
|
59722
|
+
const inlineNormal = {
|
|
59723
|
+
_backpedal: noopTest,
|
|
59724
|
+
// only used for GFM url
|
|
59725
|
+
anyPunctuation,
|
|
59726
|
+
autolink,
|
|
59727
|
+
blockSkip,
|
|
59728
|
+
br,
|
|
59729
|
+
code: inlineCode,
|
|
59730
|
+
del: noopTest,
|
|
59731
|
+
emStrongLDelim,
|
|
59732
|
+
emStrongRDelimAst,
|
|
59733
|
+
emStrongRDelimUnd,
|
|
59734
|
+
escape: escape$1,
|
|
59735
|
+
link,
|
|
59736
|
+
nolink,
|
|
59737
|
+
punctuation,
|
|
59738
|
+
reflink,
|
|
59739
|
+
reflinkSearch,
|
|
59740
|
+
tag,
|
|
59741
|
+
text: inlineText,
|
|
59742
|
+
url: noopTest
|
|
59743
|
+
};
|
|
59744
|
+
/**
|
|
59745
|
+
* Pedantic Inline Grammar
|
|
59746
|
+
*/
|
|
59747
|
+
const inlinePedantic = {
|
|
59748
|
+
...inlineNormal,
|
|
59749
|
+
link: edit(/^!?\[(label)\]\((.*?)\)/).replace('label', _inlineLabel).getRegex(),
|
|
59750
|
+
reflink: edit(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace('label', _inlineLabel).getRegex()
|
|
59751
|
+
};
|
|
59752
|
+
/**
|
|
59753
|
+
* GFM Inline Grammar
|
|
59754
|
+
*/
|
|
59755
|
+
const inlineGfm = {
|
|
59756
|
+
...inlineNormal,
|
|
59757
|
+
escape: edit(escape$1).replace('])', '~|])').getRegex(),
|
|
59758
|
+
url: edit(/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/, 'i').replace('email', /[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),
|
|
59759
|
+
_backpedal: /(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,
|
|
59760
|
+
del: /^(~~?)(?=[^\s~])((?:\\.|[^\\])*?(?:\\.|[^\s~\\]))\1(?=[^~]|$)/,
|
|
59761
|
+
text: /^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/
|
|
59762
|
+
};
|
|
59763
|
+
/**
|
|
59764
|
+
* GFM + Line Breaks Inline Grammar
|
|
59765
|
+
*/
|
|
59766
|
+
const inlineBreaks = {
|
|
59767
|
+
...inlineGfm,
|
|
59768
|
+
br: edit(br).replace('{2,}', '*').getRegex(),
|
|
59769
|
+
text: edit(inlineGfm.text).replace('\\b_', '\\b_| {2,}\\n').replace(/\{2,\}/g, '*').getRegex()
|
|
59770
|
+
};
|
|
59771
|
+
/**
|
|
59772
|
+
* exports
|
|
59773
|
+
*/
|
|
59774
|
+
const block = {
|
|
59775
|
+
normal: blockNormal,
|
|
59776
|
+
gfm: blockGfm,
|
|
59777
|
+
pedantic: blockPedantic
|
|
59778
|
+
};
|
|
59779
|
+
const inline = {
|
|
59780
|
+
normal: inlineNormal,
|
|
59781
|
+
gfm: inlineGfm,
|
|
59782
|
+
breaks: inlineBreaks,
|
|
59783
|
+
pedantic: inlinePedantic
|
|
59784
|
+
};
|
|
59609
59785
|
|
|
59610
59786
|
/**
|
|
59611
59787
|
* Helpers
|
|
59612
59788
|
*/
|
|
59613
|
-
const escapeTest = /[&<>"']/;
|
|
59614
|
-
const escapeReplace = new RegExp(escapeTest.source, 'g');
|
|
59615
|
-
const escapeTestNoEncode = /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/;
|
|
59616
|
-
const escapeReplaceNoEncode = new RegExp(escapeTestNoEncode.source, 'g');
|
|
59617
59789
|
const escapeReplacements = {
|
|
59618
59790
|
'&': '&',
|
|
59619
59791
|
'<': '<',
|
|
@@ -59622,50 +59794,30 @@
|
|
|
59622
59794
|
"'": '''
|
|
59623
59795
|
};
|
|
59624
59796
|
const getEscapeReplacement = ch => escapeReplacements[ch];
|
|
59625
|
-
function escape
|
|
59797
|
+
function escape(html, encode) {
|
|
59626
59798
|
if (encode) {
|
|
59627
|
-
if (escapeTest.test(html)) {
|
|
59628
|
-
return html.replace(escapeReplace, getEscapeReplacement);
|
|
59799
|
+
if (other.escapeTest.test(html)) {
|
|
59800
|
+
return html.replace(other.escapeReplace, getEscapeReplacement);
|
|
59629
59801
|
}
|
|
59630
59802
|
} else {
|
|
59631
|
-
if (escapeTestNoEncode.test(html)) {
|
|
59632
|
-
return html.replace(escapeReplaceNoEncode, getEscapeReplacement);
|
|
59803
|
+
if (other.escapeTestNoEncode.test(html)) {
|
|
59804
|
+
return html.replace(other.escapeReplaceNoEncode, getEscapeReplacement);
|
|
59633
59805
|
}
|
|
59634
59806
|
}
|
|
59635
59807
|
return html;
|
|
59636
59808
|
}
|
|
59637
|
-
const caret = /(^|[^\[])\^/g;
|
|
59638
|
-
function edit(regex, opt) {
|
|
59639
|
-
let source = typeof regex === 'string' ? regex : regex.source;
|
|
59640
|
-
opt = opt || '';
|
|
59641
|
-
const obj = {
|
|
59642
|
-
replace: (name, val) => {
|
|
59643
|
-
let valSource = typeof val === 'string' ? val : val.source;
|
|
59644
|
-
valSource = valSource.replace(caret, '$1');
|
|
59645
|
-
source = source.replace(name, valSource);
|
|
59646
|
-
return obj;
|
|
59647
|
-
},
|
|
59648
|
-
getRegex: () => {
|
|
59649
|
-
return new RegExp(source, opt);
|
|
59650
|
-
}
|
|
59651
|
-
};
|
|
59652
|
-
return obj;
|
|
59653
|
-
}
|
|
59654
59809
|
function cleanUrl(href) {
|
|
59655
59810
|
try {
|
|
59656
|
-
href = encodeURI(href).replace(
|
|
59811
|
+
href = encodeURI(href).replace(other.percentDecode, '%');
|
|
59657
59812
|
} catch {
|
|
59658
59813
|
return null;
|
|
59659
59814
|
}
|
|
59660
59815
|
return href;
|
|
59661
59816
|
}
|
|
59662
|
-
const noopTest = {
|
|
59663
|
-
exec: () => null
|
|
59664
|
-
};
|
|
59665
59817
|
function splitCells(tableRow, count) {
|
|
59666
59818
|
// ensure that every cell-delimiting pipe has a space
|
|
59667
59819
|
// before it to distinguish it from an escaped pipe
|
|
59668
|
-
const row = tableRow.replace(
|
|
59820
|
+
const row = tableRow.replace(other.findPipe, (match, offset, str) => {
|
|
59669
59821
|
let escaped = false;
|
|
59670
59822
|
let curr = offset;
|
|
59671
59823
|
while (--curr >= 0 && str[curr] === '\\') escaped = !escaped;
|
|
@@ -59678,13 +59830,13 @@
|
|
|
59678
59830
|
return ' |';
|
|
59679
59831
|
}
|
|
59680
59832
|
}),
|
|
59681
|
-
cells = row.split(
|
|
59833
|
+
cells = row.split(other.splitPipe);
|
|
59682
59834
|
let i = 0;
|
|
59683
59835
|
// First/last cell in a row cannot be empty if it has no leading/trailing pipe
|
|
59684
59836
|
if (!cells[0].trim()) {
|
|
59685
59837
|
cells.shift();
|
|
59686
59838
|
}
|
|
59687
|
-
if (cells.length > 0 && !cells
|
|
59839
|
+
if (cells.length > 0 && !cells.at(-1)?.trim()) {
|
|
59688
59840
|
cells.pop();
|
|
59689
59841
|
}
|
|
59690
59842
|
if (count) {
|
|
@@ -59696,7 +59848,7 @@
|
|
|
59696
59848
|
}
|
|
59697
59849
|
for (; i < cells.length; i++) {
|
|
59698
59850
|
// leading or trailing whitespace is ignored per the gfm spec
|
|
59699
|
-
cells[i] = cells[i].trim().replace(
|
|
59851
|
+
cells[i] = cells[i].trim().replace(other.slashPipe, '|');
|
|
59700
59852
|
}
|
|
59701
59853
|
return cells;
|
|
59702
59854
|
}
|
|
@@ -59747,10 +59899,10 @@
|
|
|
59747
59899
|
}
|
|
59748
59900
|
return -1;
|
|
59749
59901
|
}
|
|
59750
|
-
function outputLink(cap, link, raw, lexer) {
|
|
59902
|
+
function outputLink(cap, link, raw, lexer, rules) {
|
|
59751
59903
|
const href = link.href;
|
|
59752
|
-
const title = link.title
|
|
59753
|
-
const text = cap[1].replace(
|
|
59904
|
+
const title = link.title || null;
|
|
59905
|
+
const text = cap[1].replace(rules.other.outputLinkReplace, '$1');
|
|
59754
59906
|
if (cap[0].charAt(0) !== '!') {
|
|
59755
59907
|
lexer.state.inLink = true;
|
|
59756
59908
|
const token = {
|
|
@@ -59769,17 +59921,17 @@
|
|
|
59769
59921
|
raw,
|
|
59770
59922
|
href,
|
|
59771
59923
|
title,
|
|
59772
|
-
text
|
|
59924
|
+
text
|
|
59773
59925
|
};
|
|
59774
59926
|
}
|
|
59775
|
-
function indentCodeCompensation(raw, text) {
|
|
59776
|
-
const matchIndentToCode = raw.match(
|
|
59927
|
+
function indentCodeCompensation(raw, text, rules) {
|
|
59928
|
+
const matchIndentToCode = raw.match(rules.other.indentCodeCompensation);
|
|
59777
59929
|
if (matchIndentToCode === null) {
|
|
59778
59930
|
return text;
|
|
59779
59931
|
}
|
|
59780
59932
|
const indentToCode = matchIndentToCode[1];
|
|
59781
59933
|
return text.split('\n').map(node => {
|
|
59782
|
-
const matchIndentInNode = node.match(
|
|
59934
|
+
const matchIndentInNode = node.match(rules.other.beginningSpace);
|
|
59783
59935
|
if (matchIndentInNode === null) {
|
|
59784
59936
|
return node;
|
|
59785
59937
|
}
|
|
@@ -59812,7 +59964,7 @@
|
|
|
59812
59964
|
code(src) {
|
|
59813
59965
|
const cap = this.rules.block.code.exec(src);
|
|
59814
59966
|
if (cap) {
|
|
59815
|
-
const text = cap[0].replace(
|
|
59967
|
+
const text = cap[0].replace(this.rules.other.codeRemoveIndent, '');
|
|
59816
59968
|
return {
|
|
59817
59969
|
type: 'code',
|
|
59818
59970
|
raw: cap[0],
|
|
@@ -59825,7 +59977,7 @@
|
|
|
59825
59977
|
const cap = this.rules.block.fences.exec(src);
|
|
59826
59978
|
if (cap) {
|
|
59827
59979
|
const raw = cap[0];
|
|
59828
|
-
const text = indentCodeCompensation(raw, cap[3] || '');
|
|
59980
|
+
const text = indentCodeCompensation(raw, cap[3] || '', this.rules);
|
|
59829
59981
|
return {
|
|
59830
59982
|
type: 'code',
|
|
59831
59983
|
raw,
|
|
@@ -59839,11 +59991,11 @@
|
|
|
59839
59991
|
if (cap) {
|
|
59840
59992
|
let text = cap[2].trim();
|
|
59841
59993
|
// remove trailing #s
|
|
59842
|
-
if (
|
|
59994
|
+
if (this.rules.other.endingHash.test(text)) {
|
|
59843
59995
|
const trimmed = rtrim(text, '#');
|
|
59844
59996
|
if (this.options.pedantic) {
|
|
59845
59997
|
text = trimmed.trim();
|
|
59846
|
-
} else if (!trimmed ||
|
|
59998
|
+
} else if (!trimmed || this.rules.other.endingSpaceChar.test(trimmed)) {
|
|
59847
59999
|
// CommonMark requires space before trailing #s
|
|
59848
60000
|
text = trimmed.trim();
|
|
59849
60001
|
}
|
|
@@ -59879,7 +60031,7 @@
|
|
|
59879
60031
|
let i;
|
|
59880
60032
|
for (i = 0; i < lines.length; i++) {
|
|
59881
60033
|
// get lines up to a continuation
|
|
59882
|
-
if (
|
|
60034
|
+
if (this.rules.other.blockquoteStart.test(lines[i])) {
|
|
59883
60035
|
currentLines.push(lines[i]);
|
|
59884
60036
|
inBlockquote = true;
|
|
59885
60037
|
} else if (!inBlockquote) {
|
|
@@ -59892,7 +60044,7 @@
|
|
|
59892
60044
|
const currentRaw = currentLines.join('\n');
|
|
59893
60045
|
const currentText = currentRaw
|
|
59894
60046
|
// precede setext continuation with 4 spaces so it isn't a setext
|
|
59895
|
-
.replace(
|
|
60047
|
+
.replace(this.rules.other.blockquoteSetextReplace, '\n $1').replace(this.rules.other.blockquoteSetextReplace2, '');
|
|
59896
60048
|
raw = raw ? `${raw}\n${currentRaw}` : currentRaw;
|
|
59897
60049
|
text = text ? `${text}\n${currentText}` : currentText;
|
|
59898
60050
|
// parse blockquote lines as top level tokens
|
|
@@ -59905,7 +60057,7 @@
|
|
|
59905
60057
|
if (lines.length === 0) {
|
|
59906
60058
|
break;
|
|
59907
60059
|
}
|
|
59908
|
-
const lastToken = tokens
|
|
60060
|
+
const lastToken = tokens.at(-1);
|
|
59909
60061
|
if (lastToken?.type === 'code') {
|
|
59910
60062
|
// blockquote continuation cannot be preceded by a code block
|
|
59911
60063
|
break;
|
|
@@ -59926,7 +60078,7 @@
|
|
|
59926
60078
|
tokens[tokens.length - 1] = newToken;
|
|
59927
60079
|
raw = raw.substring(0, raw.length - lastToken.raw.length) + newToken.raw;
|
|
59928
60080
|
text = text.substring(0, text.length - oldToken.raw.length) + newToken.raw;
|
|
59929
|
-
lines = newText.substring(tokens
|
|
60081
|
+
lines = newText.substring(tokens.at(-1).raw.length).split('\n');
|
|
59930
60082
|
continue;
|
|
59931
60083
|
}
|
|
59932
60084
|
}
|
|
@@ -59956,7 +60108,7 @@
|
|
|
59956
60108
|
bull = isordered ? bull : '[*+-]';
|
|
59957
60109
|
}
|
|
59958
60110
|
// Get next list item
|
|
59959
|
-
const itemRegex =
|
|
60111
|
+
const itemRegex = this.rules.other.listItemRegex(bull);
|
|
59960
60112
|
let endsWithBlankLine = false;
|
|
59961
60113
|
// Check if current bullet point can start a new List Item
|
|
59962
60114
|
while (src) {
|
|
@@ -59972,7 +60124,7 @@
|
|
|
59972
60124
|
}
|
|
59973
60125
|
raw = cap[0];
|
|
59974
60126
|
src = src.substring(raw.length);
|
|
59975
|
-
let line = cap[2].split('\n', 1)[0].replace(
|
|
60127
|
+
let line = cap[2].split('\n', 1)[0].replace(this.rules.other.listReplaceTabs, t => ' '.repeat(3 * t.length));
|
|
59976
60128
|
let nextLine = src.split('\n', 1)[0];
|
|
59977
60129
|
let blankLine = !line.trim();
|
|
59978
60130
|
let indent = 0;
|
|
@@ -59982,23 +60134,23 @@
|
|
|
59982
60134
|
} else if (blankLine) {
|
|
59983
60135
|
indent = cap[1].length + 1;
|
|
59984
60136
|
} else {
|
|
59985
|
-
indent = cap[2].search(
|
|
60137
|
+
indent = cap[2].search(this.rules.other.nonSpaceChar); // Find first non-space char
|
|
59986
60138
|
indent = indent > 4 ? 1 : indent; // Treat indented code blocks (> 4 spaces) as having only 1 indent
|
|
59987
60139
|
itemContents = line.slice(indent);
|
|
59988
60140
|
indent += cap[1].length;
|
|
59989
60141
|
}
|
|
59990
|
-
if (blankLine &&
|
|
60142
|
+
if (blankLine && this.rules.other.blankLine.test(nextLine)) {
|
|
59991
60143
|
// Items begin with at most one blank line
|
|
59992
60144
|
raw += nextLine + '\n';
|
|
59993
60145
|
src = src.substring(nextLine.length + 1);
|
|
59994
60146
|
endEarly = true;
|
|
59995
60147
|
}
|
|
59996
60148
|
if (!endEarly) {
|
|
59997
|
-
const nextBulletRegex =
|
|
59998
|
-
const hrRegex =
|
|
59999
|
-
const fencesBeginRegex =
|
|
60000
|
-
const headingBeginRegex =
|
|
60001
|
-
const htmlBeginRegex =
|
|
60149
|
+
const nextBulletRegex = this.rules.other.nextBulletRegex(indent);
|
|
60150
|
+
const hrRegex = this.rules.other.hrRegex(indent);
|
|
60151
|
+
const fencesBeginRegex = this.rules.other.fencesBeginRegex(indent);
|
|
60152
|
+
const headingBeginRegex = this.rules.other.headingBeginRegex(indent);
|
|
60153
|
+
const htmlBeginRegex = this.rules.other.htmlBeginRegex(indent);
|
|
60002
60154
|
// Check if following lines should be included in List Item
|
|
60003
60155
|
while (src) {
|
|
60004
60156
|
const rawLine = src.split('\n', 1)[0];
|
|
@@ -60006,10 +60158,10 @@
|
|
|
60006
60158
|
nextLine = rawLine;
|
|
60007
60159
|
// Re-align to follow commonmark nesting rules
|
|
60008
60160
|
if (this.options.pedantic) {
|
|
60009
|
-
nextLine = nextLine.replace(
|
|
60161
|
+
nextLine = nextLine.replace(this.rules.other.listReplaceNesting, ' ');
|
|
60010
60162
|
nextLineWithoutTabs = nextLine;
|
|
60011
60163
|
} else {
|
|
60012
|
-
nextLineWithoutTabs = nextLine.replace(
|
|
60164
|
+
nextLineWithoutTabs = nextLine.replace(this.rules.other.tabCharGlobal, ' ');
|
|
60013
60165
|
}
|
|
60014
60166
|
// End list item if found code fences
|
|
60015
60167
|
if (fencesBeginRegex.test(nextLine)) {
|
|
@@ -60031,7 +60183,7 @@
|
|
|
60031
60183
|
if (hrRegex.test(nextLine)) {
|
|
60032
60184
|
break;
|
|
60033
60185
|
}
|
|
60034
|
-
if (nextLineWithoutTabs.search(
|
|
60186
|
+
if (nextLineWithoutTabs.search(this.rules.other.nonSpaceChar) >= indent || !nextLine.trim()) {
|
|
60035
60187
|
// Dedent if possible
|
|
60036
60188
|
itemContents += '\n' + nextLineWithoutTabs.slice(indent);
|
|
60037
60189
|
} else {
|
|
@@ -60040,7 +60192,7 @@
|
|
|
60040
60192
|
break;
|
|
60041
60193
|
}
|
|
60042
60194
|
// paragraph continuation unless last line was a different block level element
|
|
60043
|
-
if (line.replace(
|
|
60195
|
+
if (line.replace(this.rules.other.tabCharGlobal, ' ').search(this.rules.other.nonSpaceChar) >= 4) {
|
|
60044
60196
|
// indented code block
|
|
60045
60197
|
break;
|
|
60046
60198
|
}
|
|
@@ -60068,7 +60220,7 @@
|
|
|
60068
60220
|
// If the previous item ended with a blank line, the list is loose
|
|
60069
60221
|
if (endsWithBlankLine) {
|
|
60070
60222
|
list.loose = true;
|
|
60071
|
-
} else if (
|
|
60223
|
+
} else if (this.rules.other.doubleBlankLine.test(raw)) {
|
|
60072
60224
|
endsWithBlankLine = true;
|
|
60073
60225
|
}
|
|
60074
60226
|
}
|
|
@@ -60076,10 +60228,10 @@
|
|
|
60076
60228
|
let ischecked;
|
|
60077
60229
|
// Check for task list items
|
|
60078
60230
|
if (this.options.gfm) {
|
|
60079
|
-
istask =
|
|
60231
|
+
istask = this.rules.other.listIsTask.exec(itemContents);
|
|
60080
60232
|
if (istask) {
|
|
60081
60233
|
ischecked = istask[0] !== '[ ] ';
|
|
60082
|
-
itemContents = itemContents.replace(
|
|
60234
|
+
itemContents = itemContents.replace(this.rules.other.listReplaceTask, '');
|
|
60083
60235
|
}
|
|
60084
60236
|
}
|
|
60085
60237
|
list.items.push({
|
|
@@ -60094,8 +60246,11 @@
|
|
|
60094
60246
|
list.raw += raw;
|
|
60095
60247
|
}
|
|
60096
60248
|
// Do not consume newlines at end of final item. Alternatively, make itemRegex *start* with any newlines to simplify/speed up endsWithBlankLine logic
|
|
60097
|
-
|
|
60098
|
-
|
|
60249
|
+
const lastItem = list.items.at(-1);
|
|
60250
|
+
if (lastItem) {
|
|
60251
|
+
lastItem.raw = lastItem.raw.trimEnd();
|
|
60252
|
+
lastItem.text = lastItem.text.trimEnd();
|
|
60253
|
+
}
|
|
60099
60254
|
list.raw = list.raw.trimEnd();
|
|
60100
60255
|
// Item child tokens handled here at end because we needed to have the final item to trim it first
|
|
60101
60256
|
for (let i = 0; i < list.items.length; i++) {
|
|
@@ -60104,7 +60259,7 @@
|
|
|
60104
60259
|
if (!list.loose) {
|
|
60105
60260
|
// Check if list should be loose
|
|
60106
60261
|
const spacers = list.items[i].tokens.filter(t => t.type === 'space');
|
|
60107
|
-
const hasMultipleLineBreaks = spacers.length > 0 && spacers.some(t =>
|
|
60262
|
+
const hasMultipleLineBreaks = spacers.length > 0 && spacers.some(t => this.rules.other.anyLine.test(t.raw));
|
|
60108
60263
|
list.loose = hasMultipleLineBreaks;
|
|
60109
60264
|
}
|
|
60110
60265
|
}
|
|
@@ -60133,8 +60288,8 @@
|
|
|
60133
60288
|
def(src) {
|
|
60134
60289
|
const cap = this.rules.block.def.exec(src);
|
|
60135
60290
|
if (cap) {
|
|
60136
|
-
const tag = cap[1].toLowerCase().replace(
|
|
60137
|
-
const href = cap[2] ? cap[2].replace(
|
|
60291
|
+
const tag = cap[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal, ' ');
|
|
60292
|
+
const href = cap[2] ? cap[2].replace(this.rules.other.hrefBrackets, '$1').replace(this.rules.inline.anyPunctuation, '$1') : '';
|
|
60138
60293
|
const title = cap[3] ? cap[3].substring(1, cap[3].length - 1).replace(this.rules.inline.anyPunctuation, '$1') : cap[3];
|
|
60139
60294
|
return {
|
|
60140
60295
|
type: 'def',
|
|
@@ -60150,13 +60305,13 @@
|
|
|
60150
60305
|
if (!cap) {
|
|
60151
60306
|
return;
|
|
60152
60307
|
}
|
|
60153
|
-
if (
|
|
60308
|
+
if (!this.rules.other.tableDelimiter.test(cap[2])) {
|
|
60154
60309
|
// delimiter row must have a pipe (|) or colon (:) otherwise it is a setext heading
|
|
60155
60310
|
return;
|
|
60156
60311
|
}
|
|
60157
60312
|
const headers = splitCells(cap[1]);
|
|
60158
|
-
const aligns = cap[2].replace(
|
|
60159
|
-
const rows = cap[3]
|
|
60313
|
+
const aligns = cap[2].replace(this.rules.other.tableAlignChars, '').split('|');
|
|
60314
|
+
const rows = cap[3]?.trim() ? cap[3].replace(this.rules.other.tableRowBlankLine, '').split('\n') : [];
|
|
60160
60315
|
const item = {
|
|
60161
60316
|
type: 'table',
|
|
60162
60317
|
raw: cap[0],
|
|
@@ -60169,11 +60324,11 @@
|
|
|
60169
60324
|
return;
|
|
60170
60325
|
}
|
|
60171
60326
|
for (const align of aligns) {
|
|
60172
|
-
if (
|
|
60327
|
+
if (this.rules.other.tableAlignRight.test(align)) {
|
|
60173
60328
|
item.align.push('right');
|
|
60174
|
-
} else if (
|
|
60329
|
+
} else if (this.rules.other.tableAlignCenter.test(align)) {
|
|
60175
60330
|
item.align.push('center');
|
|
60176
|
-
} else if (
|
|
60331
|
+
} else if (this.rules.other.tableAlignLeft.test(align)) {
|
|
60177
60332
|
item.align.push('left');
|
|
60178
60333
|
} else {
|
|
60179
60334
|
item.align.push(null);
|
|
@@ -60240,21 +60395,21 @@
|
|
|
60240
60395
|
return {
|
|
60241
60396
|
type: 'escape',
|
|
60242
60397
|
raw: cap[0],
|
|
60243
|
-
text:
|
|
60398
|
+
text: cap[1]
|
|
60244
60399
|
};
|
|
60245
60400
|
}
|
|
60246
60401
|
}
|
|
60247
60402
|
tag(src) {
|
|
60248
60403
|
const cap = this.rules.inline.tag.exec(src);
|
|
60249
60404
|
if (cap) {
|
|
60250
|
-
if (!this.lexer.state.inLink &&
|
|
60405
|
+
if (!this.lexer.state.inLink && this.rules.other.startATag.test(cap[0])) {
|
|
60251
60406
|
this.lexer.state.inLink = true;
|
|
60252
|
-
} else if (this.lexer.state.inLink &&
|
|
60407
|
+
} else if (this.lexer.state.inLink && this.rules.other.endATag.test(cap[0])) {
|
|
60253
60408
|
this.lexer.state.inLink = false;
|
|
60254
60409
|
}
|
|
60255
|
-
if (!this.lexer.state.inRawBlock &&
|
|
60410
|
+
if (!this.lexer.state.inRawBlock && this.rules.other.startPreScriptTag.test(cap[0])) {
|
|
60256
60411
|
this.lexer.state.inRawBlock = true;
|
|
60257
|
-
} else if (this.lexer.state.inRawBlock &&
|
|
60412
|
+
} else if (this.lexer.state.inRawBlock && this.rules.other.endPreScriptTag.test(cap[0])) {
|
|
60258
60413
|
this.lexer.state.inRawBlock = false;
|
|
60259
60414
|
}
|
|
60260
60415
|
return {
|
|
@@ -60271,9 +60426,9 @@
|
|
|
60271
60426
|
const cap = this.rules.inline.link.exec(src);
|
|
60272
60427
|
if (cap) {
|
|
60273
60428
|
const trimmedUrl = cap[2].trim();
|
|
60274
|
-
if (!this.options.pedantic &&
|
|
60429
|
+
if (!this.options.pedantic && this.rules.other.startAngleBracket.test(trimmedUrl)) {
|
|
60275
60430
|
// commonmark requires matching angle brackets
|
|
60276
|
-
if (
|
|
60431
|
+
if (!this.rules.other.endAngleBracket.test(trimmedUrl)) {
|
|
60277
60432
|
return;
|
|
60278
60433
|
}
|
|
60279
60434
|
// ending angle bracket cannot be escaped
|
|
@@ -60296,7 +60451,7 @@
|
|
|
60296
60451
|
let title = '';
|
|
60297
60452
|
if (this.options.pedantic) {
|
|
60298
60453
|
// split pedantic href and title
|
|
60299
|
-
const link =
|
|
60454
|
+
const link = this.rules.other.pedanticHrefTitle.exec(href);
|
|
60300
60455
|
if (link) {
|
|
60301
60456
|
href = link[1];
|
|
60302
60457
|
title = link[3];
|
|
@@ -60305,8 +60460,8 @@
|
|
|
60305
60460
|
title = cap[3] ? cap[3].slice(1, -1) : '';
|
|
60306
60461
|
}
|
|
60307
60462
|
href = href.trim();
|
|
60308
|
-
if (
|
|
60309
|
-
if (this.options.pedantic &&
|
|
60463
|
+
if (this.rules.other.startAngleBracket.test(href)) {
|
|
60464
|
+
if (this.options.pedantic && !this.rules.other.endAngleBracket.test(trimmedUrl)) {
|
|
60310
60465
|
// pedantic allows starting angle bracket without ending angle bracket
|
|
60311
60466
|
href = href.slice(1);
|
|
60312
60467
|
} else {
|
|
@@ -60316,13 +60471,13 @@
|
|
|
60316
60471
|
return outputLink(cap, {
|
|
60317
60472
|
href: href ? href.replace(this.rules.inline.anyPunctuation, '$1') : href,
|
|
60318
60473
|
title: title ? title.replace(this.rules.inline.anyPunctuation, '$1') : title
|
|
60319
|
-
}, cap[0], this.lexer);
|
|
60474
|
+
}, cap[0], this.lexer, this.rules);
|
|
60320
60475
|
}
|
|
60321
60476
|
}
|
|
60322
60477
|
reflink(src, links) {
|
|
60323
60478
|
let cap;
|
|
60324
60479
|
if ((cap = this.rules.inline.reflink.exec(src)) || (cap = this.rules.inline.nolink.exec(src))) {
|
|
60325
|
-
const linkString = (cap[2] || cap[1]).replace(
|
|
60480
|
+
const linkString = (cap[2] || cap[1]).replace(this.rules.other.multipleSpaceGlobal, ' ');
|
|
60326
60481
|
const link = links[linkString.toLowerCase()];
|
|
60327
60482
|
if (!link) {
|
|
60328
60483
|
const text = cap[0].charAt(0);
|
|
@@ -60332,14 +60487,14 @@
|
|
|
60332
60487
|
text
|
|
60333
60488
|
};
|
|
60334
60489
|
}
|
|
60335
|
-
return outputLink(cap, link, cap[0], this.lexer);
|
|
60490
|
+
return outputLink(cap, link, cap[0], this.lexer, this.rules);
|
|
60336
60491
|
}
|
|
60337
60492
|
}
|
|
60338
60493
|
emStrong(src, maskedSrc, prevChar = '') {
|
|
60339
60494
|
let match = this.rules.inline.emStrongLDelim.exec(src);
|
|
60340
60495
|
if (!match) return;
|
|
60341
60496
|
// _ can't be between two alphanumerics. \p{L}\p{N} includes non-english alphabet/numbers as well
|
|
60342
|
-
if (match[3] && prevChar.match(
|
|
60497
|
+
if (match[3] && prevChar.match(this.rules.other.unicodeAlphaNumeric)) return;
|
|
60343
60498
|
const nextChar = match[1] || match[2] || '';
|
|
60344
60499
|
if (!nextChar || !prevChar || this.rules.inline.punctuation.exec(prevChar)) {
|
|
60345
60500
|
// unicode Regex counts emoji as 1 char; spread into array for proper count (used multiple times below)
|
|
@@ -60398,13 +60553,12 @@
|
|
|
60398
60553
|
codespan(src) {
|
|
60399
60554
|
const cap = this.rules.inline.code.exec(src);
|
|
60400
60555
|
if (cap) {
|
|
60401
|
-
let text = cap[2].replace(
|
|
60402
|
-
const hasNonSpaceChars =
|
|
60403
|
-
const hasSpaceCharsOnBothEnds =
|
|
60556
|
+
let text = cap[2].replace(this.rules.other.newLineCharGlobal, ' ');
|
|
60557
|
+
const hasNonSpaceChars = this.rules.other.nonSpaceChar.test(text);
|
|
60558
|
+
const hasSpaceCharsOnBothEnds = this.rules.other.startingSpaceChar.test(text) && this.rules.other.endingSpaceChar.test(text);
|
|
60404
60559
|
if (hasNonSpaceChars && hasSpaceCharsOnBothEnds) {
|
|
60405
60560
|
text = text.substring(1, text.length - 1);
|
|
60406
60561
|
}
|
|
60407
|
-
text = escape$1(text, true);
|
|
60408
60562
|
return {
|
|
60409
60563
|
type: 'codespan',
|
|
60410
60564
|
raw: cap[0],
|
|
@@ -60437,10 +60591,10 @@
|
|
|
60437
60591
|
if (cap) {
|
|
60438
60592
|
let text, href;
|
|
60439
60593
|
if (cap[2] === '@') {
|
|
60440
|
-
text =
|
|
60594
|
+
text = cap[1];
|
|
60441
60595
|
href = 'mailto:' + text;
|
|
60442
60596
|
} else {
|
|
60443
|
-
text =
|
|
60597
|
+
text = cap[1];
|
|
60444
60598
|
href = text;
|
|
60445
60599
|
}
|
|
60446
60600
|
return {
|
|
@@ -60461,7 +60615,7 @@
|
|
|
60461
60615
|
if (cap = this.rules.inline.url.exec(src)) {
|
|
60462
60616
|
let text, href;
|
|
60463
60617
|
if (cap[2] === '@') {
|
|
60464
|
-
text =
|
|
60618
|
+
text = cap[0];
|
|
60465
60619
|
href = 'mailto:' + text;
|
|
60466
60620
|
} else {
|
|
60467
60621
|
// do extended autolink path validation
|
|
@@ -60470,7 +60624,7 @@
|
|
|
60470
60624
|
prevCapZero = cap[0];
|
|
60471
60625
|
cap[0] = this.rules.inline._backpedal.exec(cap[0])?.[0] ?? '';
|
|
60472
60626
|
} while (prevCapZero !== cap[0]);
|
|
60473
|
-
text =
|
|
60627
|
+
text = cap[0];
|
|
60474
60628
|
if (cap[1] === 'www.') {
|
|
60475
60629
|
href = 'http://' + cap[0];
|
|
60476
60630
|
} else {
|
|
@@ -60493,221 +60647,17 @@
|
|
|
60493
60647
|
inlineText(src) {
|
|
60494
60648
|
const cap = this.rules.inline.text.exec(src);
|
|
60495
60649
|
if (cap) {
|
|
60496
|
-
|
|
60497
|
-
if (this.lexer.state.inRawBlock) {
|
|
60498
|
-
text = cap[0];
|
|
60499
|
-
} else {
|
|
60500
|
-
text = escape$1(cap[0]);
|
|
60501
|
-
}
|
|
60650
|
+
const escaped = this.lexer.state.inRawBlock;
|
|
60502
60651
|
return {
|
|
60503
60652
|
type: 'text',
|
|
60504
60653
|
raw: cap[0],
|
|
60505
|
-
text
|
|
60654
|
+
text: cap[0],
|
|
60655
|
+
escaped
|
|
60506
60656
|
};
|
|
60507
60657
|
}
|
|
60508
60658
|
}
|
|
60509
60659
|
}
|
|
60510
60660
|
|
|
60511
|
-
/**
|
|
60512
|
-
* Block-Level Grammar
|
|
60513
|
-
*/
|
|
60514
|
-
const newline = /^(?:[ \t]*(?:\n|$))+/;
|
|
60515
|
-
const blockCode = /^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/;
|
|
60516
|
-
const fences = /^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/;
|
|
60517
|
-
const hr = /^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/;
|
|
60518
|
-
const heading = /^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/;
|
|
60519
|
-
const bullet = /(?:[*+-]|\d{1,9}[.)])/;
|
|
60520
|
-
const lheading = edit(/^(?!bull |blockCode|fences|blockquote|heading|html)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html))+?)\n {0,3}(=+|-+) *(?:\n+|$)/).replace(/bull/g, bullet) // lists can interrupt
|
|
60521
|
-
.replace(/blockCode/g, /(?: {4}| {0,3}\t)/) // indented code blocks can interrupt
|
|
60522
|
-
.replace(/fences/g, / {0,3}(?:`{3,}|~{3,})/) // fenced code blocks can interrupt
|
|
60523
|
-
.replace(/blockquote/g, / {0,3}>/) // blockquote can interrupt
|
|
60524
|
-
.replace(/heading/g, / {0,3}#{1,6}/) // ATX heading can interrupt
|
|
60525
|
-
.replace(/html/g, / {0,3}<[^\n>]+>\n/) // block html can interrupt
|
|
60526
|
-
.getRegex();
|
|
60527
|
-
const _paragraph = /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/;
|
|
60528
|
-
const blockText = /^[^\n]+/;
|
|
60529
|
-
const _blockLabel = /(?!\s*\])(?:\\.|[^\[\]\\])+/;
|
|
60530
|
-
const def = edit(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace('label', _blockLabel).replace('title', /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex();
|
|
60531
|
-
const list = edit(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g, bullet).getRegex();
|
|
60532
|
-
const _tag = 'address|article|aside|base|basefont|blockquote|body|caption' + '|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption' + '|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe' + '|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option' + '|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title' + '|tr|track|ul';
|
|
60533
|
-
const _comment = /<!--(?:-?>|[\s\S]*?(?:-->|$))/;
|
|
60534
|
-
const html = edit('^ {0,3}(?:' // optional indentation
|
|
60535
|
-
+ '<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)' // (1)
|
|
60536
|
-
+ '|comment[^\\n]*(\\n+|$)' // (2)
|
|
60537
|
-
+ '|<\\?[\\s\\S]*?(?:\\?>\\n*|$)' // (3)
|
|
60538
|
-
+ '|<![A-Z][\\s\\S]*?(?:>\\n*|$)' // (4)
|
|
60539
|
-
+ '|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)' // (5)
|
|
60540
|
-
+ '|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ \t]*)+\\n|$)' // (6)
|
|
60541
|
-
+ '|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ \t]*)+\\n|$)' // (7) open tag
|
|
60542
|
-
+ '|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ \t]*)+\\n|$)' // (7) closing tag
|
|
60543
|
-
+ ')', 'i').replace('comment', _comment).replace('tag', _tag).replace('attribute', / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex();
|
|
60544
|
-
const paragraph = edit(_paragraph).replace('hr', hr).replace('heading', ' {0,3}#{1,6}(?:\\s|$)').replace('|lheading', '') // setext headings don't interrupt commonmark paragraphs
|
|
60545
|
-
.replace('|table', '').replace('blockquote', ' {0,3}>').replace('fences', ' {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n').replace('list', ' {0,3}(?:[*+-]|1[.)]) ') // only lists starting from 1 can interrupt
|
|
60546
|
-
.replace('html', '</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)').replace('tag', _tag) // pars can be interrupted by type (6) html blocks
|
|
60547
|
-
.getRegex();
|
|
60548
|
-
const blockquote = edit(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace('paragraph', paragraph).getRegex();
|
|
60549
|
-
/**
|
|
60550
|
-
* Normal Block Grammar
|
|
60551
|
-
*/
|
|
60552
|
-
const blockNormal = {
|
|
60553
|
-
blockquote,
|
|
60554
|
-
code: blockCode,
|
|
60555
|
-
def,
|
|
60556
|
-
fences,
|
|
60557
|
-
heading,
|
|
60558
|
-
hr,
|
|
60559
|
-
html,
|
|
60560
|
-
lheading,
|
|
60561
|
-
list,
|
|
60562
|
-
newline,
|
|
60563
|
-
paragraph,
|
|
60564
|
-
table: noopTest,
|
|
60565
|
-
text: blockText
|
|
60566
|
-
};
|
|
60567
|
-
/**
|
|
60568
|
-
* GFM Block Grammar
|
|
60569
|
-
*/
|
|
60570
|
-
const gfmTable = edit('^ *([^\\n ].*)\\n' // Header
|
|
60571
|
-
+ ' {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)' // Align
|
|
60572
|
-
+ '(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)') // Cells
|
|
60573
|
-
.replace('hr', hr).replace('heading', ' {0,3}#{1,6}(?:\\s|$)').replace('blockquote', ' {0,3}>').replace('code', '(?: {4}| {0,3}\t)[^\\n]').replace('fences', ' {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n').replace('list', ' {0,3}(?:[*+-]|1[.)]) ') // only lists starting from 1 can interrupt
|
|
60574
|
-
.replace('html', '</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)').replace('tag', _tag) // tables can be interrupted by type (6) html blocks
|
|
60575
|
-
.getRegex();
|
|
60576
|
-
const blockGfm = {
|
|
60577
|
-
...blockNormal,
|
|
60578
|
-
table: gfmTable,
|
|
60579
|
-
paragraph: edit(_paragraph).replace('hr', hr).replace('heading', ' {0,3}#{1,6}(?:\\s|$)').replace('|lheading', '') // setext headings don't interrupt commonmark paragraphs
|
|
60580
|
-
.replace('table', gfmTable) // interrupt paragraphs with table
|
|
60581
|
-
.replace('blockquote', ' {0,3}>').replace('fences', ' {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n').replace('list', ' {0,3}(?:[*+-]|1[.)]) ') // only lists starting from 1 can interrupt
|
|
60582
|
-
.replace('html', '</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)').replace('tag', _tag) // pars can be interrupted by type (6) html blocks
|
|
60583
|
-
.getRegex()
|
|
60584
|
-
};
|
|
60585
|
-
/**
|
|
60586
|
-
* Pedantic grammar (original John Gruber's loose markdown specification)
|
|
60587
|
-
*/
|
|
60588
|
-
const blockPedantic = {
|
|
60589
|
-
...blockNormal,
|
|
60590
|
-
html: edit('^ *(?:comment *(?:\\n|\\s*$)' + '|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)' // closed tag
|
|
60591
|
-
+ '|<tag(?:"[^"]*"|\'[^\']*\'|\\s[^\'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))').replace('comment', _comment).replace(/tag/g, '(?!(?:' + 'a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub' + '|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)' + '\\b)\\w+(?!:|[^\\w\\s@]*@)\\b').getRegex(),
|
|
60592
|
-
def: /^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,
|
|
60593
|
-
heading: /^(#{1,6})(.*)(?:\n+|$)/,
|
|
60594
|
-
fences: noopTest,
|
|
60595
|
-
// fences not supported
|
|
60596
|
-
lheading: /^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,
|
|
60597
|
-
paragraph: edit(_paragraph).replace('hr', hr).replace('heading', ' *#{1,6} *[^\n]').replace('lheading', lheading).replace('|table', '').replace('blockquote', ' {0,3}>').replace('|fences', '').replace('|list', '').replace('|html', '').replace('|tag', '').getRegex()
|
|
60598
|
-
};
|
|
60599
|
-
/**
|
|
60600
|
-
* Inline-Level Grammar
|
|
60601
|
-
*/
|
|
60602
|
-
const escape = /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/;
|
|
60603
|
-
const inlineCode = /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/;
|
|
60604
|
-
const br = /^( {2,}|\\)\n(?!\s*$)/;
|
|
60605
|
-
const inlineText = /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/;
|
|
60606
|
-
// list of unicode punctuation marks, plus any missing characters from CommonMark spec
|
|
60607
|
-
const _punctuation = '\\p{P}\\p{S}';
|
|
60608
|
-
const punctuation = edit(/^((?![*_])[\spunctuation])/, 'u').replace(/punctuation/g, _punctuation).getRegex();
|
|
60609
|
-
// sequences em should skip over [title](link), `code`, <html>
|
|
60610
|
-
const blockSkip = /\[[^[\]]*?\]\([^\(\)]*?\)|`[^`]*?`|<[^<>]*?>/g;
|
|
60611
|
-
const emStrongLDelim = edit(/^(?:\*+(?:((?!\*)[punct])|[^\s*]))|^_+(?:((?!_)[punct])|([^\s_]))/, 'u').replace(/punct/g, _punctuation).getRegex();
|
|
60612
|
-
const emStrongRDelimAst = edit('^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)' // Skip orphan inside strong
|
|
60613
|
-
+ '|[^*]+(?=[^*])' // Consume to delim
|
|
60614
|
-
+ '|(?!\\*)[punct](\\*+)(?=[\\s]|$)' // (1) #*** can only be a Right Delimiter
|
|
60615
|
-
+ '|[^punct\\s](\\*+)(?!\\*)(?=[punct\\s]|$)' // (2) a***#, a*** can only be a Right Delimiter
|
|
60616
|
-
+ '|(?!\\*)[punct\\s](\\*+)(?=[^punct\\s])' // (3) #***a, ***a can only be Left Delimiter
|
|
60617
|
-
+ '|[\\s](\\*+)(?!\\*)(?=[punct])' // (4) ***# can only be Left Delimiter
|
|
60618
|
-
+ '|(?!\\*)[punct](\\*+)(?!\\*)(?=[punct])' // (5) #***# can be either Left or Right Delimiter
|
|
60619
|
-
+ '|[^punct\\s](\\*+)(?=[^punct\\s])', 'gu') // (6) a***a can be either Left or Right Delimiter
|
|
60620
|
-
.replace(/punct/g, _punctuation).getRegex();
|
|
60621
|
-
// (6) Not allowed for _
|
|
60622
|
-
const emStrongRDelimUnd = edit('^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)' // Skip orphan inside strong
|
|
60623
|
-
+ '|[^_]+(?=[^_])' // Consume to delim
|
|
60624
|
-
+ '|(?!_)[punct](_+)(?=[\\s]|$)' // (1) #___ can only be a Right Delimiter
|
|
60625
|
-
+ '|[^punct\\s](_+)(?!_)(?=[punct\\s]|$)' // (2) a___#, a___ can only be a Right Delimiter
|
|
60626
|
-
+ '|(?!_)[punct\\s](_+)(?=[^punct\\s])' // (3) #___a, ___a can only be Left Delimiter
|
|
60627
|
-
+ '|[\\s](_+)(?!_)(?=[punct])' // (4) ___# can only be Left Delimiter
|
|
60628
|
-
+ '|(?!_)[punct](_+)(?!_)(?=[punct])', 'gu') // (5) #___# can be either Left or Right Delimiter
|
|
60629
|
-
.replace(/punct/g, _punctuation).getRegex();
|
|
60630
|
-
const anyPunctuation = edit(/\\([punct])/, 'gu').replace(/punct/g, _punctuation).getRegex();
|
|
60631
|
-
const autolink = edit(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace('scheme', /[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace('email', /[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex();
|
|
60632
|
-
const _inlineComment = edit(_comment).replace('(?:-->|$)', '-->').getRegex();
|
|
60633
|
-
const tag = edit('^comment' + '|^</[a-zA-Z][\\w:-]*\\s*>' // self-closing tag
|
|
60634
|
-
+ '|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>' // open tag
|
|
60635
|
-
+ '|^<\\?[\\s\\S]*?\\?>' // processing instruction, e.g. <?php ?>
|
|
60636
|
-
+ '|^<![a-zA-Z]+\\s[\\s\\S]*?>' // declaration, e.g. <!DOCTYPE html>
|
|
60637
|
-
+ '|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>') // CDATA section
|
|
60638
|
-
.replace('comment', _inlineComment).replace('attribute', /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex();
|
|
60639
|
-
const _inlineLabel = /(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/;
|
|
60640
|
-
const link = edit(/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/).replace('label', _inlineLabel).replace('href', /<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/).replace('title', /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex();
|
|
60641
|
-
const reflink = edit(/^!?\[(label)\]\[(ref)\]/).replace('label', _inlineLabel).replace('ref', _blockLabel).getRegex();
|
|
60642
|
-
const nolink = edit(/^!?\[(ref)\](?:\[\])?/).replace('ref', _blockLabel).getRegex();
|
|
60643
|
-
const reflinkSearch = edit('reflink|nolink(?!\\()', 'g').replace('reflink', reflink).replace('nolink', nolink).getRegex();
|
|
60644
|
-
/**
|
|
60645
|
-
* Normal Inline Grammar
|
|
60646
|
-
*/
|
|
60647
|
-
const inlineNormal = {
|
|
60648
|
-
_backpedal: noopTest,
|
|
60649
|
-
// only used for GFM url
|
|
60650
|
-
anyPunctuation,
|
|
60651
|
-
autolink,
|
|
60652
|
-
blockSkip,
|
|
60653
|
-
br,
|
|
60654
|
-
code: inlineCode,
|
|
60655
|
-
del: noopTest,
|
|
60656
|
-
emStrongLDelim,
|
|
60657
|
-
emStrongRDelimAst,
|
|
60658
|
-
emStrongRDelimUnd,
|
|
60659
|
-
escape,
|
|
60660
|
-
link,
|
|
60661
|
-
nolink,
|
|
60662
|
-
punctuation,
|
|
60663
|
-
reflink,
|
|
60664
|
-
reflinkSearch,
|
|
60665
|
-
tag,
|
|
60666
|
-
text: inlineText,
|
|
60667
|
-
url: noopTest
|
|
60668
|
-
};
|
|
60669
|
-
/**
|
|
60670
|
-
* Pedantic Inline Grammar
|
|
60671
|
-
*/
|
|
60672
|
-
const inlinePedantic = {
|
|
60673
|
-
...inlineNormal,
|
|
60674
|
-
link: edit(/^!?\[(label)\]\((.*?)\)/).replace('label', _inlineLabel).getRegex(),
|
|
60675
|
-
reflink: edit(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace('label', _inlineLabel).getRegex()
|
|
60676
|
-
};
|
|
60677
|
-
/**
|
|
60678
|
-
* GFM Inline Grammar
|
|
60679
|
-
*/
|
|
60680
|
-
const inlineGfm = {
|
|
60681
|
-
...inlineNormal,
|
|
60682
|
-
escape: edit(escape).replace('])', '~|])').getRegex(),
|
|
60683
|
-
url: edit(/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/, 'i').replace('email', /[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),
|
|
60684
|
-
_backpedal: /(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,
|
|
60685
|
-
del: /^(~~?)(?=[^\s~])([\s\S]*?[^\s~])\1(?=[^~]|$)/,
|
|
60686
|
-
text: /^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/
|
|
60687
|
-
};
|
|
60688
|
-
/**
|
|
60689
|
-
* GFM + Line Breaks Inline Grammar
|
|
60690
|
-
*/
|
|
60691
|
-
const inlineBreaks = {
|
|
60692
|
-
...inlineGfm,
|
|
60693
|
-
br: edit(br).replace('{2,}', '*').getRegex(),
|
|
60694
|
-
text: edit(inlineGfm.text).replace('\\b_', '\\b_| {2,}\\n').replace(/\{2,\}/g, '*').getRegex()
|
|
60695
|
-
};
|
|
60696
|
-
/**
|
|
60697
|
-
* exports
|
|
60698
|
-
*/
|
|
60699
|
-
const block = {
|
|
60700
|
-
normal: blockNormal,
|
|
60701
|
-
gfm: blockGfm,
|
|
60702
|
-
pedantic: blockPedantic
|
|
60703
|
-
};
|
|
60704
|
-
const inline = {
|
|
60705
|
-
normal: inlineNormal,
|
|
60706
|
-
gfm: inlineGfm,
|
|
60707
|
-
breaks: inlineBreaks,
|
|
60708
|
-
pedantic: inlinePedantic
|
|
60709
|
-
};
|
|
60710
|
-
|
|
60711
60661
|
/**
|
|
60712
60662
|
* Block Lexer
|
|
60713
60663
|
*/
|
|
@@ -60733,6 +60683,7 @@
|
|
|
60733
60683
|
top: true
|
|
60734
60684
|
};
|
|
60735
60685
|
const rules = {
|
|
60686
|
+
other,
|
|
60736
60687
|
block: block.normal,
|
|
60737
60688
|
inline: inline.normal
|
|
60738
60689
|
};
|
|
@@ -60776,7 +60727,7 @@
|
|
|
60776
60727
|
* Preprocessing
|
|
60777
60728
|
*/
|
|
60778
60729
|
lex(src) {
|
|
60779
|
-
src = src.replace(
|
|
60730
|
+
src = src.replace(other.carriageReturn, '\n');
|
|
60780
60731
|
this.blockTokens(src, this.tokens);
|
|
60781
60732
|
for (let i = 0; i < this.inlineQueue.length; i++) {
|
|
60782
60733
|
const next = this.inlineQueue[i];
|
|
@@ -60787,13 +60738,11 @@
|
|
|
60787
60738
|
}
|
|
60788
60739
|
blockTokens(src, tokens = [], lastParagraphClipped = false) {
|
|
60789
60740
|
if (this.options.pedantic) {
|
|
60790
|
-
src = src.replace(
|
|
60741
|
+
src = src.replace(other.tabCharGlobal, ' ').replace(other.spaceLine, '');
|
|
60791
60742
|
}
|
|
60792
|
-
let token;
|
|
60793
|
-
let lastToken;
|
|
60794
|
-
let cutSrc;
|
|
60795
60743
|
while (src) {
|
|
60796
|
-
|
|
60744
|
+
let token;
|
|
60745
|
+
if (this.options.extensions?.block?.some(extTokenizer => {
|
|
60797
60746
|
if (token = extTokenizer.call({
|
|
60798
60747
|
lexer: this
|
|
60799
60748
|
}, src, tokens)) {
|
|
@@ -60808,10 +60757,11 @@
|
|
|
60808
60757
|
// newline
|
|
60809
60758
|
if (token = this.tokenizer.space(src)) {
|
|
60810
60759
|
src = src.substring(token.raw.length);
|
|
60811
|
-
|
|
60760
|
+
const lastToken = tokens.at(-1);
|
|
60761
|
+
if (token.raw.length === 1 && lastToken !== undefined) {
|
|
60812
60762
|
// if there's a single \n as a spacer, it's terminating the last line,
|
|
60813
60763
|
// so move it there so that we don't get unnecessary paragraph tags
|
|
60814
|
-
|
|
60764
|
+
lastToken.raw += '\n';
|
|
60815
60765
|
} else {
|
|
60816
60766
|
tokens.push(token);
|
|
60817
60767
|
}
|
|
@@ -60820,12 +60770,12 @@
|
|
|
60820
60770
|
// code
|
|
60821
60771
|
if (token = this.tokenizer.code(src)) {
|
|
60822
60772
|
src = src.substring(token.raw.length);
|
|
60823
|
-
lastToken = tokens
|
|
60773
|
+
const lastToken = tokens.at(-1);
|
|
60824
60774
|
// An indented code block cannot interrupt a paragraph.
|
|
60825
|
-
if (lastToken
|
|
60775
|
+
if (lastToken?.type === 'paragraph' || lastToken?.type === 'text') {
|
|
60826
60776
|
lastToken.raw += '\n' + token.raw;
|
|
60827
60777
|
lastToken.text += '\n' + token.text;
|
|
60828
|
-
this.inlineQueue
|
|
60778
|
+
this.inlineQueue.at(-1).src = lastToken.text;
|
|
60829
60779
|
} else {
|
|
60830
60780
|
tokens.push(token);
|
|
60831
60781
|
}
|
|
@@ -60870,11 +60820,11 @@
|
|
|
60870
60820
|
// def
|
|
60871
60821
|
if (token = this.tokenizer.def(src)) {
|
|
60872
60822
|
src = src.substring(token.raw.length);
|
|
60873
|
-
lastToken = tokens
|
|
60874
|
-
if (lastToken
|
|
60823
|
+
const lastToken = tokens.at(-1);
|
|
60824
|
+
if (lastToken?.type === 'paragraph' || lastToken?.type === 'text') {
|
|
60875
60825
|
lastToken.raw += '\n' + token.raw;
|
|
60876
60826
|
lastToken.text += '\n' + token.raw;
|
|
60877
|
-
this.inlineQueue
|
|
60827
|
+
this.inlineQueue.at(-1).src = lastToken.text;
|
|
60878
60828
|
} else if (!this.tokens.links[token.tag]) {
|
|
60879
60829
|
this.tokens.links[token.tag] = {
|
|
60880
60830
|
href: token.href,
|
|
@@ -60897,8 +60847,8 @@
|
|
|
60897
60847
|
}
|
|
60898
60848
|
// top-level paragraph
|
|
60899
60849
|
// prevent paragraph consuming extensions by clipping 'src' to extension start
|
|
60900
|
-
cutSrc = src;
|
|
60901
|
-
if (this.options.extensions
|
|
60850
|
+
let cutSrc = src;
|
|
60851
|
+
if (this.options.extensions?.startBlock) {
|
|
60902
60852
|
let startIndex = Infinity;
|
|
60903
60853
|
const tempSrc = src.slice(1);
|
|
60904
60854
|
let tempStart;
|
|
@@ -60915,12 +60865,12 @@
|
|
|
60915
60865
|
}
|
|
60916
60866
|
}
|
|
60917
60867
|
if (this.state.top && (token = this.tokenizer.paragraph(cutSrc))) {
|
|
60918
|
-
lastToken = tokens
|
|
60868
|
+
const lastToken = tokens.at(-1);
|
|
60919
60869
|
if (lastParagraphClipped && lastToken?.type === 'paragraph') {
|
|
60920
60870
|
lastToken.raw += '\n' + token.raw;
|
|
60921
60871
|
lastToken.text += '\n' + token.text;
|
|
60922
60872
|
this.inlineQueue.pop();
|
|
60923
|
-
this.inlineQueue
|
|
60873
|
+
this.inlineQueue.at(-1).src = lastToken.text;
|
|
60924
60874
|
} else {
|
|
60925
60875
|
tokens.push(token);
|
|
60926
60876
|
}
|
|
@@ -60931,12 +60881,12 @@
|
|
|
60931
60881
|
// text
|
|
60932
60882
|
if (token = this.tokenizer.text(src)) {
|
|
60933
60883
|
src = src.substring(token.raw.length);
|
|
60934
|
-
lastToken = tokens
|
|
60935
|
-
if (lastToken
|
|
60884
|
+
const lastToken = tokens.at(-1);
|
|
60885
|
+
if (lastToken?.type === 'text') {
|
|
60936
60886
|
lastToken.raw += '\n' + token.raw;
|
|
60937
60887
|
lastToken.text += '\n' + token.text;
|
|
60938
60888
|
this.inlineQueue.pop();
|
|
60939
|
-
this.inlineQueue
|
|
60889
|
+
this.inlineQueue.at(-1).src = lastToken.text;
|
|
60940
60890
|
} else {
|
|
60941
60891
|
tokens.push(token);
|
|
60942
60892
|
}
|
|
@@ -60966,11 +60916,9 @@
|
|
|
60966
60916
|
* Lexing/Compiling
|
|
60967
60917
|
*/
|
|
60968
60918
|
inlineTokens(src, tokens = []) {
|
|
60969
|
-
let token, lastToken, cutSrc;
|
|
60970
60919
|
// String with links masked to avoid interference with em and strong
|
|
60971
60920
|
let maskedSrc = src;
|
|
60972
|
-
let match;
|
|
60973
|
-
let keepPrevChar, prevChar;
|
|
60921
|
+
let match = null;
|
|
60974
60922
|
// Mask out reflinks
|
|
60975
60923
|
if (this.tokens.links) {
|
|
60976
60924
|
const links = Object.keys(this.tokens.links);
|
|
@@ -60990,13 +60938,16 @@
|
|
|
60990
60938
|
while ((match = this.tokenizer.rules.inline.anyPunctuation.exec(maskedSrc)) != null) {
|
|
60991
60939
|
maskedSrc = maskedSrc.slice(0, match.index) + '++' + maskedSrc.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);
|
|
60992
60940
|
}
|
|
60941
|
+
let keepPrevChar = false;
|
|
60942
|
+
let prevChar = '';
|
|
60993
60943
|
while (src) {
|
|
60994
60944
|
if (!keepPrevChar) {
|
|
60995
60945
|
prevChar = '';
|
|
60996
60946
|
}
|
|
60997
60947
|
keepPrevChar = false;
|
|
60948
|
+
let token;
|
|
60998
60949
|
// extensions
|
|
60999
|
-
if (this.options.extensions
|
|
60950
|
+
if (this.options.extensions?.inline?.some(extTokenizer => {
|
|
61000
60951
|
if (token = extTokenizer.call({
|
|
61001
60952
|
lexer: this
|
|
61002
60953
|
}, src, tokens)) {
|
|
@@ -61017,13 +60968,7 @@
|
|
|
61017
60968
|
// tag
|
|
61018
60969
|
if (token = this.tokenizer.tag(src)) {
|
|
61019
60970
|
src = src.substring(token.raw.length);
|
|
61020
|
-
|
|
61021
|
-
if (lastToken && token.type === 'text' && lastToken.type === 'text') {
|
|
61022
|
-
lastToken.raw += token.raw;
|
|
61023
|
-
lastToken.text += token.text;
|
|
61024
|
-
} else {
|
|
61025
|
-
tokens.push(token);
|
|
61026
|
-
}
|
|
60971
|
+
tokens.push(token);
|
|
61027
60972
|
continue;
|
|
61028
60973
|
}
|
|
61029
60974
|
// link
|
|
@@ -61035,8 +60980,8 @@
|
|
|
61035
60980
|
// reflink, nolink
|
|
61036
60981
|
if (token = this.tokenizer.reflink(src, this.tokens.links)) {
|
|
61037
60982
|
src = src.substring(token.raw.length);
|
|
61038
|
-
lastToken = tokens
|
|
61039
|
-
if (
|
|
60983
|
+
const lastToken = tokens.at(-1);
|
|
60984
|
+
if (token.type === 'text' && lastToken?.type === 'text') {
|
|
61040
60985
|
lastToken.raw += token.raw;
|
|
61041
60986
|
lastToken.text += token.text;
|
|
61042
60987
|
} else {
|
|
@@ -61082,8 +61027,8 @@
|
|
|
61082
61027
|
}
|
|
61083
61028
|
// text
|
|
61084
61029
|
// prevent inlineText consuming extensions by clipping 'src' to extension start
|
|
61085
|
-
cutSrc = src;
|
|
61086
|
-
if (this.options.extensions
|
|
61030
|
+
let cutSrc = src;
|
|
61031
|
+
if (this.options.extensions?.startInline) {
|
|
61087
61032
|
let startIndex = Infinity;
|
|
61088
61033
|
const tempSrc = src.slice(1);
|
|
61089
61034
|
let tempStart;
|
|
@@ -61106,8 +61051,8 @@
|
|
|
61106
61051
|
prevChar = token.raw.slice(-1);
|
|
61107
61052
|
}
|
|
61108
61053
|
keepPrevChar = true;
|
|
61109
|
-
lastToken = tokens
|
|
61110
|
-
if (lastToken
|
|
61054
|
+
const lastToken = tokens.at(-1);
|
|
61055
|
+
if (lastToken?.type === 'text') {
|
|
61111
61056
|
lastToken.raw += token.raw;
|
|
61112
61057
|
lastToken.text += token.text;
|
|
61113
61058
|
} else {
|
|
@@ -61146,12 +61091,12 @@
|
|
|
61146
61091
|
lang,
|
|
61147
61092
|
escaped
|
|
61148
61093
|
}) {
|
|
61149
|
-
const langString = (lang || '').match(
|
|
61150
|
-
const code = text.replace(
|
|
61094
|
+
const langString = (lang || '').match(other.notSpaceStart)?.[0];
|
|
61095
|
+
const code = text.replace(other.endingNewline, '') + '\n';
|
|
61151
61096
|
if (!langString) {
|
|
61152
|
-
return '<pre><code>' + (escaped ? code : escape
|
|
61097
|
+
return '<pre><code>' + (escaped ? code : escape(code, true)) + '</code></pre>\n';
|
|
61153
61098
|
}
|
|
61154
|
-
return '<pre><code class="language-' + escape
|
|
61099
|
+
return '<pre><code class="language-' + escape(langString) + '">' + (escaped ? code : escape(code, true)) + '</code></pre>\n';
|
|
61155
61100
|
}
|
|
61156
61101
|
blockquote({
|
|
61157
61102
|
tokens
|
|
@@ -61192,16 +61137,18 @@
|
|
|
61192
61137
|
checked: !!item.checked
|
|
61193
61138
|
});
|
|
61194
61139
|
if (item.loose) {
|
|
61195
|
-
if (item.tokens
|
|
61140
|
+
if (item.tokens[0]?.type === 'paragraph') {
|
|
61196
61141
|
item.tokens[0].text = checkbox + ' ' + item.tokens[0].text;
|
|
61197
61142
|
if (item.tokens[0].tokens && item.tokens[0].tokens.length > 0 && item.tokens[0].tokens[0].type === 'text') {
|
|
61198
|
-
item.tokens[0].tokens[0].text = checkbox + ' ' + item.tokens[0].tokens[0].text;
|
|
61143
|
+
item.tokens[0].tokens[0].text = checkbox + ' ' + escape(item.tokens[0].tokens[0].text);
|
|
61144
|
+
item.tokens[0].tokens[0].escaped = true;
|
|
61199
61145
|
}
|
|
61200
61146
|
} else {
|
|
61201
61147
|
item.tokens.unshift({
|
|
61202
61148
|
type: 'text',
|
|
61203
61149
|
raw: checkbox + ' ',
|
|
61204
|
-
text: checkbox + ' '
|
|
61150
|
+
text: checkbox + ' ',
|
|
61151
|
+
escaped: true
|
|
61205
61152
|
});
|
|
61206
61153
|
}
|
|
61207
61154
|
} else {
|
|
@@ -61272,7 +61219,7 @@
|
|
|
61272
61219
|
codespan({
|
|
61273
61220
|
text
|
|
61274
61221
|
}) {
|
|
61275
|
-
return `<code>${text}</code>`;
|
|
61222
|
+
return `<code>${escape(text, true)}</code>`;
|
|
61276
61223
|
}
|
|
61277
61224
|
br(token) {
|
|
61278
61225
|
return '<br>';
|
|
@@ -61295,7 +61242,7 @@
|
|
|
61295
61242
|
href = cleanHref;
|
|
61296
61243
|
let out = '<a href="' + href + '"';
|
|
61297
61244
|
if (title) {
|
|
61298
|
-
out += ' title="' + title + '"';
|
|
61245
|
+
out += ' title="' + escape(title) + '"';
|
|
61299
61246
|
}
|
|
61300
61247
|
out += '>' + text + '</a>';
|
|
61301
61248
|
return out;
|
|
@@ -61307,18 +61254,18 @@
|
|
|
61307
61254
|
}) {
|
|
61308
61255
|
const cleanHref = cleanUrl(href);
|
|
61309
61256
|
if (cleanHref === null) {
|
|
61310
|
-
return text;
|
|
61257
|
+
return escape(text);
|
|
61311
61258
|
}
|
|
61312
61259
|
href = cleanHref;
|
|
61313
61260
|
let out = `<img src="${href}" alt="${text}"`;
|
|
61314
61261
|
if (title) {
|
|
61315
|
-
out += ` title="${title}"`;
|
|
61262
|
+
out += ` title="${escape(title)}"`;
|
|
61316
61263
|
}
|
|
61317
61264
|
out += '>';
|
|
61318
61265
|
return out;
|
|
61319
61266
|
}
|
|
61320
61267
|
text(token) {
|
|
61321
|
-
return 'tokens' in token && token.tokens ? this.parser.parseInline(token.tokens) : token.text;
|
|
61268
|
+
return 'tokens' in token && token.tokens ? this.parser.parseInline(token.tokens) : 'escaped' in token && token.escaped ? token.text : escape(token.text);
|
|
61322
61269
|
}
|
|
61323
61270
|
}
|
|
61324
61271
|
|
|
@@ -61410,7 +61357,7 @@
|
|
|
61410
61357
|
for (let i = 0; i < tokens.length; i++) {
|
|
61411
61358
|
const anyToken = tokens[i];
|
|
61412
61359
|
// Run any renderer extensions
|
|
61413
|
-
if (this.options.extensions
|
|
61360
|
+
if (this.options.extensions?.renderers?.[anyToken.type]) {
|
|
61414
61361
|
const genericToken = anyToken;
|
|
61415
61362
|
const ret = this.options.extensions.renderers[genericToken.type].call({
|
|
61416
61363
|
parser: this
|
|
@@ -61483,7 +61430,8 @@
|
|
|
61483
61430
|
tokens: [{
|
|
61484
61431
|
type: 'text',
|
|
61485
61432
|
raw: body,
|
|
61486
|
-
text: body
|
|
61433
|
+
text: body,
|
|
61434
|
+
escaped: true
|
|
61487
61435
|
}]
|
|
61488
61436
|
});
|
|
61489
61437
|
} else {
|
|
@@ -61508,13 +61456,12 @@
|
|
|
61508
61456
|
/**
|
|
61509
61457
|
* Parse Inline Tokens
|
|
61510
61458
|
*/
|
|
61511
|
-
parseInline(tokens, renderer) {
|
|
61512
|
-
renderer = renderer || this.renderer;
|
|
61459
|
+
parseInline(tokens, renderer = this.renderer) {
|
|
61513
61460
|
let out = '';
|
|
61514
61461
|
for (let i = 0; i < tokens.length; i++) {
|
|
61515
61462
|
const anyToken = tokens[i];
|
|
61516
61463
|
// Run any renderer extensions
|
|
61517
|
-
if (this.options.extensions
|
|
61464
|
+
if (this.options.extensions?.renderers?.[anyToken.type]) {
|
|
61518
61465
|
const ret = this.options.extensions.renderers[anyToken.type].call({
|
|
61519
61466
|
parser: this
|
|
61520
61467
|
}, anyToken);
|
|
@@ -61932,7 +61879,7 @@
|
|
|
61932
61879
|
return e => {
|
|
61933
61880
|
e.message += '\nPlease report this to https://github.com/markedjs/marked.';
|
|
61934
61881
|
if (silent) {
|
|
61935
|
-
const msg = '<p>An error occurred:</p><pre>' + escape
|
|
61882
|
+
const msg = '<p>An error occurred:</p><pre>' + escape(e.message + '', true) + '</pre>';
|
|
61936
61883
|
if (async) {
|
|
61937
61884
|
return Promise.resolve(msg);
|
|
61938
61885
|
}
|
|
@@ -67868,7 +67815,9 @@
|
|
|
67868
67815
|
accept = ''
|
|
67869
67816
|
} = field;
|
|
67870
67817
|
/** @type {string} */
|
|
67871
|
-
const evaluatedAccept = useSingleLineTemplateEvaluation(accept
|
|
67818
|
+
const evaluatedAccept = useSingleLineTemplateEvaluation(accept, {
|
|
67819
|
+
debug: true
|
|
67820
|
+
});
|
|
67872
67821
|
const evaluatedMultiple = useBooleanExpressionEvaluation(multiple);
|
|
67873
67822
|
const errorMessageId = `${domId}-error-message`;
|
|
67874
67823
|
/** @type {File[]} */
|
|
@@ -73387,11 +73336,11 @@
|
|
|
73387
73336
|
var sortOrderedTabbables = function sortOrderedTabbables(a, b) {
|
|
73388
73337
|
return a.tabIndex === b.tabIndex ? a.documentOrder - b.documentOrder : a.tabIndex - b.tabIndex;
|
|
73389
73338
|
};
|
|
73390
|
-
var isInput
|
|
73339
|
+
var isInput = function isInput(node) {
|
|
73391
73340
|
return node.tagName === 'INPUT';
|
|
73392
73341
|
};
|
|
73393
73342
|
var isHiddenInput = function isHiddenInput(node) {
|
|
73394
|
-
return isInput
|
|
73343
|
+
return isInput(node) && node.type === 'hidden';
|
|
73395
73344
|
};
|
|
73396
73345
|
var isDetailsWithSummary = function isDetailsWithSummary(node) {
|
|
73397
73346
|
var r = node.tagName === 'DETAILS' && Array.prototype.slice.apply(node.children).some(function (child) {
|
|
@@ -73430,7 +73379,7 @@
|
|
|
73430
73379
|
return !checked || checked === node;
|
|
73431
73380
|
};
|
|
73432
73381
|
var isRadio = function isRadio(node) {
|
|
73433
|
-
return isInput
|
|
73382
|
+
return isInput(node) && node.type === 'radio';
|
|
73434
73383
|
};
|
|
73435
73384
|
var isNonTabbableRadio = function isNonTabbableRadio(node) {
|
|
73436
73385
|
return isRadio(node) && !isTabbableRadio(node);
|
|
@@ -77803,13 +77752,17 @@
|
|
|
77803
77752
|
ref.current.focus();
|
|
77804
77753
|
}
|
|
77805
77754
|
}, [selection, field]);
|
|
77806
|
-
|
|
77807
|
-
|
|
77808
|
-
|
|
77809
|
-
|
|
77810
|
-
|
|
77811
|
-
|
|
77812
|
-
|
|
77755
|
+
const onClick = T$2(event => {
|
|
77756
|
+
// TODO(nikku): refactor this to use proper DOM delegation
|
|
77757
|
+
const fieldEl = event.target.closest('[data-id]');
|
|
77758
|
+
if (!fieldEl) {
|
|
77759
|
+
return;
|
|
77760
|
+
}
|
|
77761
|
+
const id = fieldEl.dataset.id;
|
|
77762
|
+
if (id === field.id) {
|
|
77763
|
+
selection.toggle(field);
|
|
77764
|
+
}
|
|
77765
|
+
}, [field, selection]);
|
|
77813
77766
|
const isSelected = selection.isSelected(field);
|
|
77814
77767
|
const classString = F$1(() => {
|
|
77815
77768
|
const classes = [];
|
|
@@ -78200,6 +78153,34 @@
|
|
|
78200
78153
|
container,
|
|
78201
78154
|
compact = false
|
|
78202
78155
|
} = renderConfig;
|
|
78156
|
+
eventBus.on('form.init', function () {
|
|
78157
|
+
// emit <canvas.init> so dependent components can hook in
|
|
78158
|
+
// this is required to register keyboard bindings
|
|
78159
|
+
eventBus.fire('canvas.init', {
|
|
78160
|
+
svg: container,
|
|
78161
|
+
viewport: null
|
|
78162
|
+
});
|
|
78163
|
+
});
|
|
78164
|
+
|
|
78165
|
+
// focus container on over if no selection
|
|
78166
|
+
container.addEventListener('mouseover', function () {
|
|
78167
|
+
if (document.activeElement === document.body) {
|
|
78168
|
+
container.focus({
|
|
78169
|
+
preventScroll: true
|
|
78170
|
+
});
|
|
78171
|
+
}
|
|
78172
|
+
});
|
|
78173
|
+
|
|
78174
|
+
// ensure we focus the container if the users clicks
|
|
78175
|
+
// inside; this follows input focus handling closely
|
|
78176
|
+
container.addEventListener('click', function (event) {
|
|
78177
|
+
// force focus when clicking container
|
|
78178
|
+
if (!container.contains(document.activeElement)) {
|
|
78179
|
+
container.focus({
|
|
78180
|
+
preventScroll: true
|
|
78181
|
+
});
|
|
78182
|
+
}
|
|
78183
|
+
});
|
|
78203
78184
|
const App = () => {
|
|
78204
78185
|
const [state, setState] = h(formEditor._getState());
|
|
78205
78186
|
const formEditorContext = {
|
|
@@ -78630,8 +78611,8 @@
|
|
|
78630
78611
|
|
|
78631
78612
|
var KEYDOWN_EVENT = 'keyboard.keydown',
|
|
78632
78613
|
KEYUP_EVENT = 'keyboard.keyup';
|
|
78633
|
-
var HANDLE_MODIFIER_ATTRIBUTE = 'input-handle-modified-keys';
|
|
78634
78614
|
var DEFAULT_PRIORITY$2 = 1000;
|
|
78615
|
+
var compatMessage = 'Keyboard binding is now implicit; explicit binding to an element got removed. For more information, see https://github.com/bpmn-io/diagram-js/issues/661';
|
|
78635
78616
|
|
|
78636
78617
|
/**
|
|
78637
78618
|
* A keyboard abstraction that may be activated and
|
|
@@ -78651,16 +78632,16 @@
|
|
|
78651
78632
|
*
|
|
78652
78633
|
* All events contain one field which is node.
|
|
78653
78634
|
*
|
|
78654
|
-
*
|
|
78655
|
-
* `keyboard.
|
|
78635
|
+
* Specify the initial keyboard binding state via the
|
|
78636
|
+
* `keyboard.bind=true|false` configuration option.
|
|
78656
78637
|
*
|
|
78657
78638
|
* @param {Object} config
|
|
78658
|
-
* @param {
|
|
78639
|
+
* @param {boolean} [config.bind]
|
|
78659
78640
|
* @param {EventBus} eventBus
|
|
78660
78641
|
*/
|
|
78661
78642
|
function Keyboard(config, eventBus) {
|
|
78662
78643
|
var self = this;
|
|
78663
|
-
this._config = config || {};
|
|
78644
|
+
this._config = config = config || {};
|
|
78664
78645
|
this._eventBus = eventBus;
|
|
78665
78646
|
this._keydownHandler = this._keydownHandler.bind(this);
|
|
78666
78647
|
this._keyupHandler = this._keyupHandler.bind(this);
|
|
@@ -78670,16 +78651,16 @@
|
|
|
78670
78651
|
self._fire('destroy');
|
|
78671
78652
|
self.unbind();
|
|
78672
78653
|
});
|
|
78673
|
-
|
|
78674
|
-
|
|
78675
|
-
}
|
|
78676
|
-
|
|
78677
|
-
|
|
78678
|
-
|
|
78654
|
+
if (config.bindTo) {
|
|
78655
|
+
console.error('unsupported configuration <keyboard.bindTo>', new Error(compatMessage));
|
|
78656
|
+
}
|
|
78657
|
+
var bind = config && config.bind !== false;
|
|
78658
|
+
eventBus.on('canvas.init', function (event) {
|
|
78659
|
+
self._target = event.svg;
|
|
78660
|
+
if (bind) {
|
|
78661
|
+
self.bind();
|
|
78679
78662
|
}
|
|
78680
|
-
|
|
78681
|
-
eventBus.on('detach', function () {
|
|
78682
|
-
self.unbind();
|
|
78663
|
+
self._fire('init');
|
|
78683
78664
|
});
|
|
78684
78665
|
}
|
|
78685
78666
|
Keyboard.$inject = ['config.keyboard', 'eventBus'];
|
|
@@ -78703,35 +78684,29 @@
|
|
|
78703
78684
|
}
|
|
78704
78685
|
};
|
|
78705
78686
|
Keyboard.prototype._isEventIgnored = function (event) {
|
|
78706
|
-
|
|
78707
|
-
return true;
|
|
78708
|
-
}
|
|
78709
|
-
return (isInput(event.target) || isButton(event.target) && isKey([' ', 'Enter'], event)) && this._isModifiedKeyIgnored(event);
|
|
78710
|
-
};
|
|
78711
|
-
Keyboard.prototype._isModifiedKeyIgnored = function (event) {
|
|
78712
|
-
if (!isCmd(event)) {
|
|
78713
|
-
return true;
|
|
78714
|
-
}
|
|
78715
|
-
var allowedModifiers = this._getAllowedModifiers(event.target);
|
|
78716
|
-
return allowedModifiers.indexOf(event.key) === -1;
|
|
78717
|
-
};
|
|
78718
|
-
Keyboard.prototype._getAllowedModifiers = function (element) {
|
|
78719
|
-
var modifierContainer = closest(element, '[' + HANDLE_MODIFIER_ATTRIBUTE + ']');
|
|
78720
|
-
if (!modifierContainer || this._node && !this._node.contains(modifierContainer)) {
|
|
78721
|
-
return [];
|
|
78722
|
-
}
|
|
78723
|
-
return modifierContainer.getAttribute(HANDLE_MODIFIER_ATTRIBUTE).split(',');
|
|
78687
|
+
return false;
|
|
78724
78688
|
};
|
|
78725
78689
|
|
|
78726
78690
|
/**
|
|
78727
78691
|
* Bind keyboard events to the given DOM node.
|
|
78728
78692
|
*
|
|
78693
|
+
* @overlord
|
|
78694
|
+
* @deprecated No longer in use since version 15.0.0.
|
|
78695
|
+
*
|
|
78729
78696
|
* @param {EventTarget} node
|
|
78730
78697
|
*/
|
|
78698
|
+
/**
|
|
78699
|
+
* Bind keyboard events to the canvas node.
|
|
78700
|
+
*/
|
|
78731
78701
|
Keyboard.prototype.bind = function (node) {
|
|
78702
|
+
// legacy <node> argument provided
|
|
78703
|
+
if (node) {
|
|
78704
|
+
console.error('unsupported argument <node>', new Error(compatMessage));
|
|
78705
|
+
}
|
|
78706
|
+
|
|
78732
78707
|
// make sure that the keyboard is only bound once to the DOM
|
|
78733
78708
|
this.unbind();
|
|
78734
|
-
this._node =
|
|
78709
|
+
node = this._node = this._target;
|
|
78735
78710
|
|
|
78736
78711
|
// bind key events
|
|
78737
78712
|
event.bind(node, 'keydown', this._keydownHandler);
|
|
@@ -78797,15 +78772,6 @@
|
|
|
78797
78772
|
Keyboard.prototype.isCmd = isCmd;
|
|
78798
78773
|
Keyboard.prototype.isShift = isShift;
|
|
78799
78774
|
Keyboard.prototype.isKey = isKey;
|
|
78800
|
-
|
|
78801
|
-
// helpers ///////
|
|
78802
|
-
|
|
78803
|
-
function isInput(target) {
|
|
78804
|
-
return target && (matches$2(target, 'input, textarea') || target.contentEditable === 'true');
|
|
78805
|
-
}
|
|
78806
|
-
function isButton(target) {
|
|
78807
|
-
return target && matches$2(target, 'button, input[type=submit], input[type=button], a[href], [aria-role=button]');
|
|
78808
|
-
}
|
|
78809
78775
|
var LOW_PRIORITY$1 = 500;
|
|
78810
78776
|
|
|
78811
78777
|
/**
|
|
@@ -78968,7 +78934,7 @@
|
|
|
78968
78934
|
const {
|
|
78969
78935
|
keyEvent
|
|
78970
78936
|
} = context;
|
|
78971
|
-
if (
|
|
78937
|
+
if (isUndo(keyEvent)) {
|
|
78972
78938
|
editorActions.trigger('undo');
|
|
78973
78939
|
return true;
|
|
78974
78940
|
}
|
|
@@ -78981,7 +78947,7 @@
|
|
|
78981
78947
|
const {
|
|
78982
78948
|
keyEvent
|
|
78983
78949
|
} = context;
|
|
78984
|
-
if (
|
|
78950
|
+
if (isRedo(keyEvent)) {
|
|
78985
78951
|
editorActions.trigger('redo');
|
|
78986
78952
|
return true;
|
|
78987
78953
|
}
|
|
@@ -80769,6 +80735,21 @@
|
|
|
80769
80735
|
width: "16",
|
|
80770
80736
|
height: "16"
|
|
80771
80737
|
};
|
|
80738
|
+
var CloseIcon = function CloseIcon(props) {
|
|
80739
|
+
return o("svg", {
|
|
80740
|
+
...props,
|
|
80741
|
+
children: o("path", {
|
|
80742
|
+
fillRule: "evenodd",
|
|
80743
|
+
d: "m12 4.7-.7-.7L8 7.3 4.7 4l-.7.7L7.3 8 4 11.3l.7.7L8 8.7l3.3 3.3.7-.7L8.7 8 12 4.7Z",
|
|
80744
|
+
fill: "currentColor"
|
|
80745
|
+
})
|
|
80746
|
+
});
|
|
80747
|
+
};
|
|
80748
|
+
CloseIcon.defaultProps = {
|
|
80749
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
80750
|
+
width: "16",
|
|
80751
|
+
height: "16"
|
|
80752
|
+
};
|
|
80772
80753
|
var CreateIcon = function CreateIcon(props) {
|
|
80773
80754
|
return o("svg", {
|
|
80774
80755
|
...props,
|
|
@@ -80856,26 +80837,17 @@
|
|
|
80856
80837
|
fill: "none",
|
|
80857
80838
|
xmlns: "http://www.w3.org/2000/svg"
|
|
80858
80839
|
};
|
|
80859
|
-
var
|
|
80840
|
+
var LaunchIcon = function LaunchIcon(props) {
|
|
80860
80841
|
return o("svg", {
|
|
80861
80842
|
...props,
|
|
80862
80843
|
children: [o("path", {
|
|
80863
|
-
d: "
|
|
80864
|
-
}), o("circle", {
|
|
80865
|
-
cx: "16",
|
|
80866
|
-
cy: "23.5",
|
|
80867
|
-
r: "1.5"
|
|
80868
|
-
}), o("path", {
|
|
80869
|
-
d: "M17 8h-1.5a4.49 4.49 0 0 0-4.5 4.5v.5h2v-.5a2.5 2.5 0 0 1 2.5-2.5H17a2.5 2.5 0 0 1 0 5h-2v4.5h2V17a4.5 4.5 0 0 0 0-9Z"
|
|
80844
|
+
d: "M26 28H6a2.003 2.003 0 0 1-2-2V6a2.003 2.003 0 0 1 2-2h10v2H6v20h20V16h2v10a2.003 2.003 0 0 1-2 2Z"
|
|
80870
80845
|
}), o("path", {
|
|
80871
|
-
|
|
80872
|
-
fill: "none"
|
|
80873
|
-
},
|
|
80874
|
-
d: "M0 0h32v32H0z"
|
|
80846
|
+
d: "M20 2v2h6.586L18 12.586 19.414 14 28 5.414V12h2V2H20z"
|
|
80875
80847
|
})]
|
|
80876
80848
|
});
|
|
80877
80849
|
};
|
|
80878
|
-
|
|
80850
|
+
LaunchIcon.defaultProps = {
|
|
80879
80851
|
xmlns: "http://www.w3.org/2000/svg",
|
|
80880
80852
|
viewBox: "0 0 32 32"
|
|
80881
80853
|
};
|
|
@@ -80897,21 +80869,6 @@
|
|
|
80897
80869
|
height: "16",
|
|
80898
80870
|
viewBox: "0 0 32 32"
|
|
80899
80871
|
};
|
|
80900
|
-
var CloseIcon = function CloseIcon(props) {
|
|
80901
|
-
return o("svg", {
|
|
80902
|
-
...props,
|
|
80903
|
-
children: o("path", {
|
|
80904
|
-
fillRule: "evenodd",
|
|
80905
|
-
d: "m12 4.7-.7-.7L8 7.3 4.7 4l-.7.7L7.3 8 4 11.3l.7.7L8 8.7l3.3 3.3.7-.7L8.7 8 12 4.7Z",
|
|
80906
|
-
fill: "currentColor"
|
|
80907
|
-
})
|
|
80908
|
-
});
|
|
80909
|
-
};
|
|
80910
|
-
CloseIcon.defaultProps = {
|
|
80911
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
80912
|
-
width: "16",
|
|
80913
|
-
height: "16"
|
|
80914
|
-
};
|
|
80915
80872
|
function Header(props) {
|
|
80916
80873
|
const {
|
|
80917
80874
|
element,
|
|
@@ -80950,7 +80907,7 @@
|
|
|
80950
80907
|
}), o("div", {
|
|
80951
80908
|
class: "bio-properties-panel-header-actions",
|
|
80952
80909
|
children: documentationRef ? o("a", {
|
|
80953
|
-
rel: "
|
|
80910
|
+
rel: "noreferrer",
|
|
80954
80911
|
class: "bio-properties-panel-header-link",
|
|
80955
80912
|
href: documentationRef,
|
|
80956
80913
|
title: "Open documentation",
|
|
@@ -80968,19 +80925,19 @@
|
|
|
80968
80925
|
errors: {}
|
|
80969
80926
|
});
|
|
80970
80927
|
|
|
80971
|
-
/**
|
|
80972
|
-
* @typedef {Function} <propertiesPanel.showEntry> callback
|
|
80973
|
-
*
|
|
80974
|
-
* @example
|
|
80975
|
-
*
|
|
80976
|
-
* useEvent('propertiesPanel.showEntry', ({ focus = false, ...rest }) => {
|
|
80977
|
-
* // ...
|
|
80978
|
-
* });
|
|
80979
|
-
*
|
|
80980
|
-
* @param {Object} context
|
|
80981
|
-
* @param {boolean} [context.focus]
|
|
80982
|
-
*
|
|
80983
|
-
* @returns void
|
|
80928
|
+
/**
|
|
80929
|
+
* @typedef {Function} <propertiesPanel.showEntry> callback
|
|
80930
|
+
*
|
|
80931
|
+
* @example
|
|
80932
|
+
*
|
|
80933
|
+
* useEvent('propertiesPanel.showEntry', ({ focus = false, ...rest }) => {
|
|
80934
|
+
* // ...
|
|
80935
|
+
* });
|
|
80936
|
+
*
|
|
80937
|
+
* @param {Object} context
|
|
80938
|
+
* @param {boolean} [context.focus]
|
|
80939
|
+
*
|
|
80940
|
+
* @returns void
|
|
80984
80941
|
*/
|
|
80985
80942
|
|
|
80986
80943
|
const EventContext = G({
|
|
@@ -80997,20 +80954,20 @@
|
|
|
80997
80954
|
getTooltipForId: () => {}
|
|
80998
80955
|
});
|
|
80999
80956
|
|
|
81000
|
-
/**
|
|
81001
|
-
* Accesses the global TooltipContext and returns a tooltip for a given id and element.
|
|
81002
|
-
*
|
|
81003
|
-
* @example
|
|
81004
|
-
* ```jsx
|
|
81005
|
-
* function TextField(props) {
|
|
81006
|
-
* const tooltip = useTooltipContext('input1', element);
|
|
81007
|
-
* }
|
|
81008
|
-
* ```
|
|
81009
|
-
*
|
|
81010
|
-
* @param {string} id
|
|
81011
|
-
* @param {object} element
|
|
81012
|
-
*
|
|
81013
|
-
* @returns {string}
|
|
80957
|
+
/**
|
|
80958
|
+
* Accesses the global TooltipContext and returns a tooltip for a given id and element.
|
|
80959
|
+
*
|
|
80960
|
+
* @example
|
|
80961
|
+
* ```jsx
|
|
80962
|
+
* function TextField(props) {
|
|
80963
|
+
* const tooltip = useTooltipContext('input1', element);
|
|
80964
|
+
* }
|
|
80965
|
+
* ```
|
|
80966
|
+
*
|
|
80967
|
+
* @param {string} id
|
|
80968
|
+
* @param {object} element
|
|
80969
|
+
*
|
|
80970
|
+
* @returns {string}
|
|
81014
80971
|
*/
|
|
81015
80972
|
function useTooltipContext(id, element) {
|
|
81016
80973
|
const {
|
|
@@ -81162,20 +81119,20 @@
|
|
|
81162
81119
|
return `bio-properties-panel-${id}`;
|
|
81163
81120
|
}
|
|
81164
81121
|
|
|
81165
|
-
/**
|
|
81166
|
-
* Accesses the global DescriptionContext and returns a description for a given id and element.
|
|
81167
|
-
*
|
|
81168
|
-
* @example
|
|
81169
|
-
* ```jsx
|
|
81170
|
-
* function TextField(props) {
|
|
81171
|
-
* const description = useDescriptionContext('input1', element);
|
|
81172
|
-
* }
|
|
81173
|
-
* ```
|
|
81174
|
-
*
|
|
81175
|
-
* @param {string} id
|
|
81176
|
-
* @param {object} element
|
|
81177
|
-
*
|
|
81178
|
-
* @returns {string}
|
|
81122
|
+
/**
|
|
81123
|
+
* Accesses the global DescriptionContext and returns a description for a given id and element.
|
|
81124
|
+
*
|
|
81125
|
+
* @example
|
|
81126
|
+
* ```jsx
|
|
81127
|
+
* function TextField(props) {
|
|
81128
|
+
* const description = useDescriptionContext('input1', element);
|
|
81129
|
+
* }
|
|
81130
|
+
* ```
|
|
81131
|
+
*
|
|
81132
|
+
* @param {string} id
|
|
81133
|
+
* @param {object} element
|
|
81134
|
+
*
|
|
81135
|
+
* @returns {string}
|
|
81179
81136
|
*/
|
|
81180
81137
|
function useDescriptionContext(id, element) {
|
|
81181
81138
|
const {
|
|
@@ -81196,11 +81153,11 @@
|
|
|
81196
81153
|
return errors;
|
|
81197
81154
|
}
|
|
81198
81155
|
|
|
81199
|
-
/**
|
|
81200
|
-
* Subscribe to an event immediately. Update subscription after inputs changed.
|
|
81201
|
-
*
|
|
81202
|
-
* @param {string} event
|
|
81203
|
-
* @param {Function} callback
|
|
81156
|
+
/**
|
|
81157
|
+
* Subscribe to an event immediately. Update subscription after inputs changed.
|
|
81158
|
+
*
|
|
81159
|
+
* @param {string} event
|
|
81160
|
+
* @param {Function} callback
|
|
81204
81161
|
*/
|
|
81205
81162
|
function useEvent(event, callback, eventBus) {
|
|
81206
81163
|
const eventContext = q$1(EventContext);
|
|
@@ -81230,20 +81187,20 @@
|
|
|
81230
81187
|
}, [callback, event, eventBus]);
|
|
81231
81188
|
}
|
|
81232
81189
|
|
|
81233
|
-
/**
|
|
81234
|
-
* Creates a state that persists in the global LayoutContext.
|
|
81235
|
-
*
|
|
81236
|
-
* @example
|
|
81237
|
-
* ```jsx
|
|
81238
|
-
* function Group(props) {
|
|
81239
|
-
* const [ open, setOpen ] = useLayoutState([ 'groups', 'foo', 'open' ], false);
|
|
81240
|
-
* }
|
|
81241
|
-
* ```
|
|
81242
|
-
*
|
|
81243
|
-
* @param {(string|number)[]} path
|
|
81244
|
-
* @param {any} [defaultValue]
|
|
81245
|
-
*
|
|
81246
|
-
* @returns {[ any, Function ]}
|
|
81190
|
+
/**
|
|
81191
|
+
* Creates a state that persists in the global LayoutContext.
|
|
81192
|
+
*
|
|
81193
|
+
* @example
|
|
81194
|
+
* ```jsx
|
|
81195
|
+
* function Group(props) {
|
|
81196
|
+
* const [ open, setOpen ] = useLayoutState([ 'groups', 'foo', 'open' ], false);
|
|
81197
|
+
* }
|
|
81198
|
+
* ```
|
|
81199
|
+
*
|
|
81200
|
+
* @param {(string|number)[]} path
|
|
81201
|
+
* @param {any} [defaultValue]
|
|
81202
|
+
*
|
|
81203
|
+
* @returns {[ any, Function ]}
|
|
81247
81204
|
*/
|
|
81248
81205
|
function useLayoutState(path, defaultValue) {
|
|
81249
81206
|
const {
|
|
@@ -81257,11 +81214,11 @@
|
|
|
81257
81214
|
return [layoutForKey, setState];
|
|
81258
81215
|
}
|
|
81259
81216
|
|
|
81260
|
-
/**
|
|
81261
|
-
* @pinussilvestrus: we need to introduce our own hook to persist the previous
|
|
81262
|
-
* state on updates.
|
|
81263
|
-
*
|
|
81264
|
-
* cf. https://reactjs.org/docs/hooks-faq.html#how-to-get-the-previous-props-or-state
|
|
81217
|
+
/**
|
|
81218
|
+
* @pinussilvestrus: we need to introduce our own hook to persist the previous
|
|
81219
|
+
* state on updates.
|
|
81220
|
+
*
|
|
81221
|
+
* cf. https://reactjs.org/docs/hooks-faq.html#how-to-get-the-previous-props-or-state
|
|
81265
81222
|
*/
|
|
81266
81223
|
|
|
81267
81224
|
function usePrevious(value) {
|
|
@@ -81272,12 +81229,12 @@
|
|
|
81272
81229
|
return ref.current;
|
|
81273
81230
|
}
|
|
81274
81231
|
|
|
81275
|
-
/**
|
|
81276
|
-
* Subscribe to `propertiesPanel.showEntry`.
|
|
81277
|
-
*
|
|
81278
|
-
* @param {string} id
|
|
81279
|
-
*
|
|
81280
|
-
* @returns {import('preact').Ref}
|
|
81232
|
+
/**
|
|
81233
|
+
* Subscribe to `propertiesPanel.showEntry`.
|
|
81234
|
+
*
|
|
81235
|
+
* @param {string} id
|
|
81236
|
+
*
|
|
81237
|
+
* @returns {import('preact').Ref}
|
|
81281
81238
|
*/
|
|
81282
81239
|
function useShowEntryEvent(id) {
|
|
81283
81240
|
const {
|
|
@@ -81308,20 +81265,20 @@
|
|
|
81308
81265
|
return ref;
|
|
81309
81266
|
}
|
|
81310
81267
|
|
|
81311
|
-
/**
|
|
81312
|
-
* @callback setSticky
|
|
81313
|
-
* @param {boolean} value
|
|
81268
|
+
/**
|
|
81269
|
+
* @callback setSticky
|
|
81270
|
+
* @param {boolean} value
|
|
81314
81271
|
*/
|
|
81315
81272
|
|
|
81316
|
-
/**
|
|
81317
|
-
* Use IntersectionObserver to identify when DOM element is in sticky mode.
|
|
81318
|
-
* If sticky is observered setSticky(true) will be called.
|
|
81319
|
-
* If sticky mode is left, setSticky(false) will be called.
|
|
81320
|
-
*
|
|
81321
|
-
*
|
|
81322
|
-
* @param {Object} ref
|
|
81323
|
-
* @param {string} scrollContainerSelector
|
|
81324
|
-
* @param {setSticky} setSticky
|
|
81273
|
+
/**
|
|
81274
|
+
* Use IntersectionObserver to identify when DOM element is in sticky mode.
|
|
81275
|
+
* If sticky is observered setSticky(true) will be called.
|
|
81276
|
+
* If sticky mode is left, setSticky(false) will be called.
|
|
81277
|
+
*
|
|
81278
|
+
*
|
|
81279
|
+
* @param {Object} ref
|
|
81280
|
+
* @param {string} scrollContainerSelector
|
|
81281
|
+
* @param {setSticky} setSticky
|
|
81325
81282
|
*/
|
|
81326
81283
|
function useStickyIntersectionObserver(ref, scrollContainerSelector, setSticky) {
|
|
81327
81284
|
const [scrollContainer, setScrollContainer] = h(query(scrollContainerSelector));
|
|
@@ -81375,19 +81332,19 @@
|
|
|
81375
81332
|
}, [ref.current, scrollContainer, setSticky]);
|
|
81376
81333
|
}
|
|
81377
81334
|
|
|
81378
|
-
/**
|
|
81379
|
-
* Creates a static function reference with changing body.
|
|
81380
|
-
* This is necessary when external libraries require a callback function
|
|
81381
|
-
* that has references to state variables.
|
|
81382
|
-
*
|
|
81383
|
-
* Usage:
|
|
81384
|
-
* const callback = useStaticCallback((val) => {val === currentState});
|
|
81385
|
-
*
|
|
81386
|
-
* The `callback` reference is static and can be safely used in external
|
|
81387
|
-
* libraries or as a prop that does not cause rerendering of children.
|
|
81388
|
-
*
|
|
81389
|
-
* @param {Function} callback function with changing reference
|
|
81390
|
-
* @returns {Function} static function reference
|
|
81335
|
+
/**
|
|
81336
|
+
* Creates a static function reference with changing body.
|
|
81337
|
+
* This is necessary when external libraries require a callback function
|
|
81338
|
+
* that has references to state variables.
|
|
81339
|
+
*
|
|
81340
|
+
* Usage:
|
|
81341
|
+
* const callback = useStaticCallback((val) => {val === currentState});
|
|
81342
|
+
*
|
|
81343
|
+
* The `callback` reference is static and can be safely used in external
|
|
81344
|
+
* libraries or as a prop that does not cause rerendering of children.
|
|
81345
|
+
*
|
|
81346
|
+
* @param {Function} callback function with changing reference
|
|
81347
|
+
* @returns {Function} static function reference
|
|
81391
81348
|
*/
|
|
81392
81349
|
function useStaticCallback(callback) {
|
|
81393
81350
|
const callbackRef = _$1(callback);
|
|
@@ -81528,13 +81485,13 @@
|
|
|
81528
81485
|
return null;
|
|
81529
81486
|
}
|
|
81530
81487
|
|
|
81531
|
-
/**
|
|
81532
|
-
* @typedef { {
|
|
81533
|
-
* text: (element: object) => string,
|
|
81534
|
-
* icon?: (element: Object) => import('preact').Component
|
|
81535
|
-
* } } PlaceholderDefinition
|
|
81536
|
-
*
|
|
81537
|
-
* @param { PlaceholderDefinition } props
|
|
81488
|
+
/**
|
|
81489
|
+
* @typedef { {
|
|
81490
|
+
* text: (element: object) => string,
|
|
81491
|
+
* icon?: (element: Object) => import('preact').Component
|
|
81492
|
+
* } } PlaceholderDefinition
|
|
81493
|
+
*
|
|
81494
|
+
* @param { PlaceholderDefinition } props
|
|
81538
81495
|
*/
|
|
81539
81496
|
function Placeholder(props) {
|
|
81540
81497
|
const {
|
|
@@ -81571,9 +81528,9 @@
|
|
|
81571
81528
|
}
|
|
81572
81529
|
const noop$6 = () => {};
|
|
81573
81530
|
|
|
81574
|
-
/**
|
|
81575
|
-
* Buffer `.focus()` calls while the editor is not initialized.
|
|
81576
|
-
* Set Focus inside when the editor is ready.
|
|
81531
|
+
/**
|
|
81532
|
+
* Buffer `.focus()` calls while the editor is not initialized.
|
|
81533
|
+
* Set Focus inside when the editor is ready.
|
|
81577
81534
|
*/
|
|
81578
81535
|
const useBufferedFocus$1 = function (editor, ref) {
|
|
81579
81536
|
const [buffer, setBuffer] = h(undefined);
|
|
@@ -81673,9 +81630,9 @@
|
|
|
81673
81630
|
});
|
|
81674
81631
|
const noop$5 = () => {};
|
|
81675
81632
|
|
|
81676
|
-
/**
|
|
81677
|
-
* Buffer `.focus()` calls while the editor is not initialized.
|
|
81678
|
-
* Set Focus inside when the editor is ready.
|
|
81633
|
+
/**
|
|
81634
|
+
* Buffer `.focus()` calls while the editor is not initialized.
|
|
81635
|
+
* Set Focus inside when the editor is ready.
|
|
81679
81636
|
*/
|
|
81680
81637
|
const useBufferedFocus = function (editor, ref) {
|
|
81681
81638
|
const [buffer, setBuffer] = h(undefined);
|
|
@@ -81724,10 +81681,10 @@
|
|
|
81724
81681
|
p(() => {
|
|
81725
81682
|
let editor;
|
|
81726
81683
|
|
|
81727
|
-
/* Trigger FEEL toggle when
|
|
81728
|
-
*
|
|
81729
|
-
* - `backspace` is pressed
|
|
81730
|
-
* - AND the cursor is at the beginning of the input
|
|
81684
|
+
/* Trigger FEEL toggle when
|
|
81685
|
+
*
|
|
81686
|
+
* - `backspace` is pressed
|
|
81687
|
+
* - AND the cursor is at the beginning of the input
|
|
81731
81688
|
*/
|
|
81732
81689
|
const onKeyDown = e => {
|
|
81733
81690
|
if (e.key !== 'Backspace' || !editor) {
|
|
@@ -81816,10 +81773,10 @@
|
|
|
81816
81773
|
}
|
|
81817
81774
|
const noop$4 = () => {};
|
|
81818
81775
|
|
|
81819
|
-
/**
|
|
81820
|
-
* @param {Object} props
|
|
81821
|
-
* @param {Object} props.label
|
|
81822
|
-
* @param {String} props.feel
|
|
81776
|
+
/**
|
|
81777
|
+
* @param {Object} props
|
|
81778
|
+
* @param {Object} props.label
|
|
81779
|
+
* @param {String} props.feel
|
|
81823
81780
|
*/
|
|
81824
81781
|
function FeelIcon(props) {
|
|
81825
81782
|
const {
|
|
@@ -81853,22 +81810,22 @@
|
|
|
81853
81810
|
source: null
|
|
81854
81811
|
});
|
|
81855
81812
|
|
|
81856
|
-
/**
|
|
81857
|
-
* Add a dragger that calls back the passed function with
|
|
81858
|
-
* { event, delta } on drag.
|
|
81859
|
-
*
|
|
81860
|
-
* @example
|
|
81861
|
-
*
|
|
81862
|
-
* function dragMove(event, delta) {
|
|
81863
|
-
* // we are dragging (!!)
|
|
81864
|
-
* }
|
|
81865
|
-
*
|
|
81866
|
-
* domElement.addEventListener('dragstart', dragger(dragMove));
|
|
81867
|
-
*
|
|
81868
|
-
* @param {Function} fn
|
|
81869
|
-
* @param {Element} [dragPreview]
|
|
81870
|
-
*
|
|
81871
|
-
* @return {Function} drag start callback function
|
|
81813
|
+
/**
|
|
81814
|
+
* Add a dragger that calls back the passed function with
|
|
81815
|
+
* { event, delta } on drag.
|
|
81816
|
+
*
|
|
81817
|
+
* @example
|
|
81818
|
+
*
|
|
81819
|
+
* function dragMove(event, delta) {
|
|
81820
|
+
* // we are dragging (!!)
|
|
81821
|
+
* }
|
|
81822
|
+
*
|
|
81823
|
+
* domElement.addEventListener('dragstart', dragger(dragMove));
|
|
81824
|
+
*
|
|
81825
|
+
* @param {Function} fn
|
|
81826
|
+
* @param {Element} [dragPreview]
|
|
81827
|
+
*
|
|
81828
|
+
* @return {Function} drag start callback function
|
|
81872
81829
|
*/
|
|
81873
81830
|
function createDragger(fn, dragPreview) {
|
|
81874
81831
|
let self;
|
|
@@ -81922,23 +81879,23 @@
|
|
|
81922
81879
|
}
|
|
81923
81880
|
const noop$3 = () => {};
|
|
81924
81881
|
|
|
81925
|
-
/**
|
|
81926
|
-
* A generic popup component.
|
|
81927
|
-
*
|
|
81928
|
-
* @param {Object} props
|
|
81929
|
-
* @param {HTMLElement} [props.container]
|
|
81930
|
-
* @param {string} [props.className]
|
|
81931
|
-
* @param {boolean} [props.delayInitialFocus]
|
|
81932
|
-
* @param {{x: number, y: number}} [props.position]
|
|
81933
|
-
* @param {number} [props.width]
|
|
81934
|
-
* @param {number} [props.height]
|
|
81935
|
-
* @param {Function} props.onClose
|
|
81936
|
-
* @param {Function} [props.onPostActivate]
|
|
81937
|
-
* @param {Function} [props.onPostDeactivate]
|
|
81938
|
-
* @param {boolean} [props.returnFocus]
|
|
81939
|
-
* @param {boolean} [props.closeOnEscape]
|
|
81940
|
-
* @param {string} props.title
|
|
81941
|
-
* @param {Ref} [ref]
|
|
81882
|
+
/**
|
|
81883
|
+
* A generic popup component.
|
|
81884
|
+
*
|
|
81885
|
+
* @param {Object} props
|
|
81886
|
+
* @param {HTMLElement} [props.container]
|
|
81887
|
+
* @param {string} [props.className]
|
|
81888
|
+
* @param {boolean} [props.delayInitialFocus]
|
|
81889
|
+
* @param {{x: number, y: number}} [props.position]
|
|
81890
|
+
* @param {number} [props.width]
|
|
81891
|
+
* @param {number} [props.height]
|
|
81892
|
+
* @param {Function} props.onClose
|
|
81893
|
+
* @param {Function} [props.onPostActivate]
|
|
81894
|
+
* @param {Function} [props.onPostDeactivate]
|
|
81895
|
+
* @param {boolean} [props.returnFocus]
|
|
81896
|
+
* @param {boolean} [props.closeOnEscape]
|
|
81897
|
+
* @param {string} props.title
|
|
81898
|
+
* @param {Ref} [ref]
|
|
81942
81899
|
*/
|
|
81943
81900
|
function PopupComponent(props, globalRef) {
|
|
81944
81901
|
const {
|
|
@@ -82156,12 +82113,12 @@
|
|
|
82156
82113
|
const FEEL_POPUP_WIDTH = 700;
|
|
82157
82114
|
const FEEL_POPUP_HEIGHT = 250;
|
|
82158
82115
|
|
|
82159
|
-
/**
|
|
82160
|
-
* FEEL popup component, built as a singleton. Emits lifecycle events as follows:
|
|
82161
|
-
* - `feelPopup.open` - fired before the popup is mounted
|
|
82162
|
-
* - `feelPopup.opened` - fired after the popup is mounted. Event context contains the DOM node of the popup
|
|
82163
|
-
* - `feelPopup.close` - fired before the popup is unmounted. Event context contains the DOM node of the popup
|
|
82164
|
-
* - `feelPopup.closed` - fired after the popup is unmounted
|
|
82116
|
+
/**
|
|
82117
|
+
* FEEL popup component, built as a singleton. Emits lifecycle events as follows:
|
|
82118
|
+
* - `feelPopup.open` - fired before the popup is mounted
|
|
82119
|
+
* - `feelPopup.opened` - fired after the popup is mounted. Event context contains the DOM node of the popup
|
|
82120
|
+
* - `feelPopup.close` - fired before the popup is unmounted. Event context contains the DOM node of the popup
|
|
82121
|
+
* - `feelPopup.closed` - fired after the popup is unmounted
|
|
82165
82122
|
*/
|
|
82166
82123
|
function FEELPopupRoot(props) {
|
|
82167
82124
|
const {
|
|
@@ -82171,7 +82128,8 @@
|
|
|
82171
82128
|
on() {},
|
|
82172
82129
|
off() {}
|
|
82173
82130
|
},
|
|
82174
|
-
popupContainer
|
|
82131
|
+
popupContainer,
|
|
82132
|
+
getPopupLinks = () => []
|
|
82175
82133
|
} = props;
|
|
82176
82134
|
const prevElement = usePrevious(element);
|
|
82177
82135
|
const [popupConfig, setPopupConfig] = h({});
|
|
@@ -82246,6 +82204,7 @@
|
|
|
82246
82204
|
children: [open && o(FeelPopupComponent, {
|
|
82247
82205
|
onClose: handleClose,
|
|
82248
82206
|
container: popupContainer,
|
|
82207
|
+
getLinks: getPopupLinks,
|
|
82249
82208
|
sourceElement: sourceElement,
|
|
82250
82209
|
emit: emit,
|
|
82251
82210
|
...popupConfig
|
|
@@ -82255,6 +82214,7 @@
|
|
|
82255
82214
|
function FeelPopupComponent(props) {
|
|
82256
82215
|
const {
|
|
82257
82216
|
container,
|
|
82217
|
+
getLinks,
|
|
82258
82218
|
id,
|
|
82259
82219
|
hostLanguage,
|
|
82260
82220
|
onInput,
|
|
@@ -82332,17 +82292,17 @@
|
|
|
82332
82292
|
closeButtonTooltip: "Save and close",
|
|
82333
82293
|
onClose: onClose,
|
|
82334
82294
|
draggable: true,
|
|
82335
|
-
children:
|
|
82336
|
-
|
|
82337
|
-
|
|
82338
|
-
|
|
82339
|
-
|
|
82340
|
-
|
|
82341
|
-
|
|
82342
|
-
|
|
82343
|
-
|
|
82344
|
-
|
|
82345
|
-
})
|
|
82295
|
+
children: o(k$2, {
|
|
82296
|
+
children: getLinks(type).map((link, index) => {
|
|
82297
|
+
return o("a", {
|
|
82298
|
+
rel: "noreferrer",
|
|
82299
|
+
href: link.href,
|
|
82300
|
+
target: "_blank",
|
|
82301
|
+
class: "bio-properties-panel-feel-popup__title-link",
|
|
82302
|
+
children: [link.title, o(LaunchIcon, {})]
|
|
82303
|
+
}, index);
|
|
82304
|
+
})
|
|
82305
|
+
})
|
|
82346
82306
|
}), o(Popup.Body, {
|
|
82347
82307
|
children: o("div", {
|
|
82348
82308
|
onKeyDownCapture: onKeyDownCapture,
|
|
@@ -82385,11 +82345,11 @@
|
|
|
82385
82345
|
return element.closest('.cm-editor').querySelector('.cm-tooltip-autocomplete');
|
|
82386
82346
|
}
|
|
82387
82347
|
|
|
82388
|
-
/**
|
|
82389
|
-
* This hook behaves like useEffect, but does not trigger on the first render.
|
|
82390
|
-
*
|
|
82391
|
-
* @param {Function} effect
|
|
82392
|
-
* @param {Array} deps
|
|
82348
|
+
/**
|
|
82349
|
+
* This hook behaves like useEffect, but does not trigger on the first render.
|
|
82350
|
+
*
|
|
82351
|
+
* @param {Function} effect
|
|
82352
|
+
* @param {Array} deps
|
|
82393
82353
|
*/
|
|
82394
82354
|
function useUpdateEffect(effect, deps) {
|
|
82395
82355
|
const isMounted = _$1(false);
|
|
@@ -82466,19 +82426,19 @@
|
|
|
82466
82426
|
});
|
|
82467
82427
|
}
|
|
82468
82428
|
|
|
82469
|
-
/**
|
|
82470
|
-
* @param {Object} props
|
|
82471
|
-
* @param {Object} props.element
|
|
82472
|
-
* @param {String} props.id
|
|
82473
|
-
* @param {String} props.description
|
|
82474
|
-
* @param {String} props.label
|
|
82475
|
-
* @param {String} props.switcherLabel
|
|
82476
|
-
* @param {Boolean} props.inline
|
|
82477
|
-
* @param {Function} props.getValue
|
|
82478
|
-
* @param {Function} props.setValue
|
|
82479
|
-
* @param {Function} props.onFocus
|
|
82480
|
-
* @param {Function} props.onBlur
|
|
82481
|
-
* @param {string|import('preact').Component} props.tooltip
|
|
82429
|
+
/**
|
|
82430
|
+
* @param {Object} props
|
|
82431
|
+
* @param {Object} props.element
|
|
82432
|
+
* @param {String} props.id
|
|
82433
|
+
* @param {String} props.description
|
|
82434
|
+
* @param {String} props.label
|
|
82435
|
+
* @param {String} props.switcherLabel
|
|
82436
|
+
* @param {Boolean} props.inline
|
|
82437
|
+
* @param {Function} props.getValue
|
|
82438
|
+
* @param {Function} props.setValue
|
|
82439
|
+
* @param {Function} props.onFocus
|
|
82440
|
+
* @param {Function} props.onBlur
|
|
82441
|
+
* @param {string|import('preact').Component} props.tooltip
|
|
82482
82442
|
*/
|
|
82483
82443
|
function ToggleSwitchEntry(props) {
|
|
82484
82444
|
const {
|
|
@@ -82585,22 +82545,22 @@
|
|
|
82585
82545
|
});
|
|
82586
82546
|
}
|
|
82587
82547
|
|
|
82588
|
-
/**
|
|
82589
|
-
* @param {Object} props
|
|
82590
|
-
* @param {Boolean} props.debounce
|
|
82591
|
-
* @param {String} props.description
|
|
82592
|
-
* @param {Boolean} props.disabled
|
|
82593
|
-
* @param {Object} props.element
|
|
82594
|
-
* @param {Function} props.getValue
|
|
82595
|
-
* @param {String} props.id
|
|
82596
|
-
* @param {String} props.label
|
|
82597
|
-
* @param {String} props.max
|
|
82598
|
-
* @param {String} props.min
|
|
82599
|
-
* @param {Function} props.setValue
|
|
82600
|
-
* @param {Function} props.onFocus
|
|
82601
|
-
* @param {Function} props.onBlur
|
|
82602
|
-
* @param {String} props.step
|
|
82603
|
-
* @param {Function} props.validate
|
|
82548
|
+
/**
|
|
82549
|
+
* @param {Object} props
|
|
82550
|
+
* @param {Boolean} props.debounce
|
|
82551
|
+
* @param {String} props.description
|
|
82552
|
+
* @param {Boolean} props.disabled
|
|
82553
|
+
* @param {Object} props.element
|
|
82554
|
+
* @param {Function} props.getValue
|
|
82555
|
+
* @param {String} props.id
|
|
82556
|
+
* @param {String} props.label
|
|
82557
|
+
* @param {String} props.max
|
|
82558
|
+
* @param {String} props.min
|
|
82559
|
+
* @param {Function} props.setValue
|
|
82560
|
+
* @param {Function} props.onFocus
|
|
82561
|
+
* @param {Function} props.onBlur
|
|
82562
|
+
* @param {String} props.step
|
|
82563
|
+
* @param {Function} props.validate
|
|
82604
82564
|
*/
|
|
82605
82565
|
function NumberFieldEntry(props) {
|
|
82606
82566
|
const {
|
|
@@ -83085,26 +83045,26 @@
|
|
|
83085
83045
|
});
|
|
83086
83046
|
});
|
|
83087
83047
|
|
|
83088
|
-
/**
|
|
83089
|
-
* @param {Object} props
|
|
83090
|
-
* @param {Object} props.element
|
|
83091
|
-
* @param {String} props.id
|
|
83092
|
-
* @param {String} props.description
|
|
83093
|
-
* @param {Boolean} props.debounce
|
|
83094
|
-
* @param {Boolean} props.disabled
|
|
83095
|
-
* @param {Boolean} props.feel
|
|
83096
|
-
* @param {String} props.label
|
|
83097
|
-
* @param {Function} props.getValue
|
|
83098
|
-
* @param {Function} props.setValue
|
|
83099
|
-
* @param {Function} props.tooltipContainer
|
|
83100
|
-
* @param {Function} props.validate
|
|
83101
|
-
* @param {Function} props.show
|
|
83102
|
-
* @param {Function} props.example
|
|
83103
|
-
* @param {Function} props.variables
|
|
83104
|
-
* @param {Function} props.onFocus
|
|
83105
|
-
* @param {Function} props.onBlur
|
|
83106
|
-
* @param {string} [props.placeholder]
|
|
83107
|
-
* @param {string|import('preact').Component} props.tooltip
|
|
83048
|
+
/**
|
|
83049
|
+
* @param {Object} props
|
|
83050
|
+
* @param {Object} props.element
|
|
83051
|
+
* @param {String} props.id
|
|
83052
|
+
* @param {String} props.description
|
|
83053
|
+
* @param {Boolean} props.debounce
|
|
83054
|
+
* @param {Boolean} props.disabled
|
|
83055
|
+
* @param {Boolean} props.feel
|
|
83056
|
+
* @param {String} props.label
|
|
83057
|
+
* @param {Function} props.getValue
|
|
83058
|
+
* @param {Function} props.setValue
|
|
83059
|
+
* @param {Function} props.tooltipContainer
|
|
83060
|
+
* @param {Function} props.validate
|
|
83061
|
+
* @param {Function} props.show
|
|
83062
|
+
* @param {Function} props.example
|
|
83063
|
+
* @param {Function} props.variables
|
|
83064
|
+
* @param {Function} props.onFocus
|
|
83065
|
+
* @param {Function} props.onBlur
|
|
83066
|
+
* @param {string} [props.placeholder]
|
|
83067
|
+
* @param {string|import('preact').Component} props.tooltip
|
|
83108
83068
|
*/
|
|
83109
83069
|
function FeelEntry(props) {
|
|
83110
83070
|
const {
|
|
@@ -83191,27 +83151,27 @@
|
|
|
83191
83151
|
});
|
|
83192
83152
|
}
|
|
83193
83153
|
|
|
83194
|
-
/**
|
|
83195
|
-
* @param {Object} props
|
|
83196
|
-
* @param {Object} props.element
|
|
83197
|
-
* @param {String} props.id
|
|
83198
|
-
* @param {String} props.description
|
|
83199
|
-
* @param {Boolean} props.debounce
|
|
83200
|
-
* @param {Boolean} props.disabled
|
|
83201
|
-
* @param {String} props.max
|
|
83202
|
-
* @param {String} props.min
|
|
83203
|
-
* @param {String} props.step
|
|
83204
|
-
* @param {Boolean} props.feel
|
|
83205
|
-
* @param {String} props.label
|
|
83206
|
-
* @param {Function} props.getValue
|
|
83207
|
-
* @param {Function} props.setValue
|
|
83208
|
-
* @param {Function} props.tooltipContainer
|
|
83209
|
-
* @param {Function} props.validate
|
|
83210
|
-
* @param {Function} props.show
|
|
83211
|
-
* @param {Function} props.example
|
|
83212
|
-
* @param {Function} props.variables
|
|
83213
|
-
* @param {Function} props.onFocus
|
|
83214
|
-
* @param {Function} props.onBlur
|
|
83154
|
+
/**
|
|
83155
|
+
* @param {Object} props
|
|
83156
|
+
* @param {Object} props.element
|
|
83157
|
+
* @param {String} props.id
|
|
83158
|
+
* @param {String} props.description
|
|
83159
|
+
* @param {Boolean} props.debounce
|
|
83160
|
+
* @param {Boolean} props.disabled
|
|
83161
|
+
* @param {String} props.max
|
|
83162
|
+
* @param {String} props.min
|
|
83163
|
+
* @param {String} props.step
|
|
83164
|
+
* @param {Boolean} props.feel
|
|
83165
|
+
* @param {String} props.label
|
|
83166
|
+
* @param {Function} props.getValue
|
|
83167
|
+
* @param {Function} props.setValue
|
|
83168
|
+
* @param {Function} props.tooltipContainer
|
|
83169
|
+
* @param {Function} props.validate
|
|
83170
|
+
* @param {Function} props.show
|
|
83171
|
+
* @param {Function} props.example
|
|
83172
|
+
* @param {Function} props.variables
|
|
83173
|
+
* @param {Function} props.onFocus
|
|
83174
|
+
* @param {Function} props.onBlur
|
|
83215
83175
|
*/
|
|
83216
83176
|
function FeelNumberEntry(props) {
|
|
83217
83177
|
return o(FeelEntry, {
|
|
@@ -83221,24 +83181,24 @@
|
|
|
83221
83181
|
});
|
|
83222
83182
|
}
|
|
83223
83183
|
|
|
83224
|
-
/**
|
|
83225
|
-
* @param {Object} props
|
|
83226
|
-
* @param {Object} props.element
|
|
83227
|
-
* @param {String} props.id
|
|
83228
|
-
* @param {String} props.description
|
|
83229
|
-
* @param {Boolean} props.debounce
|
|
83230
|
-
* @param {Boolean} props.disabled
|
|
83231
|
-
* @param {Boolean} props.feel
|
|
83232
|
-
* @param {String} props.label
|
|
83233
|
-
* @param {Function} props.getValue
|
|
83234
|
-
* @param {Function} props.setValue
|
|
83235
|
-
* @param {Function} props.tooltipContainer
|
|
83236
|
-
* @param {Function} props.validate
|
|
83237
|
-
* @param {Function} props.show
|
|
83238
|
-
* @param {Function} props.example
|
|
83239
|
-
* @param {Function} props.variables
|
|
83240
|
-
* @param {Function} props.onFocus
|
|
83241
|
-
* @param {Function} props.onBlur
|
|
83184
|
+
/**
|
|
83185
|
+
* @param {Object} props
|
|
83186
|
+
* @param {Object} props.element
|
|
83187
|
+
* @param {String} props.id
|
|
83188
|
+
* @param {String} props.description
|
|
83189
|
+
* @param {Boolean} props.debounce
|
|
83190
|
+
* @param {Boolean} props.disabled
|
|
83191
|
+
* @param {Boolean} props.feel
|
|
83192
|
+
* @param {String} props.label
|
|
83193
|
+
* @param {Function} props.getValue
|
|
83194
|
+
* @param {Function} props.setValue
|
|
83195
|
+
* @param {Function} props.tooltipContainer
|
|
83196
|
+
* @param {Function} props.validate
|
|
83197
|
+
* @param {Function} props.show
|
|
83198
|
+
* @param {Function} props.example
|
|
83199
|
+
* @param {Function} props.variables
|
|
83200
|
+
* @param {Function} props.onFocus
|
|
83201
|
+
* @param {Function} props.onBlur
|
|
83242
83202
|
*/
|
|
83243
83203
|
function FeelToggleSwitchEntry(props) {
|
|
83244
83204
|
return o(FeelEntry, {
|
|
@@ -83248,26 +83208,26 @@
|
|
|
83248
83208
|
});
|
|
83249
83209
|
}
|
|
83250
83210
|
|
|
83251
|
-
/**
|
|
83252
|
-
* @param {Object} props
|
|
83253
|
-
* @param {Object} props.element
|
|
83254
|
-
* @param {String} props.id
|
|
83255
|
-
* @param {String} props.description
|
|
83256
|
-
* @param {String} props.hostLanguage
|
|
83257
|
-
* @param {Boolean} props.singleLine
|
|
83258
|
-
* @param {Boolean} props.debounce
|
|
83259
|
-
* @param {Boolean} props.disabled
|
|
83260
|
-
* @param {Boolean} props.feel
|
|
83261
|
-
* @param {String} props.label
|
|
83262
|
-
* @param {Function} props.getValue
|
|
83263
|
-
* @param {Function} props.setValue
|
|
83264
|
-
* @param {Function} props.tooltipContainer
|
|
83265
|
-
* @param {Function} props.validate
|
|
83266
|
-
* @param {Function} props.show
|
|
83267
|
-
* @param {Function} props.example
|
|
83268
|
-
* @param {Function} props.variables
|
|
83269
|
-
* @param {Function} props.onFocus
|
|
83270
|
-
* @param {Function} props.onBlur
|
|
83211
|
+
/**
|
|
83212
|
+
* @param {Object} props
|
|
83213
|
+
* @param {Object} props.element
|
|
83214
|
+
* @param {String} props.id
|
|
83215
|
+
* @param {String} props.description
|
|
83216
|
+
* @param {String} props.hostLanguage
|
|
83217
|
+
* @param {Boolean} props.singleLine
|
|
83218
|
+
* @param {Boolean} props.debounce
|
|
83219
|
+
* @param {Boolean} props.disabled
|
|
83220
|
+
* @param {Boolean} props.feel
|
|
83221
|
+
* @param {String} props.label
|
|
83222
|
+
* @param {Function} props.getValue
|
|
83223
|
+
* @param {Function} props.setValue
|
|
83224
|
+
* @param {Function} props.tooltipContainer
|
|
83225
|
+
* @param {Function} props.validate
|
|
83226
|
+
* @param {Function} props.show
|
|
83227
|
+
* @param {Function} props.example
|
|
83228
|
+
* @param {Function} props.variables
|
|
83229
|
+
* @param {Function} props.onFocus
|
|
83230
|
+
* @param {Function} props.onBlur
|
|
83271
83231
|
*/
|
|
83272
83232
|
function FeelTemplatingEntry(props) {
|
|
83273
83233
|
return o(FeelEntry, {
|
|
@@ -83335,84 +83295,85 @@
|
|
|
83335
83295
|
const DEFAULT_DESCRIPTION = {};
|
|
83336
83296
|
const DEFAULT_TOOLTIP = {};
|
|
83337
83297
|
|
|
83338
|
-
/**
|
|
83339
|
-
* @typedef { {
|
|
83340
|
-
* component: import('preact').Component,
|
|
83341
|
-
* id: String,
|
|
83342
|
-
* isEdited?: Function
|
|
83343
|
-
* } } EntryDefinition
|
|
83344
|
-
*
|
|
83345
|
-
* @typedef { {
|
|
83346
|
-
* autoFocusEntry: String,
|
|
83347
|
-
* autoOpen?: Boolean,
|
|
83348
|
-
* entries: Array<EntryDefinition>,
|
|
83349
|
-
* id: String,
|
|
83350
|
-
* label: String,
|
|
83351
|
-
* remove: (event: MouseEvent) => void
|
|
83352
|
-
* } } ListItemDefinition
|
|
83353
|
-
*
|
|
83354
|
-
* @typedef { {
|
|
83355
|
-
* add: (event: MouseEvent) => void,
|
|
83356
|
-
* component: import('preact').Component,
|
|
83357
|
-
* element: Object,
|
|
83358
|
-
* id: String,
|
|
83359
|
-
* items: Array<ListItemDefinition>,
|
|
83360
|
-
* label: String,
|
|
83361
|
-
* shouldOpen?: Boolean
|
|
83362
|
-
* } } ListGroupDefinition
|
|
83363
|
-
*
|
|
83364
|
-
* @typedef { {
|
|
83365
|
-
* component?: import('preact').Component,
|
|
83366
|
-
* entries: Array<EntryDefinition>,
|
|
83367
|
-
* id: String,
|
|
83368
|
-
* label: String,
|
|
83369
|
-
* shouldOpen?: Boolean
|
|
83370
|
-
* } } GroupDefinition
|
|
83371
|
-
*
|
|
83372
|
-
* @typedef { {
|
|
83373
|
-
* [id: String]: GetDescriptionFunction
|
|
83374
|
-
* } } DescriptionConfig
|
|
83375
|
-
*
|
|
83376
|
-
* @typedef { {
|
|
83377
|
-
* [id: String]: GetTooltipFunction
|
|
83378
|
-
* } } TooltipConfig
|
|
83379
|
-
*
|
|
83380
|
-
* @callback { {
|
|
83381
|
-
* @param {string} id
|
|
83382
|
-
* @param {Object} element
|
|
83383
|
-
* @returns {string}
|
|
83384
|
-
* } } GetDescriptionFunction
|
|
83385
|
-
*
|
|
83386
|
-
* @callback { {
|
|
83387
|
-
* @param {string} id
|
|
83388
|
-
* @param {Object} element
|
|
83389
|
-
* @returns {string}
|
|
83390
|
-
* } } GetTooltipFunction
|
|
83391
|
-
*
|
|
83392
|
-
* @typedef { {
|
|
83393
|
-
* getEmpty: (element: object) => import('./components/Placeholder').PlaceholderDefinition,
|
|
83394
|
-
* getMultiple: (element: Object) => import('./components/Placeholder').PlaceholderDefinition
|
|
83395
|
-
* } } PlaceholderProvider
|
|
83396
|
-
*
|
|
83298
|
+
/**
|
|
83299
|
+
* @typedef { {
|
|
83300
|
+
* component: import('preact').Component,
|
|
83301
|
+
* id: String,
|
|
83302
|
+
* isEdited?: Function
|
|
83303
|
+
* } } EntryDefinition
|
|
83304
|
+
*
|
|
83305
|
+
* @typedef { {
|
|
83306
|
+
* autoFocusEntry: String,
|
|
83307
|
+
* autoOpen?: Boolean,
|
|
83308
|
+
* entries: Array<EntryDefinition>,
|
|
83309
|
+
* id: String,
|
|
83310
|
+
* label: String,
|
|
83311
|
+
* remove: (event: MouseEvent) => void
|
|
83312
|
+
* } } ListItemDefinition
|
|
83313
|
+
*
|
|
83314
|
+
* @typedef { {
|
|
83315
|
+
* add: (event: MouseEvent) => void,
|
|
83316
|
+
* component: import('preact').Component,
|
|
83317
|
+
* element: Object,
|
|
83318
|
+
* id: String,
|
|
83319
|
+
* items: Array<ListItemDefinition>,
|
|
83320
|
+
* label: String,
|
|
83321
|
+
* shouldOpen?: Boolean
|
|
83322
|
+
* } } ListGroupDefinition
|
|
83323
|
+
*
|
|
83324
|
+
* @typedef { {
|
|
83325
|
+
* component?: import('preact').Component,
|
|
83326
|
+
* entries: Array<EntryDefinition>,
|
|
83327
|
+
* id: String,
|
|
83328
|
+
* label: String,
|
|
83329
|
+
* shouldOpen?: Boolean
|
|
83330
|
+
* } } GroupDefinition
|
|
83331
|
+
*
|
|
83332
|
+
* @typedef { {
|
|
83333
|
+
* [id: String]: GetDescriptionFunction
|
|
83334
|
+
* } } DescriptionConfig
|
|
83335
|
+
*
|
|
83336
|
+
* @typedef { {
|
|
83337
|
+
* [id: String]: GetTooltipFunction
|
|
83338
|
+
* } } TooltipConfig
|
|
83339
|
+
*
|
|
83340
|
+
* @callback { {
|
|
83341
|
+
* @param {string} id
|
|
83342
|
+
* @param {Object} element
|
|
83343
|
+
* @returns {string}
|
|
83344
|
+
* } } GetDescriptionFunction
|
|
83345
|
+
*
|
|
83346
|
+
* @callback { {
|
|
83347
|
+
* @param {string} id
|
|
83348
|
+
* @param {Object} element
|
|
83349
|
+
* @returns {string}
|
|
83350
|
+
* } } GetTooltipFunction
|
|
83351
|
+
*
|
|
83352
|
+
* @typedef { {
|
|
83353
|
+
* getEmpty: (element: object) => import('./components/Placeholder').PlaceholderDefinition,
|
|
83354
|
+
* getMultiple: (element: Object) => import('./components/Placeholder').PlaceholderDefinition
|
|
83355
|
+
* } } PlaceholderProvider
|
|
83356
|
+
*
|
|
83397
83357
|
*/
|
|
83398
83358
|
|
|
83399
|
-
/**
|
|
83400
|
-
* A basic properties panel component. Describes *how* content will be rendered, accepts
|
|
83401
|
-
* data from implementor to describe *what* will be rendered.
|
|
83402
|
-
*
|
|
83403
|
-
* @param {Object} props
|
|
83404
|
-
* @param {Object|Array} props.element
|
|
83405
|
-
* @param {import('./components/Header').HeaderProvider} props.headerProvider
|
|
83406
|
-
* @param {PlaceholderProvider} [props.placeholderProvider]
|
|
83407
|
-
* @param {Array<GroupDefinition|ListGroupDefinition>} props.groups
|
|
83408
|
-
* @param {Object} [props.layoutConfig]
|
|
83409
|
-
* @param {Function} [props.layoutChanged]
|
|
83410
|
-
* @param {DescriptionConfig} [props.descriptionConfig]
|
|
83411
|
-
* @param {Function} [props.descriptionLoaded]
|
|
83412
|
-
* @param {TooltipConfig} [props.tooltipConfig]
|
|
83413
|
-
* @param {Function} [props.tooltipLoaded]
|
|
83414
|
-
* @param {HTMLElement} [props.feelPopupContainer]
|
|
83415
|
-
* @param {
|
|
83359
|
+
/**
|
|
83360
|
+
* A basic properties panel component. Describes *how* content will be rendered, accepts
|
|
83361
|
+
* data from implementor to describe *what* will be rendered.
|
|
83362
|
+
*
|
|
83363
|
+
* @param {Object} props
|
|
83364
|
+
* @param {Object|Array} props.element
|
|
83365
|
+
* @param {import('./components/Header').HeaderProvider} props.headerProvider
|
|
83366
|
+
* @param {PlaceholderProvider} [props.placeholderProvider]
|
|
83367
|
+
* @param {Array<GroupDefinition|ListGroupDefinition>} props.groups
|
|
83368
|
+
* @param {Object} [props.layoutConfig]
|
|
83369
|
+
* @param {Function} [props.layoutChanged]
|
|
83370
|
+
* @param {DescriptionConfig} [props.descriptionConfig]
|
|
83371
|
+
* @param {Function} [props.descriptionLoaded]
|
|
83372
|
+
* @param {TooltipConfig} [props.tooltipConfig]
|
|
83373
|
+
* @param {Function} [props.tooltipLoaded]
|
|
83374
|
+
* @param {HTMLElement} [props.feelPopupContainer]
|
|
83375
|
+
* @param {Function} [props.getFeelPopupLinks]
|
|
83376
|
+
* @param {Object} [props.eventBus]
|
|
83416
83377
|
*/
|
|
83417
83378
|
function PropertiesPanel$1(props) {
|
|
83418
83379
|
const {
|
|
@@ -83427,6 +83388,7 @@
|
|
|
83427
83388
|
tooltipConfig,
|
|
83428
83389
|
tooltipLoaded,
|
|
83429
83390
|
feelPopupContainer,
|
|
83391
|
+
getFeelPopupLinks,
|
|
83430
83392
|
eventBus
|
|
83431
83393
|
} = props;
|
|
83432
83394
|
|
|
@@ -83531,6 +83493,7 @@
|
|
|
83531
83493
|
element: element,
|
|
83532
83494
|
eventBus: eventBus,
|
|
83533
83495
|
popupContainer: feelPopupContainer,
|
|
83496
|
+
getPopupLinks: getFeelPopupLinks,
|
|
83534
83497
|
children: o("div", {
|
|
83535
83498
|
class: "bio-properties-panel",
|
|
83536
83499
|
children: [o(Header, {
|
|
@@ -83583,11 +83546,11 @@
|
|
|
83583
83546
|
|
|
83584
83547
|
// hooks //////////////////
|
|
83585
83548
|
|
|
83586
|
-
/**
|
|
83587
|
-
* This hook behaves like useLayoutEffect, but does not trigger on the first render.
|
|
83588
|
-
*
|
|
83589
|
-
* @param {Function} effect
|
|
83590
|
-
* @param {Array} deps
|
|
83549
|
+
/**
|
|
83550
|
+
* This hook behaves like useLayoutEffect, but does not trigger on the first render.
|
|
83551
|
+
*
|
|
83552
|
+
* @param {Function} effect
|
|
83553
|
+
* @param {Array} deps
|
|
83591
83554
|
*/
|
|
83592
83555
|
function useUpdateLayoutEffect(effect, deps) {
|
|
83593
83556
|
const isMounted = _$1(false);
|
|
@@ -83600,20 +83563,20 @@
|
|
|
83600
83563
|
}, deps);
|
|
83601
83564
|
}
|
|
83602
83565
|
|
|
83603
|
-
/**
|
|
83604
|
-
* @typedef { {
|
|
83605
|
-
* [key: string]: string;
|
|
83606
|
-
* } } TranslateReplacements
|
|
83566
|
+
/**
|
|
83567
|
+
* @typedef { {
|
|
83568
|
+
* [key: string]: string;
|
|
83569
|
+
* } } TranslateReplacements
|
|
83607
83570
|
*/
|
|
83608
83571
|
|
|
83609
|
-
/**
|
|
83610
|
-
* A simple translation stub to be used for multi-language support.
|
|
83611
|
-
* Can be easily replaced with a more sophisticated solution.
|
|
83612
|
-
*
|
|
83613
|
-
* @param {string} template to interpolate
|
|
83614
|
-
* @param {TranslateReplacements} [replacements] a map with substitutes
|
|
83615
|
-
*
|
|
83616
|
-
* @return {string} the translated string
|
|
83572
|
+
/**
|
|
83573
|
+
* A simple translation stub to be used for multi-language support.
|
|
83574
|
+
* Can be easily replaced with a more sophisticated solution.
|
|
83575
|
+
*
|
|
83576
|
+
* @param {string} template to interpolate
|
|
83577
|
+
* @param {TranslateReplacements} [replacements] a map with substitutes
|
|
83578
|
+
*
|
|
83579
|
+
* @return {string} the translated string
|
|
83617
83580
|
*/
|
|
83618
83581
|
function translateFallback(template, replacements) {
|
|
83619
83582
|
replacements = replacements || {};
|
|
@@ -83722,8 +83685,8 @@
|
|
|
83722
83685
|
}
|
|
83723
83686
|
const noop$1 = () => {};
|
|
83724
83687
|
|
|
83725
|
-
/**
|
|
83726
|
-
* @param {import('../PropertiesPanel').ListGroupDefinition} props
|
|
83688
|
+
/**
|
|
83689
|
+
* @param {import('../PropertiesPanel').ListGroupDefinition} props
|
|
83727
83690
|
*/
|
|
83728
83691
|
function ListGroup(props) {
|
|
83729
83692
|
const {
|
|
@@ -83914,18 +83877,18 @@
|
|
|
83914
83877
|
});
|
|
83915
83878
|
}
|
|
83916
83879
|
|
|
83917
|
-
/**
|
|
83918
|
-
* @param {Object} props
|
|
83919
|
-
* @param {Object} props.element
|
|
83920
|
-
* @param {String} props.id
|
|
83921
|
-
* @param {String} props.description
|
|
83922
|
-
* @param {String} props.label
|
|
83923
|
-
* @param {Function} props.getValue
|
|
83924
|
-
* @param {Function} props.setValue
|
|
83925
|
-
* @param {Function} props.onFocus
|
|
83926
|
-
* @param {Function} props.onBlur
|
|
83927
|
-
* @param {string|import('preact').Component} props.tooltip
|
|
83928
|
-
* @param {boolean} [props.disabled]
|
|
83880
|
+
/**
|
|
83881
|
+
* @param {Object} props
|
|
83882
|
+
* @param {Object} props.element
|
|
83883
|
+
* @param {String} props.id
|
|
83884
|
+
* @param {String} props.description
|
|
83885
|
+
* @param {String} props.label
|
|
83886
|
+
* @param {Function} props.getValue
|
|
83887
|
+
* @param {Function} props.setValue
|
|
83888
|
+
* @param {Function} props.onFocus
|
|
83889
|
+
* @param {Function} props.onBlur
|
|
83890
|
+
* @param {string|import('preact').Component} props.tooltip
|
|
83891
|
+
* @param {boolean} [props.disabled]
|
|
83929
83892
|
*/
|
|
83930
83893
|
function CheckboxEntry(props) {
|
|
83931
83894
|
const {
|
|
@@ -84045,20 +84008,20 @@
|
|
|
84045
84008
|
});
|
|
84046
84009
|
}
|
|
84047
84010
|
|
|
84048
|
-
/**
|
|
84049
|
-
* @param {object} props
|
|
84050
|
-
* @param {object} props.element
|
|
84051
|
-
* @param {string} props.id
|
|
84052
|
-
* @param {string} [props.description]
|
|
84053
|
-
* @param {string} props.label
|
|
84054
|
-
* @param {Function} props.getValue
|
|
84055
|
-
* @param {Function} props.setValue
|
|
84056
|
-
* @param {Function} props.onFocus
|
|
84057
|
-
* @param {Function} props.onBlur
|
|
84058
|
-
* @param {Function} props.getOptions
|
|
84059
|
-
* @param {boolean} [props.disabled]
|
|
84060
|
-
* @param {Function} [props.validate]
|
|
84061
|
-
* @param {string|import('preact').Component} props.tooltip
|
|
84011
|
+
/**
|
|
84012
|
+
* @param {object} props
|
|
84013
|
+
* @param {object} props.element
|
|
84014
|
+
* @param {string} props.id
|
|
84015
|
+
* @param {string} [props.description]
|
|
84016
|
+
* @param {string} props.label
|
|
84017
|
+
* @param {Function} props.getValue
|
|
84018
|
+
* @param {Function} props.setValue
|
|
84019
|
+
* @param {Function} props.onFocus
|
|
84020
|
+
* @param {Function} props.onBlur
|
|
84021
|
+
* @param {Function} props.getOptions
|
|
84022
|
+
* @param {boolean} [props.disabled]
|
|
84023
|
+
* @param {Function} [props.validate]
|
|
84024
|
+
* @param {string|import('preact').Component} props.tooltip
|
|
84062
84025
|
*/
|
|
84063
84026
|
function SelectEntry(props) {
|
|
84064
84027
|
const {
|
|
@@ -84349,20 +84312,20 @@
|
|
|
84349
84312
|
});
|
|
84350
84313
|
}
|
|
84351
84314
|
|
|
84352
|
-
/**
|
|
84353
|
-
* @param {Object} props
|
|
84354
|
-
* @param {Object} props.element
|
|
84355
|
-
* @param {String} props.id
|
|
84356
|
-
* @param {String} props.description
|
|
84357
|
-
* @param {Boolean} props.debounce
|
|
84358
|
-
* @param {Boolean} props.disabled
|
|
84359
|
-
* @param {String} props.label
|
|
84360
|
-
* @param {Function} props.getValue
|
|
84361
|
-
* @param {Function} props.setValue
|
|
84362
|
-
* @param {Function} props.onFocus
|
|
84363
|
-
* @param {Function} props.onBlur
|
|
84364
|
-
* @param {string|import('preact').Component} props.tooltip
|
|
84365
|
-
* @param {Function} props.validate
|
|
84315
|
+
/**
|
|
84316
|
+
* @param {Object} props
|
|
84317
|
+
* @param {Object} props.element
|
|
84318
|
+
* @param {String} props.id
|
|
84319
|
+
* @param {String} props.description
|
|
84320
|
+
* @param {Boolean} props.debounce
|
|
84321
|
+
* @param {Boolean} props.disabled
|
|
84322
|
+
* @param {String} props.label
|
|
84323
|
+
* @param {Function} props.getValue
|
|
84324
|
+
* @param {Function} props.setValue
|
|
84325
|
+
* @param {Function} props.onFocus
|
|
84326
|
+
* @param {Function} props.onBlur
|
|
84327
|
+
* @param {string|import('preact').Component} props.tooltip
|
|
84328
|
+
* @param {Function} props.validate
|
|
84366
84329
|
*/
|
|
84367
84330
|
function TextfieldEntry(props) {
|
|
84368
84331
|
const {
|
|
@@ -84437,20 +84400,20 @@
|
|
|
84437
84400
|
this._eventBus = eventBus;
|
|
84438
84401
|
}
|
|
84439
84402
|
|
|
84440
|
-
/**
|
|
84441
|
-
* Check if the FEEL popup is open.
|
|
84442
|
-
* @return {Boolean}
|
|
84403
|
+
/**
|
|
84404
|
+
* Check if the FEEL popup is open.
|
|
84405
|
+
* @return {Boolean}
|
|
84443
84406
|
*/
|
|
84444
84407
|
isOpen() {
|
|
84445
84408
|
return this._eventBus.fire('feelPopup._isOpen');
|
|
84446
84409
|
}
|
|
84447
84410
|
|
|
84448
|
-
/**
|
|
84449
|
-
* Open the FEEL popup.
|
|
84450
|
-
*
|
|
84451
|
-
* @param {String} entryId
|
|
84452
|
-
* @param {Object} popupConfig
|
|
84453
|
-
* @param {HTMLElement} sourceElement
|
|
84411
|
+
/**
|
|
84412
|
+
* Open the FEEL popup.
|
|
84413
|
+
*
|
|
84414
|
+
* @param {String} entryId
|
|
84415
|
+
* @param {Object} popupConfig
|
|
84416
|
+
* @param {HTMLElement} sourceElement
|
|
84454
84417
|
*/
|
|
84455
84418
|
open(entryId, popupConfig, sourceElement) {
|
|
84456
84419
|
return this._eventBus.fire('feelPopup._open', {
|
|
@@ -84460,8 +84423,8 @@
|
|
|
84460
84423
|
});
|
|
84461
84424
|
}
|
|
84462
84425
|
|
|
84463
|
-
/**
|
|
84464
|
-
* Close the FEEL popup.
|
|
84426
|
+
/**
|
|
84427
|
+
* Close the FEEL popup.
|
|
84465
84428
|
*/
|
|
84466
84429
|
close() {
|
|
84467
84430
|
return this._eventBus.fire('feelPopup._close');
|
|
@@ -88997,7 +88960,7 @@
|
|
|
88997
88960
|
* @type {Element}
|
|
88998
88961
|
*/
|
|
88999
88962
|
this._container = createFormContainer();
|
|
89000
|
-
this._container.setAttribute('
|
|
88963
|
+
this._container.setAttribute('tabindex', '0');
|
|
89001
88964
|
const {
|
|
89002
88965
|
container,
|
|
89003
88966
|
exporter,
|