external-quartz-leaflet-map.../package.json
Sara Lilith Slootmaker 74a8afcf1f
Quartz community main (#14)
* Port to Quartz v5 Bases view plugin

Rewrite the v4 transformer plugin as a v5 Bases view plugin that
registers a 'leaflet-map' view type via the bases-page view registry.

- Add v5 plugin structure: package.json, tsup.config.ts, tsconfig.json
- Add view renderer (src/view.tsx) that builds server-side marker HTML
- Add client-side Leaflet initialization (src/scripts/leaflet-map.inline.ts)
- Add full Leaflet + custom marker styles (src/styles/leaflet-map.scss)
- Add type definitions for view config and marker data (src/types.ts)
- Auto-register view on import via viewRegistry.register()
- Mark @quartz-community/bases-page as external peer dependency
- ESM + DTS build via tsup with inline-script and SCSS loaders

* fix: move bases-page from dependencies to devDependencies

bases-page must only be a peerDependency at runtime so Node resolves
to the host's installed copy. Keeping it as a regular dependency caused
npm to install a private copy in node_modules/, creating a separate
ViewRegistry instance that never communicated with the host plugin.

Now bases-page is a devDependency (needed for TypeScript compilation)
and a peerDependency (resolved at runtime from the host).

* feat: resolve image paths via transformLink for correct link resolution

- Import transformLink and FullSlug from @quartz-community/bases-page
- Use slug, allSlugs, linkResolution props from ViewRendererProps
- Remove stale ambient module declaration that shadowed real package types
- Add @quartz-community/utils and @quartz-community/types as devDependencies

* fix: defer ControlContainer class definition to avoid L is not defined at parse time

* fix: add CDN fallback and error handling for dependency loading

Switch primary CDN from unpkg.com to cdn.jsdelivr.net with unpkg.com as
fallback. Add loadScript() helper that tries multiple URLs sequentially.
Add try/catch around loadDependencies() in the nav listener with early
return when no map elements found, and user-visible error message when
all CDN sources fail. Fixes maps not loading when browser content
blocking (e.g. Firefox Enhanced Tracking Protection) blocks unpkg.com.

* chore: linting

* feat: add render event listener for in-place DOM re-initialization

* fix: update to bases-page changes

* feat: allow plugin views to pass options

* Cleanup typing

* Remove quartz v4plugin files

* Removal of duplicated imports

* Cleanup typing

* Removal of duplicated imports

* chore: commit dist/ and remove prepare script

* Update README.md

* fix: update to bases-page changes

* chore: rebase

* Cleanup typing

* Removal of duplicated imports

* Cleanup typing

* Remove quartz v4plugin files

* Removal of duplicated imports

---------

Co-authored-by: saberzero1 <github@emilebangma.com>
2026-03-16 16:41:50 +00:00

94 lines
2.6 KiB
JSON

{
"name": "quartz-leaflet-map-plugin",
"version": "2.0.0",
"description": "Leaflet map Bases view plugin for Quartz v5. Renders interactive maps with markers from note frontmatter.",
"type": "module",
"license": "MIT",
"author": "Quartz Community",
"homepage": "https://quartz.jzhao.xyz",
"repository": {
"type": "git",
"url": "https://github.com/quartz-community/quartz-leaflet-map-plugin"
},
"keywords": [
"quartz",
"quartz-plugin",
"leaflet",
"bases",
"view"
],
"files": [
"dist",
"README.md",
"LICENSE",
"CHANGELOG.md"
],
"exports": {
".": "./dist/index.js"
},
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
"sideEffects": false,
"scripts": {
"build": "tsup",
"dev": "tsup --watch",
"lint": "eslint . --max-warnings=0",
"format": "prettier . --check",
"typecheck": "tsc --noEmit",
"check": "npm run typecheck && npm run lint && npm run format"
},
"peerDependencies": {
"@jackyzha0/quartz": "^5.0.0",
"@quartz-community/bases-page": "^0.1.0",
"preact": "^10.0.0"
},
"peerDependenciesMeta": {
"@jackyzha0/quartz": {
"optional": true
},
"@quartz-community/bases-page": {
"optional": false
},
"preact": {
"optional": false
}
},
"dependencies": {
"sass": "^1.97.3",
"sass-embedded": "^1.97.3",
"tsup": "^8.5.0",
"typescript": "^5.9.3"
},
"devDependencies": {
"@quartz-community/bases-page": "github:quartz-community/bases-page",
"@quartz-community/types": "github:quartz-community/types",
"@quartz-community/utils": "github:quartz-community/utils",
"@types/leaflet": "^1.9.12",
"@types/node": "^24.10.0",
"@typescript-eslint/eslint-plugin": "^7.18.0",
"@typescript-eslint/parser": "^7.18.0",
"eslint": "^8.57.0",
"eslint-config-prettier": "^9.1.0",
"preact": "^10.28.2",
"prettier": "^3.6.2"
},
"quartz": {
"name": "leaflet-map",
"displayName": "Leaflet Map",
"category": [
"component"
],
"version": "1.0.0",
"quartzVersion": ">=5.0.0",
"dependencies": [],
"defaultOrder": 50,
"defaultEnabled": true,
"defaultOptions": {
"enableCopyTool": false
}
},
"engines": {
"node": ">=22",
"npm": ">=10.9.2"
}
}