@niagads/common 0.2.2-alpha.51.sha-7da8bf53 → 0.2.2-alpha.64.sha-e071a3e3

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,18 @@
1
+ @import "@fontsource-variable/inter";
2
+ @import "@fontsource-variable/roboto-mono";
3
+ @import "@fontsource-variable/geist-mono/wght.css";
4
+ @import "@fontsource/lato/300.css";
5
+ @import "@fontsource/lato/400.css";
6
+ @import "@fontsource/lato/700.css";
7
+
8
+ :root {
9
+ --font-inter: "Inter Variable", sans-serif;
10
+ --font-mono: "Roboto Mono Variable", monospace;
11
+ --font-geist-mono: "Geist Mono Variable", monospace;
12
+ --font-lato: "Lato", sans-serif;
13
+
14
+ /* Compatibility with existing styles */
15
+ --font-roboto-mono: var(--font-mono);
16
+ --font-family-mono: var(--font-mono);
17
+ --font-source-sans: var(--font-lato);
18
+ }
@@ -0,0 +1,128 @@
1
+ /* App shell */
2
+ .app-container {
3
+ display: flex;
4
+ flex-direction: column;
5
+ min-height: 100vh;
6
+ background-color: var(--background);
7
+ }
8
+
9
+ /* Area below fixed header */
10
+ .content-container {
11
+ display: flex;
12
+ flex: 1 1 auto;
13
+ min-height: 0;
14
+ padding-top: var(--header-height);
15
+ }
16
+
17
+ /* Main page outlet */
18
+ .main-content {
19
+ flex: 1 1 auto;
20
+ min-width: 0;
21
+ background-color: var(--background);
22
+ }
23
+
24
+ /* Optional utility wrapper for centered pages */
25
+ .content-section-centered,
26
+ .content-section-narrow {
27
+ width: 100%;
28
+ max-width: 1280px;
29
+ margin: 0 auto;
30
+ padding: 1.5rem;
31
+ }
32
+
33
+ @media (min-width: 1640px) {
34
+ .content-section-centered {
35
+ max-width: 1440px;
36
+ }
37
+ }
38
+
39
+ @media (max-width: 768px) {
40
+ .content-section-centered,
41
+ .content-section-narrow {
42
+ padding: 0;
43
+ }
44
+ }
45
+
46
+ /* Generic content helpers */
47
+ .content {
48
+ width: 100%;
49
+ min-width: 0;
50
+ }
51
+
52
+ .content-section {
53
+ margin-top: 0;
54
+ }
55
+
56
+ .content-header {
57
+ display: flex;
58
+ justify-content: space-between;
59
+ align-items: flex-start;
60
+ gap: 1rem;
61
+ margin-bottom: 2rem;
62
+ }
63
+
64
+ .content-title {
65
+ font-size: 2rem;
66
+ font-weight: 700;
67
+ line-height: 1.2;
68
+ color: var(--text-primary);
69
+ }
70
+
71
+ .content-subtitle {
72
+ margin-top: 0.5rem;
73
+ color: var(--text-secondary);
74
+ }
75
+
76
+ /* Page-level helpers */
77
+ .page-container,
78
+ .page-container-capped {
79
+ min-height: calc(100vh - var(--header-height));
80
+ }
81
+
82
+ /* Grid and Spacing Classes */
83
+ .flex {
84
+ display: flex;
85
+ }
86
+ .flex-col {
87
+ flex-direction: column;
88
+ }
89
+ .items-center {
90
+ align-items: center;
91
+ }
92
+ .justify-between {
93
+ justify-content: space-between;
94
+ }
95
+ .justify-center {
96
+ justify-content: center;
97
+ }
98
+ .gap-025 {
99
+ gap: 0.25rem;
100
+ }
101
+ .gap-05 {
102
+ gap: 0.5rem;
103
+ }
104
+ .gap-075 {
105
+ gap: 0.75rem;
106
+ }
107
+ .gap-1 {
108
+ gap: 1rem;
109
+ }
110
+ .gap-15 {
111
+ gap: 1.5rem;
112
+ }
113
+ .gap-2 {
114
+ gap: 2rem;
115
+ }
116
+ .w-full {
117
+ width: 100%;
118
+ }
119
+
120
+ .mb-1 {
121
+ margin-bottom: 1rem;
122
+ }
123
+ .mb-15 {
124
+ margin-bottom: 1.5rem;
125
+ }
126
+ .space-y-15 > * + * {
127
+ margin-top: 1.5rem;
128
+ }
@@ -0,0 +1,154 @@
1
+ .mdx-content {
2
+ color: var(--gray-800);
3
+ line-height: 1.7;
4
+ overflow-wrap: break-word;
5
+ }
6
+
7
+ .mdx-content > * + * {
8
+ margin-block-start: 1rem;
9
+ }
10
+
11
+ .mdx-content :is(h1, h2, h3, h4, h5, h6) {
12
+ color: var(--gray-900);
13
+ /* font-family: var(--font-inter); */
14
+ font-weight: 600;
15
+ line-height: 1.25;
16
+ /* margin-block: 2rem 0.75rem; */
17
+ }
18
+
19
+ /* .mdx-content h1 {
20
+ font-size: 2rem;
21
+ }
22
+
23
+ .mdx-content h2 {
24
+ font-size: 1.5rem;
25
+ } */
26
+
27
+ .mdx-content #on-this-page {
28
+ font-size: 1.125rem;
29
+ margin-block: 1rem 0.375rem;
30
+ }
31
+
32
+ .mdx-content #on-this-page + ul {
33
+ font-size: 0.875rem;
34
+ line-height: 1.4;
35
+ margin-block: 0.25rem 1.25rem;
36
+ padding-inline-start: 1.125rem;
37
+ }
38
+
39
+ .mdx-content #on-this-page + ul li + li {
40
+ margin-block-start: 0.125rem;
41
+ }
42
+
43
+ .mdx-content #on-this-page + ul ul {
44
+ margin-block: 0.125rem 0;
45
+ padding-inline-start: 1rem;
46
+ }
47
+
48
+ .mdx-content h3 {
49
+ /* font-size: 1.25rem; */
50
+ }
51
+
52
+ /* .mdx-content :is(h4, h5, h6) {
53
+ font-size: 1.125rem;
54
+ } */
55
+
56
+ .mdx-content :is(p, ul, ol, blockquote, pre, table, figure) {
57
+ margin-block: 1rem;
58
+ }
59
+
60
+ .mdx-content :is(ul, ol) {
61
+ padding-inline-start: 1.5rem;
62
+ }
63
+
64
+ .mdx-content li + li {
65
+ margin-block-start: 0.375rem;
66
+ }
67
+
68
+ .mdx-content a {
69
+ color: var(--primary-blue);
70
+ text-decoration: underline;
71
+ text-underline-offset: 0.15em;
72
+ }
73
+
74
+ .mdx-content a:hover {
75
+ color: var(--accent-teal);
76
+ }
77
+
78
+ .mdx-content a:focus-visible {
79
+ outline: 2px solid var(--secondary-blue);
80
+ outline-offset: 2px;
81
+ }
82
+
83
+ .mdx-content blockquote {
84
+ border-inline-start: 3px solid var(--accent-teal);
85
+ color: var(--gray-700);
86
+ padding: 0.25rem 0 0.25rem 1rem;
87
+ }
88
+
89
+ .mdx-content :not(pre) > code {
90
+ background: var(--gray-100);
91
+ border: 1px solid var(--gray-200);
92
+ border-radius: var(--border-radius-sm);
93
+ font-family: var(--font-roboto-mono);
94
+ font-size: 0.9em;
95
+ padding: 0.1em 0.35em;
96
+ }
97
+
98
+ .mdx-content pre {
99
+ background: var(--gray-900);
100
+ border-radius: var(--border-radius-sm);
101
+ color: var(--white);
102
+ overflow-x: auto;
103
+ padding: 1rem;
104
+ }
105
+
106
+ .mdx-content pre code {
107
+ font-family: var(--font-roboto-mono);
108
+ white-space: pre;
109
+ }
110
+
111
+ .mdx-content hr {
112
+ border: 0;
113
+ border-block-start: 1px solid var(--gray-300);
114
+ margin-block: 2rem;
115
+ }
116
+
117
+ .mdx-content :is(img, video, iframe) {
118
+ height: auto;
119
+ max-width: 100%;
120
+ }
121
+
122
+ .mdx-content figure {
123
+ margin-inline: 0;
124
+ }
125
+
126
+ .mdx-content figcaption {
127
+ color: var(--gray-600);
128
+ font-size: 0.875rem;
129
+ margin-block-start: 0.5rem;
130
+ }
131
+
132
+ .mdx-content table {
133
+ border-collapse: collapse;
134
+ display: block;
135
+ max-width: 100%;
136
+ overflow-x: auto;
137
+ width: max-content;
138
+ }
139
+
140
+ .mdx-content :is(th, td) {
141
+ border: 1px solid var(--gray-300);
142
+ padding: 0.5rem 0.75rem;
143
+ text-align: start;
144
+ }
145
+
146
+ .mdx-content th {
147
+ background: var(--gray-100);
148
+ font-weight: 600;
149
+ }
150
+
151
+ .mdx-content sup,
152
+ .mdx-content sub {
153
+ line-height: 0;
154
+ }
@@ -1,9 +1,9 @@
1
1
  .json {
2
- margin: 0.75rem; /* Tailwind m-3 */
2
+ margin: 0.75rem;
3
3
  }
