@zazz-ui/core 0.3.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/src/head.ts CHANGED
@@ -4,7 +4,7 @@
4
4
  * @fileoverview Canonical `<head>` contract for Zazz pages.
5
5
  * @description The single owner of everything a Zazz page loads before its own
6
6
  * content: meta tags, the Geist fonts block, the one `index.css` stylesheet
7
- * link, the feature polyfills, the third-party **import map**, the `index.js`
7
+ * link, the feature polyfill, the third-party **import map**, the `index.js`
8
8
  * module tag, and the theme-persistence script. The docs preview iframe, the
9
9
  * kit's example pages (via `scripts/generate-heads.mjs`), and the docs page
10
10
  * that teaches head structure all render from this module: there is no other
@@ -17,7 +17,7 @@
17
17
  * static package files only (never dynamically generated `/+esm` bundles,
18
18
  * as jsDelivr regenerates those when its bundler toolchain updates, which would
19
19
  * silently invalidate SRI hashes), `sha384` integrity on every URL. ES modules
20
- * resolve through the import map; classic polyfills load as plain script tags.
20
+ * resolve through the import map; the polyfill loads as its own module tag.
21
21
  *
22
22
  * @example
23
23
  * import { buildHead } from "@zazz-ui/core/head";
@@ -135,23 +135,24 @@ const ESM_DEPENDENCIES: readonly CdnDependency[] = [
135
135
  ];
136
136
 
137
137
  /**
138
- * Feature polyfills loaded as script tags ahead of the kit module: the Popover
139
- * API (menus, tooltips, the toaster region) and Invoker Commands
140
- * (`command`/`commandfor`). Native in current engines (2026); the polyfills
141
- * keep older browsers consistent.
138
+ * Feature polyfills loaded ahead of the kit module. Exactly one entry:
139
+ * **Interest Invokers** (`interestfor`), which drives tooltip triggers and the
140
+ * optional hover/focus open on menu, menubar, and navigation-menu. Chromium
141
+ * 142+ ships it; Firefox and Safari do not, so this is the kit's one API below
142
+ * the browser-support floor that a polyfill can cover (ADR-0011).
143
+ *
144
+ * Deliberately *not* polyfilled any more (all native across the support
145
+ * window): the **Popover API** (Chrome 114, Firefox 125, Safari 17, iOS 18.3)
146
+ * and **Invoker Commands** `command`/`commandfor` (Chrome 135, Firefox 144,
147
+ * Safari 26.2). CSS anchor positioning is below the floor but has no polyfill
148
+ * here — the components gate it behind `@supports` instead.
142
149
  */
143
150
  const POLYFILLS: readonly CdnDependency[] = [
144
- {
145
- name: "@oddbird/popover-polyfill",
146
- version: "0.7.2",
147
- file: "dist/popover.min.js",
148
- integrity: "sha384-pOVHoXRgxuaWHCRM4KSyfyfRTmdxgjVo1Ux78ZKJ+GjUz4zIzXiTa8XXuDF1R1Sd",
149
- },
150
151
  {
151
152
  name: "invokers",
152
153
  version: "2.2.2",
153
- file: "dist/esm/production/compatible.js",
154
- integrity: "sha384-7vRXDaS2mcW7LheGSA/rxBwIQNEqmWj0OLEOta/+mvw+9Uf5w1vplA5qg8kLQ99u",
154
+ file: "dist/esm/production/interest.js",
155
+ integrity: "sha384-hR2BVNtsS7fIIMwOm+f7MY0JZfuByGhQQfevCBB6evFATKzBsTw0JzH/RxD94z2T",
155
156
  },
156
157
  ];
157
158
 
@@ -196,18 +197,17 @@ ${json}
196
197
  }
197
198
 
198
199
  /**
199
- * @description Renders the polyfill script tags. The popover polyfill is a
200
- * classic script; the invokers compatibility build is a module. Both are
201
- * deferred, so they execute in document order ahead of `index.js`.
200
+ * @description Renders the polyfill script tag. The invokers interest build is
201
+ * an ES module, so it is deferred by default and executes in document order —
202
+ * ahead of the `index.js` module tag that follows it.
202
203
  *
203
204
  * @returns The polyfill markup.
204
205
  * @private
205
206
  */
206
207
  function polyfillsBlock(): string {
207
- const [popover, invokers] = POLYFILLS;
208
- return `<!-- Polyfills: Popover API + Invoker Commands (command/commandfor) -->
209
- <script src="${cdnUrl(popover)}" integrity="${popover.integrity}" crossorigin="anonymous" defer></script>
210
- <script type="module" src="${cdnUrl(invokers)}" integrity="${invokers.integrity}" crossorigin="anonymous" defer></script>`;
208
+ const [interest] = POLYFILLS;
209
+ return `<!-- Polyfill: Interest Invokers (interestfor) — native in Chromium only -->
210
+ <script type="module" src="${cdnUrl(interest)}" integrity="${interest.integrity}" crossorigin="anonymous"></script>`;
211
211
  }
