@jungherz-de/notionkit-elements 1.12.0 → 1.13.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 +15 -0
- package/README.md +6 -6
- package/SKILL.md +27 -27
- package/dist/components/nk-page-cover.js +2 -0
- package/dist/components/nk-page.js +17 -9
- package/dist/notionkit-elements.esm.js +22 -12
- package/dist/notionkit-elements.js +22 -12
- package/dist/notionkit-elements.min.js +1 -1
- package/package.json +3 -3
- package/src/components/page/nk-page-cover.js +2 -0
- package/src/components/page/nk-page.js +17 -9
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,20 @@ 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.13.0] – 2026-09-25
|
|
8
|
+
|
|
9
|
+
Built against NotionKit CSS 1.13.0 (peer `>= 1.13.0`). LearnHub moved from 1.5.1 to 1.11 and sent back three findings about fixed sizes; this release answers them.
|
|
10
|
+
|
|
11
|
+
### Fixed
|
|
12
|
+
- **`<nk-page>` with a cover but no icon keeps its top padding.** It set `covered` for every cover, so the page dropped its padding for an icon that was not there, and the title – or tags and a deadline – sat right on the picture. `covered` now needs an icon too, from the attribute or from `slot="icon"`, and follows an icon that arrives later.
|
|
13
|
+
- **`<nk-input>`, `<nk-select>`, `<nk-textarea>` and `<nk-copy-field>` stay inside a narrow `<nk-panel>`** (NotionKit 1.13.0). The 210px floor ran past a 200px tile; inside a panel it gives way now, while a field row keeps it. The fix reaches the shadow roots through a custom property, so `wide` and `<nk-field stacked>` are no longer needed for it.
|
|
14
|
+
|
|
15
|
+
### Added
|
|
16
|
+
- **Cover heights you can set**: `--nk-cover-height` (200px) for `<nk-page-cover>` and the page's own cover, `--nk-panel-cover-height` (64px) for `<nk-panel cover>` – on `:root`, or on one element: `<nk-page-cover style="--nk-cover-height: clamp(200px, 30vh, 300px)">`. Until now the band's height sat in the shadow root, out of reach.
|
|
17
|
+
|
|
18
|
+
### Changed
|
|
19
|
+
- Peer `@jungherz-de/notionkit >= 1.13.0`.
|
|
20
|
+
|
|
7
21
|
## [1.12.0] – 2026-09-25
|
|
8
22
|
|
|
9
23
|
Built against NotionKit CSS 1.12.0 (peer `>= 1.12.0`). Auxdesk moved from 1.5.1 to 1.11 and sent back eight findings; this release answers all of them.
|
|
@@ -639,6 +653,7 @@ built and tested against NotionKit CSS 1.1.1 (peer range `>= 1.0.0`).
|
|
|
639
653
|
import, never in the core bundle – shadow-less, adding `nk-block-host` to
|
|
640
654
|
itself so the foundation's editor adapter rules apply.
|
|
641
655
|
|
|
656
|
+
[1.13.0]: https://github.com/JUNGHERZ/NotionKit-Elements/releases/tag/v1.13.0
|
|
642
657
|
[1.12.0]: https://github.com/JUNGHERZ/NotionKit-Elements/releases/tag/v1.12.0
|
|
643
658
|
[1.11.1]: https://github.com/JUNGHERZ/NotionKit-Elements/releases/tag/v1.11.1
|
|
644
659
|
[1.11.0]: https://github.com/JUNGHERZ/NotionKit-Elements/releases/tag/v1.11.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.13.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-87-529cca?style=flat-square" alt="87 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.13.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
|
| 🧩 **87 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 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** | 273 KB minified / 54 KB gzipped (IIFE, foundation sheet included), no external dependencies |
|
|
63
63
|
| 📦 **Four bundle shapes** | IIFE, minified IIFE, ESM, 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.13.0/notionkit.min.css">
|
|
75
|
+
<script src="https://cdn.jsdelivr.net/npm/@jungherz-de/notionkit-elements@1.13.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">
|
|
@@ -102,7 +102,7 @@ The per-component files import NotionKit's sheet as `@jungherz-de/notionkit/noti
|
|
|
102
102
|
|
|
103
103
|
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).
|
|
104
104
|
|
|
105
|
-
Two prerequisites, always: `notionkit.css` on the document (the peer dependency, `>= 1.
|
|
105
|
+
Two prerequisites, always: `notionkit.css` on the document (the peer dependency, `>= 1.13.0`; 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.
|
|
106
106
|
|
|
107
107
|
## Elements
|
|
108
108
|
|
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.13.0) wrapping NotionKit CSS v1.13.0 – the calm, document-centric design system in the Notion idiom. 87 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.12.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.13.0/notionkit.min.css">
|
|
25
|
+
<script src="https://cdn.jsdelivr.net/npm/@jungherz-de/notionkit-elements@1.13.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>
|
|
@@ -142,7 +142,7 @@ A native `<input>` inside the shadow root, wired into the surrounding form throu
|
|
|
142
142
|
<input class="nk-input" name="name" value="Ada Lovelace" placeholder="Display name">
|
|
143
143
|
```
|
|
144
144
|
|
|
145
|
-
**Small screens:** Minimum width 210px; use `wide` to fill the row.
|
|
145
|
+
**Small screens:** Minimum width 210px – inside a panel never wider than the tile; use `wide` to fill the row.
|
|
146
146
|
|
|
147
147
|
### 3.3 `<nk-copy-field>` – Copy field
|
|
148
148
|
|
|
@@ -177,7 +177,7 @@ A value to take along – a link, an address, a key – as tall as an input, wit
|
|
|
177
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>
|
|
178
178
|
```
|
|
179
179
|
|
|
180
|
-
**Small screens:** Keeps to its column: the value is cut, never the actions.
|
|
180
|
+
**Small screens:** Keeps to its column – inside a panel even below its 210px: the value is cut, never the actions.
|
|
181
181
|
|
|
182
182
|
### 3.4 `<nk-image-picker>` – Image picker
|
|
183
183
|
|
|
@@ -1274,7 +1274,7 @@ One destination of `nk-tab-bar`: an icon over a short label. A tap emits `nk-sel
|
|
|
1274
1274
|
|
|
1275
1275
|
### 3.36 `<nk-page>` – Page
|
|
1276
1276
|
|
|
1277
|
-
The document column: a scrolling wrapper, an optional cover, the 760px page with 64px side padding, and the page icon (rendered here because its slotted twin is keyed on the parent). `narrow` drops the scroll wrapper for pages that are the document itself.
|
|
1277
|
+
The document column: a scrolling wrapper, an optional cover, the 760px page with 64px side padding, and the page icon (rendered here because its slotted twin is keyed on the parent). `narrow` drops the scroll wrapper for pages that are the document itself. With a cover the icon overlaps its bottom edge; a cover without an icon leaves the page its top padding, so the title never touches the picture.
|
|
1278
1278
|
|
|
1279
1279
|
```html
|
|
1280
1280
|
<div style="display:flex;flex-direction:column;height:100%"><nk-page icon="🚀" cover>
|
|
@@ -1312,7 +1312,7 @@ The document column: a scrolling wrapper, an optional cover, the 760px page with
|
|
|
1312
1312
|
|
|
1313
1313
|
### 3.37 `<nk-page-cover>` – Page cover
|
|
1314
1314
|
|
|
1315
|
-
The 200px cover
|
|
1315
|
+
The cover band, as tall as the token `--nk-cover-height` (200px) – on `:root`, or on the element for one cover: `style="--nk-cover-height: clamp(200px, 30vh, 300px)"` comes close to Notion’s 30vh. Without `src` it shows the token gradient; with `src` a picture – an `<img>` inside the band, cropped rather than stretched. `position` moves the crop, as Notion’s “Reposition” does.
|
|
1316
1316
|
|
|
1317
1317
|
```html
|
|
1318
1318
|
<nk-page-cover src="/covers/meadow.svg"></nk-page-cover>
|
|
@@ -1332,7 +1332,7 @@ The 200px cover band. Without `src` it shows the token gradient; with `src` a pi
|
|
|
1332
1332
|
<div class="nk-cover"><img src="/covers/meadow.svg" alt=""></div>
|
|
1333
1333
|
```
|
|
1334
1334
|
|
|
1335
|
-
**Small screens:** Unchanged.
|
|
1335
|
+
**Small screens:** Unchanged; lower `--nk-cover-height` if the band eats too much of a short screen.
|
|
1336
1336
|
|
|
1337
1337
|
### 3.38 `<nk-page-title>` – Page title
|
|
1338
1338
|
|
|
@@ -1479,7 +1479,7 @@ A grid of `nk-panel`s: columns of at least 200px that share the row. The panels
|
|
|
1479
1479
|
|
|
1480
1480
|
### 3.43 `<nk-panel>` – Panel
|
|
1481
1481
|
|
|
1482
|
-
A neutral surface for content that belongs together – the cards on Notion’s Home, the boxes in its settings. `title` is the heading (never a tooltip); the content goes in as `<p>`s and blocks. `cover` without a value draws the gradient band, with a URL a picture; `icon` overlaps the cover as on a page – a page tile. With `href` the panel is a link. `slot="end"` sits at the right edge of the title – a state as a tag, a button – as Notion’s settings boxes show a connection, and moves under the title where both do not fit.
|
|
1482
|
+
A neutral surface for content that belongs together – the cards on Notion’s Home, the boxes in its settings. `title` is the heading (never a tooltip); the content goes in as `<p>`s and blocks. `cover` without a value draws the gradient band, with a URL a picture; `icon` overlaps the cover as on a page – a page tile. With `href` the panel is a link. `slot="end"` sits at the right edge of the title – a state as a tag, a button – as Notion’s settings boxes show a connection, and moves under the title where both do not fit. The cover is `--nk-panel-cover-height` tall (64px) – set it on `:root` or on one panel. Inputs, selects and copy fields inside never run past the panel’s edge, however narrow the tile.
|
|
1483
1483
|
|
|
1484
1484
|
```html
|
|
1485
1485
|
<div style="max-width:360px;display:grid;gap:12px"><nk-panel href="#" cover icon="🚀" title="NotionKit MVP"><p>2 min ago</p></nk-panel>
|
|
@@ -3084,8 +3084,8 @@ Eight skeletons, one per app shape, mirroring the NotionKit CSS SKILL.md. Copy o
|
|
|
3084
3084
|
<html lang="en" data-theme="light">
|
|
3085
3085
|
<head>
|
|
3086
3086
|
<meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
3087
|
-
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@jungherz-de/notionkit@1.
|
|
3088
|
-
<script src="https://cdn.jsdelivr.net/npm/@jungherz-de/notionkit-elements@1.
|
|
3087
|
+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@jungherz-de/notionkit@1.13.0/notionkit.min.css">
|
|
3088
|
+
<script src="https://cdn.jsdelivr.net/npm/@jungherz-de/notionkit-elements@1.13.0/dist/notionkit-elements.min.js"></script>
|
|
3089
3089
|
</head>
|
|
3090
3090
|
<body class="nk-body">
|
|
3091
3091
|
<nk-app>
|
|
@@ -3166,8 +3166,8 @@ Rules of the shell: `nk-sidebar`, `nk-topbar` and `nk-page` are `display: conten
|
|
|
3166
3166
|
<html lang="en" data-theme="light">
|
|
3167
3167
|
<head>
|
|
3168
3168
|
<meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
3169
|
-
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@jungherz-de/notionkit@1.
|
|
3170
|
-
<script src="https://cdn.jsdelivr.net/npm/@jungherz-de/notionkit-elements@1.
|
|
3169
|
+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@jungherz-de/notionkit@1.13.0/notionkit.min.css">
|
|
3170
|
+
<script src="https://cdn.jsdelivr.net/npm/@jungherz-de/notionkit-elements@1.13.0/dist/notionkit-elements.min.js"></script>
|
|
3171
3171
|
</head>
|
|
3172
3172
|
<body class="nk-body">
|
|
3173
3173
|
<nk-app>
|
|
@@ -3274,8 +3274,8 @@ Data contract: `columns` describe the properties (`type`: text | select | multi-
|
|
|
3274
3274
|
<html lang="en" data-theme="light">
|
|
3275
3275
|
<head>
|
|
3276
3276
|
<meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
3277
|
-
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@jungherz-de/notionkit@1.
|
|
3278
|
-
<script src="https://cdn.jsdelivr.net/npm/@jungherz-de/notionkit-elements@1.
|
|
3277
|
+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@jungherz-de/notionkit@1.13.0/notionkit.min.css">
|
|
3278
|
+
<script src="https://cdn.jsdelivr.net/npm/@jungherz-de/notionkit-elements@1.13.0/dist/notionkit-elements.min.js"></script>
|
|
3279
3279
|
</head>
|
|
3280
3280
|
<body class="nk-body">
|
|
3281
3281
|
<nk-app>
|
|
@@ -3334,8 +3334,8 @@ Data contract: `columns` describe the properties (`type`: text | select | multi-
|
|
|
3334
3334
|
<html lang="en" data-theme="light">
|
|
3335
3335
|
<head>
|
|
3336
3336
|
<meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
3337
|
-
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@jungherz-de/notionkit@1.
|
|
3338
|
-
<script src="https://cdn.jsdelivr.net/npm/@jungherz-de/notionkit-elements@1.
|
|
3337
|
+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@jungherz-de/notionkit@1.13.0/notionkit.min.css">
|
|
3338
|
+
<script src="https://cdn.jsdelivr.net/npm/@jungherz-de/notionkit-elements@1.13.0/dist/notionkit-elements.min.js"></script>
|
|
3339
3339
|
</head>
|
|
3340
3340
|
<body class="nk-body">
|
|
3341
3341
|
<!-- your app -->
|
|
@@ -3412,8 +3412,8 @@ The open/close contract is one attribute: `settings.open = true`, `settings.show
|
|
|
3412
3412
|
<html lang="en" data-theme="light">
|
|
3413
3413
|
<head>
|
|
3414
3414
|
<meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
3415
|
-
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@jungherz-de/notionkit@1.
|
|
3416
|
-
<script src="https://cdn.jsdelivr.net/npm/@jungherz-de/notionkit-elements@1.
|
|
3415
|
+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@jungherz-de/notionkit@1.13.0/notionkit.min.css">
|
|
3416
|
+
<script src="https://cdn.jsdelivr.net/npm/@jungherz-de/notionkit-elements@1.13.0/dist/notionkit-elements.min.js"></script>
|
|
3417
3417
|
</head>
|
|
3418
3418
|
<body class="nk-body">
|
|
3419
3419
|
<div class="nk-page" style="padding-top:48px">
|
|
@@ -3459,8 +3459,8 @@ The open/close contract is one attribute: `settings.open = true`, `settings.show
|
|
|
3459
3459
|
<html lang="en" data-theme="light">
|
|
3460
3460
|
<head>
|
|
3461
3461
|
<meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
3462
|
-
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@jungherz-de/notionkit@1.
|
|
3463
|
-
<script src="https://cdn.jsdelivr.net/npm/@jungherz-de/notionkit-elements@1.
|
|
3462
|
+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@jungherz-de/notionkit@1.13.0/notionkit.min.css">
|
|
3463
|
+
<script src="https://cdn.jsdelivr.net/npm/@jungherz-de/notionkit-elements@1.13.0/dist/notionkit-elements.min.js"></script>
|
|
3464
3464
|
</head>
|
|
3465
3465
|
<body class="nk-body">
|
|
3466
3466
|
<nk-page narrow icon="📘" cover>
|
|
@@ -3504,8 +3504,8 @@ Note `narrow`: the page is the document, so there is no inner scroll wrapper –
|
|
|
3504
3504
|
<html lang="en" data-theme="light">
|
|
3505
3505
|
<head>
|
|
3506
3506
|
<meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
3507
|
-
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@jungherz-de/notionkit@1.
|
|
3508
|
-
<script src="https://cdn.jsdelivr.net/npm/@jungherz-de/notionkit-elements@1.
|
|
3507
|
+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@jungherz-de/notionkit@1.13.0/notionkit.min.css">
|
|
3508
|
+
<script src="https://cdn.jsdelivr.net/npm/@jungherz-de/notionkit-elements@1.13.0/dist/notionkit-elements.min.js"></script>
|
|
3509
3509
|
</head>
|
|
3510
3510
|
<body class="nk-body">
|
|
3511
3511
|
<nk-app>
|
|
@@ -3559,8 +3559,8 @@ Note `narrow`: the page is the document, so there is no inner scroll wrapper –
|
|
|
3559
3559
|
<html lang="en" data-theme="light">
|
|
3560
3560
|
<head>
|
|
3561
3561
|
<meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
3562
|
-
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@jungherz-de/notionkit@1.
|
|
3563
|
-
<script src="https://cdn.jsdelivr.net/npm/@jungherz-de/notionkit-elements@1.
|
|
3562
|
+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@jungherz-de/notionkit@1.13.0/notionkit.min.css">
|
|
3563
|
+
<script src="https://cdn.jsdelivr.net/npm/@jungherz-de/notionkit-elements@1.13.0/dist/notionkit-elements.min.js"></script>
|
|
3564
3564
|
</head>
|
|
3565
3565
|
<body class="nk-body">
|
|
3566
3566
|
<!-- A narrow column, centred: layout is yours, so it is inline. -->
|
|
@@ -3759,10 +3759,10 @@ Form controls additionally re-dispatch a native, bubbling `change` event, so `fo
|
|
|
3759
3759
|
| Theme sync | one `MutationObserver` on `<html>[data-theme]`, a `Set` of instances, `.nk-wrapper[data-theme]` inside each root |
|
|
3760
3760
|
| Components | `src/components/{forms,content,shell,page,overlays,data}/nk-*.js`, one tag per file, `customElements.define` at the bottom |
|
|
3761
3761
|
| 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` |
|
|
3762
|
-
| Peer | `@jungherz-de/notionkit >= 1.
|
|
3762
|
+
| Peer | `@jungherz-de/notionkit >= 1.13.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 |
|
|
3763
3763
|
|
|
3764
3764
|
Lifecycle: construct (attach shadow, adopt sheets) → first connect (wrapper + `render()`) → every connect (`setupEvents()`, theme registration, light-DOM observer) → `attributeChangedCallback` → `onAttributeChanged` → disconnect (`teardownEvents()`, unregister).
|
|
3765
3765
|
|
|
3766
3766
|
|
|
3767
3767
|
---
|
|
3768
|
-
*NotionKit Elements v1.
|
|
3768
|
+
*NotionKit Elements v1.13.0 · wrapping NotionKit CSS v1.13.0 · MIT · Jungherz GmbH*
|
|
@@ -6,6 +6,8 @@ import '@jungherz-de/notionkit/notionkit-styles.js';
|
|
|
6
6
|
// → <div class="nk-cover"><img src="cover.jpg" alt=""></div>: the picture fills
|
|
7
7
|
// the band, cropped rather than stretched; `position` moves the crop, as
|
|
8
8
|
// Notion's "Reposition" does. The gradient stays underneath while it loads.
|
|
9
|
+
// The band is as tall as the token --nk-cover-height (200px), which reaches
|
|
10
|
+
// the shadow root: style="--nk-cover-height: 30vh" sets one cover.
|
|
9
11
|
class NkPageCover extends NkElement {
|
|
10
12
|
static get observedAttributes() { return ['src', 'position']; }
|
|
11
13
|
|
|
@@ -21,9 +21,9 @@ class NkPage extends NkElement {
|
|
|
21
21
|
render() {
|
|
22
22
|
this._page = this.createElement('div', ['nk-page']);
|
|
23
23
|
this._icon = this.createElement('div', ['nk-page-icon'], { role: 'button', title: 'Change icon' });
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
this._page.appendChild(
|
|
24
|
+
this._iconSlot = this.createElement('slot', [], { name: 'icon' });
|
|
25
|
+
this._iconSlot.appendChild(this._icon);
|
|
26
|
+
this._page.appendChild(this._iconSlot);
|
|
27
27
|
this._page.appendChild(document.createElement('slot'));
|
|
28
28
|
this._cover = this.createElement('div', ['nk-cover']);
|
|
29
29
|
this._coverSlot = this.createElement('slot', [], { name: 'cover' });
|
|
@@ -49,11 +49,14 @@ class NkPage extends NkElement {
|
|
|
49
49
|
if (this._icon.textContent !== icon) this._icon.textContent = icon;
|
|
50
50
|
this._icon.style.display = icon ? '' : 'none';
|
|
51
51
|
this._cover.style.display = this.getBoolAttr('cover') ? '' : 'none';
|
|
52
|
-
// `covered` is the stylesheet's twin of `.nk-cover + .nk-page
|
|
53
|
-
// overlaps the cover and the page drops its top padding.
|
|
54
|
-
// (attribute or a slotted nk-page-cover) the icon sits in
|
|
55
|
-
|
|
56
|
-
|
|
52
|
+
// `covered` is the stylesheet's twin of `.nk-cover + .nk-page` with an
|
|
53
|
+
// icon: the icon overlaps the cover and the page drops its top padding.
|
|
54
|
+
// Without a cover (attribute or a slotted nk-page-cover) the icon sits in
|
|
55
|
+
// the padding; without an icon (attribute or slot="icon") the page keeps
|
|
56
|
+
// it, so the title never touches the cover (NotionKit 1.13.0).
|
|
57
|
+
const filled = slot => slot.assignedNodes().some(n => n.nodeType === Node.ELEMENT_NODE || n.data.trim());
|
|
58
|
+
const covered = this.getBoolAttr('cover') || filled(this._coverSlot), iconed = !!icon || filled(this._iconSlot);
|
|
59
|
+
this._page.classList.toggle('covered', covered && iconed);
|
|
57
60
|
this._page.classList.toggle('full', this.getBoolAttr('full'));
|
|
58
61
|
this._page.classList.toggle('small', this.getBoolAttr('small'));
|
|
59
62
|
}
|
|
@@ -63,10 +66,15 @@ class NkPage extends NkElement {
|
|
|
63
66
|
this._onCover = () => this._sync();
|
|
64
67
|
this._icon.addEventListener('click', this._onIcon);
|
|
65
68
|
this._coverSlot.addEventListener('slotchange', this._onCover);
|
|
69
|
+
this._iconSlot.addEventListener('slotchange', this._onCover);
|
|
66
70
|
this._sync();
|
|
67
71
|
}
|
|
68
72
|
|
|
69
|
-
teardownEvents() {
|
|
73
|
+
teardownEvents() {
|
|
74
|
+
this._icon?.removeEventListener('click', this._onIcon);
|
|
75
|
+
this._coverSlot?.removeEventListener('slotchange', this._onCover);
|
|
76
|
+
this._iconSlot?.removeEventListener('slotchange', this._onCover);
|
|
77
|
+
}
|
|
70
78
|
|
|
71
79
|
onAttributeChanged(name) {
|
|
72
80
|
if (name === 'narrow') this._build();
|