ugly-app 0.1.45 → 0.1.46
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/README.md
CHANGED
|
@@ -503,6 +503,8 @@ configurator.setAuth({
|
|
|
503
503
|
|
|
504
504
|
Access via `app.db` or by importing `createTypedDB` / `getMongoClient` from `'ugly-app'`.
|
|
505
505
|
|
|
506
|
+
All methods accept either a `CollectionDef` object (from `defineCollections`) or a plain collection name string as the first argument.
|
|
507
|
+
|
|
506
508
|
### Writing
|
|
507
509
|
|
|
508
510
|
```typescript
|
|
@@ -602,8 +604,8 @@ Run `npm run db:init` to create/update indexes.
|
|
|
602
604
|
### Text generation
|
|
603
605
|
|
|
604
606
|
```typescript
|
|
605
|
-
import {
|
|
606
|
-
const textGen =
|
|
607
|
+
import { createTextGen } from 'ugly-app';
|
|
608
|
+
const textGen = createTextGen();
|
|
607
609
|
|
|
608
610
|
const text = await textGen.generate(messages);
|
|
609
611
|
const json = await textGen.generateJson(schema, messages); // Zod schema, retries on parse failure
|
|
@@ -624,8 +626,8 @@ Use `provider: 'auto'` (default) to let the system pick based on requirements.
|
|
|
624
626
|
### Image generation
|
|
625
627
|
|
|
626
628
|
```typescript
|
|
627
|
-
import {
|
|
628
|
-
const imageGen =
|
|
629
|
+
import { createImageGen } from 'ugly-app';
|
|
630
|
+
const imageGen = createImageGen();
|
|
629
631
|
|
|
630
632
|
const url = await imageGen.generate(prompt, { width: 1024, height: 1024 });
|
|
631
633
|
```
|
|
@@ -3,12 +3,17 @@ import type { AnimatedValueRef, TransformedValue } from './animatedValue.js';
|
|
|
3
3
|
export type AnimatedStyle = {
|
|
4
4
|
[K in keyof CSSProperties]?: CSSProperties[K] | AnimatedValueRef | TransformedValue<CSSProperties[K]>;
|
|
5
5
|
};
|
|
6
|
+
type AnimatedDivProps = Omit<HTMLAttributes<HTMLDivElement>, 'style'> & {
|
|
7
|
+
style?: AnimatedStyle;
|
|
8
|
+
};
|
|
9
|
+
type AnimatedSpanProps = Omit<HTMLAttributes<HTMLSpanElement>, 'style'> & {
|
|
10
|
+
style?: AnimatedStyle;
|
|
11
|
+
};
|
|
12
|
+
declare function AnimatedDiv({ style, ...rest }: AnimatedDivProps): import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
declare function AnimatedSpan({ style, ...rest }: AnimatedSpanProps): import("react/jsx-runtime").JSX.Element;
|
|
6
14
|
export declare const Animated: {
|
|
7
|
-
div:
|
|
8
|
-
|
|
9
|
-
} & import("react").RefAttributes<HTMLDivElement>>;
|
|
10
|
-
span: import("react").ForwardRefExoticComponent<Omit<HTMLAttributes<HTMLSpanElement>, "style"> & {
|
|
11
|
-
style?: AnimatedStyle;
|
|
12
|
-
} & import("react").RefAttributes<HTMLSpanElement>>;
|
|
15
|
+
div: typeof AnimatedDiv;
|
|
16
|
+
span: typeof AnimatedSpan;
|
|
13
17
|
};
|
|
18
|
+
export {};
|
|
14
19
|
//# sourceMappingURL=Animated.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Animated.d.ts","sourceRoot":"","sources":["../../../src/client/animation/Animated.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EACb,cAAc,
|
|
1
|
+
{"version":3,"file":"Animated.d.ts","sourceRoot":"","sources":["../../../src/client/animation/Animated.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EACb,cAAc,EAGf,MAAM,OAAO,CAAC;AACf,OAAO,KAAK,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAI7E,MAAM,MAAM,aAAa,GAAG;KACzB,CAAC,IAAI,MAAM,aAAa,CAAC,CAAC,EACvB,aAAa,CAAC,CAAC,CAAC,GAChB,gBAAgB,GAChB,gBAAgB,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC;CACvC,CAAC;AAoEF,KAAK,gBAAgB,GAAG,IAAI,CAAC,cAAc,CAAC,cAAc,CAAC,EAAE,OAAO,CAAC,GAAG;IACtE,KAAK,CAAC,EAAE,aAAa,CAAC;CACvB,CAAC;AAEF,KAAK,iBAAiB,GAAG,IAAI,CAAC,cAAc,CAAC,eAAe,CAAC,EAAE,OAAO,CAAC,GAAG;IACxE,KAAK,CAAC,EAAE,aAAa,CAAC;CACvB,CAAC;AAEF,iBAAS,WAAW,CAAC,EAAE,KAAK,EAAE,GAAG,IAAI,EAAE,EAAE,gBAAgB,2CAiBxD;AAED,iBAAS,YAAY,CAAC,EAAE,KAAK,EAAE,GAAG,IAAI,EAAE,EAAE,iBAAiB,2CAiB1D;AAED,eAAO,MAAM,QAAQ;;;CAGpB,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
2
|
+
import { useEffect, useRef, } from 'react';
|
|
3
3
|
function isAnimatedValueRef(v) {
|
|
4
4
|
return (typeof v === 'object' &&
|
|
5
5
|
v !== null &&
|
|
@@ -50,46 +50,30 @@ function staticStyle(style) {
|
|
|
50
50
|
}
|
|
51
51
|
return out;
|
|
52
52
|
}
|
|
53
|
-
|
|
54
|
-
const
|
|
53
|
+
function AnimatedDiv({ style, ...rest }) {
|
|
54
|
+
const ref = useRef(null);
|
|
55
55
|
useEffect(() => {
|
|
56
56
|
if (!style)
|
|
57
57
|
return;
|
|
58
|
-
const el =
|
|
58
|
+
const el = ref.current;
|
|
59
59
|
if (!el)
|
|
60
60
|
return;
|
|
61
61
|
return bindAnimatedStyle(el, style);
|
|
62
62
|
});
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
forwardedRef(node);
|
|
68
|
-
else if (forwardedRef)
|
|
69
|
-
forwardedRef.current = node;
|
|
70
|
-
};
|
|
71
|
-
return (_jsx("div", { ref: combinedRef, style: style ? staticStyle(style) : undefined, ...rest }));
|
|
72
|
-
});
|
|
73
|
-
const AnimatedSpan = forwardRef(function AnimatedSpan({ style, ...rest }, forwardedRef) {
|
|
74
|
-
const innerRef = useRef(null);
|
|
63
|
+
return (_jsx("div", { ref: ref, style: style ? staticStyle(style) : undefined, ...rest }));
|
|
64
|
+
}
|
|
65
|
+
function AnimatedSpan({ style, ...rest }) {
|
|
66
|
+
const ref = useRef(null);
|
|
75
67
|
useEffect(() => {
|
|
76
68
|
if (!style)
|
|
77
69
|
return;
|
|
78
|
-
const el =
|
|
70
|
+
const el = ref.current;
|
|
79
71
|
if (!el)
|
|
80
72
|
return;
|
|
81
73
|
return bindAnimatedStyle(el, style);
|
|
82
74
|
});
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
node;
|
|
86
|
-
if (typeof forwardedRef === 'function')
|
|
87
|
-
forwardedRef(node);
|
|
88
|
-
else if (forwardedRef)
|
|
89
|
-
forwardedRef.current = node;
|
|
90
|
-
};
|
|
91
|
-
return (_jsx("span", { ref: combinedRef, style: style ? staticStyle(style) : undefined, ...rest }));
|
|
92
|
-
});
|
|
75
|
+
return (_jsx("span", { ref: ref, style: style ? staticStyle(style) : undefined, ...rest }));
|
|
76
|
+
}
|
|
93
77
|
export const Animated = {
|
|
94
78
|
div: AnimatedDiv,
|
|
95
79
|
span: AnimatedSpan,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Animated.js","sourceRoot":"","sources":["../../../src/client/animation/Animated.tsx"],"names":[],"mappings":";AAAA,OAAO,EAGL,
|
|
1
|
+
{"version":3,"file":"Animated.js","sourceRoot":"","sources":["../../../src/client/animation/Animated.tsx"],"names":[],"mappings":";AAAA,OAAO,EAGL,SAAS,EACT,MAAM,GACP,MAAM,OAAO,CAAC;AAYf,SAAS,kBAAkB,CAAC,CAAU;IACpC,OAAO,CACL,OAAO,CAAC,KAAK,QAAQ;QACrB,CAAC,KAAK,IAAI;QACV,OAAO,IAAI,CAAC,KAAK,KAAK;QACtB,WAAW,IAAI,CAAC,CACjB,CAAC;AACJ,CAAC;AAED,SAAS,kBAAkB,CAAC,CAAU;IACpC,OAAO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