@diplodoc/client 3.3.3 → 3.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +20 -0
- package/build/client/app.js +1 -1
- package/build/client/app.js.map +1 -1
- package/build/client/react.js +1 -1
- package/build/client/react.js.map +1 -1
- package/build/client/vendor.js +1 -1
- package/build/client/vendor.js.map +1 -1
- package/build/server/app.js +6 -3
- package/build/server/app.js.map +1 -1
- package/build/server/react.js +16 -2
- package/build/server/react.js.map +1 -1
- package/build/server/vendor.js +196 -24
- package/build/server/vendor.js.map +1 -1
- package/package.json +2 -1
package/build/server/vendor.js
CHANGED
|
@@ -12628,7 +12628,8 @@ function registerInlineDirective(md, name, handler) {
|
|
|
12628
12628
|
return handler(args.state, params);
|
|
12629
12629
|
};
|
|
12630
12630
|
}
|
|
12631
|
-
function registerLeafBlockDirective(md,
|
|
12631
|
+
function registerLeafBlockDirective(md, nameOrConfig, maybeHandler) {
|
|
12632
|
+
const [name, handler] = isString(nameOrConfig) ? [nameOrConfig, maybeHandler] : [nameOrConfig.name, buildLeafBlockHandler(nameOrConfig)];
|
|
12632
12633
|
md[LEAF_BLOCK_KEY] ||= {};
|
|
12633
12634
|
md[LEAF_BLOCK_KEY][name] = handler;
|
|
12634
12635
|
md.blockDirectives[name] = getBlockDefaultHandler(md, name);
|
|
@@ -12656,6 +12657,19 @@ function getBlockDefaultHandler(md, name) {
|
|
|
12656
12657
|
return false;
|
|
12657
12658
|
};
|
|
12658
12659
|
}
|
|
12660
|
+
function buildLeafBlockHandler(config) {
|
|
12661
|
+
return (state, params) => {
|
|
12662
|
+
if (!config.match(params, state)) {
|
|
12663
|
+
return false;
|
|
12664
|
+
}
|
|
12665
|
+
const { container } = config;
|
|
12666
|
+
const token = state.push(container.token, container.tag, 0);
|
|
12667
|
+
token.map = [params.startLine, params.endLine];
|
|
12668
|
+
token.markup = "::" + config.name;
|
|
12669
|
+
applyTokenFields(token, container, params, state.env);
|
|
12670
|
+
return true;
|
|
12671
|
+
};
|
|
12672
|
+
}
|
|
12659
12673
|
function buildContainerHandler(config) {
|
|
12660
12674
|
return (state, params) => {
|
|
12661
12675
|
if (!params.content) {
|
|
@@ -12671,26 +12685,17 @@ function buildContainerHandler(config) {
|
|
|
12671
12685
|
let token = state.push(container.token + "_open", container.tag, 1);
|
|
12672
12686
|
token.map = [params.startLine, params.endLine];
|
|
12673
12687
|
token.markup = ":::" + config.name;
|
|
12674
|
-
|
|
12675
|
-
const attrs = isFunction(container.attrs) ? container.attrs(params) : container.attrs;
|
|
12676
|
-
token.attrs = Object.entries(attrs);
|
|
12677
|
-
}
|
|
12688
|
+
applyTokenFields(token, container, params, state.env);
|
|
12678
12689
|
if (inlineContent) {
|
|
12679
12690
|
token = state.push(inlineContent.token + "_open", inlineContent.tag, 1);
|
|
12680
|
-
|
|
12681
|
-
const attrs = isFunction(inlineContent.attrs) ? inlineContent.attrs(params) : inlineContent.attrs;
|
|
12682
|
-
token.attrs = Object.entries(attrs);
|
|
12683
|
-
}
|
|
12691
|
+
applyTokenFields(token, inlineContent, params, state.env);
|
|
12684
12692
|
token = createBlockInlineToken(state, params);
|
|
12685
12693
|
token = state.push(inlineContent.token + "_close", inlineContent.tag, -1);
|
|
12686
12694
|
}
|
|
12687
12695
|
if (content) {
|
|
12688
12696
|
token = state.push(content.token + "_open", content.tag, 1);
|
|
12689
12697
|
token.map = [params.startLine + 1, params.endLine - 1];
|
|
12690
|
-
|
|
12691
|
-
const attrs = isFunction(content.attrs) ? content.attrs(params) : content.attrs;
|
|
12692
|
-
token.attrs = Object.entries(attrs);
|
|
12693
|
-
}
|
|
12698
|
+
applyTokenFields(token, content, params, state.env);
|
|
12694
12699
|
}
|
|
12695
12700
|
if (contentTokenizer) {
|
|
12696
12701
|
contentTokenizer(state, params.content, params);
|
|
@@ -12718,10 +12723,7 @@ function buildCodeContainerHandler(config) {
|
|
|
12718
12723
|
token.content = params.content.raw;
|
|
12719
12724
|
token.markup = ":::";
|
|
12720
12725
|
token.info = name;
|
|
12721
|
-
|
|
12722
|
-
const attrs = isFunction(container.attrs) ? container.attrs(params) : container.attrs;
|
|
12723
|
-
token.attrs = Object.entries(attrs);
|
|
12724
|
-
}
|
|
12726
|
+
applyTokenFields(token, container, params, state.env);
|
|
12725
12727
|
return true;
|
|
12726
12728
|
};
|
|
12727
12729
|
}
|
|
@@ -12788,6 +12790,16 @@ function buildDests(orig) {
|
|
|
12788
12790
|
}
|
|
12789
12791
|
return dests;
|
|
12790
12792
|
}
|
|
12793
|
+
function applyTokenFields(token, { attrs, meta }, params, env) {
|
|
12794
|
+
if (attrs !== void 0) {
|
|
12795
|
+
const value = isFunction(attrs) ? attrs(params, env) : attrs;
|
|
12796
|
+
token.attrs = Object.entries(value);
|
|
12797
|
+
}
|
|
12798
|
+
if (meta !== void 0) {
|
|
12799
|
+
const value = isFunction(meta) ? meta(params, env) : meta;
|
|
12800
|
+
token.meta = value;
|
|
12801
|
+
}
|
|
12802
|
+
}
|
|
12791
12803
|
|
|
12792
12804
|
// src/index.ts
|
|
12793
12805
|
var directiveParser = () => {
|
|
@@ -13646,6 +13658,25 @@ bem-cn/lib/index.js:
|
|
|
13646
13658
|
//# sourceMappingURL=index.min.js.map
|
|
13647
13659
|
|
|
13648
13660
|
|
|
13661
|
+
/***/ }),
|
|
13662
|
+
|
|
13663
|
+
/***/ 81452:
|
|
13664
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
13665
|
+
|
|
13666
|
+
"use strict";
|
|
13667
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
13668
|
+
/* harmony export */ UQ: () => (/* binding */ rg)
|
|
13669
|
+
/* harmony export */ });
|
|
13670
|
+
/* unused harmony exports usePageConstructor, usePageConstructorController */
|
|
13671
|
+
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(96540);
|
|
13672
|
+
/* harmony import */ var react_dom_client__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(5338);
|
|
13673
|
+
/* harmony import */ var _gravity_ui_page_constructor__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(47658);
|
|
13674
|
+
/* harmony import */ var _gravity_ui_page_constructor__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(95168);
|
|
13675
|
+
/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(74848);
|
|
13676
|
+
var x=Object.defineProperty;var C=(I,g)=>x(I,"name",{value:g,configurable:!0});var p=C((I,g,A)=>new Promise((t,c)=>{var b=C(l=>{try{i(A.next(l))}catch(e){c(e)}},"fulfilled"),G=C(l=>{try{i(A.throw(l))}catch(e){c(e)}},"rejected"),i=C(l=>l.done?t(l.value):Promise.resolve(l.value).then(b,G),"step");i((A=A.apply(I,g)).next())}),"__async"),R,Y,k,v,f,V,L;R=new WeakMap;Y=new WeakMap;k=new WeakMap;v=new WeakMap;f=new WeakMap;V=new WeakMap;L=new WeakMap;var W=C(()=>typeof window<"u"&&typeof window.document<"u","isBrowser"),o=Symbol.for("extension-load-queues"),J=Symbol.for("single-queue"),u=C(I=>{if(W()){if(!window[I])window[I]=[];else if(!Array.isArray(window[I]))throw new Error(`Expected window[${String(I)}] to be an array`);return window[I]}else throw new Error("Cannot initialize QueueStore in a non-browser environment.")},"getScriptStore"),Z=C(()=>{if(W())(typeof window[o]!="object"||window[o]===null)&&(window[o]={});else throw new Error("Cannot initialize QueueStore in a non-browser environment.")},"ensureQueuesSymbolInitialized"),N=C(I=>{var g;return Z(),((g=window[o])==null?void 0:g[I])||!1},"getQueueStore"),H=C(I=>(Z(),g=>{window[o][I]=g}),"createHandleQueueCreated"),s=C(({store:I,createController:g,queueKey:A=J,isQueueCreated:t=N(A),onQueueCreated:c=H(A)})=>{if(!I||t)return;c(!0);let b=g(),G=I.splice(0,I.length);I.push=function(...n){return n.forEach(h=>{G.push(h),l()}),G.length};let i=!1;function l(){i||e()}C(l,"unqueue");function e(){return p(this,null,function*(){i=!0;let n=G.shift();if(n)return yield n(b),e();i=!1})}C(e,"next"),l()},"createLoadQueue");function r(I,g){return (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)(_gravity_ui_page_constructor__WEBPACK_IMPORTED_MODULE_3__/* .PageConstructorProvider */ .Z,{ssrConfig:{isServer:g===void 0?typeof window>"u"&&typeof global<"u":g},children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)(_gravity_ui_page_constructor__WEBPACK_IMPORTED_MODULE_4__/* .PageConstructor */ .i,{content:I})})}C(r,"createPageConstructorElement");var B={PageConstructor:"yfm-page-constructor"};var a=Symbol.for("page-constructor-store"),z=Symbol.for("page-constructor-queue"),d=class{static{C(this,"PageConstructorController")}renderContainer(g){try{let A=g.getAttribute("data-hydrated")==="true",t=g.getAttribute("data-rendered")==="true";if(A||t)return;let c=g.getAttribute("data-content-encoded");if(!c)return;let b=decodeURIComponent(c),G=JSON.parse(b);!A&&g.innerHTML.trim()!==""?((0,react_dom_client__WEBPACK_IMPORTED_MODULE_1__/* .hydrateRoot */ .c)(g,r(G,!1)),g.setAttribute("data-hydrated","true")):t||((0,react_dom_client__WEBPACK_IMPORTED_MODULE_1__/* .createRoot */ .H)(g).render(r(G,!1)),g.setAttribute("data-rendered","true"))}catch(A){console.error("Failed to render component:",A)}}getContainers(){return typeof document>"u"?[]:Array.from(document.querySelectorAll(`.${B.PageConstructor}`))}render(){this.getContainers().forEach(A=>this.renderContainer(A))}},X={render:C(()=>{u(a).push(g=>{g.render()})},"render")};if(typeof document<"u"){let I=u(a);s({store:I,createController:C(()=>{let g=new d;return document.readyState==="complete"||document.readyState==="interactive"?g.render():document.addEventListener("DOMContentLoaded",()=>{g.render()}),g},"createController"),queueKey:z})}function D(I){let[g,A]=(0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(null);return (0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(()=>{let t=u(I),c=C(b=>{A(b)},"callback");return t.push(c),()=>{let b=t.indexOf(c);b>-1&&t.splice(b,1)}},[I]),g}C(D,"useController");function ng(){return D(a)}C(ng,"usePageConstructorController");function ag(){return (0,react__WEBPACK_IMPORTED_MODULE_0__.useCallback)(()=>{X.render()},[])}C(ag,"usePageConstructor");function rg(){return (0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(()=>{X.render()},[]),null}C(rg,"PageConstructorRuntime");
|
|
13677
|
+
//# sourceMappingURL=index.js.map
|
|
13678
|
+
|
|
13679
|
+
|
|
13649
13680
|
/***/ }),
|
|
13650
13681
|
|
|
13651
13682
|
/***/ 26269:
|
|
@@ -20470,7 +20501,8 @@ __export(common_exports, {
|
|
|
20470
20501
|
createLoadQueue: () => createLoadQueue,
|
|
20471
20502
|
getQueueStore: () => getQueueStore,
|
|
20472
20503
|
getScriptStore: () => getScriptStore,
|
|
20473
|
-
isBrowser: () => isBrowser
|
|
20504
|
+
isBrowser: () => isBrowser,
|
|
20505
|
+
parseMdAttrs: () => parseMdAttrs
|
|
20474
20506
|
});
|
|
20475
20507
|
module.exports = __toCommonJS(common_exports);
|
|
20476
20508
|
|
|
@@ -20645,6 +20677,140 @@ _currentKeyType = new WeakMap();
|
|
|
20645
20677
|
_selectors = new WeakMap();
|
|
20646
20678
|
_handlers = new WeakMap();
|
|
20647
20679
|
|
|
20680
|
+
// src/lib/common/parse-md-attrs.ts
|
|
20681
|
+
function parseMdAttrs(md, src, pos, max) {
|
|
20682
|
+
if (pos >= max) {
|
|
20683
|
+
return null;
|
|
20684
|
+
}
|
|
20685
|
+
if (src.charCodeAt(pos) !== 123) {
|
|
20686
|
+
return null;
|
|
20687
|
+
}
|
|
20688
|
+
const attrs = {};
|
|
20689
|
+
++pos;
|
|
20690
|
+
pos = skipBlanks(src, pos, max);
|
|
20691
|
+
for (; pos < max; pos = skipBlanks(src, pos, max)) {
|
|
20692
|
+
if (src.charCodeAt(pos) === 125) {
|
|
20693
|
+
++pos;
|
|
20694
|
+
return { pos, attrs };
|
|
20695
|
+
}
|
|
20696
|
+
const c = src.charCodeAt(pos);
|
|
20697
|
+
if (c === 35) {
|
|
20698
|
+
++pos;
|
|
20699
|
+
const rst = parseUnsurroundedName(src, pos, max);
|
|
20700
|
+
if (rst === null) {
|
|
20701
|
+
return null;
|
|
20702
|
+
}
|
|
20703
|
+
pos = rst.pos;
|
|
20704
|
+
const key = "id", value = rst.name;
|
|
20705
|
+
if (typeof attrs[key] === "undefined") {
|
|
20706
|
+
attrs[key] = [value];
|
|
20707
|
+
} else {
|
|
20708
|
+
attrs[key].push(value);
|
|
20709
|
+
}
|
|
20710
|
+
} else if (c === 46) {
|
|
20711
|
+
++pos;
|
|
20712
|
+
const rst = parseUnsurroundedName(src, pos, max);
|
|
20713
|
+
if (rst === null) {
|
|
20714
|
+
return null;
|
|
20715
|
+
}
|
|
20716
|
+
pos = rst.pos;
|
|
20717
|
+
const key = "class", value = rst.name;
|
|
20718
|
+
if (typeof attrs[key] === "undefined") {
|
|
20719
|
+
attrs[key] = [value];
|
|
20720
|
+
} else {
|
|
20721
|
+
attrs[key].push(value);
|
|
20722
|
+
}
|
|
20723
|
+
} else {
|
|
20724
|
+
let rst = parseAttrName(src, pos, max);
|
|
20725
|
+
if (rst === null) {
|
|
20726
|
+
return null;
|
|
20727
|
+
}
|
|
20728
|
+
const key = rst.name;
|
|
20729
|
+
pos = rst.pos;
|
|
20730
|
+
pos = skipBlanks(src, pos, max);
|
|
20731
|
+
if (pos >= max) {
|
|
20732
|
+
return null;
|
|
20733
|
+
}
|
|
20734
|
+
let value;
|
|
20735
|
+
if (src.charCodeAt(pos) === 61) {
|
|
20736
|
+
++pos;
|
|
20737
|
+
pos = skipBlanks(src, pos, max);
|
|
20738
|
+
if (pos >= max) {
|
|
20739
|
+
return null;
|
|
20740
|
+
}
|
|
20741
|
+
const c2 = src.charCodeAt(pos);
|
|
20742
|
+
if (c2 === 34 || c2 === 39) {
|
|
20743
|
+
const rst2 = md.helpers.parseLinkTitle(src, pos, max);
|
|
20744
|
+
if (!rst2.ok) {
|
|
20745
|
+
return null;
|
|
20746
|
+
}
|
|
20747
|
+
value = rst2.str;
|
|
20748
|
+
pos = rst2.pos;
|
|
20749
|
+
} else {
|
|
20750
|
+
rst = parseUnsurroundedName(src, pos, max);
|
|
20751
|
+
if (rst === null) {
|
|
20752
|
+
return null;
|
|
20753
|
+
}
|
|
20754
|
+
value = rst.name;
|
|
20755
|
+
pos = rst.pos;
|
|
20756
|
+
}
|
|
20757
|
+
} else {
|
|
20758
|
+
if (isBlank(src.charCodeAt(pos - 1))) {
|
|
20759
|
+
--pos;
|
|
20760
|
+
}
|
|
20761
|
+
value = "";
|
|
20762
|
+
}
|
|
20763
|
+
if (typeof value !== "undefined") {
|
|
20764
|
+
if (typeof attrs[key] === "undefined") {
|
|
20765
|
+
attrs[key] = [value];
|
|
20766
|
+
} else {
|
|
20767
|
+
attrs[key].push(value);
|
|
20768
|
+
}
|
|
20769
|
+
}
|
|
20770
|
+
}
|
|
20771
|
+
if (pos >= max) {
|
|
20772
|
+
return null;
|
|
20773
|
+
}
|
|
20774
|
+
const charBetween = src.charCodeAt(pos);
|
|
20775
|
+
if (!isBlank(charBetween) && charBetween !== 125) {
|
|
20776
|
+
return null;
|
|
20777
|
+
}
|
|
20778
|
+
}
|
|
20779
|
+
return null;
|
|
20780
|
+
function isBlank(code) {
|
|
20781
|
+
return md.utils.isSpace(code) || code === 10;
|
|
20782
|
+
}
|
|
20783
|
+
function skipBlanks(src2, pos2, max2) {
|
|
20784
|
+
for (; pos2 < max2; pos2++) {
|
|
20785
|
+
const code = src2.charCodeAt(pos2);
|
|
20786
|
+
if (!isBlank(code)) {
|
|
20787
|
+
break;
|
|
20788
|
+
}
|
|
20789
|
+
}
|
|
20790
|
+
return pos2;
|
|
20791
|
+
}
|
|
20792
|
+
}
|
|
20793
|
+
var ATTR_NAME_RE = /^[a-z][a-z0-9\-_]*/;
|
|
20794
|
+
function parseAttrName(src, pos, max) {
|
|
20795
|
+
const oldPos = pos;
|
|
20796
|
+
const rst = src.slice(pos, max).match(ATTR_NAME_RE);
|
|
20797
|
+
if (rst === null) {
|
|
20798
|
+
return null;
|
|
20799
|
+
}
|
|
20800
|
+
pos += rst[0].length;
|
|
20801
|
+
return { pos, name: src.slice(oldPos, pos) };
|
|
20802
|
+
}
|
|
20803
|
+
var UNSURROUNDED_STRING_RE = /^[a-z0-9\-_]+/i;
|
|
20804
|
+
function parseUnsurroundedName(src, pos, max) {
|
|
20805
|
+
const oldPos = pos;
|
|
20806
|
+
const rst = src.slice(pos, max).match(UNSURROUNDED_STRING_RE);
|
|
20807
|
+
if (rst === null) {
|
|
20808
|
+
return null;
|
|
20809
|
+
}
|
|
20810
|
+
pos += rst[0].length;
|
|
20811
|
+
return { pos, name: src.slice(oldPos, pos) };
|
|
20812
|
+
}
|
|
20813
|
+
|
|
20648
20814
|
// src/lib/common/browser.ts
|
|
20649
20815
|
var isBrowser = () => {
|
|
20650
20816
|
return typeof window !== "undefined" && typeof window.document !== "undefined";
|
|
@@ -105490,12 +105656,18 @@ function findNextLine(src, startLine, endLine, state) {
|
|
|
105490
105656
|
const max = state.eMarks[line];
|
|
105491
105657
|
let pos = state.bMarks[line] + state.tShift[line];
|
|
105492
105658
|
let pos2 = state.skipChars(pos, 0x3A);
|
|
105493
|
-
|
|
105494
|
-
|
|
105495
|
-
|
|
105496
|
-
|
|
105497
|
-
|
|
105498
|
-
|
|
105659
|
+
let colonsCount = pos2 - pos;
|
|
105660
|
+
|
|
105661
|
+
if (colonsCount >= 3) {
|
|
105662
|
+
pos2 = skipBlanks(src, pos2, max);
|
|
105663
|
+
if (pos2 === max) {
|
|
105664
|
+
--level; // close mark
|
|
105665
|
+
continue;
|
|
105666
|
+
}
|
|
105667
|
+
}
|
|
105668
|
+
|
|
105669
|
+
// if it's an opening marker, increase nesting level
|
|
105670
|
+
if (colonsCount >= 3 && pos2 < max) {
|
|
105499
105671
|
++level;
|
|
105500
105672
|
}
|
|
105501
105673
|
}
|