sage-nexus-ui 1.9.2 → 1.9.3
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/_virtual/index.mjs +1 -1
- package/dist/_virtual/index2.mjs +1 -1
- package/dist/components/AgentChatWindow.mjs +1 -1
- package/dist/components/NexusChatWidget/ChatComponents/MarkdownContent.mjs +1 -1
- package/dist/components/NexusChatWidget/ChatComponents/MessageBubble.mjs +1 -1
- package/dist/components/NexusChatWidget/ChatComponents/MessageList.mjs +1 -1
- package/dist/components/NexusChatWidget/ChatComponents/StreamingBubble.mjs +1 -1
- package/dist/components/NexusChatWidget/WidgetParts/WidgetBody.mjs +1 -1
- package/dist/generated/version.mjs +1 -1
- package/dist/index.d.ts +4 -2
- package/dist/node_modules/hast-util-to-jsx-runtime/lib/index.mjs +1 -1
- package/dist/node_modules/unified/lib/index.mjs +1 -1
- package/package.json +1 -1
package/dist/_virtual/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{getDefaultExportFromCjs as e}from"./_commonjsHelpers.mjs";import{__require as
|
|
1
|
+
import{getDefaultExportFromCjs as e}from"./_commonjsHelpers.mjs";import{__require as o}from"../node_modules/style-to-js/cjs/index.mjs";var s=e(o());export{s as default};
|
package/dist/_virtual/index2.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{getDefaultExportFromCjs as e}from"./_commonjsHelpers.mjs";import{__require as
|
|
1
|
+
import{getDefaultExportFromCjs as e}from"./_commonjsHelpers.mjs";import{__require as m}from"../node_modules/extend/index.mjs";var o=e(m());export{o as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsxs as i,jsx as e}from"react/jsx-runtime";import{Box as o}from"./Box.mjs";import{Stack as t}from"./Stack.mjs";import{Caption as r}from"./Typography.mjs";import{GlassPaper as m}from"./GlassPaper.mjs";import{Paper as l}from"./Paper.mjs";import{ChatInput as n}from"./ChatInput.mjs";import"@mui/material";import"@mui/material/styles";import"../theme/tokens.mjs";import"@mui/icons-material/ChatBubbleOutlineOutlined";import"@mui/icons-material/SmartToy";import"./Code.mjs";import"
|
|
1
|
+
import{jsxs as i,jsx as e}from"react/jsx-runtime";import{Box as o}from"./Box.mjs";import{Stack as t}from"./Stack.mjs";import{Caption as r}from"./Typography.mjs";import{GlassPaper as m}from"./GlassPaper.mjs";import{Paper as l}from"./Paper.mjs";import{ChatInput as n}from"./ChatInput.mjs";import"@mui/material";import"@mui/material/styles";import"../theme/tokens.mjs";import"@mui/icons-material/ChatBubbleOutlineOutlined";import"@mui/icons-material/SmartToy";import"react";import"./Code.mjs";import"@mui/icons-material/CheckCircle";import"@mui/icons-material/ExpandMore";import"@mui/icons-material/ExpandLess";import"@mui/icons-material/OpenInNew";import"@mui/icons-material/StopCircle";import s from"./NexusChatWidget/ChatComponents/SuggestedPrompts.mjs";import"@mui/icons-material/Add";import"@mui/icons-material/Close";import"@mui/icons-material/OpenInFull";import{AgentChatWindowHeader as a}from"./AgentChatWindowHeader.mjs";const p=({title:p="Spike AI Chat",subtitle:c="Your intelligent marketing assistant",showAiChip:d=!0,headerActions:u,body:h,followUpLabel:x="Suggested follow-ups:",followUpPrompts:f,onSelectFollowUp:g,onSend:C,inputDisabled:b=!1,inputPlaceholder:y="Ask Spike anything...",sx:j})=>{const S=Boolean(f&&f.length>0&&g);return i(o,{sx:[{display:"flex",flex:1,flexDirection:"column",minWidth:0,minHeight:0,height:"100%"},...Array.isArray(j)?j:j?[j]:[]],children:[e(a,{title:p,subtitle:c,showAiChip:d,actions:u}),e(m,{sx:{borderRadius:0,border:"none",flex:1,display:"flex",flexDirection:"column",overflowY:"scroll"},children:h}),S&&i(t,{direction:{xs:"column",md:"row"},spacing:1,sx:{px:2,py:1,justifyContent:{xs:"center",sm:"flex-end"},alignItems:"center"},children:[e(r,{sx:{display:"block",mb:1},children:x}),e(s,{prompts:f??[],onSelect:g})]}),e(l,{sx:{borderRadius:0,border:"none"},children:e(o,{sx:{p:2,flexShrink:0},children:e(n,{onSend:C,disabled:b,placeholder:y})})})]})};export{p as AgentChatWindow};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as
|
|
1
|
+
import{jsx as r}from"react/jsx-runtime";import{isValidElement as e,cloneElement as o}from"react";import{Box as n}from"../../Box.mjs";import{Paper as i}from"../../Paper.mjs";import{H4 as t,H3 as l,Body1 as m}from"../../Typography.mjs";import{Code as d}from"../../Code.mjs";import{Markdown as c}from"../../../node_modules/react-markdown/lib/index.mjs";import p from"../../../node_modules/remark-gfm/lib/index.mjs";const s=(e,o)=>{const i=o?.trim();if(!i)return e;const t=new RegExp(`(${(r=>r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"))(i)})`,"ig");return e.split(t).map((e,o)=>{if(!e)return null;return e.toLowerCase()===i.toLowerCase()?r(n,{component:"mark",sx:{backgroundColor:r=>"dark"===r.palette.mode?"rgba(255, 214, 10, 0.35)":"rgba(255, 214, 10, 0.45)",color:"inherit",borderRadius:.5,px:.25,py:0},children:e},`${e}-${o}`):e})},a=(r,n)=>{if("string"==typeof r)return s(r,n);if("number"==typeof r)return s(r.toString(),n);if(Array.isArray(r))return r.map(r=>a(r,n));if(e(r)){const e=r.props.children;return void 0===e?r:o(r,void 0,a(e,n))}return r},h=({content:e,highlightQuery:o})=>{const s=r=>a(r,o);return r(c,{remarkPlugins:[p],components:{p:({children:e})=>r(m,{sx:{mb:1,"&:last-child":{mb:0}},children:s(e)}),strong:({children:e})=>r(n,{component:"strong",sx:{fontWeight:700},children:s(e)}),em:({children:e})=>r(n,{component:"em",sx:{fontStyle:"italic"},children:s(e)}),ul:({children:e})=>r(n,{component:"ul",sx:{pl:2.5,my:2,display:"grid",gap:.5,listStyleType:"disc"},children:s(e)}),ol:({children:e})=>r(n,{component:"ol",sx:{pl:2.5,my:2,display:"grid",gap:.5,listStyleType:"decimal"},children:s(e)}),li:({children:e})=>r(n,{component:"li",children:s(e)}),h1:({children:e})=>r(l,{sx:{mb:1,mt:.5},children:s(e)}),h2:({children:e})=>r(t,{sx:{mb:.5,mt:.5},children:s(e)}),h3:({children:e})=>r(t,{sx:{mb:.5,mt:.5},children:s(e)}),code:({children:e})=>r(d,{children:s(e)}),pre:({children:e})=>r(i,{component:"pre",variant:"outlined",sx:{my:2,p:1.5,overflowX:"auto",fontFamily:'"SFMono-Regular", "Consolas", "Liberation Mono", "Menlo", monospace',fontSize:"0.75rem",lineHeight:1.5,bgcolor:"action.hover"},children:s(e)}),hr:()=>r(n,{component:"hr",sx:{my:3,border:0,borderTop:1,borderColor:"divider"}})},children:e})};export{h as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsxs as
|
|
1
|
+
import{jsxs as r,jsx as e}from"react/jsx-runtime";import t from"../AgentActivity/AgentActivity.mjs";import{Box as o}from"../../Box.mjs";import n from"./ChatAvatar.mjs";import i from"./MarkdownContent.mjs";import{colours as a}from"../../../theme/tokens.mjs";const m=(r,t)=>{const n=t?.trim();if(!n)return r;const i=new RegExp(`(${(r=>r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"))(n)})`,"ig");return r.split(i).map((r,t)=>{if(!r)return null;return r.toLowerCase()===n.toLowerCase()?e(o,{component:"mark",sx:{backgroundColor:r=>"dark"===r.palette.mode?"rgba(255, 214, 10, 0.35)":"rgba(255, 214, 10, 0.45)",color:"inherit",borderRadius:.5,px:.25,py:0},children:r},`${r}-${t}`):r})},c=({message:c,highlightQuery:s,avatarIcon:l,showActivity:p=!1})=>{const d="user"===c.role;return r(o,{sx:{display:"flex",gap:1,justifyContent:d?"flex-end":"flex-start"},children:[!d&&e(n,{icon:l,sx:{mt:.25}}),r(o,{sx:{display:"flex",flexDirection:"column",gap:1},children:[e(o,{sx:{borderRadius:d?"1rem 0.25rem 1rem 1rem":"0.25rem 1rem 1rem 1rem",px:1.75,py:1.25,bgcolor:d?a.jade:"background.default",color:d?"primary.contrastText":"text.primary",border:d?"none":"1px solid",borderColor:"divider",whiteSpace:d?"pre-wrap":"normal",lineHeight:1.6},children:d?m(c.content,s):e(i,{content:c.content,highlightQuery:s})}),p&&!d&&c.traceEvents&&c.traceEvents.length>0&&e(t,{isStreaming:!1,traceEvents:c.traceEvents,latency:c.latency,activitySummary:c.activitySummary,compact:!0})]})]})};export{c as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsxs as t,jsx as e}from"react/jsx-runtime";import{useRef as r,useEffect as o}from"react";import{Box as
|
|
1
|
+
import{jsxs as t,jsx as e}from"react/jsx-runtime";import{useRef as r,useEffect as o}from"react";import{Box as i}from"../../Box.mjs";import a from"./MessageBubble.mjs";import s from"./StreamingBubble.mjs";import m from"./TypingIndicator.mjs";import{latestTraceLabel as n}from"./latestTraceLabel.mjs";const l=({messages:l,isTyping:c,streamingText:h,liveTraceEvents:g,highlightQuery:p,onAbort:f,avatarIcon:u,showActivity:v=!1})=>{const x=r(null);o(()=>{x.current?.scrollIntoView({behavior:"smooth"})},[l,c,h]);const y=(h||"").trim().length>0,b=c&&y,d=c&&!b;return t(i,{sx:{flex:1,minHeight:0,overflowY:"auto",display:"flex",flexDirection:"column",gap:1.5,px:2,py:1.5},children:[l.filter(t=>"user"===t.role||t.content).map(t=>e(a,{message:t,highlightQuery:p,avatarIcon:u,showActivity:v},t.id)),b&&e(s,{text:h||"",traceEvents:g||[],highlightQuery:p,avatarIcon:u,onAbort:f,showActivity:v}),d&&e(m,{avatarIcon:u,traceLabel:g&&g.length>0?n(g):void 0}),e(i,{ref:x})]})};export{l as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsxs as r,jsx as
|
|
1
|
+
import{jsxs as r,jsx as i}from"react/jsx-runtime";import e from"@mui/icons-material/StopCircle";import t from"../AgentActivity/AgentActivity.mjs";import{Box as o}from"../../Box.mjs";import{Stack as n}from"../../Stack.mjs";import{ButtonBase as a}from"../../ButtonBase.mjs";import{Caption as m}from"../../Typography.mjs";import s from"./ChatAvatar.mjs";import c from"./MarkdownContent.mjs";import{latestTraceLabel as l}from"./latestTraceLabel.mjs";const p=({text:p,traceEvents:d,highlightQuery:g,avatarIcon:f,onAbort:x,showActivity:y=!1})=>r(n,{direction:"row",spacing:1,sx:{justifyContent:"flex-start"},children:[i(s,{icon:f,sx:{mt:.25}}),r(n,{spacing:1,children:[p?r(o,{sx:{borderRadius:" 0.25rem 1rem 1rem 1rem",border:"1px solid",borderColor:"primary.light",bgcolor:"background.default",color:"text.primary",px:1.75,py:1.25,lineHeight:1.6},children:[i(c,{content:p,highlightQuery:g}),i(o,{sx:{display:"inline-block",height:16,bgcolor:"primary.main",verticalAlign:"text-bottom",animation:"pulse 1.2s ease-in-out infinite","@keyframes pulse":{"0%, 100%":{opacity:.35},"50%":{opacity:1}}}})]}):i(o,{sx:{borderRadius:"1rem 1rem 1rem 0.25rem",border:"1px solid",borderColor:"divider",bgcolor:"background.default",px:1.75,py:1.25},children:i(n,{direction:"row",spacing:1,sx:{alignItems:"center"},children:r(n,{direction:"row",spacing:.5,children:[" ",i(m,{children:d.length>0?`Agent is working... ${l(d)}`:"Agent is working..."}),[0,150,300].map(r=>i(o,{component:"span",sx:{bgcolor:"primary.main",animation:"bounce 1s ease-in-out infinite",animationDelay:`${r}ms`,"@keyframes bounce":{"0%, 80%, 100%":{opacity:.35,transform:"translateY(0)"},"40%":{opacity:1,transform:"translateY(-1px)"}}}},r))]})})}),y&&i(t,{isStreaming:!0,traceEvents:d,defaultExpanded:!0}),x&&r(a,{onClick:x,sx:{display:"inline-flex",alignItems:"center",gap:.5,fontSize:"0.625rem",color:"text.secondary","&:hover":{color:"error.main"},borderRadius:.5,px:.5},children:[i(e,{sx:{fontSize:11}}),"Stop generating"]})]})]});export{p as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as t}from"react/jsx-runtime";import{Box as e}from"../../Box.mjs";import"@mui/icons-material/SmartToy";import"@mui/material";import"../../../theme/tokens.mjs";import"../../Typography.mjs";import"../../Code.mjs";import"
|
|
1
|
+
import{jsx as t}from"react/jsx-runtime";import{Box as e}from"../../Box.mjs";import"@mui/icons-material/SmartToy";import"@mui/material";import"../../../theme/tokens.mjs";import"react";import"../../Typography.mjs";import"../../Code.mjs";import"@mui/icons-material/CheckCircle";import"@mui/icons-material/ExpandMore";import"@mui/icons-material/ExpandLess";import"@mui/icons-material/OpenInNew";import"@mui/material/styles";import"@mui/icons-material/StopCircle";import i from"../ChatComponents/MessageList.mjs";import o from"../ChatComponents/EmptyState.mjs";const m=({avatarIcon:m,isTyping:r,liveTraceEvents:s,messages:a,onAbort:n,showActivity:p,streamingText:c,emptyTitle:l,emptyDescription:u,dataSources:g,suggestedPrompts:y,onSend:d})=>{const x=a.length>0||r;return t(e,{sx:{flex:1,minHeight:0,display:"flex",flexDirection:"column",overflowY:"auto"},children:x?t(i,{messages:a,isTyping:r,streamingText:c,liveTraceEvents:s,onAbort:n,avatarIcon:m,showActivity:p}):t(o,{title:l,description:u,dataSources:g,prompts:y.slice(0,4),avatarIcon:m,onSelect:d})})};export{m as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const o="1.9.
|
|
1
|
+
const o="1.9.3";export{o as SAGE_NEXUS_UI_VERSION};
|
package/dist/index.d.ts
CHANGED
|
@@ -743,8 +743,9 @@ declare function NexusChatWidget({ title, subtitle, fabLabel, avatarIcon, placeh
|
|
|
743
743
|
|
|
744
744
|
interface MarkdownContentProps {
|
|
745
745
|
content: string;
|
|
746
|
+
highlightQuery?: string;
|
|
746
747
|
}
|
|
747
|
-
declare const MarkdownContent: ({ content }: MarkdownContentProps) => react_jsx_runtime.JSX.Element;
|
|
748
|
+
declare const MarkdownContent: ({ content, highlightQuery }: MarkdownContentProps) => react_jsx_runtime.JSX.Element;
|
|
748
749
|
|
|
749
750
|
interface SuggestedPromptsProps {
|
|
750
751
|
prompts: string[];
|
|
@@ -757,11 +758,12 @@ interface MessageListProps {
|
|
|
757
758
|
isTyping: boolean;
|
|
758
759
|
streamingText?: string;
|
|
759
760
|
liveTraceEvents?: TraceEvent[];
|
|
761
|
+
highlightQuery?: string;
|
|
760
762
|
onAbort?: () => void;
|
|
761
763
|
avatarIcon?: React.ReactNode;
|
|
762
764
|
showActivity?: boolean;
|
|
763
765
|
}
|
|
764
|
-
declare const MessageList: ({ messages, isTyping, streamingText, liveTraceEvents, onAbort, avatarIcon, showActivity, }: MessageListProps) => react_jsx_runtime.JSX.Element;
|
|
766
|
+
declare const MessageList: ({ messages, isTyping, streamingText, liveTraceEvents, highlightQuery, onAbort, avatarIcon, showActivity, }: MessageListProps) => react_jsx_runtime.JSX.Element;
|
|
765
767
|
|
|
766
768
|
interface EmptyStateProps {
|
|
767
769
|
title: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{stringify as e}from"../../comma-separated-tokens/index.mjs";import{ok as t}from"../../devlop/lib/default.mjs";import{svg as n,html as r}from"../../property-information/index.mjs";import{stringify as o}from"../../space-separated-tokens/index.mjs";import s from"../../../_virtual/
|
|
1
|
+
import{stringify as e}from"../../comma-separated-tokens/index.mjs";import{ok as t}from"../../devlop/lib/default.mjs";import{svg as n,html as r}from"../../property-information/index.mjs";import{stringify as o}from"../../space-separated-tokens/index.mjs";import s from"../../../_virtual/index.mjs";import{whitespace as a}from"../../hast-util-whitespace/lib/index.mjs";import{name as i}from"../../estree-util-is-identifier-name/lib/index.mjs";import{VFileMessage as l}from"../../vfile-message/lib/index.mjs";import{find as p}from"../../property-information/lib/find.mjs";import{hastToReact as c}from"../../property-information/lib/hast-to-react.mjs";import{pointStart as u}from"../../unist-util-position/lib/index.mjs";const m={}.hasOwnProperty,f=new Map,d=/[A-Z]/g,y=new Set(["table","tbody","thead","tfoot","tr"]),x=new Set(["td","th"]),v="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function h(e,t){if(!t||void 0===t.Fragment)throw new TypeError("Expected `Fragment` in options");const o=t.filePath||void 0;let s;if(t.development){if("function"!=typeof t.jsxDEV)throw new TypeError("Expected `jsxDEV` in options when `development: true`");s=function(e,t){return n;function n(n,r,o,s){const a=Array.isArray(o.children),i=u(n);return t(r,o,s,a,{columnNumber:i?i.column-1:void 0,fileName:e,lineNumber:i?i.line:void 0},void 0)}}(o,t.jsxDEV)}else{if("function"!=typeof t.jsx)throw new TypeError("Expected `jsx` in production options");if("function"!=typeof t.jsxs)throw new TypeError("Expected `jsxs` in production options");s=function(e,t,n){return r;function r(e,r,o,s){const a=Array.isArray(o.children)?n:t;return s?a(r,o,s):a(r,o)}}(0,t.jsx,t.jsxs)}const a={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:s,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:o,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:!1!==t.passKeys,passNode:t.passNode||!1,schema:"svg"===t.space?n:r,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:!1!==t.tableCellAlignToStyle},i=g(a,e,void 0);return i&&"string"!=typeof i?i:a.create(e,a.Fragment,{children:i||void 0},void 0)}function g(e,r,o){return"element"===r.type?function(e,t,r){const o=e.schema;let s=o;"svg"===t.tagName.toLowerCase()&&"html"===o.space&&(s=n,e.schema=s);e.ancestors.push(t);const i=N(e,t.tagName,!1),l=function(e,t){const n={};let r,o;for(o in t.properties)if("children"!==o&&m.call(t.properties,o)){const s=w(e,o,t.properties[o]);if(s){const[o,a]=s;e.tableCellAlignToStyle&&"align"===o&&"string"==typeof a&&x.has(t.tagName)?r=a:n[o]=a}}if(r){(n.style||(n.style={}))["css"===e.stylePropertyNameCase?"text-align":"textAlign"]=r}return n}(e,t);let p=j(e,t);y.has(t.tagName)&&(p=p.filter(function(e){return"string"!=typeof e||!a(e)}));return b(e,l,i,t),E(l,p),e.ancestors.pop(),e.schema=o,e.create(t,i,l,r)}(e,r,o):"mdxFlowExpression"===r.type||"mdxTextExpression"===r.type?function(e,n){if(n.data&&n.data.estree&&e.evaluater){const r=n.data.estree.body[0];return t("ExpressionStatement"===r.type),e.evaluater.evaluateExpression(r.expression)}A(e,n.position)}(e,r):"mdxJsxFlowElement"===r.type||"mdxJsxTextElement"===r.type?function(e,r,o){const s=e.schema;let a=s;"svg"===r.name&&"html"===s.space&&(a=n,e.schema=a);e.ancestors.push(r);const i=null===r.name?e.Fragment:N(e,r.name,!0),l=function(e,n){const r={};for(const o of n.attributes)if("mdxJsxExpressionAttribute"===o.type)if(o.data&&o.data.estree&&e.evaluater){const n=o.data.estree.body[0];t("ExpressionStatement"===n.type);const s=n.expression;t("ObjectExpression"===s.type);const a=s.properties[0];t("SpreadElement"===a.type),Object.assign(r,e.evaluater.evaluateExpression(a.argument))}else A(e,n.position);else{const s=o.name;let a;if(o.value&&"object"==typeof o.value)if(o.value.data&&o.value.data.estree&&e.evaluater){const n=o.value.data.estree.body[0];t("ExpressionStatement"===n.type),a=e.evaluater.evaluateExpression(n.expression)}else A(e,n.position);else a=null===o.value||o.value;r[s]=a}return r}(e,r),p=j(e,r);return b(e,l,i,r),E(l,p),e.ancestors.pop(),e.schema=s,e.create(r,i,l,o)}(e,r,o):"mdxjsEsm"===r.type?function(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);A(e,t.position)}(e,r):"root"===r.type?function(e,t,n){const r={};return E(r,j(e,t)),e.create(t,e.Fragment,r,n)}(e,r,o):"text"===r.type?function(e,t){return t.value}(0,r):void 0}function b(e,t,n,r){"string"!=typeof n&&n!==e.Fragment&&e.passNode&&(t.node=r)}function E(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function j(e,t){const n=[];let r=-1;const o=e.passKeys?new Map:f;for(;++r<t.children.length;){const s=t.children[r];let a;if(e.passKeys){const e="element"===s.type?s.tagName:"mdxJsxFlowElement"===s.type||"mdxJsxTextElement"===s.type?s.name:void 0;if(e){const t=o.get(e)||0;a=e+"-"+t,o.set(e,t+1)}}const i=g(e,s,a);void 0!==i&&n.push(i)}return n}function w(t,n,r){const a=p(t.schema,n);if(!(null==r||"number"==typeof r&&Number.isNaN(r))){if(Array.isArray(r)&&(r=a.commaSeparated?e(r):o(r)),"style"===a.property){let e="object"==typeof r?r:function(e,t){try{return s(t,{reactCompat:!0})}catch(t){if(e.ignoreInvalidStyle)return{};const n=t,r=new l("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:n,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw r.file=e.filePath||void 0,r.url=v+"#cannot-parse-style-attribute",r}}(t,String(r));return"css"===t.stylePropertyNameCase&&(e=function(e){const t={};let n;for(n in e)m.call(e,n)&&(t[C(n)]=e[n]);return t}(e)),["style",e]}return["react"===t.elementAttributeNameCase&&a.space?c[a.property]||a.property:a.attribute,r]}}function N(e,t,n){let r;if(n)if(t.includes(".")){const e=t.split(".");let n,o=-1;for(;++o<e.length;){const t=i(e[o])?{type:"Identifier",name:e[o]}:{type:"Literal",value:e[o]};n=n?{type:"MemberExpression",object:n,property:t,computed:Boolean(o&&"Literal"===t.type),optional:!1}:t}r=n}else r=i(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};else r={type:"Literal",value:t};if("Literal"===r.type){const t=r.value;return m.call(e.components,t)?e.components[t]:t}if(e.evaluater)return e.evaluater.evaluateExpression(r);A(e)}function A(e,t){const n=new l("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw n.file=e.filePath||void 0,n.url=v+"#cannot-handle-mdx-estrees-without-createevaluater",n}function C(e){let t=e.replace(d,S);return"ms-"===t.slice(0,3)&&(t="-"+t),t}function S(e){return"-"+e.toLowerCase()}export{h as toJsxRuntime};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{bail as e}from"../../bail/index.mjs";import t from"../../../_virtual/
|
|
1
|
+
import{bail as e}from"../../bail/index.mjs";import t from"../../../_virtual/index2.mjs";import s from"../../is-plain-obj/index.mjs";import{CallableInstance as r}from"./callable-instance.mjs";import{trough as n}from"../../trough/lib/index.mjs";import{VFile as i}from"../../vfile/lib/index.mjs";const o={}.hasOwnProperty;class c extends r{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=n()}copy(){const e=new c;let s=-1;for(;++s<this.attachers.length;){const t=this.attachers[s];e.use(...t)}return e.data(t(!0,{},this.namespace)),e}data(e,t){return"string"==typeof e?2===arguments.length?(p("data",this.frozen),this.namespace[e]=t,this):o.call(this.namespace,e)&&this.namespace[e]||void 0:e?(p("data",this.frozen),this.namespace=e,this):this.namespace}freeze(){if(this.frozen)return this;const e=this;for(;++this.freezeIndex<this.attachers.length;){const[t,...s]=this.attachers[this.freezeIndex];if(!1===s[0])continue;!0===s[0]&&(s[0]=void 0);const r=t.call(e,...s);"function"==typeof r&&this.transformers.use(r)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(e){this.freeze();const t=m(e),s=this.parser||this.Parser;return f("parse",s),s(String(t),t)}process(e,t){const s=this;return this.freeze(),f("process",this.parser||this.Parser),h("process",this.compiler||this.Compiler),t?r(void 0,t):new Promise(r);function r(r,n){const i=m(e),o=s.parse(i);function c(e,s){e||!s?n(e):r?r(s):t(void 0,s)}s.run(o,i,function(e,t,r){if(e||!t||!r)return c(e);const n=t,i=s.stringify(n,r);var o;"string"==typeof(o=i)||function(e){return Boolean(e&&"object"==typeof e&&"byteLength"in e&&"byteOffset"in e)}(o)?r.value=i:r.result=i,c(e,r)})}}processSync(t){let s,r=!1;return this.freeze(),f("processSync",this.parser||this.Parser),h("processSync",this.compiler||this.Compiler),this.process(t,function(t,n){r=!0,e(t),s=n}),l("processSync","process",r),s}run(e,t,s){u(e),this.freeze();const r=this.transformers;return s||"function"!=typeof t||(s=t,t=void 0),s?n(void 0,s):new Promise(n);function n(n,i){const o=m(t);r.run(e,o,function(t,r,o){const c=r||e;t?i(t):n?n(c):s(void 0,c,o)})}}runSync(t,s){let r,n=!1;return this.run(t,s,function(t,s){e(t),r=s,n=!0}),l("runSync","run",n),r}stringify(e,t){this.freeze();const s=m(t),r=this.compiler||this.Compiler;return h("stringify",r),u(e),r(e,s)}use(e,...r){const n=this.attachers,i=this.namespace;if(p("use",this.frozen),null==e);else if("function"==typeof e)f(e,r);else{if("object"!=typeof e)throw new TypeError("Expected usable value, not `"+e+"`");Array.isArray(e)?a(e):c(e)}return this;function o(e){if("function"==typeof e)f(e,[]);else{if("object"!=typeof e)throw new TypeError("Expected usable value, not `"+e+"`");if(Array.isArray(e)){const[t,...s]=e;f(t,s)}else c(e)}}function c(e){if(!("plugins"in e)&&!("settings"in e))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");a(e.plugins),e.settings&&(i.settings=t(!0,i.settings,e.settings))}function a(e){let t=-1;if(null==e);else{if(!Array.isArray(e))throw new TypeError("Expected a list of plugins, not `"+e+"`");for(;++t<e.length;){o(e[t])}}}function f(e,r){let i=-1,o=-1;for(;++i<n.length;)if(n[i][0]===e){o=i;break}if(-1===o)n.push([e,...r]);else if(r.length>0){let[i,...c]=r;const a=n[o][1];s(a)&&s(i)&&(i=t(!0,a,i)),n[o]=[e,i,...c]}}}}const a=(new c).freeze();function f(e,t){if("function"!=typeof t)throw new TypeError("Cannot `"+e+"` without `parser`")}function h(e,t){if("function"!=typeof t)throw new TypeError("Cannot `"+e+"` without `compiler`")}function p(e,t){if(t)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function u(e){if(!s(e)||"string"!=typeof e.type)throw new TypeError("Expected node, got `"+e+"`")}function l(e,t,s){if(!s)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function m(e){return function(e){return Boolean(e&&"object"==typeof e&&"message"in e&&"messages"in e)}(e)?e:new i(e)}export{c as Processor,a as unified};
|