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

@lightningjs/blits

Package Overview
Dependencies
Maintainers
0
Versions
90
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@lightningjs/blits - npm Package Compare versions

Comparing version 1.7.0 to 1.7.1

7

CHANGELOG.md
# Changelog
## v1.7.1
_14 oct 2024_
- Fixed support for `.otf` and `.woff` fonts files in combination with MSDF generator
## v1.7.0

@@ -4,0 +11,0 @@

8

docs/components/user_input.md

@@ -128,5 +128,5 @@ # Handling User Input

In Blits, you can easily configure the key mapping to match your needs. In the `src/index.js` file where we instantiate the App via the `Blits.Launch` function, we can add an extra key, called `keys`, to the _settings object_.
In Blits, you can easily configure the key mapping to match your needs. In the `src/index.js` file where we instantiate the App via the `Blits.Launch` function, we can add an extra key, called `keymap`, to the _settings object_.
The `keys` item should be an object literal, where you map a `key` or `keyCode` (from the `KeyboardEvent`) to an event name that you can use in your Components.
The `keymap` should contain an object literal, where you map a `key` or `keyCode` (from the `KeyboardEvent`) to an event name that you can use in your Components.

@@ -141,3 +141,3 @@ > You can use a site like [keyjs.dev](https://keyjs.dev/) to find the appropriate key and keyCode for your device

//...
keys: {
keymap: {
// switch left and right using the key

@@ -157,3 +157,3 @@ ArrowLeft: 'right',

The custom keys object will be merged with the default key mapping, that looks like this:
The custom keymap object will be merged with the default key mapping, that looks like this:

@@ -160,0 +160,0 @@ ```js

{
"name": "@lightningjs/blits",
"version": "1.7.0",
"version": "1.7.1",
"description": "Blits: The Lightning 3 App Development Framework",

@@ -5,0 +5,0 @@ "bin": "bin/index.js",

@@ -52,5 +52,15 @@ import path from 'path'

const ext = match[2]
const fontFile = path.join(fontDir, `${fontName}.ttf`)
if (fs.existsSync(fontFile)) {
// Attempt to find the font file with supported extensions
const supportedExtensions = ['ttf', 'otf', 'woff']
let fontFile = null
for (const fontExt of supportedExtensions) {
const potentialPath = path.join(fontDir, `${fontName}.${fontExt}`)
if (fs.existsSync(potentialPath)) {
fontFile = potentialPath
break
}
}
if (fontFile) {
const generatedFontFile = path.join(

@@ -87,3 +97,3 @@ msdfOutputDir,

} else {
next() // ttf file does not exist
next() // No supported font file found
}

@@ -100,7 +110,7 @@ } else {

async renderStart() {
const ttfFiles = findAllTtfFiles(publicDir)
const fontFiles = findAllFontFiles(publicDir)
for (const ttfFile of ttfFiles) {
const relativePath = path.relative(publicDir, path.dirname(ttfFile))
const baseName = path.basename(ttfFile).replace(/\.ttf$/i, '')
for (const fontFile of fontFiles) {
const relativePath = path.relative(publicDir, path.dirname(fontFile))
const baseName = path.basename(fontFile).replace(/\.(ttf|otf|woff)$/i, '')
const msdfJsonPath = path.join(msdfOutputDir, relativePath, `${baseName}.msdf.json`)

@@ -111,4 +121,4 @@ const msdfPngPath = path.join(msdfOutputDir, relativePath, `${baseName}.msdf.png`)

if (!fs.existsSync(msdfJsonPath) || !fs.existsSync(msdfPngPath)) {
console.log(`Generating missing MSDF files for ${ttfFile}`)
await generateSDF(ttfFile, path.join(msdfOutputDir, relativePath))
console.log(`Generating missing MSDF files for ${fontFile}`)
await generateSDF(fontFile, path.join(msdfOutputDir, relativePath))
}

@@ -136,4 +146,4 @@ }

// finds all TTF files in a directory
const findAllTtfFiles = (dir, filesList = []) => {
// Finds all font files (.ttf, .otf, .woff) in a directory
const findAllFontFiles = (dir, filesList = []) => {
const files = fs.readdirSync(dir, { withFileTypes: true })

@@ -144,6 +154,6 @@

const dirPath = path.join(dir, file.name)
findAllTtfFiles(dirPath, filesList)
findAllFontFiles(dirPath, filesList)
} else {
// Check for all case variations of TTF extension
if (file.name.match(/\.ttf$/i)) {
// Check for supported font extensions
if (file.name.match(/\.(ttf|otf|woff)$/i)) {
filesList.push(path.join(dir, file.name))

@@ -150,0 +160,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