@botiverse/raft-ui 0.80.0 → 0.82.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.
Files changed (34) hide show
  1. package/CHANGELOG.md +59 -0
  2. package/dist/components/choice-list/choice-list.d.mts +8 -0
  3. package/dist/components/choice-list/choice-list.mjs +37 -16
  4. package/dist/components/choice-list/choice-list.recipe.mjs +17 -3
  5. package/dist/components/composer/composer-drop-overlay.d.mts +9 -4
  6. package/dist/components/composer/composer-drop-overlay.mjs +2 -5
  7. package/dist/components/composer/sortable-composer-attachments.mjs +2 -3
  8. package/dist/components/drag/drag-lift.d.mts +10 -6
  9. package/dist/components/drag/drag-lift.mjs +11 -9
  10. package/dist/components/list-row/index.d.mts +2 -2
  11. package/dist/components/list-row/list-row.d.mts +9 -0
  12. package/dist/components/list-row/list-row.mjs +20 -1
  13. package/dist/components/list-row/list-row.recipe.d.mts +3 -0
  14. package/dist/components/list-row/list-row.recipe.mjs +1 -0
  15. package/dist/components/message-action-card/index.d.mts +2 -2
  16. package/dist/components/message-action-card/message-action-card.d.mts +8 -0
  17. package/dist/components/message-action-card/message-action-card.mjs +16 -1
  18. package/dist/components/message-action-card/message-action-card.recipe.mjs +5 -0
  19. package/dist/components/resizable/resizable.recipe.mjs +4 -4
  20. package/dist/components/scroll-area/scroll-area.css +15 -2
  21. package/dist/components/scroll-area/use-scrollbars.mjs +2 -1
  22. package/dist/components/steps/otter-animation-visibility.mjs +45 -0
  23. package/dist/components/steps/otter-indicator.css +131 -106
  24. package/dist/components/steps/otter-indicator.d.mts +5 -8
  25. package/dist/components/steps/otter-indicator.mjs +38 -314
  26. package/dist/components/steps/ottie-assets/error.webp +0 -0
  27. package/dist/components/steps/ottie-assets/finish.webp +0 -0
  28. package/dist/components/steps/ottie-assets/process.webp +0 -0
  29. package/dist/components/steps/ottie-assets/wait.webp +0 -0
  30. package/dist/components/tabs/tabs.mjs +2 -3
  31. package/dist/components/task-dnd/task-dnd.d.mts +5 -1
  32. package/dist/index.d.mts +3 -3
  33. package/dist/index.mjs +3 -3
  34. package/package.json +1 -1