4
4
 
5
5
  .string {
6
- color: #065f46; /* Tailwind text-green-800 */
6
+ color: #065f46;
7
7
  }
8
8
 
9
9
  .number {
@@ -15,33 +15,9 @@
15
15
  }
16
16
 
17
17
  .null {
18
- color: #374151; /* Tailwind text-gray-700 */
18
+ color: #374151;
19
19
  }
20
20
 
21
21
  .key {
22
- color: #b45309; /* Tailwind text-yellow-700 */
22
+ color: #b45309;
23
23
  }
24
-
25
- /* .json {
26
- @apply m-3
27
- }
28
-
29
- .string {
30
- @apply text-green-800
31
- }
32
-
33
- .number {
34
- color: darkorange;
35
- }
36
-
37
- .boolean {
38
- color: blue;
39
- }
40
-
41
- .null {
42
- @apply text-gray-700
43
- }
44
-
45
- .key {
46
- @apply text-yellow-700
47
- } */
@@ -52,6 +52,8 @@
52
52
  --border-radius-sm: 4px;
53
53
  --border-radius-lg: 12px;
54
54
 
55
+ --header-height: 4rem;
56
+
55
57
  /* Shadows */
56
58
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
57
59
  --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
@@ -64,10 +66,19 @@
64
66
  --transition-slow: 350ms cubic-bezier(0.4, 0, 0.2, 1);
