Asset improvements (#1557)
This PR does the following: - Add `selfHosted.js`, which is a great option for users that wish to self host the assets. Works well for both self hosting from the public folder or via a CDN. - Updates the docs for assets. We now have a dedicated page for assets where all the options are more clearly explained. I also removed the assets explanation from the main docs as the unpkg option should work out of the box and setting up the assets is no longer necessary. - Cleaned up the `refresh-assets` script. We now use common `types.d.ts` file to define our types. All the other options then reuse them. - Pulled out the `formatAssetUrl` into it's own file. It's now static an no longer generated. - `urls.d.ts`, `import.d.ts`, and newly added `selfhosted.d.ts` are now also no longer generated as we can import the types from `types.d.ts`. - You can now pass a subset of `assetUrls` to `<Tldraw />` and it will override the default option with the passed in overrides. This makes it easy to only customizes certain assets (only change the draw font as an example). ### Change Type - [x] `patch` — Bug Fix
This commit is contained in:
parent
707ddc876f
commit
bacb307bad
24 changed files with 682 additions and 608 deletions
|
@ -130,6 +130,11 @@ export function promiseWithResolve<T>(): Promise<T> & {
|
|||
// @internal
|
||||
export function rafThrottle(fn: () => void): () => void;
|
||||
|
||||
// @public (undocumented)
|
||||
export type RecursivePartial<T> = {
|
||||
[P in keyof T]?: RecursivePartial<T[P]>;
|
||||
};
|
||||
|
||||
// @public (undocumented)
|
||||
export type Result<T, E> = ErrorResult<E> | OkResult<T>;
|
||||
|
||||
|
|
|
@ -26,4 +26,5 @@ export {
|
|||
} from './lib/object'
|
||||
export { rafThrottle, throttledRaf } from './lib/raf'
|
||||
export { sortById } from './lib/sort'
|
||||
export type { RecursivePartial } from './lib/types'
|
||||
export { isDefined, isNonNull, isNonNullish, structuredClone } from './lib/value'
|
||||
|
|
4
packages/utils/src/lib/types.ts
Normal file
4
packages/utils/src/lib/types.ts
Normal file
|
@ -0,0 +1,4 @@
|
|||
/** @public */
|
||||
export type RecursivePartial<T> = {
|
||||
[P in keyof T]?: RecursivePartial<T[P]>
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue