@yuhuanowo/yunui 0.2.17 → 0.2.19
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 +56 -5
- package/README.zh-CN.md +21 -3
- package/README.zh-TW.md +21 -3
- package/THIRD_PARTY_NOTICES.md +13 -0
- package/agent/catalog.generated.json +29368 -0
- package/agent/recipes/analytics.tsx +121 -0
- package/agent/recipes/chat.tsx +154 -0
- package/agent/recipes/conversation-units.tsx +28 -0
- package/agent/recipes/dashboard.tsx +38 -0
- package/agent/recipes/landing.tsx +26 -0
- package/agent/recipes/setup.md +44 -0
- package/agent/skills/yunui/SKILL.md +82 -0
- package/dist/adapters.d.ts +5 -0
- package/dist/adapters.js +1 -1
- package/dist/ai.d.ts +478 -273
- package/dist/ai.js +1334 -1964
- package/dist/ai.js.map +1 -1
- package/dist/charts.d.ts +149 -0
- package/dist/charts.js +849 -0
- package/dist/charts.js.map +1 -0
- package/dist/chat.d.ts +204 -18
- package/dist/chat.js +887 -132
- package/dist/chat.js.map +1 -1
- package/dist/{chunk-F2HG4TOQ.js → chunk-ASPPAL7E.js} +25 -29
- package/dist/chunk-ASPPAL7E.js.map +1 -0
- package/dist/chunk-AVXIR7ZQ.js +197 -0
- package/dist/chunk-AVXIR7ZQ.js.map +1 -0
- package/dist/chunk-FJ52MVRF.js +82 -0
- package/dist/chunk-FJ52MVRF.js.map +1 -0
- package/dist/chunk-GRUB2GXF.js +15 -0
- package/dist/chunk-GRUB2GXF.js.map +1 -0
- package/dist/{chunk-3RT24MSH.js → chunk-GWD5W5F5.js} +2 -2
- package/dist/{chunk-3RT24MSH.js.map → chunk-GWD5W5F5.js.map} +1 -1
- package/dist/{chunk-BCOKFWXC.js → chunk-I2DAKAD5.js} +423 -281
- package/dist/chunk-I2DAKAD5.js.map +1 -0
- package/dist/chunk-OM7B4O6K.js +193 -0
- package/dist/chunk-OM7B4O6K.js.map +1 -0
- package/dist/chunk-OZIDZFMF.js +70 -0
- package/dist/chunk-OZIDZFMF.js.map +1 -0
- package/dist/chunk-P6LU2FWV.js +35 -0
- package/dist/chunk-P6LU2FWV.js.map +1 -0
- package/dist/chunk-SXWMKFKM.js +41 -0
- package/dist/chunk-SXWMKFKM.js.map +1 -0
- package/dist/chunk-TMTXJFNN.js +2715 -0
- package/dist/chunk-TMTXJFNN.js.map +1 -0
- package/dist/chunk-VNKAEQKU.js +501 -0
- package/dist/chunk-VNKAEQKU.js.map +1 -0
- package/dist/chunk-VSS7ASN2.js +12 -0
- package/dist/chunk-VSS7ASN2.js.map +1 -0
- package/dist/chunk-VYVFMNM7.js +112 -0
- package/dist/chunk-VYVFMNM7.js.map +1 -0
- package/dist/chunk-YKUQ7GCJ.js +230 -0
- package/dist/chunk-YKUQ7GCJ.js.map +1 -0
- package/dist/chunk-Z6WXDNBJ.js +366 -0
- package/dist/chunk-Z6WXDNBJ.js.map +1 -0
- package/dist/chunk-ZBRV6NHL.js +1115 -0
- package/dist/chunk-ZBRV6NHL.js.map +1 -0
- package/dist/code.d.ts +42 -0
- package/dist/code.js +8 -0
- package/dist/code.js.map +1 -0
- package/dist/content.d.ts +26 -40
- package/dist/content.js +400 -418
- package/dist/content.js.map +1 -1
- package/dist/footer-BCd-S806.d.ts +122 -0
- package/dist/index.d.ts +814 -88
- package/dist/index.js +7 -5
- package/dist/language.d.ts +30 -0
- package/dist/language.js +5 -0
- package/dist/language.js.map +1 -0
- package/dist/model-card.d.ts +43 -0
- package/dist/model-card.js +116 -0
- package/dist/model-card.js.map +1 -0
- package/dist/model.d.ts +51 -0
- package/dist/model.js +91 -0
- package/dist/model.js.map +1 -0
- package/dist/motion.d.ts +11 -0
- package/dist/motion.js +9 -0
- package/dist/motion.js.map +1 -0
- package/dist/patterns.d.ts +913 -29
- package/dist/patterns.js +1987 -259
- package/dist/patterns.js.map +1 -1
- package/dist/pickers.d.ts +134 -0
- package/dist/pickers.js +751 -0
- package/dist/pickers.js.map +1 -0
- package/dist/provider-icons-bgBTnami.d.ts +88 -0
- package/dist/segmented-bar-Bsr0PZIL.d.ts +58 -0
- package/dist/sparkline-vy5ec5C6.d.ts +67 -0
- package/icons/apps/aistudio.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/ling.webp +0 -0
- package/icons/apps/longcat.webp +0 -0
- package/icons/apps/monica.webp +0 -0
- package/icons/apps/n8n.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/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/ling.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/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/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/agnesai.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/aihubmix.webp +0 -0
- package/icons/providers/aimass.webp +0 -0
- package/icons/providers/aimlapi.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/amdradeoncloud.webp +0 -0
- package/icons/providers/amp.webp +0 -0
- package/icons/providers/anspire.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/appwrite.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/bocha.webp +0 -0
- package/icons/providers/brave.webp +0 -0
- package/icons/providers/briaai.webp +0 -0
- package/icons/providers/browserless.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/celestoai.webp +0 -0
- package/icons/providers/centml.webp +0 -0
- package/icons/providers/cerebras.webp +0 -0
- package/icons/providers/chatglm.webp +0 -0
- package/icons/providers/cheaperinference.webp +0 -0
- package/icons/providers/cherrystudio.webp +0 -0
- package/icons/providers/chutes.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/commandcode.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/decart.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/digitalocean.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/dothoosh.webp +0 -0
- package/icons/providers/dotsstudio.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/empiriolabs.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/firecrawl.webp +0 -0
- package/icons/providers/fireworks.webp +0 -0
- package/icons/providers/fishaudio.webp +0 -0
- package/icons/providers/flexai.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/gmicloud.webp +0 -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/greenpt.webp +0 -0
- package/icons/providers/greptile.webp +0 -0
- package/icons/providers/grok.webp +0 -0
- package/icons/providers/grokbot.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/happyhorse.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/inceptron.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/ionet.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/kagi.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/ling.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/llmgateway.webp +0 -0
- package/icons/providers/lmstudio.webp +0 -0
- package/icons/providers/lobehub.webp +0 -0
- package/icons/providers/lobot.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/magpie.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/muse.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/nextbit.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/omlx.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/perceptron.webp +0 -0
- package/icons/providers/perplexity.webp +0 -0
- package/icons/providers/phala.webp +0 -0
- package/icons/providers/phidata.webp +0 -0
- package/icons/providers/phind.webp +0 -0
- package/icons/providers/pi.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/poolside.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/reflection.webp +0 -0
- package/icons/providers/reka.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/sakana.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/searxng.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/sub2api.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/tabbit.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/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/typesafeai.webp +0 -0
- package/icons/providers/udio.webp +0 -0
- package/icons/providers/unionalpha.webp +0 -0
- package/icons/providers/unsloth.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/wafer.webp +0 -0
- package/icons/providers/wandb.webp +0 -0
- package/icons/providers/wavespeed.webp +0 -0
- package/icons/providers/wenxin.webp +0 -0
- package/icons/providers/windsurf.webp +0 -0
- package/icons/providers/workbuddy.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/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/licenses/beautiful-ui-MIT.txt +21 -0
- package/package.json +53 -10
- package/scripts/yunui-audit.mjs +664 -0
- package/scripts/yunui-cli.mjs +868 -0
- package/scripts/yunui-init.mjs +138 -0
- package/styles/content.css +37 -3
- package/styles/tokens.css +41 -0
- package/styles/yunui.css +1586 -141
- package/dist/chunk-BCOKFWXC.js.map +0 -1
- package/dist/chunk-DDUP7GAX.js +0 -86
- package/dist/chunk-DDUP7GAX.js.map +0 -1
- package/dist/chunk-F2HG4TOQ.js.map +0 -1
- package/dist/chunk-HH3JBHRP.js +0 -1211
- package/dist/chunk-HH3JBHRP.js.map +0 -1
- package/dist/chunk-N4QO7RN5.js +0 -98
- package/dist/chunk-N4QO7RN5.js.map +0 -1
- package/dist/chunk-QEIBYOG2.js +0 -188
- package/dist/chunk-QEIBYOG2.js.map +0 -1
- package/dist/footer-BoFu7Wqq.d.ts +0 -46
- package/icons/apps/ling.png +0 -0
- package/icons/models/ling.png +0 -0
- package/icons/providers/Kwaipilot.png +0 -0
package/dist/content.js
CHANGED
|
@@ -1,351 +1,27 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
3
|
-
export {
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
import './chunk-
|
|
2
|
+
import { useContentDarkMode, CodeBlock, InlineCode } from './chunk-VNKAEQKU.js';
|
|
3
|
+
export { CodeBlock, InlineCode } from './chunk-VNKAEQKU.js';
|
|
4
|
+
import { ImageLightbox } from './chunk-OM7B4O6K.js';
|
|
5
|
+
export { ImageLightbox } from './chunk-OM7B4O6K.js';
|
|
6
|
+
import { useContentT } from './chunk-FJ52MVRF.js';
|
|
7
|
+
import { Alert, TooltipProvider, Tooltip, TooltipTrigger, TooltipContent } from './chunk-I2DAKAD5.js';
|
|
8
|
+
import './chunk-Z6WXDNBJ.js';
|
|
9
|
+
import { cn } from './chunk-VSS7ASN2.js';
|
|
10
|
+
import './chunk-P6LU2FWV.js';
|
|
11
|
+
import './chunk-GWD5W5F5.js';
|
|
7
12
|
import * as React2 from 'react';
|
|
8
|
-
import {
|
|
9
|
-
import ReactMarkdown from 'react-markdown';
|
|
13
|
+
import { useRef, useState, useEffect, useMemo } from 'react';
|
|
14
|
+
import ReactMarkdown, { defaultUrlTransform } from 'react-markdown';
|
|
10
15
|
import remarkGfm from 'remark-gfm';
|
|
11
16
|
import remarkMath from 'remark-math';
|
|
12
17
|
import rehypeRaw from 'rehype-raw';
|
|
13
18
|
import rehypeKatex from 'rehype-katex';
|
|
14
19
|
import rehypeSlug from 'rehype-slug';
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
20
|
+
import { CheckCircle2, XOctagon, AlertTriangle, AlertCircle, Lightbulb, Info, ExternalLink, Link2 } from 'lucide-react';
|
|
21
|
+
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
22
|
+
import rehypeSanitize, { defaultSchema } from 'rehype-sanitize';
|
|
19
23
|
import katex from 'katex';
|
|
20
24
|
|
|
21
|
-
var languageNames = {
|
|
22
|
-
js: "JavaScript",
|
|
23
|
-
javascript: "JavaScript",
|
|
24
|
-
ts: "TypeScript",
|
|
25
|
-
typescript: "TypeScript",
|
|
26
|
-
tsx: "TSX",
|
|
27
|
-
jsx: "JSX",
|
|
28
|
-
py: "Python",
|
|
29
|
-
python: "Python",
|
|
30
|
-
rb: "Ruby",
|
|
31
|
-
ruby: "Ruby",
|
|
32
|
-
go: "Go",
|
|
33
|
-
rust: "Rust",
|
|
34
|
-
rs: "Rust",
|
|
35
|
-
cpp: "C++",
|
|
36
|
-
c: "C",
|
|
37
|
-
java: "Java",
|
|
38
|
-
kotlin: "Kotlin",
|
|
39
|
-
kt: "Kotlin",
|
|
40
|
-
swift: "Swift",
|
|
41
|
-
php: "PHP",
|
|
42
|
-
sql: "SQL",
|
|
43
|
-
html: "HTML",
|
|
44
|
-
css: "CSS",
|
|
45
|
-
scss: "SCSS",
|
|
46
|
-
sass: "Sass",
|
|
47
|
-
json: "JSON",
|
|
48
|
-
yaml: "YAML",
|
|
49
|
-
yml: "YAML",
|
|
50
|
-
xml: "XML",
|
|
51
|
-
md: "Markdown",
|
|
52
|
-
markdown: "Markdown",
|
|
53
|
-
bash: "Bash",
|
|
54
|
-
sh: "Shell",
|
|
55
|
-
shell: "Shell",
|
|
56
|
-
zsh: "Zsh",
|
|
57
|
-
powershell: "PowerShell",
|
|
58
|
-
ps1: "PowerShell",
|
|
59
|
-
dockerfile: "Dockerfile",
|
|
60
|
-
docker: "Docker",
|
|
61
|
-
graphql: "GraphQL",
|
|
62
|
-
vue: "Vue",
|
|
63
|
-
svelte: "Svelte",
|
|
64
|
-
diff: "Diff",
|
|
65
|
-
plaintext: "Plain Text",
|
|
66
|
-
text: "Plain Text"
|
|
67
|
-
};
|
|
68
|
-
var langExtMap = {
|
|
69
|
-
typescript: "ts",
|
|
70
|
-
javascript: "js",
|
|
71
|
-
python: "py",
|
|
72
|
-
bash: "sh",
|
|
73
|
-
shell: "sh",
|
|
74
|
-
markdown: "md"
|
|
75
|
-
};
|
|
76
|
-
var shikiLanguages = {
|
|
77
|
-
bash: () => import('shiki/langs/bash.mjs'),
|
|
78
|
-
c: () => import('shiki/langs/c.mjs'),
|
|
79
|
-
cpp: () => import('shiki/langs/cpp.mjs'),
|
|
80
|
-
css: () => import('shiki/langs/css.mjs'),
|
|
81
|
-
diff: () => import('shiki/langs/diff.mjs'),
|
|
82
|
-
dockerfile: () => import('shiki/langs/dockerfile.mjs'),
|
|
83
|
-
go: () => import('shiki/langs/go.mjs'),
|
|
84
|
-
graphql: () => import('shiki/langs/graphql.mjs'),
|
|
85
|
-
html: () => import('shiki/langs/html.mjs'),
|
|
86
|
-
java: () => import('shiki/langs/java.mjs'),
|
|
87
|
-
javascript: () => import('shiki/langs/javascript.mjs'),
|
|
88
|
-
json: () => import('shiki/langs/json.mjs'),
|
|
89
|
-
jsx: () => import('shiki/langs/jsx.mjs'),
|
|
90
|
-
kotlin: () => import('shiki/langs/kotlin.mjs'),
|
|
91
|
-
markdown: () => import('shiki/langs/markdown.mjs'),
|
|
92
|
-
php: () => import('shiki/langs/php.mjs'),
|
|
93
|
-
powershell: () => import('shiki/langs/powershell.mjs'),
|
|
94
|
-
python: () => import('shiki/langs/python.mjs'),
|
|
95
|
-
ruby: () => import('shiki/langs/ruby.mjs'),
|
|
96
|
-
rust: () => import('shiki/langs/rust.mjs'),
|
|
97
|
-
sass: () => import('shiki/langs/sass.mjs'),
|
|
98
|
-
scss: () => import('shiki/langs/scss.mjs'),
|
|
99
|
-
sql: () => import('shiki/langs/sql.mjs'),
|
|
100
|
-
svelte: () => import('shiki/langs/svelte.mjs'),
|
|
101
|
-
swift: () => import('shiki/langs/swift.mjs'),
|
|
102
|
-
tsx: () => import('shiki/langs/tsx.mjs'),
|
|
103
|
-
typescript: () => import('shiki/langs/typescript.mjs'),
|
|
104
|
-
vue: () => import('shiki/langs/vue.mjs'),
|
|
105
|
-
xml: () => import('shiki/langs/xml.mjs'),
|
|
106
|
-
yaml: () => import('shiki/langs/yaml.mjs')
|
|
107
|
-
};
|
|
108
|
-
var shikiLanguageAliases = {
|
|
109
|
-
cxx: "cpp",
|
|
110
|
-
docker: "dockerfile",
|
|
111
|
-
js: "javascript",
|
|
112
|
-
kt: "kotlin",
|
|
113
|
-
md: "markdown",
|
|
114
|
-
py: "python",
|
|
115
|
-
rb: "ruby",
|
|
116
|
-
rs: "rust",
|
|
117
|
-
sh: "bash",
|
|
118
|
-
shell: "bash",
|
|
119
|
-
ts: "typescript",
|
|
120
|
-
yml: "yaml",
|
|
121
|
-
zsh: "bash"
|
|
122
|
-
};
|
|
123
|
-
var shikiThemes = {
|
|
124
|
-
"github-dark": () => import('shiki/themes/github-dark.mjs'),
|
|
125
|
-
"github-light": () => import('shiki/themes/github-light.mjs')
|
|
126
|
-
};
|
|
127
|
-
var contentHighlighterPromise;
|
|
128
|
-
var languageLoadPromises = /* @__PURE__ */ new Map();
|
|
129
|
-
var themeLoadPromises = /* @__PURE__ */ new Map();
|
|
130
|
-
function getContentHighlighter() {
|
|
131
|
-
contentHighlighterPromise ??= createHighlighterCore({
|
|
132
|
-
// The JavaScript regex engine avoids a WASM payload and is sufficient for
|
|
133
|
-
// browser-side highlighting of the curated grammar set above.
|
|
134
|
-
engine: createJavaScriptRegexEngine()
|
|
135
|
-
});
|
|
136
|
-
return contentHighlighterPromise;
|
|
137
|
-
}
|
|
138
|
-
async function ensureLanguage(highlighter, language) {
|
|
139
|
-
if (language === "plaintext" || highlighter.getLoadedLanguages().includes(language)) {
|
|
140
|
-
return;
|
|
141
|
-
}
|
|
142
|
-
let pending = languageLoadPromises.get(language);
|
|
143
|
-
if (!pending) {
|
|
144
|
-
pending = (async () => {
|
|
145
|
-
const registration = (await shikiLanguages[language]()).default;
|
|
146
|
-
await highlighter.loadLanguage(registration);
|
|
147
|
-
})();
|
|
148
|
-
languageLoadPromises.set(language, pending);
|
|
149
|
-
}
|
|
150
|
-
await pending;
|
|
151
|
-
}
|
|
152
|
-
async function ensureTheme(highlighter, theme) {
|
|
153
|
-
if (highlighter.getLoadedThemes().includes(theme)) return;
|
|
154
|
-
let pending = themeLoadPromises.get(theme);
|
|
155
|
-
if (!pending) {
|
|
156
|
-
pending = (async () => {
|
|
157
|
-
const registration = (await shikiThemes[theme]()).default;
|
|
158
|
-
await highlighter.loadTheme(registration);
|
|
159
|
-
})();
|
|
160
|
-
themeLoadPromises.set(theme, pending);
|
|
161
|
-
}
|
|
162
|
-
await pending;
|
|
163
|
-
}
|
|
164
|
-
async function highlightToHtml(code, options) {
|
|
165
|
-
const highlighter = await getContentHighlighter();
|
|
166
|
-
const language = options.lang;
|
|
167
|
-
const theme = options.theme;
|
|
168
|
-
await Promise.all([
|
|
169
|
-
ensureLanguage(highlighter, language),
|
|
170
|
-
ensureTheme(highlighter, theme)
|
|
171
|
-
]);
|
|
172
|
-
return highlighter.codeToHtml(code, options);
|
|
173
|
-
}
|
|
174
|
-
function resolveShikiLanguage(language) {
|
|
175
|
-
const normalized = language.trim().toLowerCase();
|
|
176
|
-
if (!normalized || normalized === "text" || normalized === "plaintext") {
|
|
177
|
-
return "plaintext";
|
|
178
|
-
}
|
|
179
|
-
if (normalized in shikiLanguages) return normalized;
|
|
180
|
-
return shikiLanguageAliases[normalized] ?? "plaintext";
|
|
181
|
-
}
|
|
182
|
-
function useIsDarkMode() {
|
|
183
|
-
const [isDark, setIsDark] = useState(false);
|
|
184
|
-
useEffect(() => {
|
|
185
|
-
const check = () => setIsDark(document.documentElement.classList.contains("dark"));
|
|
186
|
-
check();
|
|
187
|
-
const observer = new MutationObserver(check);
|
|
188
|
-
observer.observe(document.documentElement, {
|
|
189
|
-
attributes: true,
|
|
190
|
-
attributeFilter: ["class"]
|
|
191
|
-
});
|
|
192
|
-
return () => observer.disconnect();
|
|
193
|
-
}, []);
|
|
194
|
-
return isDark;
|
|
195
|
-
}
|
|
196
|
-
function CodeBlock({
|
|
197
|
-
children,
|
|
198
|
-
language = "plaintext",
|
|
199
|
-
showLineNumbers = false,
|
|
200
|
-
highlightLines = [],
|
|
201
|
-
filename,
|
|
202
|
-
className,
|
|
203
|
-
onEdit
|
|
204
|
-
}) {
|
|
205
|
-
const [copied, setCopied] = useState(false);
|
|
206
|
-
const [highlightedCode, setHighlightedCode] = useState("");
|
|
207
|
-
const [isLoading, setIsLoading] = useState(true);
|
|
208
|
-
const isDark = useIsDarkMode();
|
|
209
|
-
const t = useContentT();
|
|
210
|
-
const code = useMemo(
|
|
211
|
-
() => typeof children === "string" ? children.trim() : String(children).trim(),
|
|
212
|
-
[children]
|
|
213
|
-
);
|
|
214
|
-
const displayLanguage = languageNames[language?.toLowerCase()] || language?.toUpperCase() || "CODE";
|
|
215
|
-
const handleEdit = useCallback(() => {
|
|
216
|
-
if (!onEdit) return;
|
|
217
|
-
const ext = langExtMap[language?.toLowerCase()] || language || "txt";
|
|
218
|
-
onEdit({ code, language, filename: filename || `snippet.${ext}` });
|
|
219
|
-
}, [onEdit, code, language, filename]);
|
|
220
|
-
useEffect(() => {
|
|
221
|
-
let cancelled = false;
|
|
222
|
-
async function highlight() {
|
|
223
|
-
setIsLoading(true);
|
|
224
|
-
try {
|
|
225
|
-
const theme = isDark ? "github-dark" : "github-light";
|
|
226
|
-
const lang = resolveShikiLanguage(language || "plaintext");
|
|
227
|
-
const html = await highlightToHtml(code, {
|
|
228
|
-
lang,
|
|
229
|
-
theme,
|
|
230
|
-
transformers: [
|
|
231
|
-
{
|
|
232
|
-
line(node, line) {
|
|
233
|
-
if (showLineNumbers) node.properties["data-line"] = line;
|
|
234
|
-
if (highlightLines.includes(line)) {
|
|
235
|
-
node.properties["class"] = `${node.properties["class"] || ""} highlighted-line`;
|
|
236
|
-
}
|
|
237
|
-
}
|
|
238
|
-
}
|
|
239
|
-
]
|
|
240
|
-
});
|
|
241
|
-
if (!cancelled) {
|
|
242
|
-
setHighlightedCode(html);
|
|
243
|
-
setIsLoading(false);
|
|
244
|
-
}
|
|
245
|
-
} catch {
|
|
246
|
-
if (!cancelled) {
|
|
247
|
-
setHighlightedCode(
|
|
248
|
-
`<pre class="shiki"><code>${escapeHtml(code)}</code></pre>`
|
|
249
|
-
);
|
|
250
|
-
setIsLoading(false);
|
|
251
|
-
}
|
|
252
|
-
}
|
|
253
|
-
}
|
|
254
|
-
highlight();
|
|
255
|
-
return () => {
|
|
256
|
-
cancelled = true;
|
|
257
|
-
};
|
|
258
|
-
}, [code, language, isDark, showLineNumbers, highlightLines]);
|
|
259
|
-
const handleCopy = async () => {
|
|
260
|
-
try {
|
|
261
|
-
if (navigator.clipboard?.writeText) {
|
|
262
|
-
await navigator.clipboard.writeText(code);
|
|
263
|
-
} else {
|
|
264
|
-
const textArea = document.createElement("textarea");
|
|
265
|
-
textArea.value = code;
|
|
266
|
-
document.body.appendChild(textArea);
|
|
267
|
-
textArea.select();
|
|
268
|
-
document.execCommand("copy");
|
|
269
|
-
document.body.removeChild(textArea);
|
|
270
|
-
}
|
|
271
|
-
setCopied(true);
|
|
272
|
-
setTimeout(() => setCopied(false), 2e3);
|
|
273
|
-
} catch {
|
|
274
|
-
}
|
|
275
|
-
};
|
|
276
|
-
const btnBase = "flex items-center gap-1.5 px-2.5 py-1 rounded-md text-xs font-medium transition-all hover:bg-(--accent-subtle) outline-none focus-visible:ring-2 focus-visible:ring-ring";
|
|
277
|
-
return /* @__PURE__ */ jsxs(
|
|
278
|
-
"div",
|
|
279
|
-
{
|
|
280
|
-
className: cn(
|
|
281
|
-
"card group my-4 overflow-hidden max-w-full min-w-0",
|
|
282
|
-
className
|
|
283
|
-
),
|
|
284
|
-
children: [
|
|
285
|
-
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between px-4 py-2.5 border-b border-(--border-hairline) bg-(--bg-elevated)", children: [
|
|
286
|
-
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2.5", children: [
|
|
287
|
-
/* @__PURE__ */ jsxs("div", { className: "flex gap-1", children: [
|
|
288
|
-
/* @__PURE__ */ jsx("div", { className: "w-2 h-2 rounded-full bg-(--error) opacity-80" }),
|
|
289
|
-
/* @__PURE__ */ jsx("div", { className: "w-2 h-2 rounded-full bg-(--warning) opacity-80" }),
|
|
290
|
-
/* @__PURE__ */ jsx("div", { className: "w-2 h-2 rounded-full bg-(--success) opacity-80" })
|
|
291
|
-
] }),
|
|
292
|
-
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 })
|
|
293
|
-
] }),
|
|
294
|
-
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1.5", children: [
|
|
295
|
-
onEdit && /* @__PURE__ */ jsxs("button", { onClick: handleEdit, className: cn(btnBase, "text-(--text-secondary)"), children: [
|
|
296
|
-
/* @__PURE__ */ jsx(Edit3, { className: "w-3.5 h-3.5" }),
|
|
297
|
-
t("edit", "Edit")
|
|
298
|
-
] }),
|
|
299
|
-
/* @__PURE__ */ jsx("button", { onClick: handleCopy, className: btnBase, children: copied ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
300
|
-
/* @__PURE__ */ jsx(Check, { className: "w-3.5 h-3.5 text-(--success)" }),
|
|
301
|
-
/* @__PURE__ */ jsx("span", { className: "text-(--success)", children: t("copied", "Copied") })
|
|
302
|
-
] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
303
|
-
/* @__PURE__ */ jsx(Copy, { className: "w-3.5 h-3.5 text-(--text-secondary)" }),
|
|
304
|
-
/* @__PURE__ */ jsx("span", { className: "text-(--text-secondary)", children: t("copy", "Copy") })
|
|
305
|
-
] }) })
|
|
306
|
-
] })
|
|
307
|
-
] }),
|
|
308
|
-
/* @__PURE__ */ jsx(
|
|
309
|
-
"div",
|
|
310
|
-
{
|
|
311
|
-
tabIndex: 0,
|
|
312
|
-
className: cn(
|
|
313
|
-
"overflow-x-auto overflow-y-auto p-4 max-h-100 bg-(--bg-base)",
|
|
314
|
-
showLineNumbers && "code-with-line-numbers"
|
|
315
|
-
),
|
|
316
|
-
children: isLoading ? /* @__PURE__ */ jsx("pre", { className: "text-sm font-mono", children: /* @__PURE__ */ jsx("code", { children: code }) }) : /* @__PURE__ */ jsx(
|
|
317
|
-
"div",
|
|
318
|
-
{
|
|
319
|
-
className: "shiki-wrapper text-sm [&_pre]:bg-transparent! [&_code]:bg-transparent!",
|
|
320
|
-
dangerouslySetInnerHTML: { __html: highlightedCode }
|
|
321
|
-
}
|
|
322
|
-
)
|
|
323
|
-
}
|
|
324
|
-
)
|
|
325
|
-
]
|
|
326
|
-
}
|
|
327
|
-
);
|
|
328
|
-
}
|
|
329
|
-
function InlineCode({
|
|
330
|
-
children,
|
|
331
|
-
className
|
|
332
|
-
}) {
|
|
333
|
-
return /* @__PURE__ */ jsx(
|
|
334
|
-
"code",
|
|
335
|
-
{
|
|
336
|
-
className: cn(
|
|
337
|
-
"px-1.5 py-0.5 mx-0.5 rounded text-sm font-mono",
|
|
338
|
-
"bg-(--accent-subtle) text-(--text-primary) border border-(--border-hairline)",
|
|
339
|
-
"wrap-break-word",
|
|
340
|
-
className
|
|
341
|
-
),
|
|
342
|
-
children
|
|
343
|
-
}
|
|
344
|
-
);
|
|
345
|
-
}
|
|
346
|
-
function escapeHtml(str) {
|
|
347
|
-
return str.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
348
|
-
}
|
|
349
25
|
var mermaidSeq = 0;
|
|
350
26
|
var NEEDS_MANUAL_ROUGHENING = /* @__PURE__ */ new Set([
|
|
351
27
|
"sequenceDiagram",
|
|
@@ -396,7 +72,7 @@ function MermaidDiagram({
|
|
|
396
72
|
const [svg, setSvg] = useState("");
|
|
397
73
|
const [error, setError] = useState("");
|
|
398
74
|
const [isLoading, setIsLoading] = useState(true);
|
|
399
|
-
const
|
|
75
|
+
const isDark = useContentDarkMode();
|
|
400
76
|
const [zoomOpen, setZoomOpen] = useState(false);
|
|
401
77
|
const t = useContentT();
|
|
402
78
|
useEffect(() => {
|
|
@@ -407,7 +83,6 @@ function MermaidDiagram({
|
|
|
407
83
|
const diagramId = `yunui-mermaid-${mermaidSeq += 1}`;
|
|
408
84
|
try {
|
|
409
85
|
const mermaid = (await import('mermaid')).default;
|
|
410
|
-
const isDark = typeof document !== "undefined" && document.documentElement.classList.contains("dark");
|
|
411
86
|
mermaid.initialize({
|
|
412
87
|
startOnLoad: false,
|
|
413
88
|
theme: isDark ? "dark" : "default",
|
|
@@ -445,16 +120,7 @@ function MermaidDiagram({
|
|
|
445
120
|
return () => {
|
|
446
121
|
cancelled = true;
|
|
447
122
|
};
|
|
448
|
-
}, [chart,
|
|
449
|
-
useEffect(() => {
|
|
450
|
-
if (typeof document === "undefined") return;
|
|
451
|
-
const observer = new MutationObserver(() => setThemeTick((n) => n + 1));
|
|
452
|
-
observer.observe(document.documentElement, {
|
|
453
|
-
attributes: true,
|
|
454
|
-
attributeFilter: ["class"]
|
|
455
|
-
});
|
|
456
|
-
return () => observer.disconnect();
|
|
457
|
-
}, []);
|
|
123
|
+
}, [chart, isDark]);
|
|
458
124
|
if (error) {
|
|
459
125
|
return /* @__PURE__ */ jsx(
|
|
460
126
|
"div",
|
|
@@ -498,6 +164,12 @@ function MermaidDiagram({
|
|
|
498
164
|
{
|
|
499
165
|
ref: containerRef,
|
|
500
166
|
onClick: enableZoom ? () => setZoomOpen(true) : void 0,
|
|
167
|
+
onKeyDown: enableZoom ? (event) => {
|
|
168
|
+
if (event.key === "Enter" || event.key === " ") {
|
|
169
|
+
event.preventDefault();
|
|
170
|
+
setZoomOpen(true);
|
|
171
|
+
}
|
|
172
|
+
} : void 0,
|
|
501
173
|
role: enableZoom ? "button" : void 0,
|
|
502
174
|
"aria-label": enableZoom ? t("zoomDiagram", "Zoom diagram") : void 0,
|
|
503
175
|
tabIndex: 0,
|
|
@@ -571,105 +243,398 @@ function parseCalloutType(text) {
|
|
|
571
243
|
}
|
|
572
244
|
var ContentImage = React2.memo(function ContentImage2({
|
|
573
245
|
enableLightbox = true,
|
|
246
|
+
zoomLabel,
|
|
574
247
|
className,
|
|
248
|
+
style,
|
|
575
249
|
alt = "",
|
|
576
250
|
src,
|
|
251
|
+
srcSet,
|
|
577
252
|
onError,
|
|
578
253
|
onLoad,
|
|
254
|
+
onClick,
|
|
255
|
+
onKeyDown,
|
|
256
|
+
role,
|
|
257
|
+
tabIndex,
|
|
258
|
+
"aria-label": ariaLabel,
|
|
579
259
|
...rest
|
|
580
260
|
}) {
|
|
581
|
-
const [loaded, setLoaded] = useState(false);
|
|
582
|
-
const [failed, setFailed] = useState(false);
|
|
583
|
-
const [lightboxOpen, setLightboxOpen] = useState(false);
|
|
584
|
-
const imgRef = useRef(null);
|
|
585
|
-
const wrapperRef = useRef(null);
|
|
586
261
|
const t = useContentT();
|
|
587
262
|
const srcString = typeof src === "string" ? src : "";
|
|
588
|
-
const
|
|
263
|
+
const srcSetString = typeof srcSet === "string" ? srcSet : void 0;
|
|
264
|
+
const valid = Boolean(srcString && srcString !== "#" && srcString !== "undefined" && srcString !== "null");
|
|
265
|
+
const generationRef = useRef({ src: srcString, srcSet: srcSetString, generation: 0 });
|
|
266
|
+
if (generationRef.current.src !== srcString || generationRef.current.srcSet !== srcSetString) {
|
|
267
|
+
generationRef.current = {
|
|
268
|
+
src: srcString,
|
|
269
|
+
srcSet: srcSetString,
|
|
270
|
+
generation: generationRef.current.generation + 1
|
|
271
|
+
};
|
|
272
|
+
}
|
|
273
|
+
const generation = generationRef.current.generation;
|
|
274
|
+
const lightboxEpochRef = useRef({ enabled: enableLightbox, epoch: 0 });
|
|
275
|
+
if (lightboxEpochRef.current.enabled !== enableLightbox) {
|
|
276
|
+
lightboxEpochRef.current = {
|
|
277
|
+
enabled: enableLightbox,
|
|
278
|
+
epoch: lightboxEpochRef.current.epoch + 1
|
|
279
|
+
};
|
|
280
|
+
}
|
|
281
|
+
const lightboxEpoch = lightboxEpochRef.current.epoch;
|
|
282
|
+
const [status, setStatus] = useState(null);
|
|
283
|
+
const [requestedGeneration, setRequestedGeneration] = useState(null);
|
|
284
|
+
const [openState, setOpenState] = useState(null);
|
|
285
|
+
const [insideLink, setInsideLink] = useState(false);
|
|
286
|
+
const imgRef = useRef(null);
|
|
287
|
+
const wrapperRef = useRef(null);
|
|
288
|
+
const currentStatus = status?.generation === generation ? status.value : "loading";
|
|
289
|
+
const loaded = currentStatus === "loaded";
|
|
290
|
+
const failed = currentStatus === "failed";
|
|
291
|
+
const canZoom = enableLightbox && loaded && !insideLink;
|
|
292
|
+
const lightboxOpen = enableLightbox && openState?.generation === generation && openState.lightboxEpoch === lightboxEpoch;
|
|
293
|
+
const accessibleZoomLabel = zoomLabel ?? `${t("zoomImage", "Zoom image")}${alt ? `: ${alt}` : ""}`;
|
|
589
294
|
useEffect(() => {
|
|
295
|
+
setInsideLink(Boolean(imgRef.current?.closest("a")));
|
|
590
296
|
if (!wrapperRef.current || !valid) return;
|
|
591
|
-
const
|
|
592
|
-
const
|
|
297
|
+
const root = wrapperRef.current.closest('[data-scroll-container="true"]');
|
|
298
|
+
const image = imgRef.current;
|
|
299
|
+
if (!image) return;
|
|
300
|
+
if (typeof IntersectionObserver === "undefined") {
|
|
301
|
+
setRequestedGeneration(generation);
|
|
302
|
+
return;
|
|
303
|
+
}
|
|
593
304
|
const observer = new IntersectionObserver(
|
|
594
305
|
(entries) => {
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
306
|
+
if (generationRef.current.generation !== generation || !image.isConnected) return;
|
|
307
|
+
for (const entry of entries) {
|
|
308
|
+
if (entry.isIntersecting) {
|
|
309
|
+
setRequestedGeneration(generation);
|
|
598
310
|
observer.unobserve(entry.target);
|
|
311
|
+
break;
|
|
599
312
|
}
|
|
600
|
-
}
|
|
313
|
+
}
|
|
601
314
|
},
|
|
602
|
-
{
|
|
603
|
-
root,
|
|
604
|
-
rootMargin: "300px 0px",
|
|
605
|
-
threshold: 0.01
|
|
606
|
-
}
|
|
315
|
+
{ root, rootMargin: "300px 0px", threshold: 0.01 }
|
|
607
316
|
);
|
|
608
317
|
observer.observe(wrapperRef.current);
|
|
609
318
|
return () => observer.disconnect();
|
|
610
|
-
}, [srcString, valid]);
|
|
319
|
+
}, [srcString, valid, generation]);
|
|
611
320
|
if (!valid) return null;
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
321
|
+
const isCurrentImage = (event) => generationRef.current.generation === generation && event.currentTarget === imgRef.current;
|
|
322
|
+
const handleLoad = (event) => {
|
|
323
|
+
onLoad?.(event);
|
|
324
|
+
if (isCurrentImage(event)) setStatus({ generation, value: "loaded" });
|
|
325
|
+
};
|
|
326
|
+
const handleError = (event) => {
|
|
327
|
+
onError?.(event);
|
|
328
|
+
if (isCurrentImage(event)) setStatus({ generation, value: "failed" });
|
|
329
|
+
};
|
|
330
|
+
const openPreview = (event) => {
|
|
331
|
+
if (onClick) onClick(event);
|
|
332
|
+
if (event.defaultPrevented || !canZoom || imgRef.current?.closest("a")) return;
|
|
333
|
+
event.currentTarget.focus();
|
|
334
|
+
event.stopPropagation();
|
|
335
|
+
setOpenState({ generation, lightboxEpoch });
|
|
336
|
+
};
|
|
337
|
+
const handleKeyDown = (event) => {
|
|
338
|
+
onKeyDown?.(event);
|
|
339
|
+
if (event.defaultPrevented || !canZoom || imgRef.current?.closest("a")) return;
|
|
340
|
+
if (event.key === "Enter" || event.key === " ") {
|
|
341
|
+
event.preventDefault();
|
|
342
|
+
event.stopPropagation();
|
|
343
|
+
event.currentTarget.focus();
|
|
344
|
+
setOpenState({ generation, lightboxEpoch });
|
|
345
|
+
}
|
|
346
|
+
};
|
|
618
347
|
return /* @__PURE__ */ jsxs(
|
|
619
348
|
"span",
|
|
620
349
|
{
|
|
621
350
|
ref: wrapperRef,
|
|
622
351
|
className: "inline-block max-w-full overflow-hidden relative",
|
|
623
352
|
style: {
|
|
624
|
-
minHeight: loaded ? "auto" : "200px",
|
|
625
|
-
minWidth: loaded ? "auto" : "200px"
|
|
353
|
+
minHeight: loaded || failed ? "auto" : "200px",
|
|
354
|
+
minWidth: loaded || failed ? "auto" : "200px"
|
|
626
355
|
},
|
|
627
356
|
children: [
|
|
628
|
-
!loaded && /* @__PURE__ */ jsx("span", { className: "absolute inset-0 flex items-center justify-center bg-(--bg-elevated) rounded-xl", children: /* @__PURE__ */ jsx("span", { className: "w-6 h-6 border-2 border-primary border-t-transparent rounded-full animate-spin block" }) }),
|
|
357
|
+
!loaded && !failed && /* @__PURE__ */ jsx("span", { className: "absolute inset-0 flex items-center justify-center bg-(--bg-elevated) rounded-xl", "aria-hidden": "true", children: /* @__PURE__ */ jsx("span", { className: "w-6 h-6 border-2 border-primary border-t-transparent rounded-full animate-spin block" }) }),
|
|
358
|
+
failed && /* @__PURE__ */ jsx("span", { className: "inline-flex items-center justify-center bg-error-soft px-3 py-2 rounded-xl border border-error-soft text-center", children: /* @__PURE__ */ jsxs("span", { className: "text-error text-sm", children: [
|
|
359
|
+
"\u{1F5BC}\uFE0F ",
|
|
360
|
+
t("imageLoadingFailed", "Image failed to load")
|
|
361
|
+
] }) }),
|
|
629
362
|
/* @__PURE__ */ jsx(
|
|
630
363
|
"img",
|
|
631
364
|
{
|
|
632
365
|
ref: imgRef,
|
|
633
366
|
alt,
|
|
367
|
+
src: requestedGeneration === generation ? srcString : void 0,
|
|
368
|
+
srcSet: requestedGeneration === generation ? srcSetString : void 0,
|
|
634
369
|
className: cn(
|
|
635
|
-
"max-w-full h-auto rounded-xl shadow-sm border border-(--border-hairline) transition-opacity duration-
|
|
370
|
+
"max-w-full h-auto rounded-xl shadow-sm border border-(--border-hairline) transition-opacity duration-(--dur-slow)",
|
|
636
371
|
loaded ? "opacity-100" : "opacity-0",
|
|
637
|
-
|
|
372
|
+
canZoom && "cursor-zoom-in",
|
|
373
|
+
canZoom && "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-primary",
|
|
374
|
+
failed && "hidden",
|
|
638
375
|
className
|
|
639
376
|
),
|
|
640
|
-
style: { maxHeight: "80vh" },
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
onError:
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
},
|
|
649
|
-
onClick: enableLightbox ? () => setLightboxOpen(true) : void 0,
|
|
377
|
+
style: { ...style, maxHeight: style?.maxHeight ?? "80vh" },
|
|
378
|
+
role: loaded && !failed ? role ?? (canZoom ? "button" : void 0) : void 0,
|
|
379
|
+
tabIndex: loaded && !failed ? tabIndex ?? (canZoom ? 0 : void 0) : void 0,
|
|
380
|
+
"aria-label": ariaLabel ?? (canZoom ? accessibleZoomLabel : void 0),
|
|
381
|
+
onLoad: handleLoad,
|
|
382
|
+
onError: handleError,
|
|
383
|
+
onClick: openPreview,
|
|
384
|
+
onKeyDown: handleKeyDown,
|
|
650
385
|
...rest
|
|
651
|
-
}
|
|
386
|
+
},
|
|
387
|
+
generation
|
|
652
388
|
),
|
|
653
389
|
enableLightbox && /* @__PURE__ */ jsx(
|
|
654
390
|
ImageLightbox,
|
|
655
391
|
{
|
|
656
392
|
src: srcString,
|
|
657
393
|
alt,
|
|
394
|
+
label: t("imagePreview", "Image preview") + (alt ? `: ${alt}` : ""),
|
|
658
395
|
isOpen: lightboxOpen,
|
|
659
|
-
onClose: () =>
|
|
396
|
+
onClose: () => setOpenState(null)
|
|
660
397
|
}
|
|
661
398
|
)
|
|
662
399
|
]
|
|
663
400
|
}
|
|
664
401
|
);
|
|
665
402
|
});
|
|
403
|
+
var schema = {
|
|
404
|
+
...defaultSchema,
|
|
405
|
+
clobberPrefix: "user-content-",
|
|
406
|
+
tagNames: [...defaultSchema.tagNames ?? [], "mark", "abbr"],
|
|
407
|
+
strip: [...defaultSchema.strip ?? [], "style", "iframe", "object", "embed", "svg", "math", "template", "form"],
|
|
408
|
+
attributes: {
|
|
409
|
+
...defaultSchema.attributes,
|
|
410
|
+
"*": (defaultSchema.attributes?.["*"] ?? []).filter((attribute) => attribute !== "tabIndex" && attribute !== "accessKey"),
|
|
411
|
+
code: [[
|
|
412
|
+
"className",
|
|
413
|
+
/^language-[\w+-]+$/,
|
|
414
|
+
"math-inline",
|
|
415
|
+
"math-display",
|
|
416
|
+
"showLineNumbers",
|
|
417
|
+
/^\{[\d,-]+\}$/,
|
|
418
|
+
/^filename-[A-Za-z0-9._~%\-]{1,1152}$/
|
|
419
|
+
]]
|
|
420
|
+
}
|
|
421
|
+
};
|
|
422
|
+
function visit(node, callback) {
|
|
423
|
+
callback(node);
|
|
424
|
+
if ("children" in node) for (const child of node.children) visit(child, callback);
|
|
425
|
+
}
|
|
426
|
+
function rehypeSanitizeMarkdown() {
|
|
427
|
+
const sanitize = rehypeSanitize(schema);
|
|
428
|
+
return (tree) => {
|
|
429
|
+
const ids = /* @__PURE__ */ new Set();
|
|
430
|
+
visit(tree, (node) => {
|
|
431
|
+
if (node.type === "element") {
|
|
432
|
+
for (const key of ["id", "name"]) {
|
|
433
|
+
const value = node.properties[key];
|
|
434
|
+
if (typeof value === "string") ids.add(value);
|
|
435
|
+
}
|
|
436
|
+
}
|
|
437
|
+
});
|
|
438
|
+
const clean = sanitize(tree);
|
|
439
|
+
const cleanIds = /* @__PURE__ */ new Set();
|
|
440
|
+
visit(clean, (node) => {
|
|
441
|
+
if (node.type !== "element") return;
|
|
442
|
+
for (const key of ["id", "name"]) {
|
|
443
|
+
const value = node.properties[key];
|
|
444
|
+
if (typeof value === "string") cleanIds.add(value);
|
|
445
|
+
}
|
|
446
|
+
});
|
|
447
|
+
visit(clean, (node) => {
|
|
448
|
+
if (node.type !== "element") return;
|
|
449
|
+
const href = node.properties.href;
|
|
450
|
+
if (typeof href !== "string" || !href.startsWith("#")) return;
|
|
451
|
+
let target;
|
|
452
|
+
try {
|
|
453
|
+
target = decodeURIComponent(href.slice(1));
|
|
454
|
+
} catch {
|
|
455
|
+
return;
|
|
456
|
+
}
|
|
457
|
+
const prefixed = `${schema.clobberPrefix}${target}`;
|
|
458
|
+
if (ids.has(target) && cleanIds.has(prefixed)) node.properties.href = `#${encodeURIComponent(prefixed)}`;
|
|
459
|
+
});
|
|
460
|
+
return clean;
|
|
461
|
+
};
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
// src/content/rehype-chunk-fade.ts
|
|
465
|
+
function rehypeChunkFade(state) {
|
|
466
|
+
return () => (tree) => {
|
|
467
|
+
let count = 0;
|
|
468
|
+
const from = state.prev < 0 ? Number.POSITIVE_INFINITY : state.prev;
|
|
469
|
+
const cls = state.flip ? "yunui-chunk-a" : "yunui-chunk-b";
|
|
470
|
+
const walk = (node) => {
|
|
471
|
+
if (!node.children) return;
|
|
472
|
+
if (node.type === "element" && (node.tagName === "pre" || node.tagName === "code")) return;
|
|
473
|
+
const next = [];
|
|
474
|
+
for (const child of node.children) {
|
|
475
|
+
if (child.type === "text" && typeof child.value === "string") {
|
|
476
|
+
const start = count;
|
|
477
|
+
count += child.value.length;
|
|
478
|
+
if (count <= from) {
|
|
479
|
+
next.push(child);
|
|
480
|
+
} else {
|
|
481
|
+
const cut = Math.max(0, from - start);
|
|
482
|
+
if (cut > 0) next.push({ type: "text", value: child.value.slice(0, cut) });
|
|
483
|
+
next.push({
|
|
484
|
+
type: "element",
|
|
485
|
+
tagName: "span",
|
|
486
|
+
properties: { className: [cls] },
|
|
487
|
+
children: [{ type: "text", value: child.value.slice(cut) }]
|
|
488
|
+
});
|
|
489
|
+
}
|
|
490
|
+
} else {
|
|
491
|
+
walk(child);
|
|
492
|
+
next.push(child);
|
|
493
|
+
}
|
|
494
|
+
}
|
|
495
|
+
node.children = next;
|
|
496
|
+
};
|
|
497
|
+
walk(tree);
|
|
498
|
+
state.total = count;
|
|
499
|
+
};
|
|
500
|
+
}
|
|
501
|
+
|
|
502
|
+
// src/content/remark-code-meta.ts
|
|
503
|
+
var MAX_META_LENGTH = 1024;
|
|
504
|
+
var MAX_FILENAME_LENGTH = 128;
|
|
505
|
+
var MAX_HIGHLIGHT_RANGES = 32;
|
|
506
|
+
var filenameClassPattern = /^filename-[A-Za-z0-9._~%\-]{1,1152}$/;
|
|
507
|
+
var languagePattern = /^[A-Za-z0-9_+-]{1,32}$/;
|
|
508
|
+
var highlightPattern = /^\{((?:\d{1,16}(?:-\d{1,16})?)(?:,\d{1,16}(?:-\d{1,16})?)*)\}$/;
|
|
509
|
+
var controlCharacterPattern = /[\u0000-\u001f\u007f]/;
|
|
510
|
+
function tokenizeMeta(meta) {
|
|
511
|
+
if (meta.length > MAX_META_LENGTH) return [];
|
|
512
|
+
const tokens = [];
|
|
513
|
+
let token = "";
|
|
514
|
+
let quote;
|
|
515
|
+
let tokenStarted = false;
|
|
516
|
+
const finishToken = () => {
|
|
517
|
+
if (tokenStarted) tokens.push(token);
|
|
518
|
+
token = "";
|
|
519
|
+
tokenStarted = false;
|
|
520
|
+
};
|
|
521
|
+
for (let index = 0; index < meta.length; index += 1) {
|
|
522
|
+
const character = meta[index];
|
|
523
|
+
if (quote) {
|
|
524
|
+
if (character === "\\" && index + 1 < meta.length) {
|
|
525
|
+
const next = meta[index + 1];
|
|
526
|
+
if (next === quote || next === "\\") {
|
|
527
|
+
token += next;
|
|
528
|
+
index += 1;
|
|
529
|
+
} else {
|
|
530
|
+
token += character;
|
|
531
|
+
}
|
|
532
|
+
} else if (character === quote) {
|
|
533
|
+
quote = void 0;
|
|
534
|
+
} else {
|
|
535
|
+
token += character;
|
|
536
|
+
}
|
|
537
|
+
tokenStarted = true;
|
|
538
|
+
continue;
|
|
539
|
+
}
|
|
540
|
+
if (character === '"' || character === "'") {
|
|
541
|
+
quote = character;
|
|
542
|
+
tokenStarted = true;
|
|
543
|
+
} else if (/\s/.test(character)) {
|
|
544
|
+
finishToken();
|
|
545
|
+
} else {
|
|
546
|
+
token += character;
|
|
547
|
+
tokenStarted = true;
|
|
548
|
+
}
|
|
549
|
+
}
|
|
550
|
+
if (!quote) finishToken();
|
|
551
|
+
return tokens;
|
|
552
|
+
}
|
|
553
|
+
function isHighlightRange(value) {
|
|
554
|
+
const match = highlightPattern.exec(value);
|
|
555
|
+
return Boolean(match && match[1].split(",").length <= MAX_HIGHLIGHT_RANGES);
|
|
556
|
+
}
|
|
557
|
+
function encodeFilename(value) {
|
|
558
|
+
if (!value || value.length > MAX_FILENAME_LENGTH || controlCharacterPattern.test(value)) return void 0;
|
|
559
|
+
try {
|
|
560
|
+
const encoded = encodeURIComponent(value).replace(
|
|
561
|
+
/[!'()*]/g,
|
|
562
|
+
(character) => `%${character.charCodeAt(0).toString(16).toUpperCase()}`
|
|
563
|
+
);
|
|
564
|
+
return encoded.length <= MAX_FILENAME_LENGTH * 9 ? encoded : void 0;
|
|
565
|
+
} catch {
|
|
566
|
+
return void 0;
|
|
567
|
+
}
|
|
568
|
+
}
|
|
569
|
+
function decodeCodeFilenameClass(value) {
|
|
570
|
+
if (!filenameClassPattern.test(value)) return void 0;
|
|
571
|
+
try {
|
|
572
|
+
const filename = decodeURIComponent(value.slice("filename-".length));
|
|
573
|
+
if (!filename || filename.length > MAX_FILENAME_LENGTH || controlCharacterPattern.test(filename)) return void 0;
|
|
574
|
+
return filename;
|
|
575
|
+
} catch {
|
|
576
|
+
return void 0;
|
|
577
|
+
}
|
|
578
|
+
}
|
|
579
|
+
function parseFenceOptions(meta) {
|
|
580
|
+
const options = { showLineNumbers: false };
|
|
581
|
+
for (const token of tokenizeMeta(meta)) {
|
|
582
|
+
if (token === "showLineNumbers") {
|
|
583
|
+
options.showLineNumbers = true;
|
|
584
|
+
} else if (!options.highlightRange && isHighlightRange(token)) {
|
|
585
|
+
options.highlightRange = token;
|
|
586
|
+
} else if (!options.filename && token.startsWith("filename=")) {
|
|
587
|
+
const encoded = encodeFilename(token.slice("filename=".length));
|
|
588
|
+
if (encoded) options.filename = encoded;
|
|
589
|
+
}
|
|
590
|
+
}
|
|
591
|
+
return options;
|
|
592
|
+
}
|
|
593
|
+
function visit2(node, callback) {
|
|
594
|
+
callback(node);
|
|
595
|
+
if (Array.isArray(node.children)) {
|
|
596
|
+
for (const child of node.children) visit2(child, callback);
|
|
597
|
+
}
|
|
598
|
+
}
|
|
599
|
+
function remarkCodeMeta() {
|
|
600
|
+
return (tree) => {
|
|
601
|
+
visit2(tree, (node) => {
|
|
602
|
+
if (node.type !== "code" || typeof node.meta !== "string") return;
|
|
603
|
+
const options = parseFenceOptions(node.meta);
|
|
604
|
+
if (!options.showLineNumbers && !options.highlightRange && !options.filename) return;
|
|
605
|
+
const className = [];
|
|
606
|
+
if (typeof node.lang === "string") {
|
|
607
|
+
const language = node.lang.trim().split(/\s+/)[0];
|
|
608
|
+
if (languagePattern.test(language)) className.push(`language-${language}`);
|
|
609
|
+
}
|
|
610
|
+
if (options.showLineNumbers) className.push("showLineNumbers");
|
|
611
|
+
if (options.highlightRange) className.push(options.highlightRange);
|
|
612
|
+
if (options.filename) className.push(`filename-${options.filename}`);
|
|
613
|
+
const existing = node.data && typeof node.data === "object" ? node.data : {};
|
|
614
|
+
node.data = {
|
|
615
|
+
...existing,
|
|
616
|
+
hProperties: { className }
|
|
617
|
+
};
|
|
618
|
+
});
|
|
619
|
+
};
|
|
620
|
+
}
|
|
666
621
|
function MarkdownRenderer({
|
|
667
622
|
content,
|
|
668
623
|
className,
|
|
669
624
|
urlTransform,
|
|
625
|
+
linkOrigin,
|
|
670
626
|
onCodeEdit,
|
|
671
|
-
renderLink
|
|
627
|
+
renderLink,
|
|
628
|
+
streaming = false
|
|
672
629
|
}) {
|
|
630
|
+
const fade = useRef({ prev: -1, total: 0, flip: false });
|
|
631
|
+
if (!streaming) fade.current.prev = -1;
|
|
632
|
+
useEffect(() => {
|
|
633
|
+
const st = fade.current;
|
|
634
|
+
if (!streaming) return;
|
|
635
|
+
if (st.total !== st.prev) st.flip = !st.flip;
|
|
636
|
+
st.prev = st.total;
|
|
637
|
+
});
|
|
673
638
|
const components = useMemo(
|
|
674
639
|
() => ({
|
|
675
640
|
p: ({ children }) => /* @__PURE__ */ jsx("div", { className: "mb-4 last:mb-0 leading-relaxed", children }),
|
|
@@ -684,11 +649,11 @@ function MarkdownRenderer({
|
|
|
684
649
|
]
|
|
685
650
|
}
|
|
686
651
|
),
|
|
687
|
-
h2: ({ children, id }) => /* @__PURE__ */ jsxs(
|
|
652
|
+
h2: ({ children, id, className: headingClass }) => /* @__PURE__ */ jsxs(
|
|
688
653
|
"h2",
|
|
689
654
|
{
|
|
690
655
|
id,
|
|
691
|
-
className: "group flex items-center gap-2 text-xl font-bold mt-6 mb-3 scroll-mt-20",
|
|
656
|
+
className: cn("group flex items-center gap-2 text-xl font-bold mt-6 mb-3 scroll-mt-20", headingClass),
|
|
692
657
|
children: [
|
|
693
658
|
children,
|
|
694
659
|
id && /* @__PURE__ */ jsx(HeadingAnchor, { id })
|
|
@@ -743,6 +708,8 @@ function MarkdownRenderer({
|
|
|
743
708
|
code: ({ children, className: codeClass }) => {
|
|
744
709
|
const match = /language-(\w+)/.exec(codeClass || "");
|
|
745
710
|
const language = match ? match[1] : "";
|
|
711
|
+
const filenameClass = typeof codeClass === "string" ? codeClass.split(/\s+/).find((token) => token.startsWith("filename-")) : void 0;
|
|
712
|
+
const filename = filenameClass ? decodeCodeFilenameClass(filenameClass) : void 0;
|
|
746
713
|
const codeString = String(children).replace(/\n$/, "");
|
|
747
714
|
if (language === "mermaid") {
|
|
748
715
|
return /* @__PURE__ */ jsx(MermaidDiagram, { chart: codeString });
|
|
@@ -750,13 +717,14 @@ function MarkdownRenderer({
|
|
|
750
717
|
if (codeClass || codeString.includes("\n")) {
|
|
751
718
|
const showLineNumbers = codeClass?.includes("showLineNumbers");
|
|
752
719
|
const highlightMatch = codeClass?.match(/\{([^}]+)\}/);
|
|
753
|
-
const highlightLines = highlightMatch ? parseLineHighlights(highlightMatch[1]) : [];
|
|
720
|
+
const highlightLines = highlightMatch ? parseLineHighlights(highlightMatch[1], codeString.split("\n").length) : [];
|
|
754
721
|
return /* @__PURE__ */ jsx(
|
|
755
722
|
CodeBlock,
|
|
756
723
|
{
|
|
757
724
|
language,
|
|
758
725
|
showLineNumbers,
|
|
759
726
|
highlightLines,
|
|
727
|
+
filename,
|
|
760
728
|
onEdit: onCodeEdit,
|
|
761
729
|
children: codeString
|
|
762
730
|
}
|
|
@@ -767,9 +735,14 @@ function MarkdownRenderer({
|
|
|
767
735
|
pre: ({ children }) => /* @__PURE__ */ jsx(Fragment, { children }),
|
|
768
736
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
769
737
|
img: ({ node, ...props }) => /* @__PURE__ */ jsx(ContentImage, { ...props }),
|
|
770
|
-
a: ({ href, children, ...props }) => {
|
|
771
|
-
|
|
772
|
-
|
|
738
|
+
a: ({ href, children, node: _node, ...props }) => {
|
|
739
|
+
let isExternal = Boolean(href && /^(https?:)?\/\//i.test(href));
|
|
740
|
+
if (isExternal && linkOrigin) {
|
|
741
|
+
try {
|
|
742
|
+
isExternal = new URL(href, linkOrigin).origin !== new URL(linkOrigin).origin;
|
|
743
|
+
} catch {
|
|
744
|
+
}
|
|
745
|
+
}
|
|
773
746
|
const override = renderLink?.({ href, children, isExternal: Boolean(isExternal) });
|
|
774
747
|
if (override !== void 0) return override;
|
|
775
748
|
return /* @__PURE__ */ jsxs(
|
|
@@ -816,12 +789,13 @@ function MarkdownRenderer({
|
|
|
816
789
|
th: ({ children }) => /* @__PURE__ */ jsx("th", { className: "px-4 py-2 text-left text-sm font-semibold text-(--text-primary)", children }),
|
|
817
790
|
td: ({ children }) => /* @__PURE__ */ jsx("td", { className: "px-4 py-2 text-sm border-t border-(--border-hairline)", children }),
|
|
818
791
|
ul: ({ children }) => /* @__PURE__ */ jsx("ul", { className: "my-3 ml-6 list-disc space-y-1 [&>li]:pl-1", children }),
|
|
819
|
-
ol: ({ children }) => /* @__PURE__ */ jsx("ol", { className: "my-3 ml-6 list-decimal space-y-1 [&>li]:pl-1", children }),
|
|
820
|
-
li: ({ children, className: liClass }) => {
|
|
792
|
+
ol: ({ children, start }) => /* @__PURE__ */ jsx("ol", { start, className: "my-3 ml-6 list-decimal space-y-1 [&>li]:pl-1", children }),
|
|
793
|
+
li: ({ children, className: liClass, id }) => {
|
|
821
794
|
const isTaskItem = liClass?.includes("task-list-item");
|
|
822
795
|
return /* @__PURE__ */ jsx(
|
|
823
796
|
"li",
|
|
824
797
|
{
|
|
798
|
+
id,
|
|
825
799
|
className: cn(
|
|
826
800
|
"leading-relaxed",
|
|
827
801
|
isTaskItem && "list-none -ml-6 flex items-start gap-2"
|
|
@@ -830,7 +804,7 @@ function MarkdownRenderer({
|
|
|
830
804
|
}
|
|
831
805
|
);
|
|
832
806
|
},
|
|
833
|
-
input: ({ type, checked, ...props }) => {
|
|
807
|
+
input: ({ node: _node, type, checked, ...props }) => {
|
|
834
808
|
if (type === "checkbox") {
|
|
835
809
|
return /* @__PURE__ */ jsx(
|
|
836
810
|
"input",
|
|
@@ -838,6 +812,8 @@ function MarkdownRenderer({
|
|
|
838
812
|
type: "checkbox",
|
|
839
813
|
checked,
|
|
840
814
|
readOnly: true,
|
|
815
|
+
"aria-hidden": "true",
|
|
816
|
+
tabIndex: -1,
|
|
841
817
|
className: "mt-1 h-4 w-4 rounded border-(--border-hairline) accent-(--accent) focus:ring-ring",
|
|
842
818
|
...props
|
|
843
819
|
}
|
|
@@ -862,11 +838,12 @@ function MarkdownRenderer({
|
|
|
862
838
|
sup: ({ children }) => /* @__PURE__ */ jsx("sup", { className: "text-xs", children }),
|
|
863
839
|
del: ({ children }) => /* @__PURE__ */ jsx("del", { className: "text-(--text-tertiary) line-through", children })
|
|
864
840
|
}),
|
|
865
|
-
[onCodeEdit, renderLink]
|
|
841
|
+
[onCodeEdit, renderLink, linkOrigin]
|
|
866
842
|
);
|
|
867
843
|
return /* @__PURE__ */ jsx(
|
|
868
844
|
"div",
|
|
869
845
|
{
|
|
846
|
+
"data-yunui-streaming": streaming ? "true" : void 0,
|
|
870
847
|
className: cn(
|
|
871
848
|
// NOT prose. This renderer styles every element itself via the component
|
|
872
849
|
// map below, so Tailwind Typography would double-style everything — the
|
|
@@ -880,9 +857,9 @@ function MarkdownRenderer({
|
|
|
880
857
|
children: /* @__PURE__ */ jsx(
|
|
881
858
|
ReactMarkdown,
|
|
882
859
|
{
|
|
883
|
-
remarkPlugins: [remarkGfm, remarkMath],
|
|
884
|
-
rehypePlugins: [rehypeRaw, rehypeKatex,
|
|
885
|
-
urlTransform,
|
|
860
|
+
remarkPlugins: [remarkGfm, remarkMath, remarkCodeMeta],
|
|
861
|
+
rehypePlugins: [rehypeRaw, rehypeSlug, rehypeSanitizeMarkdown, rehypeKatex, ...streaming ? [rehypeChunkFade(fade.current)] : []],
|
|
862
|
+
urlTransform: (url) => defaultUrlTransform(urlTransform ? urlTransform(url) : url),
|
|
886
863
|
components,
|
|
887
864
|
children: content
|
|
888
865
|
}
|
|
@@ -910,7 +887,7 @@ function HeadingAnchor({ id }) {
|
|
|
910
887
|
href: `#${id}`,
|
|
911
888
|
onClick: handleClick,
|
|
912
889
|
className: cn(
|
|
913
|
-
"opacity-0 group-hover:opacity-100 transition-opacity",
|
|
890
|
+
"opacity-0 group-hover:opacity-100 group-focus-within:opacity-100 focus-visible:opacity-100 transition-opacity rounded outline-none focus-visible:ring-2 focus-visible:ring-ring",
|
|
914
891
|
"text-(--text-tertiary) hover:text-(--text-primary)",
|
|
915
892
|
copied && "text-success"
|
|
916
893
|
),
|
|
@@ -919,21 +896,21 @@ function HeadingAnchor({ id }) {
|
|
|
919
896
|
}
|
|
920
897
|
);
|
|
921
898
|
}
|
|
922
|
-
function parseLineHighlights(input) {
|
|
923
|
-
const lines =
|
|
899
|
+
function parseLineHighlights(input, lineCount) {
|
|
900
|
+
const lines = /* @__PURE__ */ new Set();
|
|
924
901
|
for (const part of input.split(",")) {
|
|
925
902
|
const trimmed = part.trim();
|
|
926
903
|
if (trimmed.includes("-")) {
|
|
927
|
-
const [start, end] = trimmed.split("-").map((n) =>
|
|
928
|
-
if (
|
|
929
|
-
for (let i = start; i <= end; i++) lines.
|
|
904
|
+
const [start, end] = trimmed.split("-").map((n) => Number(n.trim()));
|
|
905
|
+
if (Number.isSafeInteger(start) && Number.isSafeInteger(end) && start > 0 && end >= start) {
|
|
906
|
+
for (let i = start; i <= Math.min(end, lineCount); i++) lines.add(i);
|
|
930
907
|
}
|
|
931
908
|
} else {
|
|
932
|
-
const num =
|
|
933
|
-
if (
|
|
909
|
+
const num = Number(trimmed);
|
|
910
|
+
if (Number.isSafeInteger(num) && num > 0 && num <= lineCount) lines.add(num);
|
|
934
911
|
}
|
|
935
912
|
}
|
|
936
|
-
return lines;
|
|
913
|
+
return [...lines];
|
|
937
914
|
}
|
|
938
915
|
function MathRenderer({ math, block = false, className }) {
|
|
939
916
|
const containerRef = useRef(null);
|
|
@@ -945,7 +922,10 @@ function MathRenderer({ math, block = false, className }) {
|
|
|
945
922
|
katex.render(math, containerRef.current, {
|
|
946
923
|
displayMode: block,
|
|
947
924
|
throwOnError: false,
|
|
948
|
-
|
|
925
|
+
// KaTeX writes this straight into inline styles, so it cannot be a
|
|
926
|
+
// class. Read the live token instead of hardcoding a red that matches
|
|
927
|
+
// neither theme; fall back only if the stylesheet has not loaded.
|
|
928
|
+
errorColor: typeof window !== "undefined" && getComputedStyle(document.documentElement).getPropertyValue("--error").trim() || "#cc0000",
|
|
949
929
|
strict: false,
|
|
950
930
|
// trust:false — untrusted math must not enable \href{javascript:...},
|
|
951
931
|
// \includegraphics, \htmlData etc. (KaTeX XSS surface).
|
|
@@ -1041,7 +1021,9 @@ function InlineCitation({
|
|
|
1041
1021
|
sideOffset: 8,
|
|
1042
1022
|
className: cn(
|
|
1043
1023
|
"w-[min(340px,calc(100vw-24px))] rounded-2xl border border-border",
|
|
1044
|
-
|
|
1024
|
+
// shadow-lg shadow-black/5 is the house overlay drop; shadow-xl was
|
|
1025
|
+
// heavier than every other popover in the system.
|
|
1026
|
+
"bg-popover p-3 text-popover-foreground shadow-lg shadow-black/5"
|
|
1045
1027
|
),
|
|
1046
1028
|
children: /* @__PURE__ */ jsxs("div", { className: "flex min-w-0 items-start gap-2.5", children: [
|
|
1047
1029
|
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,
|
|
@@ -1059,6 +1041,6 @@ function InlineCitation({
|
|
|
1059
1041
|
] }) });
|
|
1060
1042
|
}
|
|
1061
1043
|
|
|
1062
|
-
export { BlockMath, CalloutBlock,
|
|
1044
|
+
export { BlockMath, CalloutBlock, ContentImage, InlineCitation, InlineMath, MarkdownRenderer, MathRenderer, MermaidDiagram, parseCalloutType };
|
|
1063
1045
|
//# sourceMappingURL=content.js.map
|
|
1064
1046
|
//# sourceMappingURL=content.js.map
|