@runtypelabs/persona 3.16.0 → 3.17.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 (58) hide show
  1. package/dist/animations/glyph-cycle.cjs +279 -0
  2. package/dist/animations/glyph-cycle.d.cts +5 -0
  3. package/dist/animations/glyph-cycle.d.ts +5 -0
  4. package/dist/animations/glyph-cycle.js +252 -0
  5. package/dist/animations/types-HPZY7oAI.d.cts +282 -0
  6. package/dist/animations/types-HPZY7oAI.d.ts +282 -0
  7. package/dist/animations/wipe.cjs +107 -0
  8. package/dist/animations/wipe.d.cts +5 -0
  9. package/dist/animations/wipe.d.ts +5 -0
  10. package/dist/animations/wipe.js +80 -0
  11. package/dist/index.cjs +48 -47
  12. package/dist/index.cjs.map +1 -1
  13. package/dist/index.d.cts +205 -1
  14. package/dist/index.d.ts +205 -1
  15. package/dist/index.global.js +136 -81
  16. package/dist/index.global.js.map +1 -1
  17. package/dist/index.js +48 -47
  18. package/dist/index.js.map +1 -1
  19. package/dist/testing.cjs +85 -0
  20. package/dist/testing.d.cts +39 -0
  21. package/dist/testing.d.ts +39 -0
  22. package/dist/testing.js +56 -0
  23. package/dist/theme-editor.cjs +714 -99
  24. package/dist/theme-editor.d.cts +214 -2
  25. package/dist/theme-editor.d.ts +214 -2
  26. package/dist/theme-editor.js +712 -99
  27. package/dist/widget.css +133 -0
  28. package/package.json +20 -3
  29. package/src/animations/glyph-cycle.ts +332 -0
  30. package/src/animations/wipe.ts +66 -0
  31. package/src/client.test.ts +141 -0
  32. package/src/client.ts +28 -0
  33. package/src/components/composer-builder.ts +61 -10
  34. package/src/components/message-bubble.test.ts +181 -2
  35. package/src/components/message-bubble.ts +209 -14
  36. package/src/components/panel.ts +4 -1
  37. package/src/defaults.ts +16 -0
  38. package/src/index-global.ts +31 -0
  39. package/src/index.ts +18 -0
  40. package/src/session.test.ts +93 -1
  41. package/src/session.ts +5 -0
  42. package/src/styles/widget.css +133 -0
  43. package/src/testing/index.ts +11 -0
  44. package/src/testing/mock-stream.test.ts +80 -0
  45. package/src/testing/mock-stream.ts +94 -0
  46. package/src/testing.ts +2 -0
  47. package/src/theme-editor/index.ts +4 -0
  48. package/src/theme-editor/preview-utils.test.ts +60 -0
  49. package/src/theme-editor/preview-utils.ts +129 -0
  50. package/src/theme-editor/sections.test.ts +19 -0
  51. package/src/theme-editor/sections.ts +84 -1
  52. package/src/types.ts +210 -0
  53. package/src/ui.stop-button.test.ts +165 -0
  54. package/src/ui.ts +75 -6
  55. package/src/utils/message-fingerprint.ts +2 -0
  56. package/src/utils/morph.ts +7 -0
  57. package/src/utils/stream-animation.test.ts +417 -0
  58. package/src/utils/stream-animation.ts +449 -0
@@ -0,0 +1,80 @@
1
+ // src/utils/stream-animation.ts
2
+ var BUILTIN_PLUGINS = [
3
+ {
4
+ name: "typewriter",
5
+ containerClass: "persona-stream-typewriter",
6
+ wrap: "char",
7
+ useCaret: true
8
+ },
9
+ {
10
+ name: "pop-bubble",
11
+ bubbleClass: "persona-stream-pop",
12
+ wrap: "none"
13
+ },
14
+ {
15
+ name: "letter-rise",
16
+ containerClass: "persona-stream-letter-rise",
17
+ wrap: "char"
18
+ },
19
+ {
20
+ name: "word-fade",
21
+ containerClass: "persona-stream-word-fade",
22
+ wrap: "word"
23
+ }
24
+ ];
25
+ var globalRegistry = /* @__PURE__ */ new Map();
26
+ for (const plugin of BUILTIN_PLUGINS) globalRegistry.set(plugin.name, plugin);
27
+ var registerStreamAnimationPlugin = (plugin) => {
28
+ globalRegistry.set(plugin.name, plugin);
29
+ };
30
+
31
+ // src/animations/wipe.ts
32
+ var STYLES = `
33
+ @keyframes persona-stream-wipe {
34
+ from { -webkit-mask-position: 100% 0; mask-position: 100% 0; }
35
+ to { -webkit-mask-position: 0% 0; mask-position: 0% 0; }
36
+ }
37
+ [data-persona-root] .persona-stream-wipe .persona-stream-word {
38
+ -webkit-mask-image: linear-gradient(
39
+ 90deg,
40
+ black 0%,
41
+ black 45%,
42
+ transparent 55%,
43
+ transparent 100%
44
+ );
45
+ mask-image: linear-gradient(
46
+ 90deg,
47
+ black 0%,
48
+ black 45%,
49
+ transparent 55%,
50
+ transparent 100%
51
+ );
52
+ -webkit-mask-size: 200% 100%;
53
+ mask-size: 200% 100%;
54
+ -webkit-mask-position: 100% 0;
55
+ mask-position: 100% 0;
56
+ -webkit-mask-repeat: no-repeat;
57
+ mask-repeat: no-repeat;
58
+ animation: persona-stream-wipe calc(var(--persona-stream-step, 120ms) * 3)
59
+ ease-out forwards;
60
+ }
61
+ @media (prefers-reduced-motion: reduce) {
62
+ [data-persona-root] .persona-stream-wipe .persona-stream-word {
63
+ animation: none !important;
64
+ -webkit-mask-image: none !important;
65
+ mask-image: none !important;
66
+ }
67
+ }
68
+ `.trim();
69
+ var wipe = {
70
+ name: "wipe",
71
+ containerClass: "persona-stream-wipe",
72
+ wrap: "word",
73
+ styles: STYLES
74
+ };
75
+ registerStreamAnimationPlugin(wipe);
76
+ var wipe_default = wipe;
77
+ export {
78
+ wipe_default as default,
79
+ wipe
80
+ };