@jungherz-de/notionkit-elements 1.17.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 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.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
+
7
21
  ## [1.17.0] – 2026-09-25
8
22
 
9
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.
@@ -718,6 +732,7 @@ built and tested against NotionKit CSS 1.1.1 (peer range `>= 1.0.0`).
718
732
  import, never in the core bundle – shadow-less, adding `nk-block-host` to
719
733
  itself so the foundation's editor adapter rules apply.
720
734
 
735
+ [1.18.0]: https://github.com/JUNGHERZ/NotionKit-Elements/releases/tag/v1.18.0
721
736
  [1.17.0]: https://github.com/JUNGHERZ/NotionKit-Elements/releases/tag/v1.17.0
722
737
  [1.16.0]: https://github.com/JUNGHERZ/NotionKit-Elements/releases/tag/v1.16.0
723
738
  [1.15.0]: https://github.com/JUNGHERZ/NotionKit-Elements/releases/tag/v1.15.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.17.0-2383e2?style=flat-square" alt="Version"></a>
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.17.0-lightgrey?style=flat-square" alt="Changelog"></a>
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** | 286 KB minified / 57 KB gzipped (IIFE, foundation sheet included), no external dependencies |
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.17.0/notionkit.min.css">
75
- <script src="https://cdn.jsdelivr.net/npm/@jungherz-de/notionkit-elements@1.17.0/dist/notionkit-elements.min.js"></script>
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.17.0`; 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.
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
 
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.17.0) wrapping NotionKit CSS v1.17.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.
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.17.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.17.0/notionkit.min.css">
25
- <script src="https://cdn.jsdelivr.net/npm/@jungherz-de/notionkit-elements@1.17.0/dist/notionkit-elements.min.js"></script>
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>
@@ -148,17 +148,19 @@ A native `<input>` inside the shadow root, wired into the surrounding form throu
148
148
 
149
149
  ### 3.3 `<nk-copy-field>` – Copy field
150
150
 
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.
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`.
152
152
 
153
153
  ```html
154
154
  <div style="max-width:340px"><nk-copy-field value="https://monahilft.notionkit.app" copy-label="Copy"></nk-copy-field></div>
155
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>
156
157
  ```
157
158
 
158
159
  | Attribute | Type | Default | Description |
159
160
  |---|---|---|---|
160
161
  | `value` | string | – | The value. |
161
162
  | `secret` | boolean | – | Masked, with Show/Hide. |
163
+ | `icons` | boolean | – | Icons instead of words at every width, not only on a phone. |
162
164
  | `mono` | boolean | – | Monospace – addresses, keys, code. |
163
165
  | `wrap` | boolean | – | A long value breaks instead of an ellipsis. |
164
166
  | `wide` | boolean | – | Fills the row. |
@@ -169,17 +171,18 @@ A value to take along – a link, an address, a key – as tall as an input, wit
169
171
 
170
172
  **Events:** `nk-action` `{ action: 'copy', value, ok }` – Copy clicked; `ok` is false where the clipboard refused.
171
173
 
172
- **Properties:** `value`, `secret` · **Methods:** `copy()`
174
+ **Properties:** `value`, `secret`, `icons` · **Methods:** `copy()`
173
175
 
174
- **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`
175
177
 
176
178
  ```html
177
179
  <!-- equivalent class markup -->
178
- <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>
179
- <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>
180
183
  ```
181
184
 
182
- **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.
183
186
 
184
187
  ### 3.4 `<nk-image-picker>` – Image picker
185
188
 
@@ -607,10 +610,11 @@ The select option as Notion draws it, in its nine colours. The colour modifier c
607
610
 
608
611
  ### 3.15 `<nk-progress>` – Progress
609
612
 
610
- 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.
611
614
 
612
615
  ```html
613
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>
614
618
  ```
615
619
 
616
620
  | Attribute | Type | Default | Description |
@@ -622,11 +626,12 @@ A 60px bar with an optional label. `value`/`max` set the fill; the bar carries `
622
626
 
