@aceshooting/lyra-flags 1.4.0 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +5 -5
- package/index.js +1 -1
- package/package.json +9 -11
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Aceshooting
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# @aceshooting/lyra-flags
|
|
2
2
|
|
|
3
3
|
Waving country/territory flag SVGs (249 codes) — the optional companion asset package for
|
|
4
|
-
`<
|
|
4
|
+
`<lr-flag>` in [`lyra-ui`](https://github.com/aceshooting/lyra-ui/tree/main/packages/lyra-ui).
|
|
5
5
|
|
|
6
6
|
## Install
|
|
7
7
|
|
|
@@ -10,11 +10,11 @@ pnpm add @aceshooting/lyra-flags
|
|
|
10
10
|
```
|
|
11
11
|
|
|
12
12
|
`lyra-ui` declares this as an **optional peer dependency** — installing `lyra-ui` alone never
|
|
13
|
-
pulls this package in. Add it explicitly if your app uses `<
|
|
13
|
+
pulls this package in. Add it explicitly if your app uses `<lr-flag>`.
|
|
14
14
|
|
|
15
15
|
## Usage
|
|
16
16
|
|
|
17
|
-
You normally never call this directly; `<
|
|
17
|
+
You normally never call this directly; `<lr-flag>` resolves it internally. Direct usage:
|
|
18
18
|
|
|
19
19
|
```js
|
|
20
20
|
import { flagUrl } from '@aceshooting/lyra-flags';
|
|
@@ -44,12 +44,12 @@ A minority of flags (65 of 249) embed a detailed coat of arms, seal, or emblem i
|
|
|
44
44
|
artwork (e.g. `es`, `pt`, `sv`) — full illustrative vector detail that isn't visually
|
|
45
45
|
distinguishable at icon scale but costs real transfer bytes regardless (the worst case, `sv`, is
|
|
46
46
|
741 KB raw). Those 65 codes ship **three tiers**, each the best representation for a size band; pick
|
|
47
|
-
one with `flagUrl(code, { variant })` or `<
|
|
47
|
+
one with `flagUrl(code, { variant })` or `<lr-flag variant="...">`:
|
|
48
48
|
|
|
49
49
|
- **`compact`** — a tiny WebP raster (~1–3 KB) for icon-scale use (menu items, language selectors,
|
|
50
50
|
dense lists; ~12–28px), where the emblem is a sub-pixel smudge anyway. At that size a downscaled
|
|
51
51
|
raster is both crisper *and* far smaller than hundreds of sub-pixel vector paths.
|
|
52
|
-
- **`standard`** (the default — what `flagUrl(code)` / `<
|
|
52
|
+
- **`standard`** (the default — what `flagUrl(code)` / `<lr-flag country="...">` resolve to) — an
|
|
53
53
|
aggressively-but-losslessly SVGO-optimized vector for card/row sizes (~28–96px). Every flag is
|
|
54
54
|
under 80 KB, with no fidelity loss perceptible at that scale.
|
|
55
55
|
- **`detailed`** — the pristine, unmodified original vector, for rendering larger than icon scale
|
package/index.js
CHANGED
|
@@ -47,7 +47,7 @@ import { FLAG_LOADERS_COMPACT } from './flags/generated-compact.js';
|
|
|
47
47
|
* @param {{ variant?: 'compact' | 'standard' | 'detailed' }} [options]
|
|
48
48
|
* @returns {Promise<string | undefined>} The flag's URL. For a `code` with no matching shipped
|
|
49
49
|
* flag, resolves `undefined` (same non-crashing "no image" outcome as the old code's
|
|
50
|
-
* now-404ing URL, for `<
|
|
50
|
+
* now-404ing URL, for `<lr-flag>`'s `<img src>` use).
|
|
51
51
|
*/
|
|
52
52
|
export function flagUrl(code, options) {
|
|
53
53
|
if (options?.variant === 'detailed' && FLAG_LOADERS_DETAILED[code]) {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aceshooting/lyra-flags",
|
|
3
|
-
"version": "
|
|
4
|
-
"description": "Waving country/territory flag SVGs — optional companion asset package for <
|
|
3
|
+
"version": "2.0.0",
|
|
4
|
+
"description": "Waving country/territory flag SVGs — optional companion asset package for <lr-flag> in lyra-ui.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"flag-icons",
|
|
7
7
|
"flags",
|
|
@@ -32,13 +32,6 @@
|
|
|
32
32
|
"node": ">=20"
|
|
33
33
|
},
|
|
34
34
|
"sideEffects": false,
|
|
35
|
-
"scripts": {
|
|
36
|
-
"generate": "node scripts/generate-index.mjs",
|
|
37
|
-
"optimize": "node scripts/optimize-flags.mjs",
|
|
38
|
-
"build-compact": "node scripts/build-compact.mjs",
|
|
39
|
-
"test": "node scripts/test.mjs",
|
|
40
|
-
"prepack": "pnpm run generate"
|
|
41
|
-
},
|
|
42
35
|
"files": [
|
|
43
36
|
"flags",
|
|
44
37
|
"index.js",
|
|
@@ -54,10 +47,15 @@
|
|
|
54
47
|
},
|
|
55
48
|
"./flags/*": "./flags/*"
|
|
56
49
|
},
|
|
57
|
-
"packageManager": "pnpm@11.13.0",
|
|
58
50
|
"devDependencies": {
|
|
59
51
|
"@resvg/resvg-js": "^2.6.2",
|
|
60
52
|
"sharp": "^0.35.3",
|
|
61
53
|
"svgo": "^4.0.2"
|
|
54
|
+
},
|
|
55
|
+
"scripts": {
|
|
56
|
+
"generate": "node scripts/generate-index.mjs",
|
|
57
|
+
"optimize": "node scripts/optimize-flags.mjs",
|
|
58
|
+
"build-compact": "node scripts/build-compact.mjs",
|
|
59
|
+
"test": "node scripts/test.mjs"
|
|
62
60
|
}
|
|
63
|
-
}
|
|
61
|
+
}
|