@redvars/peacock 4.3.1 → 4.3.3

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 (187) hide show
  1. package/dist/{BaseField-CHBcjVc2.js → BaseField-DPyW5Zm5.js} +3 -3
  2. package/dist/{BaseField-CHBcjVc2.js.map → BaseField-DPyW5Zm5.js.map} +1 -1
  3. package/dist/{BaseInput-DZp2O8Gh.js → BaseInput-FhjvfMjF.js} +2 -2
  4. package/dist/{BaseInput-DZp2O8Gh.js.map → BaseInput-FhjvfMjF.js.map} +1 -1
  5. package/dist/ai-badge.js +2 -2
  6. package/dist/ai-summary.js +2 -2
  7. package/dist/alert.js +2 -2
  8. package/dist/anchor-nav.js +2 -2
  9. package/dist/app-shell.js +2 -2
  10. package/dist/assistant-panel.js +2 -2
  11. package/dist/assistant-step.js +2 -2
  12. package/dist/assistant-steps.js +2 -2
  13. package/dist/avatar-group.js +2 -2
  14. package/dist/banner.js +2 -2
  15. package/dist/{base-progress-CKQ32Ruw.js → base-progress-D8-x6XS4.js} +2 -2
  16. package/dist/{base-progress-CKQ32Ruw.js.map → base-progress-D8-x6XS4.js.map} +1 -1
  17. package/dist/bottom-sheet.js +2 -2
  18. package/dist/breadcrumb.js +2 -2
  19. package/dist/calendar.js +2 -2
  20. package/dist/{canvas-base-BoKef3yr.js → canvas-base-CjxNdEsR.js} +2 -2
  21. package/dist/{canvas-base-BoKef3yr.js.map → canvas-base-CjxNdEsR.js.map} +1 -1
  22. package/dist/carousel.js +2 -2
  23. package/dist/{cartesian-chart-DqZxnoG1.js → cartesian-chart-D30aTNVm.js} +2 -2
  24. package/dist/{cartesian-chart-DqZxnoG1.js.map → cartesian-chart-D30aTNVm.js.map} +1 -1
  25. package/dist/{cb-group-base-DHwx72Gt.js → cb-group-base-2Ps2CnBz.js} +5 -4
  26. package/dist/{cb-group-base-DHwx72Gt.js.map → cb-group-base-2Ps2CnBz.js.map} +1 -1
  27. package/dist/{cb-group-base-DXnAJxEK.js → cb-group-base-Crt0BSzR.js} +20 -69
  28. package/dist/cb-group-base-Crt0BSzR.js.map +1 -0
  29. package/dist/cb-group.js +6 -6
  30. package/dist/cb-group.js.map +1 -1
  31. package/dist/cb-rule.js +3 -3
  32. package/dist/chart-area.js +4 -4
  33. package/dist/chart-bar.js +4 -4
  34. package/dist/{chart-base-ByCJM_9C.js → chart-base-D2kPte5J.js} +2 -2
  35. package/dist/{chart-base-ByCJM_9C.js.map → chart-base-D2kPte5J.js.map} +1 -1
  36. package/dist/chart-doughnut.js +3 -3
  37. package/dist/chart-line.js +4 -4
  38. package/dist/chart-pie.js +3 -3
  39. package/dist/chat-event.js +2 -2
  40. package/dist/chat-message.js +2 -2
  41. package/dist/chat-thread.js +2 -2
  42. package/dist/checkbox-group.js +3 -3
  43. package/dist/checkbox.js +3 -3
  44. package/dist/chip-set.js +2 -2
  45. package/dist/chip.js +2 -2
  46. package/dist/circular-progress.js +3 -3
  47. package/dist/citation.js +2 -2
  48. package/dist/code-editor.js +3 -3
  49. package/dist/code-highlighter.js +2 -2
  50. package/dist/color-field.js +4 -4
  51. package/dist/color-picker.js +2 -2
  52. package/dist/command-palette.js +2 -2
  53. package/dist/comment-composer.js +4 -4
  54. package/dist/condition-builder.js +6 -6
  55. package/dist/condition-builder.js.map +1 -1
  56. package/dist/confirm-dialog.js +2 -2
  57. package/dist/copy-button.js +2 -2
  58. package/dist/currency-field.js +4 -4
  59. package/dist/custom-elements-jsdocs.json +5 -5
  60. package/dist/custom-elements.json +308 -264
  61. package/dist/date-field.js +5 -5
  62. package/dist/date-picker.js +2 -2
  63. package/dist/date-range-field.js +5 -5
  64. package/dist/datetime-field.js +5 -5
  65. package/dist/dependency-map.js +3 -3
  66. package/dist/description-item.js +2 -2
  67. package/dist/description-list.js +2 -2
  68. package/dist/{diagram-Cnrj-4y3.js → diagram-BFGq2POp.js} +2 -2
  69. package/dist/{diagram-Cnrj-4y3.js.map → diagram-BFGq2POp.js.map} +1 -1
  70. package/dist/diagram-controls.js +2 -2
  71. package/dist/diagram-minimap.js +2 -2
  72. package/dist/diagram.js +4 -4
  73. package/dist/diff-viewer.js +2 -2
  74. package/dist/discussion-activity.js +2 -2
  75. package/dist/discussion-comment.js +2 -2
  76. package/dist/discussion.js +4 -4
  77. package/dist/{document-editor-C8ThjDQ7.js → document-editor-CC7MTHMO.js} +2 -2
  78. package/dist/{document-editor-C8ThjDQ7.js.map → document-editor-CC7MTHMO.js.map} +1 -1
  79. package/dist/document-editor.js +3 -3
  80. package/dist/draft-card.js +2 -2
  81. package/dist/erd.js +3 -3
  82. package/dist/file-upload.js +3 -3
  83. package/dist/filter-bar.js +2 -2
  84. package/dist/flow.js +4 -4
  85. package/dist/form.js +2 -2
  86. package/dist/{generative-view-CQ8-g1wY.js → generative-view-DoT9YwHL.js} +2 -2
  87. package/dist/{generative-view-CQ8-g1wY.js.map → generative-view-DoT9YwHL.js.map} +1 -1
  88. package/dist/generative-view.js +3 -3
  89. package/dist/html-editor.js +4 -4
  90. package/dist/{i18n-controller-DLJcJ5gO.js → i18n-controller-Co6pasNo.js} +2 -2
  91. package/dist/{i18n-controller-DLJcJ5gO.js.map → i18n-controller-Co6pasNo.js.map} +1 -1
  92. package/dist/image.js +2 -2
  93. package/dist/index.js +18 -18
  94. package/dist/inline-edit.js +2 -2
  95. package/dist/input.js +3 -3
  96. package/dist/json-viewer.js +2 -2
  97. package/dist/kanban.js +2 -2
  98. package/dist/kbd.js +2 -2
  99. package/dist/linear-progress.js +3 -3
  100. package/dist/listbox.js +2 -2
  101. package/dist/loader-full.js +10 -10
  102. package/dist/loader.js +10 -10
  103. package/dist/markdown-editor.js +4 -4
  104. package/dist/mention-input.js +4 -4
  105. package/dist/modal.js +2 -2
  106. package/dist/navigation-bar.js +2 -2
  107. package/dist/navigation-drawer.js +2 -2
  108. package/dist/navigation-rail.js +2 -2
  109. package/dist/notification-center.js +2 -2
  110. package/dist/number-field.js +4 -4
  111. package/dist/page-header.js +2 -2
  112. package/dist/pagination.js +2 -2
  113. package/dist/password-field.js +4 -4
  114. package/dist/password-rules.js +2 -2
  115. package/dist/phone-field.js +4 -4
  116. package/dist/{picker-field-B5xOFc3-.js → picker-field-BliKNENo.js} +3 -3
  117. package/dist/{picker-field-B5xOFc3-.js.map → picker-field-BliKNENo.js.map} +1 -1
  118. package/dist/pin-input.js +4 -4
  119. package/dist/presence-indicator.js +2 -2
  120. package/dist/prompt-input.js +4 -4
  121. package/dist/radio.js +3 -3
  122. package/dist/rating.js +3 -3
  123. package/dist/redvars-loader.js +2 -2
  124. package/dist/relative-time.js +2 -2
  125. package/dist/resizable-panels.js +2 -2
  126. package/dist/{rich-text-input-C4B9D6oD.js → rich-text-input-YeqK1or-.js} +3 -3
  127. package/dist/{rich-text-input-C4B9D6oD.js.map → rich-text-input-YeqK1or-.js.map} +1 -1
  128. package/dist/{schema-CPhNrjrx.js → schema-CuHBNpzo.js} +2 -2
  129. package/dist/{schema-CPhNrjrx.js.map → schema-CuHBNpzo.js.map} +1 -1
  130. package/dist/search.js +3 -3
  131. package/dist/select.js +4 -4
  132. package/dist/side-sheet.js +2 -2
  133. package/dist/signature-pad.js +3 -3
  134. package/dist/site-header.js +2 -2
  135. package/dist/slider.js +3 -3
  136. package/dist/snackbar.js +2 -2
  137. package/dist/sparkline.js +2 -2
  138. package/dist/split-button.js +2 -2
  139. package/dist/src/__internal/i18n/strings.d.ts +6 -0
  140. package/dist/src/condition-builder/cb-group-base.d.ts +2 -14
  141. package/dist/src/condition-builder/cb-group.d.ts +2 -2
  142. package/dist/src/condition-builder/condition-builder.d.ts +2 -2
  143. package/dist/src/transfer-list/transfer-list.d.ts +49 -1
  144. package/dist/stat.js +2 -2
  145. package/dist/status-indicator.js +2 -2
  146. package/dist/step.js +2 -2
  147. package/dist/stepper.js +2 -2
  148. package/dist/{strings-MXyrGrNs.js → strings-DYwXSSu_.js} +7 -1
  149. package/dist/strings-DYwXSSu_.js.map +1 -0
  150. package/dist/svg.js +2 -2
  151. package/dist/switch.js +3 -3
  152. package/dist/table.js +2 -2
  153. package/dist/textarea.js +4 -4
  154. package/dist/time-field.js +5 -5
  155. package/dist/time-picker.js +2 -2
  156. package/dist/timeline-item.js +2 -2
  157. package/dist/timeline.js +2 -2
  158. package/dist/{toggle-base-I1wE_fVe.js → toggle-base-B-HOnUIy.js} +2 -2
  159. package/dist/{toggle-base-I1wE_fVe.js.map → toggle-base-B-HOnUIy.js.map} +1 -1
  160. package/dist/tour.js +2 -2
  161. package/dist/transfer-list.js +427 -6
  162. package/dist/transfer-list.js.map +1 -1
  163. package/dist/tree-chart.js +3 -3
  164. package/dist/tree-item.js +2 -2
  165. package/dist/tree.js +2 -2
  166. package/dist/tsconfig.tsbuildinfo +1 -1
  167. package/dist/typing-indicator.js +2 -2
  168. package/dist/url-field.js +4 -4
  169. package/dist/user-menu.js +2 -2
  170. package/dist/{video-IwNmHyft.js → video-u-Vs7M9g.js} +2 -2
  171. package/dist/{video-IwNmHyft.js.map → video-u-Vs7M9g.js.map} +1 -1
  172. package/dist/video.js +3 -3
  173. package/dist/virtual-list.js +2 -2
  174. package/dist/workflow-timeline.js +2 -2
  175. package/dist/workflow.js +3 -3
  176. package/dist/workspace-switcher.js +2 -2
  177. package/package.json +1 -1
  178. package/src/__internal/i18n/strings.ts +8 -0
  179. package/src/condition-builder/cb-group-base.scss +6 -3
  180. package/src/condition-builder/cb-group-base.ts +22 -73
  181. package/src/condition-builder/cb-group.ts +2 -2
  182. package/src/condition-builder/cb-rule.scss +4 -0
  183. package/src/condition-builder/condition-builder.ts +2 -2
  184. package/src/transfer-list/transfer-list.scss +95 -1
  185. package/src/transfer-list/transfer-list.ts +359 -2
  186. package/dist/cb-group-base-DXnAJxEK.js.map +0 -1
  187. package/dist/strings-MXyrGrNs.js.map +0 -1
@@ -1,7 +1,7 @@
1
1
  import { i, _ as __decorate, I as IndividualComponent, a as i$1, b } from './IndividualComponent-BK7XZjE2.js';
2
2
  import { n } from './property-B2TG3KEE.js';
3
- import { I as I18nController } from './i18n-controller-DLJcJ5gO.js';
4
- import './strings-MXyrGrNs.js';
3
+ import { I as I18nController } from './i18n-controller-Co6pasNo.js';
4
+ import './strings-DYwXSSu_.js';
5
5
  import './locale-DEsJZCQG.js';
6
6
 
7
7
  var css_248z = i`* {
package/dist/url-field.js CHANGED
@@ -3,12 +3,12 @@ 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 { s as spread } from './spread-B5cgadZl.js';
6
- import { I as I18nController } from './i18n-controller-DLJcJ5gO.js';
7
- import { B as BaseField } from './BaseField-CHBcjVc2.js';
8
- import { n as nativeValidity } from './BaseInput-DZp2O8Gh.js';
6
+ import { I as I18nController } from './i18n-controller-Co6pasNo.js';
7
+ import { B as BaseField } from './BaseField-DPyW5Zm5.js';
8
+ import { n as nativeValidity } from './BaseInput-FhjvfMjF.js';
9
9
  import './base-Cl6v8-BZ.js';
10
10
  import './directive-ZPhl09Yt.js';
11
- import './strings-MXyrGrNs.js';
11
+ import './strings-DYwXSSu_.js';
12
12
  import './locale-DEsJZCQG.js';
13
13
  import './element-internals-QME0yEz4.js';
14
14
  import './form-associated-BHbg72PG.js';
package/dist/user-menu.js CHANGED
@@ -2,10 +2,10 @@ 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 { e } from './query-CHb9Ft_d.js';
5
- import { I as I18nController } from './i18n-controller-DLJcJ5gO.js';
5
+ import { I as I18nController } from './i18n-controller-Co6pasNo.js';
6
6
  import { M as MenuTriggerController } from './menu-trigger-controller-CEJq1ugC.js';
7
7
  import './base-Cl6v8-BZ.js';
8
- import './strings-MXyrGrNs.js';
8
+ import './strings-DYwXSSu_.js';
9
9
  import './locale-DEsJZCQG.js';
10
10
 
11
11
  var css_248z = i`* {
@@ -3,7 +3,7 @@ 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 } from './style-map-CHOg6N_R.js';
6
- import { I as I18nController } from './i18n-controller-DLJcJ5gO.js';
6
+ import { I as I18nController } from './i18n-controller-Co6pasNo.js';
7
7
 
