open-index/open-npm huggingface dataset:
npm package: @newlogic-digital/core
Description: Set of tools that can be used to create modern web applications
Author: New Logic Studio s.r.o.
Latest version: 4.1.0

<p align="center">
  <a href="https://core.newlogic.cz/" target="_blank" rel="noopener noreferrer">
    <img width="180" src="https://core.newlogic.cz/logo.png" alt="Logo">
  </a>
</p>
<p align="center">
  <a href="https://npmjs.com/package/@newlogic-digital/core"><img src="https://img.shields.io/npm/v/@newlogic-digital/core.svg" alt="npm package"></a>
  <a href="https://nodejs.org/en/about/releases/"><img src="https://img.shields.io/node/v/@newlogic-digital/core.svg" alt="node compatility"></a>
</p>

# ⚙️ Newlogic Core

Starter for creating web applications. Powered by Vite and Vituum.

- ⚡️ Powered by Vite
- 💡 Modern principles
- 🚀️ Fast development
- 🛠️ Integrated tools
- 📦 Modular structure
- ✉️ Email templates

Newlogic Core is a plugin for [Vite](https://vitejs.dev), and contains set of plugins that can be used to create modern web applications.

We use it as our main front-end set of tools at [Newlogic Digital](https://www.newlogic.cz/) to create wonders.

## 🛠️ Integrated tools
* **[Vite](https://vitejs.dev)** next-generation frontend tooling
* **[Vituum](https://vituum.dev)** fast prototyping with template engines
* **[PostCSS](https://postcss.org/)** with basic plugins
* **[TailwindCSS](https://tailwindcss.com/)** for utility classes
* **[Latte](https://github.com/vituum/vite-plugin-latte)** as template engine latte

## 🪄 Get started

```sh
npm i @newlogic-digital/core --save-dev
```

### Config

Each **Newlogic Core** project needs to have config via `vite.config.js`

```js
import core from  "@newlogic-digital/core"

export default {
  plugins: [core()]
}
```

You can also try minimal example project [core-starter](https://github.com/newlogic-digital/core-starter)

### Requirements

- [Node.js LTS (18.x)](https://nodejs.org/en/download/)
- [Vite](https://vitejs.dev/)
- [PHP 8.2](https://www.php.net/) for Latte support

## Licence
MIT
npm package: @newlogic-digital/naja-extensions
Description: ## Usage
Author: New Logic Studio s.r.o.
Latest version: 1.0.3

# Naja Extensions

## Usage

```javascript
    import {
        NajaCoreExtension,
        NajaInvokeExtension,
        NajaCheckValidityExtension
    } from '@newlogic-digital/naja-extensions'
    import naja from 'naja'

    naja.registerExtension(NajaCoreExtension())
    naja.registerExtension(NajaInvokeExtension())
    naja.registerExtension(NajaCheckValidityExtension())

    naja.initialize()
```

## Info
### NajaCoreExtension

#### 1. Sets default selector to `data-naja`

#### 2. Adds support for the `data-naja` attribute on buttons

_Standard usage:_
```html
<button data-naja data-naja-url="/url" data-naja-data='{"requestData": ""}'>Button</button>
```
- `data-naja`: Activates Naja functionality on the button.
- `data-naja-url`: Specifies the URL for the AJAX request.
- `data-naja-data`: Contains the data to be sent with the request in JSON format.

_One-Time Activation:_
```html
<button data-naja="once" data-naja-url="/url" data-naja-data='{"requestData": ""}'>Button</button>
```
- `data-naja="once"`: Ensures the event is removed after the first request, preventing further AJAX actions

#### 3. Adds support for recaptcha

#### 4. Dispatches custom events on elements

#### 5. Adds loading attribute on buttons upon interaction

### NajaInvokeExtension
Replaces naja interaction with invoke actions after interaction.

_Example before request:_
```html
<button data-naja="invoke once" data-naja-url="/url" data-naja-data='{"requestData": ""}'>Button</button>
```

_Example after request:_
```html
<button data-action="invoke#action" data-invoke-target="#snippetId" data-naja-url="/url" data-naja-data='{"requestData": ""}'>Button</button>
```

### NajaCheckValidityExtension
Prevents form sending if it's invalid