65
67
  }
66
68
 
69
+ html,
70
+ body {
71
+ font-family: var(--font-inter);
72
+ }
73
+
67
74
  /* Links */
68
75
  a {
69
76
  color: var(--secondary-blue);
70
- /* text-decoration: none; */
77
+ text-decoration: none;
78
+ }
79
+
80
+ a:hover {
81
+ text-decoration: underline;
71
82
  }
72
83
 
73
84
  /* Focus management */
@@ -36,6 +36,10 @@
36
36
  color: var(--error-red);
37
37
  }
38
38
 
39
+ .text-center {
40
+ text-align: center;
41
+ }
42
+
39
43
  .font-normal {
40
44
  font-weight: 400;
41
45
  }
package/dist/colors.js CHANGED
@@ -1,2 +1,2 @@
1
- const r={PuBlRd:["#601A4A","#EE442F","#63ACBE"],RdBlPu:["#EE442F","#601A4A","#63ACBE"],eight_color:["#332288","#117733","#44AA99","#88CCEE","#DDCC77","#CC6677","#AA4499","#882255"]};function o({transform:r,thresholds:o,colors:t}){if(t.length!==o.length+1)throw new Error(`colorscale: colors array must have one more element than thresholds. Got ${o.length} thresholds and ${t.length} colors.`);return e=>{const l=r?r(e):e;for(let r=0;r<o.length;r++)if(l<o[r])return t[r];return t[t.length-1]}}export{r as COLOR_BLIND_FRIENDLY_PALETTES,o as colorscale};
1
+ const r={PuBlRd:["#601A4A","#EE442F","#63ACBE"],RdBlPu:["#EE442F","#601A4A","#63ACBE"],eight_color:["#332288","#117733","#44AA99","#88CCEE","#DDCC77","#CC6677","#AA4499","#882255"]},o=r=>{const o=String(r);let e;if(o.includes("e-")){const r=o.split("e-");parseInt(r[1])>50&&(e=50)}e||(e=-Math.log10(Number(r)));return{backgroundColor:t({thresholds:[.3,3,6,7.3,50],colors:["rgba(60,80,100,1)","rgb(254,220,220)","rgb(252,140,140)","rgb(255,200,120)","rgb(150,230,150)","rgb(150,210,255)"]})(e)}};function t({transform:r,thresholds:o,colors:t}){if(t.length!==o.length+1)throw new Error(`colorscale: colors array must have one more element than thresholds. Got ${o.length} thresholds and ${t.length} colors.`);return e=>{const l=r?r(e):e;for(let r=0;r<o.length;r++)if(l<o[r])return t[r];return t[t.length-1]}}export{r as COLOR_BLIND_FRIENDLY_PALETTES,t as colorscale,o as getPvalueStyle};
2
2
  //# sourceMappingURL=colors.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"colors.js","sources":["../src/colors.tsx"],"sourcesContent":[null],"names":["COLOR_BLIND_FRIENDLY_PALETTES","PuBlRd","RdBlPu","eight_color","colorscale","transform","thresholds","colors","length","Error","value","transformedValue","i"],"mappings":"AAAO,MAAMA,EAAgC,CACzCC,OAAQ,CAAC,UAAW,UAAW,WAC/BC,OAAQ,CAAC,UAAW,UAAW,WAC/BC,YAAa,CAAC,UAAW,UAAW,UAAW,UAAW,UAAW,UAAW,UAAW,YAmDzF,SAAUC,GAAWC,UACvBA,EAASC,WACTA,EAAUC,OACVA,IAMA,GAAIA,EAAOC,SAAWF,EAAWE,OAAS,EACtC,MAAM,IAAIC,MAEF,4EAAOH,EAAWE,yBAAyBD,EAAOC,kBAI9D,OAAQE,IACJ,MAAMC,EAAmBN,EAAYA,EAAUK,GAASA,EACxD,IAAK,IAAIE,EAAI,EAAGA,EAAIN,EAAWE,OAAQI,IACnC,GAAID,EAAmBL,EAAWM,GAC9B,OAAOL,EAAOK,GAGtB,OAAOL,EAAOA,EAAOC,OAAS,GAEtC"}
