@redvars/peacock 4.3.4 → 4.5.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-BbOj212R.js} +3 -3
- package/dist/{BaseField-DPyW5Zm5.js.map → BaseField-BbOj212R.js.map} +1 -1
- package/dist/{BaseInput-FhjvfMjF.js → BaseInput-Cv03GZLu.js} +2 -2
- package/dist/{BaseInput-FhjvfMjF.js.map → BaseInput-Cv03GZLu.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-CqsyiVOV.js} +2 -2
- package/dist/{base-progress-D8-x6XS4.js.map → base-progress-CqsyiVOV.js.map} +1 -1
- package/dist/bottom-sheet.js +2 -2
- package/dist/breadcrumb.js +2 -2
- package/dist/calendar-column-view.js +648 -30
- package/dist/calendar-column-view.js.map +1 -1
- package/dist/calendar-drag-IXMPZrTN.js +344 -0
- package/dist/calendar-drag-IXMPZrTN.js.map +1 -0
- package/dist/{calendar-event-_OYdAT3c.js → calendar-event-BQChlMXy.js} +15 -4
- package/dist/calendar-event-BQChlMXy.js.map +1 -0
- package/dist/calendar-header-DVrfThwr.js +59 -0
- package/dist/calendar-header-DVrfThwr.js.map +1 -0
- package/dist/calendar-month-view.js +311 -21
- package/dist/calendar-month-view.js.map +1 -1
- package/dist/calendar-timeline.js +1877 -0
- package/dist/calendar-timeline.js.map +1 -0
- package/dist/calendar.js +224 -62
- package/dist/calendar.js.map +1 -1
- package/dist/{canvas-base-CjxNdEsR.js → canvas-base-BjiU3Ecl.js} +2 -2
- package/dist/{canvas-base-CjxNdEsR.js.map → canvas-base-BjiU3Ecl.js.map} +1 -1
- package/dist/carousel.js +2 -2
- package/dist/{cartesian-chart-D30aTNVm.js → cartesian-chart-iE3cmeGF.js} +2 -2
- package/dist/{cartesian-chart-D30aTNVm.js.map → cartesian-chart-iE3cmeGF.js.map} +1 -1
- package/dist/{cb-group-base-BhWC78b0.js → cb-group-base-CWctDJvy.js} +2 -2
- package/dist/{cb-group-base-BhWC78b0.js.map → cb-group-base-CWctDJvy.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-CDyVDmz7.js} +2 -2
- package/dist/{chart-base-D2kPte5J.js.map → chart-base-CDyVDmz7.js.map} +1 -1
- package/dist/chart-doughnut.js +3 -3
- package/dist/chart-line.js +4 -4
- package/dist/chart-pie.js +3 -3
- package/dist/chat-event.js +2 -2
- package/dist/chat-message.js +2 -2
- package/dist/chat-thread.js +2 -2
- package/dist/checkbox-group.js +3 -3
- package/dist/checkbox.js +3 -3
- package/dist/chip-set.js +2 -2
- package/dist/chip.js +2 -2
- package/dist/circular-progress.js +3 -3
- package/dist/citation.js +2 -2
- package/dist/code-editor.js +3 -3
- package/dist/code-highlighter.js +2 -2
- package/dist/color-field.js +4 -4
- package/dist/color-picker.js +2 -2
- package/dist/command-palette.js +2 -2
- package/dist/comment-composer.js +4 -4
- package/dist/condition-builder.js +3 -3
- package/dist/confirm-dialog.js +2 -2
- package/dist/copy-button.js +2 -2
- package/dist/currency-field.js +4 -4
- package/dist/custom-elements-jsdocs.json +52 -129
- package/dist/custom-elements.json +3109 -5
- package/dist/{date-vFrYT1S9.js → date-cfPx3alz.js} +20 -3
- package/dist/date-cfPx3alz.js.map +1 -0
- package/dist/date-field.js +8 -8
- package/dist/date-picker.js +4 -4
- package/dist/date-range-field.js +8 -8
- package/dist/datetime-field.js +7 -7
- 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-D2aM93kf.js} +2 -2
- package/dist/{diagram-BFGq2POp.js.map → diagram-D2aM93kf.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-BS6al7Hq.js} +2 -2
- package/dist/{document-editor-CC7MTHMO.js.map → document-editor-BS6al7Hq.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/{event-manager-CWAWPOUE.js → event-manager-KGMT2x2Q.js} +10 -8
- package/dist/event-manager-KGMT2x2Q.js.map +1 -0
- package/dist/file-upload.js +3 -3
- package/dist/filter-bar.js +4 -4
- package/dist/flow.js +4 -4
- package/dist/form.js +2 -2
- package/dist/{generative-view-DoT9YwHL.js → generative-view-DsSOPf26.js} +2 -2
- package/dist/{generative-view-DoT9YwHL.js.map → generative-view-DsSOPf26.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-BTeChxE0.js} +2 -2
- package/dist/{i18n-controller-Co6pasNo.js.map → i18n-controller-BTeChxE0.js.map} +1 -1
- package/dist/image.js +2 -2
- package/dist/index.js +26 -23
- package/dist/index.js.map +1 -1
- package/dist/inline-edit.js +2 -2
- package/dist/input.js +3 -3
- package/dist/json-viewer.js +2 -2
- package/dist/kanban.js +2 -2
- package/dist/kbd.js +2 -2
- package/dist/linear-progress.js +3 -3
- package/dist/listbox.js +2 -2
- package/dist/loader-full.js +13 -13
- package/dist/loader.js +17 -13
- package/dist/loader.js.map +1 -1
- package/dist/markdown-editor.js +4 -4
- package/dist/mention-input.js +4 -4
- package/dist/modal.js +2 -2
- package/dist/navigation-bar.js +2 -2
- package/dist/navigation-drawer.js +2 -2
- package/dist/navigation-rail.js +2 -2
- package/dist/notification-center.js +2 -2
- package/dist/number-field.js +4 -4
- package/dist/page-header.js +2 -2
- package/dist/pagination.js +2 -2
- package/dist/password-field.js +4 -4
- package/dist/password-rules.js +2 -2
- package/dist/phone-field.js +4 -4
- package/dist/{picker-field-BliKNENo.js → picker-field-DmXYPvbF.js} +3 -3
- package/dist/{picker-field-BliKNENo.js.map → picker-field-DmXYPvbF.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/{range-utils-BoKOhxVX.js → range-utils-DZe96GnO.js} +2 -2
- package/dist/{range-utils-BoKOhxVX.js.map → range-utils-DZe96GnO.js.map} +1 -1
- 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-BCZ46UF8.js} +3 -3
- package/dist/{rich-text-input-YeqK1or-.js.map → rich-text-input-BCZ46UF8.js.map} +1 -1
- package/dist/{schema-CuHBNpzo.js → schema-D0PCeIEA.js} +2 -2
- package/dist/{schema-CuHBNpzo.js.map → schema-D0PCeIEA.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 +20 -0
- package/dist/src/__internal/utils/date.d.ts +5 -0
- package/dist/src/calendar/base-event.d.ts +5 -0
- package/dist/src/calendar/calendar-column-view.d.ts +65 -1
- package/dist/src/calendar/calendar-drag.d.ts +91 -0
- package/dist/src/calendar/calendar-header.d.ts +28 -0
- package/dist/src/calendar/calendar-month-view.d.ts +39 -1
- package/dist/src/calendar/calendar.d.ts +83 -6
- package/dist/src/calendar/index.d.ts +2 -2
- package/dist/src/calendar/types.d.ts +32 -0
- package/dist/src/calendar/utils.d.ts +53 -0
- package/dist/src/calendar-timeline/calendar-timeline.d.ts +287 -0
- package/dist/src/calendar-timeline/index.d.ts +3 -0
- package/dist/src/calendar-timeline/layout.d.ts +39 -0
- package/dist/src/calendar-timeline/types.d.ts +60 -0
- package/dist/src/index.d.ts +4 -2
- 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-DeiQWMd9.js} +22 -1
- package/dist/strings-DeiQWMd9.js.map +1 -0
- package/dist/svg.js +2 -2
- package/dist/switch.js +3 -3
- package/dist/table.js +2 -2
- package/dist/test/calendar-timeline.test.d.ts +1 -0
- package/dist/textarea.js +4 -4
- package/dist/time-field.js +7 -7
- package/dist/time-picker.js +4 -4
- package/dist/timeline-item.js +2 -2
- package/dist/timeline.js +2 -2
- package/dist/{toggle-base-B-HOnUIy.js → toggle-base-BtjRAZ5z.js} +2 -2
- package/dist/{toggle-base-B-HOnUIy.js.map → toggle-base-BtjRAZ5z.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/{utils-D92ldd1V.js → utils-DcvLgexs.js} +116 -19
- package/dist/utils-DcvLgexs.js.map +1 -0
- package/dist/{video-u-Vs7M9g.js → video-DPjOBk6I.js} +2 -2
- package/dist/{video-u-Vs7M9g.js.map → video-DPjOBk6I.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/readme.md +1 -0
- package/src/__internal/i18n/strings.ts +29 -0
- package/src/__internal/utils/date.ts +19 -0
- package/src/calendar/_calendar-header.scss +33 -0
- package/src/calendar/base-event.ts +19 -2
- package/src/calendar/calendar-column-view.scss +174 -2
- package/src/calendar/calendar-column-view.ts +665 -37
- package/src/calendar/calendar-drag.ts +403 -0
- package/src/calendar/calendar-header.ts +78 -0
- package/src/calendar/calendar-month-view.scss +89 -0
- package/src/calendar/calendar-month-view.ts +289 -23
- package/src/calendar/calendar.scss +2 -27
- package/src/calendar/calendar.ts +264 -62
- package/src/calendar/event-manager.ts +11 -7
- package/src/calendar/index.ts +8 -2
- package/src/calendar/types.ts +35 -0
- package/src/calendar/utils.ts +160 -20
- package/src/calendar-timeline/calendar-timeline.scss +554 -0
- package/src/calendar-timeline/calendar-timeline.ts +1528 -0
- package/src/calendar-timeline/index.ts +14 -0
- package/src/calendar-timeline/layout.ts +129 -0
- package/src/calendar-timeline/types.ts +65 -0
- package/src/index.ts +18 -0
- package/src/loader.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/calendar-event-_OYdAT3c.js.map +0 -1
- package/dist/date-vFrYT1S9.js.map +0 -1
- package/dist/event-manager-CWAWPOUE.js.map +0 -1
- package/dist/strings-DYwXSSu_.js.map +0 -1
- package/dist/utils-D92ldd1V.js.map +0 -1
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-BTeChxE0.js';
|
|
4
|
+
import './strings-DeiQWMd9.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-BTeChxE0.js';
|
|
7
|
+
import { B as BaseField } from './BaseField-BbOj212R.js';
|
|
8
|
+
import { n as nativeValidity } from './BaseInput-Cv03GZLu.js';
|
|
9
9
|
import './base-Cl6v8-BZ.js';
|
|
10
10
|
import './directive-ZPhl09Yt.js';
|
|
11
|
-
import './strings-
|
|
11
|
+
import './strings-DeiQWMd9.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-BTeChxE0.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-DeiQWMd9.js';
|
|
9
9
|
import './locale-DEsJZCQG.js';
|
|
10
10
|
|
|
11
11
|
var css_248z = i`* {
|
|
@@ -78,6 +78,87 @@ function calculateDateRange(view, contextDate, days, weekStartsOn = 1) {
|
|
|
78
78
|
};
|
|
79
79
|
}
|
|
80
80
|
const LONG_EVENT_PADDING = 0.25;
|
|
81
|
+
/** Milliseconds in a day of 24 hours. */
|
|
82
|
+
const DAY_MS = 86400000;
|
|
83
|
+
/** Milliseconds in a minute. */
|
|
84
|
+
const MINUTE_MS = 60000;
|
|
85
|
+
function clamp(value, min, max) {
|
|
86
|
+
return Math.min(max, Math.max(min, value));
|
|
87
|
+
}
|
|
88
|
+
/** Whether `date` is at local midnight. */
|
|
89
|
+
function isMidnight(date) {
|
|
90
|
+
return (date.getHours() === 0 &&
|
|
91
|
+
date.getMinutes() === 0 &&
|
|
92
|
+
date.getSeconds() === 0 &&
|
|
93
|
+
date.getMilliseconds() === 0);
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Whether a range belongs in the all-day row: it lasts a day or more, or runs from one midnight to
|
|
97
|
+
* a later one (a day the clocks go forward on has only 23 hours).
|
|
98
|
+
*/
|
|
99
|
+
function isAllDayRange(start, end) {
|
|
100
|
+
const length = end.valueOf() - start.valueOf();
|
|
101
|
+
return (length >= DAY_MS || (length > 0 && isMidnight(start) && isMidnight(end)));
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* The last day a range covers. `end` is exclusive, so a range that ends at midnight ends the day
|
|
105
|
+
* before. Never earlier than the day of `start`.
|
|
106
|
+
*/
|
|
107
|
+
function lastDayOf(start, end) {
|
|
108
|
+
const first = startOfDay(start);
|
|
109
|
+
const last = startOfDay(new Date(end.valueOf() - 1));
|
|
110
|
+
return last.valueOf() < first.valueOf() ? first : last;
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Whether the range `start`–`end` (end exclusive) shares time with `from`–`to`. A range without
|
|
114
|
+
* length counts when its instant falls inside.
|
|
115
|
+
*/
|
|
116
|
+
function rangesOverlap(start, end, from, to) {
|
|
117
|
+
if (start.valueOf() >= end.valueOf()) {
|
|
118
|
+
return start.valueOf() >= from.valueOf() && start.valueOf() < to.valueOf();
|
|
119
|
+
}
|
|
120
|
+
return start.valueOf() < to.valueOf() && end.valueOf() > from.valueOf();
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* The start of the day after `date`'s. Unlike `addDays(day, 1)`, it lands on midnight even after a
|
|
124
|
+
* day whose midnight the clocks skipped, where `startOfDay` gives 01:00.
|
|
125
|
+
*/
|
|
126
|
+
function nextDay(date) {
|
|
127
|
+
return startOfDay(addDays(startOfDay(date), 1));
|
|
128
|
+
}
|
|
129
|
+
/** Minutes in a day on the wall clock, which the day and week views draw. */
|
|
130
|
+
const DAY_MINUTES = 1440;
|
|
131
|
+
/**
|
|
132
|
+
* Wall-clock minutes from the start of `day` to `date`: negative before it, 1440 or more after
|
|
133
|
+
* it. The day and week views draw 24 equal hours, also on the days the clocks change.
|
|
134
|
+
*/
|
|
135
|
+
function wallMinutes(date, day) {
|
|
136
|
+
return (differenceInDays(date, day) * DAY_MINUTES +
|
|
137
|
+
date.getHours() * 60 +
|
|
138
|
+
date.getMinutes() +
|
|
139
|
+
date.getSeconds() / 60 +
|
|
140
|
+
date.getMilliseconds() / MINUTE_MS);
|
|
141
|
+
}
|
|
142
|
+
/** The time `minutes` after the start of `day` on the wall clock; 1440 is the next midnight. */
|
|
143
|
+
function atWallMinutes(day, minutes) {
|
|
144
|
+
const date = startOfDay(day);
|
|
145
|
+
date.setHours(0, 0, 0, Math.round(minutes * MINUTE_MS));
|
|
146
|
+
return date;
|
|
147
|
+
}
|
|
148
|
+
/** The time at `fraction` (0 to 1) down `day`'s column: the inverse of `getTimePercent`. */
|
|
149
|
+
function timeAtFraction(day, fraction) {
|
|
150
|
+
return atWallMinutes(day, clamp(fraction, 0, 1) * DAY_MINUTES);
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* `date` moved to a multiple of `minutes` on the wall clock after the start of `day` (by default
|
|
154
|
+
* its own day): the nearest one, or the one before or after. The result stays within `day`, whose
|
|
155
|
+
* end is the next midnight.
|
|
156
|
+
*/
|
|
157
|
+
function snapTime(date, minutes, mode = 'round', day = date) {
|
|
158
|
+
const step = Math.max(1, minutes);
|
|
159
|
+
const steps = Math[mode](wallMinutes(date, day) / step);
|
|
160
|
+
return atWallMinutes(day, clamp(steps * step, 0, DAY_MINUTES));
|
|
161
|
+
}
|
|
81
162
|
/**
|
|
82
163
|
* The wall-clock fields `date` shows in `timeZone` (an IANA name such as `America/New_York`),
|
|
83
164
|
* read from `Intl.DateTimeFormat#formatToParts`. Throws a `RangeError` for an unknown zone.
|
|
@@ -147,18 +228,38 @@ function formatDate(date, pattern, locale = resolveLocale()) {
|
|
|
147
228
|
return date.toLocaleDateString(locale);
|
|
148
229
|
return new Intl.DateTimeFormat(locale, options).format(date);
|
|
149
230
|
}
|
|
150
|
-
/**
|
|
151
|
-
function
|
|
152
|
-
const format = new Intl.DateTimeFormat(locale, allDay
|
|
153
|
-
? { dateStyle: 'medium' }
|
|
154
|
-
: { dateStyle: 'medium', timeStyle: 'short' });
|
|
155
|
-
let when;
|
|
231
|
+
/** `format.formatRange`, or both dates joined by a dash where it is missing or throws. */
|
|
232
|
+
function formatRange(format, start, end) {
|
|
156
233
|
try {
|
|
157
|
-
|
|
234
|
+
return format.formatRange(start, end);
|
|
158
235
|
}
|
|
159
236
|
catch {
|
|
160
|
-
|
|
237
|
+
return `${format.format(start)} – ${format.format(end)}`;
|
|
161
238
|
}
|
|
239
|
+
}
|
|
240
|
+
/**
|
|
241
|
+
* When an event happens, for example `Nov 6, 2026, 9:00 – 9:30 AM`. An all-day event shows its
|
|
242
|
+
* days only, through the day before an `end` at midnight.
|
|
243
|
+
*/
|
|
244
|
+
function formatEventWhen(start, end, locale, allDay = false) {
|
|
245
|
+
if (allDay) {
|
|
246
|
+
const format = new Intl.DateTimeFormat(locale, { dateStyle: 'medium' });
|
|
247
|
+
return formatRange(format, start, lastDayOf(start, end));
|
|
248
|
+
}
|
|
249
|
+
const format = new Intl.DateTimeFormat(locale, {
|
|
250
|
+
dateStyle: 'medium',
|
|
251
|
+
timeStyle: 'short',
|
|
252
|
+
});
|
|
253
|
+
return formatRange(format, start, end);
|
|
254
|
+
}
|
|
255
|
+
/** The times of a range without its date, for example `9:00 – 10:30 AM`. */
|
|
256
|
+
function formatTimeRange(start, end, locale) {
|
|
257
|
+
const format = new Intl.DateTimeFormat(locale, { timeStyle: 'short' });
|
|
258
|
+
return formatRange(format, start, end);
|
|
259
|
+
}
|
|
260
|
+
/** Accessible name of an event: its title and when it happens, for example `Standup, Nov 6, 2026, 9:00 – 9:30 AM`. */
|
|
261
|
+
function formatEventLabel(title, start, end, locale, allDay = false) {
|
|
262
|
+
const when = formatEventWhen(start, end, locale, allDay);
|
|
162
263
|
return title ? `${title}, ${when}` : when;
|
|
163
264
|
}
|
|
164
265
|
/** Runs `action` on Enter or Space, the keys that activate a button. */
|
|
@@ -170,17 +271,13 @@ function onActivateKey(action) {
|
|
|
170
271
|
action();
|
|
171
272
|
};
|
|
172
273
|
}
|
|
274
|
+
/**
|
|
275
|
+
* How far down `forDay`'s column (by default `date`'s own day) `date` falls, in percent, on a
|
|
276
|
+
* 24-hour wall clock: a 9:00 event sits at the 9 AM row also on the days the clocks change.
|
|
277
|
+
*/
|
|
173
278
|
function getTimePercent(date, forDay) {
|
|
174
|
-
|
|
175
|
-
const sd = startOfDay(day);
|
|
176
|
-
const ed = endOfDay(day);
|
|
177
|
-
const percent = ((date.valueOf() - sd.valueOf()) / (ed.valueOf() - sd.valueOf())) * 100;
|
|
178
|
-
if (percent < 0)
|
|
179
|
-
return 0;
|
|
180
|
-
if (percent > 100)
|
|
181
|
-
return 100;
|
|
182
|
-
return percent;
|
|
279
|
+
return clamp((wallMinutes(date, forDay || date) / DAY_MINUTES) * 100, 0, 100);
|
|
183
280
|
}
|
|
184
281
|
|
|
185
|
-
export { LONG_EVENT_PADDING as L, addDays as a,
|
|
186
|
-
//# sourceMappingURL=utils-
|
|
282
|
+
export { atWallMinutes as A, LONG_EVENT_PADDING as L, MINUTE_MS as M, addDays as a, startOfDay as b, addMonths as c, differenceInDays as d, endOfDay as e, formatEventWhen as f, formatEventLabel as g, formatDate as h, isAllDayRange as i, getTimePercent as j, calculateDateRange as k, lastDayOf as l, timeAtFraction as m, nextDay as n, snapTime as o, clamp as p, onActivateKey as q, rangesOverlap as r, startOfWeek as s, toZonedWallClock as t, addHours as u, formatTimeRange as v, calculateMonthRange as w, startOfMonth as x, endOfMonth as y, wallMinutes as z };
|
|
283
|
+
//# sourceMappingURL=utils-DcvLgexs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils-DcvLgexs.js","sources":["../../src/calendar/utils.ts"],"sourcesContent":["/**\n * Pure date utility functions (no external dependencies).\n */\n\nimport { resolveLocale } from '@/__internal/i18n/locale.js';\n\nexport function startOfDay(date: Date): Date {\n const d = new Date(date);\n d.setHours(0, 0, 0, 0);\n return d;\n}\n\nexport function endOfDay(date: Date): Date {\n const d = new Date(date);\n d.setHours(23, 59, 59, 999);\n return d;\n}\n\nexport function addDays(date: Date, days: number): Date {\n const d = new Date(date);\n d.setDate(d.getDate() + days);\n return d;\n}\n\nexport function addMonths(date: Date, months: number): Date {\n const d = new Date(date);\n d.setMonth(d.getMonth() + months);\n return d;\n}\n\nexport function addHours(date: Date, hours: number): Date {\n const d = new Date(date);\n d.setHours(d.getHours() + hours);\n return d;\n}\n\nexport function differenceInDays(dateA: Date, dateB: Date): number {\n const a = startOfDay(dateA);\n const b = startOfDay(dateB);\n return Math.round((a.valueOf() - b.valueOf()) / 86400000);\n}\n\nexport function startOfWeek(\n date: Date,\n weekStartsOn: 0 | 1 | 2 | 3 | 4 | 5 | 6 = 1,\n): Date {\n const d = startOfDay(date);\n const day = d.getDay();\n const diff = (day < weekStartsOn ? 7 : 0) + day - weekStartsOn;\n d.setDate(d.getDate() - diff);\n return d;\n}\n\nexport function endOfWeek(\n date: Date,\n weekStartsOn: 0 | 1 | 2 | 3 | 4 | 5 | 6 = 1,\n): Date {\n const d = startOfWeek(date, weekStartsOn);\n d.setDate(d.getDate() + 6);\n return endOfDay(d);\n}\n\nexport function startOfMonth(date: Date): Date {\n const d = new Date(date);\n d.setDate(1);\n d.setHours(0, 0, 0, 0);\n return d;\n}\n\nexport function endOfMonth(date: Date): Date {\n const d = new Date(date);\n d.setMonth(d.getMonth() + 1, 0);\n d.setHours(23, 59, 59, 999);\n return d;\n}\n\nexport function calculateMonthRange(\n date: Date,\n weekStartsOn: 0 | 1 | 2 | 3 | 4 | 5 | 6 = 1,\n) {\n const sd = startOfWeek(startOfMonth(date), weekStartsOn);\n const ed = endOfWeek(endOfMonth(date), weekStartsOn);\n return { startDate: sd, endDate: ed, totalDays: 42 };\n}\n\nexport function calculateWeekRange(\n date: Date,\n weekStartsOn: 0 | 1 | 2 | 3 | 4 | 5 | 6 = 1,\n) {\n const sd = startOfWeek(date, weekStartsOn);\n const ed = endOfWeek(date, weekStartsOn);\n return { startDate: sd, endDate: ed, totalDays: 7 };\n}\n\nexport function calculateDateRange(\n view: string,\n contextDate: Date,\n days: number,\n weekStartsOn: 0 | 1 | 2 | 3 | 4 | 5 | 6 = 1,\n) {\n if (view === 'week') {\n return calculateWeekRange(contextDate, weekStartsOn);\n }\n return {\n startDate: startOfDay(contextDate),\n endDate: endOfDay(addDays(contextDate, days - 1)),\n totalDays: days,\n };\n}\n\nexport const LONG_EVENT_PADDING = 0.25;\n\n/** Milliseconds in a day of 24 hours. */\nexport const DAY_MS = 86400000;\n\n/** Milliseconds in a minute. */\nexport const MINUTE_MS = 60000;\n\nexport function clamp(value: number, min: number, max: number): number {\n return Math.min(max, Math.max(min, value));\n}\n\n/** Whether `date` is at local midnight. */\nexport function isMidnight(date: Date): boolean {\n return (\n date.getHours() === 0 &&\n date.getMinutes() === 0 &&\n date.getSeconds() === 0 &&\n date.getMilliseconds() === 0\n );\n}\n\n/**\n * Whether a range belongs in the all-day row: it lasts a day or more, or runs from one midnight to\n * a later one (a day the clocks go forward on has only 23 hours).\n */\nexport function isAllDayRange(start: Date, end: Date): boolean {\n const length = end.valueOf() - start.valueOf();\n return (\n length >= DAY_MS || (length > 0 && isMidnight(start) && isMidnight(end))\n );\n}\n\n/**\n * The last day a range covers. `end` is exclusive, so a range that ends at midnight ends the day\n * before. Never earlier than the day of `start`.\n */\nexport function lastDayOf(start: Date, end: Date): Date {\n const first = startOfDay(start);\n const last = startOfDay(new Date(end.valueOf() - 1));\n return last.valueOf() < first.valueOf() ? first : last;\n}\n\n/**\n * Whether the range `start`–`end` (end exclusive) shares time with `from`–`to`. A range without\n * length counts when its instant falls inside.\n */\nexport function rangesOverlap(\n start: Date,\n end: Date,\n from: Date,\n to: Date,\n): boolean {\n if (start.valueOf() >= end.valueOf()) {\n return start.valueOf() >= from.valueOf() && start.valueOf() < to.valueOf();\n }\n return start.valueOf() < to.valueOf() && end.valueOf() > from.valueOf();\n}\n\n/**\n * The start of the day after `date`'s. Unlike `addDays(day, 1)`, it lands on midnight even after a\n * day whose midnight the clocks skipped, where `startOfDay` gives 01:00.\n */\nexport function nextDay(date: Date): Date {\n return startOfDay(addDays(startOfDay(date), 1));\n}\n\n/** Minutes in a day on the wall clock, which the day and week views draw. */\nconst DAY_MINUTES = 1440;\n\n/**\n * Wall-clock minutes from the start of `day` to `date`: negative before it, 1440 or more after\n * it. The day and week views draw 24 equal hours, also on the days the clocks change.\n */\nexport function wallMinutes(date: Date, day: Date): number {\n return (\n differenceInDays(date, day) * DAY_MINUTES +\n date.getHours() * 60 +\n date.getMinutes() +\n date.getSeconds() / 60 +\n date.getMilliseconds() / MINUTE_MS\n );\n}\n\n/** The time `minutes` after the start of `day` on the wall clock; 1440 is the next midnight. */\nexport function atWallMinutes(day: Date, minutes: number): Date {\n const date = startOfDay(day);\n date.setHours(0, 0, 0, Math.round(minutes * MINUTE_MS));\n return date;\n}\n\n/** The time at `fraction` (0 to 1) down `day`'s column: the inverse of `getTimePercent`. */\nexport function timeAtFraction(day: Date, fraction: number): Date {\n return atWallMinutes(day, clamp(fraction, 0, 1) * DAY_MINUTES);\n}\n\n/**\n * `date` moved to a multiple of `minutes` on the wall clock after the start of `day` (by default\n * its own day): the nearest one, or the one before or after. The result stays within `day`, whose\n * end is the next midnight.\n */\nexport function snapTime(\n date: Date,\n minutes: number,\n mode: 'round' | 'floor' | 'ceil' = 'round',\n day: Date = date,\n): Date {\n const step = Math.max(1, minutes);\n const steps = Math[mode](wallMinutes(date, day) / step);\n return atWallMinutes(day, clamp(steps * step, 0, DAY_MINUTES));\n}\n\n/** Wall-clock date and time fields; `month` is 1–12. */\nexport type WallClockParts = {\n year: number;\n month: number;\n day: number;\n hour: number;\n minute: number;\n second: number;\n};\n\n/**\n * The wall-clock fields `date` shows in `timeZone` (an IANA name such as `America/New_York`),\n * read from `Intl.DateTimeFormat#formatToParts`. Throws a `RangeError` for an unknown zone.\n */\nexport function zonedParts(date: Date, timeZone: string): WallClockParts {\n const parts = new Intl.DateTimeFormat('en-US', {\n timeZone,\n hourCycle: 'h23',\n year: 'numeric',\n month: 'numeric',\n day: 'numeric',\n hour: 'numeric',\n minute: 'numeric',\n second: 'numeric',\n }).formatToParts(date);\n const field = (type: Intl.DateTimeFormatPartTypes) =>\n Number(parts.find(part => part.type === type)?.value ?? 0);\n return {\n year: field('year'),\n month: field('month'),\n day: field('day'),\n // Some engines print midnight as 24 even with `h23`.\n hour: field('hour') % 24,\n minute: field('minute'),\n second: field('second'),\n };\n}\n\n/**\n * A `Date` whose local fields show the wall-clock time `date` has in `timeZone`, so the views can\n * lay it out with local getters. An empty or unknown zone returns a copy of `date`.\n */\nexport function toZonedWallClock(date: Date, timeZone: string): Date {\n if (!timeZone) return new Date(date);\n try {\n const { year, month, day, hour, minute, second } = zonedParts(\n date,\n timeZone,\n );\n const wall = new Date(\n year,\n month - 1,\n day,\n hour,\n minute,\n second,\n date.getMilliseconds(),\n );\n // Two-digit years would otherwise land in the 1900s.\n wall.setFullYear(year);\n return wall;\n } catch {\n return new Date(date);\n }\n}\n\n/** `Intl` options for each display pattern; the output matches the pattern in `en-US`. */\nconst DISPLAY_FORMATS: Record<string, Intl.DateTimeFormatOptions> = {\n 'MMMM d, yyyy': { month: 'long', day: 'numeric', year: 'numeric' },\n EEEE: { weekday: 'long' },\n E: { weekday: 'short' },\n d: { day: 'numeric' },\n dd: { day: '2-digit' },\n 'hh a': { hour: '2-digit' },\n 'hh:mm a': { hour: '2-digit', minute: '2-digit' },\n};\n\n/**\n * Formats a date for display in `locale`. The patterns name the `en-US` output; other locales get\n * their own month and day names, order and clock. `dd-MM-yyyy` is a fixed key, not display text.\n */\nexport function formatDate(\n date: Date,\n pattern: string,\n locale: string = resolveLocale(),\n): string {\n if (pattern === 'dd-MM-yyyy') {\n const day = String(date.getDate()).padStart(2, '0');\n const month = String(date.getMonth() + 1).padStart(2, '0');\n return `${day}-${month}-${date.getFullYear()}`;\n }\n const options = DISPLAY_FORMATS[pattern];\n if (!options) return date.toLocaleDateString(locale);\n return new Intl.DateTimeFormat(locale, options).format(date);\n}\n\n/** `format.formatRange`, or both dates joined by a dash where it is missing or throws. */\nfunction formatRange(\n format: Intl.DateTimeFormat,\n start: Date,\n end: Date,\n): string {\n try {\n return format.formatRange(start, end);\n } catch {\n return `${format.format(start)} – ${format.format(end)}`;\n }\n}\n\n/**\n * When an event happens, for example `Nov 6, 2026, 9:00 – 9:30 AM`. An all-day event shows its\n * days only, through the day before an `end` at midnight.\n */\nexport function formatEventWhen(\n start: Date,\n end: Date,\n locale: string,\n allDay = false,\n): string {\n if (allDay) {\n const format = new Intl.DateTimeFormat(locale, { dateStyle: 'medium' });\n return formatRange(format, start, lastDayOf(start, end));\n }\n const format = new Intl.DateTimeFormat(locale, {\n dateStyle: 'medium',\n timeStyle: 'short',\n });\n return formatRange(format, start, end);\n}\n\n/** The times of a range without its date, for example `9:00 – 10:30 AM`. */\nexport function formatTimeRange(\n start: Date,\n end: Date,\n locale: string,\n): string {\n const format = new Intl.DateTimeFormat(locale, { timeStyle: 'short' });\n return formatRange(format, start, end);\n}\n\n/** Accessible name of an event: its title and when it happens, for example `Standup, Nov 6, 2026, 9:00 – 9:30 AM`. */\nexport function formatEventLabel(\n title: string,\n start: Date,\n end: Date,\n locale: string,\n allDay = false,\n): string {\n const when = formatEventWhen(start, end, locale, allDay);\n return title ? `${title}, ${when}` : when;\n}\n\n/** Runs `action` on Enter or Space, the keys that activate a button. */\nexport function onActivateKey(action: () => void) {\n return (event: KeyboardEvent) => {\n if (event.key !== 'Enter' && event.key !== ' ') return;\n event.preventDefault();\n action();\n };\n}\n\n/**\n * How far down `forDay`'s column (by default `date`'s own day) `date` falls, in percent, on a\n * 24-hour wall clock: a 9:00 event sits at the 9 AM row also on the days the clocks change.\n */\nexport function getTimePercent(date: Date, forDay?: Date): number {\n return clamp((wallMinutes(date, forDay || date) / DAY_MINUTES) * 100, 0, 100);\n}\n"],"names":[],"mappings":";;AAAA;;AAEG;AAIG,SAAU,UAAU,CAAC,IAAU,EAAA;AACnC,IAAA,MAAM,CAAC,GAAG,IAAI,IAAI,CAAC,IAAI,CAAC;IACxB,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;AACtB,IAAA,OAAO,CAAC;AACV;AAEM,SAAU,QAAQ,CAAC,IAAU,EAAA;AACjC,IAAA,MAAM,CAAC,GAAG,IAAI,IAAI,CAAC,IAAI,CAAC;IACxB,CAAC,CAAC,QAAQ,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,GAAG,CAAC;AAC3B,IAAA,OAAO,CAAC;AACV;AAEM,SAAU,OAAO,CAAC,IAAU,EAAE,IAAY,EAAA;AAC9C,IAAA,MAAM,CAAC,GAAG,IAAI,IAAI,CAAC,IA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AA,EAAK,IAAI,CAAA,CAAE,GAAG,IAAI;AAC3C;AAEA;AACM,SAAU,aAAa,CAAC,MAAkB,EAAA;IAC9C,OAAO,CAAC,KAAoB,KAAI;QAC9B,IAAI,KAAK,CAAC,GAAG,KAAK,OAAO,IAAI,KAAK,CAAC,GAAG,KAAK,GAAG;YAAE;QAChD,KAAK,CAAC,cAAc,EAAE;AACtB,QAAA,MAAM,EAAE;AACV,IAAA,CAAC;AACH;AAEA;;;AAGG;AACG,SAAU,cAAc,CAAC,IAAU,EAAE,MAAa,EAAA;IACtD,OAAO,KAAK,CAAC,CAAC,WAAW,CAAC,IAAI,EAAE,MAAM,IAAI,IAAI,CAAC,GAAG,WAAW,IAAI,GAAG,EAAE,CAAC,EAAE,GAAG,CAAC;AAC/E;;;;"}
|
|
@@ -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-BTeChxE0.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-DPjOBk6I.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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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;;;;"}
|
|
1
|
+
{"version":3,"file":"video-DPjOBk6I.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,GA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0B,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-
|
|
7
|
-
export { V as Video } from './video-
|
|
6
|
+
import './i18n-controller-BTeChxE0.js';
|
|
7
|
+
export { V as Video } from './video-DPjOBk6I.js';
|
|
8
8
|
import './base-Cl6v8-BZ.js';
|
|
9
9
|
import './directive-ZPhl09Yt.js';
|
|
10
|
-
import './strings-
|
|
10
|
+
import './strings-DeiQWMd9.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-BTeChxE0.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-DeiQWMd9.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,\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G,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
|
+
{"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,EAA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EAAE,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-BTeChxE0.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-DeiQWMd9.js';
|
|
10
10
|
import './locale-DEsJZCQG.js';
|
|
11
11
|
import './host-CZK7xhzh.js';
|
|
12
12
|
|