@tekkare/romulus 0.1.165 → 0.1.166
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/dist/module.json
CHANGED
|
@@ -6,11 +6,13 @@
|
|
|
6
6
|
affiche « FR » dans deux carres. Le detail est dans internal/flags.ts, qui
|
|
7
7
|
porte aussi la table.
|
|
8
8
|
|
|
9
|
-
Un code absent de la table retombe
|
|
10
|
-
|
|
9
|
+
Un code absent de la table retombe d'abord sur `flags-world.ts`, les 173 pays
|
|
10
|
+
repris d'Auriga, charges a la demande : une app qui ne montre que cinq pays
|
|
11
|
+
n'embarque pas les 147 Ko du monde entier. Si le code n'y est pas non plus,
|
|
12
|
+
l'emoji reste le dernier recours.
|
|
11
13
|
-->
|
|
12
14
|
<script setup lang="ts">
|
|
13
|
-
import { computed } from 'vue'
|
|
15
|
+
import { computed, shallowRef, watchEffect } from 'vue'
|
|
14
16
|
import { RM_FLAGS, rmFlagEmoji } from '../internal/flags'
|
|
15
17
|
|
|
16
18
|
const props = withDefaults(defineProps<{
|
|
@@ -22,25 +24,45 @@ const props = withDefaults(defineProps<{
|
|
|
22
24
|
title?: string
|
|
23
25
|
/** Coins arrondis. Un drapeau a angles vifs jure a cote d'une icone. */
|
|
24
26
|
rounded?: boolean
|
|
27
|
+
/**
|
|
28
|
+
* Pastille ronde plutot que rectangle. Pour une tuile de pays, ou le drapeau
|
|
29
|
+
* est le sujet et non une mention a cote d'un libelle : le dessin est recadre
|
|
30
|
+
* au carre puis decoupe au disque.
|
|
31
|
+
*/
|
|
32
|
+
circle?: boolean
|
|
25
33
|
}>(), {
|
|
26
34
|
height: 14,
|
|
27
35
|
title: undefined,
|
|
28
36
|
rounded: true,
|
|
37
|
+
circle: false,
|
|
29
38
|
})
|
|
30
39
|
|
|
31
40
|
const key = computed(() => (props.code || '').toLowerCase())
|
|
32
|
-
|
|
33
|
-
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* La table du monde entier n'est demandee que si le code manque a la table de
|
|
44
|
+
* base : elle pese plus lourd que tout le reste du paquet.
|
|
45
|
+
*/
|
|
46
|
+
const world = shallowRef<Record<string, string>>({})
|
|
47
|
+
watchEffect(async () => {
|
|
48
|
+
if (!key.value || RM_FLAGS[key.value] || world.value[key.value]) return
|
|
49
|
+
const mod = await import('../internal/flags-world')
|
|
50
|
+
world.value = mod.RM_FLAGS_WORLD
|
|
51
|
+
})
|
|
52
|
+
|
|
53
|
+
const svg = computed(() => RM_FLAGS[key.value] ?? world.value[key.value])
|
|
54
|
+
const width = computed(() => (props.circle ? props.height : (props.height * 21) / 15))
|
|
34
55
|
</script>
|
|
35
56
|
|
|
36
57
|
<template>
|
|
37
58
|
<svg
|
|
38
59
|
v-if="svg"
|
|
39
60
|
class="rm-flag"
|
|
40
|
-
:class="{ 'rm-flag--rounded': rounded }"
|
|
61
|
+
:class="{ 'rm-flag--rounded': rounded && !circle, 'rm-flag--circle': circle }"
|
|
41
62
|
:width="width"
|
|
42
63
|
:height="height"
|
|
43
|
-
viewBox="0 0 21 15"
|
|
64
|
+
:viewBox="circle ? '3 0 15 15' : '0 0 21 15'"
|
|
65
|
+
:preserveAspectRatio="circle ? 'xMidYMid slice' : undefined"
|
|
44
66
|
:role="title ? 'img' : undefined"
|
|
45
67
|
:aria-hidden="title ? undefined : true"
|
|
46
68
|
v-html="(title ? `<title>${title}</title>` : '') + svg"
|
|
@@ -49,5 +71,5 @@ const width = computed(() => (props.height * 21) / 15)
|
|
|
49
71
|
</template>
|
|
50
72
|
|
|
51
73
|
<style scoped>
|
|
52
|
-
.rm-flag{display:inline-block;flex-shrink:0;vertical-align:-.15em}.rm-flag--rounded{border-radius:2px
|
|
74
|
+
.rm-flag{display:inline-block;flex-shrink:0;vertical-align:-.15em}.rm-flag--rounded{border-radius:2px}.rm-flag--circle,.rm-flag--rounded{box-shadow:inset 0 0 0 .5px rgba(30,41,59,.18)}.rm-flag--circle{border-radius:50%}
|
|
53
75
|
</style>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const RM_FLAGS_WORLD: Record<string, string>;
|