@qalma/kit 0.3.0 → 0.5.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 ADDED
@@ -0,0 +1,196 @@
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 does not ship a compiled stylesheet. It expects your app to provide
37
+ Tailwind utilities and the CSS token contract below. If you already use
38
+ shadcn-style tokens, the defaults should feel familiar.
39
+
40
+ With Tailwind v4, point Tailwind at the installed package so it generates the
41
+ utilities used inside kit components:
42
+
43
+ ```css
44
+ @import 'tailwindcss';
45
+
46
+ /* Adjust the path if your global stylesheet is not src/styles.css. */
47
+ @source '../node_modules/@qalma/kit';
48
+ ```
49
+
50
+ ## Theming
51
+
52
+ The kit does not ship a fixed brand. Components read design tokens through
53
+ Tailwind utility names such as `bg-popover`, `text-muted-foreground`,
54
+ `border-border`, and `ring-ring`.
55
+
56
+ Then expose those tokens with `@theme`:
57
+
58
+ ```css
59
+ @import 'tailwindcss';
60
+ @source '../node_modules/@qalma/kit';
61
+
62
+ @theme {
63
+ --color-background: var(--background);
64
+ --color-foreground: var(--foreground);
65
+ --color-card: var(--card);
66
+ --color-popover: var(--popover);
67
+ --color-primary: var(--primary);
68
+ --color-primary-foreground: var(--primary-foreground);
69
+ --color-secondary: var(--secondary);
70
+ --color-secondary-foreground: var(--secondary-foreground);
71
+ --color-muted-foreground: var(--muted-foreground);
72
+ --color-accent: var(--accent);
73
+ --color-accent-foreground: var(--accent-foreground);
74
+ --color-accent-subtle: var(--accent-subtle);
75
+ --color-border: var(--border);
76
+ --color-ring: var(--ring);
77
+ }
78
+
79
+ :root {
80
+ --background: #ffffff;
81
+ --foreground: #18181b;
82
+ --card: #ffffff;
83
+ --popover: #ffffff;
84
+ --primary: #18181b;
85
+ --primary-foreground: #fafafa;
86
+ --secondary: #f4f4f5;
87
+ --secondary-foreground: #18181b;
88
+ --muted-foreground: #71717a;
89
+ --accent: #2563eb;
90
+ --accent-foreground: #ffffff;
91
+ --accent-subtle: #dbeafe;
92
+ --border: #e4e4e7;
93
+ --ring: #93c5fd;
94
+ }
95
+ ```
96
+
97
+ If those variable names conflict with your product tokens, scope them to the
98
+ editor surface instead of `:root`:
99
+
100
+ ```css
101
+ .qalma-surface {
102
+ --background: #ffffff;
103
+ --foreground: #18181b;
104
+ --accent: #2563eb;
105
+ --border: #e4e4e7;
106
+ --ring: #93c5fd;
107
+ }
108
+ ```
109
+
110
+ ## Quick Start
111
+
112
+ Create a Qalma editor as usual, then compose kit components inside the editor
113
+ context:
114
+
115
+ ```ts
116
+ import { Component } from '@angular/core';
117
+ import { createQalmaEditor, HistoryPlugin, QalmaContent, QalmaEditor, QalmaToolbar, TextFormattingKit } from '@qalma/editor';
118
+ import { provideQalmaToolbarIcons, QALMA_TOOLBAR_HEADINGS, QALMA_TOOLBAR_HISTORY, QALMA_TOOLBAR_INLINE_MARKS, QalmaToolbarRegistry } from '@qalma/kit';
119
+
120
+ @Component({
121
+ standalone: true,
122
+ selector: 'app-editor',
123
+ imports: [QalmaEditor, QalmaContent, QalmaToolbar, QalmaToolbarRegistry],
124
+ providers: [provideQalmaToolbarIcons()],
125
+ template: `
126
+ <qalma-editor [editor]="editor" class="qalma-surface">
127
+ <qalma-toolbar class="flex flex-wrap items-center gap-1 border-b border-border p-2">
128
+ <qalma-toolbar-registry [groups]="toolbarGroups" />
129
+ </qalma-toolbar>
130
+
131
+ <qalma-content />
132
+ </qalma-editor>
133
+ `,
134
+ })
135
+ export class EditorComponent {
136
+ protected readonly editor = createQalmaEditor({
137
+ content: '<p>Hello Qalma</p>',
138
+ plugins: [...TextFormattingKit, HistoryPlugin],
139
+ });
140
+
141
+ protected readonly toolbarGroups = [QALMA_TOOLBAR_HEADINGS, QALMA_TOOLBAR_INLINE_MARKS, QALMA_TOOLBAR_HISTORY];
142
+ }
143
+ ```
144
+
145
+ ## What Is Included
146
+
147
+ Visible components and directives:
148
+
149
+ - `QalmaButton`
150
+ - `QalmaToolbarButton`
151
+ - `QalmaToolbarRegistry`
152
+ - `QalmaMentionMenu`
153
+ - `QalmaSlashCommandMenu`
154
+ - `QalmaLinkPopover`
155
+ - `QalmaContextualToolbar`
156
+ - `QalmaSelectionToolbarDirective`
157
+ - `QalmaDragHandle`
158
+ - `QalmaDragHandleDirective`
159
+
160
+ Toolbar helpers:
161
+
162
+ - `provideQalmaToolbarIcons()`
163
+ - `QALMA_TOOLBAR_HEADINGS`
164
+ - `QALMA_TOOLBAR_INLINE_MARKS`
165
+ - `QALMA_TOOLBAR_ALIGN`
166
+ - `QALMA_TOOLBAR_LISTS`
167
+ - `QALMA_TOOLBAR_TABLE_INSERT`
168
+ - `QALMA_TOOLBAR_TABLE_OPS`
169
+ - `QALMA_TOOLBAR_CLEAR_FORMATTING`
170
+ - `QALMA_TOOLBAR_UNSET_LINK`
171
+ - `QALMA_TOOLBAR_HISTORY`
172
+
173
+ Behavior primitives for custom UI:
174
+
175
+ - `anchorToRect`
176
+ - `flipAbovePlacement`
177
+ - `DismissibleOverlay`
178
+ - `KeyboardNavigableList`
179
+ - `DragHandleController`
180
+ - `LinkPopoverController`
181
+ - selection toolbar and suggestion menu controller primitives
182
+
183
+ ## Philosophy
184
+
185
+ Use the kit when its interaction pieces match your product. Skip it, or use only
186
+ the primitives, when your app already owns controls through PrimeNG, Material,
187
+ Kendo, ng-zorro, or a private design system.
188
+
189
+ The editor engine remains in `@qalma/editor`; this package is only the optional
190
+ UI layer.
191
+
192
+ ## Learn More
193
+
194
+ - **UI Kit docs:** [qalma.dev/kit](https://qalma.dev/kit)
195
+ - **Editor docs:** [qalma.dev/docs](https://qalma.dev/docs)
196
+ - **Source and issues:** [github.com/cdskill/qalma](https://github.com/cdskill/qalma)