@redvars/peacock 4.3.4 → 4.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{BaseField-DPyW5Zm5.js → BaseField-Cj2rNVeC.js} +3 -3
- package/dist/{BaseField-DPyW5Zm5.js.map → BaseField-Cj2rNVeC.js.map} +1 -1
- package/dist/{BaseInput-FhjvfMjF.js → BaseInput-CSOLv2-i.js} +2 -2
- package/dist/{BaseInput-FhjvfMjF.js.map → BaseInput-CSOLv2-i.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-D8-x6XS4.js → base-progress-DduJjUeq.js} +2 -2
- package/dist/{base-progress-D8-x6XS4.js.map → base-progress-DduJjUeq.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-CjxNdEsR.js → canvas-base-Bfpv5_HJ.js} +2 -2
- package/dist/{canvas-base-CjxNdEsR.js.map → canvas-base-Bfpv5_HJ.js.map} +1 -1
- package/dist/carousel.js +2 -2
- package/dist/{cartesian-chart-D30aTNVm.js → cartesian-chart-SnqFbbXV.js} +2 -2
- package/dist/{cartesian-chart-D30aTNVm.js.map → cartesian-chart-SnqFbbXV.js.map} +1 -1
- package/dist/{cb-group-base-BhWC78b0.js → cb-group-base-DZIzMlen.js} +2 -2
- package/dist/{cb-group-base-BhWC78b0.js.map → cb-group-base-DZIzMlen.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-D2kPte5J.js → chart-base-C2N0WQLI.js} +2 -2
- package/dist/{chart-base-D2kPte5J.js.map → chart-base-C2N0WQLI.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.json +1 -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-BFGq2POp.js → diagram-W_Kddt7I.js} +2 -2
- package/dist/{diagram-BFGq2POp.js.map → diagram-W_Kddt7I.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-CC7MTHMO.js → document-editor-dBgmcyUW.js} +2 -2
- package/dist/{document-editor-CC7MTHMO.js.map → document-editor-dBgmcyUW.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-DoT9YwHL.js → generative-view-CfW6yMpY.js} +2 -2
- package/dist/{generative-view-DoT9YwHL.js.map → generative-view-CfW6yMpY.js.map} +1 -1
- package/dist/generative-view.js +3 -3
- package/dist/html-editor.js +4 -4
- package/dist/{i18n-controller-Co6pasNo.js → i18n-controller-DNAjVSIP.js} +2 -2
- package/dist/{i18n-controller-Co6pasNo.js.map → i18n-controller-DNAjVSIP.js.map} +1 -1
- package/dist/image.js +2 -2
- package/dist/index.js +17 -17
- 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 +10 -10
- package/dist/loader.js +10 -10
- 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-BliKNENo.js → picker-field-Mi7_hbo8.js} +3 -3
- package/dist/{picker-field-BliKNENo.js.map → picker-field-Mi7_hbo8.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-YeqK1or-.js → rich-text-input-O1ku1q-J.js} +3 -3
- package/dist/{rich-text-input-YeqK1or-.js.map → rich-text-input-O1ku1q-J.js.map} +1 -1
- package/dist/{schema-CuHBNpzo.js → schema-BWH1ANdE.js} +2 -2
- package/dist/{schema-CuHBNpzo.js.map → schema-BWH1ANdE.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-header.js +2 -2
- 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 +4 -0
- package/dist/src/workflow/workflow-model.d.ts +12 -3
- 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-DYwXSSu_.js → strings-BpCoUL0V.js} +5 -1
- package/dist/{strings-DYwXSSu_.js.map → strings-BpCoUL0V.js.map} +1 -1
- package/dist/svg.js +2 -2
- package/dist/switch.js +3 -3
- package/dist/table.js +2 -2
- 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-B-HOnUIy.js → toggle-base-BRNNka2o.js} +2 -2
- package/dist/{toggle-base-B-HOnUIy.js.map → toggle-base-BRNNka2o.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-u-Vs7M9g.js → video-DBdRuyh4.js} +2 -2
- package/dist/{video-u-Vs7M9g.js.map → video-DBdRuyh4.js.map} +1 -1
- package/dist/video.js +3 -3
- package/dist/virtual-list.js +2 -2
- package/dist/workflow-model-CauduOG2.js.map +1 -1
- package/dist/workflow-timeline.js +2 -2
- package/dist/workflow.js +16 -5
- package/dist/workflow.js.map +1 -1
- package/dist/workspace-switcher.js +2 -2
- package/package.json +1 -1
- package/src/__internal/i18n/strings.ts +4 -0
- package/src/workflow/workflow-model.ts +12 -3
- package/src/workflow/workflow.scss +5 -0
- package/src/workflow/workflow.ts +10 -2
package/dist/typing-indicator.js
CHANGED
|
@@ -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-
|
|
4
|
-
import './strings-
|
|
3
|
+
import { I as I18nController } from './i18n-controller-DNAjVSIP.js';
|
|
4
|
+
import './strings-BpCoUL0V.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-
|
|
7
|
-
import { B as BaseField } from './BaseField-
|
|
8
|
-
import { n as nativeValidity } from './BaseInput-
|
|
6
|
+
import { I as I18nController } from './i18n-controller-DNAjVSIP.js';
|
|
7
|
+
import { B as BaseField } from './BaseField-Cj2rNVeC.js';
|
|
8
|
+
import { n as nativeValidity } from './BaseInput-CSOLv2-i.js';
|
|
9
9
|
import './base-Cl6v8-BZ.js';
|
|
10
10
|
import './directive-ZPhl09Yt.js';
|
|
11
|
-
import './strings-
|
|
11
|
+
import './strings-BpCoUL0V.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-
|
|
5
|
+
import { I as I18nController } from './i18n-controller-DNAjVSIP.js';
|
|
6
6
|
import { M as MenuTriggerController } from './menu-trigger-controller-CEJq1ugC.js';
|
|
7
7
|
import './base-Cl6v8-BZ.js';
|
|
8
|
-
import './strings-
|
|
8
|
+
import './strings-BpCoUL0V.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-
|
|
6
|
+
import { I as I18nController } from './i18n-controller-DNAjVSIP.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-
|
|
509
|
+
//# sourceMappingURL=video-DBdRuyh4.js.map
|
|
@@ -1 +1 @@
|
|
|
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><track></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;AAC9D,IAAA,IAAI,CAAC,KAAK;AAAE,QAAA,OAAO,CAAC;AACpB,IAAA,MAAM,GAAG,CAAC,GAAG,GAAG,EAAE,CAAC,GAAG,GAAG,EAAE,CAAC,GAAG,GAAG,CAAC,GAAG,KAAK;AAC3C,IAAA,OAAO,MAAM,CAAC,CAAC,CAAC,GAAG,IAAI,GAAG,MAAM,CAAC,CAAC,CAAC,GAAG,EAAE,GAAG,MAAM,CAAC,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AAA,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;;;;"}
|
|
1
|
+
{"version":3,"file":"video-DBdRuyh4.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><track></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;AAC9D,IAAA,IAAI,CAAC,KAAK;AAAE,QAAA,OAAO,CAAC;AACpB,IAAA,MAAM,GAAG,CAAC,GAAG,GAAG,EAAE,CAAC,GAAG,GAAG,EAAE,CAAC,GAAG,GAAG,CAAC,GAAG,KAAK;AAC3C,IAAA,OAAO,MAAM,CAAC,CAAC,CAAC,GAAG,IAAI,GAAG,MAAM,CAAC,CAAC,CAAC,GAAG,EAAE,GAAG,MAAM,CAAC,CAAC,CAAC;AACtD;AAEA,SAAS,SAAS,CAAC,GAAQ,EAAA;AACzB,IAAA,IAAI,GAAG,CAAC,QAAQ,KAAK,UAAU;QAAE,OAAO,GAAG,CAAC,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;IAClE,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,GAAG,CAAC,QAAQ,CAAC;AAAE,QAAA,OAAO,SAAS;AAC3D,IAAA,IAAI,GAAG,CAAC,QAAQ,KAAK,QAAQ;QAAE,OAAO,GAAG,CAAC,YAAY,CAAC,GAAG,CAA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A,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-
|
|
7
|
-
export { V as Video } from './video-
|
|
6
|
+
import './i18n-controller-DNAjVSIP.js';
|
|
7
|
+
export { V as Video } from './video-DBdRuyh4.js';
|
|
8
8
|
import './base-Cl6v8-BZ.js';
|
|
9
9
|
import './directive-ZPhl09Yt.js';
|
|
10
|
-
import './strings-
|
|
10
|
+
import './strings-BpCoUL0V.js';
|
|
11
11
|
import './locale-DEsJZCQG.js';
|
|
12
12
|
//# sourceMappingURL=video.js.map
|
package/dist/virtual-list.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-DNAjVSIP.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-
|
|
9
|
+
import './strings-BpCoUL0V.js';
|
|
10
10
|
import './locale-DEsJZCQG.js';
|
|
11
11
|
|
|
12
12
|
var css_248z = i`* {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workflow-model-CauduOG2.js","sources":["../../src/workflow/workflow-model.ts"],"sourcesContent":["/** Colour of a step's icon tile, from the theme's accent palettes. */\nexport type WorkflowAccent =\n | 'primary'\n | 'tertiary'\n | 'blue'\n | 'green'\n | 'orange'\n | 'purple'\n | 'red'\n | 'yellow'\n | 'neutral';\n\n/** A label and value shown on a step card. `{{Step.output}}` in `value` renders as a data pill. */\nexport interface WorkflowField {\n label: string;\n value: string;\n}\n\n/** A value a step produces for later steps. */\nexport interface WorkflowOutput {\n name: string;\n type?: string;\n}\n\n/** A tool an AI agent step may call. */\nexport interface WorkflowTool {\n id: string;\n headline: string;\n icon?: string;\n}\n\n/** Who works on a human task. */\nexport interface WorkflowAssignee {\n name: string;\n src?: string;\n}\n\n// Steps nest steps, so these types refer to the union declared after them.\n/* eslint-disable no-use-before-define */\n\ninterface WorkflowStepBase {\n /** Unique across the whole workflow. */\n id: string;\n /** The step's title. */\n headline?: string;\n /** A short second line, usually the kind of step (\"HTTP request\", \"Approval\"). */\n supportingText?: string;\n /** Material Symbols name for the icon tile. */\n icon?: string;\n accent?: WorkflowAccent;\n /** The step type's `kind`, for your own lookups. */\n kind?: string;\n /** Marks the step as needing attention; `errorText` says why. */\n invalid?: boolean;\n errorText?: string;\n /** Starts a branch or loop collapsed. */\n collapsed?: boolean;\n /** The step's data is pinned for testing: shown with a pin badge. */\n pinned?: boolean;\n /** Your own data, kept with the step. */\n data?: Record<string, unknown>;\n}\n\nexport interface WorkflowActionStep extends WorkflowStepBase {\n type: 'action';\n fields?: WorkflowField[];\n outputs?: WorkflowOutput[];\n tools?: WorkflowTool[];\n assignee?: WorkflowAssignee;\n /** Steps that run when this step fails, drawn as a side path. */\n onError?: WorkflowStep[];\n}\n\nexport interface WorkflowPath {\n id: string;\n /** Shown on the pill at the top of the path, for example \"amount > 1,000\" or \"Otherwise\". */\n label: string;\n /** The default path (\"else\"), shown in a quieter pill. */\n isDefault?: boolean;\n /** Your own condition, for example a `wc-condition-builder` value. */\n condition?: unknown;\n steps: WorkflowStep[];\n}\n\nexport interface WorkflowBranchStep extends WorkflowStepBase {\n /** `branch` runs the first path whose condition holds; `parallel` runs every path and waits for all. */\n type: 'branch' | 'parallel';\n paths: WorkflowPath[];\n}\n\nexport interface WorkflowLoopStep extends WorkflowStepBase {\n type: 'loop';\n mode?: 'for-each' | 'while' | 'until';\n /** What the loop goes over or tests, for example `{{Trigger.line_items}}`. */\n over?: string;\n steps: WorkflowStep[];\n}\n\nexport interface WorkflowWaitStep extends WorkflowStepBase {\n type: 'wait';\n /** A time or event, for example \"3 days\" or \"Approval received\". */\n until?: string;\n}\n\nexport interface WorkflowEndStep extends WorkflowStepBase {\n type: 'end';\n}\n\nexport type WorkflowStep =\n | WorkflowActionStep\n | WorkflowBranchStep\n | WorkflowLoopStep\n | WorkflowWaitStep\n | WorkflowEndStep;\n\n/* eslint-enable no-use-before-define */\n\nexport interface WorkflowValue {\n /** What starts the workflow, drawn first. */\n trigger?: WorkflowActionStep;\n steps: WorkflowStep[];\n}\n\n/** Where one step is in a run. */\nexport type WorkflowRunStepStatus =\n | 'queued'\n | 'running'\n | 'waiting'\n | 'paused'\n | 'success'\n | 'failed'\n | 'skipped'\n | 'canceled';\n\n/** What happened to one step in a run. */\nexport interface WorkflowRunStep {\n status: WorkflowRunStepStatus;\n /** When the step started, in milliseconds (an epoch time or an offset from the run's start). */\n startedAt?: number;\n durationMs?: number;\n input?: unknown;\n output?: unknown;\n error?: { message: string; detail?: string };\n /** How many times the step has been tried. */\n attempts?: number;\n /** For a loop: what each iteration did, keyed by the ids of the steps inside. */\n iterations?: Record<string, WorkflowRunStep>[];\n}\n\n/** A run of the workflow, for debugging and run history. Your engine produces it; the component only shows it. */\nexport interface WorkflowRun {\n id: string;\n status: 'running' | 'paused' | 'success' | 'failed' | 'canceled';\n startedAt?: number;\n durationMs?: number;\n /** The step running now, or paused on. */\n current?: string;\n steps: Record<string, WorkflowRunStep>;\n}\n\n/** Whether a run step has been reached: it is running, waiting, paused or done. */\nexport function isReached(status: WorkflowRunStepStatus | undefined): boolean {\n return (\n status === 'running' ||\n status === 'waiting' ||\n status === 'paused' ||\n status === 'success' ||\n status === 'failed'\n );\n}\n\n/** An entry in the add-step palette. */\nexport interface WorkflowStepType {\n /** Your identifier, copied to the new step's `kind`. */\n kind: string;\n type: WorkflowStep['type'];\n headline: string;\n supportingText?: string;\n icon?: string;\n accent?: WorkflowAccent;\n /** Heading the entry is grouped under. */\n category?: string;\n /** Offered only when adding a trigger. */\n trigger?: boolean;\n /** Extra fields for new steps of this type, such as `fields` or `paths`. */\n defaults?: Partial<WorkflowStep>;\n}\n\n/** Where a list of steps lives: the main sequence, a branch path, a loop body or an error path. */\nexport type WorkflowListRef =\n | { kind: 'root' }\n | { kind: 'path'; stepId: string; pathId: string }\n | { kind: 'loop'; stepId: string }\n | { kind: 'error'; stepId: string };\n\n/** Logic steps offered when `step-types` is not set. */\nexport const WORKFLOW_LOGIC_STEPS: WorkflowStepType[] = [\n {\n kind: 'branch',\n type: 'branch',\n headline: 'Branch',\n supportingText: 'If / else',\n icon: 'call_split',\n accent: 'orange',\n category: 'Logic',\n },\n {\n kind: 'parallel',\n type: 'parallel',\n headline: 'Parallel',\n supportingText: 'Run paths together',\n icon: 'alt_route',\n accent: 'orange',\n category: 'Logic',\n },\n {\n kind: 'loop',\n type: 'loop',\n headline: 'Loop',\n supportingText: 'For each item',\n icon: 'repeat',\n accent: 'purple',\n category: 'Logic',\n },\n {\n kind: 'wait',\n type: 'wait',\n headline: 'Wait',\n supportingText: 'Delay or event',\n icon: 'schedule',\n accent: 'yellow',\n category: 'Logic',\n },\n {\n kind: 'end',\n type: 'end',\n headline: 'End',\n icon: 'stop_circle',\n accent: 'neutral',\n category: 'Logic',\n },\n];\n\nexport function listKey(ref: WorkflowListRef): string {\n switch (ref.kind) {\n case 'path':\n return `path:${ref.stepId}:${ref.pathId}`;\n case 'loop':\n return `loop:${ref.stepId}`;\n case 'error':\n return `error:${ref.stepId}`;\n default:\n return 'root';\n }\n}\n\n/** The lists of steps directly inside `step`, with their references. */\nexport function childLists(\n step: WorkflowStep,\n): { ref: WorkflowListRef; steps: WorkflowStep[] }[] {\n if (step.type === 'branch' || step.type === 'parallel') {\n return step.paths.map(p => ({\n ref: { kind: 'path', stepId: step.id, pathId: p.id },\n steps: p.steps,\n }));\n }\n if (step.type === 'loop') {\n return [{ ref: { kind: 'loop', stepId: step.id }, steps: step.steps }];\n }\n if (step.type === 'action' && step.onError) {\n return [{ ref: { kind: 'error', stepId: step.id }, steps: step.onError }];\n }\n return [];\n}\n\nexport interface WalkEntry {\n step: WorkflowStep;\n ref: WorkflowListRef;\n index: number;\n depth: number;\n parent?: WorkflowStep;\n}\n\n/** Visits every step in reading order: a block, then what is inside it, then what follows. */\nexport function walk(\n value: WorkflowValue,\n visit: (entry: WalkEntry) => void,\n options: { skip?: (step: WorkflowStep) => boolean } = {},\n) {\n const visitList = (\n steps: WorkflowStep[],\n ref: WorkflowListRef,\n depth: number,\n parent?: WorkflowStep,\n ) => {\n steps.forEach((step, index) => {\n visit({ step, ref, index, depth, parent });\n if (!options.skip?.(step)) {\n for (const child of childLists(step)) {\n visitList(child.steps, child.ref, depth + 1, step);\n }\n }\n });\n };\n visitList(value.steps, { kind: 'root' }, 1);\n}\n\nexport function findStep(\n value: WorkflowValue,\n id: string,\n): WalkEntry | undefined {\n if (value.trigger?.id === id) {\n return { step: value.trigger, ref: { kind: 'root' }, index: -1, depth: 1 };\n }\n let found: WalkEntry | undefined;\n walk(value, entry => {\n if (!found && entry.step.id === id) found = entry;\n });\n return found;\n}\n\nexport function getList(\n value: WorkflowValue,\n ref: WorkflowListRef,\n): WorkflowStep[] | undefined {\n if (ref.kind === 'root') return value.steps;\n const owner = findStep(value, ref.stepId)?.step;\n if (!owner) return undefined;\n return childLists(owner).find(c => listKey(c.ref) === listKey(ref))?.steps;\n}\n\n/** Returns a new step list with `fn` applied to the list `ref` names, wherever it is nested. */\nfunction mapLists(\n steps: WorkflowStep[],\n ref: WorkflowListRef,\n fn: (list: WorkflowStep[]) => WorkflowStep[],\n): WorkflowStep[] {\n return steps.map(step => {\n if (ref.kind !== 'root' && step.id === ref.stepId) {\n if (\n ref.kind === 'path' &&\n (step.type === 'branch' || step.type === 'parallel')\n ) {\n return {\n ...step,\n paths: step.paths.map(p =>\n p.id === ref.pathId ? { ...p, steps: fn(p.steps) } : p,\n ),\n };\n }\n if (ref.kind === 'loop' && step.type === 'loop') {\n return { ...step, steps: fn(step.steps) };\n }\n if (ref.kind === 'error' && step.type === 'action') {\n return { ...step, onError: fn(step.onError ?? []) };\n }\n }\n if (step.type === 'branch' || step.type === 'parallel') {\n return {\n ...step,\n paths: step.paths.map(p => ({\n ...p,\n steps: mapLists(p.steps, ref, fn),\n })),\n };\n }\n if (step.type === 'loop')\n return { ...step, steps: mapLists(step.steps, ref, fn) };\n if (step.type === 'action' && step.onError) {\n return { ...step, onError: mapLists(step.onError, ref, fn) };\n }\n return step;\n });\n}\n\nexport function updateList(\n value: WorkflowValue,\n ref: WorkflowListRef,\n fn: (list: WorkflowStep[]) => WorkflowStep[],\n): WorkflowValue {\n if (ref.kind === 'root') return { ...value, steps: fn(value.steps) };\n return { ...value, steps: mapLists(value.steps, ref, fn) };\n}\n\nexport function insertStep(\n value: WorkflowValue,\n ref: WorkflowListRef,\n index: number,\n step: WorkflowStep,\n): WorkflowValue {\n return updateList(value, ref, list => [\n ...list.slice(0, index),\n step,\n ...list.slice(index),\n ]);\n}\n\nexport function removeStep(value: WorkflowValue, id: string): WorkflowValue {\n if (value.trigger?.id === id) {\n const rest = { ...value };\n delete rest.trigger;\n return rest;\n }\n const found = findStep(value, id);\n if (!found) return value;\n return updateList(value, found.ref, list => list.filter(s => s.id !== id));\n}\n\n/** Moves a step to `index` in `ref`, where the index counts the list before the move. */\nexport function moveStep(\n value: WorkflowValue,\n id: string,\n ref: WorkflowListRef,\n index: number,\n): WorkflowValue {\n const found = findStep(value, id);\n if (!found || found.index < 0) return value;\n let target = index;\n if (listKey(found.ref) === listKey(ref) && found.index < index) target -= 1;\n return insertStep(removeStep(value, id), ref, target, found.step);\n}\n\nexport function replaceStep(\n value: WorkflowValue,\n id: string,\n fn: (step: WorkflowStep) => WorkflowStep,\n): WorkflowValue {\n if (value.trigger?.id === id) {\n return { ...value, trigger: fn(value.trigger) as WorkflowActionStep };\n }\n const found = findStep(value, id);\n if (!found) return value;\n return updateList(value, found.ref, list =>\n list.map(s => (s.id === id ? fn(s) : s)),\n );\n}\n\n/** Whether `id` is `step` or somewhere inside it. */\nexport function contains(step: WorkflowStep, id: string): boolean {\n if (step.id === id) return true;\n return childLists(step).some(c => c.steps.some(s => contains(s, id)));\n}\n\n/** Every id used in the workflow. */\nexport function allIds(value: WorkflowValue): Set<string> {\n const ids = new Set<string>();\n if (value.trigger) ids.add(value.trigger.id);\n walk(value, ({ step }) => {\n ids.add(step.id);\n if (step.type === 'branch' || step.type === 'parallel') {\n for (const p of step.paths) ids.add(p.id);\n }\n });\n return ids;\n}\n\nexport function uniqueId(base: string, taken: Set<string>): string {\n const clean = base.replace(/[^a-zA-Z0-9_-]+/g, '-') || 'step';\n if (!taken.has(clean)) return clean;\n let i = 2;\n while (taken.has(`${clean}-${i}`)) i += 1;\n return `${clean}-${i}`;\n}\n\n/** A deep copy of `step` with fresh ids for it, its paths and everything inside. */\nexport function cloneWithNewIds(\n step: WorkflowStep,\n taken: Set<string>,\n): WorkflowStep {\n const fresh = (id: string) => {\n const next = uniqueId(`${id}-copy`, taken);\n taken.add(next);\n return next;\n };\n const cloneList = (steps: WorkflowStep[]) =>\n steps.map(s => cloneWithNewIds(s, taken));\n const id = fresh(step.id);\n if (step.type === 'branch' || step.type === 'parallel') {\n return {\n ...step,\n id,\n paths: step.paths.map(p => ({\n ...p,\n id: fresh(p.id),\n steps: cloneList(p.steps),\n })),\n };\n }\n if (step.type === 'loop')\n return { ...step, id, steps: cloneList(step.steps) };\n if (step.type === 'action' && step.onError) {\n return { ...step, id, onError: cloneList(step.onError) };\n }\n return { ...step, id };\n}\n\n/** Whether running a list of steps always stops before reaching what comes after it. */\nexport function listTerminates(steps: WorkflowStep[]): boolean {\n const last = steps[steps.length - 1];\n if (!last) return false;\n if (last.type === 'end') return true;\n if (last.type === 'branch' || last.type === 'parallel') {\n return (\n last.paths.length > 0 && last.paths.every(p => listTerminates(p.steps))\n );\n }\n return false;\n}\n\n/** Whether a block step stops the flow (every path ends). */\nexport function stepTerminates(step: WorkflowStep): boolean {\n return listTerminates([step]);\n}\n\n/** Counts the steps inside a block, for its collapsed summary. */\nexport function countInside(step: WorkflowStep): number {\n return childLists(step).reduce(\n (n, c) => n + c.steps.reduce((m, s) => m + 1 + countInside(s), 0),\n 0,\n );\n}\n\n/** Builds a new step from a palette entry. */\nexport function createStep(\n type: WorkflowStepType,\n taken: Set<string>,\n): WorkflowStep {\n const id = uniqueId(type.kind, taken);\n taken.add(id);\n const pathId = (n: number) => {\n const p = uniqueId(`${id}-path-${n}`, taken);\n taken.add(p);\n return p;\n };\n const base = {\n id,\n kind: type.kind,\n headline: type.headline,\n supportingText: type.supportingText,\n icon: type.icon,\n accent: type.accent,\n };\n let step: WorkflowStep;\n switch (type.type) {\n case 'branch':\n step = {\n ...base,\n type: 'branch',\n paths: [\n { id: pathId(1), label: 'If', steps: [] },\n { id: pathId(2), label: 'Otherwise', isDefault: true, steps: [] },\n ],\n };\n break;\n case 'parallel':\n step = {\n ...base,\n type: 'parallel',\n paths: [\n { id: pathId(1), label: 'Path 1', steps: [] },\n { id: pathId(2), label: 'Path 2', steps: [] },\n ],\n };\n break;\n case 'loop':\n step = { ...base, type: 'loop', mode: 'for-each', steps: [] };\n break;\n case 'wait':\n step = { ...base, type: 'wait' };\n break;\n case 'end':\n step = { ...base, type: 'end' };\n break;\n default:\n step = { ...base, type: 'action' };\n }\n return {\n ...step,\n ...(type.defaults ?? {}),\n id,\n type: step.type,\n } as W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AE,GAAG,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE;YAC/B;AACF,QAAA;YACE,IAAI,GAAG,EAAE,GAAG,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE;;IAEtC,OAAO;AACL,QAAA,GAAG,IAAI;AACP,QAAA,IAAI,IAAI,CAAC,QAAQ,IAAI,EAAE,CAAC;QACxB,EAAE;QACF,IAAI,EAAE,IAAI,CAAC,IAAI;KACA;AACnB;;;;"}
|
|
1
|
+
{"version":3,"file":"workflow-model-CauduOG2.js","sources":["../../src/workflow/workflow-model.ts"],"sourcesContent":["/** Colour of a step's icon tile, from the theme's accent palettes. */\nexport type WorkflowAccent =\n | 'primary'\n | 'tertiary'\n | 'blue'\n | 'green'\n | 'orange'\n | 'purple'\n | 'red'\n | 'yellow'\n | 'neutral';\n\n/** A label and value shown on a step card. `{{Step.output}}` in `value` renders as a data pill. */\nexport interface WorkflowField {\n label: string;\n value: string;\n}\n\n/** A value a step produces for later steps. */\nexport interface WorkflowOutput {\n name: string;\n type?: string;\n}\n\n/** A tool an AI agent step may call. */\nexport interface WorkflowTool {\n id: string;\n headline: string;\n icon?: string;\n}\n\n/** Who works on a human task. */\nexport interface WorkflowAssignee {\n name: string;\n src?: string;\n}\n\n// Steps nest steps, so these types refer to the union declared after them.\n/* eslint-disable no-use-before-define */\n\ninterface WorkflowStepBase {\n /** Unique across the whole workflow. */\n id: string;\n /** The step's title. */\n headline?: string;\n /** A short second line, usually the kind of step (\"HTTP request\", \"Approval\"). */\n supportingText?: string;\n /** Material Symbols name for the icon tile. */\n icon?: string;\n accent?: WorkflowAccent;\n /** The step type's `kind`, for your own lookups. */\n kind?: string;\n /** Marks the step as needing attention; `errorText` says why. */\n invalid?: boolean;\n errorText?: string;\n /** Starts a branch or loop collapsed. */\n collapsed?: boolean;\n /** The step's data is pinned for testing: shown with a pin badge. */\n pinned?: boolean;\n /** Your own data, kept with the step. */\n data?: Record<string, unknown>;\n}\n\nexport interface WorkflowActionStep extends WorkflowStepBase {\n type: 'action';\n fields?: WorkflowField[];\n outputs?: WorkflowOutput[];\n tools?: WorkflowTool[];\n assignee?: WorkflowAssignee;\n /** Steps that run when this step fails, drawn as a side path. */\n onError?: WorkflowStep[];\n}\n\nexport interface WorkflowPath {\n id: string;\n /** Shown on the pill at the top of the path, for example \"amount > 1,000\" or \"Otherwise\". */\n label: string;\n /** The default path (\"else\"), shown in a quieter pill. */\n isDefault?: boolean;\n /** Your own condition, for example a `wc-condition-builder` value. */\n condition?: unknown;\n steps: WorkflowStep[];\n}\n\nexport interface WorkflowBranchStep extends WorkflowStepBase {\n /** `branch` runs the first path whose condition holds; `parallel` runs every path. */\n type: 'branch' | 'parallel';\n /**\n * For `parallel`: `all` (the default) goes on when every path has ended; `first` goes on when one\n * has, and stops the others.\n */\n mode?: 'all' | 'first';\n paths: WorkflowPath[];\n}\n\nexport interface WorkflowLoopStep extends WorkflowStepBase {\n type: 'loop';\n /** `for-each` item of a list, `times` a number of passes, `while` or `until` a condition. */\n mode?: 'for-each' | 'times' | 'while' | 'until';\n /**\n * What the loop goes over, counts or tests: `{{Trigger.line_items}}`, `3` or\n * `{{Settings.levels}}` for `times`, a condition for `while` and `until`.\n */\n over?: string;\n steps: WorkflowStep[];\n}\n\nexport interface WorkflowWaitStep extends WorkflowStepBase {\n type: 'wait';\n /** A time or event, for example \"3 days\" or \"Approval received\". */\n until?: string;\n}\n\nexport interface WorkflowEndStep extends WorkflowStepBase {\n type: 'end';\n}\n\nexport type WorkflowStep =\n | WorkflowActionStep\n | WorkflowBranchStep\n | WorkflowLoopStep\n | WorkflowWaitStep\n | WorkflowEndStep;\n\n/* eslint-enable no-use-before-define */\n\nexport interface WorkflowValue {\n /** What starts the workflow, drawn first. */\n trigger?: WorkflowActionStep;\n steps: WorkflowStep[];\n}\n\n/** Where one step is in a run. */\nexport type WorkflowRunStepStatus =\n | 'queued'\n | 'running'\n | 'waiting'\n | 'paused'\n | 'success'\n | 'failed'\n | 'skipped'\n | 'canceled';\n\n/** What happened to one step in a run. */\nexport interface WorkflowRunStep {\n status: WorkflowRunStepStatus;\n /** When the step started, in milliseconds (an epoch time or an offset from the run's start). */\n startedAt?: number;\n durationMs?: number;\n input?: unknown;\n output?: unknown;\n error?: { message: string; detail?: string };\n /** How many times the step has been tried. */\n attempts?: number;\n /** For a loop: what each iteration did, keyed by the ids of the steps inside. */\n iterations?: Record<string, WorkflowRunStep>[];\n}\n\n/** A run of the workflow, for debugging and run history. Your engine produces it; the component only shows it. */\nexport interface WorkflowRun {\n id: string;\n status: 'running' | 'paused' | 'success' | 'failed' | 'canceled';\n startedAt?: number;\n durationMs?: number;\n /** The step running now, or paused on. */\n current?: string;\n steps: Record<string, WorkflowRunStep>;\n}\n\n/** Whether a run step has been reached: it is running, waiting, paused or done. */\nexport function isReached(status: WorkflowRunStepStatus | undefined): boolean {\n return (\n status === 'running' ||\n status === 'waiting' ||\n status === 'paused' ||\n status === 'success' ||\n status === 'failed'\n );\n}\n\n/** An entry in the add-step palette. */\nexport interface WorkflowStepType {\n /** Your identifier, copied to the new step's `kind`. */\n kind: string;\n type: WorkflowStep['type'];\n headline: string;\n supportingText?: string;\n icon?: string;\n accent?: WorkflowAccent;\n /** Heading the entry is grouped under. */\n category?: string;\n /** Offered only when adding a trigger. */\n trigger?: boolean;\n /** Extra fields for new steps of this type, such as `fields` or `paths`. */\n defaults?: Partial<WorkflowStep>;\n}\n\n/** Where a list of steps lives: the main sequence, a branch path, a loop body or an error path. */\nexport type WorkflowListRef =\n | { kind: 'root' }\n | { kind: 'path'; stepId: string; pathId: string }\n | { kind: 'loop'; stepId: string }\n | { kind: 'error'; stepId: string };\n\n/** Logic steps offered when `step-types` is not set. */\nexport const WORKFLOW_LOGIC_STEPS: WorkflowStepType[] = [\n {\n kind: 'branch',\n type: 'branch',\n headline: 'Branch',\n supportingText: 'If / else',\n icon: 'call_split',\n accent: 'orange',\n category: 'Logic',\n },\n {\n kind: 'parallel',\n type: 'parallel',\n headline: 'Parallel',\n supportingText: 'Run paths together',\n icon: 'alt_route',\n accent: 'orange',\n category: 'Logic',\n },\n {\n kind: 'loop',\n type: 'loop',\n headline: 'Loop',\n supportingText: 'For each item',\n icon: 'repeat',\n accent: 'purple',\n category: 'Logic',\n },\n {\n kind: 'wait',\n type: 'wait',\n headline: 'Wait',\n supportingText: 'Delay or event',\n icon: 'schedule',\n accent: 'yellow',\n category: 'Logic',\n },\n {\n kind: 'end',\n type: 'end',\n headline: 'End',\n icon: 'stop_circle',\n accent: 'neutral',\n category: 'Logic',\n },\n];\n\nexport function listKey(ref: WorkflowListRef): string {\n switch (ref.kind) {\n case 'path':\n return `path:${ref.stepId}:${ref.pathId}`;\n case 'loop':\n return `loop:${ref.stepId}`;\n case 'error':\n return `error:${ref.stepId}`;\n default:\n return 'root';\n }\n}\n\n/** The lists of steps directly inside `step`, with their references. */\nexport function childLists(\n step: WorkflowStep,\n): { ref: WorkflowListRef; steps: WorkflowStep[] }[] {\n if (step.type === 'branch' || step.type === 'parallel') {\n return step.paths.map(p => ({\n ref: { kind: 'path', stepId: step.id, pathId: p.id },\n steps: p.steps,\n }));\n }\n if (step.type === 'loop') {\n return [{ ref: { kind: 'loop', stepId: step.id }, steps: step.steps }];\n }\n if (step.type === 'action' && step.onError) {\n return [{ ref: { kind: 'error', stepId: step.id }, steps: step.onError }];\n }\n return [];\n}\n\nexport interface WalkEntry {\n step: WorkflowStep;\n ref: WorkflowListRef;\n index: number;\n depth: number;\n parent?: WorkflowStep;\n}\n\n/** Visits every step in reading order: a block, then what is inside it, then what follows. */\nexport function walk(\n value: WorkflowValue,\n visit: (entry: WalkEntry) => void,\n options: { skip?: (step: WorkflowStep) => boolean } = {},\n) {\n const visitList = (\n steps: WorkflowStep[],\n ref: WorkflowListRef,\n depth: number,\n parent?: WorkflowStep,\n ) => {\n steps.forEach((step, index) => {\n visit({ step, ref, index, depth, parent });\n if (!options.skip?.(step)) {\n for (const child of childLists(step)) {\n visitList(child.steps, child.ref, depth + 1, step);\n }\n }\n });\n };\n visitList(value.steps, { kind: 'root' }, 1);\n}\n\nexport function findStep(\n value: WorkflowValue,\n id: string,\n): WalkEntry | undefined {\n if (value.trigger?.id === id) {\n return { step: value.trigger, ref: { kind: 'root' }, index: -1, depth: 1 };\n }\n let found: WalkEntry | undefined;\n walk(value, entry => {\n if (!found && entry.step.id === id) found = entry;\n });\n return found;\n}\n\nexport function getList(\n value: WorkflowValue,\n ref: WorkflowListRef,\n): WorkflowStep[] | undefined {\n if (ref.kind === 'root') return value.steps;\n const owner = findStep(value, ref.stepId)?.step;\n if (!owner) return undefined;\n return childLists(owner).find(c => listKey(c.ref) === listKey(ref))?.steps;\n}\n\n/** Returns a new step list with `fn` applied to the list `ref` names, wherever it is nested. */\nfunction mapLists(\n steps: WorkflowStep[],\n ref: WorkflowListRef,\n fn: (list: WorkflowStep[]) => WorkflowStep[],\n): WorkflowStep[] {\n return steps.map(step => {\n if (ref.kind !== 'root' && step.id === ref.stepId) {\n if (\n ref.kind === 'path' &&\n (step.type === 'branch' || step.type === 'parallel')\n ) {\n return {\n ...step,\n paths: step.paths.map(p =>\n p.id === ref.pathId ? { ...p, steps: fn(p.steps) } : p,\n ),\n };\n }\n if (ref.kind === 'loop' && step.type === 'loop') {\n return { ...step, steps: fn(step.steps) };\n }\n if (ref.kind === 'error' && step.type === 'action') {\n return { ...step, onError: fn(step.onError ?? []) };\n }\n }\n if (step.type === 'branch' || step.type === 'parallel') {\n return {\n ...step,\n paths: step.paths.map(p => ({\n ...p,\n steps: mapLists(p.steps, ref, fn),\n })),\n };\n }\n if (step.type === 'loop')\n return { ...step, steps: mapLists(step.steps, ref, fn) };\n if (step.type === 'action' && step.onError) {\n return { ...step, onError: mapLists(step.onError, ref, fn) };\n }\n return step;\n });\n}\n\nexport function updateList(\n value: WorkflowValue,\n ref: WorkflowListRef,\n fn: (list: WorkflowStep[]) => WorkflowStep[],\n): WorkflowValue {\n if (ref.kind === 'root') return { ...value, steps: fn(value.steps) };\n return { ...value, steps: mapLists(value.steps, ref, fn) };\n}\n\nexport function insertStep(\n value: WorkflowValue,\n ref: WorkflowListRef,\n index: number,\n step: WorkflowStep,\n): WorkflowValue {\n return updateList(value, ref, list => [\n ...list.slice(0, index),\n step,\n ...list.slice(index),\n ]);\n}\n\nexport function removeStep(value: WorkflowValue, id: string): WorkflowValue {\n if (value.trigger?.id === id) {\n const rest = { ...value };\n delete rest.trigger;\n return rest;\n }\n const found = findStep(value, id);\n if (!found) return value;\n return updateList(value, found.ref, list => list.filter(s => s.id !== id));\n}\n\n/** Moves a step to `index` in `ref`, where the index counts the list before the move. */\nexport function moveStep(\n value: WorkflowValue,\n id: string,\n ref: WorkflowListRef,\n index: number,\n): WorkflowValue {\n const found = findStep(value, id);\n if (!found || found.index < 0) return value;\n let target = index;\n if (listKey(found.ref) === listKey(ref) && found.index < index) target -= 1;\n return insertStep(removeStep(value, id), ref, target, found.step);\n}\n\nexport function replaceStep(\n value: WorkflowValue,\n id: string,\n fn: (step: WorkflowStep) => WorkflowStep,\n): WorkflowValue {\n if (value.trigger?.id === id) {\n return { ...value, trigger: fn(value.trigger) as WorkflowActionStep };\n }\n const found = findStep(value, id);\n if (!found) return value;\n return updateList(value, found.ref, list =>\n list.map(s => (s.id === id ? fn(s) : s)),\n );\n}\n\n/** Whether `id` is `step` or somewhere inside it. */\nexport function contains(step: WorkflowStep, id: string): boolean {\n if (step.id === id) return true;\n return childLists(step).some(c => c.steps.some(s => contains(s, id)));\n}\n\n/** Every id used in the workflow. */\nexport function allIds(value: WorkflowValue): Set<string> {\n const ids = new Set<string>();\n if (value.trigger) ids.add(value.trigger.id);\n walk(value, ({ step }) => {\n ids.add(step.id);\n if (step.type === 'branch' || step.type === 'parallel') {\n for (const p of step.paths) ids.add(p.id);\n }\n });\n return ids;\n}\n\nexport function uniqueId(base: string, taken: Set<string>): string {\n const clean = base.replace(/[^a-zA-Z0-9_-]+/g, '-') || 'step';\n if (!taken.has(clean)) return clean;\n let i = 2;\n while (taken.has(`${clean}-${i}`)) i += 1;\n return `${clean}-${i}`;\n}\n\n/** A deep copy of `step` with fresh ids for it, its paths and everything inside. */\nexport function cloneWithNewIds(\n step: WorkflowStep,\n taken: Set<string>,\n): WorkflowStep {\n const fresh = (id: string) => {\n const next = uniqueId(`${id}-copy`, taken);\n taken.add(next);\n return next;\n };\n const cloneList = (steps: WorkflowStep[]) =>\n steps.map(s => cloneWithNewIds(s, taken));\n const id = fresh(step.id);\n if (step.type === 'branch' || step.type === 'parallel') {\n return {\n ...step,\n id,\n paths: step.paths.map(p => ({\n ...p,\n id: fresh(p.id),\n steps: cloneList(p.steps),\n })),\n };\n }\n if (step.type === 'loop')\n return { ...step, id, steps: cloneList(step.steps) };\n if (step.type === 'action' && step.onError) {\n return { ...step, id, onError: cloneList(step.onError) };\n }\n return { ...step, id };\n}\n\n/** Whether running a list of steps always stops before reaching what comes after it. */\nexport function listTerminates(steps: WorkflowStep[]): boolean {\n const last = steps[steps.length - 1];\n if (!last) return false;\n if (last.type === 'end') return true;\n if (last.type === 'branch' || last.type === 'parallel') {\n return (\n last.paths.length > 0 && last.paths.every(p => listTerminates(p.steps))\n );\n }\n return false;\n}\n\n/** Whether a block step stops the flow (every path ends). */\nexport function stepTerminates(step: WorkflowStep): boolean {\n return listTerminates([step]);\n}\n\n/** Counts the steps inside a block, for its collapsed summary. */\nexport function countInside(step: WorkflowStep): number {\n return childLists(step).reduce(\n (n, c) => n + c.steps.reduce((m, s) => m + 1 + countInside(s), 0),\n 0,\n );\n}\n\n/** Builds a new step from a palette entry. */\nexport function createStep(\n type: WorkflowStepType,\n taken: Set<string>,\n): WorkflowStep {\n const id = uniqueId(type.kind, taken);\n taken.add(id);\n const pathId = (n: number) => {\n const p = uniqueId(`${id}-path-${n}`, taken);\n taken.add(p);\n return p;\n };\n const base = {\n id,\n kind: type.kind,\n headline: type.headline,\n supportingText: type.supportingText,\n icon: type.icon,\n accent: type.accent,\n };\n let step: WorkflowStep;\n switch (type.type) {\n case 'branch':\n step = {\n ...base,\n type: 'branch',\n paths: [\n { id: pathId(1), label: 'If', steps: [] },\n { id: pathId(2), label: 'Otherwise', isDefault: true, steps: [] },\n ],\n };\n break;\n case 'parallel':\n step = {\n ...base,\n type: 'parallel',\n paths: [\n { id: pathId(1), label: 'Path 1', steps: [] },\n { id: pathId(2), label: 'Path 2', steps: [] },\n ],\n };\n break;\n case 'loop':\n step = { ...base, type: 'loop', mode: 'for-each', steps: [] };\n break;\n case 'wait':\n step = { ...base, type: 'wait' };\n break;\n case 'end':\n step = { ...base, type: 'end' };\n break;\n default:\n step = { ...base, type: 'action' };\n }\n return {\n ...step,\n ...(type.defaults ?? {}),\n id,\n type: step.type,\n } as WorkflowStep;\n}\n"],"names":[],"mappings":"AAyKA;AACM,SAAU,SAAS,CAAC,MAAyC,EAAA;IACjE,QACE,MAAM,KAAK,SAAS;AACpB,QAAA,MAAM,KAAK,SAAS;AACpB,QAAA,MAAM,KAAK,QAAQ;AACnB,QAAA,MAAM,KAAK,SAAS;QACpB,MAAM,KAAK,QAAQ;AAEvB;AA0BA;AACO,MAAM,oBAAoB,GAAuB;AACtD,IAAA;AACE,QAAA,IAAI,EAAE,QAAQ;AACd,QAAA,IAAI,EAAE,QAAQ;AACd,QAAA,QAAQ,EAAE,QAAQ;AAClB,QAAA,cAAc,EAAE,WAAW;AAC3B,QAAA,IAAI,EAAE,YAAY;AAClB,QAAA,MAAM,EAAE,QAAQ;AAChB,QAAA,QAAQ,EAAE,OAAO;AAClB,KAAA;AACD,IAAA;AACE,QAAA,IAAI,EAAE,UAAU;AAChB,QAAA,IAAI,EAAE,UAAU;AAChB,QAAA,QAAQ,EAAE,UAAU;AACpB,QAAA,cAAc,EAAE,oBAAoB;AACpC,QAAA,IAAI,EAAE,WAAW;AACjB,QAAA,MAAM,EAAE,QAAQ;AAChB,QAAA,QAAQ,EAAE,OAAO;AAClB,KAAA;AACD,IAAA;AACE,QAAA,IAAI,EAAE,MAAM;AACZ,QAAA,IAAI,EAAE,MA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,EAAE;AAC7C,oBAAA,EAAE,EAAE,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,EAAE,EAAE;AAC9C,iBAAA;aACF;YACD;AACF,QAAA,KAAK,MAAM;AACT,YAAA,IAAI,GAAG,EAAE,GAAG,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,EAAE,KAAK,EAAE,EAAE,EAAE;YAC7D;AACF,QAAA,KAAK,MAAM;YACT,IAAI,GAAG,EAAE,GAAG,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE;YAChC;AACF,QAAA,KAAK,KAAK;YACR,IAAI,GAAG,EAAE,GAAG,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE;YAC/B;AACF,QAAA;YACE,IAAI,GAAG,EAAE,GAAG,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE;;IAEtC,OAAO;AACL,QAAA,GAAG,IAAI;AACP,QAAA,IAAI,IAAI,CAAC,QAAQ,IAAI,EAAE,CAAC;QACxB,EAAE;QACF,IAAI,EAAE,IAAI,CAAC,IAAI;KACA;AACnB;;;;"}
|
|
@@ -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-
|
|
4
|
+
import { I as I18nController } from './i18n-controller-DNAjVSIP.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-
|
|
9
|
+
import './strings-BpCoUL0V.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-
|
|
6
|
+
import { D as DiagramCanvasElement, p as prefersReducedMotion, a as animateOut } from './canvas-base-Bfpv5_HJ.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-
|
|
14
|
-
import './strings-
|
|
13
|
+
import './i18n-controller-DNAjVSIP.js';
|
|
14
|
+
import './strings-BpCoUL0V.js';
|
|
15
15
|
import './locale-DEsJZCQG.js';
|
|
16
16
|
import './host-CZK7xhzh.js';
|
|
17
17
|
|
|
@@ -525,6 +525,9 @@ var css_248z = i`* {
|
|
|
525
525
|
color: var(--color-on-surface-variant);
|
|
526
526
|
border: 2px solid var(--workflow-connector-color);
|
|
527
527
|
}
|
|
528
|
+
.wf-join.is-bar.is-first {
|
|
529
|
+
border-style: dashed;
|
|
530
|
+
}
|
|
528
531
|
|
|
529
532
|
.wf-loop {
|
|
530
533
|
padding: 12px 24px 28px 40px;
|
|
@@ -2947,13 +2950,18 @@ let Workflow = Workflow_1 = class Workflow extends DiagramCanvasElement {
|
|
|
2947
2950
|
class=${e$1({
|
|
2948
2951
|
'wf-join': true,
|
|
2949
2952
|
'is-bar': step.type === 'parallel',
|
|
2953
|
+
'is-first': step.type === 'parallel' && step.mode === 'first',
|
|
2950
2954
|
})}
|
|
2951
2955
|
data-join-for=${step.id}
|
|
2952
2956
|
data-out-for=${step.id}
|
|
2953
2957
|
data-flip=${`join:${step.id}`}
|
|
2954
2958
|
>
|
|
2955
2959
|
${step.type === 'parallel'
|
|
2956
|
-
? b `<span
|
|
2960
|
+
? b `<span
|
|
2961
|
+
>${step.mode === 'first'
|
|
2962
|
+
? this.i18n.t('workflowFirstToFinish')
|
|
2963
|
+
: this.i18n.t('workflowWaitForAll')}</span
|
|
2964
|
+
>`
|
|
2957
2965
|
: A}
|
|
2958
2966
|
</div>`}
|
|
2959
2967
|
</div>`;
|
|
@@ -2961,6 +2969,7 @@ let Workflow = Workflow_1 = class Workflow extends DiagramCanvasElement {
|
|
|
2961
2969
|
if (step.type === 'loop' && !collapsed) {
|
|
2962
2970
|
const mode = {
|
|
2963
2971
|
'for-each': this.i18n.t('workflowLoopForEach'),
|
|
2972
|
+
times: this.i18n.t('workflowLoopTimes'),
|
|
2964
2973
|
while: this.i18n.t('workflowLoopWhile'),
|
|
2965
2974
|
until: this.i18n.t('workflowLoopUntil'),
|
|
2966
2975
|
}[step.mode ?? 'for-each'];
|
|
@@ -2975,7 +2984,9 @@ let Workflow = Workflow_1 = class Workflow extends DiagramCanvasElement {
|
|
|
2975
2984
|
${this.renderCard({ ...step, supportingText: step.supportingText ?? mode }, { ...ctx, inAnchor: false, outAnchor: false })}
|
|
2976
2985
|
${step.over
|
|
2977
2986
|
? b `<span class="wf-loop-over"
|
|
2978
|
-
>${this.renderValue(step.over)}
|
|
2987
|
+
>${this.renderValue(step.over)}${step.mode === 'times'
|
|
2988
|
+
? ` ${this.i18n.t('workflowLoopTimesSuffix')}`
|
|
2989
|
+
: A}</span
|
|
2979
2990
|
>`
|
|
2980
2991
|
: A}
|
|
2981
2992
|
${this.renderIterations(step.id)}
|