elements-kit 0.21.0 → 0.22.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.
Files changed (64) hide show
  1. package/README.md +20 -19
  2. package/dist/attributes.d.mts +1 -1
  3. package/dist/await.d.mts +6 -5
  4. package/dist/await.mjs +0 -36
  5. package/dist/{types-CUvFIgPa.d.mts → children-s3nFjpLA.d.mts} +124 -226
  6. package/dist/custom-elements-CdpilMDu.d.mts +87 -0
  7. package/dist/custom-elements.d.mts +2 -2
  8. package/dist/{element-D3om9yA6.mjs → element-Di0PYFX1.mjs} +15 -38
  9. package/dist/for.d.mts +9 -4
  10. package/dist/for.mjs +1 -1
  11. package/dist/{fragment-ROPRBJQd.mjs → fragment-Bvs1sGu1.mjs} +3 -3
  12. package/dist/hydrate/index.mjs +1 -1
  13. package/dist/{hydrate-6Qx4n4Su.mjs → hydrate-CHomBRY9.mjs} +4 -4
  14. package/dist/integrations/astro-client.mjs +2 -2
  15. package/dist/integrations/astro-server.mjs +2 -2
  16. package/dist/integrations/astro-slots.d.mts +6 -5
  17. package/dist/integrations/astro-slots.mjs +9 -8
  18. package/dist/integrations/react.d.mts +1 -1
  19. package/dist/integrations/react.mjs +1 -1
  20. package/dist/jsx-runtime/index.d.mts +2 -2
  21. package/dist/jsx-runtime/index.mjs +2 -2
  22. package/dist/polyfill-BVNd6ogU.d.mts +9 -0
  23. package/dist/render.mjs +1 -1
  24. package/dist/server/index.mjs +1 -1
  25. package/dist/{server-iFSng50i.mjs → server-CTkyXTV6.mjs} +2 -2
  26. package/dist/signals/index.d.mts +1 -1
  27. package/dist/slot.d.mts +83 -2
  28. package/dist/slot.mjs +179 -2
  29. package/dist/ui/marketing/marketing.css +5 -3
  30. package/dist/ui/otp-input/index.d.mts +1 -1
  31. package/dist/ui/styles/index.css +174 -172
  32. package/dist/ui/styles/unset.css +212 -210
  33. package/dist/utilities/active-element.d.mts +1 -1
  34. package/dist/utilities/async.d.mts +1 -1
  35. package/dist/utilities/debounced.d.mts +1 -1
  36. package/dist/utilities/dom-lifecycle.bench.mjs +2 -2
  37. package/dist/utilities/element-rect.d.mts +1 -1
  38. package/dist/utilities/element-scroll.d.mts +1 -1
  39. package/dist/utilities/event-driven.d.mts +1 -1
  40. package/dist/utilities/event-listener.d.mts +1 -1
  41. package/dist/utilities/focus-within.d.mts +1 -1
  42. package/dist/utilities/hover.d.mts +1 -1
  43. package/dist/utilities/interval.d.mts +1 -1
  44. package/dist/utilities/location.d.mts +1 -1
  45. package/dist/utilities/media-devices.d.mts +1 -1
  46. package/dist/utilities/media-player.d.mts +1 -1
  47. package/dist/utilities/media-query.d.mts +1 -1
  48. package/dist/utilities/network.d.mts +1 -1
  49. package/dist/utilities/orientation.d.mts +1 -1
  50. package/dist/utilities/previous.d.mts +1 -1
  51. package/dist/utilities/promise.d.mts +1 -1
  52. package/dist/utilities/routing.d.mts +1 -1
  53. package/dist/utilities/search-params.d.mts +1 -1
  54. package/dist/utilities/storage.d.mts +1 -1
  55. package/dist/utilities/throttled.d.mts +1 -1
  56. package/dist/utilities/timeout.d.mts +1 -1
  57. package/dist/utilities/window-focus.d.mts +1 -1
  58. package/dist/utilities/window-size.d.mts +1 -1
  59. package/package.json +3 -1
  60. package/dist/custom-elements-BGcU6ldL.d.mts +0 -57
  61. package/dist/slot-BFWXeFRl.d.mts +0 -77
  62. package/dist/slot-Dvf30O0B.mjs +0 -138
  63. /package/dist/{attributes-3r7Diua4.d.mts → attributes-DILeh3-s.d.mts} +0 -0
  64. /package/dist/{scope-zbEG299F.mjs → scope-C1vELXqP.mjs} +0 -0
