@graphysdk/viz-engine 0.0.1-experimental.6 → 0.0.1-experimental.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -473,6 +473,16 @@ export declare type BackgroundSpec = {
473
473
 
474
474
  declare function bar(options?: GeomOptions<'bar'>): LayerInputOf<'bar'>;
475
475
 
476
+ /**
477
+ * Which side of the value scale's domain a bar's baseline (its zero origin) falls beyond.
478
+ *
479
+ * - `'min'`: the baseline sits below the domain, so bars grow from the clipped lower edge
480
+ * (the usual case — a positive `domainMin`).
481
+ * - `'max'`: the baseline sits above the domain.
482
+ * - `null`: the baseline is in view, so bars start at their true origin.
483
+ */
484
+ export declare type BarBaselineClip = 'min' | 'max' | null;
485
+
476
486
  /**
477
487
  * Bar/Column-specific parameters — intentionally empty. A bar's geometry comes
478
488
  * entirely from the position columns (band edges plus bar length); corner radius
@@ -3108,6 +3118,16 @@ export declare function getAlpha(observation: Observation): NumericDataValue;
3108
3118
  */
3109
3119
  export declare function getAngleExtent(observation: Observation): AngleExtent;
3110
3120
 
3121
+ /**
3122
+ * Reports whether a bar geom's baseline falls outside the value scale's visible domain. When it
3123
+ * does, bar lengths are truncated at the panel edge and no longer encode their values to scale, so
3124
+ * renderers can fade the clipped edge to signal the truncation.
3125
+ *
3126
+ * Returns `null` for non-continuous or reversed value scales, where a single clipped edge is not
3127
+ * well defined.
3128
+ */
3129
+ export declare const getBarBaselineClip: (valueScale: CompiledScale | undefined) => BarBaselineClip;
3130
+
3111
3131
  /**
3112
3132
  * Normalized data-space bounds for a bar observation in [0, 1]² with origin at the top-left
3113
3133
  * (matches SVG conventions used by overlay renderers). Negative values flip the rect upside-down
package/dist/index.mjs CHANGED
@@ -11,7 +11,7 @@ import "@graphysdk/i18n";
11
11
  import { curveCatmullRom as Aa, curveLinear as Ta, area as Ma, line as xs, arc as La } from "d3-shape";
12
12
  import { Delaunay as Va } from "d3-delaunay";
13
13
  import Ea from "lodash-es/isEqual";
14
- typeof window < "u" && (window.__GRAPHY_SDK__ ??= {}, window.__GRAPHY_SDK__.vizEngine = "0.0.1-experimental.6");
14
+ typeof window < "u" && (window.__GRAPHY_SDK__ ??= {}, window.__GRAPHY_SDK__.vizEngine = "0.0.1-experimental.8");
15
15
  const mn = (e) => e.length > 0;
16
16
  function h(e) {
17
17
  return e != null;
@@ -7357,7 +7357,13 @@ const Ag = ({ guides: e, numberFormat: t, layer: n, locale: r }) => {
7357
7357
  dashOffset: nh(s, c),
7358
7358
  arrowheadExtent: d
7359
7359
  };
7360
- }, sh = (e, t) => Math.min(e, t * e / rh), oh = 2, Wo = (e) => e === "catmull-rom" ? Aa : Ta, Lg = (e) => {
7360
+ }, sh = (e, t) => Math.min(e, t * e / rh), Lg = (e) => {
7361
+ if (!e || e.kind !== "position" || e.spec.scaleType !== "continuous" || e.spec.reverse) return null;
7362
+ const t = e.domain[0], n = e.domain[e.domain.length - 1];
7363
+ if (typeof t != "number" || typeof n != "number") return null;
7364
+ const r = 0;
7365
+ return t > r ? "min" : n < r ? "max" : null;
7366
+ }, oh = 2, Wo = (e) => e === "catmull-rom" ? Aa : Ta, Vg = (e) => {
7361
7367
  switch (e) {
7362
7368
  case "dashed":
7363
7369
  return "8 4";
@@ -7366,7 +7372,7 @@ const Ag = ({ guides: e, numberFormat: t, layer: n, locale: r }) => {
7366
7372
  case "solid":
7367
7373
  return;
7368
7374
  }
7369
- }, Vg = (e, t) => t.lineWidth !== "auto" ? t.lineWidth : Pa(e) ?? oh, Eg = (e, t) => {
7375
+ }, Eg = (e, t) => t.lineWidth !== "auto" ? t.lineWidth : Pa(e) ?? oh, kg = (e, t) => {
7370
7376
  const n = Wo(t.interpolate), r = Ma().curve(n), s = xs().curve(n);
7371
7377
  if (e.mainAxis === "y") {
7372
7378
  const o = (c) => Ee(C(c) ?? 0), a = (c) => be(c) ?? 0, i = (c) => ie(c) ?? G(c) ?? 0;
@@ -7380,7 +7386,7 @@ const Ag = ({ guides: e, numberFormat: t, layer: n, locale: r }) => {
7380
7386
  r.defined(o), s.defined(o);
7381
7387
  }
7382
7388
  return { lineGenerator: s, areaGenerator: r };
7383
- }, kg = (e, t) => t !== "connect" ? e : e.filter((n) => G(n) !== null && C(n) !== null), Ig = (e, t) => {
7389
+ }, Ig = (e, t) => t !== "connect" ? e : e.filter((n) => G(n) !== null && C(n) !== null), Cg = (e, t) => {
7384
7390
  const n = be(t), r = ie(t), s = se(t), o = H(t) ?? C(t);
7385
7391
  if (n === null || r === null || s === null || o === null) return null;
7386
7392
  if (e === "x") {
@@ -7389,16 +7395,16 @@ const Ag = ({ guides: e, numberFormat: t, layer: n, locale: r }) => {
7389
7395
  }
7390
7396
  let a = n, i = r - n;
7391
7397
  return i < 0 && (a += i, i = -i), { x: a, y: 1 - o, width: i, height: o - s };
7392
- }, Cg = (e) => {
7398
+ }, Dg = (e) => {
7393
7399
  const t = xs().x((n) => G(n) ?? 0).y((n) => Ee(C(n) ?? 0)).curve(Wo(e.interpolate));
7394
7400
  return e.missingValues === "gap" && t.defined((n) => G(n) !== null && C(n) !== null), t;
7395
- }, Dg = (e, t) => t !== "connect" ? e : e.filter((n) => G(n) !== null && C(n) !== null), ah = La(), Fg = (e) => ah(e), _g = (e, t, n) => {
7401
+ }, Fg = (e, t) => t !== "connect" ? e : e.filter((n) => G(n) !== null && C(n) !== null), ah = La(), _g = (e) => ah(e), Rg = (e, t, n) => {
7396
7402
  const r = Mn(e, t);
7397
7403
  return (s) => {
7398
7404
  const o = Ie(s) ?? "default", a = r(s);
7399
7405
  return `${n}-${o}${a !== null && a !== "" ? `-${a}` : ""}`;
7400
7406
  };
7401
- }, Rg = () => (e, t) => fn(e) ?? `default-${t}`;
7407
+ }, Ng = () => (e, t) => fn(e) ?? `default-${t}`;
7402
7408
  function Yo(e, t) {
7403
7409
  return Xn(e.buckets, t, (n) => n.main);
7404
7410
  }
@@ -7932,7 +7938,7 @@ function Wh({ layer: e, cursor: t, aspectRatio: n, warmStarts: r }) {
7932
7938
  }
7933
7939
  }
7934
7940
  const mt = { primary: null, group: [], related: /* @__PURE__ */ new Map() }, Yh = 1;