623
627
 
624
628
 
625
- **Replaces:** `.nk-progress`, `.nk-progress-label`, `.wide`
629
+ **Replaces:** `.nk-progress`, `.nk-progress-label`, `.wide`, `.nk-progress-row`
626
630
 
627
631
  ```html
628
632
  <!-- equivalent class markup -->
629
- <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>
630
635
  ```
631
636
 
632
637
  **Small screens:** Unchanged.
@@ -1198,7 +1203,7 @@ The ☀️/🌙 button. Flips `data-theme` on `<html>`, remembers the choice in
1198
1203
 
1199
1204
  ### 3.34 `<nk-tab-bar>` – Tab bar (mobile)
1200
1205
 
1201
- 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 exactly one `nk-tab-bar-item` active (listening to `nk-select`); a `drawer` item opens the sidebar instead. Needs NotionKit CSS 1.2.0.
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.
1202
1207
 
1203
1208
  ```html
1204
1209
  <div style="max-width:390px;border:1px solid var(--nk-border);border-radius:12px;overflow:hidden"><nk-tab-bar always value="inbox">
@@ -1212,7 +1217,7 @@ The thumb-reachable twin of the sidebar for phones and installed PWAs. Put it la
1212
1217
 
1213
1218
  | Attribute | Type | Default | Description |
1214
1219
  |---|---|---|---|
1215
- | `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. |
1216
1221
  | `always` | boolean | – | Visible at every width, not only below 860px. |
1217
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. |
1218
1223
  | `floating` | boolean | – | A fixed capsule with rounded corners instead of the full-width bar. |
@@ -3145,8 +3150,8 @@ Eight skeletons, one per app shape, mirroring the NotionKit CSS SKILL.md. Copy o
3145
3150
  <html lang="en" data-theme="light">
3146
3151
  <head>
3147
3152
  <meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0">
3148
- <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@jungherz-de/notionkit@1.17.0/notionkit.min.css">
3149
- <script src="https://cdn.jsdelivr.net/npm/@jungherz-de/notionkit-elements@1.17.0/dist/notionkit-elements.min.js"></script>
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>
3150
3155
  </head>
3151
3156
  <body class="nk-body">
3152
3157
  <nk-app>
@@ -3227,8 +3232,8 @@ Rules of the shell: `nk-sidebar`, `nk-topbar` and `nk-page` are `display: conten
3227
3232
  <html lang="en" data-theme="light">
3228
3233
  <head>
3229
3234
  <meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0">
3230
- <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@jungherz-de/notionkit@1.17.0/notionkit.min.css">
3231
- <script src="https://cdn.jsdelivr.net/npm/@jungherz-de/notionkit-elements@1.17.0/dist/notionkit-elements.min.js"></script>
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>
3232
3237
  </head>
3233
3238
  <body class="nk-body">
3234
3239
  <nk-app>
@@ -3335,8 +3340,8 @@ Data contract: `columns` describe the properties (`type`: text | select | multi-
3335
3340
  <html lang="en" data-theme="light">
3336
3341
  <head>
3337
3342
  <meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0">
3338
- <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@jungherz-de/notionkit@1.17.0/notionkit.min.css">
3339
- <script src="https://cdn.jsdelivr.net/npm/@jungherz-de/notionkit-elements@1.17.0/dist/notionkit-elements.min.js"></script>
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>
3340
3345
  </head>
3341
3346
  <body class="nk-body">
3342
3347
  <nk-app>
@@ -3395,8 +3400,8 @@ Data contract: `columns` describe the properties (`type`: text | select | multi-
3395
3400
  <html lang="en" data-theme="light">
3396
3401
  <head>
3397
3402
  <meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0">
3398
- <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@jungherz-de/notionkit@1.17.0/notionkit.min.css">
3399
- <script src="https://cdn.jsdelivr.net/npm/@jungherz-de/notionkit-elements@1.17.0/dist/notionkit-elements.min.js"></script>
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>
3400
3405
  </head>
3401
3406
  <body class="nk-body">
3402
3407
  <!-- your app -->
@@ -3473,8 +3478,8 @@ The open/close contract is one attribute: `settings.open = true`, `settings.show
3473
3478
  <html lang="en" data-theme="light">
