Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@steelbreeze/landscape

Package Overview
Dependencies
Maintainers
1
Versions
47
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@steelbreeze/landscape - npm Package Compare versions

Comparing version 3.4.1 to 3.4.2

2

docs/dist/landscape.min.js

@@ -1,1 +0,1 @@

var landscape;(()=>{"use strict";var e={};(()=>{var n=e;function t(e,n){n.index.forEach(((t,o)=>{e.index.includes(t)||(e.index.push(t),e.source.push(n.source[o]))}))}function o(e,n,t,o){return e.forEach(((e,s)=>{const r=n[s];for(let n=0;n<r;++n)o.push(t(e,r,n,s))})),o}function s(e,n){for(let t=e.length;t--;)n(e[t],t)}function r(e,n){return e.map((e=>n(e)||1)).reduce(((e,n)=>e*n/c(e,n)))}function c(e,n){return n?c(n,e%n):e}function u(e,n){return e.text===n.text&&e.style===n.style}function l(e,n){return{text:e.value,style:`axis ${n} ${e.key}`,index:[],source:[],rows:1,cols:1}}Object.defineProperty(n,"__esModule",{value:!0}),n.merge=n.table=void 0,n.table=function(e,n,t,s){const c={index:0},i=e.map((e=>e.map((e=>e.length?function(e,n,t){const o=[];for(const s of e){const e=n(s),r=o.find((n=>u(n,e)));r?(r.index.push(t.index),r.source.push(s)):o.push({...e,index:[t.index],source:[s],rows:1,cols:1}),t.index++}return o}(e,t,c):[{text:"",style:"empty",index:[],source:[],rows:1,cols:1}]))));return function(e,n,t){const s=n.x.map(((n,o)=>t?r(e,(e=>e[o].length)):1)),c=e.map((e=>t?1:r(e,(e=>e.length))));return o(e,c,((e,t,r,c)=>o(e,s,((e,n,o)=>({...e[Math.floor(e.length*(r+o)*t/n)]})),n.y[c].map((e=>l(e,"y"))))),n.x[0].map(((e,t)=>o(n.x,s,(e=>l(e[t],"x")),n.y[0].map((()=>l({key:"",value:""},"xy")))))))}(i,n,s)},n.merge=function(e,n,o){let r;s(e,((c,l)=>{s(c,((s,i)=>{o&&l&&(r=e[l-1][i])&&u(r,s)&&r.cols===s.cols?(r.rows+=s.rows,t(r,s),c.splice(i,1)):n&&i&&(r=c[i-1])&&u(r,s)&&r.rows===s.rows&&(r.cols+=s.cols,t(r,s),c.splice(i,1))}))}))}})(),landscape=e})();
var landscape;(()=>{"use strict";var e={};(()=>{var n=e;function t(e,n,t){const o=n.x.map(((n,o)=>t?c(e,(e=>e[o].length)):1)),r=e.map((e=>t?1:c(e,(e=>e.length))));return s(e,r,((e,t,r,c)=>s(e,o,((e,n,o)=>({...e[Math.floor(e.length*(r+o)/(n*t))]})),n.y[c].map((e=>i(e,"y"))))),n.x[0].map(((e,t)=>s(n.x,o,(e=>i(e[t],"x")),n.y[0].map((()=>i({key:"",value:""},"xy")))))))}function o(e,n){n.index.forEach(((t,o)=>{e.index.includes(t)||(e.index.push(t),e.source.push(n.source[o]))}))}function s(e,n,t,o){return e.forEach(((e,s)=>{const r=n[s];for(let n=0;n<r;++n)o.push(t(e,r,n,s))})),o}function r(e,n){for(let t=e.length;t--;)n(e[t],t)}function c(e,n){return e.map((e=>n(e)||1)).reduce(((e,n)=>e*n/u(e,n)))}function u(e,n){return n?u(n,e%n):e}function l(e,n){return e.text===n.text&&e.style===n.style}function i(e,n){return{text:e.value,style:`axis ${n} ${e.key}`,index:[],source:[],rows:1,cols:1}}Object.defineProperty(n,"__esModule",{value:!0}),n.merge=n.split=n.table=void 0,n.table=function(e,n,o,s){const r={index:0},c=e.map((e=>e.map((e=>e.length?function(e,n,t){const o=[];for(const s of e){const e=n(s),r=o.find((n=>l(n,e)));r?(r.index.push(t.index),r.source.push(s)):o.push({...e,index:[t.index],source:[s],rows:1,cols:1}),t.index++}return o}(e,o,r):[{text:"",style:"empty",index:[],source:[],rows:1,cols:1}]))));return t(c,n,s)},n.split=t,n.merge=function(e,n,t){let s;r(e,((c,u)=>{r(c,((r,i)=>{t&&u&&(s=e[u-1][i])&&l(s,r)&&s.cols===r.cols?(s.rows+=r.rows,o(s,r),c.splice(i,1)):n&&i&&(s=c[i-1])&&l(s,r)&&s.rows===r.rows&&(s.cols+=r.cols,o(s,r),c.splice(i,1))}))}))}})(),landscape=e})();
import { Axes, Cube, Func, Row } from '@steelbreeze/pivot';
/** The final text and class name to use when rendering cells in a table. */
export interface Key {

@@ -28,7 +29,14 @@ /** The text to use in the final table rendering. */

/**
* Splits a cube of keys into a table, creating mutiple rows or columns where a cell in a cube has multiple values.
* @param cube The source cube.
* @param axes The x and y axes used in the pivot operation to create the cube.
* @param onX A flag to indicate if cells in cube containing multiple values should be split on the x axis (if not, the y axis will be used).
*/
export declare function split<TRow extends Row>(cells: Cube<Cell<TRow>>, axes: Axes<TRow>, onX: boolean): Array<Array<Cell<TRow>>>;
/**
* Merge adjacent cells in a split table on the y and/or x axes.
* @param table A table of Cells created by a previous call to splitX or splitY.
* @param cells A table of Cells created by a previous call to splitX or splitY.
* @param onX A flag to indicate that cells should be merged on the x axis.
* @param onY A flag to indicate that cells should be merged on the y axis.
*/
export declare function merge<TRow extends Row>(table: Array<Array<Cell<TRow>>>, onX: boolean, onY: boolean): void;
export declare function merge<TRow extends Row>(cells: Array<Array<Cell<TRow>>>, onX: boolean, onY: boolean): void;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.merge = exports.table = void 0;
exports.merge = exports.split = exports.table = void 0;
/**

@@ -32,13 +32,13 @@ * Generates a table from a cube and it's axis.

// iterate and expand the x axis based on the split data
return expand(row, xSplits, (table, xSplit, xsi) => {
return expand(row, xSplits, (cell, xSplit, xsi) => {
// generate the cube cells
return { ...(table[Math.floor(table.length * (ysi + xsi) * ySplit / xSplit)]) }; // NOTE: clone cells from the cube so subsiquent merge operation work
return { ...cell[Math.floor(cell.length * (ysi + xsi) / (xSplit * ySplit))] };
// generate the y axis row header cells
}, axes.y[iY].map(criterion => axis(criterion, 'y')));
// generate the x axis column header rows
}, axes.x[0].map((_, iX) => {
}, axes.x[0].map((_, iC) => {
// iterate and expand the x axis
return expand(axes.x, xSplits, x => {
return expand(axes.x, xSplits, xPoint => {
// generate the x axis cells
return axis(x[iX], 'x');
return axis(xPoint[iC], 'x');
// generate the x/y header

@@ -48,20 +48,21 @@ }, axes.y[0].map(() => axis({ key: '', value: '' }, 'xy')));

}
exports.split = split;
/**
* Merge adjacent cells in a split table on the y and/or x axes.
* @param table A table of Cells created by a previous call to splitX or splitY.
* @param cells A table of Cells created by a previous call to splitX or splitY.
* @param onX A flag to indicate that cells should be merged on the x axis.
* @param onY A flag to indicate that cells should be merged on the y axis.
*/
function merge(table, onX, onY) {
function merge(cells, onX, onY) {
let next;
forEachRev(table, (row, iY) => {
forEachRev(row, (value, iX) => {
if (onY && iY && (next = table[iY - 1][iX]) && keyEquals(next, value) && next.cols === value.cols) {
next.rows += value.rows;
mergeContext(next, value);
forEachRev(cells, (row, iY) => {
forEachRev(row, (cell, iX) => {
if (onY && iY && (next = cells[iY - 1][iX]) && keyEquals(next, cell) && next.cols === cell.cols) {
next.rows += cell.rows;
mergeContext(next, cell);
row.splice(iX, 1);
}
else if (onX && iX && (next = row[iX - 1]) && keyEquals(next, value) && next.rows === value.rows) {
next.cols += value.cols;
mergeContext(next, value);
else if (onX && iX && (next = row[iX - 1]) && keyEquals(next, cell) && next.rows === cell.rows) {
next.cols += cell.cols;
mergeContext(next, cell);
row.splice(iX, 1);

@@ -77,7 +78,7 @@ }

*/
function mergeContext(next, value) {
value.index.forEach((index, i) => {
function mergeContext(next, cell) {
cell.index.forEach((index, i) => {
if (!next.index.includes(index)) {
next.index.push(index);
next.source.push(value.source[i]);
next.source.push(cell.source[i]);
}

@@ -84,0 +85,0 @@ });

@@ -1,1 +0,1 @@

var landscape;(()=>{"use strict";var e={};(()=>{var n=e;function t(e,n){n.index.forEach(((t,o)=>{e.index.includes(t)||(e.index.push(t),e.source.push(n.source[o]))}))}function o(e,n,t,o){return e.forEach(((e,s)=>{const r=n[s];for(let n=0;n<r;++n)o.push(t(e,r,n,s))})),o}function s(e,n){for(let t=e.length;t--;)n(e[t],t)}function r(e,n){return e.map((e=>n(e)||1)).reduce(((e,n)=>e*n/c(e,n)))}function c(e,n){return n?c(n,e%n):e}function u(e,n){return e.text===n.text&&e.style===n.style}function l(e,n){return{text:e.value,style:`axis ${n} ${e.key}`,index:[],source:[],rows:1,cols:1}}Object.defineProperty(n,"__esModule",{value:!0}),n.merge=n.table=void 0,n.table=function(e,n,t,s){const c={index:0},i=e.map((e=>e.map((e=>e.length?function(e,n,t){const o=[];for(const s of e){const e=n(s),r=o.find((n=>u(n,e)));r?(r.index.push(t.index),r.source.push(s)):o.push({...e,index:[t.index],source:[s],rows:1,cols:1}),t.index++}return o}(e,t,c):[{text:"",style:"empty",index:[],source:[],rows:1,cols:1}]))));return function(e,n,t){const s=n.x.map(((n,o)=>t?r(e,(e=>e[o].length)):1)),c=e.map((e=>t?1:r(e,(e=>e.length))));return o(e,c,((e,t,r,c)=>o(e,s,((e,n,o)=>({...e[Math.floor(e.length*(r+o)*t/n)]})),n.y[c].map((e=>l(e,"y"))))),n.x[0].map(((e,t)=>o(n.x,s,(e=>l(e[t],"x")),n.y[0].map((()=>l({key:"",value:""},"xy")))))))}(i,n,s)},n.merge=function(e,n,o){let r;s(e,((c,l)=>{s(c,((s,i)=>{o&&l&&(r=e[l-1][i])&&u(r,s)&&r.cols===s.cols?(r.rows+=s.rows,t(r,s),c.splice(i,1)):n&&i&&(r=c[i-1])&&u(r,s)&&r.rows===s.rows&&(r.cols+=s.cols,t(r,s),c.splice(i,1))}))}))}})(),landscape=e})();
var landscape;(()=>{"use strict";var e={};(()=>{var n=e;function t(e,n,t){const o=n.x.map(((n,o)=>t?c(e,(e=>e[o].length)):1)),r=e.map((e=>t?1:c(e,(e=>e.length))));return s(e,r,((e,t,r,c)=>s(e,o,((e,n,o)=>({...e[Math.floor(e.length*(r+o)/(n*t))]})),n.y[c].map((e=>i(e,"y"))))),n.x[0].map(((e,t)=>s(n.x,o,(e=>i(e[t],"x")),n.y[0].map((()=>i({key:"",value:""},"xy")))))))}function o(e,n){n.index.forEach(((t,o)=>{e.index.includes(t)||(e.index.push(t),e.source.push(n.source[o]))}))}function s(e,n,t,o){return e.forEach(((e,s)=>{const r=n[s];for(let n=0;n<r;++n)o.push(t(e,r,n,s))})),o}function r(e,n){for(let t=e.length;t--;)n(e[t],t)}function c(e,n){return e.map((e=>n(e)||1)).reduce(((e,n)=>e*n/u(e,n)))}function u(e,n){return n?u(n,e%n):e}function l(e,n){return e.text===n.text&&e.style===n.style}function i(e,n){return{text:e.value,style:`axis ${n} ${e.key}`,index:[],source:[],rows:1,cols:1}}Object.defineProperty(n,"__esModule",{value:!0}),n.merge=n.split=n.table=void 0,n.table=function(e,n,o,s){const r={index:0},c=e.map((e=>e.map((e=>e.length?function(e,n,t){const o=[];for(const s of e){const e=n(s),r=o.find((n=>l(n,e)));r?(r.index.push(t.index),r.source.push(s)):o.push({...e,index:[t.index],source:[s],rows:1,cols:1}),t.index++}return o}(e,o,r):[{text:"",style:"empty",index:[],source:[],rows:1,cols:1}]))));return t(c,n,s)},n.split=t,n.merge=function(e,n,t){let s;r(e,((c,u)=>{r(c,((r,i)=>{t&&u&&(s=e[u-1][i])&&l(s,r)&&s.cols===r.cols?(s.rows+=r.rows,o(s,r),c.splice(i,1)):n&&i&&(s=c[i-1])&&l(s,r)&&s.rows===r.rows&&(s.cols+=r.cols,o(s,r),c.splice(i,1))}))}))}})(),landscape=e})();
{
"name": "@steelbreeze/landscape",
"version": "3.4.1",
"version": "3.4.2",
"description": "Landscape map viewpoint visualisation",

@@ -5,0 +5,0 @@ "main": "lib/node/index.js",

import { Axes, Cube, Func, Pair, Row, Table } from '@steelbreeze/pivot';
/** The final text and class name to use when rendering cells in a table. */
export interface Key {

@@ -49,3 +50,3 @@ /** The text to use in the final table rendering. */

*/
function split<TRow extends Row>(cells: Cube<Cell<TRow>>, axes: Axes<TRow>, onX: boolean): Array<Array<Cell<TRow>>> {
export function split<TRow extends Row>(cells: Cube<Cell<TRow>>, axes: Axes<TRow>, onX: boolean): Array<Array<Cell<TRow>>> {
// calcuate the x and y splits required

@@ -59,6 +60,6 @@ const xSplits = axes.x.map((_, iX) => onX ? leastCommonMultiple(cells, row => row[iX].length) : 1);

// iterate and expand the x axis based on the split data
return expand(row, xSplits, (table, xSplit, xsi) => {
return expand(row, xSplits, (cell, xSplit, xsi) => {
// generate the cube cells
return { ...(table[Math.floor(table.length * (ysi + xsi) * ySplit / xSplit)]) }; // NOTE: clone cells from the cube so subsiquent merge operation work
return { ...cell[Math.floor(cell.length * (ysi + xsi) / (xSplit * ySplit))] };

@@ -69,9 +70,9 @@ // generate the y axis row header cells

// generate the x axis column header rows
}, axes.x[0].map((_, iX) => {
}, axes.x[0].map((_, iC) => {
// iterate and expand the x axis
return expand(axes.x, xSplits, x => {
return expand(axes.x, xSplits, xPoint => {
// generate the x axis cells
return axis(x[iX], 'x');
return axis(xPoint[iC], 'x');

@@ -83,20 +84,21 @@ // generate the x/y header

/**
* Merge adjacent cells in a split table on the y and/or x axes.
* @param table A table of Cells created by a previous call to splitX or splitY.
* @param cells A table of Cells created by a previous call to splitX or splitY.
* @param onX A flag to indicate that cells should be merged on the x axis.
* @param onY A flag to indicate that cells should be merged on the y axis.
*/
export function merge<TRow extends Row>(table: Array<Array<Cell<TRow>>>, onX: boolean, onY: boolean): void {
export function merge<TRow extends Row>(cells: Array<Array<Cell<TRow>>>, onX: boolean, onY: boolean): void {
let next;
forEachRev(table, (row, iY) => {
forEachRev(row, (value, iX) => {
if (onY && iY && (next = table[iY - 1][iX]) && keyEquals(next, value) && next.cols === value.cols) {
next.rows += value.rows;
mergeContext(next, value);
forEachRev(cells, (row, iY) => {
forEachRev(row, (cell, iX) => {
if (onY && iY && (next = cells[iY - 1][iX]) && keyEquals(next, cell) && next.cols === cell.cols) {
next.rows += cell.rows;
mergeContext(next, cell);
row.splice(iX, 1);
} else if (onX && iX && (next = row[iX - 1]) && keyEquals(next, value) && next.rows === value.rows) {
next.cols += value.cols;
mergeContext(next, value);
} else if (onX && iX && (next = row[iX - 1]) && keyEquals(next, cell) && next.rows === cell.rows) {
next.cols += cell.cols;
mergeContext(next, cell);
row.splice(iX, 1);

@@ -112,7 +114,7 @@ }

*/
function mergeContext<TRow extends Row>(next: Cell<TRow>, value: Cell<TRow>): void {
value.index.forEach((index, i) => {
function mergeContext<TRow extends Row>(next: Cell<TRow>, cell: Cell<TRow>): void {
cell.index.forEach((index, i) => {
if (!next.index.includes(index)) {
next.index.push(index);
next.source.push(value.source[i]);
next.source.push(cell.source[i]);
}

@@ -146,2 +148,3 @@ });

/**

@@ -148,0 +151,0 @@ * Expands an array using, splitting values into multiple based on a set of corresponding splits then maps the data to a desired structure.

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc