vue-mc-full-ts
v2.0.5
Published
TypeScript version of Vue Model Collections library
Maintainers
Readme
vue-mc-full-ts
TypeScript-first fork of the Vue Model Collection pattern library for Vue 3.
Documentation: vue-mc-full-ts
This project continues ideas from:
vue-mc(original by Figured Limited)@planetadeleste/vue-mc(newer community fork)
It adds and maintains strong TypeScript support, Vue 3 compatibility, and project-specific updates documented in docs.md.
Installation
npm install vue-mc-full-tsRequirements
vue3.xtypescript5.x (recommended)@vuelidate/core2.x and@vuelidate/validators2.x for validation APIs
Quick Start
import { Model, Collection } from 'vue-mc-full-ts';
import { Ref } from 'vue';
import { required } from '@vuelidate/validators';
interface TaskAttributes {
id: number | null;
name: string;
done: boolean;
}
class Task extends Model {
declare attributes: Ref<TaskAttributes>;
defaults(): Partial<TaskAttributes> {
return {
id: null,
name: '',
done: false,
};
}
validation() {
return {
name: { required },
done: {},
};
}
routes() {
return {
fetch: '/task/{id}',
save: '/task',
delete: '/task/{id}',
};
}
}
class TaskCollection extends Collection<Task> {
model() {
return Task;
}
routes() {
return {
fetch: '/tasks',
};
}
}What Is Different In This Fork
- TypeScript-focused API and declarations across models/collections.
- Vue 3 ecosystem alignment.
- Validation is based on Vuelidate (
@vuelidate/core,@vuelidate/validators). - Additional maintenance and behavioral clarifications are tracked in
docs.md.
Documentation
- Full local docs: see
docs.md. - Optional generated site/document pages live in
docs/. - Helpful scripts:
npm run docs:checknpm run docs:buildnpm run docs:build:write
Compatibility Notes
- This package is a maintained fork, not a drop-in official continuation of upstream.
- Most core concepts and method names follow the original
vue-mcmental model. - If migrating from either upstream package, verify validation and request flow behavior against your current app tests.
Contributing
PRs are welcome. Please keep API/doc updates synchronized with docs.md.
License
MIT. See LICENSE.
Credits
Thanks to original and community maintainers of vue-mc and @planetadeleste/vue-mc, whose work this fork builds upon.