@@ -0,0 +1,45 @@
1
+ //#region src/components/steps/otter-animation-visibility.ts
2
+ /** One observer/listener per document, regardless of the number of illustrations. */
3
+ const documents = /* @__PURE__ */ new WeakMap();
4
+ function observeOtterAnimation(node) {
5
+ const doc = node.ownerDocument;
6
+ let manager = documents.get(doc);
7
+ if (!manager) {
8
+ const visible = /* @__PURE__ */ new Map();
9
+ const update = (element, intersects) => {
10
+ element.dataset.animate = String(intersects && !doc.hidden);
11
+ };
12
+ const onVisibility = () => {
13
+ for (const [element, intersects] of visible) update(element, intersects);
14
+ };
15
+ const Observer = doc.defaultView?.IntersectionObserver;
16
+ const observer = Observer ? new Observer((entries) => {
17
+ for (const entry of entries) {
18
+ const element = entry.target;
19
+ if (!visible.has(element)) continue;
20
+ visible.set(element, entry.isIntersecting);
21
+ update(element, entry.isIntersecting);
22
+ }
23
+ }) : null;
24
+ doc.addEventListener("visibilitychange", onVisibility);
25
+ manager = { observe(element) {
26
+ visible.set(element, !observer);
27
+ update(element, !observer);
28
+ observer?.observe(element);
29
+ return () => {
30
+ observer?.unobserve(element);
31
+ visible.delete(element);
32
+ delete element.dataset.animate;
33
+ if (visible.size === 0) {
34
+ observer?.disconnect();
35
+ doc.removeEventListener("visibilitychange", onVisibility);
36
+ documents.delete(doc);
37
+ }
38
+ };
39
+ } };
40
+ documents.set(doc, manager);
41
+ }
42
+ return manager.observe(node);
43
+ }
44
+ //#endregion
45
+ export { observeOtterAnimation };
@@ -1,141 +1,166 @@
1
- /* ─────────────────────────────────────────────────────────────────────────
2
- OtterIndicator — an otter posed by a status (an agent's turn, a step). The
3
- picture is fixed art; only the badges and the "z" take token colours.
4
- ───────────────────────────────────────────────────────────────────────── */
5
-
1
+ /* Fixed Ottie artwork in separate CSS assets; no image modules/base64 in JS. */
6
2
  .r-otter-indicator {
7
- overflow: visible;
8
- }
9
- .r-otter-indicator * {
10
- transform-box: view-box;
11
- }
12
- .r-otter-indicator__body {
13
- transform-origin: 24px 28px;
14
- }
15
- .r-otter-indicator__arm {
16
- transform-origin: 29px 27px;
17
- }
18
- .r-otter-indicator__ripple {
19
- opacity: 0;
20
- transform-origin: 6px 30.5px;
21
- }
22
- .r-otter-indicator__z {
23
- opacity: 0;
24
- }
25
- .r-otter-indicator__parcel--adrift {
26
- transform-origin: 6px 25px;
3
+ overflow: hidden;
4
+ flex-shrink: 0;
5
+ }
6
+ .r-otter-indicator--wait {
7
+ --r-ottie-art: url("./ottie-assets/wait.webp");
8
+ }
9
+ .r-otter-indicator--process {
10
+ --r-ottie-art: url("./ottie-assets/process.webp");
11
+ }
12
+ .r-otter-indicator--error {
13
+ --r-ottie-art: url("./ottie-assets/error.webp");
14
+ }
15
+ .r-otter-indicator--finish {
16
+ --r-ottie-art: url("./ottie-assets/finish.webp");
17
+ }
18
+ .r-otter-indicator__viewport {
19
+ width: 100%;
20
+ aspect-ratio: 1;
21
+ overflow: hidden;
22
+ }
23
+ .r-otter-indicator__art {
24
+ width: 100%;
25
+ height: 100%;
26
+ position: relative;
27
+ }
28
+ .r-otter-indicator__base,
29
+ .r-otter-indicator__frames,
30
+ .r-otter-indicator__rest {
31
+ position: absolute;
32
+ inset: 0;
33
+ background-image: var(--r-ottie-art);
34
+ background-size: 300% 200%;
35
+ background-repeat: no-repeat;
36
+ background-position: 0% 0%;
37
+ }
38
+ .r-otter-indicator__rest {
39
+ background-size: contain;
40
+ background-position: center;
41
+ transform-origin: 50% 80%;
42
+ }
43
+ .r-otter-indicator--process .r-otter-indicator__frames {
44
+ mask-image:
45
+ radial-gradient(ellipse 11% 9% at 40% 60%, oklch(0 0 0) 88%, transparent 100%),
46
+ radial-gradient(ellipse 11% 9% at 61% 60%, oklch(0 0 0) 88%, transparent 100%);
47
+ }
48
+ .r-otter-indicator--error .r-otter-indicator__frames {
49
+ mask-image: linear-gradient(oklch(0 0 0) 0 58%, transparent 64%);
50
+ }
51
+ .r-otter-indicator--error .r-otter-indicator__frames,
52
+ .r-otter-indicator--finish .r-otter-indicator__frames {
53
+ background-position: 100% 100%;
54
+ }
55
+ .r-otter-indicator__question {
56
+ fill: oklch(0.57 0.09 75);
57
+ font-family: ui-rounded, system-ui, sans-serif;
27
58
  }
