@synnaxlabs/x 0.34.0 → 0.35.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.
Files changed (72) hide show
  1. package/.turbo/turbo-build.log +25 -25
  2. package/dist/{box-Mf8E1Ypp.cjs → box-BpSX4si6.cjs} +1 -1
  3. package/dist/{box-DVCNGsJG.js → box-CYXc9-qp.js} +2 -2
  4. package/dist/box.cjs +1 -1
  5. package/dist/box.js +1 -1
  6. package/dist/deep.cjs +1 -1
  7. package/dist/deep.js +1 -1
  8. package/dist/index.cjs +2 -2
  9. package/dist/index.js +38 -37
  10. package/dist/location-Cn1ByVTZ.js +95 -0
  11. package/dist/location-DLP2ZS0o.cjs +1 -0
  12. package/dist/location.cjs +1 -1
  13. package/dist/location.js +1 -1
  14. package/dist/path-1tZLZ4AN.cjs +1 -0
  15. package/dist/path-DD6ytXzr.js +76 -0
  16. package/dist/{position-CFc9RsSn.js → position-DJXB-pDS.js} +2 -2
  17. package/dist/{position-DKhPhvPh.cjs → position-JCN6-sJC.cjs} +1 -1
  18. package/dist/position.cjs +1 -1
  19. package/dist/position.js +1 -1
  20. package/dist/record.cjs +1 -1
  21. package/dist/record.js +5 -4
  22. package/dist/{scale-DNQE1LMm.js → scale-Coub2bPH.js} +70 -67
  23. package/dist/scale-Dj7-5FQQ.cjs +1 -0
  24. package/dist/scale.cjs +1 -1
  25. package/dist/scale.js +1 -1
  26. package/dist/{series-DWLXo7J6.cjs → series-CAP8K7YO.cjs} +1 -1
  27. package/dist/{series-sjWkW8qe.js → series-DOxur2pj.js} +5 -5
  28. package/dist/spatial.cjs +1 -1
  29. package/dist/spatial.js +5 -5
  30. package/dist/src/deep/path.d.ts.map +1 -1
  31. package/dist/src/record.d.ts +1 -0
  32. package/dist/src/record.d.ts.map +1 -1
  33. package/dist/src/record.spec.d.ts +2 -0
  34. package/dist/src/record.spec.d.ts.map +1 -0
  35. package/dist/src/spatial/location/location.d.ts +1 -0
  36. package/dist/src/spatial/location/location.d.ts.map +1 -1
  37. package/dist/src/spatial/scale/scale.d.ts +17 -1
  38. package/dist/src/spatial/scale/scale.d.ts.map +1 -1
  39. package/dist/src/spatial/xy/xy.d.ts +36 -1
  40. package/dist/src/spatial/xy/xy.d.ts.map +1 -1
  41. package/dist/src/zodutil/zodutil.d.ts.map +1 -1
  42. package/dist/telem.cjs +1 -1
  43. package/dist/telem.js +1 -1
  44. package/dist/xy-DQdccWlc.js +128 -0
  45. package/dist/xy-LADI2wVU.cjs +1 -0
  46. package/dist/xy.cjs +1 -1
  47. package/dist/xy.js +1 -1
  48. package/dist/zodutil-BRjUdYAv.cjs +1 -0
  49. package/dist/{zodutil-Tmuc4CNq.js → zodutil-DI4gVZkT.js} +11 -11
  50. package/dist/zodutil.cjs +1 -1
  51. package/dist/zodutil.js +1 -1
  52. package/package.json +2 -2
  53. package/src/deep/path.ts +6 -1
  54. package/src/record.spec.ts +29 -0
  55. package/src/record.ts +6 -0
  56. package/src/spatial/location/location.ts +1 -0
  57. package/src/spatial/scale/scale.spec.ts +62 -51
  58. package/src/spatial/scale/scale.ts +21 -12
  59. package/src/spatial/xy/xy.spec.ts +22 -1
  60. package/src/spatial/xy/xy.ts +101 -5
  61. package/src/strings/strings.spec.ts +0 -4
  62. package/src/telem/series.spec.ts +0 -1
  63. package/src/zodutil/zodutil.ts +4 -1
  64. package/tsconfig.tsbuildinfo +1 -1
  65. package/dist/location-CI9x53qR.js +0 -94
  66. package/dist/location-DetomF8Z.cjs +0 -1
  67. package/dist/path-BBCx3K6k.cjs +0 -1
  68. package/dist/path-CmnoH3RC.js +0 -72
  69. package/dist/scale-CT61XD_X.cjs +0 -1
  70. package/dist/xy-CrgPnICw.js +0 -89
  71. package/dist/xy-cP-FXJtR.cjs +0 -1
  72. package/dist/zodutil-C6RYzvXd.cjs +0 -1
@@ -1,72 +0,0 @@
1
- const c = (l, e, t = ".") => {
2
- const n = l.split(t);
3
- return n.map((s, o) => {
4
- const a = e(s, o, n);
5
- return a == null ? null : typeof a == "string" ? a : a.join(t);
6
- }).filter((s) => s != null).join(t);
7
- }, u = (l, e, t = { optional: !1, separator: "." }) => {
8
- t.separator ?? (t.separator = ".");
9
- const { optional: n, getter: r = (a, i) => a[i] } = t, s = e.split(t.separator);
10
- if (s.length === 1 && s[0] === "") return l;
11
- let o = l;
12
- for (const a of s) {
13
- const i = r(o, a);
14
- if (i == null) {
15
- if (n) return null;
16
- throw new Error(`Path ${e} does not exist. ${a} is null`);
17
- }
18
- o = i;
19
- }
20
- return o;
21
- }, f = (l, e, t) => {
22
- const n = e.split(".");
23
- let r = l;
24
- for (let s = 0; s < n.length - 1; s++) {
25
- const o = n[s];
26
- r[o] ?? (r[o] = {}), r = r[o];
27
- }
28
- r[n[n.length - 1]] = t;
29
- }, p = (l, e) => {
30
- const t = e.split(".");
31
- let n = l;
32
- for (let r = 0; r < t.length - 1; r++) {
33
- const s = t[r];
34
- if (n[s] == null) return;
35
- n = n[s];
36
- }
37
- if (Array.isArray(n)) {
38
- const r = parseInt(t[t.length - 1]);
39
- if (isNaN(r)) return;
40
- n.splice(r, 1);
41
- return;
42
- }
43
- delete n[t[t.length - 1]];
44
- }, h = (l, e) => {
45
- const t = l.split(".");
46
- return e < 0 ? t[t.length + e] : t[e];
47
- }, g = (l, e) => {
48
- try {
49
- return u(l, e), !0;
50
- } catch {
51
- return !1;
52
- }
53
- }, m = (l, e) => {
54
- if (e.length === 0) return !0;
55
- const t = l.split("."), n = e.split(".");
56
- if (n.length > t.length) return !1;
57
- for (let r = 0; r < n.length; r++) {
58
- const s = t[r], o = n[r];
59
- if (o !== "*" && s !== o)
60
- return !1;
61
- }
62
- return !0;
63
- };
64
- export {
65
- h as e,
66
- u as g,
67
- g as h,
68
- m as p,
69
- p as r,
70
- f as s,
71
- c as t
72
- };
@@ -1 +0,0 @@
1
- "use strict";var v=Object.defineProperty;var g=(n,t,e)=>t in n?v(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e;var i=(n,t,e)=>g(n,typeof t!="symbol"?t+"":t,e);const R=require("zod"),x=require("./bounds-DzCDHgdE.cjs"),u=require("./box-Mf8E1Ypp.cjs"),T=require("./location-DetomF8Z.cjs"),h=require("./xy-cP-FXJtR.cjs"),m=(n,t,e)=>t!==void 0&&n<t?t:e!==void 0&&n>e?e:n,q=R.z.object({offset:h.crudeZ,scale:h.crudeZ}),E=n=>(t,e,s,r)=>e==="dimension"?[t,s]:[t,r?s-n:s+n],I=n=>(t,e,s,r)=>[t,r?s/n:s*n],Y=n=>(t,e,s)=>{if(t===null)return[n,s];const{lower:r,upper:o}=t,{lower:p,upper:l}=n,f=o-r,w=l-p;if(e==="dimension")return[n,s*(w/f)];const B=(s-r)*(w/f)+p;return[n,B]},j=n=>(t,e,s)=>[n,s],z=()=>(n,t,e)=>{if(n===null)throw new Error("cannot invert without bounds");if(t==="dimension")return[n,e];const{lower:s,upper:r}=n;return[n,r-(e-s)]},D=n=>(t,e,s)=>{const{lower:r,upper:o}=n;return s=m(s,r,o),[t,s]},a=class a{constructor(){i(this,"ops",[]);i(this,"currBounds",null);i(this,"currType",null);i(this,"reversed",!1);this.ops=[]}static translate(t){return new a().translate(t)}static magnify(t){return new a().magnify(t)}static scale(t,e){return new a().scale(t,e)}translate(t){const e=this.new(),s=E(t);return s.type="translate",e.ops.push(s),e}magnify(t){const e=this.new(),s=I(t);return s.type="magnify",e.ops.push(s),e}scale(t,e){const s=x.construct(t,e),r=this.new(),o=Y(s);return o.type="scale",r.ops.push(o),r}clamp(t,e){const s=x.construct(t,e),r=this.new(),o=D(s);return o.type="clamp",r.ops.push(o),r}reBound(t,e){const s=x.construct(t,e),r=this.new(),o=j(s);return o.type="re-bound",r.ops.push(o),r}invert(){const t=z();t.type="invert";const e=this.new();return e.ops.push(t),e}pos(t){return this.exec("position",t)}dim(t){return this.exec("dimension",t)}new(){const t=new a;return t.ops=this.ops.slice(),t.reversed=this.reversed,t}exec(t,e){return this.currBounds=null,this.ops.reduce(([s,r],o)=>o(s,t,r,this.reversed),[null,e])[1]}reverse(){const t=this.new();t.ops.reverse();const e=[];return t.ops.forEach((s,r)=>{if(s.type==="scale"||e.some(([p,l])=>r>=p&&r<=l))return;const o=t.ops.findIndex((p,l)=>p.type==="scale"&&l>r);o!==-1&&e.push([r,o])}),e.forEach(([s,r])=>{const o=t.ops.slice(s,r);o.unshift(t.ops[r]),t.ops.splice(s,r-s+1,...o)}),t.reversed=!t.reversed,t}};i(a,"IDENTITY",new a);let y=a;const L=n=>({scale:{x:n.x.dim(1),y:n.y.dim(1)},offset:{x:n.x.pos(0),y:n.y.pos(0)}}),c=class c{constructor(t=new y,e=new y,s=null){i(this,"x");i(this,"y");i(this,"currRoot");this.x=t,this.y=e,this.currRoot=s}static translate(t,e){return new c().translate(t,e)}static translateX(t){return new c().translateX(t)}static translateY(t){return new c().translateY(t)}static clamp(t){return new c().clamp(t)}static magnify(t){return new c().magnify(t)}static scale(t){return new c().scale(t)}static reBound(t){return new c().reBound(t)}translate(t,e){const s=h.construct(t,e),r=this.copy();return r.x=this.x.translate(s.x),r.y=this.y.translate(s.y),r}translateX(t){const e=this.copy();return e.x=this.x.translate(t),e}translateY(t){const e=this.copy();return e.y=this.y.translate(t),e}magnify(t){const e=this.copy();return e.x=this.x.magnify(t.x),e.y=this.y.magnify(t.y),e}scale(t){const e=this.copy();if(u.isBox(t)){const s=this.currRoot;return e.currRoot=t.root,s!=null&&!T.xyEquals(s,t.root)&&(s.x!==t.root.x&&(e.x=e.x.invert()),s.y!==t.root.y&&(e.y=e.y.invert())),e.x=e.x.scale(u.xBounds(t)),e.y=e.y.scale(u.yBounds(t)),e}return e.x=e.x.scale(t.width),e.y=e.y.scale(t.height),e}reBound(t){const e=this.copy();return e.x=this.x.reBound(u.xBounds(t)),e.y=this.y.reBound(u.yBounds(t)),e}clamp(t){const e=this.copy();return e.x=this.x.clamp(u.xBounds(t)),e.y=this.y.clamp(u.yBounds(t)),e}copy(){const t=new c;return t.currRoot=this.currRoot,t.x=this.x,t.y=this.y,t}reverse(){const t=this.copy();return t.x=this.x.reverse(),t.y=this.y.reverse(),t}pos(t){return{x:this.x.pos(t.x),y:this.y.pos(t.y)}}box(t){return u.construct(this.pos(t.one),this.pos(t.two),0,0,this.currRoot??t.root)}};i(c,"IDENTITY",new c);let d=c;const M=Object.freeze(Object.defineProperty({__proto__:null,Scale:y,XY:d,crudeXYTransform:q,xyScaleToTransform:L},Symbol.toStringTag,{value:"Module"}));exports.clamp=m;exports.scale=M;
@@ -1,89 +0,0 @@
1
- import { z as c } from "zod";
2
- import { x as u, n as m, d, s as l, i as a } from "./base-DnZzEvvz.js";
3
- const p = c.union([
4
- c.number(),
5
- u,
6
- m,
7
- d,
8
- l,
9
- a
10
- ]), s = (t, n) => {
11
- if (typeof t == "string") {
12
- if (n === void 0) throw new Error("The y coordinate must be given.");
13
- return t === "x" ? { x: n, y: 0 } : { x: 0, y: n };
14
- }
15
- return typeof t == "number" ? { x: t, y: n ?? t } : Array.isArray(t) ? { x: t[0], y: t[1] } : "signedWidth" in t ? { x: t.signedWidth, y: t.signedHeight } : "clientX" in t ? { x: t.clientX, y: t.clientY } : "width" in t ? { x: t.width, y: t.height } : { x: t.x, y: t.y };
16
- }, i = Object.freeze({ x: 0, y: 0 }), g = Object.freeze({ x: 1, y: 1 }), O = Object.freeze({ x: 1 / 0, y: 1 / 0 }), h = Object.freeze({ x: NaN, y: NaN }), x = (t, n, e = 0) => {
17
- const r = s(t), o = s(n);
18
- return e === 0 ? r.x === o.x && r.y === o.y : Math.abs(r.x - o.x) <= e && Math.abs(r.y - o.y) <= e;
19
- }, j = (t) => x(t, i), z = (t, n, e) => {
20
- const r = s(t), o = s(n, e);
21
- return { x: r.x * o.x, y: r.y * o.y };
22
- }, f = (t, n) => {
23
- const e = s(t);
24
- return { x: e.x + n, y: e.y };
25
- }, b = (t, n) => {
26
- const e = s(t);
27
- return { x: e.x, y: e.y + n };
28
- }, F = (t, n, e, ...r) => typeof n == "string" && typeof e == "number" ? n === "x" ? f(t, e) : b(t, e) : [t, n, e ?? i, ...r].reduce((o, N) => {
29
- const y = s(N);
30
- return { x: o.x + y.x, y: o.y + y.y };
31
- }, i), _ = (t, n, e) => {
32
- const r = s(t);
33
- return n === "x" ? { x: e, y: r.y } : { x: r.x, y: e };
34
- }, I = (t, n) => {
35
- const e = s(t), r = s(n);
36
- return Math.sqrt((e.x - r.x) ** 2 + (e.y - r.y) ** 2);
37
- }, w = (t, n) => {
38
- const e = s(t), r = s(n);
39
- return { x: r.x - e.x, y: r.y - e.y };
40
- }, M = (t) => {
41
- const n = s(t);
42
- return Number.isNaN(n.x) || Number.isNaN(n.y);
43
- }, X = (t) => {
44
- const n = s(t);
45
- return Number.isFinite(n.x) && Number.isFinite(n.y);
46
- }, Y = (t) => {
47
- const n = s(t);
48
- return [n.x, n.y];
49
- }, Z = (t) => {
50
- const n = s(t);
51
- return { left: n.x, top: n.y };
52
- }, A = (t, n = 0) => {
53
- const e = s(t);
54
- return { x: Number(e.x.toFixed(n)), y: Number(e.y.toFixed(n)) };
55
- }, q = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
56
- __proto__: null,
57
- INFINITY: O,
58
- NAN: h,
59
- ONE: g,
60
- ZERO: i,
61
- clientXY: a,
62
- construct: s,
63
- couple: Y,
64
- crudeZ: p,
65
- css: Z,
66
- distance: I,
67
- equals: x,
68
- isFinite: X,
69
- isNan: M,
70
- isZero: j,
71
- scale: z,
72
- set: _,
73
- translate: F,
74
- translateX: f,
75
- translateY: b,
76
- translation: w,
77
- truncate: A,
78
- xy: u
79
- }, Symbol.toStringTag, { value: "Module" }));
80
- export {
81
- g as O,
82
- i as Z,
83
- A as a,
84
- p as b,
85
- s as c,
86
- x as e,
87
- F as t,
88
- q as x
89
- };
@@ -1 +0,0 @@
1
- "use strict";const x=require("zod"),i=require("./base-B48bPNx5.cjs"),a=x.z.union([x.z.number(),i.xy,i.numberCouple,i.dimensions,i.signedDimensions,i.clientXY]),r=(t,n)=>{if(typeof t=="string"){if(n===void 0)throw new Error("The y coordinate must be given.");return t==="x"?{x:n,y:0}:{x:0,y:n}}return typeof t=="number"?{x:t,y:n??t}:Array.isArray(t)?{x:t[0],y:t[1]}:"signedWidth"in t?{x:t.signedWidth,y:t.signedHeight}:"clientX"in t?{x:t.clientX,y:t.clientY}:"width"in t?{x:t.width,y:t.height}:{x:t.x,y:t.y}},o=Object.freeze({x:0,y:0}),f=Object.freeze({x:1,y:1}),g=Object.freeze({x:1/0,y:1/0}),p=Object.freeze({x:NaN,y:NaN}),y=(t,n,e=0)=>{const s=r(t),c=r(n);return e===0?s.x===c.x&&s.y===c.y:Math.abs(s.x-c.x)<=e&&Math.abs(s.y-c.y)<=e},O=t=>y(t,o),h=(t,n,e)=>{const s=r(t),c=r(n,e);return{x:s.x*c.x,y:s.y*c.y}},b=(t,n)=>{const e=r(t);return{x:e.x+n,y:e.y}},N=(t,n)=>{const e=r(t);return{x:e.x,y:e.y+n}},l=(t,n,e,...s)=>typeof n=="string"&&typeof e=="number"?n==="x"?b(t,e):N(t,e):[t,n,e??o,...s].reduce((c,m)=>{const u=r(m);return{x:c.x+u.x,y:c.y+u.y}},o),z=(t,n,e)=>{const s=r(t);return n==="x"?{x:e,y:s.y}:{x:s.x,y:e}},j=(t,n)=>{const e=r(t),s=r(n);return Math.sqrt((e.x-s.x)**2+(e.y-s.y)**2)},F=(t,n)=>{const e=r(t),s=r(n);return{x:s.x-e.x,y:s.y-e.y}},X=t=>{const n=r(t);return Number.isNaN(n.x)||Number.isNaN(n.y)},Y=t=>{const n=r(t);return Number.isFinite(n.x)&&Number.isFinite(n.y)},_=t=>{const n=r(t);return[n.x,n.y]},q=t=>{const n=r(t);return{left:n.x,top:n.y}},d=(t,n=0)=>{const e=r(t);return{x:Number(e.x.toFixed(n)),y:Number(e.y.toFixed(n))}},E=Object.freeze(Object.defineProperty({__proto__:null,INFINITY:g,NAN:p,ONE:f,ZERO:o,clientXY:i.clientXY,construct:r,couple:_,crudeZ:a,css:q,distance:j,equals:y,isFinite:Y,isNan:X,isZero:O,scale:h,set:z,translate:l,translateX:b,translateY:N,translation:F,truncate:d,xy:i.xy},Symbol.toStringTag,{value:"Module"}));exports.ONE=f;exports.ZERO=o;exports.construct=r;exports.crudeZ=a;exports.equals=y;exports.translate=l;exports.truncate=d;exports.xy=E;
@@ -1 +0,0 @@
1
- "use strict";const c=require("zod"),i=require("./path-BBCx3K6k.cjs"),u=e=>i.transformPath(e,(t,n,r)=>{const s=n===r.length-1,a=!isNaN(parseInt(t)),f=!isNaN(parseInt(r[n+1]));return a&&(t="element"),s||f?t:[t,"shape"]}),o=(e,t)=>{if(e==null)return null;const n=e[t];return n==null&&typeof e=="object"&&"sourceType"in e?e.sourceType()[t]:n},g=(e,t,n)=>i.get(o(e,"shape"),u(t),{...n,getter:o}),m=(e,t)=>n=>{const r=t.find(s=>s.safeParse(n).success);return r==null?null:e(r.parse(n))},l=c.z.bigint().or(c.z.string().transform(BigInt)),h=Object.freeze(Object.defineProperty({__proto__:null,bigInt:l,getFieldSchema:g,getFieldSchemaPath:u,transformer:m},Symbol.toStringTag,{value:"Module"}));exports.bigInt=l;exports.zodutil=h;