8
8
  const YOUTUBE_HOSTS = [
9
9
  'youtube.com',
@@ -506,4 +506,4 @@ Video = __decorate([
506
506
  ], Video);
507
507
 
508
508
  export { Video as V, parseVideoSource as p };
509
- //# sourceMappingURL=video-IwNmHyft.js.map
509
+ //# sourceMappingURL=video-u-Vs7M9g.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"video-IwNmHyft.js","sources":["../../src/video/video-source.ts","../../src/video/video.ts"],"sourcesContent":["/** Where a video plays from. */\nexport type VideoProvider = 'youtube' | 'vimeo' | 'file';\n\nexport interface VideoSource {\n provider: VideoProvider;\n /** The player URL to load on play, for YouTube and Vimeo; the file URL for a file. */\n url: string;\n}\n\nconst YOUTUBE_HOSTS = [\n 'youtube.com',\n 'www.youtube.com',\n 'm.youtube.com',\n 'music.youtube.com',\n 'youtube-nocookie.com',\n 'www.youtube-nocookie.com',\n];\n\nconst VIMEO_HOSTS = ['vimeo.com', 'www.vimeo.com', 'player.vimeo.com'];\n\n/** A YouTube time such as `90`, `90s` or `1m30s`, in whole seconds. */\nfunction seconds(time: string | null): number {\n if (!time) return 0;\n if (/^\\d+$/.test(time)) return Number(time);\n const match = /^(?:(\\d+)h)?(?:(\\d+)m)?(?:(\\d+)s)?$/.exec(time);\n if (!match) return 0;\n const [, h = '0', m = '0', s = '0'] = match;\n return Number(h) * 3600 + Number(m) * 60 + Number(s);\n}\n\nfunction youtubeId(url: URL): string | undefined {\n if (url.hostname === 'youtu.be') return url.pathname.split('/')[1];\n if (!YOUTUBE_HOSTS.includes(url.hostname)) return undefined;\n if (url.pathname === '/watch') return url.searchParams.get('v') ?? undefined;\n const [, kind, id] = url.pathname.split('/');\n return ['embed', 'shorts', 'live', 'v'].includes(kind) ? id : undefined;\n}\n\n/**\n * Reads a video URL. YouTube links play through youtube-nocookie.com and Vimeo links with\n * `dnt=1`, so neither sets tracking cookies; any other URL is treated as a video file.\n */\nexport function parseVideoSource(src: string): VideoSource {\n let url: URL;\n try {\n url = new URL(src, document.baseURI);\n } catch {\n return { provider: 'file', url: src };\n }\n\n const youtube = youtubeId(url);\n if (youtube && /^[\\w-]+$/.test(youtube)) {\n const params = new URLSearchParams({ autoplay: '1', rel: '0' });\n const start = seconds(\n url.searchParams.get('t') ?? url.searchParams.get('start'),\n );\n if (start) params.set('start', String(start));\n return {\n provider: 'youtube',\n url: `https://www.youtube-nocookie.com/embed/${youtube}?${params}`,\n };\n }\n\n if (VIMEO_HOSTS.includes(url.hostname)) {\n const parts = url.pathname.split('/').filter(Boolean);\n const at = parts[0] === 'video' ? 1 : 0;\n const id = parts[at];\n if (id && /^\\d+$/.test(id)) {\n const params = new URLSearchParams({ autoplay: '1', dnt: '1' });\n const hash = url.searchParams.get('h') ?? parts[at + 1];\n if (hash && /^\\w+$/.test(hash)) params.set('h', hash);\n return {\n provider: 'vimeo',\n url: `https://player.vimeo.com/video/${id}?${params}`,\n };\n }\n }\n\n return { provider: 'file', url: src };\n}\n","import { html, LitElement, nothing, type PropertyValues } from 'lit';\nimport { property, query, state } from 'lit/decorators.js';\nimport { styleMap } from 'lit/directives/style-map.js';\nimport IndividualComponent from '@/IndividualComponent.js';\nimport { I18nController } from '@/__internal/i18n/i18n-controller.js';\nimport {\n parseVideoSource,\n type VideoProvider,\n type VideoSource,\n} from './video-source.js';\nimport styles from './video.scss';\n\nexport type { VideoProvider } from './video-source.js';\n\n/**\n * @label Video\n * @tag wc-video\n * @rawTag video\n *\n * @summary A video from YouTube, Vimeo or a file, that loads its player only when the person presses play.\n * @overview\n * <p>Video shows a poster with a play button. A YouTube or Vimeo player loads only on that click, so\n * the page makes no request to the video site until the person asks for the video: no cookies, no\n * tracking, and a faster page. YouTube plays through <code>youtube-nocookie.com</code> and Vimeo with\n * Do Not Track, and a line on the poster says where the video plays from.</p>\n * <p>Any other <code>src</code> is a video file, shown in the browser's own player with its\n * controls. Put <code>&lt;track&gt;</code> elements in the video for captions and subtitles.</p>\n * <p>The video keeps its <code>aspect-ratio</code> before and after it loads, so nothing on the page\n * moves.</p>\n *\n * @slot - `<track>` elements for a video file's captions and subtitles.\n *\n * @csspart base - The frame that holds the poster or the player.\n * @csspart play-button - The poster button that loads and plays the video.\n * @csspart player - The `<iframe>` or `<video>`.\n *\n * @cssprop --video-shape - Corner radius of the frame. Defaults to `--shape-corner-large`.\n *\n * @fires {CustomEvent} play - Dispatched when the person starts the video: the player loads, or the file starts playing.\n *\n * @example\n * ```html\n * <wc-video\n * src=\"https://www.youtube.com/watch?v=aqz-KE-bpKQ\"\n * label=\"Build a portal in ten minutes\"\n * duration=\"9:42\"\n * poster=\"/img/portal-video.webp\"\n * ></wc-video>\n * ```\n * @example\n * ```html\n * <wc-video src=\"/media/tour.mp4\" poster=\"/media/tour.webp\" label=\"Product tour\">\n * <track kind=\"captions\" src=\"/media/tour.en.vtt\" srclang=\"en\" label=\"English\" default />\n * </wc-video>\n * ```\n * @tags media\n */\n@IndividualComponent\nexport class Video extends LitElement {\n // ── Static ───────────────────────────────────────────────────────────────\n\n static styles = [styles];\n\n // ── Properties ───────────────────────────────────────────────────────────\n\n /** A YouTube or Vimeo link, or the URL of a video file. */\n @property({ reflect: true })\n src = '';\n\n /** An image shown before the video plays. Without one, the frame shows the label on a plain surface. */\n @property({ reflect: true })\n poster = '';\n\n /** The video's title: shown on the poster, and the name of the play button and the player. */\n @property({ reflect: true })\n label = '';\n\n /** The video's length as text, such as `9:42`, shown on the poster. */\n @property({ reflect: true })\n duration = '';\n\n /** The frame's width to height, as a CSS `aspect-ratio`. */\n @property({ attribute: 'aspect-ratio', reflect: true })\n aspectRatio = '16 / 9';\n\n // ── State ────────────────────────────────────────────────────────────────\n\n /** Whether the person pressed play, so the YouTube or Vimeo player is loaded. */\n @state() private loaded = false;\n\n // ── Queries ──────────────────────────────────────────────────────────────\n\n @query('.player') private readonly player?:\n | HTMLIFrameElement\n | HTMLVideoElement;\n\n // ── Private fields ───────────────────────────────────────────────────────\n\n private readonly i18n = new I18nController(this);\n\n /** Whether the next update moves focus to the player that just loaded. */\n private focusPlayer = false;\n\n // ── Lifecycle ────────────────────────────────────────────────────────────\n\n protected override willUpdate(changed: PropertyValues<this>) {\n super.willUpdate(changed);\n if (changed.has('src') && changed.get('src') !== undefined) {\n this.loaded = false;\n }\n }\n\n protected override updated(changed: PropertyValues<this>) {\n super.updated(changed);\n if (this.player instanceof HTMLVideoElement) this.syncTracks();\n if (this.focusPlayer && this.player) {\n this.focusPlayer = false;\n this.player.focus();\n }\n }\n\n // ── Public methods ───────────────────────────────────────────────────────\n\n /** Where the video plays from, read from `src`. */\n get provider(): VideoProvider {\n return this.source.provider;\n }\n\n /** Loads the player and starts the video, as the play button does. */\n play() {\n if (this.player instanceof HTMLVideoElement) {\n this.player.play().catch(() => {\n // The browser refused to play without a gesture; its controls are still there.\n });\n return;\n }\n if (this.loaded) return;\n this.loaded = true;\n this.focusPlayer = true;\n this.dispatchEvent(new CustomEvent('play'));\n }\n\n // ── Private methods ──────────────────────────────────────────────────────\n\n private get source(): VideoSource {\n return parseVideoSource(this.src);\n }\n\n private get name() {\n return this.label || this.i18n.t('video');\n }\n\n /** Copies the light DOM `<track>` children into the shadow `<video>`, where tracks must be. */\n private syncTracks() {\n const video = this.player as HTMLVideoElement;\n const tracks = Array.from(this.querySelectorAll(':scope > track'));\n const current = Array.from(video.querySelectorAll('track'));\n const same =\n tracks.length === current.length &&\n tracks.every((track, i) => track.isEqualNode(current[i]));\n if (same) return;\n current.forEach(track => track.remove());\n tracks.forEach(track => video.append(track.cloneNode(true)));\n }\n\n private readonly handleSlotChange = () => {\n if (this.player instanceof HTMLVideoElement) this.syncTracks();\n };\n\n private readonly handleVideoPlay = () => {\n this.dispatchEvent(new CustomEvent('play'));\n };\n\n // ── Render helpers ───────────────────────────────────────────────────────\n\n private renderFile(url: string) {\n return html`<video\n class=\"player\"\n part=\"player\"\n src=${url}\n poster=${this.poster || nothing}\n aria-label=${this.name}\n controls\n playsinline\n preload=\"none\"\n @play=${this.handleVideoPlay}\n ></video>`;\n }\n\n private renderEmbed(source: VideoSource) {\n if (this.loaded) {\n return html`<iframe\n class=\"player\"\n part=\"player\"\n src=${source.url}\n title=${this.name}\n allow=\"autoplay; encrypted-media; fullscreen; picture-in-picture\"\n allowfullscreen\n referrerpolicy=\"strict-origin-when-cross-origin\"\n ></iframe>`;\n }\n const from =\n source.provider === 'youtube'\n ? this.i18n.t('videoFromYouTube')\n : this.i18n.t('videoFromVimeo');\n return html`<button\n id=\"play\"\n class=\"play-button\"\n part=\"play-button\"\n type=\"button\"\n aria-label=${this.i18n.t('playVideo')(this.name)}\n @click=${() => this.play()}\n >\n ${this.poster\n ? html`<img class=\"poster\" src=${this.poster} alt=\"\" />`\n : nothing}\n ${this.label\n ? html`<span class=\"title\" aria-hidden=\"true\">${this.label}</span>`\n : nothing}\n <span class=\"play-icon\" aria-hidden=\"true\">\n <wc-icon name=\"play_arrow\"></wc-icon>\n </span>\n <span class=\"meta\" aria-hidden=\"true\">\n <span>${from}</span>\n ${this.duration ? html`<span>${this.duration}</span>` : nothing}\n </span>\n <wc-focus-ring class=\"focus-ring\" for=\"play\"></wc-focus-ring>\n </button>`;\n }\n\n // ── Render ───────────────────────────────────────────────────────────────\n\n render() {\n const { source } = this;\n return html`<div\n class=\"frame\"\n part=\"base\"\n style=${styleMap({ aspectRatio: this.aspectRatio })}\n >\n ${source.provider === 'file'\n ? this.renderFile(source.url)\n : this.renderEmbed(source)}\n </div>\n <slot hidden @slotchange=${this.handleSlotChange}></slot>`;\n }\n}\n"],"names":["LitElement","html","nothing","styleMap","styles","property","state","query"],"mappings":";;;;;;;AASA,MAAM,aAAa,GAAG;IACpB,aAAa;IACb,iBAAiB;IACjB,eAAe;IACf,m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AA,EAAA,KAAK,CA2LjB;;;;"}
1
+ {"version":3,"file":"video-u-Vs7M9g.js","sources":["../../src/video/video-source.ts","../../src/video/video.ts"],"sourcesContent":["/** Where a video plays from. */\nexport type VideoProvider = 'youtube' | 'vimeo' | 'file';\n\nexport interface VideoSource {\n provider: VideoProvider;\n /** The player URL to load on play, for YouTube and Vimeo; the file URL for a file. */\n url: string;\n}\n\nconst YOUTUBE_HOSTS = [\n 'youtube.com',\n 'www.youtube.com',\n 'm.youtube.com',\n 'music.youtube.com',\n 'youtube-nocookie.com',\n 'www.youtube-nocookie.com',\n];\n\nconst VIMEO_HOSTS = ['vimeo.com', 'www.vimeo.com', 'player.vimeo.com'];\n\n/** A YouTube time such as `90`, `90s` or `1m30s`, in whole seconds. */\nfunction seconds(time: string | null): number {\n if (!time) return 0;\n if (/^\\d+$/.test(time)) return Number(time);\n const match = /^(?:(\\d+)h)?(?:(\\d+)m)?(?:(\\d+)s)?$/.exec(time);\n if (!match) return 0;\n const [, h = '0', m = '0', s = '0'] = match;\n return Number(h) * 3600 + Number(m) * 60 + Number(s);\n}\n\nfunction youtubeId(url: URL): string | undefined {\n if (url.hostname === 'youtu.be') return url.pathname.split('/')[1];\n if (!YOUTUBE_HOSTS.includes(url.hostname)) return undefined;\n if (url.pathname === '/watch') return url.searchParams.get('v') ?? undefined;\n const [, kind, id] = url.pathname.split('/');\n return ['embed', 'shorts', 'live', 'v'].includes(kind) ? id : undefined;\n}\n\n/**\n * Reads a video URL. YouTube links play through youtube-nocookie.com and Vimeo links with\n * `dnt=1`, so neither sets tracking cookies; any other URL is treated as a video file.\n */\nexport function parseVideoSource(src: string): VideoSource {\n let url: URL;\n try {\n url = new URL(src, document.baseURI);\n } catch {\n return { provider: 'file', url: src };\n }\n\n const youtube = youtubeId(url);\n if (youtube && /^[\\w-]+$/.test(youtube)) {\n const params = new URLSearchParams({ autoplay: '1', rel: '0' });\n const start = seconds(\n url.searchParams.get('t') ?? url.searchParams.get('start'),\n );\n if (start) params.set('start', String(start));\n return {\n provider: 'youtube',\n url: `https://www.youtube-nocookie.com/embed/${youtube}?${params}`,\n };\n }\n\n if (VIMEO_HOSTS.includes(url.hostname)) {\n const parts = url.pathname.split('/').filter(Boolean);\n const at = parts[0] === 'video' ? 1 : 0;\n const id = parts[at];\n if (id && /^\\d+$/.test(id)) {\n const params = new URLSearchParams({ autoplay: '1', dnt: '1' });\n const hash = url.searchParams.get('h') ?? parts[at + 1];\n if (hash && /^\\w+$/.test(hash)) params.set('h', hash);\n return {\n provider: 'vimeo',\n url: `https://player.vimeo.com/video/${id}?${params}`,\n };\n }\n }\n\n return { provider: 'file', url: src };\n}\n","import { html, LitElement, nothing, type PropertyValues } from 'lit';\nimport { property, query, state } from 'lit/decorators.js';\nimport { styleMap } from 'lit/directives/style-map.js';\nimport IndividualComponent from '@/IndividualComponent.js';\nimport { I18nController } from '@/__internal/i18n/i18n-controller.js';\nimport {\n parseVideoSource,\n type VideoProvider,\n type VideoSource,\n} from './video-source.js';\nimport styles from './video.scss';\n\nexport type { VideoProvider } from './video-source.js';\n\n/**\n * @label Video\n * @tag wc-video\n * @rawTag video\n *\n * @summary A video from YouTube, Vimeo or a file, that loads its player only when the person presses play.\n * @overview\n * <p>Video shows a poster with a play button. A YouTube or Vimeo player loads only on that click, so\n * the page makes no request to the video site until the person asks for the video: no cookies, no\n * tracking, and a faster page. YouTube plays through <code>youtube-nocookie.com</code> and Vimeo with\n * Do Not Track, and a line on the poster says where the video plays from.</p>\n * <p>Any other <code>src</code> is a video file, shown in the browser's own player with its\n * controls. Put <code>&lt;track&gt;</code> elements in the video for captions and subtitles.</p>\n * <p>The video keeps its <code>aspect-ratio</code> before and after it loads, so nothing on the page\n * moves.</p>\n *\n * @slot - `<track>` elements for a video file's captions and subtitles.\n *\n * @csspart base - The frame that holds the poster or the player.\n * @csspart play-button - The poster button that loads and plays the video.\n * @csspart player - The `<iframe>` or `<video>`.\n *\n * @cssprop --video-shape - Corner radius of the frame. Defaults to `--shape-corner-large`.\n *\n * @fires {CustomEvent} play - Dispatched when the person starts the video: the player loads, or the file starts playing.\n *\n * @example\n * ```html\n * <wc-video\n * src=\"https://www.youtube.com/watch?v=aqz-KE-bpKQ\"\n * label=\"Build a portal in ten minutes\"\n * duration=\"9:42\"\n * poster=\"/img/portal-video.webp\"\n * ></wc-video>\n * ```\n * @example\n * ```html\n * <wc-video src=\"/media/tour.mp4\" poster=\"/media/tour.webp\" label=\"Product tour\">\n * <track kind=\"captions\" src=\"/media/tour.en.vtt\" srclang=\"en\" label=\"English\" default />\n * </wc-video>\n * ```\n * @tags media\n */\n@IndividualComponent\nexport class Video extends LitElement {\n // ── Static ───────────────────────────────────────────────────────────────\n\n static styles = [styles];\n\n // ── Properties ───────────────────────────────────────────────────────────\n\n /** A YouTube or Vimeo link, or the URL of a video file. */\n @property({ reflect: true })\n src = '';\n\n /** An image shown before the video plays. Without one, the frame shows the label on a plain surface. */\n @property({ reflect: true })\n poster = '';\n\n /** The video's title: shown on the poster, and the name of the play button and the player. */\n @property({ reflect: true })\n label = '';\n\n /** The video's length as text, such as `9:42`, shown on the poster. */\n @property({ reflect: true })\n duration = '';\n\n /** The frame's width to height, as a CSS `aspect-ratio`. */\n @property({ attribute: 'aspect-ratio', reflect: true })\n aspectRatio = '16 / 9';\n\n // ── State ────────────────────────────────────────────────────────────────\n\n /** Whether the person pressed play, so the YouTube or Vimeo player is loaded. */\n @state() private loaded = false;\n\n // ── Queries ──────────────────────────────────────────────────────────────\n\n @query('.player') private readonly player?:\n | HTMLIFrameElement\n | HTMLVideoElement;\n\n // ── Private fields ───────────────────────────────────────────────────────\n\n private readonly i18n = new I18nController(this);\n\n /** Whether the next update moves focus to the player that just loaded. */\n private focusPlayer = false;\n\n // ── Lifecycle ────────────────────────────────────────────────────────────\n\n protected override willUpdate(changed: PropertyValues<this>) {\n super.willUpdate(changed);\n if (changed.has('src') && changed.get('src') !== undefined) {\n this.loaded = false;\n }\n }\n\n protected override updated(changed: PropertyValues<this>) {\n super.updated(changed);\n if (this.player instanceof HTMLVideoElement) this.syncTracks();\n if (this.focusPlayer && this.player) {\n this.focusPlayer = false;\n this.player.focus();\n }\n }\n\n // ── Public methods ───────────────────────────────────────────────────────\n\n /** Where the video plays from, read from `src`. */\n get provider(): VideoProvider {\n return this.source.provider;\n }\n\n /** Loads the player and starts the video, as the play button does. */\n play() {\n if (this.player instanceof HTMLVideoElement) {\n this.player.play().catch(() => {\n // The browser refused to play without a gesture; its controls are still there.\n });\n return;\n }\n if (this.loaded) return;\n this.loaded = true;\n this.focusPlayer = true;\n this.dispatchEvent(new CustomEvent('play'));\n }\n\n // ── Private methods ──────────────────────────────────────────────────────\n\n private get source(): VideoSource {\n return parseVideoSource(this.src);\n }\n\n private get name() {\n return this.label || this.i18n.t('video');\n }\n\n /** Copies the light DOM `<track>` children into the shadow `<video>`, where tracks must be. */\n private syncTracks() {\n const video = this.player as HTMLVideoElement;\n const tracks = Array.from(this.querySelectorAll(':scope > track'));\n const current = Array.from(video.querySelectorAll('track'));\n const same =\n tracks.length === current.length &&\n tracks.every((track, i) => track.isEqualNode(current[i]));\n if (same) return;\n current.forEach(track => track.remove());\n tracks.forEach(track => video.append(track.cloneNode(true)));\n }\n\n private readonly handleSlotChange = () => {\n if (this.player instanceof HTMLVideoElement) this.syncTracks();\n };\n\n private readonly handleVideoPlay = () => {\n this.dispatchEvent(new CustomEvent('play'));\n };\n\n // ── Render helpers ───────────────────────────────────────────────────────\n\n private renderFile(url: string) {\n return html`<video\n class=\"player\"\n part=\"player\"\n src=${url}\n poster=${this.poster || nothing}\n aria-label=${this.name}\n controls\n playsinline\n preload=\"none\"\n @play=${this.handleVideoPlay}\n ></video>`;\n }\n\n private renderEmbed(source: VideoSource) {\n if (this.loaded) {\n return html`<iframe\n class=\"player\"\n part=\"player\"\n src=${source.url}\n title=${this.name}\n allow=\"autoplay; encrypted-media; fullscreen; picture-in-picture\"\n allowfullscreen\n referrerpolicy=\"strict-origin-when-cross-origin\"\n ></iframe>`;\n }\n const from =\n source.provider === 'youtube'\n ? this.i18n.t('videoFromYouTube')\n : this.i18n.t('videoFromVimeo');\n return html`<button\n id=\"play\"\n class=\"play-button\"\n part=\"play-button\"\n type=\"button\"\n aria-label=${this.i18n.t('playVideo')(this.name)}\n @click=${() => this.play()}\n >\n ${this.poster\n ? html`<img class=\"poster\" src=${this.poster} alt=\"\" />`\n : nothing}\n ${this.label\n ? html`<span class=\"title\" aria-hidden=\"true\">${this.label}</span>`\n : nothing}\n <span class=\"play-icon\" aria-hidden=\"true\">\n <wc-icon name=\"play_arrow\"></wc-icon>\n </span>\n <span class=\"meta\" aria-hidden=\"true\">\n <span>${from}</span>\n ${this.duration ? html`<span>${this.duration}</span>` : nothing}\n </span>\n <wc-focus-ring class=\"focus-ring\" for=\"play\"></wc-focus-ring>\n </button>`;\n }\n\n // ── Render ───────────────────────────────────────────────────────────────\n\n render() {\n const { source } = this;\n return html`<div\n class=\"frame\"\n part=\"base\"\n style=${styleMap({ aspectRatio: this.aspectRatio })}\n >\n ${source.provider === 'file'\n ? this.renderFile(source.url)\n : this.renderEmbed(source)}\n </div>\n <slot hidden @slotchange=${this.handleSlotChange}></slot>`;\n }\n}\n"],"names":["LitElement","html","nothing","styleMap","styles","property","state","query"],"mappings":";;;;;;;AASA,MAAM,aAAa,GAAG;IACpB,aAAa;IACb,iBAAiB;IACjB,eAAe;IACf,mBAAmB;IACnB,sBAAsB;IACtB,0BAA0B;CAC3B;AAED,MAAM,WAAW,GAAG,CAAC,WAAW,EAAE,eAAe,EAAE,kBAAkB,CAAC;AAEtE;AACA,SAAS,OAAO,CAAC,IAAmB,EAAA;AAClC,IAAA,IAAI,CAAC,IAAI;AAAE,QAAA,OAAO,CAAC;AACnB,IAAA,IAAI,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC;AAAE,QAAA,OAAO,MAAM,CAAC,IAAI,CAAC;IAC3C,MAAM,KAAK,GAAG,qCAAqC,CAAC,IAAI,CAAC,IAAI,CAAC;AA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A,KAAA,EAAA,MAAA,CAAA;AAIT,UAAA,CAAA;AADC,IAAAA,CAAQ,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE;AACf,CAAA,EAAA,KAAA,CAAA,SAAA,EAAA,QAAA,EAAA,MAAA,CAAA;AAIZ,UAAA,CAAA;AADC,IAAAA,CAAQ,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE;AAChB,CAAA,EAAA,KAAA,CAAA,SAAA,EAAA,OAAA,EAAA,MAAA,CAAA;AAIX,UAAA,CAAA;AADC,IAAAA,CAAQ,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE;AACb,CAAA,EAAA,KAAA,CAAA,SAAA,EAAA,UAAA,EAAA,MAAA,CAAA;AAId,UAAA,CAAA;IADCA,CAAQ,CAAC,EAAE,SAAS,EAAE,cAAc,EAAE,OAAO,EAAE,IAAI,EAAE;AAC/B,CAAA,EAAA,KAAA,CAAA,SAAA,EAAA,aAAA,EAAA,MAAA,CAAA;AAKN,UAAA,CAAA;AAAhB,IAAAC,CAAK;AAA0B,CAAA,EAAA,KAAA,CAAA,SAAA,EAAA,QAAA,EAAA,MAAA,CAAA;AAIG,UAAA,CAAA;IAAlCC,CAAK,CAAC,SAAS;AAEK,CAAA,EAAA,KAAA,CAAA,SAAA,EAAA,QAAA,EAAA,MAAA,CAAA;AApCV,KAAK,GAAA,UAAA,CAAA;IADjB;AACY,CAAA,EAAA,KAAK,CA2LjB;;;;"}
package/dist/video.js CHANGED
@@ -3,10 +3,10 @@ import './property-B2TG3KEE.js';
3
3
  import './state-BCeDVCI9.js';
4
4
  import './query-CHb9Ft_d.js';
5
5
  import './style-map-CHOg6N_R.js';
6
- import './i18n-controller-DLJcJ5gO.js';
7
- export { V as Video } from './video-IwNmHyft.js';
6
+ import './i18n-controller-Co6pasNo.js';
7
+ export { V as Video } from './video-u-Vs7M9g.js';
8
8
  import './base-Cl6v8-BZ.js';
9
9
  import './directive-ZPhl09Yt.js';
10
- import './strings-MXyrGrNs.js';
10
+ import './strings-DYwXSSu_.js';
11
11
  import './locale-DEsJZCQG.js';
12
12
  //# sourceMappingURL=video.js.map
@@ -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-DLJcJ5gO.js';
5
+ import { I as I18nController } from './i18n-controller-Co6pasNo.js';
6
6
  import { v as virtualWindow } from './virtual-window-5OYyIqZh.js';
7
7
  import './directive-ZPhl09Yt.js';
8
8
  import './directive-helpers-Bx3mu42O.js';
9
- import './strings-MXyrGrNs.js';
9
+ import './strings-DYwXSSu_.js';
10
10
  import './locale-DEsJZCQG.js';
11
11
 
12
12
  var css_248z = i`* {
@@ -1,12 +1,12 @@
1
1
  import { i, _ as __decorate, I as IndividualComponent, a as i$1, A, b } from './IndividualComponent-BK7XZjE2.js';
2
2
  import { n } from './property-B2TG3KEE.js';
3
3
  import { e } from './class-map-NDIkZErE.js';
4
- import { I as I18nController } from './i18n-controller-DLJcJ5gO.js';
4
+ import { I as I18nController } from './i18n-controller-Co6pasNo.js';
5
5
  import { D as DiagramCanvasLink } from './canvas-link-CtgsALq4.js';
6
6
  import { w as walk } from './workflow-model-CauduOG2.js';
7
7
  import { f as formatDuration } from './workflow-format-BsyveyeC.js';
8
8
  import './directive-ZPhl09Yt.js';
9
- import './strings-MXyrGrNs.js';
9
+ import './strings-DYwXSSu_.js';
10
10
  import './locale-DEsJZCQG.js';
11
11
  import './host-CZK7xhzh.js';
12
12
 
package/dist/workflow.js CHANGED
@@ -3,15 +3,15 @@ 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 { D as DiagramCanvasElement, p as prefersReducedMotion, a as animateOut } from './canvas-base-BoKef3yr.js';
6
+ import { D as DiagramCanvasElement, p as prefersReducedMotion, a as animateOut } from './canvas-base-CjxNdEsR.js';
7
7
  import { r as roundedPath } from './geometry-INg82Lxq.js';
8
8
  import { H as History } from './history-YbTSQZHj.js';
9
9
  import { W as WORKFLOW_LOGIC_STEPS, f as findStep, w as walk, i as isReached, r as replaceStep, a as removeStep, g as getList, c as createStep, b as allIds, d as insertStep, m as moveStep, l as listKey, e as cloneWithNewIds, h as contains, j as countInside, k as listTerminates, s as stepTerminates } from './workflow-model-CauduOG2.js';
10
10
  import { f as formatDuration } from './workflow-format-BsyveyeC.js';
11
11
  import './base-Cl6v8-BZ.js';
12
12
  import './directive-ZPhl09Yt.js';
13
- import './i18n-controller-DLJcJ5gO.js';
14
- import './strings-MXyrGrNs.js';
13
+ import './i18n-controller-Co6pasNo.js';
14
+ import './strings-DYwXSSu_.js';
15
15
  import './locale-DEsJZCQG.js';
16
16
  import './host-CZK7xhzh.js';
17
17
 
@@ -3,11 +3,11 @@ 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-DLJcJ5gO.js';
6
+ import { I as I18nController } from './i18n-controller-Co6pasNo.js';
7
7
  import { M as MenuTriggerController } from './menu-trigger-controller-CEJq1ugC.js';
8
8
  import './base-Cl6v8-BZ.js';
9
9
  import './directive-ZPhl09Yt.js';
10
- import './strings-MXyrGrNs.js';
10
+ import './strings-DYwXSSu_.js';
11
11
  import './locale-DEsJZCQG.js';
12
12
 
13
13
  var css_248z = i`* {
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@redvars/peacock",
3
3
  "description": "The foundation for beautiful user interfaces",
4
4
  "license": "Apache-2.0",
5
- "version": "4.3.1",
5
+ "version": "4.3.3",
6
6
  "type": "module",
7
7
  "main": "dist/index.js",
8
8
  "module": "dist/index.js",
@@ -358,6 +358,11 @@ export const defaultStrings = {
358
358
  /** Label of the and/or toggle, for example "Match conditions with And". */
359
359
  matchConditionsWith: (operator: string): string =>
360
360
  `Match conditions with ${operator}`,
361
+ /** What a click on the and/or toggle does, for example "Switch to Or": its tooltip and description. */
362
+ switchOperatorTo: (operator: string): string => `Switch to ${operator}`,
363
+ /** Announced after the and/or toggle swapped the operator, for example "Conditions now match with Or". */
364
+ conditionsNowMatchWith: (operator: string): string =>
365
+ `Conditions now match with ${operator}`,
361
366
  /** Description of a rule's handle: the keys that move the rule. */
362
367
  reorderConditionHint:
363
368
  'Arrow Up and Arrow Down move the condition. Arrow Right moves it into the group beside it, Arrow Left out of its group.',
@@ -560,6 +565,9 @@ export const defaultStrings = {
560
565
  position: string,
561
566
  total: string,
562
567
  ): string => `${label}, position ${position} of ${total}`,
568
+ /** Announced after dragging several items, for example "3 items moved to position 2". */
569
+ transferListMovedToPosition: (count: string, position: string): string =>
570
+ `${count} items moved to position ${position}`,
563
571
  /** Accessible name of a dot-only status indicator without `label` or `intent`. */
564
572
  statusIndicatorNeutral: 'Status',
565
573
 
@@ -7,10 +7,13 @@
7
7
  }
8
8
 
9
9
  .group {
10
- --_connector-width: 3.5rem;
10
+ // The pill sits centred on the bracket's line, halfway across the connector, so a connector of
11
+ // the pill's width plus twice a gap leaves that gap between the pill and the items.
12
+ --_pill-min-width: 3.25rem;
13
+ --_connector-width: calc(var(--_pill-min-width) + 2 * var(--spacing-100, 0.5rem));
11
14
 
12
15
  @include mixin.for-phone-only {
13
- --_connector-width: 3rem;
16
+ --_connector-width: calc(var(--_pill-min-width) + 2 * var(--spacing-050, 0.25rem));
14
17
  }
15
18
  }
16
19
 
@@ -49,7 +52,7 @@
49
52
  align-items: center;
50
53
  justify-content: center;
51
54
  gap: var(--spacing-025);
52
- min-width: 3.25rem;
55
+ min-width: var(--_pill-min-width);
53
56
  height: 1.5rem;
54
57
  white-space: nowrap;
55
58
  padding-inline: var(--spacing-100) var(--spacing-050);
@@ -30,11 +30,9 @@ const OPERATOR_LABEL_KEYS: Record<CbOperator, 'operatorAnd' | 'operatorOr'> = {
30
30
  or: 'operatorOr',
31
31
  };
32
32
 
33
- type MenuElement = HTMLElement & {
34
- anchorElement: HTMLElement | null;
35
- show: () => void;
36
- close: () => void;
37
- };
33
+ /** The operator the pill swaps to. */
34
+ const otherOperator = (operator: CbOperator): CbOperator =>
35
+ operator === 'and' ? 'or' : 'and';
38
36
 
39
37
  /** Adds the non-enumerable `element` to a node of the `value` tree. */
40
38
  function withElement<T extends object>(node: T, element: HTMLElement): T {
@@ -44,7 +42,7 @@ function withElement<T extends object>(node: T, element: HTMLElement): T {
44
42
 
45
43
  /**
46
44
  * Shared behaviour of `wc-condition-builder` and `wc-cb-group`: the And/Or
47
- * operator pill, the bracket joining the items, dropping dragged rules,
45
+ * operator pill, which swaps the operator on a click, the bracket joining the items, dropping dragged rules,
48
46
  * `disabled`/`readonly` passed down to the items, and the `value` tree.
49
47
  */
50
48
  export class CbGroupBase extends LitElement {
@@ -87,10 +85,6 @@ export class CbGroupBase extends LitElement {
87
85
  @state()
88
86
  private _dropIndicatorTop: number | null = null;
89
87
 
90
- /** Whether the operator menu is open. */
91
- @state()
92
- private _menuOpen = false;
93
-
94
88
  /** `disabled` passed down by the enclosing group. */
95
89
  @state()
96
90
  private _inheritedDisabled = false;
@@ -111,17 +105,8 @@ export class CbGroupBase extends LitElement {
111
105
  @query('.connector')
112
106
  private readonly _connectorEl?: HTMLElement;
113
107
 
114
- @query('.operator-pill')
115
- private readonly _pillEl?: HTMLElement;
116
-
117
- @query('wc-menu')
118
- private readonly _menuEl?: MenuElement;
119
-
120
108
  // ── Private fields ────────────────────────────────────────────────────────
121
109
 
122
- /** Id linking the operator pill to its menu. */
123
- private readonly _menuId = `cb-operator-menu-${Math.random().toString(36).slice(2, 9)}`;
124
-
125
110
  /** Re-measures the bracket when any item changes size; exists while connected. */
126
111
  private _resizeObserver?: ResizeObserver;
127
112
 
@@ -311,33 +296,16 @@ export class CbGroupBase extends LitElement {
311
296
  this._connectorEl.style.height = `${bottom - top}px`;
312
297
  }
313
298
 
299
+ /** The pill swaps the operator: And becomes Or, Or becomes And, announced through the live region. */
314
300
  private _onPillClick(event: MouseEvent) {
315
301
  event.stopPropagation();
316
- if (this.locked || !this._menuEl || !this._pillEl) return;
317
-
318
- if (this._menuOpen) {
319
- this._menuEl.close();
320
- } else {
321
- this._menuEl.anchorElement = this._pillEl;
322
- this._menuEl.show();
323
- }
324
- }
325
-
326
- /**
327
- * The operator menu's `open`/`close` are internal: they bubble and are composed, so stop them
328
- * here. Only the menu's own (not a nested one's) changes the open state.
329
- */
330
- private _onMenuToggle(event: Event) {
331
- event.stopPropagation();
332
- if (event.target !== event.currentTarget) return;
333
- this._menuOpen = event.type === 'open';
334
- }
335
-
336
- private _onMenuActivate(event: CustomEvent<{ item: { value: string } }>) {
337
- const operator = event.detail.item.value as CbOperator;
338
- if (this.locked || operator === this.operator) return;
302
+ if (this.locked) return;
339
303
 
304
+ const operator = otherOperator(this.operator);
340
305
  this.operator = operator;
306
+ this.announce(
307
+ this.i18n.t('conditionsNowMatchWith')(this._operatorLabel(operator)),
308
+ );
341
309
  this.dispatchEvent(
342
310
  new CustomEvent<{ operator: CbOperator }>('operator-change', {
343
311
  detail: { operator },
@@ -421,15 +389,18 @@ export class CbGroupBase extends LitElement {
421
389
  if (this._itemCount < 2) return nothing;
422
390
 
423
391
  const label = this._operatorLabel(this.operator);
392
+ // The name says what the pill holds; the description and the tooltip what a click does.
393
+ const swap = this.i18n.t('switchOperatorTo')(
394
+ this._operatorLabel(otherOperator(this.operator)),
395
+ );
424
396
  return html`
425
397
  <div class="connector">
426
398
  <wc-cb-divider connect-start connect-end>
427
399
  <button
400
+ id="operator-pill"
428
401
  class="operator-pill"
429
402
  aria-label=${this.i18n.t('matchConditionsWith')(label)}
430
- aria-haspopup=${this.locked ? nothing : 'menu'}
431
- aria-expanded=${this.locked ? nothing : String(this._menuOpen)}
432
- aria-controls=${this.locked ? nothing : this._menuId}
403
+ aria-description=${this.locked ? nothing : swap}
433
404
  ?disabled=${this.effectiveDisabled}
434
405
  aria-readonly=${this.effectiveReadonly ? 'true' : nothing}
435
406
  @click=${this._onPillClick}
@@ -438,39 +409,18 @@ export class CbGroupBase extends LitElement {
438
409
  <span class="operator-label">${label}</span>
439
410
  ${this.locked
440
411
  ? nothing
441
- : html`<wc-icon
442
- name="arrow_drop_down"
443
- aria-hidden="true"
444
- ></wc-icon>`}
412
+ : html`<wc-icon name="swap_vert" aria-hidden="true"></wc-icon>`}
445
413
  </button>
414
+ ${this.locked
415
+ ? nothing
416
+ : html`<wc-tooltip class="operator-tooltip" for="operator-pill"
417
+ >${swap}</wc-tooltip
418
+ >`}
446
419
  </wc-cb-divider>
447
420
  </div>
448
421
  `;
449
422
  }
450
423
 
451
- private _renderOperatorMenu() {
452
- if (this.locked) return nothing;
453
- return html`
454
- <wc-menu
455
- id=${this._menuId}
456
- @open=${this._onMenuToggle}
457
- @close=${this._onMenuToggle}
458
- @menu-item-activate=${this._onMenuActivate}
459
- >
460
- ${(Object.keys(OPERATOR_LABEL_KEYS) as CbOperator[]).map(
461
- operator => html`
462
- <wc-menu-item
463
- value=${operator}
464
- ?selected=${operator === this.operator}
465
- >
466
- ${this._operatorLabel(operator)}
467
- </wc-menu-item>
468
- `,
469
- )}
470
- </wc-menu>
471
- `;
472
- }
473
-
474
424
  // ── Render ────────────────────────────────────────────────────────────────
475
425
 
476
426
  override render() {
@@ -501,7 +451,6 @@ export class CbGroupBase extends LitElement {
501
451
  </div>
502
452
  ${this.renderFooter()}
503
453
  </div>
504
- ${this._renderOperatorMenu()}
505
454
  <span class="sr-only" aria-live="polite">${this._announcement}</span>
506
455
  `;
507
456
  }
@@ -10,11 +10,11 @@ import styles from './cb-group.scss';
10
10
  * @rawTag cb-group
11
11
  * @summary A bordered, nested group of rules in a condition builder, joined by its own And/Or operator.
12
12
  * @overview
13
- * <p>A bracket on the left joins the group's rules, with a pill to switch between And and Or. Rules can be dragged into, out of and within the group, or moved with the keyboard from their handles.</p>
13
+ * <p>A bracket on the left joins the group's rules, with a pill that swaps between And and Or on a click. Rules can be dragged into, out of and within the group, or moved with the keyboard from their handles.</p>
14
14
  * <p>It takes <code>disabled</code> and <code>readonly</code> from the builder around it, or sets them for itself and what it holds.</p>
15
15
  * @tags condition-builder
16
16
  *
17
- * @fires {CustomEvent<{operator: 'and' | 'or'}>} operator-change - Dispatched when the user picks a different operator.
17
+ * @fires {CustomEvent<{operator: 'and' | 'or'}>} operator-change - Dispatched when the user swaps the operator with the pill.
18
18
  * @fires {CustomEvent<{rule: CbRule, from: HTMLElement | null, to: HTMLElement, index: number}>} rule-move - Dispatched before a rule is moved into this group. Cancelable: unless prevented, the group moves the rule.
19
19
  * @fires {CustomEvent<{group: HTMLElement}>} add-rule - Dispatched when the default "Add condition" link is clicked.
20
20
  * @fires {CustomEvent<{group: HTMLElement}>} add-group - Dispatched when the default "Add inner group" link is clicked.
@@ -3,6 +3,10 @@
3
3
  @include mixin.base-styles;
4
4
 
5
5
  :host {
6
+ // Positioned, so the rule has a paint layer of its own: a drag image is painted from the dragged
7
+ // element's layer, and without one Chrome paints the group's around it, the whole section.
8
+ // No z-index, so it starts no stacking context and nothing in the rule stacks differently.
9
+ position: relative;
6
10
  display: block;
7
11
  container-type: inline-size;
8
12
  }
@@ -22,7 +22,7 @@ export interface ConditionBuilderDescribeDetail {
22
22
  * @overview
23
23
  * <p>The condition builder is the root group of a query. It holds rules (<code>wc-cb-rule</code>) and bordered nested groups (<code>wc-cb-group</code>), each joined by a bracket with an And/Or pill.</p>
24
24
  * <ul>
25
- * <li>Click the pill to switch a group between And and Or.</li>
25
+ * <li>Click the pill to swap a group between And and Or; its tooltip says which it switches to.</li>
26
26
  * <li>Drag a rule by its handle to reorder it or move it between groups.</li>
27
27
  * <li>Without a mouse, focus a rule's handle: ArrowUp and ArrowDown move it within its group, ArrowRight moves it into the group beside it and ArrowLeft out of its group. Each move is announced.</li>
28
28
  * <li>Removing, moving and switching are built in; adding rules and groups is up to you, since only you know what a new rule contains. Listen for <code>add-rule</code> and <code>add-group</code>, which nested groups fire too; <code>detail.group</code> is the group to add to.</li>
@@ -46,7 +46,7 @@ export interface ConditionBuilderDescribeDetail {
46
46
  * one discards it. <code>no-ai</code> turns the box off.</p>
47
47
  * @tags condition-builder
48
48
  *
49
- * @fires {CustomEvent<{operator: 'and' | 'or'}>} operator-change - Dispatched when the user picks a different operator, on this or a nested group.
49
+ * @fires {CustomEvent<{operator: 'and' | 'or'}>} operator-change - Dispatched when the user swaps the operator with the pill, on this or a nested group.
50
50
  * @fires {CustomEvent<{rule: CbRule, from: HTMLElement | null, to: HTMLElement, index: number}>} rule-move - Dispatched before a rule is moved. Cancelable: unless prevented, the target group moves the rule.
51
51
  * @fires {CustomEvent<{rule: CbRule, group: HTMLElement | null}>} rule-remove - Dispatched when a rule's remove button is clicked. Cancelable: unless prevented, the rule removes itself.
52
52
  * @fires {CustomEvent<{group: HTMLElement}>} add-rule - Dispatched when "Add rule" (or a nested group's "Add condition") is clicked.
@@ -52,6 +52,7 @@
52
52
  }
53
53
 
54
54
  .pane {
55
+ position: relative;
55
56
  display: flex;
56
57
  flex-direction: column;
57
58
  min-inline-size: 0;
@@ -92,7 +93,9 @@
92
93
 
93
94
  .list-wrapper {
94
95
  position: relative;
95
- flex: 1;
96
+ // The height is the basis, so a long list scrolls instead of growing the pane; it still
97
+ // grows to fill a pane stretched by the other one.
98
+ flex: 1 0 auto;
96
99
  block-size: var(--_list-block-size);
97
100
  overflow-y: auto;
98
101
  }
@@ -108,6 +111,97 @@
108
111
  }
109
112
  }
110
113
 
114
+ // ── Drag to reorder (ordered) ────────────────────────────────────────────
115
+
116
+ .drag-handle {
117
+ --icon-size: 1.25rem;
118
+ --icon-color: currentColor;
119
+
120
+ flex: none;
121
+ color: var(--color-on-surface-variant);
122
+ cursor: grab;
123
+ // Touch drags move the item instead of scrolling the list.
124
+ touch-action: none;
125
+
126
+ &:hover {
127
+ color: var(--color-on-surface);
128
+ }
129
+ }
130
+
131
+ wc-listbox-option.dragging {
132
+ opacity: 0.38;
133
+ }
134
+
135
+ .drop-indicator {
136
+ position: absolute;
137
+ inset-inline: var(--spacing-100);
138
+ block-size: 0.125rem;
139
+ margin-block-start: -0.0625rem;
140
+ border-radius: var(--shape-corner-full);
141
+ background-color: var(--color-primary);
142
+ pointer-events: none;
143
+
144
+ &::before {
145
+ content: '';
146
+ position: absolute;
147
+ inset-inline-start: -0.25rem;
148
+ inset-block-start: -0.1875rem;
149
+ inline-size: 0.5rem;
150
+ block-size: 0.5rem;
151
+ border-radius: var(--shape-corner-full);
152
+ background-color: var(--color-primary);
153
+ }
154
+ }
155
+
156
+ .drag-preview {
157
+ @include mixin.get-typography(body-large);
158
+
159
+ position: absolute;
160
+ z-index: 1;
161
+ display: flex;
162
+ align-items: center;
163
+ gap: var(--spacing-100);
164
+ max-inline-size: 70%;
165
+ padding: var(--spacing-100) var(--spacing-150);
166
+ // The pointer holds the copy by its grip, as it held the item's handle.
167
+ transform: translate(calc(-1 * (var(--spacing-150) + 0.625rem)), -50%);
168
+ border-radius: var(--shape-corner-small);
169
+ background-color: var(--color-surface-container-high);
170
+ box-shadow: var(--elevation-level2);
171
+ color: var(--color-on-surface);
172
+ cursor: grabbing;
173
+ pointer-events: none;
174
+ }
175
+
176
+ .drag-preview-icon {
177
+ --icon-size: 1.25rem;
178
+ --icon-color: currentColor;
179
+
180
+ flex: none;
181
+ color: var(--color-on-surface-variant);
182
+ }
183
+
184
+ .drag-preview-label {
185
+ overflow: hidden;
186
+ white-space: nowrap;
187
+ text-overflow: ellipsis;
188
+ }
189
+
190
+ .drag-count {
191
+ @include mixin.get-typography(label-small);
192
+
193
+ position: absolute;
194
+ inset-inline-end: -0.5rem;
195
+ inset-block-start: -0.5rem;
196
+ min-inline-size: 1.25rem;
197
+ padding-inline: var(--spacing-050);
198
+ border-radius: var(--shape-corner-full);
199
+ background-color: var(--color-primary);
200
+ color: var(--color-on-primary);
201
+ text-align: center;
202
+ line-height: 1.25rem;
203
+ }
204
+
111
205
  .empty {
112
206
  @include mixin.get-typography(body-medium);
113
207