@runtypelabs/persona 3.18.0 → 3.20.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 (42) hide show
  1. package/README.md +45 -2
  2. package/dist/index.cjs +47 -47
  3. package/dist/index.cjs.map +1 -1
  4. package/dist/index.d.cts +383 -6
  5. package/dist/index.d.ts +383 -6
  6. package/dist/index.global.js +102 -1636
  7. package/dist/index.global.js.map +1 -1
  8. package/dist/index.js +47 -47
  9. package/dist/index.js.map +1 -1
  10. package/dist/theme-editor.cjs +1514 -626
  11. package/dist/theme-editor.d.cts +192 -1
  12. package/dist/theme-editor.d.ts +192 -1
  13. package/dist/theme-editor.js +1628 -626
  14. package/dist/widget.css +348 -0
  15. package/package.json +1 -1
  16. package/src/components/composer-builder.test.ts +52 -0
  17. package/src/components/composer-builder.ts +67 -490
  18. package/src/components/composer-parts.test.ts +152 -0
  19. package/src/components/composer-parts.ts +452 -0
  20. package/src/components/header-builder.ts +22 -299
  21. package/src/components/header-parts.ts +360 -0
  22. package/src/components/panel.test.ts +61 -0
  23. package/src/components/panel.ts +262 -5
  24. package/src/components/pill-composer-builder.test.ts +85 -0
  25. package/src/components/pill-composer-builder.ts +183 -0
  26. package/src/index.ts +5 -0
  27. package/src/runtime/init.ts +4 -2
  28. package/src/runtime/persist-state.test.ts +152 -0
  29. package/src/session.test.ts +123 -0
  30. package/src/session.ts +58 -4
  31. package/src/styles/widget.css +348 -0
  32. package/src/types.ts +196 -1
  33. package/src/ui.component-directive.test.ts +183 -0
  34. package/src/ui.composer-bar.test.ts +1009 -0
  35. package/src/ui.ts +827 -72
  36. package/src/utils/attachment-manager.ts +1 -1
  37. package/src/utils/component-middleware.test.ts +134 -0
  38. package/src/utils/component-middleware.ts +44 -13
  39. package/src/utils/dock.test.ts +45 -0
  40. package/src/utils/dock.ts +3 -0
  41. package/src/utils/icons.ts +314 -58
  42. package/src/utils/stream-animation.ts +7 -2
@@ -275,7 +275,7 @@ export const wrapStreamAnimation = (
275
275
  html: string,
276
276
  mode: "char" | "word",
277
277
  messageId: string,
278
- options?: { skipTags?: string[] }
278
+ options?: { skipTags?: string[]; startIndex?: number }
279
279
  ): string => {
280
280
  if (!html) return html;
281
281
  if (typeof document === "undefined") return html;
@@ -294,7 +294,12 @@ export const wrapStreamAnimation = (
294
294
  node = walker.nextNode();
295
295
  }
296
296
 
297
- const counterRef = { value: 0 };
297
+ // `startIndex` lets callers number spans by their absolute position in a
298
+ // larger string, even when only a slice is being wrapped. The peek banner
299
+ // uses this so per-char span IDs stay stable as the trailing-100-char
300
+ // window shifts each chunk — idiomorph then preserves animations on
301
+ // already-revealed chars instead of restarting them.
302
+ const counterRef = { value: options?.startIndex ?? 0 };
298
303
  const wrap = mode === "char" ? wrapTextNodeChars : wrapTextNodeWords;
299
304
  for (const textNode of textNodes) {
300
305
  wrap(textNode, messageId, counterRef);