allotaxonometer-ui 0.1.4 → 0.1.6

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/index.js CHANGED
@@ -4,54 +4,68 @@ import * as d3 from 'd3';
4
4
  import { map, extent, InternSet, range, rollup, scaleLinear, scaleBand, rgb, interpolateInferno, scaleOrdinal } from 'd3';
5
5
  import { descending, sum, group, extent as extent$1 } from 'd3-array';
6
6
 
7
- const colors = {
8
- darkgrey: "rgb(140, 140, 140)",
9
- darkergrey: "rgb(89, 89, 89)"};
10
-
11
- const fonts = {
12
- family: '"EB Garamond", "Garamond", "Century Schoolbook L", "URW Bookman L", "Bookman Old Style", "Times", serif',
13
- sizes: {
14
- sm: "12px",
15
- lg: "16px"}
16
- };
7
+ // Helper: convert [0–1, 0–1, 0–1] → "rgb(R, G, B)"
8
+ function rgbArrayToCss(rgbArray) {
9
+ const [r, g, b] = rgbArray.map(v => Math.round(v * 255));
10
+ return `rgb(${r}, ${g}, ${b})`;
11
+ }
17
12
 
18
- // Style builder function
19
13
  function style(props) {
20
14
  return Object.entries(props)
21
15
  .map(([key, value]) => `${key.replace(/([A-Z])/g, '-$1').toLowerCase()}: ${value}`)
22
16
  .join('; ');
23
17
  }
24
18
 
