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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@cn-map/gaode-solid

v0.0.2

Published

高德地图 solid-js 组件

Readme

@cn-map/gaode-solid

高德地图 Solid.js 组件库,基于高德地图 JavaScript API 2.0 开发。提供了一套 Solid.js 组件、Primitives 和工具,用于构建高德地图应用。

特性

  • 🎯 类型友好 - 组件与 Hooks 提供类型定义
  • 🚀 Solid.js 兼容 - 支持最新的 Solid.js 特性
  • 🎨 丰富的组件 - 覆盖地图、覆盖物、图层、控件与常用工具
  • 🧩 可与原生 API 混用 - WebService 等未封装能力可直接调用原生 AMap.*
  • 📊 3D 可视化 - 基于 Loca 的可视化组件
  • 🛠️ 易于使用 - 简洁的 API 设计
  • 📦 按需加载 - 支持组件按需导入
  • ⚡ 细粒度响应式 - 利用 Solid.js 的响应式系统

安装

npm install @cn-map/gaode-solid
yarn add @cn-map/gaode-solid
pnpm add @cn-map/gaode-solid
bun add @cn-map/gaode-solid

TypeScript 类型见 @cn-map/gaode-types。

使用示例

基础地图

import { APILoader, LoadStatus, Map, Marker, useAPIStatus } from '@cn-map/gaode-solid'
import { Show } from 'solid-js'

const App = () => {
  const status = useAPIStatus('AMap')

  return (
    <APILoader apiKey="YOUR_AMAP_KEY">
      <Show when={status() === LoadStatus.Loaded}>
        <Map center={[116.397428, 39.90923]} style={{ height: '400px' }} zoom={13}>
          <Marker position={[116.397428, 39.90923]} />
        </Map>
      </Show>
    </APILoader>
  )
}

export default App

or

import { APILoader, LoadStatus, Map, Marker } from '@cn-map/gaode-solid'
import { Show } from 'solid-js'

const App = () => {
  return (
    <APILoader apiKey="YOUR_AMAP_KEY">
      {status => (
        <Show when={status().AMap === LoadStatus.Loaded}>
          <Map center={[116.397428, 39.90923]} style={{ height: '400px' }} zoom={13}>
            <Marker position={[116.397428, 39.90923]} />
          </Map>
        </Show>
      )}
    </APILoader>
  )
}

export default App

使用 Loca 可视化

import { APILoader, LoadStatus, Map, useAPIStatus } from '@cn-map/gaode-solid'
import { GeoJSONSource, HeatMapLayer, Loca } from '@cn-map/gaode-solid/loca'
import { Show } from 'solid-js'

const App = () => {
  const status = useAPIStatus()

  return (
    <APILoader apiKey={import.meta.env.VITE_AMAP_KEY} Loca={{}}>
      <Show when={status().AMap === LoadStatus.Loaded}>
        <Map
          center={[102.618687, 31.790976]}
          mapStyle="amap://styles/whitesmoke"
          pitch={40}
          style={{ height: '400px' }}
          viewMode="3D"
          zoom={4}
          zooms={[4, 7]}
        >
          <Show when={status().Loca === LoadStatus.Loaded}>
            <Loca>
              <GeoJSONSource url="https://a.amap.com/Loca/static/loca-v2/demos/mock_data/traffic.json">
                <HeatMapLayer<{
                  avg: number
                  city: string
                  index: number
                  lnglat: string
                  mom: string
                  prov: string
                  ranking: number
                  yoy: string
                }>
                  opacity={1}
                  style={{
                    gradient: {
                      0.1: '#2A85B8',
                      0.2: '#16B0A9',
                      0.3: '#29CF6F',
                      0.4: '#5CE182',
                      0.5: '#7DF675',
                      0.6: '#FFF100',
                      0.7: '#FAA53F',
                      1.0: '#D04343',
                    },
                    height: 500000,
                    heightBezier: [0, 0.53, 0.37, 0.98],
                    radius: 200000,
                    value(index, feature) {
                      const value = Number.parseFloat(feature.properties.mom)
                      return value + 10 * Math.random()
                    },
                    unit: 'meter',
                  }}
                  visible={true}
                  zIndex={10}
                />
              </GeoJSONSource>
            </Loca>
          </Show>
        </Map>
      </Show>
    </APILoader>
  )
}

export default App

核心组件

API 加载器

| 导出名称 | 类型 | 描述 | | ------------------ | --------- | ------------------------------ | | APILoader | 组件 | 高德地图 JavaScript API 加载器 | | APILoaderOptions | 类型 | APILoader 组件的配置选项 | | LoadStatus | 枚举 | 表示加载状态的枚举值 | | useAPIError | Primitive | 获取 API 加载错误信息的原语 | | useAPILoader | Primitive | 加载高德地图 API 的原语 | | useAPIStatus | Primitive | 检查 API 加载状态的原语 |

地图组件

| 导出名称 | 类型 | 描述 | | -------- | --------- | ------------------ | | Map | 组件 | 地图容器组件 | | useMap | Primitive | 获取地图实例的原语 |

地图控制组件