212
212
 
213
213
  /**
@@ -394,9 +394,8 @@ function cdnBlocks(cdn: CdnHeadOptions, scripts: boolean): string[] {
394
394
  // Side-effect modules need their own tag (nothing imports them); the rest
395
395
  // of each primitive's chain loads through native relative imports. The
396
396
  // core dialog-lifecycle module always leads: dialogs, menus, and popovers
397
- // assume its lifecycle events. Polyfills stay in even for css-only
398
- // closures — tooltip/dialog/menu styles ride on the Popover API and
399
- // Invoker Commands.
397
+ // assume its lifecycle events. The polyfill stays in even for css-only
398
+ // closures — tooltip is styles-only but its trigger is `interestfor`.
400
399
  const scriptFiles = [
401
400
  ...new Set([
402
401
  "base/dialog-lifecycle.js",
package/src/manifest.d.ts CHANGED
@@ -73,7 +73,7 @@ export declare const CSS_CASCADE_ORDER: string[];
73
73
  * @throws {Error} On an unknown primitive name.
74
74
  * @example
75
75
  * resolveClosure(["combobox"]);
76
- * // ["kbd", "button", "popover", "fields", "input", "select", "badge", "combobox"]
76
+ * // ["fields", "badge", "kbd", "button", "popover", "select", "combobox"]
77
77
  */
78
78
  export declare function resolveClosure(names: string[]): string[];
79
79
  export type ExampleScript = "autocomplete" | "combobox" | "command" | "command-actions" | "embla" | "reveal" | "carousel" | "checkbox" | "lightbox" | "menu" | "multiselect" | "otp" | "password" | "tabs" | "toaster";
package/src/manifest.js CHANGED
@@ -81,7 +81,7 @@ export const PRIMITIVES = {
81
81
  css: ["primitives/badge/badge.css"],
82
82
  js: [],
83
83
  base: [],
84
- primitives: [],
84
+ primitives: ["fields"],
85
85
  bare: [],
86
86
  examples: ["primitives/badge/badge.html", "primitives/badge/badge-icon.html"],
87
87
  },