25
- // Axis styles
26
- const axisStyles = {
27
- label: () => style({
28
- fontFamily: fonts.family,
29
- fontSize: fonts.sizes.lg,
30
- fill: colors.darkergrey,
31
- textAnchor: "middle"
32
- }),
33
-
34
- tickLabel: () => style({
35
- fontFamily: fonts.family,
36
- fontSize: fonts.sizes.sm,
37
- fill: colors.darkergrey,
38
- }),
39
-
40
- helperText: () => style({
41
- fontFamily: fonts.family,
42
- fontSize: fonts.sizes.sm,
43
- fill: colors.darkgrey,
44
- textAnchor: "middle",
45
- opacity: "0.8"
46
- }),
47
-
48
- tickLine: () => style({
49
- stroke: colors.darkgrey,
50
- strokeWidth: "0.5"
51
- })
19
+ // // imported from matlab version. Normalized RGB color definitions
20
+ const rawColors = {
21
+ blue: [43, 103, 198].map(v => v / 255),
22
+ red: [198, 43, 103].map(v => v / 255),
23
+
24
+ paleblue: [195, 230, 243].map(v => v / 255),
25
+ palered: [255, 204, 204].map(v => v / 255),
26
+
27
+ lightergrey: [1, 1, 1].map(v => v * 0.96),
28
+ lightishgrey: [1, 1, 1].map(v => v * 0.93),
29
+ lightgrey: [1, 1, 1].map(v => v * 0.90),
30
+
31
+ lightgreyer: [1, 1, 1].map(v => v * 0.85),
32
+ lightgreyish: [1, 1, 1].map(v => v * 0.80),
33
+
34
+ grey: [1, 1, 1].map(v => v * 0.75),
35
+ darkgrey: [1, 1, 1].map(v => v * 0.55),
36
+ darkergrey: [1, 1, 1].map(v => v * 0.35),
37
+ verydarkgrey: [1, 1, 1].map(v => v * 0.15),
38
+ superdarkgrey: [1, 1, 1].map(v => v * 0.10),
39
+ reallyverdarkgrey: [1, 1, 1].map(v => v * 0.05),
40
+
41
+ orange: [255, 116, 0].map(v => v / 255)
42
+ };
43
+
44
+ // Create CSS strings for each
45
+ const cssColors = {};
46
+ for (const [key, rgb] of Object.entries(rawColors)) {
47
+ cssColors[key] = rgbArrayToCss(rgb);
48
+ }
49
+
50
+ // Export both raw RGB arrays and CSS strings
51
+ const alloColors = {
52
+ css: cssColors // e.g., colors.css.blue → "rgb(43, 103, 198)"
53
+ };
54
+
55
+ // System font stack in order of preference
56
+ const alloFonts = {
57
+ family: `"EB Garamond", "Garamond", "Century Schoolbook L", "URW Bookman L", "Bookman Old Style", "Times", serif`,
58
+ sizes: {
59
+ xs: "10px",
60
+ sm: "12px",
61
+ md: "14px",
62
+ lg: "16px",
63
+ xl: "18px"
64
+ }
65
+
52
66
  };
53
67
 
54
- var root_1$7 = $.from_svg(`<g><line x1="0" x2="0" y1="0" y2="6"></line></g><g><text dx="5" dy="13" text-anchor="start"> </text></g>`, 1);
68
+ var root_1$7 = $.from_svg(`<g><line x1="0" x2="0" y1="0" y2="6" stroke-width="0.5"></line></g><g><text dx="5" dy="13" text-anchor="start"> </text></g>`, 1);
55
69
  var root$8 = $.from_svg(`<g class="axis x"><!><g class="xlab"><text dy="45">Rank r</text><text dy="63">for</text><text dy="80"> </text><text dy="60">more →</text><text dy="75">frequent</text><text dy="60">← less</text><text dy="75">frequent</text></g></g>`);
56
70
 
57
71
  function AxisX($$anchor, $$props) {
@@ -59,6 +73,21 @@ function AxisX($$anchor, $$props) {
59
73
 
60
74
  let logFormat10 = $.derived(() => $$props.scale.tickFormat());
61
75
  let xTicks = $.derived(() => $$props.scale.ticks().filter((t) => t >= 1 && Number.isInteger(Math.log10(t))));
76
+
77
+ let axisStyles = () => style({
78
+ fontFamily: alloFonts.family,
79
+ fontSize: alloFonts.sizes.lg,
80
+ fill: alloColors.css.darkergrey,
81
+ textAnchor: "middle"
82
+ });
83
+
84
+ let helperText = () => style({
85
+ fontFamily: alloFonts.family,
86
+ fontSize: alloFonts.sizes.sm,
87
+ fill: alloColors.css.darkergrey,
88
+ textAnchor: "middle"
89
+ });
90
+
62
91
  var g = root$8();
63
92
  var node = $.child(g);
64
93
 
@@ -77,18 +106,18 @@ function AxisX($$anchor, $$props) {
77
106
  $.reset(g_2);
78
107
 
79
108
  $.template_effect(
80
- ($0, $1, $2, $3, $4) => {
109
+ ($0, $1, $2) => {
81
110
  $.set_attribute(g_1, 'transform', `translate(${$0 ?? ''}, 0)`);
82
- $.set_style(line, $1);
83
- $.set_attribute(g_2, 'transform', `translate(${$2 ?? ''}, 0) scale(-1,1) rotate(45)`);
84
- $.set_style(text, $3);
85
- $.set_text(text_1, $4);
111
+ $.set_attribute(line, 'stroke', alloColors.css.darkergreyy);
112
+ $.set_attribute(g_2, 'transform', `translate(${$1 ?? ''}, 0) scale(-1,1) rotate(45)`);
113
+ $.set_attribute(text, 'font-family', alloFonts.family);
114
+ $.set_attribute(text, 'font-size', alloFonts.sizes.md);
115
+ $.set_attribute(text, 'fill', alloColors.css.darkergrey);
116
+ $.set_text(text_1, $2);
86
117
  },
87
118
  [
88
119
  () => $$props.scale($.get(tick)),
89
- () => axisStyles.tickLine(),
90
120
  () => $$props.scale($.get(tick)),
91
- () => axisStyles.tickLabel(),
92
121
  () => $.get(logFormat10)($.get(tick))
93
122
  ]
94
123
  );
@@ -141,13 +170,13 @@ function AxisX($$anchor, $$props) {
141
170
  $.set_style(text_9, $6);
142
171
  },
143
172
  [
144
- () => axisStyles.label(),
145
- () => axisStyles.label(),
146
- () => axisStyles.label(),
147
- () => axisStyles.helperText(),
148
- () => axisStyles.helperText(),
149
- () => axisStyles.helperText(),
150
- () => axisStyles.helperText()
173
+ axisStyles,
174
+ axisStyles,
175
+ axisStyles,
176
+ helperText,
177
+ helperText,
178
+ helperText,
179
+ helperText
151
180
  ]
152
181
  );
153
182
 
@@ -155,7 +184,7 @@ function AxisX($$anchor, $$props) {
155
184
  $.pop();
156
185
  }
157
186
 
158
- var root_1$6 = $.from_svg(`<g><line x1="0" x2="-6" y1="0" y2="0"></line></g><g><text dx="-5" dy="13" text-anchor="end"> </text></g>`, 1);
187
+ var root_1$6 = $.from_svg(`<g><line x1="0" x2="-6" y1="0" y2="0" stroke-width="0.5"></line></g><g><text dx="-5" dy="13" text-anchor="end"> </text></g>`, 1);
159
188
  var root$7 = $.from_svg(`<g class="axis y"><!><g class="ylab" transform="rotate(90)"><text dy="45">Rank r</text><text dy="63">for</text><text dy="80"> </text><text dy="60">less →</text><text dy="75">frequent</text><text dy="60">← more</text><text dy="75">frequent</text></g></g>`);
160
189
 
161
190
  function AxisY($$anchor, $$props) {
@@ -163,6 +192,21 @@ function AxisY($$anchor, $$props) {
163
192
 
164
193
  let logFormat10 = $.derived(() => $$props.scale.tickFormat());
165
194
  let yTicks = $.derived(() => $$props.scale.ticks().filter((t) => t >= 1 && Number.isInteger(Math.log10(t))));
195
+
196
+ let axisStyles = () => style({
197
+ fontFamily: alloFonts.family,
198
+ fontSize: alloFonts.sizes.lg,
199
+ fill: alloColors.css.darkergrey,
200
+ textAnchor: "middle"
201
+ });
202
+
203
+ let helperText = () => style({
204
+ fontFamily: alloFonts.family,
205
+ fontSize: alloFonts.sizes.sm,
206
+ fill: alloColors.css.darkergrey,
207
+ textAnchor: "middle"
208
+ });
209
+
166
210
  var g = root$7();
167
211
  var node = $.child(g);
168
212
 
@@ -181,18 +225,18 @@ function AxisY($$anchor, $$props) {
181
225
  $.reset(g_2);
182
226
 
183
227
  $.template_effect(
184
- ($0, $1, $2, $3, $4) => {
228
+ ($0, $1, $2) => {
185
229
  $.set_attribute(g_1, 'transform', `translate(0, ${$0 ?? ''})`);
186
- $.set_style(line, $1);
187
- $.set_attribute(g_2, 'transform', `translate(0, ${$2 ?? ''}) rotate(45)`);
188
- $.set_style(text, $3);
189
- $.set_text(text_1, $4);
230
+ $.set_attribute(line, 'stroke', alloColors.css.darkergreyy);
231
+ $.set_attribute(g_2, 'transform', `translate(0, ${$1 ?? ''}) rotate(45)`);
232
+ $.set_attribute(text, 'font-family', alloFonts.family);
233
+ $.set_attribute(text, 'font-size', alloFonts.sizes.md);
234
+ $.set_attribute(text, 'fill', alloColors.css.darkergrey);
235
+ $.set_text(text_1, $2);
190
236
  },
191
237
  [
192
238
  () => $$props.scale($.get(tick)),
193
- () => axisStyles.tickLine(),
194
239
  () => $$props.scale($.get(tick)),
195
- () => axisStyles.tickLabel(),
196
240
  () => $.get(logFormat10)($.get(tick))
197
241
  ]
198
242
  );
@@ -238,13 +282,13 @@ function AxisY($$anchor, $$props) {
238
282
  $.set_style(text_9, $6);
239
283
  },
240
284
  [
241
- () => axisStyles.label(),
242
- () => axisStyles.label(),
243
- () => axisStyles.label(),
244
- () => axisStyles.helperText(),
245
- () => axisStyles.helperText(),
246
- () => axisStyles.helperText(),
247
- () => axisStyles.helperText()
285
+ axisStyles,
286
+ axisStyles,
287
+ axisStyles,
288
+ helperText,
289
+ helperText,
290
+ helperText,
291
+ helperText
248
292
  ]
249
293
  );
250
294
 
@@ -252,7 +296,7 @@ function AxisY($$anchor, $$props) {
252
296
  $.pop();
253
297
  }
254
298
 
255
- var root_1$5 = $.from_svg(`<g><line y2="0" stroke="#d3d3d3" stroke-dasharray="3,3"></line></g><g><line x2="0" stroke="#d3d3d3" stroke-dasharray="3,3"></line></g>`, 1);
299
+ var root_1$5 = $.from_svg(`<g><line y2="0" stroke="#d3d3d3" stroke-dasharray="1,3"></line></g><g><line x2="0" stroke="#d3d3d3" stroke-dasharray="1,3"></line></g>`, 1);
256
300
  var root$6 = $.from_svg(`<g class="grid"></g>`);
257
301
 
258
302
  function Grid($$anchor, $$props) {
@@ -296,7 +340,7 @@ function Grid($$anchor, $$props) {
296
340
  $.pop();
297
341
  }
298
342
 
299
- var root_1$4 = $.from_svg(`<path fill="none" stroke="grey" stroke-width="0.9" stroke-opacity="0.9"></path>`);
343
+ var root_1$4 = $.from_svg(`<path fill="none" stroke="grey" stroke-width="0.55" stroke-opacity="0.9"></path>`);
300
344
  var root$5 = $.from_svg(`<g class="contours"></g>`);
301
345
 
302
346
  function Contours($$anchor, $$props) {
@@ -403,51 +447,6 @@ function Contours($$anchor, $$props) {
403
447
  $.pop();
404
448
  }
405
449
 
406
- // Helper: convert [0–1, 0–1, 0–1] → "rgb(R, G, B)"
407
- function rgbArrayToCss(rgbArray) {
408
- const [r, g, b] = rgbArray.map(v => Math.round(v * 255));
409
- return `rgb(${r}, ${g}, ${b})`;
410
- }
411
-
412
- // // imported from matlab version. Normalized RGB color definitions
413
- const rawColors = {
414
- blue: [43, 103, 198].map(v => v / 255),
415
- red: [198, 43, 103].map(v => v / 255),
416
-
417
- paleblue: [195, 230, 243].map(v => v / 255),
418
- palered: [255, 204, 204].map(v => v / 255),
419
-
420
- lightergrey: [1, 1, 1].map(v => v * 0.96),
421
- lightishgrey: [1, 1, 1].map(v => v * 0.93),
422
- lightgrey: [1, 1, 1].map(v => v * 0.90),
423
-
424
- lightgreyer: [1, 1, 1].map(v => v * 0.85),
425
- lightgreyish: [1, 1, 1].map(v => v * 0.80),
426
-
427
- grey: [1, 1, 1].map(v => v * 0.75),
428
- darkgrey: [1, 1, 1].map(v => v * 0.55),
429
- darkergrey: [1, 1, 1].map(v => v * 0.35),
430
- verydarkgrey: [1, 1, 1].map(v => v * 0.15),
431
- superdarkgrey: [1, 1, 1].map(v => v * 0.10),
432
- reallyverdarkgrey: [1, 1, 1].map(v => v * 0.05),
433
-
434
- orange: [255, 116, 0].map(v => v / 255)
435
- };
436
-
437
- // Create CSS strings for each
438
- const cssColors = {};
439
- for (const [key, rgb] of Object.entries(rawColors)) {
440
- cssColors[key] = rgbArrayToCss(rgb);
441
- }
442
-
443
- // Export both raw RGB arrays and CSS strings
444
- const alloColors = {
445
- css: cssColors // e.g., colors.css.blue → "rgb(43, 103, 198)"
446
- };
447
-
448
- // System font stack in order of preference
449
- const alloFonts = `"EB Garamond", "Garamond", "Century Schoolbook L", "URW Bookman L", "Bookman Old Style", "Times", serif`;
450
-
451
450
  function updateTooltipPosition(event, tooltipVisible, tooltipX, tooltipY) {
452
451
  if ($.get(tooltipVisible)) {
453
452
  $.set(tooltipX, event.clientX + 15);
@@ -690,7 +689,7 @@ function Diamond($$anchor, $$props) {
690
689
  $.set_attribute(text, 'dx', $.get(d).x1 - $.get(d).y1 <= 0 ? 5 : -5);
691
690
  $.set_attribute(text, 'text-anchor', $.get(d).x1 - $.get(d).y1 <= 0 ? "start" : "end");
692
691
  $.set_attribute(text, 'transform', `scale(1,-1) rotate(-90) rotate(-45, ${$2 ?? ''}, ${$3 ?? ''}) translate(${$4 ?? ''}, 0)`);
693
- $.set_style(text, `font-family: ${alloFonts}; font-size: 12px; fill: ${alloColors.css.darkergrey ?? ''};`);
692
+ $.set_style(text, `font-family: ${alloFonts ?? ''}; font-size: 12px; fill: ${alloColors.css.darkergrey ?? ''};`);
694
693
  $.set_text(text_1, $5);
695
694
  },
696
695
  [
@@ -888,7 +887,7 @@ function Wordshift($$anchor, $$props) {
888
887
  $.set_attribute(line_1, 'y2', $.get(innerHeight) - xAxisYOffset + barYOffset);
889
888
  $.set_style(line_1, $.get(tick) === 0 ? `stroke: ${alloColors.css.verydarkgrey}; stroke-width: 1; stroke-opacity: 0.8;` : `stroke: currentColor; stroke-opacity: 0.1;`);
890
889
  $.set_attribute(text, 'x', $4);
891
- $.set_style(text, `font-family: ${alloFonts}; font-size: 14px; fill: ${alloColors.css.verydarkgrey ?? ''};`);
890
+ $.set_style(text, `font-family: ${alloFonts ?? ''}; font-size: 14px; fill: ${alloColors.css.verydarkgrey ?? ''};`);
892
891
  $.set_text(text_1, $5);
893
892
  },
894
893
  [
@@ -957,7 +956,7 @@ function Wordshift($$anchor, $$props) {
957
956
  $.template_effect(() => {
958
957
  $.set_attribute(text_6, 'x', $.get(xValue) > 0 ? -6 : 6);
959
958
  $.set_attribute(text_6, 'text-anchor', $.get(xValue) > 0 ? "end" : "start");
960
- $.set_style(text_6, `font-family: ${alloFonts}; font-size: 14px; fill: ${alloColors.css.darkergrey ?? ''}; opacity: 0.5;`);
959
+ $.set_style(text_6, `font-family: ${alloFonts ?? ''}; font-size: 14px; fill: ${alloColors.css.darkergrey ?? ''}; opacity: 0.5;`);
961
960
  $.set_text(text_7, $.get(labelData).numbers_y);
962
961
  });
963
962
 
@@ -976,7 +975,7 @@ function Wordshift($$anchor, $$props) {
976
975
  $.set_attribute(g_3, 'transform', `translate(0, ${$0 ?? ''})`);
977
976
  $.set_attribute(text_4, 'x', $.get(xValue) > 0 ? 6 : -6);
978
977
  $.set_attribute(text_4, 'text-anchor', $.get(xValue) > 0 ? "start" : "end");
979
- $.set_style(text_4, `font-family: ${alloFonts}; font-size: 14px; fill: ${alloColors.css.verydarkgrey ?? ''};`);
978
+ $.set_style(text_4, `font-family: ${alloFonts ?? ''}; font-size: 14px; fill: ${alloColors.css.verydarkgrey ?? ''};`);
980
979
  $.set_text(text_5, $.get(labelData).name_y);
981
980
  },
982
981
  [
@@ -998,7 +997,7 @@ function Wordshift($$anchor, $$props) {
998
997
  $.set_attribute(svg, 'viewBox', `0 0 ${width() ?? ''} ${$.get(finalHeight) ?? ''}`);
999
998
  $.set_attribute(g, 'transform', `translate(${marginLeft() ?? ''}, ${marginTop() - shiftSvgBy})`);
1000
999
  $.set_attribute(text_2, 'x', $0);
1001
- $.set_style(text_2, `font-family: ${alloFonts}; font-size: 16px; fill: ${alloColors.css.verydarkgrey ?? ''};`);
1000
+ $.set_style(text_2, `font-family: ${alloFonts ?? ''}; font-size: 16px; fill: ${alloColors.css.verydarkgrey ?? ''};`);
1002
1001
  $.set_text(text_3, xLabel());
1003
1002
  $.set_attribute(g_2, 'transform', `translate(${$1 ?? ''}, 0)`);
1004
1003
  },
@@ -1081,7 +1080,7 @@ function DivergingBarChart($$anchor, $$props) {
1081
1080
  $.set_attribute(text, 'x', $4);
1082
1081
  $.set_attribute(text, 'y', $5);
1083
1082
  $.set_attribute(text, 'text-anchor', $.get(X)[$.get(i)] < 0 ? "end" : "start");
1084
- $.set_style(text, `font-family: ${alloFonts}; font-size: 10px; fill: ${alloColors.css.darkergrey ?? ''}; opacity: 0.5;`);
1083
+ $.set_style(text, `font-family: ${alloFonts ?? ''}; font-size: 10px; fill: ${alloColors.css.darkergrey ?? ''}; opacity: 0.5;`);
1085
1084
  $.set_text(text_1, $6);
1086
1085
  },
1087
1086
  [
@@ -1110,7 +1109,7 @@ function DivergingBarChart($$anchor, $$props) {
1110
1109
  ($0, $1) => {
1111
1110
  $.set_attribute(text_2, 'y', $0);
1112
1111
  $.set_attribute(text_2, 'opacity', $1);
1113
- $.set_style(text_2, `font-family: ${alloFonts}; font-size: 14px; fill: ${alloColors.css.darkergrey ?? ''};`);
1112
+ $.set_style(text_2, `font-family: ${alloFonts ?? ''}; font-size: 14px; fill: ${alloColors.css.darkergrey ?? ''};`);
1114
1113
  $.set_text(text_3, $.get(label));
1115
1114
  },
1116
1115
  [
@@ -1198,7 +1197,7 @@ function Legend($$anchor, $$props) {
1198
1197
  $.template_effect(
1199
1198
  ($0) => {
1200
1199
  $.set_attribute(g_1, 'transform', `translate(${$0 ?? ''}, 0)`);
1201
- $.set_style(text, `font-family: ${alloFonts}; font-size: 14px; fill: ${alloColors.css.verydarkgrey ?? ''}; text-anchor: start;`);
1200
+ $.set_style(text, `font-family: ${alloFonts ?? ''}; font-size: 14px; fill: ${alloColors.css.verydarkgrey ?? ''}; text-anchor: start;`);
1202
1201
  $.set_text(text_1, $.get(tick));
1203
1202
  },
1204
1203
  [() => $.get(x2)($.get(tick))]
@@ -1218,14 +1217,14 @@ function Legend($$anchor, $$props) {
1218
1217
  $.set_attribute(svg, 'viewBox', `0 0 ${width() ?? ''} ${height() ?? ''}`);
1219
1218
  $.set_attribute(text_2, 'x', marginLeft() - 25);
1220
1219
  $.set_attribute(text_2, 'y', marginTop() + marginBottom());
1221
- $.set_style(text_2, `font-family: ${alloFonts}; font-size: 14px; fill: ${alloColors.css.verydarkgrey ?? ''}; text-anchor: start;`);
1220
+ $.set_style(text_2, `font-family: ${alloFonts ?? ''}; font-size: 14px; fill: ${alloColors.css.verydarkgrey ?? ''}; text-anchor: start;`);
1222
1221
  });
1223
1222
 
1224
1223
  $.append($$anchor, svg);
1225
1224
  $.pop();
1226
1225
  }
1227
1226
 
1228
- var root = $.from_html(`<div class="allotaxonometer-dashboard" style="position: relative; margin: 0; padding: 0;"><div style="display:flex; flex-wrap: wrap; align-items:center; justify-content: center; row-gap: 50px;"><div style="margin-top:20px"><div style="display:flex; gap: 10em; justify-content: center; margin-bottom: -70px; margin-right: 70px; position: relative;"><div style="position: relative;"><div> </div> <div> </div> <div> </div></div> <div> </div></div> <div id="diamondplot"><!></div> <div style="display: flex; gap: 13em; justify-content: center;"><div id="legend" style="margin-left: -50px;"><!></div> <div id="balance"><!></div></div></div> <div style="margin-top:60px; overflow: visible;"><div id="wordshift" style="overflow: visible;"><!></div></div></div></div>`);
1227
+ var root = $.from_html(`<div id="allotaxonometer-dashboard" style="position: relative; margin: 0; padding: 0;"><div style="display:flex; flex-wrap: wrap; align-items:center; justify-content: center; row-gap: 50px;"><div id="diamond-group" style="margin-top:20px; margin-right: -50px;"><div style="display:flex; gap: 10em; justify-content: center; margin-bottom: -70px; margin-right: 70px; position: relative;"><div style="position: relative;"><div> </div> <div><div style="margin-bottom: 0.5em;"> </div> <div> </div></div></div> <div> </div></div> <div id="diamondplot"><!></div> <div style="display: flex; gap: 13em; justify-content: center;"><div id="legend" style="margin-left: -50px;"><!></div> <div id="balance"><!></div></div></div> <div style="margin-top:60px; overflow: visible;"><div id="wordshift" style="overflow: visible;"><!></div></div></div></div>`);
1229
1228
 
1230
1229
  function Dashboard($$anchor, $$props) {
1231
1230
  $.push($$props, true);
@@ -1254,35 +1253,6 @@ function Dashboard($$anchor, $$props) {
1254
1253
  $.prop($$props, 'showWordshift', 3, true);
1255
1254
  $.prop($$props, 'showDivergingBar', 3, true);
1256
1255
  $.prop($$props, 'showLegend', 3, true);
1257
- $.rest_props($$props, [
1258
- '$$slots',
1259
- '$$events',
1260
- '$$legacy',
1261
- 'dat',
1262
- 'alpha',
1263
- 'divnorm',
1264
- 'barData',
1265
- 'balanceData',
1266
- 'xDomain',
1267
- 'instrumentText',
1268
- 'title',
1269
- 'maxlog10',
1270
- 'height',
1271
- 'width',
1272
- 'DashboardHeight',
1273
- 'DashboardWidth',
1274
- 'DiamondHeight',
1275
- 'DiamondWidth',
1276
- 'marginInner',
1277
- 'marginDiamond',
1278
- 'max_count_log',
1279
- 'class',
1280
- 'style',
1281
- 'showDiamond',
1282
- 'showWordshift',
1283
- 'showDivergingBar',
1284
- 'showLegend'
1285
- ]);
1286
1256
 
1287
1257
  let max_shift = $.derived(() => barData().length > 0 ? Math.max(...barData().map((d) => Math.abs(d.metric))) : 1);
1288
1258
 
@@ -1302,24 +1272,26 @@ function Dashboard($$anchor, $$props) {
1302
1272
  $.reset(div_5);
1303
1273
 
1304
1274
  var div_6 = $.sibling(div_5, 2);
1305
- var text_1 = $.child(div_6, true);
1275
+ var div_7 = $.child(div_6);
1276
+ var text_1 = $.child(div_7, true);
1306
1277
 
1307
- $.reset(div_6);
1278
+ $.reset(div_7);
1308
1279
 
1309
- var div_7 = $.sibling(div_6, 2);
1310
- var text_2 = $.child(div_7);
1280
+ var div_8 = $.sibling(div_7, 2);
1281
+ var text_2 = $.child(div_8);
1311
1282
 
1312
- $.reset(div_7);
1283
+ $.reset(div_8);
1284
+ $.reset(div_6);
1313
1285
  $.reset(div_4);
1314
1286
 
1315
- var div_8 = $.sibling(div_4, 2);
1316
- var text_3 = $.child(div_8, true);
1287
+ var div_9 = $.sibling(div_4, 2);
1288
+ var text_3 = $.child(div_9, true);
1317
1289
 
1318
- $.reset(div_8);
1290
+ $.reset(div_9);
1319
1291
  $.reset(div_3);
1320
1292
 
1321
- var div_9 = $.sibling(div_3, 2);
1322
- var node = $.child(div_9);
1293
+ var div_10 = $.sibling(div_3, 2);
1294
+ var node = $.child(div_10);
1323
1295
 
1324
1296
  Diamond(node, {
1325
1297
  get dat() {
@@ -1348,11 +1320,11 @@ function Dashboard($$anchor, $$props) {
1348
1320
  }
1349
1321
  });
1350
1322
 
1351
- $.reset(div_9);
1323
+ $.reset(div_10);
1352
1324
 
1353
- var div_10 = $.sibling(div_9, 2);
1354
- var div_11 = $.child(div_10);
1355
- var node_1 = $.child(div_11);
1325
+ var div_11 = $.sibling(div_10, 2);
1326
+ var div_12 = $.child(div_11);
1327
+ var node_1 = $.child(div_12);
1356
1328
  const expression = $.derived(() => max_count_log() || 5);
1357
1329
 
1358
1330
  Legend(node_1, {
@@ -1367,10 +1339,10 @@ function Dashboard($$anchor, $$props) {
1367
1339
  }
1368
1340
  });
1369
1341
 
1370
- $.reset(div_11);
1342
+ $.reset(div_12);
1371
1343
 
1372
- var div_12 = $.sibling(div_11, 2);
1373
- var node_2 = $.child(div_12);
1344
+ var div_13 = $.sibling(div_12, 2);
1345
+ var node_2 = $.child(div_13);
1374
1346
 
1375
1347
  DivergingBarChart(node_2, {
1376
1348
  get data() {
@@ -1384,13 +1356,13 @@ function Dashboard($$anchor, $$props) {
1384
1356
  }
1385
1357
  });
1386
1358
 
1387
- $.reset(div_12);
1388
- $.reset(div_10);
1359
+ $.reset(div_13);
1360
+ $.reset(div_11);
1389
1361
  $.reset(div_2);
1390
1362
 
1391
- var div_13 = $.sibling(div_2, 2);
1392
- var div_14 = $.child(div_13);
1393
- var node_3 = $.child(div_14);
1363
+ var div_14 = $.sibling(div_2, 2);
1364
+ var div_15 = $.child(div_14);
1365
+ var node_3 = $.child(div_15);
1394
1366
 
1395
1367
  Wordshift(node_3, {
1396
1368
  get barData() {
@@ -1406,22 +1378,21 @@ function Dashboard($$anchor, $$props) {
1406
1378
  return $.get(wordshiftXDomain);
1407
1379
  },
1408
1380
  width: 640,
1409
- marginLeft: 140
1381
+ marginLeft: 110
1410
1382
  });
1411
1383
 
1384
+ $.reset(div_15);
1412
1385
  $.reset(div_14);
1413
- $.reset(div_13);
1414
1386
  $.reset(div_1);
1415
1387
  $.reset(div);
1416
1388
 
1417
1389
  $.template_effect(() => {
1418
- $.set_style(div_5, `font-family: ${alloFonts}; font-size: 16px; color: ${alloColors.css.superdarkgrey ?? ''};`);
1390
+ $.set_style(div_5, `font-family: ${alloFonts ?? ''}; font-size: 16px; color: ${alloColors.css.superdarkgrey ?? ''};`);
1419
1391
  $.set_text(text, title()[0]);
1420
- $.set_style(div_6, `position: absolute; top: 100%; left: -12em; margin-top: 2.5em; font-family: ${alloFonts}; font-size: 14px; color: ${alloColors.css.darkgrey ?? ''};`);
1392
+ $.set_style(div_6, `position: absolute; top: 100%; left: -8em; margin-top: 3em; font-family: ${alloFonts ?? ''}; font-size: 14px; color: ${alloColors.css.darkgrey ?? ''}; width: 150px; line-height: 1;`);
1421
1393
  $.set_text(text_1, instrumentText());
1422
- $.set_style(div_7, `position: absolute; top: 100%; left: -12em; margin-top: 3.5em; font-family: ${alloFonts}; font-size: 14px; color: ${alloColors.css.darkgrey ?? ''};`);
1423
1394
  $.set_text(text_2, `α = ${alpha() ?? ''}`);
1424
- $.set_style(div_8, `font-family: ${alloFonts}; font-size: 16px; color: ${alloColors.css.superdarkgrey ?? ''};`);
1395
+ $.set_style(div_9, `font-family: ${alloFonts ?? ''}; font-size: 16px; color: ${alloColors.css.superdarkgrey ?? ''};`);
1425
1396
  $.set_text(text_3, title()[1]);
1426
1397
  });
1427
1398
 
package/dist/ssr/index.js CHANGED
@@ -3,56 +3,73 @@ import * as d3 from "d3";
3
3
  import { map, extent, InternSet, range, rollup, scaleLinear, scaleBand, rgb, interpolateInferno, scaleOrdinal } from "d3";
4
4
  import { descending, sum, group, extent as extent$1 } from "d3-array";
5
5
  import structuredClone from "@ungap/structured-clone";
6
- const colors = {
7
- darkgrey: "rgb(140, 140, 140)",
8
- darkergrey: "rgb(89, 89, 89)"
6
+ function rgbArrayToCss(rgbArray) {
7
+ const [r, g, b] = rgbArray.map((v) => Math.round(v * 255));
8
+ return `rgb(${r}, ${g}, ${b})`;
9
+ }
10
+ function style(props) {
11
+ return Object.entries(props).map(([key, value]) => `${key.replace(/([A-Z])/g, "-$1").toLowerCase()}: ${value}`).join("; ");
12
+ }
13
+ const rawColors = {
14
+ blue: [43, 103, 198].map((v) => v / 255),
15
+ red: [198, 43, 103].map((v) => v / 255),
16
+ paleblue: [195, 230, 243].map((v) => v / 255),
17
+ palered: [255, 204, 204].map((v) => v / 255),
18
+ lightergrey: [1, 1, 1].map((v) => v * 0.96),
19
+ lightishgrey: [1, 1, 1].map((v) => v * 0.93),
20
+ lightgrey: [1, 1, 1].map((v) => v * 0.9),
21
+ lightgreyer: [1, 1, 1].map((v) => v * 0.85),
22
+ lightgreyish: [1, 1, 1].map((v) => v * 0.8),
23
+ grey: [1, 1, 1].map((v) => v * 0.75),
24
+ darkgrey: [1, 1, 1].map((v) => v * 0.55),
25
+ darkergrey: [1, 1, 1].map((v) => v * 0.35),
26
+ verydarkgrey: [1, 1, 1].map((v) => v * 0.15),
27
+ superdarkgrey: [1, 1, 1].map((v) => v * 0.1),
28
+ reallyverdarkgrey: [1, 1, 1].map((v) => v * 0.05),
29
+ orange: [255, 116, 0].map((v) => v / 255)
9
30
  };
10
- const fonts = {
11
- family: '"EB Garamond", "Garamond", "Century Schoolbook L", "URW Bookman L", "Bookman Old Style", "Times", serif',
31
+ const cssColors = {};
32
+ for (const [key, rgb2] of Object.entries(rawColors)) {
33
+ cssColors[key] = rgbArrayToCss(rgb2);
34
+ }
35
+ const alloColors = {
36
+ css: cssColors
37
+ // e.g., colors.css.blue → "rgb(43, 103, 198)"
38
+ };
39
+ const alloFonts = {
40
+ family: `"EB Garamond", "Garamond", "Century Schoolbook L", "URW Bookman L", "Bookman Old Style", "Times", serif`,
12
41
  sizes: {
42
+ xs: "10px",
13
43
  sm: "12px",
14
- lg: "16px"
44
+ md: "14px",
45
+ lg: "16px",
46
+ xl: "18px"
15
47
  }
16
48
  };
17
- function style(props) {
18
- return Object.entries(props).map(([key, value]) => `${key.replace(/([A-Z])/g, "-$1").toLowerCase()}: ${value}`).join("; ");
19
- }
20
- const axisStyles = {
21
- label: () => style({
22
- fontFamily: fonts.family,
23
- fontSize: fonts.sizes.lg,
24
- fill: colors.darkergrey,
25
- textAnchor: "middle"
26
- }),
27
- tickLabel: () => style({
28
- fontFamily: fonts.family,
29
- fontSize: fonts.sizes.sm,
30
- fill: colors.darkergrey
31
- }),
32
- helperText: () => style({
33
- fontFamily: fonts.family,
34
- fontSize: fonts.sizes.sm,
35
- fill: colors.darkgrey,
36
- textAnchor: "middle",
37
- opacity: "0.8"
38
- }),
39
- tickLine: () => style({
40
- stroke: colors.darkgrey,
41
- strokeWidth: "0.5"
42
- })
43
- };
44
49
  function AxisX($$payload, $$props) {
45
50
  $.push();
46
51
  let { innerHeight, scale, title } = $$props;
47
52
  let logFormat10 = scale.tickFormat();
48
53
  let xTicks = scale.ticks().filter((t) => t >= 1 && Number.isInteger(Math.log10(t)));
54
+ let axisStyles = () => style({
55
+ fontFamily: alloFonts.family,
56
+ fontSize: alloFonts.sizes.lg,
57
+ fill: alloColors.css.darkergrey,
58
+ textAnchor: "middle"
59
+ });
60
+ let helperText = () => style({
61
+ fontFamily: alloFonts.family,
62
+ fontSize: alloFonts.sizes.sm,
63
+ fill: alloColors.css.darkergrey,
64
+ textAnchor: "middle"
65
+ });
49
66
  const each_array = $.ensure_array_like(xTicks);
50
67
  $$payload.out += `<g class="axis x"${$.attr("transform", `translate(0, ${$.stringify(innerHeight)})`)}><!--[-->`;
51
68
  for (let index = 0, $$length = each_array.length; index < $$length; index++) {
52
69
  let tick = each_array[index];
53
- $$payload.out += `<g${$.attr("transform", `translate(${$.stringify(scale(tick))}, 0)`)}><line x1="0" x2="0" y1="0" y2="6"${$.attr_style(axisStyles.tickLine())}></line></g><g${$.attr("transform", `translate(${$.stringify(scale(tick))}, 0) scale(-1,1) rotate(45)`)}><text dx="5" dy="13" text-anchor="start"${$.attr_style(axisStyles.tickLabel())}>${$.escape(logFormat10(tick))}</text></g>`;
70
+ $$payload.out += `<g${$.attr("transform", `translate(${$.stringify(scale(tick))}, 0)`)}><line x1="0" x2="0" y1="0" y2="6"${$.attr("stroke", alloColors.css.darkergreyy)} stroke-width="0.5"></line></g><g${$.attr("transform", `translate(${$.stringify(scale(tick))}, 0) scale(-1,1) rotate(45)`)}><text dx="5" dy="13" text-anchor="start"${$.attr("font-family", alloFonts.family)}${$.attr("font-size", alloFonts.sizes.md)}${$.attr("fill", alloColors.css.darkergrey)}>${$.escape(logFormat10(tick))}</text></g>`;
54
71
  }
55
- $$payload.out += `<!--]--><g class="xlab"><text${$.attr("x", innerHeight / 2)} dy="45"${$.attr("transform", `scale(-1,1) translate(-${$.stringify(innerHeight)}, 0)`)}${$.attr_style(axisStyles.label())}>Rank r</text><text${$.attr("x", innerHeight / 2)} dy="63"${$.attr("transform", `scale(-1,1) translate(-${$.stringify(innerHeight)}, 0)`)}${$.attr_style(axisStyles.label())}>for</text><text${$.attr("x", innerHeight / 2)} dy="80"${$.attr("transform", `scale(-1,1) translate(-${$.stringify(innerHeight)}, 0)`)}${$.attr_style(axisStyles.label())}>${$.escape(title[1])}</text><text${$.attr("x", innerHeight - 40)} dy="60"${$.attr("transform", `scale(-1,1) translate(-${$.stringify(innerHeight)}, 0)`)}${$.attr_style(axisStyles.helperText())}>more →</text><text${$.attr("x", innerHeight - 40)} dy="75"${$.attr("transform", `scale(-1,1) translate(-${$.stringify(innerHeight)}, 0)`)}${$.attr_style(axisStyles.helperText())}>frequent</text><text${$.attr("x", 40)} dy="60"${$.attr("transform", `scale(-1,1) translate(-${$.stringify(innerHeight)}, 0)`)}${$.attr_style(axisStyles.helperText())}>← less</text><text${$.attr("x", 40)} dy="75"${$.attr("transform", `scale(-1,1) translate(-${$.stringify(innerHeight)}, 0)`)}${$.attr_style(axisStyles.helperText())}>frequent</text></g></g>`;
72
+ $$payload.out += `<!--]--><g class="xlab"><text${$.attr("x", innerHeight / 2)} dy="45"${$.attr("transform", `scale(-1,1) translate(-${$.stringify(innerHeight)}, 0)`)}${$.attr_style(axisStyles())}>Rank r</text><text${$.attr("x", innerHeight / 2)} dy="63"${$.attr("transform", `scale(-1,1) translate(-${$.stringify(innerHeight)}, 0)`)}${$.attr_style(axisStyles())}>for</text><text${$.attr("x", innerHeight / 2)} dy="80"${$.attr("transform", `scale(-1,1) translate(-${$.stringify(innerHeight)}, 0)`)}${$.attr_style(axisStyles())}>${$.escape(title[1])}</text><text${$.attr("x", innerHeight - 40)} dy="60"${$.attr("transform", `scale(-1,1) translate(-${$.stringify(innerHeight)}, 0)`)}${$.attr_style(helperText())}>more →</text><text${$.attr("x", innerHeight - 40)} dy="75"${$.attr("transform", `scale(-1,1) translate(-${$.stringify(innerHeight)}, 0)`)}${$.attr_style(helperText())}>frequent</text><text${$.attr("x", 40)} dy="60"${$.attr("transform", `scale(-1,1) translate(-${$.stringify(innerHeight)}, 0)`)}${$.attr_style(helperText())}>← less</text><text${$.attr("x", 40)} dy="75"${$.attr("transform", `scale(-1,1) translate(-${$.stringify(innerHeight)}, 0)`)}${$.attr_style(helperText())}>frequent</text></g></g>`;
56
73
  $.pop();
57
74
  }
58
75
  function AxisY($$payload, $$props) {
@@ -60,13 +77,25 @@ function AxisY($$payload, $$props) {
60
77
  let { innerHeight, scale, title } = $$props;
61
78
  let logFormat10 = scale.tickFormat();
62
79
  let yTicks = scale.ticks().filter((t) => t >= 1 && Number.isInteger(Math.log10(t)));
80
+ let axisStyles = () => style({
81
+ fontFamily: alloFonts.family,
82
+ fontSize: alloFonts.sizes.lg,
83
+ fill: alloColors.css.darkergrey,
84
+ textAnchor: "middle"
85
+ });
86
+ let helperText = () => style({
87
+ fontFamily: alloFonts.family,
88
+ fontSize: alloFonts.sizes.sm,
89
+ fill: alloColors.css.darkergrey,
90
+ textAnchor: "middle"
91
+ });
63
92
  const each_array = $.ensure_array_like(yTicks);
64
93
  $$payload.out += `<g class="axis y"${$.attr("transform", `translate(${$.stringify(innerHeight)}, 0) scale(-1, 1)`)}><!--[-->`;
65
94
  for (let index = 0, $$length = each_array.length; index < $$length; index++) {
66
95
  let tick = each_array[index];
67
- $$payload.out += `<g${$.attr("transform", `translate(0, ${$.stringify(scale(tick))})`)}><line x1="0" x2="-6" y1="0" y2="0"${$.attr_style(axisStyles.tickLine())}></line></g><g${$.attr("transform", `translate(0, ${$.stringify(scale(tick))}) rotate(45)`)}><text dx="-5" dy="13" text-anchor="end"${$.attr_style(axisStyles.tickLabel())}>${$.escape(logFormat10(tick))}</text></g>`;
96
+ $$payload.out += `<g${$.attr("transform", `translate(0, ${$.stringify(scale(tick))})`)}><line x1="0" x2="-6" y1="0" y2="0"${$.attr("stroke", alloColors.css.darkergreyy)} stroke-width="0.5"></line></g><g${$.attr("transform", `translate(0, ${$.stringify(scale(tick))}) rotate(45)`)}><text dx="-5" dy="13" text-anchor="end"${$.attr("font-family", alloFonts.family)}${$.attr("font-size", alloFonts.sizes.md)}${$.attr("fill", alloColors.css.darkergrey)}>${$.escape(logFormat10(tick))}</text></g>`;
68
97
  }
69
- $$payload.out += `<!--]--><g class="ylab" transform="rotate(90)"><text${$.attr("x", innerHeight / 2)} dy="45"${$.attr_style(axisStyles.label())}>Rank r</text><text${$.attr("x", innerHeight / 2)} dy="63"${$.attr_style(axisStyles.label())}>for</text><text${$.attr("x", innerHeight / 2)} dy="80"${$.attr_style(axisStyles.label())}>${$.escape(title[0])}</text><text${$.attr("x", innerHeight - 40)} dy="60"${$.attr_style(axisStyles.helperText())}>less →</text><text${$.attr("x", innerHeight - 40)} dy="75"${$.attr_style(axisStyles.helperText())}>frequent</text><text${$.attr("x", 40)} dy="60"${$.attr_style(axisStyles.helperText())}>← more</text><text${$.attr("x", 40)} dy="75"${$.attr_style(axisStyles.helperText())}>frequent</text></g></g>`;
98
+ $$payload.out += `<!--]--><g class="ylab" transform="rotate(90)"><text${$.attr("x", innerHeight / 2)} dy="45"${$.attr_style(axisStyles())}>Rank r</text><text${$.attr("x", innerHeight / 2)} dy="63"${$.attr_style(axisStyles())}>for</text><text${$.attr("x", innerHeight / 2)} dy="80"${$.attr_style(axisStyles())}>${$.escape(title[0])}</text><text${$.attr("x", innerHeight - 40)} dy="60"${$.attr_style(helperText())}>less →</text><text${$.attr("x", innerHeight - 40)} dy="75"${$.attr_style(helperText())}>frequent</text><text${$.attr("x", 40)} dy="60"${$.attr_style(helperText())}>← more</text><text${$.attr("x", 40)} dy="75"${$.attr_style(helperText())}>frequent</text></g></g>`;
70
99
  $.pop();
71
100
  }
72
101
  function Grid($$payload, $$props) {
@@ -77,7 +106,7 @@ function Grid($$payload, $$props) {
77
106
  $$payload.out += `<g class="grid"><!--[-->`;
78
107
  for (let index = 0, $$length = each_array.length; index < $$length; index++) {
79
108
  let yline = each_array[index];
80
- $$payload.out += `<g${$.attr("transform", `translate(${$.stringify(wxy(yline))}, 0)`)}><line${$.attr("y1", height)} y2="0" stroke="#d3d3d3" stroke-dasharray="3,3"${$.attr("opacity", index === 0 ? 0 : 1)}></line></g><g${$.attr("transform", `translate(0, ${$.stringify(wxy(yline))})`)}><line${$.attr("x1", height)} x2="0" stroke="#d3d3d3" stroke-dasharray="3,3"${$.attr("opacity", index === 0 ? 0 : 1)}></line></g>`;
109
+ $$payload.out += `<g${$.attr("transform", `translate(${$.stringify(wxy(yline))}, 0)`)}><line${$.attr("y1", height)} y2="0" stroke="#d3d3d3" stroke-dasharray="1,3"${$.attr("opacity", index === 0 ? 0 : 1)}></line></g><g${$.attr("transform", `translate(0, ${$.stringify(wxy(yline))})`)}><line${$.attr("x1", height)} x2="0" stroke="#d3d3d3" stroke-dasharray="1,3"${$.attr("opacity", index === 0 ? 0 : 1)}></line></g>`;
81
110
  }
82
111
  $$payload.out += `<!--]--></g>`;
83
112
  $.pop();
@@ -164,42 +193,11 @@ function Contours($$payload, $$props) {
164
193
  $$payload.out += `<g class="contours"><!--[-->`;
165
194
  for (let index = 0, $$length = each_array.length; index < $$length; index++) {
166
195
  let contour = each_array[index];
167
- $$payload.out += `<path fill="none" stroke="grey"${$.attr("d", pathData(contour))} stroke-width="0.9" stroke-opacity="0.9"></path>`;
196
+ $$payload.out += `<path fill="none" stroke="grey"${$.attr("d", pathData(contour))} stroke-width="0.55" stroke-opacity="0.9"></path>`;
168
197
  }
169
198
  $$payload.out += `<!--]--></g>`;
170
199
  $.pop();
171
200
  }
172
- function rgbArrayToCss(rgbArray) {
173
- const [r, g, b] = rgbArray.map((v) => Math.round(v * 255));
174
- return `rgb(${r}, ${g}, ${b})`;
175
- }
176
- const rawColors = {
177
- blue: [43, 103, 198].map((v) => v / 255),
178
- red: [198, 43, 103].map((v) => v / 255),
179
- paleblue: [195, 230, 243].map((v) => v / 255),
180
- palered: [255, 204, 204].map((v) => v / 255),
181
- lightergrey: [1, 1, 1].map((v) => v * 0.96),
182
- lightishgrey: [1, 1, 1].map((v) => v * 0.93),
183
- lightgrey: [1, 1, 1].map((v) => v * 0.9),
184
- lightgreyer: [1, 1, 1].map((v) => v * 0.85),
185
- lightgreyish: [1, 1, 1].map((v) => v * 0.8),
186
- grey: [1, 1, 1].map((v) => v * 0.75),
187
- darkgrey: [1, 1, 1].map((v) => v * 0.55),
188
- darkergrey: [1, 1, 1].map((v) => v * 0.35),
189
- verydarkgrey: [1, 1, 1].map((v) => v * 0.15),
190
- superdarkgrey: [1, 1, 1].map((v) => v * 0.1),
191
- reallyverdarkgrey: [1, 1, 1].map((v) => v * 0.05),
192
- orange: [255, 116, 0].map((v) => v / 255)
193
- };
194
- const cssColors = {};
195
- for (const [key, rgb2] of Object.entries(rawColors)) {
196
- cssColors[key] = rgbArrayToCss(rgb2);
197
- }
198
- const alloColors = {
199
- css: cssColors
200
- // e.g., colors.css.blue → "rgb(43, 103, 198)"
201
- };
202
- const alloFonts = `"EB Garamond", "Garamond", "Century Schoolbook L", "URW Bookman L", "Bookman Old Style", "Times", serif`;
203
201
  function Diamond($$payload, $$props) {
204
202
  $.push();
205
203
  let {
@@ -320,7 +318,7 @@ function Wordshift($$payload, $$props) {
320
318
  xFormat = "%",
321
319
  xLabel = "← System 1 · Divergence contribution · System 2 →",
322
320
  yPadding = 0,
323
- colors: colors2 = [
321
+ colors = [
324
322
  alloColors.css.lightgrey,
325
323
  alloColors.css.paleblue
326
324
  ],
@@ -376,7 +374,7 @@ function Wordshift($$payload, $$props) {
376
374
  $$payload.out += `<!--]--><text${$.attr("x", xScale(0))} y="-35" text-anchor="middle"${$.attr_style(`font-family: ${$.stringify(alloFonts)}; font-size: 16px; fill: ${$.stringify(alloColors.css.verydarkgrey)};`)}>${$.escape(xLabel)}</text></g><!--[-->`;
377
375
  for (let $$index_1 = 0, $$length = each_array_1.length; $$index_1 < $$length; $$index_1++) {
378
376
  let i = each_array_1[$$index_1];
379
- $$payload.out += `<rect class="wordshift-bar"${$.attr("x", Math.min(xScale(0), xScale(X[i])))}${$.attr("y", yScale(Y[i]) + (yScale.bandwidth() - yScale.bandwidth() * barHeightFactor) / 2)}${$.attr("fill", colors2[X[i] > 0 ? colors2.length - 1 : 0])}${$.attr("width", Math.abs(xScale(X[i]) - xScale(0)))}${$.attr("height", yScale.bandwidth() * barHeightFactor)} style="mix-blend-mode: multiply;"></rect>`;
377
+ $$payload.out += `<rect class="wordshift-bar"${$.attr("x", Math.min(xScale(0), xScale(X[i])))}${$.attr("y", yScale(Y[i]) + (yScale.bandwidth() - yScale.bandwidth() * barHeightFactor) / 2)}${$.attr("fill", colors[X[i] > 0 ? colors.length - 1 : 0])}${$.attr("width", Math.abs(xScale(X[i]) - xScale(0)))}${$.attr("height", yScale.bandwidth() * barHeightFactor)} style="mix-blend-mode: multiply;"></rect>`;
380
378
  }
381
379
  $$payload.out += `<!--]--><g class="wordshift-y-axis"${$.attr("transform", `translate(${$.stringify(xScale(0))}, 0)`)}><!--[-->`;
382
380
  for (let $$index_2 = 0, $$length = each_array_2.length; $$index_2 < $$length; $$index_2++) {
@@ -408,7 +406,7 @@ function DivergingBarChart($$payload, $$props) {
408
406
  marginLeft = 40,
409
407
  width = 200,
410
408
  yPadding = 0.5,
411
- colors: colors2 = [
409
+ colors = [
412
410
  alloColors.css.lightgrey,
413
411
  alloColors.css.paleblue
414
412
  ]
@@ -430,7 +428,7 @@ function DivergingBarChart($$payload, $$props) {
430
428
  $$payload.out += `<svg${$.attr("width", width)}${$.attr("height", height)}${$.attr("viewBox", `0 0 ${$.stringify(width)} ${$.stringify(height)}`)} style="overflow: visible; display: block;"><g class="balance-chart"><!--[-->`;
431
429
  for (let $$index = 0, $$length = each_array.length; $$index < $$length; $$index++) {
432
430
  let i = each_array[$$index];
433
- $$payload.out += `<rect${$.attr("x", Math.min(xScale(0), xScale(X[i])))}${$.attr("y", yScale(Y[i]))}${$.attr("fill", colors2[X[i] > 0 ? colors2.length - 1 : 0])}${$.attr("width", Math.abs(xScale(X[i]) - xScale(0)))}${$.attr("height", yScale.bandwidth())}></rect><text${$.attr("x", xScale(X[i]) + Math.sign(X[i] - 0) * 4)}${$.attr("y", yScale(Y[i]) + yScale.bandwidth() / 2)} dy="0.35em"${$.attr("text-anchor", X[i] < 0 ? "end" : "start")}${$.attr_style(`font-family: ${$.stringify(alloFonts)}; font-size: 10px; fill: ${$.stringify(alloColors.css.darkergrey)}; opacity: 0.5;`)}>${$.escape(format(Math.abs(X[i])))}</text>`;
431
+ $$payload.out += `<rect${$.attr("x", Math.min(xScale(0), xScale(X[i])))}${$.attr("y", yScale(Y[i]))}${$.attr("fill", colors[X[i] > 0 ? colors.length - 1 : 0])}${$.attr("width", Math.abs(xScale(X[i]) - xScale(0)))}${$.attr("height", yScale.bandwidth())}></rect><text${$.attr("x", xScale(X[i]) + Math.sign(X[i] - 0) * 4)}${$.attr("y", yScale(Y[i]) + yScale.bandwidth() / 2)} dy="0.35em"${$.attr("text-anchor", X[i] < 0 ? "end" : "start")}${$.attr_style(`font-family: ${$.stringify(alloFonts)}; font-size: 10px; fill: ${$.stringify(alloColors.css.darkergrey)}; opacity: 0.5;`)}>${$.escape(format(Math.abs(X[i])))}</text>`;
434
432
  }
435
433
  $$payload.out += `<!--]--><g class="y-axis"${$.attr("transform", `translate(${$.stringify(xScale(0))}, -12)`)}><!--[-->`;
436
434
  for (let $$index_1 = 0, $$length = each_array_1.length; $$index_1 < $$length; $$index_1++) {
@@ -498,14 +496,11 @@ function Dashboard($$payload, $$props) {
498
496
  showDiamond = true,
499
497
  showWordshift = true,
500
498
  showDivergingBar = true,
501
- showLegend = true,
502
- $$slots,
503
- $$events,
504
- ...restProps
499
+ showLegend = true
505
500
  } = $$props;
506
501
  let max_shift = barData.length > 0 ? Math.max(...barData.map((d) => Math.abs(d.metric))) : 1;
507
502
  let wordshiftXDomain = xDomain || [-max_shift * 1.5, max_shift * 1.5];
508
- $$payload.out += `<div class="allotaxonometer-dashboard" style="position: relative; margin: 0; padding: 0;"><div style="display:flex; flex-wrap: wrap; align-items:center; justify-content: center; row-gap: 50px;"><div style="margin-top:20px"><div style="display:flex; gap: 10em; justify-content: center; margin-bottom: -70px; margin-right: 70px; position: relative;"><div style="position: relative;"><div${$.attr_style(`font-family: ${$.stringify(alloFonts)}; font-size: 16px; color: ${$.stringify(alloColors.css.superdarkgrey)};`)}>${$.escape(title[0])}</div> <div${$.attr_style(`position: absolute; top: 100%; left: -12em; margin-top: 2.5em; font-family: ${$.stringify(alloFonts)}; font-size: 14px; color: ${$.stringify(alloColors.css.darkgrey)};`)}>${$.escape(instrumentText)}</div> <div${$.attr_style(`position: absolute; top: 100%; left: -12em; margin-top: 3.5em; font-family: ${$.stringify(alloFonts)}; font-size: 14px; color: ${$.stringify(alloColors.css.darkgrey)};`)}>α = ${$.escape(alpha)}</div></div> <div${$.attr_style(`font-family: ${$.stringify(alloFonts)}; font-size: 16px; color: ${$.stringify(alloColors.css.superdarkgrey)};`)}>${$.escape(title[1])}</div></div> <div id="diamondplot">`;
503
+ $$payload.out += `<div id="allotaxonometer-dashboard" style="position: relative; margin: 0; padding: 0;"><div style="display:flex; flex-wrap: wrap; align-items:center; justify-content: center; row-gap: 50px;"><div id="diamond-group" style="margin-top:20px; margin-right: -50px;"><div style="display:flex; gap: 10em; justify-content: center; margin-bottom: -70px; margin-right: 70px; position: relative;"><div style="position: relative;"><div${$.attr_style(`font-family: ${$.stringify(alloFonts)}; font-size: 16px; color: ${$.stringify(alloColors.css.superdarkgrey)};`)}>${$.escape(title[0])}</div> <div${$.attr_style(`position: absolute; top: 100%; left: -8em; margin-top: 3em; font-family: ${$.stringify(alloFonts)}; font-size: 14px; color: ${$.stringify(alloColors.css.darkgrey)}; width: 150px; line-height: 1;`)}><div style="margin-bottom: 0.5em;">${$.escape(instrumentText)}</div> <div>α = ${$.escape(alpha)}</div></div></div> <div${$.attr_style(`font-family: ${$.stringify(alloFonts)}; font-size: 16px; color: ${$.stringify(alloColors.css.superdarkgrey)};`)}>${$.escape(title[1])}</div></div> <div id="diamondplot">`;
509
504
  Diamond($$payload, {
510
505
  dat,
511
506
  alpha,
@@ -530,7 +525,7 @@ function Dashboard($$payload, $$props) {
530
525
  barData,
531
526
  xDomain: wordshiftXDomain,
532
527
  width: 640,
533
- marginLeft: 140
528
+ marginLeft: 110
534
529
  });
535
530
  $$payload.out += `<!----></div></div></div></div>`;
536
531
  $.pop();
package/dist/style.css CHANGED
@@ -18,10 +18,10 @@
18
18
  --allo-superdarkgrey: rgb(26, 26, 26);
19
19
  --allo-reallyverdarkgrey: rgb(13, 13, 13);
20
20
  --allo-orange: rgb(255, 116, 0);
21
-
21
+
22
22
  /* Typography */
23
- --allo-font-family: "EB Garamond", "Garamond", "Century Schoolbook L", "URW Bookman L", "Bookman Old Style", "Times", serif;
24
-
23
+ --allo-font-family: '"EB Garamond", "Garamond", "Century Schoolbook L", "URW Bookman L", "Bookman Old Style", "Times", serif';
24
+
25
25
  /* Font sizes */
26
26
  --allo-font-xs: 10px;
27
27
  --allo-font-sm: 12px;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "allotaxonometer-ui",
3
- "version": "0.1.4",
3
+ "version": "0.1.6",
4
4
  "description": "Headless UI components for allotaxonometer visualizations built with Svelte 5",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -39,7 +39,6 @@
39
39
  },
40
40
  "peerDependencies": {
41
41
  "@ungap/structured-clone": "1.3.0",
42
- "allotaxonometer": "1.1.11",
43
42
  "d3": "^7.0.0",
44
43
  "svelte": "^5.0.0"
45
44
  },