@krak-stack/registry 0.10.4 → 0.10.6

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 (31) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/dist/components/ui/animated-list.d.ts +6 -7
  3. package/dist/components/ui/animated-list.js +329 -139
  4. package/dist/components/ui/animated-number.js +47 -24
  5. package/dist/components/ui/auto-height.js +56 -15
  6. package/dist/components/ui/data-table.js +16 -13
  7. package/dist/components/ui/email-editor.d.ts +124 -0
  8. package/dist/components/ui/email-editor.js +2651 -0
  9. package/dist/components/ui/form.d.ts +5 -5
  10. package/dist/components/ui/presence-transition.d.ts +1 -1
  11. package/dist/components/ui/presence-transition.js +79 -26
  12. package/dist/components/ui/rich-text-editor.d.ts +70 -0
  13. package/dist/components/ui/rich-text-editor.js +1135 -0
  14. package/dist/components/ui/time-picker.d.ts +13 -4
  15. package/dist/components/ui/time-picker.js +141 -47
  16. package/dist/components/ui/time-picker.schema.d.ts +16 -2
  17. package/dist/lib/email-document/model.d.ts +26 -0
  18. package/dist/lib/email-document/model.js +253 -0
  19. package/dist/lib/email-document/render.d.ts +115 -0
  20. package/dist/lib/email-document/render.js +469 -0
  21. package/dist/lib/email-document/schema.d.ts +285 -0
  22. package/dist/lib/email-document/schema.js +139 -0
  23. package/dist/lib/krakmotion.d.ts +27 -0
  24. package/dist/lib/rich-text/dom.d.ts +40 -0
  25. package/dist/lib/rich-text/model.d.ts +19 -0
  26. package/dist/lib/rich-text/model.js +141 -0
  27. package/dist/lib/rich-text/schema.d.ts +64 -0
  28. package/dist/lib/rich-text/schema.js +53 -0
  29. package/dist/services/events/client/audit-log-table.js +16 -13
  30. package/dist/services/webhooks/client/delivery-table.js +16 -13
  31. package/package.json +29 -5
@@ -1,6 +1,38 @@
1
+ // ../../src/lib/krakmotion.ts
2
+ import {
3
+ useEffect,
4
+ useEffectEvent,
5
+ useLayoutEffect,
6
+ useRef,
7
+ useState,
8
+ useSyncExternalStore
9
+ } from "react";
10
+ var useBrowserLayoutEffect = globalThis.window ? useLayoutEffect : useEffect;
11
+ var reducedMotionQuery = "(prefers-reduced-motion: reduce)";
12
+ var subscribeReducedMotion = (notify) => {
13
+ const query = window.matchMedia?.(reducedMotionQuery);
14
+ query?.addEventListener("change", notify);
15
+ return () => query?.removeEventListener("change", notify);
16
+ };
17
+ var useReducedMotion = () => useSyncExternalStore(subscribeReducedMotion, () => window.matchMedia?.(reducedMotionQuery).matches ?? true, () => true);
18
+ var animateElement = (element, frames, duration, complete) => {
19
+ if (duration <= 0 || !element.animate) {
20
+ complete?.();
21
+ return () => {};
22
+ }
23
+ const animation = element.animate(frames, {
24
+ duration,
25
+ easing: "cubic-bezier(0.2, 0, 0, 1)"
26
+ });
27
+ animation.onfinish = () => complete?.();
28
+ return () => {
29
+ animation.onfinish = null;
30
+ animation.cancel();
31
+ };
32
+ };
33
+
1
34
  // ../../src/components/ui/auto-height.tsx
2
- import { motion, useReducedMotion } from "motion/react";
3
- import { useEffect, useRef, useState } from "react";
35
+ import { useEffect as useEffect2, useRef as useRef2 } from "react";
4
36
  import { jsx } from "react/jsx-runtime";