@@ -97,7 +97,7 @@ export const PRIMITIVES = {
97
97
  css: ["primitives/button/button.css"],
98
98
  js: [],
99
99
  base: [],
100
- primitives: ["kbd"],
100
+ primitives: ["kbd", "fields"],
101
101
  bare: [],
102
102
  examples: [
103
103
  "primitives/button/button.html",
@@ -136,7 +136,7 @@ export const PRIMITIVES = {
136
136
  css: ["primitives/checkbox/checkbox.css"],
137
137
  js: ["primitives/checkbox/checkbox.js"],
138
138
  base: [],
139
- primitives: [],
139
+ primitives: ["fields"],
140
140
  bare: SIGNALS_BARE,
141
141
  examples: ["primitives/checkbox/checkbox.html", "primitives/checkbox/checkbox-tasklist.html"],
142
142
  },
@@ -378,7 +378,7 @@ export const PRIMITIVES = {
378
378
  css: ["primitives/tabs/tabs.css"],
379
379
  js: ["primitives/tabs/tabs.js"],
380
380
  base: [],
381
- primitives: [],
381
+ primitives: ["fields"],
382
382
  bare: [],
383
383
  examples: ["primitives/tabs/tabs.html"],
384
384
  },
@@ -489,6 +489,7 @@ export const PRIMITIVES = {
489
489
  */
490
490
  export const CSS_CASCADE_ORDER = [
491
491
  "separator",
492
+ "fields",
492
493
  "badge",
493
494
  "kbd",
494
495
  "button",
@@ -506,7 +507,6 @@ export const CSS_CASCADE_ORDER = [
506
507
  "menu",
507
508
  "navigation-menu",
508
509
  "mobile-menu",
509
- "fields",
510
510
  "input",
511
511
  "textarea",
512
512
  "select",
@@ -538,7 +538,7 @@ export const CSS_CASCADE_ORDER = [
538
538
  * @throws {Error} On an unknown primitive name.
539
539
  * @example
540
540
  * resolveClosure(["combobox"]);
541
- * // ["kbd", "button", "popover", "fields", "input", "select", "badge", "combobox"]
541
+ * // ["fields", "badge", "kbd", "button", "popover", "select", "combobox"]
542
542
  */
543
543
  export function resolveClosure(names) {
544
544
  const closure = new Set();
@@ -49,7 +49,7 @@
49
49
  }
50
50
 
51
51
  /* Only display is gated — see popover.css: closed popovers stay display: none */
52
- [data-slot~="autocomplete-panel"]:where(:popover-open, .\:popover-open) {
52
+ [data-slot~="autocomplete-panel"]:popover-open {
53
53
  display: flex;
54
54
  }
55
55
 
@@ -179,7 +179,7 @@
179
179
  }
180
180
 
181
181
  /* Only display is gated; see popover.css: closed popovers stay display: none */
182
- [data-slot~="combobox-panel"]:where(:popover-open, .\:popover-open) {
182
+ [data-slot~="combobox-panel"]:popover-open {
183
183
  display: flex;
184
184
  }
185
185
 
@@ -53,7 +53,7 @@
53
53
 
54
54
  /* Only display is gated; unconditional it would defeat the UA's
55
55
  display: none on closed popovers and dialogs */
56
- [data-slot~="command-panel"]:where(:popover-open, .\:popover-open, [open]) {
56
+ [data-slot~="command-panel"]:where(:popover-open, [open]) {
57
57
  display: flex;
58
58
  }
59
59
 
@@ -137,7 +137,7 @@ class UiCommand extends TypeaheadElement {
137
137
  if (panel.open)
138
138
  panel.close();
139
139
  }
140
- else if (panel.matches(":popover-open, .\\:popover-open")) {
140
+ else if (panel.matches(":popover-open")) {
141
141
  panel.hidePopover();
142
142
  }
143
143
  }
@@ -146,7 +146,7 @@ class UiCommand extends TypeaheadElement {
146
146
  if (!panel) return;
147
147
  if (panel instanceof HTMLDialogElement) {
148
148
  if (panel.open) panel.close();
149
- } else if (panel.matches(":popover-open, .\\:popover-open")) {
149
+ } else if (panel.matches(":popover-open")) {
150
150
  panel.hidePopover();
151
151
  }
152
152
  }
@@ -78,7 +78,7 @@ class UiMenu extends ZazzElement {
78
78
  return;
79
79
  const isTrigger = target.parentElement === this &&
80
80
  (target.hasAttribute("popovertarget") || target.hasAttribute("interestfor"));
81
- const open = panel.matches(":popover-open, .\\:popover-open");
81
+ const open = panel.matches(":popover-open");
82
82
  if (isTrigger && !open && (event.key === "ArrowDown" || event.key === "ArrowUp")) {
83
83
  event.preventDefault();
84
84
  panel.showPopover();
@@ -87,7 +87,7 @@ class UiMenu extends ZazzElement {
87
87
  const isTrigger =
88
88
  target.parentElement === this &&
89
89
  (target.hasAttribute("popovertarget") || target.hasAttribute("interestfor"));
90
- const open = panel.matches(":popover-open, .\\:popover-open");
90
+ const open = panel.matches(":popover-open");
91
91
 
92
92
  if (isTrigger && !open && (event.key === "ArrowDown" || event.key === "ArrowUp")) {
93
93
  event.preventDefault();
@@ -80,9 +80,7 @@
80
80
  transition: var(--ui-navigation-menu-icon-transition);
81
81
  }
82
82
 
83
- [data-slot~="navigation-menu-item"]:has(
84
- [data-slot~="navigation-menu-popover"]:where(:popover-open, .\:popover-open)
85
- )
83
+ [data-slot~="navigation-menu-item"]:has([data-slot~="navigation-menu-popover"]:popover-open)
86
84
  [data-slot~="navigation-menu-trigger"]
87
85
  > svg {
88
86
  transform: var(--ui-navigation-menu-icon-transform);
@@ -158,10 +156,7 @@
158
156
  /* Highlight the row on hover and while its submenu is open */
159
157
  [data-slot~="navigation-menu-submenu-trigger"]:hover,
160
158
  [data-slot~="navigation-menu-submenu"]:has(
161
- [data-slot~="navigation-menu-popover"][data-variant="submenu"]:where(
162
- :popover-open,
163
- .\:popover-open
164
- )
159
+ [data-slot~="navigation-menu-popover"][data-variant="submenu"]:popover-open
165
160
  )
166
161
  [data-slot~="navigation-menu-submenu-trigger"] {
167
162
  background-color: var(--muted);
@@ -237,10 +232,7 @@
237
232
  padding var(--default-transition-duration) var(--default-transition-timing-function);
238
233
  }
239
234
 
240
- [data-slot~="navigation-menu-popover"][data-animation="slide-down"]:where(
241
- :popover-open,
242
- .\:popover-open
243
- ) {
235
+ [data-slot~="navigation-menu-popover"][data-animation="slide-down"]:popover-open {
244
236
  opacity: var(--ui-popover-opacity--end);
245
237
  transform: scale(var(--ui-popover-scale--end)) translate3d(var(--ui-popover-translate--end));
246
238
 
@@ -251,10 +243,7 @@
251
243
  }
252
244
  }
253
245
 
254
- [data-slot~="navigation-menu-popover"][data-animation="slide-down"]:where(
255
- :popover-open,
256
- .\:popover-open
257
- )
246
+ [data-slot~="navigation-menu-popover"][data-animation="slide-down"]:popover-open
258
247
  [data-slot~="navigation-menu-viewport"] {
259
248
  block-size: auto;
260
249
  transform: scale(1) translateY(0);
@@ -4,7 +4,8 @@
4
4
  * @layer variables, reset, components
5
5
  * @requires layers.css, _variables.css (--popover, --popover-foreground)
6
6
  * @uses [popover], popovertarget, :popover-open: Popover API
7
- * (Chromium-first; polyfill may use .\:popover-open class)
7
+ * (native across the support floor — Chrome 114, Firefox 125,
8
+ * Safari 17, iOS 18.3; no polyfill, see ADR-0011)
8
9
  * @uses @starting-style + allow-discrete: enter/exit opacity/transform
9
10
  * @uses anchor-name, position-anchor, position-area, position-try-fallbacks:
10
11
  * anchor positioning (gated behind @supports; Firefox/Safari fall
@@ -91,8 +92,9 @@
91
92
  }
92
93
  }
93
94
 
94
- /* .\:popover-open must be set for the polyfill to work with discrete animations */
95
- [popover]:where(:popover-open, .\:popover-open) {
95
+ /* Only display is gated: closed popovers keep the UA's display: none, and
96
+ allow-discrete animates the switch */
97
+ [popover]:popover-open {
96
98
  display: grid;
97
99
  align-content: start;
98
100
  opacity: var(--ui-popover-opacity--end);
@@ -409,7 +409,7 @@
409
409
  }
410
410
 
411
411
  /* Only display is gated; see popover.css: closed popovers stay display: none */
412
- [data-slot~="multiselect-panel"]:where(:popover-open, .\:popover-open) {
412
+ [data-slot~="multiselect-panel"]:popover-open {
413
413
  display: flex;
414
414
  }
415
415
 
@@ -96,7 +96,7 @@
96
96
  view-transition-name: toaster;
97
97
  }
98
98
 
99
- :where(ui-toaster, .ui-toaster):where(:popover-open, .\:popover-open) {
99
+ :where(ui-toaster, .ui-toaster):popover-open {
100
100
  display: block;
101
101
  }
102
102
 
@@ -567,7 +567,7 @@ class UiToaster extends ZazzElement {
567
567
  */
568
568
  #showRegion() {
569
569
  try {
570
- if (!this.matches(":popover-open, .\\:popover-open"))
570
+ if (!this.matches(":popover-open"))
571
571
  this.showPopover();
572
572
  }
573
573
  catch {
@@ -580,7 +580,7 @@ class UiToaster extends ZazzElement {
580
580
  */
581
581
  #hideRegion() {
582
582
  try {
583
- if (this.matches(":popover-open, .\\:popover-open"))
583
+ if (this.matches(":popover-open"))
584
584
  this.hidePopover();
585
585
  }
586
586
  catch {
@@ -642,7 +642,7 @@ class UiToaster extends ZazzElement {
642
642
  */
643
643
  #showRegion(): void {
644
644
  try {
645
- if (!this.matches(":popover-open, .\\:popover-open")) this.showPopover();
645
+ if (!this.matches(":popover-open")) this.showPopover();
646
646
  } catch {
647
647
  // Older engines without the Popover API: the region stays a fixed-position
648
648
  // element, which still renders (just not on the top layer).
@@ -654,7 +654,7 @@ class UiToaster extends ZazzElement {
654
654
  */
655
655
  #hideRegion(): void {
656
656
  try {
657
- if (this.matches(":popover-open, .\\:popover-open")) this.hidePopover();
657
+ if (this.matches(":popover-open")) this.hidePopover();
658
658
  } catch {
659
659
  // See #showRegion.
660
660
  }
@@ -90,7 +90,7 @@
90
90
  }
91
91
  }
92
92
 
93
- [data-slot~="tooltip-content"]:where(:popover-open, .\:popover-open) {
93
+ [data-slot~="tooltip-content"]:popover-open {
94
94
  display: flex;
95
95
  opacity: var(--ui-tooltip-opacity--end);
96
96
  transform: scale(var(--ui-tooltip-scale--end)) translate3d(var(--ui-tooltip-translate--end));