@tuturuuu/utils 0.0.3 → 0.6.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.
- package/CHANGELOG.md +305 -0
- package/biome.json +5 -0
- package/jsr.json +8 -8
- package/package.json +63 -32
- package/src/__tests__/ai-temp-auth.test.ts +309 -0
- package/src/__tests__/api-proxy-guard.test.ts +1451 -0
- package/src/__tests__/app-url.test.ts +270 -0
- package/src/__tests__/avatar-url.test.ts +97 -0
- package/src/__tests__/color-helper.test.ts +179 -0
- package/src/__tests__/constants.test.ts +351 -0
- package/src/__tests__/crypto.test.ts +107 -0
- package/src/__tests__/date-helper.test.ts +408 -0
- package/src/__tests__/fixtures/task-description-full-featured.json +456 -0
- package/src/__tests__/format.test.ts +317 -0
- package/src/__tests__/html-sanitizer.test.ts +360 -0
- package/src/__tests__/interest-calculator.test.ts +336 -0
- package/src/__tests__/interest-detector.test.ts +222 -0
- package/src/__tests__/label-colors.test.ts +241 -0
- package/src/__tests__/name-helper.test.ts +158 -0
- package/src/__tests__/node-diff.test.ts +576 -0
- package/src/__tests__/notification-service.test.ts +210 -0
- package/src/__tests__/onboarding-helper.test.ts +331 -0
- package/src/__tests__/path-helper.test.ts +152 -0
- package/src/__tests__/permissions.test.tsx +81 -0
- package/src/__tests__/request-emoji-limit.test.ts +172 -0
- package/src/__tests__/search-helper.test.ts +51 -0
- package/src/__tests__/storage-display-name.test.ts +37 -0
- package/src/__tests__/storage-path.test.ts +238 -0
- package/src/__tests__/tag-utils.test.ts +205 -0
- package/src/__tests__/task-description-yjs-state.test.ts +581 -0
- package/src/__tests__/task-helper-board-api-routing.test.ts +94 -0
- package/src/__tests__/task-helper-create-task.test.ts +129 -0
- package/src/__tests__/task-helpers.test.ts +464 -0
- package/src/__tests__/task-overrides.test.ts +305 -0
- package/src/__tests__/task-reorder-cache.test.ts +74 -0
- package/src/__tests__/task-sort-keys.test.ts +36 -0
- package/src/__tests__/task-transformers.test.ts +62 -0
- package/src/__tests__/text-helper.test.ts +776 -0
- package/src/__tests__/time-helper.test.ts +70 -0
- package/src/__tests__/time-tracker-period.test.ts +55 -0
- package/src/__tests__/timezone.test.ts +117 -0
- package/src/__tests__/upstash-rest.test.ts +77 -0
- package/src/__tests__/uuid-helper.test.ts +133 -0
- package/src/__tests__/workspace-helper.test.ts +859 -0
- package/src/__tests__/workspace-limits.test.ts +255 -0
- package/src/__tests__/yjs-helper.test.ts +581 -0
- package/src/abuse-protection/__tests__/backend-rate-limit.test.ts +113 -0
- package/src/abuse-protection/__tests__/edge.test.ts +136 -0
- package/src/abuse-protection/__tests__/index.test.ts +562 -0
- package/src/abuse-protection/__tests__/reputation.test.ts +192 -0
- package/src/abuse-protection/backend-rate-limit.ts +44 -0
- package/src/abuse-protection/constants.ts +117 -0
- package/src/abuse-protection/edge.ts +223 -0
- package/src/abuse-protection/index.ts +1545 -0
- package/src/abuse-protection/reputation.ts +587 -0
- package/src/abuse-protection/types.ts +97 -0
- package/src/abuse-protection/user-agent.ts +124 -0
- package/src/abuse-protection/user-suspension.ts +231 -0
- package/src/ai-temp-auth.ts +315 -0
- package/src/api-proxy-guard.ts +965 -0
- package/src/app-url.ts +96 -0
- package/src/avatar-url.ts +64 -0
- package/src/break-duration.ts +84 -0
- package/src/calendar-auth-token.test.ts +37 -0
- package/src/calendar-auth-token.ts +19 -0
- package/src/calendar-sync-coordination.md +197 -0
- package/src/calendar-utils.test.ts +169 -0
- package/src/calendar-utils.ts +91 -0
- package/src/color-helper.ts +110 -0
- package/src/common/nextjs.tsx +99 -0
- package/src/common/scan.tsx +15 -0
- package/src/configs/reports.ts +160 -0
- package/src/constants.ts +85 -0
- package/src/crypto.ts +21 -0
- package/src/currencies.ts +97 -0
- package/src/date-helper.ts +313 -0
- package/src/editor/convert-to-task.ts +264 -0
- package/src/editor/index.ts +5 -0
- package/src/email/__tests__/client.test.ts +141 -0
- package/src/email/__tests__/validation.test.ts +46 -0
- package/src/email/client.ts +92 -0
- package/src/email/server.ts +128 -0
- package/src/email/validation.ts +11 -0
- package/src/encryption/__tests__/calendar-events.test.ts +411 -0
- package/src/encryption/__tests__/configuration.test.ts +114 -0
- package/src/encryption/__tests__/field-encryption.test.ts +232 -0
- package/src/encryption/__tests__/key-generation.test.ts +30 -0
- package/src/encryption/__tests__/performance-edge-cases.test.ts +187 -0
- package/src/encryption/__tests__/test-helpers.ts +22 -0
- package/src/encryption/__tests__/workspace-key-encryption.test.ts +129 -0
- package/src/encryption/encryption-service.ts +343 -0
- package/src/encryption/index.ts +25 -0
- package/src/encryption/types.ts +57 -0
- package/src/exchange-rates.ts +49 -0
- package/src/feature-flags/__tests__/feature-flags.test.ts +302 -0
- package/src/feature-flags/core.ts +322 -0
- package/src/feature-flags/data.ts +16 -0
- package/src/feature-flags/default.ts +18 -0
- package/src/feature-flags/index.ts +7 -0
- package/src/feature-flags/requestable-features.ts +79 -0
- package/src/feature-flags/types.ts +4 -0
- package/src/fetcher.ts +2 -0
- package/src/finance/index.ts +4 -0
- package/src/finance/interest-calculator.ts +456 -0
- package/src/finance/interest-detector.ts +141 -0
- package/src/finance/transform-invoice-results.ts +219 -0
- package/src/finance/wallet-permissions.test.ts +169 -0
- package/src/finance/wallet-permissions.ts +82 -0
- package/src/format.ts +120 -1
- package/src/generated/platform-build-metadata.ts +11 -0
- package/src/hooks/use-platform.ts +64 -0
- package/src/html-sanitizer.ts +155 -0
- package/src/internal-domains.ts +497 -0
- package/src/keyboard-preset.ts +109 -0
- package/src/label-colors.ts +213 -0
- package/src/launchable-apps.test.ts +126 -0
- package/src/launchable-apps.ts +490 -0
- package/src/name-helper.ts +269 -0
- package/src/next-config.test.ts +234 -0
- package/src/next-config.ts +203 -0
- package/src/node-diff.ts +375 -0
- package/src/notification-service.ts +379 -0
- package/src/nova/scores/__tests__/calculate.test.ts +254 -0
- package/src/nova/scores/calculate.ts +132 -0
- package/src/nova/submissions/check-permission.ts +132 -0
- package/src/onboarding-helper.ts +213 -0
- package/src/path-helper.ts +93 -0
- package/src/permissions.tsx +1170 -0
- package/src/plan-helpers.test.ts +188 -0
- package/src/plan-helpers.ts +80 -0
- package/src/platform-release.test.ts +74 -0
- package/src/platform-release.ts +155 -0
- package/src/portless.ts +124 -0
- package/src/priority-styles.ts +42 -0
- package/src/request-emoji-limit.ts +335 -0
- package/src/search-helper.ts +18 -0
- package/src/search.test.ts +89 -0
- package/src/search.ts +355 -0
- package/src/storage-display-name.ts +30 -0
- package/src/storage-path.ts +147 -0
- package/src/tag-utils.ts +159 -0
- package/src/task/reorder.ts +245 -0
- package/src/task/transformers.ts +149 -0
- package/src/task-date-timezone.ts +133 -0
- package/src/task-description-content.ts +240 -0
- package/src/task-helper/board.ts +193 -0
- package/src/task-helper/bulk-actions.ts +564 -0
- package/src/task-helper/personal-external-staging.ts +21 -0
- package/src/task-helper/recycle-bin.ts +202 -0
- package/src/task-helper/relationships.ts +346 -0
- package/src/task-helper/shared.ts +109 -0
- package/src/task-helper/sort-keys.ts +337 -0
- package/src/task-helper/task-hooks-basic.ts +342 -0
- package/src/task-helper/task-hooks-move.ts +264 -0
- package/src/task-helper/task-operations.ts +278 -0
- package/src/task-helper.ts +12 -0
- package/src/task-helpers.ts +241 -0
- package/src/task-list-status.ts +62 -0
- package/src/task-overrides.ts +82 -0
- package/src/task-snapshot.ts +374 -0
- package/src/text-diff.ts +81 -0
- package/src/text-helper.ts +537 -0
- package/src/time-helper.ts +63 -0
- package/src/time-tracker-period.ts +73 -0
- package/src/timeblock-helper.ts +418 -0
- package/src/timezone.ts +190 -0
- package/src/timezones.json +1271 -0
- package/src/upstash-rest.ts +56 -0
- package/src/user-helper.ts +296 -0
- package/src/uuid-helper.ts +11 -0
- package/src/workspace-handle.ts +10 -0
- package/src/workspace-helper.ts +1408 -0
- package/src/workspace-limits.ts +68 -0
- package/src/yjs-helper.ts +217 -0
- package/src/yjs-task-description.ts +81 -0
- package/tsconfig.json +3 -5
- package/tsconfig.typecheck.json +33 -0
- package/vitest.config.ts +36 -0
- package/dist/index.d.ts +0 -8
- package/dist/index.js +0 -2
- package/dist/index.js.map +0 -1
- package/dist/index.mjs +0 -2
- package/dist/index.mjs.map +0 -1
- package/eslint.config.mjs +0 -20
- package/rollup.config.js +0 -41
- package/src/index.ts +0 -1
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { MAX_WORKSPACES_FOR_FREE_USERS } from './constants';
|
|
2
|
+
import { isValidTuturuuuEmail } from './email/client';
|
|
3
|
+
|
|
4
|
+
export const WORKSPACE_LIMIT_ERROR_CODE = 'WORKSPACE_LIMIT_REACHED';
|
|
5
|
+
|
|
6
|
+
export interface WorkspaceLimitCheckResult {
|
|
7
|
+
canCreate: boolean;
|
|
8
|
+
currentCount?: number;
|
|
9
|
+
limit?: number;
|
|
10
|
+
errorMessage?: string;
|
|
11
|
+
errorCode?: string;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Check if a user can create a new workspace based on their email and current workspace count
|
|
16
|
+
* @param supabase - Supabase client instance
|
|
17
|
+
* @param userId - User ID to check
|
|
18
|
+
* @param userEmail - User email (null/undefined for unlimited)
|
|
19
|
+
* @returns Result indicating whether the user can create a workspace
|
|
20
|
+
*/
|
|
21
|
+
export async function checkWorkspaceCreationLimit(
|
|
22
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
23
|
+
supabase: any,
|
|
24
|
+
userId: string,
|
|
25
|
+
userEmail: string | null | undefined
|
|
26
|
+
): Promise<WorkspaceLimitCheckResult> {
|
|
27
|
+
// Tuturuuu emails have unlimited workspace creation
|
|
28
|
+
if (isValidTuturuuuEmail(userEmail)) {
|
|
29
|
+
return {
|
|
30
|
+
canCreate: true,
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
// Count non-deleted workspaces created by this user
|
|
35
|
+
const { count, error: countError } = await supabase
|
|
36
|
+
.from('workspaces')
|
|
37
|
+
.select('*', { count: 'exact', head: true })
|
|
38
|
+
.eq('creator_id', userId)
|
|
39
|
+
.eq('deleted', false);
|
|
40
|
+
|
|
41
|
+
if (countError) {
|
|
42
|
+
console.error('Error counting workspaces:', countError);
|
|
43
|
+
return {
|
|
44
|
+
canCreate: false,
|
|
45
|
+
errorMessage: 'Error checking workspace limit',
|
|
46
|
+
errorCode: 'WORKSPACE_COUNT_ERROR',
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
const currentCount = count ?? 0;
|
|
51
|
+
|
|
52
|
+
// Check if user has reached the limit
|
|
53
|
+
if (currentCount >= MAX_WORKSPACES_FOR_FREE_USERS) {
|
|
54
|
+
return {
|
|
55
|
+
canCreate: false,
|
|
56
|
+
currentCount,
|
|
57
|
+
limit: MAX_WORKSPACES_FOR_FREE_USERS,
|
|
58
|
+
errorMessage: `You have reached the maximum limit of ${MAX_WORKSPACES_FOR_FREE_USERS} workspaces. Please upgrade to a paid plan or contact the Tuturuuu team for more information.`,
|
|
59
|
+
errorCode: WORKSPACE_LIMIT_ERROR_CODE,
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
return {
|
|
64
|
+
canCreate: true,
|
|
65
|
+
currentCount,
|
|
66
|
+
limit: MAX_WORKSPACES_FOR_FREE_USERS,
|
|
67
|
+
};
|
|
68
|
+
}
|
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
import type { JSONContent } from '@tiptap/react';
|
|
2
|
+
import { Node as ProseMirrorNode, type Schema } from 'prosemirror-model';
|
|
3
|
+
import * as Y from 'yjs';
|
|
4
|
+
|
|
5
|
+
const PROSEMIRROR_FRAGMENT_NAME = 'prosemirror';
|
|
6
|
+
const HASHED_MARK_NAME_REGEX = /(.*)(--[a-zA-Z0-9+/=]{8})$/;
|
|
7
|
+
|
|
8
|
+
type TextMark = NonNullable<JSONContent['marks']>[number];
|
|
9
|
+
type YTextDelta = { insert: unknown; attributes?: unknown };
|
|
10
|
+
|
|
11
|
+
function getMarkName(attributeName: string): string {
|
|
12
|
+
return HASHED_MARK_NAME_REGEX.exec(attributeName)?.[1] ?? attributeName;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
function isTextNode(content: JSONContent): boolean {
|
|
16
|
+
return content.type === 'text';
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function getAttrs(attrs: JSONContent['attrs']): Record<string, unknown> {
|
|
20
|
+
if (!attrs) return {};
|
|
21
|
+
|
|
22
|
+
return Object.fromEntries(
|
|
23
|
+
Object.entries(attrs).filter(
|
|
24
|
+
([key, value]) => key !== 'ychange' && value !== null
|
|
25
|
+
)
|
|
26
|
+
);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function marksToAttributes(
|
|
30
|
+
marks: JSONContent['marks']
|
|
31
|
+
): Record<string, unknown> {
|
|
32
|
+
if (!marks) return {};
|
|
33
|
+
|
|
34
|
+
return Object.fromEntries(
|
|
35
|
+
marks
|
|
36
|
+
.filter((mark): mark is TextMark => Boolean(mark?.type))
|
|
37
|
+
.filter((mark) => mark.type !== 'ychange')
|
|
38
|
+
.map((mark) => [mark.type, mark.attrs ?? {}])
|
|
39
|
+
);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
function attributesToMarks(attrs: unknown): JSONContent['marks'] {
|
|
43
|
+
if (!attrs || typeof attrs !== 'object' || Array.isArray(attrs)) return;
|
|
44
|
+
|
|
45
|
+
const marks = Object.entries(attrs).map(([type, value]) => {
|
|
46
|
+
const mark: TextMark = { type: getMarkName(type) };
|
|
47
|
+
if (
|
|
48
|
+
value &&
|
|
49
|
+
typeof value === 'object' &&
|
|
50
|
+
!Array.isArray(value) &&
|
|
51
|
+
Object.keys(value).length > 0
|
|
52
|
+
) {
|
|
53
|
+
mark.attrs = value as Record<string, unknown>;
|
|
54
|
+
}
|
|
55
|
+
return mark;
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
return marks.length > 0 ? marks : undefined;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
function createYText(textNodes: JSONContent[]): Y.XmlText {
|
|
62
|
+
const yText = new Y.XmlText();
|
|
63
|
+
const delta = textNodes
|
|
64
|
+
.map((node) => ({
|
|
65
|
+
insert: node.text ?? '',
|
|
66
|
+
attributes: marksToAttributes(node.marks),
|
|
67
|
+
}))
|
|
68
|
+
.filter((item) => item.insert.length > 0);
|
|
69
|
+
|
|
70
|
+
if (delta.length > 0) {
|
|
71
|
+
yText.applyDelta(delta);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
return yText;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
function createYElement(node: JSONContent): Y.XmlElement {
|
|
78
|
+
const element = new Y.XmlElement(node.type ?? 'paragraph');
|
|
79
|
+
const attrs = getAttrs(node.attrs);
|
|
80
|
+
|
|
81
|
+
for (const [key, value] of Object.entries(attrs)) {
|
|
82
|
+
element.setAttribute(key, value as string);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
element.insert(0, createYChildren(node.content ?? []));
|
|
86
|
+
|
|
87
|
+
return element;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
function createYChildren(
|
|
91
|
+
content: JSONContent[]
|
|
92
|
+
): Array<Y.XmlElement | Y.XmlText> {
|
|
93
|
+
const children: Array<Y.XmlElement | Y.XmlText> = [];
|
|
94
|
+
let pendingTextNodes: JSONContent[] = [];
|
|
95
|
+
|
|
96
|
+
const flushTextNodes = () => {
|
|
97
|
+
if (pendingTextNodes.length === 0) return;
|
|
98
|
+
children.push(createYText(pendingTextNodes));
|
|
99
|
+
pendingTextNodes = [];
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
for (const node of content) {
|
|
103
|
+
if (isTextNode(node)) {
|
|
104
|
+
pendingTextNodes.push(node);
|
|
105
|
+
continue;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
flushTextNodes();
|
|
109
|
+
children.push(createYElement(node));
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
flushTextNodes();
|
|
113
|
+
|
|
114
|
+
return children;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
function textNodesFromYText(text: Y.XmlText): JSONContent[] {
|
|
118
|
+
return (text.toDelta() as YTextDelta[])
|
|
119
|
+
.filter((delta): delta is { insert: string; attributes?: unknown } => {
|
|
120
|
+
return typeof delta.insert === 'string' && delta.insert.length > 0;
|
|
121
|
+
})
|
|
122
|
+
.map((delta) => {
|
|
123
|
+
const node: JSONContent = {
|
|
124
|
+
type: 'text',
|
|
125
|
+
text: delta.insert,
|
|
126
|
+
};
|
|
127
|
+
const marks = attributesToMarks(delta.attributes);
|
|
128
|
+
|
|
129
|
+
if (marks) {
|
|
130
|
+
node.marks = marks;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
return node;
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
function contentFromYChildren(
|
|
138
|
+
parent: Y.XmlElement | Y.XmlFragment
|
|
139
|
+
): JSONContent[] {
|
|
140
|
+
const content: JSONContent[] = [];
|
|
141
|
+
|
|
142
|
+
for (const child of parent.toArray()) {
|
|
143
|
+
if (child instanceof Y.XmlText) {
|
|
144
|
+
content.push(...textNodesFromYText(child));
|
|
145
|
+
continue;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
if (child instanceof Y.XmlElement) {
|
|
149
|
+
content.push(jsonFromYElement(child));
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
return content;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
function jsonFromYElement(element: Y.XmlElement): JSONContent {
|
|
157
|
+
const node: JSONContent = {
|
|
158
|
+
type: element.nodeName,
|
|
159
|
+
};
|
|
160
|
+
const attrs = getAttrs(element.getAttributes());
|
|
161
|
+
const content = contentFromYChildren(element);
|
|
162
|
+
|
|
163
|
+
if (Object.keys(attrs).length > 0) {
|
|
164
|
+
node.attrs = attrs;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
if (content.length > 0) {
|
|
168
|
+
node.content = content;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
return node;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
function validateJsonContent(
|
|
175
|
+
jsonContent: JSONContent,
|
|
176
|
+
schema?: Schema
|
|
177
|
+
): JSONContent {
|
|
178
|
+
if (!schema) {
|
|
179
|
+
return jsonContent;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
return ProseMirrorNode.fromJSON(schema, jsonContent).toJSON() as JSONContent;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
export function convertJsonContentToYjsState(
|
|
186
|
+
jsonContent: JSONContent,
|
|
187
|
+
schema?: Schema
|
|
188
|
+
): Uint8Array {
|
|
189
|
+
const ydoc = new Y.Doc();
|
|
190
|
+
const fragment = ydoc.getXmlFragment(PROSEMIRROR_FRAGMENT_NAME);
|
|
191
|
+
const normalizedContent = validateJsonContent(jsonContent, schema);
|
|
192
|
+
const content =
|
|
193
|
+
normalizedContent.type === 'doc'
|
|
194
|
+
? (normalizedContent.content ?? [])
|
|
195
|
+
: [normalizedContent];
|
|
196
|
+
|
|
197
|
+
fragment.insert(0, createYChildren(content));
|
|
198
|
+
return Y.encodeStateAsUpdate(ydoc);
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
export function convertYjsStateToJsonContent(
|
|
202
|
+
yjsState: Uint8Array,
|
|
203
|
+
schema?: Schema
|
|
204
|
+
): JSONContent {
|
|
205
|
+
const ydoc = new Y.Doc();
|
|
206
|
+
Y.applyUpdate(ydoc, yjsState);
|
|
207
|
+
|
|
208
|
+
const fragment = ydoc.getXmlFragment(PROSEMIRROR_FRAGMENT_NAME);
|
|
209
|
+
|
|
210
|
+
return validateJsonContent(
|
|
211
|
+
{
|
|
212
|
+
type: 'doc',
|
|
213
|
+
content: contentFromYChildren(fragment),
|
|
214
|
+
},
|
|
215
|
+
schema
|
|
216
|
+
);
|
|
217
|
+
}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import type { JSONContent } from '@tiptap/core';
|
|
2
|
+
import {
|
|
3
|
+
hasMeaningfulTaskDescriptionContent,
|
|
4
|
+
isValidTaskDescriptionContent,
|
|
5
|
+
parseTaskDescriptionContent,
|
|
6
|
+
taskDescriptionSchema,
|
|
7
|
+
} from './task-description-content';
|
|
8
|
+
import { getDescriptionText } from './text-helper';
|
|
9
|
+
import {
|
|
10
|
+
convertJsonContentToYjsState,
|
|
11
|
+
convertYjsStateToJsonContent,
|
|
12
|
+
} from './yjs-helper';
|
|
13
|
+
|
|
14
|
+
export { isValidTaskDescriptionContent, taskDescriptionSchema };
|
|
15
|
+
|
|
16
|
+
export function isValidTaskDescriptionYjsState(
|
|
17
|
+
yjsState: number[] | null | undefined
|
|
18
|
+
): boolean {
|
|
19
|
+
if (yjsState == null) {
|
|
20
|
+
return true;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
try {
|
|
24
|
+
convertYjsStateToJsonContent(
|
|
25
|
+
Uint8Array.from(yjsState),
|
|
26
|
+
taskDescriptionSchema
|
|
27
|
+
);
|
|
28
|
+
return true;
|
|
29
|
+
} catch {
|
|
30
|
+
return false;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
function encodeYjsState(content: JSONContent): number[] | null {
|
|
35
|
+
const encoded = convertJsonContentToYjsState(content, taskDescriptionSchema);
|
|
36
|
+
if (encoded.length === 0) {
|
|
37
|
+
return null;
|
|
38
|
+
}
|
|
39
|
+
return Array.from(encoded);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Derives a task-description Yjs state array from TipTap JSON or plain text.
|
|
44
|
+
* Returns null for empty descriptions or when conversion cannot succeed.
|
|
45
|
+
*/
|
|
46
|
+
export function deriveTaskDescriptionYjsState(
|
|
47
|
+
description: string | null | undefined
|
|
48
|
+
): number[] | null {
|
|
49
|
+
const normalizedDescription = description?.trim();
|
|
50
|
+
if (!normalizedDescription) {
|
|
51
|
+
return null;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
const content = parseTaskDescriptionContent(normalizedDescription);
|
|
55
|
+
if (!hasMeaningfulTaskDescriptionContent(content)) {
|
|
56
|
+
return null;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
try {
|
|
60
|
+
return encodeYjsState(content);
|
|
61
|
+
} catch {
|
|
62
|
+
const fallbackText = getDescriptionText(normalizedDescription).trim();
|
|
63
|
+
if (!fallbackText) {
|
|
64
|
+
return null;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
try {
|
|
68
|
+
return encodeYjsState({
|
|
69
|
+
type: 'doc',
|
|
70
|
+
content: [
|
|
71
|
+
{
|
|
72
|
+
type: 'paragraph',
|
|
73
|
+
content: [{ type: 'text', text: fallbackText }],
|
|
74
|
+
},
|
|
75
|
+
],
|
|
76
|
+
});
|
|
77
|
+
} catch {
|
|
78
|
+
return null;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
package/tsconfig.json
CHANGED
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"extends": "@tuturuuu/typescript-config/react-library.json",
|
|
3
3
|
"compilerOptions": {
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
"@tuturuuu/types/*": ["./src/*"]
|
|
7
|
-
}
|
|
4
|
+
"outDir": "dist",
|
|
5
|
+
"rootDir": "src"
|
|
8
6
|
},
|
|
9
7
|
"include": ["src"],
|
|
10
|
-
"exclude": ["node_modules"]
|
|
8
|
+
"exclude": ["node_modules", "dist", ".turbo"]
|
|
11
9
|
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json.schemastore.org/tsconfig",
|
|
3
|
+
"display": "Utils TypeCheck",
|
|
4
|
+
"compilerOptions": {
|
|
5
|
+
"esModuleInterop": true,
|
|
6
|
+
"incremental": true,
|
|
7
|
+
"composite": false,
|
|
8
|
+
"declaration": false,
|
|
9
|
+
"declarationMap": false,
|
|
10
|
+
"isolatedModules": true,
|
|
11
|
+
"forceConsistentCasingInFileNames": true,
|
|
12
|
+
"inlineSources": false,
|
|
13
|
+
"noUnusedLocals": true,
|
|
14
|
+
"noUnusedParameters": false,
|
|
15
|
+
"preserveWatchOutput": true,
|
|
16
|
+
"strictNullChecks": true,
|
|
17
|
+
"allowJs": false,
|
|
18
|
+
"lib": ["esnext", "DOM", "DOM.Iterable"],
|
|
19
|
+
"module": "NodeNext",
|
|
20
|
+
"moduleDetection": "force",
|
|
21
|
+
"moduleResolution": "NodeNext",
|
|
22
|
+
"noUncheckedIndexedAccess": true,
|
|
23
|
+
"resolveJsonModule": true,
|
|
24
|
+
"skipLibCheck": true,
|
|
25
|
+
"strict": true,
|
|
26
|
+
"target": "esnext",
|
|
27
|
+
"jsx": "react-jsx",
|
|
28
|
+
"outDir": "dist",
|
|
29
|
+
"rootDir": "src"
|
|
30
|
+
},
|
|
31
|
+
"include": ["src"],
|
|
32
|
+
"exclude": ["node_modules", "dist", ".turbo"]
|
|
33
|
+
}
|
package/vitest.config.ts
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { resolve } from 'node:path';
|
|
2
|
+
import react from '@vitejs/plugin-react';
|
|
3
|
+
import { loadEnv } from 'vite';
|
|
4
|
+
import { defineConfig } from 'vitest/config';
|
|
5
|
+
|
|
6
|
+
const silent = process.env.CHECK_DETAILS === '1' ? false : 'passed-only';
|
|
7
|
+
|
|
8
|
+
export default defineConfig({
|
|
9
|
+
plugins: [react()],
|
|
10
|
+
test: {
|
|
11
|
+
environment: 'jsdom',
|
|
12
|
+
env: loadEnv('production', process.cwd(), ''),
|
|
13
|
+
exclude: ['**/node_modules/**', '**/dist/**'],
|
|
14
|
+
silent,
|
|
15
|
+
},
|
|
16
|
+
resolve: {
|
|
17
|
+
alias: [
|
|
18
|
+
{ find: '@', replacement: resolve(__dirname, './src') },
|
|
19
|
+
{
|
|
20
|
+
find: '@tuturuuu/internal-api/tasks',
|
|
21
|
+
replacement: resolve(__dirname, '../internal-api/src/tasks.ts'),
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
find: '@tuturuuu/internal-api/workspace-configs',
|
|
25
|
+
replacement: resolve(
|
|
26
|
+
__dirname,
|
|
27
|
+
'../internal-api/src/workspace-configs.ts'
|
|
28
|
+
),
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
find: '@tuturuuu/supabase/next/server',
|
|
32
|
+
replacement: resolve(__dirname, '../supabase/src/next/server.ts'),
|
|
33
|
+
},
|
|
34
|
+
],
|
|
35
|
+
},
|
|
36
|
+
});
|
package/dist/index.d.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
declare function cn(...inputs: (string | undefined)[]): string;
|
|
2
|
-
declare const capitalize: (s?: string | null) => string;
|
|
3
|
-
declare function formatBytes(bytes: number, opts?: {
|
|
4
|
-
decimals?: number;
|
|
5
|
-
sizeType?: 'accurate' | 'normal';
|
|
6
|
-
}): string;
|
|
7
|
-
|
|
8
|
-
export { capitalize, cn, formatBytes };
|
package/dist/index.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use strict";function e(r){var o,t,n="";if("string"==typeof r||"number"==typeof r)n+=r;else if("object"==typeof r)if(Array.isArray(r)){var s=r.length;for(o=0;o<s;o++)r[o]&&(t=e(r[o]))&&(n&&(n+=" "),n+=t)}else for(t in r)r[t]&&(n&&(n+=" "),n+=t);return n}const r=e=>{const r=s(e),{conflictingClassGroups:t,conflictingClassGroupModifiers:l}=e;return{getClassGroupId:e=>{const t=e.split("-");return""===t[0]&&1!==t.length&&t.shift(),o(t,r)||n(e)},getConflictingClassGroupIds:(e,r)=>{const o=t[e]||[];return r&&l[e]?[...o,...l[e]]:o}}},o=(e,r)=>{if(0===e.length)return r.classGroupId;const t=e[0],n=r.nextPart.get(t),s=n?o(e.slice(1),n):void 0;if(s)return s;if(0===r.validators.length)return;const l=e.join("-");return r.validators.find((({validator:e})=>e(l)))?.classGroupId},t=/^\[(.+)\]$/,n=e=>{if(t.test(e)){const r=t.exec(e)[1],o=r?.substring(0,r.indexOf(":"));if(o)return"arbitrary.."+o}},s=e=>{const{theme:r,classGroups:o}=e,t={nextPart:new Map,validators:[]};for(const e in o)l(o[e],t,e,r);return t},l=(e,r,o,t)=>{e.forEach((e=>{if("string"!=typeof e){if("function"==typeof e)return i(e)?void l(e(t),r,o,t):void r.validators.push({validator:e,classGroupId:o});Object.entries(e).forEach((([e,n])=>{l(n,a(r,e),o,t)}))}else{(""===e?r:a(r,e)).classGroupId=o}}))},a=(e,r)=>{let o=e;return r.split("-").forEach((e=>{o.nextPart.has(e)||o.nextPart.set(e,{nextPart:new Map,validators:[]}),o=o.nextPart.get(e)})),o},i=e=>e.isThemeGetter,d=e=>{if(e<1)return{get:()=>{},set:()=>{}};let r=0,o=new Map,t=new Map;const n=(n,s)=>{o.set(n,s),r++,r>e&&(r=0,t=o,o=new Map)};return{get(e){let r=o.get(e);return void 0!==r?r:void 0!==(r=t.get(e))?(n(e,r),r):void 0},set(e,r){o.has(e)?o.set(e,r):n(e,r)}}},c=e=>{const{prefix:r,experimentalParseClassName:o}=e;let t=e=>{const r=[];let o,t=0,n=0,s=0;for(let l=0;l<e.length;l++){let a=e[l];if(0===t&&0===n){if(":"===a){r.push(e.slice(s,l)),s=l+1;continue}if("/"===a){o=l;continue}}"["===a?t++:"]"===a?t--:"("===a?n++:")"===a&&n--}const l=0===r.length?e:e.substring(s),a=p(l);return{modifiers:r,hasImportantModifier:a!==l,baseClassName:a,maybePostfixModifierPosition:o&&o>s?o-s:void 0}};if(r){const e=r+":",o=t;t=r=>r.startsWith(e)?o(r.substring(e.length)):{isExternal:!0,modifiers:[],hasImportantModifier:!1,baseClassName:r,maybePostfixModifierPosition:void 0}}if(o){const e=t;t=r=>o({className:r,parseClassName:e})}return t},p=e=>e.endsWith("!")?e.substring(0,e.length-1):e.startsWith("!")?e.substring(1):e,u=e=>{const r=Object.fromEntries(e.orderSensitiveModifiers.map((e=>[e,!0])));return e=>{if(e.length<=1)return e;const o=[];let t=[];return e.forEach((e=>{"["===e[0]||r[e]?(o.push(...t.sort(),e),t=[]):t.push(e)})),o.push(...t.sort()),o}},b=/\s+/;function f(){let e,r,o=0,t="";for(;o<arguments.length;)(e=arguments[o++])&&(r=m(e))&&(t&&(t+=" "),t+=r);return t}const m=e=>{if("string"==typeof e)return e;let r,o="";for(let t=0;t<e.length;t++)e[t]&&(r=m(e[t]))&&(o&&(o+=" "),o+=r);return o};function g(e,...o){let t,n,s,l=function(i){const p=o.reduce(((e,r)=>r(e)),e());return t=(e=>({cache:d(e.cacheSize),parseClassName:c(e),sortModifiers:u(e),...r(e)}))(p),n=t.cache.get,s=t.cache.set,l=a,a(i)};function a(e){const r=n(e);if(r)return r;const o=((e,r)=>{const{parseClassName:o,getClassGroupId:t,getConflictingClassGroupIds:n,sortModifiers:s}=r,l=[],a=e.trim().split(b);let i="";for(let e=a.length-1;e>=0;e-=1){const r=a[e],{isExternal:d,modifiers:c,hasImportantModifier:p,baseClassName:u,maybePostfixModifierPosition:b}=o(r);if(d){i=r+(i.length>0?" "+i:i);continue}let f=!!b,m=t(f?u.substring(0,b):u);if(!m){if(!f){i=r+(i.length>0?" "+i:i);continue}if(m=t(u),!m){i=r+(i.length>0?" "+i:i);continue}f=!1}const g=s(c).join(":"),h=p?g+"!":g,x=h+m;if(l.includes(x))continue;l.push(x);const w=n(m,f);for(let e=0;e<w.length;++e){const r=w[e];l.push(h+r)}i=r+(i.length>0?" "+i:i)}return i})(e,t);return s(e,o),o}return function(){return l(f.apply(null,arguments))}}const h=e=>{const r=r=>r[e]||[];return r.isThemeGetter=!0,r},x=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,w=/^\((?:(\w[\w-]*):)?(.+)\)$/i,y=/^\d+\/\d+$/,v=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,k=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,z=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,M=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,C=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,j=e=>y.test(e),G=e=>Boolean(e)&&!Number.isNaN(Number(e)),B=e=>Boolean(e)&&Number.isInteger(Number(e)),N=e=>e.endsWith("%")&&G(e.slice(0,-1)),P=e=>v.test(e),I=()=>!0,$=e=>k.test(e)&&!z.test(e),E=()=>!1,S=e=>M.test(e),T=e=>C.test(e),W=e=>!O(e)&&!D(e),A=e=>X(e,te,E),O=e=>x.test(e),q=e=>X(e,ne,$),K=e=>X(e,se,G),U=e=>X(e,Z,E),_=e=>X(e,re,T),F=e=>X(e,E,S),D=e=>w.test(e),H=e=>Y(e,ne),J=e=>Y(e,le),L=e=>Y(e,Z),Q=e=>Y(e,te),R=e=>Y(e,re),V=e=>Y(e,ae,!0),X=(e,r,o)=>{const t=x.exec(e);return!!t&&(t[1]?r(t[1]):o(t[2]))},Y=(e,r,o=!1)=>{const t=w.exec(e);return!!t&&(t[1]?r(t[1]):o)},Z=e=>"position"===e,ee=new Set(["image","url"]),re=e=>ee.has(e),oe=new Set(["length","size","percentage"]),te=e=>oe.has(e),ne=e=>"length"===e,se=e=>"number"===e,le=e=>"family-name"===e,ae=e=>"shadow"===e,ie=g((()=>{const e=h("color"),r=h("font"),o=h("text"),t=h("font-weight"),n=h("tracking"),s=h("leading"),l=h("breakpoint"),a=h("container"),i=h("spacing"),d=h("radius"),c=h("shadow"),p=h("inset-shadow"),u=h("drop-shadow"),b=h("blur"),f=h("perspective"),m=h("aspect"),g=h("ease"),x=h("animate"),w=()=>[j,"px","full","auto",D,O,i],y=()=>[B,"none","subgrid",D,O],v=()=>["auto",{span:["full",B,D,O]},D,O],k=()=>[B,"auto",D,O],z=()=>["auto","min","max","fr",D,O],M=()=>[D,O,i],C=()=>[D,O,i],$=()=>["px",...C()],E=()=>["px","auto",...C()],S=()=>[j,"auto","px","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",D,O,i],T=()=>[e,D,O],X=()=>[N,q],Y=()=>["","none","full",d,D,O],Z=()=>["",G,H,q],ee=()=>["","none",b,D,O],re=()=>["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",D,O],oe=()=>["none",G,D,O],te=()=>["none",G,D,O],ne=()=>[G,D,O],se=()=>[j,"full","px",D,O,i];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[P],breakpoint:[P],color:[I],container:[P],"drop-shadow":[P],ease:["in","out","in-out"],font:[W],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[P],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[P],shadow:[P],spacing:[G],text:[P],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",j,O,D,m]}],container:["container"],columns:[{columns:[G,O,D,a]}],"break-after":[{"break-after":["auto","avoid","all","avoid-page","page","left","right","column"]}],"break-before":[{"break-before":["auto","avoid","all","avoid-page","page","left","right","column"]}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top",O,D]}],overflow:[{overflow:["auto","hidden","clip","visible","scroll"]}],"overflow-x":[{"overflow-x":["auto","hidden","clip","visible","scroll"]}],"overflow-y":[{"overflow-y":["auto","hidden","clip","visible","scroll"]}],overscroll:[{overscroll:["auto","contain","none"]}],"overscroll-x":[{"overscroll-x":["auto","contain","none"]}],"overscroll-y":[{"overscroll-y":["auto","contain","none"]}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:w()}],"inset-x":[{"inset-x":w()}],"inset-y":[{"inset-y":w()}],start:[{start:w()}],end:[{end:w()}],top:[{top:w()}],right:[{right:w()}],bottom:[{bottom:w()}],left:[{left:w()}],visibility:["visible","invisible","collapse"],z:[{z:[B,"auto",D,O]}],basis:[{basis:[j,"full","auto",D,O,a,i]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[G,j,"auto","initial","none",O]}],grow:[{grow:["",G,D,O]}],shrink:[{shrink:["",G,D,O]}],order:[{order:[B,"first","last","none",D,O]}],"grid-cols":[{"grid-cols":y()}],"col-start-end":[{col:v()}],"col-start":[{"col-start":k()}],"col-end":[{"col-end":k()}],"grid-rows":[{"grid-rows":y()}],"row-start-end":[{row:v()}],"row-start":[{"row-start":k()}],"row-end":[{"row-end":k()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":z()}],"auto-rows":[{"auto-rows":z()}],gap:[{gap:M()}],"gap-x":[{"gap-x":M()}],"gap-y":[{"gap-y":M()}],"justify-content":[{justify:["start","end","center","between","around","evenly","stretch","baseline","normal"]}],"justify-items":[{"justify-items":["start","end","center","stretch","normal"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal","start","end","center","between","around","evenly","stretch","baseline"]}],"align-items":[{items:["start","end","center","stretch","baseline"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":["start","end","center","between","around","evenly","stretch","baseline"]}],"place-items":[{"place-items":["start","end","center","stretch","baseline"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:$()}],px:[{px:$()}],py:[{py:$()}],ps:[{ps:$()}],pe:[{pe:$()}],pt:[{pt:$()}],pr:[{pr:$()}],pb:[{pb:$()}],pl:[{pl:$()}],m:[{m:E()}],mx:[{mx:E()}],my:[{my:E()}],ms:[{ms:E()}],me:[{me:E()}],mt:[{mt:E()}],mr:[{mr:E()}],mb:[{mb:E()}],ml:[{ml:E()}],"space-x":[{"space-x":C()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":C()}],"space-y-reverse":["space-y-reverse"],size:[{size:S()}],w:[{w:[a,"screen",...S()]}],"min-w":[{"min-w":[a,"screen","none",...S()]}],"max-w":[{"max-w":[a,"screen","none","prose",{screen:[l]},...S()]}],h:[{h:["screen",...S()]}],"min-h":[{"min-h":["screen","none",...S()]}],"max-h":[{"max-h":["screen",...S()]}],"font-size":[{text:["base",o,H,q]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[t,D,K]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",N,O]}],"font-family":[{font:[J,O,r]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[n,D,O]}],"line-clamp":[{"line-clamp":[G,"none",D,K]}],leading:[{leading:[D,O,s,i]}],"list-image":[{"list-image":["none",D,O]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",D,O]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:T()}],"text-color":[{text:T()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:["solid","dashed","dotted","double","wavy"]}],"text-decoration-thickness":[{decoration:[G,"from-font","auto",D,q]}],"text-decoration-color":[{decoration:T()}],"underline-offset":[{"underline-offset":[G,"auto",D,O]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:["px",...C()]}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",D,O]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",D,O]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top",L,U]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","space","round"]}]}],"bg-size":[{bg:["auto","cover","contain",Q,A]}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},B,D,O],radial:["",D,O],conic:[B,D,O]},R,_]}],"bg-color":[{bg:T()}],"gradient-from-pos":[{from:X()}],"gradient-via-pos":[{via:X()}],"gradient-to-pos":[{to:X()}],"gradient-from":[{from:T()}],"gradient-via":[{via:T()}],"gradient-to":[{to:T()}],rounded:[{rounded:Y()}],"rounded-s":[{"rounded-s":Y()}],"rounded-e":[{"rounded-e":Y()}],"rounded-t":[{"rounded-t":Y()}],"rounded-r":[{"rounded-r":Y()}],"rounded-b":[{"rounded-b":Y()}],"rounded-l":[{"rounded-l":Y()}],"rounded-ss":[{"rounded-ss":Y()}],"rounded-se":[{"rounded-se":Y()}],"rounded-ee":[{"rounded-ee":Y()}],"rounded-es":[{"rounded-es":Y()}],"rounded-tl":[{"rounded-tl":Y()}],"rounded-tr":[{"rounded-tr":Y()}],"rounded-br":[{"rounded-br":Y()}],"rounded-bl":[{"rounded-bl":Y()}],"border-w":[{border:Z()}],"border-w-x":[{"border-x":Z()}],"border-w-y":[{"border-y":Z()}],"border-w-s":[{"border-s":Z()}],"border-w-e":[{"border-e":Z()}],"border-w-t":[{"border-t":Z()}],"border-w-r":[{"border-r":Z()}],"border-w-b":[{"border-b":Z()}],"border-w-l":[{"border-l":Z()}],"divide-x":[{"divide-x":Z()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":Z()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:["solid","dashed","dotted","double","hidden","none"]}],"divide-style":[{divide:["solid","dashed","dotted","double","hidden","none"]}],"border-color":[{border:T()}],"border-color-x":[{"border-x":T()}],"border-color-y":[{"border-y":T()}],"border-color-s":[{"border-s":T()}],"border-color-e":[{"border-e":T()}],"border-color-t":[{"border-t":T()}],"border-color-r":[{"border-r":T()}],"border-color-b":[{"border-b":T()}],"border-color-l":[{"border-l":T()}],"divide-color":[{divide:T()}],"outline-style":[{outline:["solid","dashed","dotted","double","none","hidden"]}],"outline-offset":[{"outline-offset":[G,D,O]}],"outline-w":[{outline:["",G,H,q]}],"outline-color":[{outline:[e]}],shadow:[{shadow:["","none",c,V,F]}],"shadow-color":[{shadow:T()}],"inset-shadow":[{"inset-shadow":["none",D,O,p]}],"inset-shadow-color":[{"inset-shadow":T()}],"ring-w":[{ring:Z()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:T()}],"ring-offset-w":[{"ring-offset":[G,q]}],"ring-offset-color":[{"ring-offset":T()}],"inset-ring-w":[{"inset-ring":Z()}],"inset-ring-color":[{"inset-ring":T()}],opacity:[{opacity:[G,D,O]}],"mix-blend":[{"mix-blend":["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity","plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"]}],filter:[{filter:["","none",D,O]}],blur:[{blur:ee()}],brightness:[{brightness:[G,D,O]}],contrast:[{contrast:[G,D,O]}],"drop-shadow":[{"drop-shadow":["","none",u,D,O]}],grayscale:[{grayscale:["",G,D,O]}],"hue-rotate":[{"hue-rotate":[G,D,O]}],invert:[{invert:["",G,D,O]}],saturate:[{saturate:[G,D,O]}],sepia:[{sepia:["",G,D,O]}],"backdrop-filter":[{"backdrop-filter":["","none",D,O]}],"backdrop-blur":[{"backdrop-blur":ee()}],"backdrop-brightness":[{"backdrop-brightness":[G,D,O]}],"backdrop-contrast":[{"backdrop-contrast":[G,D,O]}],"backdrop-grayscale":[{"backdrop-grayscale":["",G,D,O]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[G,D,O]}],"backdrop-invert":[{"backdrop-invert":["",G,D,O]}],"backdrop-opacity":[{"backdrop-opacity":[G,D,O]}],"backdrop-saturate":[{"backdrop-saturate":[G,D,O]}],"backdrop-sepia":[{"backdrop-sepia":["",G,D,O]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":C()}],"border-spacing-x":[{"border-spacing-x":C()}],"border-spacing-y":[{"border-spacing-y":C()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",D,O]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[G,"initial",D,O]}],ease:[{ease:["linear","initial",g,D,O]}],delay:[{delay:[G,D,O]}],animate:[{animate:["none",x,D,O]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[f,D,O]}],"perspective-origin":[{"perspective-origin":re()}],rotate:[{rotate:oe()}],"rotate-x":[{"rotate-x":oe()}],"rotate-y":[{"rotate-y":oe()}],"rotate-z":[{"rotate-z":oe()}],scale:[{scale:te()}],"scale-x":[{"scale-x":te()}],"scale-y":[{"scale-y":te()}],"scale-z":[{"scale-z":te()}],"scale-3d":["scale-3d"],skew:[{skew:ne()}],"skew-x":[{"skew-x":ne()}],"skew-y":[{"skew-y":ne()}],transform:[{transform:[D,O,"","none","gpu","cpu"]}],"transform-origin":[{origin:re()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:se()}],"translate-x":[{"translate-x":se()}],"translate-y":[{"translate-y":se()}],"translate-z":[{"translate-z":se()}],"translate-none":["translate-none"],accent:[{accent:T()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:T()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",D,O]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":C()}],"scroll-mx":[{"scroll-mx":C()}],"scroll-my":[{"scroll-my":C()}],"scroll-ms":[{"scroll-ms":C()}],"scroll-me":[{"scroll-me":C()}],"scroll-mt":[{"scroll-mt":C()}],"scroll-mr":[{"scroll-mr":C()}],"scroll-mb":[{"scroll-mb":C()}],"scroll-ml":[{"scroll-ml":C()}],"scroll-p":[{"scroll-p":C()}],"scroll-px":[{"scroll-px":C()}],"scroll-py":[{"scroll-py":C()}],"scroll-ps":[{"scroll-ps":C()}],"scroll-pe":[{"scroll-pe":C()}],"scroll-pt":[{"scroll-pt":C()}],"scroll-pr":[{"scroll-pr":C()}],"scroll-pb":[{"scroll-pb":C()}],"scroll-pl":[{"scroll-pl":C()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",D,O]}],fill:[{fill:["none",...T()]}],"stroke-w":[{stroke:[G,H,q,K]}],stroke:[{stroke:["none",...T()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["before","after","placeholder","file","marker","selection","first-line","first-letter","backdrop","*","**"]}}));exports.capitalize=e=>e?0===e.length?e:1===e.length?e.toUpperCase():e.charAt(0).toUpperCase()+e.slice(1):"",exports.cn=function(...r){return ie(function(){for(var r,o,t=0,n="",s=arguments.length;t<s;t++)(r=arguments[t])&&(o=e(r))&&(n&&(n+=" "),n+=o);return n}(r))},exports.formatBytes=function(e,r={}){const{decimals:o=0,sizeType:t="normal"}=r;if(0===e)return"0 Byte";const n=Math.floor(Math.log(e)/Math.log(1024));return`${(e/Math.pow(1024,n)).toFixed(o)} ${"accurate"===t?["Bytes","KiB","MiB","GiB","TiB"][n]??"Bytest":["Bytes","KB","MB","GB","TB"][n]??"Bytes"}`};
|
|
2
|
-
//# sourceMappingURL=index.js.map
|