@cotherapist/instrument-take
v0.1.0
Published
Stimulus controllers for Cotherapist instrument take forms (questionnaire, ordered_selection, stimulus_wizard)
Maintainers
Readme
@cotherapist/instrument-take
Stimulus-контроллеры для прохождения психологических тестов (form archetypes):
questionnaire-wizard— пошаговый опросник с авто-submitordered-selection— ранжирование / выбор в колонках (портретные методики)stimulus-wizard— wizard для стимульных методикsubmit-loading— блокировка формы при отправке без отмены навигации в Chromium
Установка
npm install @cotherapist/instrument-take @hotwired/stimulus@hotwired/stimulus — peer dependency (>= 3.2).
Использование
import { Application } from "@hotwired/stimulus"
import {
QuestionnaireWizardController,
OrderedSelectionController,
StimulusWizardController,
SubmitLoadingController,
} from "@cotherapist/instrument-take"
const app = Application.start()
app.register("questionnaire-wizard", QuestionnaireWizardController)
app.register("ordered-selection", OrderedSelectionController)
app.register("stimulus-wizard", StimulusWizardController)
app.register("submit-loading", SubmitLoadingController)Хелперы экспортируются из корня пакета:
import { findStepElement, parseDataset, lockSubmitButtons } from "@cotherapist/instrument-take"Стили портретного ordered-selection (Сонди) — в пакете:
@import "@cotherapist/instrument-take/styles/ordered-selection.css";Для Sass (monolith) импортируйте без расширения .css, чтобы стили встроились в бандл:
@import "@cotherapist/instrument-take/styles/ordered-selection";В public-testing файл копируется при task assets в web/static/instrument-take-ordered-selection.css.
Разработка
npm ci
npm testТребуется Node.js >= 18 (встроенный node:test).
Публикация
Подробная пошаговая инструкция: PUBLISHING.md (npm org, GitHub Secrets, первый и последующие релизы).
Кратко:
- Репозиторий: github.com/cotherapist-ru/instrument-take
- Секрет
NPM_TOKENв GitHub Actions (Automation token org@cotherapist) - GitHub Release с тегом
vX.Y.Z=versionвpackage.json→ workflow Publish публикует в npm
Лицензия
MIT — см. LICENSE.
