npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

n2o-framework

v7.29.20

Published

N2O React

Readme

n2o-framework (frontend)

n2o-framework — React/TypeScript библиотека для построения UI на базе N2O: виджеты, страницы, инфраструктура (redux/saga), утилиты и стили.

Быстрый старт

Установка зависимостей

yarn install

Собрать библиотеку TypeScript в lib/ и стили/шрифты в dist/

Сборка

yarn build


Основная структура src

  • actions — action creators
  • components — UI-часть framework: страницы, виджеты, контейнеры, общие компоненты
  • constants — константы, enum'ы, ключи, типовые значения
  • core — ядро: фабрики/реестр компонентов, инфраструктура, базовые механизмы N2O
  • ducks — redux логика (action+reducer+sagas(компонентов)+types рядом)
  • sagas — мета saga-логика (watchers/workers, эффекты)
  • factoryComponents — компоненты/адаптеры, используемые и регистрируемые во factories
  • impl — кнопки выполняющие конкретные действия
  • plugins — плагины/расширения framework (подключаемые модули)
  • tools — инструменты, вспомогательные модули
  • utils — утилиты общего назначения
  • locales — локализации (словари/ресурсы i18n)
  • sass — стили framework (SCSS)

Использование компонентов N2O

В N2O компоненты подключаются через конфигурацию factories (реестр компонентов/адаптеров). Есть два основных способа: быстрый (через createFactoryConfig) и ручной (тонкая настройка/частичный импорт).

1) Быстро: импорт всех базовых factories через createFactoryConfig

Используйте createFactoryConfig, чтобы объединить стандартную конфигурацию n2o-framework с вашей кастомной конфигурацией.

import createFactoryConfig from 'n2o-framework/lib/core/factory/createFactoryConfig';

<N2O {...createFactoryConfig(config)} />

Где config — ваши переопределения/расширения (например виджеты, редьюсеры, саги, evalContext).

Пример: добавляем виджет CustomWidget и переопределяем стандартный FormWidget (зарезервированные имена можно посмотреть в переменной factories внутри createFactoryConfig):

const widgets = {
    CustomWidget,
    FormWidget,
}

Подключение redux-частей:

  • редьюсеры добавляются ключом customReducers
  • саги — ключом customSagas
const customReducers = { yourReducer }
const customSagas = [...yourSagas]

Расширение контекста вычислений (evalContext): можно добавить проектные функции, доступные во встроенных JS-выражениях. Пример ориентируйтесь на src/utils/functions.ts.

const evalContextFunctions = {
    $prefix: { yourFunc },
}

const evalContext = {  ...evalContextFunctions }

Итоговая сборка:

const config = createFactoryConfig({
      widgets,
      customReducers,
      customSagas,
      evalContext
})

export const App = () => <N2O {...config} />

2) Тонко: собрать factories вручную (без createFactoryConfig)

Подходит, если вы хотите:

  • подключать только часть компонентов,
  • контролировать lazy‑загрузку,
  • минимизировать бандл.

Шаги:

  1. Импортировать нужные компоненты (ориентируясь на то, что использует createFactoryConfig)
  2. Для lazy‑загрузки использовать defineAsync
  3. Объединить factories с вашей локальной конфигурацией (например через deepmerge)
  4. Передать конфигурацию в N2O

Пример: подключаем только два виджета, HtmlWidget грузим lazy:

import { defineAsync } from 'n2o-framework/lib/core/factory/defineAsync'
import { FormWidget } from 'n2o-framework/lib/components/widgets/Form/FormWidget'

export const widgets = {
    HtmlWidget: defineAsync(() => import('n2o-framework/lib/components/widgets/Html/HtmlWidget')
        .then(({ HtmlWidget }) => HtmlWidget)),
    FormWidget,
}

export const n2oFactories = { widgets }
export const localFactories = { ...yourFactories }

export const config = deepmerge(n2oFactories, localFactories)

export const App = () => <N2O {...config} />

Пакеты рядом

  • @i-novus/n2o-components — UI-компоненты, используемые внутри n2o-framework (лежит в frontend/n2o-components).