From 0a0c2298391f8ce1c1bbef5aaa06209ad49914d8 Mon Sep 17 00:00:00 2001 From: Andreas Stassivik Date: Sat, 12 Oct 2024 01:50:15 -0700 Subject: [PATCH 01/31] npm install `@rollup/plugin-html@^1.0.4` as devDependency --- package-lock.json | 19 +++++++++++++++++++ package.json | 1 + 2 files changed, 20 insertions(+) diff --git a/package-lock.json b/package-lock.json index fe39e99..7d28480 100644 --- a/package-lock.json +++ b/package-lock.json @@ -28,6 +28,7 @@ "@babel/eslint-parser": "^7.25.8", "@babel/plugin-syntax-import-attributes": "^7.25.7", "@rollup/plugin-commonjs": "^28.0.0", + "@rollup/plugin-html": "^1.0.4", "@rollup/plugin-inject": "^5.0.5", "@rollup/plugin-node-resolve": "^15.3.0", "@rollup/plugin-replace": "^6.0.1", @@ -1875,6 +1876,24 @@ "url": "https://github.com/sponsors/jonschlinkert" } }, + "node_modules/@rollup/plugin-html": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/@rollup/plugin-html/-/plugin-html-1.0.4.tgz", + "integrity": "sha512-dbxJ8JAuelwdiW7nqeRbe564XPwxX234lsBHrmgVJ+yTL9Nt5zFbZIRcgIIlcTtNNp6M9spK5M+spjcnSExj1w==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=14.0.0" + }, + "peerDependencies": { + "rollup": "^1.20.0||^2.0.0||^3.0.0||^4.0.0" + }, + "peerDependenciesMeta": { + "rollup": { + "optional": true + } + } + }, "node_modules/@rollup/plugin-inject": { "version": "5.0.5", "resolved": "https://registry.npmjs.org/@rollup/plugin-inject/-/plugin-inject-5.0.5.tgz", diff --git a/package.json b/package.json index 585ce0f..e43e9f7 100644 --- a/package.json +++ b/package.json @@ -64,6 +64,7 @@ "@babel/eslint-parser": "^7.25.8", "@babel/plugin-syntax-import-attributes": "^7.25.7", "@rollup/plugin-commonjs": "^28.0.0", + "@rollup/plugin-html": "^1.0.4", "@rollup/plugin-inject": "^5.0.5", "@rollup/plugin-node-resolve": "^15.3.0", "@rollup/plugin-replace": "^6.0.1", From 1c9d7fc959b70a3734abe6245635440a0eec2546 Mon Sep 17 00:00:00 2001 From: Andreas Stassivik Date: Sun, 13 Oct 2024 03:48:05 -0700 Subject: [PATCH 02/31] `quick-start.html` and its script bundle generated by `@rollup/plugin-html` template (missing stylesheets embedded in the original) --- rollup.config.ts | 62 ++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 58 insertions(+), 4 deletions(-) diff --git a/rollup.config.ts b/rollup.config.ts index 0bfb1c2..eb86971 100644 --- a/rollup.config.ts +++ b/rollup.config.ts @@ -1,13 +1,22 @@ -// noinspection JSUnusedGlobalSymbols +// noinspection HtmlRequiredLangAttribute, JSUnusedGlobalSymbols +import { + type OutputAsset, + type OutputChunk, + type Plugin, + type RollupOptions, +} from 'rollup' import commonjs from '@rollup/plugin-commonjs' +import html, { + makeHtmlAttributes, + type RollupHtmlTemplateOptions, +} from '@rollup/plugin-html' import inject from '@rollup/plugin-inject' import terser from '@rollup/plugin-terser' import typescript from '@rollup/plugin-typescript' // @ts-expect-error -- untyped plugin import untypedModify from 'rollup-plugin-modify' import { nodeResolve } from '@rollup/plugin-node-resolve' -import { type Plugin, type RollupOptions } from 'rollup' // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment -- untyped plugin const modify: (modifyOptions: { @@ -48,14 +57,59 @@ const rollupConfig: RollupOptions[] = [ external: ['@stassi/leaf'], input: 'src/tutorial/quick-start/quick-start.ts', output: { - file: 'public/tutorial/quick-start/dist/script/quick-start.js', + dir: 'public/tutorial/quick-start/dist/', + entryFileNames: 'script/quick-start.js', format: 'esm', paths: { '@stassi/leaf': '../../../../leaf/leaf.js', }, sourcemap: true, }, - plugins: [typescript(), terser()], + plugins: [ + typescript(), + terser(), + html({ + fileName: 'quick-start.html', + template({ + attributes, + files, + meta, + publicPath, + title, + }: RollupHtmlTemplateOptions): string { + return ` + + >attributes.html)}> + + ${meta + .map( + (input: Record): string => + ``, + ) + .join('\n')} + ${title} + ${(files.css ?? []) + .map( + ({ fileName }: OutputChunk | OutputAsset): string => + `>attributes.link)}>`, + ) + .join('\n')} + + +
+ ${(files.js ?? []) + .map( + ({ fileName }: OutputChunk | OutputAsset): string => + ``, + ) + .join('\n')} + + + ` + }, + title: 'Leaflet Quick Start Guide', + }), + ], }, { external: ['@stassi/leaf'], From bc4402f775386099dd8e63f5216667cb9677b4b5 Mon Sep 17 00:00:00 2001 From: Andreas Stassivik Date: Sun, 13 Oct 2024 03:56:30 -0700 Subject: [PATCH 03/31] npm install `rollup-plugin-styles@^4.0.0` `--legacy-peer-deps` as devDependency --- package-lock.json | 1218 ++++++++++++++++++++++++++++++++++++++++++++- package.json | 1 + 2 files changed, 1200 insertions(+), 19 deletions(-) diff --git a/package-lock.json b/package-lock.json index 7d28480..8c367ea 100644 --- a/package-lock.json +++ b/package-lock.json @@ -56,6 +56,7 @@ "puppeteer": "^23.5.3", "rollup": "^4.24.0", "rollup-plugin-modify": "^3.0.0", + "rollup-plugin-styles": "^4.0.0", "shx": "^0.3.4", "ts-jest": "^29.2.5", "typescript": "^5.6.3" @@ -2346,6 +2347,16 @@ "dev": true, "license": "MIT" }, + "node_modules/@trysound/sax": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/@trysound/sax/-/sax-0.2.0.tgz", + "integrity": "sha512-L7z9BgrNEcYyUYtF+HaEfiS5ebkh9jXqbszz7pC0hRBPaatV0XjSD3+eHrpqFemQfgwiFF0QPIarnIihIDn7OA==", + "dev": true, + "license": "ISC", + "engines": { + "node": ">=10.13.0" + } + }, "node_modules/@types/babel__core": { "version": "7.20.5", "resolved": "https://registry.npmjs.org/@types/babel__core/-/babel__core-7.20.5.tgz", @@ -2391,6 +2402,16 @@ "@babel/types": "^7.20.7" } }, + "node_modules/@types/cssnano": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/@types/cssnano/-/cssnano-5.0.0.tgz", + "integrity": "sha512-z98V7ICNAojxj9YV9+Q8qV+F7fW0poLWJRjed9tu7KNdYzHwAvLOAsTMI8xWjkOY9yzO+HmMxRRixlIvRsZwXg==", + "dev": true, + "license": "MIT", + "dependencies": { + "postcss": "^8" + } + }, "node_modules/@types/estree": { "version": "1.0.6", "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.6.tgz", @@ -2607,6 +2628,13 @@ "dev": true, "license": "MIT" }, + "node_modules/@types/parse-json": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/@types/parse-json/-/parse-json-4.0.2.tgz", + "integrity": "sha512-dISoDXWWQwUquiKsyZ4Ng+HX2KsPL7LyHKHQwgGFEA3IaKac4Obd+h2a/a6waisAoepJlBcx9paWqjA8/HVjCw==", + "dev": true, + "license": "MIT" + }, "node_modules/@types/puppeteer": { "version": "5.4.7", "resolved": "https://registry.npmjs.org/@types/puppeteer/-/puppeteer-5.4.7.tgz", @@ -3848,6 +3876,13 @@ "node": ">=10.0.0" } }, + "node_modules/boolbase": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/boolbase/-/boolbase-1.0.0.tgz", + "integrity": "sha512-JZOSA7Mo9sNGB8+UjSgzdLtokWAky1zbztM3WRLCbZ70/3cTANmQmOdR7y2g+J0e2WXywy1yS468tY+IruqEww==", + "dev": true, + "license": "ISC" + }, "node_modules/boxen": { "version": "7.0.0", "resolved": "https://registry.npmjs.org/boxen/-/boxen-7.0.0.tgz", @@ -4089,6 +4124,19 @@ "node": ">=6" } }, + "node_modules/caniuse-api": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/caniuse-api/-/caniuse-api-3.0.0.tgz", + "integrity": "sha512-bsTwuIg/BZZK/vreVTYYbSWoe2F+71P7K5QGEX+pT250DZbfU1MQ5prOKpPR+LL6uWKK3KMwMCAS74QB3Um1uw==", + "dev": true, + "license": "MIT", + "dependencies": { + "browserslist": "^4.0.0", + "caniuse-lite": "^1.0.0", + "lodash.memoize": "^4.1.2", + "lodash.uniq": "^4.5.0" + } + }, "node_modules/caniuse-lite": { "version": "1.0.30001668", "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001668.tgz", @@ -4426,6 +4474,13 @@ "dev": true, "license": "MIT" }, + "node_modules/colord": { + "version": "2.9.3", + "resolved": "https://registry.npmjs.org/colord/-/colord-2.9.3.tgz", + "integrity": "sha512-jeC1axXpnb0/2nn/Y1LPuLdgXBLH7aDcHu4KEKfqw3CUhX7ZpfBSlPKyqXE6btIgEzfWtrX3/tyBCaCvXvMkOw==", + "dev": true, + "license": "MIT" + }, "node_modules/combined-stream": { "version": "1.0.8", "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", @@ -4682,6 +4737,168 @@ "node": ">= 8" } }, + "node_modules/css-declaration-sorter": { + "version": "6.4.1", + "resolved": "https://registry.npmjs.org/css-declaration-sorter/-/css-declaration-sorter-6.4.1.tgz", + "integrity": "sha512-rtdthzxKuyq6IzqX6jEcIzQF/YqccluefyCYheovBOLhFT/drQA9zj/UbRAa9J7C0o6EG6u3E6g+vKkay7/k3g==", + "dev": true, + "license": "ISC", + "engines": { + "node": "^10 || ^12 || >=14" + }, + "peerDependencies": { + "postcss": "^8.0.9" + } + }, + "node_modules/css-select": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/css-select/-/css-select-4.3.0.tgz", + "integrity": "sha512-wPpOYtnsVontu2mODhA19JrqWxNsfdatRKd64kmpRbQgh1KtItko5sTnEpPdpSaJszTOhEMlF/RPz28qj4HqhQ==", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "boolbase": "^1.0.0", + "css-what": "^6.0.1", + "domhandler": "^4.3.1", + "domutils": "^2.8.0", + "nth-check": "^2.0.1" + }, + "funding": { + "url": "https://github.com/sponsors/fb55" + } + }, + "node_modules/css-tree": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/css-tree/-/css-tree-1.1.3.tgz", + "integrity": "sha512-tRpdppF7TRazZrjJ6v3stzv93qxRcSsFmW6cX0Zm2NVKpxE1WV1HblnghVv9TreireHkqI/VDEsfolRF1p6y7Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "mdn-data": "2.0.14", + "source-map": "^0.6.1" + }, + "engines": { + "node": ">=8.0.0" + } + }, + "node_modules/css-what": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/css-what/-/css-what-6.1.0.tgz", + "integrity": "sha512-HTUrgRJ7r4dsZKU6GjmpfRK1O76h97Z8MfS1G0FozR+oF2kG6Vfe8JE6zwrkbxigziPHinCJ+gCPjA9EaBDtRw==", + "dev": true, + "license": "BSD-2-Clause", + "engines": { + "node": ">= 6" + }, + "funding": { + "url": "https://github.com/sponsors/fb55" + } + }, + "node_modules/cssesc": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/cssesc/-/cssesc-3.0.0.tgz", + "integrity": "sha512-/Tb/JcjK111nNScGob5MNtsntNM1aCNUDipB/TkwZFhyDrrE47SOx/18wF2bbjgc3ZzCSKW1T5nt5EbFoAz/Vg==", + "dev": true, + "license": "MIT", + "bin": { + "cssesc": "bin/cssesc" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/cssnano": { + "version": "5.1.15", + "resolved": "https://registry.npmjs.org/cssnano/-/cssnano-5.1.15.tgz", + "integrity": "sha512-j+BKgDcLDQA+eDifLx0EO4XSA56b7uut3BQFH+wbSaSTuGLuiyTa/wbRYthUXX8LC9mLg+WWKe8h+qJuwTAbHw==", + "dev": true, + "license": "MIT", + "dependencies": { + "cssnano-preset-default": "^5.2.14", + "lilconfig": "^2.0.3", + "yaml": "^1.10.2" + }, + "engines": { + "node": "^10 || ^12 || >=14.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/cssnano" + }, + "peerDependencies": { + "postcss": "^8.2.15" + } + }, + "node_modules/cssnano-preset-default": { + "version": "5.2.14", + "resolved": "https://registry.npmjs.org/cssnano-preset-default/-/cssnano-preset-default-5.2.14.tgz", + "integrity": "sha512-t0SFesj/ZV2OTylqQVOrFgEh5uanxbO6ZAdeCrNsUQ6fVuXwYTxJPNAGvGTxHbD68ldIJNec7PyYZDBrfDQ+6A==", + "dev": true, + "license": "MIT", + "dependencies": { + "css-declaration-sorter": "^6.3.1", + "cssnano-utils": "^3.1.0", + "postcss-calc": "^8.2.3", + "postcss-colormin": "^5.3.1", + "postcss-convert-values": "^5.1.3", + "postcss-discard-comments": "^5.1.2", + "postcss-discard-duplicates": "^5.1.0", + "postcss-discard-empty": "^5.1.1", + "postcss-discard-overridden": "^5.1.0", + "postcss-merge-longhand": "^5.1.7", + "postcss-merge-rules": "^5.1.4", + "postcss-minify-font-values": "^5.1.0", + "postcss-minify-gradients": "^5.1.1", + "postcss-minify-params": "^5.1.4", + "postcss-minify-selectors": "^5.2.1", + "postcss-normalize-charset": "^5.1.0", + "postcss-normalize-display-values": "^5.1.0", + "postcss-normalize-positions": "^5.1.1", + "postcss-normalize-repeat-style": "^5.1.1", + "postcss-normalize-string": "^5.1.0", + "postcss-normalize-timing-functions": "^5.1.0", + "postcss-normalize-unicode": "^5.1.1", + "postcss-normalize-url": "^5.1.0", + "postcss-normalize-whitespace": "^5.1.1", + "postcss-ordered-values": "^5.1.3", + "postcss-reduce-initial": "^5.1.2", + "postcss-reduce-transforms": "^5.1.0", + "postcss-svgo": "^5.1.0", + "postcss-unique-selectors": "^5.1.1" + }, + "engines": { + "node": "^10 || ^12 || >=14.0" + }, + "peerDependencies": { + "postcss": "^8.2.15" + } + }, + "node_modules/cssnano-utils": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/cssnano-utils/-/cssnano-utils-3.1.0.tgz", + "integrity": "sha512-JQNR19/YZhz4psLX/rQ9M83e3z2Wf/HdJbryzte4a3NSuafyp9w/I4U+hx5C2S9g41qlstH7DEWnZaaj83OuEA==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^10 || ^12 || >=14.0" + }, + "peerDependencies": { + "postcss": "^8.2.15" + } + }, + "node_modules/csso": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/csso/-/csso-4.2.0.tgz", + "integrity": "sha512-wvlcdIbf6pwKEk7vHj8/Bkc0B4ylXZruLvOgs9doS5eOsOpuodOV2zJChSpkp+pRpYQLQMeF04nr3Z68Sta9jA==", + "dev": true, + "license": "MIT", + "dependencies": { + "css-tree": "^1.1.2" + }, + "engines": { + "node": ">=8.0.0" + } + }, "node_modules/cwd": { "version": "0.10.0", "resolved": "https://registry.npmjs.org/cwd/-/cwd-0.10.0.tgz", @@ -4785,6 +5002,16 @@ } } }, + "node_modules/decode-uri-component": { + "version": "0.2.2", + "resolved": "https://registry.npmjs.org/decode-uri-component/-/decode-uri-component-0.2.2.tgz", + "integrity": "sha512-FqUYQ+8o158GyGTrMFJms9qh3CqTKvAqgqsTnkLI8sKu0028orqBhxNMFkFen0zGyg6epACD32pjVk58ngIErQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10" + } + }, "node_modules/dedent": { "version": "1.5.3", "resolved": "https://registry.npmjs.org/dedent/-/dedent-1.5.3.tgz", @@ -4983,12 +5210,71 @@ "node": ">=6.0.0" } }, + "node_modules/dom-serializer": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/dom-serializer/-/dom-serializer-1.4.1.tgz", + "integrity": "sha512-VHwB3KfrcOOkelEG2ZOfxqLZdfkil8PtJi4P8N2MMXucZq2yLp75ClViUlOVwyoHEDjYU433Aq+5zWP61+RGag==", + "dev": true, + "license": "MIT", + "dependencies": { + "domelementtype": "^2.0.1", + "domhandler": "^4.2.0", + "entities": "^2.0.0" + }, + "funding": { + "url": "https://github.com/cheeriojs/dom-serializer?sponsor=1" + } + }, + "node_modules/domelementtype": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/domelementtype/-/domelementtype-2.3.0.tgz", + "integrity": "sha512-OLETBj6w0OsagBwdXnPdN0cnMfF9opN69co+7ZrbfPGrdpPVNBUj02spi6B1N7wChLQiPn4CSH/zJvXw56gmHw==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/fb55" + } + ], + "license": "BSD-2-Clause" + }, + "node_modules/domhandler": { + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/domhandler/-/domhandler-4.3.1.tgz", + "integrity": "sha512-GrwoxYN+uWlzO8uhUXRl0P+kHE4GtVPfYzVLcUxPL7KNdHKj66vvlhiweIHqYYXWlw+T8iLMp42Lm67ghw4WMQ==", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "domelementtype": "^2.2.0" + }, + "engines": { + "node": ">= 4" + }, + "funding": { + "url": "https://github.com/fb55/domhandler?sponsor=1" + } + }, "node_modules/dompurify": { "version": "3.1.7", "resolved": "https://registry.npmjs.org/dompurify/-/dompurify-3.1.7.tgz", "integrity": "sha512-VaTstWtsneJY8xzy7DekmYWEOZcmzIe3Qb3zPd4STve1OBTa+e+WmS1ITQec1fZYXI3HCsOZZiSMpG6oxoWMWQ==", "license": "(MPL-2.0 OR Apache-2.0)" }, + "node_modules/domutils": { + "version": "2.8.0", + "resolved": "https://registry.npmjs.org/domutils/-/domutils-2.8.0.tgz", + "integrity": "sha512-w96Cjofp72M5IIhpjgobBimYEfoPjx1Vx0BSX9P30WBdZW2WIKU0T1Bd0kz2eNZ9ikjKgHbEyKx8BB6H1L3h3A==", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "dom-serializer": "^1.0.1", + "domelementtype": "^2.2.0", + "domhandler": "^4.2.0" + }, + "funding": { + "url": "https://github.com/fb55/domutils?sponsor=1" + } + }, "node_modules/eastasianwidth": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/eastasianwidth/-/eastasianwidth-0.2.0.tgz", @@ -5061,6 +5347,16 @@ "node": ">=10.13.0" } }, + "node_modules/entities": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/entities/-/entities-2.2.0.tgz", + "integrity": "sha512-p92if5Nz619I0w+akJrLZH0MX0Pb5DX39XOwQTtXSdQQOaYH03S1uIQp4mhOZtAXrxq4ViO67YTiLBo2638o9A==", + "dev": true, + "license": "BSD-2-Clause", + "funding": { + "url": "https://github.com/fb55/entities?sponsor=1" + } + }, "node_modules/env-paths": { "version": "2.2.1", "resolved": "https://registry.npmjs.org/env-paths/-/env-paths-2.2.1.tgz", @@ -6463,6 +6759,13 @@ "node": ">=0.10.0" } }, + "node_modules/eventemitter3": { + "version": "4.0.7", + "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-4.0.7.tgz", + "integrity": "sha512-8guHBZCwKnFhYdHr2ysuRWErTwhoN2X8XELRlrRwpmfeY2jjuUN4taQMsULKUVo1K4DvZl+0pgfyoysHxvmvEw==", + "dev": true, + "license": "MIT" + }, "node_modules/execa": { "version": "5.1.1", "resolved": "https://registry.npmjs.org/execa/-/execa-5.1.1.tgz", @@ -6739,6 +7042,16 @@ "node": ">=8" } }, + "node_modules/filter-obj": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/filter-obj/-/filter-obj-1.1.0.tgz", + "integrity": "sha512-8rXg1ZnX7xzy2NGDVkBVaAy+lSlPNwad13BtgSlLuxfIslyt5Vg64U7tFcCt4WS1R0hvtnQybT/IyCkGZ3DpXQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/find-file-up": { "version": "0.1.3", "resolved": "https://registry.npmjs.org/find-file-up/-/find-file-up-0.1.3.tgz", @@ -7489,6 +7802,19 @@ "node": ">=10.17.0" } }, + "node_modules/icss-utils": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/icss-utils/-/icss-utils-5.1.0.tgz", + "integrity": "sha512-soFhflCVWLfRNOPU3iv5Z9VUdT44xFRbzjLsEzSr5AQmgqPMTHdU3PMT1Cf1ssx8fLNJDA1juftYl+PUcv3MqA==", + "dev": true, + "license": "ISC", + "engines": { + "node": "^10 || ^12 || >= 14" + }, + "peerDependencies": { + "postcss": "^8.1.0" + } + }, "node_modules/ieee754": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", @@ -10945,6 +11271,16 @@ "node": ">= 0.8.0" } }, + "node_modules/lilconfig": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/lilconfig/-/lilconfig-2.1.0.tgz", + "integrity": "sha512-utWOt/GHzuUxnLKxB6dk81RoOeoNeHgbrXiuGk4yyF5qlRz+iIVWu56E2fqGHFrXz0QNUhLB/8nKqvRH66JKGQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10" + } + }, "node_modules/lines-and-columns": { "version": "1.2.4", "resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.2.4.tgz", @@ -10989,6 +11325,13 @@ "dev": true, "license": "MIT" }, + "node_modules/lodash.uniq": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/lodash.uniq/-/lodash.uniq-4.5.0.tgz", + "integrity": "sha512-xfBaXQd9ryd9dlSDvnvI0lvxfLJlYAZzXomUYzLKtUeOQvOP5piqAWuGtrhWeqaXK9hhoM/iyJc5AV+XfsX3HQ==", + "dev": true, + "license": "MIT" + }, "node_modules/loose-envify": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz", @@ -11068,6 +11411,13 @@ "tmpl": "1.0.5" } }, + "node_modules/mdn-data": { + "version": "2.0.14", + "resolved": "https://registry.npmjs.org/mdn-data/-/mdn-data-2.0.14.tgz", + "integrity": "sha512-dn6wd0uw5GsdswPFfsgMp5NSB0/aDe6fK94YJV/AJDYXL6HVLWBsxeq7js7Ad+mU2K9LAlwpk6kN2D5mwCPVow==", + "dev": true, + "license": "CC0-1.0" + }, "node_modules/merge-stream": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz", @@ -11199,6 +11549,25 @@ "dev": true, "license": "MIT" }, + "node_modules/nanoid": { + "version": "3.3.7", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.7.tgz", + "integrity": "sha512-eSRppjcPIatRIMC1U6UngP8XFcz8MQWGQdt1MTBQ7NaAmvXDfvNxbvWV3x2y6CdEUciCSsDHDQZbhYaB8QEo2g==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "bin": { + "nanoid": "bin/nanoid.cjs" + }, + "engines": { + "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" + } + }, "node_modules/natural-compare": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", @@ -11272,6 +11641,19 @@ "node": ">=0.10.0" } }, + "node_modules/normalize-url": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/normalize-url/-/normalize-url-6.1.0.tgz", + "integrity": "sha512-DlL+XwOy3NxAQ8xuC0okPgK46iuVNAK01YN7RueYBqqFeGsBjV9XmCAzAdgt+667bCl5kPh9EqKKDwnaPG1I7A==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/npm-run-path": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-4.0.1.tgz", @@ -11284,6 +11666,19 @@ "node": ">=8" } }, + "node_modules/nth-check": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/nth-check/-/nth-check-2.1.1.tgz", + "integrity": "sha512-lqjrjmaOoAnWfMmBPL+XNnynZh2+swxiX3WUE0s4yEHI6m+AwrK2UZOimIRl3X/4QctVqS8AiZjFqyOGrMXb/w==", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "boolbase": "^1.0.0" + }, + "funding": { + "url": "https://github.com/fb55/nth-check?sponsor=1" + } + }, "node_modules/object-assign": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", @@ -11495,6 +11890,16 @@ "ospec": "bin/ospec" } }, + "node_modules/p-finally": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/p-finally/-/p-finally-1.0.0.tgz", + "integrity": "sha512-LICb2p9CB7FS+0eR1oqWnHhp0FljGLZCWBE9aix0Uye9W8LTQPwMTYVGWQWIw9RdQiDg4+epXQODwIYJtSJaow==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4" + } + }, "node_modules/p-limit": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", @@ -11527,6 +11932,36 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/p-queue": { + "version": "6.6.2", + "resolved": "https://registry.npmjs.org/p-queue/-/p-queue-6.6.2.tgz", + "integrity": "sha512-RwFpb72c/BhQLEXIZ5K2e+AhgNVmIejGlTgiB9MzZ0e93GRvqZ7uSi0dvRF7/XIXDeNkra2fNHBxTyPDGySpjQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "eventemitter3": "^4.0.4", + "p-timeout": "^3.2.0" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/p-timeout": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/p-timeout/-/p-timeout-3.2.0.tgz", + "integrity": "sha512-rhIwUycgwwKcP9yTOOFK/AKsAopjjCakVqLHePO3CC6Mir1Z99xT+R63jZxAT5lFZLa2inS5h+ZS2GvR99/FBg==", + "dev": true, + "license": "MIT", + "dependencies": { + "p-finally": "^1.0.0" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/p-try": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", @@ -11685,21 +12120,6 @@ "dev": true, "license": "ISC" }, - "node_modules/picomatch": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.2.tgz", - "integrity": "sha512-M7BAV6Rlcy5u+m6oPhAPFgJTzAioX/6B0DxyvDlo9l8+T3nLKbrczg2WLUyzd45L8RqfUMyGPzekbMvX2Ldkwg==", - "dev": true, - "license": "MIT", - "optional": true, - "peer": true, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/jonschlinkert" - } - }, "node_modules/pirates": { "version": "4.0.6", "resolved": "https://registry.npmjs.org/pirates/-/pirates-4.0.6.tgz", @@ -11799,10 +12219,555 @@ "node": ">= 0.4" } }, - "node_modules/prelude-ls": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz", - "integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==", + "node_modules/postcss": { + "version": "8.4.47", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.47.tgz", + "integrity": "sha512-56rxCq7G/XfB4EkXq9Egn5GCqugWvDFjafDOThIdMBsI15iqPqR5r15TfSr1YPYeEI19YeaXMCbY6u88Y76GLQ==", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/postcss/" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/postcss" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "dependencies": { + "nanoid": "^3.3.7", + "picocolors": "^1.1.0", + "source-map-js": "^1.2.1" + }, + "engines": { + "node": "^10 || ^12 || >=14" + } + }, + "node_modules/postcss-calc": { + "version": "8.2.4", + "resolved": "https://registry.npmjs.org/postcss-calc/-/postcss-calc-8.2.4.tgz", + "integrity": "sha512-SmWMSJmB8MRnnULldx0lQIyhSNvuDl9HfrZkaqqE/WHAhToYsAvDq+yAsA/kIyINDszOp3Rh0GFoNuH5Ypsm3Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "postcss-selector-parser": "^6.0.9", + "postcss-value-parser": "^4.2.0" + }, + "peerDependencies": { + "postcss": "^8.2.2" + } + }, + "node_modules/postcss-colormin": { + "version": "5.3.1", + "resolved": "https://registry.npmjs.org/postcss-colormin/-/postcss-colormin-5.3.1.tgz", + "integrity": "sha512-UsWQG0AqTFQmpBegeLLc1+c3jIqBNB0zlDGRWR+dQ3pRKJL1oeMzyqmH3o2PIfn9MBdNrVPWhDbT769LxCTLJQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "browserslist": "^4.21.4", + "caniuse-api": "^3.0.0", + "colord": "^2.9.1", + "postcss-value-parser": "^4.2.0" + }, + "engines": { + "node": "^10 || ^12 || >=14.0" + }, + "peerDependencies": { + "postcss": "^8.2.15" + } + }, + "node_modules/postcss-convert-values": { + "version": "5.1.3", + "resolved": "https://registry.npmjs.org/postcss-convert-values/-/postcss-convert-values-5.1.3.tgz", + "integrity": "sha512-82pC1xkJZtcJEfiLw6UXnXVXScgtBrjlO5CBmuDQc+dlb88ZYheFsjTn40+zBVi3DkfF7iezO0nJUPLcJK3pvA==", + "dev": true, + "license": "MIT", + "dependencies": { + "browserslist": "^4.21.4", + "postcss-value-parser": "^4.2.0" + }, + "engines": { + "node": "^10 || ^12 || >=14.0" + }, + "peerDependencies": { + "postcss": "^8.2.15" + } + }, + "node_modules/postcss-discard-comments": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/postcss-discard-comments/-/postcss-discard-comments-5.1.2.tgz", + "integrity": "sha512-+L8208OVbHVF2UQf1iDmRcbdjJkuBF6IS29yBDSiWUIzpYaAhtNl6JYnYm12FnkeCwQqF5LeklOu6rAqgfBZqQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^10 || ^12 || >=14.0" + }, + "peerDependencies": { + "postcss": "^8.2.15" + } + }, + "node_modules/postcss-discard-duplicates": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/postcss-discard-duplicates/-/postcss-discard-duplicates-5.1.0.tgz", + "integrity": "sha512-zmX3IoSI2aoenxHV6C7plngHWWhUOV3sP1T8y2ifzxzbtnuhk1EdPwm0S1bIUNaJ2eNbWeGLEwzw8huPD67aQw==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^10 || ^12 || >=14.0" + }, + "peerDependencies": { + "postcss": "^8.2.15" + } + }, + "node_modules/postcss-discard-empty": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/postcss-discard-empty/-/postcss-discard-empty-5.1.1.tgz", + "integrity": "sha512-zPz4WljiSuLWsI0ir4Mcnr4qQQ5e1Ukc3i7UfE2XcrwKK2LIPIqE5jxMRxO6GbI3cv//ztXDsXwEWT3BHOGh3A==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^10 || ^12 || >=14.0" + }, + "peerDependencies": { + "postcss": "^8.2.15" + } + }, + "node_modules/postcss-discard-overridden": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/postcss-discard-overridden/-/postcss-discard-overridden-5.1.0.tgz", + "integrity": "sha512-21nOL7RqWR1kasIVdKs8HNqQJhFxLsyRfAnUDm4Fe4t4mCWL9OJiHvlHPjcd8zc5Myu89b/7wZDnOSjFgeWRtw==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^10 || ^12 || >=14.0" + }, + "peerDependencies": { + "postcss": "^8.2.15" + } + }, + "node_modules/postcss-merge-longhand": { + "version": "5.1.7", + "resolved": "https://registry.npmjs.org/postcss-merge-longhand/-/postcss-merge-longhand-5.1.7.tgz", + "integrity": "sha512-YCI9gZB+PLNskrK0BB3/2OzPnGhPkBEwmwhfYk1ilBHYVAZB7/tkTHFBAnCrvBBOmeYyMYw3DMjT55SyxMBzjQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "postcss-value-parser": "^4.2.0", + "stylehacks": "^5.1.1" + }, + "engines": { + "node": "^10 || ^12 || >=14.0" + }, + "peerDependencies": { + "postcss": "^8.2.15" + } + }, + "node_modules/postcss-merge-rules": { + "version": "5.1.4", + "resolved": "https://registry.npmjs.org/postcss-merge-rules/-/postcss-merge-rules-5.1.4.tgz", + "integrity": "sha512-0R2IuYpgU93y9lhVbO/OylTtKMVcHb67zjWIfCiKR9rWL3GUk1677LAqD/BcHizukdZEjT8Ru3oHRoAYoJy44g==", + "dev": true, + "license": "MIT", + "dependencies": { + "browserslist": "^4.21.4", + "caniuse-api": "^3.0.0", + "cssnano-utils": "^3.1.0", + "postcss-selector-parser": "^6.0.5" + }, + "engines": { + "node": "^10 || ^12 || >=14.0" + }, + "peerDependencies": { + "postcss": "^8.2.15" + } + }, + "node_modules/postcss-minify-font-values": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/postcss-minify-font-values/-/postcss-minify-font-values-5.1.0.tgz", + "integrity": "sha512-el3mYTgx13ZAPPirSVsHqFzl+BBBDrXvbySvPGFnQcTI4iNslrPaFq4muTkLZmKlGk4gyFAYUBMH30+HurREyA==", + "dev": true, + "license": "MIT", + "dependencies": { + "postcss-value-parser": "^4.2.0" + }, + "engines": { + "node": "^10 || ^12 || >=14.0" + }, + "peerDependencies": { + "postcss": "^8.2.15" + } + }, + "node_modules/postcss-minify-gradients": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/postcss-minify-gradients/-/postcss-minify-gradients-5.1.1.tgz", + "integrity": "sha512-VGvXMTpCEo4qHTNSa9A0a3D+dxGFZCYwR6Jokk+/3oB6flu2/PnPXAh2x7x52EkY5xlIHLm+Le8tJxe/7TNhzw==", + "dev": true, + "license": "MIT", + "dependencies": { + "colord": "^2.9.1", + "cssnano-utils": "^3.1.0", + "postcss-value-parser": "^4.2.0" + }, + "engines": { + "node": "^10 || ^12 || >=14.0" + }, + "peerDependencies": { + "postcss": "^8.2.15" + } + }, + "node_modules/postcss-minify-params": { + "version": "5.1.4", + "resolved": "https://registry.npmjs.org/postcss-minify-params/-/postcss-minify-params-5.1.4.tgz", + "integrity": "sha512-+mePA3MgdmVmv6g+30rn57USjOGSAyuxUmkfiWpzalZ8aiBkdPYjXWtHuwJGm1v5Ojy0Z0LaSYhHaLJQB0P8Jw==", + "dev": true, + "license": "MIT", + "dependencies": { + "browserslist": "^4.21.4", + "cssnano-utils": "^3.1.0", + "postcss-value-parser": "^4.2.0" + }, + "engines": { + "node": "^10 || ^12 || >=14.0" + }, + "peerDependencies": { + "postcss": "^8.2.15" + } + }, + "node_modules/postcss-minify-selectors": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/postcss-minify-selectors/-/postcss-minify-selectors-5.2.1.tgz", + "integrity": "sha512-nPJu7OjZJTsVUmPdm2TcaiohIwxP+v8ha9NehQ2ye9szv4orirRU3SDdtUmKH+10nzn0bAyOXZ0UEr7OpvLehg==", + "dev": true, + "license": "MIT", + "dependencies": { + "postcss-selector-parser": "^6.0.5" + }, + "engines": { + "node": "^10 || ^12 || >=14.0" + }, + "peerDependencies": { + "postcss": "^8.2.15" + } + }, + "node_modules/postcss-modules-extract-imports": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/postcss-modules-extract-imports/-/postcss-modules-extract-imports-3.1.0.tgz", + "integrity": "sha512-k3kNe0aNFQDAZGbin48pL2VNidTF0w4/eASDsxlyspobzU3wZQLOGj7L9gfRe0Jo9/4uud09DsjFNH7winGv8Q==", + "dev": true, + "license": "ISC", + "engines": { + "node": "^10 || ^12 || >= 14" + }, + "peerDependencies": { + "postcss": "^8.1.0" + } + }, + "node_modules/postcss-modules-local-by-default": { + "version": "4.0.5", + "resolved": "https://registry.npmjs.org/postcss-modules-local-by-default/-/postcss-modules-local-by-default-4.0.5.tgz", + "integrity": "sha512-6MieY7sIfTK0hYfafw1OMEG+2bg8Q1ocHCpoWLqOKj3JXlKu4G7btkmM/B7lFubYkYWmRSPLZi5chid63ZaZYw==", + "dev": true, + "license": "MIT", + "dependencies": { + "icss-utils": "^5.0.0", + "postcss-selector-parser": "^6.0.2", + "postcss-value-parser": "^4.1.0" + }, + "engines": { + "node": "^10 || ^12 || >= 14" + }, + "peerDependencies": { + "postcss": "^8.1.0" + } + }, + "node_modules/postcss-modules-scope": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/postcss-modules-scope/-/postcss-modules-scope-3.2.0.tgz", + "integrity": "sha512-oq+g1ssrsZOsx9M96c5w8laRmvEu9C3adDSjI8oTcbfkrTE8hx/zfyobUoWIxaKPO8bt6S62kxpw5GqypEw1QQ==", + "dev": true, + "license": "ISC", + "dependencies": { + "postcss-selector-parser": "^6.0.4" + }, + "engines": { + "node": "^10 || ^12 || >= 14" + }, + "peerDependencies": { + "postcss": "^8.1.0" + } + }, + "node_modules/postcss-modules-values": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/postcss-modules-values/-/postcss-modules-values-4.0.0.tgz", + "integrity": "sha512-RDxHkAiEGI78gS2ofyvCsu7iycRv7oqw5xMWn9iMoR0N/7mf9D50ecQqUo5BZ9Zh2vH4bCUR/ktCqbB9m8vJjQ==", + "dev": true, + "license": "ISC", + "dependencies": { + "icss-utils": "^5.0.0" + }, + "engines": { + "node": "^10 || ^12 || >= 14" + }, + "peerDependencies": { + "postcss": "^8.1.0" + } + }, + "node_modules/postcss-normalize-charset": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/postcss-normalize-charset/-/postcss-normalize-charset-5.1.0.tgz", + "integrity": "sha512-mSgUJ+pd/ldRGVx26p2wz9dNZ7ji6Pn8VWBajMXFf8jk7vUoSrZ2lt/wZR7DtlZYKesmZI680qjr2CeFF2fbUg==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^10 || ^12 || >=14.0" + }, + "peerDependencies": { + "postcss": "^8.2.15" + } + }, + "node_modules/postcss-normalize-display-values": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/postcss-normalize-display-values/-/postcss-normalize-display-values-5.1.0.tgz", + "integrity": "sha512-WP4KIM4o2dazQXWmFaqMmcvsKmhdINFblgSeRgn8BJ6vxaMyaJkwAzpPpuvSIoG/rmX3M+IrRZEz2H0glrQNEA==", + "dev": true, + "license": "MIT", + "dependencies": { + "postcss-value-parser": "^4.2.0" + }, + "engines": { + "node": "^10 || ^12 || >=14.0" + }, + "peerDependencies": { + "postcss": "^8.2.15" + } + }, + "node_modules/postcss-normalize-positions": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/postcss-normalize-positions/-/postcss-normalize-positions-5.1.1.tgz", + "integrity": "sha512-6UpCb0G4eofTCQLFVuI3EVNZzBNPiIKcA1AKVka+31fTVySphr3VUgAIULBhxZkKgwLImhzMR2Bw1ORK+37INg==", + "dev": true, + "license": "MIT", + "dependencies": { + "postcss-value-parser": "^4.2.0" + }, + "engines": { + "node": "^10 || ^12 || >=14.0" + }, + "peerDependencies": { + "postcss": "^8.2.15" + } + }, + "node_modules/postcss-normalize-repeat-style": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/postcss-normalize-repeat-style/-/postcss-normalize-repeat-style-5.1.1.tgz", + "integrity": "sha512-mFpLspGWkQtBcWIRFLmewo8aC3ImN2i/J3v8YCFUwDnPu3Xz4rLohDO26lGjwNsQxB3YF0KKRwspGzE2JEuS0g==", + "dev": true, + "license": "MIT", + "dependencies": { + "postcss-value-parser": "^4.2.0" + }, + "engines": { + "node": "^10 || ^12 || >=14.0" + }, + "peerDependencies": { + "postcss": "^8.2.15" + } + }, + "node_modules/postcss-normalize-string": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/postcss-normalize-string/-/postcss-normalize-string-5.1.0.tgz", + "integrity": "sha512-oYiIJOf4T9T1N4i+abeIc7Vgm/xPCGih4bZz5Nm0/ARVJ7K6xrDlLwvwqOydvyL3RHNf8qZk6vo3aatiw/go3w==", + "dev": true, + "license": "MIT", + "dependencies": { + "postcss-value-parser": "^4.2.0" + }, + "engines": { + "node": "^10 || ^12 || >=14.0" + }, + "peerDependencies": { + "postcss": "^8.2.15" + } + }, + "node_modules/postcss-normalize-timing-functions": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/postcss-normalize-timing-functions/-/postcss-normalize-timing-functions-5.1.0.tgz", + "integrity": "sha512-DOEkzJ4SAXv5xkHl0Wa9cZLF3WCBhF3o1SKVxKQAa+0pYKlueTpCgvkFAHfk+Y64ezX9+nITGrDZeVGgITJXjg==", + "dev": true, + "license": "MIT", + "dependencies": { + "postcss-value-parser": "^4.2.0" + }, + "engines": { + "node": "^10 || ^12 || >=14.0" + }, + "peerDependencies": { + "postcss": "^8.2.15" + } + }, + "node_modules/postcss-normalize-unicode": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/postcss-normalize-unicode/-/postcss-normalize-unicode-5.1.1.tgz", + "integrity": "sha512-qnCL5jzkNUmKVhZoENp1mJiGNPcsJCs1aaRmURmeJGES23Z/ajaln+EPTD+rBeNkSryI+2WTdW+lwcVdOikrpA==", + "dev": true, + "license": "MIT", + "dependencies": { + "browserslist": "^4.21.4", + "postcss-value-parser": "^4.2.0" + }, + "engines": { + "node": "^10 || ^12 || >=14.0" + }, + "peerDependencies": { + "postcss": "^8.2.15" + } + }, + "node_modules/postcss-normalize-url": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/postcss-normalize-url/-/postcss-normalize-url-5.1.0.tgz", + "integrity": "sha512-5upGeDO+PVthOxSmds43ZeMeZfKH+/DKgGRD7TElkkyS46JXAUhMzIKiCa7BabPeIy3AQcTkXwVVN7DbqsiCew==", + "dev": true, + "license": "MIT", + "dependencies": { + "normalize-url": "^6.0.1", + "postcss-value-parser": "^4.2.0" + }, + "engines": { + "node": "^10 || ^12 || >=14.0" + }, + "peerDependencies": { + "postcss": "^8.2.15" + } + }, + "node_modules/postcss-normalize-whitespace": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/postcss-normalize-whitespace/-/postcss-normalize-whitespace-5.1.1.tgz", + "integrity": "sha512-83ZJ4t3NUDETIHTa3uEg6asWjSBYL5EdkVB0sDncx9ERzOKBVJIUeDO9RyA9Zwtig8El1d79HBp0JEi8wvGQnA==", + "dev": true, + "license": "MIT", + "dependencies": { + "postcss-value-parser": "^4.2.0" + }, + "engines": { + "node": "^10 || ^12 || >=14.0" + }, + "peerDependencies": { + "postcss": "^8.2.15" + } + }, + "node_modules/postcss-ordered-values": { + "version": "5.1.3", + "resolved": "https://registry.npmjs.org/postcss-ordered-values/-/postcss-ordered-values-5.1.3.tgz", + "integrity": "sha512-9UO79VUhPwEkzbb3RNpqqghc6lcYej1aveQteWY+4POIwlqkYE21HKWaLDF6lWNuqCobEAyTovVhtI32Rbv2RQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "cssnano-utils": "^3.1.0", + "postcss-value-parser": "^4.2.0" + }, + "engines": { + "node": "^10 || ^12 || >=14.0" + }, + "peerDependencies": { + "postcss": "^8.2.15" + } + }, + "node_modules/postcss-reduce-initial": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/postcss-reduce-initial/-/postcss-reduce-initial-5.1.2.tgz", + "integrity": "sha512-dE/y2XRaqAi6OvjzD22pjTUQ8eOfc6m/natGHgKFBK9DxFmIm69YmaRVQrGgFlEfc1HePIurY0TmDeROK05rIg==", + "dev": true, + "license": "MIT", + "dependencies": { + "browserslist": "^4.21.4", + "caniuse-api": "^3.0.0" + }, + "engines": { + "node": "^10 || ^12 || >=14.0" + }, + "peerDependencies": { + "postcss": "^8.2.15" + } + }, + "node_modules/postcss-reduce-transforms": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/postcss-reduce-transforms/-/postcss-reduce-transforms-5.1.0.tgz", + "integrity": "sha512-2fbdbmgir5AvpW9RLtdONx1QoYG2/EtqpNQbFASDlixBbAYuTcJ0dECwlqNqH7VbaUnEnh8SrxOe2sRIn24XyQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "postcss-value-parser": "^4.2.0" + }, + "engines": { + "node": "^10 || ^12 || >=14.0" + }, + "peerDependencies": { + "postcss": "^8.2.15" + } + }, + "node_modules/postcss-selector-parser": { + "version": "6.1.2", + "resolved": "https://registry.npmjs.org/postcss-selector-parser/-/postcss-selector-parser-6.1.2.tgz", + "integrity": "sha512-Q8qQfPiZ+THO/3ZrOrO0cJJKfpYCagtMUkXbnEfmgUjwXg6z/WBeOyS9APBBPCTSiDV+s4SwQGu8yFsiMRIudg==", + "dev": true, + "license": "MIT", + "dependencies": { + "cssesc": "^3.0.0", + "util-deprecate": "^1.0.2" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/postcss-svgo": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/postcss-svgo/-/postcss-svgo-5.1.0.tgz", + "integrity": "sha512-D75KsH1zm5ZrHyxPakAxJWtkyXew5qwS70v56exwvw542d9CRtTo78K0WeFxZB4G7JXKKMbEZtZayTGdIky/eA==", + "dev": true, + "license": "MIT", + "dependencies": { + "postcss-value-parser": "^4.2.0", + "svgo": "^2.7.0" + }, + "engines": { + "node": "^10 || ^12 || >=14.0" + }, + "peerDependencies": { + "postcss": "^8.2.15" + } + }, + "node_modules/postcss-unique-selectors": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/postcss-unique-selectors/-/postcss-unique-selectors-5.1.1.tgz", + "integrity": "sha512-5JiODlELrz8L2HwxfPnhOWZYWDxVHWL83ufOv84NrcgipI7TaeRsatAhK4Tr2/ZiYldpK/wBvw5BD3qfaK96GA==", + "dev": true, + "license": "MIT", + "dependencies": { + "postcss-selector-parser": "^6.0.5" + }, + "engines": { + "node": "^10 || ^12 || >=14.0" + }, + "peerDependencies": { + "postcss": "^8.2.15" + } + }, + "node_modules/postcss-value-parser": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/postcss-value-parser/-/postcss-value-parser-4.2.0.tgz", + "integrity": "sha512-1NNCs6uurfkVbeXG4S8JFT9t19m45ICnif8zWLd5oPSZ50QnwMfK+H3jv408d4jw/7Bttv5axS5IiHoLaVNHeQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/prelude-ls": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz", + "integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==", "dev": true, "license": "MIT", "engines": { @@ -12083,6 +13048,25 @@ ], "license": "MIT" }, + "node_modules/query-string": { + "version": "7.1.3", + "resolved": "https://registry.npmjs.org/query-string/-/query-string-7.1.3.tgz", + "integrity": "sha512-hh2WYhq4fi8+b+/2Kg9CEge4fDPvHS534aOOvOZeQ3+Vf2mCFsaFBYj0i+iXcAq6I9Vzp5fjMFBlONvayDC1qg==", + "dev": true, + "license": "MIT", + "dependencies": { + "decode-uri-component": "^0.2.2", + "filter-obj": "^1.1.0", + "split-on-first": "^1.0.0", + "strict-uri-encode": "^2.0.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/queue-microtask": { "version": "1.2.3", "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", @@ -12567,6 +13551,98 @@ "sourcemap-codec": "^1.4.4" } }, + "node_modules/rollup-plugin-styles": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/rollup-plugin-styles/-/rollup-plugin-styles-4.0.0.tgz", + "integrity": "sha512-A2K2sao84OsTmDxXG83JTCdXWrmgvQkkI38XDat46rdtpGMRm9tSYqeCdlwwGDJF4kKIafhV1mUidqu8MxUGig==", + "dev": true, + "license": "MIT", + "dependencies": { + "@rollup/pluginutils": "^4.1.2", + "@types/cssnano": "^5.0.0", + "cosmiconfig": "^7.0.1", + "cssnano": "^5.0.15", + "fs-extra": "^10.0.0", + "icss-utils": "^5.1.0", + "mime-types": "^2.1.34", + "p-queue": "^6.6.2", + "postcss": "^8.4.5", + "postcss-modules-extract-imports": "^3.0.0", + "postcss-modules-local-by-default": "^4.0.0", + "postcss-modules-scope": "^3.0.0", + "postcss-modules-values": "^4.0.0", + "postcss-value-parser": "^4.2.0", + "query-string": "^7.1.0", + "resolve": "^1.21.0", + "source-map-js": "^1.0.1", + "tslib": "^2.3.1" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "peerDependencies": { + "rollup": "^2.63.0" + } + }, + "node_modules/rollup-plugin-styles/node_modules/@rollup/pluginutils": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/@rollup/pluginutils/-/pluginutils-4.2.1.tgz", + "integrity": "sha512-iKnFXr7NkdZAIHiIWE+BX5ULi/ucVFYWD6TbAV+rZctiRTY2PL6tsIKhoIOaoskiWAkgu+VsbXgUVDNLHf+InQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "estree-walker": "^2.0.1", + "picomatch": "^2.2.2" + }, + "engines": { + "node": ">= 8.0.0" + } + }, + "node_modules/rollup-plugin-styles/node_modules/cosmiconfig": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/cosmiconfig/-/cosmiconfig-7.1.0.tgz", + "integrity": "sha512-AdmX6xUzdNASswsFtmwSt7Vj8po9IuqXm0UXz7QKPuEUmPB4XyjGfaAr2PSuELMwkRMVH1EpIkX5bTZGRB3eCA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/parse-json": "^4.0.0", + "import-fresh": "^3.2.1", + "parse-json": "^5.0.0", + "path-type": "^4.0.0", + "yaml": "^1.10.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/rollup-plugin-styles/node_modules/fs-extra": { + "version": "10.1.0", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-10.1.0.tgz", + "integrity": "sha512-oRXApq54ETRj4eMiFzGnHWGy+zo5raudjuxN0b8H7s/RU2oW0Wvsx9O0ACRN/kRq9E8Vu/ReskGB5o3ji+FzHQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "graceful-fs": "^4.2.0", + "jsonfile": "^6.0.1", + "universalify": "^2.0.0" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/rollup-plugin-styles/node_modules/picomatch": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", + "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8.6" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, "node_modules/run-parallel": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", @@ -13072,6 +14148,16 @@ "node": ">=0.10.0" } }, + "node_modules/source-map-js": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.1.tgz", + "integrity": "sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==", + "dev": true, + "license": "BSD-3-Clause", + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/source-map-support": { "version": "0.5.13", "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.13.tgz", @@ -13154,6 +14240,16 @@ "dev": true, "license": "CC0-1.0" }, + "node_modules/split-on-first": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/split-on-first/-/split-on-first-1.1.0.tgz", + "integrity": "sha512-43ZssAJaMusuKWL8sKUBQXHWOpq8d6CfN/u1p4gUzfJkM05C8rxTmYrkIPTXapZpORA6LkkzcUulJ8FqA7Uudw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, "node_modules/sprintf-js": { "version": "1.1.3", "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.1.3.tgz", @@ -13161,6 +14257,14 @@ "dev": true, "license": "BSD-3-Clause" }, + "node_modules/stable": { + "version": "0.1.8", + "resolved": "https://registry.npmjs.org/stable/-/stable-0.1.8.tgz", + "integrity": "sha512-ji9qxRnOVfcuLDySj9qzhGSEFVobyt1kIOSkj1qZzYLzq7Tos/oUUWvotUPQLlrsidqsK6tBH89Bc9kL5zHA6w==", + "deprecated": "Modern JS already guarantees Array#sort() is a stable sort, so this library is deprecated. See the compatibility table on MDN: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort#browser_compatibility", + "dev": true, + "license": "MIT" + }, "node_modules/stack-utils": { "version": "2.0.6", "resolved": "https://registry.npmjs.org/stack-utils/-/stack-utils-2.0.6.tgz", @@ -13212,6 +14316,16 @@ "bare-events": "^2.2.0" } }, + "node_modules/strict-uri-encode": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/strict-uri-encode/-/strict-uri-encode-2.0.0.tgz", + "integrity": "sha512-QwiXZgpRcKkhTj2Scnn++4PKtWsH0kpzZ62L2R6c/LUVYv7hVnZqcg2+sMuT6R7Jusu1vviK/MFsu6kNJfWlEQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4" + } + }, "node_modules/string-length": { "version": "4.0.2", "resolved": "https://registry.npmjs.org/string-length/-/string-length-4.0.2.tgz", @@ -13428,6 +14542,23 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/stylehacks": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/stylehacks/-/stylehacks-5.1.1.tgz", + "integrity": "sha512-sBpcd5Hx7G6seo7b1LkpttvTz7ikD0LlH5RmdcBNb6fFR0Fl7LQwHDFr300q4cwUqi+IYrFGmsIHieMBfnN/Bw==", + "dev": true, + "license": "MIT", + "dependencies": { + "browserslist": "^4.21.4", + "postcss-selector-parser": "^6.0.4" + }, + "engines": { + "node": "^10 || ^12 || >=14.0" + }, + "peerDependencies": { + "postcss": "^8.2.15" + } + }, "node_modules/supports-color": { "version": "5.5.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", @@ -13454,6 +14585,38 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/svgo": { + "version": "2.8.0", + "resolved": "https://registry.npmjs.org/svgo/-/svgo-2.8.0.tgz", + "integrity": "sha512-+N/Q9kV1+F+UeWYoSiULYo4xYSDQlTgb+ayMobAXPwMnLvop7oxKMo9OzIrX5x3eS4L4f2UHhc9axXwY8DpChg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@trysound/sax": "0.2.0", + "commander": "^7.2.0", + "css-select": "^4.1.3", + "css-tree": "^1.1.3", + "csso": "^4.2.0", + "picocolors": "^1.0.0", + "stable": "^0.1.8" + }, + "bin": { + "svgo": "bin/svgo" + }, + "engines": { + "node": ">=10.13.0" + } + }, + "node_modules/svgo/node_modules/commander": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-7.2.0.tgz", + "integrity": "sha512-QrWXB+ZQSVPmIWIhtEO9H+gwHaMGYiF5ChvoJ+K9ZGHG/sVsa6yiesAD1GC/x46sET00Xlwo1u49RVVVzvcSkw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 10" + } + }, "node_modules/synckit": { "version": "0.6.2", "resolved": "https://registry.npmjs.org/synckit/-/synckit-0.6.2.tgz", @@ -14029,6 +15192,13 @@ "dev": true, "license": "MIT" }, + "node_modules/util-deprecate": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", + "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==", + "dev": true, + "license": "MIT" + }, "node_modules/v8-to-istanbul": { "version": "9.3.0", "resolved": "https://registry.npmjs.org/v8-to-istanbul/-/v8-to-istanbul-9.3.0.tgz", @@ -14333,6 +15503,16 @@ "dev": true, "license": "ISC" }, + "node_modules/yaml": { + "version": "1.10.2", + "resolved": "https://registry.npmjs.org/yaml/-/yaml-1.10.2.tgz", + "integrity": "sha512-r3vXyErRCYJ7wg28yvBY5VSoAF8ZvlcW9/BwUzEtUsjvX/DKs24dIkuwjtuprwJJHsbyUbLApepYTR1BN4uHrg==", + "dev": true, + "license": "ISC", + "engines": { + "node": ">= 6" + } + }, "node_modules/yargs": { "version": "17.7.2", "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.7.2.tgz", diff --git a/package.json b/package.json index e43e9f7..88b70ec 100644 --- a/package.json +++ b/package.json @@ -92,6 +92,7 @@ "puppeteer": "^23.5.3", "rollup": "^4.24.0", "rollup-plugin-modify": "^3.0.0", + "rollup-plugin-styles": "^4.0.0", "shx": "^0.3.4", "ts-jest": "^29.2.5", "typescript": "^5.6.3" From f90b655017c4cfbfdcb4ba9624ebeef350ab02f9 Mon Sep 17 00:00:00 2001 From: Andreas Stassivik Date: Wed, 16 Oct 2024 17:59:09 -0700 Subject: [PATCH 04/31] tutorial stylesheets imported as source files --- .../tutorial/quick-start/style/short.css | 0 src/tutorial/style/theme.css | 13 +++++++++++++ 2 files changed, 13 insertions(+) rename {public => src}/tutorial/quick-start/style/short.css (100%) create mode 100644 src/tutorial/style/theme.css diff --git a/public/tutorial/quick-start/style/short.css b/src/tutorial/quick-start/style/short.css similarity index 100% rename from public/tutorial/quick-start/style/short.css rename to src/tutorial/quick-start/style/short.css diff --git a/src/tutorial/style/theme.css b/src/tutorial/style/theme.css new file mode 100644 index 0000000..98e887f --- /dev/null +++ b/src/tutorial/style/theme.css @@ -0,0 +1,13 @@ +body { + background-color: color-mix( + in srgb, + Canvas, + CanvasText 2.5% + ); + color: color-mix( + in srgb, + CanvasText, + Canvas 15% + ); + color-scheme: light dark; +} From 031533199e91520f447d4afb4a82efd277992fc2 Mon Sep 17 00:00:00 2001 From: Andreas Stassivik Date: Wed, 16 Oct 2024 18:18:55 -0700 Subject: [PATCH 05/31] opt project into npm `legacy-peer-deps` option due to `rollup@2.79.2` conflict versus `rollup@^2.63.0` from `rollup-plugin-styles@4.0.0` --- .npmrc | 1 + 1 file changed, 1 insertion(+) create mode 100644 .npmrc diff --git a/.npmrc b/.npmrc new file mode 100644 index 0000000..521a9f7 --- /dev/null +++ b/.npmrc @@ -0,0 +1 @@ +legacy-peer-deps=true From 58adb56c8adca9ab362ed8a77b8ffddec6e2f8d6 Mon Sep 17 00:00:00 2001 From: Andreas Stassivik Date: Wed, 16 Oct 2024 19:11:41 -0700 Subject: [PATCH 06/31] Revert "tutorial stylesheets imported as source files" This reverts commit f90b655017c4cfbfdcb4ba9624ebeef350ab02f9. --- .../tutorial/quick-start/style/short.css | 0 src/tutorial/style/theme.css | 13 ------------- 2 files changed, 13 deletions(-) rename {src => public}/tutorial/quick-start/style/short.css (100%) delete mode 100644 src/tutorial/style/theme.css diff --git a/src/tutorial/quick-start/style/short.css b/public/tutorial/quick-start/style/short.css similarity index 100% rename from src/tutorial/quick-start/style/short.css rename to public/tutorial/quick-start/style/short.css diff --git a/src/tutorial/style/theme.css b/src/tutorial/style/theme.css deleted file mode 100644 index 98e887f..0000000 --- a/src/tutorial/style/theme.css +++ /dev/null @@ -1,13 +0,0 @@ -body { - background-color: color-mix( - in srgb, - Canvas, - CanvasText 2.5% - ); - color: color-mix( - in srgb, - CanvasText, - Canvas 15% - ); - color-scheme: light dark; -} From 28507922a951bf24a9a09d46e44035a6c46b6936 Mon Sep 17 00:00:00 2001 From: Andreas Stassivik Date: Wed, 16 Oct 2024 19:17:31 -0700 Subject: [PATCH 07/31] tutorial stylesheets copied as source files --- src/tutorial/quick-start/style/short.css | 3 +++ src/tutorial/style/theme.css | 13 +++++++++++++ 2 files changed, 16 insertions(+) create mode 100644 src/tutorial/quick-start/style/short.css create mode 100644 src/tutorial/style/theme.css diff --git a/src/tutorial/quick-start/style/short.css b/src/tutorial/quick-start/style/short.css new file mode 100644 index 0000000..a14de7d --- /dev/null +++ b/src/tutorial/quick-start/style/short.css @@ -0,0 +1,3 @@ +.leaflet-container { + height: 180px; +} diff --git a/src/tutorial/style/theme.css b/src/tutorial/style/theme.css new file mode 100644 index 0000000..98e887f --- /dev/null +++ b/src/tutorial/style/theme.css @@ -0,0 +1,13 @@ +body { + background-color: color-mix( + in srgb, + Canvas, + CanvasText 2.5% + ); + color: color-mix( + in srgb, + CanvasText, + Canvas 15% + ); + color-scheme: light dark; +} From a105f3d9b6f45f9194a84b89d7d2d74973220fec Mon Sep 17 00:00:00 2001 From: Andreas Stassivik Date: Wed, 16 Oct 2024 19:20:26 -0700 Subject: [PATCH 08/31] dynamic imports in leaflet adapter --- src/leaf/circle.ts | 9 ++++----- .../coordinate-reference-system/epsg-3857.ts | 4 +--- src/leaf/map/map.ts | 16 ++++++++-------- src/leaf/marker.ts | 12 ++++++------ src/leaf/polygon.ts | 14 +++++++++----- src/leaf/popup.ts | 8 ++++---- src/leaf/tile-layer/tile-layer-osm.ts | 4 +++- src/leaf/tile-layer/tile-layer.ts | 7 +++---- 8 files changed, 38 insertions(+), 36 deletions(-) diff --git a/src/leaf/circle.ts b/src/leaf/circle.ts index b643b78..45ebc55 100644 --- a/src/leaf/circle.ts +++ b/src/leaf/circle.ts @@ -1,5 +1,4 @@ import { - circle as leafletCircle, type Circle, type CircleMarkerOptions, type Content, @@ -22,7 +21,7 @@ export type CircleOptions = CircleMarkerOptions & { const defaultColor = '#3388ff' -export function circle({ +export async function circle({ color = defaultColor, fillColor = defaultColor, fillOpacity = 0.2, @@ -30,14 +29,14 @@ export function circle({ map, popupContent, ...props -}: CircleOptions): Circle { - const created = leafletCircle(latitudeLongitude, { +}: CircleOptions): Promise { + const created: Circle = (await import('leaflet')).circle(latitudeLongitude, { color, fillColor, fillOpacity, ...props, }), - conditionallyRendered = map ? created.addTo(map) : created + conditionallyRendered: Circle = map ? created.addTo(map) : created return popupContent ? conditionallyRendered.bindPopup(popupContent) diff --git a/src/leaf/coordinate-reference-system/epsg-3857.ts b/src/leaf/coordinate-reference-system/epsg-3857.ts index 97533c6..c132d79 100644 --- a/src/leaf/coordinate-reference-system/epsg-3857.ts +++ b/src/leaf/coordinate-reference-system/epsg-3857.ts @@ -1,5 +1,3 @@ -import { CRS } from 'leaflet' - -const { EPSG3857: epsg3857 } = CRS +const { EPSG3857: epsg3857 } = (await import('leaflet')).CRS export { epsg3857 } diff --git a/src/leaf/map/map.ts b/src/leaf/map/map.ts index cce8bc7..ccf695c 100644 --- a/src/leaf/map/map.ts +++ b/src/leaf/map/map.ts @@ -1,5 +1,4 @@ import { - map as leafletMap, type CRS, type ErrorEventHandlerFn, type FitBoundsOptions, @@ -11,8 +10,6 @@ import { type MapOptions as LeafletMapOptions, } from 'leaflet' -import { epsg3857 } from '../coordinate-reference-system/epsg-3857.js' - export type MapOptions = LeafletMapOptions & { id: string | HTMLElement } & Partial<{ @@ -31,9 +28,9 @@ export type MapOptions = LeafletMapOptions & { zoomSnap: number }> -export function map({ +export async function map({ activeLayers: layers, - crs = epsg3857, + crs, dragging = true, fitWorld, fitWorldOptions = fitWorld ? {} : undefined, @@ -47,9 +44,12 @@ export function map({ zoomMin: minZoom, zoomSnap = 1, ...props -}: MapOptions): Map { - const created: Map = leafletMap(element, { - crs, +}: MapOptions): Promise { + const created: Map = (await import('leaflet')).map(element, { + crs: crs + ? crs + : (await import('../coordinate-reference-system/epsg-3857.js')) + .epsg3857, dragging, layers, maxZoom, diff --git a/src/leaf/marker.ts b/src/leaf/marker.ts index 0f7e2ee..943502b 100644 --- a/src/leaf/marker.ts +++ b/src/leaf/marker.ts @@ -1,6 +1,4 @@ import { - icon, - marker as leafletMarker, type Content, type IconOptions, type LatLngExpression, @@ -21,17 +19,19 @@ export type MarkerOptions = LeafletMarkerOptions & { popupContent: ((layer: Layer) => Content) | Content | Popup }> -export function marker({ +export async function marker({ altText: alt = 'Marker', iconOptions, latitudeLongitude, map, popupContent, ...props -}: MarkerOptions): Marker { - const created: Marker = leafletMarker(latitudeLongitude, { +}: MarkerOptions): Promise { + const created: Marker = (await import('leaflet')).marker(latitudeLongitude, { alt, - ...(iconOptions ? { icon: icon(iconOptions) } : {}), + ...(iconOptions + ? { icon: (await import('leaflet')).icon(iconOptions) } + : {}), ...props, }), prerendered: Marker = popupContent diff --git a/src/leaf/polygon.ts b/src/leaf/polygon.ts index 4f4352e..387e1b4 100644 --- a/src/leaf/polygon.ts +++ b/src/leaf/polygon.ts @@ -1,5 +1,4 @@ import { - polygon as leafletPolygon, type Content, type LatLngExpression, type Layer, @@ -20,14 +19,19 @@ export type PolygonOptions = PolylineOptions & { popupContent: ((layer: Layer) => Content) | Content | Popup }> -export function polygon({ +export async function polygon({ latitudeLongitudes, map, popupContent, ...props -}: PolygonOptions): Polygon { - const created = leafletPolygon(latitudeLongitudes, props), - prerendered = popupContent ? created.bindPopup(popupContent) : created +}: PolygonOptions): Promise { + const created: Polygon = (await import('leaflet')).polygon( + latitudeLongitudes, + props, + ), + prerendered: Polygon = popupContent + ? created.bindPopup(popupContent) + : created return map ? prerendered.addTo(map) : prerendered } diff --git a/src/leaf/popup.ts b/src/leaf/popup.ts index a5980f0..7b9ea16 100644 --- a/src/leaf/popup.ts +++ b/src/leaf/popup.ts @@ -1,5 +1,4 @@ import { - popup as leafletPopup, type Content, type LatLngExpression, type Layer, @@ -14,13 +13,14 @@ export type PopupOptions = Partial & { map: Map } -export function popup({ +export async function popup({ htmlContent, latitudeLongitude, map, ...props -}: PopupOptions): Popup { - return leafletPopup(props) +}: PopupOptions): Promise { + return (await import('leaflet')) + .popup(props) .setLatLng(latitudeLongitude) .setContent(htmlContent) .openOn(map) diff --git a/src/leaf/tile-layer/tile-layer-osm.ts b/src/leaf/tile-layer/tile-layer-osm.ts index be227d5..7fa90de 100644 --- a/src/leaf/tile-layer/tile-layer-osm.ts +++ b/src/leaf/tile-layer/tile-layer-osm.ts @@ -7,7 +7,9 @@ export type TileLayerOsmOptions = Omit< 'attribution' | 'urlTemplate' > -export function tileLayerOsm({ ...props }: TileLayerOsmOptions): TileLayer { +export async function tileLayerOsm({ + ...props +}: TileLayerOsmOptions): Promise { return tileLayer({ attribution: '© OpenStreetMap', diff --git a/src/leaf/tile-layer/tile-layer.ts b/src/leaf/tile-layer/tile-layer.ts index 5b8d5ba..3509866 100644 --- a/src/leaf/tile-layer/tile-layer.ts +++ b/src/leaf/tile-layer/tile-layer.ts @@ -1,5 +1,4 @@ import { - tileLayer as leafletTileLayer, type LayerGroup, type Map, type TileLayer, @@ -15,13 +14,13 @@ export type TileLayerOptions = { } > -export function tileLayer({ +export async function tileLayer({ map, urlTemplate, zoomMax: maxZoom = 18, ...props -}: TileLayerOptions): TileLayer { - const created = leafletTileLayer(urlTemplate, { +}: TileLayerOptions): Promise { + const created: TileLayer = (await import('leaflet')).tileLayer(urlTemplate, { maxZoom, ...props, }) From 5e88186888ea65ff2cf199e9ee9b7bfe6fa11ba2 Mon Sep 17 00:00:00 2001 From: Andreas Stassivik Date: Wed, 16 Oct 2024 20:32:31 -0700 Subject: [PATCH 09/31] extend leaflet `Map` to support extant async event handlers `onClick` & `onLocate` --- src/leaf/map/map.ts | 34 +++++++++++++++++++++++++++++++--- 1 file changed, 31 insertions(+), 3 deletions(-) diff --git a/src/leaf/map/map.ts b/src/leaf/map/map.ts index ccf695c..9a31fe2 100644 --- a/src/leaf/map/map.ts +++ b/src/leaf/map/map.ts @@ -3,13 +3,41 @@ import { type ErrorEventHandlerFn, type FitBoundsOptions, type Layer, + type LeafletMouseEvent, type LeafletMouseEventHandlerFn, type LocateOptions, + type LocationEvent, type LocationEventHandlerFn, - type Map, + type Map as LeafletMap, type MapOptions as LeafletMapOptions, } from 'leaflet' +type OnClick = + | LeafletMouseEventHandlerFn + | ((event: LeafletMouseEvent) => Promise) +type OnLocate = + | LocationEventHandlerFn + | ((event: LocationEvent) => Promise) + +export type Map = LeafletMap & { + on: + | (( + type: + | 'click' + | 'dblclick' + | 'mousedown' + | 'mouseup' + | 'mouseover' + | 'mouseout' + | 'mousemove' + | 'contextmenu' + | 'preclick', + fn: OnClick, + context?: unknown, + ) => void) + | ((type: 'locationfound', fn: OnLocate, context?: unknown) => void) +} + export type MapOptions = LeafletMapOptions & { id: string | HTMLElement } & Partial<{ @@ -19,8 +47,8 @@ export type MapOptions = LeafletMapOptions & { fitWorld: boolean fitWorldOptions: FitBoundsOptions locateOptions: LocateOptions - onClick: LeafletMouseEventHandlerFn - onLocate: LocationEventHandlerFn + onClick: OnClick + onLocate: OnLocate onLocateError: ErrorEventHandlerFn zoomDelta: number zoomMax: number From aae963596956efb02425f94c4e2b63dc9075cdf8 Mon Sep 17 00:00:00 2001 From: Andreas Stassivik Date: Wed, 16 Oct 2024 20:44:00 -0700 Subject: [PATCH 10/31] async leaflet adapter & extended `Map` type integration --- src/tutorial/custom-icons/custom-icons.ts | 55 +++++++++++------------ src/tutorial/mobile/mobile.ts | 35 +++++++++------ src/tutorial/quick-start/quick-start.ts | 54 ++++++++++++++-------- 3 files changed, 83 insertions(+), 61 deletions(-) diff --git a/src/tutorial/custom-icons/custom-icons.ts b/src/tutorial/custom-icons/custom-icons.ts index 86b38a5..97e2ee8 100644 --- a/src/tutorial/custom-icons/custom-icons.ts +++ b/src/tutorial/custom-icons/custom-icons.ts @@ -1,6 +1,6 @@ -import { type LatLngExpression, type Map } from 'leaflet' +import { type LatLngExpression } from 'leaflet' -import { map as leafletMap, marker, tileLayerOsm } from '@stassi/leaf' +import { map as leafletMap, type Map, marker, tileLayerOsm } from '@stassi/leaf' type Icon = { iconUrl: string @@ -8,35 +8,34 @@ type Icon = { popupContent: string } -const map: Map = leafletMap({ - center: [51.5, -0.09], - id: 'map', - zoom: 13, - }), - icons = [ - { - iconUrl: 'image/green.png', - latitudeLongitude: [51.5, -0.09], - popupContent: 'I am a green leaf.', - }, - { - iconUrl: 'image/orange.png', - latitudeLongitude: [51.49, -0.1], - popupContent: 'I am an orange leaf.', - }, - { - iconUrl: 'image/red.png', - latitudeLongitude: [51.495, -0.083], - popupContent: 'I am a red leaf.', - }, - ] +const map: Map = await leafletMap({ + center: [51.5, -0.09], + id: 'map', + zoom: 13, +}) -tileLayerOsm({ +await tileLayerOsm({ map, }) -icons.forEach(({ iconUrl, latitudeLongitude, popupContent }: Icon): void => { - marker({ +for (const { iconUrl, latitudeLongitude, popupContent } of [ + { + iconUrl: 'image/green.png', + latitudeLongitude: [51.5, -0.09], + popupContent: 'I am a green leaf.', + }, + { + iconUrl: 'image/orange.png', + latitudeLongitude: [51.49, -0.1], + popupContent: 'I am an orange leaf.', + }, + { + iconUrl: 'image/red.png', + latitudeLongitude: [51.495, -0.083], + popupContent: 'I am a red leaf.', + }, +]) { + await marker({ iconOptions: { iconAnchor: [22, 94], iconSize: [38, 95], @@ -50,4 +49,4 @@ icons.forEach(({ iconUrl, latitudeLongitude, popupContent }: Icon): void => { map, popupContent, }) -}) +} diff --git a/src/tutorial/mobile/mobile.ts b/src/tutorial/mobile/mobile.ts index 3263604..3093888 100644 --- a/src/tutorial/mobile/mobile.ts +++ b/src/tutorial/mobile/mobile.ts @@ -1,37 +1,44 @@ -import { type ErrorEvent, type LocationEvent, type Map } from 'leaflet' +import { type ErrorEvent, type LocationEvent } from 'leaflet' -import { circle, map as leafletMap, marker, tileLayerOsm } from '@stassi/leaf' +import { + circle, + map as leafletMap, + type Map, + marker, + tileLayerOsm, +} from '@stassi/leaf' -const map: Map = leafletMap({ +const map: Map = await leafletMap({ fitWorld: true, id: 'map', locateOptions: { maxZoom: 16, setView: true, }, - onLocate: ({ + async onLocate({ accuracy: radius, latlng: latitudeLongitude, - }: LocationEvent): void => { - circle({ + }: LocationEvent): Promise { + await circle({ latitudeLongitude, map, radius, }) - - marker({ - latitudeLongitude, - map, - popupContent: `You are within ${radius.toString()} meters from this point.`, - }).openPopup() + ;( + await marker({ + latitudeLongitude, + map, + popupContent: `You are within ${radius.toString()} meters from this point.`, + }) + ).openPopup() }, - onLocateError: ({ message }: ErrorEvent): void => { + onLocateError({ message }: ErrorEvent): void { // eslint-disable-next-line no-alert -- required by tutorial alert(message) }, }) -tileLayerOsm({ +await tileLayerOsm({ map, zoomMax: 19, }) diff --git a/src/tutorial/quick-start/quick-start.ts b/src/tutorial/quick-start/quick-start.ts index 924f5d5..6cdfa86 100644 --- a/src/tutorial/quick-start/quick-start.ts +++ b/src/tutorial/quick-start/quick-start.ts @@ -1,19 +1,22 @@ -import { type LeafletMouseEvent, type Map } from 'leaflet' - -import { - circle, - map as leafletMap, - marker, - polygon, - popup, - tileLayerOsm, -} from '@stassi/leaf' - -const map: Map = leafletMap({ +import 'leaflet/dist/leaflet.css' +import '../style/theme.css' +import './style/short.css' + +import { type LeafletMouseEvent } from 'leaflet' + +import { type Map } from '@stassi/leaf' + +const map: Map = await ( + await import('../../leaf/map/map.js') +).map({ center: [51.505, -0.09], id: 'map', - onClick: ({ latlng: latitudeLongitude }: LeafletMouseEvent): void => { - popup({ + async onClick({ + latlng: latitudeLongitude, + }: LeafletMouseEvent): Promise { + await ( + await import('../../leaf/popup.js') + ).popup({ htmlContent: `You clicked the map at ${latitudeLongitude.toString()}`, latitudeLongitude, map, @@ -22,18 +25,27 @@ const map: Map = leafletMap({ zoom: 13, }) -tileLayerOsm({ +await ( + await import('../../leaf/tile-layer/tile-layer-osm.js') +).tileLayerOsm({ map, zoomMax: 19, }) -marker({ +await ( + await import('../../leaf/marker.js') +).marker({ + iconOptions: { + iconUrl: './assets/marker-icon.png', + }, latitudeLongitude: [51.5, -0.09], map, popupContent: 'Hello world!
I am a popup.', }) -circle({ +await ( + await import('../../leaf/circle.js') +).circle({ color: 'red', fillColor: '#f03', fillOpacity: 0.5, @@ -43,7 +55,9 @@ circle({ radius: 500, }) -polygon({ +await ( + await import('../../leaf/polygon.js') +).polygon({ latitudeLongitudes: [ [51.509, -0.08], [51.503, -0.06], @@ -53,7 +67,9 @@ polygon({ popupContent: 'I am a polygon.', }) -popup({ +await ( + await import('../../leaf/popup.js') +).popup({ htmlContent: 'I am a standalone popup.', latitudeLongitude: [51.513, -0.09], map, From 5595fec1909db44d0758b6737f4b3fe6b23d6e42 Mon Sep 17 00:00:00 2001 From: Andreas Stassivik Date: Wed, 16 Oct 2024 20:46:12 -0700 Subject: [PATCH 11/31] `quick-start` tutorial dynamic generation --- rollup.config.ts | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/rollup.config.ts b/rollup.config.ts index eb86971..b257b85 100644 --- a/rollup.config.ts +++ b/rollup.config.ts @@ -17,6 +17,7 @@ import typescript from '@rollup/plugin-typescript' // @ts-expect-error -- untyped plugin import untypedModify from 'rollup-plugin-modify' import { nodeResolve } from '@rollup/plugin-node-resolve' +import styles from 'rollup-plugin-styles' // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment -- untyped plugin const modify: (modifyOptions: { @@ -29,7 +30,8 @@ const rollupConfig: RollupOptions[] = [ input: 'src/index.ts', output: [ { - file: 'dist/leaf.js', + dir: 'dist/', + entryFileNames: 'leaf.js', format: 'esm', sourcemap: true, }, @@ -57,19 +59,26 @@ const rollupConfig: RollupOptions[] = [ external: ['@stassi/leaf'], input: 'src/tutorial/quick-start/quick-start.ts', output: { - dir: 'public/tutorial/quick-start/dist/', - entryFileNames: 'script/quick-start.js', + assetFileNames: 'style/[name][extname]', + chunkFileNames: 'script/[name]-[hash].js', + dir: 'public/tutorial/dist/', + entryFileNames: 'script/[name].js', format: 'esm', - paths: { - '@stassi/leaf': '../../../../leaf/leaf.js', - }, sourcemap: true, }, plugins: [ + commonjs(), + nodeResolve(), + styles({ + mode: 'extract', + sourceMap: true, + url: { hash: false, publicPath: '../assets/' }, + }), typescript(), terser(), html({ fileName: 'quick-start.html', + publicPath: './', template({ attributes, files, From 2e1b04b5e156f3694d40f6b26aaeace796ede64f Mon Sep 17 00:00:00 2001 From: Andreas Stassivik Date: Wed, 16 Oct 2024 20:46:50 -0700 Subject: [PATCH 12/31] dynamic `quick-start` tutorial integration --- public/index.html | 2 +- src/tutorial/open-street-map-tiles.test.ts | 2 +- src/tutorial/quick-start/quick-start.test.ts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/public/index.html b/public/index.html index a3dc709..ff8fdb6 100644 --- a/public/index.html +++ b/public/index.html @@ -11,7 +11,7 @@

Leaflet

  1. - Quick start + Quick start (tutorial)
  2. diff --git a/src/tutorial/open-street-map-tiles.test.ts b/src/tutorial/open-street-map-tiles.test.ts index adc895e..2cbeb44 100644 --- a/src/tutorial/open-street-map-tiles.test.ts +++ b/src/tutorial/open-street-map-tiles.test.ts @@ -4,7 +4,7 @@ describe('OpenStreetMap tiles', (): void => { 'accessibility/interactive', 'custom-icons/custom-icons', 'mobile/mobile', - 'quick-start/quick-start', + 'dist/quick-start', ])('tutorial: %s', (path: string): void => { it('should render', async (): Promise => { await page.goto(`http://localhost:3001/tutorial/${path}`) diff --git a/src/tutorial/quick-start/quick-start.test.ts b/src/tutorial/quick-start/quick-start.test.ts index fbbde86..bbfc9a9 100644 --- a/src/tutorial/quick-start/quick-start.test.ts +++ b/src/tutorial/quick-start/quick-start.test.ts @@ -2,7 +2,7 @@ import { type BoundingBox } from 'puppeteer' describe('quick start tutorial', (): void => { beforeAll(async (): Promise => { - await page.goto('http://localhost:3001/tutorial/quick-start/quick-start') + await page.goto('http://localhost:3001/tutorial/dist/quick-start') }) describe('map', (): void => { From 81104d723191f7537a72c9ef877f3c96eba6b10f Mon Sep 17 00:00:00 2001 From: Andreas Stassivik Date: Wed, 16 Oct 2024 20:47:55 -0700 Subject: [PATCH 13/31] remove superfluous statically generated `quick-start` tutorial (replaced by dynamic generation) --- public/tutorial/quick-start/quick-start.html | 17 ----------------- 1 file changed, 17 deletions(-) delete mode 100644 public/tutorial/quick-start/quick-start.html diff --git a/public/tutorial/quick-start/quick-start.html b/public/tutorial/quick-start/quick-start.html deleted file mode 100644 index 6079681..0000000 --- a/public/tutorial/quick-start/quick-start.html +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - Leaflet Quick Start Guide - - - - - - - -
    - - - From a048160e4d4407bef1d1ce5a1ddb181625fa3fc5 Mon Sep 17 00:00:00 2001 From: Andreas Stassivik Date: Wed, 16 Oct 2024 22:56:44 -0700 Subject: [PATCH 14/31] common tutorial stylesheet copied to source --- src/tutorial/style/medium.css | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 src/tutorial/style/medium.css diff --git a/src/tutorial/style/medium.css b/src/tutorial/style/medium.css new file mode 100644 index 0000000..9810b5d --- /dev/null +++ b/src/tutorial/style/medium.css @@ -0,0 +1,6 @@ +.leaflet-container { + height: 400px; + max-height: 100%; + max-width: 100%; + width: 600px; +} From 713dc62ac4105262e809213eecade99f4731a3e6 Mon Sep 17 00:00:00 2001 From: Andreas Stassivik Date: Wed, 16 Oct 2024 23:00:50 -0700 Subject: [PATCH 15/31] `custom-icons` tutorial dynamic generation --- rollup.config.ts | 64 ++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 57 insertions(+), 7 deletions(-) diff --git a/rollup.config.ts b/rollup.config.ts index b257b85..3a6542d 100644 --- a/rollup.config.ts +++ b/rollup.config.ts @@ -56,7 +56,6 @@ const rollupConfig: RollupOptions[] = [ ], }, { - external: ['@stassi/leaf'], input: 'src/tutorial/quick-start/quick-start.ts', output: { assetFileNames: 'style/[name][extname]', @@ -134,17 +133,68 @@ const rollupConfig: RollupOptions[] = [ plugins: [typescript(), terser()], }, { - external: ['@stassi/leaf'], input: 'src/tutorial/custom-icons/custom-icons.ts', output: { - file: 'public/tutorial/custom-icons/dist/script/custom-icons.js', + assetFileNames: 'style/[name][extname]', + chunkFileNames: 'script/[name]-[hash].js', + dir: 'public/tutorial/dist/', + entryFileNames: 'script/[name].js', format: 'esm', - paths: { - '@stassi/leaf': '../../../../leaf/leaf.js', - }, sourcemap: true, }, - plugins: [typescript(), terser()], + plugins: [ + commonjs(), + nodeResolve(), + styles({ + mode: 'extract', + sourceMap: true, + url: { hash: false, publicPath: '../assets/' }, + }), + typescript(), + terser(), + html({ + fileName: 'custom-icons.html', + publicPath: './', + template({ + attributes, + files, + meta, + publicPath, + title, + }: RollupHtmlTemplateOptions): string { + return ` + + >attributes.html)}> + + ${meta + .map( + (input: Record): string => + ``, + ) + .join('\n')} + ${title} + ${(files.css ?? []) + .map( + ({ fileName }: OutputChunk | OutputAsset): string => + `>attributes.link)}>`, + ) + .join('\n')} + + +
    + ${(files.js ?? []) + .map( + ({ fileName }: OutputChunk | OutputAsset): string => + ``, + ) + .join('\n')} + + + ` + }, + title: 'Markers With Custom Icons', + }), + ], }, ] From 3a2ee02cf3285790dff1c2c6aae9bb721fd1972f Mon Sep 17 00:00:00 2001 From: Andreas Stassivik Date: Wed, 16 Oct 2024 23:01:17 -0700 Subject: [PATCH 16/31] dynamic `custom-icons` tutorial integration --- public/index.html | 2 +- .../custom-icons/custom-icons.test.ts | 8 +++---- src/tutorial/custom-icons/custom-icons.ts | 24 +++++++++++++------ src/tutorial/open-street-map-tiles.test.ts | 4 ++-- 4 files changed, 24 insertions(+), 14 deletions(-) diff --git a/public/index.html b/public/index.html index ff8fdb6..6f43c69 100644 --- a/public/index.html +++ b/public/index.html @@ -19,7 +19,7 @@

    Leaflet

    (tutorial)
  3. - Custom icons + Custom icons (tutorial)
  4. diff --git a/src/tutorial/custom-icons/custom-icons.test.ts b/src/tutorial/custom-icons/custom-icons.test.ts index b1ba6e1..0b6ac5b 100644 --- a/src/tutorial/custom-icons/custom-icons.test.ts +++ b/src/tutorial/custom-icons/custom-icons.test.ts @@ -1,6 +1,6 @@ describe('custom icons tutorial', (): void => { beforeAll(async (): Promise => { - await page.goto('http://localhost:3001/tutorial/custom-icons/custom-icons') + await page.goto('http://localhost:3001/tutorial/dist/custom-icons') }) describe('map', (): void => { @@ -9,15 +9,15 @@ describe('custom icons tutorial', (): void => { describe.each([ { popupText: 'I am a green leaf.', - src: 'image/green.png', + src: 'tutorial/custom-icons/image/green.png', }, { popupText: 'I am an orange leaf.', - src: 'image/orange.png', + src: 'tutorial/custom-icons/image/orange.png', }, { popupText: 'I am a red leaf.', - src: 'image/red.png', + src: 'tutorial/custom-icons/image/red.png', }, ])( 'src="$src"', diff --git a/src/tutorial/custom-icons/custom-icons.ts b/src/tutorial/custom-icons/custom-icons.ts index 97e2ee8..9858cc5 100644 --- a/src/tutorial/custom-icons/custom-icons.ts +++ b/src/tutorial/custom-icons/custom-icons.ts @@ -1,6 +1,10 @@ +import 'leaflet/dist/leaflet.css' +import '../style/theme.css' +import '../style/medium.css' + import { type LatLngExpression } from 'leaflet' -import { map as leafletMap, type Map, marker, tileLayerOsm } from '@stassi/leaf' +import { type Map } from '@stassi/leaf' type Icon = { iconUrl: string @@ -8,34 +12,40 @@ type Icon = { popupContent: string } -const map: Map = await leafletMap({ +const map: Map = await ( + await import('../../leaf/map/map.js') +).map({ center: [51.5, -0.09], id: 'map', zoom: 13, }) -await tileLayerOsm({ +await ( + await import('../../leaf/tile-layer/tile-layer-osm.js') +).tileLayerOsm({ map, }) for (const { iconUrl, latitudeLongitude, popupContent } of [ { - iconUrl: 'image/green.png', + iconUrl: 'tutorial/custom-icons/image/green.png', latitudeLongitude: [51.5, -0.09], popupContent: 'I am a green leaf.', }, { - iconUrl: 'image/orange.png', + iconUrl: 'tutorial/custom-icons/image/orange.png', latitudeLongitude: [51.49, -0.1], popupContent: 'I am an orange leaf.', }, { - iconUrl: 'image/red.png', + iconUrl: 'tutorial/custom-icons/image/red.png', latitudeLongitude: [51.495, -0.083], popupContent: 'I am a red leaf.', }, ]) { - await marker({ + await ( + await import('../../leaf/marker.js') + ).marker({ iconOptions: { iconAnchor: [22, 94], iconSize: [38, 95], diff --git a/src/tutorial/open-street-map-tiles.test.ts b/src/tutorial/open-street-map-tiles.test.ts index 2cbeb44..ad94b40 100644 --- a/src/tutorial/open-street-map-tiles.test.ts +++ b/src/tutorial/open-street-map-tiles.test.ts @@ -2,9 +2,9 @@ describe('OpenStreetMap tiles', (): void => { describe.each([ 'accessibility/interactive', - 'custom-icons/custom-icons', - 'mobile/mobile', + 'dist/custom-icons', 'dist/quick-start', + 'mobile/mobile', ])('tutorial: %s', (path: string): void => { it('should render', async (): Promise => { await page.goto(`http://localhost:3001/tutorial/${path}`) From 111db4d6c84a06fb4fdd139edc5d3b162a28c96f Mon Sep 17 00:00:00 2001 From: Andreas Stassivik Date: Wed, 16 Oct 2024 23:20:38 -0700 Subject: [PATCH 17/31] correct custom-icons image paths --- src/tutorial/custom-icons/custom-icons.test.ts | 6 +++--- src/tutorial/custom-icons/custom-icons.ts | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/tutorial/custom-icons/custom-icons.test.ts b/src/tutorial/custom-icons/custom-icons.test.ts index 0b6ac5b..890cb13 100644 --- a/src/tutorial/custom-icons/custom-icons.test.ts +++ b/src/tutorial/custom-icons/custom-icons.test.ts @@ -9,15 +9,15 @@ describe('custom icons tutorial', (): void => { describe.each([ { popupText: 'I am a green leaf.', - src: 'tutorial/custom-icons/image/green.png', + src: '../custom-icons/image/green.png', }, { popupText: 'I am an orange leaf.', - src: 'tutorial/custom-icons/image/orange.png', + src: '../custom-icons/image/orange.png', }, { popupText: 'I am a red leaf.', - src: 'tutorial/custom-icons/image/red.png', + src: '../custom-icons/image/red.png', }, ])( 'src="$src"', diff --git a/src/tutorial/custom-icons/custom-icons.ts b/src/tutorial/custom-icons/custom-icons.ts index 9858cc5..7006696 100644 --- a/src/tutorial/custom-icons/custom-icons.ts +++ b/src/tutorial/custom-icons/custom-icons.ts @@ -28,17 +28,17 @@ await ( for (const { iconUrl, latitudeLongitude, popupContent } of [ { - iconUrl: 'tutorial/custom-icons/image/green.png', + iconUrl: '../custom-icons/image/green.png', latitudeLongitude: [51.5, -0.09], popupContent: 'I am a green leaf.', }, { - iconUrl: 'tutorial/custom-icons/image/orange.png', + iconUrl: '../custom-icons/image/orange.png', latitudeLongitude: [51.49, -0.1], popupContent: 'I am an orange leaf.', }, { - iconUrl: 'tutorial/custom-icons/image/red.png', + iconUrl: '../custom-icons/image/red.png', latitudeLongitude: [51.495, -0.083], popupContent: 'I am a red leaf.', }, @@ -53,7 +53,7 @@ for (const { iconUrl, latitudeLongitude, popupContent } of [ popupAnchor: [-3, -76], shadowAnchor: [4, 62], shadowSize: [50, 64], - shadowUrl: 'image/shadow.png', + shadowUrl: '../custom-icons/image/shadow.png', }, latitudeLongitude, map, From 7bd9c7ffa3242345e46b2d4480302d22f100d219 Mon Sep 17 00:00:00 2001 From: Andreas Stassivik Date: Fri, 18 Oct 2024 01:50:35 -0700 Subject: [PATCH 18/31] leaflet types reexport/reimport --- src/index.ts | 1 + src/leaf/circle.ts | 2 +- src/leaf/map/map.ts | 9 ++++++--- src/leaf/polygon.ts | 2 +- src/leaf/popup.ts | 5 +++-- src/leaf/tile-layer/tile-layer-osm.ts | 4 ++-- src/leaf/tile-layer/tile-layer.ts | 9 +++------ src/leaflet-types.ts | 23 +++++++++++++++++++++++ 8 files changed, 40 insertions(+), 15 deletions(-) create mode 100644 src/leaflet-types.ts diff --git a/src/index.ts b/src/index.ts index 24ee016..fc9a72c 100644 --- a/src/index.ts +++ b/src/index.ts @@ -6,3 +6,4 @@ export * from './leaf/polygon.js' export * from './leaf/popup.js' export * from './leaf/tile-layer/tile-layer-osm.js' export * from './leaf/tile-layer/tile-layer.js' +export * from './leaflet-types.js' diff --git a/src/leaf/circle.ts b/src/leaf/circle.ts index 45ebc55..d288806 100644 --- a/src/leaf/circle.ts +++ b/src/leaf/circle.ts @@ -7,7 +7,7 @@ import { type LayerGroup, type Map, type Popup, -} from 'leaflet' +} from '@stassi/leaf' export type CircleOptions = CircleMarkerOptions & { latitudeLongitude: LatLngExpression diff --git a/src/leaf/map/map.ts b/src/leaf/map/map.ts index 9a31fe2..437796a 100644 --- a/src/leaf/map/map.ts +++ b/src/leaf/map/map.ts @@ -1,3 +1,8 @@ +import { + type Map as LeafletMap, + type MapOptions as LeafletMapOptions, +} from 'leaflet' + import { type CRS, type ErrorEventHandlerFn, @@ -8,9 +13,7 @@ import { type LocateOptions, type LocationEvent, type LocationEventHandlerFn, - type Map as LeafletMap, - type MapOptions as LeafletMapOptions, -} from 'leaflet' +} from '@stassi/leaf' type OnClick = | LeafletMouseEventHandlerFn diff --git a/src/leaf/polygon.ts b/src/leaf/polygon.ts index 387e1b4..170641c 100644 --- a/src/leaf/polygon.ts +++ b/src/leaf/polygon.ts @@ -7,7 +7,7 @@ import { type Polygon, type PolylineOptions, type Popup, -} from 'leaflet' +} from '@stassi/leaf' export type PolygonOptions = PolylineOptions & { latitudeLongitudes: diff --git a/src/leaf/popup.ts b/src/leaf/popup.ts index 7b9ea16..5e44f1a 100644 --- a/src/leaf/popup.ts +++ b/src/leaf/popup.ts @@ -1,11 +1,12 @@ +import { type PopupOptions as LeafletPopupOptions } from 'leaflet' + import { type Content, type LatLngExpression, type Layer, type Map, type Popup, - type PopupOptions as LeafletPopupOptions, -} from 'leaflet' +} from '@stassi/leaf' export type PopupOptions = Partial & { htmlContent: ((source: Layer) => Content) | Content diff --git a/src/leaf/tile-layer/tile-layer-osm.ts b/src/leaf/tile-layer/tile-layer-osm.ts index 7fa90de..271cf55 100644 --- a/src/leaf/tile-layer/tile-layer-osm.ts +++ b/src/leaf/tile-layer/tile-layer-osm.ts @@ -1,7 +1,7 @@ -import { type TileLayer } from 'leaflet' - import { tileLayer, type TileLayerOptions } from './tile-layer.js' +import { type TileLayer } from '@stassi/leaf' + export type TileLayerOsmOptions = Omit< TileLayerOptions, 'attribution' | 'urlTemplate' diff --git a/src/leaf/tile-layer/tile-layer.ts b/src/leaf/tile-layer/tile-layer.ts index 3509866..7c92ff7 100644 --- a/src/leaf/tile-layer/tile-layer.ts +++ b/src/leaf/tile-layer/tile-layer.ts @@ -1,9 +1,6 @@ -import { - type LayerGroup, - type Map, - type TileLayer, - type TileLayerOptions as LeafletTileLayerOptions, -} from 'leaflet' +import { type TileLayerOptions as LeafletTileLayerOptions } from 'leaflet' + +import { type LayerGroup, type Map, type TileLayer } from '@stassi/leaf' export type TileLayerOptions = { urlTemplate: string diff --git a/src/leaflet-types.ts b/src/leaflet-types.ts new file mode 100644 index 0000000..d9d43a1 --- /dev/null +++ b/src/leaflet-types.ts @@ -0,0 +1,23 @@ +export { + type CRS, + type Circle, + type CircleMarkerOptions, + type Content, + type ErrorEvent, + type ErrorEventHandlerFn, + type FitBoundsOptions, + type Icon, + type LatLngExpression, + type Layer, + type LayerGroup, + type LeafletMouseEvent, + type LeafletMouseEventHandlerFn, + type LocateOptions, + type LocationEvent, + type LocationEventHandlerFn, + type Marker, + type Polygon, + type PolylineOptions, + type Popup, + type TileLayer, +} from 'leaflet' From e303fb25c6f2475b983be4a2e801c41d04c41749 Mon Sep 17 00:00:00 2001 From: Andreas Stassivik Date: Fri, 18 Oct 2024 01:51:29 -0700 Subject: [PATCH 19/31] `icon` implementation --- src/leaf/icon.ts | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 src/leaf/icon.ts diff --git a/src/leaf/icon.ts b/src/leaf/icon.ts new file mode 100644 index 0000000..5a504f8 --- /dev/null +++ b/src/leaf/icon.ts @@ -0,0 +1,32 @@ +import { type IconOptions as LeafletIconOptions } from 'leaflet' + +import { type Icon } from '@stassi/leaf' + +export type IconOptions = Omit & + Partial<{ + iconUrl: string + }> + +export async function icon({ + iconUrl = 'marker-icon.png', + iconRetinaUrl = 'marker-icon-2x.png', + shadowUrl = 'marker-shadow.png', + iconSize = [25, 41], + iconAnchor = [12, 41], + popupAnchor = [1, -34], + tooltipAnchor = [16, -28], + shadowSize = [41, 41], + ...props +}: IconOptions): Promise { + return (await import('leaflet')).icon({ + iconAnchor, + iconRetinaUrl, + iconSize, + iconUrl, + popupAnchor, + shadowSize, + shadowUrl, + tooltipAnchor, + ...props, + }) +} From aba7fd08277aa98e0f15e4c36e7c71671fae59f4 Mon Sep 17 00:00:00 2001 From: Andreas Stassivik Date: Fri, 18 Oct 2024 01:52:19 -0700 Subject: [PATCH 20/31] `icon` export --- src/index.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/index.ts b/src/index.ts index fc9a72c..a500d69 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,5 +1,6 @@ export * from './leaf/circle.js' export * from './leaf/coordinate-reference-system/epsg-3857.js' +export * from './leaf/icon.js' export * from './leaf/map/map.js' export * from './leaf/marker.js' export * from './leaf/polygon.js' From 512971b60ed828487f10252b3030aa99fbcd779a Mon Sep 17 00:00:00 2001 From: Andreas Stassivik Date: Fri, 18 Oct 2024 01:54:03 -0700 Subject: [PATCH 21/31] `icon` integration (repairs default properties) --- src/leaf/marker.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/leaf/marker.ts b/src/leaf/marker.ts index 943502b..39ec23c 100644 --- a/src/leaf/marker.ts +++ b/src/leaf/marker.ts @@ -1,3 +1,5 @@ +import { type MarkerOptions as LeafletMarkerOptions } from 'leaflet' + import { type Content, type IconOptions, @@ -6,9 +8,8 @@ import { type LayerGroup, type Map, type Marker, - type MarkerOptions as LeafletMarkerOptions, type Popup, -} from 'leaflet' +} from '@stassi/leaf' export type MarkerOptions = LeafletMarkerOptions & { latitudeLongitude: LatLngExpression @@ -30,7 +31,7 @@ export async function marker({ const created: Marker = (await import('leaflet')).marker(latitudeLongitude, { alt, ...(iconOptions - ? { icon: (await import('leaflet')).icon(iconOptions) } + ? { icon: await (await import('./icon.js')).icon(iconOptions) } : {}), ...props, }), From dddbcdf0dc5f455483ceee1536a5e48a4ba9ef69 Mon Sep 17 00:00:00 2001 From: Andreas Stassivik Date: Fri, 18 Oct 2024 01:54:56 -0700 Subject: [PATCH 22/31] stylesheet imported as source --- {public/tutorial/mobile => src/tutorial}/style/fullscreen.css | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {public/tutorial/mobile => src/tutorial}/style/fullscreen.css (100%) diff --git a/public/tutorial/mobile/style/fullscreen.css b/src/tutorial/style/fullscreen.css similarity index 100% rename from public/tutorial/mobile/style/fullscreen.css rename to src/tutorial/style/fullscreen.css From 07f45cfdb4f6d8d0a368b0d70a16da90c3eec8f0 Mon Sep 17 00:00:00 2001 From: Andreas Stassivik Date: Fri, 18 Oct 2024 01:57:21 -0700 Subject: [PATCH 23/31] import leaflet types via proxy --- src/tutorial/custom-icons/custom-icons.ts | 4 +--- src/tutorial/quick-start/quick-start.ts | 4 +--- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/src/tutorial/custom-icons/custom-icons.ts b/src/tutorial/custom-icons/custom-icons.ts index 7006696..11c5c7a 100644 --- a/src/tutorial/custom-icons/custom-icons.ts +++ b/src/tutorial/custom-icons/custom-icons.ts @@ -2,9 +2,7 @@ import 'leaflet/dist/leaflet.css' import '../style/theme.css' import '../style/medium.css' -import { type LatLngExpression } from 'leaflet' - -import { type Map } from '@stassi/leaf' +import { type LatLngExpression, type Map } from '@stassi/leaf' type Icon = { iconUrl: string diff --git a/src/tutorial/quick-start/quick-start.ts b/src/tutorial/quick-start/quick-start.ts index 6cdfa86..81380e6 100644 --- a/src/tutorial/quick-start/quick-start.ts +++ b/src/tutorial/quick-start/quick-start.ts @@ -2,9 +2,7 @@ import 'leaflet/dist/leaflet.css' import '../style/theme.css' import './style/short.css' -import { type LeafletMouseEvent } from 'leaflet' - -import { type Map } from '@stassi/leaf' +import { type LeafletMouseEvent, type Map } from '@stassi/leaf' const map: Map = await ( await import('../../leaf/map/map.js') From 1705662750e70a375a9d1ea762dd34753f02f12b Mon Sep 17 00:00:00 2001 From: Andreas Stassivik Date: Fri, 18 Oct 2024 01:58:37 -0700 Subject: [PATCH 24/31] image paths corrected in `iconOptions` property --- src/tutorial/quick-start/quick-start.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/tutorial/quick-start/quick-start.ts b/src/tutorial/quick-start/quick-start.ts index 81380e6..655cc6f 100644 --- a/src/tutorial/quick-start/quick-start.ts +++ b/src/tutorial/quick-start/quick-start.ts @@ -34,7 +34,8 @@ await ( await import('../../leaf/marker.js') ).marker({ iconOptions: { - iconUrl: './assets/marker-icon.png', + iconUrl: '../../../leaflet/images/marker-icon.png', + shadowUrl: '../../../leaflet/images/marker-shadow.png', }, latitudeLongitude: [51.5, -0.09], map, From 5924703011e045f810508ab262756cd33318d3d1 Mon Sep 17 00:00:00 2001 From: Andreas Stassivik Date: Fri, 18 Oct 2024 02:01:27 -0700 Subject: [PATCH 25/31] `mobile` tutorial dynamic generation --- rollup.config.ts | 71 ++++++++++++++++++++++++++++++++--- src/tutorial/mobile/mobile.ts | 32 ++++++++++------ 2 files changed, 85 insertions(+), 18 deletions(-) diff --git a/rollup.config.ts b/rollup.config.ts index 3a6542d..e1a02b2 100644 --- a/rollup.config.ts +++ b/rollup.config.ts @@ -120,17 +120,76 @@ const rollupConfig: RollupOptions[] = [ ], }, { - external: ['@stassi/leaf'], input: 'src/tutorial/mobile/mobile.ts', output: { - file: 'public/tutorial/mobile/dist/script/mobile.js', + assetFileNames: 'style/[name][extname]', + chunkFileNames: 'script/[name]-[hash].js', + dir: 'public/tutorial/dist/', + entryFileNames: 'script/[name].js', format: 'esm', - paths: { - '@stassi/leaf': '../../../../leaf/leaf.js', - }, sourcemap: true, }, - plugins: [typescript(), terser()], + plugins: [ + commonjs(), + nodeResolve(), + styles({ + mode: 'extract', + sourceMap: true, + url: { hash: false, publicPath: '../assets/' }, + }), + typescript(), + terser(), + html({ + fileName: 'mobile.html', + meta: [ + { charset: 'utf-8' }, + { + content: + 'initial-scale=1.0, maximum-scale=1.0, user-scalable=no, width=device-width', + name: 'viewport', + }, + ], + publicPath: './', + template({ + attributes, + files, + meta, + publicPath, + title, + }: RollupHtmlTemplateOptions): string { + return ` + + >attributes.html)}> + + ${meta + .map( + (input: Record): string => + ``, + ) + .join('\n')} + ${title} + ${(files.css ?? []) + .map( + ({ fileName }: OutputChunk | OutputAsset): string => + `>attributes.link)}>`, + ) + .join('\n')} + + +
    + ${(files.js ?? []) + .map( + ({ fileName }: OutputChunk | OutputAsset): string => + ``, + ) + .join('\n')} + + + ` + }, + title: 'Markers With Custom Icons', + }), + ], }, { input: 'src/tutorial/custom-icons/custom-icons.ts', diff --git a/src/tutorial/mobile/mobile.ts b/src/tutorial/mobile/mobile.ts index 3093888..2b5a707 100644 --- a/src/tutorial/mobile/mobile.ts +++ b/src/tutorial/mobile/mobile.ts @@ -1,14 +1,12 @@ -import { type ErrorEvent, type LocationEvent } from 'leaflet' +import 'leaflet/dist/leaflet.css' +import '../style/theme.css' +import '../style/fullscreen.css' -import { - circle, - map as leafletMap, - type Map, - marker, - tileLayerOsm, -} from '@stassi/leaf' +import { type ErrorEvent, type LocationEvent, type Map } from '@stassi/leaf' -const map: Map = await leafletMap({ +const map: Map = await ( + await import('../../leaf/map/map.js') +).map({ fitWorld: true, id: 'map', locateOptions: { @@ -19,13 +17,21 @@ const map: Map = await leafletMap({ accuracy: radius, latlng: latitudeLongitude, }: LocationEvent): Promise { - await circle({ + await ( + await import('../../leaf/circle.js') + ).circle({ latitudeLongitude, map, radius, }) ;( - await marker({ + await ( + await import('../../leaf/marker.js') + ).marker({ + iconOptions: { + iconUrl: '../../../leaflet/images/marker-icon.png', + shadowUrl: '../../../leaflet/images/marker-shadow.png', + }, latitudeLongitude, map, popupContent: `You are within ${radius.toString()} meters from this point.`, @@ -38,7 +44,9 @@ const map: Map = await leafletMap({ }, }) -await tileLayerOsm({ +await ( + await import('../../leaf/tile-layer/tile-layer-osm.js') +).tileLayerOsm({ map, zoomMax: 19, }) From f22a73554a9585b0a4986de2fc68e3bb6108da97 Mon Sep 17 00:00:00 2001 From: Andreas Stassivik Date: Fri, 18 Oct 2024 02:02:50 -0700 Subject: [PATCH 26/31] dynamic `mobile` tutorial integration --- public/index.html | 2 +- src/tutorial/mobile/mobile.test.ts | 2 +- src/tutorial/open-street-map-tiles.test.ts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/public/index.html b/public/index.html index 6f43c69..71b3207 100644 --- a/public/index.html +++ b/public/index.html @@ -15,7 +15,7 @@

    Leaflet

    (tutorial)
  5. - Mobile + Mobile (tutorial)
  6. diff --git a/src/tutorial/mobile/mobile.test.ts b/src/tutorial/mobile/mobile.test.ts index a3f426a..9da9739 100644 --- a/src/tutorial/mobile/mobile.test.ts +++ b/src/tutorial/mobile/mobile.test.ts @@ -10,7 +10,7 @@ describe('mobile tutorial', (): void => { longitude: -0.09, }) - await page.goto('http://localhost:3001/tutorial/mobile/mobile') + await page.goto('http://localhost:3001/tutorial/dist/mobile') }) describe('map', (): void => { diff --git a/src/tutorial/open-street-map-tiles.test.ts b/src/tutorial/open-street-map-tiles.test.ts index ad94b40..8d58e41 100644 --- a/src/tutorial/open-street-map-tiles.test.ts +++ b/src/tutorial/open-street-map-tiles.test.ts @@ -3,8 +3,8 @@ describe('OpenStreetMap tiles', (): void => { describe.each([ 'accessibility/interactive', 'dist/custom-icons', + 'dist/mobile', 'dist/quick-start', - 'mobile/mobile', ])('tutorial: %s', (path: string): void => { it('should render', async (): Promise => { await page.goto(`http://localhost:3001/tutorial/${path}`) From dd2026a8d8316d18aa37923f2c521fb7c2651cc5 Mon Sep 17 00:00:00 2001 From: Andreas Stassivik Date: Fri, 18 Oct 2024 02:03:55 -0700 Subject: [PATCH 27/31] remove superfluous static files (dynamic duplicates in `src`) --- public/tutorial/custom-icons/custom-icons.html | 17 ----------------- public/tutorial/mobile/mobile.html | 17 ----------------- public/tutorial/quick-start/style/short.css | 3 --- 3 files changed, 37 deletions(-) delete mode 100644 public/tutorial/custom-icons/custom-icons.html delete mode 100644 public/tutorial/mobile/mobile.html delete mode 100644 public/tutorial/quick-start/style/short.css diff --git a/public/tutorial/custom-icons/custom-icons.html b/public/tutorial/custom-icons/custom-icons.html deleted file mode 100644 index e638787..0000000 --- a/public/tutorial/custom-icons/custom-icons.html +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - Markers With Custom Icons - - - - - - - -
    - - - diff --git a/public/tutorial/mobile/mobile.html b/public/tutorial/mobile/mobile.html deleted file mode 100644 index 5023b27..0000000 --- a/public/tutorial/mobile/mobile.html +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - Leaflet on Mobile - - - - - - -
    - - - diff --git a/public/tutorial/quick-start/style/short.css b/public/tutorial/quick-start/style/short.css deleted file mode 100644 index a14de7d..0000000 --- a/public/tutorial/quick-start/style/short.css +++ /dev/null @@ -1,3 +0,0 @@ -.leaflet-container { - height: 180px; -} From fd0aef44586bd85ff03cfaea934fac7c142b0a45 Mon Sep 17 00:00:00 2001 From: Andreas Stassivik Date: Fri, 18 Oct 2024 02:39:12 -0700 Subject: [PATCH 28/31] tutorials `RollupOptions` iteration with `Array.map` --- rollup.config.ts | 284 +++++++++++++++-------------------------------- 1 file changed, 88 insertions(+), 196 deletions(-) diff --git a/rollup.config.ts b/rollup.config.ts index e1a02b2..6bd0429 100644 --- a/rollup.config.ts +++ b/rollup.config.ts @@ -55,206 +55,98 @@ const rollupConfig: RollupOptions[] = [ terser(), ], }, - { - input: 'src/tutorial/quick-start/quick-start.ts', - output: { - assetFileNames: 'style/[name][extname]', - chunkFileNames: 'script/[name]-[hash].js', - dir: 'public/tutorial/dist/', - entryFileNames: 'script/[name].js', - format: 'esm', - sourcemap: true, + ...[ + { + fileName: 'quick-start.html', + input: 'src/tutorial/quick-start/quick-start.ts', + title: 'Leaflet Quick Start Guide', }, - plugins: [ - commonjs(), - nodeResolve(), - styles({ - mode: 'extract', - sourceMap: true, - url: { hash: false, publicPath: '../assets/' }, - }), - typescript(), - terser(), - html({ - fileName: 'quick-start.html', - publicPath: './', - template({ - attributes, - files, - meta, - publicPath, - title, - }: RollupHtmlTemplateOptions): string { - return ` - - >attributes.html)}> - - ${meta - .map( - (input: Record): string => - ``, - ) - .join('\n')} - ${title} - ${(files.css ?? []) - .map( - ({ fileName }: OutputChunk | OutputAsset): string => - `>attributes.link)}>`, - ) - .join('\n')} - - -
    - ${(files.js ?? []) - .map( - ({ fileName }: OutputChunk | OutputAsset): string => - ``, - ) - .join('\n')} - - - ` - }, - title: 'Leaflet Quick Start Guide', - }), - ], - }, - { - input: 'src/tutorial/mobile/mobile.ts', - output: { - assetFileNames: 'style/[name][extname]', - chunkFileNames: 'script/[name]-[hash].js', - dir: 'public/tutorial/dist/', - entryFileNames: 'script/[name].js', - format: 'esm', - sourcemap: true, + { + fileName: 'mobile.html', + input: 'src/tutorial/mobile/mobile.ts', + title: 'Leaflet on Mobile', }, - plugins: [ - commonjs(), - nodeResolve(), - styles({ - mode: 'extract', - sourceMap: true, - url: { hash: false, publicPath: '../assets/' }, - }), - typescript(), - terser(), - html({ - fileName: 'mobile.html', - meta: [ - { charset: 'utf-8' }, - { - content: - 'initial-scale=1.0, maximum-scale=1.0, user-scalable=no, width=device-width', - name: 'viewport', - }, - ], - publicPath: './', - template({ - attributes, - files, - meta, - publicPath, - title, - }: RollupHtmlTemplateOptions): string { - return ` - - >attributes.html)}> - - ${meta - .map( - (input: Record): string => - ``, - ) - .join('\n')} - ${title} - ${(files.css ?? []) - .map( - ({ fileName }: OutputChunk | OutputAsset): string => - `>attributes.link)}>`, - ) - .join('\n')} - - -
    - ${(files.js ?? []) - .map( - ({ fileName }: OutputChunk | OutputAsset): string => - ``, - ) - .join('\n')} - - - ` - }, - title: 'Markers With Custom Icons', - }), - ], - }, - { - input: 'src/tutorial/custom-icons/custom-icons.ts', - output: { - assetFileNames: 'style/[name][extname]', - chunkFileNames: 'script/[name]-[hash].js', - dir: 'public/tutorial/dist/', - entryFileNames: 'script/[name].js', - format: 'esm', - sourcemap: true, + { + fileName: 'custom-icons.html', + input: 'src/tutorial/custom-icons/custom-icons.ts', + title: 'Markers With Custom Icons', }, - plugins: [ - commonjs(), - nodeResolve(), - styles({ - mode: 'extract', - sourceMap: true, - url: { hash: false, publicPath: '../assets/' }, - }), - typescript(), - terser(), - html({ - fileName: 'custom-icons.html', - publicPath: './', - template({ - attributes, - files, - meta, - publicPath, - title, - }: RollupHtmlTemplateOptions): string { - return ` - - >attributes.html)}> - - ${meta - .map( - (input: Record): string => - ``, - ) - .join('\n')} - ${title} - ${(files.css ?? []) - .map( - ({ fileName }: OutputChunk | OutputAsset): string => - `>attributes.link)}>`, - ) - .join('\n')} - - -
    - ${(files.js ?? []) - .map( - ({ fileName }: OutputChunk | OutputAsset): string => - ``, - ) - .join('\n')} - - - ` + ].map( + ({ + fileName, + input, + title, + }: Record<'fileName' | 'input' | 'title', string>): RollupOptions => { + return { + input, + output: { + assetFileNames: 'style/[name][extname]', + chunkFileNames: 'script/[name]-[hash].js', + dir: 'public/tutorial/dist/', + entryFileNames: 'script/[name].js', + format: 'esm', + sourcemap: true, }, - title: 'Markers With Custom Icons', - }), - ], - }, + plugins: [ + commonjs(), + nodeResolve(), + styles({ + mode: 'extract', + sourceMap: true, + url: { hash: false, publicPath: '../assets/' }, + }), + typescript(), + terser(), + html({ + fileName, + publicPath: './', + template({ + attributes, + files, + meta, + publicPath, + title: templateTitle, + }: RollupHtmlTemplateOptions): string { + return ` + + >attributes.html)}> + + ${meta + .map( + (metaInput: Record): string => + ``, + ) + .join('\n')} + ${templateTitle} + ${(files.css ?? []) + .map( + ({ + fileName: templateFileName, + }: OutputChunk | OutputAsset): string => + `>attributes.link)}>`, + ) + .join('\n')} + + +
    + ${(files.js ?? []) + .map( + ({ + fileName: templateFileName, + }: OutputChunk | OutputAsset): string => + ``, + ) + .join('\n')} + + + ` + }, + title, + }), + ], + } + }, + ), ] // eslint-disable-next-line import/no-default-export -- default export required by Rollup.js From f3dea83ec4865e2e59535756ff2390e02c9d11b8 Mon Sep 17 00:00:00 2001 From: Andreas Stassivik Date: Sat, 19 Oct 2024 12:36:07 -0700 Subject: [PATCH 29/31] npm install `@rollup/plugin-alias@^5.1.1` as devDependency --- package-lock.json | 19 +++++++++++++++++++ package.json | 1 + 2 files changed, 20 insertions(+) diff --git a/package-lock.json b/package-lock.json index 8c367ea..7424855 100644 --- a/package-lock.json +++ b/package-lock.json @@ -27,6 +27,7 @@ "devDependencies": { "@babel/eslint-parser": "^7.25.8", "@babel/plugin-syntax-import-attributes": "^7.25.7", + "@rollup/plugin-alias": "^5.1.1", "@rollup/plugin-commonjs": "^28.0.0", "@rollup/plugin-html": "^1.0.4", "@rollup/plugin-inject": "^5.0.5", @@ -1837,6 +1838,24 @@ "node": ">=10" } }, + "node_modules/@rollup/plugin-alias": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/@rollup/plugin-alias/-/plugin-alias-5.1.1.tgz", + "integrity": "sha512-PR9zDb+rOzkRb2VD+EuKB7UC41vU5DIwZ5qqCpk0KJudcWAyi8rvYOhS7+L5aZCspw1stTViLgN5v6FF1p5cgQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=14.0.0" + }, + "peerDependencies": { + "rollup": "^1.20.0||^2.0.0||^3.0.0||^4.0.0" + }, + "peerDependenciesMeta": { + "rollup": { + "optional": true + } + } + }, "node_modules/@rollup/plugin-commonjs": { "version": "28.0.0", "resolved": "https://registry.npmjs.org/@rollup/plugin-commonjs/-/plugin-commonjs-28.0.0.tgz", diff --git a/package.json b/package.json index 88b70ec..7d9ac54 100644 --- a/package.json +++ b/package.json @@ -63,6 +63,7 @@ "devDependencies": { "@babel/eslint-parser": "^7.25.8", "@babel/plugin-syntax-import-attributes": "^7.25.7", + "@rollup/plugin-alias": "^5.1.1", "@rollup/plugin-commonjs": "^28.0.0", "@rollup/plugin-html": "^1.0.4", "@rollup/plugin-inject": "^5.0.5", From 036fc8bd274fdd0971db4690f777b7d48477ee9e Mon Sep 17 00:00:00 2001 From: Andreas Stassivik Date: Sat, 19 Oct 2024 15:36:46 -0700 Subject: [PATCH 30/31] purify leaflet ESM, replacing CJS --- rollup.config.ts | 190 +++++++++++++++++++++++++---------------------- 1 file changed, 103 insertions(+), 87 deletions(-) diff --git a/rollup.config.ts b/rollup.config.ts index 6bd0429..6df98d7 100644 --- a/rollup.config.ts +++ b/rollup.config.ts @@ -6,12 +6,13 @@ import { type Plugin, type RollupOptions, } from 'rollup' +import alias, { type RollupAliasOptions } from '@rollup/plugin-alias' import commonjs from '@rollup/plugin-commonjs' import html, { makeHtmlAttributes, type RollupHtmlTemplateOptions, } from '@rollup/plugin-html' -import inject from '@rollup/plugin-inject' +import inject, { type RollupInjectOptions } from '@rollup/plugin-inject' import terser from '@rollup/plugin-terser' import typescript from '@rollup/plugin-typescript' // @ts-expect-error -- untyped plugin @@ -19,95 +20,110 @@ import untypedModify from 'rollup-plugin-modify' import { nodeResolve } from '@rollup/plugin-node-resolve' import styles from 'rollup-plugin-styles' -// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment -- untyped plugin -const modify: (modifyOptions: { +type ModifyOptions = { find: string | RegExp replace: string | ((match: string, element: string, value: string) => string) -}) => Plugin = untypedModify +} -const rollupConfig: RollupOptions[] = [ - { - input: 'src/index.ts', - output: [ +const aliasOptions: RollupAliasOptions = { + entries: [ { - dir: 'dist/', - entryFileNames: 'leaf.js', - format: 'esm', - sourcemap: true, + find: /^leaflet$/, + replacement: 'leaflet/dist/leaflet-src.esm.js', }, ], - plugins: [ - commonjs(), - modify({ - find: /(?.*)\.innerHTML\s*=\s*(?.*);/, - replace: (_match: string, element: string, value: string): string => - `${element}.innerHTML = DOMPurify.sanitize(${value});`, - }), - inject({ - DOMPurify: 'dompurify', - }), - nodeResolve(), - typescript({ - declaration: true, - exclude: ['rollup.config.ts', 'src/tutorial/**/*.ts'], - outDir: './dist', - }), - terser(), - ], }, - ...[ - { - fileName: 'quick-start.html', - input: 'src/tutorial/quick-start/quick-start.ts', - title: 'Leaflet Quick Start Guide', - }, - { - fileName: 'mobile.html', - input: 'src/tutorial/mobile/mobile.ts', - title: 'Leaflet on Mobile', - }, + modifyOptions: ModifyOptions = { + find: /(?.*)\.innerHTML\s*=\s*(?.*);/, + replace: (_match: string, element: string, value: string): string => + `${element}.innerHTML = DOMPurify.sanitize(${value});`, + }, + injectOptions: RollupInjectOptions = { + DOMPurify: 'dompurify', + }, + // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment -- untyped plugin + modify: (modifyOptions: ModifyOptions) => Plugin = untypedModify, + rollupConfig: RollupOptions[] = [ { - fileName: 'custom-icons.html', - input: 'src/tutorial/custom-icons/custom-icons.ts', - title: 'Markers With Custom Icons', - }, - ].map( - ({ - fileName, - input, - title, - }: Record<'fileName' | 'input' | 'title', string>): RollupOptions => { - return { - input, - output: { - assetFileNames: 'style/[name][extname]', - chunkFileNames: 'script/[name]-[hash].js', - dir: 'public/tutorial/dist/', - entryFileNames: 'script/[name].js', + input: 'src/index.ts', + output: [ + { + dir: 'dist/', + entryFileNames: 'leaf.js', format: 'esm', sourcemap: true, }, - plugins: [ - commonjs(), - nodeResolve(), - styles({ - mode: 'extract', - sourceMap: true, - url: { hash: false, publicPath: '../assets/' }, - }), - typescript(), - terser(), - html({ - fileName, - publicPath: './', - template({ - attributes, - files, - meta, - publicPath, - title: templateTitle, - }: RollupHtmlTemplateOptions): string { - return ` + ], + plugins: [ + alias(aliasOptions), + nodeResolve(), + commonjs(), + modify(modifyOptions), + inject(injectOptions), + typescript({ + declaration: true, + exclude: ['rollup.config.ts', 'src/tutorial/**/*.ts'], + outDir: './dist', + }), + terser(), + ], + }, + ...[ + { + fileName: 'quick-start.html', + input: 'src/tutorial/quick-start/quick-start.ts', + title: 'Leaflet Quick Start Guide', + }, + { + fileName: 'mobile.html', + input: 'src/tutorial/mobile/mobile.ts', + title: 'Leaflet on Mobile', + }, + { + fileName: 'custom-icons.html', + input: 'src/tutorial/custom-icons/custom-icons.ts', + title: 'Markers With Custom Icons', + }, + ].map( + ({ + fileName, + input, + title, + }: Record<'fileName' | 'input' | 'title', string>): RollupOptions => { + return { + input, + output: { + assetFileNames: 'style/[name][extname]', + chunkFileNames: 'script/[name]-[hash].js', + dir: 'public/tutorial/dist/', + entryFileNames: 'script/[name].js', + format: 'esm', + sourcemap: true, + }, + plugins: [ + alias(aliasOptions), + nodeResolve(), + commonjs(), + modify(modifyOptions), + inject(injectOptions), + styles({ + mode: 'extract', + sourceMap: true, + url: { hash: false, publicPath: '../assets/' }, + }), + typescript(), + terser(), + html({ + fileName, + publicPath: './', + template({ + attributes, + files, + meta, + publicPath, + title: templateTitle, + }: RollupHtmlTemplateOptions): string { + return ` >attributes.html)}> @@ -140,14 +156,14 @@ const rollupConfig: RollupOptions[] = [ ` - }, - title, - }), - ], - } - }, - ), -] + }, + title, + }), + ], + } + }, + ), + ] // eslint-disable-next-line import/no-default-export -- default export required by Rollup.js export default rollupConfig From 677e35342c527d4283d0adbef9f894dc98695b81 Mon Sep 17 00:00:00 2001 From: Andreas Stassivik Date: Sat, 19 Oct 2024 15:39:04 -0700 Subject: [PATCH 31/31] 0.0.62 --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 7424855..d500529 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@stassi/leaf", - "version": "0.0.61", + "version": "0.0.62", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@stassi/leaf", - "version": "0.0.61", + "version": "0.0.62", "cpu": [ "arm64", "x64" diff --git a/package.json b/package.json index 7d9ac54..9e7dc34 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@stassi/leaf", - "version": "0.0.61", + "version": "0.0.62", "description": "Leaflet adapter.", "keywords": [ "cartography",