@krak-stack/registry 0.10.5 → 0.10.7
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.
- package/CHANGELOG.md +20 -0
- package/dist/components/ui/animated-list.d.ts +6 -7
- package/dist/components/ui/animated-list.js +329 -139
- package/dist/components/ui/animated-number.js +47 -24
- package/dist/components/ui/auto-height.js +56 -15
- package/dist/components/ui/email-editor.d.ts +124 -0
- package/dist/components/ui/email-editor.js +2677 -0
- package/dist/components/ui/form.d.ts +5 -5
- package/dist/components/ui/presence-transition.d.ts +1 -1
- package/dist/components/ui/presence-transition.js +79 -26
- package/dist/components/ui/rich-text-editor.d.ts +70 -0
- package/dist/components/ui/rich-text-editor.js +1135 -0
- package/dist/components/ui/time-picker.d.ts +13 -4
- package/dist/components/ui/time-picker.js +141 -47
- package/dist/components/ui/time-picker.schema.d.ts +16 -2
- package/dist/lib/email-document/model.d.ts +26 -0
- package/dist/lib/email-document/model.js +253 -0
- package/dist/lib/email-document/render.d.ts +115 -0
- package/dist/lib/email-document/render.js +469 -0
- package/dist/lib/email-document/schema.d.ts +285 -0
- package/dist/lib/email-document/schema.js +139 -0
- package/dist/lib/krakmotion.d.ts +27 -0
- package/dist/lib/rich-text/dom.d.ts +40 -0
- package/dist/lib/rich-text/model.d.ts +19 -0
- package/dist/lib/rich-text/model.js +141 -0
- package/dist/lib/rich-text/schema.d.ts +64 -0
- package/dist/lib/rich-text/schema.js +53 -0
- 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 {
|
|
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 =
|
|
12
|
-
const
|
|
43
|
+
const content = useRef2(null);
|
|
44
|
+
const container = useRef2(null);
|
|
13
45
|
const reduced = useReducedMotion();
|
|
14
|
-
|
|
46
|
+
useEffect2(() => {
|
|
15
47
|
const element = content.current;
|
|
16
|
-
|
|
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
|
-
|
|
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 () =>
|
|
25
|
-
|
|
26
|
-
|
|
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,
|
|
@@ -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 {};
|