likec4 1.32.2 → 1.34.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/__app__/src/const.js +1 -0
- package/__app__/src/fonts.css +1 -1
- package/__app__/src/main.js +728 -470
- package/__app__/src/style.css +1 -1
- package/dist/cli/index.mjs +703 -701
- package/dist/index.d.mts +1 -1
- package/dist/index.mjs +2 -2
- package/dist/shared/likec4.BeWJWU7_.mjs +1 -0
- package/dist/shared/{likec4.BaQDJZ_m.d.mts → likec4.C6HFkgux.d.mts} +11437 -1323
- package/dist/shared/likec4.C88_VGwZ.mjs +239 -0
- package/dist/shared/likec4.Dgr2oMAn.mjs +2245 -0
- package/dist/vite-plugin/index.d.mts +1 -1
- package/dist/vite-plugin/index.mjs +2 -2
- package/dist/vite-plugin/internal.d.mts +417 -0
- package/dist/vite-plugin/internal.mjs +9 -0
- package/package.json +39 -33
- package/react/index.d.mts +71 -307
- package/react/index.mjs +30 -30
- package/vite-plugin-modules.d.ts +82 -2
- package/dist/shared/likec4.D6SCXR05.mjs +0 -239
- package/dist/shared/likec4.DDbeRd6k.mjs +0 -2383
package/react/index.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Generated by dts-bundle-generator v9.5.1
|
|
2
2
|
|
|
3
|
-
import { CSSProperties, ComponentType,
|
|
3
|
+
import { CSSProperties, ComponentType, HTMLAttributes, JSX, MouseEvent as ReactMouseEvent, PropsWithChildren, ReactNode, WheelEvent as WheelEvent$1 } from 'react';
|
|
4
4
|
|
|
5
5
|
type UnionToIntersection<Union> = (
|
|
6
6
|
// `extends unknown` is always going to be the case and is used to convert the
|
|
@@ -120,6 +120,13 @@ interface Link {
|
|
|
120
120
|
relative?: string;
|
|
121
121
|
}
|
|
122
122
|
type Coalesce<V extends string, OrIfAny = string> = IsAny<V> extends true ? OrIfAny : V;
|
|
123
|
+
type MarkdownOrString = {
|
|
124
|
+
txt: string;
|
|
125
|
+
md?: never;
|
|
126
|
+
} | {
|
|
127
|
+
md: string;
|
|
128
|
+
txt?: never;
|
|
129
|
+
};
|
|
123
130
|
type BuiltInIcon = "none" | `${"aws" | "azure" | "gcp" | "tech"}:${string}`;
|
|
124
131
|
type Icon = Tagged<string, "Icon"> | BuiltInIcon;
|
|
125
132
|
type IconUrl = Icon;
|
|
@@ -181,43 +188,6 @@ type WithOptionalTags<A extends Any> = {
|
|
|
181
188
|
type WithOptionalLinks = {
|
|
182
189
|
readonly links?: readonly Link[] | null;
|
|
183
190
|
};
|
|
184
|
-
type EqualOperator<V> = {
|
|
185
|
-
eq: V;
|
|
186
|
-
neq?: never;
|
|
187
|
-
} | {
|
|
188
|
-
eq?: never;
|
|
189
|
-
neq: V;
|
|
190
|
-
};
|
|
191
|
-
type AllNever = {
|
|
192
|
-
not?: never;
|
|
193
|
-
and?: never;
|
|
194
|
-
or?: never;
|
|
195
|
-
tag?: never;
|
|
196
|
-
kind?: never;
|
|
197
|
-
participant?: never;
|
|
198
|
-
operator?: never;
|
|
199
|
-
};
|
|
200
|
-
type TagEqual<A extends Any> = Omit<AllNever, "tag"> & {
|
|
201
|
-
tag: EqualOperator<Tag$1<A>> | Tag$1<A>;
|
|
202
|
-
};
|
|
203
|
-
type KindEqual<A extends Any> = Omit<AllNever, "kind"> & {
|
|
204
|
-
kind: EqualOperator<AllKinds<A>> | AllKinds<A>;
|
|
205
|
-
};
|
|
206
|
-
type Participant = "source" | "target";
|
|
207
|
-
type ParticipantOperator<A extends Any> = Omit<AllNever, "participant" | "operator"> & {
|
|
208
|
-
participant: Participant;
|
|
209
|
-
operator: KindEqual<A> | TagEqual<A>;
|
|
210
|
-
};
|
|
211
|
-
type NotOperator<A extends Any> = Omit<AllNever, "not"> & {
|
|
212
|
-
not: WhereOperator<A>;
|
|
213
|
-
};
|
|
214
|
-
type AndOperator<A extends Any> = Omit<AllNever, "and"> & {
|
|
215
|
-
and: NonEmptyArray<WhereOperator<A>>;
|
|
216
|
-
};
|
|
217
|
-
type OrOperator<A extends Any> = Omit<AllNever, "or"> & {
|
|
218
|
-
or: NonEmptyArray<WhereOperator<A>>;
|
|
219
|
-
};
|
|
220
|
-
type WhereOperator<A extends Any = Any> = TagEqual<A> | KindEqual<A> | ParticipantOperator<A> | NotOperator<A> | AndOperator<A> | OrOperator<A>;
|
|
221
191
|
type SpacingSize = "xs" | "sm" | "md" | "lg" | "xl";
|
|
222
192
|
type TextSize = "xs" | "sm" | "md" | "lg" | "xl";
|
|
223
193
|
type ShapeSize = "xs" | "sm" | "md" | "lg" | "xl";
|
|
@@ -257,6 +227,43 @@ declare const ThemeColors: readonly [
|
|
|
257
227
|
];
|
|
258
228
|
type ThemeColor = typeof ThemeColors[number];
|
|
259
229
|
type Color = ThemeColor | ColorLiteral;
|
|
230
|
+
type EqualOperator<V> = {
|
|
231
|
+
eq: V;
|
|
232
|
+
neq?: never;
|
|
233
|
+
} | {
|
|
234
|
+
eq?: never;
|
|
235
|
+
neq: V;
|
|
236
|
+
};
|
|
237
|
+
type AllNever = {
|
|
238
|
+
not?: never;
|
|
239
|
+
and?: never;
|
|
240
|
+
or?: never;
|
|
241
|
+
tag?: never;
|
|
242
|
+
kind?: never;
|
|
243
|
+
participant?: never;
|
|
244
|
+
operator?: never;
|
|
245
|
+
};
|
|
246
|
+
type TagEqual<A extends Any> = Omit<AllNever, "tag"> & {
|
|
247
|
+
tag: EqualOperator<Tag$1<A>> | Tag$1<A>;
|
|
248
|
+
};
|
|
249
|
+
type KindEqual<A extends Any> = Omit<AllNever, "kind"> & {
|
|
250
|
+
kind: EqualOperator<AllKinds<A>> | AllKinds<A>;
|
|
251
|
+
};
|
|
252
|
+
type Participant = "source" | "target";
|
|
253
|
+
type ParticipantOperator<A extends Any> = Omit<AllNever, "participant" | "operator"> & {
|
|
254
|
+
participant: Participant;
|
|
255
|
+
operator: KindEqual<A> | TagEqual<A>;
|
|
256
|
+
};
|
|
257
|
+
type NotOperator<A extends Any> = Omit<AllNever, "not"> & {
|
|
258
|
+
not: WhereOperator<A>;
|
|
259
|
+
};
|
|
260
|
+
type AndOperator<A extends Any> = Omit<AllNever, "and"> & {
|
|
261
|
+
and: NonEmptyArray<WhereOperator<A>>;
|
|
262
|
+
};
|
|
263
|
+
type OrOperator<A extends Any> = Omit<AllNever, "or"> & {
|
|
264
|
+
or: NonEmptyArray<WhereOperator<A>>;
|
|
265
|
+
};
|
|
266
|
+
type WhereOperator<A extends Any = Any> = TagEqual<A> | KindEqual<A> | ParticipantOperator<A> | NotOperator<A> | AndOperator<A> | OrOperator<A>;
|
|
260
267
|
type Point = readonly [
|
|
261
268
|
x: number,
|
|
262
269
|
y: number
|
|
@@ -324,7 +331,7 @@ type ViewManualLayout = {
|
|
|
324
331
|
interface BaseViewProperties<A extends Any> extends WithOptionalTags<A>, WithOptionalLinks {
|
|
325
332
|
readonly id: StrictViewId<A>;
|
|
326
333
|
readonly title: string | null;
|
|
327
|
-
readonly description:
|
|
334
|
+
readonly description: MarkdownOrString | null;
|
|
328
335
|
/**
|
|
329
336
|
* For all views we find common ancestor path.
|
|
330
337
|
* This is used to generate relative paths, i.e.:
|
|
@@ -381,16 +388,14 @@ interface ComputedNode<A extends Any = Any> extends WithOptionalLinks {
|
|
|
381
388
|
parent: NodeId | null;
|
|
382
389
|
/**
|
|
383
390
|
* Reference to model element
|
|
384
|
-
* If 1 - node id is a reference
|
|
385
391
|
*/
|
|
386
392
|
modelRef?: Fqn$1<A> | undefined;
|
|
387
393
|
/**
|
|
388
394
|
* Reference to deployment element
|
|
389
|
-
* If 1 - node id is a reference
|
|
390
395
|
*/
|
|
391
396
|
deploymentRef?: DeploymentFqn$1<A> | undefined;
|
|
392
397
|
title: string;
|
|
393
|
-
description?:
|
|
398
|
+
description?: MarkdownOrString | null;
|
|
394
399
|
technology?: string | null;
|
|
395
400
|
notation?: string;
|
|
396
401
|
children: NodeId[];
|
|
@@ -415,7 +420,7 @@ interface ComputedEdge<A extends Any = Any> extends WithOptionalTags<A> {
|
|
|
415
420
|
source: NodeId;
|
|
416
421
|
target: NodeId;
|
|
417
422
|
label: string | null;
|
|
418
|
-
description?:
|
|
423
|
+
description?: MarkdownOrString | null;
|
|
419
424
|
technology?: string;
|
|
420
425
|
relations: RelationId[];
|
|
421
426
|
kind?: RelationKind<A> | typeof StepEdgeKind;
|
|
@@ -500,6 +505,27 @@ interface LayoutedDynamicView<A extends Any = Any> extends BaseLayoutedViewPrope
|
|
|
500
505
|
readonly [_type]: "dynamic";
|
|
501
506
|
}
|
|
502
507
|
type LayoutedView<A extends Any = Any> = LayoutedElementView<A> | LayoutedDeploymentView<A> | LayoutedDynamicView<A>;
|
|
508
|
+
interface RichTextEmpty {
|
|
509
|
+
readonly isEmpty: true;
|
|
510
|
+
readonly isMarkdown: false;
|
|
511
|
+
readonly nonEmpty: false;
|
|
512
|
+
readonly $source: null;
|
|
513
|
+
readonly text: null;
|
|
514
|
+
readonly md: null;
|
|
515
|
+
readonly html: null;
|
|
516
|
+
equals(other: unknown): boolean;
|
|
517
|
+
}
|
|
518
|
+
interface RichTextNonEmpty {
|
|
519
|
+
readonly isEmpty: false;
|
|
520
|
+
readonly nonEmpty: true;
|
|
521
|
+
readonly isMarkdown: boolean;
|
|
522
|
+
readonly $source: MarkdownOrString;
|
|
523
|
+
readonly text: string;
|
|
524
|
+
readonly md: string;
|
|
525
|
+
readonly html: string;
|
|
526
|
+
equals(other: unknown): boolean;
|
|
527
|
+
}
|
|
528
|
+
type RichTextOrEmpty = RichTextNonEmpty | RichTextEmpty;
|
|
503
529
|
declare namespace ViewChange {
|
|
504
530
|
interface ChangeElementStyle {
|
|
505
531
|
op: "change-element-style";
|
|
@@ -2008,7 +2034,8 @@ type NonOptional<T extends object> = Simplify<{
|
|
|
2008
2034
|
[P in OptionalKeysOf<T>]-?: T[P] | undefined;
|
|
2009
2035
|
}>;
|
|
2010
2036
|
declare namespace Types {
|
|
2011
|
-
type LeafNodeData = Base.NodeData & NonOptional<Pick<DiagramNode, "id" | "title" | "technology" | "
|
|
2037
|
+
type LeafNodeData = Base.NodeData & NonOptional<Pick<DiagramNode, "id" | "title" | "technology" | "color" | "shape" | "width" | "level" | "height" | "style" | "tags" | "position">> & {
|
|
2038
|
+
description: RichTextOrEmpty;
|
|
2012
2039
|
/**
|
|
2013
2040
|
* View this node belongs to
|
|
2014
2041
|
*/
|
|
@@ -2537,272 +2564,9 @@ export declare const LikeC4ModelProvider: (props: LikeC4ModelProviderProps) => J
|
|
|
2537
2564
|
export declare const ViewNotFound: ({ viewId }: {
|
|
2538
2565
|
viewId: string;
|
|
2539
2566
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
2540
|
-
type AllKeys<T> = T extends any ? keyof T : never;
|
|
2541
|
-
type Primitive = boolean | number | string;
|
|
2542
|
-
type ReadonlyIfObject<Value> = Value extends undefined ? Value : Value extends (...args: any) => any ? Value : Value extends Primitive ? Value : Value extends object ? Readonly<Value> : Value;
|
|
2543
|
-
interface ReadableAtom<Value = any> {
|
|
2544
|
-
/**
|
|
2545
|
-
* Get store value.
|
|
2546
|
-
*
|
|
2547
|
-
* In contrast with {@link ReadableAtom#value} this value will be always
|
|
2548
|
-
* initialized even if store had no listeners.
|
|
2549
|
-
*
|
|
2550
|
-
* ```js
|
|
2551
|
-
* $store.get()
|
|
2552
|
-
* ```
|
|
2553
|
-
*
|
|
2554
|
-
* @returns Store value.
|
|
2555
|
-
*/
|
|
2556
|
-
get(): Value;
|
|
2557
|
-
/**
|
|
2558
|
-
* Listeners count.
|
|
2559
|
-
*/
|
|
2560
|
-
readonly lc: number;
|
|
2561
|
-
/**
|
|
2562
|
-
* Subscribe to store changes.
|
|
2563
|
-
*
|
|
2564
|
-
* In contrast with {@link Store#subscribe} it do not call listener
|
|
2565
|
-
* immediately.
|
|
2566
|
-
*
|
|
2567
|
-
* @param listener Callback with store value and old value.
|
|
2568
|
-
* @returns Function to remove listener.
|
|
2569
|
-
*/
|
|
2570
|
-
listen(listener: (value: ReadonlyIfObject<Value>, oldValue: ReadonlyIfObject<Value>) => void): () => void;
|
|
2571
|
-
/**
|
|
2572
|
-
* Low-level method to notify listeners about changes in the store.
|
|
2573
|
-
*
|
|
2574
|
-
* Can cause unexpected behaviour when combined with frontend frameworks
|
|
2575
|
-
* that perform equality checks for values, such as React.
|
|
2576
|
-
*/
|
|
2577
|
-
notify(oldValue?: ReadonlyIfObject<Value>): void;
|
|
2578
|
-
/**
|
|
2579
|
-
* Unbind all listeners.
|
|
2580
|
-
*/
|
|
2581
|
-
off(): void;
|
|
2582
|
-
/**
|
|
2583
|
-
* Subscribe to store changes and call listener immediately.
|
|
2584
|
-
*
|
|
2585
|
-
* ```
|
|
2586
|
-
* import { $router } from '../store'
|
|
2587
|
-
*
|
|
2588
|
-
* $router.subscribe(page => {
|
|
2589
|
-
* console.log(page)
|
|
2590
|
-
* })
|
|
2591
|
-
* ```
|
|
2592
|
-
*
|
|
2593
|
-
* @param listener Callback with store value and old value.
|
|
2594
|
-
* @returns Function to remove listener.
|
|
2595
|
-
*/
|
|
2596
|
-
subscribe(listener: (value: ReadonlyIfObject<Value>, oldValue?: ReadonlyIfObject<Value>) => void): () => void;
|
|
2597
|
-
/**
|
|
2598
|
-
* Low-level method to read store’s value without calling `onStart`.
|
|
2599
|
-
*
|
|
2600
|
-
* Try to use only {@link ReadableAtom#get}.
|
|
2601
|
-
* Without subscribers, value can be undefined.
|
|
2602
|
-
*/
|
|
2603
|
-
readonly value: undefined | Value;
|
|
2604
|
-
}
|
|
2605
|
-
interface WritableAtom<Value = any> extends ReadableAtom<Value> {
|
|
2606
|
-
/**
|
|
2607
|
-
* Change store value.
|
|
2608
|
-
*
|
|
2609
|
-
* ```js
|
|
2610
|
-
* $router.set({ path: location.pathname, page: parse(location.pathname) })
|
|
2611
|
-
* ```
|
|
2612
|
-
*
|
|
2613
|
-
* @param newValue New store value.
|
|
2614
|
-
*/
|
|
2615
|
-
set(newValue: Value): void;
|
|
2616
|
-
}
|
|
2617
|
-
interface PreinitializedWritableAtom<Value> extends WritableAtom<Value> {
|
|
2618
|
-
readonly value: Value;
|
|
2619
|
-
}
|
|
2620
|
-
type Atom<Value = any> = ReadableAtom<Value> | WritableAtom<Value>;
|
|
2621
|
-
declare function atom<Value, StoreExt = object>(...args: undefined extends Value ? [
|
|
2622
|
-
] | [
|
|
2623
|
-
Value
|
|
2624
|
-
] : [
|
|
2625
|
-
Value
|
|
2626
|
-
]): PreinitializedWritableAtom<Value> & StoreExt;
|
|
2627
|
-
type KeyofBase = keyof any;
|
|
2628
|
-
type Get<T, K extends KeyofBase> = Extract<T, {
|
|
2629
|
-
[K1 in K]: any;
|
|
2630
|
-
}>[K];
|
|
2631
|
-
type HasIndexSignature<T> = string extends keyof T ? true : false;
|
|
2632
|
-
type ValueWithUndefinedForIndexSignatures<Value, Key extends keyof Value> = HasIndexSignature<Value> extends true ? undefined | Value[Key] : Value[Key];
|
|
2633
|
-
type WritableStore<Value = any> = (Value extends object ? MapStore<Value> : never) | WritableAtom<Value>;
|
|
2634
|
-
type Store<Value = any> = ReadableAtom<Value> | WritableStore<Value>;
|
|
2635
|
-
type AnyStore<Value = any> = {
|
|
2636
|
-
get(): Value;
|
|
2637
|
-
readonly value: undefined | Value;
|
|
2638
|
-
};
|
|
2639
|
-
type StoreValue<SomeStore> = SomeStore extends {
|
|
2640
|
-
get(): infer Value;
|
|
2641
|
-
} ? Value : any;
|
|
2642
|
-
interface MapStore<Value extends object = any> extends WritableAtom<Value> {
|
|
2643
|
-
/**
|
|
2644
|
-
* Subscribe to store changes.
|
|
2645
|
-
*
|
|
2646
|
-
* In contrast with {@link Store#subscribe} it do not call listener
|
|
2647
|
-
* immediately.
|
|
2648
|
-
*
|
|
2649
|
-
* @param listener Callback with store value and old value.
|
|
2650
|
-
* @param changedKey Key that was changed. Will present only if `setKey`
|
|
2651
|
-
* has been used to change a store.
|
|
2652
|
-
* @returns Function to remove listener.
|
|
2653
|
-
*/
|
|
2654
|
-
listen(listener: (value: ReadonlyIfObject<Value>, oldValue: ReadonlyIfObject<Value>, changedKey: AllKeys<Value>) => void): () => void;
|
|
2655
|
-
/**
|
|
2656
|
-
* Low-level method to notify listeners about changes in the store.
|
|
2657
|
-
*
|
|
2658
|
-
* Can cause unexpected behaviour when combined with frontend frameworks
|
|
2659
|
-
* that perform equality checks for values, such as React.
|
|
2660
|
-
*/
|
|
2661
|
-
notify(oldValue?: ReadonlyIfObject<Value>, changedKey?: AllKeys<Value>): void;
|
|
2662
|
-
/**
|
|
2663
|
-
* Change store value.
|
|
2664
|
-
*
|
|
2665
|
-
* ```js
|
|
2666
|
-
* $settings.set({ theme: 'dark' })
|
|
2667
|
-
* ```
|
|
2668
|
-
*
|
|
2669
|
-
* Operation is atomic, subscribers will be notified once with the new value.
|
|
2670
|
-
* `changedKey` will be undefined
|
|
2671
|
-
*
|
|
2672
|
-
* @param newValue New store value.
|
|
2673
|
-
*/
|
|
2674
|
-
set(newValue: Value): void;
|
|
2675
|
-
/**
|
|
2676
|
-
* Change key in store value.
|
|
2677
|
-
*
|
|
2678
|
-
* ```js
|
|
2679
|
-
* $settings.setKey('theme', 'dark')
|
|
2680
|
-
* ```
|
|
2681
|
-
*
|
|
2682
|
-
* To delete key set `undefined`.
|
|
2683
|
-
*
|
|
2684
|
-
* ```js
|
|
2685
|
-
* $settings.setKey('theme', undefined)
|
|
2686
|
-
* ```
|
|
2687
|
-
*
|
|
2688
|
-
* @param key The key name.
|
|
2689
|
-
* @param value New value.
|
|
2690
|
-
*/
|
|
2691
|
-
setKey<Key extends AllKeys<Value>>(key: Key, value: Get<Value, Key> | ValueWithUndefinedForIndexSignatures<Value, Key>): void;
|
|
2692
|
-
/**
|
|
2693
|
-
* Subscribe to store changes and call listener immediately.
|
|
2694
|
-
*
|
|
2695
|
-
* ```
|
|
2696
|
-
* import { $router } from '../store'
|
|
2697
|
-
*
|
|
2698
|
-
* $router.subscribe(page => {
|
|
2699
|
-
* console.log(page)
|
|
2700
|
-
* })
|
|
2701
|
-
* ```
|
|
2702
|
-
*
|
|
2703
|
-
* @param listener Callback with store value and old value.
|
|
2704
|
-
* @param changedKey Key that was changed. Will present only
|
|
2705
|
-
* if `setKey` has been used to change a store.
|
|
2706
|
-
* @returns Function to remove listener.
|
|
2707
|
-
*/
|
|
2708
|
-
subscribe(listener: (value: ReadonlyIfObject<Value>, oldValue: ReadonlyIfObject<Value> | undefined, changedKey: AllKeys<Value> | undefined) => void): () => void;
|
|
2709
|
-
}
|
|
2710
|
-
interface PreinitializedMapStore<Value extends object = any> extends MapStore<Value> {
|
|
2711
|
-
readonly value: Value;
|
|
2712
|
-
}
|
|
2713
|
-
declare function map<Value extends object, StoreExt extends object = object>(value?: Value): PreinitializedMapStore<Value> & StoreExt;
|
|
2714
|
-
interface Task<Value> extends Promise<Value> {
|
|
2715
|
-
t: true;
|
|
2716
|
-
}
|
|
2717
|
-
type StoreValues<Stores extends AnyStore[]> = {
|
|
2718
|
-
[Index in keyof Stores]: StoreValue<Stores[Index]>;
|
|
2719
|
-
};
|
|
2720
|
-
interface Computed {
|
|
2721
|
-
<Value, OriginStore extends Store>(stores: OriginStore, cb: (value: StoreValue<OriginStore>) => Task<Value>): ReadableAtom<undefined | Value>;
|
|
2722
|
-
<Value, OriginStores extends AnyStore[]>(stores: [
|
|
2723
|
-
...OriginStores
|
|
2724
|
-
], cb: (...values: StoreValues<OriginStores>) => Task<Value>): ReadableAtom<undefined | Value>;
|
|
2725
|
-
<Value, OriginStore extends Store>(stores: OriginStore, cb: (value: StoreValue<OriginStore>) => Value): ReadableAtom<Value>;
|
|
2726
|
-
/**
|
|
2727
|
-
* Create derived store, which use generates value from another stores.
|
|
2728
|
-
*
|
|
2729
|
-
* ```js
|
|
2730
|
-
* import { computed } from 'nanostores'
|
|
2731
|
-
*
|
|
2732
|
-
* import { $users } from './users.js'
|
|
2733
|
-
*
|
|
2734
|
-
* export const $admins = computed($users, users => {
|
|
2735
|
-
* return users.filter(user => user.isAdmin)
|
|
2736
|
-
* })
|
|
2737
|
-
* ```
|
|
2738
|
-
*
|
|
2739
|
-
* An async function can be evaluated by using {@link task}.
|
|
2740
|
-
*
|
|
2741
|
-
* ```js
|
|
2742
|
-
* import { computed, task } from 'nanostores'
|
|
2743
|
-
*
|
|
2744
|
-
* import { $userId } from './users.js'
|
|
2745
|
-
*
|
|
2746
|
-
* export const $user = computed($userId, userId => task(async () => {
|
|
2747
|
-
* const response = await fetch(`https://my-api/users/${userId}`)
|
|
2748
|
-
* return response.json()
|
|
2749
|
-
* }))
|
|
2750
|
-
* ```
|
|
2751
|
-
*/
|
|
2752
|
-
<Value, OriginStores extends AnyStore[]>(stores: [
|
|
2753
|
-
...OriginStores
|
|
2754
|
-
], cb: (...values: StoreValues<OriginStores>) => Task<Value> | Value): ReadableAtom<Value>;
|
|
2755
|
-
}
|
|
2756
|
-
declare const computed: Computed;
|
|
2757
|
-
interface Batched {
|
|
2758
|
-
<Value, OriginStore extends Store>(stores: OriginStore, cb: (value: StoreValue<OriginStore>) => Task<Value> | Value): ReadableAtom<Value>;
|
|
2759
|
-
/**
|
|
2760
|
-
* Create derived store, which use generates value from another stores.
|
|
2761
|
-
*
|
|
2762
|
-
* ```js
|
|
2763
|
-
* import { batched } from 'nanostores'
|
|
2764
|
-
*
|
|
2765
|
-
* const $sortBy = atom('id')
|
|
2766
|
-
* const $category = atom('')
|
|
2767
|
-
*
|
|
2768
|
-
* export const $link = batched([$sortBy, $category], (sortBy, category) => {
|
|
2769
|
-
* return `/api/entities?sortBy=${sortBy}&category=${category}`
|
|
2770
|
-
* })
|
|
2771
|
-
* ```
|
|
2772
|
-
*/
|
|
2773
|
-
<Value, OriginStores extends AnyStore[]>(stores: [
|
|
2774
|
-
...OriginStores
|
|
2775
|
-
], cb: (...values: StoreValues<OriginStores>) => Task<Value> | Value): ReadableAtom<Value>;
|
|
2776
|
-
}
|
|
2777
|
-
declare const batched: Batched;
|
|
2778
|
-
type StoreKeys<T> = T extends {
|
|
2779
|
-
setKey: (k: infer K, v: any) => unknown;
|
|
2780
|
-
} ? K : never;
|
|
2781
|
-
interface UseStoreOptions<SomeStore> {
|
|
2782
|
-
/**
|
|
2783
|
-
* @default
|
|
2784
|
-
* ```ts
|
|
2785
|
-
* [store, options.keys]
|
|
2786
|
-
* ```
|
|
2787
|
-
*/
|
|
2788
|
-
deps?: DependencyList;
|
|
2789
|
-
/**
|
|
2790
|
-
* Will re-render components only on specific key changes.
|
|
2791
|
-
*/
|
|
2792
|
-
keys?: StoreKeys<SomeStore>[];
|
|
2793
|
-
}
|
|
2794
|
-
declare function useStore<SomeStore extends Store>(store: SomeStore, options?: UseStoreOptions<SomeStore>): StoreValue<SomeStore>;
|
|
2795
|
-
export declare const createHooksForModel: ($atom: WritableAtom) => any;
|
|
2796
2567
|
|
|
2797
2568
|
declare namespace Base {
|
|
2798
2569
|
export { Dimmed, Edge$1 as Edge, EdgeData, Node$1 as Node, NodeData, NodeProps$2 as NodeProps, setData, setDimmed, setHovered };
|
|
2799
2570
|
}
|
|
2800
|
-
declare namespace nano {
|
|
2801
|
-
export { Atom, ReadableAtom, WritableAtom, atom, batched, computed, map, useStore };
|
|
2802
|
-
}
|
|
2803
|
-
|
|
2804
|
-
export {
|
|
2805
|
-
nano,
|
|
2806
|
-
};
|
|
2807
2571
|
|
|
2808
2572
|
export {};
|