### Example Component Directory Structure (Text) Source: https://github.com/zjuvai/netv.js/blob/dev/docs/development-guide-chinese.md An example illustrating how to organize component files within a project directory, typically documented in a README.md file. ```text components/ |- todolist/ |- index.vue |- todolist-item.vue |- todolist-item-button.vue |- index.html |- README.md |- search-bar/ |- index.vue |- search-bar-navigation.vue |- search-bar-button.vue |- index.html |- README.md ``` -------------------------------- ### Importing Modules Examples (JavaScript) Source: https://github.com/zjuvai/netv.js/blob/dev/docs/development-guide-chinese.md Examples demonstrating different ways to import modules in JavaScript, including importing all exports as a namespace, importing a default export, and importing named exports. ```javascript import * as fileOne from '../file-one.js' import MyClass from '../my-class.js' import SimpleComponent from '../simple-component.vue' import SearchBar from '../search-bar' import { addTwoNumbers, mySqrt } from '../my-math.js' import { SOME_CONSTANT } from '../constant.js' ``` -------------------------------- ### Adding File Information Block (JavaScript) Source: https://github.com/zjuvai/netv.js/blob/dev/docs/development-guide-chinese.md Example of the required file information block at the top of each JavaScript file, including author, description, purpose, dependencies, and an example. ```javascript /** * @fileoverview Utilities for handling textareas. * Provide a series of functions. * Based on d3.js, lodash.js. * @author Ran Chen */ ``` -------------------------------- ### Class Definition Example - JavaScript Source: https://github.com/zjuvai/netv.js/blob/dev/docs/development-guide.md Provides an example of a class definition, demonstrating the convention for private methods using the `$_` prefix and a public method. ```JavaScript class Foo { constructor() {} // private method $_computeBar() {} // public method getBar() {} } ``` -------------------------------- ### ES Module Import Examples - JavaScript Source: https://github.com/zjuvai/netv.js/blob/dev/docs/development-guide.md Illustrates different ways to import ES modules according to the style guide, including namespace imports, default imports, and named imports. ```JavaScript import * as fileOne from '../file-one.js' import MyClass from '../my-class.js' import SimpleComponent from '../simple-component.vue' import SearchBar from '../search-bar' import { addTwoNumbers, mySqrt } from '../my-math.js' import { SOME_CONSTANT } from '../constant.js' ``` -------------------------------- ### JavaScript Naming Methods: Camel Case Examples Source: https://github.com/zjuvai/netv.js/blob/dev/docs/development-guide.md Examples demonstrating the application of the camel naming method, showing how phrases are converted to camelCase, handling existing camel case words and common abbreviations. ```JavaScript 'XML HTTP request' -> 'XmlHttpRequest', not 'XMLHTTPRequest' 'new customer ID' -> 'newCustomerId', not 'newCustomerID' 'supports IPv6 on iOS' -> 'supportsIpv6OnIos', not 'supportsIPv6OnIOS' 'YouTube importer' -> 'YouTubeImporter', not 'YoutubeImporter' ``` -------------------------------- ### Variable Naming Examples (JavaScript) Source: https://github.com/zjuvai/netv.js/blob/dev/docs/development-guide-chinese.md Provides examples of bad and good variable names according to the guidelines, emphasizing descriptive names and avoiding ambiguous abbreviations or Hungarian notation. ```javascript // Bad n // Meaningless. nErr // Ambiguous abbreviation. nCompConns // Ambiguous abbreviation. wgcConnections // Only your group knows what this stands for. pcReader // Lots of things can be abbreviated "pc". cstmrId // Deletes internal letters. kSecondsPerDay // Do not use Hungarian notation. // Good errorCount // No abbreviation. dnsConnectionIndex // Most people know what "DNS" stands for. referrerUrl // Ditto for "URL". customerId // "Id" is both ubiquitous and unlikely to be misunderstood. ``` -------------------------------- ### JavaScript Comment Style: Class JSDoc Example Source: https://github.com/zjuvai/netv.js/blob/dev/docs/development-guide.md Example demonstrating the recommended JSDoc style for commenting classes or components, including a description, optional tags like @implements, and constructor parameter documentation. ```JavaScript /** * Description of class * @implements {Iterable} */ class MyFancyTarget extends EventTarget { /** * @param {string} arg1 An argument that makes this more interesting. * @param {Array} arg2 List of numbers to be processed. */ constructor(arg1, arg2) { // ... } } ``` -------------------------------- ### JavaScript Comment Style: Function JSDoc Example Source: https://github.com/zjuvai/netv.js/blob/dev/docs/development-guide.md Example illustrating the recommended JSDoc style for commenting functions, including a description, parameter documentation with types and descriptions, rest parameters, and return type documentation. ```JavaScript /** * Description of function * @param {number} arg1 The first argument. * @param {number} arg2 The second argument. * @param {...number} rest The remainder of arguments are all numbers. * @returns {number} The result */ function func(arg1, arg2, ...rest) { // ... } ``` -------------------------------- ### Object Literal Examples - JavaScript Source: https://github.com/zjuvai/netv.js/blob/dev/docs/development-guide.md Shows preferred method shorthand syntax in object literals, an exception for Vue instance configuration, and the recommended pattern for defining enumerations. ```JavaScript const myObject = { shorthandMethod() { // ... } // instead of // method: function () { // ... // } } // Method shorthand is worse herein. new Vue({ render: (h) => h(App) }).$mount('#app') // Enumerations const Option = { // The option used shall have been the first. FIRST_OPTION: 1, // The second among two options. SECOND_OPTION: 2 } ``` -------------------------------- ### JavaScript Comment Style: Variable/Enum JSDoc Examples Source: https://github.com/zjuvai/netv.js/blob/dev/docs/development-guide.md Examples demonstrating the recommended JSDoc style for commenting variables and enums, including descriptions and type information. ```JavaScript /** * Some description. * @type {Array} */ const data = [] /** * An enum with two options. * @enum {number} */ const Option = { FIRST_OPTION: 1, SECOND_OPTION: 2 } ``` -------------------------------- ### JavaScript Comment Style: Block Comment Example Source: https://github.com/zjuvai/netv.js/blob/dev/docs/development-guide.md Example showing the simple block comment style using multiple single-line comments for multi-line explanations. ```JavaScript // xxx // yyy // ... ``` -------------------------------- ### Pull Request Template Example Source: https://github.com/zjuvai/netv.js/blob/dev/docs/development-guide.md A template structure provided for creating pull requests, including sections for type, description, self-check items, and additional plans. ```Markdown ### This is a ... - [ ] New feature (addNodes/addLinks) - [ ] Other (documents) ### Description ### Self check - [x] Test passed or not need - [x] Doc is ready or not need - [x] Demo is provided or not need ### Additional Plan? > If this PR related with other PR or following info. You can type here. ``` -------------------------------- ### Camel Case Naming Method Examples (Text) Source: https://github.com/zjuvai/netv.js/blob/dev/docs/development-guide-chinese.md Illustrates the process and results of applying the camel case naming method to various phrases, showing how to handle acronyms and multiple words. ```text 'XML HTTP request' -> 'XmlHttpRequest', not 'XMLHTTPRequest' 'new customer ID' -> 'newCustomerId', not 'newCustomerID' 'supports IPv6 on iOS' -> 'supportsIpv6OnIos', not 'supportsIPv6OnIOS' 'YouTube importer' -> 'YouTubeImporter', not 'YoutubeImporter' ``` -------------------------------- ### File Overview JSDoc Comment - JavaScript Source: https://github.com/zjuvai/netv.js/blob/dev/docs/development-guide.md Demonstrates the required JSDoc comment block at the top of each file to provide an overview including authors, description, usage, and dependencies. ```JavaScript /** * @fileoverview Utilities for handling textareas. * Provide a series of functions. * Based on d3.js, lodash.js. * @author Ran Chen */ ``` -------------------------------- ### Build Benchmarks (Shell) Source: https://github.com/zjuvai/netv.js/blob/dev/packages/netv/benchmarks/README.md Executes the npm script to build the necessary files for running the benchmark tests. ```Shell npm run build:benchmarks ``` -------------------------------- ### JavaScript Naming Conventions: Good vs Bad Examples Source: https://github.com/zjuvai/netv.js/blob/dev/docs/development-guide.md Examples illustrating good and bad practices for naming identifiers in JavaScript based on the defined rules, emphasizing descriptiveness and avoiding ambiguous abbreviations or Hungarian notation. ```JavaScript // Bad n // Meaningless. nErr // Ambiguous abbreviation. nCompConns // Ambiguous abbreviation. wgcConnections // Only your group knows what this stands for. pcReader // Lots of things can be abbreviated "pc". cstmrId // Deletes internal letters. kSecondsPerDay // Do not use Hungarian notation. // Good errorCount // No abbreviation. dnsConnectionIndex // Most people know what "DNS" stands for. referrerUrl // Ditto for "URL". customerId // "Id" is both ubiquitous and unlikely to be misunderstood. ``` -------------------------------- ### Bootstrapping Development Environment Source: https://github.com/zjuvai/netv.js/blob/dev/README-CHINESE.md Command used in the NetV.js monorepo development setup to install dependencies for all packages simultaneously. This is typically run after cloning the repository. ```bash npm run bootstrap ``` -------------------------------- ### Build NetV.js (Shell) Source: https://github.com/zjuvai/netv.js/blob/dev/packages/netv/benchmarks/README.md Executes the npm script to build the latest version of the NetV.js library. ```Shell npm run build ``` -------------------------------- ### Object and Enumeration Examples (JavaScript) Source: https://github.com/zjuvai/netv.js/blob/dev/docs/development-guide-chinese.md Illustrates using object method shorthand, a case where shorthand is not suitable (Vue render), and defining enumerations using a `const` object with `CONSTANT_CASE` values. ```javascript const myObject = { shorthandMethod() { // ... } // instead of // method: function () { // ... // } } // Method shorthand is worse herein. new Vue({ render: (h) => h(App) }).$mount('#app') // Enumerations const Option = { // The option used shall have been the first. FIRST_OPTION: 1, // The second among two options. SECOND_OPTION: 2 } ``` -------------------------------- ### Basic NetV.js Usage Example (JavaScript) Source: https://github.com/zjuvai/netv.js/blob/dev/README.md Demonstrates how to initialize NetV.js with a container element and load sample graph data (nodes and links). It then calls the draw method to render the graph. ```JavaScript const testData = { nodes: [ { id: '0', x: 300, y: 100 }, { id: '1', x: 500, y: 100 }, { id: '2', x: 400, y: 400 } ], links: [ { source: '0', target: '2' }, { source: '1', target: '2' } ] } const netv = new NetV({ container: document.getElementById('main') }) netv.data(testData) netv.draw() ``` -------------------------------- ### Bootstrap NetV.js Development Environment (bash) Source: https://github.com/zjuvai/netv.js/blob/dev/README.md Command to set up the development environment for NetV.js, including installing dependencies for all packages in the monorepo. ```bash npm run bootstrap ``` -------------------------------- ### Class and Private Field Example (JavaScript) Source: https://github.com/zjuvai/netv.js/blob/dev/docs/development-guide-chinese.md Demonstrates defining a class with a private method (prefixed with `$_`) and a public method, following the recommendation to use `class` over `prototype` and the private field naming convention. ```javascript class Foo { constructor() {} // private method $_computeBar() {} // public method getBar() {} } ``` -------------------------------- ### Installing Lerna Globally Source: https://github.com/zjuvai/netv.js/blob/dev/README-CHINESE.md Instructs the user to install the Lerna command-line tool globally. Lerna is used for managing monorepos, which is how NetV.js packages are structured. ```bash npm install lerna -g ``` -------------------------------- ### Basic NetV.js Usage Example Source: https://github.com/zjuvai/netv.js/blob/dev/README-CHINESE.md Demonstrates how to initialize NetV.js, load a simple graph dataset (nodes and links), and render it within a specified HTML container element. Requires a DOM element with the ID 'main'. ```javascript const testData = { nodes: [ { id: '0', x: 300, y: 100 }, { id: '1', x: 500, y: 100 }, { id: '2', x: 400, y: 400 } ], links: [ { source: '0', target: '2' }, { source: '1', target: '2' } ] } const netv = new NetV({ container: document.getElementById('main') }) netv.data(testData) netv.draw() ``` -------------------------------- ### Install Lerna Globally (Publishing Context) Source: https://github.com/zjuvai/netv.js/blob/dev/packages/netv/README.md Ensures Lerna is installed globally before proceeding with the publishing process. This command is repeated in the publishing section. ```bash $ npm install -g lerna ``` -------------------------------- ### JSDoc Style for JavaScript Functions Source: https://github.com/zjuvai/netv.js/blob/dev/docs/development-guide-chinese.md Illustrates the standard JSDoc format for documenting JavaScript functions. It includes examples of documenting regular parameters, rest parameters (`...`), and the return value using `@param` and `@returns` tags. ```JavaScript /** * Description of function * @param {number} arg1 The first argument. * @param {number} arg2 The second argument. * @param {...number} rest The remainder of arguments are all numbers. * @returns {number} The result */ function func(arg1, arg2, ...rest) { // ... } ``` -------------------------------- ### Installing NetV.js via NPM Source: https://github.com/zjuvai/netv.js/blob/dev/README-CHINESE.md Provides the standard command to install the NetV.js library using the Node Package Manager (NPM). This is the recommended way to include NetV.js in a modern JavaScript project. ```bash npm install netv ``` -------------------------------- ### Run Development Bootstrap Source: https://github.com/zjuvai/netv.js/blob/dev/packages/netv/README.md Executes the bootstrap script defined in the package.json, typically used to install dependencies and link packages in a monorepo setup. ```bash $ npm run bootstrap ``` -------------------------------- ### Install Lerna Globally Source: https://github.com/zjuvai/netv.js/blob/dev/packages/netv/README.md Installs the Lerna monorepo management tool globally on the system, required for managing multiple packages within the repository. ```bash $ npm install lerna -g ``` -------------------------------- ### Install NetV.js via npm Source: https://github.com/zjuvai/netv.js/blob/dev/packages/netv/README.md Installs the NetV.js library as a project dependency using the npm package manager. ```bash npm install netv ``` -------------------------------- ### Installing NetV.js via npm (bash) Source: https://github.com/zjuvai/netv.js/blob/dev/README.md Command to install the NetV.js library using the npm package manager. This is the recommended way to include NetV.js in a Node.js project. ```bash npm install netv ``` -------------------------------- ### Install Lerna Globally for Publishing (bash) Source: https://github.com/zjuvai/netv.js/blob/dev/README.md Command to ensure Lerna is installed globally before proceeding with the publishing process. This is a prerequisite for using Lerna's publishing commands. ```bash npm install -g lerna ``` -------------------------------- ### JSDoc Style for JavaScript Classes Source: https://github.com/zjuvai/netv.js/blob/dev/docs/development-guide-chinese.md Defines the recommended JSDoc format for documenting JavaScript classes, including class descriptions and constructor parameters. It shows how to use `@implements` and parameter tags. ```JavaScript /** * Description of class * @implements {Iterable} */ class MyFancyTarget extends EventTarget { /** * @param {string} arg1 An argument that makes this more interesting. * @param {Array} arg2 List of numbers to be processed. */ constructor(arg1, arg2) { // ... } } ``` -------------------------------- ### Install Lerna Globally (bash) Source: https://github.com/zjuvai/netv.js/blob/dev/README.md Command to install the Lerna monorepo management tool globally using npm. Lerna is used for managing multiple packages within the NetV.js repository. ```bash npm install lerna -g ``` -------------------------------- ### Change Directory to Package (bash) Source: https://github.com/zjuvai/netv.js/blob/dev/README.md Example command to navigate into a specific package directory within the NetV.js monorepo, often done before running package-specific commands. ```bash cd ./packages/label ``` -------------------------------- ### Installing NetV.js via NPM Source: https://github.com/zjuvai/netv.js/blob/dev/packages/netv/README-CHINESE.md This command installs the NetV.js library as a dependency in your project using the Node Package Manager (NPM). It's the standard way to include NetV.js in a modern JavaScript project. ```bash npm install netv ``` -------------------------------- ### Standard Pull Request Template Source: https://github.com/zjuvai/netv.js/blob/dev/docs/development-guide-chinese.md Provides the required Markdown template to be used when submitting Pull Requests. It includes sections for categorizing the change, providing a description, a self-check list, and additional notes. ```Markdown ### This is a ... - [ ] New feature (addNodes/addLinks) - [ ] Other (documents) ### Description ### Self check - [x] Test passed or not need - [x] Doc is ready or not need - [x] Demo is provided or not need ### Additional Plan? > If this PR related with other PR or following info. You can type here. ``` -------------------------------- ### JSDoc Style for JavaScript Variables Source: https://github.com/zjuvai/netv.js/blob/dev/docs/development-guide-chinese.md Demonstrates using JSDoc to document JavaScript variables. It shows how to provide a description and specify the variable's type using the `@type` tag. ```JavaScript /** * Some description. * @type {Array} */ const data = [] ``` -------------------------------- ### Publishing NetV.js Packages with Lerna Source: https://github.com/zjuvai/netv.js/blob/dev/packages/netv/README-CHINESE.md These commands outline the process for publishing packages managed by Lerna. It involves installing Lerna globally if not already present, versioning the packages according to semantic versioning rules, and publishing the tagged versions from Git. ```bash npm install -g lerna # 如果还没有全局安装lerna lerna version [major | minor | patch | premajor | preminor | prepatch | prerelease] lerna publish from-git ``` -------------------------------- ### Add Local Dependency with Lerna (bash) Source: https://github.com/zjuvai/netv.js/blob/dev/README.md Example command using Lerna to add a local package (e.g., `@netv/label`) as a dependency to another local package (e.g., `netv`) within the monorepo. ```bash lerna add @netv/label --scope=netv ``` -------------------------------- ### Watching a Specific Package Source: https://github.com/zjuvai/netv.js/blob/dev/README-CHINESE.md Provides commands to navigate into a specific package directory within the monorepo and start a development 'watch' process. This typically rebuilds the package automatically on code changes. ```bash cd ./packages/label npm run watch ``` -------------------------------- ### Watch Package for Changes (bash) Source: https://github.com/zjuvai/netv.js/blob/dev/README.md Command to start a watch process for a specific package (e.g., `packages/label`), which automatically rebuilds the package when source files change during development. ```bash npm run watch ``` -------------------------------- ### Watch Package for Changes Source: https://github.com/zjuvai/netv.js/blob/dev/packages/netv/README.md Starts a process that watches for file changes within a specific package directory and automatically rebuilds or performs other actions. ```bash $ npm run watch ``` -------------------------------- ### Running Development Commands with Lerna Source: https://github.com/zjuvai/netv.js/blob/dev/packages/netv/README-CHINESE.md These commands are part of the development workflow for NetV.js, which uses Lerna for managing multiple packages. They cover bootstrapping dependencies, adding local package dependencies, building all packages, and watching a specific package for changes. Requires Lerna installed globally. ```bash # 启动、为所有包安装依赖 npm run bootstrap # 将某个本地的package安装为另一个package的依赖: # 第一步:需要全局安装lerna这个库 npm install lerna -g # 第二步: lerna add local-package-1-name --scope=local-package-2-name # e.g. 将 packages/label 安装为 packages/netv 的依赖 # 它们的名字已经在他们对应的 "package.json" 中定义了 lerna add @netv/label --scope=netv # 注意,只有public的包能这样使用,否则发布到npm之后会有问题 # 构建所有包 npm run build # 只构建一个包,比如packages/label cd ./packages/label npm run watch ``` -------------------------------- ### JavaScript Block Comment Style Source: https://github.com/zjuvai/netv.js/blob/dev/docs/development-guide-chinese.md Shows the preferred style for multi-line block comments in JavaScript using consecutive single-line comments (`//`). This is often used for general notes or temporary comments. ```JavaScript // xxx // yyy // ... ``` -------------------------------- ### JSDoc Style for JavaScript Enums Source: https://github.com/zjuvai/netv.js/blob/dev/docs/development-guide-chinese.md Explains how to document JavaScript objects used as enums with JSDoc. It shows using the `@enum` tag to indicate the object represents an enumeration and specifying the type of its values. ```JavaScript /** * An enum with two options. * @enum {number} */ const Option = { FIRST_OPTION: 1, SECOND_OPTION: 2 } ``` -------------------------------- ### Customizing Label Drawing with NetV.js Source: https://github.com/zjuvai/netv.js/blob/dev/packages/label/README.md Demonstrates how to use a custom function with the `draw` method to create specific SVG elements as node labels, such as an image. This example creates an SVG image element and sets its attributes before returning it. ```javascript const element = document.createElementNS('http://www.w3.org/2000/svg', 'image') element.setAttribute('href', 'http://netv.zjuvag.org/logo.svg') element.setAttribute('width', '100') labelManager.draw(node, (node) => { return element }) ``` -------------------------------- ### Initialize NetV.js with Data Source: https://github.com/zjuvai/netv.js/blob/dev/packages/netv/README.md Demonstrates how to initialize NetV.js with a container element and load sample node and link data, then draw the graph. ```js const testData = { nodes: [ { id: '0', x: 300, y: 100 }, { id: '1', x: 500, y: 100 }, { id: '2', x: 400, y: 400 } ], links: [ { source: '0', target: '2' }, { source: '1', target: '2' } ] } const netv = new NetV({ container: document.getElementById('main') }) netv.data(testData) netv.draw() ``` -------------------------------- ### Initializing NetV.js and Loading Data Source: https://github.com/zjuvai/netv.js/blob/dev/packages/netv/README-CHINESE.md This snippet demonstrates the basic steps to initialize a NetV instance, define graph data (nodes and links), load the data into NetV, and draw the graph on the specified container element. It requires a DOM element with the ID 'main'. ```js const testData = { nodes: [ { id: '0', x: 300, y: 100 }, { id: '1', x: 500, y: 100 }, { id: '2', x: 400, y: 400 } ], links: [ { source: '0', target: '2' }, { source: '1', target: '2' } ] } const netv = new NetV({ container: document.getElementById('main') }) netv.data(testData) netv.draw() ``` -------------------------------- ### Building All Packages Source: https://github.com/zjuvai/netv.js/blob/dev/README-CHINESE.md Command to trigger the build process for all packages defined within the NetV.js monorepo. This compiles source code and prepares packages for publishing or use. ```bash npm run build ``` -------------------------------- ### Initializing Lasso Plugin in NetV.js Source: https://github.com/zjuvai/netv.js/blob/dev/packages/lasso-selection/README.md Creates a new instance of the Lasso handler for a given NetV object with optional configuration settings. ```JavaScript lasso = new Lasso(netv, configs) ``` -------------------------------- ### Versioning Packages with Lerna Source: https://github.com/zjuvai/netv.js/blob/dev/README-CHINESE.md Explains how to use Lerna to manage package versions before a release. The command interactively prompts for the version bump type (major, minor, patch, etc.) and creates necessary git tags. ```bash lerna version [major | minor | patch | premajor | preminor | prepatch | prerelease] ``` -------------------------------- ### Publish Packages with Lerna Source: https://github.com/zjuvai/netv.js/blob/dev/packages/netv/README.md Publishes the versioned packages to the npm registry using Lerna, based on the git tags created by the version command. ```bash $ lerna publish from-git ``` -------------------------------- ### Version Packages with Lerna Source: https://github.com/zjuvai/netv.js/blob/dev/packages/netv/README.md Uses Lerna to version the packages in the monorepo. It prompts for the next version and creates version commits and tags. ```bash $ lerna version [major | minor | patch | premajor | preminor | prepatch | prerelease] ``` -------------------------------- ### Build Packages Source: https://github.com/zjuvai/netv.js/blob/dev/packages/netv/README.md Runs the build script defined in the package.json, typically compiling or transpiling source code for all packages. ```bash $ npm run build ``` -------------------------------- ### Publish Packages from Git with Lerna (bash) Source: https://github.com/zjuvai/netv.js/blob/dev/README.md Command to publish packages to npm based on the version tags created by Lerna's version command. It publishes packages that have changed since the last release. ```bash lerna publish from-git ``` -------------------------------- ### Publishing Packages with Lerna Source: https://github.com/zjuvai/netv.js/blob/dev/README-CHINESE.md Command to publish the versioned packages to the NPM registry. Lerna uses the git tags created by the 'lerna version' command to determine which packages to publish. ```bash lerna publish from-git ``` -------------------------------- ### Build NetV.js Packages (bash) Source: https://github.com/zjuvai/netv.js/blob/dev/README.md Command to build all packages within the NetV.js monorepo. This typically compiles source code and prepares packages for publishing or use. ```bash npm run build ``` -------------------------------- ### Linking Local Packages with Lerna Source: https://github.com/zjuvai/netv.js/blob/dev/README-CHINESE.md Shows how to use Lerna to add one local package (e.g., '@netv/label') as a dependency to another local package (e.g., 'netv') within the monorepo structure. Useful for local development and testing. ```bash lerna add @netv/label --scope=netv ``` -------------------------------- ### Add Local Dependency with Lerna Source: https://github.com/zjuvai/netv.js/blob/dev/packages/netv/README.md Uses Lerna to add a local package (e.g., @netv/label) as a dependency to another local package (e.g., netv) within the monorepo. ```bash $ lerna add @netv/label --scope=netv ``` -------------------------------- ### Lasso Path Style Configuration in NetV.js Source: https://github.com/zjuvai/netv.js/blob/dev/packages/lasso-selection/README.md Defines the visual style properties for the lasso selection path. ```JavaScript { fill: 'rgba(200, 200, 200, 0.2)', stroke: 'black', 'stroke-width': '2', 'stroke-dasharray': '[]', 'stroke-linejoin': 'round', 'stroke-linecap': 'round' } ``` -------------------------------- ### Change Directory to Package Source: https://github.com/zjuvai/netv.js/blob/dev/packages/netv/README.md Navigates into a specific package directory within the monorepo, often a prerequisite for running package-specific scripts. ```bash $ cd ./packages/label ``` -------------------------------- ### Version Packages with Lerna (bash) Source: https://github.com/zjuvai/netv.js/blob/dev/README.md Command to version the packages in the monorepo using Lerna. It prompts for the version bump type (major, minor, patch, etc.) and creates version commits and tags. ```bash lerna version [major | minor | patch | premajor | preminor | prepatch | prerelease] ``` -------------------------------- ### Enabling Lasso Selection in NetV.js Source: https://github.com/zjuvai/netv.js/blob/dev/packages/lasso-selection/README.md Manually activates the lasso selection functionality. ```JavaScript lasso.enable() ``` -------------------------------- ### Setting Lasso Selection Callback in NetV.js Source: https://github.com/zjuvai/netv.js/blob/dev/packages/lasso-selection/README.md Registers a callback function to be executed when nodes are selected by the lasso. The callback receives an array of selected NetV Node objects. ```JavaScript lasso.onSelected(callback: (nodes: Node[]) => {}) ``` -------------------------------- ### Setting Lasso Close Distance in NetV.js Source: https://github.com/zjuvai/netv.js/blob/dev/packages/lasso-selection/README.md Sets the tolerance distance for closing the lasso path. ```JavaScript lasso.closeDistance(distance: number) ``` -------------------------------- ### Disposing Lasso Handler in NetV.js Source: https://github.com/zjuvai/netv.js/blob/dev/packages/lasso-selection/README.md Cleans up resources and removes associated DOM elements for the Lasso handler. ```JavaScript lasso.dispose() ``` -------------------------------- ### Disabling Lasso Selection in NetV.js Source: https://github.com/zjuvai/netv.js/blob/dev/packages/lasso-selection/README.md Manually deactivates the lasso selection functionality. ```JavaScript lasso.disable() ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.