Files
kit/README.md
T
2021-08-25 18:49:45 +03:00

106 lines
3.8 KiB
Markdown

# wt.core assets source [![Build Status](https://travis-ci.org/joemccann/dillinger.svg?branch=master)](https://bitbucket.org/bellord13/kit/)
## is a dependency wt.core [![Build Status](https://travis-ci.org/joemccann/dillinger.svg?branch=master)](https://bitbucket.org/andreyleoua/wt.core/)
Предназначен для асинхронной работы с ресурсами на веб-проектах.
## Термины и определения в контексте фреймворка
`Плагин` - сущность включающая в себя модуль, js-, css-файлы, шрифты.
`Модуль` - составляющая плагина, определяемая как основной файл плагина (его наличие не обязательно в плагине)
`PluginManager` - класс для работы с плагинами
## Базовые принципы
Основные этапы работы с плагином:
| этап | метод |
| ------ | ------ |
| Регистрация | registerPlugin(`pluginId`, `config`) или registerPlugins(`object`) |
| Загрузка | load(`pluginId`, `callback`) |
| Установка | install(`pluginId`, `callback`) |
| Запрос | require(`pluginId`, `callback`) |
## Пример конфигурации
```sh
kit.PluginManager.registerPlugin('menu', {
path: kit.config.defaultPath + '/menu',
module: '/menu.js',
type: 'loader',
css: [
'/menu.css'
],
deps: ['lib', 'align', 'utils']
}
);
```
## Использование
Запуск исполняемого кода после установки зависимостей:
```sh
PluginManager.exec(deps, callback, argArr, context)
```
Запуск исполняемого кода после установки зависимостей и при загруженной странице:
```sh
PluginManager.ready(deps, callback)
```
> `kit.config.requiredDependencies` определяет зависимости (deps) по умолчанию
## Глобальный конфиг
Параметры определяются в плагине `config`
> Параметры допустимо определять до загрузки `PluginManager`
| name | default | description |
| --- | --- | --- |
| defaultPath | /local/templater.dev/kit/assets | |
| requiredDependencies | ['bsCore', 'toolkit'] | дополнительно определяет список зависимостей для любого колбека вызванного функциями `exec` и `ready` |
| autoloadPluginList | ['tooltip'] | Автоматически загрузит ресурсы указанных плагинов. В случае модуля с типом `loader` код не будет исполнен сразу после загрузки. Исполнение бдует определятся функций `install` |
| debug | false | Расширит список выводимой в консоль информации |
## z-index map
| z-index | plugin | selector |
| --- | --- | --- |
| 100 | flex-kit | .flex-card:hover .flex-card__content |
✨ Magic ✨
> The overriding design goal for Markdown's
> formatting syntax is to make it as readable
> as possible. The idea is that a
> Markdown-formatted document should be
> publishable as-is, as plain text, without
> looking like it's been marked up with tags
> or formatting instructions.
## Установка
## License
MIT
[//]: # (These are reference links used in the body of this note and get stripped out when the markdown processor does its job. There is no need to format nicely because it shouldn't be seen. Thanks SO - http://stackoverflow.com/questions/4823468/store-comments-in-markdown-syntax)
[dill]: <https://github.com/joemccann/dillinger>