@redvars/peacock 4.2.1 → 4.3.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/{BaseField-D8ByB0l3.js → BaseField-CHBcjVc2.js} +3 -3
- package/dist/{BaseField-D8ByB0l3.js.map → BaseField-CHBcjVc2.js.map} +1 -1
- package/dist/{BaseInput-xCHvT4AN.js → BaseInput-DZp2O8Gh.js} +2 -2
- package/dist/{BaseInput-xCHvT4AN.js.map → BaseInput-DZp2O8Gh.js.map} +1 -1
- package/dist/ai-badge.js +2 -2
- package/dist/ai-summary.js +2 -2
- package/dist/alert.js +2 -2
- package/dist/anchor-nav.js +2 -2
- package/dist/app-shell.js +2 -2
- package/dist/assistant-panel.js +2 -2
- package/dist/assistant-step.js +2 -2
- package/dist/assistant-steps.js +2 -2
- package/dist/avatar-group.js +2 -2
- package/dist/banner.js +2 -2
- package/dist/{base-progress-DxNgAQtw.js → base-progress-CKQ32Ruw.js} +2 -2
- package/dist/{base-progress-DxNgAQtw.js.map → base-progress-CKQ32Ruw.js.map} +1 -1
- package/dist/bottom-sheet.js +2 -2
- package/dist/breadcrumb.js +2 -2
- package/dist/calendar.js +2 -2
- package/dist/{canvas-base-DHKf2CmA.js → canvas-base-BoKef3yr.js} +2 -2
- package/dist/{canvas-base-DHKf2CmA.js.map → canvas-base-BoKef3yr.js.map} +1 -1
- package/dist/carousel.js +644 -0
- package/dist/carousel.js.map +1 -0
- package/dist/{cartesian-chart-G6VX1aKk.js → cartesian-chart-DqZxnoG1.js} +2 -2
- package/dist/{cartesian-chart-G6VX1aKk.js.map → cartesian-chart-DqZxnoG1.js.map} +1 -1
- package/dist/{cb-group-base-CZLzCnXK.js → cb-group-base-Bf7iOIGS.js} +2 -2
- package/dist/{cb-group-base-CZLzCnXK.js.map → cb-group-base-Bf7iOIGS.js.map} +1 -1
- package/dist/cb-group.js +3 -3
- package/dist/cb-rule.js +3 -3
- package/dist/chart-area.js +4 -4
- package/dist/chart-bar.js +4 -4
- package/dist/{chart-base-DREru2P0.js → chart-base-ByCJM_9C.js} +2 -2
- package/dist/{chart-base-DREru2P0.js.map → chart-base-ByCJM_9C.js.map} +1 -1
- package/dist/chart-doughnut.js +3 -3
- package/dist/chart-line.js +4 -4
- package/dist/chart-pie.js +3 -3
- package/dist/chat-event.js +2 -2
- package/dist/chat-message.js +2 -2
- package/dist/chat-thread.js +2 -2
- package/dist/checkbox-group.js +3 -3
- package/dist/checkbox.js +3 -3
- package/dist/chip-set.js +2 -2
- package/dist/chip.js +2 -2
- package/dist/circular-progress.js +3 -3
- package/dist/citation.js +2 -2
- package/dist/code-editor.js +3 -3
- package/dist/code-highlighter.js +2 -2
- package/dist/color-field.js +4 -4
- package/dist/color-picker.js +2 -2
- package/dist/command-palette.js +2 -2
- package/dist/comment-composer.js +4 -4
- package/dist/condition-builder.js +3 -3
- package/dist/confirm-dialog.js +2 -2
- package/dist/copy-button.js +2 -2
- package/dist/currency-field.js +4 -4
- package/dist/custom-elements-jsdocs.json +902 -74
- package/dist/custom-elements.json +2842 -1
- package/dist/date-field.js +5 -5
- package/dist/date-picker.js +2 -2
- package/dist/date-range-field.js +5 -5
- package/dist/datetime-field.js +5 -5
- package/dist/dependency-map.js +3 -3
- package/dist/description-item.js +2 -2
- package/dist/description-list.js +2 -2
- package/dist/{diagram-CHF70xTL.js → diagram-Cnrj-4y3.js} +2 -2
- package/dist/{diagram-CHF70xTL.js.map → diagram-Cnrj-4y3.js.map} +1 -1
- package/dist/diagram-controls.js +2 -2
- package/dist/diagram-minimap.js +2 -2
- package/dist/diagram.js +4 -4
- package/dist/diff-viewer.js +2 -2
- package/dist/discussion-activity.js +2 -2
- package/dist/discussion-comment.js +2 -2
- package/dist/discussion.js +4 -4
- package/dist/{document-editor-Cb9fCxvA.js → document-editor-C8ThjDQ7.js} +2 -2
- package/dist/{document-editor-Cb9fCxvA.js.map → document-editor-C8ThjDQ7.js.map} +1 -1
- package/dist/document-editor.js +3 -3
- package/dist/draft-card.js +2 -2
- package/dist/erd.js +3 -3
- package/dist/file-upload.js +3 -3
- package/dist/filter-bar.js +2 -2
- package/dist/flow.js +4 -4
- package/dist/form.js +2 -2
- package/dist/{generative-view-C4fJ2zI7.js → generative-view-CQ8-g1wY.js} +2 -2
- package/dist/{generative-view-C4fJ2zI7.js.map → generative-view-CQ8-g1wY.js.map} +1 -1
- package/dist/generative-view.js +3 -3
- package/dist/highlight-Be0wu7kh.js +252 -0
- package/dist/highlight-Be0wu7kh.js.map +1 -0
- package/dist/highlight.js +6 -0
- package/dist/highlight.js.map +1 -0
- package/dist/html-editor.js +4 -4
- package/dist/{i18n-controller-CH4e9sju.js → i18n-controller-DLJcJ5gO.js} +2 -2
- package/dist/{i18n-controller-CH4e9sju.js.map → i18n-controller-DLJcJ5gO.js.map} +1 -1
- package/dist/image.js +2 -2
- package/dist/index.js +26 -16
- package/dist/index.js.map +1 -1
- package/dist/inline-edit.js +2 -2
- package/dist/input.js +3 -3
- package/dist/json-viewer.js +2 -2
- package/dist/kanban.js +2 -2
- package/dist/kbd.js +2 -2
- package/dist/linear-progress.js +3 -3
- package/dist/listbox.js +2 -2
- package/dist/loader-full.js +19 -9
- package/dist/loader-full.js.map +1 -1
- package/dist/loader.js +46 -9
- package/dist/loader.js.map +1 -1
- package/dist/markdown-editor.js +4 -4
- package/dist/mention-input.js +4 -4
- package/dist/modal.js +2 -2
- package/dist/navigation-bar.js +2 -2
- package/dist/navigation-drawer.js +2 -2
- package/dist/navigation-rail.js +2 -2
- package/dist/notification-center.js +2 -2
- package/dist/number-field.js +4 -4
- package/dist/page-header.js +2 -2
- package/dist/pagination.js +2 -2
- package/dist/password-field.js +4 -4
- package/dist/password-rules.js +2 -2
- package/dist/phone-field.js +4 -4
- package/dist/{picker-field-loXW-xrW.js → picker-field-B5xOFc3-.js} +3 -3
- package/dist/{picker-field-loXW-xrW.js.map → picker-field-B5xOFc3-.js.map} +1 -1
- package/dist/pin-input.js +4 -4
- package/dist/presence-indicator.js +2 -2
- package/dist/prompt-input.js +4 -4
- package/dist/radio.js +3 -3
- package/dist/rating.js +3 -3
- package/dist/redvars-loader.js +2 -2
- package/dist/relative-time.js +2 -2
- package/dist/resizable-panels.js +2 -2
- package/dist/{rich-text-input-B5j0eqCJ.js → rich-text-input-C4B9D6oD.js} +3 -3
- package/dist/{rich-text-input-B5j0eqCJ.js.map → rich-text-input-C4B9D6oD.js.map} +1 -1
- package/dist/{schema-BJzlGRP1.js → schema-CPhNrjrx.js} +2 -2
- package/dist/{schema-BJzlGRP1.js.map → schema-CPhNrjrx.js.map} +1 -1
- package/dist/search.js +3 -3
- package/dist/select.js +4 -4
- package/dist/side-sheet.js +2 -2
- package/dist/signature-pad.js +3 -3
- package/dist/site-footer-group.js +142 -0
- package/dist/site-footer-group.js.map +1 -0
- package/dist/site-footer.js +338 -0
- package/dist/site-footer.js.map +1 -0
- package/dist/site-header.js +774 -0
- package/dist/site-header.js.map +1 -0
- package/dist/site-nav-group.js +123 -0
- package/dist/site-nav-group.js.map +1 -0
- package/dist/site-nav-link.js +321 -0
- package/dist/site-nav-link.js.map +1 -0
- package/dist/site-nav-menu.js +506 -0
- package/dist/site-nav-menu.js.map +1 -0
- package/dist/site-nav-shared-BDR2HG8e.js +23 -0
- package/dist/site-nav-shared-BDR2HG8e.js.map +1 -0
- package/dist/slider.js +3 -3
- package/dist/snackbar.js +2 -2
- package/dist/sparkline.js +2 -2
- package/dist/split-button.js +2 -2
- package/dist/src/__internal/i18n/strings.d.ts +24 -0
- package/dist/src/carousel/carousel.d.ts +135 -0
- package/dist/src/carousel/index.d.ts +1 -0
- package/dist/src/highlight/highlight.d.ts +56 -0
- package/dist/src/highlight/index.d.ts +2 -0
- package/dist/src/highlight/matches.d.ts +9 -0
- package/dist/src/index.d.ts +9 -0
- package/dist/src/site-footer/index.d.ts +2 -0
- package/dist/src/site-footer/site-footer-group.d.ts +34 -0
- package/dist/src/site-footer/site-footer.d.ts +74 -0
- package/dist/src/site-header/index.d.ts +4 -0
- package/dist/src/site-header/site-header.d.ts +170 -0
- package/dist/src/site-header/site-nav-group.d.ts +32 -0
- package/dist/src/site-header/site-nav-link.d.ts +65 -0
- package/dist/src/site-header/site-nav-menu.d.ts +104 -0
- package/dist/src/site-header/site-nav-shared.d.ts +13 -0
- package/dist/src/video/index.d.ts +2 -0
- package/dist/src/video/video-source.d.ts +12 -0
- package/dist/src/video/video.d.ts +80 -0
- package/dist/stat.js +2 -2
- package/dist/status-indicator.js +2 -2
- package/dist/step.js +2 -2
- package/dist/stepper.js +2 -2
- package/dist/{strings-o6v6Hrmn.js → strings-MXyrGrNs.js} +28 -1
- package/dist/strings-MXyrGrNs.js.map +1 -0
- package/dist/svg.js +2 -2
- package/dist/switch.js +3 -3
- package/dist/table.js +2 -2
- package/dist/test/carousel.test.d.ts +1 -0
- package/dist/test/highlight.test.d.ts +1 -0
- package/dist/test/site-footer.test.d.ts +1 -0
- package/dist/test/site-header.test.d.ts +1 -0
- package/dist/test/video.test.d.ts +1 -0
- package/dist/textarea.js +4 -4
- package/dist/time-field.js +5 -5
- package/dist/time-picker.js +2 -2
- package/dist/timeline-item.js +2 -2
- package/dist/timeline.js +2 -2
- package/dist/{toggle-base-BSzBnLZN.js → toggle-base-I1wE_fVe.js} +2 -2
- package/dist/{toggle-base-BSzBnLZN.js.map → toggle-base-I1wE_fVe.js.map} +1 -1
- package/dist/tour.js +2 -2
- package/dist/transfer-list.js +3 -3
- package/dist/tree-chart.js +3 -3
- package/dist/tree-item.js +2 -2
- package/dist/tree.js +2 -2
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/typing-indicator.js +2 -2
- package/dist/url-field.js +4 -4
- package/dist/user-menu.js +2 -2
- package/dist/video-IwNmHyft.js +509 -0
- package/dist/video-IwNmHyft.js.map +1 -0
- package/dist/video.js +12 -0
- package/dist/video.js.map +1 -0
- package/dist/virtual-list.js +2 -2
- package/dist/workflow-timeline.js +2 -2
- package/dist/workflow.js +3 -3
- package/dist/workspace-switcher.js +2 -2
- package/package.json +1 -1
- package/readme.md +5 -0
- package/src/__internal/i18n/strings.ts +31 -0
- package/src/carousel/carousel.scss +124 -0
- package/src/carousel/carousel.ts +547 -0
- package/src/carousel/index.ts +1 -0
- package/src/highlight/highlight.scss +25 -0
- package/src/highlight/highlight.ts +123 -0
- package/src/highlight/index.ts +2 -0
- package/src/highlight/matches.ts +94 -0
- package/src/index.ts +18 -0
- package/src/loader.ts +36 -0
- package/src/site-footer/index.ts +2 -0
- package/src/site-footer/site-footer-group.scss +53 -0
- package/src/site-footer/site-footer-group.ts +52 -0
- package/src/site-footer/site-footer.scss +171 -0
- package/src/site-footer/site-footer.ts +151 -0
- package/src/site-header/index.ts +8 -0
- package/src/site-header/site-header.scss +238 -0
- package/src/site-header/site-header.ts +565 -0
- package/src/site-header/site-nav-group.scss +29 -0
- package/src/site-header/site-nav-group.ts +57 -0
- package/src/site-header/site-nav-link.scss +154 -0
- package/src/site-header/site-nav-link.ts +140 -0
- package/src/site-header/site-nav-menu.scss +182 -0
- package/src/site-header/site-nav-menu.ts +336 -0
- package/src/site-header/site-nav-shared.ts +27 -0
- package/src/video/index.ts +2 -0
- package/src/video/video-source.ts +80 -0
- package/src/video/video.scss +183 -0
- package/src/video/video.ts +246 -0
- package/dist/strings-o6v6Hrmn.js.map +0 -1
|
@@ -0,0 +1,252 @@
|
|
|
1
|
+
import { i, _ as __decorate, I as IndividualComponent, a as i$1, b } from './IndividualComponent-BK7XZjE2.js';
|
|
2
|
+
import { n } from './property-B2TG3KEE.js';
|
|
3
|
+
import { r } from './state-BCeDVCI9.js';
|
|
4
|
+
import { r as resolveLocale } from './locale-DEsJZCQG.js';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Folds text for matching: lower case in the locale, accents and other combining marks removed.
|
|
8
|
+
* Returns the folded text and, for each of its code units, the original text's range it came from,
|
|
9
|
+
* so a match in the folded text maps back to the original even when folding changes lengths.
|
|
10
|
+
*/
|
|
11
|
+
function fold(text, locale) {
|
|
12
|
+
let folded = '';
|
|
13
|
+
const starts = [];
|
|
14
|
+
const ends = [];
|
|
15
|
+
let offset = 0;
|
|
16
|
+
for (const char of text) {
|
|
17
|
+
const piece = char
|
|
18
|
+
.normalize('NFD')
|
|
19
|
+
.replace(/\p{M}/gu, '')
|
|
20
|
+
.toLocaleLowerCase(locale);
|
|
21
|
+
for (let i = 0; i < piece.length; i += 1) {
|
|
22
|
+
starts.push(offset);
|
|
23
|
+
ends.push(offset + char.length);
|
|
24
|
+
}
|
|
25
|
+
// A mark that folds away, such as a combining accent, belongs to the letter before it.
|
|
26
|
+
if (!piece && ends.length)
|
|
27
|
+
ends[ends.length - 1] = offset + char.length;
|
|
28
|
+
folded += piece;
|
|
29
|
+
offset += char.length;
|
|
30
|
+
}
|
|
31
|
+
return { folded, starts, ends };
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* The words of a query to look for, longest first so a longer word wins where two overlap.
|
|
35
|
+
* One-letter words are left out when the query has longer ones, so "reset a password" does not
|
|
36
|
+
* mark every "a".
|
|
37
|
+
*/
|
|
38
|
+
function queryWords(query, locale) {
|
|
39
|
+
const words = Array.from(new Set(fold(query, locale)
|
|
40
|
+
.folded.split(/[\s\p{P}]+/u)
|
|
41
|
+
.filter(Boolean)));
|
|
42
|
+
const long = words.filter(word => [...word].length > 1);
|
|
43
|
+
return (long.length ? long : words).sort((a, b) => b.length - a.length);
|
|
44
|
+
}
|
|
45
|
+
/** Sorts ranges and merges the ones that touch or overlap. */
|
|
46
|
+
function mergeRanges(ranges, length) {
|
|
47
|
+
const sorted = ranges
|
|
48
|
+
.map(([start, end]) => [
|
|
49
|
+
Math.max(0, Math.min(start, length)),
|
|
50
|
+
Math.max(0, Math.min(end, length)),
|
|
51
|
+
])
|
|
52
|
+
.filter(([start, end]) => end > start)
|
|
53
|
+
.sort((a, b) => a[0] - b[0]);
|
|
54
|
+
const merged = [];
|
|
55
|
+
for (const range of sorted) {
|
|
56
|
+
const last = merged[merged.length - 1];
|
|
57
|
+
if (last && range[0] <= last[1])
|
|
58
|
+
last[1] = Math.max(last[1], range[1]);
|
|
59
|
+
else
|
|
60
|
+
merged.push([range[0], range[1]]);
|
|
61
|
+
}
|
|
62
|
+
return merged;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Where the words of `query` occur in `text`, each word on its own, ignoring case and accents.
|
|
66
|
+
* Ranges are sorted and do not overlap.
|
|
67
|
+
*/
|
|
68
|
+
function findMatches(text, query, locale = 'en') {
|
|
69
|
+
const words = queryWords(query, locale);
|
|
70
|
+
if (!text || !words.length)
|
|
71
|
+
return [];
|
|
72
|
+
const { folded, starts, ends } = fold(text, locale);
|
|
73
|
+
const taken = new Array(folded.length).fill(false);
|
|
74
|
+
const ranges = [];
|
|
75
|
+
for (const word of words) {
|
|
76
|
+
let from = folded.indexOf(word);
|
|
77
|
+
while (from !== -1) {
|
|
78
|
+
const to = from + word.length;
|
|
79
|
+
if (!taken.slice(from, to).some(Boolean)) {
|
|
80
|
+
taken.fill(true, from, to);
|
|
81
|
+
ranges.push([starts[from], ends[to - 1]]);
|
|
82
|
+
}
|
|
83
|
+
from = folded.indexOf(word, to);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
return mergeRanges(ranges, text.length);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
var css_248z = i`* {
|
|
90
|
+
box-sizing: border-box;
|
|
91
|
+
-webkit-tap-highlight-color: transparent;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
.screen-reader-only {
|
|
95
|
+
position: absolute !important;
|
|
96
|
+
inline-size: 1px !important;
|
|
97
|
+
block-size: 1px !important;
|
|
98
|
+
padding: 0 !important;
|
|
99
|
+
margin: -1px !important;
|
|
100
|
+
overflow: hidden !important;
|
|
101
|
+
clip-path: inset(50%) !important;
|
|
102
|
+
white-space: nowrap !important;
|
|
103
|
+
border: 0 !important;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
[hidden] {
|
|
107
|
+
display: none !important;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
@media (forced-colors: active) {
|
|
111
|
+
.selected,
|
|
112
|
+
[aria-selected=true],
|
|
113
|
+
[aria-pressed=true],
|
|
114
|
+
[aria-checked=true],
|
|
115
|
+
[aria-current]:not([aria-current=false]) {
|
|
116
|
+
outline: 2px solid Highlight;
|
|
117
|
+
outline-offset: -2px;
|
|
118
|
+
}
|
|
119
|
+
.disabled,
|
|
120
|
+
[aria-disabled=true] {
|
|
121
|
+
color: GrayText;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
:host {
|
|
125
|
+
display: inline;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
mark {
|
|
129
|
+
border-radius: var(--shape-corner-extra-small);
|
|
130
|
+
padding-inline: 0.0625rem;
|
|
131
|
+
background-color: var(--highlight-background, var(--color-tertiary-container));
|
|
132
|
+
color: var(--highlight-color, var(--color-on-tertiary-container));
|
|
133
|
+
box-decoration-break: clone;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
@media (forced-colors: active) {
|
|
137
|
+
mark {
|
|
138
|
+
background-color: Mark;
|
|
139
|
+
color: MarkText;
|
|
140
|
+
}
|
|
141
|
+
}`;
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* @label Highlight
|
|
145
|
+
* @tag wc-highlight
|
|
146
|
+
* @rawTag highlight
|
|
147
|
+
*
|
|
148
|
+
* @summary Marks the words of a search query in a piece of text.
|
|
149
|
+
* @overview
|
|
150
|
+
* <p>Highlight shows its text with each word of <code>query</code> marked, for search results in a
|
|
151
|
+
* knowledge base, a site search or a filtered list. Words match on their own, in any order,
|
|
152
|
+
* ignoring case and accents, so "resume" marks "Résumé".</p>
|
|
153
|
+
* <p>It reads its children as plain text and never parses HTML, so text from records or a search
|
|
154
|
+
* index is safe to put in it. When the server already knows where the matches are, set
|
|
155
|
+
* <code>ranges</code> instead of <code>query</code>.</p>
|
|
156
|
+
* <p>Marks use the tertiary container colour, so they differ from links and from the selection.</p>
|
|
157
|
+
*
|
|
158
|
+
* @slot - The text. Only its text content is used; markup in it is not rendered.
|
|
159
|
+
*
|
|
160
|
+
* @csspart mark - Each marked run of text, a `<mark>` element.
|
|
161
|
+
*
|
|
162
|
+
* @cssprop --highlight-background - Background of the marks. Defaults to `--color-tertiary-container`.
|
|
163
|
+
* @cssprop --highlight-color - Text colour of the marks. Defaults to `--color-on-tertiary-container`.
|
|
164
|
+
*
|
|
165
|
+
* @example
|
|
166
|
+
* ```html
|
|
167
|
+
* <wc-highlight query="reset password">
|
|
168
|
+
* If you forgot your password, choose Forgot password and reset it from the link we email you.
|
|
169
|
+
* </wc-highlight>
|
|
170
|
+
* ```
|
|
171
|
+
* @tags display search
|
|
172
|
+
*/
|
|
173
|
+
let Highlight = class Highlight extends i$1 {
|
|
174
|
+
constructor() {
|
|
175
|
+
// ── Static ───────────────────────────────────────────────────────────────
|
|
176
|
+
super(...arguments);
|
|
177
|
+
// ── Properties ───────────────────────────────────────────────────────────
|
|
178
|
+
/** The search query whose words are marked. */
|
|
179
|
+
this.query = '';
|
|
180
|
+
// ── State ────────────────────────────────────────────────────────────────
|
|
181
|
+
/** The element's text content. */
|
|
182
|
+
this.text = '';
|
|
183
|
+
// ── Private fields ───────────────────────────────────────────────────────
|
|
184
|
+
/** Watches the text, so the marks follow when it changes. */
|
|
185
|
+
this.textObserver = new MutationObserver(() => this.syncText());
|
|
186
|
+
}
|
|
187
|
+
// ── Lifecycle ────────────────────────────────────────────────────────────
|
|
188
|
+
connectedCallback() {
|
|
189
|
+
super.connectedCallback();
|
|
190
|
+
this.syncText();
|
|
191
|
+
this.textObserver.observe(this, {
|
|
192
|
+
childList: true,
|
|
193
|
+
characterData: true,
|
|
194
|
+
subtree: true,
|
|
195
|
+
});
|
|
196
|
+
}
|
|
197
|
+
disconnectedCallback() {
|
|
198
|
+
this.textObserver.disconnect();
|
|
199
|
+
super.disconnectedCallback();
|
|
200
|
+
}
|
|
201
|
+
willUpdate(changed) {
|
|
202
|
+
super.willUpdate(changed);
|
|
203
|
+
this.syncText();
|
|
204
|
+
}
|
|
205
|
+
// ── Private methods ──────────────────────────────────────────────────────
|
|
206
|
+
/** The runs to mark, as `[start, end)` offsets in the text. */
|
|
207
|
+
get marks() {
|
|
208
|
+
if (this.ranges)
|
|
209
|
+
return mergeRanges(this.ranges, this.text.length);
|
|
210
|
+
return findMatches(this.text, this.query, resolveLocale(this.locale, this));
|
|
211
|
+
}
|
|
212
|
+
syncText() {
|
|
213
|
+
// Kept as is, so `ranges` offsets match the text; CSS collapses the whitespace when it renders.
|
|
214
|
+
const text = this.textContent ?? '';
|
|
215
|
+
if (text !== this.text)
|
|
216
|
+
this.text = text;
|
|
217
|
+
}
|
|
218
|
+
// ── Render ───────────────────────────────────────────────────────────────
|
|
219
|
+
render() {
|
|
220
|
+
const { text } = this;
|
|
221
|
+
const pieces = [];
|
|
222
|
+
let at = 0;
|
|
223
|
+
for (const [start, end] of this.marks) {
|
|
224
|
+
if (start > at)
|
|
225
|
+
pieces.push(text.slice(at, start));
|
|
226
|
+
pieces.push(b `<mark part="mark">${text.slice(start, end)}</mark>`);
|
|
227
|
+
at = end;
|
|
228
|
+
}
|
|
229
|
+
if (at < text.length)
|
|
230
|
+
pieces.push(text.slice(at));
|
|
231
|
+
return b `${pieces}`;
|
|
232
|
+
}
|
|
233
|
+
};
|
|
234
|
+
Highlight.styles = [css_248z];
|
|
235
|
+
__decorate([
|
|
236
|
+
n({ reflect: true })
|
|
237
|
+
], Highlight.prototype, "query", void 0);
|
|
238
|
+
__decorate([
|
|
239
|
+
n({ attribute: false })
|
|
240
|
+
], Highlight.prototype, "ranges", void 0);
|
|
241
|
+
__decorate([
|
|
242
|
+
n({ reflect: true })
|
|
243
|
+
], Highlight.prototype, "locale", void 0);
|
|
244
|
+
__decorate([
|
|
245
|
+
r()
|
|
246
|
+
], Highlight.prototype, "text", void 0);
|
|
247
|
+
Highlight = __decorate([
|
|
248
|
+
IndividualComponent
|
|
249
|
+
], Highlight);
|
|
250
|
+
|
|
251
|
+
export { Highlight as H, findMatches as f };
|
|
252
|
+
//# sourceMappingURL=highlight-Be0wu7kh.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"highlight-Be0wu7kh.js","sources":["../../src/highlight/matches.ts","../../src/highlight/highlight.ts"],"sourcesContent":["/** A run of marked text: `[start, end)` in UTF-16 code units of the original text. */\nexport type HighlightRange = [start: number, end: number];\n\n/**\n * Folds text for matching: lower case in the locale, accents and other combining marks removed.\n * Returns the folded text and, for each of its code units, the original text's range it came from,\n * so a match in the folded text maps back to the original even when folding changes lengths.\n */\nfunction fold(text: string, locale: string) {\n let folded = '';\n const starts: number[] = [];\n const ends: number[] = [];\n let offset = 0;\n for (const char of text) {\n const piece = char\n .normalize('NFD')\n .replace(/\\p{M}/gu, '')\n .toLocaleLowerCase(locale);\n for (let i = 0; i < piece.length; i += 1) {\n starts.push(offset);\n ends.push(offset + char.length);\n }\n // A mark that folds away, such as a combining accent, belongs to the letter before it.\n if (!piece && ends.length) ends[ends.length - 1] = offset + char.length;\n folded += piece;\n offset += char.length;\n }\n return { folded, starts, ends };\n}\n\n/**\n * The words of a query to look for, longest first so a longer word wins where two overlap.\n * One-letter words are left out when the query has longer ones, so \"reset a password\" does not\n * mark every \"a\".\n */\nfunction queryWords(query: string, locale: string): string[] {\n const words = Array.from(\n new Set(\n fold(query, locale)\n .folded.split(/[\\s\\p{P}]+/u)\n .filter(Boolean),\n ),\n );\n const long = words.filter(word => [...word].length > 1);\n return (long.length ? long : words).sort((a, b) => b.length - a.length);\n}\n\n/** Sorts ranges and merges the ones that touch or overlap. */\nexport function mergeRanges(ranges: readonly HighlightRange[], length: number) {\n const sorted = ranges\n .map(\n ([start, end]): HighlightRange => [\n Math.max(0, Math.min(start, length)),\n Math.max(0, Math.min(end, length)),\n ],\n )\n .filter(([start, end]) => end > start)\n .sort((a, b) => a[0] - b[0]);\n const merged: HighlightRange[] = [];\n for (const range of sorted) {\n const last = merged[merged.length - 1];\n if (last && range[0] <= last[1]) last[1] = Math.max(last[1], range[1]);\n else merged.push([range[0], range[1]]);\n }\n return merged;\n}\n\n/**\n * Where the words of `query` occur in `text`, each word on its own, ignoring case and accents.\n * Ranges are sorted and do not overlap.\n */\nexport function findMatches(\n text: string,\n query: string,\n locale = 'en',\n): HighlightRange[] {\n const words = queryWords(query, locale);\n if (!text || !words.length) return [];\n const { folded, starts, ends } = fold(text, locale);\n const taken = new Array<boolean>(folded.length).fill(false);\n const ranges: HighlightRange[] = [];\n for (const word of words) {\n let from = folded.indexOf(word);\n while (from !== -1) {\n const to = from + word.length;\n if (!taken.slice(from, to).some(Boolean)) {\n taken.fill(true, from, to);\n ranges.push([starts[from], ends[to - 1]]);\n }\n from = folded.indexOf(word, to);\n }\n }\n return mergeRanges(ranges, text.length);\n}\n","import { html, LitElement, type PropertyValues } from 'lit';\nimport { property, state } from 'lit/decorators.js';\nimport IndividualComponent from '@/IndividualComponent.js';\nimport { resolveLocale } from '@/__internal/i18n/locale.js';\nimport { findMatches, type HighlightRange, mergeRanges } from './matches.js';\nimport styles from './highlight.scss';\n\nexport type { HighlightRange } from './matches.js';\n\n/**\n * @label Highlight\n * @tag wc-highlight\n * @rawTag highlight\n *\n * @summary Marks the words of a search query in a piece of text.\n * @overview\n * <p>Highlight shows its text with each word of <code>query</code> marked, for search results in a\n * knowledge base, a site search or a filtered list. Words match on their own, in any order,\n * ignoring case and accents, so \"resume\" marks \"Résumé\".</p>\n * <p>It reads its children as plain text and never parses HTML, so text from records or a search\n * index is safe to put in it. When the server already knows where the matches are, set\n * <code>ranges</code> instead of <code>query</code>.</p>\n * <p>Marks use the tertiary container colour, so they differ from links and from the selection.</p>\n *\n * @slot - The text. Only its text content is used; markup in it is not rendered.\n *\n * @csspart mark - Each marked run of text, a `<mark>` element.\n *\n * @cssprop --highlight-background - Background of the marks. Defaults to `--color-tertiary-container`.\n * @cssprop --highlight-color - Text colour of the marks. Defaults to `--color-on-tertiary-container`.\n *\n * @example\n * ```html\n * <wc-highlight query=\"reset password\">\n * If you forgot your password, choose Forgot password and reset it from the link we email you.\n * </wc-highlight>\n * ```\n * @tags display search\n */\n@IndividualComponent\nexport class Highlight extends LitElement {\n // ── Static ───────────────────────────────────────────────────────────────\n\n static styles = [styles];\n\n // ── Properties ───────────────────────────────────────────────────────────\n\n /** The search query whose words are marked. */\n @property({ reflect: true })\n query = '';\n\n /**\n * Runs to mark, as `[start, end)` offsets in the element's `textContent`, for matches the server\n * already found. When set, `query` is ignored.\n */\n @property({ attribute: false })\n ranges?: HighlightRange[];\n\n /** The language to fold case in. Defaults to the nearest `lang`, else the browser's. */\n @property({ reflect: true })\n locale?: string;\n\n // ── State ────────────────────────────────────────────────────────────────\n\n /** The element's text content. */\n @state() private text = '';\n\n // ── Private fields ───────────────────────────────────────────────────────\n\n /** Watches the text, so the marks follow when it changes. */\n private readonly textObserver = new MutationObserver(() => this.syncText());\n\n // ── Lifecycle ────────────────────────────────────────────────────────────\n\n override connectedCallback() {\n super.connectedCallback();\n this.syncText();\n this.textObserver.observe(this, {\n childList: true,\n characterData: true,\n subtree: true,\n });\n }\n\n override disconnectedCallback() {\n this.textObserver.disconnect();\n super.disconnectedCallback();\n }\n\n protected override willUpdate(changed: PropertyValues<this>) {\n super.willUpdate(changed);\n this.syncText();\n }\n\n // ── Private methods ──────────────────────────────────────────────────────\n\n /** The runs to mark, as `[start, end)` offsets in the text. */\n private get marks(): HighlightRange[] {\n if (this.ranges) return mergeRanges(this.ranges, this.text.length);\n return findMatches(this.text, this.query, resolveLocale(this.locale, this));\n }\n\n private syncText() {\n // Kept as is, so `ranges` offsets match the text; CSS collapses the whitespace when it renders.\n const text = this.textContent ?? '';\n if (text !== this.text) this.text = text;\n }\n\n // ── Render ───────────────────────────────────────────────────────────────\n\n render() {\n const { text } = this;\n const pieces = [];\n let at = 0;\n for (const [start, end] of this.marks) {\n if (start > at) pieces.push(text.slice(at, start));\n pieces.push(html`<mark part=\"mark\">${text.slice(start, end)}</mark>`);\n at = end;\n }\n if (at < text.length) pieces.push(text.slice(at));\n return html`${pieces}`;\n }\n}\n"],"names":["LitElement","html","styles","property","state"],"mappings":";;;;;AAGA;;;;AAIG;AACH,SAAS,IAAI,CAAC,IAAY,EAAE,MAAc,EAAA;IACxC,IAAI,MAAM,GAAG,EAAE;IACf,MAAM,MAAM,GAAa,EAAE;IAC3B,MAAM,IAAI,GAAa,EAAE;IACzB,IAAI,MAAM,GAAG,CAAC;AACd,IAAA,KAAK,MAAM,IAAI,IAAI,IAAI,EAAE;QACvB,MAAM,KAAK,GAAG;aACX,SAAS,CAAC,KAAK;AACf,aAAA,OAAO,CAAC,SAAS,EAAE,EAAE;aACrB,iBAAiB,CAAC,MAAM,CAAC;AAC5B,QAAA,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,IAAI,CAAC,EAAE;AACxC,YAAA,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC;YACnB,IAAI,CAAC,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC;QACjC;;AAEA,QAAA,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,MAAM;AAAE,YAAA,IAAI,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,GAAG,MAAM,GAAG,IAAI,CAAC,MAAM;QACvE,MAAM,IAAI,KAAK;AACf,QAAA,MAAM,IAAI,IAAI,CAAC,MAAM;IACvB;AACA,IAAA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE;AACjC;AAEA;;;;AAIG;AACH,SAAS,UAAU,CAAC,KAAa,EAAE,MAAc,EAAA;AAC/C,IAAA,MAAM,KAAK,GAAG,KAAK,CAAC,IAAI,CACtB,IAAI,GAAG,CACL,IAAI,CAAC,KAAK,EAAE,MAAM;AACf,SAAA,MAAM,CAAC,KAAK,CAAC,aAAa;AAC1B,S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A,SAAA,CAAA,SAAA,EAAA,QAAA,EAAA,MAAA,CAAA;AAKC,UAAA,CAAA;AAAhB,IAAAC,CAAK;AAAqB,CAAA,EAAA,SAAA,CAAA,SAAA,EAAA,MAAA,EAAA,MAAA,CAAA;AAzBhB,SAAS,GAAA,UAAA,CAAA;IADrB;AACY,CAAA,EAAA,SAAS,CAkFrB;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"highlight.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;"}
|
package/dist/html-editor.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { i, _ as __decorate, I as IndividualComponent } from './IndividualComponent-BK7XZjE2.js';
|
|
2
|
-
import { R as RichTextInput } from './rich-text-input-
|
|
2
|
+
import { R as RichTextInput } from './rich-text-input-C4B9D6oD.js';
|
|
3
3
|
import './property-B2TG3KEE.js';
|
|
4
4
|
import './state-BCeDVCI9.js';
|
|
5
5
|
import './query-CHb9Ft_d.js';
|
|
@@ -17,12 +17,12 @@ import './floating-controller-CABF4tBT.js';
|
|
|
17
17
|
import './overlay-controller-BOk-kfil.js';
|
|
18
18
|
import './mention--NNhafc7.js';
|
|
19
19
|
import './url-BFUh__RO.js';
|
|
20
|
-
import './BaseInput-
|
|
20
|
+
import './BaseInput-DZp2O8Gh.js';
|
|
21
21
|
import './element-internals-QME0yEz4.js';
|
|
22
22
|
import './form-associated-BHbg72PG.js';
|
|
23
|
-
import './strings-
|
|
23
|
+
import './strings-MXyrGrNs.js';
|
|
24
24
|
import './suggestion-controller-7YRQqkaI.js';
|
|
25
|
-
import './i18n-controller-
|
|
25
|
+
import './i18n-controller-DLJcJ5gO.js';
|
|
26
26
|
|
|
27
27
|
var css_248z = i`* {
|
|
28
28
|
box-sizing: border-box;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { o as onPeacockStringsChange, p as peacockString } from './strings-
|
|
1
|
+
import { o as onPeacockStringsChange, p as peacockString } from './strings-MXyrGrNs.js';
|
|
2
2
|
import { r as resolveLocale } from './locale-DEsJZCQG.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
@@ -33,4 +33,4 @@ class I18nController {
|
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
export { I18nController as I };
|
|
36
|
-
//# sourceMappingURL=i18n-controller-
|
|
36
|
+
//# sourceMappingURL=i18n-controller-DLJcJ5gO.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"i18n-controller-
|
|
1
|
+
{"version":3,"file":"i18n-controller-DLJcJ5gO.js","sources":["../../src/__internal/i18n/i18n-controller.ts"],"sourcesContent":["import type { ReactiveController, ReactiveControllerHost } from 'lit';\nimport {\n onPeacockStringsChange,\n peacockString,\n type PeacockStringKey,\n type PeacockStrings,\n} from './strings.js';\nimport { resolveLocale } from './locale.js';\n\ntype Host = ReactiveControllerHost &\n HTMLElement & {\n /** Per-instance string overrides, on components that render many strings. */\n strings?: Partial<PeacockStrings>;\n /** The component's own locale, on components that format numbers or dates. */\n locale?: string;\n };\n\n/**\n * Gives a component its strings and locale, and re-renders it when the app calls\n * `setPeacockStrings()`.\n *\n * @example\n * private readonly i18n = new I18nController(this);\n * // in render(): aria-label=${this.i18n.t('dismiss')}\n */\nexport class I18nController implements ReactiveController {\n private readonly host: Host;\n\n private stopListening?: () => void;\n\n constructor(host: Host) {\n this.host = host;\n host.addController(this);\n }\n\n hostConnected() {\n this.stopListening = onPeacockStringsChange(() =>\n this.host.requestUpdate(),\n );\n }\n\n hostDisconnected() {\n this.stopListening?.();\n this.stopListening = undefined;\n }\n\n /** The string for `key`: the instance's override, else the app's, else the English default. */\n t<K extends PeacockStringKey>(key: K): PeacockStrings[K] {\n const override = this.host.strings?.[key];\n return (override ?? peacockString(key)) as PeacockStrings[K];\n }\n\n /** The locale to format with: the host's `locale`, else the nearest `lang`, else the browser's. */\n get locale(): string {\n return resolveLocale(this.host.locale, this.host);\n }\n}\n"],"names":[],"mappings":";;;AAiBA;;;;;;;AAOG;MACU,cAAc,CAAA;AAKzB,IAAA,WAAA,CAAY,IAAU,EAAA;AACpB,QAAA,IAAI,CAAC,IAAI,GAAG,IAAI;AAChB,QAAA,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC;IAC1B;IAEA,aAAa,GAAA;AACX,QAAA,IAAI,CAAC,aAAa,GAAG,sBAAsB,CAAC,MAC1C,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE,CAC1B;IACH;IAEA,gBAAgB,GAAA;AACd,QAAA,IAAI,CAAC,aAAa,IAAI;AACtB,QAAA,IAAI,CAAC,aAAa,GAAG,SAAS;IAChC;;AAGA,IAAA,CAAC,CAA6B,GAAM,EAAA;QAClC,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,GAAG,GAAG,CAAC;QACzC,QAAQ,QAAQ,IAAI,aAAa,CAAC,GAAG,CAAC;IACxC;;AAGA,IAAA,IAAI,MAAM,GAAA;AACR,QAAA,OAAO,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,IAAI,CAAC;IACnD;AACD;;;;"}
|
package/dist/image.js
CHANGED
|
@@ -3,9 +3,9 @@ import { n } from './property-B2TG3KEE.js';
|
|
|
3
3
|
import { r } from './state-BCeDVCI9.js';
|
|
4
4
|
import { e } from './query-CHb9Ft_d.js';
|
|
5
5
|
import { o as observeThemeChange } from './observe-theme-change-CkSENG98.js';
|
|
6
|
-
import { I as I18nController } from './i18n-controller-
|
|
6
|
+
import { I as I18nController } from './i18n-controller-DLJcJ5gO.js';
|
|
7
7
|
import './base-Cl6v8-BZ.js';
|
|
8
|
-
import './strings-
|
|
8
|
+
import './strings-MXyrGrNs.js';
|
|
9
9
|
import './locale-DEsJZCQG.js';
|
|
10
10
|
|
|
11
11
|
/**
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { d as defaultStrings, s as setPeacockStrings } from './strings-
|
|
1
|
+
export { d as defaultStrings, s as setPeacockStrings } from './strings-MXyrGrNs.js';
|
|
2
2
|
export { Icon } from './icon.js';
|
|
3
3
|
export { s as setIconBase } from './datasource-OwvH7SVq.js';
|
|
4
4
|
export { Avatar } from './avatar.js';
|
|
@@ -63,7 +63,7 @@ export { MarkdownEditor } from './markdown-editor.js';
|
|
|
63
63
|
export { Markdown } from './markdown.js';
|
|
64
64
|
export { e as extractMentions } from './markdown-lexer-Bx4Vkpu6.js';
|
|
65
65
|
export { m as mentionToMarkdown } from './mention--NNhafc7.js';
|
|
66
|
-
export { D as DocumentEditor, e as emptyDocument, n as normalizeDocument } from './document-editor-
|
|
66
|
+
export { D as DocumentEditor, e as emptyDocument, n as normalizeDocument } from './document-editor-C8ThjDQ7.js';
|
|
67
67
|
export { Image } from './image.js';
|
|
68
68
|
export { Svg } from './svg.js';
|
|
69
69
|
export { Tab } from './tab.js';
|
|
@@ -103,6 +103,15 @@ export { NavigationBarItem } from './navigation-bar-item.js';
|
|
|
103
103
|
export { NavigationDrawer } from './navigation-drawer.js';
|
|
104
104
|
export { NavigationDrawerItem } from './navigation-drawer-item.js';
|
|
105
105
|
export { NavigationDrawerGroup } from './navigation-drawer-group.js';
|
|
106
|
+
export { SiteHeader } from './site-header.js';
|
|
107
|
+
export { SiteNavMenu } from './site-nav-menu.js';
|
|
108
|
+
export { SiteNavGroup } from './site-nav-group.js';
|
|
109
|
+
export { SiteNavLink } from './site-nav-link.js';
|
|
110
|
+
export { SiteFooter } from './site-footer.js';
|
|
111
|
+
export { SiteFooterGroup } from './site-footer-group.js';
|
|
112
|
+
export { Carousel } from './carousel.js';
|
|
113
|
+
export { V as Video, p as parseVideoSource } from './video-IwNmHyft.js';
|
|
114
|
+
export { H as Highlight, f as findMatches } from './highlight-Be0wu7kh.js';
|
|
106
115
|
export { Listbox } from './listbox.js';
|
|
107
116
|
export { ListboxOption } from './listbox-option.js';
|
|
108
117
|
export { PinInput } from './pin-input.js';
|
|
@@ -161,8 +170,8 @@ export { AssistantSteps } from './assistant-steps.js';
|
|
|
161
170
|
export { AssistantStep } from './assistant-step.js';
|
|
162
171
|
export { DraftCard } from './draft-card.js';
|
|
163
172
|
export { AiSummary } from './ai-summary.js';
|
|
164
|
-
export { G as GenerativeView, p as parsePartialJson } from './generative-view-
|
|
165
|
-
export { g as generativeViewSchema } from './schema-
|
|
173
|
+
export { G as GenerativeView, p as parsePartialJson } from './generative-view-CQ8-g1wY.js';
|
|
174
|
+
export { g as generativeViewSchema } from './schema-CPhNrjrx.js';
|
|
166
175
|
export { AssistantPanel } from './assistant-panel.js';
|
|
167
176
|
export { HoverCard } from './hover-card.js';
|
|
168
177
|
export { Kanban, applyKanbanMove } from './kanban.js';
|
|
@@ -178,7 +187,7 @@ export { I as Illustration, i as illustrationNames, r as registerIllustration }
|
|
|
178
187
|
export { Calendar } from './calendar.js';
|
|
179
188
|
export { CalendarColumnView } from './calendar-column-view.js';
|
|
180
189
|
export { CalendarMonthView } from './calendar-month-view.js';
|
|
181
|
-
export { D as Diagram } from './diagram-
|
|
190
|
+
export { D as Diagram } from './diagram-Cnrj-4y3.js';
|
|
182
191
|
export { Flow } from './flow.js';
|
|
183
192
|
export { DiagramControls } from './diagram-controls.js';
|
|
184
193
|
export { Workflow } from './workflow.js';
|
|
@@ -189,7 +198,7 @@ export { Erd } from './erd.js';
|
|
|
189
198
|
export { DiagramMinimap } from './diagram-minimap.js';
|
|
190
199
|
export { ConditionBuilder } from './condition-builder.js';
|
|
191
200
|
export { CbGroup } from './cb-group.js';
|
|
192
|
-
export { C as CbRule } from './cb-group-base-
|
|
201
|
+
export { C as CbRule } from './cb-group-base-Bf7iOIGS.js';
|
|
193
202
|
export { CbDivider } from './cb-divider.js';
|
|
194
203
|
export { W as WORKFLOW_LOGIC_STEPS } from './workflow-model-CauduOG2.js';
|
|
195
204
|
import './IndividualComponent-BK7XZjE2.js';
|
|
@@ -215,38 +224,38 @@ import './warn-once-BNxX1Y98.js';
|
|
|
215
224
|
import './form-associated-BHbg72PG.js';
|
|
216
225
|
import './is-link-Dk2OV3PM.js';
|
|
217
226
|
import './hyperlink-DycWPKwU.js';
|
|
218
|
-
import './i18n-controller-
|
|
227
|
+
import './i18n-controller-DLJcJ5gO.js';
|
|
219
228
|
import './menu-trigger-controller-CEJq1ugC.js';
|
|
220
229
|
import './attachable-controller-DofeyflD.js';
|
|
221
230
|
import './query-assigned-elements-BJaGSqM0.js';
|
|
222
231
|
import './roving-focus-controller-fm95JkZJ.js';
|
|
223
232
|
import './NativeHyperlinkMixin-WdY0fM-H.js';
|
|
224
233
|
import './spread-B5cgadZl.js';
|
|
225
|
-
import './BaseInput-
|
|
234
|
+
import './BaseInput-DZp2O8Gh.js';
|
|
226
235
|
import './suggestion-controller-7YRQqkaI.js';
|
|
227
236
|
import './style-map-CHOg6N_R.js';
|
|
228
|
-
import './base-progress-
|
|
229
|
-
import './BaseField-
|
|
237
|
+
import './base-progress-CKQ32Ruw.js';
|
|
238
|
+
import './BaseField-CHBcjVc2.js';
|
|
230
239
|
import './date-vFrYT1S9.js';
|
|
231
240
|
import './utils-D92ldd1V.js';
|
|
232
|
-
import './picker-field-
|
|
241
|
+
import './picker-field-B5xOFc3-.js';
|
|
233
242
|
import './range-utils-BoKOhxVX.js';
|
|
234
|
-
import './toggle-base-
|
|
243
|
+
import './toggle-base-I1wE_fVe.js';
|
|
235
244
|
import './floating-controller-CABF4tBT.js';
|
|
236
245
|
import './placement-C4GO0JP9.js';
|
|
237
246
|
import './overlay-controller-BOk-kfil.js';
|
|
238
247
|
import './query-all-ThKhg-Lp.js';
|
|
239
248
|
import './token-colors-DEO6rvEu.js';
|
|
240
249
|
import './observe-theme-change-CkSENG98.js';
|
|
241
|
-
import './rich-text-input-
|
|
250
|
+
import './rich-text-input-C4B9D6oD.js';
|
|
242
251
|
import './slash-controller-DAsDquPA.js';
|
|
243
252
|
import './diff-CT416thw.js';
|
|
244
253
|
import './sparkle-BmtM0vbq.js';
|
|
245
254
|
import './url-BFUh__RO.js';
|
|
246
255
|
import './transform-CxeQFXXB.js';
|
|
247
|
-
import './chart-base-
|
|
256
|
+
import './chart-base-ByCJM_9C.js';
|
|
248
257
|
import './path-CJ0Arqcy.js';
|
|
249
|
-
import './cartesian-chart-
|
|
258
|
+
import './cartesian-chart-DqZxnoG1.js';
|
|
250
259
|
import './repeat-D_ERDRYT.js';
|
|
251
260
|
import './directive-helpers-Bx3mu42O.js';
|
|
252
261
|
import './virtual-window-5OYyIqZh.js';
|
|
@@ -254,12 +263,13 @@ import './modal-B78gUfEO.js';
|
|
|
254
263
|
import './live-D_5OfuGD.js';
|
|
255
264
|
import './navigation-item-base-kUrvJgCx.js';
|
|
256
265
|
import './indicator-navigation-item-CmyhsOmy.js';
|
|
266
|
+
import './site-nav-shared-BDR2HG8e.js';
|
|
257
267
|
import './platform-BUuoTAmr.js';
|
|
258
268
|
import './relative-time-BNxqvEbg.js';
|
|
259
269
|
import './discussion-time-DqykqvNy.js';
|
|
260
270
|
import './calendar-event-_OYdAT3c.js';
|
|
261
271
|
import './event-manager-CWAWPOUE.js';
|
|
262
|
-
import './canvas-base-
|
|
272
|
+
import './canvas-base-BoKef3yr.js';
|
|
263
273
|
import './geometry-INg82Lxq.js';
|
|
264
274
|
import './host-CZK7xhzh.js';
|
|
265
275
|
import './measure-controller-Dmc5hZKg.js';
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/dist/inline-edit.js
CHANGED
|
@@ -3,10 +3,10 @@ import { n } from './property-B2TG3KEE.js';
|
|
|
3
3
|
import { r } from './state-BCeDVCI9.js';
|
|
4
4
|
import { e } from './query-CHb9Ft_d.js';
|
|
5
5
|
import { e as e$1 } from './class-map-NDIkZErE.js';
|
|
6
|
-
import { I as I18nController } from './i18n-controller-
|
|
6
|
+
import { I as I18nController } from './i18n-controller-DLJcJ5gO.js';
|
|
7
7
|
import './base-Cl6v8-BZ.js';
|
|
8
8
|
import './directive-ZPhl09Yt.js';
|
|
9
|
-
import './strings-
|
|
9
|
+
import './strings-MXyrGrNs.js';
|
|
10
10
|
import './locale-DEsJZCQG.js';
|
|
11
11
|
|
|
12
12
|
var css_248z = i`* {
|
package/dist/input.js
CHANGED
|
@@ -2,12 +2,12 @@ import { i, _ as __decorate, I as IndividualComponent, A, b } from './Individual
|
|
|
2
2
|
import { n } from './property-B2TG3KEE.js';
|
|
3
3
|
import { e } from './query-CHb9Ft_d.js';
|
|
4
4
|
import { s as spread } from './spread-B5cgadZl.js';
|
|
5
|
-
import { B as BaseField } from './BaseField-
|
|
6
|
-
import { n as nativeValidity } from './BaseInput-
|
|
5
|
+
import { B as BaseField } from './BaseField-CHBcjVc2.js';
|
|
6
|
+
import { n as nativeValidity } from './BaseInput-DZp2O8Gh.js';
|
|
7
7
|
import './base-Cl6v8-BZ.js';
|
|
8
8
|
import './directive-ZPhl09Yt.js';
|
|
9
9
|
import './state-BCeDVCI9.js';
|
|
10
|
-
import './strings-
|
|
10
|
+
import './strings-MXyrGrNs.js';
|
|
11
11
|
import './element-internals-QME0yEz4.js';
|
|
12
12
|
import './form-associated-BHbg72PG.js';
|
|
13
13
|
import './suggestion-controller-7YRQqkaI.js';
|
package/dist/json-viewer.js
CHANGED
|
@@ -2,12 +2,12 @@ import { i, _ as __decorate, I as IndividualComponent, a as i$1, A, b } from './
|
|
|
2
2
|
import { n } from './property-B2TG3KEE.js';
|
|
3
3
|
import { r } from './state-BCeDVCI9.js';
|
|
4
4
|
import { c } from './repeat-D_ERDRYT.js';
|
|
5
|
-
import { I as I18nController } from './i18n-controller-
|
|
5
|
+
import { I as I18nController } from './i18n-controller-DLJcJ5gO.js';
|
|
6
6
|
import { R as RovingFocusController } from './roving-focus-controller-fm95JkZJ.js';
|
|
7
7
|
import { w as writeClipboardText } from './clipboard-C7hBdUXP.js';
|
|
8
8
|
import './directive-ZPhl09Yt.js';
|
|
9
9
|
import './directive-helpers-Bx3mu42O.js';
|
|
10
|
-
import './strings-
|
|
10
|
+
import './strings-MXyrGrNs.js';
|
|
11
11
|
import './locale-DEsJZCQG.js';
|
|
12
12
|
|
|
13
13
|
/** Keys that JSONPath can write with dot notation. */
|
package/dist/kanban.js
CHANGED
|
@@ -2,11 +2,11 @@ import { i, _ as __decorate, I as IndividualComponent, a as i$1, D, A, b } from
|
|
|
2
2
|
import { n } from './property-B2TG3KEE.js';
|
|
3
3
|
import { r } from './state-BCeDVCI9.js';
|
|
4
4
|
import { c } from './repeat-D_ERDRYT.js';
|
|
5
|
-
import { I as I18nController } from './i18n-controller-
|
|
5
|
+
import { I as I18nController } from './i18n-controller-DLJcJ5gO.js';
|
|
6
6
|
import { i as isRtl } from './locale-DEsJZCQG.js';
|
|
7
7
|
import './directive-ZPhl09Yt.js';
|
|
8
8
|
import './directive-helpers-Bx3mu42O.js';
|
|
9
|
-
import './strings-
|
|
9
|
+
import './strings-MXyrGrNs.js';
|
|
10
10
|
|
|
11
11
|
var css_248z = i`* {
|
|
12
12
|
box-sizing: border-box;
|
package/dist/kbd.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { i, _ as __decorate, I as IndividualComponent, a as i$1, b, A } from './IndividualComponent-BK7XZjE2.js';
|
|
2
2
|
import { n } from './property-B2TG3KEE.js';
|
|
3
|
-
import { I as I18nController } from './i18n-controller-
|
|
3
|
+
import { I as I18nController } from './i18n-controller-DLJcJ5gO.js';
|
|
4
4
|
import { i as isApplePlatform } from './platform-BUuoTAmr.js';
|
|
5
|
-
import './strings-
|
|
5
|
+
import './strings-MXyrGrNs.js';
|
|
6
6
|
import './locale-DEsJZCQG.js';
|
|
7
7
|
|
|
8
8
|
var css_248z = i`* {
|
package/dist/linear-progress.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { i, _ as __decorate, I as IndividualComponent, A, b } from './IndividualComponent-BK7XZjE2.js';
|
|
2
2
|
import { e } from './class-map-NDIkZErE.js';
|
|
3
3
|
import { o } from './style-map-CHOg6N_R.js';
|
|
4
|
-
import { B as BaseProgress } from './base-progress-
|
|
4
|
+
import { B as BaseProgress } from './base-progress-CKQ32Ruw.js';
|
|
5
5
|
import './directive-ZPhl09Yt.js';
|
|
6
6
|
import './property-B2TG3KEE.js';
|
|
7
|
-
import './i18n-controller-
|
|
8
|
-
import './strings-
|
|
7
|
+
import './i18n-controller-DLJcJ5gO.js';
|
|
8
|
+
import './strings-MXyrGrNs.js';
|
|
9
9
|
import './locale-DEsJZCQG.js';
|
|
10
10
|
import './delegate-Bw2wdPFP.js';
|
|
11
11
|
|
package/dist/listbox.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { i, _ as __decorate, I as IndividualComponent, b } from './IndividualComponent-BK7XZjE2.js';
|
|
2
2
|
import { n } from './property-B2TG3KEE.js';
|
|
3
|
-
import { B as BaseInput } from './BaseInput-
|
|
3
|
+
import { B as BaseInput } from './BaseInput-DZp2O8Gh.js';
|
|
4
4
|
import { R as RovingFocusController } from './roving-focus-controller-fm95JkZJ.js';
|
|
5
5
|
import { g as getFormValue } from './form-associated-BHbg72PG.js';
|
|
6
|
-
import { p as peacockString } from './strings-
|
|
6
|
+
import { p as peacockString } from './strings-MXyrGrNs.js';
|
|
7
7
|
import { ListboxOption } from './listbox-option.js';
|
|
8
8
|
import './state-BCeDVCI9.js';
|
|
9
9
|
import './element-internals-QME0yEz4.js';
|