3474
3479
  <head>
3475
3480
  <meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0">
3476
- <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@jungherz-de/notionkit@1.17.0/notionkit.min.css">
3477
- <script src="https://cdn.jsdelivr.net/npm/@jungherz-de/notionkit-elements@1.17.0/dist/notionkit-elements.min.js"></script>
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>
3478
3483
  </head>
3479
3484
  <body class="nk-body">
3480
3485
  <div class="nk-page" style="padding-top:48px">
@@ -3520,8 +3525,8 @@ The open/close contract is one attribute: `settings.open = true`, `settings.show
3520
3525
  <html lang="en" data-theme="light">
3521
3526
  <head>
3522
3527
  <meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0">
3523
- <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@jungherz-de/notionkit@1.17.0/notionkit.min.css">
3524
- <script src="https://cdn.jsdelivr.net/npm/@jungherz-de/notionkit-elements@1.17.0/dist/notionkit-elements.min.js"></script>
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>
3525
3530
  </head>
3526
3531
  <body class="nk-body">
3527
3532
  <nk-page narrow icon="📘" cover>
@@ -3565,8 +3570,8 @@ Note `narrow`: the page is the document, so there is no inner scroll wrapper –
3565
3570
  <html lang="en" data-theme="light">
3566
3571
  <head>
3567
3572
  <meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0">
3568
- <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@jungherz-de/notionkit@1.17.0/notionkit.min.css">
3569
- <script src="https://cdn.jsdelivr.net/npm/@jungherz-de/notionkit-elements@1.17.0/dist/notionkit-elements.min.js"></script>
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>
3570
3575
  </head>
3571
3576
  <body class="nk-body">
3572
3577
  <nk-app>
@@ -3620,8 +3625,8 @@ Note `narrow`: the page is the document, so there is no inner scroll wrapper –
3620
3625
  <html lang="en" data-theme="light">
3621
3626
  <head>
3622
3627
  <meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0">
3623
- <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@jungherz-de/notionkit@1.17.0/notionkit.min.css">
3624
- <script src="https://cdn.jsdelivr.net/npm/@jungherz-de/notionkit-elements@1.17.0/dist/notionkit-elements.min.js"></script>
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>
3625
3630
  </head>
3626
3631
  <body class="nk-body">
3627
3632
  <!-- A narrow column, centred: layout is yours, so it is inline. -->
@@ -3712,6 +3717,9 @@ Form controls additionally re-dispatch a native, bubbling `change` event, so `fo
3712
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 |
3713
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 |
3714
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 |
3715
3723
 
3716
3724
 
3717
3725
  # 7. Quick Reference
@@ -3720,7 +3728,7 @@ Form controls additionally re-dispatch a native, bubbling `change` event, so `fo
3720
3728
  |---|---|---|---|---|
3721
3729
  | `<nk-btn>` | forms | `variant`, `active`, `small`, `disabled` | `(default)` | `click` |
3722
3730
  | `<nk-input>` | forms | `value`, `type`, `placeholder`, `name` | – | `nk-change`, `nk-input` |
3723
- | `<nk-copy-field>` | forms | `value`, `secret`, `mono`, `wrap` | – | `nk-action` |
3731
+ | `<nk-copy-field>` | forms | `value`, `secret`, `icons`, `mono` | – | `nk-action` |
3724
3732
  | `<nk-image-picker>` | forms | `src`, `initials`, `square`, `max` | – | `nk-change`, `nk-error` |
3725
3733
  | `<nk-calendar>` | forms | `value`, `month`, `min`, `max` | – | `nk-change`, `nk-month`, `nk-toggle` |
3726
3734
  | `<nk-textarea>` | forms | `value`, `placeholder`, `rows`, `name` | `(default)` | `nk-change`, `nk-input` |
@@ -3826,10 +3834,10 @@ Form controls additionally re-dispatch a native, bubbling `change` event, so `fo
3826
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 |
3827
3835
  | Components | `src/components/{forms,content,shell,page,overlays,data}/nk-*.js`, one tag per file, `customElements.define` at the bottom |
