@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,36 @@
|
|
|
1
|
+
import { isRecord, pushMissingChannel } from "./validate-structure-layer-shared.js";
|
|
2
|
+
export function ribbonStructuralErrors(layer, layerPath, mapped) {
|
|
3
|
+
const errors = [];
|
|
4
|
+
const params = isRecord(layer["params"]) ? layer["params"] : {};
|
|
5
|
+
const pinned = params["orientation"] === "x" || params["orientation"] === "y" ? params["orientation"] : null;
|
|
6
|
+
const xContract = mapped("x") !== undefined && mapped("ymin") !== undefined && mapped("ymax") !== undefined;
|
|
7
|
+
const yContract = mapped("y") !== undefined && mapped("xmin") !== undefined && mapped("xmax") !== undefined;
|
|
8
|
+
if (pinned === null && xContract && yContract) {
|
|
9
|
+
errors.push({
|
|
10
|
+
code: "ribbon-orientation-ambiguous",
|
|
11
|
+
path: `${layerPath}/params/orientation`,
|
|
12
|
+
message: 'This ribbon layer maps both x-orientation (x+ymin+ymax) and y-orientation (y+xmin+xmax) contracts. Set params.orientation to "x" or "y".',
|
|
13
|
+
fix: {
|
|
14
|
+
description: "Pin orientation explicitly.",
|
|
15
|
+
example: { params: { orientation: "x" } },
|
|
16
|
+
},
|
|
17
|
+
});
|
|
18
|
+
return errors;
|
|
19
|
+
}
|
|
20
|
+
const orientation = pinned === "x" || pinned === "y" ? pinned : xContract ? "x" : yContract ? "y" : null;
|
|
21
|
+
const usesYContract = orientation === "y" ||
|
|
22
|
+
(orientation === null &&
|
|
23
|
+
[mapped("y"), mapped("xmin"), mapped("xmax")].some((value) => value !== undefined));
|
|
24
|
+
const needed = usesYContract ? ["y", "xmin", "xmax"] : ["x", "ymin", "ymax"];
|
|
25
|
+
for (const channel of needed) {
|
|
26
|
+
if (mapped(channel) !== undefined)
|
|
27
|
+
continue;
|
|
28
|
+
const suffix = ribbonContractSuffix(orientation);
|
|
29
|
+
pushMissingChannel(errors, layerPath, channel, `The ribbon geom ${suffix} requires a "${channel}" channel; map it in the layer's aes or the plot-level aes.`);
|
|
30
|
+
}
|
|
31
|
+
return errors;
|
|
32
|
+
}
|
|
33
|
+
function ribbonContractSuffix(orientation) {
|
|
34
|
+
return orientation === null ? "for its interval contract" : `with orientation "${orientation}"`;
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=validate-structure-layer-ribbon.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validate-structure-layer-ribbon.js","sourceRoot":"","sources":["../src/validate-structure-layer-ribbon.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,QAAQ,EAAE,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AAS,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC;IAEvF,MAAM,aAAa,GACjB,WAAW,KAAK,GAAG;QACnB,CAAC,WAAW,KAAK,IAAI;YACnB,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC;IACxF,MAAM,MAAM,GAAkB,aAAa,CAAC,CAAC,CAAC,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;IAE5F,KAAK,MAAM,OAAO,IAAI,MAAM,EAAE,CAAC;QAC7B,IAAI,MAAM,CAAC,OAAO,CAAC,KAAK,SAAS;YAAE,SAAS;QAC5C,MAAM,MAAM,GAAG,oBAAoB,CAAC,WAAW,CAAC,CAAC;QACjD,kBAAkB,CAChB,MAAM,EACN,SAAS,EACT,OAAO,EACP,mBAAmB,MAAM,gBAAgB,OAAO,6DAA6D,CAC9G,CAAC;IACJ,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,SAAS,oBAAoB,CAAC,WAA6B;IACzD,OAAO,WAAW,KAAK,IAAI,CAAC,CAAC,CAAC,2BAA2B,CAAC,CAAC,CAAC,qBAAqB,WAAW,GAAG,CAAC;AAClG,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Rule / hline / vline annotation vs data-driven form checks.
|
|
3
|
+
* Orchestrated by validate-structure-layers.ts.
|
|
4
|
+
*/
|
|
5
|
+
import type { SpecError } from "./errors.js";
|
|
6
|
+
import type { Aes } from "./schema.js";
|
|
7
|
+
/** Asymmetric intercept presence for rule / hline / vline form checks. */
|
|
8
|
+
export declare function hasGeomIntercepts(geom: string, layer: Record<string, unknown>): boolean;
|
|
9
|
+
/**
|
|
10
|
+
* Structural errors for rule-family geoms. Caller returns these immediately
|
|
11
|
+
* (no further layer checks apply to the rule family).
|
|
12
|
+
*/
|
|
13
|
+
export declare function ruleFamilyStructuralErrors(layer: Record<string, unknown>, geom: string, layerPath: string, layerAes: Aes | undefined, mapped: (channel: "x" | "y") => unknown): SpecError[];
|
|
14
|
+
//# sourceMappingURL=validate-structure-layer-rule.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validate-structure-layer-rule.d.ts","sourceRoot":"","sources":["../src/validate-structure-layer-rule.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAGvC,0EAA0E;AAC1E,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAMvF;AAED;;;GAGG;AACH,wBAAgB,0BAA0B,CACxC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC9B,IAAI,EAAE,MAAM,EACZ,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,GAAG,GAAG,SAAS,EACzB,MAAM,EAAE,CAAC,OAAO,EAAE,GAAG,GAAG,GAAG,KAAK,OAAO,GACtC,SAAS,EAAE,CAiDb"}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { isRecord } from "./validate-structure-layer-shared.js";
|
|
2
|
+
/** Asymmetric intercept presence for rule / hline / vline form checks. */
|
|
3
|
+
export function hasGeomIntercepts(geom, layer) {
|
|
4
|
+
const params = layer["params"];
|
|
5
|
+
if (!isRecord(params))
|
|
6
|
+
return false;
|
|
7
|
+
if (geom === "hline")
|
|
8
|
+
return params["yintercept"] !== undefined;
|
|
9
|
+
if (geom === "vline")
|
|
10
|
+
return params["xintercept"] !== undefined;
|
|
11
|
+
return params["xintercept"] !== undefined || params["yintercept"] !== undefined;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Structural errors for rule-family geoms. Caller returns these immediately
|
|
15
|
+
* (no further layer checks apply to the rule family).
|
|
16
|
+
*/
|
|
17
|
+
export function ruleFamilyStructuralErrors(layer, geom, layerPath, layerAes, mapped) {
|
|
18
|
+
const errors = [];
|
|
19
|
+
const intercepts = hasGeomIntercepts(geom, layer);
|
|
20
|
+
// The annotation form inherits NO plot aes (normalize drops it, matching
|
|
21
|
+
// ggplot2's inherit.aes = FALSE) — only the layer's OWN x/y mappings
|
|
22
|
+
// conflict with intercepts. Data-driven hline/vline sugar also nulls the
|
|
23
|
+
// orthogonal axis during normalize; pre-normalize validation still sees
|
|
24
|
+
// raw layer aes here.
|
|
25
|
+
const own = (channel) => layerAes?.[channel] ?? undefined;
|
|
26
|
+
let x = intercepts ? own("x") : mapped("x");
|
|
27
|
+
let y = intercepts ? own("y") : mapped("y");
|
|
28
|
+
// Pre-normalize data-driven aliases: orthogonal axis is not part of the form.
|
|
29
|
+
if (!intercepts && geom === "hline")
|
|
30
|
+
x = undefined;
|
|
31
|
+
if (!intercepts && geom === "vline")
|
|
32
|
+
y = undefined;
|
|
33
|
+
const { interceptHint, dataHint } = ruleHints(geom);
|
|
34
|
+
if (intercepts && (x !== undefined || y !== undefined)) {
|
|
35
|
+
errors.push({
|
|
36
|
+
code: "rule-form-ambiguous",
|
|
37
|
+
path: layerPath,
|
|
38
|
+
message: `This ${geom} layer mixes the annotation form (${interceptHint}) with mapped ${dataHint}. Use fixed intercepts OR a data mapping, never both.`,
|
|
39
|
+
fix: {
|
|
40
|
+
description: "Remove the intercept params (data-driven form), or unset the position aes with null (annotation form).",
|
|
41
|
+
example: ruleExample(geom),
|
|
42
|
+
},
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
else if (!intercepts && x === undefined && y === undefined) {
|
|
46
|
+
errors.push({
|
|
47
|
+
code: "rule-form-missing",
|
|
48
|
+
path: layerPath,
|
|
49
|
+
message: `This ${geom} layer has neither fixed intercepts (${interceptHint}) nor a mapped ${dataHint} — nothing to draw.`,
|
|
50
|
+
fix: {
|
|
51
|
+
description: missingRuleDescription(geom),
|
|
52
|
+
example: ruleExample(geom),
|
|
53
|
+
},
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
else if (!intercepts && x !== undefined && y !== undefined) {
|
|
57
|
+
errors.push({
|
|
58
|
+
code: "rule-both-axes",
|
|
59
|
+
path: layerPath,
|
|
60
|
+
message: "This rule layer maps BOTH aes.x and aes.y; a data-driven rule is either vertical (map x) or horizontal (map y). Unset the other channel with null.",
|
|
61
|
+
fix: {
|
|
62
|
+
description: "Keep one direction and unset the other channel with null.",
|
|
63
|
+
example: { geom: "rule", aes: { y: null } },
|
|
64
|
+
},
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
return errors;
|
|
68
|
+
}
|
|
69
|
+
function ruleHints(geom) {
|
|
70
|
+
if (geom === "hline")
|
|
71
|
+
return { interceptHint: "params.yintercept", dataHint: "aes.y" };
|
|
72
|
+
if (geom === "vline")
|
|
73
|
+
return { interceptHint: "params.xintercept", dataHint: "aes.x" };
|
|
74
|
+
return { interceptHint: "params.xintercept/yintercept", dataHint: "aes.x/aes.y" };
|
|
75
|
+
}
|
|
76
|
+
function ruleExample(geom) {
|
|
77
|
+
if (geom === "vline")
|
|
78
|
+
return { geom: "vline", params: { xintercept: 0 } };
|
|
79
|
+
return { geom: geom === "hline" ? "hline" : "rule", params: { yintercept: 0 } };
|
|
80
|
+
}
|
|
81
|
+
function missingRuleDescription(geom) {
|
|
82
|
+
if (geom === "hline") {
|
|
83
|
+
return "Set params.yintercept for an annotation, or map aes.y for data-driven rules.";
|
|
84
|
+
}
|
|
85
|
+
if (geom === "vline") {
|
|
86
|
+
return "Set params.xintercept for an annotation, or map aes.x for data-driven rules.";
|
|
87
|
+
}
|
|
88
|
+
return "Set params.yintercept (or xintercept) for an annotation, or map aes.x/aes.y to a field for data-driven rules.";
|
|
89
|
+
}
|
|
90
|
+
//# sourceMappingURL=validate-structure-layer-rule.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validate-structure-layer-rule.js","sourceRoot":"","sources":["../src/validate-structure-layer-rule.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,QAAQ,EAAE,MAAM,sCAAsC,CAAC;AAEhE,0EAA0E;AAC1E,MAAM,UAAU,iBAAiB,CAAC,IAAY,EAAE,KAA8B;IAC5E,MAAM,MAAM,GAAG,KAAK,CAAC,QAAQ,CAAC,CAAC;IAC/B,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC;QAAE,OAAO,KAAK,CAAC;IACpC,IAAI,IAAI,KAAK,OAAO;QAAE,OAAO,MAAM,CAAC,YAAY,CAAC,KAAK,SAAS,CAAC;IAChE,IAAI,IAAI,KAAK,OAAO;QAAE,OAAO,MAAM,CAAC,YAAY,CAAC,KAAK,SAAS,CAAC;IAChE,OAAO,MAAM,CAAC,YAAY,CAAC,KAAK,SAAS,IAAI,MAAM,CAAC,YAAY,CAAC,KAAK,SAAS,CAAC;AAClF,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,0BAA0B,CACxC,KAA8B,EAC9B,IAAY,EACZ,SAAiB,EACjB,QAAyB,EACzB,MAAuC;IAEvC,MAAM,MAAM,GAAgB,EAAE,CAAC;IAC/B,MAAM,UAAU,GAAG,iBAAiB,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IAClD,yEAAyE;IACzE,qEAAqE;IACrE,yEAAyE;IACzE,wEAAwE;IACxE,sBAAsB;IACtB,MAAM,GAAG,GAAG,CAAC,OAAkB,EAAE,EAAE,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,IAAI,SAAS,CAAC;IACrE,IAAI,CAAC,GAAG,UAAU,CA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AA+G,CAAC;AACzH,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared helpers for layer structural grammar checks.
|
|
3
|
+
*/
|
|
4
|
+
import type { SpecError } from "./errors.js";
|
|
5
|
+
import type { ChannelName } from "./schema.js";
|
|
6
|
+
/** Same shape as sibling validate-structure-* modules (local, not schema-walk). */
|
|
7
|
+
export declare function isRecord(v: unknown): v is Record<string, unknown>;
|
|
8
|
+
export declare const CHANNEL_FIX_EXAMPLE: {
|
|
9
|
+
field: string;
|
|
10
|
+
};
|
|
11
|
+
export declare function pushMissingChannel(errors: SpecError[], layerPath: string, channel: ChannelName, message: string): void;
|
|
12
|
+
//# sourceMappingURL=validate-structure-layer-shared.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validate-structure-layer-shared.d.ts","sourceRoot":"","sources":["../src/validate-structure-layer-shared.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE/C,mFAAmF;AACnF,wBAAgB,QAAQ,CAAC,CAAC,EAAE,OAAO,GAAG,CAAC,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAEjE;AAED,eAAO,MAAM,mBAAmB;;CAA2B,CAAC;AAE5D,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,SAAS,EAAE,EACnB,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,WAAW,EACpB,OAAO,EAAE,MAAM,GACd,IAAI,CAUN"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/** Same shape as sibling validate-structure-* modules (local, not schema-walk). */
|
|
2
|
+
export function isRecord(v) {
|
|
3
|
+
return typeof v === "object" && v !== null && !Array.isArray(v);
|
|
4
|
+
}
|
|
5
|
+
export const CHANNEL_FIX_EXAMPLE = { field: "column_name" };
|
|
6
|
+
export function pushMissingChannel(errors, layerPath, channel, message) {
|
|
7
|
+
errors.push({
|
|
8
|
+
code: "missing-required-channel",
|
|
9
|
+
path: `${layerPath}/aes/${channel}`,
|
|
10
|
+
message,
|
|
11
|
+
fix: {
|
|
12
|
+
description: `Map "${channel}" to a data field.`,
|
|
13
|
+
example: { [channel]: CHANNEL_FIX_EXAMPLE },
|
|
14
|
+
},
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=validate-structure-layer-shared.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validate-structure-layer-shared.js","sourceRoot":"","sources":["../src/validate-structure-layer-shared.ts"],"names":[],"mappings":"AAMA,mFAAmF;AACnF,MAAM,UAAU,QAAQ,CAAC,CAAU;IACjC,OAAO,OAAO,CAAC,KAAK,QAAQ,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;AAClE,CAAC;AAED,MAAM,CAAC,MAAM,mBAAmB,GAAG,EAAE,KAAK,EAAE,aAAa,EAAE,CAAC;AAE5D,MAAM,UAAU,kBAAkB,CAChC,MAAmB,EACnB,SAAiB,EACjB,OAAoB,EACpB,OAAe;IAEf,MAAM,CAAC,IAAI,CAAC;QACV,IAAI,EAAE,0BAA0B;QAChC,IAAI,EAAE,GAAG,SAAS,QAAQ,OAAO,EAAE;QACnC,OAAO;QACP,GAAG,EAAE;YACH,WAAW,EAAE,QAAQ,OAAO,oBAAoB;YAChD,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,EAAE,mBAAmB,EAAE;SAC5C;KACF,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Data-free structural grammar checks for layers (required channels, rule forms,
|
|
3
|
+
* computed-y bans, bin center/boundary, errorbar stat channels).
|
|
4
|
+
* Color-scheme rules: validate-structure-scales.ts. Facet form: validate-structure-facet.ts.
|
|
5
|
+
* Form families: validate-structure-layer-{rule,ribbon,computed-y,shared}.ts.
|
|
6
|
+
* Barrel: validate-structure.ts.
|
|
7
|
+
*/
|
|
8
|
+
import type { SpecError } from "./errors.js";
|
|
9
|
+
import type { Aes } from "./schema.js";
|
|
10
|
+
/** Grammar checks for one schema-valid layer. */
|
|
11
|
+
export declare function layerStructuralErrors(layer: Record<string, unknown>, geom: string, index: number, plotAes: Aes | undefined): SpecError[];
|
|
12
|
+
//# sourceMappingURL=validate-structure-layers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validate-structure-layers.d.ts","sourceRoot":"","sources":["../src/validate-structure-layers.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,KAAK,EAAE,GAAG,EAAyB,MAAM,aAAa,CAAC;AAyE9D,iDAAiD;AACjD,wBAAgB,qBAAqB,CACnC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC9B,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,GAAG,GAAG,SAAS,GACvB,SAAS,EAAE,CAsCb"}
|
|
@@ -0,0 +1,292 @@
|
|
|
1
|
+
import { GEOM_DEFAULTS } from "./schema-catalog.js";
|
|
2
|
+
import { STYLE_AESTHETIC_GEOMS } from "./capabilities.js";
|
|
3
|
+
import { effectiveChannel } from "./validate-data.js";
|
|
4
|
+
import { paintStructuralErrors } from "./validate-structure-paint.js";
|
|
5
|
+
import { computedYMappedErrors } from "./validate-structure-layer-computed-y.js";
|
|
6
|
+
import { hasGeomIntercepts, ruleFamilyStructuralErrors } from "./validate-structure-layer-rule.js";
|
|
7
|
+
import { ribbonStructuralErrors } from "./validate-structure-layer-ribbon.js";
|
|
8
|
+
import { CHANNEL_FIX_EXAMPLE, isRecord, pushMissingChannel, } from "./validate-structure-layer-shared.js";
|
|
9
|
+
/**
|
|
10
|
+
* Channels every geom needs mapped (after plot-aes inheritance).
|
|
11
|
+
* Total over GeomName — a missing geom is a type error, not a silent `?? []`
|
|
12
|
+
* (#1078). Empty lists are deliberate (form-checked elsewhere or annotation-only).
|
|
13
|
+
*/
|
|
14
|
+
const REQUIRED_CHANNELS = {
|
|
15
|
+
point: ["x", "y"],
|
|
16
|
+
count: ["x", "y"],
|
|
17
|
+
jitter: ["x", "y"],
|
|
18
|
+
line: ["x", "y"],
|
|
19
|
+
path: ["x", "y"], // data-order polylines (#788); same channels as line
|
|
20
|
+
step: ["x", "y"],
|
|
21
|
+
col: ["x", "y"],
|
|
22
|
+
bar: ["x"],
|
|
23
|
+
histogram: ["x"],
|
|
24
|
+
freqpoly: ["x"],
|
|
25
|
+
area: ["x", "y"],
|
|
26
|
+
rule: [], // form-checked separately
|
|
27
|
+
hline: [], // form-checked like rule (yintercept / aes.y)
|
|
28
|
+
vline: [], // form-checked like rule (xintercept / aes.x)
|
|
29
|
+
text: ["x", "y", "label"],
|
|
30
|
+
label: ["x", "y", "label"], // same contract as text (#1078)
|
|
31
|
+
sf_text: ["label"], // x/y come from stat_sf_coordinates (#809 phase 2)
|
|
32
|
+
sf_label: ["label"],
|
|
33
|
+
sf: [], // geometry column, not aes
|
|
34
|
+
smooth: ["x", "y"],
|
|
35
|
+
boxplot: ["x", "y"],
|
|
36
|
+
density: ["x"],
|
|
37
|
+
errorbar: ["x"], // ymin/ymax vs y are stat-dependent, checked separately
|
|
38
|
+
linerange: ["x"],
|
|
39
|
+
pointrange: ["x"],
|
|
40
|
+
crossbar: ["x"],
|
|
41
|
+
rect: ["xmin", "xmax", "ymin", "ymax"],
|
|
42
|
+
segment: ["x", "y", "xend", "yend"],
|
|
43
|
+
violin: ["x", "y"],
|
|
44
|
+
function: [], // domain from xlim / peer / optional x; y is after_stat
|
|
45
|
+
polygon: ["x", "y"],
|
|
46
|
+
spoke: ["x", "y"], // angle/radius: aes or params — checked below
|
|
47
|
+
curve: ["x", "y", "xend", "yend"],
|
|
48
|
+
rug: [], // sides-dependent; checked separately
|
|
49
|
+
tile: ["x", "y"],
|
|
50
|
+
raster: ["x", "y"],
|
|
51
|
+
ribbon: [], // orientation-dependent; checked separately
|
|
52
|
+
contour: ["x", "y", "z"],
|
|
53
|
+
quantile: ["x", "y"],
|
|
54
|
+
density_2d: ["x", "y"],
|
|
55
|
+
density_2d_filled: ["x", "y"],
|
|
56
|
+
hex: ["x", "y"],
|
|
57
|
+
bin_2d: ["x", "y"],
|
|
58
|
+
abline: [], // annotation-only: slope/intercept in params
|
|
59
|
+
qq: ["sample"],
|
|
60
|
+
qq_line: ["sample"],
|
|
61
|
+
dotplot: ["x"],
|
|
62
|
+
map: ["map_id"],
|
|
63
|
+
blank: [], // trains whatever is mapped; nothing required
|
|
64
|
+
};
|
|
65
|
+
/** Grammar checks for one schema-valid layer. */
|
|
66
|
+
export function layerStructuralErrors(layer, geom, index, plotAes) {
|
|
67
|
+
const errors = [];
|
|
68
|
+
const layerAes = isRecord(layer["aes"]) ? layer["aes"] : undefined;
|
|
69
|
+
const layerPath = `/layers/${index}`;
|
|
70
|
+
const mapped = (channel) => effectiveChannel(plotAes, layerAes, channel);
|
|
71
|
+
// Annotation-form rules / hline / vline (fixed intercepts) inherit NO plot
|
|
72
|
+
// aes — normalize drops it — so a plot-level style meant for other layers
|
|
73
|
+
// must not trip the geom-capability check here. Match the rule-form x/y
|
|
74
|
+
// handling below by consulting only the layer's OWN aes for these layers.
|
|
75
|
+
const isRuleFamily = geom === "rule" || geom === "hline" || geom === "vline";
|
|
76
|
+
const annotationRule = isRuleFamily && hasGeomIntercepts(geom, layer);
|
|
77
|
+
errors.push(...styleAestheticErrors(layerAes, geom, annotationRule, mapped, layerPath));
|
|
78
|
+
if (isRuleFamily) {
|
|
79
|
+
// Keep unsupported-geom-aesthetic errors already pushed above; rule form
|
|
80
|
+
// checks append. Returning only the form-check array would drop them.
|
|
81
|
+
errors.push(...ruleFamilyStructuralErrors(layer, geom, layerPath, layerAes, mapped));
|
|
82
|
+
return errors;
|
|
83
|
+
}
|
|
84
|
+
const stat = typeof layer["stat"] === "string"
|
|
85
|
+
? layer["stat"]
|
|
86
|
+
: (GEOM_DEFAULTS[geom]?.stat ?? "identity");
|
|
87
|
+
errors.push(...computedYMappedErrors(geom, stat, layerPath, mapped), ...binAlignmentErrors(layer, geom, stat, layerPath), ...intervalChannelErrors(geom, stat, layerPath, mapped), ...(geom === "ribbon" ? ribbonStructuralErrors(layer, layerPath, mapped) : []), ...statParameterErrors(layer, stat, layerPath), ...spokeStructuralErrors(layer, geom, layerPath, mapped), ...rugStructuralErrors(layer, geom, layerPath, mapped), ...paintStructuralErrors(layer, layerPath, plotAes), ...requiredChannelErrors(geom, stat, layerPath, mapped));
|
|
88
|
+
return errors;
|
|
89
|
+
}
|
|
90
|
+
function binAlignmentErrors(layer, geom, stat, layerPath) {
|
|
91
|
+
const binnedGeom = ["bar", "histogram", "freqpoly", "dotplot"].includes(geom);
|
|
92
|
+
const binnedLayer = binnedGeom ||
|
|
93
|
+
(geom === "line" && (stat === "bin" || stat === "summary_bin")) ||
|
|
94
|
+
((geom === "point" || geom === "errorbar") && stat === "summary_bin") ||
|
|
95
|
+
stat === "summary_bin" ||
|
|
96
|
+
stat === "bindot";
|
|
97
|
+
if (!binnedLayer)
|
|
98
|
+
return [];
|
|
99
|
+
const params = isRecord(layer["params"]) ? layer["params"] : {};
|
|
100
|
+
const binStat = ["histogram", "freqpoly", "dotplot"].includes(geom) ||
|
|
101
|
+
["bin", "summary_bin", "bindot"].includes(stat);
|
|
102
|
+
if (!binStat || params["center"] === undefined || params["boundary"] === undefined)
|
|
103
|
+
return [];
|
|
104
|
+
return [
|
|
105
|
+
{
|
|
106
|
+
code: "bin-center-and-boundary",
|
|
107
|
+
path: `${layerPath}/params`,
|
|
108
|
+
message: `The ${stat === "summary_bin" ? "summary_bin" : "bin"} stat accepts params.center OR params.boundary (both align the bin grid), never both.`,
|
|
109
|
+
fix: {
|
|
110
|
+
description: "Keep one alignment parameter and remove the other.",
|
|
111
|
+
example: { params: { binwidth: 1, boundary: 0 } },
|
|
112
|
+
},
|
|
113
|
+
},
|
|
114
|
+
];
|
|
115
|
+
}
|
|
116
|
+
function intervalChannelErrors(geom, stat, layerPath, mapped) {
|
|
117
|
+
if (!["errorbar", "linerange", "pointrange", "crossbar"].includes(geom))
|
|
118
|
+
return [];
|
|
119
|
+
const needed = stat === "summary" || stat === "summary_bin"
|
|
120
|
+
? ["y"]
|
|
121
|
+
: geom === "pointrange" || geom === "crossbar"
|
|
122
|
+
? ["y", "ymin", "ymax"]
|
|
123
|
+
: ["ymin", "ymax"];
|
|
124
|
+
return needed.flatMap((channel) => mapped(channel) === undefined
|
|
125
|
+
? [
|
|
126
|
+
{
|
|
127
|
+
code: "missing-required-channel",
|
|
128
|
+
path: `${layerPath}/aes/${channel}`,
|
|
129
|
+
message: `The ${geom} geom with the ${stat} stat requires a "${channel}" channel; map it in the layer's aes or the plot-level aes.`,
|
|
130
|
+
fix: {
|
|
131
|
+
description: `Map "${channel}" to a data field.`,
|
|
132
|
+
example: { [channel]: CHANNEL_FIX_EXAMPLE },
|
|
133
|
+
},
|
|
134
|
+
},
|
|
135
|
+
]
|
|
136
|
+
: []);
|
|
137
|
+
}
|
|
138
|
+
function statParameterErrors(layer, stat, layerPath) {
|
|
139
|
+
const errors = [];
|
|
140
|
+
const params = isRecord(layer["params"]) ? layer["params"] : {};
|
|
141
|
+
const fun = params["fun"];
|
|
142
|
+
if (["summary", "summary_bin", "summary_rolling"].includes(stat) &&
|
|
143
|
+
(fun === "first" || fun === "last")) {
|
|
144
|
+
errors.push({
|
|
145
|
+
code: "summary-fun-unsupported",
|
|
146
|
+
path: `${layerPath}/params/fun`,
|
|
147
|
+
message: `The ${stat} stat summarizes with the registry funs mean|median|sum|min|max; params.fun "${fun}" is a manual-stat keep transform and has no meaning here.`,
|
|
148
|
+
fix: {
|
|
149
|
+
description: "Use mean, median, or sum for the center summary (min/max via funMin/funMax where supported).",
|
|
150
|
+
example: { params: { fun: "median" } },
|
|
151
|
+
},
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
const window = params["window"];
|
|
155
|
+
if (stat === "summary_rolling" && (window === undefined || window === null || window === "")) {
|
|
156
|
+
errors.push({
|
|
157
|
+
code: "summary-rolling-window-required",
|
|
158
|
+
path: `${layerPath}/params/window`,
|
|
159
|
+
message: "The summary_rolling stat requires params.window (rolling-window width in x data units, greater than 0). There is no silent default width.",
|
|
160
|
+
fix: {
|
|
161
|
+
description: "Set params.window to the window width in x units (e.g. 30 for a 30-year running summary).",
|
|
162
|
+
example: { params: { window: 30 } },
|
|
163
|
+
},
|
|
164
|
+
});
|
|
165
|
+
}
|
|
166
|
+
if (stat === "manual" && (fun === undefined || fun === null || fun === "")) {
|
|
167
|
+
errors.push({
|
|
168
|
+
code: "manual-fun-required",
|
|
169
|
+
path: `${layerPath}/params/fun`,
|
|
170
|
+
message: "The manual stat requires params.fun (one of first|last|mean|median|min|max|sum). There is no silent identity default (ggplot2 divergence; #814).",
|
|
171
|
+
fix: {
|
|
172
|
+
description: "Set params.fun to a registered portable transform name.",
|
|
173
|
+
example: { params: { fun: "mean" } },
|
|
174
|
+
},
|
|
175
|
+
});
|
|
176
|
+
}
|
|
177
|
+
return errors;
|
|
178
|
+
}
|
|
179
|
+
function spokeStructuralErrors(layer, geom, layerPath, mapped) {
|
|
180
|
+
if (geom !== "spoke")
|
|
181
|
+
return [];
|
|
182
|
+
const errors = [];
|
|
183
|
+
const params = isRecord(layer["params"]) ? layer["params"] : {};
|
|
184
|
+
for (const channel of ["angle", "radius"]) {
|
|
185
|
+
const fromAes = mapped(channel);
|
|
186
|
+
const fromParams = params[channel];
|
|
187
|
+
if (fromAes === undefined && fromParams === undefined) {
|
|
188
|
+
errors.push(spokeChannelError(channel, layerPath, false));
|
|
189
|
+
}
|
|
190
|
+
if (fromAes !== undefined && !("field" in fromAes) && fromParams === undefined) {
|
|
191
|
+
errors.push(spokeChannelError(channel, layerPath, true));
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
return errors;
|
|
195
|
+
}
|
|
196
|
+
function spokeChannelError(channel, layerPath, invalidAesConstant) {
|
|
197
|
+
const message = invalidAesConstant
|
|
198
|
+
? `The spoke geom requires aes.${channel} to map a data field (not a constant or stat). Use params.${channel} for a fixed value.`
|
|
199
|
+
: `The spoke geom requires "${channel}" via aes.${channel} or params.${channel}.`;
|
|
200
|
+
return {
|
|
201
|
+
code: "missing-required-channel",
|
|
202
|
+
path: `${layerPath}/aes/${channel}`,
|
|
203
|
+
message,
|
|
204
|
+
fix: {
|
|
205
|
+
description: `Map aes.${channel} to a field, or set params.${channel} to a constant.`,
|
|
206
|
+
example: channel === "angle"
|
|
207
|
+
? { geom: "spoke", params: { angle: 0, radius: 1 } }
|
|
208
|
+
: { geom: "spoke", params: { radius: 1, angle: 0 } },
|
|
209
|
+
},
|
|
210
|
+
};
|
|
211
|
+
}
|
|
212
|
+
function rugStructuralErrors(layer, geom, layerPath, mapped) {
|
|
213
|
+
if (geom !== "rug")
|
|
214
|
+
return [];
|
|
215
|
+
const errors = [];
|
|
216
|
+
const params = isRecord(layer["params"]) ? layer["params"] : {};
|
|
217
|
+
const sides = typeof params["sides"] === "string" ? params["sides"] : "bl";
|
|
218
|
+
if (/[bt]/.test(sides) && mapped("x") === undefined) {
|
|
219
|
+
pushMissingChannel(errors, layerPath, "x", `The rug geom with sides "${sides}" requires an "x" channel for bottom/top ticks; map aes.x or narrow params.sides.`);
|
|
220
|
+
}
|
|
221
|
+
if (/[lr]/.test(sides) && mapped("y") === undefined) {
|
|
222
|
+
pushMissingChannel(errors, layerPath, "y", `The rug geom with sides "${sides}" requires a "y" channel for left/right ticks; map aes.y or narrow params.sides.`);
|
|
223
|
+
}
|
|
224
|
+
return errors;
|
|
225
|
+
}
|
|
226
|
+
function styleAestheticErrors(layerAes, geom, annotationRule, mapped, layerPath) {
|
|
227
|
+
const errors = [];
|
|
228
|
+
for (const aesthetic of Object.keys(STYLE_AESTHETIC_GEOMS)) {
|
|
229
|
+
const value = annotationRule ? (layerAes?.[aesthetic] ?? undefined) : mapped(aesthetic);
|
|
230
|
+
if (value === undefined)
|
|
231
|
+
continue;
|
|
232
|
+
const compatible = STYLE_AESTHETIC_GEOMS[aesthetic];
|
|
233
|
+
if (compatible.includes(geom))
|
|
234
|
+
continue;
|
|
235
|
+
errors.push({
|
|
236
|
+
code: "unsupported-geom-aesthetic",
|
|
237
|
+
path: `${layerPath}/aes/${aesthetic}`,
|
|
238
|
+
message: `The ${geom} geom does not consume aes.${aesthetic}; supported geoms: ${compatible.join(", ")}.`,
|
|
239
|
+
fix: {
|
|
240
|
+
description: `Remove aes.${aesthetic} or move it to a compatible ${compatible[0]} layer.`,
|
|
241
|
+
},
|
|
242
|
+
});
|
|
243
|
+
}
|
|
244
|
+
return errors;
|
|
245
|
+
}
|
|
246
|
+
function requiredChannelErrors(geom, stat, layerPath, mapped) {
|
|
247
|
+
const errors = [];
|
|
248
|
+
for (const channel of REQUIRED_CHANNELS[geom]) {
|
|
249
|
+
if (computedPositionChannel(geom, stat, channel))
|
|
250
|
+
continue;
|
|
251
|
+
const value = mapped(channel);
|
|
252
|
+
if (value === undefined) {
|
|
253
|
+
errors.push(missingChannelError(geom, layerPath, channel));
|
|
254
|
+
continue;
|
|
255
|
+
}
|
|
256
|
+
if (requiresFieldMapping(geom, channel) && !("field" in value)) {
|
|
257
|
+
errors.push({
|
|
258
|
+
code: "missing-required-channel",
|
|
259
|
+
path: `${layerPath}/aes/${channel}`,
|
|
260
|
+
message: `The ${geom} geom requires aes.${channel} to map a data field (not a constant or stat).`,
|
|
261
|
+
fix: {
|
|
262
|
+
description: `Map "${channel}" to a data field.`,
|
|
263
|
+
example: { [channel]: CHANNEL_FIX_EXAMPLE },
|
|
264
|
+
},
|
|
265
|
+
});
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
return errors;
|
|
269
|
+
}
|
|
270
|
+
function computedPositionChannel(geom, stat, channel) {
|
|
271
|
+
if (channel === "x")
|
|
272
|
+
return false;
|
|
273
|
+
return (["bar", "histogram", "freqpoly", "density", "dotplot"].includes(geom) ||
|
|
274
|
+
(geom === "line" && stat === "bin"));
|
|
275
|
+
}
|
|
276
|
+
function requiresFieldMapping(geom, channel) {
|
|
277
|
+
const endpoint = channel === "x" || channel === "y" || channel === "xend" || channel === "yend";
|
|
278
|
+
return (((geom === "segment" || geom === "curve") && endpoint) ||
|
|
279
|
+
(geom === "spoke" && (channel === "x" || channel === "y")));
|
|
280
|
+
}
|
|
281
|
+
function missingChannelError(geom, layerPath, channel) {
|
|
282
|
+
return {
|
|
283
|
+
code: "missing-required-channel",
|
|
284
|
+
path: `${layerPath}/aes/${channel}`,
|
|
285
|
+
message: `The ${geom} geom requires a "${channel}" channel; map it in the layer's aes or the plot-level aes.`,
|
|
286
|
+
fix: {
|
|
287
|
+
description: `Map "${channel}" to a data field.`,
|
|
288
|
+
example: { [channel]: CHANNEL_FIX_EXAMPLE },
|
|
289
|
+
},
|
|
290
|
+
};
|
|
291
|
+
}
|
|
292
|
+
//# sourceMappingURL=validate-structure-layers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validate-structure-layers.js","sourceRoot":"","sources":["../src/validate-structure-layers.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,qBAAqB,EAAuB,MAAM,mBAAmB,CAAC;AAC/E,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AACtE,OAAO,EAAE,qBAAqB,EAAE,MAAM,0CAA0C,CAAC;AACjF,OAAO,EAAE,iBAAiB,EAAE,0BAA0B,EAAE,MAAM,oCAAoC,CAAC;AACnG,OAAO,EAAE,sBAAsB,EAAE,MAAM,sCAAsC,CAAC;AAC9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AAE;YACH,WAAW,EAAE,QAAQ,OAAO,oBAAoB;YAChD,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,EAAE,mBAAmB,EAAE;SAC5C;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Structural validation for within-mark paint (#591): stop order and
|
|
3
|
+
* data-mapped fill/color conflicts. Schema already rejects empty stops,
|
|
4
|
+
* out-of-range offsets, non-hex colors, and excessive glow radii.
|
|
5
|
+
*/
|
|
6
|
+
import type { SpecError } from "./errors.js";
|
|
7
|
+
import type { Aes } from "./schema.js";
|
|
8
|
+
/**
|
|
9
|
+
* Paint structural checks for one layer (opt-in tier-2 via validate options).
|
|
10
|
+
*/
|
|
11
|
+
export declare function paintStructuralErrors(layer: Record<string, unknown>, layerPath: string, plotAes: Aes | undefined): SpecError[];
|
|
12
|
+
//# sourceMappingURL=validate-structure-paint.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validate-structure-paint.d.ts","sourceRoot":"","sources":["../src/validate-structure-paint.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,KAAK,EAAE,GAAG,EAAgB,MAAM,aAAa,CAAC;AA6CrD;;GAEG;AACH,wBAAgB,qBAAqB,CACnC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC9B,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,GAAG,GAAG,SAAS,GACvB,SAAS,EAAE,CA0Cb"}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { effectiveChannel } from "./validate-data.js";
|
|
2
|
+
function isRecord(v) {
|
|
3
|
+
return typeof v === "object" && v !== null && !Array.isArray(v);
|
|
4
|
+
}
|
|
5
|
+
function isDataMapped(channel) {
|
|
6
|
+
if (channel === undefined || channel === null)
|
|
7
|
+
return false;
|
|
8
|
+
if ("field" in channel)
|
|
9
|
+
return true;
|
|
10
|
+
if ("value" in channel && channel.scale === true)
|
|
11
|
+
return true;
|
|
12
|
+
return false;
|
|
13
|
+
}
|
|
14
|
+
function stopOrderErrors(paint, path) {
|
|
15
|
+
if (!isRecord(paint) || !Array.isArray(paint["stops"]))
|
|
16
|
+
return [];
|
|
17
|
+
const stops = paint["stops"];
|
|
18
|
+
let prev = -Infinity;
|
|
19
|
+
for (let i = 0; i < stops.length; i++) {
|
|
20
|
+
const stop = stops[i];
|
|
21
|
+
if (!isRecord(stop) || typeof stop["offset"] !== "number")
|
|
22
|
+
continue;
|
|
23
|
+
const offset = stop["offset"];
|
|
24
|
+
if (offset < prev) {
|
|
25
|
+
return [
|
|
26
|
+
{
|
|
27
|
+
code: "paint-stops-unordered",
|
|
28
|
+
path: `${path}/stops/${String(i)}/offset`,
|
|
29
|
+
message: `Gradient stop offsets must be non-decreasing; stop ${String(i)} has offset ${String(offset)} after ${String(prev)}.`,
|
|
30
|
+
fix: {
|
|
31
|
+
description: "Sort stops by offset ascending (each between 0 and 1).",
|
|
32
|
+
example: {
|
|
33
|
+
stops: [
|
|
34
|
+
{ offset: 0, color: "#000000" },
|
|
35
|
+
{ offset: 1, color: "#ffffff" },
|
|
36
|
+
],
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
];
|
|
41
|
+
}
|
|
42
|
+
prev = offset;
|
|
43
|
+
}
|
|
44
|
+
return [];
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Paint structural checks for one layer (opt-in tier-2 via validate options).
|
|
48
|
+
*/
|
|
49
|
+
export function paintStructuralErrors(layer, layerPath, plotAes) {
|
|
50
|
+
const errors = [];
|
|
51
|
+
const params = isRecord(layer["params"]) ? layer["params"] : null;
|
|
52
|
+
if (params === null)
|
|
53
|
+
return errors;
|
|
54
|
+
const layerAes = isRecord(layer["aes"]) ? layer["aes"] : undefined;
|
|
55
|
+
const fill = effectiveChannel(plotAes, layerAes, "fill");
|
|
56
|
+
const color = effectiveChannel(plotAes, layerAes, "color");
|
|
57
|
+
if (params["fillPaint"] !== undefined) {
|
|
58
|
+
errors.push(...stopOrderErrors(params["fillPaint"], `${layerPath}/params/fillPaint`));
|
|
59
|
+
if (isDataMapped(fill)) {
|
|
60
|
+
errors.push({
|
|
61
|
+
code: "paint-scale-conflict",
|
|
62
|
+
path: `${layerPath}/params/fillPaint`,
|
|
63
|
+
message: "params.fillPaint cannot combine with a data-mapped fill channel (field or scaled constant).",
|
|
64
|
+
fix: {
|
|
65
|
+
description: "Remove aes.fill field mapping, or remove fillPaint and keep the scale.",
|
|
66
|
+
example: { params: { fillPaint: { type: "linear" } } },
|
|
67
|
+
},
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
if (params["strokePaint"] !== undefined) {
|
|
72
|
+
errors.push(...stopOrderErrors(params["strokePaint"], `${layerPath}/params/strokePaint`));
|
|
73
|
+
if (isDataMapped(color)) {
|
|
74
|
+
errors.push({
|
|
75
|
+
code: "paint-scale-conflict",
|
|
76
|
+
path: `${layerPath}/params/strokePaint`,
|
|
77
|
+
message: "params.strokePaint cannot combine with a data-mapped color channel (field or scaled constant).",
|
|
78
|
+
fix: {
|
|
79
|
+
description: "Remove aes.color field mapping, or remove strokePaint and keep the scale.",
|
|
80
|
+
example: { params: { strokePaint: { type: "linear" } } },
|
|
81
|
+
},
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
return errors;
|
|
86
|
+
}
|
|
87
|
+
//# sourceMappingURL=validate-structure-paint.js.map
|