@jungherz-de/notionkit-elements 1.16.0 → 1.18.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/CHANGELOG.md +32 -0
- package/README.md +64 -6
- package/SKILL.md +79 -65
- package/dist/components/base.js +102 -3
- package/dist/components/nk-ai-input-row.js +6 -3
- package/dist/components/nk-board-view.js +2 -2
- package/dist/components/nk-breadcrumb.js +2 -1
- package/dist/components/nk-calendar-view.js +8 -5
- package/dist/components/nk-calendar.js +10 -7
- package/dist/components/nk-cmdk.js +6 -2
- package/dist/components/nk-comments.js +5 -3
- package/dist/components/nk-copy-field.js +37 -6
- package/dist/components/nk-emoji-picker.js +6 -2
- package/dist/components/nk-filter-bar.js +10 -8
- package/dist/components/nk-gallery-view.js +29 -7
- package/dist/components/nk-image-picker.js +7 -3
- package/dist/components/nk-list-view.js +3 -2
- package/dist/components/nk-modal.js +3 -1
- package/dist/components/nk-page-title.js +2 -1
- package/dist/components/nk-page.js +3 -1
- package/dist/components/nk-peek.js +6 -3
- package/dist/components/nk-progress.js +6 -3
- package/dist/components/nk-sidebar.js +5 -2
- package/dist/components/nk-steps.js +20 -4
- package/dist/components/nk-synced.js +2 -1
- package/dist/components/nk-tab-bar.js +10 -4
- package/dist/components/nk-table-view.js +3 -2
- package/dist/components/nk-theme-toggle.js +5 -2
- package/dist/components/nk-tree-item.js +3 -1
- package/dist/components/shared/{property-cell-BSVcETss.js → property-cell-DcsfnUNF.js} +15 -5
- package/dist/notionkit-elements.esm.js +312 -80
- package/dist/notionkit-elements.esm.min.js +1 -1
- package/dist/notionkit-elements.esm.min.js.map +1 -1
- package/dist/notionkit-elements.js +314 -79
- package/dist/notionkit-elements.min.js +1 -1
- package/package.json +3 -3
- package/src/base.js +32 -2
- package/src/components/content/nk-progress.js +6 -3
- package/src/components/data/nk-ai-input-row.js +6 -3
- package/src/components/data/nk-board-view.js +2 -2
- package/src/components/data/nk-calendar-view.js +7 -4
- package/src/components/data/nk-comments.js +5 -3
- package/src/components/data/nk-filter-bar.js +10 -8
- package/src/components/data/nk-gallery-view.js +29 -7
- package/src/components/data/nk-list-view.js +2 -1
- package/src/components/data/nk-table-view.js +2 -1
- package/src/components/forms/nk-calendar.js +10 -7
- package/src/components/forms/nk-copy-field.js +37 -6
- package/src/components/forms/nk-image-picker.js +7 -3
- package/src/components/overlays/nk-cmdk.js +6 -2
- package/src/components/overlays/nk-emoji-picker.js +6 -2
- package/src/components/overlays/nk-modal.js +3 -1
- package/src/components/overlays/nk-peek.js +6 -3
- package/src/components/page/nk-page-title.js +2 -1
- package/src/components/page/nk-page.js +3 -1
- package/src/components/page/nk-steps.js +20 -4
- package/src/components/page/nk-synced.js +2 -1
- package/src/components/shell/nk-breadcrumb.js +2 -1
- package/src/components/shell/nk-sidebar.js +5 -2
- package/src/components/shell/nk-tab-bar.js +10 -4
- package/src/components/shell/nk-theme-toggle.js +5 -2
- package/src/components/shell/nk-tree-item.js +3 -1
- package/src/index.js +5 -1
- package/src/util/property-cell.js +14 -4
- package/src/util/strings.js +73 -0
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,36 @@ All notable changes to NotionKit Elements are documented here. The format follow
|
|
|
4
4
|
[Keep a Changelog](https://keepachangelog.com/en/1.1.0/); versions follow
|
|
5
5
|
[Semantic Versioning](https://semver.org/).
|
|
6
6
|
|
|
7
|
+
## [1.18.0] – 2026-09-25
|
|
8
|
+
|
|
9
|
+
Built against NotionKit CSS 1.18.0 (peer `>= 1.18.0`). What LearnHub and Auxdesk found after their move to 1.17.0: LearnHub's finding 17 and Auxdesk's 26, 27 and 28.
|
|
10
|
+
|
|
11
|
+
### Added
|
|
12
|
+
- **`<nk-copy-field>` shows icons on a phone.** Each button carries an icon beside its word; below 860px, and with the new `icons` attribute at every width, the icon stands in for the word – two overlapping squares for Copy, an eye and an eye struck through for Show and Hide, a green check for the moment after – and a masked key keeps a dozen characters more (Auxdesk's wish 27). The word stays the button's `aria-label`, from the dictionary or `copy-label` and the other attributes, and while the icons show, its tooltip for `<nk-tooltip>`.
|
|
13
|
+
|
|
14
|
+
### Changed
|
|
15
|
+
- **`<nk-tab-bar>` marks "More" for a page without a tab of its own.** A `value` no item has – a mailbox, the settings, an account page opened from the drawer – makes the `drawer` item active, as iOS marks "More"; a bar without a drawer item marks none. Before, the bar kept the tab the user came from (Auxdesk's finding 28). `nk-change` reports such a value too; without a value the item marked `active`, else the first, is the one, as before.
|
|
16
|
+
|
|
17
|
+
### Fixed
|
|
18
|
+
- **`<nk-progress wide label>` in a panel keeps its label beside the bar.** The host is `display: contents`, so bar and label were two flex items of the panel and stood one under the other. With a label the element sets both in one `.nk-progress-row` (NotionKit 1.18.0): beside each other, the label on the bar's middle, the bar filling the rest (LearnHub's finding 17). In a property value the label now stands 7px from the bar, as in a table cell, instead of 13px.
|
|
19
|
+
- **`<nk-prop>` on a phone keeps a long copy field inside its card** – NotionKit 1.18.0's fix for Auxdesk's finding 26 reaches the element's shadow root.
|
|
20
|
+
|
|
21
|
+
## [1.17.0] – 2026-09-25
|
|
22
|
+
|
|
23
|
+
Built against NotionKit CSS 1.17.0 (peer `>= 1.17.0`). The rest of LearnHub's consolidated list: German texts in the elements (finding 9) and steps and gallery cards as links (6 and 16), under one link contract. Additive – with `lang="en"` every text stays as it was.
|
|
24
|
+
|
|
25
|
+
### Added
|
|
26
|
+
- **The elements speak English and German.** Button labels, placeholders and the names a screen reader announces – 38 texts, from Copy, Today and + New page to the names of the palette and the modal – come from a dictionary after the element's language: its nearest `lang` attribute, across shadow roots, else `<html lang>`. `de`, `de-DE` or `de-AT` give German, everything else English. An attribute on the element still wins, so a label with a meaning of its own stays. The fixed accessible names – Message, Send, Breadcrumb, Command palette, Comment, Search emoji, Settings, Title, Change icon – come from the same dictionary; before, they could not be changed at all. README lists every key with its attribute, English and German.
|
|
27
|
+
- **`setStrings(strings, lang?)` and `builtInStrings(lang)`**, from the bundle and from `base.js`: add or replace texts for every language or for one – a language of its own too. The elements on the page take them at once, and again when `<html lang>` changes.
|
|
28
|
+
- **`this.str(key)` and `onStringsChanged()` on `NkElement`**: a project's own element reads the dictionary in its language, its own keys too, and applies new texts when they change.
|
|
29
|
+
- **Percentages as `Intl` writes them.** A progress cell, a board card and a gallery card write 45 as `45%` in English and `45 %` in German, with a no-break space – the column's `locale` first, else the page's language. `formatPercent(column, value)` is exported beside `formatDate()`.
|
|
30
|
+
- **`<nk-steps>`: a step with `href` is a link.** Its label becomes `<a class="st-label" href>`, with or without `selectable`, and opens in a new tab with a middle click or offers "Copy link" – for chapters whose addresses are shared. Steps without `href` stay buttons.
|
|
31
|
+
- **`<nk-gallery-view href-key>`: cards as links.** `href-key` names the row field with a card's address – a string or `{ href }`. Such a card is `<a class="nk-card" href>` in a `.card-item` that carries `role="listitem"`; rows without an address and galleries without `href-key` stay as they were.
|
|
32
|
+
- **The link contract, for both:** a plain left click and Enter fire the cancelable `nk-select` as before – `{ index, value, step }` and `{ row, id, value }`; cancel it and the browser stays, for a router of your own, otherwise it follows the link (and a step becomes current). A middle click or one with Cmd, Ctrl, Shift or Alt fires nothing and does what a link does; Space on a link card scrolls, like on any link. The mark beside a step's link counts as the link.
|
|
33
|
+
|
|
34
|
+
### Changed
|
|
35
|
+
- **The German demo sets no text attributes any more.** `de/app.html` takes Kopieren, Heute, Seitenleiste schließen and the others from `<html lang="de">`; `app.html` dropped the English ones it only carried to be translated. The docs have a Languages section, show the defaults of text attributes in both languages and write percentages and the new-row text in the page's language.
|
|
36
|
+
|
|
7
37
|
## [1.16.0] – 2026-09-25
|
|
8
38
|
|
|
9
39
|
Built against NotionKit CSS 1.16.0 (peer `>= 1.16.0`). LearnHub checked all its open findings against 1.14.0; this release takes the fixes and small additions from that list – 3, 4, 5, 10, 11 and 15 – together with Auxdesk's finding 25. Links for steps and gallery cards and German texts follow in 1.17.0.
|
|
@@ -702,6 +732,8 @@ built and tested against NotionKit CSS 1.1.1 (peer range `>= 1.0.0`).
|
|
|
702
732
|
import, never in the core bundle – shadow-less, adding `nk-block-host` to
|
|
703
733
|
itself so the foundation's editor adapter rules apply.
|
|
704
734
|
|
|
735
|
+
[1.18.0]: https://github.com/JUNGHERZ/NotionKit-Elements/releases/tag/v1.18.0
|
|
736
|
+
[1.17.0]: https://github.com/JUNGHERZ/NotionKit-Elements/releases/tag/v1.17.0
|
|
705
737
|
[1.16.0]: https://github.com/JUNGHERZ/NotionKit-Elements/releases/tag/v1.16.0
|
|
706
738
|
[1.15.0]: https://github.com/JUNGHERZ/NotionKit-Elements/releases/tag/v1.15.0
|
|
707
739
|
[1.14.0]: https://github.com/JUNGHERZ/NotionKit-Elements/releases/tag/v1.14.0
|
package/README.md
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
<h1 align="center">🧩 NotionKit Elements</h1>
|
|
2
2
|
|
|
3
3
|
<p align="center">
|
|
4
|
-
<a href="https://www.npmjs.com/package/@jungherz-de/notionkit-elements"><img src="https://img.shields.io/badge/version-1.
|
|
4
|
+
<a href="https://www.npmjs.com/package/@jungherz-de/notionkit-elements"><img src="https://img.shields.io/badge/version-1.18.0-2383e2?style=flat-square" alt="Version"></a>
|
|
5
5
|
<a href="#"><img src="https://img.shields.io/badge/vanilla_JS-no_dependencies-448361?style=flat-square" alt="Vanilla JS"></a>
|
|
6
6
|
<a href="#"><img src="https://img.shields.io/badge/elements-88-529cca?style=flat-square" alt="88 Elements"></a>
|
|
7
7
|
<a href="LICENSE"><img src="https://img.shields.io/badge/license-MIT-9065b0?style=flat-square" alt="MIT License"></a>
|
|
8
|
-
<a href="CHANGELOG.md"><img src="https://img.shields.io/badge/changelog-v1.
|
|
8
|
+
<a href="CHANGELOG.md"><img src="https://img.shields.io/badge/changelog-v1.18.0-lightgrey?style=flat-square" alt="Changelog"></a>
|
|
9
9
|
<a href="https://www.npmjs.com/package/@jungherz-de/notionkit-elements"><img src="https://img.shields.io/badge/npm-%40jungherz--de%2Fnotionkit--elements-cb3837?style=flat-square&logo=npm" alt="npm"></a>
|
|
10
10
|
</p>
|
|
11
11
|
|
|
@@ -59,7 +59,7 @@ It is the **app layer** of the NotionKit family – three layers, one design lan
|
|
|
59
59
|
| 🧩 **88 Elements** | Forms with copy field, image picker and date picker, content blocks with bookmarks, app shell & tree with the ☰ drawer and the collapsing sidebar, page shell with properties, panels, avatars and steps, overlays (modal, sheet, dialog, resizable side peek, tooltip, ⌘K palette, menus that float in and become sheets on a phone, popover, emoji picker, toast), database table, board, list, calendar & gallery with toolbar and filter pills, comments, AI thread |
|
|
60
60
|
| 🎛️ **Form participation** | Input, textarea, select, switch, check, radio, slider, segmented and model card work natively with `<form>` via `ElementInternals`; radios group across shadow roots |
|
|
61
61
|
| 🌗 **Theme sync** | One observer mirrors `data-theme` on `<html>` into every element |
|
|
62
|
-
| 🪶 **Lightweight** |
|
|
62
|
+
| 🪶 **Lightweight** | 288 KB minified / 58 KB gzipped (IIFE, foundation sheet included), no external dependencies |
|
|
63
63
|
| 📦 **Five bundle shapes** | IIFE, minified IIFE, ESM, minified ESM with a source map (`esm.min.js`), and per-component ESM entries on a stable `base.js`, which import NotionKit's sheet instead of carrying a copy |
|
|
64
64
|
| 🤖 **AI-ready** | `SKILL.md` with copy-paste markup, six app skeletons and the rules – an agent given only that file built a working app in the release test |
|
|
65
65
|
|
|
@@ -71,8 +71,8 @@ It is the **app layer** of the NotionKit family – three layers, one design lan
|
|
|
71
71
|
<!DOCTYPE html>
|
|
72
72
|
<html lang="en" data-theme="light">
|
|
73
73
|
<head>
|
|
74
|
-
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@jungherz-de/notionkit@1.
|
|
75
|
-
<script src="https://cdn.jsdelivr.net/npm/@jungherz-de/notionkit-elements@1.
|
|
74
|
+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@jungherz-de/notionkit@1.18.0/notionkit.min.css">
|
|
75
|
+
<script src="https://cdn.jsdelivr.net/npm/@jungherz-de/notionkit-elements@1.18.0/dist/notionkit-elements.min.js"></script>
|
|
76
76
|
</head>
|
|
77
77
|
<body class="nk-body">
|
|
78
78
|
<nk-field label="Display name" desc="Shown next to your comments">
|
|
@@ -104,7 +104,7 @@ Without a build step, an import map can point at the minified module instead: `"
|
|
|
104
104
|
|
|
105
105
|
Do not mix the full bundle with the per-component files: each brings its own `NkElement`. With the bundle, take `componentsSheet` and `NkElement` from the bundle (`NotionKitElements.componentsSheet` from the `<script>` build).
|
|
106
106
|
|
|
107
|
-
Two prerequisites, always: `notionkit.css` on the document (the peer dependency, `>= 1.
|
|
107
|
+
Two prerequisites, always: `notionkit.css` on the document (the peer dependency, `>= 1.18.0`; 1.18.0 brings a bar and its label in one row, stacked properties that keep to their card on a phone and icons in the copy field, 1.17.0 brings a step's label and a gallery card as links, 1.16.0 brings `--nk-block-space` and `flush` for blocks in a column, keeps a wide progress bar and a stretched button's label in shape and lays floating menus above dialogs, 1.15.0 brings table text with a tone and a second line, 1.14.0 brings the gallery view and a banner action that stands at the right edge again, 1.13.0 keeps fields inside narrow panels, leaves a page without icon its padding under the cover and makes cover heights tokens, 1.12.0 brings a tag or button beside a panel's title, lists and grids without outer margin, text values, steps with states in any order and in a row, scrolling tabs, a cap for full pages and buttons per table row, 1.11.0 keeps a floating menu inside an open modal or dialog in place and inside the window and brings the banner's action as a button, fields that share a row and tooltips of several lines, 1.10.1 lets a disabled button show its tooltip, 1.10.0 brings the collapsing sidebar, the resizable side peek, the dialog and the tooltip, 1.9.0 the date picker and the calendar view, 1.8.0 the side peek, the bookmark, the copy field and pictures on the profile row, 1.7.0 the sheet, menus that float in and become sheets on a phone, the sidebar drawer, the database toolbar with filter pills and the steps, 1.7.1 minified files that carry all of it, 1.6.0 page properties, page options, list view, panels, prose and the avatar, 1.5.1 the safe areas, 1.5.0 the Notion-2025 tokens, the nine tag colours and the filled inputs; from 1.5.0 on, Elements and the foundation share one version number – the elements are built and tested against the same release) and `class="nk-body"` on `<body>`. The elements ship no visual CSS of their own – every rule comes from the foundation. The bundle injects the design tokens once as `@layer notionkit-defaults`, so any plain `:root { --nk-accent: … }` of yours re-brands every element in both themes.
|
|
108
108
|
|
|
109
109
|
## Elements
|
|
110
110
|
|
|
@@ -119,6 +119,64 @@ Two prerequisites, always: `notionkit.css` on the document (the peer dependency,
|
|
|
119
119
|
|
|
120
120
|
Static content goes in through attributes and slots, dynamic data through properties (`tree.data`, `database.rows`, `palette.commands`). Interactions fire custom events with fixed names: `nk-select`, `nk-change`, `nk-view-change`, `nk-command`, `nk-toggle`, `nk-submit`, `nk-action`. No fetching, no two-way binding – the elements render what they get.
|
|
121
121
|
|
|
122
|
+
## Languages
|
|
123
|
+
|
|
124
|
+
The texts the elements bring along – button labels, placeholders and the names a screen reader announces – come in English and German. The language is the element's own: its nearest `lang` attribute, across shadow roots, else `<html lang>`; `de`, `de-DE` or `de-AT` give German, everything else English. An attribute on the element still wins, so a label with a meaning of its own stays (`choose-label="Upload logo"`).
|
|
125
|
+
|
|
126
|
+
```js
|
|
127
|
+
import { setStrings, builtInStrings } from '@jungherz-de/notionkit-elements'; // or from '…/base.js' with single elements
|
|
128
|
+
setStrings({ newPage: '+ New course' }); // every language
|
|
129
|
+
setStrings({ copy: 'Copier', close: 'Fermer' }, 'fr'); // a language of its own
|
|
130
|
+
builtInStrings('de'); // the keys and the German texts, a copy
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
The elements on the page take new texts at once, after `setStrings()` and when `<html lang>` changes. An element of your own built on `NkElement` reads the same dictionary with `this.str('key')` – your keys too – and applies it again in `onStringsChanged()`. Percentages follow the language as well: a progress value of 45 reads `45%` in English and `45 %` in German, with a no-break space, as `Intl.NumberFormat` writes it (a column's `locale` first). Dates and month names already did.
|
|
134
|
+
|
|
135
|
+
| Key | Element | Attribute | English | German |
|
|
136
|
+
|---|---|---|---|---|
|
|
137
|
+
| `copy` | `nk-copy-field` | `copy-label` | Copy | Kopieren |
|
|
138
|
+
| `copied` | `nk-copy-field` | `copied-label` | Copied | Kopiert |
|
|
139
|
+
| `show` | `nk-copy-field` | `show-label` | Show | Zeigen |
|
|
140
|
+
| `hide` | `nk-copy-field` | `hide-label` | Hide | Verbergen |
|
|
141
|
+
| `uploadImage` | `nk-image-picker` | `choose-label` | Upload image | Bild hochladen |
|
|
142
|
+
| `changeImage` | `nk-image-picker` | `change-label` | Change image | Bild ändern |
|
|
143
|
+
| `remove` | `nk-image-picker` | `remove-label` | Remove | Entfernen |
|
|
144
|
+
| `close` | `nk-peek` | `close-label` | Close | Schließen |
|
|
145
|
+
| `resize` | `nk-peek` | `resize-label` | Resize | Breite ändern |
|
|
146
|
+
| `today` | `nk-calendar`, `nk-calendar-view` | `today-label` | Today | Heute |
|
|
147
|
+
| `previousMonth` | `nk-calendar`, `nk-calendar-view` | `prev-label` | Previous month | Voriger Monat |
|
|
148
|
+
| `nextMonth` | `nk-calendar`, `nk-calendar-view` | `next-label` | Next month | Nächster Monat |
|
|
149
|
+
| `clear` | `nk-calendar` | `clear-label` | Clear | Leeren |
|
|
150
|
+
| `time` | `nk-calendar` | `time-label` | Time | Uhrzeit |
|
|
151
|
+
| `filter` | `nk-filter-bar` | `filter-label` | Filter | Filter |
|
|
152
|
+
| `sort` | `nk-filter-bar` | `sort-label` | Sort | Sortieren |
|
|
153
|
+
| `addFilter` | `nk-filter-bar` | `add-label` | + Filter | + Filter |
|
|
154
|
+
| `removeFilter` | `nk-filter-bar` | `remove-label` | Remove filter | Filter entfernen |
|
|
155
|
+
| `search` | `nk-filter-bar` | `placeholder` | Search … | Suchen … |
|
|
156
|
+
| `closeSidebar` | `nk-sidebar` | `collapse-label` | Close sidebar | Seitenleiste schließen |
|
|
157
|
+
| `newPage` | `nk-table-view`, `nk-list-view`, `nk-gallery-view` | `new-row-label` | + New page | + Neue Seite |
|
|
158
|
+
| `commentPlaceholder` | `nk-comments` | `placeholder` | Comment … | Kommentieren … |
|
|
159
|
+
| `send` | `nk-comments`, `nk-ai-input-row` | `send-label` (comments) | Send | Senden |
|
|
160
|
+
| `askPlaceholder` | `nk-ai-input-row` | `placeholder` | Ask something … | Frag etwas … |
|
|
161
|
+
| `commandPlaceholder` | `nk-cmdk` | `placeholder` | Search or type a command … | Suchen oder Befehl eingeben … |
|
|
162
|
+
| `emojiPlaceholder` | `nk-emoji-picker` | `placeholder` | Search… | Suchen … |
|
|
163
|
+
| `toggleTheme` | `nk-theme-toggle` | `title` | Toggle light / dark | Hell / Dunkel |
|
|
164
|
+
| `synced` | `nk-synced` | `badge` | ⟳ synced | ⟳ synchronisiert |
|
|
165
|
+
| `message` | `nk-ai-input-row` | – | Message | Nachricht |
|
|
166
|
+
| `comment` | `nk-comments` | – | Comment | Kommentar |
|
|
167
|
+
| `commandPalette` | `nk-cmdk` | – | Command palette | Befehlspalette |
|
|
168
|
+
| `searchEmoji` | `nk-emoji-picker` | – | Search emoji | Emoji suchen |
|
|
169
|
+
| `settings` | `nk-modal` | – | Settings | Einstellungen |
|
|
170
|
+
| `title` | `nk-page-title` (editable) | – | Title | Titel |
|
|
171
|
+
| `changeIcon` | `nk-page` | – | Change icon | Symbol ändern |
|
|
172
|
+
| `breadcrumb` | `nk-breadcrumb` | – | Breadcrumb | Pfad |
|
|
173
|
+
| `add` | `nk-tree-item` | – | Add | Hinzufügen |
|
|
174
|
+
| `more` | `nk-tree-item` | – | More | Mehr |
|
|
175
|
+
|
|
176
|
+
## Links
|
|
177
|
+
|
|
178
|
+
A step of `<nk-steps>` with `href` and a card of `<nk-gallery-view>` whose row has an address in the field named by `href-key` are real links: they open in a new tab with a middle click and offer "Copy link" in the context menu. A plain left click, and Enter, fire the cancelable `nk-select` as before; cancel it and the browser stays, for a router of your own. A middle click or one with Cmd, Ctrl, Shift or Alt fires nothing and does what a link does. Steps and rows without an address stay buttons and cards.
|
|
179
|
+
|
|
122
180
|
## How it works
|
|
123
181
|
|
|
124
182
|
- Each element's shadow root adopts the NotionKit **components** sheet only; tokens are inherited from the document. A `.nk-wrapper` inside the root mirrors `data-theme` from `<html>` – one observer for all instances.
|
package/SKILL.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: notionkit-elements
|
|
3
|
-
description: NotionKit Elements is a vanilla-JS Web Components library (v1.
|
|
3
|
+
description: NotionKit Elements is a vanilla-JS Web Components library (v1.18.0) wrapping NotionKit CSS v1.18.0 – the calm, document-centric design system in the Notion idiom. 88 custom elements with the `nk-` prefix, Shadow DOM, automatic light/dark sync via data-theme on <html>, and form-associated controls. Use this reference whenever generating HTML that uses <nk-*> tags to get attributes, slots, events and composition right.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# NotionKit Elements – AI Component Reference
|
|
@@ -21,8 +21,8 @@ description: NotionKit Elements is a vanilla-JS Web Components library (v1.16.0)
|
|
|
21
21
|
<head>
|
|
22
22
|
<meta charset="UTF-8">
|
|
23
23
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
24
|
-
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@jungherz-de/notionkit@1.
|
|
25
|
-
<script src="https://cdn.jsdelivr.net/npm/@jungherz-de/notionkit-elements@1.
|
|
24
|
+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@jungherz-de/notionkit@1.18.0/notionkit.min.css">
|
|
25
|
+
<script src="https://cdn.jsdelivr.net/npm/@jungherz-de/notionkit-elements@1.18.0/dist/notionkit-elements.min.js"></script>
|
|
26
26
|
</head>
|
|
27
27
|
<body class="nk-body">
|
|
28
28
|
<nk-btn variant="primary">Save</nk-btn>
|
|
@@ -72,6 +72,8 @@ Never mix the full bundle with the per-component files – each brings its own `
|
|
|
72
72
|
| Light-DOM children | Elements that copy children (`nk-select` options, breadcrumb crumbs) watch them; `element.refresh()` is the escape hatch. The empty string is a valid value. |
|
|
73
73
|
| Moving elements | An element moved in the DOM keeps working – listeners and theme registration are re-armed on every connect. |
|
|
74
74
|
| Attributes are live | Every documented attribute re-renders when changed after connect (`stat.setAttribute('value', '129')`, `el.open = true`); properties reflect to attributes where a setter is listed. |
|
|
75
|
+
| Language | The texts an element brings along – button labels, placeholders, accessible names – come in English and German after its nearest `lang` (across shadow roots), else `<html lang>`. An attribute on the element wins. `setStrings({ key: '…' }, lang?)` adds or replaces texts, and the elements on the page take them at once; your own `NkElement` reads them with `this.str('key')`. Percentages follow as `Intl` writes them (`45 %` in German). |
|
|
76
|
+
| Links | A step of `nk-steps` with `href` and a card of `nk-gallery-view` whose row has an address (`href-key`) are real `<a href>`: a middle click opens a new tab, the context menu copies the link. A plain click or Enter fires the cancelable `nk-select` – cancel it to route yourself; middle and modified clicks fire nothing. |
|
|
75
77
|
|
|
76
78
|
|
|
77
79
|
# 3. Element Catalog (88 elements)
|
|
@@ -146,38 +148,41 @@ A native `<input>` inside the shadow root, wired into the surrounding form throu
|
|
|
146
148
|
|
|
147
149
|
### 3.3 `<nk-copy-field>` – Copy field
|
|
148
150
|
|
|
149
|
-
A value to take along – a link, an address, a key – as tall as an input, with Copy inside on the right: it writes the clipboard and says “Copied” in green for a moment; where the clipboard is not allowed, the value is shown and selected for ⌘C. `secret` masks it behind Show/Hide, Copy still copies the real value. `value` set as a property is not reflected, so a key never lands in the markup.
|
|
151
|
+
A value to take along – a link, an address, a key – as tall as an input, with Copy inside on the right: it writes the clipboard and says “Copied” in green for a moment; where the clipboard is not allowed, the value is shown and selected for ⌘C. `secret` masks it behind Show/Hide, Copy still copies the real value. `value` set as a property is not reflected, so a key never lands in the markup. Each button carries an icon beside its word: on a phone, and with `icons` anywhere, the icon stands in for the word – two overlapping squares, an eye, a check in green for the moment after – and a masked key keeps a dozen characters more. The word stays the button’s name, and while the icons show, its tooltip for `nk-tooltip`.
|
|
150
152
|
|
|
151
153
|
```html
|
|
152
154
|
<div style="max-width:340px"><nk-copy-field value="https://monahilft.notionkit.app" copy-label="Copy"></nk-copy-field></div>
|
|
153
155
|
<div style="max-width:340px;margin-top:10px"><nk-copy-field value="ntn_4f2a9c1e8b7d6a5f3e2c" secret mono copy-label="Copy" show-label="Show"></nk-copy-field></div>
|
|
156
|
+
<div style="max-width:340px;margin-top:10px"><nk-copy-field value="ntn_4f2a9c1e8b7d6a5f3e2c" secret mono icons copy-label="Copy" show-label="Show"></nk-copy-field></div>
|
|
154
157
|
```
|
|
155
158
|
|
|
156
159
|
| Attribute | Type | Default | Description |
|
|
157
160
|
|---|---|---|---|
|
|
158
161
|
| `value` | string | – | The value. |
|
|
159
162
|
| `secret` | boolean | – | Masked, with Show/Hide. |
|
|
163
|
+
| `icons` | boolean | – | Icons instead of words at every width, not only on a phone. |
|
|
160
164
|
| `mono` | boolean | – | Monospace – addresses, keys, code. |
|
|
161
165
|
| `wrap` | boolean | – | A long value breaks instead of an ellipsis. |
|
|
162
166
|
| `wide` | boolean | – | Fills the row. |
|
|
163
|
-
| `copy-label` | string | `Copy` | Button text. |
|
|
164
|
-
| `copied-label` | string | `Copied` | Text for the moment after. |
|
|
165
|
-
| `show-label` | string | `Show` | Reveal (secret). |
|
|
166
|
-
| `hide-label` | string | `Hide` | Mask again. |
|
|
167
|
+
| `copy-label` | string | `Copy · Kopieren` | Button text. |
|
|
168
|
+
| `copied-label` | string | `Copied · Kopiert` | Text for the moment after. |
|
|
169
|
+
| `show-label` | string | `Show · Zeigen` | Reveal (secret). |
|
|
170
|
+
| `hide-label` | string | `Hide · Verbergen` | Mask again. |
|
|
167
171
|
|
|
168
172
|
**Events:** `nk-action` `{ action: 'copy', value, ok }` – Copy clicked; `ok` is false where the clipboard refused.
|
|
169
173
|
|
|
170
|
-
**Properties:** `value`, `secret` · **Methods:** `copy()`
|
|
174
|
+
**Properties:** `value`, `secret`, `icons` · **Methods:** `copy()`
|
|
171
175
|
|
|
172
|
-
**Replaces:** `.nk-copy-field`, `.cf-value`, `.cf-btn`, `.copied`, `.mono`, `.wrap`, `.wide`
|
|
176
|
+
**Replaces:** `.nk-copy-field`, `.cf-value`, `.cf-btn`, `.copied`, `.mono`, `.wrap`, `.wide`, `.icons`
|
|
173
177
|
|
|
174
178
|
```html
|
|
175
179
|
<!-- equivalent class markup -->
|
|
176
|
-
<div style="max-width:340px"><div class="nk-copy-field"><span class="cf-value">https://monahilft.notionkit.app</span><button class="cf-btn">Copy</button></div></div>
|
|
177
|
-
<div style="max-width:340px;margin-top:10px"><div class="nk-copy-field mono"><span class="cf-value">••••••••••••••••••••••••</span><button class="cf-btn">Show</button><button class="cf-btn">Copy</button></div></div>
|
|
180
|
+
<div style="max-width:340px"><div class="nk-copy-field"><span class="cf-value">https://monahilft.notionkit.app</span><button class="cf-btn" aria-label="Copy"><svg viewBox="0 0 24 24" aria-hidden="true"><path d="M15 9V5a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v8a2 2 0 0 0 2 2h4"/><rect x="9" y="9" width="12" height="12" rx="2"/></svg><span>Copy</span></button></div></div>
|
|
181
|
+
<div style="max-width:340px;margin-top:10px"><div class="nk-copy-field mono"><span class="cf-value">••••••••••••••••••••••••</span><button class="cf-btn" aria-label="Show"><svg viewBox="0 0 24 24" aria-hidden="true"><path d="M2 12s3.5-7 10-7 10 7 10 7-3.5 7-10 7S2 12 2 12Z"/><circle cx="12" cy="12" r="3"/></svg><span>Show</span></button><button class="cf-btn" aria-label="Copy"><svg viewBox="0 0 24 24" aria-hidden="true"><path d="M15 9V5a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v8a2 2 0 0 0 2 2h4"/><rect x="9" y="9" width="12" height="12" rx="2"/></svg><span>Copy</span></button></div></div>
|
|
182
|
+
<div style="max-width:340px;margin-top:10px"><div class="nk-copy-field mono icons"><span class="cf-value">••••••••••••••••••••••••</span><button class="cf-btn" aria-label="Show"><svg viewBox="0 0 24 24" aria-hidden="true"><path d="M2 12s3.5-7 10-7 10 7 10 7-3.5 7-10 7S2 12 2 12Z"/><circle cx="12" cy="12" r="3"/></svg><span>Show</span></button><button class="cf-btn" aria-label="Copy"><svg viewBox="0 0 24 24" aria-hidden="true"><path d="M15 9V5a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v8a2 2 0 0 0 2 2h4"/><rect x="9" y="9" width="12" height="12" rx="2"/></svg><span>Copy</span></button></div></div>
|
|
178
183
|
```
|
|
179
184
|
|
|
180
|
-
**Small screens:** Keeps to its column – inside a panel even below its 210px: the value is cut, never the actions.
|
|
185
|
+
**Small screens:** Keeps to its column – inside a panel even below its 210px: the value is cut, never the actions. The actions are icons, with the words as their names and tooltips.
|
|
181
186
|
|
|
182
187
|
### 3.4 `<nk-image-picker>` – Image picker
|
|
183
188
|
|
|
@@ -198,9 +203,9 @@ A picture for a person or a workspace, on NotionKit’s profile row: round, or `
|
|
|
198
203
|
| `quality` | 0–1 | `0.82` | JPEG / WebP quality. |
|
|
199
204
|
| `accept` | string | `image/*` | File dialog filter. |
|
|
200
205
|
| `label` | string | – | Names the group. |
|
|
201
|
-
| `choose-label` | string | `Upload image` | Without a picture. |
|
|
202
|
-
| `change-label` | string | `Change image` | With a picture. |
|
|
203
|
-
| `remove-label` | string | `Remove` | Remove button. |
|
|
206
|
+
| `choose-label` | string | `Upload image · Bild hochladen` | Without a picture. |
|
|
207
|
+
| `change-label` | string | `Change image · Bild ändern` | With a picture. |
|
|
208
|
+
| `remove-label` | string | `Remove · Entfernen` | Remove button. |
|
|
204
209
|
|
|
205
210
|
**Events:** `nk-change` `{ dataUrl, width, height, size }` – A picture chosen – or removed, with an empty dataUrl. · `nk-error` `{ message, name }` – The file cannot be decoded.
|
|
206
211
|
|
|
@@ -247,12 +252,12 @@ Notion’s date picker as one element (NotionKit 1.9.0): a month with Today and
|
|
|
247
252
|
| `open` | boolean | – | Floating: shown. |
|
|
248
253
|
| `align` | end | start | `end` | Floating: right or left edge on the anchor’s. |
|
|
249
254
|
| `label` | string | – | Names the month group for screen readers. |
|
|
250
|
-
| `today-label` | string | `Today` | Today button. |
|
|
251
|
-
| `prev-label` | string | `Previous month` | Names ‹. |
|
|
252
|
-
| `next-label` | string | `Next month` | Names ›. |
|
|
255
|
+
| `today-label` | string | `Today · Heute` | Today button. |
|
|
256
|
+
| `prev-label` | string | `Previous month · Voriger Monat` | Names ‹. |
|
|
257
|
+
| `next-label` | string | `Next month · Nächster Monat` | Names ›. |
|
|
253
258
|
| `week-label` | string | `W · KW` | Head of the week column. |
|
|
254
|
-
| `time-label` | string | `Time` | Names the time field. |
|
|
255
|
-
| `clear-label` | string | `Clear` | Clear button. |
|
|
259
|
+
| `time-label` | string | `Time · Uhrzeit` | Names the time field. |
|
|
260
|
+
| `clear-label` | string | `Clear · Leeren` | Clear button. |
|
|
256
261
|
| `name` | string | – | Form field name (FormData key). |
|
|
257
262
|
| `disabled` | boolean | – | Disables the control. |
|
|
258
263
|
| `required` | boolean | – | A value is required; validity is set on the host. |
|
|
@@ -605,10 +610,11 @@ The select option as Notion draws it, in its nine colours. The colour modifier c
|
|
|
605
610
|
|
|
606
611
|
### 3.15 `<nk-progress>` – Progress
|
|
607
612
|
|
|
608
|
-
A 60px bar with an optional label. `value`/`max` set the fill; the bar carries `role="progressbar"`. `wide` fills its row, and in a flex column – a panel – it stays a 6px bar.
|
|
613
|
+
A 60px bar with an optional label. `value`/`max` set the fill; the bar carries `role="progressbar"`. `wide` fills its row, and in a flex column – a panel – it stays a 6px bar. With a `label` the bar and its label form one `.nk-progress-row`: the label sits beside the bar, on its middle, in a panel too, where the host – `display: contents` – would let them stand one under the other.
|
|
609
614
|
|
|
610
615
|
```html
|
|
611
616
|
<nk-progress value="72" label="72%"></nk-progress>
|
|
617
|
+
<div class="nk-panel" style="margin-top:12px"><h3>Progress</h3><nk-progress value="40" label="40%" wide></nk-progress></div>
|
|
612
618
|
```
|
|
613
619
|
|
|
614
620
|
| Attribute | Type | Default | Description |
|
|
@@ -620,11 +626,12 @@ A 60px bar with an optional label. `value`/`max` set the fill; the bar carries `
|
|
|
620
626
|
|
|
621
627
|
|
|
622
628
|
|
|
623
|
-
**Replaces:** `.nk-progress`, `.nk-progress-label`, `.wide`
|
|
629
|
+
**Replaces:** `.nk-progress`, `.nk-progress-label`, `.wide`, `.nk-progress-row`
|
|
624
630
|
|
|
625
631
|
```html
|
|
626
632
|
<!-- equivalent class markup -->
|
|
627
|
-
<span class="nk-progress"><i style="width:72%"></i></span><span class="nk-progress-label">72%</span>
|
|
633
|
+
<span class="nk-progress-row"><span class="nk-progress"><i style="width:72%"></i></span><span class="nk-progress-label">72%</span></span>
|
|
634
|
+
<div class="nk-panel" style="margin-top:12px"><h3>Progress</h3><span class="nk-progress-row"><span class="nk-progress wide"><i style="width:40%"></i></span><span class="nk-progress-label">40%</span></span></div>
|
|
628
635
|
```
|
|
629
636
|
|
|
630
637
|
**Small screens:** Unchanged.
|
|
@@ -938,7 +945,7 @@ The left rail: workspace slot on top, a scrolling default slot for the tree, a p
|
|
|
938
945
|
| `open` | boolean | – | Drawer state on small screens (no effect on desktop). |
|
|
939
946
|
| `collapsible` | boolean | – | Shows the « that collapses it on the desktop, and ⌘\. |
|
|
940
947
|
| `collapsed` | boolean | – | Collapsed on the desktop (no effect on a phone). |
|
|
941
|
-
| `collapse-label` | string | `Close sidebar` | Name and tooltip of the «. |
|
|
948
|
+
| `collapse-label` | string | `Close sidebar · Seitenleiste schließen` | Name and tooltip of the «. |
|
|
942
949
|
|
|
943
950
|
**Slots:** `workspace` – `nk-workspace-switcher`. · `(default)` – The tree (scrolls). · `footer` – Pinned bottom rows (Settings, Trash).
|
|
944
951
|
|
|
@@ -1196,7 +1203,7 @@ The ☀️/🌙 button. Flips `data-theme` on `<html>`, remembers the choice in
|
|
|
1196
1203
|
|
|
1197
1204
|
### 3.34 `<nk-tab-bar>` – Tab bar (mobile)
|
|
1198
1205
|
|
|
1199
|
-
The thumb-reachable twin of the sidebar for phones and installed PWAs. Put it last inside `nk-app`: it is slotted into the main column below the scrolling page, so it never moves and no bottom padding is needed. Keeps
|
|
1206
|
+
The thumb-reachable twin of the sidebar for phones and installed PWAs. Put it last inside `nk-app`: it is slotted into the main column below the scrolling page, so it never moves and no bottom padding is needed. Keeps the `nk-tab-bar-item` whose value is `value` active (listening to `nk-select`); a `drawer` item opens the sidebar instead. A value no item has – a page without a tab of its own, opened from the drawer – marks the `drawer` item, as iOS marks “More”; without one no item is active. Needs NotionKit CSS 1.2.0.
|
|
1200
1207
|
|
|
1201
1208
|
```html
|
|
1202
1209
|
<div style="max-width:390px;border:1px solid var(--nk-border);border-radius:12px;overflow:hidden"><nk-tab-bar always value="inbox">
|
|
@@ -1210,7 +1217,7 @@ The thumb-reachable twin of the sidebar for phones and installed PWAs. Put it la
|
|
|
1210
1217
|
|
|
1211
1218
|
| Attribute | Type | Default | Description |
|
|
1212
1219
|
|---|---|---|---|
|
|
1213
|
-
| `value` | string | – | Active item value (default: the item with `active`, else the first). |
|
|
1220
|
+
| `value` | string | – | Active item value (default: the item with `active`, else the first); a value no item has marks the `drawer` item. |
|
|
1214
1221
|
| `always` | boolean | – | Visible at every width, not only below 860px. |
|
|
1215
1222
|
| `fixed` | boolean | – | Pinned to the viewport bottom instead of sitting in the column – for standalone PWAs; a spacer keeps its height (`--nk-tab-bar-height` + safe area) in the flow. |
|
|
1216
1223
|
| `floating` | boolean | – | A fixed capsule with rounded corners instead of the full-width bar. |
|
|
@@ -1624,7 +1631,7 @@ Content that appears in several places, framed with a badge.
|
|
|
1624
1631
|
|
|
1625
1632
|
| Attribute | Type | Default | Description |
|
|
1626
1633
|
|---|---|---|---|
|
|
1627
|
-
| `badge` | string | `⟳ synced` | Badge text. |
|
|
1634
|
+
| `badge` | string | `⟳ synced · ⟳ synchronisiert` | Badge text. |
|
|
1628
1635
|
|
|
1629
1636
|
**Slots:** `(default)` – Content.
|
|
1630
1637
|
|
|
@@ -1739,13 +1746,13 @@ Plain `<button value>` children stay in the light DOM (the stylesheet’s slotte
|
|
|
1739
1746
|
|
|
1740
1747
|
### 3.52 `<nk-steps>` – Steps
|
|
1741
1748
|
|
|
1742
|
-
A short flow – connecting an account, setting up a model – calm and vertical: a numbered circle per step joined by a hairline, done steps with a check on the green tag, the current one ringed in the accent and marked `aria-current="step"`. `current` counts from 1; one past the last marks every step done, and `next()` moves on. The `steps` attribute is a comma-separated list; the property also takes `{ label, desc }` objects for a line under the label. A `state` in such an object – `done`, `skipped` or `open` – wins over the order, for a wizard that lets a step be skipped while a later one is done; a skipped step shows a dashed ring around a dash. `selectable` makes each label a button: a click or Enter fires `nk-select { index, value, step }` – `index` counts from 1, like `current` – and, unless cancelled, makes that step current. `horizontal` sets the steps in one row above a wizard.
|
|
1749
|
+
A short flow – connecting an account, setting up a model – calm and vertical: a numbered circle per step joined by a hairline, done steps with a check on the green tag, the current one ringed in the accent and marked `aria-current="step"`. `current` counts from 1; one past the last marks every step done, and `next()` moves on. The `steps` attribute is a comma-separated list; the property also takes `{ label, desc }` objects for a line under the label. A `state` in such an object – `done`, `skipped` or `open` – wins over the order, for a wizard that lets a step be skipped while a later one is done; a skipped step shows a dashed ring around a dash. `selectable` makes each label a button: a click or Enter fires `nk-select { index, value, step }` – `index` counts from 1, like `current` – and, unless cancelled, makes that step current. A step with `href` shows its label as a link, with or without `selectable` – to open a chapter in a new tab or copy its address. A plain click, and Enter, fire the same `nk-select`; cancel it and the browser stays, for a router of your own. A middle click or one with Cmd, Ctrl, Shift or Alt fires nothing and does what a link does. `horizontal` sets the steps in one row above a wizard.
|
|
1743
1750
|
|
|
1744
1751
|
```html
|
|
1745
1752
|
<nk-steps label="Connect your own model" current="2"></nk-steps>
|
|
1746
1753
|
<script>{ document.currentScript.previousElementSibling.steps = [{ label: 'Choose a provider', desc: 'Anthropic' }, 'Enter the API key', 'Test the connection']; }</script>
|
|
1747
1754
|
<div style="margin-top:16px"><nk-steps id="stepsWizard" label="Connect your own model" current="3" horizontal selectable></nk-steps></div>
|
|
1748
|
-
<script>{ document.getElementById('stepsWizard').steps = [{ label: 'Choose a provider', state: 'done' }, { label: 'Enter the API key', desc: 'skipped', state: 'skipped' }, 'Test the connection']; }</script>
|
|
1755
|
+
<script>{ document.getElementById('stepsWizard').steps = [{ label: 'Choose a provider', state: 'done', href: '#nk-steps' }, { label: 'Enter the API key', desc: 'skipped', state: 'skipped' }, 'Test the connection']; }</script>
|
|
1749
1756
|
```
|
|
1750
1757
|
|
|
1751
1758
|
| Attribute | Type | Default | Description |
|
|
@@ -1756,7 +1763,7 @@ A short flow – connecting an account, setting up a model – calm and vertical
|
|
|
1756
1763
|
| `selectable` | boolean | – | Labels are buttons that jump to their step. |
|
|
1757
1764
|
| `horizontal` | boolean | – | One row above a wizard. |
|
|
1758
1765
|
|
|
1759
|
-
**Events:** `nk-select` `{ index, value, step }` – A step clicked (with `selectable
|
|
1766
|
+
**Events:** `nk-select` `{ index, value, step }` – A step clicked (with `selectable`, or its link with a plain click or Enter); cancel it to stay.
|
|
1760
1767
|
|
|
1761
1768
|
**Properties:** `steps`, `current`, `selectable`, `horizontal` · **Methods:** `next()`, `select(index)`
|
|
1762
1769
|
|
|
@@ -1770,7 +1777,7 @@ A short flow – connecting an account, setting up a model – calm and vertical
|
|
|
1770
1777
|
<li class="nk-step"><span class="st-mark">3</span><span>Test the connection</span></li>
|
|
1771
1778
|
</ol>
|
|
1772
1779
|
<div style="margin-top:16px"><ol class="nk-steps horizontal" aria-label="Connect your own model">
|
|
1773
|
-
<li class="nk-step done"><span class="st-mark">✓</span><
|
|
1780
|
+
<li class="nk-step done"><span class="st-mark">✓</span><a class="st-label" href="#nk-steps">Choose a provider</a></li>
|
|
1774
1781
|
<li class="nk-step skipped"><span class="st-mark">–</span><button type="button" class="st-label">Enter the API key<span class="st-desc">skipped</span></button></li>
|
|
1775
1782
|
<li class="nk-step current" aria-current="step"><span class="st-mark">3</span><button type="button" class="st-label">Test the connection</button></li>
|
|
1776
1783
|
</ol></div>
|
|
@@ -2205,12 +2212,12 @@ Notion’s side peek: a database row opens at the right edge, full height, next
|
|
|
2205
2212
|
|---|---|---|---|
|
|
2206
2213
|
| `open` | boolean | – | Shown. |
|
|
2207
2214
|
| `label` | string | – | The dialog’s name – the entry’s title. |
|
|
2208
|
-
| `close-label` | string | `Close` | Name of ». |
|
|
2215
|
+
| `close-label` | string | `Close · Schließen` | Name of ». |
|
|
2209
2216
|
| `resizable` | boolean | – | The left edge makes it wider or narrower – pointer and arrow keys; the width is the token `--nk-peek-width` on `:root`. |
|
|
2210
2217
|
| `width` | px | `560` | Sets the width, within min and max. |
|
|
2211
2218
|
| `min` | px | `380` | Narrowest. |
|
|
2212
2219
|
| `max` | px | `window − 320` | Widest. |
|
|
2213
|
-
| `resize-label` | string | `Resize` | Name of the edge. |
|
|
2220
|
+
| `resize-label` | string | `Resize · Breite ändern` | Name of the edge. |
|
|
2214
2221
|
| `inset` | boolean | – | While open on the desktop, the page’s `nk-app` makes room instead of lying under it – for a chart whose bars must stay visible. |
|
|
2215
2222
|
|
|
2216
2223
|
**Slots:** `(default)` – The page: title, properties, prose, comments. · `actions` – Buttons beside » – open as page, share.
|
|
@@ -2682,7 +2689,7 @@ Renders `columns` × `rows` as the NotionKit table. Cells are polymorphic (`text
|
|
|
2682
2689
|
| `badge` | string | – | Tab badge. |
|
|
2683
2690
|
| `count` | boolean | – | Row count as badge. |
|
|
2684
2691
|
| `new-row` | boolean | – | Show the add row. |
|
|
2685
|
-
| `new-row-label` | string | `+ New page` | Its text. |
|
|
2692
|
+
| `new-row-label` | string | `+ New page · + Neue Seite` | Its text. |
|
|
2686
2693
|
| `sortable` | boolean | – | Header click sorts locally. |
|
|
2687
2694
|
| `sort-key` | string | – | Sorted column. |
|
|
2688
2695
|
| `sort-dir` | asc | desc | – | Direction. |
|
|
@@ -2794,7 +2801,7 @@ The third database view: one line per row – icon and title, the `meta-keys` on
|
|
|
2794
2801
|
| `title-key` | string | – | Title column. |
|
|
2795
2802
|
| `meta-keys` | list | – | Comma-separated columns on the right. |
|
|
2796
2803
|
| `new-row` | boolean | – | Show the add row. |
|
|
2797
|
-
| `new-row-label` | string | `+ New page` | Its text. |
|
|
2804
|
+
| `new-row-label` | string | `+ New page · + Neue Seite` | Its text. |
|
|
2798
2805
|
|
|
2799
2806
|
**Events:** `nk-select` `{ row, id }` – Row clicked or Enter. · `nk-action` `{ action: 'new-row' }` – Add row clicked.
|
|
2800
2807
|
|
|
@@ -2852,9 +2859,9 @@ The fourth database view (NotionKit 1.9.0): a month, the rows as cards on their
|
|
|
2852
2859
|
| `weekend` | list | – | Weekdays not worked, washed – `6,0`. |
|
|
2853
2860
|
| `today` | YYYY-MM-DD | – | Another today – for tests and docs. |
|
|
2854
2861
|
| `locale` | BCP 47 | `lang` | Language of the names and the week. |
|
|
2855
|
-
| `today-label` | string | `Today` | Today button. |
|
|
2856
|
-
| `prev-label` | string | `Previous month` | Names ‹. |
|
|
2857
|
-
| `next-label` | string | `Next month` | Names ›. |
|
|
2862
|
+
| `today-label` | string | `Today · Heute` | Today button. |
|
|
2863
|
+
| `prev-label` | string | `Previous month · Voriger Monat` | Names ‹. |
|
|
2864
|
+
| `next-label` | string | `Next month · Nächster Monat` | Names ›. |
|
|
2858
2865
|
| `week-label` | string | `W · KW` | Head of the week column. |
|
|
2859
2866
|
|
|
2860
2867
|
**Events:** `nk-select` `{ row, id }` – Card clicked or Enter. · `nk-month` `{ month }` – Another month shown.
|
|
@@ -2882,7 +2889,7 @@ The fourth database view (NotionKit 1.9.0): a month, the rows as cards on their
|
|
|
2882
2889
|
|
|
2883
2890
|
### 3.82 `<nk-gallery-view>` – Gallery view
|
|
2884
2891
|
|
|
2885
|
-
The fifth database view: the rows as cards with a picture on top, in a grid that fills the row – Notion’s gallery, for a course catalog or a reading list. `cover-key` names the row field with the picture’s URL (default: `cover`); a row without one shows the cover gradient, `no-cover` leaves the pictures out. The picture stands in 2:1, cropped to fill; `fit` shows it whole, for logos. `size` small, medium or large sets the card size – columns from 180, 260 or 340px. Cards show the title and the `meta-keys` (default: the select and date columns) and fire `nk-select` on a click, Enter or Space; `new-row` adds the add card.
|
|
2892
|
+
The fifth database view: the rows as cards with a picture on top, in a grid that fills the row – Notion’s gallery, for a course catalog or a reading list. `cover-key` names the row field with the picture’s URL (default: `cover`); a row without one shows the cover gradient, `no-cover` leaves the pictures out. The picture stands in 2:1, cropped to fill; `fit` shows it whole, for logos. `size` small, medium or large sets the card size – columns from 180, 260 or 340px. Cards show the title and the `meta-keys` (default: the select and date columns) and fire `nk-select` on a click, Enter or Space; `new-row` adds the add card. `href-key` names the row field with a card’s address: such a card is a link, `<a class="nk-card" href>` in a `.card-item` that carries the list item’s role – to open a course in a new tab or copy its address. A plain click, and Enter, fire the same `nk-select`; cancel it and the browser stays. A middle click or one with Cmd, Ctrl, Shift or Alt fires nothing and does what a link does.
|
|
2886
2893
|
|
|
2887
2894
|
```html
|
|
2888
2895
|
<nk-gallery-view meta-keys="status,due" new-row></nk-gallery-view>
|
|
@@ -2916,14 +2923,15 @@ The fifth database view: the rows as cards with a picture on top, in a grid that
|
|
|
2916
2923
|
| `fit` | boolean | – | Show a picture whole instead of cropped. |
|
|
2917
2924
|
| `title-key` | string | – | Title column. |
|
|
2918
2925
|
| `meta-keys` | list | – | Comma-separated columns under the title. |
|
|
2926
|
+
| `href-key` | string | – | Row field with the card’s address; such a card is a link. |
|
|
2919
2927
|
| `new-row` | boolean | – | Show the add card. |
|
|
2920
|
-
| `new-row-label` | string | `+ New page` | Its text. |
|
|
2928
|
+
| `new-row-label` | string | `+ New page · + Neue Seite` | Its text. |
|
|
2921
2929
|
|
|
2922
|
-
**Events:** `nk-select` `{ row, id, value }` – Card clicked, Enter or Space. · `nk-action` `{ action: 'new-row' }` – Add card clicked.
|
|
2930
|
+
**Events:** `nk-select` `{ row, id, value }` – Card clicked, Enter or Space; a link card with a plain click or Enter – cancel it to stay. · `nk-action` `{ action: 'new-row' }` – Add card clicked.
|
|
2923
2931
|
|
|
2924
2932
|
**Properties:** `columns`, `rows`, `data` · **Methods:** `refresh()`
|
|
2925
2933
|
|
|
2926
|
-
**Replaces:** `.nk-gallery`, `.small`, `.large`, `.fit`, `.nk-card`, `.nk-cover`, `.card-title`, `.card-meta`, `.nk-new-row`
|
|
2934
|
+
**Replaces:** `.nk-gallery`, `.small`, `.large`, `.fit`, `.nk-card`, `.card-item`, `.nk-cover`, `.card-title`, `.card-meta`, `.nk-new-row`
|
|
2927
2935
|
|
|
2928
2936
|
```html
|
|
2929
2937
|
<!-- equivalent class markup -->
|
|
@@ -2954,8 +2962,8 @@ The filters in effect as NotionKit’s filter pills – `.active` with an accent
|
|
|
2954
2962
|
| `no-filter` | boolean | – | Hide the Filter tool. |
|
|
2955
2963
|
| `no-sort` | boolean | – | Hide the Sort tool. |
|
|
2956
2964
|
| `filter-label` | string | `Filter` | Text of the Filter tool. |
|
|
2957
|
-
| `sort-label` | string | `Sort` | Text of the Sort tool. |
|
|
2958
|
-
| `remove-label` | string | `Remove filter` | The ×’s name, followed by the pill’s text. |
|
|
2965
|
+
| `sort-label` | string | `Sort · Sortieren` | Text of the Sort tool. |
|
|
2966
|
+
| `remove-label` | string | `Remove filter · Filter entfernen` | The ×’s name, followed by the pill’s text. |
|
|
2959
2967
|
| `search` | boolean | – | Show the search field. |
|
|
2960
2968
|
| `placeholder` | string | – | Search placeholder. |
|
|
2961
2969
|
|
|
@@ -2988,7 +2996,7 @@ A left-ruled thread of `nk-comment`s with an input row. Enter or the button fire
|
|
|
2988
2996
|
| Attribute | Type | Default | Description |
|
|
2989
2997
|
|---|---|---|---|
|
|
2990
2998
|
| `placeholder` | string | – | Input placeholder. |
|
|
2991
|
-
| `send-label` | string | `Send` | Button text. |
|
|
2999
|
+
| `send-label` | string | `Send · Senden` | Button text. |
|
|
2992
3000
|
| `no-input` | boolean | – | Read-only thread. |
|
|
2993
3001
|
| `disabled` | boolean | – | Input disabled. |
|
|
2994
3002
|
|
|
@@ -3142,8 +3150,8 @@ Eight skeletons, one per app shape, mirroring the NotionKit CSS SKILL.md. Copy o
|
|
|
3142
3150
|
<html lang="en" data-theme="light">
|
|
3143
3151
|
<head>
|
|
3144
3152
|
<meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
3145
|
-
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@jungherz-de/notionkit@1.
|
|
3146
|
-
<script src="https://cdn.jsdelivr.net/npm/@jungherz-de/notionkit-elements@1.
|
|
3153
|
+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@jungherz-de/notionkit@1.18.0/notionkit.min.css">
|
|
3154
|
+
<script src="https://cdn.jsdelivr.net/npm/@jungherz-de/notionkit-elements@1.18.0/dist/notionkit-elements.min.js"></script>
|
|
3147
3155
|
</head>
|
|
3148
3156
|
<body class="nk-body">
|
|
3149
3157
|
<nk-app>
|
|
@@ -3224,8 +3232,8 @@ Rules of the shell: `nk-sidebar`, `nk-topbar` and `nk-page` are `display: conten
|
|
|
3224
3232
|
<html lang="en" data-theme="light">
|
|
3225
3233
|
<head>
|
|
3226
3234
|
<meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
3227
|
-
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@jungherz-de/notionkit@1.
|
|
3228
|
-
<script src="https://cdn.jsdelivr.net/npm/@jungherz-de/notionkit-elements@1.
|
|
3235
|
+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@jungherz-de/notionkit@1.18.0/notionkit.min.css">
|
|
3236
|
+
<script src="https://cdn.jsdelivr.net/npm/@jungherz-de/notionkit-elements@1.18.0/dist/notionkit-elements.min.js"></script>
|
|
3229
3237
|
</head>
|
|
3230
3238
|
<body class="nk-body">
|
|
3231
3239
|
<nk-app>
|
|
@@ -3332,8 +3340,8 @@ Data contract: `columns` describe the properties (`type`: text | select | multi-
|
|
|
3332
3340
|
<html lang="en" data-theme="light">
|
|
3333
3341
|
<head>
|
|
3334
3342
|
<meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
3335
|
-
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@jungherz-de/notionkit@1.
|
|
3336
|
-
<script src="https://cdn.jsdelivr.net/npm/@jungherz-de/notionkit-elements@1.
|
|
3343
|
+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@jungherz-de/notionkit@1.18.0/notionkit.min.css">
|
|
3344
|
+
<script src="https://cdn.jsdelivr.net/npm/@jungherz-de/notionkit-elements@1.18.0/dist/notionkit-elements.min.js"></script>
|
|
3337
3345
|
</head>
|
|
3338
3346
|
<body class="nk-body">
|
|
3339
3347
|
<nk-app>
|
|
@@ -3392,8 +3400,8 @@ Data contract: `columns` describe the properties (`type`: text | select | multi-
|
|
|
3392
3400
|
<html lang="en" data-theme="light">
|
|
3393
3401
|
<head>
|
|
3394
3402
|
<meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
3395
|
-
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@jungherz-de/notionkit@1.
|
|
3396
|
-
<script src="https://cdn.jsdelivr.net/npm/@jungherz-de/notionkit-elements@1.
|
|
3403
|
+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@jungherz-de/notionkit@1.18.0/notionkit.min.css">
|
|
3404
|
+
<script src="https://cdn.jsdelivr.net/npm/@jungherz-de/notionkit-elements@1.18.0/dist/notionkit-elements.min.js"></script>
|
|
3397
3405
|
</head>
|
|
3398
3406
|
<body class="nk-body">
|
|
3399
3407
|
<!-- your app -->
|
|
@@ -3470,8 +3478,8 @@ The open/close contract is one attribute: `settings.open = true`, `settings.show
|
|
|
3470
3478
|
<html lang="en" data-theme="light">
|
|
3471
3479
|
<head>
|
|
3472
3480
|
<meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
3473
|
-
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@jungherz-de/notionkit@1.
|
|
3474
|
-
<script src="https://cdn.jsdelivr.net/npm/@jungherz-de/notionkit-elements@1.
|
|
3481
|
+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@jungherz-de/notionkit@1.18.0/notionkit.min.css">
|
|
3482
|
+
<script src="https://cdn.jsdelivr.net/npm/@jungherz-de/notionkit-elements@1.18.0/dist/notionkit-elements.min.js"></script>
|
|
3475
3483
|
</head>
|
|
3476
3484
|
<body class="nk-body">
|
|
3477
3485
|
<div class="nk-page" style="padding-top:48px">
|
|
@@ -3517,8 +3525,8 @@ The open/close contract is one attribute: `settings.open = true`, `settings.show
|
|
|
3517
3525
|
<html lang="en" data-theme="light">
|
|
3518
3526
|
<head>
|
|
3519
3527
|
<meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
3520
|
-
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@jungherz-de/notionkit@1.
|
|
3521
|
-
<script src="https://cdn.jsdelivr.net/npm/@jungherz-de/notionkit-elements@1.
|
|
3528
|
+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@jungherz-de/notionkit@1.18.0/notionkit.min.css">
|
|
3529
|
+
<script src="https://cdn.jsdelivr.net/npm/@jungherz-de/notionkit-elements@1.18.0/dist/notionkit-elements.min.js"></script>
|
|
3522
3530
|
</head>
|
|
3523
3531
|
<body class="nk-body">
|
|
3524
3532
|
<nk-page narrow icon="📘" cover>
|
|
@@ -3562,8 +3570,8 @@ Note `narrow`: the page is the document, so there is no inner scroll wrapper –
|
|
|
3562
3570
|
<html lang="en" data-theme="light">
|
|
3563
3571
|
<head>
|
|
3564
3572
|
<meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
3565
|
-
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@jungherz-de/notionkit@1.
|
|
3566
|
-
<script src="https://cdn.jsdelivr.net/npm/@jungherz-de/notionkit-elements@1.
|
|
3573
|
+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@jungherz-de/notionkit@1.18.0/notionkit.min.css">
|
|
3574
|
+
<script src="https://cdn.jsdelivr.net/npm/@jungherz-de/notionkit-elements@1.18.0/dist/notionkit-elements.min.js"></script>
|
|
3567
3575
|
</head>
|
|
3568
3576
|
<body class="nk-body">
|
|
3569
3577
|
<nk-app>
|
|
@@ -3617,8 +3625,8 @@ Note `narrow`: the page is the document, so there is no inner scroll wrapper –
|
|
|
3617
3625
|
<html lang="en" data-theme="light">
|
|
3618
3626
|
<head>
|
|
3619
3627
|
<meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
3620
|
-
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@jungherz-de/notionkit@1.
|
|
3621
|
-
<script src="https://cdn.jsdelivr.net/npm/@jungherz-de/notionkit-elements@1.
|
|
3628
|
+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@jungherz-de/notionkit@1.18.0/notionkit.min.css">
|
|
3629
|
+
<script src="https://cdn.jsdelivr.net/npm/@jungherz-de/notionkit-elements@1.18.0/dist/notionkit-elements.min.js"></script>
|
|
3622
3630
|
</head>
|
|
3623
3631
|
<body class="nk-body">
|
|
3624
3632
|
<!-- A narrow column, centred: layout is yours, so it is inline. -->
|
|
@@ -3707,6 +3715,11 @@ Form controls additionally re-dispatch a native, bubbling `change` event, so `fo
|
|
|
3707
3715
|
| A padding on the page while the side peek is open, or a peek wider by CSS | `<nk-peek resizable inset>` – the width is `--nk-peek-width`, `nk-resize` to keep it |
|
|
3708
3716
|
| A hand-built month grid, or `<input type="date">` for a date property | `<nk-calendar floating sheet>` and `picker.show(cell)` – the table's `nk-select` names the `key` and the `cell`; `range` for start and end, `weeks` for calendar weeks, `days` for holidays and marks |
|
|
3709
3717
|
| Rows laid out in a table of weeks to show them by date | `<nk-calendar-view date-key="due">` in `<nk-database>` – a tab like table and board |
|
|
3718
|
+
| German labels on every instance (`copy-label="Kopieren"`, `today-label="Heute"`, `new-row-label="+ Neue Seite"` …) | `<html lang="de">` – the elements bring the German texts, the accessible names too; keep an attribute for a label with a meaning of its own, `setStrings()` for another language |
|
|
3719
|
+
| `<nk-steps selectable>` or a gallery whose `nk-select` sets `location.href` | `href` on the step, `href-key` on the gallery: a real link opens in a new tab and can be copied; cancel `nk-select` to route yourself |
|
|
3720
|
+
| A `<div style="display:flex">` around `<nk-progress wide label>` in a panel so the label stays beside the bar | Not needed: with a `label` the element sets bar and label in one `.nk-progress-row` – beside each other in a flex column too |
|
|
3721
|
+
| `copy-label="⧉"` or other glyphs to save room in `<nk-copy-field>` on a phone | Nothing: on a phone the buttons show icons by themselves, the words stay their names; `icons` does it at every width |
|
|
3722
|
+
| `<nk-tab-bar>` kept on the last tab while a page from the drawer is open | Set `value` to that page's own value: a value no item has marks the `drawer` item ("More"), as on iOS |
|
|
3710
3723
|
|
|
3711
3724
|
|
|
3712
3725
|
# 7. Quick Reference
|
|
@@ -3715,7 +3728,7 @@ Form controls additionally re-dispatch a native, bubbling `change` event, so `fo
|
|
|
3715
3728
|
|---|---|---|---|---|
|
|
3716
3729
|
| `<nk-btn>` | forms | `variant`, `active`, `small`, `disabled` | `(default)` | `click` |
|
|
3717
3730
|
| `<nk-input>` | forms | `value`, `type`, `placeholder`, `name` | – | `nk-change`, `nk-input` |
|
|
3718
|
-
| `<nk-copy-field>` | forms | `value`, `secret`, `
|
|
3731
|
+
| `<nk-copy-field>` | forms | `value`, `secret`, `icons`, `mono` | – | `nk-action` |
|
|
3719
3732
|
| `<nk-image-picker>` | forms | `src`, `initials`, `square`, `max` | – | `nk-change`, `nk-error` |
|
|
3720
3733
|
| `<nk-calendar>` | forms | `value`, `month`, `min`, `max` | – | `nk-change`, `nk-month`, `nk-toggle` |
|
|
3721
3734
|
| `<nk-textarea>` | forms | `value`, `placeholder`, `rows`, `name` | `(default)` | `nk-change`, `nk-input` |
|
|
@@ -3818,12 +3831,13 @@ Form controls additionally re-dispatch a native, bubbling `change` event, so `fo
|
|
|
3818
3831
|
| Base classes `NkElement` / `NkFormElement` | `src/base.js` – shadow root, adopted `componentsSheet`, theme wrapper, `render/setupEvents/teardownEvents/onAttributeChanged/projectLightDom/refresh`, ElementInternals |
|
|
3819
3832
|
| Token injection | `src/base.js` – once per page, `@layer notionkit-defaults { tokensCss }` appended to `document.adoptedStyleSheets` |
|
|
3820
3833
|
| Theme sync | one `MutationObserver` on `<html>[data-theme]`, a `Set` of instances, `.nk-wrapper[data-theme]` inside each root |
|
|
3834
|
+
| Texts | `src/util/strings.js` – the English and German dictionary and `setStrings()`; `NkElement#str(key)` reads it in the element's language, `onStringsChanged()` runs after `setStrings()` and when `<html lang>` changes |
|
|
3821
3835
|
| Components | `src/components/{forms,content,shell,page,overlays,data}/nk-*.js`, one tag per file, `customElements.define` at the bottom |
|
|
3822
3836
|
| Build | Rollup: IIFE, minified IIFE, ESM, and per-component ESM entries on a stable `dist/components/base.js` that import NotionKit's sheet (`@jungherz-de/notionkit/notionkit-styles.js`) instead of inlining it; the full bundles inline it and export `componentsSheet` |
|
|
3823
|
-
| Peer | `@jungherz-de/notionkit >= 1.
|
|
3837
|
+
| Peer | `@jungherz-de/notionkit >= 1.18.0` – from 1.5.0 on the elements and the foundation share one version number; the bundle embeds that release's stylesheet, so keep them in step |
|
|
3824
3838
|
|
|
3825
3839
|
Lifecycle: construct (attach shadow, adopt sheets) → first connect (wrapper + `render()`) → every connect (`setupEvents()`, theme registration, light-DOM observer) → `attributeChangedCallback` → `onAttributeChanged` → disconnect (`teardownEvents()`, unregister).
|
|
3826
3840
|
|
|
3827
3841
|
|
|
3828
3842
|
---
|
|
3829
|
-
*NotionKit Elements v1.
|
|
3843
|
+
*NotionKit Elements v1.18.0 · wrapping NotionKit CSS v1.18.0 · MIT · Jungherz GmbH*
|