@runtypelabs/persona 3.16.0 → 3.18.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 (71) hide show
  1. package/README.md +142 -0
  2. package/dist/animations/glyph-cycle.cjs +279 -0
  3. package/dist/animations/glyph-cycle.d.cts +5 -0
  4. package/dist/animations/glyph-cycle.d.ts +5 -0
  5. package/dist/animations/glyph-cycle.js +252 -0
  6. package/dist/animations/types-cwY5HaFD.d.cts +307 -0
  7. package/dist/animations/types-cwY5HaFD.d.ts +307 -0
  8. package/dist/animations/wipe.cjs +107 -0
  9. package/dist/animations/wipe.d.cts +5 -0
  10. package/dist/animations/wipe.d.ts +5 -0
  11. package/dist/animations/wipe.js +80 -0
  12. package/dist/index.cjs +49 -48
  13. package/dist/index.cjs.map +1 -1
  14. package/dist/index.d.cts +504 -1
  15. package/dist/index.d.ts +504 -1
  16. package/dist/index.global.js +143 -88
  17. package/dist/index.global.js.map +1 -1
  18. package/dist/index.js +49 -48
  19. package/dist/index.js.map +1 -1
  20. package/dist/testing.cjs +85 -0
  21. package/dist/testing.d.cts +39 -0
  22. package/dist/testing.d.ts +39 -0
  23. package/dist/testing.js +56 -0
  24. package/dist/theme-editor.cjs +2095 -207
  25. package/dist/theme-editor.d.cts +432 -2
  26. package/dist/theme-editor.d.ts +432 -2
  27. package/dist/theme-editor.js +2093 -207
  28. package/dist/theme-reference.cjs +1 -1
  29. package/dist/theme-reference.d.cts +14 -0
  30. package/dist/theme-reference.d.ts +14 -0
  31. package/dist/widget.css +565 -0
  32. package/package.json +20 -3
  33. package/src/animations/glyph-cycle.ts +332 -0
  34. package/src/animations/wipe.ts +66 -0
  35. package/src/client.test.ts +275 -0
  36. package/src/client.ts +99 -0
  37. package/src/components/ask-user-question-bubble.test.ts +583 -0
  38. package/src/components/ask-user-question-bubble.ts +924 -0
  39. package/src/components/composer-builder.ts +61 -10
  40. package/src/components/message-bubble.test.ts +181 -2
  41. package/src/components/message-bubble.ts +209 -14
  42. package/src/components/messages.ts +33 -1
  43. package/src/components/panel.ts +45 -5
  44. package/src/defaults.ts +37 -0
  45. package/src/index-global.ts +31 -0
  46. package/src/index.ts +34 -1
  47. package/src/plugins/types.ts +57 -0
  48. package/src/session.test.ts +276 -1
  49. package/src/session.ts +247 -3
  50. package/src/styles/widget.css +565 -0
  51. package/src/testing/index.ts +11 -0
  52. package/src/testing/mock-stream.test.ts +80 -0
  53. package/src/testing/mock-stream.ts +94 -0
  54. package/src/testing.ts +2 -0
  55. package/src/theme-editor/index.ts +4 -0
  56. package/src/theme-editor/preview-utils.test.ts +60 -0
  57. package/src/theme-editor/preview-utils.ts +129 -0
  58. package/src/theme-editor/sections.test.ts +19 -0
  59. package/src/theme-editor/sections.ts +84 -1
  60. package/src/types/theme.ts +15 -0
  61. package/src/types.ts +360 -0
  62. package/src/ui.ask-user-question-plugin.test.ts +649 -0
  63. package/src/ui.stop-button.test.ts +165 -0
  64. package/src/ui.ts +706 -11
  65. package/src/utils/message-fingerprint.ts +2 -0
  66. package/src/utils/morph.ts +7 -0
  67. package/src/utils/storage.ts +10 -2
  68. package/src/utils/stream-animation.test.ts +417 -0
  69. package/src/utils/stream-animation.ts +449 -0
  70. package/src/utils/theme.test.ts +36 -0
  71. package/src/utils/tokens.ts +23 -0