| 导出名称 | 类型 | 描述 | | ------------- | ---- | ---------------- | | ControlBar | 组件 | 组合控件 | | Geolocation | 组件 | 定位控件 | | HawkEye | 组件 | 鹰眼控件 | | MapType | 组件 | 地图类型切换控件 | | Scale | 组件 | 比例尺控件 | | ToolBar | 组件 | 工具条控件 |

地图图层

| 导出名称 | 类型 | 描述 | | ---------------------------- | ---- | ---------------- | | Buildings, BuildingLayer | 组件 | 楼块图层 | | CanvasLayer | 组件 | Canvas 图层 | | CustomLayer | 组件 | 自定义图层 | | DistrictLayer | 组件 | 行政区图层 | | Country | 组件 | 国家图层 | | Province | 组件 | 省份图层 | | World | 组件 | 世界图层 | | Flexible | 组件 | 灵活切片图层 | | GLCustomLayer | 组件 | WebGL 自定义图层 | | HeatMap | 组件 | 热力图图层 | | ImageLayer | 组件 | 图片图层 | | IndoorMap | 组件 | 室内地图图层 | | LabelsLayer | 组件 | 标注图层 | | LayerGroup | 组件 | 图层群组 | | Mapbox | 组件 | Mapbox 图层 | | MapboxVectorTileLayer | 组件 | MVT 图层 | | TileLayer | 组件 | 切片图层 | | Flexible | 组件 | 灵活切片图层 | | Mark | 组件 | 白嫖标记图层 | | RoadNet | 组件 | 路网图层 | | Satellite | 组件 | 卫星图层 | | Traffic | 组件 | 实时交通图层 | | WMS | 组件 | WMS 图层 | | WMTS | 组件 | WMTS 图层 | | VectorLayer | 组件 | 矢量图层 |

覆盖物组件

| 导出名称 | 类型 | 描述 | | --------------- | ---- | -------------- | | BezierCurve | 组件 | 贝塞尔曲线 | | Circle | 组件 | 圆形 | | CircleMarker | 组件 | 圆点标记 | | ContextMenu | 组件 | 右键菜单 | | ElasticMarker | 组件 | 灵活点标记 | | Ellipse | 组件 | 椭圆 | | IndexCluster | 组件 | 索引点聚合 | | InfoWindow | 组件 | 信息窗体 | | LabelMarker | 组件 | 标注标记 | | Marker | 组件 | 点标记 | | MarkerCluster | 组件 | 点聚合 | | MassMarks | 组件 | 海量点 | | OverlayGroup | 组件 | 覆盖物群组 | | Polygon | 组件 | 多边形 | | Polyline | 组件 | 折线 | | Rectangle | 组件 | 矩形 | | Text | 组件 | 文本标记 | | VectorOverlay | 组件 | 矢量图形覆盖物 |

工具组件

| 导出名称 | 类型 | 描述 | | ------------------- | ---- | ---------------- | | BezierCurveEditor | 组件 | 贝塞尔曲线编辑器 | | CircleEditor | 组件 | 圆形编辑器 | | EllipseEditor | 组件 | 椭圆编辑器 | | MouseTool | 组件 | 鼠标工具 | | PolygonEditor | 组件 | 多边形编辑器 | | PolylineEditor | 组件 | 折线编辑器 | | RangingTool | 组件 | 测距工具 | | RectangleEditor | 组件 | 矩形编辑器 |

Loca 可视化组件

基于 Loca 库的高级 3D 可视化组件:

Loca 容器

| 导出名称 | 类型 | 描述 | | --------- | --------- | -------------------- | | Loca | 组件 | Loca 容器组件 | | useLoca | Primitive | 访问 Loca 实例的原语 |

Loca 图层

| 导出名称 | 类型 | 描述 | | ---------------- | ---- | ------------ | | GridLayer | 组件 | 网格图层 | | HeatMapLayer | 组件 | 热力图图层 | | HexagonLayer | 组件 | 蜂窝图层 | | IconLayer | 组件 | 图标图层 | | LabelsLayer | 组件 | 标注图层 | | LaserLayer | 组件 | 激光图层 | | LineLayer | 组件 | 线图层 | | LinkLayer | 组件 | 连接图层 | | PointLayer | 组件 | 点图层 | | PolygonLayer | 组件 | 面图层 | | PrismLayer | 组件 | 棱柱图层 | | PulseLineLayer | 组件 | 脉冲线图层 | | PulseLinkLayer | 组件 | 脉冲连接图层 | | ScatterLayer | 组件 | 散点图层 | | ZMarkerLayer | 组件 | Z轴标记图层 |

Loca 光照

| 导出名称 | 类型 | 描述 | | ------------------ | ---- | ------ | | AmbientLight | 组件 | 环境光 | | DirectionalLight | 组件 | 平行光 | | PointLight | 组件 | 点光源 |

Loca UI 组件

| 导出名称 | 类型 | 描述 | | -------- | ---- | -------- | | Legend | 组件 | 图例组件 |

Loca 数据源

| 导出名称 | 类型 | 描述 | | ----------------- | ---- | ---------------- | | GeoBufferSource | 组件 | GeoBuffer 数据源 | | GeoJSONSource | 组件 | GeoJSON 数据源 |

相关链接

许可证

MIT