28
59
  @media (prefers-reduced-motion: no-preference) {
29
- .r-otter-indicator__wave {
30
- animation: r-otter-indicator-wave 1.2s linear infinite;
60
+ .r-otter-indicator__rest {
61
+ animation: r-ottie-breathe 6s ease-in-out infinite;
31
62
  }
32
- .r-otter-indicator__wave--back {
33
- animation-duration: 2s;
63
+ .r-otter-indicator--process .r-otter-indicator__frames {
64
+ animation: r-ottie-type 4.52s steps(1, end) infinite;
34
65
  }
35
- .r-otter-indicator--process .r-otter-indicator__body {
36
- animation: r-otter-indicator-bob 1.8s ease-in-out infinite alternate;
66
+ .r-otter-indicator--error .r-otter-indicator__frames {
67
+ animation: r-ottie-tilt 1.55s steps(1, end) both;
37
68
  }
38
- .r-otter-indicator--process .r-otter-indicator__arm {
39
- animation: r-otter-indicator-paddle 0.9s ease-in-out infinite alternate;
69
+ .r-otter-indicator--finish .r-otter-indicator__frames {
70
+ animation: r-ottie-finish 1.24s steps(1, end) both;
40
71
  }
41
- .r-otter-indicator--process .r-otter-indicator__ripple {
42
- animation: r-otter-indicator-ripple 1.8s ease-out infinite;
72
+ .r-otter-indicator__question {
73
+ animation: r-ottie-question 1s linear both;
43
74
  }
44
- .r-otter-indicator--process .r-otter-indicator__ripple--late {
45
- animation-delay: 0.9s;
75
+ .r-otter-indicator .r-otter-indicator__rest,
76
+ .r-otter-indicator .r-otter-indicator__frames,
77
+ .r-otter-indicator .r-otter-indicator__question {
78
+ animation-play-state: paused;
46
79
  }
47
- .r-otter-indicator--finish .r-otter-indicator__wave {
48
- animation-duration: 3s;
80
+ .r-otter-indicator[data-animate="true"] .r-otter-indicator__rest,
81
+ .r-otter-indicator[data-animate="true"] .r-otter-indicator__frames,
82
+ .r-otter-indicator[data-animate="true"] .r-otter-indicator__question {
83
+ animation-play-state: running;
49
84
  }
50
- .r-otter-indicator--finish .r-otter-indicator__body {
51
- animation: r-otter-indicator-bob 3.2s ease-in-out infinite alternate;
52
- }
53
- .r-otter-indicator--wait .r-otter-indicator__body {
54
- animation: r-otter-indicator-breathe 2.4s ease-in-out infinite alternate;
85
+ }
86
+ @keyframes r-ottie-breathe {
87
+ 0%,
88
+ 100% {
89
+ transform: scaleY(1);
55
90
  }
56
- .r-otter-indicator--wait .r-otter-indicator__z {
57
- animation: r-otter-indicator-z 2.4s ease-out infinite;
91
+ 50% {
92
+ transform: scaleY(1.006);
58
93
  }
59
- .r-otter-indicator--wait .r-otter-indicator__z--late {
60
- animation-delay: 1.2s;
94
+ }
95
+ @keyframes r-ottie-type {
96
+ 0%,
97
+ 100% {
98
+ background-position: 0% 0%;
61
99
  }
62
- .r-otter-indicator--error .r-otter-indicator__body {
63
- animation: r-otter-indicator-shiver 0.18s linear infinite alternate;
100
+ 48.6726% {
101
+ background-position: 50% 0%;
64
102
  }
65
- .r-otter-indicator--error .r-otter-indicator__parcel--adrift {
66
- animation: r-otter-indicator-drift 2s ease-in-out infinite alternate;
103
+ 52.6549% {
104
+ background-position: 100% 0%;
67
105
  }
68
- }
69
- @media (prefers-reduced-motion: reduce) {
70
- .r-otter-indicator__z {
71
- opacity: 1;
106
+ 58.8496% {
107
+ background-position: 0% 100%;
72
108
  }
73
- }
74
- @keyframes r-otter-indicator-bob {
75
- from {
76
- transform: translateY(-0.6px) rotate(-3deg);
109
+ 62.8319% {
110
+ background-position: 50% 100%;
77
111
  }
78
- to {
79
- transform: translateY(1.2px) rotate(2deg);
112
+ 69.0265% {
113
+ background-position: 100% 100%;
80
114
  }
81
115
  }
82
- @keyframes r-otter-indicator-paddle {
83
- from {
84
- transform: rotate(-35deg);
116
+ @keyframes r-ottie-tilt {
117
+ 0% {
118
+ background-position: 0% 0%;
85
119
  }
86
- to {
87
- transform: rotate(30deg);
120
+ 8.3871% {
121
+ background-position: 50% 0%;
88
122
  }
89
- }
90
- @keyframes r-otter-indicator-wave {
91
- to {
92
- transform: translateX(-12px);
93
- }
94
- }
95
- @keyframes r-otter-indicator-ripple {
96
- from {
97
- opacity: 0.8;
98
- transform: scale(0.4);
123
+ 16.7742% {
124
+ background-position: 100% 0%;
99
125
  }
100
- to {
101
- opacity: 0;
102
- transform: scale(1.6);
126
+ 25.1613% {
127
+ background-position: 0% 100%;
103
128
  }
104
- }
105
- @keyframes r-otter-indicator-breathe {
106
- from {
107
- transform: scale(1, 1);
129
+ 33.5484% {
130
+ background-position: 50% 100%;
108
131
  }
109
- to {
110
- transform: scale(1.02, 1.05);
132
+ 41.9355%,
133
+ 100% {
134
+ background-position: 100% 100%;
111
135
  }
112
136
  }
113
- @keyframes r-otter-indicator-z {
114
- from {
115
- opacity: 0;
116
- transform: translate(0, 0);
137
+ @keyframes r-ottie-finish {
138
+ 0% {
139
+ background-position: 0% 0%;
117
140
  }
118
- 30% {
119
- opacity: 1;
141
+ 13.7097% {
142
+ background-position: 50% 0%;
120
143
  }
121
- to {
122
- opacity: 0;
123
- transform: translate(4px, -7px);
144
+ 26.6129% {
145
+ background-position: 100% 0%;
124
146
  }
125
- }
126
- @keyframes r-otter-indicator-shiver {
127
- from {
128
- transform: translateX(-0.4px);
147
+ 38.7097% {
148
+ background-position: 0% 100%;
129
149
  }
130
- to {
131
- transform: translateX(0.4px);
150
+ 51.6129% {
151
+ background-position: 50% 100%;
152
+ }
153
+ 63.7097%,
154
+ 100% {
155
+ background-position: 100% 100%;
132
156
  }
133
157
  }
134
- @keyframes r-otter-indicator-drift {
135
- from {
136
- transform: translate(0, 0) rotate(-18deg);
158
+ @keyframes r-ottie-question {
159
+ 0%,
160
+ 72% {
161
+ opacity: 0;
137
162
  }
138
- to {
139
- transform: translate(-1.5px, 1.2px) rotate(-8deg);
163
+ 100% {
164
+ opacity: 1;
140
165
  }
141
166
  }
@@ -5,13 +5,10 @@ export interface OtterIndicatorProps extends Omit<ComponentPropsWithRef<"svg">,
5
5
  status: StepStatus;
6
6
  }
7
7
  /**
8
- * An otter on its back, one pose per status:
9
- * - `wait`: asleep on the dry bank, the parcel still on its belly.
10
- * - `process`: afloat, paddling with one arm, the parcel on its belly.
11
- * - `finish`: drifting at ease, hugging the delivered parcel.
12
- * - `error`: shivering in the water; the parcel has slipped away.
13
- *
14
- * It fills its box; give it 48px or more so the poses read.
8
+ * Ottie resting, quietly typing, tilting its head or celebrating.
9
+ * Wait/process loop only while visible. Error/finish play once on entry.
10
+ * Reduced motion shows a still pose. Give it an explicit square box, 40px or larger.
11
+ * Decorative by default; the consumer supplies the nearby status text.
15
12
  */
16
- export declare function OtterIndicator({ status, className, ...props }: OtterIndicatorProps): import("react").JSX.Element;
13
+ export declare function OtterIndicator({ status, className, ref, ...props }: OtterIndicatorProps): import("react").JSX.Element;
17
14
  //#endregion