@@ -0,0 +1,107 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/animations/wipe.ts
21
+ var wipe_exports = {};
22
+ __export(wipe_exports, {
23
+ default: () => wipe_default,
24
+ wipe: () => wipe
25
+ });
26
+ module.exports = __toCommonJS(wipe_exports);
27
+
28
+ // src/utils/stream-animation.ts
29
+ var BUILTIN_PLUGINS = [
30
+ {
31
+ name: "typewriter",
32
+ containerClass: "persona-stream-typewriter",
33
+ wrap: "char",
34
+ useCaret: true
35
+ },
36
+ {
37
+ name: "pop-bubble",
38
+ bubbleClass: "persona-stream-pop",
39
+ wrap: "none"
40
+ },
41
+ {
42
+ name: "letter-rise",
43
+ containerClass: "persona-stream-letter-rise",
44
+ wrap: "char"
45
+ },
46
+ {
47
+ name: "word-fade",
48
+ containerClass: "persona-stream-word-fade",
49
+ wrap: "word"
50
+ }
51
+ ];
52
+ var globalRegistry = /* @__PURE__ */ new Map();
53
+ for (const plugin of BUILTIN_PLUGINS) globalRegistry.set(plugin.name, plugin);
54
+ var registerStreamAnimationPlugin = (plugin) => {
55
+ globalRegistry.set(plugin.name, plugin);
56
+ };
57
+
58
+ // src/animations/wipe.ts
59
+ var STYLES = `
60
+ @keyframes persona-stream-wipe {
61
+ from { -webkit-mask-position: 100% 0; mask-position: 100% 0; }
62
+ to { -webkit-mask-position: 0% 0; mask-position: 0% 0; }
63
+ }
64
+ [data-persona-root] .persona-stream-wipe .persona-stream-word {
65
+ -webkit-mask-image: linear-gradient(
66
+ 90deg,
67
+ black 0%,
68
+ black 45%,
69
+ transparent 55%,
70
+ transparent 100%
71
+ );
72
+ mask-image: linear-gradient(
73
+ 90deg,
74
+ black 0%,
75
+ black 45%,
76
+ transparent 55%,
77
+ transparent 100%
78
+ );
79
+ -webkit-mask-size: 200% 100%;
80
+ mask-size: 200% 100%;
81
+ -webkit-mask-position: 100% 0;
82
+ mask-position: 100% 0;
83
+ -webkit-mask-repeat: no-repeat;
84
+ mask-repeat: no-repeat;
85
+ animation: persona-stream-wipe calc(var(--persona-stream-step, 120ms) * 3)
86
+ ease-out forwards;
87
+ }
88
+ @media (prefers-reduced-motion: reduce) {
89
+ [data-persona-root] .persona-stream-wipe .persona-stream-word {
90
+ animation: none !important;
91
+ -webkit-mask-image: none !important;
92
+ mask-image: none !important;
93
+ }
94
+ }
95
+ `.trim();
96
+ var wipe = {
97
+ name: "wipe",
98
+ containerClass: "persona-stream-wipe",
99
+ wrap: "word",
100
+ styles: STYLES
101
+ };
102
+ registerStreamAnimationPlugin(wipe);
103
+ var wipe_default = wipe;
104
+ // Annotate the CommonJS export names for ESM import in node:
105
+ 0 && (module.exports = {
106
+ wipe
107
+ });
@@ -0,0 +1,5 @@
1
+ import { S as StreamAnimationPlugin } from './types-cwY5HaFD.cjs';
2
+
3
+ declare const wipe: StreamAnimationPlugin;
4
+
5
+ export { wipe as default, wipe };
@@ -0,0 +1,5 @@
1
+ import { S as StreamAnimationPlugin } from './types-cwY5HaFD.js';
2
+
3
+ declare const wipe: StreamAnimationPlugin;
4
+
5
+ export { wipe as default, wipe };
@@ -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
+ };