krackedmaps 0.1.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.
@@ -0,0 +1,219 @@
1
+ /* ============================================================
2
+ peta-malaysia — map styles. Everything is scoped under `.mmap`
3
+ (the container createMalaysiaMap() is mounted in), so it can't
4
+ leak into a host page. Restyle by overriding the CSS variables,
5
+ or pass a theme to createMalaysiaMap().
6
+ ============================================================ */
7
+ .mmap {
8
+ /* ---- theme: blueprint by default (override these to restyle) ---- */
9
+ --sea: #0a1e3f;
10
+ --grid: rgba(120, 180, 255, 0.10);
11
+ --grid-size: 38px;
12
+
13
+ --land: #0d2950;
14
+ --land-hover: #15406f;
15
+ --land-active: #5fd0ff;
16
+ --stroke: #5fa8ff;
17
+ --stroke-w: 1;
18
+
19
+ --district: #0d2950;
20
+ --carve: #3d77c0;
21
+ --carve-w: 0.75;
22
+ --district-hi: #5fd0ff;
23
+
24
+ --label: #cfe6ff;
25
+ --label-dim: rgba(207, 230, 255, 0.55);
26
+ --pin: #ffd166;
27
+ --pin-ring: rgba(255, 209, 102, 0.5);
28
+ --accent: #5fd0ff;
29
+ --panel-bg: #0a1e3f;
30
+ --panel-edge: #1d3c6b;
31
+
32
+ --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
33
+
34
+ /* ---- the widget is a self-contained, self-sized stage ---- */
35
+ position: relative;
36
+ overflow: hidden;
37
+ aspect-ratio: 800 / 353; /* sensible default if the host gives only a width */
38
+ background-color: var(--sea);
39
+ background-image:
40
+ linear-gradient(to right, var(--grid) 1px, transparent 1px),
41
+ linear-gradient(to bottom, var(--grid) 1px, transparent 1px);
42
+ background-size: var(--grid-size) var(--grid-size);
43
+ font-family: var(--font);
44
+ }
45
+
46
+ .mmap-svg { width: 100%; height: 100%; display: block; touch-action: none; position: relative; z-index: 1; }
47
+
48
+ /* grid-glow: brighter grid lines spotlit under the cursor, behind the map.
49
+ JS sets --mx/--my; off-screen by default so there's no glow until you move. */
50
+ .mmap::before {
51
+ content: "";
52
+ position: absolute; inset: 0; z-index: 0; pointer-events: none;
53
+ background-image:
54
+ linear-gradient(to right, var(--accent) 1px, transparent 1px),
55
+ linear-gradient(to bottom, var(--accent) 1px, transparent 1px);
56
+ background-size: var(--grid-size) var(--grid-size);
57
+ opacity: .45;
58
+ -webkit-mask-image: radial-gradient(circle 130px at var(--mx, -200px) var(--my, -200px), #000 0%, transparent 70%);
59
+ mask-image: radial-gradient(circle 130px at var(--mx, -200px) var(--my, -200px), #000 0%, transparent 70%);
60
+ }
61
+ .mmap--static .mmap-svg { pointer-events: none; }
62
+
63
+ /* ---- land (flat) ---- */
64
+ .mmap .state {
65
+ fill: var(--land);
66
+ stroke: var(--stroke);
67
+ stroke-width: var(--stroke-w);
68
+ stroke-linejoin: round;
69
+ vector-effect: non-scaling-stroke; /* borders stay crisp at any zoom */
70
+ transition: fill .2s ease, opacity .5s ease, transform .6s ease;
71
+ transform-box: fill-box;
72
+ transform-origin: center;
73
+ cursor: pointer;
74
+ }
75
+ .mmap .state.is-hover { fill: var(--land-hover); }
76
+ .mmap .state.is-active { fill: var(--land-active); }
77
+
78
+ /* intro: states fade + rise in, staggered via inline --i */
79
+ .mmap .state.intro { opacity: 0; transform: translateY(8px) scale(.985); }
80
+
81
+ /* choropleth mode sets per-state fill via inline style */
82
+ .mmap .state[data-fill] { fill: var(--data-fill); }
83
+
84
+ /* dim the rest of the country while one state is drilled into */
85
+ .mmap .land.drilled .state:not(.is-active) { opacity: .28; }
86
+ .mmap .land.drilled .state.is-active { fill: var(--district); }
87
+ /* where districts cover a state, drop its ADM1 outline so it doesn't double the
88
+ ADM2 carve lines (the two come from different sources and don't align) */
89
+ .mmap .land.drilled .state.is-active.has-districts { stroke: none; }
90
+ .mmap.show-all-districts .state.has-districts { stroke: none; }
91
+
92
+ /* ---- districts (drill-down layer, flat) ---- */
93
+ .mmap .district {
94
+ fill: var(--district);
95
+ stroke: var(--carve);
96
+ stroke-width: var(--carve-w);
97
+ stroke-linejoin: round;
98
+ vector-effect: non-scaling-stroke;
99
+ opacity: 0;
100
+ pointer-events: none;
101
+ transition: opacity .35s ease, fill .15s ease;
102
+ cursor: pointer;
103
+ }
104
+ .mmap .district.show { opacity: 1; pointer-events: auto; }
105
+ .mmap--static .district.show { pointer-events: none; }
106
+ .mmap .district.is-hover { fill: var(--district-hi); }
107
+ .mmap .district.is-active { fill: var(--district-hi); }
108
+ /* states-only ↔ show-all-districts (used by the playground) */
109
+ .mmap.show-all-districts .district { opacity: 1; }
110
+
111
+ /* ---- labels ---- */
112
+ .mmap .label {
113
+ fill: var(--label);
114
+ font-size: var(--label-fs, 9px);
115
+ font-weight: 600;
116
+ text-anchor: middle;
117
+ paint-order: stroke;
118
+ stroke: rgba(0,0,0,.55);
119
+ stroke-width: var(--label-sw, 2.4px);
120
+ pointer-events: none;
121
+ opacity: 0;
122
+ transition: opacity .3s ease;
123
+ }
124
+ .mmap .labels.show .label { opacity: 1; }
125
+ .mmap .label.ft { fill: var(--label-dim); font-size: 7.5px; }
126
+
127
+ /* ---- pins ---- */
128
+ .mmap .pin-dot { fill: var(--pin); stroke: #fff; stroke-width: 1.2; cursor: pointer; }
129
+ .mmap .pin-ring {
130
+ fill: none; stroke: var(--pin-ring); stroke-width: 2;
131
+ transform-box: fill-box; transform-origin: center;
132
+ animation: mmap-pulse 2.4s ease-out infinite; pointer-events: none;
133
+ }
134
+ @keyframes mmap-pulse {
135
+ 0% { transform: scale(.4); opacity: .9; }
136
+ 70% { transform: scale(2.6); opacity: 0; }
137
+ 100% { transform: scale(2.6); opacity: 0; }
138
+ }
139
+ .mmap .pin-label {
140
+ fill: #fff; font-size: 8px; font-weight: 600; text-anchor: middle;
141
+ paint-order: stroke; stroke: rgba(0,0,0,.6); stroke-width: 2.4px; pointer-events: none;
142
+ }
143
+
144
+ /* ---- tooltip (absolute within the container) ---- */
145
+ .mmap-tooltip {
146
+ position: absolute;
147
+ z-index: 20;
148
+ padding: 6px 10px;
149
+ font-size: 13px;
150
+ font-weight: 600;
151
+ letter-spacing: .2px;
152
+ color: #eafffa;
153
+ background: var(--panel-bg);
154
+ border: 1px solid var(--panel-edge);
155
+ border-radius: 8px;
156
+ pointer-events: none;
157
+ opacity: 0;
158
+ transform: translate(-50%, -130%);
159
+ transition: opacity .12s ease;
160
+ white-space: nowrap;
161
+ }
162
+ .mmap-tooltip.show { opacity: 1; }
163
+
164
+ /* ---- info panel (slides in within the container) ---- */
165
+ .mmap-panel {
166
+ position: absolute; z-index: 16; right: 0; top: 0; bottom: 0;
167
+ width: min(320px, 84%);
168
+ padding: 26px 24px;
169
+ background: var(--panel-bg);
170
+ border-left: 1px solid var(--panel-edge);
171
+ transform: translateX(100%);
172
+ transition: transform .35s cubic-bezier(.4,0,.2,1);
173
+ overflow-y: auto;
174
+ font-family: var(--font);
175
+ }
176
+ .mmap-panel.open { transform: translateX(0); }
177
+ .mmap-panel .kicker { font-size: 11px; letter-spacing: 2px; text-transform: uppercase; color: var(--accent); }
178
+ .mmap-panel h2 { margin: 6px 0 2px; font-size: 26px; color: #fff; }
179
+ .mmap-panel .sub { font-size: 13px; color: rgba(255,255,255,.55); margin-bottom: 18px; }
180
+ .mmap-panel .row { display: flex; justify-content: space-between; padding: 10px 0; border-top: 1px solid rgba(255,255,255,.07); font-size: 14px; color: rgba(255,255,255,.7); }
181
+ .mmap-panel .row span:last-child { color: #fff; font-weight: 600; }
182
+ .mmap-panel .close { position: absolute; top: 16px; right: 18px; cursor: pointer; color: rgba(255,255,255,.5); font-size: 22px; line-height: 1; }
183
+ .mmap-panel .close:hover { color: #fff; }
184
+
185
+ /* ============================================================
186
+ THEME PRESETS — createMalaysiaMap(el, { theme: 'light' })
187
+ ============================================================ */
188
+ .mmap--theme-mono { /* identical to the defaults above; here for switching back */
189
+ --sea:#ffffff; --grid:rgba(0,0,0,.05); --land:#ffffff; --land-hover:#e6e6e6;
190
+ --land-active:#111111; --stroke:#111111; --district:#ffffff; --carve:#9a9a9a;
191
+ --district-hi:#111111; --label:#111111; --label-dim:rgba(17,17,17,.5); --accent:#111111;
192
+ --pin:#111111; --pin-ring:rgba(0,0,0,.4); --panel-bg:#111111; --panel-edge:#333333;
193
+ }
194
+ .mmap--theme-flat-dark {
195
+ --sea:#151619; --grid:rgba(255,255,255,.045); --land:#f5f6f7; --land-hover:#d7efe8;
196
+ --land-active:#ffcc33; --stroke:#313640; --district:#fff; --carve:#c4cad2;
197
+ --district-hi:#ffcc33; --label:#1b1d22; --accent:#34c3a6; --panel-bg:#122031; --panel-edge:#1e3a44;
198
+ }
199
+ .mmap--theme-light {
200
+ --sea:#e7ecf1; --grid:rgba(20,30,50,.06); --land:#ffffff; --land-hover:#cfeee6;
201
+ --land-active:#ffc83d; --stroke:#9aa6b4; --district:#f7f9fb; --carve:#d3dae2;
202
+ --district-hi:#ffc83d; --label:#26303c; --label-dim:rgba(38,48,60,.5);
203
+ --pin:#e0445a; --pin-ring:rgba(224,68,90,.5); --accent:#0e8f76;
204
+ --panel-bg:#16202b; --panel-edge:#2a3848;
205
+ }
206
+ .mmap--theme-blueprint {
207
+ --sea:#0a1e3f; --grid:rgba(120,180,255,.10); --land:#0d2950; --land-hover:#15406f;
208
+ --land-active:#5fd0ff; --stroke:#5fa8ff; --stroke-w:1; --district:#0d2950; --carve:#3d77c0;
209
+ --district-hi:#5fd0ff; --label:#cfe6ff; --label-dim:rgba(207,230,255,.55);
210
+ --pin:#ffd166; --pin-ring:rgba(255,209,102,.5); --accent:#5fd0ff;
211
+ --panel-bg:#0a1e3f; --panel-edge:#1d3c6b;
212
+ }
213
+ .mmap--theme-batik {
214
+ --sea:#2a1a12; --grid:rgba(255,210,160,.06); --land:#f3e3cf; --land-hover:#e8c79c;
215
+ --land-active:#d98324; --stroke:#7a4a25; --district:#f7ecdb; --carve:#cdab85;
216
+ --district-hi:#d98324; --label:#4a2e16; --label-dim:rgba(74,46,22,.5);
217
+ --pin:#c1432f; --pin-ring:rgba(193,67,47,.5); --accent:#d98324;
218
+ --panel-bg:#241008; --panel-edge:#46291a;
219
+ }