package/dist/slot.mjs CHANGED
@@ -1,2 +1,179 @@
1
- import { n as Slot, t as SLOTS } from "./slot-Dvf30O0B.mjs";
2
- export { SLOTS, Slot };
1
+ import "./polyfill-CdZVCxdo.mjs";
2
+ //#region src/slot.ts
3
+ /**
4
+ * A lightweight slot that reserves a region in the DOM using comment markers.
5
+ * Content between the markers can be replaced dynamically without wrapper elements.
6
+ */
7
+ var Slot = class Slot {
8
+ #start;
9
+ #end;
10
+ #pending;
11
+ /**
12
+ * Bind a slot to an existing marker pair (server-rendered comments) instead
13
+ * of creating new ones. Used by the hydrate claim pass: content between the
14
+ * markers is adopted as the slot's current content.
15
+ */
16
+ static claim(start, end) {
17
+ const slot = new Slot();
18
+ slot.#start = start;
19
+ slot.#end = end;
20
+ return slot;
21
+ }
22
+ /**
23
+ * Render the slot as a DocumentFragment.
24
+ * If not yet mounted, inserts the comment markers and any default content
25
+ * (`Node`s or strings — native `append()` semantics; strings become text
26
+ * nodes). If already mounted, extracts and returns the current content
27
+ * WITHOUT disposing it — the caller takes ownership of the returned nodes
28
+ * and is responsible for their disposal.
29
+ */
30
+ get(...nodes) {
31
+ const fragment = document.createDocumentFragment();
32
+ if (this.isMounted()) {
33
+ const range = document.createRange();
34
+ range.setStartAfter(this.#start);
35
+ range.setEndBefore(this.#end);
36
+ fragment.appendChild(range.extractContents());
37
+ return fragment;
38
+ }
39
+ const start = this.#start ??= document.createComment("{");
40
+ const end = this.#end ??= document.createComment("}");
41
+ fragment.appendChild(start);
42
+ fragment.appendChild(end);
43
+ const initialContent = this.#pending ?? toContent(nodes);
44
+ if (initialContent) fragment.insertBefore(initialContent, end);
45
+ this.#pending = void 0;
46
+ return fragment;
47
+ }
48
+ /** Dispose reactive children and remove all content between the markers. */
49
+ clear() {
50
+ if (!this.#start || !this.#end) return;
51
+ let node = this.#start.nextSibling;
52
+ while (node && node !== this.#end) {
53
+ const next = node.nextSibling;
54
+ if (node instanceof Element) node[Symbol.dispose]?.();
55
+ node = next;
56
+ }
57
+ const range = document.createRange();
58
+ range.setStartAfter(this.#start);
59
+ range.setEndBefore(this.#end);
60
+ range.deleteContents();
61
+ }
62
+ /**
63
+ * Replace the slot's content with the given nodes/strings (native
64
+ * `append()` semantics; strings become text nodes). No args clears the
65
+ * slot. Buffers until mounted; no-op if the content is identical.
66
+ */
67
+ set(...nodes) {
68
+ const content = toContent(nodes);
69
+ if (content == null) {
70
+ this.clear();
71
+ return;
72
+ }
73
+ const parent = this.parent();
74
+ if (!parent) {
75
+ this.#pending = content;
76
+ return;
77
+ }
78
+ if (this.#isSame(content)) return;
79
+ this.clear();
80
+ parent.insertBefore(content, this.#end);
81
+ this.#pending = void 0;
82
+ }
83
+ /**
84
+ * Extract and return the current slot content as a DocumentFragment.
85
+ * Returns `null` if the slot is not mounted.
86
+ * Content is NOT disposed — the caller takes ownership and is responsible
87
+ * for disposal.
88
+ */
89
+ current() {
90
+ if (!this.isMounted()) return null;
91
+ const range = document.createRange();
92
+ range.setStartAfter(this.#start);
93
+ range.setEndBefore(this.#end);
94
+ return range.extractContents();
95
+ }
96
+ /** Returns the parent node if the slot is mounted, otherwise `null`. */
97
+ parent() {
98
+ return this.isMounted() ? this.#start.parentNode : null;
99
+ }
100
+ /** Whether the slot's comment markers are attached to the DOM. */
101
+ isMounted() {
102
+ return !!this.#start && this.#start.parentNode !== null && this.#start.parentNode === this.#end.parentNode;
103
+ }
104
+ #isSame(element) {
105
+ return this.#start.nextSibling === element && this.#end === element.nextSibling;
106
+ }
107
+ };
108
+ function toContent(nodes) {
109
+ if (nodes.length === 0) return void 0;
110
+ if (nodes.length === 1 && nodes[0] instanceof Node) return nodes[0];
111
+ const frag = document.createDocumentFragment();
112
+ frag.append(...nodes);
113
+ return frag;
114
+ }
115
+ function toArgs(value) {
116
+ return Array.isArray(value) ? value.flat(Infinity) : [value];
117
+ }
118
+ /**
119
+ * Field decorator declaring a slot as a plain property backed by a
120
+ * {@link Slot}. Reading returns the slot's region (`slot.get()` — a fragment
121
+ * to append into any template, elements-kit JSX or not); assigning fills it
122
+ * (`null` clears). Values follow native `append()` semantics — a `Node`, a
123
+ * string, or an array of them. Assignment buffers before mount, so consumers
124
+ * can set content before the element renders.
125
+ *
126
+ * The getter is EFFECTFUL: it mounts the markers on first read and extracts
127
+ * current content on later reads (the re-render semantic of
128
+ * {@link Slot.get}). Read it to PLACE the region, not to inspect it.
129
+ *
130
+ * Declare the field as {@link SlotContent} to accept the full native
131
+ * `append()` surface (`Node` | string | array); narrow it to `Node` when the
132
+ * slot only ever holds an element.
133
+ *
134
+ * @example
135
+ * ```tsx
136
+ * class Card extends HTMLElement {
137
+ * \@slot() header!: SlotContent;
138
+ *
139
+ * render() {
140
+ * return <header>{this.header}</header>; // or root.append(card.header)
141
+ * }
142
+ * }
143
+ *
144
+ * // consumers — any framework, or none:
145
+ * card.header = document.createElement("h1"); // Node
146
+ * card.header = "plain text"; // native append() content
147
+ * card.header = null; // clear
148
+ * ```
149
+ */
150
+ function slot() {
151
+ const store = /* @__PURE__ */ new WeakMap();
152
+ return function(_target, context) {
153
+ context.addInitializer(function() {
154
+ const s = store.get(this);
155
+ Object.defineProperty(this, context.name, {
156
+ get() {
157
+ return s.get();
158
+ },
159
+ set(value) {
160
+ if (value == null) {
161
+ s.clear();
162
+ return;
163
+ }
164
+ s.set(...toArgs(value));
165
+ },
166
+ enumerable: true,
167
+ configurable: true
168
+ });
169
+ });
170
+ return function(initialValue) {
171
+ const s = new Slot();
172
+ store.set(this, s);
173
+ if (initialValue != null) s.set(...toArgs(initialValue));
174
+ return initialValue;
175
+ };
176
+ };
177
+ }
178
+ //#endregion
179
+ export { Slot, slot };
@@ -1,5 +1,7 @@
1
- .hero :is(h1, h2, h3, h4, h5, h6, p), .section-header :is(h1, h2, h3, h4, h5, h6, p), .section-heading, .section-paragraph, .river-content :is(h1, h2, h3, h4, h5, h6, p), .pillar :is(h1, h2, h3, h4, h5, h6, p, [data-heading], [data-paragraph]), .cta-banner :is(h1, h2, h3, h4, h5, h6, p), .testimonial :is(blockquote, figcaption, cite, p), .statistic :is(p, [data-leading], [data-heading], [data-description]) {
2
- margin: 0;
1
+ @layer unset {
2
+ .hero :is(h1, h2, h3, h4, h5, h6, p), .section-header :is(h1, h2, h3, h4, h5, h6, p), .section-heading, .section-paragraph, .river-content :is(h1, h2, h3, h4, h5, h6, p), .pillar :is(h1, h2, h3, h4, h5, h6, p, [data-heading], [data-paragraph]), .cta-banner :is(h1, h2, h3, h4, h5, h6, p), .testimonial :is(blockquote, figcaption, cite, p), .statistic :is(p, [data-leading], [data-heading], [data-description]) {
3
+ margin: 0;
4
+ }
3
5
  }
4
6
 
5
7
  .hero {
@@ -32,7 +34,7 @@
32
34
  @media (min-width: 64rem) {
33
35
  .hero .section-paragraph {
34
36
  font-size: var(--font-size-5);
35
- line-height: var(--line-height-5);
37
+ line-height: var(--line-height-6);
36
38
  }
37
39
  }
38
40
 
@@ -1,4 +1,4 @@
1
- import { n as AttrChangeHandler, t as ATTRIBUTES } from "../../attributes-3r7Diua4.mjs";
1
+ import { n as AttrChangeHandler, t as ATTRIBUTES } from "../../attributes-DILeh3-s.mjs";
2
2
 
3
3
  //#region src/ui/otp-input/otp-input.d.ts
4
4
  /**
@@ -449,214 +449,216 @@
449
449
  --cursor-switch: default;
450
450
  }
451
451
 
452
- .unset:where(body, blockquote, dl, dd, figure, p) {
453
- margin: 0;
454
- }
452
+ @layer unset {
453
+ .unset:where(body, blockquote, dl, dd, figure, p) {
454
+ margin: 0;
455
+ }
455
456
 
456
- .unset:where(address, b, cite, code, dfn, em, i, kbd, q, samp, small, strong, var) {
457
- font: unset;
458
- }
457
+ .unset:where(address, b, cite, code, dfn, em, i, kbd, q, samp, small, strong, var) {
458
+ font: unset;
459
+ }
459
460
 
460
- .unset:where(h1, h2, h3, h4, h5, h6) {
461
- font: unset;
462
- margin: 0;
463
- }
461
+ .unset:where(h1, h2, h3, h4, h5, h6) {
462
+ font: unset;
463
+ margin: 0;
464
+ }
464
465
 
465
- .unset:where(a) {
466
- all: unset;
467
- -webkit-tap-highlight-color: transparent;
468
- }
466
+ .unset:where(a) {
467
+ all: unset;
468
+ -webkit-tap-highlight-color: transparent;
469
+ }
469
470
 
470
- .unset:where(button, select, [type="button"], [type="image"], [type="reset"], [type="submit"], [type="checkbox"], [type="color"], [type="radio"], [type="range"]) {
471
- all: unset;
472
- text-indent: initial;
473
- -webkit-tap-highlight-color: transparent;
474
- font-style: normal;
475
- font-weight: normal;
476
- display: inline-block;
477
- }
471
+ .unset:where(button, select, [type="button"], [type="image"], [type="reset"], [type="submit"], [type="checkbox"], [type="color"], [type="radio"], [type="range"]) {
472
+ all: unset;
473
+ text-indent: initial;
474
+ -webkit-tap-highlight-color: transparent;
475
+ font-style: normal;
476
+ font-weight: normal;
477
+ display: inline-block;
478
+ }
478
479
 
479
- .unset:where(label) {
480
- -webkit-tap-highlight-color: transparent;
481
- }
480
+ .unset:where(label) {
481
+ -webkit-tap-highlight-color: transparent;
482
+ }
482
483
 
483
- .unset:where(dialog, [popover]) {
484
- box-sizing: border-box;
485
- background: none;
486
- border: 0;
487
- outline: none;
488
- max-width: none;
489
- max-height: none;
490
- margin: 0;
491
- padding: 0;
492
- position: fixed;
493
- inset: auto;
494
- overflow: visible;
495
- }
484
+ .unset:where(dialog, [popover]) {
485
+ box-sizing: border-box;
486
+ background: none;
487
+ border: 0;
488
+ outline: none;
489
+ max-width: none;
490
+ max-height: none;
491
+ margin: 0;
492
+ padding: 0;
493
+ position: fixed;
494
+ inset: auto;
495
+ overflow: visible;
496
+ }
496
497
 
497
- .unset:where(select) {
498
- text-align: start;
499
- font-style: normal;
500
- font-weight: normal;
501
- }
498
+ .unset:where(select) {
499
+ text-align: start;
500
+ font-style: normal;
501
+ font-weight: normal;
502
+ }
502
503
 
503
- .unset:where(textarea, input:not([type="button"], [type="image"], [type="reset"], [type="submit"], [type="checkbox"], [type="color"], [type="radio"], [type="range"])) {
504
- all: unset;
505
- text-align: start;
506
- width: -webkit-fill-available;
507
- width: -moz-available;
508
- width: stretch;
509
- text-indent: initial;
510
- -webkit-tap-highlight-color: transparent;
511
- cursor: text;
512
- white-space: pre-wrap;
513
- font-style: normal;
514
- font-weight: normal;
515
- display: block;
516
- }
504
+ .unset:where(textarea, input:not([type="button"], [type="image"], [type="reset"], [type="submit"], [type="checkbox"], [type="color"], [type="radio"], [type="range"])) {
505
+ all: unset;
506
+ text-align: start;
507
+ width: -webkit-fill-available;
508
+ width: -moz-available;
509
+ width: stretch;
510
+ text-indent: initial;
511
+ -webkit-tap-highlight-color: transparent;
512
+ cursor: text;
513
+ white-space: pre-wrap;
514
+ font-style: normal;
515
+ font-weight: normal;
516
+ display: block;
517
+ }
517
518
 
518
- .unset:where(:focus) {
519
- outline: none;
520
- }
519
+ .unset:where(:focus) {
520
+ outline: none;
521
+ }
521
522
 
522
- .unset::placeholder {
523
- color: unset;
524
- opacity: unset;
525
- -webkit-user-select: none;
526
- user-select: none;
527
- }
523
+ .unset::placeholder {
524
+ color: unset;
525
+ opacity: unset;
526
+ -webkit-user-select: none;
527
+ user-select: none;
528
+ }
528
529
 
529
- .unset:where(table) {
530
- all: unset;
531
- text-indent: initial;
532
- display: table;
533
- }
530
+ .unset:where(table) {
531
+ all: unset;
532
+ text-indent: initial;
533
+ display: table;
534
+ }
534
535
 
535
- .unset:where(caption) {
536
- text-align: inherit;
537
- }
536
+ .unset:where(caption) {
537
+ text-align: inherit;
538
+ }
538
539
 
539
- .unset:where(td) {
540
- padding: 0;
541
- }
540
+ .unset:where(td) {
541
+ padding: 0;
542
+ }
542
543
 
543
- .unset:where(th) {
544
- font-weight: unset;
545
- text-align: inherit;
546
- padding: 0;
547
- }
544
+ .unset:where(th) {
545
+ font-weight: unset;
546
+ text-align: inherit;
547
+ padding: 0;
548
+ }
548
549
 
549
- .unset:where(abbr, acronym) {
550
- text-decoration: none;
551
- }
550
+ .unset:where(abbr, acronym) {
551
+ text-decoration: none;
552
+ }
552
553
 
553
- .unset:where(canvas, object, picture, summary) {
554
- display: block;
555
- }
554
+ .unset:where(canvas, object, picture, summary) {
555
+ display: block;
556
+ }
556
557
 
557
- .unset:where(del, s) {
558
- -webkit-text-decoration: unset;
559
- text-decoration: unset;
560
- }
558
+ .unset:where(del, s) {
559
+ -webkit-text-decoration: unset;
560
+ text-decoration: unset;
561
+ }
561
562
 
562
- .unset:where(fieldset, hr) {
563
- all: unset;
564
- display: block;
565
- }
563
+ .unset:where(fieldset, hr) {
564
+ all: unset;
565
+ display: block;
566
+ }
566
567
 
567
- .unset:where(legend) {
568
- cursor: default;
569
- border: none;
570
- padding: 0;
571
- }
568
+ .unset:where(legend) {
569
+ cursor: default;
570
+ border: none;
571
+ padding: 0;
572
+ }
572
573
 
573
- .unset:where(li) {
574
- text-align: unset;
575
- display: block;
576
- }
574
+ .unset:where(li) {
575
+ text-align: unset;
576
+ display: block;
577
+ }
577
578
 
578
- .unset:where(ol, ul) {
579
- margin: 0;
580
- padding: 0;
581
- list-style: none;
582
- }
579
+ .unset:where(ol, ul) {
580
+ margin: 0;
581
+ padding: 0;
582
+ list-style: none;
583
+ }
583
584
 
584
- .unset:where(iframe) {
585
- width: -webkit-fill-available;
586
- width: -moz-available;
587
- border: none;
588
- width: stretch;
589
- display: block;
590
- }
585
+ .unset:where(iframe) {
586
+ width: -webkit-fill-available;
587
+ width: -moz-available;
588
+ border: none;
589
+ width: stretch;
590
+ display: block;
591
+ }
591
592
 
592
- .unset:where(ins, u) {
593
- text-decoration: none;
594
- }
593
+ .unset:where(ins, u) {
594
+ text-decoration: none;
595
+ }
595
596
 
596
- .unset:where(img) {
597
- max-width: 100%;
598
- display: block;
599
- }
597
+ .unset:where(img) {
598
+ max-width: 100%;
599
+ display: block;
600
+ }
600
601
 
601
- .unset:where(svg) {
602
- flex-shrink: 0;
603
- max-width: 100%;
604
- display: block;
605
- }
602
+ .unset:where(svg) {
603
+ flex-shrink: 0;
604
+ max-width: 100%;
605
+ display: block;
606
+ }
606
607
 
607
- .unset:where(mark) {
608
- all: unset;
609
- }
608
+ .unset:where(mark) {
609
+ all: unset;
610
+ }
610
611
 
611
- .unset:where(pre) {
612
- font: unset;
613
- margin: unset;
614
- }
612
+ .unset:where(pre) {
613
+ font: unset;
614
+ margin: unset;
615
+ }
615
616
 
616
- .unset:where(q):before, .unset:where(q):after {
617
- content: "";
618
- }
617
+ .unset:where(q):before, .unset:where(q):after {
618
+ content: "";
619
+ }
619
620
 
620
- .unset:where(sub, sup) {
621
- font: unset;
622
- vertical-align: unset;
623
- }
621
+ .unset:where(sub, sup) {
622
+ font: unset;
623
+ vertical-align: unset;
624
+ }
624
625
 
625
- .unset:where(details) ::marker {
626
- content: none;
627
- }
626
+ .unset:where(details) ::marker {
627
+ content: none;
628
+ }
628
629
 
629
- .unset:where(summary)::marker {
630
- content: none;
631
- }
630
+ .unset:where(summary)::marker {
631
+ content: none;
632
+ }
632
633
 
633
- .unset:where(video) {
634
- width: -webkit-fill-available;
635
- width: -moz-available;
636
- width: stretch;
637
- display: block;
638
- }
634
+ .unset:where(video) {
635
+ width: -webkit-fill-available;
636
+ width: -moz-available;
637
+ width: stretch;
638
+ display: block;
639
+ }
639
640
 
640
- .unset:where(:any-link) {
641
- cursor: var(--cursor-link);
642
- }
641
+ .unset:where(:any-link) {
642
+ cursor: var(--cursor-link);
643
+ }
643
644
 
644
- .unset:where(button) {
645
- cursor: var(--cursor-button);
646
- }
645
+ .unset:where(button) {
646
+ cursor: var(--cursor-button);
647
+ }
647
648
 
648
- .unset:where(:disabled, [data-disabled]) {
649
- cursor: var(--cursor-disabled);
650
- }
649
+ .unset:where(:disabled, [data-disabled]) {
650
+ cursor: var(--cursor-disabled);
651
+ }
651
652
 
652
- .unset:where(input[type="checkbox"]) {
653
- cursor: var(--cursor-checkbox);
654
- }
653
+ .unset:where(input[type="checkbox"]) {
654
+ cursor: var(--cursor-checkbox);
655
+ }
655
656
 
656
- .unset:where(input[type="radio"]) {
657
- cursor: var(--cursor-radio);
658
- }
657
+ .unset:where(input[type="radio"]) {
658
+ cursor: var(--cursor-radio);
659
+ }
659
660
 
660
- .unset, .unset:before, .unset:after {
661
- box-sizing: border-box;
661
+ .unset, .unset:before, .unset:after {
662
+ box-sizing: border-box;
663
+ }
662
664
  }