@texturehq/edges 1.3.0 → 1.4.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/dist/components.manifest.json +2 -2
- package/dist/generated/tailwind-tokens-dark.css +120 -87
- package/dist/generated/tailwind-tokens-light.css +117 -87
- package/dist/generated/viz-runtime.css +193 -0
- package/dist/index.cjs +7 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +7 -7
- package/dist/index.js.map +1 -1
- package/dist/{server-iqeQRrwF.d.cts → server-Utz6Sv9w.d.cts} +6 -6
- package/dist/{server-iqeQRrwF.d.ts → server-Utz6Sv9w.d.ts} +6 -6
- package/dist/server.cjs +2 -2
- package/dist/server.cjs.map +1 -1
- package/dist/server.d.cts +1 -1
- package/dist/server.d.ts +1 -1
- package/dist/server.js +2 -2
- package/dist/server.js.map +1 -1
- package/dist/styles.css +308 -88
- package/dist/theme.css +6 -0
- package/dist/utilities.manifest.json +189 -14
- package/package.json +1 -1
- package/scripts/copy-assets.js +1 -0
- package/scripts/generate-viz-runtime.js +95 -0
|
@@ -1,10 +1,36 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "1.
|
|
3
|
-
"generatedAt": "2025-10-
|
|
2
|
+
"version": "1.4.0",
|
|
3
|
+
"generatedAt": "2025-10-09T18:20:15.870Z",
|
|
4
4
|
"categories": {
|
|
5
5
|
"hooks": {
|
|
6
6
|
"description": "React hooks for common functionality like debouncing, local storage, and time controls",
|
|
7
7
|
"utilities": [
|
|
8
|
+
{
|
|
9
|
+
"name": "Breakpoint",
|
|
10
|
+
"type": "type",
|
|
11
|
+
"description": "",
|
|
12
|
+
"example": null,
|
|
13
|
+
"category": "hooks",
|
|
14
|
+
"file": "hooks/useBreakpoint.ts"
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"name": "BREAKPOINTS",
|
|
18
|
+
"type": "constant",
|
|
19
|
+
"description": "Tailwind CSS default breakpoints These match the standard Tailwind breakpoints used in your CSS",
|
|
20
|
+
"params": [],
|
|
21
|
+
"returns": null,
|
|
22
|
+
"example": null,
|
|
23
|
+
"category": "hooks",
|
|
24
|
+
"file": "hooks/useBreakpoint.ts"
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
"name": "BreakpointState",
|
|
28
|
+
"type": "type",
|
|
29
|
+
"description": "",
|
|
30
|
+
"example": null,
|
|
31
|
+
"category": "hooks",
|
|
32
|
+
"file": "hooks/useBreakpoint.ts"
|
|
33
|
+
},
|
|
8
34
|
{
|
|
9
35
|
"name": "handleChartExport",
|
|
10
36
|
"type": "function",
|
|
@@ -23,6 +49,33 @@
|
|
|
23
49
|
"category": "hooks",
|
|
24
50
|
"file": "hooks/useTimeControls.ts"
|
|
25
51
|
},
|
|
52
|
+
{
|
|
53
|
+
"name": "useBreakpoint",
|
|
54
|
+
"type": "function",
|
|
55
|
+
"description": "Hook to detect which Tailwind breakpoint is currently active Returns an object with boolean flags for each breakpoint and convenience helpers. All breakpoints use min-width queries to match Tailwind's mobile-first approach. ```tsx const { isMobile, isDesktop, current } = useBreakpoint(); // Conditional rendering based on screen size return isMobile ? <MobileNav /> : <DesktopNav />; // Check specific breakpoint if (isLg) { // Show expanded view on large screens } // Use current breakpoint console.log(`Current breakpoint: ${current}`); // \"md\", \"lg\", etc. ```",
|
|
56
|
+
"params": [
|
|
57
|
+
{
|
|
58
|
+
"name": "defaultBreakpoint",
|
|
59
|
+
"type": "unknown",
|
|
60
|
+
"description": "The breakpoint to assume during SSR or before first render (defaults to \"base\" for mobile-first)"
|
|
61
|
+
}
|
|
62
|
+
],
|
|
63
|
+
"returns": {
|
|
64
|
+
"type": "unknown",
|
|
65
|
+
"description": "An object containing breakpoint state information"
|
|
66
|
+
},
|
|
67
|
+
"example": "const { isMobile, isDesktop, current } = useBreakpoint();\n\n// Conditional rendering based on screen size\nreturn isMobile ? <MobileNav /> : <DesktopNav />;\n\n// Check specific breakpoint\nif (isLg) {\n // Show expanded view on large screens\n}\n\n// Use current breakpoint\nconsole.log(`Current breakpoint: ${current}`); // \"md\", \"lg\", etc.",
|
|
68
|
+
"category": "hooks",
|
|
69
|
+
"file": "hooks/useBreakpoint.ts"
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
"name": "UseBreakpointReturn",
|
|
73
|
+
"type": "type",
|
|
74
|
+
"description": "Public return type alias for useBreakpoint hook Provides a stable public API for barrel re-exports",
|
|
75
|
+
"example": null,
|
|
76
|
+
"category": "hooks",
|
|
77
|
+
"file": "hooks/useBreakpoint.ts"
|
|
78
|
+
},
|
|
26
79
|
{
|
|
27
80
|
"name": "useDebounce",
|
|
28
81
|
"type": "function",
|
|
@@ -57,6 +110,30 @@
|
|
|
57
110
|
"category": "hooks",
|
|
58
111
|
"file": "hooks/useLocalStorage.ts"
|
|
59
112
|
},
|
|
113
|
+
{
|
|
114
|
+
"name": "useMediaQuery",
|
|
115
|
+
"type": "function",
|
|
116
|
+
"description": "Hook to check if a media query matches the current viewport ```tsx const isMobile = useMediaQuery('(max-width: 767px)'); const prefersReducedMotion = useMediaQuery('(prefers-reduced-motion: reduce)'); const isLandscape = useMediaQuery('(orientation: landscape)'); ```",
|
|
117
|
+
"params": [
|
|
118
|
+
{
|
|
119
|
+
"name": "query",
|
|
120
|
+
"type": "unknown",
|
|
121
|
+
"description": "A CSS media query string (e.g., \"(min-width: 768px)\")"
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
"name": "defaultValue",
|
|
125
|
+
"type": "unknown",
|
|
126
|
+
"description": "The default value to return during SSR or before the first render"
|
|
127
|
+
}
|
|
128
|
+
],
|
|
129
|
+
"returns": {
|
|
130
|
+
"type": "unknown",
|
|
131
|
+
"description": "A boolean indicating whether the media query matches"
|
|
132
|
+
},
|
|
133
|
+
"example": "const isMobile = useMediaQuery('(max-width: 767px)');\nconst prefersReducedMotion = useMediaQuery('(prefers-reduced-motion: reduce)');\nconst isLandscape = useMediaQuery('(orientation: landscape)');",
|
|
134
|
+
"category": "hooks",
|
|
135
|
+
"file": "hooks/useMediaQuery.ts"
|
|
136
|
+
},
|
|
60
137
|
{
|
|
61
138
|
"name": "useTimeControls",
|
|
62
139
|
"type": "function",
|
|
@@ -1776,6 +1853,26 @@
|
|
|
1776
1853
|
"colors": {
|
|
1777
1854
|
"description": "Color management utilities for theme-aware color resolution, contrast calculation, and palette generation",
|
|
1778
1855
|
"utilities": [
|
|
1856
|
+
{
|
|
1857
|
+
"name": "calculateBounds",
|
|
1858
|
+
"type": "constant",
|
|
1859
|
+
"description": "Calculate min and max bounds from numeric values",
|
|
1860
|
+
"params": [],
|
|
1861
|
+
"returns": null,
|
|
1862
|
+
"example": null,
|
|
1863
|
+
"category": "colors",
|
|
1864
|
+
"file": "utils/colors.ts"
|
|
1865
|
+
},
|
|
1866
|
+
{
|
|
1867
|
+
"name": "calculateCenter",
|
|
1868
|
+
"type": "constant",
|
|
1869
|
+
"description": "Calculate center point for diverging palettes",
|
|
1870
|
+
"params": [],
|
|
1871
|
+
"returns": null,
|
|
1872
|
+
"example": null,
|
|
1873
|
+
"category": "colors",
|
|
1874
|
+
"file": "utils/colors.ts"
|
|
1875
|
+
},
|
|
1779
1876
|
{
|
|
1780
1877
|
"name": "clearColorCache",
|
|
1781
1878
|
"type": "function",
|
|
@@ -1796,6 +1893,16 @@
|
|
|
1796
1893
|
"category": "colors",
|
|
1797
1894
|
"file": "utils/colors.ts"
|
|
1798
1895
|
},
|
|
1896
|
+
{
|
|
1897
|
+
"name": "createCategoricalMapping",
|
|
1898
|
+
"type": "constant",
|
|
1899
|
+
"description": "Creates a categorical color mapping for use with vector layers or explicit mappings This is a helper for cases where categorical auto-assignment doesn't work: - Vector tile layers (data not accessible at render time) - URL-based GeoJSON layers - Custom pin layers // Vector layer with categorical coloring layer.vector({ tileset: \"mapbox://my-tileset\", sourceLayer: \"buildings\", style: { color: createCategoricalMapping(\"type\", [\"residential\", \"commercial\", \"industrial\"]) } }) // With custom colors for specific values const mapping = createCategoricalMapping(\"status\", [\"active\", \"pending\", \"inactive\"]); // Then override specific colors if needed: mapping.mapping.inactive = { hex: \"#cccccc\" };",
|
|
1900
|
+
"params": [],
|
|
1901
|
+
"returns": null,
|
|
1902
|
+
"example": "// Vector layer with categorical coloring\nlayer.vector({\n tileset: \"mapbox://my-tileset\",\n sourceLayer: \"buildings\",\n style: {\n color: createCategoricalMapping(\"type\", [\"residential\", \"commercial\", \"industrial\"])\n }\n})",
|
|
1903
|
+
"category": "colors",
|
|
1904
|
+
"file": "utils/colors.ts"
|
|
1905
|
+
},
|
|
1799
1906
|
{
|
|
1800
1907
|
"name": "createCategoryColorMap",
|
|
1801
1908
|
"type": "constant",
|
|
@@ -1816,6 +1923,46 @@
|
|
|
1816
1923
|
"category": "colors",
|
|
1817
1924
|
"file": "utils/colors.ts"
|
|
1818
1925
|
},
|
|
1926
|
+
{
|
|
1927
|
+
"name": "createDivergingMapping",
|
|
1928
|
+
"type": "constant",
|
|
1929
|
+
"description": "Creates a diverging color mapping for vector layers or manual bounds Use this helper when categorical auto-assignment doesn't work: - Vector tile layers (data not accessible at render time) - URL-based GeoJSON layers - When you want consistent colors across multiple maps // Vector layer with diverging coloring layer.vector({ tileset: \"mapbox://my-tileset\", sourceLayer: \"temperature\", style: { color: createDivergingMapping(\"temp_anomaly\", { min: -10, max: 10 }, 0, \"orangeYellowSeafoam\") } })",
|
|
1930
|
+
"params": [],
|
|
1931
|
+
"returns": null,
|
|
1932
|
+
"example": "// Vector layer with diverging coloring\nlayer.vector({\n tileset: \"mapbox://my-tileset\",\n sourceLayer: \"temperature\",\n style: {\n color: createDivergingMapping(\"temp_anomaly\", { min: -10, max: 10 }, 0, \"orangeYellowSeafoam\")\n }\n})",
|
|
1933
|
+
"category": "colors",
|
|
1934
|
+
"file": "utils/colors.ts"
|
|
1935
|
+
},
|
|
1936
|
+
{
|
|
1937
|
+
"name": "createSequentialMapping",
|
|
1938
|
+
"type": "constant",
|
|
1939
|
+
"description": "Creates a sequential color mapping for vector layers or manual bounds Use this helper when categorical auto-assignment doesn't work: - Vector tile layers (data not accessible at render time) - URL-based GeoJSON layers - When you want consistent colors across multiple maps // Vector layer with sequential coloring layer.vector({ tileset: \"mapbox://my-tileset\", sourceLayer: \"population\", style: { color: createSequentialMapping(\"density\", { min: 0, max: 100000 }, \"magma\") } })",
|
|
1940
|
+
"params": [],
|
|
1941
|
+
"returns": null,
|
|
1942
|
+
"example": "// Vector layer with sequential coloring\nlayer.vector({\n tileset: \"mapbox://my-tileset\",\n sourceLayer: \"population\",\n style: {\n color: createSequentialMapping(\"density\", { min: 0, max: 100000 }, \"magma\")\n }\n})",
|
|
1943
|
+
"category": "colors",
|
|
1944
|
+
"file": "utils/colors.ts"
|
|
1945
|
+
},
|
|
1946
|
+
{
|
|
1947
|
+
"name": "extractNumericValues",
|
|
1948
|
+
"type": "constant",
|
|
1949
|
+
"description": "Extract numeric values from GeoJSON data for sequential/diverging palettes",
|
|
1950
|
+
"params": [],
|
|
1951
|
+
"returns": null,
|
|
1952
|
+
"example": null,
|
|
1953
|
+
"category": "colors",
|
|
1954
|
+
"file": "utils/colors.ts"
|
|
1955
|
+
},
|
|
1956
|
+
{
|
|
1957
|
+
"name": "extractUniqueValues",
|
|
1958
|
+
"type": "constant",
|
|
1959
|
+
"description": "Extracts unique values for a given property from GeoJSON FeatureCollection",
|
|
1960
|
+
"params": [],
|
|
1961
|
+
"returns": null,
|
|
1962
|
+
"example": null,
|
|
1963
|
+
"category": "colors",
|
|
1964
|
+
"file": "utils/colors.ts"
|
|
1965
|
+
},
|
|
1819
1966
|
{
|
|
1820
1967
|
"name": "getContrastingTextColor",
|
|
1821
1968
|
"type": "function",
|
|
@@ -1848,10 +1995,19 @@
|
|
|
1848
1995
|
},
|
|
1849
1996
|
{
|
|
1850
1997
|
"name": "getDivergingColors",
|
|
1851
|
-
"type": "
|
|
1852
|
-
"description": "
|
|
1853
|
-
"params": [
|
|
1854
|
-
|
|
1998
|
+
"type": "function",
|
|
1999
|
+
"description": "Get colors for a specific diverging palette",
|
|
2000
|
+
"params": [
|
|
2001
|
+
{
|
|
2002
|
+
"name": "scheme",
|
|
2003
|
+
"type": "unknown",
|
|
2004
|
+
"description": "Diverging palette name (defaults to \"redYellowBlue\")"
|
|
2005
|
+
}
|
|
2006
|
+
],
|
|
2007
|
+
"returns": {
|
|
2008
|
+
"type": "unknown",
|
|
2009
|
+
"description": "Array of 10 hex color strings (color 5 is the center)"
|
|
2010
|
+
},
|
|
1855
2011
|
"example": null,
|
|
1856
2012
|
"category": "colors",
|
|
1857
2013
|
"file": "utils/colors.ts"
|
|
@@ -1859,7 +2015,7 @@
|
|
|
1859
2015
|
{
|
|
1860
2016
|
"name": "getResolvedColor",
|
|
1861
2017
|
"type": "constant",
|
|
1862
|
-
"description": "Resolves a CSS variable to its computed color value Supports
|
|
2018
|
+
"description": "Resolves a CSS variable to its computed color value Supports multiple formats and automatically adds the color- prefix if needed - \"brand-primary\" → resolves to --color-brand-primary - \"color-brand-primary\" → resolves to --color-brand-primary - \"--color-brand-primary\" → used as-is - \"var(--color-brand-primary)\" → unwrapped and used",
|
|
1863
2019
|
"params": [],
|
|
1864
2020
|
"returns": null,
|
|
1865
2021
|
"example": null,
|
|
@@ -1868,10 +2024,19 @@
|
|
|
1868
2024
|
},
|
|
1869
2025
|
{
|
|
1870
2026
|
"name": "getSequentialColors",
|
|
1871
|
-
"type": "
|
|
1872
|
-
"description": "
|
|
1873
|
-
"params": [
|
|
1874
|
-
|
|
2027
|
+
"type": "function",
|
|
2028
|
+
"description": "Get colors for a specific sequential palette",
|
|
2029
|
+
"params": [
|
|
2030
|
+
{
|
|
2031
|
+
"name": "scheme",
|
|
2032
|
+
"type": "unknown",
|
|
2033
|
+
"description": "Sequential palette name (defaults to \"viridis\")"
|
|
2034
|
+
}
|
|
2035
|
+
],
|
|
2036
|
+
"returns": {
|
|
2037
|
+
"type": "unknown",
|
|
2038
|
+
"description": "Array of 10 hex color strings"
|
|
2039
|
+
},
|
|
1875
2040
|
"example": null,
|
|
1876
2041
|
"category": "colors",
|
|
1877
2042
|
"file": "utils/colors.ts"
|
|
@@ -1895,6 +2060,16 @@
|
|
|
1895
2060
|
"example": null,
|
|
1896
2061
|
"category": "colors",
|
|
1897
2062
|
"file": "utils/colors.ts"
|
|
2063
|
+
},
|
|
2064
|
+
{
|
|
2065
|
+
"name": "mapValuesToCategoricalColors",
|
|
2066
|
+
"type": "constant",
|
|
2067
|
+
"description": "Maps unique values to categorical colors with looping",
|
|
2068
|
+
"params": [],
|
|
2069
|
+
"returns": null,
|
|
2070
|
+
"example": null,
|
|
2071
|
+
"category": "colors",
|
|
2072
|
+
"file": "utils/colors.ts"
|
|
1898
2073
|
}
|
|
1899
2074
|
]
|
|
1900
2075
|
},
|
|
@@ -1935,12 +2110,12 @@
|
|
|
1935
2110
|
}
|
|
1936
2111
|
},
|
|
1937
2112
|
"summary": {
|
|
1938
|
-
"totalUtilities":
|
|
2113
|
+
"totalUtilities": 207,
|
|
1939
2114
|
"totalCategories": 5,
|
|
1940
2115
|
"categories": [
|
|
1941
2116
|
{
|
|
1942
2117
|
"name": "hooks",
|
|
1943
|
-
"count":
|
|
2118
|
+
"count": 11
|
|
1944
2119
|
},
|
|
1945
2120
|
{
|
|
1946
2121
|
"name": "formatting",
|
|
@@ -1952,7 +2127,7 @@
|
|
|
1952
2127
|
},
|
|
1953
2128
|
{
|
|
1954
2129
|
"name": "colors",
|
|
1955
|
-
"count":
|
|
2130
|
+
"count": 20
|
|
1956
2131
|
},
|
|
1957
2132
|
{
|
|
1958
2133
|
"name": "general",
|
package/package.json
CHANGED
package/scripts/copy-assets.js
CHANGED
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generate viz-runtime.css from Style Dictionary output
|
|
3
|
+
*
|
|
4
|
+
* WORKAROUND: Tailwind 4's @theme directive filters out viz color variables,
|
|
5
|
+
* so we extract them and create a separate runtime file with plain :root and
|
|
6
|
+
* .theme-dark blocks.
|
|
7
|
+
*
|
|
8
|
+
* This script should run after Style Dictionary generates the token files.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import fs from "fs";
|
|
12
|
+
import path from "path";
|
|
13
|
+
|
|
14
|
+
const GENERATED_DIR = "src/generated";
|
|
15
|
+
const LIGHT_TOKENS = path.join(GENERATED_DIR, "tailwind-tokens-light.css");
|
|
16
|
+
const DARK_TOKENS = path.join(GENERATED_DIR, "tailwind-tokens-dark.css");
|
|
17
|
+
const OUTPUT_FILE = path.join(GENERATED_DIR, "viz-runtime.css");
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Extract viz color variables from a CSS file
|
|
21
|
+
*/
|
|
22
|
+
function extractVizColors(cssContent) {
|
|
23
|
+
const vizColorRegex = /^\s*(--color-viz-[^:]+:\s*[^;]+;)\s*$/gm;
|
|
24
|
+
const matches = [];
|
|
25
|
+
let match;
|
|
26
|
+
|
|
27
|
+
while ((match = vizColorRegex.exec(cssContent)) !== null) {
|
|
28
|
+
matches.push(match[1]);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
return matches;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Generate the viz-runtime.css file
|
|
36
|
+
*/
|
|
37
|
+
function generateVizRuntime() {
|
|
38
|
+
console.log("🎨 Generating viz-runtime.css...");
|
|
39
|
+
|
|
40
|
+
// Read token files
|
|
41
|
+
const lightContent = fs.readFileSync(LIGHT_TOKENS, "utf8");
|
|
42
|
+
const darkContent = fs.readFileSync(DARK_TOKENS, "utf8");
|
|
43
|
+
|
|
44
|
+
// Extract viz colors
|
|
45
|
+
const lightVizColors = extractVizColors(lightContent);
|
|
46
|
+
const darkVizColors = extractVizColors(darkContent);
|
|
47
|
+
|
|
48
|
+
if (lightVizColors.length === 0) {
|
|
49
|
+
console.warn("⚠️ No viz colors found in light theme tokens");
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
if (darkVizColors.length === 0) {
|
|
53
|
+
console.warn("⚠️ No viz colors found in dark theme tokens");
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
// Generate output
|
|
57
|
+
const output = `/**
|
|
58
|
+
* Data Visualization Color Palette - Runtime Override
|
|
59
|
+
*
|
|
60
|
+
* WORKAROUND: These variables are defined here instead of in tailwind-tokens-*.css
|
|
61
|
+
* because Tailwind 4's @theme directive filters them out (similar issue as data-* prefix).
|
|
62
|
+
*
|
|
63
|
+
* AUTO-GENERATED by scripts/generate-viz-runtime.js
|
|
64
|
+
* DO NOT EDIT MANUALLY - Edit tokens/base/data-visualization.json instead.
|
|
65
|
+
*
|
|
66
|
+
* To customize dark mode viz colors, edit the "viz" section in tokens/themes/dark.json
|
|
67
|
+
*/
|
|
68
|
+
|
|
69
|
+
/* Light theme (default) */
|
|
70
|
+
:root {
|
|
71
|
+
${lightVizColors.map((color) => ` ${color}`).join("\n")}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/* Dark theme */
|
|
75
|
+
.theme-dark {
|
|
76
|
+
${darkVizColors.map((color) => ` ${color}`).join("\n")}
|
|
77
|
+
}
|
|
78
|
+
`;
|
|
79
|
+
|
|
80
|
+
// Write output
|
|
81
|
+
fs.writeFileSync(OUTPUT_FILE, output, "utf8");
|
|
82
|
+
|
|
83
|
+
console.log(`✅ Generated ${OUTPUT_FILE}`);
|
|
84
|
+
console.log(` - Light theme: ${lightVizColors.length} variables`);
|
|
85
|
+
console.log(` - Dark theme: ${darkVizColors.length} variables`);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
// Run the script
|
|
89
|
+
try {
|
|
90
|
+
generateVizRuntime();
|
|
91
|
+
} catch (error) {
|
|
92
|
+
console.error("❌ Error generating viz-runtime.css:", error);
|
|
93
|
+
process.exit(1);
|
|
94
|
+
}
|
|
95
|
+
|