svelteplot 0.14.0-pr-545.2 → 0.14.0-pr-545.4
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/marks/Density.svelte +13 -2
- package/package.json +1 -1
|
@@ -159,9 +159,17 @@
|
|
|
159
159
|
function isDensityAccessor(v: ChannelAccessor<Datum> | string | undefined): boolean {
|
|
160
160
|
if (v == null) return false;
|
|
161
161
|
if (typeof v === 'function') return true;
|
|
162
|
+
// Descriptor form { value, scale } — recurse into the inner value.
|
|
163
|
+
if (typeof v === 'object' && 'value' in (v as object))
|
|
164
|
+
return isDensityAccessor((v as { value: any }).value);
|
|
162
165
|
if (typeof v !== 'string') return false;
|
|
163
166
|
const lower = v.toLowerCase();
|
|
164
|
-
if (
|
|
167
|
+
if (
|
|
168
|
+
lower === 'none' ||
|
|
169
|
+
lower === 'density' ||
|
|
170
|
+
lower === 'inherit' ||
|
|
171
|
+
lower === 'currentcolor'
|
|
172
|
+
)
|
|
165
173
|
return false;
|
|
166
174
|
return !isColorOrNull(v);
|
|
167
175
|
}
|
|
@@ -183,7 +191,7 @@
|
|
|
183
191
|
const isZGrouped = $derived(zGroupAcc != null);
|
|
184
192
|
|
|
185
193
|
// Resolved static fill/stroke strings (after extracting accessor info)
|
|
186
|
-
const fill = $derived<string>(fillIsAccessor ? 'none' : (rawFill as string) ?? 'none');
|
|
194
|
+
const fill = $derived<string>(fillIsAccessor ? 'none' : ((rawFill as string) ?? 'none'));
|
|
187
195
|
|
|
188
196
|
const fillDensity = $derived(/^density$/i.test(fill ?? ''));
|
|
189
197
|
|
|
@@ -209,6 +217,9 @@
|
|
|
209
217
|
function resolveAcc(acc: ChannelAccessor<any> | undefined | null, d: any): any {
|
|
210
218
|
if (acc == null) return undefined;
|
|
211
219
|
if (typeof acc === 'function') return (acc as (d: any) => any)(d);
|
|
220
|
+
// Descriptor form { value, scale } — resolve the inner value.
|
|
221
|
+
if (typeof acc === 'object' && 'value' in (acc as object))
|
|
222
|
+
return resolveAcc((acc as { value: any }).value, d);
|
|
212
223
|
return (d as any)[acc as string];
|
|
213
224
|
}
|
|
214
225
|
|