5
37
  var AutoHeight = ({
6
38
  children,
@@ -8,29 +40,38 @@ var AutoHeight = ({
8
40
  className,
9
41
  contentClassName
10
42
  }) => {
11
- const content = useRef(null);
12
- const [height, setHeight] = useState();
43
+ const content = useRef2(null);
44
+ const container = useRef2(null);
13
45
  const reduced = useReducedMotion();
14
- useEffect(() => {
46
+ useEffect2(() => {
15
47
  const element = content.current;
16
- if (!element || !globalThis.ResizeObserver)
48
+ const wrapper = container.current;
49
+ if (!element || !wrapper || !globalThis.ResizeObserver)
17
50
  return;
51
+ let previous;
52
+ let cancel = () => {};
18
53
  const observer = new ResizeObserver(() => {
19
54
  if (element.getClientRects().length === 0)
20
55
  return;
21
- setHeight(element.getBoundingClientRect().height);
56
+ const height = element.getBoundingClientRect().height;
57
+ const from = Number.parseFloat(getComputedStyle(wrapper).height);
58
+ cancel();
59
+ wrapper.style.height = `${height}px`;
60
+ if (previous !== undefined)
61
+ cancel = animateElement(wrapper, [{ height: `${from}px` }, { height: `${height}px` }], reduced ? 0 : Math.max(0, duration));
62
+ previous = height;
22
63
  });
23
64
  observer.observe(element);
24
- return () => observer.disconnect();
25
- }, []);
26
- return /* @__PURE__ */ jsx(motion.div, {
65
+ return () => {
66
+ observer.disconnect();
67
+ cancel();
68
+ wrapper.style.height = "";
69
+ };
70
+ }, [duration, reduced]);
71
+ return /* @__PURE__ */ jsx("div", {
72
+ ref: container,
27
73
  "data-slot": "auto-height",
28
74
  className,
29
- initial: false,
30
- animate: { height: height ?? "auto" },
31
- transition: {
32
- duration: reduced !== false ? 0 : Math.max(0, duration) / 1000
33
- },
34
75
  style: { overflow: "clip", boxSizing: "content-box" },
35
76
  children: /* @__PURE__ */ jsx("div", {
36
77
  ref: content,
@@ -3605,8 +3605,8 @@ var GalleryCard = ({
3605
3605
  /* @__PURE__ */ jsxs9(CardHeader, {
3606
3606
  className: cn("relative", hasRowActionMenu(store) && "pr-12"),
3607
3607
  children: [
3608
- selection || draggable || tagIds.length ? /* @__PURE__ */ jsxs9("div", {
3609
- className: "flex flex-wrap items-center gap-2",
3608
+ selection || draggable ? /* @__PURE__ */ jsxs9("div", {
3609
+ className: "flex items-center gap-2",
3610
3610
  children: [
3611
3611
  selection ? /* @__PURE__ */ jsx15(Checkbox, {
3612
3612
  "aria-label": store.config.labels.selectRow,
@@ -3617,22 +3617,25 @@ var GalleryCard = ({
3617
3617
  }) : null,
3618
3618
  draggable ? /* @__PURE__ */ jsx15(DragHandle, {
3619
3619
  tableAtom
3620
- }) : null,
3621
- tagIds.map((id) => {
3622
- const column = find(id);
3623
- return column ? /* @__PURE__ */ jsx15(GalleryTag, {
3624
- row,
3625
- column,
3626
- locale: store.config.locale,
3627
- labels: store.config.labels,
3628
- icon: id === gallery.tag ? gallery.tagIcon : undefined
3629
- }, id) : null;
3630
- })
3620
+ }) : null
3631
3621
  ]
3632
3622
  }) : null,
3633
3623
  /* @__PURE__ */ jsx15(CardTitle, {
3634
3624
  children: name ? renderCell(row, name, store.config.locale, store.config.labels) : row.id
3635
3625
  }),
3626
+ tagIds.length ? /* @__PURE__ */ jsx15("div", {
3627
+ className: "flex flex-wrap items-center gap-2",
3628
+ children: tagIds.map((id) => {
3629
+ const column = find(id);
3630
+ return column ? /* @__PURE__ */ jsx15(GalleryTag, {
3631
+ row,
3632
+ column,
3633
+ locale: store.config.locale,
3634
+ labels: store.config.labels,
3635
+ icon: id === gallery.tag ? gallery.tagIcon : undefined
3636
+ }, id) : null;
3637
+ })
3638
+ }) : null,
3636
3639
  description ? /* @__PURE__ */ jsx15("div", {
3637
3640
  className: "text-muted-foreground line-clamp-3 text-sm",
3638
3641
  children: renderCell(row, description, store.config.locale, store.config.labels)
@@ -0,0 +1,124 @@
1
+ import { type ReactNode } from "react";
2
+ import { type RichTextVariable } from "../../lib/rich-text/schema.js";
3
+ import { type EmailDocument } from "../../lib/email-document/schema.js";
4
+ declare const labels: {
5
+ en: {
6
+ edit: string;
7
+ preview: string;
8
+ subject: string;
9
+ preheader: string;
10
+ add: string;
11
+ text: string;
12
+ button: string;
13
+ code: string;
14
+ logo: string;
15
+ image: string;
16
+ divider: string;
17
+ spacer: string;
18
+ content: string;
19
+ properties: string;
20
+ select: string;
21
+ alignment: string;
22
+ left: string;
23
+ center: string;
24
+ right: string;
25
+ paddingTop: string;
26
+ paddingBottom: string;
27
+ width: string;
28
+ height: string;
29
+ src: string;
30
+ alt: string;
31
+ label: string;
32
+ destination: string;
33
+ url: string;
34
+ variable: string;
35
+ insertVariable: string;
36
+ close: string;
37
+ duplicate: string;
38
+ remove: string;
39
+ background: string;
40
+ surface: string;
41
+ primary: string;
42
+ primaryText: string;
43
+ foreground: string;
44
+ font: string;
45
+ sans: string;
46
+ serif: string;
47
+ mono: string;
48
+ branding: string;
49
+ invalid: string;
50
+ newText: string;
51
+ newButton: string;
52
+ newImage: string;
53
+ empty: string;
54
+ editElement: string;
55
+ local: string;
56
+ };
57
+ fr: {
58
+ edit: string;
59
+ preview: string;
60
+ subject: string;
61
+ preheader: string;
62
+ add: string;
63
+ text: string;
64
+ button: string;
65
+ code: string;
66
+ logo: string;
67
+ image: string;
68
+ divider: string;
69
+ spacer: string;
70
+ content: string;
71
+ properties: string;
72
+ select: string;
73
+ alignment: string;
74
+ left: string;
75
+ center: string;
76
+ right: string;
77
+ paddingTop: string;
78
+ paddingBottom: string;
79
+ width: string;
80
+ height: string;
81
+ src: string;
82
+ alt: string;
83
+ label: string;
84
+ destination: string;
85
+ url: string;
86
+ variable: string;
87
+ insertVariable: string;
88
+ close: string;
89
+ duplicate: string;
90
+ remove: string;
91
+ background: string;
92
+ surface: string;
93
+ primary: string;
94
+ primaryText: string;
95
+ foreground: string;
96
+ font: string;
97
+ sans: string;
98
+ serif: string;
99
+ mono: string;
100
+ branding: string;
101
+ invalid: string;
102
+ newText: string;
103
+ newButton: string;
104
+ newImage: string;
105
+ empty: string;
106
+ editElement: string;
107
+ local: string;
108
+ };
109
+ };
110
+ export type EmailEditorMessages = {
111
+ [K in keyof typeof labels.en]: string;
112
+ };
113
+ export type EmailEditorProps = {
114
+ value: EmailDocument;
115
+ onChange: (value: EmailDocument) => void;
116
+ variables?: readonly RichTextVariable[];
117
+ requiredVariables?: readonly string[];
118
+ preview?: ReactNode;
119
+ disabled?: boolean;
120
+ locale?: string;
121
+ messages?: Partial<Record<string, Partial<EmailEditorMessages>>>;
122
+ };
123
+ export declare const EmailEditor: ({ value, onChange, variables, requiredVariables, preview, disabled, locale: override, messages, }: EmailEditorProps) => import("react").JSX.Element;
124
+ export {};