@yuhuanowo/yunui 0.2.16 → 0.2.18
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/README.md +13 -2
- package/README.zh-CN.md +14 -1
- package/README.zh-TW.md +14 -1
- package/dist/ai.d.ts +191 -7
- package/dist/ai.js +662 -168
- package/dist/ai.js.map +1 -1
- package/dist/chat.d.ts +31 -5
- package/dist/chat.js +71 -13
- package/dist/chat.js.map +1 -1
- package/dist/{chunk-5E3O6ANF.js → chunk-AFVENY4D.js} +386 -74
- package/dist/chunk-AFVENY4D.js.map +1 -0
- package/dist/{chunk-GSPJ5YI6.js → chunk-GAXVET76.js} +36 -24
- package/dist/chunk-GAXVET76.js.map +1 -0
- package/dist/{chunk-UYYG4XDW.js → chunk-LEBQPP4B.js} +80 -7
- package/dist/chunk-LEBQPP4B.js.map +1 -0
- package/dist/chunk-ST6TSBVQ.js +208 -0
- package/dist/chunk-ST6TSBVQ.js.map +1 -0
- package/dist/chunk-V7VJKZ5Q.js +254 -0
- package/dist/chunk-V7VJKZ5Q.js.map +1 -0
- package/dist/{chunk-5TOGZTAO.js → chunk-YKWRCA2S.js} +184 -208
- package/dist/chunk-YKWRCA2S.js.map +1 -0
- package/dist/content.d.ts +48 -6
- package/dist/content.js +233 -49
- package/dist/content.js.map +1 -1
- package/dist/index.d.ts +319 -22
- package/dist/index.js +4 -4
- package/dist/patterns.d.ts +557 -25
- package/dist/patterns.js +1076 -186
- package/dist/patterns.js.map +1 -1
- package/icons/apps/aistudio.webp +0 -0
- package/icons/apps/application.png +0 -0
- package/icons/apps/baixiaoying.webp +0 -0
- package/icons/apps/coze.webp +0 -0
- package/icons/apps/dify.webp +0 -0
- package/icons/apps/doubao.webp +0 -0
- package/icons/apps/flowith.webp +0 -0
- package/icons/apps/gemini.webp +0 -0
- package/icons/apps/github-copilot.webp +0 -0
- package/icons/apps/google.webp +0 -0
- package/icons/apps/grok.webp +0 -0
- package/icons/apps/kimi.webp +0 -0
- package/icons/apps/longcat.webp +0 -0
- package/icons/apps/metaso.webp +0 -0
- package/icons/apps/monica.webp +0 -0
- package/icons/apps/n8n.webp +0 -0
- package/icons/apps/nm-search.webp +0 -0
- package/icons/apps/notebooklm.webp +0 -0
- package/icons/apps/perplexity.webp +0 -0
- package/icons/apps/poe.webp +0 -0
- package/icons/apps/qingyan.webp +0 -0
- package/icons/apps/stepfun.webp +0 -0
- package/icons/apps/tiangong.webp +0 -0
- package/icons/apps/xiaoyi.webp +0 -0
- package/icons/apps/yuanbao.webp +0 -0
- package/icons/apps/zai.webp +0 -0
- package/icons/models/ai21.webp +0 -0
- package/icons/models/aimass.webp +0 -0
- package/icons/models/anthropic.webp +0 -0
- package/icons/models/baichuan.webp +0 -0
- package/icons/models/byte_dance.webp +0 -0
- package/icons/models/chatglm.webp +0 -0
- package/icons/models/claude.webp +0 -0
- package/icons/models/codegeex.webp +0 -0
- package/icons/models/cogview3flash.webp +0 -0
- package/icons/models/cohere.webp +0 -0
- package/icons/models/copilot.webp +0 -0
- package/icons/models/dalle.webp +0 -0
- package/icons/models/dbrx.webp +0 -0
- package/icons/models/deepseek.webp +0 -0
- package/icons/models/doubao.webp +0 -0
- package/icons/models/flux.webp +0 -0
- package/icons/models/gemini.webp +0 -0
- package/icons/models/gemma.webp +0 -0
- package/icons/models/google.webp +0 -0
- package/icons/models/grok.webp +0 -0
- package/icons/models/hailuo.webp +0 -0
- package/icons/models/huggingface.webp +0 -0
- package/icons/models/hunyuan.webp +0 -0
- package/icons/models/ibm.webp +0 -0
- package/icons/models/ideogram.webp +0 -0
- package/icons/models/internlm.webp +0 -0
- package/icons/models/jina.webp +0 -0
- package/icons/models/llava.webp +0 -0
- package/icons/models/luma.webp +0 -0
- package/icons/models/magic.webp +0 -0
- package/icons/models/microsoft.webp +0 -0
- package/icons/models/midjourney.webp +0 -0
- package/icons/models/minimax.webp +0 -0
- package/icons/models/mistral.webp +0 -0
- package/icons/models/moonshot.webp +0 -0
- package/icons/models/nousresearch.webp +0 -0
- package/icons/models/nvidia.webp +0 -0
- package/icons/models/o3.webp +0 -0
- package/icons/models/openai.webp +0 -0
- package/icons/models/palm.webp +0 -0
- package/icons/models/perplexity.webp +0 -0
- package/icons/models/qwen.webp +0 -0
- package/icons/models/stability.webp +0 -0
- package/icons/models/step.webp +0 -0
- package/icons/models/suno.webp +0 -0
- package/icons/models/upstage.webp +0 -0
- package/icons/models/vidu.webp +0 -0
- package/icons/models/volcengine.webp +0 -0
- package/icons/models/voyageai.webp +0 -0
- package/icons/models/wenxin.webp +0 -0
- package/icons/models/xirang.png +0 -0
- package/icons/models/xirang_dark.png +0 -0
- package/icons/models/yi.webp +0 -0
- package/icons/models/zai.webp +0 -0
- package/icons/models/zero-one.webp +0 -0
- package/icons/models/zhipu.webp +0 -0
- package/icons/providers/302ai.webp +0 -0
- package/icons/providers/DMXAPI-to-img.webp +0 -0
- package/icons/providers/Tesseract.js.png +0 -0
- package/icons/providers/ace.webp +0 -0
- package/icons/providers/adobe.webp +0 -0
- package/icons/providers/adobefirefly.webp +0 -0
- package/icons/providers/agentvoice.webp +0 -0
- package/icons/providers/agui.webp +0 -0
- package/icons/providers/ai2.webp +0 -0
- package/icons/providers/ai21.webp +0 -0
- package/icons/providers/ai302.webp +0 -0
- package/icons/providers/ai360.webp +0 -0
- package/icons/providers/aiOnly.webp +0 -0
- package/icons/providers/aihubmix.webp +0 -0
- package/icons/providers/aimass.webp +0 -0
- package/icons/providers/aionlabs.webp +0 -0
- package/icons/providers/airjelly.webp +0 -0
- package/icons/providers/aistudio.webp +0 -0
- package/icons/providers/akashchat.webp +0 -0
- package/icons/providers/alephalpha.webp +0 -0
- package/icons/providers/alibaba.webp +0 -0
- package/icons/providers/alibabacloud.webp +0 -0
- package/icons/providers/amp.webp +0 -0
- package/icons/providers/antgroup.webp +0 -0
- package/icons/providers/anthropic.webp +0 -0
- package/icons/providers/antigravity.webp +0 -0
- package/icons/providers/anyscale.webp +0 -0
- package/icons/providers/apertis.webp +0 -0
- package/icons/providers/apple.webp +0 -0
- package/icons/providers/arcee.webp +0 -0
- package/icons/providers/askverdict.webp +0 -0
- package/icons/providers/assemblyai.webp +0 -0
- package/icons/providers/atlascloud.webp +0 -0
- package/icons/providers/automatic.webp +0 -0
- package/icons/providers/aws-bedrock.webp +0 -0
- package/icons/providers/aws.webp +0 -0
- package/icons/providers/aya.webp +0 -0
- package/icons/providers/azure.webp +0 -0
- package/icons/providers/azureai.webp +0 -0
- package/icons/providers/baai.webp +0 -0
- package/icons/providers/baichuan.webp +0 -0
- package/icons/providers/baidu-cloud.webp +0 -0
- package/icons/providers/baidu.webp +0 -0
- package/icons/providers/baiducloud.webp +0 -0
- package/icons/providers/bailian.webp +0 -0
- package/icons/providers/baseten.webp +0 -0
- package/icons/providers/bedrock.webp +0 -0
- package/icons/providers/bfl.webp +0 -0
- package/icons/providers/bigModel.webp +0 -0
- package/icons/providers/bilibili.webp +0 -0
- package/icons/providers/bilibiliindex.webp +0 -0
- package/icons/providers/bing.webp +0 -0
- package/icons/providers/briaai.webp +0 -0
- package/icons/providers/burncloud.webp +0 -0
- package/icons/providers/bytedance.webp +0 -0
- package/icons/providers/capcut.webp +0 -0
- package/icons/providers/centml.webp +0 -0
- package/icons/providers/cephalon.jpeg +0 -0
- package/icons/providers/cerebras.webp +0 -0
- package/icons/providers/chatglm.webp +0 -0
- package/icons/providers/cherryin.png +0 -0
- package/icons/providers/cherrystudio.webp +0 -0
- package/icons/providers/civitai.webp +0 -0
- package/icons/providers/claude.webp +0 -0
- package/icons/providers/claudecode.webp +0 -0
- package/icons/providers/cline.webp +0 -0
- package/icons/providers/clipdrop.webp +0 -0
- package/icons/providers/cloudflare.webp +0 -0
- package/icons/providers/codebuddy.webp +0 -0
- package/icons/providers/codeflicker.webp +0 -0
- package/icons/providers/codegeex.webp +0 -0
- package/icons/providers/codex.webp +0 -0
- package/icons/providers/cogvideo.webp +0 -0
- package/icons/providers/cogview.webp +0 -0
- package/icons/providers/cogview3flash.webp +0 -0
- package/icons/providers/cohere.webp +0 -0
- package/icons/providers/colab.webp +0 -0
- package/icons/providers/cometapi.webp +0 -0
- package/icons/providers/comfyui.webp +0 -0
- package/icons/providers/commanda.webp +0 -0
- package/icons/providers/copilot.webp +0 -0
- package/icons/providers/copilotkit.webp +0 -0
- package/icons/providers/coqui.webp +0 -0
- package/icons/providers/coze.webp +0 -0
- package/icons/providers/crewai.webp +0 -0
- package/icons/providers/crusoe.webp +0 -0
- package/icons/providers/cursor.webp +0 -0
- package/icons/providers/cybercut.webp +0 -0
- package/icons/providers/dalle.webp +0 -0
- package/icons/providers/dbrx.webp +0 -0
- package/icons/providers/deepai.webp +0 -0
- package/icons/providers/deepcogito.webp +0 -0
- package/icons/providers/deepinfra.webp +0 -0
- package/icons/providers/deepl.webp +0 -0
- package/icons/providers/deepmind.webp +0 -0
- package/icons/providers/deepseek.webp +0 -0
- package/icons/providers/devin.webp +0 -0
- package/icons/providers/dify.webp +0 -0
- package/icons/providers/dmxapi-logo-dark.webp +0 -0
- package/icons/providers/dmxapi-logo.webp +0 -0
- package/icons/providers/doc2x.webp +0 -0
- package/icons/providers/docsearch.webp +0 -0
- package/icons/providers/dolphin.webp +0 -0
- package/icons/providers/doubao.webp +0 -0
- package/icons/providers/dreammachine.webp +0 -0
- package/icons/providers/elevenlabs.webp +0 -0
- package/icons/providers/elevenx.webp +0 -0
- package/icons/providers/essentialai.webp +0 -0
- package/icons/providers/exa.webp +0 -0
- package/icons/providers/fal.webp +0 -0
- package/icons/providers/fastgpt.webp +0 -0
- package/icons/providers/featherless.webp +0 -0
- package/icons/providers/figma.webp +0 -0
- package/icons/providers/fireworks.webp +0 -0
- package/icons/providers/fishaudio.webp +0 -0
- package/icons/providers/flora.webp +0 -0
- package/icons/providers/flowith.webp +0 -0
- package/icons/providers/flux.webp +0 -0
- package/icons/providers/friendli.webp +0 -0
- package/icons/providers/gemini.webp +0 -0
- package/icons/providers/geminicli.webp +0 -0
- package/icons/providers/gemma.webp +0 -0
- package/icons/providers/gitee-ai.webp +0 -0
- package/icons/providers/giteeai.webp +0 -0
- package/icons/providers/github.webp +0 -0
- package/icons/providers/githubcopilot.webp +0 -0
- package/icons/providers/glama.webp +0 -0
- package/icons/providers/glif.webp +0 -0
- package/icons/providers/glmv.webp +0 -0
- package/icons/providers/gmi.svg +5 -0
- package/icons/providers/google.webp +0 -0
- package/icons/providers/googlecloud.webp +0 -0
- package/icons/providers/goose.webp +0 -0
- package/icons/providers/gradio.webp +0 -0
- package/icons/providers/greptile.webp +0 -0
- package/icons/providers/grok.webp +0 -0
- package/icons/providers/groq.webp +0 -0
- package/icons/providers/hailuo.webp +0 -0
- package/icons/providers/haiper.webp +0 -0
- package/icons/providers/hedra.webp +0 -0
- package/icons/providers/hermesagent.webp +0 -0
- package/icons/providers/higress.webp +0 -0
- package/icons/providers/huawei.webp +0 -0
- package/icons/providers/huaweicloud.webp +0 -0
- package/icons/providers/huggingface.webp +0 -0
- package/icons/providers/hunyuan.webp +0 -0
- package/icons/providers/hyperbolic.webp +0 -0
- package/icons/providers/ibm.webp +0 -0
- package/icons/providers/ideogram.webp +0 -0
- package/icons/providers/iflytekcloud.webp +0 -0
- package/icons/providers/inception.webp +0 -0
- package/icons/providers/inference.webp +0 -0
- package/icons/providers/infermatic.webp +0 -0
- package/icons/providers/infini.webp +0 -0
- package/icons/providers/infinigence.webp +0 -0
- package/icons/providers/inflection.webp +0 -0
- package/icons/providers/internlm.webp +0 -0
- package/icons/providers/jimeng.webp +0 -0
- package/icons/providers/jina.webp +0 -0
- package/icons/providers/junie.webp +0 -0
- package/icons/providers/kilocode.webp +0 -0
- package/icons/providers/kimi.webp +0 -0
- package/icons/providers/kiro.webp +0 -0
- package/icons/providers/kling.webp +0 -0
- package/icons/providers/kluster.webp +0 -0
- package/icons/providers/kolors.webp +0 -0
- package/icons/providers/krea.webp +0 -0
- package/icons/providers/kwaikat.webp +0 -0
- package/icons/providers/kwaipilot.webp +0 -0
- package/icons/providers/lambda.webp +0 -0
- package/icons/providers/langchain.webp +0 -0
- package/icons/providers/langfuse.webp +0 -0
- package/icons/providers/langgraph.webp +0 -0
- package/icons/providers/langsmith.webp +0 -0
- package/icons/providers/leptonai.webp +0 -0
- package/icons/providers/lg.webp +0 -0
- package/icons/providers/lightricks.webp +0 -0
- package/icons/providers/liquid.webp +0 -0
- package/icons/providers/livekit.webp +0 -0
- package/icons/providers/llamaindex.webp +0 -0
- package/icons/providers/llava.webp +0 -0
- package/icons/providers/llmapi.webp +0 -0
- package/icons/providers/lmstudio.webp +0 -0
- package/icons/providers/lobehub.webp +0 -0
- package/icons/providers/longcat.webp +0 -0
- package/icons/providers/lovable.webp +0 -0
- package/icons/providers/lovart.webp +0 -0
- package/icons/providers/luma.webp +0 -0
- package/icons/providers/magic.webp +0 -0
- package/icons/providers/make.webp +0 -0
- package/icons/providers/manus.webp +0 -0
- package/icons/providers/mastra.webp +0 -0
- package/icons/providers/mcp.webp +0 -0
- package/icons/providers/mcpso.webp +0 -0
- package/icons/providers/menlo.webp +0 -0
- package/icons/providers/meshy.webp +0 -0
- package/icons/providers/meta.webp +0 -0
- package/icons/providers/metaai.webp +0 -0
- package/icons/providers/metagpt.webp +0 -0
- package/icons/providers/microsoft.webp +0 -0
- package/icons/providers/midjourney.webp +0 -0
- package/icons/providers/minimax.webp +0 -0
- package/icons/providers/mistral.webp +0 -0
- package/icons/providers/modelscope.webp +0 -0
- package/icons/providers/monica.webp +0 -0
- package/icons/providers/moonshot.webp +0 -0
- package/icons/providers/morph.webp +0 -0
- package/icons/providers/moxt.webp +0 -0
- package/icons/providers/myshell.webp +0 -0
- package/icons/providers/n8n.webp +0 -0
- package/icons/providers/nanobanana.webp +0 -0
- package/icons/providers/nebius.webp +0 -0
- package/icons/providers/newapi.webp +0 -0
- package/icons/providers/notebooklm.webp +0 -0
- package/icons/providers/notion.webp +0 -0
- package/icons/providers/nousresearch.webp +0 -0
- package/icons/providers/nova.webp +0 -0
- package/icons/providers/novelai.webp +0 -0
- package/icons/providers/novita.webp +0 -0
- package/icons/providers/nplcloud.webp +0 -0
- package/icons/providers/nvidia.webp +0 -0
- package/icons/providers/o3.webp +0 -0
- package/icons/providers/obsidian.webp +0 -0
- package/icons/providers/ollama.webp +0 -0
- package/icons/providers/openai.webp +0 -0
- package/icons/providers/openchat.webp +0 -0
- package/icons/providers/openclaw.webp +0 -0
- package/icons/providers/opencode.webp +0 -0
- package/icons/providers/openhands.webp +0 -0
- package/icons/providers/openhuman.webp +0 -0
- package/icons/providers/openrouter.webp +0 -0
- package/icons/providers/openwebui.webp +0 -0
- package/icons/providers/paddleocr.webp +0 -0
- package/icons/providers/palm.webp +0 -0
- package/icons/providers/parasail.webp +0 -0
- package/icons/providers/perplexity.webp +0 -0
- package/icons/providers/phidata.webp +0 -0
- package/icons/providers/phind.webp +0 -0
- package/icons/providers/pika.webp +0 -0
- package/icons/providers/pixverse.webp +0 -0
- package/icons/providers/player2.webp +0 -0
- package/icons/providers/poe.webp +0 -0
- package/icons/providers/pollinations.webp +0 -0
- package/icons/providers/ppio.webp +0 -0
- package/icons/providers/prunaai.webp +0 -0
- package/icons/providers/pydanticai.webp +0 -0
- package/icons/providers/qingyan.webp +0 -0
- package/icons/providers/qiniu.webp +0 -0
- package/icons/providers/qoder.webp +0 -0
- package/icons/providers/qwen.webp +0 -0
- package/icons/providers/railway.webp +0 -0
- package/icons/providers/recraft.webp +0 -0
- package/icons/providers/relace.webp +0 -0
- package/icons/providers/replicate.webp +0 -0
- package/icons/providers/replit.webp +0 -0
- package/icons/providers/reve.webp +0 -0
- package/icons/providers/roocode.webp +0 -0
- package/icons/providers/rsshub.webp +0 -0
- package/icons/providers/runway.webp +0 -0
- package/icons/providers/rwkv.webp +0 -0
- package/icons/providers/sambanova.webp +0 -0
- package/icons/providers/search1api.webp +0 -0
- package/icons/providers/searchapi.webp +0 -0
- package/icons/providers/sensenova.webp +0 -0
- package/icons/providers/silicon.webp +0 -0
- package/icons/providers/siliconcloud.webp +0 -0
- package/icons/providers/sillytavern.webp +0 -0
- package/icons/providers/skywork.webp +0 -0
- package/icons/providers/slock.webp +0 -0
- package/icons/providers/smithery.webp +0 -0
- package/icons/providers/snowflake.webp +0 -0
- package/icons/providers/sophnet.webp +0 -0
- package/icons/providers/sora.webp +0 -0
- package/icons/providers/spark.webp +0 -0
- package/icons/providers/speedai.webp +0 -0
- package/icons/providers/stability.webp +0 -0
- package/icons/providers/statecloud.webp +0 -0
- package/icons/providers/step.webp +0 -0
- package/icons/providers/stepfun.webp +0 -0
- package/icons/providers/straico.webp +0 -0
- package/icons/providers/streamlake.webp +0 -0
- package/icons/providers/submodel.webp +0 -0
- package/icons/providers/suno.webp +0 -0
- package/icons/providers/sync.webp +0 -0
- package/icons/providers/targon.webp +0 -0
- package/icons/providers/tavily.webp +0 -0
- package/icons/providers/tencent-cloud-ti.webp +0 -0
- package/icons/providers/tencent.webp +0 -0
- package/icons/providers/tencentcloud.webp +0 -0
- package/icons/providers/tiangong.webp +0 -0
- package/icons/providers/tii.webp +0 -0
- package/icons/providers/together.webp +0 -0
- package/icons/providers/tokenrouter.png +0 -0
- package/icons/providers/topazlabs.webp +0 -0
- package/icons/providers/trae.webp +0 -0
- package/icons/providers/tripo.webp +0 -0
- package/icons/providers/turix.webp +0 -0
- package/icons/providers/udio.webp +0 -0
- package/icons/providers/unstructured.webp +0 -0
- package/icons/providers/upstage.webp +0 -0
- package/icons/providers/v0.webp +0 -0
- package/icons/providers/vectorizerai.webp +0 -0
- package/icons/providers/venice.webp +0 -0
- package/icons/providers/vercel.webp +0 -0
- package/icons/providers/vertexai.webp +0 -0
- package/icons/providers/vidu.webp +0 -0
- package/icons/providers/viggle.webp +0 -0
- package/icons/providers/vllm.webp +0 -0
- package/icons/providers/volcengine.webp +0 -0
- package/icons/providers/voyage.webp +0 -0
- package/icons/providers/voyageai.webp +0 -0
- package/icons/providers/wenxin.webp +0 -0
- package/icons/providers/windsurf.webp +0 -0
- package/icons/providers/workersai.webp +0 -0
- package/icons/providers/worldrouter.webp +0 -0
- package/icons/providers/xai.webp +0 -0
- package/icons/providers/xiaomimimo.webp +0 -0
- package/icons/providers/xinference.webp +0 -0
- package/icons/providers/xirang.png +0 -0
- package/icons/providers/xpay.webp +0 -0
- package/icons/providers/xuanyuan.webp +0 -0
- package/icons/providers/yandex.webp +0 -0
- package/icons/providers/yi.webp +0 -0
- package/icons/providers/youmind.webp +0 -0
- package/icons/providers/yuanbao.webp +0 -0
- package/icons/providers/zai.webp +0 -0
- package/icons/providers/zapier.webp +0 -0
- package/icons/providers/zeabur.webp +0 -0
- package/icons/providers/zencoder.webp +0 -0
- package/icons/providers/zenmux.webp +0 -0
- package/icons/providers/zero-one.webp +0 -0
- package/icons/providers/zeroone.webp +0 -0
- package/icons/providers/zhipu.webp +0 -0
- package/package.json +36 -36
- package/styles/content.css +3 -1
- package/styles/yunui.css +346 -89
- package/dist/chunk-5E3O6ANF.js.map +0 -1
- package/dist/chunk-5TOGZTAO.js.map +0 -1
- package/dist/chunk-AV5TGEJS.js +0 -54
- package/dist/chunk-AV5TGEJS.js.map +0 -1
- package/dist/chunk-GSPJ5YI6.js.map +0 -1
- package/dist/chunk-QEIBYOG2.js +0 -188
- package/dist/chunk-QEIBYOG2.js.map +0 -1
- package/dist/chunk-UYYG4XDW.js.map +0 -1
package/dist/content.d.ts
CHANGED
|
@@ -20,9 +20,10 @@ interface CodeBlockProps {
|
|
|
20
20
|
}
|
|
21
21
|
/**
|
|
22
22
|
* Syntax-highlighted code block powered by Shiki (accurate, VS Code-grade
|
|
23
|
-
* highlighting for
|
|
24
|
-
*
|
|
25
|
-
* highlighted lines, a filename header, copy, and an optional edit
|
|
23
|
+
* highlighting for common application and LLM output languages). Shiki core,
|
|
24
|
+
* the selected grammar, and the selected theme load on demand. Supports line
|
|
25
|
+
* numbers, highlighted lines, a filename header, copy, and an optional edit
|
|
26
|
+
* action. Unknown fence labels degrade to escaped plaintext.
|
|
26
27
|
*/
|
|
27
28
|
declare function CodeBlock({ children, language, showLineNumbers, highlightLines, filename, className, onEdit, }: CodeBlockProps): React.JSX.Element;
|
|
28
29
|
/** Inline code (`` `code` ``) — used by the markdown renderer. */
|
|
@@ -39,11 +40,27 @@ interface MarkdownRendererProps {
|
|
|
39
40
|
* proxy). Defaults to identity.
|
|
40
41
|
*/
|
|
41
42
|
urlTransform?: (url: string) => string;
|
|
43
|
+
/**
|
|
44
|
+
* Stable origin used to recognize same-origin absolute links, in SSR and the
|
|
45
|
+
* browser alike (e.g. "https://example.com"). Without it, absolute HTTP(S)
|
|
46
|
+
* links open externally; relative and fragment links remain internal.
|
|
47
|
+
*/
|
|
48
|
+
linkOrigin?: string;
|
|
42
49
|
/**
|
|
43
50
|
* When provided, code blocks show an "Edit" button that calls this with the
|
|
44
51
|
* code payload (e.g. open it in an editor). Hidden if unset.
|
|
45
52
|
*/
|
|
46
53
|
onCodeEdit?: (payload: CodeBlockEditPayload) => void;
|
|
54
|
+
/**
|
|
55
|
+
* Intercept a rendered Markdown link. Return a node to replace the default
|
|
56
|
+
* link, or `undefined` to retain YunUI's normal internal/external link UI.
|
|
57
|
+
* Useful for typed inline citations encoded as fragment links.
|
|
58
|
+
*/
|
|
59
|
+
renderLink?: (link: {
|
|
60
|
+
href?: string;
|
|
61
|
+
children: React.ReactNode;
|
|
62
|
+
isExternal: boolean;
|
|
63
|
+
}) => React.ReactNode | undefined;
|
|
47
64
|
}
|
|
48
65
|
/**
|
|
49
66
|
* Full markdown renderer: GFM (tables, task lists, strikethrough), math (KaTeX),
|
|
@@ -51,7 +68,7 @@ interface MarkdownRendererProps {
|
|
|
51
68
|
* and lazy, zoomable images. Requires `katex/dist/katex.min.css` and the YunUI
|
|
52
69
|
* content styles to be imported by the host app.
|
|
53
70
|
*/
|
|
54
|
-
declare function MarkdownRenderer({ content, className, urlTransform, onCodeEdit, }: MarkdownRendererProps): React.JSX.Element;
|
|
71
|
+
declare function MarkdownRenderer({ content, className, urlTransform, linkOrigin, onCodeEdit, renderLink, }: MarkdownRendererProps): React.JSX.Element;
|
|
55
72
|
|
|
56
73
|
type CalloutType = "note" | "tip" | "important" | "warning" | "caution" | "success";
|
|
57
74
|
interface CalloutBlockProps {
|
|
@@ -112,6 +129,8 @@ interface ImageLightboxProps {
|
|
|
112
129
|
/** Image URL to view. Omit when providing custom `children` (e.g. an SVG). */
|
|
113
130
|
src?: string;
|
|
114
131
|
alt?: string;
|
|
132
|
+
/** Accessible dialog name; defaults to alt or the host's content translation. */
|
|
133
|
+
label?: string;
|
|
115
134
|
isOpen: boolean;
|
|
116
135
|
onClose: () => void;
|
|
117
136
|
/**
|
|
@@ -125,7 +144,7 @@ interface ImageLightboxProps {
|
|
|
125
144
|
* (Esc / +/- / R). Views an image (`src`) or any custom `children` (e.g. an
|
|
126
145
|
* inline SVG diagram). Rendered into a portal on `document.body`.
|
|
127
146
|
*/
|
|
128
|
-
declare function ImageLightbox({ src, alt, isOpen, onClose, children }: ImageLightboxProps): React.
|
|
147
|
+
declare function ImageLightbox({ src, alt, label, isOpen, onClose, children }: ImageLightboxProps): React.JSX.Element | null;
|
|
129
148
|
|
|
130
149
|
interface ContentImageProps extends React.ImgHTMLAttributes<HTMLImageElement> {
|
|
131
150
|
/** Open a zoom/rotate/download lightbox on click. @defaultValue true */
|
|
@@ -141,4 +160,27 @@ interface ContentImageProps extends React.ImgHTMLAttributes<HTMLImageElement> {
|
|
|
141
160
|
*/
|
|
142
161
|
declare const ContentImage: React.MemoExoticComponent<({ enableLightbox, className, alt, src, onError, onLoad, ...rest }: ContentImageProps) => React.JSX.Element | null>;
|
|
143
162
|
|
|
144
|
-
|
|
163
|
+
interface InlineCitationProps {
|
|
164
|
+
/** Compact label shown beside the supported claim. */
|
|
165
|
+
label: string;
|
|
166
|
+
/** Full source title shown in the evidence preview. */
|
|
167
|
+
title: string;
|
|
168
|
+
/** Exact source location, for example a hostname or PDF page. */
|
|
169
|
+
meta?: string;
|
|
170
|
+
/** Bounded source excerpt that substantiates the adjacent claim. */
|
|
171
|
+
description?: string;
|
|
172
|
+
/** Optional source icon or favicon. */
|
|
173
|
+
icon?: React.ReactNode;
|
|
174
|
+
/** Open a document location or external URL. */
|
|
175
|
+
onOpen?: () => void;
|
|
176
|
+
className?: string;
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* Claim-adjacent evidence marker for grounded AI content.
|
|
180
|
+
*
|
|
181
|
+
* The compact trigger stays in the reading flow. Hover/focus previews the
|
|
182
|
+
* concrete source and clicking delegates navigation to the host application.
|
|
183
|
+
*/
|
|
184
|
+
declare function InlineCitation({ label, title, meta, description, icon, onOpen, className, }: InlineCitationProps): React.JSX.Element;
|
|
185
|
+
|
|
186
|
+
export { BlockMath, CalloutBlock, type CalloutBlockProps, type CalloutType, CodeBlock, type CodeBlockEditPayload, type CodeBlockProps, ContentImage, type ContentImageProps, ImageLightbox, type ImageLightboxProps, InlineCitation, type InlineCitationProps, InlineCode, InlineMath, MarkdownRenderer, type MarkdownRendererProps, MathRenderer, type MathRendererProps, MermaidDiagram, type MermaidDiagramProps, parseCalloutType };
|
package/dist/content.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { useContentT, ImageLightbox } from './chunk-
|
|
3
|
-
export { ImageLightbox } from './chunk-
|
|
4
|
-
import { Alert } from './chunk-
|
|
5
|
-
import { cn } from './chunk-
|
|
2
|
+
import { useContentT, ImageLightbox } from './chunk-ST6TSBVQ.js';
|
|
3
|
+
export { ImageLightbox } from './chunk-ST6TSBVQ.js';
|
|
4
|
+
import { Alert, TooltipProvider, Tooltip, TooltipTrigger, TooltipContent } from './chunk-YKWRCA2S.js';
|
|
5
|
+
import { cn } from './chunk-V7VJKZ5Q.js';
|
|
6
6
|
import './chunk-3RT24MSH.js';
|
|
7
7
|
import * as React2 from 'react';
|
|
8
8
|
import { useState, useRef, useEffect, useMemo, useCallback } from 'react';
|
|
@@ -13,9 +13,26 @@ import rehypeRaw from 'rehype-raw';
|
|
|
13
13
|
import rehypeKatex from 'rehype-katex';
|
|
14
14
|
import rehypeSlug from 'rehype-slug';
|
|
15
15
|
import { Edit3, Check, Copy, CheckCircle2, XOctagon, AlertTriangle, AlertCircle, Lightbulb, Info, ExternalLink, Link2 } from 'lucide-react';
|
|
16
|
+
import { createHighlighterCore } from 'shiki/core';
|
|
17
|
+
import { createJavaScriptRegexEngine } from 'shiki/engine/javascript';
|
|
16
18
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
17
19
|
import katex from 'katex';
|
|
18
20
|
|
|
21
|
+
function useContentDarkMode() {
|
|
22
|
+
const [dark, setDark] = useState(false);
|
|
23
|
+
useEffect(() => {
|
|
24
|
+
const root = document.documentElement;
|
|
25
|
+
const check = () => {
|
|
26
|
+
const theme = root.getAttribute("data-theme");
|
|
27
|
+
setDark(root.classList.contains("dark") || root.classList.contains("true-black") || theme === "dark" || theme === "true-black");
|
|
28
|
+
};
|
|
29
|
+
check();
|
|
30
|
+
const observer = new MutationObserver(check);
|
|
31
|
+
observer.observe(root, { attributes: true, attributeFilter: ["class", "data-theme"] });
|
|
32
|
+
return () => observer.disconnect();
|
|
33
|
+
}, []);
|
|
34
|
+
return dark;
|
|
35
|
+
}
|
|
19
36
|
var languageNames = {
|
|
20
37
|
js: "JavaScript",
|
|
21
38
|
javascript: "JavaScript",
|
|
@@ -71,19 +88,111 @@ var langExtMap = {
|
|
|
71
88
|
shell: "sh",
|
|
72
89
|
markdown: "md"
|
|
73
90
|
};
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
91
|
+
var shikiLanguages = {
|
|
92
|
+
bash: () => import('shiki/langs/bash.mjs'),
|
|
93
|
+
c: () => import('shiki/langs/c.mjs'),
|
|
94
|
+
cpp: () => import('shiki/langs/cpp.mjs'),
|
|
95
|
+
css: () => import('shiki/langs/css.mjs'),
|
|
96
|
+
diff: () => import('shiki/langs/diff.mjs'),
|
|
97
|
+
dockerfile: () => import('shiki/langs/dockerfile.mjs'),
|
|
98
|
+
go: () => import('shiki/langs/go.mjs'),
|
|
99
|
+
graphql: () => import('shiki/langs/graphql.mjs'),
|
|
100
|
+
html: () => import('shiki/langs/html.mjs'),
|
|
101
|
+
java: () => import('shiki/langs/java.mjs'),
|
|
102
|
+
javascript: () => import('shiki/langs/javascript.mjs'),
|
|
103
|
+
json: () => import('shiki/langs/json.mjs'),
|
|
104
|
+
jsx: () => import('shiki/langs/jsx.mjs'),
|
|
105
|
+
kotlin: () => import('shiki/langs/kotlin.mjs'),
|
|
106
|
+
markdown: () => import('shiki/langs/markdown.mjs'),
|
|
107
|
+
php: () => import('shiki/langs/php.mjs'),
|
|
108
|
+
powershell: () => import('shiki/langs/powershell.mjs'),
|
|
109
|
+
python: () => import('shiki/langs/python.mjs'),
|
|
110
|
+
ruby: () => import('shiki/langs/ruby.mjs'),
|
|
111
|
+
rust: () => import('shiki/langs/rust.mjs'),
|
|
112
|
+
sass: () => import('shiki/langs/sass.mjs'),
|
|
113
|
+
scss: () => import('shiki/langs/scss.mjs'),
|
|
114
|
+
sql: () => import('shiki/langs/sql.mjs'),
|
|
115
|
+
svelte: () => import('shiki/langs/svelte.mjs'),
|
|
116
|
+
swift: () => import('shiki/langs/swift.mjs'),
|
|
117
|
+
tsx: () => import('shiki/langs/tsx.mjs'),
|
|
118
|
+
typescript: () => import('shiki/langs/typescript.mjs'),
|
|
119
|
+
vue: () => import('shiki/langs/vue.mjs'),
|
|
120
|
+
xml: () => import('shiki/langs/xml.mjs'),
|
|
121
|
+
yaml: () => import('shiki/langs/yaml.mjs')
|
|
122
|
+
};
|
|
123
|
+
var shikiLanguageAliases = {
|
|
124
|
+
cxx: "cpp",
|
|
125
|
+
docker: "dockerfile",
|
|
126
|
+
js: "javascript",
|
|
127
|
+
kt: "kotlin",
|
|
128
|
+
md: "markdown",
|
|
129
|
+
py: "python",
|
|
130
|
+
rb: "ruby",
|
|
131
|
+
rs: "rust",
|
|
132
|
+
sh: "bash",
|
|
133
|
+
shell: "bash",
|
|
134
|
+
ts: "typescript",
|
|
135
|
+
yml: "yaml",
|
|
136
|
+
zsh: "bash"
|
|
137
|
+
};
|
|
138
|
+
var shikiThemes = {
|
|
139
|
+
"github-dark-default": () => import('shiki/themes/github-dark-default.mjs'),
|
|
140
|
+
"github-light-default": () => import('shiki/themes/github-light-default.mjs')
|
|
141
|
+
};
|
|
142
|
+
var contentHighlighterPromise;
|
|
143
|
+
var languageLoadPromises = /* @__PURE__ */ new Map();
|
|
144
|
+
var themeLoadPromises = /* @__PURE__ */ new Map();
|
|
145
|
+
function getContentHighlighter() {
|
|
146
|
+
contentHighlighterPromise ??= createHighlighterCore({
|
|
147
|
+
// The JavaScript regex engine avoids a WASM payload and is sufficient for
|
|
148
|
+
// browser-side highlighting of the curated grammar set above.
|
|
149
|
+
engine: createJavaScriptRegexEngine()
|
|
150
|
+
});
|
|
151
|
+
return contentHighlighterPromise;
|
|
152
|
+
}
|
|
153
|
+
async function ensureLanguage(highlighter, language) {
|
|
154
|
+
if (language === "plaintext" || highlighter.getLoadedLanguages().includes(language)) {
|
|
155
|
+
return;
|
|
156
|
+
}
|
|
157
|
+
let pending = languageLoadPromises.get(language);
|
|
158
|
+
if (!pending) {
|
|
159
|
+
pending = (async () => {
|
|
160
|
+
const registration = (await shikiLanguages[language]()).default;
|
|
161
|
+
await highlighter.loadLanguage(registration);
|
|
162
|
+
})();
|
|
163
|
+
languageLoadPromises.set(language, pending);
|
|
164
|
+
}
|
|
165
|
+
await pending;
|
|
166
|
+
}
|
|
167
|
+
async function ensureTheme(highlighter, theme) {
|
|
168
|
+
if (highlighter.getLoadedThemes().includes(theme)) return;
|
|
169
|
+
let pending = themeLoadPromises.get(theme);
|
|
170
|
+
if (!pending) {
|
|
171
|
+
pending = (async () => {
|
|
172
|
+
const registration = (await shikiThemes[theme]()).default;
|
|
173
|
+
await highlighter.loadTheme(registration);
|
|
174
|
+
})();
|
|
175
|
+
themeLoadPromises.set(theme, pending);
|
|
176
|
+
}
|
|
177
|
+
await pending;
|
|
178
|
+
}
|
|
179
|
+
async function highlightToHtml(code, options) {
|
|
180
|
+
const highlighter = await getContentHighlighter();
|
|
181
|
+
const language = options.lang;
|
|
182
|
+
const theme = options.theme;
|
|
183
|
+
await Promise.all([
|
|
184
|
+
ensureLanguage(highlighter, language),
|
|
185
|
+
ensureTheme(highlighter, theme)
|
|
186
|
+
]);
|
|
187
|
+
return highlighter.codeToHtml(code, options);
|
|
188
|
+
}
|
|
189
|
+
function resolveShikiLanguage(language) {
|
|
190
|
+
const normalized = language.trim().toLowerCase();
|
|
191
|
+
if (!normalized || normalized === "text" || normalized === "plaintext") {
|
|
192
|
+
return "plaintext";
|
|
193
|
+
}
|
|
194
|
+
if (normalized in shikiLanguages) return normalized;
|
|
195
|
+
return shikiLanguageAliases[normalized] ?? "plaintext";
|
|
87
196
|
}
|
|
88
197
|
function CodeBlock({
|
|
89
198
|
children,
|
|
@@ -97,7 +206,7 @@ function CodeBlock({
|
|
|
97
206
|
const [copied, setCopied] = useState(false);
|
|
98
207
|
const [highlightedCode, setHighlightedCode] = useState("");
|
|
99
208
|
const [isLoading, setIsLoading] = useState(true);
|
|
100
|
-
const isDark =
|
|
209
|
+
const isDark = useContentDarkMode();
|
|
101
210
|
const t = useContentT();
|
|
102
211
|
const code = useMemo(
|
|
103
212
|
() => typeof children === "string" ? children.trim() : String(children).trim(),
|
|
@@ -114,10 +223,9 @@ function CodeBlock({
|
|
|
114
223
|
async function highlight() {
|
|
115
224
|
setIsLoading(true);
|
|
116
225
|
try {
|
|
117
|
-
const
|
|
118
|
-
const
|
|
119
|
-
const
|
|
120
|
-
const html = await codeToHtml(code, {
|
|
226
|
+
const theme = isDark ? "github-dark-default" : "github-light-default";
|
|
227
|
+
const lang = resolveShikiLanguage(language || "plaintext");
|
|
228
|
+
const html = await highlightToHtml(code, {
|
|
121
229
|
lang,
|
|
122
230
|
theme,
|
|
123
231
|
transformers: [
|
|
@@ -185,7 +293,7 @@ function CodeBlock({
|
|
|
185
293
|
filename ? /* @__PURE__ */ jsx("span", { className: "text-xs font-medium text-(--text-secondary) font-mono", children: filename }) : /* @__PURE__ */ jsx("span", { className: "badge text-xs", children: displayLanguage })
|
|
186
294
|
] }),
|
|
187
295
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1.5", children: [
|
|
188
|
-
onEdit && /* @__PURE__ */ jsxs("button", { onClick: handleEdit, className: cn(btnBase, "text-(--text-
|
|
296
|
+
onEdit && /* @__PURE__ */ jsxs("button", { onClick: handleEdit, className: cn(btnBase, "text-(--text-secondary)"), children: [
|
|
189
297
|
/* @__PURE__ */ jsx(Edit3, { className: "w-3.5 h-3.5" }),
|
|
190
298
|
t("edit", "Edit")
|
|
191
299
|
] }),
|
|
@@ -193,14 +301,15 @@ function CodeBlock({
|
|
|
193
301
|
/* @__PURE__ */ jsx(Check, { className: "w-3.5 h-3.5 text-(--success)" }),
|
|
194
302
|
/* @__PURE__ */ jsx("span", { className: "text-(--success)", children: t("copied", "Copied") })
|
|
195
303
|
] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
196
|
-
/* @__PURE__ */ jsx(Copy, { className: "w-3.5 h-3.5 text-(--text-
|
|
197
|
-
/* @__PURE__ */ jsx("span", { className: "text-(--text-
|
|
304
|
+
/* @__PURE__ */ jsx(Copy, { className: "w-3.5 h-3.5 text-(--text-secondary)" }),
|
|
305
|
+
/* @__PURE__ */ jsx("span", { className: "text-(--text-secondary)", children: t("copy", "Copy") })
|
|
198
306
|
] }) })
|
|
199
307
|
] })
|
|
200
308
|
] }),
|
|
201
309
|
/* @__PURE__ */ jsx(
|
|
202
310
|
"div",
|
|
203
311
|
{
|
|
312
|
+
tabIndex: 0,
|
|
204
313
|
className: cn(
|
|
205
314
|
"overflow-x-auto overflow-y-auto p-4 max-h-100 bg-(--bg-base)",
|
|
206
315
|
showLineNumbers && "code-with-line-numbers"
|
|
@@ -288,7 +397,7 @@ function MermaidDiagram({
|
|
|
288
397
|
const [svg, setSvg] = useState("");
|
|
289
398
|
const [error, setError] = useState("");
|
|
290
399
|
const [isLoading, setIsLoading] = useState(true);
|
|
291
|
-
const
|
|
400
|
+
const isDark = useContentDarkMode();
|
|
292
401
|
const [zoomOpen, setZoomOpen] = useState(false);
|
|
293
402
|
const t = useContentT();
|
|
294
403
|
useEffect(() => {
|
|
@@ -299,7 +408,6 @@ function MermaidDiagram({
|
|
|
299
408
|
const diagramId = `yunui-mermaid-${mermaidSeq += 1}`;
|
|
300
409
|
try {
|
|
301
410
|
const mermaid = (await import('mermaid')).default;
|
|
302
|
-
const isDark = typeof document !== "undefined" && document.documentElement.classList.contains("dark");
|
|
303
411
|
mermaid.initialize({
|
|
304
412
|
startOnLoad: false,
|
|
305
413
|
theme: isDark ? "dark" : "default",
|
|
@@ -307,7 +415,11 @@ function MermaidDiagram({
|
|
|
307
415
|
// supports (flowchart, state, class, ER, requirement, C4, block…).
|
|
308
416
|
look: "handDrawn",
|
|
309
417
|
handDrawnSeed: 1,
|
|
310
|
-
|
|
418
|
+
// "strict" (not "loose"): diagram source here is untrusted LLM/chat output.
|
|
419
|
+
// "loose" enables HTML labels + relaxes Mermaid's internal DOMPurify, so a
|
|
420
|
+
// label like <img src=x onerror=...> executes when the SVG is injected via
|
|
421
|
+
// dangerouslySetInnerHTML. "strict" sanitizes labels and disables htmlLabels.
|
|
422
|
+
securityLevel: "strict",
|
|
311
423
|
fontFamily: '"Comic Sans MS", "Segoe Print", ui-rounded, system-ui, sans-serif',
|
|
312
424
|
flowchart: { curve: "basis", padding: 20 },
|
|
313
425
|
sequence: { diagramMarginX: 20, diagramMarginY: 20 },
|
|
@@ -333,16 +445,7 @@ function MermaidDiagram({
|
|
|
333
445
|
return () => {
|
|
334
446
|
cancelled = true;
|
|
335
447
|
};
|
|
336
|
-
}, [chart,
|
|
337
|
-
useEffect(() => {
|
|
338
|
-
if (typeof document === "undefined") return;
|
|
339
|
-
const observer = new MutationObserver(() => setThemeTick((n) => n + 1));
|
|
340
|
-
observer.observe(document.documentElement, {
|
|
341
|
-
attributes: true,
|
|
342
|
-
attributeFilter: ["class"]
|
|
343
|
-
});
|
|
344
|
-
return () => observer.disconnect();
|
|
345
|
-
}, []);
|
|
448
|
+
}, [chart, isDark]);
|
|
346
449
|
if (error) {
|
|
347
450
|
return /* @__PURE__ */ jsx(
|
|
348
451
|
"div",
|
|
@@ -358,7 +461,7 @@ function MermaidDiagram({
|
|
|
358
461
|
/* @__PURE__ */ jsx("p", { className: "text-xs text-(--text-tertiary) mt-1", children: error }),
|
|
359
462
|
/* @__PURE__ */ jsxs("details", { className: "mt-2", children: [
|
|
360
463
|
/* @__PURE__ */ jsx("summary", { className: "text-xs text-(--text-tertiary) cursor-pointer hover:text-(--text-primary)", children: t("viewSource", "View source") }),
|
|
361
|
-
/* @__PURE__ */ jsx("pre", { className: "mt-2 p-2 bg-(--bg-elevated) rounded text-xs overflow-auto", children: chart })
|
|
464
|
+
/* @__PURE__ */ jsx("pre", { className: "mt-2 p-2 bg-(--bg-elevated) rounded text-xs overflow-auto", tabIndex: 0, children: chart })
|
|
362
465
|
] })
|
|
363
466
|
] })
|
|
364
467
|
] })
|
|
@@ -386,10 +489,17 @@ function MermaidDiagram({
|
|
|
386
489
|
{
|
|
387
490
|
ref: containerRef,
|
|
388
491
|
onClick: enableZoom ? () => setZoomOpen(true) : void 0,
|
|
492
|
+
onKeyDown: enableZoom ? (event) => {
|
|
493
|
+
if (event.key === "Enter" || event.key === " ") {
|
|
494
|
+
event.preventDefault();
|
|
495
|
+
setZoomOpen(true);
|
|
496
|
+
}
|
|
497
|
+
} : void 0,
|
|
389
498
|
role: enableZoom ? "button" : void 0,
|
|
390
499
|
"aria-label": enableZoom ? t("zoomDiagram", "Zoom diagram") : void 0,
|
|
500
|
+
tabIndex: 0,
|
|
391
501
|
className: cn(
|
|
392
|
-
"card my-4 p-4 overflow-x-auto",
|
|
502
|
+
"mermaid-container card my-4 p-4 overflow-x-auto",
|
|
393
503
|
"flex items-center justify-center",
|
|
394
504
|
"[&_svg]:max-w-full [&_svg]:h-auto",
|
|
395
505
|
enableZoom && "cursor-zoom-in",
|
|
@@ -554,7 +664,9 @@ function MarkdownRenderer({
|
|
|
554
664
|
content,
|
|
555
665
|
className,
|
|
556
666
|
urlTransform,
|
|
557
|
-
|
|
667
|
+
linkOrigin,
|
|
668
|
+
onCodeEdit,
|
|
669
|
+
renderLink
|
|
558
670
|
}) {
|
|
559
671
|
const components = useMemo(
|
|
560
672
|
() => ({
|
|
@@ -653,9 +765,16 @@ function MarkdownRenderer({
|
|
|
653
765
|
pre: ({ children }) => /* @__PURE__ */ jsx(Fragment, { children }),
|
|
654
766
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
655
767
|
img: ({ node, ...props }) => /* @__PURE__ */ jsx(ContentImage, { ...props }),
|
|
656
|
-
a: ({ href, children, ...props }) => {
|
|
657
|
-
|
|
658
|
-
|
|
768
|
+
a: ({ href, children, node: _node, ...props }) => {
|
|
769
|
+
let isExternal = Boolean(href && /^(https?:)?\/\//i.test(href));
|
|
770
|
+
if (isExternal && linkOrigin) {
|
|
771
|
+
try {
|
|
772
|
+
isExternal = new URL(href, linkOrigin).origin !== new URL(linkOrigin).origin;
|
|
773
|
+
} catch {
|
|
774
|
+
}
|
|
775
|
+
}
|
|
776
|
+
const override = renderLink?.({ href, children, isExternal: Boolean(isExternal) });
|
|
777
|
+
if (override !== void 0) return override;
|
|
659
778
|
return /* @__PURE__ */ jsxs(
|
|
660
779
|
"a",
|
|
661
780
|
{
|
|
@@ -695,7 +814,7 @@ function MarkdownRenderer({
|
|
|
695
814
|
}
|
|
696
815
|
return /* @__PURE__ */ jsx("blockquote", { className: "border-l-4 border-(--border-default) pl-4 my-4 italic text-(--text-secondary)", children });
|
|
697
816
|
},
|
|
698
|
-
table: ({ children }) => /* @__PURE__ */ jsx("div", { className: "card my-4 overflow-x-auto", children: /* @__PURE__ */ jsx("table", { className: "min-w-full divide-y divide-(--border-hairline)", children }) }),
|
|
817
|
+
table: ({ children }) => /* @__PURE__ */ jsx("div", { className: "card my-4 overflow-x-auto", tabIndex: 0, children: /* @__PURE__ */ jsx("table", { className: "min-w-full divide-y divide-(--border-hairline)", children }) }),
|
|
699
818
|
thead: ({ children }) => /* @__PURE__ */ jsx("thead", { className: "bg-(--bg-elevated)", children }),
|
|
700
819
|
th: ({ children }) => /* @__PURE__ */ jsx("th", { className: "px-4 py-2 text-left text-sm font-semibold text-(--text-primary)", children }),
|
|
701
820
|
td: ({ children }) => /* @__PURE__ */ jsx("td", { className: "px-4 py-2 text-sm border-t border-(--border-hairline)", children }),
|
|
@@ -722,6 +841,8 @@ function MarkdownRenderer({
|
|
|
722
841
|
type: "checkbox",
|
|
723
842
|
checked,
|
|
724
843
|
readOnly: true,
|
|
844
|
+
"aria-hidden": "true",
|
|
845
|
+
tabIndex: -1,
|
|
725
846
|
className: "mt-1 h-4 w-4 rounded border-(--border-hairline) accent-(--accent) focus:ring-ring",
|
|
726
847
|
...props
|
|
727
848
|
}
|
|
@@ -746,7 +867,7 @@ function MarkdownRenderer({
|
|
|
746
867
|
sup: ({ children }) => /* @__PURE__ */ jsx("sup", { className: "text-xs", children }),
|
|
747
868
|
del: ({ children }) => /* @__PURE__ */ jsx("del", { className: "text-(--text-tertiary) line-through", children })
|
|
748
869
|
}),
|
|
749
|
-
[onCodeEdit]
|
|
870
|
+
[onCodeEdit, renderLink, linkOrigin]
|
|
750
871
|
);
|
|
751
872
|
return /* @__PURE__ */ jsx(
|
|
752
873
|
"div",
|
|
@@ -829,9 +950,14 @@ function MathRenderer({ math, block = false, className }) {
|
|
|
829
950
|
katex.render(math, containerRef.current, {
|
|
830
951
|
displayMode: block,
|
|
831
952
|
throwOnError: false,
|
|
832
|
-
|
|
953
|
+
// KaTeX writes this straight into inline styles, so it cannot be a
|
|
954
|
+
// class. Read the live token instead of hardcoding a red that matches
|
|
955
|
+
// neither theme; fall back only if the stylesheet has not loaded.
|
|
956
|
+
errorColor: typeof window !== "undefined" && getComputedStyle(document.documentElement).getPropertyValue("--error").trim() || "#cc0000",
|
|
833
957
|
strict: false,
|
|
834
|
-
trust:
|
|
958
|
+
// trust:false — untrusted math must not enable \href{javascript:...},
|
|
959
|
+
// \includegraphics, \htmlData etc. (KaTeX XSS surface).
|
|
960
|
+
trust: false,
|
|
835
961
|
macros: {
|
|
836
962
|
"\\RR": "\\mathbb{R}",
|
|
837
963
|
"\\NN": "\\mathbb{N}",
|
|
@@ -867,6 +993,7 @@ function MathRenderer({ math, block = false, className }) {
|
|
|
867
993
|
return /* @__PURE__ */ jsx(
|
|
868
994
|
"div",
|
|
869
995
|
{
|
|
996
|
+
tabIndex: 0,
|
|
870
997
|
className: cn(
|
|
871
998
|
"my-4 py-4 overflow-x-auto text-center",
|
|
872
999
|
"[&_.katex]:text-lg",
|
|
@@ -884,7 +1011,64 @@ function InlineMath({ value }) {
|
|
|
884
1011
|
function BlockMath({ value }) {
|
|
885
1012
|
return /* @__PURE__ */ jsx(MathRenderer, { math: value, block: true });
|
|
886
1013
|
}
|
|
1014
|
+
function InlineCitation({
|
|
1015
|
+
label,
|
|
1016
|
+
title,
|
|
1017
|
+
meta,
|
|
1018
|
+
description,
|
|
1019
|
+
icon,
|
|
1020
|
+
onOpen,
|
|
1021
|
+
className
|
|
1022
|
+
}) {
|
|
1023
|
+
return /* @__PURE__ */ jsx(TooltipProvider, { delayDuration: 180, children: /* @__PURE__ */ jsxs(Tooltip, { children: [
|
|
1024
|
+
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxs(
|
|
1025
|
+
"button",
|
|
1026
|
+
{
|
|
1027
|
+
type: "button",
|
|
1028
|
+
"data-inline-citation": true,
|
|
1029
|
+
onClick: onOpen,
|
|
1030
|
+
className: cn(
|
|
1031
|
+
"mx-1 inline-flex h-6 max-w-40 translate-y-[1px] items-center gap-1 rounded-full",
|
|
1032
|
+
"border border-border/60 bg-muted/55 px-2 text-[11px] font-medium leading-none",
|
|
1033
|
+
"text-(--text-secondary) transition-colors hover:border-border hover:bg-muted hover:text-(--text-primary)",
|
|
1034
|
+
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/50",
|
|
1035
|
+
className
|
|
1036
|
+
),
|
|
1037
|
+
"aria-label": `${label}: ${title}${meta ? `, ${meta}` : ""}`,
|
|
1038
|
+
children: [
|
|
1039
|
+
icon ? /* @__PURE__ */ jsx("span", { className: "flex shrink-0 items-center", children: icon }) : null,
|
|
1040
|
+
/* @__PURE__ */ jsx("span", { className: "truncate", children: label })
|
|
1041
|
+
]
|
|
1042
|
+
}
|
|
1043
|
+
) }),
|
|
1044
|
+
/* @__PURE__ */ jsx(
|
|
1045
|
+
TooltipContent,
|
|
1046
|
+
{
|
|
1047
|
+
side: "top",
|
|
1048
|
+
align: "start",
|
|
1049
|
+
sideOffset: 8,
|
|
1050
|
+
className: cn(
|
|
1051
|
+
"w-[min(340px,calc(100vw-24px))] rounded-2xl border border-border",
|
|
1052
|
+
// shadow-lg shadow-black/5 is the house overlay drop; shadow-xl was
|
|
1053
|
+
// heavier than every other popover in the system.
|
|
1054
|
+
"bg-popover p-3 text-popover-foreground shadow-lg shadow-black/5"
|
|
1055
|
+
),
|
|
1056
|
+
children: /* @__PURE__ */ jsxs("div", { className: "flex min-w-0 items-start gap-2.5", children: [
|
|
1057
|
+
icon ? /* @__PURE__ */ jsx("span", { className: "mt-0.5 flex h-7 w-7 shrink-0 items-center justify-center rounded-lg bg-muted", children: icon }) : null,
|
|
1058
|
+
/* @__PURE__ */ jsxs("div", { className: "min-w-0 flex-1", children: [
|
|
1059
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-start gap-2", children: [
|
|
1060
|
+
/* @__PURE__ */ jsx("span", { className: "min-w-0 flex-1 text-xs font-semibold leading-snug", children: title }),
|
|
1061
|
+
onOpen ? /* @__PURE__ */ jsx(ExternalLink, { "aria-hidden": true, className: "mt-0.5 h-3 w-3 shrink-0 text-(--text-tertiary)" }) : null
|
|
1062
|
+
] }),
|
|
1063
|
+
meta ? /* @__PURE__ */ jsx("div", { className: "mt-0.5 text-[10px] text-(--text-tertiary)", children: meta }) : null,
|
|
1064
|
+
description ? /* @__PURE__ */ jsx("p", { className: "mt-2 line-clamp-4 text-[11px] font-normal leading-relaxed text-(--text-secondary)", children: description }) : null
|
|
1065
|
+
] })
|
|
1066
|
+
] })
|
|
1067
|
+
}
|
|
1068
|
+
)
|
|
1069
|
+
] }) });
|
|
1070
|
+
}
|
|
887
1071
|
|
|
888
|
-
export { BlockMath, CalloutBlock, CodeBlock, ContentImage, InlineCode, InlineMath, MarkdownRenderer, MathRenderer, MermaidDiagram, parseCalloutType };
|
|
1072
|
+
export { BlockMath, CalloutBlock, CodeBlock, ContentImage, InlineCitation, InlineCode, InlineMath, MarkdownRenderer, MathRenderer, MermaidDiagram, parseCalloutType };
|
|
889
1073
|
//# sourceMappingURL=content.js.map
|
|
890
1074
|
//# sourceMappingURL=content.js.map
|