1
+ {"version":3,"file":"colors.js","sources":["../src/colors.tsx"],"sourcesContent":[null],"names":["COLOR_BLIND_FRIENDLY_PALETTES","PuBlRd","RdBlPu","eight_color","getPvalueStyle","pvalue","strValue","String","neglog10p","includes","parts","split","parseInt","Math","log10","Number","backgroundColor","colorscale","thresholds","colors","scale","transform","length","Error","value","transformedValue","i"],"mappings":"AAAO,MAAMA,EAAgC,CACzCC,OAAQ,CAAC,UAAW,UAAW,WAC/BC,OAAQ,CAAC,UAAW,UAAW,WAC/BC,YAAa,CAAC,UAAW,UAAW,UAAW,UAAW,UAAW,UAAW,UAAW,YAclFC,EAAkBC,IAC3B,MAAMC,EAAWC,OAAOF,GACxB,IAAIG,EACJ,GAAIF,EAASG,SAAS,MAAO,CACzB,MAAMC,EAAQJ,EAASK,MAAM,MACZC,SAASF,EAAM,IACjB,KACXF,EAAY,GAEpB,CACKA,IACDA,GAAaK,KAAKC,MAAMC,OAAOV,KAenC,MAAO,CAAEW,gBAbKC,EAAW,CACrBC,WAAY,CAAC,GAAK,EAAG,EAAG,IAAK,IAC7BC,OAAQ,CACJ,oBACA,mBACA,mBACA,mBACA,mBACA,qBAGeC,CAAMZ,KA2C3B,SAAUS,GAAWI,UACvBA,EAASH,WACTA,EAAUC,OACVA,IAMA,GAAIA,EAAOG,SAAWJ,EAAWI,OAAS,EACtC,MAAM,IAAIC,MAEF,4EAAOL,EAAWI,yBAAyBH,EAAOG,kBAI9D,OAAQE,IACJ,MAAMC,EAAmBJ,EAAYA,EAAUG,GAASA,EACxD,IAAK,IAAIE,EAAI,EAAGA,EAAIR,EAAWI,OAAQI,IACnC,GAAID,EAAmBP,EAAWQ,GAC9B,OAAOP,EAAOO,GAGtB,OAAOP,EAAOA,EAAOG,OAAS,GAEtC"}
@@ -0,0 +1,2 @@
1
+ "use client";import e,{createContext as n,useState as o,useContext as i}from"react";const r=n(void 0);function t({children:n}){const[i,t]=o(!1),[s,a]=o("Loading...");return e.createElement(r.Provider,{value:{isLoading:i,setLoading:e=>{t(e)},loadingMessage:s,setLoadingMessage:a}},n)}function s(){const e=i(r);if(void 0===e)throw new Error("useLoading must be used within a LoadingProvider");return e}export{t as LoadingProvider,s as useLoading};
2
+ //# sourceMappingURL=LoadingProvider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LoadingProvider.js","sources":["../../../src/components/providers/LoadingProvider.tsx"],"sourcesContent":[null],"names":["LoadingContext","createContext","undefined","LoadingProvider","children","isLoading","setIsLoading","useState","loadingMessage","setLoadingMessage","React","Provider","value","setLoading","loading","useLoading","context","useContext","Error"],"mappings":"oFAYA,MAAMA,EAAiBC,OAA8CC,GAE/D,SAAUC,GAAgBC,SAAEA,IAC9B,MAAOC,EAAWC,GAAgBC,GAAS,IACpCC,EAAgBC,GAAqBF,EAAS,cAMrD,OACIG,gBAACV,EAAeW,SAAQ,CAACC,MAAO,CAAEP,YAAWQ,WAL7BC,IAChBR,EAAaQ,IAI4CN,iBAAgBC,sBACpEL,EAGb,UAEgBW,IACZ,MAAMC,EAAUC,EAAWjB,GAC3B,QAAgBE,IAAZc,EACA,MAAM,IAAIE,MAAM,oDAEpB,OAAOF,CACX"}
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import React, { JSX } from 'react';
1
+ import React, { JSX, ReactNode } from 'react';
2
2
  import { NextRequest } from 'next/server';