3828
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` |
3829
- | Peer | `@jungherz-de/notionkit >= 1.17.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 |
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 |
3830
3838
 
3831
3839
  Lifecycle: construct (attach shadow, adopt sheets) → first connect (wrapper + `render()`) → every connect (`setupEvents()`, theme registration, light-DOM observer) → `attributeChangedCallback` → `onAttributeChanged` → disconnect (`teardownEvents()`, unregister).
3832
3840
 
3833
3841
 
3834
3842
  ---
3835
- *NotionKit Elements v1.17.0 · wrapping NotionKit CSS v1.17.0 · MIT · Jungherz GmbH*
3843
+ *NotionKit Elements v1.18.0 · wrapping NotionKit CSS v1.18.0 · MIT · Jungherz GmbH*
@@ -4,7 +4,8 @@ import '@jungherz-de/notionkit/notionkit-styles.js';
4
4
  // <nk-copy-field value="https://monahilft.notionkit.app"></nk-copy-field>
5
5
  // <nk-copy-field value="ntn_4f2…" secret mono></nk-copy-field>
6
6
  // → <div class="nk-copy-field mono"><span class="cf-value">…</span>
7
- // <button class="cf-btn">Show</button><button class="cf-btn">Copy</button></div>
7
+ // <button class="cf-btn" aria-label="Show"><svg>…</svg><span>Show</span></button>
8
+ // <button class="cf-btn" aria-label="Copy"><svg>…</svg><span>Copy</span></button></div>
8
9
  // A value to take along – a link, an address, a key (NotionKit 1.8.0). Copy
9
10
  // writes it to the clipboard and says "Copied" in green for a moment; where
10
11
  // the clipboard is not allowed, the value is shown and selected instead, for
@@ -13,8 +14,21 @@ import '@jungherz-de/notionkit/notionkit-styles.js';
13
14
  // lands in the markup. Fires nk-action { action: 'copy', value, ok }. The
14
15
  // texts come in English or German after the language (1.17.0, setStrings()
15
16
  // for others); copy-label, copied-label, show-label, hide-label set them here.
