@qalma/kit 0.1.0-beta.0 → 0.4.0
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.
- package/README.md +185 -0
- package/fesm2022/qalma-kit-headless.mjs +932 -0
- package/fesm2022/qalma-kit-headless.mjs.map +1 -0
- package/fesm2022/qalma-kit.mjs +90 -1146
- package/fesm2022/qalma-kit.mjs.map +1 -1
- package/package.json +6 -2
- package/types/qalma-kit-headless.d.ts +303 -0
- package/types/qalma-kit-headless.d.ts.map +1 -0
- package/types/qalma-kit.d.ts +32 -316
- package/types/qalma-kit.d.ts.map +1 -1
package/README.md
ADDED
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<picture>
|
|
3
|
+
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/cdskill/qalma/main/apps/docs/public/qalma-mark-dark.svg" />
|
|
4
|
+
<img src="https://raw.githubusercontent.com/cdskill/qalma/main/apps/docs/public/qalma-mark-light.svg" alt="Qalma" width="56" height="56" />
|
|
5
|
+
</picture>
|
|
6
|
+
</p>
|
|
7
|
+
|
|
8
|
+
# @qalma/kit
|
|
9
|
+
|
|
10
|
+
Optional UI components for [@qalma/editor](https://www.npmjs.com/package/@qalma/editor).
|
|
11
|
+
|
|
12
|
+
`@qalma/editor` stays headless. `@qalma/kit` is the Tailwind-first layer for
|
|
13
|
+
teams that want ready-made buttons, toolbar pieces, floating menus, link
|
|
14
|
+
popovers, drag handles, and behavior primitives while still owning their app's
|
|
15
|
+
visual identity.
|
|
16
|
+
|
|
17
|
+
**[Documentation and live examples](https://qalma.dev/kit)**
|
|
18
|
+
|
|
19
|
+
> **Status:** pre-1.0 (`0.x`). The public API is stabilizing but may still
|
|
20
|
+
> change before `1.0`.
|
|
21
|
+
|
|
22
|
+
## Installation
|
|
23
|
+
|
|
24
|
+
```sh
|
|
25
|
+
npm install @qalma/editor @qalma/kit @ng-icons/core @ng-icons/lucide
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
Peer dependencies:
|
|
29
|
+
|
|
30
|
+
- `@angular/core` `>=21 <22`
|
|
31
|
+
- `@angular/common` `>=21 <22`
|
|
32
|
+
- `@qalma/editor`
|
|
33
|
+
- `@ng-icons/core`
|
|
34
|
+
- `@ng-icons/lucide`
|
|
35
|
+
|
|
36
|
+
The kit expects your app to provide Tailwind utilities and the CSS token
|
|
37
|
+
contract below. If you already use shadcn-style tokens, the defaults should feel
|
|
38
|
+
familiar.
|
|
39
|
+
|
|
40
|
+
## Theming
|
|
41
|
+
|
|
42
|
+
The kit does not ship a fixed brand. Components read design tokens through
|
|
43
|
+
Tailwind utility names such as `bg-popover`, `text-muted-foreground`,
|
|
44
|
+
`border-border`, and `ring-ring`.
|
|
45
|
+
|
|
46
|
+
With Tailwind v4, expose those tokens with `@theme`:
|
|
47
|
+
|
|
48
|
+
```css
|
|
49
|
+
@import 'tailwindcss';
|
|
50
|
+
|
|
51
|
+
@theme {
|
|
52
|
+
--color-background: var(--background);
|
|
53
|
+
--color-foreground: var(--foreground);
|
|
54
|
+
--color-card: var(--card);
|
|
55
|
+
--color-popover: var(--popover);
|
|
56
|
+
--color-primary: var(--primary);
|
|
57
|
+
--color-primary-foreground: var(--primary-foreground);
|
|
58
|
+
--color-secondary: var(--secondary);
|
|
59
|
+
--color-secondary-foreground: var(--secondary-foreground);
|
|
60
|
+
--color-muted-foreground: var(--muted-foreground);
|
|
61
|
+
--color-accent: var(--accent);
|
|
62
|
+
--color-accent-foreground: var(--accent-foreground);
|
|
63
|
+
--color-accent-subtle: var(--accent-subtle);
|
|
64
|
+
--color-border: var(--border);
|
|
65
|
+
--color-ring: var(--ring);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
:root {
|
|
69
|
+
--background: #ffffff;
|
|
70
|
+
--foreground: #18181b;
|
|
71
|
+
--card: #ffffff;
|
|
72
|
+
--popover: #ffffff;
|
|
73
|
+
--primary: #18181b;
|
|
74
|
+
--primary-foreground: #fafafa;
|
|
75
|
+
--secondary: #f4f4f5;
|
|
76
|
+
--secondary-foreground: #18181b;
|
|
77
|
+
--muted-foreground: #71717a;
|
|
78
|
+
--accent: #2563eb;
|
|
79
|
+
--accent-foreground: #ffffff;
|
|
80
|
+
--accent-subtle: #dbeafe;
|
|
81
|
+
--border: #e4e4e7;
|
|
82
|
+
--ring: #93c5fd;
|
|
83
|
+
}
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
If those variable names conflict with your product tokens, scope them to the
|
|
87
|
+
editor surface instead of `:root`:
|
|
88
|
+
|
|
89
|
+
```css
|
|
90
|
+
.qalma-surface {
|
|
91
|
+
--background: #ffffff;
|
|
92
|
+
--foreground: #18181b;
|
|
93
|
+
--accent: #2563eb;
|
|
94
|
+
--border: #e4e4e7;
|
|
95
|
+
--ring: #93c5fd;
|
|
96
|
+
}
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
## Quick Start
|
|
100
|
+
|
|
101
|
+
Create a Qalma editor as usual, then compose kit components inside the editor
|
|
102
|
+
context:
|
|
103
|
+
|
|
104
|
+
```ts
|
|
105
|
+
import { Component } from '@angular/core';
|
|
106
|
+
import { createQalmaEditor, HistoryPlugin, QalmaContent, QalmaEditor, QalmaToolbar, TextFormattingKit } from '@qalma/editor';
|
|
107
|
+
import { provideQalmaToolbarIcons, QALMA_TOOLBAR_HEADINGS, QALMA_TOOLBAR_HISTORY, QALMA_TOOLBAR_INLINE_MARKS, QalmaToolbarRegistry } from '@qalma/kit';
|
|
108
|
+
|
|
109
|
+
@Component({
|
|
110
|
+
standalone: true,
|
|
111
|
+
selector: 'app-editor',
|
|
112
|
+
imports: [QalmaEditor, QalmaContent, QalmaToolbar, QalmaToolbarRegistry],
|
|
113
|
+
providers: [provideQalmaToolbarIcons()],
|
|
114
|
+
template: `
|
|
115
|
+
<qalma-editor [editor]="editor" class="qalma-surface">
|
|
116
|
+
<qalma-toolbar class="flex flex-wrap items-center gap-1 border-b border-border p-2">
|
|
117
|
+
<qalma-toolbar-registry [groups]="toolbarGroups" />
|
|
118
|
+
</qalma-toolbar>
|
|
119
|
+
|
|
120
|
+
<qalma-content />
|
|
121
|
+
</qalma-editor>
|
|
122
|
+
`,
|
|
123
|
+
})
|
|
124
|
+
export class EditorComponent {
|
|
125
|
+
protected readonly editor = createQalmaEditor({
|
|
126
|
+
content: '<p>Hello Qalma</p>',
|
|
127
|
+
plugins: [...TextFormattingKit, HistoryPlugin],
|
|
128
|
+
});
|
|
129
|
+
|
|
130
|
+
protected readonly toolbarGroups = [QALMA_TOOLBAR_HEADINGS, QALMA_TOOLBAR_INLINE_MARKS, QALMA_TOOLBAR_HISTORY];
|
|
131
|
+
}
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
## What Is Included
|
|
135
|
+
|
|
136
|
+
Visible components and directives:
|
|
137
|
+
|
|
138
|
+
- `QalmaButton`
|
|
139
|
+
- `QalmaToolbarButton`
|
|
140
|
+
- `QalmaToolbarRegistry`
|
|
141
|
+
- `QalmaMentionMenu`
|
|
142
|
+
- `QalmaSlashCommandMenu`
|
|
143
|
+
- `QalmaLinkPopover`
|
|
144
|
+
- `QalmaContextualToolbar`
|
|
145
|
+
- `QalmaSelectionToolbarDirective`
|
|
146
|
+
- `QalmaDragHandle`
|
|
147
|
+
- `QalmaDragHandleDirective`
|
|
148
|
+
|
|
149
|
+
Toolbar helpers:
|
|
150
|
+
|
|
151
|
+
- `provideQalmaToolbarIcons()`
|
|
152
|
+
- `QALMA_TOOLBAR_HEADINGS`
|
|
153
|
+
- `QALMA_TOOLBAR_INLINE_MARKS`
|
|
154
|
+
- `QALMA_TOOLBAR_ALIGN`
|
|
155
|
+
- `QALMA_TOOLBAR_LISTS`
|
|
156
|
+
- `QALMA_TOOLBAR_TABLE_INSERT`
|
|
157
|
+
- `QALMA_TOOLBAR_TABLE_OPS`
|
|
158
|
+
- `QALMA_TOOLBAR_CLEAR_FORMATTING`
|
|
159
|
+
- `QALMA_TOOLBAR_UNSET_LINK`
|
|
160
|
+
- `QALMA_TOOLBAR_HISTORY`
|
|
161
|
+
|
|
162
|
+
Behavior primitives for custom UI:
|
|
163
|
+
|
|
164
|
+
- `anchorToRect`
|
|
165
|
+
- `flipAbovePlacement`
|
|
166
|
+
- `DismissibleOverlay`
|
|
167
|
+
- `KeyboardNavigableList`
|
|
168
|
+
- `DragHandleController`
|
|
169
|
+
- `LinkPopoverController`
|
|
170
|
+
- selection toolbar and suggestion menu controller primitives
|
|
171
|
+
|
|
172
|
+
## Philosophy
|
|
173
|
+
|
|
174
|
+
Use the kit when its interaction pieces match your product. Skip it, or use only
|
|
175
|
+
the primitives, when your app already owns controls through PrimeNG, Material,
|
|
176
|
+
Kendo, ng-zorro, or a private design system.
|
|
177
|
+
|
|
178
|
+
The editor engine remains in `@qalma/editor`; this package is only the optional
|
|
179
|
+
UI layer.
|
|
180
|
+
|
|
181
|
+
## Learn More
|
|
182
|
+
|
|
183
|
+
- **UI Kit docs:** [qalma.dev/kit](https://qalma.dev/kit)
|
|
184
|
+
- **Editor docs:** [qalma.dev/docs](https://qalma.dev/docs)
|
|
185
|
+
- **Source and issues:** [github.com/cdskill/qalma](https://github.com/cdskill/qalma)
|