New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@likec4/core

Package Overview
Dependencies
Maintainers
1
Versions
130
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@likec4/core - npm Package Compare versions

Comparing version 0.40.0 to 0.41.0

dist/cjs/colors/element.d.ts

2

dist/cjs/index.d.ts
export * from './colors';
export * from './compute-view';
export * from './errors';
export * from './model-index';
export * from './types';

@@ -6,0 +4,0 @@ export * from './utils';

@@ -17,13 +17,2 @@ "use strict";

});
var _computeView = require("./compute-view");
Object.keys(_computeView).forEach(function (key) {
if (key === "default" || key === "__esModule") return;
if (key in exports && exports[key] === _computeView[key]) return;
Object.defineProperty(exports, key, {
enumerable: true,
get: function () {
return _computeView[key];
}
});
});
var _errors = require("./errors");

@@ -40,13 +29,2 @@ Object.keys(_errors).forEach(function (key) {

});
var _modelIndex = require("./model-index");
Object.keys(_modelIndex).forEach(function (key) {
if (key === "default" || key === "__esModule") return;
if (key in exports && exports[key] === _modelIndex[key]) return;
Object.defineProperty(exports, key, {
enumerable: true,
get: function () {
return _modelIndex[key];
}
});
});
var _types = require("./types");

@@ -53,0 +31,0 @@ Object.keys(_types).forEach(function (key) {

import type { Opaque } from './opaque';
import type { ElementKind, ElementShape, Fqn, Tag } from './element';
import type { RelationID } from './relation';
import type { RelationID, RelationshipArrowType, RelationshipLineType } from './relation';
import type { BasicElementView, ViewID, ViewRuleAutoLayout } from './view';

@@ -34,9 +34,12 @@ import type { IconUrl, NonEmptyArray } from './_common';

relations: RelationID[];
color?: ThemeColor;
line?: RelationshipLineType;
head?: RelationshipArrowType;
tail?: RelationshipArrowType;
}
export interface ComputedView extends BasicElementView {
viewOf?: Fqn;
extends?: ViewID;
autoLayout: ViewRuleAutoLayout['autoLayout'];
nodes: ComputedNode[];
edges: ComputedEdge[];
export interface ComputedView extends Omit<BasicElementView, 'rules'> {
readonly extends?: ViewID;
readonly autoLayout: ViewRuleAutoLayout['autoLayout'];
readonly nodes: ComputedNode[];
readonly edges: ComputedEdge[];
}
import type { ColorLiteral } from './theme';
import type { ComputedEdge, ComputedNode, ComputedView } from './computed-view';
import type { NonEmptyArray } from './_common';
export type Point = [x: number, y: number];
export type BBox = {
x: number;
y: number;
width: number;
height: number;
};
export interface DiagramLabel {

@@ -23,5 +30,7 @@ align: 'left' | 'right' | 'center';

export interface DiagramEdge extends ComputedEdge {
points: Point[];
headArrow?: Point[];
labels: DiagramLabel[];
points: NonEmptyArray<Point>;
headArrow?: NonEmptyArray<Point>;
tailArrow?: NonEmptyArray<Point>;
labels?: NonEmptyArray<DiagramLabel>;
labelBBox?: BBox;
}

@@ -31,4 +40,4 @@ export interface DiagramView extends Omit<ComputedView, 'nodes' | 'edges'> {

readonly edges: DiagramEdge[];
width: number;
height: number;
readonly width: number;
readonly height: number;
}

@@ -17,3 +17,3 @@ import type { ElementKind, Fqn, Tag } from './element';

element: Fqn;
isDescedants: boolean;
isDescedants?: boolean;
}

@@ -20,0 +20,0 @@ export declare function isElementRef(expr: Expression): expr is ElementRefExpr;

import type { Opaque } from './opaque';
import type { Fqn, Tag } from './element';
import type { ThemeColor } from './theme';
export type RelationID = Opaque<string, 'RelationID'>;
export type RelationshipKind = Opaque<string, 'RelationshipKind'>;
export type RelationshipLineType = 'dashed' | 'solid' | 'dotted';
export type RelationshipArrowType = 'none' | 'normal' | 'onormal' | 'diamond' | 'odiamond' | 'crow' | 'open' | 'vee';
export declare const DefaultLineStyle = "dashed";
export declare const DefaultArrowType = "normal";
export declare const DefaultRelationshipColor = "gray";
export interface Relation {

@@ -10,2 +17,7 @@ readonly id: RelationID;

readonly tags?: Tag[];
readonly kind?: RelationshipKind;
readonly color?: ThemeColor;
readonly line?: RelationshipLineType;
readonly head?: RelationshipArrowType;
readonly tail?: RelationshipArrowType;
}

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

"use strict";
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.DefaultRelationshipColor = exports.DefaultLineStyle = exports.DefaultArrowType = void 0;
const DefaultLineStyle = "dashed";
exports.DefaultLineStyle = DefaultLineStyle;
const DefaultArrowType = "normal";
exports.DefaultArrowType = DefaultArrowType;
const DefaultRelationshipColor = "gray";
exports.DefaultRelationshipColor = DefaultRelationshipColor;
export type ThemeColor = 'amber' | 'blue' | 'gray' | 'slate' | 'green' | 'indigo' | 'muted' | 'primary' | 'red' | 'secondary' | 'sky';
export type HexColorLiteral = `#${string}`;
export type ColorLiteral = HexColorLiteral;
export type InteractiveColor = HexColorLiteral | [
HexColorLiteral,
{
onHover: HexColorLiteral;
}
];
export interface ThemeColorValues {
export interface ElementThemeColorValues {
fill: ColorLiteral;

@@ -16,14 +10,18 @@ stroke: ColorLiteral;

}
export type ThemeColors = {
[key in ThemeColor]: ThemeColorValues;
export type ElementThemeColors = {
[key in ThemeColor]: ElementThemeColorValues;
};
export interface ThemeRelationColors {
lineColor: InteractiveColor;
labelColor: InteractiveColor;
export interface RelationshipThemeColorValues {
lineColor: ColorLiteral;
labelBgColor: ColorLiteral;
labelColor: ColorLiteral;
}
export type RelationshipThemeColors = {
[key in ThemeColor]: RelationshipThemeColorValues;
};
export interface LikeC4Theme {
font: 'Helvetica';
shadow: ColorLiteral;
relation: ThemeRelationColors;
colors: ThemeColors;
relationships: RelationshipThemeColors;
elements: ElementThemeColors;
}

@@ -7,6 +7,9 @@ import type { Opaque } from './opaque';

export type ViewID = Opaque<string, 'ViewID'>;
export interface ViewRuleExpression {
isInclude: boolean;
exprs: Expression[];
}
export type ViewRuleExpression = {
include: Expression[];
exclude?: never;
} | {
include?: never;
exclude: Expression[];
};
export declare function isViewRuleExpression(rule: ViewRule): rule is ViewRuleExpression;

@@ -13,0 +16,0 @@ export interface ViewRuleStyle {

@@ -12,3 +12,3 @@ "use strict";

function isViewRuleExpression(rule) {
return "exprs" in rule && "isInclude" in rule;
return "include" in rule && Array.isArray(rule.include) || "exclude" in rule && Array.isArray(rule.exclude);
}

@@ -15,0 +15,0 @@ function isViewRuleStyle(rule) {

@@ -8,3 +8,3 @@ import type { Element, Fqn } from '../types';

id: Fqn;
}>(...args: [one: Fqn, another: Fqn] | [one: E, another: E]): boolean;
}>(one: E | Fqn, another: E | Fqn): boolean;
export declare function isDescendantOf<E extends {

@@ -17,2 +17,7 @@ id: Fqn;

/**
* Get all ancestor elements (i.e. parent, parent’s parent, etc.)
* (from closest to root)
*/
export declare function ancestorsFqn(fqn: Fqn): Fqn[];
/**
* Compares two fully qualified names (fqns) hierarchically based on their depth.

@@ -19,0 +24,0 @@ * From parent nodes to leaves

@@ -6,2 +6,3 @@ "use strict";

});
exports.ancestorsFqn = ancestorsFqn;
exports.commonAncestor = commonAncestor;

@@ -31,6 +32,6 @@ exports.compareByFqnHierarchically = compareByFqnHierarchically;

}
function isSameHierarchy(...args) {
const one = (0, _guards.isString)(args[0]) ? args[0] : args[0].id;
const another = (0, _guards.isString)(args[1]) ? args[1] : args[1].id;
return one === another || another.startsWith(one + ".") || one.startsWith(another + ".");
function isSameHierarchy(one, another) {
const first = (0, _guards.isString)(one) ? one : one.id;
const second = (0, _guards.isString)(another) ? another : another.id;
return first === second || second.startsWith(first + ".") || first.startsWith(second + ".");
}

@@ -71,2 +72,14 @@ function isDescendantOf(ancestors) {

}
function ancestorsFqn(fqn) {
const path = fqn.split(".");
path.pop();
if (path.length === 0) {
return [];
}
return path.reduce((acc, _, idx) => {
const ancestor = path.slice(0, idx + 1).join(".");
acc.unshift(ancestor);
return acc;
}, []);
}
function compareFqnHierarchically(a, b) {

@@ -73,0 +86,0 @@ const depthA = a.split(".").length;

import type { NonEmptyArray } from '../types';
export { hasAtLeast } from 'remeda';
export declare function isString(value: unknown): value is string;
export declare function isNonEmptyArray<A>(arr: ArrayLike<A>): arr is NonEmptyArray<A>;

@@ -6,4 +6,11 @@ "use strict";

});
Object.defineProperty(exports, "hasAtLeast", {
enumerable: true,
get: function () {
return _remeda.hasAtLeast;
}
});
exports.isNonEmptyArray = isNonEmptyArray;
exports.isString = isString;
var _remeda = require("remeda");
function isString(value) {

@@ -10,0 +17,0 @@ return value != null && typeof value === "string";

export * from './fqn';
export * from './guards';
export * from './compute-node-levels';
export * from './relations';

@@ -28,13 +28,2 @@ "use strict";

});
var _computeNodeLevels = require("./compute-node-levels");
Object.keys(_computeNodeLevels).forEach(function (key) {
if (key === "default" || key === "__esModule") return;
if (key in exports && exports[key] === _computeNodeLevels[key]) return;
Object.defineProperty(exports, key, {
enumerable: true,
get: function () {
return _computeNodeLevels[key];
}
});
});
var _relations = require("./relations");

@@ -41,0 +30,0 @@ Object.keys(_relations).forEach(function (key) {

export * from './colors';
export * from './compute-view';
export * from './errors';
export * from './model-index';
export * from './types';

@@ -6,0 +4,0 @@ export * from './utils';

@@ -1,6 +0,4 @@

export * from "./colors.js";
export * from "./compute-view/index.js";
export * from "./colors/index.js";
export * from "./errors/index.js";
export * from "./model-index/index.js";
export * from "./types/index.js";
export * from "./utils/index.js";
import type { Opaque } from './opaque';
import type { ElementKind, ElementShape, Fqn, Tag } from './element';
import type { RelationID } from './relation';
import type { RelationID, RelationshipArrowType, RelationshipLineType } from './relation';
import type { BasicElementView, ViewID, ViewRuleAutoLayout } from './view';

@@ -34,9 +34,12 @@ import type { IconUrl, NonEmptyArray } from './_common';

relations: RelationID[];
color?: ThemeColor;
line?: RelationshipLineType;
head?: RelationshipArrowType;
tail?: RelationshipArrowType;
}
export interface ComputedView extends BasicElementView {
viewOf?: Fqn;
extends?: ViewID;
autoLayout: ViewRuleAutoLayout['autoLayout'];
nodes: ComputedNode[];
edges: ComputedEdge[];
export interface ComputedView extends Omit<BasicElementView, 'rules'> {
readonly extends?: ViewID;
readonly autoLayout: ViewRuleAutoLayout['autoLayout'];
readonly nodes: ComputedNode[];
readonly edges: ComputedEdge[];
}
import type { ColorLiteral } from './theme';
import type { ComputedEdge, ComputedNode, ComputedView } from './computed-view';
import type { NonEmptyArray } from './_common';
export type Point = [x: number, y: number];
export type BBox = {
x: number;
y: number;
width: number;
height: number;
};
export interface DiagramLabel {

@@ -23,5 +30,7 @@ align: 'left' | 'right' | 'center';

export interface DiagramEdge extends ComputedEdge {
points: Point[];
headArrow?: Point[];
labels: DiagramLabel[];
points: NonEmptyArray<Point>;
headArrow?: NonEmptyArray<Point>;
tailArrow?: NonEmptyArray<Point>;
labels?: NonEmptyArray<DiagramLabel>;
labelBBox?: BBox;
}

@@ -31,4 +40,4 @@ export interface DiagramView extends Omit<ComputedView, 'nodes' | 'edges'> {

readonly edges: DiagramEdge[];
width: number;
height: number;
readonly width: number;
readonly height: number;
}

@@ -17,3 +17,3 @@ import type { ElementKind, Fqn, Tag } from './element';

element: Fqn;
isDescedants: boolean;
isDescedants?: boolean;
}

@@ -20,0 +20,0 @@ export declare function isElementRef(expr: Expression): expr is ElementRefExpr;

import type { Opaque } from './opaque';
import type { Fqn, Tag } from './element';
import type { ThemeColor } from './theme';
export type RelationID = Opaque<string, 'RelationID'>;
export type RelationshipKind = Opaque<string, 'RelationshipKind'>;
export type RelationshipLineType = 'dashed' | 'solid' | 'dotted';
export type RelationshipArrowType = 'none' | 'normal' | 'onormal' | 'diamond' | 'odiamond' | 'crow' | 'open' | 'vee';
export declare const DefaultLineStyle = "dashed";
export declare const DefaultArrowType = "normal";
export declare const DefaultRelationshipColor = "gray";
export interface Relation {

@@ -10,2 +17,7 @@ readonly id: RelationID;

readonly tags?: Tag[];
readonly kind?: RelationshipKind;
readonly color?: ThemeColor;
readonly line?: RelationshipLineType;
readonly head?: RelationshipArrowType;
readonly tail?: RelationshipArrowType;
}
export type ThemeColor = 'amber' | 'blue' | 'gray' | 'slate' | 'green' | 'indigo' | 'muted' | 'primary' | 'red' | 'secondary' | 'sky';
export type HexColorLiteral = `#${string}`;
export type ColorLiteral = HexColorLiteral;
export type InteractiveColor = HexColorLiteral | [
HexColorLiteral,
{
onHover: HexColorLiteral;
}
];
export interface ThemeColorValues {
export interface ElementThemeColorValues {
fill: ColorLiteral;

@@ -16,14 +10,18 @@ stroke: ColorLiteral;

}
export type ThemeColors = {
[key in ThemeColor]: ThemeColorValues;
export type ElementThemeColors = {
[key in ThemeColor]: ElementThemeColorValues;
};
export interface ThemeRelationColors {
lineColor: InteractiveColor;
labelColor: InteractiveColor;
export interface RelationshipThemeColorValues {
lineColor: ColorLiteral;
labelBgColor: ColorLiteral;
labelColor: ColorLiteral;
}
export type RelationshipThemeColors = {
[key in ThemeColor]: RelationshipThemeColorValues;
};
export interface LikeC4Theme {
font: 'Helvetica';
shadow: ColorLiteral;
relation: ThemeRelationColors;
colors: ThemeColors;
relationships: RelationshipThemeColors;
elements: ElementThemeColors;
}

@@ -7,6 +7,9 @@ import type { Opaque } from './opaque';

export type ViewID = Opaque<string, 'ViewID'>;
export interface ViewRuleExpression {
isInclude: boolean;
exprs: Expression[];
}
export type ViewRuleExpression = {
include: Expression[];
exclude?: never;
} | {
include?: never;
exclude: Expression[];
};
export declare function isViewRuleExpression(rule: ViewRule): rule is ViewRuleExpression;

@@ -13,0 +16,0 @@ export interface ViewRuleStyle {

export function isViewRuleExpression(rule) {
return "exprs" in rule && "isInclude" in rule;
return "include" in rule && Array.isArray(rule.include) || "exclude" in rule && Array.isArray(rule.exclude);
}

@@ -4,0 +4,0 @@ export function isViewRuleStyle(rule) {

@@ -8,3 +8,3 @@ import type { Element, Fqn } from '../types';

id: Fqn;
}>(...args: [one: Fqn, another: Fqn] | [one: E, another: E]): boolean;
}>(one: E | Fqn, another: E | Fqn): boolean;
export declare function isDescendantOf<E extends {

@@ -17,2 +17,7 @@ id: Fqn;

/**
* Get all ancestor elements (i.e. parent, parent’s parent, etc.)
* (from closest to root)
*/
export declare function ancestorsFqn(fqn: Fqn): Fqn[];
/**
* Compares two fully qualified names (fqns) hierarchically based on their depth.

@@ -19,0 +24,0 @@ * From parent nodes to leaves

@@ -16,6 +16,6 @@ import { anyPass } from "remeda";

}
export function isSameHierarchy(...args) {
const one = isString(args[0]) ? args[0] : args[0].id;
const another = isString(args[1]) ? args[1] : args[1].id;
return one === another || another.startsWith(one + ".") || one.startsWith(another + ".");
export function isSameHierarchy(one, another) {
const first = isString(one) ? one : one.id;
const second = isString(another) ? another : another.id;
return first === second || second.startsWith(first + ".") || first.startsWith(second + ".");
}

@@ -56,2 +56,14 @@ export function isDescendantOf(ancestors) {

}
export function ancestorsFqn(fqn) {
const path = fqn.split(".");
path.pop();
if (path.length === 0) {
return [];
}
return path.reduce((acc, _, idx) => {
const ancestor = path.slice(0, idx + 1).join(".");
acc.unshift(ancestor);
return acc;
}, []);
}
export function compareFqnHierarchically(a, b) {

@@ -58,0 +70,0 @@ const depthA = a.split(".").length;

import type { NonEmptyArray } from '../types';
export { hasAtLeast } from 'remeda';
export declare function isString(value: unknown): value is string;
export declare function isNonEmptyArray<A>(arr: ArrayLike<A>): arr is NonEmptyArray<A>;

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

export { hasAtLeast } from "remeda";
export function isString(value) {

@@ -2,0 +3,0 @@ return value != null && typeof value === "string";

export * from './fqn';
export * from './guards';
export * from './compute-node-levels';
export * from './relations';
export * from "./fqn.js";
export * from "./guards.js";
export * from "./compute-node-levels.js";
export * from "./relations.js";
{
"name": "@likec4/core",
"version": "0.40.0",
"version": "0.41.0",
"license": "MIT",

@@ -14,9 +14,7 @@ "homepage": "https://likec4.dev",

"scripts": {
"typecheck": "tsc --emitDeclarationOnly",
"build:watch": "tsc --watch",
"typecheck": "tsc --noEmit",
"build": "unbuild",
"prepack": "unbuild",
"prepack": "run clean && run build",
"lint": "run -T eslint src/ --fix",
"test": "run -T vitest run",
"test:watch": "run -T vitest",
"clean": "run -T rimraf dist"

@@ -26,59 +24,27 @@ },

"dist",
"!**/__test__/",
"!**/*.spec.*"
"!**/*.spec.*",
"!**/*.map"
],
"type": "module",
"sideEffects": false,
"main": "./dist/cjs/index.js",
"types": "./dist/cjs/index.d.ts",
"exports": {
".": {
"import": {
"types": "./dist/esm/index.d.ts",
"default": "./dist/esm/index.js"
},
"require": {
"types": "./dist/cjs/index.d.ts",
"default": "./dist/cjs/index.js"
}
"types": "./dist/types/index.d.ts",
"import": "./dist/esm/index.js",
"require": "./dist/cjs/index.js"
},
"./colors": {
"import": {
"types": "./dist/esm/colors.d.ts",
"default": "./dist/esm/colors.js"
},
"require": {
"types": "./dist/cjs/colors.d.ts",
"default": "./dist/cjs/colors.js"
}
"types": "./dist/types/colors/index.d.ts",
"import": "./dist/esm/colors/index.js",
"require": "./dist/cjs/colors/index.js"
},
"./errors": {
"import": {
"types": "./dist/esm/errors/index.d.ts",
"default": "./dist/esm/errors/index.js"
},
"require": {
"types": "./dist/cjs/errors/index.d.ts",
"default": "./dist/cjs/errors/index.js"
}
},
"./types": {
"import": {
"types": "./dist/esm/types/index.d.ts",
"default": "./dist/esm/types/index.js"
},
"require": {
"types": "./dist/cjs/types/index.d.ts",
"default": "./dist/cjs/types/index.js"
}
"types": "./dist/types/types/index.d.ts",
"import": "./dist/esm/types/index.js",
"require": "./dist/cjs/types/index.js"
},
"./utils": {
"import": {
"types": "./dist/esm/utils/index.d.ts",
"default": "./dist/esm/utils/index.js"
},
"require": {
"types": "./dist/cjs/utils/index.d.ts",
"default": "./dist/cjs/utils/index.js"
}
"types": "./dist/types/utils/index.d.ts",
"import": "./dist/esm/utils/index.js",
"require": "./dist/cjs/utils/index.js"
}

@@ -88,8 +54,32 @@ },

"registry": "https://registry.npmjs.org",
"access": "public"
"access": "public",
"main": "./dist/cjs/index.js",
"module": "./dist/esm/index.js",
"types": "./dist/types/index.d.ts",
"exports": {
".": {
"types": "./dist/types/index.d.ts",
"import": "./dist/esm/index.js",
"require": "./dist/cjs/index.js"
},
"./colors": {
"types": "./dist/types/colors/index.d.ts",
"import": "./dist/esm/colors/index.js",
"require": "./dist/cjs/colors/index.js"
},
"./types": {
"types": "./dist/types/types/index.d.ts",
"import": "./dist/esm/types/index.js",
"require": "./dist/cjs/types/index.js"
},
"./utils": {
"types": "./dist/types/utils/index.d.ts",
"import": "./dist/esm/utils/index.js",
"require": "./dist/cjs/utils/index.js"
}
}
},
"dependencies": {
"@dagrejs/graphlib": "^2.1.13",
"rambdax": "^9.1.1",
"remeda": "^1.27.0",
"remeda": "^1.27.1",
"safe-stable-stringify": "^2.4.3",

@@ -99,2 +89,3 @@ "ts-custom-error": "^3.3.1"

"devDependencies": {
"execa": "^8.0.1",
"typescript": "^5.2.2",

@@ -104,3 +95,9 @@ "unbuild": "^2.0.0",

},
"packageManager": "yarn@3.6.3"
"packageManager": "yarn@3.6.4",
"volta": {
"extends": "../../package.json"
},
"main": "./dist/cjs/index.js",
"module": "./dist/esm/index.js",
"types": "./dist/types/index.d.ts"
}

@@ -1,9 +0,5 @@

# LikeC4 Core
# `@likec4/core`
[docs](https://likec4.dev/docs/) | [example](https://likec4.dev/examples/bigbank/likec4/)
[docs](https://likec4.dev/docs/)
```bash
npm install @likec4/core
```
Package contains:

@@ -10,0 +6,0 @@

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