eleventy-plugin-uncharted 0.7.4 → 0.7.5
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/eleventy.config.js +8 -13
- package/package.json +1 -1
- package/src/config.js +0 -5
package/eleventy.config.js
CHANGED
|
@@ -11,7 +11,7 @@ const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
|
11
11
|
* Uncharted - Eleventy CSS Charts Plugin
|
|
12
12
|
* @param {Object} eleventyConfig - Eleventy configuration object
|
|
13
13
|
* @param {Object} [options] - Plugin options
|
|
14
|
-
* @param {string} [options.dataDir] -
|
|
14
|
+
* @param {string} [options.dataDir] - Data directory path relative to root (e.g., '_data/charts'). Defaults to Eleventy's dir.data config.
|
|
15
15
|
* @param {boolean} [options.animate] - Enable animations globally (individual charts can override)
|
|
16
16
|
* @param {string} [options.cssPath] - Output path for stylesheet (default: '/css/uncharted.css')
|
|
17
17
|
* @param {boolean} [options.injectCss] - Automatically copy and inject CSS (default: true)
|
|
@@ -28,14 +28,9 @@ export default function(eleventyConfig, options = {}) {
|
|
|
28
28
|
eleventyDirs = dirs;
|
|
29
29
|
});
|
|
30
30
|
|
|
31
|
-
// Warn if deprecated dataDir option is used
|
|
32
|
-
if (options.dataDir) {
|
|
33
|
-
console.warn('[uncharted] "dataDir" option is deprecated; the plugin now auto-detects from Eleventy\'s dir.data config');
|
|
34
|
-
}
|
|
35
|
-
|
|
36
31
|
// Helper to resolve data directory
|
|
37
32
|
function getDataDir() {
|
|
38
|
-
// Plugin option takes precedence if explicitly set
|
|
33
|
+
// Plugin option takes precedence if explicitly set
|
|
39
34
|
if (options.dataDir) {
|
|
40
35
|
return path.resolve(process.cwd(), options.dataDir);
|
|
41
36
|
}
|
|
@@ -93,13 +88,13 @@ export default function(eleventyConfig, options = {}) {
|
|
|
93
88
|
});
|
|
94
89
|
}
|
|
95
90
|
|
|
96
|
-
// CSV data passthrough for download links
|
|
91
|
+
// CSV data passthrough for download links
|
|
92
|
+
// When dataDir is set explicitly, use it; otherwise use Eleventy's default _data
|
|
97
93
|
if (dataPassthrough) {
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
});
|
|
94
|
+
const dataDirForPassthrough = options.dataDir || '_data';
|
|
95
|
+
const destPath = dataPath.replace(/^\//, '').replace(/\/$/, '');
|
|
96
|
+
eleventyConfig.addPassthroughCopy({
|
|
97
|
+
[dataDirForPassthrough]: destPath
|
|
103
98
|
});
|
|
104
99
|
}
|
|
105
100
|
|
package/package.json
CHANGED
package/src/config.js
CHANGED
|
@@ -68,11 +68,6 @@ export function normalizeConfig(config, chartId = 'unknown') {
|
|
|
68
68
|
// Build y axis config
|
|
69
69
|
normalized.y = buildAxisConfig('y', config, chartId);
|
|
70
70
|
|
|
71
|
-
// Warn for deprecated columns key
|
|
72
|
-
if (config.columns) {
|
|
73
|
-
warnDeprecation(chartId, 'columns', 'x.column / y.columns');
|
|
74
|
-
}
|
|
75
|
-
|
|
76
71
|
// Warn for deprecated legend array (when used for labels, not boolean)
|
|
77
72
|
if (Array.isArray(config.legend)) {
|
|
78
73
|
warnDeprecation(chartId, 'legend (array)', 'y.columns: { key: "Label" }');
|