3
3
 
4
4
  declare const COLOR_BLIND_FRIENDLY_PALETTES: {
@@ -13,6 +13,9 @@ type HEX = `#${string}`;
13
13
  type STANDARD_COLORS = "red" | "blue" | "green" | "gold" | "grey" | "black" | "white";
14
14
  type Color = RGB | RGBA | HSL | HEX | STANDARD_COLORS;
15
15
  type ColorScale = (value: number) => Color;
16
+ declare const getPvalueStyle: (pvalue: number | string) => {
17
+ backgroundColor: Color;
18
+ };
16
19
  declare function colorscale({ transform, thresholds, colors, }: {
17
20
  transform?: (value: number) => number;
18
21
  thresholds: readonly number[];
@@ -90,5 +93,16 @@ declare function userAgentIsBrowser(userAgent: string): boolean;
90
93
  declare function backendFetchFromRequest(request: NextRequest, base: string, asText?: boolean): Promise<any>;
91
94
  declare function backendFetch(pathname: string, base: string | undefined, skipErrorCheck?: boolean): Promise<any>;
92
95
 
93
- export { APIError, COLOR_BLIND_FRIENDLY_PALETTES, _deepCopy, _get, _hasOwnProperty, _isEmpty, _isJSON, _isNA, _isNull, _isObject, backendFetch, backendFetchFromRequest, caseInsensitiveIncludes, colorscale, formatMultiline, getUrlParam, isAPIError, jsonSyntaxHighlight, linkify, negLog10, safeHtml, toExponential, toFixedWithoutZeros, toTitleCase, userAgentIsBrowser };
96
+ interface LoadingContextType {
97
+ isLoading: boolean;
98
+ setLoading: (loading: boolean) => void;
99
+ loadingMessage: string;
100
+ setLoadingMessage: (message: string) => void;
101
+ }
102
+ declare function LoadingProvider({ children }: {
103
+ children: ReactNode;
104
+ }): React.JSX.Element;
105
+ declare function useLoading(): LoadingContextType;
106
+
107
+ export { APIError, COLOR_BLIND_FRIENDLY_PALETTES, LoadingProvider, _deepCopy, _get, _hasOwnProperty, _isEmpty, _isJSON, _isNA, _isNull, _isObject, backendFetch, backendFetchFromRequest, caseInsensitiveIncludes, colorscale, formatMultiline, getPvalueStyle, getUrlParam, isAPIError, jsonSyntaxHighlight, linkify, negLog10, safeHtml, toExponential, toFixedWithoutZeros, toTitleCase, useLoading, userAgentIsBrowser };
94
108
  export type { APIErrorResponse, APIPagination, APIResponse, APIResult, BasicType, Color, ColorScale, Expand, ExpandRecursively, Modify, NAString, Range, TypeMapper };
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
- export{COLOR_BLIND_FRIENDLY_PALETTES,colorscale}from"./colors.js";export{APIError,isAPIError}from"./errors.js";export{safeHtml}from"./formatters.js";export{_deepCopy,_get,_hasOwnProperty,_isEmpty,_isJSON,_isNA,_isNull,_isObject,caseInsensitiveIncludes,formatMultiline,getUrlParam,jsonSyntaxHighlight,linkify,negLog10,toExponential,toFixedWithoutZeros,toTitleCase}from"./utils.js";export{backendFetch,backendFetchFromRequest,userAgentIsBrowser}from"./route-handlers.js";
1
+ export{COLOR_BLIND_FRIENDLY_PALETTES,colorscale,getPvalueStyle}from"./colors.js";export{APIError,isAPIError}from"./errors.js";export{safeHtml}from"./formatters.js";export{_deepCopy,_get,_hasOwnProperty,_isEmpty,_isJSON,_isNA,_isNull,_isObject,caseInsensitiveIncludes,formatMultiline,getUrlParam,jsonSyntaxHighlight,linkify,negLog10,toExponential,toFixedWithoutZeros,toTitleCase}from"./utils.js";export{backendFetch,backendFetchFromRequest,userAgentIsBrowser}from"./route-handlers.js";export{LoadingProvider,useLoading}from"./components/providers/LoadingProvider.js";
2
2
  //# sourceMappingURL=index.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@niagads/common",
3
- "version": "0.2.2-alpha.51.sha-7da8bf53",
3
+ "version": "0.2.2-alpha.64.sha-e071a3e3",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/NIAGADS/niagads-viz-monorepo.git"
@@ -29,6 +29,10 @@
29
29
  "rollup-plugin-postcss": "^4.0.2"
30
30
  },
31
31
  "dependencies": {
32
+ "@fontsource-variable/geist-mono": "^5.2.6",
33
+ "@fontsource-variable/inter": "^5.0.0",
34
+ "@fontsource-variable/roboto-mono": "^5.0.0",
35
+ "@fontsource/lato": "^5.0.0",
32
36
  "tslib": "^2"
33
37
  },
34
38
  "main": "dist/index.js",
@@ -40,5 +44,5 @@
40
44
  "publishConfig": {
41
45
  "access": "public"
42
46
  },
43
- "gitHead": "7da8bf53cc76bcb81870eeb3a19a2311c737fbee"
47
+ "gitHead": "e071a3e36852ef0379ef463a71bb75021bc7c3dd"
44
48
  }