palistor 0.0.29 → 0.0.30

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.md +56 -20
  2. package/README.ru.md +56 -20
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -60,9 +60,33 @@ Palistor's state also caches data so it isn't re-fetched from the data layer unn
60
60
 
61
61
  ---
62
62
 
63
- ## The MVVM idea (Model-View-ViewModel)
63
+ ## Table of contents
64
+
65
+ - [Idea](#idea)
66
+ - [Demo](#demo)
67
+ - [Features](#features)
68
+ - [Installation](#installation)
69
+ - [Quick start](#quick-start)
70
+ - [Concepts](#concepts)
71
+ - [API reference](#api-reference)
72
+ - [Async resolvers](#async-resolvers)
73
+ - [Lists & entities](#lists--entities)
74
+ - [Flows (step wizards)](#flows-step-wizards)
75
+ - [Field mapping](#field-mapping)
76
+ - [Persist](#persist)
77
+ - [i18n](#i18n)
78
+ - [Notifications](#notifications)
79
+ - [Store context](#store-context)
80
+ - [TypeScript](#typescript)
81
+ - [License](#license)
82
+
83
+ ---
84
+
85
+ ## Idea
86
+
87
+ ### The MVVM idea (Model-View-ViewModel)
64
88
 
65
- ### Classic MVVM, but by data flow it's more accurate to read it as a pipeline: Model → ViewModel → View
89
+ #### Classic MVVM, but by data flow it's more accurate to read it as a pipeline: Model → ViewModel → View
66
90
 
67
91
  Most React screens tangle three unrelated concerns inside components:
68
92
  - how the screen **behaves** (validation, conditional fields, cross-field rules),
@@ -91,7 +115,7 @@ As a bonus, we get:
91
115
 
92
116
  All of this lets us grow the complexity of every layer and add new functionality without sacrificing stability or predictability. And, most importantly, move toward generating frontends for enterprise systems.
93
117
 
94
- ## Use cases for Palistor
118
+ ### Use cases for Palistor
95
119
 
96
120
  Admin panels, SaaS platforms, consoles, personal dashboards — anything built mostly from forms, step wizards, dynamic widgets and tables:
97
121
  - Onboarding / KYC / verification / questionnaires — branching multi-step wizards, conditional fields, step-by-step validation (`defineFlow`).
@@ -102,7 +126,7 @@ Admin panels, SaaS platforms, consoles, personal dashboards — anything built m
102
126
  - Schema-driven / backend-driven forms — since the config is data, it can be generated or served from the backend. Plus the multi-region angle: context for regions/laws.
103
127
  - Dashboards with form-like filters — a filter panel as a reactive data source.
104
128
 
105
- ## What Palistor is not for
129
+ ### What Palistor is not for
106
130
 
107
131
  Landing pages with no complex logic, where the main goal is to ship a simple page fast.
108
132
  - Content sites: blogs, docs, marketing, SSG — SEO-first, static, almost no behavior.
@@ -112,23 +136,19 @@ Landing pages with no complex logic, where the main goal is to ship a simple pag
112
136
 
113
137
  ---
114
138
 
115
- ## Table of contents
139
+ ## Demo
116
140
 
117
- - [Features](#features)
118
- - [Installation](#installation)
119
- - [Quick start](#quick-start)
120
- - [Concepts](#concepts)
121
- - [API reference](#api-reference)
122
- - [Async resolvers](#async-resolvers)
123
- - [Lists & entities](#lists--entities)
124
- - [Flows (step wizards)](#flows-step-wizards)
125
- - [Field mapping](#field-mapping)
126
- - [Persist](#persist)
127
- - [i18n](#i18n)
128
- - [Notifications](#notifications)
129
- - [Store context](#store-context)
130
- - [TypeScript](#typescript)
131
- - [License](#license)
141
+ A live playground with every example from this README: **[projectint.github.io/palistor](https://projectint.github.io/palistor/)**
142
+
143
+ Each tab is a separate framework feature, and every one has a direct deep link:
144
+
145
+ - [Quick start](https://projectint.github.io/palistor/#form) — conditional fields, submit pipeline, persist
146
+ - [Flows](https://projectint.github.io/palistor/#flow) — a step wizard with branching
147
+ - [Lists & entities](https://projectint.github.io/palistor/#lists) — normalized registry, list proxy, store context
148
+ - [Async resolvers](https://projectint.github.io/palistor/#async) — data loading, retry, notifications
149
+ - [Field mapping](https://projectint.github.io/palistor/#mapping) — rename props to your UI kit
150
+
151
+ The playground sources live in [`app-demo/`](https://github.com/ProjectINT/palistor/tree/main/app-demo). Each section below links to the specific example code and its live tab.
132
152
 
133
153
  ---
134
154
 
@@ -199,6 +219,8 @@ import {
199
219
 
200
220
  ## Quick start
201
221
 
222
+ > 🔗 **Source:** [config/payment.ts](https://github.com/ProjectINT/palistor/blob/main/app-demo/src/config/payment.ts), [modules/payment-form/](https://github.com/ProjectINT/palistor/tree/main/app-demo/src/modules/payment-form) · **Live result:** [Demo → Payment Form](https://projectint.github.io/palistor/#form)
223
+
202
224
  ### 1. Describe the form
203
225
 
204
226
  The config is declarative: field values, validation, visibility and lifecycle callbacks live in one tree. Create the store at module level.
@@ -544,6 +566,8 @@ company: {
544
566
 
545
567
  ## Async resolvers
546
568
 
569
+ > 🔗 **Source:** [config/catalog/](https://github.com/ProjectINT/palistor/tree/main/app-demo/src/config/catalog), [modules/async-demo/](https://github.com/ProjectINT/palistor/tree/main/app-demo/src/modules/async-demo) · **Live result:** [Demo → Async resolvers](https://projectint.github.io/palistor/#async)
570
+
547
571
  A resolver is configured on a group node. It loads data asynchronously with auto-tracked dependencies, retry and React Suspense support.
548
572
 
549
573
  ```typescript
@@ -603,6 +627,8 @@ When a dependency changes, the resolve state resets, `optimisticResolver` applie
603
627
 
604
628
  ## Lists & entities
605
629
 
630
+ > 🔗 **Source:** [modules/lists-demo/](https://github.com/ProjectINT/palistor/tree/main/app-demo/src/modules/lists-demo) · **Live result:** [Demo → Lists & entities](https://projectint.github.io/palistor/#lists)
631
+
606
632
  Lists are declared with `defineList` (preferred — fully typed) or as a raw array of length 1–2 where `[0]` is the item template.
607
633
 
608
634
  ```typescript
@@ -704,6 +730,8 @@ store.delete("u1");
704
730
 
705
731
  ## Flows (step wizards)
706
732
 
733
+ > 🔗 **Source:** [config/flow.ts](https://github.com/ProjectINT/palistor/blob/main/app-demo/src/config/flow.ts), [modules/flow-demo/](https://github.com/ProjectINT/palistor/tree/main/app-demo/src/modules/flow-demo) · **Live result:** [Demo → Flows](https://projectint.github.io/palistor/#flow)
734
+
707
735
  `defineFlow` / `defineStep` build a step wizard on top of regular group nodes: navigation state, step statuses, branching and per-step validation.
708
736
 
709
737
  ```typescript
@@ -798,6 +826,8 @@ Flow navigation (current step, history) is included in [persist](#persist) snaps
798
826
 
799
827
  ## Field mapping
800
828
 
829
+ > 🔗 **Source:** [config/fieldMapping.ts](https://github.com/ProjectINT/palistor/blob/main/app-demo/src/config/fieldMapping.ts), [modules/field-mapping/](https://github.com/ProjectINT/palistor/tree/main/app-demo/src/modules/field-mapping) · **Live result:** [Demo → Field mapping](https://projectint.github.io/palistor/#mapping)
830
+
801
831
  `fieldMapping` renames field-state props **at the proxy boundary** — GET, SET, tracking and spread — so `{...form.email}` can be spread directly into a component from MUI, Ant Design or plain HTML without adapters. The internal engine is unchanged.
802
832
 
803
833
  ```typescript
@@ -843,6 +873,8 @@ Mappable keys: `value`, `label`, `placeholder`, `description`, `isRequired`, `is
843
873
 
844
874
  ## Persist
845
875
 
876
+ > 🔗 **Source:** [modules/payment-form/PersistControls.tsx](https://github.com/ProjectINT/palistor/blob/main/app-demo/src/modules/payment-form/PersistControls.tsx) · **Live result:** [Demo → Payment Form](https://projectint.github.io/palistor/#form)
877
+
846
878
  Autosave form state to any storage.
847
879
 
848
880
  ### React hook (recommended)
@@ -937,6 +969,8 @@ The `validate` callback also receives `t` as its third argument. Without a regis
937
969
 
938
970
  ## Notifications
939
971
 
972
+ > 🔗 **Source:** [config/catalog/catalog.ts](https://github.com/ProjectINT/palistor/blob/main/app-demo/src/config/catalog/catalog.ts) · **Live result:** [Demo → Async resolvers](https://projectint.github.io/palistor/#async)
973
+
940
974
  Register a toast/alert function once; resolvers receive it in `onError` via `ctx.notify`:
941
975
 
942
976
  ```tsx
@@ -957,6 +991,8 @@ function RootLayout({ children }: { children: React.ReactNode }) {
957
991
 
958
992
  ## Store context
959
993
 
994
+ > 🔗 **Source:** [modules/lists-demo/StoreContextSection.tsx](https://github.com/ProjectINT/palistor/blob/main/app-demo/src/modules/lists-demo/StoreContextSection.tsx) · **Live result:** [Demo → Lists & entities](https://projectint.github.io/palistor/#lists)
995
+
960
996
  Non-reactive data (account id, tenant, tokens…) available to every callback via `store.context`. It is not part of the form — it does not appear in `getValues()`, submit payloads or persisted state.
961
997
 
962
998
  ```tsx
package/README.ru.md CHANGED
@@ -60,9 +60,33 @@ const store = new Palistor({
60
60
 
61
61
  ---
62
62
 
63
- ## Идея MVVM (Model-View-ViewModel)
63
+ ## Содержание
64
+
65
+ - [Идея](#идея)
66
+ - [Демо](#демо)
67
+ - [Возможности](#возможности)
68
+ - [Установка](#установка)
69
+ - [Быстрый старт](#быстрый-старт)
70
+ - [Концепции](#концепции)
71
+ - [API Reference](#api-reference)
72
+ - [Async-резолверы](#async-резолверы)
73
+ - [Списки и сущности](#списки-и-сущности)
74
+ - [Flows (пошаговые мастера)](#flows-пошаговые-мастера)
75
+ - [Field mapping](#field-mapping)
76
+ - [Persist](#persist)
77
+ - [i18n](#i18n)
78
+ - [Уведомления](#уведомления)
79
+ - [Контекст store](#контекст-store)
80
+ - [TypeScript](#typescript)
81
+ - [Лицензия](#лицензия)
82
+
83
+ ---
84
+
85
+ ## Идея
86
+
87
+ ### Идея MVVM (Model-View-ViewModel)
64
88
 
65
- ### Классический MVVM, но по потоку данных правильнее читать его как конвейер: Model → ViewModel → View
89
+ #### Классический MVVM, но по потоку данных правильнее читать его как конвейер: Model → ViewModel → View
66
90
 
67
91
  Большинство React-экранов сплетают внутри компонентов три несвязанные заботы:
68
92
  - как экран **себя ведёт** (валидация, условные поля, кросс-полевые правила),
@@ -91,7 +115,7 @@ const store = new Palistor({
91
115
 
92
116
  Все это позволит нам нарастить сложность всех слоев и добавить новый функционал без ущерба для стабильности и предсказуемости. А главное перейти к генерации фронтенда для корпоративных систем.
93
117
 
94
- ## Задачи для Palistor
118
+ ### Задачи для Palistor
95
119
  Админки, саас платформы, консоли, личные кабинеты, состоящие в основном из форм и шаговых мастеров, динамических виджетов и таблиц:
96
120
  - Онбординг / KYC / верификация / анкеты — ветвящиеся многошаговые мастера, условные поля, пошаговая валидация (defineFlow).
97
121
  - Чек-ауты и платёжные формы — условные способы оплаты, кросс-полевые правила, async-подгрузка.
@@ -101,7 +125,7 @@ const store = new Palistor({
101
125
  - Schema-driven / бэкенд-управляемые формы — раз конфиг это данные, его можно генерить/отдавать с сервера. Плюс твой козырь про мультирегиональность (context под регионы/законы).
102
126
  - Дашборды с формо-подобными фильтрами — панель фильтров как реактивный источник для данных.
103
127
 
104
- ## Для чего не подходит Palistor
128
+ ### Для чего не подходит Palistor
105
129
  Сайты лендинги где нет сложной логики и главная задача быстрее отдать простую страницу.
106
130
  - Контент-сайты: блоги, документация, маркетинг, SSG — SEO-first, статика, поведения почти нет.
107
131
  - Графика / canvas / realtime-рендер — игры, редакторы (rich-text, диаграммы, карты), видеоплееры, тяжёлые визуализации. Тут сложность в рендере, а модель не расщепляется на слои.
@@ -109,23 +133,19 @@ const store = new Palistor({
109
133
  - Встраиваемые виджеты, где критичен вес бандла — ты сам признал «библиотека не маленькая»; для embeddable-скрипта на чужой странице это минус.
110
134
  ---
111
135
 
112
- ## Содержание
136
+ ## Демо
113
137
 
114
- - [Возможности](#возможности)
115
- - [Установка](#установка)
116
- - [Быстрый старт](#быстрый-старт)
117
- - [Концепции](#концепции)
118
- - [API Reference](#api-reference)
119
- - [Async-резолверы](#async-резолверы)
120
- - [Списки и сущности](#списки-и-сущности)
121
- - [Flows (пошаговые мастера)](#flows-пошаговые-мастера)
122
- - [Field mapping](#field-mapping)
123
- - [Persist](#persist)
124
- - [i18n](#i18n)
125
- - [Уведомления](#уведомления)
126
- - [Контекст store](#контекст-store)
127
- - [TypeScript](#typescript)
128
- - [Лицензия](#лицензия)
138
+ Живой стенд со всеми примерами из этого README: **[projectint.github.io/palistor](https://projectint.github.io/palistor/)**
139
+
140
+ Каждый таб — отдельная возможность фреймворка, на каждый ведёт прямая deep-ссылка:
141
+
142
+ - [Быстрый старт](https://projectint.github.io/palistor/#form) — условные поля, submit-pipeline, persist
143
+ - [Flows](https://projectint.github.io/palistor/#flow) — пошаговый мастер с ветвлением
144
+ - [Списки и сущности](https://projectint.github.io/palistor/#lists) — нормализованный реестр, list-proxy, контекст store
145
+ - [Async-резолверы](https://projectint.github.io/palistor/#async) — загрузка данных, retry, уведомления
146
+ - [Field mapping](https://projectint.github.io/palistor/#mapping) — переименование пропсов под UI-кит
147
+
148
+ Исходники стенда — в [`app-demo/`](https://github.com/ProjectINT/palistor/tree/main/app-demo). Под каждым разделом ниже — ссылки на конкретный код примера и соответствующий таб.
129
149
 
130
150
  ---
131
151
 
@@ -196,6 +216,8 @@ import {
196
216
 
197
217
  ## Быстрый старт
198
218
 
219
+ > 🔗 **Код:** [config/payment.ts](https://github.com/ProjectINT/palistor/blob/main/app-demo/src/config/payment.ts), [modules/payment-form/](https://github.com/ProjectINT/palistor/tree/main/app-demo/src/modules/payment-form) · **Живой результат:** [Демо → Форма оплаты](https://projectint.github.io/palistor/#form)
220
+
199
221
  ### 1. Опишите форму
200
222
 
201
223
  Конфиг декларативен: значения полей, валидация, видимость и lifecycle-колбэки живут в одном дереве. Store создаётся на уровне модуля.
@@ -541,6 +563,8 @@ company: {
541
563
 
542
564
  ## Async-резолверы
543
565
 
566
+ > 🔗 **Код:** [config/catalog/](https://github.com/ProjectINT/palistor/tree/main/app-demo/src/config/catalog), [modules/async-demo/](https://github.com/ProjectINT/palistor/tree/main/app-demo/src/modules/async-demo) · **Живой результат:** [Демо → Async-резолверы](https://projectint.github.io/palistor/#async)
567
+
544
568
  Резолвер конфигурируется на групповом узле. Загружает данные асинхронно — с авто-трекингом зависимостей, retry и поддержкой React Suspense.
545
569
 
546
570
  ```typescript
@@ -600,6 +624,8 @@ if (form.userInfo.loading) return <Spinner />;
600
624
 
601
625
  ## Списки и сущности
602
626
 
627
+ > 🔗 **Код:** [modules/lists-demo/](https://github.com/ProjectINT/palistor/tree/main/app-demo/src/modules/lists-demo) · **Живой результат:** [Демо → Списки и сущности](https://projectint.github.io/palistor/#lists)
628
+
603
629
  Списки объявляются через `defineList` (предпочтительно — полная типизация) или сырым массивом длиной 1–2, где `[0]` — шаблон элемента.
604
630
 
605
631
  ```typescript
@@ -701,6 +727,8 @@ store.delete("u1");
701
727
 
702
728
  ## Flows (пошаговые мастера)
703
729
 
730
+ > 🔗 **Код:** [config/flow.ts](https://github.com/ProjectINT/palistor/blob/main/app-demo/src/config/flow.ts), [modules/flow-demo/](https://github.com/ProjectINT/palistor/tree/main/app-demo/src/modules/flow-demo) · **Живой результат:** [Демо → Flows](https://projectint.github.io/palistor/#flow)
731
+
704
732
  `defineFlow` / `defineStep` строят пошаговый мастер поверх обычных групповых узлов: навигационное состояние, статусы шагов, ветвление и валидация по шагам.
705
733
 
706
734
  ```typescript
@@ -795,6 +823,8 @@ defineStep("details", {
795
823
 
796
824
  ## Field mapping
797
825
 
826
+ > 🔗 **Код:** [config/fieldMapping.ts](https://github.com/ProjectINT/palistor/blob/main/app-demo/src/config/fieldMapping.ts), [modules/field-mapping/](https://github.com/ProjectINT/palistor/tree/main/app-demo/src/modules/field-mapping) · **Живой результат:** [Демо → Field mapping](https://projectint.github.io/palistor/#mapping)
827
+
798
828
  `fieldMapping` переименовывает пропсы состояния поля **на границе proxy** — GET, SET, tracking и spread, — так что `{...form.email}` можно спредить напрямую в компонент MUI, Ant Design или нативный HTML без адаптеров. Внутреннее ядро не меняется.
799
829
 
800
830
  ```typescript
@@ -840,6 +870,8 @@ function EmailField() {
840
870
 
841
871
  ## Persist
842
872
 
873
+ > 🔗 **Код:** [modules/payment-form/PersistControls.tsx](https://github.com/ProjectINT/palistor/blob/main/app-demo/src/modules/payment-form/PersistControls.tsx) · **Живой результат:** [Демо → Форма оплаты](https://projectint.github.io/palistor/#form)
874
+
843
875
  Автосохранение состояния формы в любое хранилище.
844
876
 
845
877
  ### React-хук (рекомендуется)
@@ -934,6 +966,8 @@ cardNumber: {
934
966
 
935
967
  ## Уведомления
936
968
 
969
+ > 🔗 **Код:** [config/catalog/catalog.ts](https://github.com/ProjectINT/palistor/blob/main/app-demo/src/config/catalog/catalog.ts) · **Живой результат:** [Демо → Async-резолверы](https://projectint.github.io/palistor/#async)
970
+
937
971
  Зарегистрируйте функцию toast/alert один раз; резолверы получат её в `onError` через `ctx.notify`:
938
972
 
939
973
  ```tsx
@@ -954,6 +988,8 @@ function RootLayout({ children }: { children: React.ReactNode }) {
954
988
 
955
989
  ## Контекст store
956
990
 
991
+ > 🔗 **Код:** [modules/lists-demo/StoreContextSection.tsx](https://github.com/ProjectINT/palistor/blob/main/app-demo/src/modules/lists-demo/StoreContextSection.tsx) · **Живой результат:** [Демо → Списки и сущности](https://projectint.github.io/palistor/#lists)
992
+
957
993
  Нереактивные данные (id аккаунта, tenant, токены…), доступные во всех колбэках через `store.context`. Не является частью формы — не попадает в `getValues()`, submit-payload и persist.
958
994
 
959
995
  ```tsx
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "palistor",
3
- "version": "0.0.29",
3
+ "version": "0.0.30",
4
4
  "description": "Declarative MVVM-style state framework for React — forms, lists & wizards, batteries included",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",