npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

@mind-elixir/open-desktop

v0.0.2

Published

Import XMind files to MindElixir format

Downloads

203

Readme

@mind-elixir/open-desktop

一个用于在浏览器中启动 Mind Elixir Desktop 应用并传输思维导图数据的 JavaScript 库。

功能特性

  • 🚀 自动检测并启动 Mind Elixir Desktop 应用
  • 📡 通过本地服务传输思维导图数据
  • 🔄 智能回退机制:未安装应用时自动跳转到下载页面
  • ⏱️ 可配置的超时和重试机制
  • 📦 TypeScript 支持

安装

npm install @mind-elixir/open-desktop

或者使用 yarn:

yarn add @mind-elixir/open-desktop

使用方法

基本用法

import { launchMindElixir } from '@mind-elixir/open-desktop'
import type { MindElixirData } from 'mind-elixir'

// 准备思维导图数据
const mindmapData: MindElixirData = {
  nodeData: {
    id: 'root',
    topic: '中心主题',
    children: [
      {
        id: 'node1',
        topic: '分支1',
        children: []
      },
      {
        id: 'node2',
        topic: '分支2',
        children: []
      }
    ]
  },
  linkData: []
}

// 启动 Mind Elixir 并传输数据
try {
  await launchMindElixir(mindmapData)
  console.log('思维导图已成功发送到 Mind Elixir Desktop')
} catch (error) {
  console.error('启动失败:', error)
}

高级配置

import { launchMindElixir } from '@mind-elixir/open-desktop'

const mindmapData = { /* 你的思维导图数据 */ }
const source = 'https://your-website.com' // 可选:数据来源URL

const options = {
  appUrl: 'mind-elixir://open',                    // 应用协议URL
  serviceUrl: 'http://127.0.0.1:6595/create-mindmap', // 服务端点
  pingUrl: 'http://127.0.0.1:6595/ping',           // 健康检查端点
  timeout: 10000                                   // 超时时间(毫秒)
}

try {
  await launchMindElixir(mindmapData, source, options)
} catch (error) {
  if (error.message === '未安装 Mind Elixir Desktop') {
    // 用户将被自动重定向到下载页面
    console.log('请安装 Mind Elixir Desktop 应用')
  } else {
    console.error('其他错误:', error)
  }
}

API 文档

launchMindElixir(mindmapData, source?, options?)

启动 Mind Elixir Desktop 应用并传输思维导图数据。

参数

  • mindmapData (MindElixirData): 思维导图数据对象
  • source (string, 可选): 数据来源URL,默认为当前页面URL
  • options (object, 可选): 配置选项
    • appUrl (string): 应用协议URL,默认 'mind-elixir://open'
    • serviceUrl (string): 服务端点URL,默认 'http://127.0.0.1:6595/create-mindmap'
    • pingUrl (string): 健康检查端点URL,默认 'http://127.0.0.1:6595/ping'
    • timeout (number): 服务启动超时时间(毫秒),默认 8000

返回值

返回一个 Promise<void>,成功时解析,失败时抛出错误。

错误处理

  • "未安装 Mind Elixir Desktop": 检测到用户未安装应用,会自动打开下载页面
  • "服务启动超时": 应用启动超时
  • "发送思维导图数据失败": 数据传输失败

工作原理

  1. 应用检测: 使用自定义协议 mind-elixir:// 尝试启动桌面应用
  2. 回退机制: 如果应用未安装,自动重定向到 Mind Elixir Desktop 下载页面
  3. 服务等待: 等待本地服务 (端口 6595) 启动并可用
  4. 数据传输: 通过 HTTP POST 请求将思维导图数据发送到本地服务

系统要求

  • 现代浏览器(支持 ES2017+)
  • Mind Elixir Desktop 应用(用于完整功能)

开发

# 安装依赖
npm install

# 开发模式(监听文件变化)
npm run dev

# 构建
npm run build

# 类型检查
npm run check-types

# 清理构建文件
npm run clean

许可证

MIT License

相关链接

贡献

欢迎提交 Issue 和 Pull Request!

更新日志

0.0.1

  • 初始版本
  • 支持启动 Mind Elixir Desktop 应用
  • 支持传输思维导图数据
  • 智能回退机制

0.0.2

  • 导出 openAppWithFallback 方法,可以直接打开地址(无其他操作)
  • launchMindElixir 重命名为 launchAndCreateMindmap