7935
- class Ng {
7941
+ class Pg {
7936
7942
  constructor({ layers: t, coordSystem: n }) {
7937
7943
  this.layerIndexes = [], this.layerRefs = [], this.aspectRatio = Yh, this.warmStarts = /* @__PURE__ */ new Map(), this.cachedState = mt, this.cachedKey = null, this.nonInteractiveLayerIds = /* @__PURE__ */ new Set(), this.layerIndexes = t.map((r) => ps(r, n, this.aspectRatio)), this.layerRefs = t.map((r) => ms(r, n)), this.nonInteractiveLayerIds = fs(t);
7938
7944
  }
@@ -8030,7 +8036,7 @@ function fs(e) {
8030
8036
  function Hh(e, t) {
8031
8037
  return e.data === t.data && e.geom === t.geom && e.position === t.position && e.coord === t.coord;
8032
8038
  }
8033
- function Pg(e, t) {
8039
+ function Og(e, t) {
8034
8040
  const n = Ue(e.mainAxis, t);
8035
8041
  if (e.mainAxis === "y") {
8036
8042
  const s = Me(Ee(n));
@@ -8039,7 +8045,7 @@ function Pg(e, t) {
8039
8045
  const r = Me(n);
8040
8046
  return { x1: r, x2: r, y1: 0, y2: "100%" };
8041
8047
  }
8042
- function Og(e, t, n) {
8048
+ function $g(e, t, n) {
8043
8049
  const r = e.mainAxis === "y" ? C(n.observation) : G(n.observation);
8044
8050
  if (r === null) return null;
8045
8051
  const s = e.mainAxis === "y" ? Kh(n) : Uh(n), a = (t.x?.kind === "position" ? t.x : null)?.bandwidth ?? s;
@@ -8060,7 +8066,7 @@ function Kh(e) {
8060
8066
  const t = se(e.observation), n = H(e.observation);
8061
8067
  return t === null || n === null ? null : n - t;
8062
8068
  }
8063
- const Xh = /^(?:https?:|mailto:)/i, $g = (e) => {
8069
+ const Xh = /^(?:https?:|mailto:)/i, Bg = (e) => {
8064
8070
  if (typeof e != "string") return !1;
8065
8071
  const t = e.replace(/^[\x00-\x20]+/, "");
8066
8072
  return t.length === 0 ? !1 : Xh.test(t);
@@ -8134,7 +8140,7 @@ const Xh = /^(?:https?:|mailto:)/i, $g = (e) => {
8134
8140
  throw new Error(`Unhandled value format: ${n.type}`);
8135
8141
  }
8136
8142
  }
8137
- }, Bg = ({
8143
+ }, zg = ({
8138
8144
  layers: e,
8139
8145
  coordSystem: t,
8140
8146
  scales: n,
@@ -8231,10 +8237,10 @@ function ny(e, t) {
8231
8237
  const n = Qe(t.yScaleType);
8232
8238
  return Kn(e, n)?.label ?? "";
8233
8239
  }
8234
- const zg = (e) => ({
8240
+ const Gg = (e) => ({
8235
8241
  type: "annotations",
8236
8242
  annotations: e
8237
- }), Gg = {
8243
+ }), Wg = {
8238
8244
  lilac: "linear-gradient(94deg, #C9C0F7 -2.94%, #F6E6FD 92.51%)",
8239
8245
  neon_pink: "linear-gradient(93deg, #E04A95 2.61%, #FD7F92 97.51%)",
8240
8246
  blackberry: "linear-gradient(132deg, #9F9FED 2.98%, #B9E6FF 97.65%)",
@@ -8248,7 +8254,7 @@ const zg = (e) => ({
8248
8254
  cool: "linear-gradient(93.55deg, #3F8EEB -6.07%, #58C8D8 113.6%)",
8249
8255
  fresh: "linear-gradient(114.37deg, #A4A4EE 4.32%, #58C8D8 87.71%)"
8250
8256
  };
8251
- function Wg(e, t = {}) {
8257
+ function Yg(e, t = {}) {
8252
8258
  return {
8253
8259
  type: "highlight",
8254
8260
  id: t.id,
@@ -8257,7 +8263,7 @@ function Wg(e, t = {}) {
8257
8263
  layerIndex: t.layerIndex
8258
8264
  };
8259
8265
  }
8260
- function Yg(...e) {
8266
+ function Hg(...e) {
8261
8267
  let t = {}, n;
8262
8268
  const [r, ...s] = e;
8263
8269
  h(r) && !ry(r) ? (t = r, n = s) : n = e;
@@ -8271,7 +8277,7 @@ function Yg(...e) {
8271
8277
  };
8272
8278
  return n.reduce((a, i) => Ko(a, i), o);
8273
8279
  }
8274
- function Hg(e, ...t) {
8280
+ function Ug(e, ...t) {
8275
8281
  return t.reduce((n, r) => Ko(n, r), e);
8276
8282
  }
8277
8283
  function ry(e) {
@@ -8315,7 +8321,7 @@ function sy(e, t) {
8315
8321
  function de(e, t) {
8316
8322
  return e ? t ? [...e, ...t] : e : t;
8317
8323
  }
8318
- function Ug(e) {
8324
+ function Kg(e) {
8319
8325
  return {
8320
8326
  mapping: e.mapping,
8321
8327
  layers: e.layers,
@@ -8952,7 +8958,7 @@ L.register(wy);
8952
8958
  L.register(Ay);
8953
8959
  L.register(Ty);
8954
8960
  L.register(My);
8955
- class Kg {
8961
+ class Xg {
8956
8962
  constructor(t = {}) {
8957
8963
  this.undoStack = [], this.redoStack = [], this.listeners = /* @__PURE__ */ new Set(), this.isEmitting = !1, this.cachedSnapshot = null, this.maxHistorySize = t.maxHistorySize ?? 100;
8958
8964
  }
@@ -9059,11 +9065,11 @@ const Xo = 500, jo = "normal", qo = {
9059
9065
  heavy: 900,
9060
9066
  extraBlack: 950,
9061
9067
  ultraBlack: 950
9062
- }, Xg = (e) => {
9068
+ }, jg = (e) => {
9063
9069
  const t = e.style ?? jo, n = e.weight ?? Xo, r = e.family.includes(",") ? e.family : `'${e.family}'`;
9064
9070
  return `${t} ${n} ${e.size}px ${r}`;
9065
- }, jg = (e) => typeof e == "string" ? e : Qo(e), Qo = (e) => e.text !== void 0 ? e.text : e.content ? e.content.map(Qo).join("") : "", Zo = (e) => typeof e != "string" ? e ?? Xo : qo[e], Ry = "\0";
9066
- class qg {
9071
+ }, qg = (e) => typeof e == "string" ? e : Qo(e), Qo = (e) => e.text !== void 0 ? e.text : e.content ? e.content.map(Qo).join("") : "", Zo = (e) => typeof e != "string" ? e ?? Xo : qo[e], Ry = "\0";
9072
+ class Qg {
9067
9073
  constructor(t) {
9068
9074
  this.inner = t, this.cache = /* @__PURE__ */ new Map();
9069
9075
  }
@@ -9175,7 +9181,7 @@ const Ny = {
9175
9181
  "}": 0.33,
9176
9182
  "~": 0.56
9177
9183
  }, Py = 0.55, Oy = 1.05, $y = 0.84, By = 0.21;
9178
- class Qg {
9184
+ class Zg {
9179
9185
  measureText(t, n) {
9180
9186
  let r = 0;
9181
9187
  for (const i of t)
@@ -9192,11 +9198,11 @@ class Qg {
9192
9198
  }
9193
9199
  export {
9194
9200
  Bu as BORDER_PRESETS,
9195
- Gg as BORDER_PRESET_GRADIENTS,
9201
+ Wg as BORDER_PRESET_GRADIENTS,
9196
9202
  lg as COMPILER_STAGE_KEYS,
9197
- qg as CachedTextMeasurer,
9203
+ Qg as CachedTextMeasurer,
9198
9204
  _y as CommandRegistry,
9199
- Kg as CommandStackManager,
9205
+ Xg as CommandStackManager,
9200
9206
  zp as Compiler,
9201
9207
  jo as DEFAULT_FONT_STYLE,
9202
9208
  Xo as DEFAULT_FONT_WEIGHT,
@@ -9209,8 +9215,8 @@ export {
9209
9215
  Hf as HEADLINE_TREND_GAP,
9210
9216
  Yf as HEADLINE_TREND_ICON_SIZE,
9211
9217
  Wf as HEADLINE_VALUE_LABEL_GAP,
9212
- Qg as HeuristicTextMeasurer,
9213
- Ng as HoverEngine,
9218
+ Zg as HeuristicTextMeasurer,
9219
+ Pg as HoverEngine,
9214
9220
  _o as LAYOUT_PADDING,
9215
9221
  mg as LayoutCompiler,
9216
9222
  nu as MONO_BASES,
@@ -9227,39 +9233,39 @@ export {
9227
9233
  gr as SetScaleDomainCommand,
9228
9234
  pp as SpecResolver,
9229
9235
  ge as VISUAL_VARIABLES,
9230
- zg as annotations,
9236
+ Gg as annotations,
9231
9237
  fg as buildAverageLineSymbols,
9232
9238
  gg as buildDataLabelsContent,
9233
- Xg as buildFontString,
9239
+ jg as buildFontString,
9234
9240
  zo as buildLayerYValueFormatter,
9235
- Fg as buildPolarBarArcPath,
9236
- Bg as buildTooltipContent,
9241
+ _g as buildPolarBarArcPath,
9242
+ zg as buildTooltipContent,
9237
9243
  L as commandRegistry,
9238
9244
  bg as computeDifferenceArrow,
9239
9245
  vg as computeDirectLabelsLayout,
9240
9246
  Mg as computeFreeformArrow,
9241
9247
  zu as config,
9242
- Ug as convertSpecToInput,
9248
+ Kg as convertSpecToInput,
9243
9249
  z as coord,
9244
9250
  ag as createAlphaValueReader,
9245
- Eg as createAreaPathGenerators,
9251
+ kg as createAreaPathGenerators,
9246
9252
  Al as createColorValueReader,
9247
9253
  ug as createCompiler,
9248
9254
  El as createEmptyHighlight,
9249
9255
  ig as createGroupValueReader,
9250
9256
  Tg as createHeadlineItemRows,
9251
9257
  sg as createLabelValueReader,
9252
- Cg as createLinePathGenerator,
9258
+ Dg as createLinePathGenerator,
9253
9259
  ee as createRawValueReader,
9254
9260
  Vn as createSegmentYReader,
9255
9261
  og as createSizeValueReader,
9256
- Yg as createSpec,
9257
- _g as createStableKeyGenerator,
9262
+ Hg as createSpec,
9263
+ Rg as createStableKeyGenerator,
9258
9264
  cg as createStrokeWidthValueReader,
9259
9265
  P as createValueFormatter,
9260
9266
  Mn as createXValueReader,
9261
9267
  wl as createYValueReader,
9262
- jg as extractPlainText,
9268
+ qg as extractPlainText,
9263
9269
  Kn as findAxisGuide,
9264
9270
  wg as findLegendForAesthetic,
9265
9271
  xg as formatHeadline,
@@ -9268,21 +9274,22 @@ export {
9268
9274
  F as geom,
9269
9275
  rg as getAlpha,
9270
9276
  lf as getAngleExtent,
9271
- Ig as getBarRectBounds,
9277
+ Lg as getBarBaselineClip,
9278
+ Cg as getBarRectBounds,
9272
9279
  fn as getColor,
9273
9280
  Hn as getCrossAxisCoordinate,
9274
9281
  Wo as getCurve,
9275
- Lg as getDashArray,
9282
+ Vg as getDashArray,
9276
9283
  Co as getDifferenceArrowDimensions,
9277
9284
  Ie as getGroup,
9278
- Pg as getHoverGuideLineProps,
9279
- Og as getHoverGuideRectProps,
9285
+ Og as getHoverGuideLineProps,
9286
+ $g as getHoverGuideRectProps,
9280
9287
  Oa as getLineType,
9281
9288
  Ue as getMainAxisCoordinate,
9282
9289
  Zo as getNumericWeight,
9283
9290
  uf as getRadiusExtent,
9284
9291
  Na as getSize,
9285
- Rg as getStablePolarBarKeyGenerator,
9292
+ Ng as getStablePolarBarKeyGenerator,
9286
9293
  Pa as getStrokeWidth,
9287
9294
  G as getX,
9288
9295
  ie as getXMax,
@@ -9291,7 +9298,7 @@ export {
9291
9298
  H as getYMax,
9292
9299
  se as getYMin,
9293
9300
  Ra as getYRaw,
9294
- Wg as highlight,
9301
+ Yg as highlight,
9295
9302
  hg as isCartesian,
9296
9303
  wi as isCategoricalValueFormat,
9297
9304
  tg as isCompilerCachingEnabled,
@@ -9302,19 +9309,19 @@ export {
9302
9309
  dg as isLayerOf,
9303
9310
  Si as isLookupValueFormat,
9304
9311
  ks as isNumericValueFormat,
9305
- $g as isSafeUrl,
9312
+ Bg as isSafeUrl,
9306
9313
  J as isStackedPosition,
9307
9314
  je as isTemporalValueFormat,
9308
9315
  ng as mapping,
9309
- Hg as pipe,
9316
+ Ug as pipe,
9310
9317
  A as prefixInternalVariable,
9311
- kg as prepareAreaObservations,
9312
- Dg as prepareLineObservations,
9318
+ Ig as prepareAreaObservations,
9319
+ Fg as prepareLineObservations,
9313
9320
  Uh as readXExtent,
9314
9321
  Kh as readYExtent,
9315
9322
  pg as resolveHeadlinePlacement,
9316
9323
  Ln as resolveSegmentYSource,
9317
- Vg as resolveStrokeWidth,
9324
+ Eg as resolveStrokeWidth,
9318
9325
  Qe as resolveYScaleAesthetic,
9319
9326
  Ve as scale,
9320
9327
  eg as setCompilerCachingEnabled,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@graphysdk/viz-engine",
3
3
  "author": "Graphy",
4
- "version": "0.0.1-experimental.6",
4
+ "version": "0.0.1-experimental.8",
5
5
  "private": false,
6
6
  "type": "module",
7
7
  "sideEffects": [
@@ -44,8 +44,8 @@
44
44
  "vite": "^6.4.2",
45
45
  "vite-plugin-dts": "^4.5.4",
46
46
  "vitest": "^4.1.0",
47
- "@graphytools/eslint-plugin-graphy": "1.0.0",
48
47
  "@graphytools/eslint-config": "0.0.1",
48
+ "@graphytools/eslint-plugin-graphy": "1.0.0",
49
49
  "@graphytools/vitest-config": "1.0.0",
50
50
  "@graphytools/typescript-config": "0.0.1"
51
51
  },