@prismicio/editor-support
Advanced tools
Comparing version 0.4.51 to 0.4.52
@@ -1,1 +0,1 @@ | ||
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function a(o,n){const e=new Map;return o.forEach((r,t)=>{e.set(t,n(r,t))}),e}function c(o,n){for(const[e,r]of o)if(n(r,e))return!0;return!1}function f(o,n){const e=new Map;let r=0;for(const t of o){const u=n(t,r++),s=e.get(u);s?s.push(t):e.set(u,[t])}return e}exports.groupBy=f;exports.mapValues=a;exports.some=c; | ||
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function c(n,s){const e=new Map;return n.forEach((o,t)=>{e.set(t,s(o,t))}),e}function a(n,s){for(const[e,o]of n)if(s(o,e))return!0;return!1}function f(n,s){const e=new Map;let o=0;for(const t of n){const u=s(t,o++),r=e.get(u);r?r.push(t):e.set(u,[t])}return e}function l(n,s,e){return n.reduce((o,t)=>{const u=s(t),r=e?e(t):t;return o.set(u,r),o},new Map)}exports.groupBy=f;exports.keyBy=l;exports.mapValues=c;exports.some=a; |
@@ -14,1 +14,7 @@ export declare function mapValues<A, B, C>(map: ReadonlyMap<A, B>, fn: (value: B, key: A) => C): Map<A, C>; | ||
export declare function groupBy<K, T>(items: Iterable<T>, keySelector: (value: T, index: number) => K): Map<K, T[]>; | ||
/** | ||
* Creates a Map from an array of items, using a key function to determine the key. | ||
* Optionally, a value function can be provided to determine the value for each key. | ||
*/ | ||
export declare function keyBy<T, K>(array: T[], keyFn: (item: T) => K): Map<K, T>; | ||
export declare function keyBy<T, K, V>(array: T[], keyFn: (item: T) => K, valueFn: (item: T) => V): Map<K, V>; |
@@ -1,26 +0,33 @@ | ||
function c(n, o) { | ||
const t = /* @__PURE__ */ new Map(); | ||
return n.forEach((r, e) => { | ||
t.set(e, o(r, e)); | ||
}), t; | ||
function c(o, s) { | ||
const e = /* @__PURE__ */ new Map(); | ||
return o.forEach((n, t) => { | ||
e.set(t, s(n, t)); | ||
}), e; | ||
} | ||
function f(n, o) { | ||
for (const [t, r] of n) | ||
if (o(r, t)) | ||
function f(o, s) { | ||
for (const [e, n] of o) | ||
if (s(n, e)) | ||
return !0; | ||
return !1; | ||
} | ||
function a(n, o) { | ||
const t = /* @__PURE__ */ new Map(); | ||
let r = 0; | ||
for (const e of n) { | ||
const s = o(e, r++), u = t.get(s); | ||
u ? u.push(e) : t.set(s, [e]); | ||
function a(o, s) { | ||
const e = /* @__PURE__ */ new Map(); | ||
let n = 0; | ||
for (const t of o) { | ||
const r = s(t, n++), u = e.get(r); | ||
u ? u.push(t) : e.set(r, [t]); | ||
} | ||
return t; | ||
return e; | ||
} | ||
function i(o, s, e) { | ||
return o.reduce((n, t) => { | ||
const r = s(t), u = e ? e(t) : t; | ||
return n.set(r, u), n; | ||
}, /* @__PURE__ */ new Map()); | ||
} | ||
export { | ||
a as groupBy, | ||
i as keyBy, | ||
c as mapValues, | ||
f as some | ||
}; |
import { type DependencyList, type JSXElementConstructor, type ReactNode, type RefCallback, type RefObject, type TransitionStartFunction } from "react"; | ||
declare module "react" { | ||
interface CSSProperties { | ||
[key: `--${string}`]: string | number; | ||
type CSSProperties = { | ||
[key: `--${string | ||
}`]: string | number; | ||
} | ||
@@ -53,4 +54,4 @@ function forwardRef<T, P = object>(render: (props: P, ref: React.ForwardedRef<T>) => React.ReactElement | null): (props: P & React.RefAttributes<T>) => React.ReactElement | null; | ||
}; | ||
interface UseInViewOptions { | ||
once?: boolean; | ||
type UseInViewOptions = { | ||
once?: boolean; | ||
} | ||
@@ -57,0 +58,0 @@ /** |
@@ -44,4 +44,4 @@ /** | ||
export type Fetcher<ARGS extends readonly SerializableArg[] = never, BODY = unknown> = (...args: ARGS) => Promise<BODY>; | ||
interface FetcherConfig { | ||
/** | ||
type FetcherConfig = { | ||
/** | ||
* How many items to keep in the LRU cache. | ||
@@ -57,3 +57,3 @@ * Defaults to 500. Note that this must be at least as great as the number of displayed components using distinct data from this fetcher. | ||
type: "never"; | ||
} | { | ||
} | { | ||
type: "swr"; | ||
@@ -70,4 +70,4 @@ onFocus: boolean; | ||
type CacheValue<BODY = unknown> = FetchedSuccess<BODY> | FetchedError | InFlight<BODY>; | ||
interface CacheMeta { | ||
args: readonly SerializableArg[]; | ||
type CacheMeta = { | ||
args: readonly SerializableArg[]; | ||
stale?: true; | ||
@@ -85,4 +85,4 @@ } | ||
} | ||
interface FetchedError extends CacheMeta { | ||
state: "fetched"; | ||
type FetchedError = CacheMeta & { | ||
state: "fetched"; | ||
ok: false; | ||
@@ -139,4 +139,4 @@ error: unknown; | ||
type SerializableArg = string | number | boolean | URL | undefined; | ||
interface ErrorBoundaryAPI { | ||
registerRequest: (fetcher: Fetcher, args: readonly unknown[]) => void; | ||
type ErrorBoundaryAPI = { | ||
registerRequest: (fetcher: Fetcher, args: readonly unknown[]) => void; | ||
reset: () => void; | ||
@@ -143,0 +143,0 @@ } |
@@ -68,3 +68,3 @@ { | ||
}, | ||
"version": "0.4.51" | ||
"version": "0.4.52" | ||
} |
72228
1674