Gathering detailed insights and metrics for @nagwa-limited/kashida-engine
Gathering detailed insights and metrics for @nagwa-limited/kashida-engine
Gathering detailed insights and metrics for @nagwa-limited/kashida-engine
Gathering detailed insights and metrics for @nagwa-limited/kashida-engine
npm install @nagwa-limited/kashida-engine
Typescript
Module System
Node Version
NPM Version
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
A kashida engine that adds kashida to poem lines to unify their widths to match the widest text.
These instructions will guide you to consume the API provided by the app.
Following these instructions will integrate the app into your website and will provide a globally defined API to be used. Also, if you're using the Script tag method then the app will automatically add kashidas to the poem lines if the following structure is found in DOM, if not then check the Documentation to manually invoke the required functions.
1<element class="poem"> 2 <element class="linesGroup"> 3 <div> 4 <div> [The line should exist here] </div> 5 </div> 6 </element> 7 <element class="linesGroup"> 8 <div> 9 <div> [The line should exist here] </div> 10 <div> [The line should exist here] </div> 11 </div> 12 </element> 13</element>
script
tagDownload the latest version of the app.
Link the app's Javascript file in the body of your HTML File. Example:
1<body> 2 <script src="/static/js/kashida-engine.js"></script> 3</body>
npm
Run the following command:
1npm i kashida-engine
Here will explain the API provided by our app that can be found under the globally defined namespace NagwaHTMLEditor.
The KashidaEngine
is implementing the following interface:
1interface KashidaEngine { 2 unifyTextsWidths: (texts: string[], font: string) => string[] 3 renderKashidaToPoems: (poemSelector?: string, lineSelector?: string) => void 4 renderKashidaToPoems: (e?: Event) => void 5 getTextWidth: (text: string, font: string) => number 6 getTextsWidths: (texts: string[], font: string) => TextWidths 7} 8 9interface TextWidths { 10 textWidths: number[] 11 maxTextWidth: number 12}
Here's an explanation of the provided API:
KashidaEngine
:
unifyTextsWidths
: Unifies the widths of all the inputted texts to match the max width.renderKashidaToPoems
: Has two overloads to render all the poem lines after adding kashida to it and unifying all its widths for all the poems available on page and still be able to use it as an event handler by using the second overload that accepts an Event
as an argument.getTextWidth
: Uses canvas.measureText
to compute and return the width of the given text of given font in pixels.getTextsWidths
: Uses getTextWidth
to compute and return the widths of the given texts of given font in pixels and the max width of all the sentences.TextWidths
:
textWidths
: An array of the width of the sentences.maxTextWidth
: The maximum width of all of these widths.These instructions will get you a copy of the project up and running on your local machine.
You have to have Node.js v17.2.0, and npm v8.1.4 installed.
Also, check ./package.json
for all the packages used in this project.
Clone this repo, open the terminal and navigate to the repo directory on your local machine, and then run:
1npm install
wait until it's done and you're good to go!
A commit messages consists of three distinct parts separated by a blank line: the title, an optional body and an optional footer. The layout looks like this:
1type: subject 2 3body
The type is contained within the title and can be one of these types:
Subjects should be no greater than 50 characters, should begin with a capital letter and do not end with a period.
Use an imperative tone to describe what a commit does, rather than what it did. For example, use change; not changed or changes.
Not all commits are complex enough to warrant a body, therefore it is optional and only used when a commit requires a bit of explanation and context. Use the body to explain the what and why of a commit, not the how.
When writing a body, the blank line between the title and the body is required and you should limit the length of each line to no more than 72 characters.
For more information about the style guide for Git and programming Languages check: Udacity's Code Style Guide or Conventional Commits
No vulnerabilities found.
No security vulnerabilities found.