@ggts-sh/spec 0.43.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/LICENSE +21 -0
- package/README.md +75 -0
- package/dist/artifact.d.ts +11 -0
- package/dist/artifact.d.ts.map +1 -0
- package/dist/artifact.js +71 -0
- package/dist/artifact.js.map +1 -0
- package/dist/builder-core.d.ts +100 -0
- package/dist/builder-core.d.ts.map +1 -0
- package/dist/builder-core.js +176 -0
- package/dist/builder-core.js.map +1 -0
- package/dist/builder-data.d.ts +36 -0
- package/dist/builder-data.d.ts.map +1 -0
- package/dist/builder-data.js +123 -0
- package/dist/builder-data.js.map +1 -0
- package/dist/builder-geoms.d.ts +128 -0
- package/dist/builder-geoms.d.ts.map +1 -0
- package/dist/builder-geoms.js +221 -0
- package/dist/builder-geoms.js.map +1 -0
- package/dist/builder-options.d.ts +323 -0
- package/dist/builder-options.d.ts.map +1 -0
- package/dist/builder-options.js +2 -0
- package/dist/builder-options.js.map +1 -0
- package/dist/builder-scales.d.ts +160 -0
- package/dist/builder-scales.d.ts.map +1 -0
- package/dist/builder-scales.js +322 -0
- package/dist/builder-scales.js.map +1 -0
- package/dist/builder.d.ts +242 -0
- package/dist/builder.d.ts.map +1 -0
- package/dist/builder.js +42 -0
- package/dist/builder.js.map +1 -0
- package/dist/capabilities-data.d.ts +72 -0
- package/dist/capabilities-data.d.ts.map +1 -0
- package/dist/capabilities-data.js +337 -0
- package/dist/capabilities-data.js.map +1 -0
- package/dist/capabilities-helpers.d.ts +31 -0
- package/dist/capabilities-helpers.d.ts.map +1 -0
- package/dist/capabilities-helpers.js +41 -0
- package/dist/capabilities-helpers.js.map +1 -0
- package/dist/capabilities.d.ts +22 -0
- package/dist/capabilities.d.ts.map +1 -0
- package/dist/capabilities.js +154 -0
- package/dist/capabilities.js.map +1 -0
- package/dist/coord-helpers.d.ts +102 -0
- package/dist/coord-helpers.d.ts.map +1 -0
- package/dist/coord-helpers.js +90 -0
- package/dist/coord-helpers.js.map +1 -0
- package/dist/coord-reference-build.d.ts +50 -0
- package/dist/coord-reference-build.d.ts.map +1 -0
- package/dist/coord-reference-build.js +211 -0
- package/dist/coord-reference-build.js.map +1 -0
- package/dist/coord-reference.d.ts +52 -0
- package/dist/coord-reference.d.ts.map +1 -0
- package/dist/coord-reference.js +27 -0
- package/dist/coord-reference.js.map +1 -0
- package/dist/error-catalog.d.ts +258 -0
- package/dist/error-catalog.d.ts.map +1 -0
- package/dist/error-catalog.js +235 -0
- package/dist/error-catalog.js.map +1 -0
- package/dist/error-prose-shared.d.ts +100 -0
- package/dist/error-prose-shared.d.ts.map +1 -0
- package/dist/error-prose-shared.js +95 -0
- package/dist/error-prose-shared.js.map +1 -0
- package/dist/errors.d.ts +39 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +52 -0
- package/dist/errors.js.map +1 -0
- package/dist/generated/coord-reference-data.d.ts +189 -0
- package/dist/generated/coord-reference-data.d.ts.map +1 -0
- package/dist/generated/coord-reference-data.js +212 -0
- package/dist/generated/coord-reference-data.js.map +1 -0
- package/dist/generated/geom-param-keys.d.ts +58 -0
- package/dist/generated/geom-param-keys.d.ts.map +1 -0
- package/dist/generated/geom-param-keys.js +223 -0
- package/dist/generated/geom-param-keys.js.map +1 -0
- package/dist/generated/geom-reference-data.d.ts +2377 -0
- package/dist/generated/geom-reference-data.d.ts.map +1 -0
- package/dist/generated/geom-reference-data.js +2790 -0
- package/dist/generated/geom-reference-data.js.map +1 -0
- package/dist/generated/guide-reference-data.d.ts +219 -0
- package/dist/generated/guide-reference-data.d.ts.map +1 -0
- package/dist/generated/guide-reference-data.js +253 -0
- package/dist/generated/guide-reference-data.js.map +1 -0
- package/dist/generated/plot-spec-validator.d.ts +2 -0
- package/dist/generated/plot-spec-validator.d.ts.map +1 -0
- package/dist/generated/plot-spec-validator.js +6274 -0
- package/dist/generated/plot-spec-validator.js.map +1 -0
- package/dist/generated/position-reference-data.d.ts +82 -0
- package/dist/generated/position-reference-data.d.ts.map +1 -0
- package/dist/generated/position-reference-data.js +181 -0
- package/dist/generated/position-reference-data.js.map +1 -0
- package/dist/generated/scale-reference-data.d.ts +8366 -0
- package/dist/generated/scale-reference-data.d.ts.map +1 -0
- package/dist/generated/scale-reference-data.js +9821 -0
- package/dist/generated/scale-reference-data.js.map +1 -0
- package/dist/generated/stat-reference-data.d.ts +241 -0
- package/dist/generated/stat-reference-data.d.ts.map +1 -0
- package/dist/generated/stat-reference-data.js +311 -0
- package/dist/generated/stat-reference-data.js.map +1 -0
- package/dist/geom-params-build.d.ts +3 -0
- package/dist/geom-params-build.d.ts.map +1 -0
- package/dist/geom-params-build.js +80 -0
- package/dist/geom-params-build.js.map +1 -0
- package/dist/geom-params.d.ts +13 -0
- package/dist/geom-params.d.ts.map +1 -0
- package/dist/geom-params.js +7 -0
- package/dist/geom-params.js.map +1 -0
- package/dist/geom-reference-build.d.ts +29 -0
- package/dist/geom-reference-build.d.ts.map +1 -0
- package/dist/geom-reference-build.js +221 -0
- package/dist/geom-reference-build.js.map +1 -0
- package/dist/geom-reference.d.ts +52 -0
- package/dist/geom-reference.d.ts.map +1 -0
- package/dist/geom-reference.js +72 -0
- package/dist/geom-reference.js.map +1 -0
- package/dist/guide-helpers.d.ts +20 -0
- package/dist/guide-helpers.d.ts.map +1 -0
- package/dist/guide-helpers.js +25 -0
- package/dist/guide-helpers.js.map +1 -0
- package/dist/guide-reference-build.d.ts +42 -0
- package/dist/guide-reference-build.d.ts.map +1 -0
- package/dist/guide-reference-build.js +180 -0
- package/dist/guide-reference-build.js.map +1 -0
- package/dist/guide-reference.d.ts +48 -0
- package/dist/guide-reference.d.ts.map +1 -0
- package/dist/guide-reference.js +32 -0
- package/dist/guide-reference.js.map +1 -0
- package/dist/hue-grey-palettes.d.ts +15 -0
- package/dist/hue-grey-palettes.d.ts.map +1 -0
- package/dist/hue-grey-palettes.js +77 -0
- package/dist/hue-grey-palettes.js.map +1 -0
- package/dist/index.d.ts +364 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +225 -0
- package/dist/index.js.map +1 -0
- package/dist/lint-catalog.d.ts +47 -0
- package/dist/lint-catalog.d.ts.map +1 -0
- package/dist/lint-catalog.js +39 -0
- package/dist/lint-catalog.js.map +1 -0
- package/dist/lint-layer-rules.d.ts +18 -0
- package/dist/lint-layer-rules.d.ts.map +1 -0
- package/dist/lint-layer-rules.js +145 -0
- package/dist/lint-layer-rules.js.map +1 -0
- package/dist/lint-scale-rules.d.ts +8 -0
- package/dist/lint-scale-rules.d.ts.map +1 -0
- package/dist/lint-scale-rules.js +254 -0
- package/dist/lint-scale-rules.js.map +1 -0
- package/dist/lint.d.ts +62 -0
- package/dist/lint.d.ts.map +1 -0
- package/dist/lint.js +57 -0
- package/dist/lint.js.map +1 -0
- package/dist/normalize-coord.d.ts +8 -0
- package/dist/normalize-coord.d.ts.map +1 -0
- package/dist/normalize-coord.js +123 -0
- package/dist/normalize-coord.js.map +1 -0
- package/dist/normalize-input-layers-marks.d.ts +208 -0
- package/dist/normalize-input-layers-marks.d.ts.map +1 -0
- package/dist/normalize-input-layers-marks.js +2 -0
- package/dist/normalize-input-layers-marks.js.map +1 -0
- package/dist/normalize-input-layers-special.d.ts +131 -0
- package/dist/normalize-input-layers-special.d.ts.map +1 -0
- package/dist/normalize-input-layers-special.js +2 -0
- package/dist/normalize-input-layers-special.js.map +1 -0
- package/dist/normalize-input.d.ts +81 -0
- package/dist/normalize-input.d.ts.map +1 -0
- package/dist/normalize-input.js +2 -0
- package/dist/normalize-input.js.map +1 -0
- package/dist/normalize-paint.d.ts +8 -0
- package/dist/normalize-paint.d.ts.map +1 -0
- package/dist/normalize-paint.js +83 -0
- package/dist/normalize-paint.js.map +1 -0
- package/dist/normalize-scales.d.ts +7 -0
- package/dist/normalize-scales.d.ts.map +1 -0
- package/dist/normalize-scales.js +90 -0
- package/dist/normalize-scales.js.map +1 -0
- package/dist/normalize.d.ts +46 -0
- package/dist/normalize.d.ts.map +1 -0
- package/dist/normalize.js +279 -0
- package/dist/normalize.js.map +1 -0
- package/dist/paint-helpers.d.ts +45 -0
- package/dist/paint-helpers.d.ts.map +1 -0
- package/dist/paint-helpers.js +48 -0
- package/dist/paint-helpers.js.map +1 -0
- package/dist/pipeline-error-catalog.d.ts +319 -0
- package/dist/pipeline-error-catalog.d.ts.map +1 -0
- package/dist/pipeline-error-catalog.js +260 -0
- package/dist/pipeline-error-catalog.js.map +1 -0
- package/dist/portability-check.d.ts +35 -0
- package/dist/portability-check.d.ts.map +1 -0
- package/dist/portability-check.js +121 -0
- package/dist/portability-check.js.map +1 -0
- package/dist/portability-lossy.d.ts +19 -0
- package/dist/portability-lossy.d.ts.map +1 -0
- package/dist/portability-lossy.js +65 -0
- package/dist/portability-lossy.js.map +1 -0
- package/dist/portability.d.ts +23 -0
- package/dist/portability.d.ts.map +1 -0
- package/dist/portability.js +23 -0
- package/dist/portability.js.map +1 -0
- package/dist/portable-builder.d.ts +215 -0
- package/dist/portable-builder.d.ts.map +1 -0
- package/dist/portable-builder.js +27 -0
- package/dist/portable-builder.js.map +1 -0
- package/dist/portable-entry.d.ts +16 -0
- package/dist/portable-entry.d.ts.map +1 -0
- package/dist/portable-entry.js +14 -0
- package/dist/portable-entry.js.map +1 -0
- package/dist/position-reference-build.d.ts +29 -0
- package/dist/position-reference-build.d.ts.map +1 -0
- package/dist/position-reference-build.js +115 -0
- package/dist/position-reference-build.js.map +1 -0
- package/dist/position-reference.d.ts +34 -0
- package/dist/position-reference.d.ts.map +1 -0
- package/dist/position-reference.js +19 -0
- package/dist/position-reference.js.map +1 -0
- package/dist/runtime.d.ts +139 -0
- package/dist/runtime.d.ts.map +1 -0
- package/dist/runtime.js +2 -0
- package/dist/runtime.js.map +1 -0
- package/dist/scale-color-helpers.d.ts +121 -0
- package/dist/scale-color-helpers.d.ts.map +1 -0
- package/dist/scale-color-helpers.js +188 -0
- package/dist/scale-color-helpers.js.map +1 -0
- package/dist/scale-color-hue-grey.d.ts +52 -0
- package/dist/scale-color-hue-grey.d.ts.map +1 -0
- package/dist/scale-color-hue-grey.js +60 -0
- package/dist/scale-color-hue-grey.js.map +1 -0
- package/dist/scale-color-stops.d.ts +85 -0
- package/dist/scale-color-stops.d.ts.map +1 -0
- package/dist/scale-color-stops.js +87 -0
- package/dist/scale-color-stops.js.map +1 -0
- package/dist/scale-color-viridis.d.ts +52 -0
- package/dist/scale-color-viridis.d.ts.map +1 -0
- package/dist/scale-color-viridis.js +68 -0
- package/dist/scale-color-viridis.js.map +1 -0
- package/dist/scale-helpers.d.ts +20 -0
- package/dist/scale-helpers.d.ts.map +1 -0
- package/dist/scale-helpers.js +20 -0
- package/dist/scale-helpers.js.map +1 -0
- package/dist/scale-multi-helpers.d.ts +61 -0
- package/dist/scale-multi-helpers.d.ts.map +1 -0
- package/dist/scale-multi-helpers.js +147 -0
- package/dist/scale-multi-helpers.js.map +1 -0
- package/dist/scale-position-helpers.d.ts +81 -0
- package/dist/scale-position-helpers.d.ts.map +1 -0
- package/dist/scale-position-helpers.js +133 -0
- package/dist/scale-position-helpers.js.map +1 -0
- package/dist/scale-reference-build.d.ts +50 -0
- package/dist/scale-reference-build.d.ts.map +1 -0
- package/dist/scale-reference-build.js +147 -0
- package/dist/scale-reference-build.js.map +1 -0
- package/dist/scale-reference-classify-color.d.ts +11 -0
- package/dist/scale-reference-classify-color.d.ts.map +1 -0
- package/dist/scale-reference-classify-color.js +292 -0
- package/dist/scale-reference-classify-color.js.map +1 -0
- package/dist/scale-reference-classify-position.d.ts +10 -0
- package/dist/scale-reference-classify-position.d.ts.map +1 -0
- package/dist/scale-reference-classify-position.js +137 -0
- package/dist/scale-reference-classify-position.js.map +1 -0
- package/dist/scale-reference-classify-style.d.ts +10 -0
- package/dist/scale-reference-classify-style.d.ts.map +1 -0
- package/dist/scale-reference-classify-style.js +194 -0
- package/dist/scale-reference-classify-style.js.map +1 -0
- package/dist/scale-reference-classify-support.d.ts +37 -0
- package/dist/scale-reference-classify-support.d.ts.map +1 -0
- package/dist/scale-reference-classify-support.js +206 -0
- package/dist/scale-reference-classify-support.js.map +1 -0
- package/dist/scale-reference.d.ts +80 -0
- package/dist/scale-reference.d.ts.map +1 -0
- package/dist/scale-reference.js +85 -0
- package/dist/scale-reference.js.map +1 -0
- package/dist/scale-style-helpers.d.ts +158 -0
- package/dist/scale-style-helpers.d.ts.map +1 -0
- package/dist/scale-style-helpers.js +197 -0
- package/dist/scale-style-helpers.js.map +1 -0
- package/dist/schema-catalog.d.ts +62 -0
- package/dist/schema-catalog.d.ts.map +1 -0
- package/dist/schema-catalog.js +208 -0
- package/dist/schema-catalog.js.map +1 -0
- package/dist/schema-declarations.d.ts +1585 -0
- package/dist/schema-declarations.d.ts.map +1 -0
- package/dist/schema-declarations.js +51 -0
- package/dist/schema-declarations.js.map +1 -0
- package/dist/schema-decls-data.d.ts +58 -0
- package/dist/schema-decls-data.d.ts.map +1 -0
- package/dist/schema-decls-data.js +151 -0
- package/dist/schema-decls-data.js.map +1 -0
- package/dist/schema-decls-guides-theme.d.ts +166 -0
- package/dist/schema-decls-guides-theme.d.ts.map +1 -0
- package/dist/schema-decls-guides-theme.js +251 -0
- package/dist/schema-decls-guides-theme.js.map +1 -0
- package/dist/schema-decls-layers-col-boxplot.d.ts +118 -0
- package/dist/schema-decls-layers-col-boxplot.d.ts.map +1 -0
- package/dist/schema-decls-layers-col-boxplot.js +239 -0
- package/dist/schema-decls-layers-col-boxplot.js.map +1 -0
- package/dist/schema-decls-layers-count-pointrange.d.ts +89 -0
- package/dist/schema-decls-layers-count-pointrange.d.ts.map +1 -0
- package/dist/schema-decls-layers-count-pointrange.js +190 -0
- package/dist/schema-decls-layers-count-pointrange.js.map +1 -0
- package/dist/schema-decls-layers-crossbar-jitter.d.ts +129 -0
- package/dist/schema-decls-layers-crossbar-jitter.d.ts.map +1 -0
- package/dist/schema-decls-layers-crossbar-jitter.js +255 -0
- package/dist/schema-decls-layers-crossbar-jitter.js.map +1 -0
- package/dist/schema-decls-layers-point-path.d.ts +49 -0
- package/dist/schema-decls-layers-point-path.d.ts.map +1 -0
- package/dist/schema-decls-layers-point-path.js +156 -0
- package/dist/schema-decls-layers-point-path.js.map +1 -0
- package/dist/schema-decls-layers-sf-blank.d.ts +89 -0
- package/dist/schema-decls-layers-sf-blank.d.ts.map +1 -0
- package/dist/schema-decls-layers-sf-blank.js +254 -0
- package/dist/schema-decls-layers-sf-blank.js.map +1 -0
- package/dist/schema-decls-layers-text-map.d.ts +80 -0
- package/dist/schema-decls-layers-text-map.d.ts.map +1 -0
- package/dist/schema-decls-layers-text-map.js +151 -0
- package/dist/schema-decls-layers-text-map.js.map +1 -0
- package/dist/schema-decls-paint.d.ts +39 -0
- package/dist/schema-decls-paint.d.ts.map +1 -0
- package/dist/schema-decls-paint.js +95 -0
- package/dist/schema-decls-paint.js.map +1 -0
- package/dist/schema-decls-params-area-abline.d.ts +85 -0
- package/dist/schema-decls-params-area-abline.d.ts.map +1 -0
- package/dist/schema-decls-params-area-abline.js +259 -0
- package/dist/schema-decls-params-area-abline.js.map +1 -0
- package/dist/schema-decls-params-col-contour.d.ts +61 -0
- package/dist/schema-decls-params-col-contour.d.ts.map +1 -0
- package/dist/schema-decls-params-col-contour.js +202 -0
- package/dist/schema-decls-params-col-contour.js.map +1 -0
- package/dist/schema-decls-params-curve-label.d.ts +64 -0
- package/dist/schema-decls-params-curve-label.d.ts.map +1 -0
- package/dist/schema-decls-params-curve-label.js +204 -0
- package/dist/schema-decls-params-curve-label.js.map +1 -0
- package/dist/schema-decls-params-errorbar-position.d.ts +83 -0
- package/dist/schema-decls-params-errorbar-position.d.ts.map +1 -0
- package/dist/schema-decls-params-errorbar-position.js +264 -0
- package/dist/schema-decls-params-errorbar-position.js.map +1 -0
- package/dist/schema-decls-params-point-path.d.ts +61 -0
- package/dist/schema-decls-params-point-path.d.ts.map +1 -0
- package/dist/schema-decls-params-point-path.js +240 -0
- package/dist/schema-decls-params-point-path.js.map +1 -0
- package/dist/schema-decls-params-violin-summary.d.ts +78 -0
- package/dist/schema-decls-params-violin-summary.d.ts.map +1 -0
- package/dist/schema-decls-params-violin-summary.js +272 -0
- package/dist/schema-decls-params-violin-summary.js.map +1 -0
- package/dist/schema-decls-plot.d.ts +80 -0
- package/dist/schema-decls-plot.d.ts.map +1 -0
- package/dist/schema-decls-plot.js +222 -0
- package/dist/schema-decls-plot.js.map +1 -0
- package/dist/schema-decls-scales-guides.d.ts +291 -0
- package/dist/schema-decls-scales-guides.d.ts.map +1 -0
- package/dist/schema-decls-scales-guides.js +189 -0
- package/dist/schema-decls-scales-guides.js.map +1 -0
- package/dist/schema-decls-scales.d.ts +124 -0
- package/dist/schema-decls-scales.d.ts.map +1 -0
- package/dist/schema-decls-scales.js +279 -0
- package/dist/schema-decls-scales.js.map +1 -0
- package/dist/schema-imports.d.ts +1679 -0
- package/dist/schema-imports.d.ts.map +1 -0
- package/dist/schema-imports.js +104 -0
- package/dist/schema-imports.js.map +1 -0
- package/dist/schema-name-schemas.d.ts +18 -0
- package/dist/schema-name-schemas.d.ts.map +1 -0
- package/dist/schema-name-schemas.js +13 -0
- package/dist/schema-name-schemas.js.map +1 -0
- package/dist/schema-names.d.ts +53 -0
- package/dist/schema-names.d.ts.map +1 -0
- package/dist/schema-names.js +229 -0
- package/dist/schema-names.js.map +1 -0
- package/dist/schema-types.d.ts +336 -0
- package/dist/schema-types.d.ts.map +1 -0
- package/dist/schema-types.js +10 -0
- package/dist/schema-types.js.map +1 -0
- package/dist/schema.d.ts +38 -0
- package/dist/schema.d.ts.map +1 -0
- package/dist/schema.js +34 -0
- package/dist/schema.js.map +1 -0
- package/dist/stat-reference-build.d.ts +24 -0
- package/dist/stat-reference-build.d.ts.map +1 -0
- package/dist/stat-reference-build.js +86 -0
- package/dist/stat-reference-build.js.map +1 -0
- package/dist/stat-reference.d.ts +33 -0
- package/dist/stat-reference.d.ts.map +1 -0
- package/dist/stat-reference.js +19 -0
- package/dist/stat-reference.js.map +1 -0
- package/dist/structural-gate.d.ts +15 -0
- package/dist/structural-gate.d.ts.map +1 -0
- package/dist/structural-gate.js +34 -0
- package/dist/structural-gate.js.map +1 -0
- package/dist/temporal-column.d.ts +33 -0
- package/dist/temporal-column.d.ts.map +1 -0
- package/dist/temporal-column.js +247 -0
- package/dist/temporal-column.js.map +1 -0
- package/dist/temporal-guides.d.ts +11 -0
- package/dist/temporal-guides.d.ts.map +1 -0
- package/dist/temporal-guides.js +11 -0
- package/dist/temporal-guides.js.map +1 -0
- package/dist/temporal-interval-schema.d.ts +9 -0
- package/dist/temporal-interval-schema.d.ts.map +1 -0
- package/dist/temporal-interval-schema.js +25 -0
- package/dist/temporal-interval-schema.js.map +1 -0
- package/dist/temporal-interval.d.ts +29 -0
- package/dist/temporal-interval.d.ts.map +1 -0
- package/dist/temporal-interval.js +122 -0
- package/dist/temporal-interval.js.map +1 -0
- package/dist/temporal-parse-core.d.ts +96 -0
- package/dist/temporal-parse-core.d.ts.map +1 -0
- package/dist/temporal-parse-core.js +235 -0
- package/dist/temporal-parse-core.js.map +1 -0
- package/dist/temporal-parse-format.d.ts +13 -0
- package/dist/temporal-parse-format.d.ts.map +1 -0
- package/dist/temporal-parse-format.js +180 -0
- package/dist/temporal-parse-format.js.map +1 -0
- package/dist/temporal-parse-schema.d.ts +11 -0
- package/dist/temporal-parse-schema.d.ts.map +1 -0
- package/dist/temporal-parse-schema.js +23 -0
- package/dist/temporal-parse-schema.js.map +1 -0
- package/dist/temporal-parse.d.ts +18 -0
- package/dist/temporal-parse.d.ts.map +1 -0
- package/dist/temporal-parse.js +183 -0
- package/dist/temporal-parse.js.map +1 -0
- package/dist/temporal-polyfill.d.ts +3 -0
- package/dist/temporal-polyfill.d.ts.map +1 -0
- package/dist/temporal-polyfill.js +25 -0
- package/dist/temporal-polyfill.js.map +1 -0
- package/dist/temporal-ticks.d.ts +20 -0
- package/dist/temporal-ticks.d.ts.map +1 -0
- package/dist/temporal-ticks.js +246 -0
- package/dist/temporal-ticks.js.map +1 -0
- package/dist/temporal.d.ts +109 -0
- package/dist/temporal.d.ts.map +1 -0
- package/dist/temporal.js +73 -0
- package/dist/temporal.js.map +1 -0
- package/dist/validate-data-checks-color-temporal.d.ts +58 -0
- package/dist/validate-data-checks-color-temporal.d.ts.map +1 -0
- package/dist/validate-data-checks-color-temporal.js +168 -0
- package/dist/validate-data-checks-color-temporal.js.map +1 -0
- package/dist/validate-data-checks-color.d.ts +28 -0
- package/dist/validate-data-checks-color.d.ts.map +1 -0
- package/dist/validate-data-checks-color.js +296 -0
- package/dist/validate-data-checks-color.js.map +1 -0
- package/dist/validate-data-checks-layer.d.ts +37 -0
- package/dist/validate-data-checks-layer.d.ts.map +1 -0
- package/dist/validate-data-checks-layer.js +343 -0
- package/dist/validate-data-checks-layer.js.map +1 -0
- package/dist/validate-data-checks-position.d.ts +45 -0
- package/dist/validate-data-checks-position.d.ts.map +1 -0
- package/dist/validate-data-checks-position.js +204 -0
- package/dist/validate-data-checks-position.js.map +1 -0
- package/dist/validate-data-checks-style-finite.d.ts +24 -0
- package/dist/validate-data-checks-style-finite.d.ts.map +1 -0
- package/dist/validate-data-checks-style-finite.js +40 -0
- package/dist/validate-data-checks-style-finite.js.map +1 -0
- package/dist/validate-data-checks-style-numeric.d.ts +26 -0
- package/dist/validate-data-checks-style-numeric.d.ts.map +1 -0
- package/dist/validate-data-checks-style-numeric.js +327 -0
- package/dist/validate-data-checks-style-numeric.js.map +1 -0
- package/dist/validate-data-checks-style.d.ts +14 -0
- package/dist/validate-data-checks-style.d.ts.map +1 -0
- package/dist/validate-data-checks-style.js +14 -0
- package/dist/validate-data-checks-style.js.map +1 -0
- package/dist/validate-data-checks-temporal.d.ts +57 -0
- package/dist/validate-data-checks-temporal.d.ts.map +1 -0
- package/dist/validate-data-checks-temporal.js +83 -0
- package/dist/validate-data-checks-temporal.js.map +1 -0
- package/dist/validate-data-checks.d.ts +31 -0
- package/dist/validate-data-checks.d.ts.map +1 -0
- package/dist/validate-data-checks.js +110 -0
- package/dist/validate-data-checks.js.map +1 -0
- package/dist/validate-data-evidence.d.ts +69 -0
- package/dist/validate-data-evidence.d.ts.map +1 -0
- package/dist/validate-data-evidence.js +329 -0
- package/dist/validate-data-evidence.js.map +1 -0
- package/dist/validate-data.d.ts +73 -0
- package/dist/validate-data.d.ts.map +1 -0
- package/dist/validate-data.js +30 -0
- package/dist/validate-data.js.map +1 -0
- package/dist/validate-map-errors.d.ts +32 -0
- package/dist/validate-map-errors.d.ts.map +1 -0
- package/dist/validate-map-errors.js +76 -0
- package/dist/validate-map-errors.js.map +1 -0
- package/dist/validate-map-forms.d.ts +43 -0
- package/dist/validate-map-forms.d.ts.map +1 -0
- package/dist/validate-map-forms.js +125 -0
- package/dist/validate-map-forms.js.map +1 -0
- package/dist/validate-map-path-keywords.d.ts +11 -0
- package/dist/validate-map-path-keywords.d.ts.map +1 -0
- package/dist/validate-map-path-keywords.js +95 -0
- package/dist/validate-map-path-keywords.js.map +1 -0
- package/dist/validate-map-path-unions.d.ts +27 -0
- package/dist/validate-map-path-unions.d.ts.map +1 -0
- package/dist/validate-map-path-unions.js +200 -0
- package/dist/validate-map-path-unions.js.map +1 -0
- package/dist/validate-schema-shape.d.ts +69 -0
- package/dist/validate-schema-shape.d.ts.map +1 -0
- package/dist/validate-schema-shape.js +156 -0
- package/dist/validate-schema-shape.js.map +1 -0
- package/dist/validate-schema-walk.d.ts +34 -0
- package/dist/validate-schema-walk.d.ts.map +1 -0
- package/dist/validate-schema-walk.js +216 -0
- package/dist/validate-schema-walk.js.map +1 -0
- package/dist/validate-structure-facet.d.ts +8 -0
- package/dist/validate-structure-facet.d.ts.map +1 -0
- package/dist/validate-structure-facet.js +67 -0
- package/dist/validate-structure-facet.js.map +1 -0
- package/dist/validate-structure-layer-computed-y.d.ts +14 -0
- package/dist/validate-structure-layer-computed-y.d.ts.map +1 -0
- package/dist/validate-structure-layer-computed-y.js +70 -0
- package/dist/validate-structure-layer-computed-y.js.map +1 -0
- package/dist/validate-structure-layer-ribbon.d.ts +8 -0
- package/dist/validate-structure-layer-ribbon.d.ts.map +1 -0
- package/dist/validate-structure-layer-ribbon.js +36 -0
- package/dist/validate-structure-layer-ribbon.js.map +1 -0
- package/dist/validate-structure-layer-rule.d.ts +14 -0
- package/dist/validate-structure-layer-rule.d.ts.map +1 -0
- package/dist/validate-structure-layer-rule.js +90 -0
- package/dist/validate-structure-layer-rule.js.map +1 -0
- package/dist/validate-structure-layer-shared.d.ts +12 -0
- package/dist/validate-structure-layer-shared.d.ts.map +1 -0
- package/dist/validate-structure-layer-shared.js +17 -0
- package/dist/validate-structure-layer-shared.js.map +1 -0
- package/dist/validate-structure-layers.d.ts +12 -0
- package/dist/validate-structure-layers.d.ts.map +1 -0
- package/dist/validate-structure-layers.js +292 -0
- package/dist/validate-structure-layers.js.map +1 -0
- package/dist/validate-structure-paint.d.ts +12 -0
- package/dist/validate-structure-paint.d.ts.map +1 -0
- package/dist/validate-structure-paint.js +87 -0
- package/dist/validate-structure-paint.js.map +1 -0
- package/dist/validate-structure-scales.d.ts +10 -0
- package/dist/validate-structure-scales.d.ts.map +1 -0
- package/dist/validate-structure-scales.js +242 -0
- package/dist/validate-structure-scales.js.map +1 -0
- package/dist/validate-structure-style-bins.d.ts +17 -0
- package/dist/validate-structure-style-bins.d.ts.map +1 -0
- package/dist/validate-structure-style-bins.js +150 -0
- package/dist/validate-structure-style-bins.js.map +1 -0
- package/dist/validate-structure.d.ts +16 -0
- package/dist/validate-structure.d.ts.map +1 -0
- package/dist/validate-structure.js +16 -0
- package/dist/validate-structure.js.map +1 -0
- package/dist/validate.d.ts +24 -0
- package/dist/validate.d.ts.map +1 -0
- package/dist/validate.js +178 -0
- package/dist/validate.js.map +1 -0
- package/package.json +59 -0
- package/schema/v0.json +9618 -0
- package/src/artifact.ts +81 -0
- package/src/builder-core.ts +276 -0
- package/src/builder-data.ts +156 -0
- package/src/builder-geoms.ts +290 -0
- package/src/builder-options.ts +428 -0
- package/src/builder-scales.ts +443 -0
- package/src/builder.ts +125 -0
- package/src/capabilities-data.ts +336 -0
- package/src/capabilities-helpers.ts +54 -0
- package/src/capabilities.ts +159 -0
- package/src/coord-helpers.ts +177 -0
- package/src/coord-reference-build.ts +283 -0
- package/src/coord-reference.ts +75 -0
- package/src/error-catalog.ts +253 -0
- package/src/error-prose-shared.ts +106 -0
- package/src/errors.ts +87 -0
- package/src/generated/coord-reference-data.ts +235 -0
- package/src/generated/geom-param-keys.ts +222 -0
- package/src/generated/geom-reference-data.ts +3024 -0
- package/src/generated/guide-reference-data.ts +284 -0
- package/src/generated/plot-spec-validator.ts +7335 -0
- package/src/generated/position-reference-data.ts +191 -0
- package/src/generated/scale-reference-data.ts +10665 -0
- package/src/generated/stat-reference-data.ts +339 -0
- package/src/geom-params-build.ts +92 -0
- package/src/geom-params.ts +14 -0
- package/src/geom-reference-build.ts +292 -0
- package/src/geom-reference.ts +127 -0
- package/src/guide-helpers.ts +44 -0
- package/src/guide-reference-build.ts +249 -0
- package/src/guide-reference.ts +76 -0
- package/src/hue-grey-palettes.ts +82 -0
- package/src/index.ts +400 -0
- package/src/lint-catalog.ts +57 -0
- package/src/lint-layer-rules.ts +175 -0
- package/src/lint-scale-rules.ts +285 -0
- package/src/lint.ts +126 -0
- package/src/normalize-coord.ts +126 -0
- package/src/normalize-input-layers-marks.ts +276 -0
- package/src/normalize-input-layers-special.ts +252 -0
- package/src/normalize-input.ts +154 -0
- package/src/normalize-paint.ts +98 -0
- package/src/normalize-scales.ts +108 -0
- package/src/normalize.ts +403 -0
- package/src/paint-helpers.ts +98 -0
- package/src/pipeline-error-catalog.ts +278 -0
- package/src/portability-check.ts +155 -0
- package/src/portability-lossy.ts +81 -0
- package/src/portability.ts +31 -0
- package/src/portable-builder.ts +35 -0
- package/src/portable-entry.ts +37 -0
- package/src/position-reference-build.ts +164 -0
- package/src/position-reference.ts +41 -0
- package/src/runtime.ts +198 -0
- package/src/scale-color-helpers.ts +263 -0
- package/src/scale-color-hue-grey.ts +95 -0
- package/src/scale-color-stops.ts +177 -0
- package/src/scale-color-viridis.ts +99 -0
- package/src/scale-helpers.ts +264 -0
- package/src/scale-multi-helpers.ts +220 -0
- package/src/scale-position-helpers.ts +231 -0
- package/src/scale-reference-build.ts +222 -0
- package/src/scale-reference-classify-color.ts +334 -0
- package/src/scale-reference-classify-position.ts +164 -0
- package/src/scale-reference-classify-style.ts +229 -0
- package/src/scale-reference-classify-support.ts +298 -0
- package/src/scale-reference.ts +165 -0
- package/src/scale-style-helpers.ts +316 -0
- package/src/schema-catalog.ts +222 -0
- package/src/schema-declarations.ts +51 -0
- package/src/schema-decls-data.ts +272 -0
- package/src/schema-decls-guides-theme.ts +395 -0
- package/src/schema-decls-layers-col-boxplot.ts +410 -0
- package/src/schema-decls-layers-count-pointrange.ts +321 -0
- package/src/schema-decls-layers-crossbar-jitter.ts +443 -0
- package/src/schema-decls-layers-point-path.ts +246 -0
- package/src/schema-decls-layers-sf-blank.ts +408 -0
- package/src/schema-decls-layers-text-map.ts +259 -0
- package/src/schema-decls-paint.ts +124 -0
- package/src/schema-decls-params-area-abline.ts +440 -0
- package/src/schema-decls-params-col-contour.ts +333 -0
- package/src/schema-decls-params-curve-label.ts +343 -0
- package/src/schema-decls-params-errorbar-position.ts +446 -0
- package/src/schema-decls-params-point-path.ts +394 -0
- package/src/schema-decls-params-violin-summary.ts +447 -0
- package/src/schema-decls-plot.ts +385 -0
- package/src/schema-decls-scales-guides.ts +233 -0
- package/src/schema-decls-scales.ts +432 -0
- package/src/schema-imports.ts +116 -0
- package/src/schema-name-schemas.ts +37 -0
- package/src/schema-names.ts +243 -0
- package/src/schema-types.ts +400 -0
- package/src/schema.ts +287 -0
- package/src/stat-reference-build.ts +145 -0
- package/src/stat-reference.ts +38 -0
- package/src/structural-gate.ts +42 -0
- package/src/temporal-column.ts +323 -0
- package/src/temporal-guides.ts +32 -0
- package/src/temporal-interval-schema.ts +40 -0
- package/src/temporal-interval.ts +151 -0
- package/src/temporal-parse-core.ts +331 -0
- package/src/temporal-parse-format.ts +222 -0
- package/src/temporal-parse-schema.ts +38 -0
- package/src/temporal-parse.ts +259 -0
- package/src/temporal-polyfill.ts +27 -0
- package/src/temporal-ticks.ts +312 -0
- package/src/temporal.ts +112 -0
- package/src/validate-data-checks-color-temporal.ts +261 -0
- package/src/validate-data-checks-color.ts +395 -0
- package/src/validate-data-checks-layer.ts +492 -0
- package/src/validate-data-checks-position.ts +275 -0
- package/src/validate-data-checks-style-finite.ts +55 -0
- package/src/validate-data-checks-style-numeric.ts +455 -0
- package/src/validate-data-checks-style.ts +13 -0
- package/src/validate-data-checks-temporal.ts +129 -0
- package/src/validate-data-checks.ts +157 -0
- package/src/validate-data-evidence.ts +419 -0
- package/src/validate-data.ts +114 -0
- package/src/validate-map-errors.ts +126 -0
- package/src/validate-map-forms.ts +148 -0
- package/src/validate-map-path-keywords.ts +129 -0
- package/src/validate-map-path-unions.ts +281 -0
- package/src/validate-schema-shape.ts +232 -0
- package/src/validate-schema-walk.ts +219 -0
- package/src/validate-structure-facet.ts +76 -0
- package/src/validate-structure-layer-computed-y.ts +94 -0
- package/src/validate-structure-layer-ribbon.ts +61 -0
- package/src/validate-structure-layer-rule.ts +98 -0
- package/src/validate-structure-layer-shared.ts +29 -0
- package/src/validate-structure-layers.ts +395 -0
- package/src/validate-structure-paint.ts +101 -0
- package/src/validate-structure-scales.ts +278 -0
- package/src/validate-structure-style-bins.ts +167 -0
- package/src/validate-structure.ts +16 -0
- package/src/validate.ts +212 -0
|
@@ -0,0 +1,263 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generic non-position color/fill scale helpers + ColorBrewer (#825) +
|
|
3
|
+
* configuredColorScaleType. Palette families live in sibling modules:
|
|
4
|
+
* scale-color-viridis.ts, scale-color-stops.ts (gradient + steps),
|
|
5
|
+
* scale-color-hue-grey.ts. Facade re-exports: scale-helpers.ts.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import type { ColorScaleSpec, Scales } from "./schema.js";
|
|
9
|
+
import { SEQUENTIAL_SCHEME_NAMES } from "./schema-names.js";
|
|
10
|
+
|
|
11
|
+
const SEQUENTIAL_SCHEMES = new Set<string>(SEQUENTIAL_SCHEME_NAMES);
|
|
12
|
+
|
|
13
|
+
/** Resolve family intent encoded by family-specific options before data inference. */
|
|
14
|
+
export function configuredColorScaleType(
|
|
15
|
+
config: ColorScaleSpec | undefined,
|
|
16
|
+
): ColorScaleSpec["type"] | undefined {
|
|
17
|
+
if (config === undefined) return undefined;
|
|
18
|
+
if (config.type !== undefined) return config.type;
|
|
19
|
+
if (config.scheme !== undefined && config.range === undefined) {
|
|
20
|
+
return SEQUENTIAL_SCHEMES.has(config.scheme) ? "sequential" : "ordinal";
|
|
21
|
+
}
|
|
22
|
+
const sequentialOptions = [
|
|
23
|
+
config.transform,
|
|
24
|
+
config.temporalKind,
|
|
25
|
+
config.parse,
|
|
26
|
+
config.parseFailure,
|
|
27
|
+
config.timezone,
|
|
28
|
+
config.disambiguation,
|
|
29
|
+
config.breaks,
|
|
30
|
+
config.oob,
|
|
31
|
+
config.labels,
|
|
32
|
+
];
|
|
33
|
+
if (sequentialOptions.some((value) => value !== undefined)) {
|
|
34
|
+
return "sequential";
|
|
35
|
+
}
|
|
36
|
+
if (config.domainMode !== undefined || config.onExhaust !== undefined) return "ordinal";
|
|
37
|
+
return undefined;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
// --- generic non-position color/fill families -------------------------------
|
|
41
|
+
|
|
42
|
+
export type ColorScaleOptions = Omit<ColorScaleSpec, "type">;
|
|
43
|
+
export type SequentialColorScaleOptions = Omit<ColorScaleOptions, "domainMode" | "onExhaust">;
|
|
44
|
+
export type BinnedColorScaleOptions = SequentialColorScaleOptions;
|
|
45
|
+
export type DiscreteColorScaleOptions = Pick<
|
|
46
|
+
ColorScaleSpec,
|
|
47
|
+
| "domain"
|
|
48
|
+
| "domainMode"
|
|
49
|
+
| "range"
|
|
50
|
+
| "scheme"
|
|
51
|
+
| "reverse"
|
|
52
|
+
| "naValue"
|
|
53
|
+
| "unknownValue"
|
|
54
|
+
| "onExhaust"
|
|
55
|
+
| "guide"
|
|
56
|
+
>;
|
|
57
|
+
export type TransformedColorScaleOptions = Omit<
|
|
58
|
+
SequentialColorScaleOptions,
|
|
59
|
+
"transform" | "temporalKind" | "parse" | "parseFailure" | "timezone" | "disambiguation"
|
|
60
|
+
>;
|
|
61
|
+
export type TemporalColorScaleOptions = Omit<
|
|
62
|
+
SequentialColorScaleOptions,
|
|
63
|
+
"transform" | "temporalKind"
|
|
64
|
+
>;
|
|
65
|
+
export type ManualColorScaleOptions = Pick<
|
|
66
|
+
ColorScaleSpec,
|
|
67
|
+
"domain" | "naValue" | "unknownValue" | "guide"
|
|
68
|
+
> & {
|
|
69
|
+
/** Colors paired positionally with the explicit or trained domain. */
|
|
70
|
+
values: NonNullable<ColorScaleSpec["range"]>;
|
|
71
|
+
};
|
|
72
|
+
export type IdentityColorScaleOptions = Pick<ColorScaleSpec, "naValue" | "unknownValue" | "guide">;
|
|
73
|
+
|
|
74
|
+
type ColorAesthetic = "color" | "fill";
|
|
75
|
+
|
|
76
|
+
/** Shared PortableSpec builder for color/fill scale helpers (sibling modules). */
|
|
77
|
+
export function colorScale(
|
|
78
|
+
aesthetic: ColorAesthetic,
|
|
79
|
+
type: "ordinal" | "sequential" | "binned" | "manual" | "identity",
|
|
80
|
+
options: ColorScaleOptions = {},
|
|
81
|
+
forced: {
|
|
82
|
+
transform?: "log10" | "sqrt";
|
|
83
|
+
temporalKind?: "date" | "datetime";
|
|
84
|
+
} = {},
|
|
85
|
+
): Scales {
|
|
86
|
+
return {
|
|
87
|
+
[aesthetic]: {
|
|
88
|
+
type,
|
|
89
|
+
...options,
|
|
90
|
+
...(forced.transform !== undefined && { transform: forced.transform }),
|
|
91
|
+
...(forced.temporalKind !== undefined && { temporalKind: forced.temporalKind }),
|
|
92
|
+
},
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
function manualColorScale(aesthetic: ColorAesthetic, options: ManualColorScaleOptions): Scales {
|
|
97
|
+
const { values, ...rest } = options;
|
|
98
|
+
return colorScale(aesthetic, "manual", { ...rest, range: [...values] });
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
// Color/colour helpers share function identity. American camelCase is the
|
|
102
|
+
// TypeScript-primary spelling; British and snake_case names are exact aliases.
|
|
103
|
+
export function scaleColorContinuous(options: SequentialColorScaleOptions = {}): Scales {
|
|
104
|
+
return colorScale("color", "sequential", options);
|
|
105
|
+
}
|
|
106
|
+
export function scaleColorDiscrete(options: DiscreteColorScaleOptions = {}): Scales {
|
|
107
|
+
return colorScale("color", "ordinal", options);
|
|
108
|
+
}
|
|
109
|
+
export function scaleColorBinned(options: BinnedColorScaleOptions = {}): Scales {
|
|
110
|
+
return colorScale("color", "binned", options);
|
|
111
|
+
}
|
|
112
|
+
export function scaleColorLog10(options: TransformedColorScaleOptions = {}): Scales {
|
|
113
|
+
return colorScale("color", "sequential", options, { transform: "log10" });
|
|
114
|
+
}
|
|
115
|
+
export function scaleColorSqrt(options: TransformedColorScaleOptions = {}): Scales {
|
|
116
|
+
return colorScale("color", "sequential", options, { transform: "sqrt" });
|
|
117
|
+
}
|
|
118
|
+
export function scaleColorDate(options: TemporalColorScaleOptions = {}): Scales {
|
|
119
|
+
return colorScale("color", "sequential", options, { temporalKind: "date" });
|
|
120
|
+
}
|
|
121
|
+
export function scaleColorDatetime(options: TemporalColorScaleOptions = {}): Scales {
|
|
122
|
+
return colorScale("color", "sequential", options, { temporalKind: "datetime" });
|
|
123
|
+
}
|
|
124
|
+
export function scaleColorManual(options: ManualColorScaleOptions): Scales {
|
|
125
|
+
return manualColorScale("color", options);
|
|
126
|
+
}
|
|
127
|
+
export function scaleColorIdentity(options: IdentityColorScaleOptions = {}): Scales {
|
|
128
|
+
return colorScale("color", "identity", options);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
/** ggplot2 palette + direction options for ColorBrewer helpers (#825). */
|
|
132
|
+
export type ColorBrewerScaleOptions = DiscreteColorScaleOptions & {
|
|
133
|
+
/** ColorBrewer palette name (e.g. "Dark2", "Blues"). Maps to `scheme`. */
|
|
134
|
+
palette?: string;
|
|
135
|
+
/** `1` (default) or `-1` (reverse). */
|
|
136
|
+
direction?: 1 | -1;
|
|
137
|
+
};
|
|
138
|
+
|
|
139
|
+
export type ColorDistillerScaleOptions = SequentialColorScaleOptions & {
|
|
140
|
+
palette?: string;
|
|
141
|
+
direction?: 1 | -1;
|
|
142
|
+
};
|
|
143
|
+
|
|
144
|
+
export type ColorFermenterScaleOptions = BinnedColorScaleOptions & {
|
|
145
|
+
palette?: string;
|
|
146
|
+
direction?: 1 | -1;
|
|
147
|
+
};
|
|
148
|
+
|
|
149
|
+
function withBrewerPalette<T extends { scheme?: string; reverse?: boolean }>(
|
|
150
|
+
options: T & { palette?: string; direction?: 1 | -1 },
|
|
151
|
+
): T {
|
|
152
|
+
const { palette, direction, scheme, reverse, ...rest } = options;
|
|
153
|
+
const resolvedScheme = palette ?? scheme;
|
|
154
|
+
return {
|
|
155
|
+
...rest,
|
|
156
|
+
...(resolvedScheme === undefined ? {} : { scheme: resolvedScheme }),
|
|
157
|
+
...(direction === -1 || reverse === true ? { reverse: true } : {}),
|
|
158
|
+
} as T;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
/** ggplot2 `scale_color_brewer` — discrete ColorBrewer palette. */
|
|
162
|
+
export function scaleColorBrewer(options: ColorBrewerScaleOptions = {}): Scales {
|
|
163
|
+
return colorScale("color", "ordinal", withBrewerPalette(options));
|
|
164
|
+
}
|
|
165
|
+
/** ggplot2 `scale_color_distiller` — continuous ColorBrewer ramp. */
|
|
166
|
+
export function scaleColorDistiller(options: ColorDistillerScaleOptions = {}): Scales {
|
|
167
|
+
return colorScale("color", "sequential", withBrewerPalette(options));
|
|
168
|
+
}
|
|
169
|
+
/** ggplot2 `scale_color_fermenter` — binned ColorBrewer ramp. */
|
|
170
|
+
export function scaleColorFermenter(options: ColorFermenterScaleOptions = {}): Scales {
|
|
171
|
+
return colorScale("color", "binned", withBrewerPalette(options));
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
export const scaleColourContinuous = scaleColorContinuous;
|
|
175
|
+
export const scaleColourDiscrete = scaleColorDiscrete;
|
|
176
|
+
export const scaleColourBinned = scaleColorBinned;
|
|
177
|
+
export const scaleColourLog10 = scaleColorLog10;
|
|
178
|
+
export const scaleColourSqrt = scaleColorSqrt;
|
|
179
|
+
export const scaleColourDate = scaleColorDate;
|
|
180
|
+
export const scaleColourDatetime = scaleColorDatetime;
|
|
181
|
+
export const scaleColourManual = scaleColorManual;
|
|
182
|
+
export const scaleColourIdentity = scaleColorIdentity;
|
|
183
|
+
export const scaleColourBrewer = scaleColorBrewer;
|
|
184
|
+
export const scaleColourDistiller = scaleColorDistiller;
|
|
185
|
+
export const scaleColourFermenter = scaleColorFermenter;
|
|
186
|
+
export const scale_color_continuous = scaleColorContinuous;
|
|
187
|
+
export const scale_color_discrete = scaleColorDiscrete;
|
|
188
|
+
export const scale_color_binned = scaleColorBinned;
|
|
189
|
+
export const scale_color_log10 = scaleColorLog10;
|
|
190
|
+
export const scale_color_sqrt = scaleColorSqrt;
|
|
191
|
+
export const scale_color_date = scaleColorDate;
|
|
192
|
+
export const scale_color_datetime = scaleColorDatetime;
|
|
193
|
+
export const scale_color_manual = scaleColorManual;
|
|
194
|
+
export const scale_color_identity = scaleColorIdentity;
|
|
195
|
+
export const scale_color_brewer = scaleColorBrewer;
|
|
196
|
+
export const scale_color_distiller = scaleColorDistiller;
|
|
197
|
+
export const scale_color_fermenter = scaleColorFermenter;
|
|
198
|
+
export const scale_colour_continuous = scaleColorContinuous;
|
|
199
|
+
export const scale_colour_discrete = scaleColorDiscrete;
|
|
200
|
+
export const scale_colour_binned = scaleColorBinned;
|
|
201
|
+
export const scale_colour_log10 = scaleColorLog10;
|
|
202
|
+
export const scale_colour_sqrt = scaleColorSqrt;
|
|
203
|
+
export const scale_colour_date = scaleColorDate;
|
|
204
|
+
export const scale_colour_datetime = scaleColorDatetime;
|
|
205
|
+
export const scale_colour_manual = scaleColorManual;
|
|
206
|
+
export const scale_colour_identity = scaleColorIdentity;
|
|
207
|
+
export const scale_colour_brewer = scaleColorBrewer;
|
|
208
|
+
export const scale_colour_distiller = scaleColorDistiller;
|
|
209
|
+
export const scale_colour_fermenter = scaleColorFermenter;
|
|
210
|
+
|
|
211
|
+
export function scaleFillContinuous(options: SequentialColorScaleOptions = {}): Scales {
|
|
212
|
+
return colorScale("fill", "sequential", options);
|
|
213
|
+
}
|
|
214
|
+
export function scaleFillDiscrete(options: DiscreteColorScaleOptions = {}): Scales {
|
|
215
|
+
return colorScale("fill", "ordinal", options);
|
|
216
|
+
}
|
|
217
|
+
export function scaleFillBinned(options: BinnedColorScaleOptions = {}): Scales {
|
|
218
|
+
return colorScale("fill", "binned", options);
|
|
219
|
+
}
|
|
220
|
+
export function scaleFillLog10(options: TransformedColorScaleOptions = {}): Scales {
|
|
221
|
+
return colorScale("fill", "sequential", options, { transform: "log10" });
|
|
222
|
+
}
|
|
223
|
+
export function scaleFillSqrt(options: TransformedColorScaleOptions = {}): Scales {
|
|
224
|
+
return colorScale("fill", "sequential", options, { transform: "sqrt" });
|
|
225
|
+
}
|
|
226
|
+
export function scaleFillDate(options: TemporalColorScaleOptions = {}): Scales {
|
|
227
|
+
return colorScale("fill", "sequential", options, { temporalKind: "date" });
|
|
228
|
+
}
|
|
229
|
+
export function scaleFillDatetime(options: TemporalColorScaleOptions = {}): Scales {
|
|
230
|
+
return colorScale("fill", "sequential", options, { temporalKind: "datetime" });
|
|
231
|
+
}
|
|
232
|
+
export function scaleFillManual(options: ManualColorScaleOptions): Scales {
|
|
233
|
+
return manualColorScale("fill", options);
|
|
234
|
+
}
|
|
235
|
+
export function scaleFillIdentity(options: IdentityColorScaleOptions = {}): Scales {
|
|
236
|
+
return colorScale("fill", "identity", options);
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
/** ggplot2 `scale_fill_brewer`. */
|
|
240
|
+
export function scaleFillBrewer(options: ColorBrewerScaleOptions = {}): Scales {
|
|
241
|
+
return colorScale("fill", "ordinal", withBrewerPalette(options));
|
|
242
|
+
}
|
|
243
|
+
/** ggplot2 `scale_fill_distiller`. */
|
|
244
|
+
export function scaleFillDistiller(options: ColorDistillerScaleOptions = {}): Scales {
|
|
245
|
+
return colorScale("fill", "sequential", withBrewerPalette(options));
|
|
246
|
+
}
|
|
247
|
+
/** ggplot2 `scale_fill_fermenter`. */
|
|
248
|
+
export function scaleFillFermenter(options: ColorFermenterScaleOptions = {}): Scales {
|
|
249
|
+
return colorScale("fill", "binned", withBrewerPalette(options));
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
export const scale_fill_continuous = scaleFillContinuous;
|
|
253
|
+
export const scale_fill_discrete = scaleFillDiscrete;
|
|
254
|
+
export const scale_fill_binned = scaleFillBinned;
|
|
255
|
+
export const scale_fill_log10 = scaleFillLog10;
|
|
256
|
+
export const scale_fill_sqrt = scaleFillSqrt;
|
|
257
|
+
export const scale_fill_date = scaleFillDate;
|
|
258
|
+
export const scale_fill_datetime = scaleFillDatetime;
|
|
259
|
+
export const scale_fill_manual = scaleFillManual;
|
|
260
|
+
export const scale_fill_identity = scaleFillIdentity;
|
|
261
|
+
export const scale_fill_brewer = scaleFillBrewer;
|
|
262
|
+
export const scale_fill_distiller = scaleFillDistiller;
|
|
263
|
+
export const scale_fill_fermenter = scaleFillFermenter;
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Hue / grey / ordinal color/fill scale constructors (#829).
|
|
3
|
+
* Ordinal aliases bind to scaleColorDiscrete / scaleFillDiscrete (same identity).
|
|
4
|
+
*/
|
|
5
|
+
import type { Scales } from "./schema.js";
|
|
6
|
+
import { buildGreyPalette, buildHuePalette } from "./hue-grey-palettes.js";
|
|
7
|
+
import {
|
|
8
|
+
colorScale,
|
|
9
|
+
scaleColorDiscrete,
|
|
10
|
+
scaleFillDiscrete,
|
|
11
|
+
type DiscreteColorScaleOptions,
|
|
12
|
+
} from "./scale-color-helpers.js";
|
|
13
|
+
|
|
14
|
+
const HUE_STOPS = 10;
|
|
15
|
+
const GREY_STOPS = 10;
|
|
16
|
+
|
|
17
|
+
/** scale_*_hue options: discrete + optional HSL-ish h/c/l (bake range if set). */
|
|
18
|
+
export type HueScaleOptions = Omit<DiscreteColorScaleOptions, "scheme" | "range"> & {
|
|
19
|
+
/** Hue range in degrees [start, end). Default [15, 375). */
|
|
20
|
+
h?: readonly [number, number];
|
|
21
|
+
/** Chroma proxy 0–100 → HSL saturation. Default 100. */
|
|
22
|
+
c?: number;
|
|
23
|
+
/** Lightness 0–100. Default 65. */
|
|
24
|
+
l?: number;
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
/** scale_*_grey / gray options. */
|
|
28
|
+
export type GreyScaleOptions = Omit<DiscreteColorScaleOptions, "scheme" | "range"> & {
|
|
29
|
+
/** Lightness start in [0, 1]. Default 0.2. */
|
|
30
|
+
start?: number;
|
|
31
|
+
/** Lightness end in [0, 1]. Default 0.8. */
|
|
32
|
+
end?: number;
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
export type OrdinalColorScaleOptions = DiscreteColorScaleOptions;
|
|
36
|
+
|
|
37
|
+
function hueConfig(options: HueScaleOptions): DiscreteColorScaleOptions {
|
|
38
|
+
const { h, c, l, ...rest } = options;
|
|
39
|
+
if (h !== undefined || c !== undefined || l !== undefined) {
|
|
40
|
+
return {
|
|
41
|
+
...rest,
|
|
42
|
+
range: buildHuePalette(HUE_STOPS, h ?? [15, 375], c ?? 100, l ?? 65),
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
return { ...rest, scheme: "hue" };
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
function greyConfig(options: GreyScaleOptions): DiscreteColorScaleOptions {
|
|
49
|
+
const { start, end, ...rest } = options;
|
|
50
|
+
// Always bake a range — there is no registered "grey"/"gray" scheme name.
|
|
51
|
+
// scale_*_grey stays portable via explicit stops (start/end still honored).
|
|
52
|
+
return {
|
|
53
|
+
...rest,
|
|
54
|
+
range: buildGreyPalette(GREY_STOPS, start ?? 0.2, end ?? 0.8),
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export function scaleColorHue(options: HueScaleOptions = {}): Scales {
|
|
59
|
+
return colorScale("color", "ordinal", hueConfig(options));
|
|
60
|
+
}
|
|
61
|
+
export function scaleColorGrey(options: GreyScaleOptions = {}): Scales {
|
|
62
|
+
return colorScale("color", "ordinal", greyConfig(options));
|
|
63
|
+
}
|
|
64
|
+
/** Binding-identical American spelling of scaleColorGrey. */
|
|
65
|
+
export const scaleColorGray = scaleColorGrey;
|
|
66
|
+
/** Binding-identical alias of scaleColorDiscrete (ggplot2 scale_*_ordinal). */
|
|
67
|
+
export const scaleColorOrdinal = scaleColorDiscrete;
|
|
68
|
+
|
|
69
|
+
export function scaleFillHue(options: HueScaleOptions = {}): Scales {
|
|
70
|
+
return colorScale("fill", "ordinal", hueConfig(options));
|
|
71
|
+
}
|
|
72
|
+
export function scaleFillGrey(options: GreyScaleOptions = {}): Scales {
|
|
73
|
+
return colorScale("fill", "ordinal", greyConfig(options));
|
|
74
|
+
}
|
|
75
|
+
/** Binding-identical American spelling of scaleFillGrey. */
|
|
76
|
+
export const scaleFillGray = scaleFillGrey;
|
|
77
|
+
/** Binding-identical alias of scaleFillDiscrete. */
|
|
78
|
+
export const scaleFillOrdinal = scaleFillDiscrete;
|
|
79
|
+
|
|
80
|
+
export const scaleColourHue = scaleColorHue;
|
|
81
|
+
export const scaleColourGrey = scaleColorGrey;
|
|
82
|
+
export const scaleColourGray = scaleColorGray;
|
|
83
|
+
export const scaleColourOrdinal = scaleColorOrdinal;
|
|
84
|
+
export const scale_color_hue = scaleColorHue;
|
|
85
|
+
export const scale_color_grey = scaleColorGrey;
|
|
86
|
+
export const scale_color_gray = scaleColorGray;
|
|
87
|
+
export const scale_color_ordinal = scaleColorOrdinal;
|
|
88
|
+
export const scale_colour_hue = scaleColorHue;
|
|
89
|
+
export const scale_colour_grey = scaleColorGrey;
|
|
90
|
+
export const scale_colour_gray = scaleColorGray;
|
|
91
|
+
export const scale_colour_ordinal = scaleColorOrdinal;
|
|
92
|
+
export const scale_fill_hue = scaleFillHue;
|
|
93
|
+
export const scale_fill_grey = scaleFillGrey;
|
|
94
|
+
export const scale_fill_gray = scaleFillGray;
|
|
95
|
+
export const scale_fill_ordinal = scaleFillOrdinal;
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Multi-stop color/fill scale constructors: gradient* (#826 continuous) and
|
|
3
|
+
* steps* (#827 binned). Share default hexes and stop-range resolvers so the
|
|
4
|
+
* two families stay one edit surface.
|
|
5
|
+
*/
|
|
6
|
+
import type { Scales } from "./schema.js";
|
|
7
|
+
import {
|
|
8
|
+
colorScale,
|
|
9
|
+
type BinnedColorScaleOptions,
|
|
10
|
+
type SequentialColorScaleOptions,
|
|
11
|
+
} from "./scale-color-helpers.js";
|
|
12
|
+
|
|
13
|
+
// Shared stop defaults (navy→sky continuous; red–light–blue diverging).
|
|
14
|
+
const STOP_DEFAULT_LOW = "#132B43";
|
|
15
|
+
const STOP_DEFAULT_HIGH = "#56B1F7";
|
|
16
|
+
/** ggts diverging defaults (red–light–blue); not claimed as ggplot2 muted(). */
|
|
17
|
+
const STOP2_DEFAULT_LOW = "#B2182B";
|
|
18
|
+
const STOP2_DEFAULT_MID = "#F7F7F7";
|
|
19
|
+
const STOP2_DEFAULT_HIGH = "#2166AC";
|
|
20
|
+
|
|
21
|
+
/** ggplot2-shaped two-stop continuous colour (default navy → sky). */
|
|
22
|
+
export type GradientScaleOptions = Omit<SequentialColorScaleOptions, "scheme" | "range"> & {
|
|
23
|
+
low?: string;
|
|
24
|
+
high?: string;
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Diverging three-stop continuous colour.
|
|
29
|
+
* v1: mid is the center stop of `range` only — no asymmetric domain remapping
|
|
30
|
+
* (ggplot2 `midpoint` deferred; not accepted so it cannot silently no-op).
|
|
31
|
+
*/
|
|
32
|
+
export type Gradient2ScaleOptions = Omit<SequentialColorScaleOptions, "scheme" | "range"> & {
|
|
33
|
+
low?: string;
|
|
34
|
+
mid?: string;
|
|
35
|
+
high?: string;
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
/** N-stop continuous colour; requires ≥2 hex stops via colours/colors/values. */
|
|
39
|
+
export type GradientnScaleOptions = Omit<SequentialColorScaleOptions, "scheme" | "range"> & {
|
|
40
|
+
colours?: readonly string[];
|
|
41
|
+
colors?: readonly string[];
|
|
42
|
+
values?: readonly string[];
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
/** Two-stop stepped continuous colour (default navy → sky). */
|
|
46
|
+
export type StepsScaleOptions = Omit<BinnedColorScaleOptions, "scheme" | "range"> & {
|
|
47
|
+
low?: string;
|
|
48
|
+
high?: string;
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Three-stop stepped diverging colour.
|
|
53
|
+
* v1: no `midpoint` param (asymmetric domain remapping deferred).
|
|
54
|
+
*/
|
|
55
|
+
export type Steps2ScaleOptions = Omit<BinnedColorScaleOptions, "scheme" | "range"> & {
|
|
56
|
+
low?: string;
|
|
57
|
+
mid?: string;
|
|
58
|
+
high?: string;
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
/** N-stop stepped colour; requires ≥2 hex stops via colours/colors/values. */
|
|
62
|
+
export type StepsnScaleOptions = Omit<BinnedColorScaleOptions, "scheme" | "range"> & {
|
|
63
|
+
colours?: readonly string[];
|
|
64
|
+
colors?: readonly string[];
|
|
65
|
+
values?: readonly string[];
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
type TwoStopOptions = { low?: string; high?: string };
|
|
69
|
+
type ThreeStopOptions = { low?: string; mid?: string; high?: string };
|
|
70
|
+
type NStopOptions = {
|
|
71
|
+
colours?: readonly string[];
|
|
72
|
+
colors?: readonly string[];
|
|
73
|
+
values?: readonly string[];
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
function twoStopRange<T extends TwoStopOptions>(
|
|
77
|
+
options: T,
|
|
78
|
+
): Omit<T, "low" | "high"> & { range: string[] } {
|
|
79
|
+
const { low = STOP_DEFAULT_LOW, high = STOP_DEFAULT_HIGH, ...rest } = options;
|
|
80
|
+
return { ...rest, range: [low, high] };
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
function threeStopRange<T extends ThreeStopOptions>(
|
|
84
|
+
options: T,
|
|
85
|
+
): Omit<T, "low" | "mid" | "high"> & { range: string[] } {
|
|
86
|
+
const {
|
|
87
|
+
low = STOP2_DEFAULT_LOW,
|
|
88
|
+
mid = STOP2_DEFAULT_MID,
|
|
89
|
+
high = STOP2_DEFAULT_HIGH,
|
|
90
|
+
...rest
|
|
91
|
+
} = options;
|
|
92
|
+
return { ...rest, range: [low, mid, high] };
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
function nStopRange<T extends NStopOptions>(
|
|
96
|
+
options: T,
|
|
97
|
+
helperLabel: string,
|
|
98
|
+
): Omit<T, "colours" | "colors" | "values"> & { range: string[] } {
|
|
99
|
+
const { colours, colors, values, ...rest } = options;
|
|
100
|
+
const stops = colours ?? colors ?? values;
|
|
101
|
+
if (stops === undefined || stops.length < 2) {
|
|
102
|
+
throw new Error(
|
|
103
|
+
`${helperLabel} requires colours/colors/values with at least 2 #rgb/#rrggbb stops.`,
|
|
104
|
+
);
|
|
105
|
+
}
|
|
106
|
+
return { ...rest, range: [...stops] };
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
// --- gradient / gradient2 / gradientn (#826) --------------------------------
|
|
110
|
+
|
|
111
|
+
export function scaleColorGradient(options: GradientScaleOptions = {}): Scales {
|
|
112
|
+
return colorScale("color", "sequential", twoStopRange(options));
|
|
113
|
+
}
|
|
114
|
+
export function scaleColorGradient2(options: Gradient2ScaleOptions = {}): Scales {
|
|
115
|
+
return colorScale("color", "sequential", threeStopRange(options));
|
|
116
|
+
}
|
|
117
|
+
export function scaleColorGradientn(options: GradientnScaleOptions = {}): Scales {
|
|
118
|
+
return colorScale("color", "sequential", nStopRange(options, "scale_*_gradientn"));
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
export function scaleFillGradient(options: GradientScaleOptions = {}): Scales {
|
|
122
|
+
return colorScale("fill", "sequential", twoStopRange(options));
|
|
123
|
+
}
|
|
124
|
+
export function scaleFillGradient2(options: Gradient2ScaleOptions = {}): Scales {
|
|
125
|
+
return colorScale("fill", "sequential", threeStopRange(options));
|
|
126
|
+
}
|
|
127
|
+
export function scaleFillGradientn(options: GradientnScaleOptions = {}): Scales {
|
|
128
|
+
return colorScale("fill", "sequential", nStopRange(options, "scale_*_gradientn"));
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
export const scaleColourGradient = scaleColorGradient;
|
|
132
|
+
export const scaleColourGradient2 = scaleColorGradient2;
|
|
133
|
+
export const scaleColourGradientn = scaleColorGradientn;
|
|
134
|
+
export const scale_color_gradient = scaleColorGradient;
|
|
135
|
+
export const scale_color_gradient2 = scaleColorGradient2;
|
|
136
|
+
export const scale_color_gradientn = scaleColorGradientn;
|
|
137
|
+
export const scale_colour_gradient = scaleColorGradient;
|
|
138
|
+
export const scale_colour_gradient2 = scaleColorGradient2;
|
|
139
|
+
export const scale_colour_gradientn = scaleColorGradientn;
|
|
140
|
+
export const scale_fill_gradient = scaleFillGradient;
|
|
141
|
+
export const scale_fill_gradient2 = scaleFillGradient2;
|
|
142
|
+
export const scale_fill_gradientn = scaleFillGradientn;
|
|
143
|
+
|
|
144
|
+
// --- steps / steps2 / stepsn (#827) ----------------------------------------
|
|
145
|
+
|
|
146
|
+
export function scaleColorSteps(options: StepsScaleOptions = {}): Scales {
|
|
147
|
+
return colorScale("color", "binned", twoStopRange(options));
|
|
148
|
+
}
|
|
149
|
+
export function scaleColorSteps2(options: Steps2ScaleOptions = {}): Scales {
|
|
150
|
+
return colorScale("color", "binned", threeStopRange(options));
|
|
151
|
+
}
|
|
152
|
+
export function scaleColorStepsn(options: StepsnScaleOptions = {}): Scales {
|
|
153
|
+
return colorScale("color", "binned", nStopRange(options, "scale_*_stepsn"));
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
export function scaleFillSteps(options: StepsScaleOptions = {}): Scales {
|
|
157
|
+
return colorScale("fill", "binned", twoStopRange(options));
|
|
158
|
+
}
|
|
159
|
+
export function scaleFillSteps2(options: Steps2ScaleOptions = {}): Scales {
|
|
160
|
+
return colorScale("fill", "binned", threeStopRange(options));
|
|
161
|
+
}
|
|
162
|
+
export function scaleFillStepsn(options: StepsnScaleOptions = {}): Scales {
|
|
163
|
+
return colorScale("fill", "binned", nStopRange(options, "scale_*_stepsn"));
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
export const scaleColourSteps = scaleColorSteps;
|
|
167
|
+
export const scaleColourSteps2 = scaleColorSteps2;
|
|
168
|
+
export const scaleColourStepsn = scaleColorStepsn;
|
|
169
|
+
export const scale_color_steps = scaleColorSteps;
|
|
170
|
+
export const scale_color_steps2 = scaleColorSteps2;
|
|
171
|
+
export const scale_color_stepsn = scaleColorStepsn;
|
|
172
|
+
export const scale_colour_steps = scaleColorSteps;
|
|
173
|
+
export const scale_colour_steps2 = scaleColorSteps2;
|
|
174
|
+
export const scale_colour_stepsn = scaleColorStepsn;
|
|
175
|
+
export const scale_fill_steps = scaleFillSteps;
|
|
176
|
+
export const scale_fill_steps2 = scaleFillSteps2;
|
|
177
|
+
export const scale_fill_stepsn = scaleFillStepsn;
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Viridis family color/fill scale constructors (#828).
|
|
3
|
+
* ggplot2 scale_*_viridis_{c,d,b}. Helper-only fields `option` and `direction`
|
|
4
|
+
* are stripped before PortableSpec; `begin`/`end` deferred.
|
|
5
|
+
*/
|
|
6
|
+
import type { Scales } from "./schema.js";
|
|
7
|
+
import { SEQUENTIAL_SCHEME_NAMES } from "./schema-names.js";
|
|
8
|
+
import {
|
|
9
|
+
colorScale,
|
|
10
|
+
type ColorScaleOptions,
|
|
11
|
+
type DiscreteColorScaleOptions,
|
|
12
|
+
type SequentialColorScaleOptions,
|
|
13
|
+
} from "./scale-color-helpers.js";
|
|
14
|
+
|
|
15
|
+
type SequentialSchemeName = (typeof SEQUENTIAL_SCHEME_NAMES)[number];
|
|
16
|
+
|
|
17
|
+
export type ViridisOptionName = SequentialSchemeName;
|
|
18
|
+
|
|
19
|
+
/** Shared option surface for scale_*_viridis_* constructors. */
|
|
20
|
+
export type ViridisScaleOptions = {
|
|
21
|
+
/** Viridis-family map name (default `"viridis"`). Maps to PortableSpec `scheme`. */
|
|
22
|
+
option?: ViridisOptionName;
|
|
23
|
+
/**
|
|
24
|
+
* ggplot2 direction: `1` (default) dark→bright, `-1` reverses the ramp.
|
|
25
|
+
* Emitted as PortableSpec `reverse: true` when `-1`.
|
|
26
|
+
*/
|
|
27
|
+
direction?: 1 | -1;
|
|
28
|
+
reverse?: boolean;
|
|
29
|
+
domain?: SequentialColorScaleOptions["domain"];
|
|
30
|
+
range?: SequentialColorScaleOptions["range"];
|
|
31
|
+
breaks?: SequentialColorScaleOptions["breaks"];
|
|
32
|
+
labels?: SequentialColorScaleOptions["labels"];
|
|
33
|
+
oob?: SequentialColorScaleOptions["oob"];
|
|
34
|
+
naValue?: SequentialColorScaleOptions["naValue"];
|
|
35
|
+
unknownValue?: SequentialColorScaleOptions["unknownValue"];
|
|
36
|
+
guide?: SequentialColorScaleOptions["guide"];
|
|
37
|
+
transform?: SequentialColorScaleOptions["transform"];
|
|
38
|
+
domainMode?: DiscreteColorScaleOptions["domainMode"];
|
|
39
|
+
onExhaust?: DiscreteColorScaleOptions["onExhaust"];
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
const VIRIDIS_OPTIONS = new Set<string>(SEQUENTIAL_SCHEME_NAMES);
|
|
43
|
+
|
|
44
|
+
function resolveViridisPortable(options: ViridisScaleOptions): ColorScaleOptions {
|
|
45
|
+
const { option, direction, reverse, ...rest } = options;
|
|
46
|
+
if (option !== undefined && !VIRIDIS_OPTIONS.has(option)) {
|
|
47
|
+
throw new Error(
|
|
48
|
+
`Unknown viridis option "${option}". Expected one of: ${SEQUENTIAL_SCHEME_NAMES.join(", ")}.`,
|
|
49
|
+
);
|
|
50
|
+
}
|
|
51
|
+
const out: ColorScaleOptions = {
|
|
52
|
+
scheme: option ?? "viridis",
|
|
53
|
+
};
|
|
54
|
+
if (rest.domain !== undefined) out.domain = rest.domain;
|
|
55
|
+
if (rest.range !== undefined) out.range = rest.range;
|
|
56
|
+
if (rest.breaks !== undefined) out.breaks = rest.breaks;
|
|
57
|
+
if (rest.labels !== undefined) out.labels = rest.labels;
|
|
58
|
+
if (rest.oob !== undefined) out.oob = rest.oob;
|
|
59
|
+
if (rest.naValue !== undefined) out.naValue = rest.naValue;
|
|
60
|
+
if (rest.unknownValue !== undefined) out.unknownValue = rest.unknownValue;
|
|
61
|
+
if (rest.guide !== undefined) out.guide = rest.guide;
|
|
62
|
+
if (rest.transform !== undefined) out.transform = rest.transform;
|
|
63
|
+
if (rest.domainMode !== undefined) out.domainMode = rest.domainMode;
|
|
64
|
+
if (rest.onExhaust !== undefined) out.onExhaust = rest.onExhaust;
|
|
65
|
+
if (reverse === true || direction === -1) out.reverse = true;
|
|
66
|
+
return out;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export function scaleColorViridisC(options: ViridisScaleOptions = {}): Scales {
|
|
70
|
+
return colorScale("color", "sequential", resolveViridisPortable(options));
|
|
71
|
+
}
|
|
72
|
+
export function scaleColorViridisD(options: ViridisScaleOptions = {}): Scales {
|
|
73
|
+
return colorScale("color", "ordinal", resolveViridisPortable(options));
|
|
74
|
+
}
|
|
75
|
+
export function scaleColorViridisB(options: ViridisScaleOptions = {}): Scales {
|
|
76
|
+
return colorScale("color", "binned", resolveViridisPortable(options));
|
|
77
|
+
}
|
|
78
|
+
export function scaleFillViridisC(options: ViridisScaleOptions = {}): Scales {
|
|
79
|
+
return colorScale("fill", "sequential", resolveViridisPortable(options));
|
|
80
|
+
}
|
|
81
|
+
export function scaleFillViridisD(options: ViridisScaleOptions = {}): Scales {
|
|
82
|
+
return colorScale("fill", "ordinal", resolveViridisPortable(options));
|
|
83
|
+
}
|
|
84
|
+
export function scaleFillViridisB(options: ViridisScaleOptions = {}): Scales {
|
|
85
|
+
return colorScale("fill", "binned", resolveViridisPortable(options));
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
export const scaleColourViridisC = scaleColorViridisC;
|
|
89
|
+
export const scaleColourViridisD = scaleColorViridisD;
|
|
90
|
+
export const scaleColourViridisB = scaleColorViridisB;
|
|
91
|
+
export const scale_color_viridis_c = scaleColorViridisC;
|
|
92
|
+
export const scale_color_viridis_d = scaleColorViridisD;
|
|
93
|
+
export const scale_color_viridis_b = scaleColorViridisB;
|
|
94
|
+
export const scale_colour_viridis_c = scaleColorViridisC;
|
|
95
|
+
export const scale_colour_viridis_d = scaleColorViridisD;
|
|
96
|
+
export const scale_colour_viridis_b = scaleColorViridisB;
|
|
97
|
+
export const scale_fill_viridis_c = scaleFillViridisC;
|
|
98
|
+
export const scale_fill_viridis_d = scaleFillViridisD;
|
|
99
|
+
export const scale_fill_viridis_b = scaleFillViridisB;
|