Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/johannschopplich/kirby-types
🎊 A Collection of TypeScript types for the Kirby CMS
https://github.com/johannschopplich/kirby-types
kirby-cms kirby-panel kirby-plugin
Last synced: 15 days ago
JSON representation
🎊 A Collection of TypeScript types for the Kirby CMS
- Host: GitHub
- URL: https://github.com/johannschopplich/kirby-types
- Owner: johannschopplich
- License: mit
- Created: 2022-09-16T15:31:59.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2024-10-07T13:30:27.000Z (about 1 month ago)
- Last Synced: 2024-10-07T13:58:54.784Z (about 1 month ago)
- Topics: kirby-cms, kirby-panel, kirby-plugin
- Language: TypeScript
- Homepage: https://github.com/johannschopplich/kirbyuse
- Size: 386 KB
- Stars: 12
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# kirby-types
[![NPM version](https://img.shields.io/npm/v/kirby-types?color=a1b858&label=)](https://www.npmjs.com/package/kirby-types)
A collection of TypeScript types to work with [Kirby CMS](https://getkirby.com), mainly in the context of the Kirby Query Language and [headless Kirby usage](https://github.com/johannschopplich/kirby-headless).
## Setup
```bash
# pnpm
pnpm add -D kirby-types# npm
npm i -D kirby-types# yarn
yarn add -D kirby-types
```## Basic Usage
```ts
import type { KirbyQuery } from "kirby-types";// Strictly typed query
const query: KirbyQuery = 'page.children.filterBy("featured", true)';// Invalid queries will throw a type error
let invalidQuery: KirbyQuery;
invalidQuery = "unknown"; // Not a valid model
invalidQuery = 'site("'; // Empty parentheses
invalidQuery = 'site("value"'; // Missing closing parenthesis
```## API
By clicking on a type name, you will be redirected to the corresponding TypeScript definition file.
### API
- [`KirbyApiResponse`](./src/api.d.ts) - Matches the response of a [Kirby API request](https://getkirby.com/docs/reference/api).
### Query
- [`KirbyQueryModel`](./src/query.d.ts) - Matches any supported KirbyQL model.
- [`KirbyQuery`](./src/query.d.ts) - Matches a KirbyQL [`query`](https://getkirby.com/docs/guide/blueprints/query-language).### Blocks
- [`KirbyBlock`](./src/blocks.d.ts) - Matches a [Kirby block](https://getkirby.com/docs/guide/page-builder).
- [`KirbyDefaultBlockType`](./src/blocks.d.ts) - Matches any [Kirby default block type](https://getkirby.com/docs/reference/panel/blocks).
- [`KirbyDefaultBlocks`](./src/blocks.d.ts) - Maps each of [Kirby's default block type](https://getkirby.com/docs/reference/panel/blocks) to its corresponding block content.### Layout
- [`KirbyLayout`](./src/layout.d.ts) - Matches a [Kirby layout](https://getkirby.com/docs/reference/panel/fields/layout).
- [`KirbyLayoutColumn`](./src/layout.d.ts) - Matches any [supported layout width](https://getkirby.com/docs/reference/panel/fields/layout#defining-your-own-layouts__available-widths).### KQL
- [`KirbyQuerySchema`](./src/kql.d.ts) - Matches a [KQL query schema](https://github.com/getkirby/kql).
- [`KirbyQueryRequest`](./src/kql.d.ts) - Matches any [KQL request](https://github.com/getkirby/kql).
- [`KirbyQueryResponse`](./src/kql.d.ts) - Matches any [KQL response](https://github.com/getkirby/kql).## License
[MIT](./LICENSE) License © 2022-PRESENT [Johann Schopplich](https://github.com/johannschopplich)