@widergy/energy-ui 3.197.0 → 3.197.1
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 +7 -0
- package/dist/components/UTLabel/components/Markdown/components/BlockQuote/index.js +1 -1
- package/dist/components/UTLabel/components/Markdown/components/BlockQuote/styles.module.scss +0 -1
- package/dist/components/UTLabel/components/Markdown/customPlugins/remarkCitations.js +1 -1
- package/dist/esm/components/UTLabel/components/Markdown/components/BlockQuote/index.js +1 -1
- package/dist/esm/components/UTLabel/components/Markdown/components/BlockQuote/styles.module.scss +0 -1
- package/dist/esm/components/UTLabel/components/Markdown/customPlugins/remarkCitations.js +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
## [3.197.1](https://github.com/widergy/energy-ui/compare/v3.197.0...v3.197.1) (2026-11-06)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* [CH-1003] markdown fixes ([#900](https://github.com/widergy/energy-ui/issues/900)) ([883ceea](https://github.com/widergy/energy-ui/commit/883ceeac635bbb8d696000d080115cb965ca8834))
|
|
7
|
+
|
|
1
8
|
# [3.197.0](https://github.com/widergy/energy-ui/compare/v3.196.0...v3.197.0) (2026-11-03)
|
|
2
9
|
|
|
3
10
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var _react=_interopRequireWildcard(require("react")),_propTypes=require("prop-types"),_WithCustomHandler=_interopRequireDefault(require("../WithCustomHandler")),_stylesModule=_interopRequireDefault(require("./styles.module.scss"));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function _interopRequireWildcard(e,t){if("function"==typeof WeakMap)var r=new WeakMap,o=new WeakMap;return(_interopRequireWildcard=function(e,t){if(!t&&e&&e.__esModule)return e;var i,l
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var _react=_interopRequireWildcard(require("react")),_propTypes=require("prop-types"),_WithCustomHandler=_interopRequireDefault(require("../WithCustomHandler")),_stylesModule=_interopRequireDefault(require("./styles.module.scss"));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function _interopRequireWildcard(e,t){if("function"==typeof WeakMap)var r=new WeakMap,o=new WeakMap;return(_interopRequireWildcard=function(e,t){if(!t&&e&&e.__esModule)return e;var n,i,l={__proto__:null,default:e};if(null===e||"object"!=typeof e&&"function"!=typeof e)return l;if(n=t?o:r){if(n.has(e))return n.get(e);n.set(e,l)}for(const t in e)"default"!==t&&{}.hasOwnProperty.call(e,t)&&((i=(n=Object.defineProperty)&&Object.getOwnPropertyDescriptor(e,t))&&(i.get||i.set)?n(l,t,i):l[t]=e[t]);return l})(e,t)}const BREAK_TAG="br",PARAGRAPH_TAG="p",toArray=e=>Array.isArray(e)?e:[e],isBlank=e=>"string"==typeof e&&!e.trim(),trimLine=e=>{const t=[...e],r=t.length-1;return"string"==typeof t[0]&&(t[0]=t[0].trimStart()),"string"==typeof t[r]&&(t[r]=t[r].trimEnd()),t},splitIntoLines=e=>{const t=[[]];return toArray(e).forEach(e=>{if("string"==typeof e)e.split("\n").forEach((e,r)=>{r>0&&t.push([]),e&&t[t.length-1].push(e)});else if("br"===(null==e?void 0:e.type))t.push([]);else if("p"===(null==e?void 0:e.type)){var r;t.push(...splitIntoLines(null===(r=e.props)||void 0===r?void 0:r.children),[])}else e&&t[t.length-1].push(e)}),t.filter(e=>e.some(e=>!isBlank(e))).map(trimLine)},getNodeText=e=>{var t,r,o;return"string"==typeof e?e:Array.isArray(e)?e.map(getNodeText).join(""):getNodeText(null!==(t=null==e||null===(r=e.props)||void 0===r?void 0:r.children)&&void 0!==t?t:"")||(null==e||null===(o=e.props)||void 0===o?void 0:o.label)||""},withKeys=e=>{const t={};return e.map(e=>{const r=getNodeText(e);return t[r]=(t[r]||0)+1,{key:t[r]>1?"".concat(r,"-").concat(t[r]-1):r,nodes:e}})},BlockQuote=e=>{let{children:t,classes:r}=e;const o=withKeys(splitIntoLines(t));return _react.default.createElement("div",{className:"".concat(_stylesModule.default.blockquote," ").concat(null==r?void 0:r.blockquote)},o.map(e=>{let{key:t,nodes:r}=e;return _react.default.createElement("div",{key:t},r)}))};BlockQuote.propTypes={classes:(0,_propTypes.objectOf)(_propTypes.string)};var _default=exports.default=(0,_react.memo)((0,_WithCustomHandler.default)(BlockQuote));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var _unistUtilVisit=require("unist-util-visit"),_constants=require("../constants"),_default=()=>{const t=/\[([^\]]+?)†(https?:\/\/[^\]]+?)\]/g;return e=>{(0,_unistUtilVisit.visit)(e,e=>{if(![_constants.NODE_TYPES.PARAGRAPH,_constants.NODE_TYPES.HEADING,_constants.NODE_TYPES.LIST_ITEM,_constants.NODE_TYPES.
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var _unistUtilVisit=require("unist-util-visit"),_constants=require("../constants"),_default=()=>{const t=/\[([^\]]+?)†(https?:\/\/[^\]]+?)\]/g;return e=>{(0,_unistUtilVisit.visit)(e,e=>{if(![_constants.NODE_TYPES.PARAGRAPH,_constants.NODE_TYPES.HEADING,_constants.NODE_TYPES.LIST_ITEM,_constants.NODE_TYPES.TABLE_CELL].includes(e.type)||!Array.isArray(e.children))return;const{children:n}=e,s=t=>t.type===_constants.NODE_TYPES.TEXT?t.value||"":(t.type,_constants.NODE_TYPES.LINK,Array.isArray(t.children)?t.children.map(s).join(""):""),r=n.map(t=>{const e=s(t);return{node:t,text:e,length:e.length}}),o=r.map(t=>t.text).join("");if(!o.includes("†"))return;const a=[...o.matchAll(t)];if(0===a.length)return;const l=t=>{let e=0;return r.reduce((n,s,r)=>{if(n.found)return n;const o=e+s.length;return t<o?{found:!0,partIndex:r,offsetInPart:t-e}:(e=o,{found:!1,partIndex:-1,offsetInPart:-1})},{found:!1,partIndex:-1,offsetInPart:-1})},c=[];let i=0,u=0;if(a.forEach(t=>{const[e,n,s]=t,o=t.index,a=o+e.length;if(o>i){const t=l(o-1);for(let e=u;e<=t.partIndex;e+=1){const t=r[e],n=r.slice(0,e).reduce((t,e)=>t+e.length,0),s=Math.max(i-n,0),a=Math.min(o-n,t.length);if(0===s&&a===t.length)c.push(t.node);else{const e=t.text.slice(s,a);e&&c.push({type:_constants.NODE_TYPES.TEXT,value:e})}}u=t.partIndex+1}const d=l(o),h=l(a-1);if(d.partIndex>u)for(let t=u;t<d.partIndex;t+=1)c.push(r[t].node);c.push({type:_constants.COMPONENTS_NAMES.CITATION,data:{hName:_constants.COMPONENTS_NAMES.CITATION,hProperties:{label:n,url:s}}}),u=h.partIndex+1,i=a}),i<o.length){const t=l(i);if(t.found){const e=r.slice(0,t.partIndex).reduce((t,e)=>t+e.length,0),n=i-e,s=r[t.partIndex];if(n<s.length){const t=s.text.slice(n);t&&c.push({type:_constants.NODE_TYPES.TEXT,value:t})}for(let e=Math.max(u,t.partIndex+1);e<r.length;e+=1)c.push(r[e].node)}else for(let t=u;t<r.length;t+=1)c.push(r[t].node)}else for(let t=u;t<r.length;t+=1)c.push(r[t].node);const d=[];let h=0;for(;h<c.length;){const t=c[h];if(t.type===_constants.COMPONENTS_NAMES.CITATION){let e=1,n=h+1,s=h+1;for(;n<c.length;){const t=c[n];if(t.type===_constants.COMPONENTS_NAMES.CITATION)e+=1,s=n+1,n+=1;else{if(t.type!==_constants.NODE_TYPES.TEXT||""!==t.value.trim())break;n+=1}}if(e>=2){const t={type:_constants.COMPONENTS_NAMES.CITATION_GROUP,children:c.slice(h,s),data:{hName:_constants.COMPONENTS_NAMES.CITATION_GROUP}};d.push(t),h=s}else d.push(t),h+=1}else d.push(t),h+=1}d.length>0&&(e.children=d)})}};exports.default=_default;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import React,{memo}from"react";import{objectOf,string}from"prop-types";import WithCustomHandler from"../WithCustomHandler";import styles from"./styles.module.scss";const
|
|
1
|
+
import React,{memo}from"react";import{objectOf,string}from"prop-types";import WithCustomHandler from"../WithCustomHandler";import styles from"./styles.module.scss";const BREAK_TAG="br",PARAGRAPH_TAG="p",toArray=t=>Array.isArray(t)?t:[t],isBlank=t=>"string"==typeof t&&!t.trim(),trimLine=t=>{const e=[...t],o=e.length-1;return"string"==typeof e[0]&&(e[0]=e[0].trimStart()),"string"==typeof e[o]&&(e[o]=e[o].trimEnd()),e},splitIntoLines=t=>{const e=[[]];return toArray(t).forEach(t=>{if("string"==typeof t)t.split("\n").forEach((t,o)=>{o>0&&e.push([]),t&&e[e.length-1].push(t)});else if("br"===(null==t?void 0:t.type))e.push([]);else if("p"===(null==t?void 0:t.type)){var o;e.push(...splitIntoLines(null===(o=t.props)||void 0===o?void 0:o.children),[])}else t&&e[e.length-1].push(t)}),e.filter(t=>t.some(t=>!isBlank(t))).map(trimLine)},getNodeText=t=>{var e,o,r;return"string"==typeof t?t:Array.isArray(t)?t.map(getNodeText).join(""):getNodeText(null!==(e=null==t||null===(o=t.props)||void 0===o?void 0:o.children)&&void 0!==e?e:"")||(null==t||null===(r=t.props)||void 0===r?void 0:r.label)||""},withKeys=t=>{const e={};return t.map(t=>{const o=getNodeText(t);return e[o]=(e[o]||0)+1,{key:e[o]>1?"".concat(o,"-").concat(e[o]-1):o,nodes:t}})},BlockQuote=t=>{let{children:e,classes:o}=t;const r=withKeys(splitIntoLines(e));return React.createElement("div",{className:"".concat(styles.blockquote," ").concat(null==o?void 0:o.blockquote)},r.map(t=>{let{key:e,nodes:o}=t;return React.createElement("div",{key:e},o)}))};BlockQuote.propTypes={classes:objectOf(string)};export default memo(WithCustomHandler(BlockQuote));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{visit}from"unist-util-visit";import{COMPONENTS_NAMES,NODE_TYPES}from"../constants";export default()=>{const e=/\[([^\]]+?)†(https?:\/\/[^\]]+?)\]/g;return t=>{visit(t,t=>{if(![NODE_TYPES.PARAGRAPH,NODE_TYPES.HEADING,NODE_TYPES.LIST_ITEM,NODE_TYPES.
|
|
1
|
+
import{visit}from"unist-util-visit";import{COMPONENTS_NAMES,NODE_TYPES}from"../constants";export default()=>{const e=/\[([^\]]+?)†(https?:\/\/[^\]]+?)\]/g;return t=>{visit(t,t=>{if(![NODE_TYPES.PARAGRAPH,NODE_TYPES.HEADING,NODE_TYPES.LIST_ITEM,NODE_TYPES.TABLE_CELL].includes(t.type)||!Array.isArray(t.children))return;const{children:n}=t,r=e=>e.type===NODE_TYPES.TEXT?e.value||"":(e.type,NODE_TYPES.LINK,Array.isArray(e.children)?e.children.map(r).join(""):""),l=n.map(e=>{const t=r(e);return{node:e,text:t,length:t.length}}),s=l.map(e=>e.text).join("");if(!s.includes("†"))return;const o=[...s.matchAll(e)];if(0===o.length)return;const i=e=>{let t=0;return l.reduce((n,r,l)=>{if(n.found)return n;const s=t+r.length;return e<s?{found:!0,partIndex:l,offsetInPart:e-t}:(t=s,{found:!1,partIndex:-1,offsetInPart:-1})},{found:!1,partIndex:-1,offsetInPart:-1})},h=[];let E=0,a=0;if(o.forEach(e=>{const[t,n,r]=e,s=e.index,o=s+t.length;if(s>E){const e=i(s-1);for(let t=a;t<=e.partIndex;t+=1){const e=l[t],n=l.slice(0,t).reduce((e,t)=>e+t.length,0),r=Math.max(E-n,0),o=Math.min(s-n,e.length);if(0===r&&o===e.length)h.push(e.node);else{const t=e.text.slice(r,o);t&&h.push({type:NODE_TYPES.TEXT,value:t})}}a=e.partIndex+1}const N=i(s),p=i(o-1);if(N.partIndex>a)for(let e=a;e<N.partIndex;e+=1)h.push(l[e].node);h.push({type:COMPONENTS_NAMES.CITATION,data:{hName:COMPONENTS_NAMES.CITATION,hProperties:{label:n,url:r}}}),a=p.partIndex+1,E=o}),E<s.length){const e=i(E);if(e.found){const t=l.slice(0,e.partIndex).reduce((e,t)=>e+t.length,0),n=E-t,r=l[e.partIndex];if(n<r.length){const e=r.text.slice(n);e&&h.push({type:NODE_TYPES.TEXT,value:e})}for(let t=Math.max(a,e.partIndex+1);t<l.length;t+=1)h.push(l[t].node)}else for(let e=a;e<l.length;e+=1)h.push(l[e].node)}else for(let e=a;e<l.length;e+=1)h.push(l[e].node);const N=[];let p=0;for(;p<h.length;){const e=h[p];if(e.type===COMPONENTS_NAMES.CITATION){let t=1,n=p+1,r=p+1;for(;n<h.length;){const e=h[n];if(e.type===COMPONENTS_NAMES.CITATION)t+=1,r=n+1,n+=1;else{if(e.type!==NODE_TYPES.TEXT||""!==e.value.trim())break;n+=1}}if(t>=2){const e={type:COMPONENTS_NAMES.CITATION_GROUP,children:h.slice(p,r),data:{hName:COMPONENTS_NAMES.CITATION_GROUP}};N.push(e),p=r}else N.push(e),p+=1}else N.push(e),p+=1}N.length>0&&(t.children=N)})}};
|