17
+ // Each button carries an icon beside its word (1.18.0): on a phone, and with
18
+ // `icons` anywhere, the icon stands in for the word – two overlapping squares,
19
+ // an eye, a check in green for the moment after – and a masked key keeps a
20
+ // dozen characters more. The word stays the button's name, and while the
21
+ // icons show, its tooltip for <nk-tooltip>.
22
+ const ICONS = {
23
+ 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>',
24
+ copied: '<svg viewBox="0 0 24 24" aria-hidden="true"><path d="M20 6 9 17l-5-5"/></svg>',
25
+ 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>',
26
+ hide: '<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"/><path d="m3 3 18 18"/></svg>',
27
+ };
28
+ const PHONE = typeof matchMedia === 'function' ? matchMedia('(max-width: 860px)') : null;
29
+
16
30
  class NkCopyField extends NkElement {
17
- static get observedAttributes() { return ['value', 'mono', 'wrap', 'wide', 'secret', 'copy-label', 'copied-label', 'show-label', 'hide-label']; }
31
+ static get observedAttributes() { return ['value', 'mono', 'wrap', 'wide', 'secret', 'icons', 'copy-label', 'copied-label', 'show-label', 'hide-label']; }
18
32
 
19
33
  render() {
20
34
  this._val ??= this.getAttribute('value') ?? '';
@@ -29,29 +43,41 @@ class NkCopyField extends NkElement {
29
43
 
30
44
  _sync() {
31
45
  if (!this._box) return;
32
- for (const m of ['mono', 'wrap', 'wide']) this._box.classList.toggle(m, this.getBoolAttr(m));
46
+ for (const m of ['mono', 'wrap', 'wide', 'icons']) this._box.classList.toggle(m, this.getBoolAttr(m));
33
47
  const secret = this.getBoolAttr('secret');
34
48
  this._text.textContent = secret && !this._revealed ? '•'.repeat(Math.min(this._val.length, 24)) : this._val;
35
49
  // Not `hidden`: .cf-btn sets no display of its own that could lose to it,
36
50
  // but a button that is not there cannot be tabbed to either.
37
51
  if (secret && !this._show.isConnected) this._copy.before(this._show);
38
52
  if (!secret) this._show.remove();
39
- this._show.textContent = this._revealed ? (this.getAttribute('hide-label') || this.str('hide')) : (this.getAttribute('show-label') || this.str('show'));
53
+ const tip = this.getBoolAttr('icons') || !!PHONE?.matches;
54
+ this._button(this._show, this._revealed ? 'hide' : 'show', this._revealed ? (this.getAttribute('hide-label') || this.str('hide')) : (this.getAttribute('show-label') || this.str('show')), tip);
40
55
  this._show.setAttribute('aria-pressed', String(!!this._revealed));
41
- this._copy.textContent = this._copied ? (this.getAttribute('copied-label') || this.str('copied')) : (this.getAttribute('copy-label') || this.str('copy'));
56
+ this._button(this._copy, this._copied ? 'copied' : 'copy', this._copied ? (this.getAttribute('copied-label') || this.str('copied')) : (this.getAttribute('copy-label') || this.str('copy')), tip);
42
57
  this._copy.classList.toggle('copied', !!this._copied);
43
58
  }
44
59
 
60
+ /** The icon and the word of a button; the word is its name, and its tooltip while the icon stands in for it. */
61
+ _button(btn, icon, word, tip) {
62
+ if (btn.dataset.icon !== icon) { btn.innerHTML = `${ICONS[icon]}<span></span>`; btn.dataset.icon = icon; }
63
+ btn.lastChild.textContent = word;
64
+ btn.setAttribute('aria-label', word);
65
+ if (tip) btn.setAttribute('data-tooltip', word); else btn.removeAttribute('data-tooltip');
66
+ }
67
+
45
68
  setupEvents() {
46
69
  this._onCopy = () => this.copy();
47
70
  this._onShow = () => { this._revealed = !this._revealed; this._sync(); };
71
+ this._onPhone = () => this._sync();
48
72
  this._copy.addEventListener('click', this._onCopy);
49
73
  this._show.addEventListener('click', this._onShow);
74
+ PHONE?.addEventListener('change', this._onPhone);
50
75
  }
51
76
 
52
77
  teardownEvents() {
53
78
  this._copy?.removeEventListener('click', this._onCopy);
54
79
  this._show?.removeEventListener('click', this._onShow);
80
+ PHONE?.removeEventListener('change', this._onPhone);
55
81
  clearTimeout(this._timer);
56
82
  }
57
83
 
@@ -84,6 +110,8 @@ class NkCopyField extends NkElement {
84
110
  set value(v) { this._val = v == null ? '' : String(v); this._sync(); }
85
111
  get secret() { return this.getBoolAttr('secret'); }
86
112
  set secret(v) { this.setBoolAttr('secret', v); }
113
+ get icons() { return this.getBoolAttr('icons'); }
114
+ set icons(v) { this.setBoolAttr('icons', v); }
87
115
  }
88
116
 
89
117
  customElements.define('nk-copy-field', NkCopyField);
@@ -4,6 +4,9 @@ import '@jungherz-de/notionkit/notionkit-styles.js';
4
4
  // <nk-progress value="72" label="72%"></nk-progress>
5
5
  // <nk-progress value="72" label="72 %" wide></nk-progress> → fills its row, the label stays beside it
6
6
  // The bar is `.nk-progress > i` — a child combinator, so both nodes live here.
7
+ // With a label the two form one .nk-progress-row (1.18.0): the label beside
8
+ // the bar in a flex column too – a panel – where the host, display: contents,
9
+ // would let them stand one under the other.
7
10
  class NkProgress extends NkElement {
8
11
  static get observedAttributes() { return ['value', 'max', 'label', 'wide']; }
9
12
 
@@ -12,8 +15,7 @@ class NkProgress extends NkElement {
12
15
  this._fill = document.createElement('i');
13
16
  this._bar.appendChild(this._fill);
14
17
  this._label = this.createElement('span', ['nk-progress-label']);
15
- this._wrapper.appendChild(this._bar);
16
- this._wrapper.appendChild(this._label);
18
+ this._row = this.createElement('span', ['nk-progress-row']);
17
19
  this._sync();
18
20
  }
19
21
 
@@ -30,7 +32,8 @@ class NkProgress extends NkElement {
30
32
  this._bar.setAttribute('aria-valuemax', max);
31
33
  const label = this.getAttribute('label');
32
34
  this._label.textContent = label ?? '';
33
- this._label.style.display = label === null ? 'none' : '';
35
+ if (label === null) { if (this._bar.parentNode !== this._wrapper) this._wrapper.replaceChildren(this._bar); }
36
+ else if (this._bar.parentNode !== this._row) { this._row.replaceChildren(this._bar, this._label); this._wrapper.replaceChildren(this._row); }
34
37
  }
35
38
 
36
39
  get value() { return Number(this.getAttribute('value')) || 0; }
@@ -14,8 +14,12 @@ import '@jungherz-de/notionkit/notionkit-styles.js';
14
14
  // stylesheet hides it above 860px – there the sidebar is the navigation –
15
15
  // and shows it below; `always` shows it at every width (previews, phone
16
16
  // frames), `fixed` pins it to the viewport (standalone PWAs) with a spacer
17
- // holding its place, `floating` makes it a capsule. Exactly one item is `active`; a
18
- // `drawer` item opens the sidebar instead of becoming active.
17
+ // holding its place, `floating` makes it a capsule. The item whose value is
18
+ // the bar's `value` is `active`; a `drawer` item opens the sidebar instead of
19
+ // becoming active when clicked. A value no item has – a page without a tab
20
+ // of its own, opened from the drawer – marks the drawer item, as iOS marks
21
+ // "More" (1.18.0); without one no item is active. Without a value the item
22
+ // marked `active`, else the first, is the one.
19
23
  class NkTabBar extends NkElement {
20
24
  static get observedAttributes() { return ['value', 'always', 'fixed', 'floating', 'label']; }
21
25
 
@@ -46,16 +50,18 @@ class NkTabBar extends NkElement {
46
50
  }
47
51
 
48
52
  _sync() {
49
- const items = this.items.filter(i => !i.hasAttribute('drawer'));
53
+ const items = this.items.filter(i => !i.hasAttribute('drawer')), drawers = this.items.filter(i => i.hasAttribute('drawer'));
50
54
  if (!items.length) return;
51
55
  let value = this.getAttribute('value');
52
- if (value === null || !items.some(i => this._valueOf(i) === value)) {
56
+ if (value === null) {
53
57
  const preset = items.find(i => i.hasAttribute('active')) || items[0];
54
58
  value = this._valueOf(preset);
55
59
  }
60
+ const known = items.some(i => this._valueOf(i) === value);
56
61
  for (const item of items) {
57
62
  if (this._valueOf(item) === value) item.setAttribute('active', ''); else item.removeAttribute('active');
58
63
  }
64
+ drawers.forEach((item, n) => { if (!known && n === 0) item.setAttribute('active', ''); else item.removeAttribute('active'); });
59
65
  this._value = value;
60
66
  }
61
67