@synnaxlabs/x 0.16.1 → 0.24.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/.turbo/turbo-build.log +99 -7
- package/.vscode/settings.json +5 -1
- package/dist/base-B48bPNx5.cjs +1 -0
- package/dist/base-DnZzEvvz.js +38 -0
- package/dist/binary.cjs +3 -0
- package/dist/binary.js +100 -0
- package/dist/bounds-Bh_QBZZK.cjs +1 -0
- package/dist/bounds-Dmn-hd_-.js +129 -0
- package/dist/bounds.cjs +1 -0
- package/dist/bounds.js +4 -0
- package/dist/box-C92jYSNY.js +205 -0
- package/dist/box-m3dlc1kR.cjs +1 -0
- package/dist/box.cjs +1 -0
- package/dist/box.js +4 -0
- package/dist/caseconv.cjs +1 -0
- package/dist/caseconv.js +4 -0
- package/dist/change-C-YELKx6.cjs +1 -0
- package/dist/change-DLl6DccR.js +12 -0
- package/dist/change.cjs +1 -0
- package/dist/change.js +4 -0
- package/dist/compare.cjs +1 -0
- package/dist/compare.js +4 -0
- package/dist/debounce.cjs +1 -0
- package/dist/debounce.js +17 -0
- package/dist/deep.cjs +1 -0
- package/dist/deep.js +121 -0
- package/dist/destructor.cjs +1 -0
- package/dist/destructor.js +1 -0
- package/dist/dimensions-BAuHfd-b.js +44 -0
- package/dist/dimensions-zMcb9pMk.cjs +1 -0
- package/dist/dimensions.cjs +1 -0
- package/dist/dimensions.js +4 -0
- package/dist/direction-CScbfCdT.js +16 -0
- package/dist/direction-DZbN47uL.cjs +1 -0
- package/dist/direction.cjs +1 -0
- package/dist/direction.js +4 -0
- package/dist/external-B-DoBvh7.cjs +1 -0
- package/dist/external-DI9122wF.js +27 -0
- package/dist/identity.cjs +1 -0
- package/dist/identity.js +4 -0
- package/dist/index-BpCPHf78.cjs +1 -0
- package/dist/index-Bt5ivtN9.js +95 -0
- package/dist/index-BwkQTA-j.js +360 -0
- package/dist/index-CuG8fceO.cjs +1 -0
- package/dist/index.cjs +3 -0
- package/dist/index.js +178 -0
- package/dist/kv.cjs +1 -0
- package/dist/kv.js +6 -0
- package/dist/location-CfP9TAnW.js +94 -0
- package/dist/location-c3g6WKs-.cjs +1 -0
- package/dist/location.cjs +1 -0
- package/dist/location.js +4 -0
- package/dist/observe.cjs +1 -0
- package/dist/observe.js +43 -0
- package/dist/path-BO4pyGZf.cjs +1 -0
- package/dist/path-nTHmt_4i.js +65 -0
- package/dist/position-BBnkwGX1.cjs +1 -0
- package/dist/position-B_aphAR0.js +87 -0
- package/dist/position.cjs +1 -0
- package/dist/position.js +4 -0
- package/dist/record.cjs +1 -0
- package/dist/record.js +9 -0
- package/dist/runtime.cjs +1 -0
- package/dist/runtime.js +4 -0
- package/dist/scale-C8axypQ2.cjs +1 -0
- package/dist/scale-CgtgqlYU.js +205 -0
- package/dist/scale.cjs +1 -0
- package/dist/scale.js +4 -0
- package/dist/search.cjs +1 -0
- package/dist/search.js +15 -0
- package/dist/series-8E6FnWBU.cjs +11 -0
- package/dist/series-DCJSrg1P.js +1629 -0
- package/dist/spatial-BOhaO8xN.cjs +1 -0
- package/dist/spatial-DozyssiN.js +11 -0
- package/dist/spatial.cjs +1 -0
- package/dist/spatial.js +20 -0
- package/dist/{binary → src/binary}/encoder.d.ts +26 -2
- package/dist/src/binary/encoder.d.ts.map +1 -0
- package/dist/src/binary/encoder.spec.d.ts.map +1 -0
- package/dist/src/binary/index.d.ts.map +1 -0
- package/dist/src/caseconv/caseconv.d.ts +6 -0
- package/dist/src/caseconv/caseconv.d.ts.map +1 -0
- package/dist/src/caseconv/index.d.ts +2 -0
- package/dist/src/caseconv/index.d.ts.map +1 -0
- package/dist/{change → src/change}/change.d.ts +10 -9
- package/dist/src/change/change.d.ts.map +1 -0
- package/dist/src/change/index.d.ts.map +1 -0
- package/dist/src/clamp/clamp.d.ts.map +1 -0
- package/dist/src/clamp/index.d.ts +2 -0
- package/dist/src/clamp/index.d.ts.map +1 -0
- package/dist/{compare → src/compare}/compare.d.ts +6 -4
- package/dist/src/compare/compare.d.ts.map +1 -0
- package/dist/src/compare/compare.spec.d.ts +2 -0
- package/dist/src/compare/compare.spec.d.ts.map +1 -0
- package/dist/src/compare/index.d.ts.map +1 -0
- package/dist/src/control/control.d.ts +107 -0
- package/dist/src/control/control.d.ts.map +1 -0
- package/dist/src/control/index.d.ts +2 -0
- package/dist/src/control/index.d.ts.map +1 -0
- package/dist/src/debounce/debounce.d.ts.map +1 -0
- package/dist/src/debounce/debounce.spec.d.ts +2 -0
- package/dist/src/debounce/debounce.spec.d.ts.map +1 -0
- package/dist/src/debounce/index.d.ts +2 -0
- package/dist/src/debounce/index.d.ts.map +1 -0
- package/dist/src/deep/copy.d.ts.map +1 -0
- package/dist/{deep → src/deep}/delete.d.ts +2 -1
- package/dist/src/deep/delete.d.ts.map +1 -0
- package/dist/{deep → src/deep}/delete.spec.d.ts.map +1 -1
- package/dist/src/deep/difference.d.ts.map +1 -0
- package/dist/src/deep/difference.spec.d.ts.map +1 -0
- package/dist/src/deep/equal.d.ts.map +1 -0
- package/dist/{deep → src/deep}/equal.spec.d.ts.map +1 -1
- package/dist/{deep → src/deep}/external.d.ts +3 -4
- package/dist/src/deep/external.d.ts.map +1 -0
- package/dist/src/deep/index.d.ts.map +1 -0
- package/dist/src/deep/merge.d.ts +12 -0
- package/dist/src/deep/merge.d.ts.map +1 -0
- package/dist/{deep → src/deep}/merge.spec.d.ts.map +1 -1
- package/dist/src/deep/partial.d.ts.map +1 -0
- package/dist/src/deep/path.d.ts +54 -0
- package/dist/src/deep/path.d.ts.map +1 -0
- package/dist/{deep → src/deep}/path.spec.d.ts.map +1 -1
- package/dist/src/destructor.d.ts.map +1 -0
- package/dist/{identity.d.ts → src/identity.d.ts} +2 -1
- package/dist/src/identity.d.ts.map +1 -0
- package/dist/{index.d.ts → src/index.d.ts} +22 -20
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/invert.d.ts.map +1 -0
- package/dist/src/join.d.ts.map +1 -0
- package/dist/src/kv/index.d.ts.map +1 -0
- package/dist/src/kv/types.d.ts.map +1 -0
- package/dist/src/math/index.d.ts +2 -0
- package/dist/src/math/index.d.ts.map +1 -0
- package/dist/src/math/math.d.ts +11 -0
- package/dist/src/math/math.d.ts.map +1 -0
- package/dist/src/migrate/index.d.ts.map +1 -0
- package/dist/src/migrate/migrate.d.ts +29 -0
- package/dist/src/migrate/migrate.d.ts.map +1 -0
- package/dist/src/migrate/migrate.spec.d.ts.map +1 -0
- package/dist/{mock → src/mock}/MockGLBufferController.d.ts +2 -1
- package/dist/src/mock/MockGLBufferController.d.ts.map +1 -0
- package/dist/src/mock/index.d.ts.map +1 -0
- package/dist/src/observe/index.d.ts.map +1 -0
- package/dist/src/observe/observe.d.ts +24 -0
- package/dist/src/observe/observe.d.ts.map +1 -0
- package/dist/src/observe/obsever.spec.d.ts +2 -0
- package/dist/src/observe/obsever.spec.d.ts.map +1 -0
- package/dist/src/optional.d.ts.map +1 -0
- package/dist/{primitive.d.ts → src/primitive.d.ts} +2 -1
- package/dist/src/primitive.d.ts.map +1 -0
- package/dist/{record.d.ts → src/record.d.ts} +7 -8
- package/dist/src/record.d.ts.map +1 -0
- package/dist/{renderable.d.ts → src/renderable.d.ts} +2 -1
- package/dist/src/renderable.d.ts.map +1 -0
- package/dist/src/runtime/detect.d.ts.map +1 -0
- package/dist/src/runtime/external.d.ts.map +1 -0
- package/dist/src/runtime/index.d.ts.map +1 -0
- package/dist/src/runtime/os.d.ts +20 -0
- package/dist/src/runtime/os.d.ts.map +1 -0
- package/dist/{search.d.ts → src/search.d.ts} +5 -2
- package/dist/src/search.d.ts.map +1 -0
- package/dist/src/shallowCopy.d.ts +2 -0
- package/dist/src/shallowCopy.d.ts.map +1 -0
- package/dist/{spatial → src/spatial}/base.d.ts +30 -5
- package/dist/src/spatial/base.d.ts.map +1 -0
- package/dist/src/spatial/bounds/bounds.d.ts +148 -0
- package/dist/src/spatial/bounds/bounds.d.ts.map +1 -0
- package/dist/src/spatial/bounds/bounds.spec.d.ts.map +1 -0
- package/dist/src/spatial/bounds/index.d.ts.map +1 -0
- package/dist/{spatial → src/spatial}/box/box.d.ts +73 -24
- package/dist/src/spatial/box/box.d.ts.map +1 -0
- package/dist/src/spatial/box/box.spec.d.ts.map +1 -0
- package/dist/src/spatial/box/index.d.ts.map +1 -0
- package/dist/{spatial → src/spatial}/dimensions/dimensions.d.ts +4 -3
- package/dist/src/spatial/dimensions/dimensions.d.ts.map +1 -0
- package/dist/src/spatial/dimensions/dimensions.spec.d.ts.map +1 -0
- package/dist/src/spatial/dimensions/index.d.ts.map +1 -0
- package/dist/{spatial → src/spatial}/direction/direction.d.ts +4 -3
- package/dist/src/spatial/direction/direction.d.ts.map +1 -0
- package/dist/src/spatial/direction/direction.spec.d.ts.map +1 -0
- package/dist/src/spatial/direction/index.d.ts.map +1 -0
- package/dist/{spatial → src/spatial}/external.d.ts +2 -2
- package/dist/src/spatial/external.d.ts.map +1 -0
- package/dist/src/spatial/index.d.ts.map +1 -0
- package/dist/src/spatial/location/index.d.ts.map +1 -0
- package/dist/{spatial → src/spatial}/location/location.d.ts +4 -3
- package/dist/src/spatial/location/location.d.ts.map +1 -0
- package/dist/src/spatial/location/location.spec.d.ts.map +1 -0
- package/dist/src/spatial/position/index.d.ts.map +1 -0
- package/dist/{spatial → src/spatial}/position/position.d.ts +4 -4
- package/dist/src/spatial/position/position.d.ts.map +1 -0
- package/dist/src/spatial/position/position.spec.d.ts.map +1 -0
- package/dist/src/spatial/scale/index.d.ts.map +1 -0
- package/dist/{spatial → src/spatial}/scale/scale.d.ts +15 -62
- package/dist/src/spatial/scale/scale.d.ts.map +1 -0
- package/dist/src/spatial/scale/scale.spec.d.ts.map +1 -0
- package/dist/src/spatial/spatial.d.ts +2 -0
- package/dist/src/spatial/spatial.d.ts.map +1 -0
- package/dist/src/spatial/xy/index.d.ts.map +1 -0
- package/dist/{spatial → src/spatial}/xy/xy.d.ts +16 -25
- package/dist/src/spatial/xy/xy.d.ts.map +1 -0
- package/dist/{spatial → src/spatial}/xy/xy.spec.d.ts.map +1 -1
- package/dist/src/telem/generate.d.ts +4 -0
- package/dist/src/telem/generate.d.ts.map +1 -0
- package/dist/src/telem/gl.d.ts.map +1 -0
- package/dist/{telem → src/telem}/index.d.ts +1 -1
- package/dist/src/telem/index.d.ts.map +1 -0
- package/dist/{telem → src/telem}/series.d.ts +10 -8
- package/dist/src/telem/series.d.ts.map +1 -0
- package/dist/{telem → src/telem}/series.spec.d.ts.map +1 -1
- package/dist/{telem → src/telem}/telem.d.ts +19 -21
- package/dist/src/telem/telem.d.ts.map +1 -0
- package/dist/{telem → src/telem}/telem.spec.d.ts.map +1 -1
- package/dist/src/toArray.d.ts.map +1 -0
- package/dist/src/transform.d.ts +6 -0
- package/dist/src/transform.d.ts.map +1 -0
- package/dist/src/unique.d.ts.map +1 -0
- package/dist/src/url/index.d.ts +2 -0
- package/dist/src/url/index.d.ts.map +1 -0
- package/dist/src/url/url.d.ts.map +1 -0
- package/dist/{url → src/url}/url.spec.d.ts.map +1 -1
- package/dist/src/worker/index.d.ts +2 -0
- package/dist/src/worker/index.d.ts.map +1 -0
- package/dist/{worker → src/worker}/worker.d.ts +4 -4
- package/dist/src/worker/worker.d.ts.map +1 -0
- package/dist/src/worker/worker.spec.d.ts.map +1 -0
- package/dist/src/zodutil/index.d.ts +2 -0
- package/dist/src/zodutil/index.d.ts.map +1 -0
- package/dist/src/zodutil/zodutil.d.ts +6 -0
- package/dist/src/zodutil/zodutil.d.ts.map +1 -0
- package/dist/src/zodutil/zodutil.spec.d.ts +2 -0
- package/dist/src/zodutil/zodutil.spec.d.ts.map +1 -0
- package/dist/telem.cjs +1 -0
- package/dist/telem.js +17 -0
- package/dist/toArray.cjs +1 -0
- package/dist/toArray.js +5 -0
- package/dist/unique.cjs +1 -0
- package/dist/unique.js +4 -0
- package/dist/url.cjs +1 -0
- package/dist/url.js +54 -0
- package/dist/worker.cjs +1 -0
- package/dist/worker.js +47 -0
- package/dist/xy-D1ZbIqpT.js +90 -0
- package/dist/xy-cP-FXJtR.cjs +1 -0
- package/dist/xy.cjs +1 -0
- package/dist/xy.js +4 -0
- package/dist/zodutil.cjs +1 -0
- package/dist/zodutil.js +21 -0
- package/eslint.config.js +12 -0
- package/package.json +157 -13
- package/src/binary/encoder.spec.ts +150 -7
- package/src/binary/encoder.ts +110 -9
- package/src/binary/index.ts +1 -1
- package/src/caseconv/caseconv.ts +31 -0
- package/src/caseconv/index.ts +10 -0
- package/src/change/change.ts +7 -6
- package/src/change/index.ts +1 -1
- package/src/{clamp.ts → clamp/clamp.ts} +1 -1
- package/src/clamp/index.ts +10 -0
- package/src/compare/compare.spec.ts +49 -0
- package/src/compare/compare.ts +37 -10
- package/src/compare/index.ts +1 -1
- package/src/control/control.ts +77 -0
- package/src/control/index.ts +1 -0
- package/src/debounce/debounce.spec.ts +52 -0
- package/src/{debounce.ts → debounce/debounce.ts} +4 -4
- package/src/debounce/index.ts +10 -0
- package/src/deep/copy.ts +2 -3
- package/src/deep/delete.spec.ts +2 -2
- package/src/deep/delete.ts +3 -2
- package/src/deep/difference.spec.ts +28 -27
- package/src/deep/difference.ts +13 -11
- package/src/deep/equal.spec.ts +4 -4
- package/src/deep/equal.ts +5 -5
- package/src/deep/external.ts +4 -5
- package/src/deep/index.ts +1 -1
- package/src/deep/merge.spec.ts +120 -4
- package/src/deep/merge.ts +50 -6
- package/src/deep/partial.ts +1 -1
- package/src/deep/path.spec.ts +91 -39
- package/src/deep/path.ts +111 -46
- package/src/destructor.ts +2 -2
- package/src/identity.ts +1 -1
- package/src/index.ts +23 -21
- package/src/invert.ts +9 -0
- package/src/join.ts +1 -1
- package/src/kv/index.ts +1 -1
- package/src/kv/types.ts +1 -1
- package/src/math/index.ts +10 -0
- package/src/math/math.ts +33 -0
- package/src/migrate/index.ts +9 -0
- package/src/migrate/migrate.spec.ts +65 -54
- package/src/migrate/migrate.ts +126 -17
- package/src/mock/MockGLBufferController.ts +6 -6
- package/src/mock/index.ts +1 -1
- package/src/observe/index.ts +1 -1
- package/src/observe/observe.ts +37 -6
- package/src/observe/obsever.spec.ts +56 -0
- package/src/optional.ts +3 -4
- package/src/primitive.ts +1 -1
- package/src/record.ts +10 -6
- package/src/renderable.ts +1 -1
- package/src/runtime/detect.ts +3 -3
- package/src/runtime/external.ts +1 -1
- package/src/runtime/index.ts +1 -1
- package/src/runtime/os.ts +17 -5
- package/src/search.ts +3 -1
- package/src/shallowCopy.ts +5 -6
- package/src/spatial/base.ts +13 -5
- package/src/spatial/bounds/bounds.spec.ts +259 -180
- package/src/spatial/bounds/bounds.ts +200 -85
- package/src/spatial/bounds/index.ts +2 -2
- package/src/spatial/box/box.spec.ts +211 -2
- package/src/spatial/box/box.ts +97 -49
- package/src/spatial/box/index.ts +2 -2
- package/src/spatial/dimensions/dimensions.spec.ts +1 -1
- package/src/spatial/dimensions/dimensions.ts +4 -4
- package/src/spatial/dimensions/index.ts +2 -2
- package/src/spatial/direction/direction.spec.ts +1 -1
- package/src/spatial/direction/direction.ts +7 -7
- package/src/spatial/direction/index.ts +2 -2
- package/src/spatial/external.ts +3 -3
- package/src/spatial/index.ts +1 -1
- package/src/spatial/location/index.ts +2 -2
- package/src/spatial/location/location.spec.ts +1 -1
- package/src/spatial/location/location.ts +21 -21
- package/src/spatial/position/index.ts +1 -1
- package/src/spatial/position/position.spec.ts +1 -1
- package/src/spatial/position/position.ts +3 -20
- package/src/spatial/scale/index.ts +2 -2
- package/src/spatial/scale/scale.spec.ts +3 -3
- package/src/spatial/scale/scale.ts +3 -3
- package/src/spatial/spatial.ts +5 -5
- package/src/spatial/xy/index.ts +2 -2
- package/src/spatial/xy/xy.spec.ts +93 -44
- package/src/spatial/xy/xy.ts +20 -27
- package/src/telem/generate.ts +1 -1
- package/src/telem/gl.ts +1 -1
- package/src/telem/index.ts +2 -2
- package/src/telem/series.spec.ts +64 -5
- package/src/telem/series.ts +47 -35
- package/src/telem/telem.spec.ts +130 -2
- package/src/telem/telem.ts +63 -23
- package/src/toArray.ts +2 -2
- package/src/transform.ts +9 -2
- package/src/unique.ts +1 -1
- package/src/url/index.ts +2 -2
- package/src/url/url.spec.ts +2 -2
- package/src/url/url.ts +4 -4
- package/src/worker/index.ts +10 -0
- package/src/worker/worker.spec.ts +2 -2
- package/src/worker/worker.ts +13 -13
- package/src/zodutil/index.ts +10 -0
- package/src/zodutil/zodutil.spec.ts +103 -0
- package/src/zodutil/zodutil.ts +44 -0
- package/tsconfig.json +1 -0
- package/tsconfig.tsbuildinfo +1 -0
- package/vite.config.ts +39 -3
- package/.eslintrc.cjs +0 -18
- package/dist/binary/encoder.d.ts.map +0 -1
- package/dist/binary/encoder.spec.d.ts.map +0 -1
- package/dist/binary/index.d.ts.map +0 -1
- package/dist/case.d.ts +0 -6
- package/dist/case.d.ts.map +0 -1
- package/dist/change/change.d.ts.map +0 -1
- package/dist/change/index.d.ts.map +0 -1
- package/dist/clamp.d.ts.map +0 -1
- package/dist/compare/compare.d.ts.map +0 -1
- package/dist/compare/index.d.ts.map +0 -1
- package/dist/debounce.d.ts.map +0 -1
- package/dist/deep/copy.d.ts.map +0 -1
- package/dist/deep/delete.d.ts.map +0 -1
- package/dist/deep/difference.d.ts.map +0 -1
- package/dist/deep/difference.spec.d.ts.map +0 -1
- package/dist/deep/equal.d.ts.map +0 -1
- package/dist/deep/external.d.ts.map +0 -1
- package/dist/deep/index.d.ts.map +0 -1
- package/dist/deep/memo.d.ts +0 -2
- package/dist/deep/memo.d.ts.map +0 -1
- package/dist/deep/merge.d.ts +0 -3
- package/dist/deep/merge.d.ts.map +0 -1
- package/dist/deep/partial.d.ts.map +0 -1
- package/dist/deep/path.d.ts +0 -37
- package/dist/deep/path.d.ts.map +0 -1
- package/dist/destructor.d.ts.map +0 -1
- package/dist/identity.d.ts.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/invert.d.ts.map +0 -1
- package/dist/join.d.ts.map +0 -1
- package/dist/kv/index.d.ts.map +0 -1
- package/dist/kv/types.d.ts.map +0 -1
- package/dist/migrate/index.d.ts.map +0 -1
- package/dist/migrate/migrate.d.ts +0 -16
- package/dist/migrate/migrate.d.ts.map +0 -1
- package/dist/migrate/migrate.spec.d.ts.map +0 -1
- package/dist/mock/MockGLBufferController.d.ts.map +0 -1
- package/dist/mock/index.d.ts.map +0 -1
- package/dist/observe/index.d.ts.map +0 -1
- package/dist/observe/observe.d.ts +0 -12
- package/dist/observe/observe.d.ts.map +0 -1
- package/dist/optional.d.ts.map +0 -1
- package/dist/primitive.d.ts.map +0 -1
- package/dist/record.d.ts.map +0 -1
- package/dist/renderable.d.ts.map +0 -1
- package/dist/runtime/detect.d.ts.map +0 -1
- package/dist/runtime/external.d.ts.map +0 -1
- package/dist/runtime/index.d.ts.map +0 -1
- package/dist/runtime/os.d.ts +0 -10
- package/dist/runtime/os.d.ts.map +0 -1
- package/dist/search.d.ts.map +0 -1
- package/dist/shallowCopy.d.ts +0 -2
- package/dist/shallowCopy.d.ts.map +0 -1
- package/dist/spatial/base.d.ts.map +0 -1
- package/dist/spatial/bounds/bounds.d.ts +0 -71
- package/dist/spatial/bounds/bounds.d.ts.map +0 -1
- package/dist/spatial/bounds/bounds.spec.d.ts.map +0 -1
- package/dist/spatial/bounds/index.d.ts.map +0 -1
- package/dist/spatial/box/box.d.ts.map +0 -1
- package/dist/spatial/box/box.spec.d.ts.map +0 -1
- package/dist/spatial/box/index.d.ts.map +0 -1
- package/dist/spatial/dimensions/dimensions.d.ts.map +0 -1
- package/dist/spatial/dimensions/dimensions.spec.d.ts.map +0 -1
- package/dist/spatial/dimensions/index.d.ts.map +0 -1
- package/dist/spatial/direction/direction.d.ts.map +0 -1
- package/dist/spatial/direction/direction.spec.d.ts.map +0 -1
- package/dist/spatial/direction/index.d.ts.map +0 -1
- package/dist/spatial/external.d.ts.map +0 -1
- package/dist/spatial/index.d.ts.map +0 -1
- package/dist/spatial/location/index.d.ts.map +0 -1
- package/dist/spatial/location/location.d.ts.map +0 -1
- package/dist/spatial/location/location.spec.d.ts.map +0 -1
- package/dist/spatial/position/index.d.ts.map +0 -1
- package/dist/spatial/position/position.d.ts.map +0 -1
- package/dist/spatial/position/position.spec.d.ts.map +0 -1
- package/dist/spatial/scale/index.d.ts.map +0 -1
- package/dist/spatial/scale/scale.d.ts.map +0 -1
- package/dist/spatial/scale/scale.spec.d.ts.map +0 -1
- package/dist/spatial/spatial.d.ts +0 -2
- package/dist/spatial/spatial.d.ts.map +0 -1
- package/dist/spatial/xy/index.d.ts.map +0 -1
- package/dist/spatial/xy/xy.d.ts.map +0 -1
- package/dist/telem/generate.d.ts +0 -3
- package/dist/telem/generate.d.ts.map +0 -1
- package/dist/telem/gl.d.ts.map +0 -1
- package/dist/telem/index.d.ts.map +0 -1
- package/dist/telem/series.d.ts.map +0 -1
- package/dist/telem/telem.d.ts.map +0 -1
- package/dist/toArray.d.ts.map +0 -1
- package/dist/transform.d.ts +0 -2
- package/dist/transform.d.ts.map +0 -1
- package/dist/unique.d.ts.map +0 -1
- package/dist/url/index.d.ts +0 -2
- package/dist/url/index.d.ts.map +0 -1
- package/dist/url/url.d.ts.map +0 -1
- package/dist/worker/worker.d.ts.map +0 -1
- package/dist/worker/worker.spec.d.ts.map +0 -1
- package/dist/x.cjs +0 -12
- package/dist/x.cjs.map +0 -1
- package/dist/x.js +0 -5935
- package/dist/x.js.map +0 -1
- package/src/case.ts +0 -27
- package/src/deep/memo.ts +0 -24
- /package/dist/{binary → src/binary}/encoder.spec.d.ts +0 -0
- /package/dist/{binary → src/binary}/index.d.ts +0 -0
- /package/dist/{change → src/change}/index.d.ts +0 -0
- /package/dist/{clamp.d.ts → src/clamp/clamp.d.ts} +0 -0
- /package/dist/{compare → src/compare}/index.d.ts +0 -0
- /package/dist/{debounce.d.ts → src/debounce/debounce.d.ts} +0 -0
- /package/dist/{deep → src/deep}/copy.d.ts +0 -0
- /package/dist/{deep → src/deep}/delete.spec.d.ts +0 -0
- /package/dist/{deep → src/deep}/difference.d.ts +0 -0
- /package/dist/{deep → src/deep}/difference.spec.d.ts +0 -0
- /package/dist/{deep → src/deep}/equal.d.ts +0 -0
- /package/dist/{deep → src/deep}/equal.spec.d.ts +0 -0
- /package/dist/{deep → src/deep}/index.d.ts +0 -0
- /package/dist/{deep → src/deep}/merge.spec.d.ts +0 -0
- /package/dist/{deep → src/deep}/partial.d.ts +0 -0
- /package/dist/{deep → src/deep}/path.spec.d.ts +0 -0
- /package/dist/{destructor.d.ts → src/destructor.d.ts} +0 -0
- /package/dist/{invert.d.ts → src/invert.d.ts} +0 -0
- /package/dist/{join.d.ts → src/join.d.ts} +0 -0
- /package/dist/{kv → src/kv}/index.d.ts +0 -0
- /package/dist/{kv → src/kv}/types.d.ts +0 -0
- /package/dist/{migrate → src/migrate}/index.d.ts +0 -0
- /package/dist/{migrate → src/migrate}/migrate.spec.d.ts +0 -0
- /package/dist/{mock → src/mock}/index.d.ts +0 -0
- /package/dist/{observe → src/observe}/index.d.ts +0 -0
- /package/dist/{optional.d.ts → src/optional.d.ts} +0 -0
- /package/dist/{runtime → src/runtime}/detect.d.ts +0 -0
- /package/dist/{runtime → src/runtime}/external.d.ts +0 -0
- /package/dist/{runtime → src/runtime}/index.d.ts +0 -0
- /package/dist/{spatial → src/spatial}/bounds/bounds.spec.d.ts +0 -0
- /package/dist/{spatial → src/spatial}/bounds/index.d.ts +0 -0
- /package/dist/{spatial → src/spatial}/box/box.spec.d.ts +0 -0
- /package/dist/{spatial → src/spatial}/box/index.d.ts +0 -0
- /package/dist/{spatial → src/spatial}/dimensions/dimensions.spec.d.ts +0 -0
- /package/dist/{spatial → src/spatial}/dimensions/index.d.ts +0 -0
- /package/dist/{spatial → src/spatial}/direction/direction.spec.d.ts +0 -0
- /package/dist/{spatial → src/spatial}/direction/index.d.ts +0 -0
- /package/dist/{spatial → src/spatial}/index.d.ts +0 -0
- /package/dist/{spatial → src/spatial}/location/index.d.ts +0 -0
- /package/dist/{spatial → src/spatial}/location/location.spec.d.ts +0 -0
- /package/dist/{spatial → src/spatial}/position/index.d.ts +0 -0
- /package/dist/{spatial → src/spatial}/position/position.spec.d.ts +0 -0
- /package/dist/{spatial → src/spatial}/scale/index.d.ts +0 -0
- /package/dist/{spatial → src/spatial}/scale/scale.spec.d.ts +0 -0
- /package/dist/{spatial → src/spatial}/xy/index.d.ts +0 -0
- /package/dist/{spatial → src/spatial}/xy/xy.spec.d.ts +0 -0
- /package/dist/{telem → src/telem}/gl.d.ts +0 -0
- /package/dist/{telem → src/telem}/series.spec.d.ts +0 -0
- /package/dist/{telem → src/telem}/telem.spec.d.ts +0 -0
- /package/dist/{toArray.d.ts → src/toArray.d.ts} +0 -0
- /package/dist/{unique.d.ts → src/unique.d.ts} +0 -0
- /package/dist/{url → src/url}/url.d.ts +0 -0
- /package/dist/{url → src/url}/url.spec.d.ts +0 -0
- /package/dist/{worker → src/worker}/worker.spec.d.ts +0 -0
package/src/spatial/box/box.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Copyright
|
|
1
|
+
// Copyright 2024 Synnax Labs, Inc.
|
|
2
2
|
//
|
|
3
3
|
// Use of this software is governed by the Business Source License included in the file
|
|
4
4
|
// licenses/BSL.txt.
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
// License, use of this software will be governed by the Apache License, Version 2.0,
|
|
8
8
|
// included in the file licenses/APL.txt.
|
|
9
9
|
|
|
10
|
-
import {
|
|
10
|
+
import { z } from "zod";
|
|
11
11
|
|
|
12
12
|
import type * as bounds from "@/spatial/bounds/bounds";
|
|
13
13
|
import type * as dimensions from "@/spatial/dimensions/dimensions";
|
|
@@ -116,22 +116,22 @@ export const construct = (
|
|
|
116
116
|
};
|
|
117
117
|
|
|
118
118
|
export interface Resize {
|
|
119
|
-
/**
|
|
119
|
+
/**
|
|
120
120
|
* Sets the dimensions of the box to the given dimensions.
|
|
121
121
|
* @example resize(b, { width: 10, height: 10 }) // Sets the box to a 10x10 box.
|
|
122
122
|
*/
|
|
123
123
|
(b: Crude, dims: dimensions.Dimensions | dimensions.Signed): Box;
|
|
124
|
-
/**
|
|
125
|
-
* Sets the dimension along the given direction to the given amount.
|
|
124
|
+
/**
|
|
125
|
+
* Sets the dimension along the given direction to the given amount.
|
|
126
126
|
* @example resize(b, "x", 10) // Sets the width of the box to 10.
|
|
127
127
|
* @example resize(b, "y", 10) // Sets the height of the box to 10.
|
|
128
|
-
|
|
128
|
+
*/
|
|
129
129
|
(b: Crude, direction: direction.Direction, amount: number): Box;
|
|
130
130
|
}
|
|
131
131
|
|
|
132
132
|
export const resize: Resize = (
|
|
133
|
-
b: Crude,
|
|
134
|
-
dims: dimensions.Dimensions | dimensions.Signed | direction.Direction,
|
|
133
|
+
b: Crude,
|
|
134
|
+
dims: dimensions.Dimensions | dimensions.Signed | direction.Direction,
|
|
135
135
|
amount?: number,
|
|
136
136
|
): Box => {
|
|
137
137
|
const b_ = construct(b);
|
|
@@ -147,28 +147,32 @@ export const resize: Resize = (
|
|
|
147
147
|
);
|
|
148
148
|
}
|
|
149
149
|
return construct(b_.one, dims, undefined, undefined, b_.root);
|
|
150
|
-
}
|
|
150
|
+
};
|
|
151
151
|
|
|
152
152
|
/**
|
|
153
153
|
* Checks if a box contains a point or another box.
|
|
154
154
|
*
|
|
155
|
-
* @param
|
|
155
|
+
* @param container - The container box to check against.
|
|
156
|
+
* @param value - The point or box to check if it is contained in the container.
|
|
157
|
+
* @param inclusive - Whether the edges of the box are inclusive or exclusive.
|
|
156
158
|
* @returns true if the box inclusively contains the point or box and false otherwise.
|
|
157
159
|
*/
|
|
158
|
-
export const contains = (
|
|
159
|
-
const b_ = construct(
|
|
160
|
+
export const contains = (container: Crude, value: Box | xy.XY, inclusive: boolean = true): boolean => {
|
|
161
|
+
const b_ = construct(container);
|
|
162
|
+
let comp = (a: number, b: number) => a < b;
|
|
163
|
+
if (inclusive) comp = (a: number, b: number) => a <= b;
|
|
160
164
|
if ("one" in value)
|
|
161
165
|
return (
|
|
162
|
-
left(
|
|
163
|
-
right(value)
|
|
164
|
-
top(
|
|
165
|
-
bottom(value)
|
|
166
|
+
comp(left(b_), left(value)) &&
|
|
167
|
+
comp(right(value), right(b_)) &&
|
|
168
|
+
comp(top(b_), top(value)) &&
|
|
169
|
+
comp(bottom(value), bottom(b_))
|
|
166
170
|
);
|
|
167
171
|
return (
|
|
168
|
-
|
|
169
|
-
value.x
|
|
170
|
-
|
|
171
|
-
value.y
|
|
172
|
+
comp(left(b_), value.x) &&
|
|
173
|
+
comp(value.x, right(b_)) &&
|
|
174
|
+
comp(top(b_), value.y) &&
|
|
175
|
+
comp(value.y, bottom(b_))
|
|
172
176
|
);
|
|
173
177
|
};
|
|
174
178
|
|
|
@@ -240,26 +244,30 @@ export const loc = (b: Crude, loc: location.Location): number => {
|
|
|
240
244
|
: f(b_.one.y, b_.two.y);
|
|
241
245
|
};
|
|
242
246
|
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
if (location.X_LOCATIONS.includes(loc_ as location.X))
|
|
246
|
-
return { x: l, y: center(b).y };
|
|
247
|
-
return { x: center(b).x, y: l };
|
|
248
|
-
};
|
|
249
|
-
|
|
250
|
-
export const isZero = (b: Box): boolean => {
|
|
247
|
+
/** @returns true if the area of the box is 0 and false otherwise. */
|
|
248
|
+
export const areaIsZero = (b: Box): boolean => {
|
|
251
249
|
return b.one.x === b.two.x && b.one.y === b.two.y;
|
|
252
250
|
};
|
|
253
251
|
|
|
252
|
+
/** @returns the width of the box. */
|
|
254
253
|
export const width = (b: Crude): number => dim(b, "x");
|
|
255
254
|
|
|
255
|
+
/** @returns the height of the box. */
|
|
256
256
|
export const height = (b: Crude): number => dim(b, "y");
|
|
257
257
|
|
|
258
|
+
/**
|
|
259
|
+
* @returns the signed width of the box, which will be negative if the x value of the
|
|
260
|
+
* first coordinate is less than the x value of the second coordinate.
|
|
261
|
+
*/
|
|
258
262
|
export const signedWidth = (b: Crude): number => {
|
|
259
263
|
const b_ = construct(b);
|
|
260
264
|
return b_.two.x - b_.one.x;
|
|
261
265
|
};
|
|
262
266
|
|
|
267
|
+
/**
|
|
268
|
+
* @returns the signed height of the box, which will be negative if the y value of the
|
|
269
|
+
* first coordinate is less than the y value of the second coordinate.
|
|
270
|
+
*/
|
|
263
271
|
export const signedHeight = (b: Crude): number => {
|
|
264
272
|
const b_ = construct(b);
|
|
265
273
|
return b_.two.y - b_.one.y;
|
|
@@ -299,11 +307,23 @@ export const y = (b: Crude): number => {
|
|
|
299
307
|
|
|
300
308
|
export const root = (b: Crude): xy.XY => ({ x: x(b), y: y(b) });
|
|
301
309
|
|
|
310
|
+
/**
|
|
311
|
+
* @returns the bounds of the box along the x axis i.e. if the box root is top left,
|
|
312
|
+
* the lower bound is the x coordinate of the left side of the box and the upper bound
|
|
313
|
+
* is the x coordinate of the right side of the box.
|
|
314
|
+
* @param b - The box to get the bounds of.
|
|
315
|
+
*/
|
|
302
316
|
export const xBounds = (b: Crude): bounds.Bounds => {
|
|
303
317
|
const b_ = construct(b);
|
|
304
318
|
return { lower: b_.one.x, upper: b_.two.x };
|
|
305
319
|
};
|
|
306
320
|
|
|
321
|
+
/**
|
|
322
|
+
* @returns the bounds of the box along the y axis i.e. if the box root is top left,
|
|
323
|
+
* the lower bound is the y coordinate of the top side of the box and the upper bound
|
|
324
|
+
* is the y coordinate of the bottom side of the box.
|
|
325
|
+
* @param b - The box to get the bounds of.
|
|
326
|
+
*/
|
|
307
327
|
export const yBounds = (b: Crude): bounds.Bounds => {
|
|
308
328
|
const b_ = construct(b);
|
|
309
329
|
return { lower: b_.one.y, upper: b_.two.y };
|
|
@@ -311,24 +331,20 @@ export const yBounds = (b: Crude): bounds.Bounds => {
|
|
|
311
331
|
|
|
312
332
|
export const reRoot = (b: Box, corner: location.CornerXY): Box => copy(b, corner);
|
|
313
333
|
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
const
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
if (right(target) > width(target))
|
|
329
|
-
nextPos = xy.construct({ x: x(target) - width(target), y: y(target) });
|
|
330
|
-
else nextPos = xy.construct({ x: x(target), y: y(target) - height(target) });
|
|
331
|
-
return [construct(nextPos, dims(target)), true];
|
|
334
|
+
export const edgePoints = (b: Crude, loc: location.Location): [xy.XY, xy.XY] => {
|
|
335
|
+
const b_ = construct(b);
|
|
336
|
+
const x = location.X_LOCATIONS.includes(loc as location.X)
|
|
337
|
+
? "x"
|
|
338
|
+
: location.Y_LOCATIONS.includes(loc as location.Y)
|
|
339
|
+
? "y"
|
|
340
|
+
: null;
|
|
341
|
+
if (x === null) throw new Error(`Invalid location: ${location}`);
|
|
342
|
+
const f = loc === "top" || loc === "left" ? Math.min : Math.max;
|
|
343
|
+
const one = { ...b_.one };
|
|
344
|
+
const two = { ...b_.two };
|
|
345
|
+
one[x] = f(b_.one[x], b_.two[x]);
|
|
346
|
+
two[x] = f(b_.one[x], b_.two[x]);
|
|
347
|
+
return [one, two];
|
|
332
348
|
};
|
|
333
349
|
|
|
334
350
|
/**
|
|
@@ -346,6 +362,7 @@ export const positionInCenter = (target_: Crude, bound_: Crude): Box => {
|
|
|
346
362
|
return construct({ x: x_, y: y_ }, dims(target));
|
|
347
363
|
};
|
|
348
364
|
|
|
365
|
+
/** */
|
|
349
366
|
export const isBox = (value: unknown): value is Box => {
|
|
350
367
|
if (typeof value !== "object" || value == null) return false;
|
|
351
368
|
return "one" in value && "two" in value && "root" in value;
|
|
@@ -360,7 +377,11 @@ interface Translate {
|
|
|
360
377
|
(b: Crude, direction: direction.Direction, amount: number): Box;
|
|
361
378
|
}
|
|
362
379
|
|
|
363
|
-
export const translate = (
|
|
380
|
+
export const translate: Translate = (
|
|
381
|
+
b: Crude,
|
|
382
|
+
t: xy.Crude | direction.Direction,
|
|
383
|
+
amount?: number,
|
|
384
|
+
): Box => {
|
|
364
385
|
if (typeof t === "string") {
|
|
365
386
|
if (amount == null) throw new Error(`Undefined amount passed into box.translate`);
|
|
366
387
|
const dir = direction.construct(t);
|
|
@@ -376,17 +397,26 @@ export const translate = (b: Crude, t: xy.XY | direction.Direction, amount?: num
|
|
|
376
397
|
);
|
|
377
398
|
};
|
|
378
399
|
|
|
379
|
-
|
|
400
|
+
/** @returns a box representing the intersection of the two given boxes. */
|
|
401
|
+
export const intersection = (a: Box, b: Box): Box => {
|
|
380
402
|
const x = Math.max(left(a), left(b));
|
|
381
403
|
const y = Math.max(top(a), top(b));
|
|
382
404
|
const x2 = Math.min(right(a), right(b));
|
|
383
405
|
const y2 = Math.min(bottom(a), bottom(b));
|
|
406
|
+
if (x > x2 || y > y2) return ZERO;
|
|
384
407
|
return construct({ x, y }, { x: x2, y: y2 }, undefined, undefined, a.root);
|
|
385
408
|
};
|
|
386
409
|
|
|
410
|
+
/** @returns the area of the box. */
|
|
387
411
|
export const area = (b: Box): number => width(b) * height(b);
|
|
388
412
|
|
|
389
|
-
|
|
413
|
+
/**
|
|
414
|
+
* Truncates the coordinates of the box to the given precision.
|
|
415
|
+
* @param b - The box to truncate.
|
|
416
|
+
* @param precision - The number of decimal places to truncate to.
|
|
417
|
+
* @returns the truncated box.
|
|
418
|
+
*/
|
|
419
|
+
export const truncate = (b: Crude, precision: number): Box => {
|
|
390
420
|
const b_ = construct(b);
|
|
391
421
|
return construct(
|
|
392
422
|
xy.truncate(b_.one, precision),
|
|
@@ -397,6 +427,24 @@ export const truncate = (b: Box, precision: number = 0): Box => {
|
|
|
397
427
|
);
|
|
398
428
|
};
|
|
399
429
|
|
|
430
|
+
/**
|
|
431
|
+
* Constructs a box from a particular corner, and then reinterprets the box in order
|
|
432
|
+
* to define it from a different corner.
|
|
433
|
+
*
|
|
434
|
+
* @example
|
|
435
|
+
* const b = box.construct(0, 0, 10, 10, location.BOTTOM_LEFT, location.TOP_LEFT);
|
|
436
|
+
* // b is now a box rooted in the top left corner with it's first coordinate at
|
|
437
|
+
* // (0, 10) and it's second coordinate at (10, 0).
|
|
438
|
+
*
|
|
439
|
+
* @param x - The x coordinate of the first point.
|
|
440
|
+
* @param y - The y coordinate of the first point.
|
|
441
|
+
* @param width - The width of the box.
|
|
442
|
+
* @param height - The height of the box.
|
|
443
|
+
* @param currRoot - The current root of the box i.e. the corner that x and y represent.
|
|
444
|
+
* @param newRoot - The new root of the box i.e. the corner that the box should be
|
|
445
|
+
* reinterpreted from.
|
|
446
|
+
* @returns the box reinterpreted from the new root.
|
|
447
|
+
*/
|
|
400
448
|
export const constructWithAlternateRoot = (
|
|
401
449
|
x: number,
|
|
402
450
|
y: number,
|
package/src/spatial/box/index.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Copyright
|
|
1
|
+
// Copyright 2024 Synnax Labs, Inc.
|
|
2
2
|
//
|
|
3
3
|
// Use of this software is governed by the Business Source License included in the file
|
|
4
4
|
// licenses/BSL.txt.
|
|
@@ -7,4 +7,4 @@
|
|
|
7
7
|
// License, use of this software will be governed by the Apache License, Version 2.0,
|
|
8
8
|
// included in the file licenses/APL.txt.
|
|
9
9
|
|
|
10
|
-
export * as box from "@/spatial/box/box"
|
|
10
|
+
export * as box from "@/spatial/box/box";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Copyright
|
|
1
|
+
// Copyright 2024 Synnax Labs, Inc.
|
|
2
2
|
//
|
|
3
3
|
// Use of this software is governed by the Business Source License included in the file
|
|
4
4
|
// licenses/BSL.txt.
|
|
@@ -9,9 +9,9 @@
|
|
|
9
9
|
|
|
10
10
|
import { z } from "zod";
|
|
11
11
|
|
|
12
|
-
import {
|
|
12
|
+
import { type Dimensions, dimensions, numberCouple,xy } from "@/spatial/base";
|
|
13
13
|
|
|
14
|
-
export {
|
|
14
|
+
export { type Dimensions,dimensions };
|
|
15
15
|
|
|
16
16
|
export const signed = z.object({ signedWidth: z.number(), signedHeight: z.number() });
|
|
17
17
|
export const crude = z.union([dimensions, signed, xy, numberCouple]);
|
|
@@ -66,4 +66,4 @@ export const min = (crude: Crude[]): Dimensions => ({
|
|
|
66
66
|
export const scale = (ca: Crude, factor: number): Dimensions => {
|
|
67
67
|
const a = construct(ca);
|
|
68
68
|
return { width: a.width * factor, height: a.height * factor };
|
|
69
|
-
}
|
|
69
|
+
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Copyright
|
|
1
|
+
// Copyright 2024 Synnax Labs, Inc.
|
|
2
2
|
//
|
|
3
3
|
// Use of this software is governed by the Business Source License included in the file
|
|
4
4
|
// licenses/BSL.txt.
|
|
@@ -7,4 +7,4 @@
|
|
|
7
7
|
// License, use of this software will be governed by the Apache License, Version 2.0,
|
|
8
8
|
// included in the file licenses/APL.txt.
|
|
9
9
|
|
|
10
|
-
export * as dimensions from "@/spatial/dimensions/dimensions";
|
|
10
|
+
export * as dimensions from "@/spatial/dimensions/dimensions";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Copyright
|
|
1
|
+
// Copyright 2024 Synnax Labs, Inc.
|
|
2
2
|
//
|
|
3
3
|
// Use of this software is governed by the Business Source License included in the file
|
|
4
4
|
// licenses/BSL.txt.
|
|
@@ -8,19 +8,19 @@
|
|
|
8
8
|
// included in the file licenses/APL.txt.
|
|
9
9
|
|
|
10
10
|
import {
|
|
11
|
+
type CrudeDirection,
|
|
12
|
+
crudeDirection,
|
|
11
13
|
type Dimension,
|
|
12
14
|
type Direction,
|
|
13
|
-
|
|
14
|
-
type direction,
|
|
15
|
+
direction,
|
|
15
16
|
DIRECTIONS,
|
|
17
|
+
type Location,
|
|
18
|
+
type SignedDimension,
|
|
16
19
|
Y_LOCATIONS,
|
|
17
20
|
type YLocation,
|
|
18
|
-
type SignedDimension,
|
|
19
|
-
crudeDirection,
|
|
20
|
-
type CrudeDirection,
|
|
21
21
|
} from "@/spatial/base";
|
|
22
22
|
|
|
23
|
-
export
|
|
23
|
+
export { Direction, direction };
|
|
24
24
|
|
|
25
25
|
export const crude = crudeDirection;
|
|
26
26
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Copyright
|
|
1
|
+
// Copyright 2024 Synnax Labs, Inc.
|
|
2
2
|
//
|
|
3
3
|
// Use of this software is governed by the Business Source License included in the file
|
|
4
4
|
// licenses/BSL.txt.
|
|
@@ -7,4 +7,4 @@
|
|
|
7
7
|
// License, use of this software will be governed by the Apache License, Version 2.0,
|
|
8
8
|
// included in the file licenses/APL.txt.
|
|
9
9
|
|
|
10
|
-
export * as direction from "@/spatial/direction/direction";
|
|
10
|
+
export * as direction from "@/spatial/direction/direction";
|
package/src/spatial/external.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Copyright
|
|
1
|
+
// Copyright 2024 Synnax Labs, Inc.
|
|
2
2
|
//
|
|
3
3
|
// Use of this software is governed by the Business Source License included in the file
|
|
4
4
|
// licenses/BSL.txt.
|
|
@@ -12,7 +12,7 @@ export { box } from "@/spatial/box";
|
|
|
12
12
|
export * from "@/spatial/dimensions";
|
|
13
13
|
export * from "@/spatial/direction";
|
|
14
14
|
export * from "@/spatial/location";
|
|
15
|
-
export * from "@/spatial/xy";
|
|
16
|
-
export * from "@/spatial/scale";
|
|
17
15
|
export * from "@/spatial/position";
|
|
16
|
+
export * from "@/spatial/scale";
|
|
18
17
|
export * as spatial from "@/spatial/spatial";
|
|
18
|
+
export * from "@/spatial/xy";
|
package/src/spatial/index.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Copyright
|
|
1
|
+
// Copyright 2024 Synnax Labs, Inc.
|
|
2
2
|
//
|
|
3
3
|
// Use of this software is governed by the Business Source License included in the file
|
|
4
4
|
// licenses/BSL.txt.
|
|
@@ -7,4 +7,4 @@
|
|
|
7
7
|
// License, use of this software will be governed by the Apache License, Version 2.0,
|
|
8
8
|
// included in the file licenses/APL.txt.
|
|
9
9
|
|
|
10
|
-
export * as location from "@/spatial/location/location";
|
|
10
|
+
export * as location from "@/spatial/location/location";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Copyright
|
|
1
|
+
// Copyright 2024 Synnax Labs, Inc.
|
|
2
2
|
//
|
|
3
3
|
// Use of this software is governed by the Business Source License included in the file
|
|
4
4
|
// licenses/BSL.txt.
|
|
@@ -9,34 +9,34 @@
|
|
|
9
9
|
|
|
10
10
|
import { z } from "zod";
|
|
11
11
|
|
|
12
|
-
import {
|
|
12
|
+
import { caseconv } from "@/caseconv";
|
|
13
13
|
import {
|
|
14
|
-
|
|
15
|
-
type
|
|
16
|
-
|
|
17
|
-
|
|
14
|
+
CENTER_LOCATIONS,
|
|
15
|
+
type CenterLocation,
|
|
16
|
+
centerLocation,
|
|
17
|
+
type CrudeLocation,
|
|
18
|
+
crudeLocation,
|
|
19
|
+
type Direction,
|
|
18
20
|
DIRECTIONS,
|
|
21
|
+
type Location,
|
|
22
|
+
location,
|
|
23
|
+
type OuterLocation,
|
|
24
|
+
outerLocation,
|
|
19
25
|
X_LOCATIONS,
|
|
20
|
-
Y_LOCATIONS,
|
|
21
|
-
CENTER_LOCATIONS,
|
|
22
26
|
type XLocation,
|
|
23
|
-
|
|
27
|
+
xLocation,
|
|
28
|
+
Y_LOCATIONS,
|
|
24
29
|
type YLocation,
|
|
25
|
-
|
|
26
|
-
type Direction,
|
|
27
|
-
crudeLocation,
|
|
28
|
-
type CrudeLocation,
|
|
29
|
-
centerlocation,
|
|
30
|
-
type CenterLocation,
|
|
30
|
+
yLocation,
|
|
31
31
|
} from "@/spatial/base";
|
|
32
32
|
|
|
33
33
|
export {
|
|
34
|
-
|
|
34
|
+
CENTER_LOCATIONS,
|
|
35
35
|
type Location,
|
|
36
|
+
location,
|
|
37
|
+
outerLocation as outer,
|
|
36
38
|
X_LOCATIONS,
|
|
37
39
|
Y_LOCATIONS,
|
|
38
|
-
CENTER_LOCATIONS,
|
|
39
|
-
outerLocation as outer,
|
|
40
40
|
};
|
|
41
41
|
|
|
42
42
|
export const x = xLocation;
|
|
@@ -85,8 +85,8 @@ export const direction = (cl: Crude): Direction => {
|
|
|
85
85
|
};
|
|
86
86
|
|
|
87
87
|
export const xy = z.object({
|
|
88
|
-
x: xLocation.or(
|
|
89
|
-
y: yLocation.or(
|
|
88
|
+
x: xLocation.or(centerLocation),
|
|
89
|
+
y: yLocation.or(centerLocation),
|
|
90
90
|
});
|
|
91
91
|
export const corner = z.object({ x: xLocation, y: yLocation });
|
|
92
92
|
|
|
@@ -140,7 +140,7 @@ export const isX = (a: Crude): a is XLocation | CenterLocation =>
|
|
|
140
140
|
|
|
141
141
|
export const isY = (a: Crude): a is YLocation => direction(construct(a)) === "y";
|
|
142
142
|
|
|
143
|
-
export const xyToString = (a: XY): string => `${a.x}${
|
|
143
|
+
export const xyToString = (a: XY): string => `${a.x}${caseconv.capitalize(a.y)}`;
|
|
144
144
|
|
|
145
145
|
export const constructXY = (x: Crude | XY, y?: Crude): XY => {
|
|
146
146
|
let parsedX: Location;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Copyright
|
|
1
|
+
// Copyright 2024 Synnax Labs, Inc.
|
|
2
2
|
//
|
|
3
3
|
// Use of this software is governed by the Business Source License included in the file
|
|
4
4
|
// licenses/BSL.txt.
|
|
@@ -11,23 +11,6 @@ import { type Alignment, type XLocation, type YLocation } from "@/spatial/base";
|
|
|
11
11
|
import { box } from "@/spatial/box";
|
|
12
12
|
import { direction } from "@/spatial/direction";
|
|
13
13
|
import { location } from "@/spatial/location";
|
|
14
|
-
import { xy } from "@/spatial/xy";
|
|
15
|
-
|
|
16
|
-
export const posititonSoVisible = (target: HTMLElement, p: xy.XY): [xy.XY, boolean] => {
|
|
17
|
-
const { width, height } = target.getBoundingClientRect();
|
|
18
|
-
const { innerWidth, innerHeight } = window;
|
|
19
|
-
let changed = false;
|
|
20
|
-
let nextXY = xy.construct(p);
|
|
21
|
-
if (p.x + width > innerWidth) {
|
|
22
|
-
nextXY = xy.translateX(nextXY, -width);
|
|
23
|
-
changed = true;
|
|
24
|
-
}
|
|
25
|
-
if (p.y + height > innerHeight) {
|
|
26
|
-
nextXY = xy.translateY(nextXY, -height);
|
|
27
|
-
changed = true;
|
|
28
|
-
}
|
|
29
|
-
return [nextXY, changed];
|
|
30
|
-
};
|
|
31
14
|
|
|
32
15
|
export interface DialogProps {
|
|
33
16
|
container: box.Crude;
|
|
@@ -39,7 +22,7 @@ export interface DialogProps {
|
|
|
39
22
|
disable?: Array<location.Location | Partial<location.XY>>;
|
|
40
23
|
}
|
|
41
24
|
|
|
42
|
-
const parseLocationOptions = (
|
|
25
|
+
export const parseLocationOptions = (
|
|
43
26
|
initial?: location.Outer | Partial<location.XY> | location.XY,
|
|
44
27
|
): Partial<location.XY> => {
|
|
45
28
|
if (initial == null) return { x: undefined, y: undefined };
|
|
@@ -144,7 +127,7 @@ const evaluateOption = ({
|
|
|
144
127
|
root,
|
|
145
128
|
location.TOP_LEFT,
|
|
146
129
|
);
|
|
147
|
-
const area = box.area(box.
|
|
130
|
+
const area = box.area(box.intersection(dialogBox, container));
|
|
148
131
|
return [dialogBox, area];
|
|
149
132
|
};
|
|
150
133
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Copyright
|
|
1
|
+
// Copyright 2024 Synnax Labs, Inc.
|
|
2
2
|
//
|
|
3
3
|
// Use of this software is governed by the Business Source License included in the file
|
|
4
4
|
// licenses/BSL.txt.
|
|
@@ -7,4 +7,4 @@
|
|
|
7
7
|
// License, use of this software will be governed by the Apache License, Version 2.0,
|
|
8
8
|
// included in the file licenses/APL.txt.
|
|
9
9
|
|
|
10
|
-
export * as scale from "@/spatial/scale/scale";
|
|
10
|
+
export * as scale from "@/spatial/scale/scale";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Copyright
|
|
1
|
+
// Copyright 2024 Synnax Labs, Inc.
|
|
2
2
|
//
|
|
3
3
|
// Use of this software is governed by the Business Source License included in the file
|
|
4
4
|
// licenses/BSL.txt.
|
|
@@ -7,10 +7,10 @@
|
|
|
7
7
|
// License, use of this software will be governed by the Apache License, Version 2.0,
|
|
8
8
|
// included in the file licenses/APL.txt.
|
|
9
9
|
|
|
10
|
-
import { describe,
|
|
10
|
+
import { describe, expect, it, test } from "vitest";
|
|
11
11
|
|
|
12
12
|
import * as box from "@/spatial/box/box";
|
|
13
|
-
import { XY
|
|
13
|
+
import { Scale,XY } from "@/spatial/scale/scale";
|
|
14
14
|
|
|
15
15
|
type ScaleSpec = [name: string, scale: Scale, i: number, o: number];
|
|
16
16
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Copyright
|
|
1
|
+
// Copyright 2024 Synnax Labs, Inc.
|
|
2
2
|
//
|
|
3
3
|
// Use of this software is governed by the Business Source License included in the file
|
|
4
4
|
// licenses/BSL.txt.
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
|
|
10
10
|
import { z } from "zod";
|
|
11
11
|
|
|
12
|
-
import { clamp } from "@/clamp";
|
|
12
|
+
import { clamp } from "@/clamp/clamp";
|
|
13
13
|
import * as bounds from "@/spatial/bounds/bounds";
|
|
14
14
|
import { type Box, isBox } from "@/spatial/box/box";
|
|
15
15
|
import * as box from "@/spatial/box/box";
|
|
@@ -64,7 +64,7 @@ const curriedScale =
|
|
|
64
64
|
|
|
65
65
|
const curriedReBound =
|
|
66
66
|
(bound: bounds.Bounds): Operation =>
|
|
67
|
-
(
|
|
67
|
+
(_, __, v) => [bound, v];
|
|
68
68
|
|
|
69
69
|
const curriedInvert = (): Operation => (currScale, type, v) => {
|
|
70
70
|
if (currScale === null) throw new Error("cannot invert without bounds");
|
package/src/spatial/spatial.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Copyright
|
|
1
|
+
// Copyright 2024 Synnax Labs, Inc.
|
|
2
2
|
//
|
|
3
3
|
// Use of this software is governed by the Business Source License included in the file
|
|
4
4
|
// licenses/BSL.txt.
|
|
@@ -8,10 +8,10 @@
|
|
|
8
8
|
// included in the file licenses/APL.txt.
|
|
9
9
|
|
|
10
10
|
export {
|
|
11
|
-
ALIGNMENTS,
|
|
12
|
-
alignment,
|
|
13
11
|
type Alignment,
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
alignment,
|
|
13
|
+
ALIGNMENTS,
|
|
16
14
|
type Order,
|
|
15
|
+
order,
|
|
16
|
+
ORDERS,
|
|
17
17
|
} from "@/spatial/base";
|
package/src/spatial/xy/index.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Copyright
|
|
1
|
+
// Copyright 2024 Synnax Labs, Inc.
|
|
2
2
|
//
|
|
3
3
|
// Use of this software is governed by the Business Source License included in the file
|
|
4
4
|
// licenses/BSL.txt.
|
|
@@ -7,4 +7,4 @@
|
|
|
7
7
|
// License, use of this software will be governed by the Apache License, Version 2.0,
|
|
8
8
|
// included in the file licenses/APL.txt.
|
|
9
9
|
|
|
10
|
-
export * as xy from "@/spatial/xy/xy";
|
|
10
|
+
export * as xy from "@/spatial/xy/xy";
|