@wavelengthusaf/web-components 1.19.0 → 1.21.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/dist/cjs/index.cjs +556 -47
- package/dist/cjs/index.d.cts +48 -6
- package/dist/esm/index.d.ts +48 -6
- package/dist/esm/index.js +555 -46
- package/package.json +1 -1
package/dist/cjs/index.cjs
CHANGED
|
@@ -4044,38 +4044,69 @@ var wavelength_manyplanes_template_default = '<style>\n :host {\n display: b
|
|
|
4044
4044
|
|
|
4045
4045
|
// src/web-components/wavelength-manyplanes.ts
|
|
4046
4046
|
var WavelengthManyPlanes = class extends HTMLElement {
|
|
4047
|
-
static get observedAttributes() {
|
|
4048
|
-
return ["number-of-planes", "trail-dir", "opacity", "color", "gradient", "spaced"];
|
|
4049
|
-
}
|
|
4050
4047
|
constructor() {
|
|
4051
4048
|
super();
|
|
4049
|
+
this._numberOfPlanes = 5;
|
|
4050
|
+
this._spaced = true;
|
|
4052
4051
|
this.shadow = this.attachShadow({ mode: "open" });
|
|
4053
4052
|
this.shadow.innerHTML = wavelength_manyplanes_template_default;
|
|
4054
4053
|
}
|
|
4054
|
+
static get observedAttributes() {
|
|
4055
|
+
return ["number-of-planes", "trail-dir", "opacity", "color", "gradient", "spaced"];
|
|
4056
|
+
}
|
|
4057
|
+
get numberOfPlanes() {
|
|
4058
|
+
return this._numberOfPlanes;
|
|
4059
|
+
}
|
|
4060
|
+
set numberOfPlanes(val) {
|
|
4061
|
+
if (this._numberOfPlanes !== val) {
|
|
4062
|
+
this._numberOfPlanes = val;
|
|
4063
|
+
this.setAttribute("number-of-planes", val.toString());
|
|
4064
|
+
this.updateComponent();
|
|
4065
|
+
}
|
|
4066
|
+
}
|
|
4067
|
+
get spaced() {
|
|
4068
|
+
return this._spaced;
|
|
4069
|
+
}
|
|
4070
|
+
set spaced(val) {
|
|
4071
|
+
if (this._spaced !== val) {
|
|
4072
|
+
this._spaced = val;
|
|
4073
|
+
this.setAttribute("spaced", val.toString());
|
|
4074
|
+
this.updateComponent();
|
|
4075
|
+
}
|
|
4076
|
+
}
|
|
4055
4077
|
connectedCallback() {
|
|
4056
4078
|
this.updateComponent();
|
|
4057
4079
|
}
|
|
4058
|
-
attributeChangedCallback() {
|
|
4080
|
+
attributeChangedCallback(name, oldValue, newValue) {
|
|
4081
|
+
if (oldValue === newValue) return;
|
|
4082
|
+
if (name === "number-of-planes") {
|
|
4083
|
+
const parsed = Number(newValue);
|
|
4084
|
+
if (!isNaN(parsed)) {
|
|
4085
|
+
this._numberOfPlanes = parsed;
|
|
4086
|
+
}
|
|
4087
|
+
} else if (name === "spaced") {
|
|
4088
|
+
this._spaced = newValue === "true";
|
|
4089
|
+
}
|
|
4059
4090
|
this.updateComponent();
|
|
4060
4091
|
}
|
|
4061
4092
|
updateComponent() {
|
|
4062
|
-
const numberOfPlanes = this.
|
|
4093
|
+
const numberOfPlanes = this._numberOfPlanes;
|
|
4063
4094
|
const trailDir = this.getAttribute("trail-dir") || "right";
|
|
4064
4095
|
const opacity = this.getAttribute("opacity") || "1";
|
|
4065
4096
|
const color = this.getAttribute("color") || "#00308F";
|
|
4066
4097
|
const gradient = this.getAttribute("gradient") || "false";
|
|
4067
|
-
const spaced = this.
|
|
4098
|
+
const spaced = this._spaced;
|
|
4068
4099
|
const planeContainer = this.shadow.getElementById("plane-container");
|
|
4069
4100
|
if (planeContainer === null) {
|
|
4070
4101
|
return;
|
|
4071
4102
|
}
|
|
4072
4103
|
planeContainer.replaceChildren();
|
|
4073
4104
|
planeContainer.style.flexDirection = trailDir === "right" ? "row" : "row-reverse";
|
|
4074
|
-
planeContainer.style.justifyContent = spaced
|
|
4075
|
-
for (let i = 0; i <
|
|
4105
|
+
planeContainer.style.justifyContent = spaced ? "space-between" : "flex-end";
|
|
4106
|
+
for (let i = 0; i < numberOfPlanes; i++) {
|
|
4076
4107
|
let currentPlaneOpacity = opacity;
|
|
4077
4108
|
if (gradient === "true") {
|
|
4078
|
-
currentPlaneOpacity = (parseFloat(opacity) * ((i + 1) /
|
|
4109
|
+
currentPlaneOpacity = (parseFloat(opacity) * ((i + 1) / numberOfPlanes)).toString();
|
|
4079
4110
|
}
|
|
4080
4111
|
planeContainer.appendChild(this.createPlane(currentPlaneOpacity, color, trailDir === "right" ? false : true));
|
|
4081
4112
|
}
|
|
@@ -4459,7 +4490,7 @@ var wavelength_search_template_default = '<style>\n :host {\n display: block
|
|
|
4459
4490
|
var WavelengthSearch = class extends HTMLElement {
|
|
4460
4491
|
constructor() {
|
|
4461
4492
|
super();
|
|
4462
|
-
this.
|
|
4493
|
+
this._options = [];
|
|
4463
4494
|
this.highlightedIndex = -1;
|
|
4464
4495
|
this.styleAttributes = [
|
|
4465
4496
|
"width",
|
|
@@ -4477,14 +4508,15 @@ var WavelengthSearch = class extends HTMLElement {
|
|
|
4477
4508
|
];
|
|
4478
4509
|
this.handleFocusIn = () => {
|
|
4479
4510
|
this.inputContainer.classList.add("focused");
|
|
4511
|
+
this.handleSearch(this.input.value || "");
|
|
4480
4512
|
};
|
|
4481
4513
|
this.handleFocusOut = () => {
|
|
4482
4514
|
this.inputContainer.classList.remove("focused");
|
|
4483
4515
|
};
|
|
4484
4516
|
this.handleInputChange = (e) => {
|
|
4485
4517
|
const mode = this.getAttribute("mode") || "automatic";
|
|
4486
|
-
const
|
|
4487
|
-
if (
|
|
4518
|
+
const currentQueryText = e.detail.value;
|
|
4519
|
+
if (currentQueryText) {
|
|
4488
4520
|
this.inputContainer.classList.add("has-value");
|
|
4489
4521
|
} else {
|
|
4490
4522
|
this.inputContainer.classList.remove("has-value");
|
|
@@ -4494,7 +4526,7 @@ var WavelengthSearch = class extends HTMLElement {
|
|
|
4494
4526
|
clearTimeout(this.searchTimeout);
|
|
4495
4527
|
}
|
|
4496
4528
|
this.searchTimeout = setTimeout(() => {
|
|
4497
|
-
this.handleSearch(
|
|
4529
|
+
this.handleSearch(currentQueryText);
|
|
4498
4530
|
}, 300);
|
|
4499
4531
|
}
|
|
4500
4532
|
};
|
|
@@ -4524,18 +4556,22 @@ var WavelengthSearch = class extends HTMLElement {
|
|
|
4524
4556
|
} else if (e.key === "Enter") {
|
|
4525
4557
|
if (isDropdownVisible && this.highlightedIndex >= 0 && this.highlightedIndex < items.length) {
|
|
4526
4558
|
e.preventDefault();
|
|
4527
|
-
|
|
4559
|
+
const id = items[this.highlightedIndex].getAttribute("data-id");
|
|
4560
|
+
const selected = this._options.find((o) => String(o.id) === id);
|
|
4561
|
+
if (selected) {
|
|
4562
|
+
this.selectOption(selected);
|
|
4563
|
+
}
|
|
4528
4564
|
} else {
|
|
4529
|
-
const
|
|
4530
|
-
this.dispatchEvent(new CustomEvent("wavelength-search-submit", { detail: { value }, bubbles: true, composed: true }));
|
|
4531
|
-
this.handleSearch(
|
|
4565
|
+
const submittedQuery = this.input.value;
|
|
4566
|
+
this.dispatchEvent(new CustomEvent("wavelength-search-submit", { detail: { value: submittedQuery }, bubbles: true, composed: true }));
|
|
4567
|
+
this.handleSearch(submittedQuery);
|
|
4532
4568
|
}
|
|
4533
4569
|
}
|
|
4534
4570
|
};
|
|
4535
4571
|
this.handleSearchIconClick = () => {
|
|
4536
|
-
const
|
|
4537
|
-
this.dispatchEvent(new CustomEvent("wavelength-search-submit", { detail: { value }, bubbles: true, composed: true }));
|
|
4538
|
-
this.handleSearch(
|
|
4572
|
+
const submittedQuery = this.input.value;
|
|
4573
|
+
this.dispatchEvent(new CustomEvent("wavelength-search-submit", { detail: { value: submittedQuery }, bubbles: true, composed: true }));
|
|
4574
|
+
this.handleSearch(submittedQuery);
|
|
4539
4575
|
};
|
|
4540
4576
|
this.handleDocumentClick = (e) => {
|
|
4541
4577
|
if (!this.contains(e.target)) {
|
|
@@ -4622,9 +4658,12 @@ var WavelengthSearch = class extends HTMLElement {
|
|
|
4622
4658
|
}
|
|
4623
4659
|
if (name === "options" && newValue) {
|
|
4624
4660
|
try {
|
|
4625
|
-
|
|
4661
|
+
const parsed = JSON.parse(newValue);
|
|
4662
|
+
if (Array.isArray(parsed)) {
|
|
4663
|
+
this._options = parsed.map((item, index) => typeof item === "string" ? { id: index, title: item } : item);
|
|
4664
|
+
}
|
|
4626
4665
|
} catch (e) {
|
|
4627
|
-
this.
|
|
4666
|
+
this._options = newValue.split(",").map((s, index) => ({ id: index, title: s.trim() }));
|
|
4628
4667
|
}
|
|
4629
4668
|
} else if (name === "placeholder" && this.animatedPlaceholder) {
|
|
4630
4669
|
this.animatedPlaceholder.textContent = newValue || "Search...";
|
|
@@ -4641,11 +4680,7 @@ var WavelengthSearch = class extends HTMLElement {
|
|
|
4641
4680
|
clearTimeout(this.searchTimeout);
|
|
4642
4681
|
this.searchTimeout = null;
|
|
4643
4682
|
}
|
|
4644
|
-
|
|
4645
|
-
this.dropdown.style.display = "none";
|
|
4646
|
-
return;
|
|
4647
|
-
}
|
|
4648
|
-
const results = this.options.filter((option) => option.toLowerCase().includes(query.toLowerCase()));
|
|
4683
|
+
const results = query ? this._options.filter((option) => option.title && option.title.toLowerCase().includes(query.toLowerCase())) : this._options;
|
|
4649
4684
|
this.highlightedIndex = -1;
|
|
4650
4685
|
this.renderDropdown(results);
|
|
4651
4686
|
}
|
|
@@ -4654,12 +4689,17 @@ var WavelengthSearch = class extends HTMLElement {
|
|
|
4654
4689
|
this.dropdown.style.display = "none";
|
|
4655
4690
|
return;
|
|
4656
4691
|
}
|
|
4657
|
-
this.dropdown.innerHTML = results.map(
|
|
4692
|
+
this.dropdown.innerHTML = results.map(
|
|
4693
|
+
(r) => `<div class="dropdown-item" data-id="${r.id}">
|
|
4694
|
+
<div class="search-result-title">${r.title}</div>
|
|
4695
|
+
${r.subtitle ? `<div class="search-result-subtitle">${r.subtitle}</div>` : ""}
|
|
4696
|
+
</div>`
|
|
4697
|
+
).join("");
|
|
4658
4698
|
this.dropdown.style.display = "block";
|
|
4659
4699
|
const items = this.dropdown.querySelectorAll(".dropdown-item");
|
|
4660
4700
|
items.forEach((item, index) => {
|
|
4661
4701
|
item.addEventListener("click", () => {
|
|
4662
|
-
this.selectOption(
|
|
4702
|
+
this.selectOption(results[index]);
|
|
4663
4703
|
});
|
|
4664
4704
|
item.addEventListener("mouseenter", () => {
|
|
4665
4705
|
this.highlightedIndex = index;
|
|
@@ -4668,44 +4708,43 @@ var WavelengthSearch = class extends HTMLElement {
|
|
|
4668
4708
|
});
|
|
4669
4709
|
this.updateHighlight(items);
|
|
4670
4710
|
}
|
|
4671
|
-
selectOption(
|
|
4672
|
-
this.input.value =
|
|
4711
|
+
selectOption(selectedItem) {
|
|
4712
|
+
this.input.value = selectedItem.title;
|
|
4673
4713
|
this.dropdown.style.display = "none";
|
|
4674
4714
|
this.highlightedIndex = -1;
|
|
4675
|
-
this.dispatchEvent(new CustomEvent("wavelength-search-select", { detail: { value }, bubbles: true, composed: true }));
|
|
4715
|
+
this.dispatchEvent(new CustomEvent("wavelength-search-select", { detail: { value: selectedItem }, bubbles: true, composed: true }));
|
|
4676
4716
|
}
|
|
4677
4717
|
// ---- Getters and Setters API ---- //
|
|
4678
4718
|
get value() {
|
|
4679
4719
|
return this.input.value;
|
|
4680
4720
|
}
|
|
4681
|
-
set value(
|
|
4682
|
-
this.input.value =
|
|
4721
|
+
set value(searchQueryText) {
|
|
4722
|
+
this.input.value = searchQueryText;
|
|
4683
4723
|
}
|
|
4684
|
-
get
|
|
4685
|
-
return this.
|
|
4724
|
+
get options() {
|
|
4725
|
+
return this._options;
|
|
4686
4726
|
}
|
|
4687
|
-
set
|
|
4688
|
-
if (val) {
|
|
4689
|
-
this.
|
|
4690
|
-
this.setAttribute("options", JSON.stringify(val));
|
|
4727
|
+
set options(val) {
|
|
4728
|
+
if (Array.isArray(val)) {
|
|
4729
|
+
this._options = val;
|
|
4691
4730
|
}
|
|
4692
4731
|
}
|
|
4693
4732
|
_syncStyles() {
|
|
4694
4733
|
this.styleAttributes.forEach((attr) => {
|
|
4695
|
-
const
|
|
4696
|
-
if (
|
|
4697
|
-
if (attr === "height" && ["small", "medium", "large"].includes(
|
|
4734
|
+
const attrValue = this.getAttribute(attr);
|
|
4735
|
+
if (attrValue) {
|
|
4736
|
+
if (attr === "height" && ["small", "medium", "large"].includes(attrValue)) {
|
|
4698
4737
|
} else {
|
|
4699
|
-
this.style.setProperty(`--${attr}`,
|
|
4738
|
+
this.style.setProperty(`--${attr}`, attrValue);
|
|
4700
4739
|
}
|
|
4701
4740
|
}
|
|
4702
4741
|
});
|
|
4703
4742
|
}
|
|
4704
|
-
updateHighlight(items) {
|
|
4743
|
+
updateHighlight(items, preventScroll = false) {
|
|
4705
4744
|
items.forEach((item, index) => {
|
|
4706
4745
|
const isHighlighted = index === this.highlightedIndex;
|
|
4707
4746
|
item.classList.toggle("highlighted", isHighlighted);
|
|
4708
|
-
if (isHighlighted) {
|
|
4747
|
+
if (isHighlighted && !preventScroll) {
|
|
4709
4748
|
item.scrollIntoView({ block: "nearest" });
|
|
4710
4749
|
}
|
|
4711
4750
|
});
|
|
@@ -5563,6 +5602,476 @@ if (!customElements.get("wavelength-slider")) {
|
|
|
5563
5602
|
customElements.define("wavelength-slider", WavelengthSlider);
|
|
5564
5603
|
}
|
|
5565
5604
|
|
|
5605
|
+
// src/web-components/wavelength-sidebar.ts
|
|
5606
|
+
var template7 = `
|
|
5607
|
+
<style>
|
|
5608
|
+
:host {
|
|
5609
|
+
display: block;
|
|
5610
|
+
--bg-color: #1a1a2e;
|
|
5611
|
+
--txt-color: white;
|
|
5612
|
+
--label-color: white;
|
|
5613
|
+
--item-color: white;
|
|
5614
|
+
--arrow-color: white;
|
|
5615
|
+
--margin-top: 0px;
|
|
5616
|
+
--margin-bottom: 0px;
|
|
5617
|
+
--width: 240px;
|
|
5618
|
+
--height: auto;
|
|
5619
|
+
--global-border-radius: 12px;
|
|
5620
|
+
font-family: "Segoe UI", sans-serif;
|
|
5621
|
+
height: var(--height, auto);
|
|
5622
|
+
}
|
|
5623
|
+
.container {
|
|
5624
|
+
display: flex;
|
|
5625
|
+
flex-direction: column;
|
|
5626
|
+
margin-top: var(--margin-top, 0px);
|
|
5627
|
+
margin-bottom: var(--margin-bottom, 0px);
|
|
5628
|
+
width: var(--width, 240px);
|
|
5629
|
+
height: 100%;
|
|
5630
|
+
background-color: var(--bg-color, #1a1a2e);
|
|
5631
|
+
border-radius: var(--global-border-radius);
|
|
5632
|
+
overflow: hidden;
|
|
5633
|
+
overflow-y: auto;
|
|
5634
|
+
-webkit-overflow-scrolling: touch;
|
|
5635
|
+
box-sizing: border-box;
|
|
5636
|
+
}
|
|
5637
|
+
.container::-webkit-scrollbar {
|
|
5638
|
+
width: 6px;
|
|
5639
|
+
}
|
|
5640
|
+
.container::-webkit-scrollbar-track {
|
|
5641
|
+
background: transparent;
|
|
5642
|
+
margin: 10px 0;
|
|
5643
|
+
}
|
|
5644
|
+
.container::-webkit-scrollbar-thumb {
|
|
5645
|
+
background: color-mix(in srgb, var(--bg-color) 80%, white 20%);
|
|
5646
|
+
border-radius: 10px;
|
|
5647
|
+
}
|
|
5648
|
+
.container::-webkit-scrollbar-thumb:hover {
|
|
5649
|
+
background: color-mix(in srgb, var(--bg-color) 60%, white 40%);
|
|
5650
|
+
}
|
|
5651
|
+
.collapsible {
|
|
5652
|
+
display: flex;
|
|
5653
|
+
align-items: center;
|
|
5654
|
+
gap: 8px;
|
|
5655
|
+
background: none;
|
|
5656
|
+
border: none;
|
|
5657
|
+
cursor: pointer;
|
|
5658
|
+
width: 100%;
|
|
5659
|
+
padding: 10px 16px;
|
|
5660
|
+
text-align: left;
|
|
5661
|
+
font-size: 14px;
|
|
5662
|
+
font-weight: 700;
|
|
5663
|
+
color: var(--txt-color);
|
|
5664
|
+
letter-spacing: 0.04em;
|
|
5665
|
+
text-transform: uppercase;
|
|
5666
|
+
transition: background 0.2s;
|
|
5667
|
+
}
|
|
5668
|
+
.collapsible:hover {
|
|
5669
|
+
background-color: color-mix(in srgb, var(--bg-color) 80%, white 20%);
|
|
5670
|
+
}
|
|
5671
|
+
.arrow {
|
|
5672
|
+
width: 16px;
|
|
5673
|
+
height: 16px;
|
|
5674
|
+
flex-shrink: 0;
|
|
5675
|
+
transition: transform 0.3s ease;
|
|
5676
|
+
color: var(--arrow-color);
|
|
5677
|
+
}
|
|
5678
|
+
.collapsible.open .arrow {
|
|
5679
|
+
transform: rotate(270deg);
|
|
5680
|
+
}
|
|
5681
|
+
.arrow path {
|
|
5682
|
+
fill: none !important;
|
|
5683
|
+
stroke: var(--arrow-color);
|
|
5684
|
+
}
|
|
5685
|
+
|
|
5686
|
+
.panel {
|
|
5687
|
+
overflow: hidden;
|
|
5688
|
+
max-height: 0;
|
|
5689
|
+
transition: max-height 0.3s ease;
|
|
5690
|
+
}
|
|
5691
|
+
|
|
5692
|
+
.subheading {
|
|
5693
|
+
padding: 8px 16px 4px 32px;
|
|
5694
|
+
font-size: 11px;
|
|
5695
|
+
font-weight: 600;
|
|
5696
|
+
letter-spacing: 0.08em;
|
|
5697
|
+
text-transform: uppercase;
|
|
5698
|
+
color: var(--label-color);
|
|
5699
|
+
}
|
|
5700
|
+
|
|
5701
|
+
.item-btn {
|
|
5702
|
+
display: block;
|
|
5703
|
+
width: 100%;
|
|
5704
|
+
background: none;
|
|
5705
|
+
border: none;
|
|
5706
|
+
cursor: pointer;
|
|
5707
|
+
padding: 7px 16px 7px 44px;
|
|
5708
|
+
text-align: left;
|
|
5709
|
+
font-size: 13px;
|
|
5710
|
+
color: var(--item-color);
|
|
5711
|
+
transition: background 0.15s;
|
|
5712
|
+
border-radius: 0;
|
|
5713
|
+
}
|
|
5714
|
+
|
|
5715
|
+
.item-btn:hover {
|
|
5716
|
+
background-color: color-mix(in srgb, var(--bg-color) 80%, white 20%);
|
|
5717
|
+
}
|
|
5718
|
+
|
|
5719
|
+
.item-btn {
|
|
5720
|
+
position: relative;
|
|
5721
|
+
overflow: hidden;
|
|
5722
|
+
}
|
|
5723
|
+
|
|
5724
|
+
.item-btn::after {
|
|
5725
|
+
content: "";
|
|
5726
|
+
position: absolute;
|
|
5727
|
+
inset: 0;
|
|
5728
|
+
background: radial-gradient(circle, rgba(255, 255, 255, 0.35) 0%, transparent 70%);
|
|
5729
|
+
opacity: 0;
|
|
5730
|
+
transform: scale(0);
|
|
5731
|
+
border-radius: inherit;
|
|
5732
|
+
pointer-events: none;
|
|
5733
|
+
transition: none;
|
|
5734
|
+
}
|
|
5735
|
+
|
|
5736
|
+
.item-btn:active {
|
|
5737
|
+
background-color: color-mix(in srgb, var(--bg-color) 65%, white 35%);
|
|
5738
|
+
transform: scale(0.98);
|
|
5739
|
+
transition:
|
|
5740
|
+
transform 0.08s ease,
|
|
5741
|
+
background-color 0.08s ease;
|
|
5742
|
+
}
|
|
5743
|
+
|
|
5744
|
+
.item-btn:active::after {
|
|
5745
|
+
animation: ripple 0.4s ease-out forwards;
|
|
5746
|
+
}
|
|
5747
|
+
|
|
5748
|
+
@keyframes ripple {
|
|
5749
|
+
0% {
|
|
5750
|
+
opacity: 1;
|
|
5751
|
+
transform: scale(0);
|
|
5752
|
+
}
|
|
5753
|
+
100% {
|
|
5754
|
+
opacity: 0;
|
|
5755
|
+
transform: scale(2.5);
|
|
5756
|
+
}
|
|
5757
|
+
}
|
|
5758
|
+
|
|
5759
|
+
.collapsible:active {
|
|
5760
|
+
background-color: color-mix(in srgb, var(--bg-color) 65%, white 35%);
|
|
5761
|
+
transform: scale(0.99);
|
|
5762
|
+
transition:
|
|
5763
|
+
transform 0.08s ease,
|
|
5764
|
+
background-color 0.08s ease;
|
|
5765
|
+
}
|
|
5766
|
+
</style>
|
|
5767
|
+
<div id="container" class="container"></div>
|
|
5768
|
+
`;
|
|
5769
|
+
var WavelengthSideBar = class extends HTMLElement {
|
|
5770
|
+
constructor() {
|
|
5771
|
+
super();
|
|
5772
|
+
this._sections = [];
|
|
5773
|
+
this.shadow = this.attachShadow({ mode: "open" });
|
|
5774
|
+
this.shadow.innerHTML = template7;
|
|
5775
|
+
}
|
|
5776
|
+
static get observedAttributes() {
|
|
5777
|
+
return ["sections"];
|
|
5778
|
+
}
|
|
5779
|
+
get sections() {
|
|
5780
|
+
return this._sections;
|
|
5781
|
+
}
|
|
5782
|
+
set sections(value) {
|
|
5783
|
+
this._sections = value;
|
|
5784
|
+
this._render();
|
|
5785
|
+
}
|
|
5786
|
+
connectedCallback() {
|
|
5787
|
+
this.container = this.shadowRoot.querySelector("#container");
|
|
5788
|
+
this._render();
|
|
5789
|
+
}
|
|
5790
|
+
attributeChangedCallback(name, oldValue, newValue) {
|
|
5791
|
+
if (oldValue === newValue) return;
|
|
5792
|
+
if (name === "sections") {
|
|
5793
|
+
try {
|
|
5794
|
+
this.sections = JSON.parse(newValue);
|
|
5795
|
+
} catch (e) {
|
|
5796
|
+
console.error("WavelengthSideBar: Invalid JSON in attribute");
|
|
5797
|
+
}
|
|
5798
|
+
}
|
|
5799
|
+
}
|
|
5800
|
+
_render() {
|
|
5801
|
+
if (!this.container) return;
|
|
5802
|
+
this.container.innerHTML = "";
|
|
5803
|
+
if (!this._sections || !this._sections.length) return;
|
|
5804
|
+
const svgArrow = `
|
|
5805
|
+
<svg class="arrow" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" transform="rotate(180)" fill="none">
|
|
5806
|
+
<path d="M15 6L9 12L15 18" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" fill="none" stroke="currentColor"></path>
|
|
5807
|
+
</svg>
|
|
5808
|
+
`;
|
|
5809
|
+
this._sections.forEach((section) => {
|
|
5810
|
+
const sectionWrapper = document.createElement("div");
|
|
5811
|
+
sectionWrapper.style.display = "flex";
|
|
5812
|
+
sectionWrapper.style.flexDirection = "column";
|
|
5813
|
+
const button = document.createElement("button");
|
|
5814
|
+
button.classList.add("collapsible");
|
|
5815
|
+
button.innerHTML = `${svgArrow} <span>${section.title || section}</span>`;
|
|
5816
|
+
const panel = document.createElement("div");
|
|
5817
|
+
panel.classList.add("panel");
|
|
5818
|
+
if (section.subsections) {
|
|
5819
|
+
section.subsections.forEach((sub) => {
|
|
5820
|
+
if (sub.title) {
|
|
5821
|
+
const subheading = document.createElement("div");
|
|
5822
|
+
subheading.classList.add("subheading");
|
|
5823
|
+
subheading.textContent = sub.title;
|
|
5824
|
+
panel.appendChild(subheading);
|
|
5825
|
+
}
|
|
5826
|
+
if (sub.items) {
|
|
5827
|
+
sub.items.forEach((item) => {
|
|
5828
|
+
const itemBtn = document.createElement("button");
|
|
5829
|
+
itemBtn.classList.add("item-btn");
|
|
5830
|
+
itemBtn.textContent = item.title || item;
|
|
5831
|
+
itemBtn.onclick = () => {
|
|
5832
|
+
this.dispatchEvent(
|
|
5833
|
+
new CustomEvent("wavelength-sidebar-item-click", {
|
|
5834
|
+
detail: { item: item.title || item, section: section.title },
|
|
5835
|
+
bubbles: true,
|
|
5836
|
+
composed: true
|
|
5837
|
+
})
|
|
5838
|
+
);
|
|
5839
|
+
};
|
|
5840
|
+
panel.appendChild(itemBtn);
|
|
5841
|
+
});
|
|
5842
|
+
}
|
|
5843
|
+
});
|
|
5844
|
+
}
|
|
5845
|
+
button.onclick = (e) => {
|
|
5846
|
+
e.stopPropagation();
|
|
5847
|
+
const isOpen = button.classList.toggle("open");
|
|
5848
|
+
panel.style.maxHeight = isOpen ? `${panel.scrollHeight}px` : "0";
|
|
5849
|
+
};
|
|
5850
|
+
sectionWrapper.appendChild(button);
|
|
5851
|
+
sectionWrapper.appendChild(panel);
|
|
5852
|
+
this.container.appendChild(sectionWrapper);
|
|
5853
|
+
});
|
|
5854
|
+
}
|
|
5855
|
+
};
|
|
5856
|
+
if (!customElements.get("wavelength-sidebar")) {
|
|
5857
|
+
customElements.define("wavelength-sidebar", WavelengthSideBar);
|
|
5858
|
+
}
|
|
5859
|
+
|
|
5860
|
+
// src/web-components/wavelength-comment-display.ts
|
|
5861
|
+
var template8 = `
|
|
5862
|
+
<style>
|
|
5863
|
+
:host {
|
|
5864
|
+
display: block;
|
|
5865
|
+
--txt-color: #000000;
|
|
5866
|
+
--bg-color: rgb(122, 204, 231);
|
|
5867
|
+
--border: 1px solid color-mix(in srgb, rgb(122, 204, 231) 50%, black 70%);
|
|
5868
|
+
--icon-selected-color: #0acd55;
|
|
5869
|
+
}
|
|
5870
|
+
|
|
5871
|
+
.outer-wrapper {
|
|
5872
|
+
display: flex;
|
|
5873
|
+
flex-direction: row;
|
|
5874
|
+
align-items: flex-start;
|
|
5875
|
+
justify-content: space-between;
|
|
5876
|
+
gap: 10px;
|
|
5877
|
+
font-family: "Montserrat", sans-serif;
|
|
5878
|
+
background-color: color-mix(in srgb, var(--bg-color) 60%, transparent);
|
|
5879
|
+
border-radius: 10px;
|
|
5880
|
+
padding: 10px;
|
|
5881
|
+
border: var(--border);
|
|
5882
|
+
width: 350px;
|
|
5883
|
+
max-width: 100%;
|
|
5884
|
+
height: fit-content;
|
|
5885
|
+
min-height: min-content;
|
|
5886
|
+
box-sizing: border-box;
|
|
5887
|
+
overflow-y: visible;
|
|
5888
|
+
}
|
|
5889
|
+
|
|
5890
|
+
.inner-wrapper {
|
|
5891
|
+
display: flex;
|
|
5892
|
+
flex-direction: column;
|
|
5893
|
+
flex: 1;
|
|
5894
|
+
gap: 10px;
|
|
5895
|
+
font-family: "Montserrat", sans-serif;
|
|
5896
|
+
}
|
|
5897
|
+
|
|
5898
|
+
.author {
|
|
5899
|
+
display: block;
|
|
5900
|
+
font-weight: bold;
|
|
5901
|
+
font-size: 14px;
|
|
5902
|
+
color: var(--txt-color);
|
|
5903
|
+
}
|
|
5904
|
+
.header {
|
|
5905
|
+
display: flex;
|
|
5906
|
+
flex-direction: column;
|
|
5907
|
+
gap: 5px;
|
|
5908
|
+
}
|
|
5909
|
+
|
|
5910
|
+
.comment {
|
|
5911
|
+
display: block;
|
|
5912
|
+
font-style: italic;
|
|
5913
|
+
color: var(--txt-color);
|
|
5914
|
+
font-size: 12px;
|
|
5915
|
+
line-height: 1.4;
|
|
5916
|
+
word-break: break-word;
|
|
5917
|
+
}
|
|
5918
|
+
|
|
5919
|
+
.date {
|
|
5920
|
+
display: block;
|
|
5921
|
+
font-size: 9px;
|
|
5922
|
+
color: #666666;
|
|
5923
|
+
}
|
|
5924
|
+
|
|
5925
|
+
.icon {
|
|
5926
|
+
flex-shrink: 0;
|
|
5927
|
+
width: 20px;
|
|
5928
|
+
height: 20px;
|
|
5929
|
+
align-self: flex-start;
|
|
5930
|
+
stroke: #807f7f;
|
|
5931
|
+
stroke-width: 2;
|
|
5932
|
+
background-color: transparent;
|
|
5933
|
+
border-radius: 50%;
|
|
5934
|
+
transition:
|
|
5935
|
+
filter 0.2s ease,
|
|
5936
|
+
background-color 0.2s ease,
|
|
5937
|
+
stroke 0.2s ease;
|
|
5938
|
+
}
|
|
5939
|
+
|
|
5940
|
+
.icon:hover {
|
|
5941
|
+
cursor: pointer;
|
|
5942
|
+
filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.2));
|
|
5943
|
+
background-color: rgba(0, 0, 0, 0.08);
|
|
5944
|
+
}
|
|
5945
|
+
|
|
5946
|
+
.icon.selected {
|
|
5947
|
+
background-color: var(--icon-selected-color);
|
|
5948
|
+
}
|
|
5949
|
+
|
|
5950
|
+
.icon.selected .checkmark {
|
|
5951
|
+
stroke: #ffffff;
|
|
5952
|
+
}
|
|
5953
|
+
|
|
5954
|
+
.icon.selected .circle {
|
|
5955
|
+
stroke: var(--icon-selected-color);
|
|
5956
|
+
}
|
|
5957
|
+
</style>
|
|
5958
|
+
<div class="outer-wrapper">
|
|
5959
|
+
<div class="inner-wrapper">
|
|
5960
|
+
<div class="header">
|
|
5961
|
+
<span class="author">Ollie T. Orca</span>
|
|
5962
|
+
<span class="date">March 25, 2026</span>
|
|
5963
|
+
</div>
|
|
5964
|
+
<span class="comment">This is a comment.</span>
|
|
5965
|
+
</div>
|
|
5966
|
+
<svg class="icon" viewBox="2.5 2.5 19 19" xmlns="http://www.w3.org/2000/svg" fill="none">
|
|
5967
|
+
<g id="SVGRepo_bgCarrier" stroke-width="0"></g>
|
|
5968
|
+
<g id="SVGRepo_tracerCarrier" stroke-linecap="round" stroke-linejoin="round"></g>
|
|
5969
|
+
<g id="SVGRepo_iconCarrier">
|
|
5970
|
+
<g stroke-width="2">
|
|
5971
|
+
<path class="checkmark" stroke-linecap="round" stroke-linejoin="round" d="M8 13L10.5 15.5L16 10"></path>
|
|
5972
|
+
<path class="circle" d="M21 12C21 16.9706 16.9706 21 12 21C7.02944 21 3 16.9706 3 12C3 7.02944 7.02944 3 12 3C16.9706 3 21 7.02944 21 12Z"></path>
|
|
5973
|
+
</g>
|
|
5974
|
+
</g>
|
|
5975
|
+
</svg>
|
|
5976
|
+
</div>
|
|
5977
|
+
`;
|
|
5978
|
+
var WavelengthCommentDisplay = class extends HTMLElement {
|
|
5979
|
+
constructor() {
|
|
5980
|
+
super();
|
|
5981
|
+
this.styleAttributes = ["width", "height", "txt-color", "bg-color", "border", "icon-selected-color"];
|
|
5982
|
+
this.contentAttributes = ["author", "comment", "date"];
|
|
5983
|
+
this.handleIconClick = () => {
|
|
5984
|
+
this.selected = !this.selected;
|
|
5985
|
+
this.dispatchEvent(
|
|
5986
|
+
new CustomEvent("wl-comment-clicked", {
|
|
5987
|
+
detail: { selected: this.selected },
|
|
5988
|
+
bubbles: true,
|
|
5989
|
+
composed: true
|
|
5990
|
+
})
|
|
5991
|
+
);
|
|
5992
|
+
};
|
|
5993
|
+
this.shadow = this.attachShadow({ mode: "open" });
|
|
5994
|
+
this.shadow.innerHTML = template8;
|
|
5995
|
+
this.elements = {
|
|
5996
|
+
author: this.shadow.querySelector(".author"),
|
|
5997
|
+
comment: this.shadow.querySelector(".comment"),
|
|
5998
|
+
date: this.shadow.querySelector(".date"),
|
|
5999
|
+
icon: this.shadow.querySelector(".icon")
|
|
6000
|
+
};
|
|
6001
|
+
}
|
|
6002
|
+
static get observedAttributes() {
|
|
6003
|
+
return ["author", "comment", "date", "width", "height", "txt-color", "bg-color", "border", "icon-selected-color", "selected"];
|
|
6004
|
+
}
|
|
6005
|
+
get selected() {
|
|
6006
|
+
return this.hasAttribute("selected");
|
|
6007
|
+
}
|
|
6008
|
+
set selected(val) {
|
|
6009
|
+
if (val) {
|
|
6010
|
+
this.setAttribute("selected", "");
|
|
6011
|
+
} else {
|
|
6012
|
+
this.removeAttribute("selected");
|
|
6013
|
+
}
|
|
6014
|
+
}
|
|
6015
|
+
connectedCallback() {
|
|
6016
|
+
this.elements.icon.addEventListener("click", this.handleIconClick);
|
|
6017
|
+
this.applyStyles();
|
|
6018
|
+
this.applyContent();
|
|
6019
|
+
this.updateSelectedState();
|
|
6020
|
+
}
|
|
6021
|
+
attributeChangedCallback(name, oldValue, newValue) {
|
|
6022
|
+
if (oldValue === newValue) return;
|
|
6023
|
+
if (name === "selected") {
|
|
6024
|
+
const icon = this.elements.icon;
|
|
6025
|
+
if (this.selected) {
|
|
6026
|
+
icon.classList.add("selected");
|
|
6027
|
+
} else {
|
|
6028
|
+
icon.classList.remove("selected");
|
|
6029
|
+
}
|
|
6030
|
+
}
|
|
6031
|
+
if (this.styleAttributes.includes(name)) {
|
|
6032
|
+
this.applyStyles();
|
|
6033
|
+
}
|
|
6034
|
+
if (this.contentAttributes.includes(name)) {
|
|
6035
|
+
this.applyContent();
|
|
6036
|
+
}
|
|
6037
|
+
}
|
|
6038
|
+
disconnectedCallback() {
|
|
6039
|
+
this.elements.icon.removeEventListener("click", this.handleIconClick);
|
|
6040
|
+
}
|
|
6041
|
+
applyStyles() {
|
|
6042
|
+
this.styleAttributes.forEach((attr) => {
|
|
6043
|
+
const value = this.getAttribute(attr);
|
|
6044
|
+
if (value) {
|
|
6045
|
+
if (attr === "width" || attr === "height") {
|
|
6046
|
+
const wrapper = this.shadow.querySelector(".outer-wrapper");
|
|
6047
|
+
if (wrapper) wrapper.style.setProperty(attr, value);
|
|
6048
|
+
} else {
|
|
6049
|
+
this.style.setProperty(`--${attr}`, value);
|
|
6050
|
+
}
|
|
6051
|
+
}
|
|
6052
|
+
});
|
|
6053
|
+
}
|
|
6054
|
+
applyContent() {
|
|
6055
|
+
this.contentAttributes.forEach((attr) => {
|
|
6056
|
+
const value = this.getAttribute(attr);
|
|
6057
|
+
if (value) {
|
|
6058
|
+
const el = this.shadow.querySelector(`.${attr}`);
|
|
6059
|
+
if (el) el.textContent = value;
|
|
6060
|
+
}
|
|
6061
|
+
});
|
|
6062
|
+
}
|
|
6063
|
+
updateSelectedState() {
|
|
6064
|
+
const icon = this.elements.icon;
|
|
6065
|
+
if (!icon) return;
|
|
6066
|
+
icon.classList.toggle("selected", this.selected);
|
|
6067
|
+
}
|
|
6068
|
+
};
|
|
6069
|
+
if (!customElements.get("wavelength-comment-display")) {
|
|
6070
|
+
customElements.define("wavelength-comment-display", WavelengthCommentDisplay);
|
|
6071
|
+
}
|
|
6072
|
+
|
|
6073
|
+
|
|
6074
|
+
|
|
5566
6075
|
|
|
5567
6076
|
|
|
5568
6077
|
|
|
@@ -5593,5 +6102,5 @@ if (!customElements.get("wavelength-slider")) {
|
|
|
5593
6102
|
|
|
5594
6103
|
|
|
5595
6104
|
|
|
5596
|
-
exports.BaseWavelengthInput = BaseWavelengthInput; exports.BaseWavelengthMultiSelectAutocomplete = BaseWavelengthMultiSelectAutocomplete; exports.ChildDataTable = ChildDataTable; exports.SampleComponent = SampleComponent; exports.WavelengthBadge = WavelengthBadge; exports.WavelengthBanner = WavelengthBanner; exports.WavelengthButton = WavelengthButton; exports.WavelengthCheckbox = WavelengthCheckbox; exports.WavelengthConfirmationModal = WavelengthConfirmationModal; exports.WavelengthDatePicker = WavelengthDatePicker; exports.WavelengthDialog = WavelengthDialog; exports.WavelengthDropdown = WavelengthDropdown; exports.WavelengthFileDropZone = WavelengthFileDropZone; exports.WavelengthForm = WavelengthForm; exports.WavelengthInput = WavelengthInput; exports.WavelengthManyPlanes = WavelengthManyPlanes; exports.WavelengthMenu = WavelengthMenu; exports.WavelengthMultiSelectAutocomplete = WavelengthMultiSelectAutocomplete; exports.WavelengthNavBar = WavelengthNavBar; exports.WavelengthNotificationPanel = WavelengthNotificationPanel; exports.WavelengthPagination = WavelengthPagination; exports.WavelengthPlaneTrail = WavelengthPlaneTrail; exports.WavelengthPopUpMenu = WavelengthPopUpMenu; exports.WavelengthProgressBar = WavelengthProgressBar; exports.WavelengthSearch = WavelengthSearch; exports.WavelengthSlider = WavelengthSlider; exports.WavelengthSnackbar = WavelengthSnackbar; exports.WavelengthSwitch = WavelengthSwitch; exports.WavelengthTitleBar = WavelengthTitleBar; exports.WavelengthToolTip = WavelengthToolTip;
|
|
6105
|
+
exports.BaseWavelengthInput = BaseWavelengthInput; exports.BaseWavelengthMultiSelectAutocomplete = BaseWavelengthMultiSelectAutocomplete; exports.ChildDataTable = ChildDataTable; exports.SampleComponent = SampleComponent; exports.WavelengthBadge = WavelengthBadge; exports.WavelengthBanner = WavelengthBanner; exports.WavelengthButton = WavelengthButton; exports.WavelengthCheckbox = WavelengthCheckbox; exports.WavelengthCommentDisplay = WavelengthCommentDisplay; exports.WavelengthConfirmationModal = WavelengthConfirmationModal; exports.WavelengthDatePicker = WavelengthDatePicker; exports.WavelengthDialog = WavelengthDialog; exports.WavelengthDropdown = WavelengthDropdown; exports.WavelengthFileDropZone = WavelengthFileDropZone; exports.WavelengthForm = WavelengthForm; exports.WavelengthInput = WavelengthInput; exports.WavelengthManyPlanes = WavelengthManyPlanes; exports.WavelengthMenu = WavelengthMenu; exports.WavelengthMultiSelectAutocomplete = WavelengthMultiSelectAutocomplete; exports.WavelengthNavBar = WavelengthNavBar; exports.WavelengthNotificationPanel = WavelengthNotificationPanel; exports.WavelengthPagination = WavelengthPagination; exports.WavelengthPlaneTrail = WavelengthPlaneTrail; exports.WavelengthPopUpMenu = WavelengthPopUpMenu; exports.WavelengthProgressBar = WavelengthProgressBar; exports.WavelengthSearch = WavelengthSearch; exports.WavelengthSideBar = WavelengthSideBar; exports.WavelengthSlider = WavelengthSlider; exports.WavelengthSnackbar = WavelengthSnackbar; exports.WavelengthSwitch = WavelengthSwitch; exports.WavelengthTitleBar = WavelengthTitleBar; exports.WavelengthToolTip = WavelengthToolTip;
|
|
5597
6106
|
//# sourceMappingURL=index.cjs.map
|