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
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export{L as LikeC4VitePlugin}from"../shared/likec4.
|
|
2
|
-
import"boxen";import"node:child_process";import"node:events";import"node:fs/promises";import"node:stream/promises";import"node:readline/promises";import"node:os";import"fs/promises";
|
|
1
|
+
export{L as LikeC4VitePlugin}from"../shared/likec4.C88_VGwZ.mjs";import"node:path";import"../shared/likec4.Dgr2oMAn.mjs";import"node:fs";import"node:url";import"../shared/likec4.BeWJWU7_.mjs";import"tty";import"node:util";import"util";import"path";import"os";import"crypto";import"net";import"url";import"fs";import"child_process";import"@likec4/core";import"@likec4/core/types";import"events";import"@hpcc-js/wasm-graphviz";import"@likec4/core/model";import"buffer";import"@likec4/core/compute-view";
|
|
2
|
+
import"@likec4/core/utils";import"node:process";import"boxen";import"node:child_process";import"node:events";import"node:fs/promises";import"node:stream/promises";import"node:readline/promises";import"node:os";import"fs/promises";
|
|
@@ -0,0 +1,417 @@
|
|
|
1
|
+
import { DependencyList } from 'react';
|
|
2
|
+
|
|
3
|
+
type AllKeys<T> = T extends any ? keyof T : never
|
|
4
|
+
|
|
5
|
+
type Primitive = boolean | number | string
|
|
6
|
+
|
|
7
|
+
type ReadonlyIfObject<Value> = Value extends undefined
|
|
8
|
+
? Value
|
|
9
|
+
: Value extends (...args: any) => any
|
|
10
|
+
? Value
|
|
11
|
+
: Value extends Primitive
|
|
12
|
+
? Value
|
|
13
|
+
: Value extends object
|
|
14
|
+
? Readonly<Value>
|
|
15
|
+
: Value
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Store object.
|
|
19
|
+
*/
|
|
20
|
+
interface ReadableAtom<Value = any> {
|
|
21
|
+
/**
|
|
22
|
+
* Get store value.
|
|
23
|
+
*
|
|
24
|
+
* In contrast with {@link ReadableAtom#value} this value will be always
|
|
25
|
+
* initialized even if store had no listeners.
|
|
26
|
+
*
|
|
27
|
+
* ```js
|
|
28
|
+
* $store.get()
|
|
29
|
+
* ```
|
|
30
|
+
*
|
|
31
|
+
* @returns Store value.
|
|
32
|
+
*/
|
|
33
|
+
get(): Value
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Listeners count.
|
|
37
|
+
*/
|
|
38
|
+
readonly lc: number
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Subscribe to store changes.
|
|
42
|
+
*
|
|
43
|
+
* In contrast with {@link Store#subscribe} it do not call listener
|
|
44
|
+
* immediately.
|
|
45
|
+
*
|
|
46
|
+
* @param listener Callback with store value and old value.
|
|
47
|
+
* @returns Function to remove listener.
|
|
48
|
+
*/
|
|
49
|
+
listen(
|
|
50
|
+
listener: (
|
|
51
|
+
value: ReadonlyIfObject<Value>,
|
|
52
|
+
oldValue: ReadonlyIfObject<Value>
|
|
53
|
+
) => void
|
|
54
|
+
): () => void
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Low-level method to notify listeners about changes in the store.
|
|
58
|
+
*
|
|
59
|
+
* Can cause unexpected behaviour when combined with frontend frameworks
|
|
60
|
+
* that perform equality checks for values, such as React.
|
|
61
|
+
*/
|
|
62
|
+
notify(oldValue?: ReadonlyIfObject<Value>): void
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Unbind all listeners.
|
|
66
|
+
*/
|
|
67
|
+
off(): void
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Subscribe to store changes and call listener immediately.
|
|
71
|
+
*
|
|
72
|
+
* ```
|
|
73
|
+
* import { $router } from '../store'
|
|
74
|
+
*
|
|
75
|
+
* $router.subscribe(page => {
|
|
76
|
+
* console.log(page)
|
|
77
|
+
* })
|
|
78
|
+
* ```
|
|
79
|
+
*
|
|
80
|
+
* @param listener Callback with store value and old value.
|
|
81
|
+
* @returns Function to remove listener.
|
|
82
|
+
*/
|
|
83
|
+
subscribe(
|
|
84
|
+
listener: (
|
|
85
|
+
value: ReadonlyIfObject<Value>,
|
|
86
|
+
oldValue?: ReadonlyIfObject<Value>
|
|
87
|
+
) => void
|
|
88
|
+
): () => void
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Low-level method to read store’s value without calling `onStart`.
|
|
92
|
+
*
|
|
93
|
+
* Try to use only {@link ReadableAtom#get}.
|
|
94
|
+
* Without subscribers, value can be undefined.
|
|
95
|
+
*/
|
|
96
|
+
readonly value: undefined | Value
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* Store with a way to manually change the value.
|
|
101
|
+
*/
|
|
102
|
+
interface WritableAtom<Value = any> extends ReadableAtom<Value> {
|
|
103
|
+
/**
|
|
104
|
+
* Change store value.
|
|
105
|
+
*
|
|
106
|
+
* ```js
|
|
107
|
+
* $router.set({ path: location.pathname, page: parse(location.pathname) })
|
|
108
|
+
* ```
|
|
109
|
+
*
|
|
110
|
+
* @param newValue New store value.
|
|
111
|
+
*/
|
|
112
|
+
set(newValue: Value): void
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
interface PreinitializedWritableAtom<Value> extends WritableAtom<Value> {
|
|
116
|
+
readonly value: Value
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
type Atom<Value = any> = ReadableAtom<Value> | WritableAtom<Value>
|
|
120
|
+
/**
|
|
121
|
+
* Create store with atomic value. It could be a string or an object, which you
|
|
122
|
+
* will replace completely.
|
|
123
|
+
*
|
|
124
|
+
* If you want to change keys in the object inside store, use {@link map}.
|
|
125
|
+
*
|
|
126
|
+
* ```js
|
|
127
|
+
* import { atom, onMount } from 'nanostores'
|
|
128
|
+
*
|
|
129
|
+
* // Initial value
|
|
130
|
+
* export const $router = atom({ path: '', page: 'home' })
|
|
131
|
+
*
|
|
132
|
+
* function parse () {
|
|
133
|
+
* $router.set({ path: location.pathname, page: parse(location.pathname) })
|
|
134
|
+
* }
|
|
135
|
+
*
|
|
136
|
+
* // Listen for URL changes on first store’s listener.
|
|
137
|
+
* onMount($router, () => {
|
|
138
|
+
* parse()
|
|
139
|
+
* window.addEventListener('popstate', parse)
|
|
140
|
+
* return () => {
|
|
141
|
+
* window.removeEventListener('popstate', parse)
|
|
142
|
+
* }
|
|
143
|
+
* })
|
|
144
|
+
* ```
|
|
145
|
+
*
|
|
146
|
+
* @param initialValue Initial value of the store.
|
|
147
|
+
* @returns The store object with methods to subscribe.
|
|
148
|
+
*/
|
|
149
|
+
declare function atom<Value, StoreExt = object>(
|
|
150
|
+
...args: undefined extends Value ? [] | [Value] : [Value]
|
|
151
|
+
): PreinitializedWritableAtom<Value> & StoreExt
|
|
152
|
+
|
|
153
|
+
type KeyofBase = keyof any
|
|
154
|
+
|
|
155
|
+
type Get<T, K extends KeyofBase> = Extract<T, { [K1 in K]: any }>[K]
|
|
156
|
+
|
|
157
|
+
type HasIndexSignature<T> = string extends keyof T ? true : false
|
|
158
|
+
|
|
159
|
+
type ValueWithUndefinedForIndexSignatures<
|
|
160
|
+
Value,
|
|
161
|
+
Key extends keyof Value
|
|
162
|
+
> = HasIndexSignature<Value> extends true ? undefined | Value[Key] : Value[Key]
|
|
163
|
+
|
|
164
|
+
type WritableStore<Value = any> =
|
|
165
|
+
| (Value extends object ? MapStore<Value> : never)
|
|
166
|
+
| WritableAtom<Value>
|
|
167
|
+
|
|
168
|
+
type Store<Value = any> = ReadableAtom<Value> | WritableStore<Value>
|
|
169
|
+
|
|
170
|
+
type AnyStore<Value = any> = {
|
|
171
|
+
get(): Value
|
|
172
|
+
readonly value: undefined | Value
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
type StoreValue<SomeStore> = SomeStore extends {
|
|
176
|
+
get(): infer Value
|
|
177
|
+
}
|
|
178
|
+
? Value
|
|
179
|
+
: any
|
|
180
|
+
|
|
181
|
+
interface MapStore<Value extends object = any>
|
|
182
|
+
extends WritableAtom<Value> {
|
|
183
|
+
/**
|
|
184
|
+
* Subscribe to store changes.
|
|
185
|
+
*
|
|
186
|
+
* In contrast with {@link Store#subscribe} it do not call listener
|
|
187
|
+
* immediately.
|
|
188
|
+
*
|
|
189
|
+
* @param listener Callback with store value and old value.
|
|
190
|
+
* @param changedKey Key that was changed. Will present only if `setKey`
|
|
191
|
+
* has been used to change a store.
|
|
192
|
+
* @returns Function to remove listener.
|
|
193
|
+
*/
|
|
194
|
+
listen(
|
|
195
|
+
listener: (
|
|
196
|
+
value: ReadonlyIfObject<Value>,
|
|
197
|
+
oldValue: ReadonlyIfObject<Value>,
|
|
198
|
+
changedKey: AllKeys<Value>
|
|
199
|
+
) => void
|
|
200
|
+
): () => void
|
|
201
|
+
|
|
202
|
+
/**
|
|
203
|
+
* Low-level method to notify listeners about changes in the store.
|
|
204
|
+
*
|
|
205
|
+
* Can cause unexpected behaviour when combined with frontend frameworks
|
|
206
|
+
* that perform equality checks for values, such as React.
|
|
207
|
+
*/
|
|
208
|
+
notify(oldValue?: ReadonlyIfObject<Value>, changedKey?: AllKeys<Value>): void
|
|
209
|
+
|
|
210
|
+
/**
|
|
211
|
+
* Change store value.
|
|
212
|
+
*
|
|
213
|
+
* ```js
|
|
214
|
+
* $settings.set({ theme: 'dark' })
|
|
215
|
+
* ```
|
|
216
|
+
*
|
|
217
|
+
* Operation is atomic, subscribers will be notified once with the new value.
|
|
218
|
+
* `changedKey` will be undefined
|
|
219
|
+
*
|
|
220
|
+
* @param newValue New store value.
|
|
221
|
+
*/
|
|
222
|
+
set(newValue: Value): void
|
|
223
|
+
|
|
224
|
+
/**
|
|
225
|
+
* Change key in store value.
|
|
226
|
+
*
|
|
227
|
+
* ```js
|
|
228
|
+
* $settings.setKey('theme', 'dark')
|
|
229
|
+
* ```
|
|
230
|
+
*
|
|
231
|
+
* To delete key set `undefined`.
|
|
232
|
+
*
|
|
233
|
+
* ```js
|
|
234
|
+
* $settings.setKey('theme', undefined)
|
|
235
|
+
* ```
|
|
236
|
+
*
|
|
237
|
+
* @param key The key name.
|
|
238
|
+
* @param value New value.
|
|
239
|
+
*/
|
|
240
|
+
setKey<Key extends AllKeys<Value>>(
|
|
241
|
+
key: Key,
|
|
242
|
+
value: Get<Value, Key> | ValueWithUndefinedForIndexSignatures<Value, Key>
|
|
243
|
+
): void
|
|
244
|
+
|
|
245
|
+
/**
|
|
246
|
+
* Subscribe to store changes and call listener immediately.
|
|
247
|
+
*
|
|
248
|
+
* ```
|
|
249
|
+
* import { $router } from '../store'
|
|
250
|
+
*
|
|
251
|
+
* $router.subscribe(page => {
|
|
252
|
+
* console.log(page)
|
|
253
|
+
* })
|
|
254
|
+
* ```
|
|
255
|
+
*
|
|
256
|
+
* @param listener Callback with store value and old value.
|
|
257
|
+
* @param changedKey Key that was changed. Will present only
|
|
258
|
+
* if `setKey` has been used to change a store.
|
|
259
|
+
* @returns Function to remove listener.
|
|
260
|
+
*/
|
|
261
|
+
subscribe(
|
|
262
|
+
listener: (
|
|
263
|
+
value: ReadonlyIfObject<Value>,
|
|
264
|
+
oldValue: ReadonlyIfObject<Value> | undefined,
|
|
265
|
+
changedKey: AllKeys<Value> | undefined
|
|
266
|
+
) => void
|
|
267
|
+
): () => void
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
interface PreinitializedMapStore<Value extends object = any>
|
|
271
|
+
extends MapStore<Value> {
|
|
272
|
+
readonly value: Value
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
/**
|
|
276
|
+
* Create map store. Map store is a store with key-value object
|
|
277
|
+
* as a store value.
|
|
278
|
+
*
|
|
279
|
+
* @param init Initialize store and return store destructor.
|
|
280
|
+
* @returns The store object with methods to subscribe.
|
|
281
|
+
*/
|
|
282
|
+
declare function map<Value extends object, StoreExt extends object = object>(
|
|
283
|
+
value?: Value
|
|
284
|
+
): PreinitializedMapStore<Value> & StoreExt
|
|
285
|
+
|
|
286
|
+
interface Task<Value> extends Promise<Value> {
|
|
287
|
+
t: true
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
type StoreValues<Stores extends AnyStore[]> = {
|
|
291
|
+
[Index in keyof Stores]: StoreValue<Stores[Index]>
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
interface Computed {
|
|
295
|
+
<Value, OriginStore extends Store>(
|
|
296
|
+
stores: OriginStore,
|
|
297
|
+
cb: (value: StoreValue<OriginStore>) => Task<Value>
|
|
298
|
+
): ReadableAtom<undefined | Value>
|
|
299
|
+
<Value, OriginStores extends AnyStore[]>(
|
|
300
|
+
stores: [...OriginStores],
|
|
301
|
+
cb: (...values: StoreValues<OriginStores>) => Task<Value>
|
|
302
|
+
): ReadableAtom<undefined | Value>
|
|
303
|
+
<Value, OriginStore extends Store>(
|
|
304
|
+
stores: OriginStore,
|
|
305
|
+
cb: (value: StoreValue<OriginStore>) => Value
|
|
306
|
+
): ReadableAtom<Value>
|
|
307
|
+
/**
|
|
308
|
+
* Create derived store, which use generates value from another stores.
|
|
309
|
+
*
|
|
310
|
+
* ```js
|
|
311
|
+
* import { computed } from 'nanostores'
|
|
312
|
+
*
|
|
313
|
+
* import { $users } from './users.js'
|
|
314
|
+
*
|
|
315
|
+
* export const $admins = computed($users, users => {
|
|
316
|
+
* return users.filter(user => user.isAdmin)
|
|
317
|
+
* })
|
|
318
|
+
* ```
|
|
319
|
+
*
|
|
320
|
+
* An async function can be evaluated by using {@link task}.
|
|
321
|
+
*
|
|
322
|
+
* ```js
|
|
323
|
+
* import { computed, task } from 'nanostores'
|
|
324
|
+
*
|
|
325
|
+
* import { $userId } from './users.js'
|
|
326
|
+
*
|
|
327
|
+
* export const $user = computed($userId, userId => task(async () => {
|
|
328
|
+
* const response = await fetch(`https://my-api/users/${userId}`)
|
|
329
|
+
* return response.json()
|
|
330
|
+
* }))
|
|
331
|
+
* ```
|
|
332
|
+
*/
|
|
333
|
+
<Value, OriginStores extends AnyStore[]>(
|
|
334
|
+
stores: [...OriginStores],
|
|
335
|
+
cb: (...values: StoreValues<OriginStores>) => Task<Value> | Value
|
|
336
|
+
): ReadableAtom<Value>
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
declare const computed: Computed
|
|
340
|
+
|
|
341
|
+
interface Batched {
|
|
342
|
+
<Value, OriginStore extends Store>(
|
|
343
|
+
stores: OriginStore,
|
|
344
|
+
cb: (value: StoreValue<OriginStore>) => Task<Value> | Value
|
|
345
|
+
): ReadableAtom<Value>
|
|
346
|
+
/**
|
|
347
|
+
* Create derived store, which use generates value from another stores.
|
|
348
|
+
*
|
|
349
|
+
* ```js
|
|
350
|
+
* import { batched } from 'nanostores'
|
|
351
|
+
*
|
|
352
|
+
* const $sortBy = atom('id')
|
|
353
|
+
* const $category = atom('')
|
|
354
|
+
*
|
|
355
|
+
* export const $link = batched([$sortBy, $category], (sortBy, category) => {
|
|
356
|
+
* return `/api/entities?sortBy=${sortBy}&category=${category}`
|
|
357
|
+
* })
|
|
358
|
+
* ```
|
|
359
|
+
*/
|
|
360
|
+
<Value, OriginStores extends AnyStore[]>(
|
|
361
|
+
stores: [...OriginStores],
|
|
362
|
+
cb: (...values: StoreValues<OriginStores>) => Task<Value> | Value
|
|
363
|
+
): ReadableAtom<Value>
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
declare const batched: Batched
|
|
367
|
+
|
|
368
|
+
type StoreKeys<T> = T extends { setKey: (k: infer K, v: any) => unknown }
|
|
369
|
+
? K
|
|
370
|
+
: never
|
|
371
|
+
|
|
372
|
+
interface UseStoreOptions<SomeStore> {
|
|
373
|
+
/**
|
|
374
|
+
* @default
|
|
375
|
+
* ```ts
|
|
376
|
+
* [store, options.keys]
|
|
377
|
+
* ```
|
|
378
|
+
*/
|
|
379
|
+
deps?: DependencyList
|
|
380
|
+
|
|
381
|
+
/**
|
|
382
|
+
* Will re-render components only on specific key changes.
|
|
383
|
+
*/
|
|
384
|
+
keys?: StoreKeys<SomeStore>[]
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
/**
|
|
388
|
+
* Subscribe to store changes and get store’s value.
|
|
389
|
+
*
|
|
390
|
+
* Can be user with store builder too.
|
|
391
|
+
*
|
|
392
|
+
* ```js
|
|
393
|
+
* import { useStore } from 'nanostores/react'
|
|
394
|
+
*
|
|
395
|
+
* import { router } from '../store/router'
|
|
396
|
+
*
|
|
397
|
+
* export const Layout = () => {
|
|
398
|
+
* let page = useStore(router)
|
|
399
|
+
* if (page.route === 'home') {
|
|
400
|
+
* return <HomePage />
|
|
401
|
+
* } else {
|
|
402
|
+
* return <Error404 />
|
|
403
|
+
* }
|
|
404
|
+
* }
|
|
405
|
+
* ```
|
|
406
|
+
*
|
|
407
|
+
* @param store Store instance.
|
|
408
|
+
* @returns Store value.
|
|
409
|
+
*/
|
|
410
|
+
declare function useStore<SomeStore extends Store>(
|
|
411
|
+
store: SomeStore,
|
|
412
|
+
options?: UseStoreOptions<SomeStore>
|
|
413
|
+
): StoreValue<SomeStore>
|
|
414
|
+
|
|
415
|
+
declare const createHooksForModel: ($atom: WritableAtom) => any;
|
|
416
|
+
|
|
417
|
+
export { type Atom, type ReadableAtom, type WritableAtom, atom, batched, computed, createHooksForModel, map, useStore };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import{LikeC4Model as x}from"@likec4/core/model";import{useRef as R,useCallback as U,useSyncExternalStore as _,useState as y,useEffect as A}from"react";import{u as k,i as V}from"../shared/likec4.BeWJWU7_.mjs";function L(...e){return k(g,e)}function g(e,t){if(e===t||Object.is(e,t))return!0;if(typeof e!="object"||typeof t!="object"||e===null||t===null||Object.getPrototypeOf(e)!==Object.getPrototypeOf(t))return!1;if(Array.isArray(e))return z(e,t);if(e instanceof Map)return C(e,t);if(e instanceof Set)
|
|
2
|
+
return D(e,t);if(e instanceof Date)return e.getTime()===t.getTime();if(e instanceof RegExp)return e.toString()===t.toString();if(Object.keys(e).length!==Object.keys(t).length)return!1;for(let[n,r]of Object.entries(e))if(!(n in t)||!g(r,t[n]))return!1;return!0}function z(e,t){if(e.length!==t.length)return!1;for(let[n,r]of e.entries())if(!g(r,t[n]))return!1;return!0}function C(e,t){if(e.size!==t.size)return!1;for(let[n,r]of e.entries())if(!t.has(n)||!g(r,t.get(n)))return!1;return!0}function D(e,t){
|
|
3
|
+
if(e.size!==t.size)return!1;let n=[...t];for(let r of e){let i=!1;for(let[l,u]of n.entries())if(g(r,u)){i=!0,n.splice(l,1);break}if(!i)return!1}return!0}let S=Symbol("clean"),c=[],a=0;const m=4;let h=0,T=e=>{let t=[],n={get(){return n.lc||n.listen(()=>{})(),n.value},lc:0,listen(r){return n.lc=t.push(r),()=>{for(let l=a+m;l<c.length;)c[l]===r?c.splice(l,m):l+=m;let i=t.indexOf(r);~i&&(t.splice(i,1),--n.lc||n.off())}},notify(r,i){h++;let l=!c.length;for(let u of t)c.push(u,n.value,r,i);if(l){for(a=
|
|
4
|
+
0;a<c.length;a+=m)c[a](c[a+1],c[a+2],c[a+3]);c.length=0}},off(){},set(r){let i=n.value;i!==r&&(n.value=r,n.notify(i))},subscribe(r){let i=n.listen(r);return r(n.value),i},value:e};return process.env.NODE_ENV!=="production"&&(n[S]=()=>{t=[],n.lc=0,n.off()}),n};const I=5,v=6,O=10;let P=(e,t,n,r)=>(e.events=e.events||{},e.events[n+O]||(e.events[n+O]=r(i=>{e.events[n].reduceRight((l,u)=>(u(l),l),{shared:{},...i})})),e.events[n]=e.events[n]||[],e.events[n].push(t),()=>{let i=e.events[n],l=i.indexOf(t);
|
|
5
|
+
i.splice(l,1),i.length||(delete e.events[n],e.events[n+O](),delete e.events[n+O])}),Q=1e3,q=(e,t)=>P(e,r=>{let i=t(r);i&&e.events[v].push(i)},I,r=>{let i=e.listen;e.listen=(...u)=>(!e.lc&&!e.active&&(e.active=!0,r()),i(...u));let l=e.off;if(e.events[v]=[],e.off=()=>{l(),setTimeout(()=>{if(e.active&&!e.lc){e.active=!1;for(let u of e.events[v])u();e.events[v]=[]}},Q)},process.env.NODE_ENV!=="production"){let u=e[S];e[S]=()=>{for(let s of e.events[v])s();e.events[v]=[],e.active=!1,u()}}return()=>{e.
|
|
6
|
+
listen=i,e.off=l}}),w=(e,t,n)=>{Array.isArray(e)||(e=[e]);let r,i,l=()=>{if(i===h)return;i=h;let o=e.map(f=>f.get());if(!r||o.some((f,E)=>f!==r[E])){r=o;let f=t(...o);f&&f.then&&f.t?f.then(E=>{r===o&&u.set(E)}):(u.set(f),i=h)}},u=T(void 0),s=u.get;u.get=()=>(l(),s());let d,p=n?()=>{clearTimeout(d),d=setTimeout(l)}:l;return q(u,()=>{let o=e.map(f=>f.listen(p));return l(),()=>{for(let f of o)f()}}),u},M=(e,t)=>w(e,t),F=(e,t)=>w(e,t,!0);function H(e,t,n){let r=new Set(t).add(void 0);return e.listen(
|
|
7
|
+
(i,l,u)=>{r.has(u)&&n(i,l,u)})}let Y=(e={})=>{let t=T(e);return t.setKey=function(n,r){let i=t.value;typeof r>"u"&&n in t.value?(t.value={...t.value},delete t.value[n],t.notify(i,n)):t.value[n]!==r&&(t.value={...t.value,[n]:r},t.notify(i,n))},t},b=(e,t)=>n=>{e.current!==n&&(e.current=n,t())};function N(e,{keys:t,deps:n=[e,t]}={}){let r=R();r.current=e.get();let i=U(u=>(b(r,u)(e.value),t?.length>0?H(e,t,b(r,u)):e.listen(b(r,u))),n),l=()=>r.current;return _(i,l,l)}const B=e=>{const t=M(e,s=>x.create(
|
|
8
|
+
s));function n(s){const d=e.get();if(L(d,s))return;const p={...s,views:V(s.views,o=>{const f=d.views[o.id];return L(f,o)?f:o})};e.set(p)}const r=M(e,s=>[...Object.values(s.views)]);function i(){return N(t)}function l(){return N(r)}function u(s){const[d,p]=y(e.value?.views[s]??null);return A(()=>e.subscribe(o=>{p(o.views[s]??null)}),[s]),d}return{updateModel:n,$likec4model:t,useLikeC4Model:i,useLikeC4Views:l,useLikeC4View:u}};export{T as atom,F as batched,M as computed,B as createHooksForModel,Y as map,
|
|
9
|
+
N as useStore};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "likec4",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.34.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"homepage": "https://likec4.dev",
|
|
6
6
|
"author": "Denis Davydkov <denis@davydkov.com>",
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"graph"
|
|
20
20
|
],
|
|
21
21
|
"engines": {
|
|
22
|
-
"node": ">=20.19.
|
|
22
|
+
"node": ">=20.19.3"
|
|
23
23
|
},
|
|
24
24
|
"engineStrict": true,
|
|
25
25
|
"bugs": "https://github.com/likec4/likec4/issues",
|
|
@@ -61,6 +61,10 @@
|
|
|
61
61
|
"./vite-plugin-modules": {
|
|
62
62
|
"types": "./vite-plugin-modules.d.ts"
|
|
63
63
|
},
|
|
64
|
+
"./vite-plugin/internal": {
|
|
65
|
+
"sources": "./src/vite-plugin/internal.ts",
|
|
66
|
+
"default": "./dist/vite-plugin/internal.mjs"
|
|
67
|
+
},
|
|
64
68
|
"./vite-plugin": {
|
|
65
69
|
"sources": "./src/vite-plugin/index.ts",
|
|
66
70
|
"default": {
|
|
@@ -85,35 +89,35 @@
|
|
|
85
89
|
"access": "public"
|
|
86
90
|
},
|
|
87
91
|
"dependencies": {
|
|
88
|
-
"@hpcc-js/wasm-graphviz": "1.
|
|
89
|
-
"@vitejs/plugin-react": "^4.
|
|
92
|
+
"@hpcc-js/wasm-graphviz": "1.8.0",
|
|
93
|
+
"@vitejs/plugin-react": "^4.6.0",
|
|
90
94
|
"boxen": "^8.0.1",
|
|
91
|
-
"playwright": "^1.53.
|
|
92
|
-
"rollup": "^4.
|
|
95
|
+
"playwright": "^1.53.1",
|
|
96
|
+
"rollup": "^4.44.0",
|
|
93
97
|
"type-fest": "^4.41.0",
|
|
94
98
|
"vite": "^6.3.5",
|
|
95
|
-
"@likec4/core": "1.
|
|
99
|
+
"@likec4/core": "1.34.0"
|
|
96
100
|
},
|
|
97
101
|
"peerDependencies": {
|
|
98
102
|
"react": "^18.x || ^19.x",
|
|
99
103
|
"react-dom": "^18.x || ^19.x"
|
|
100
104
|
},
|
|
101
105
|
"devDependencies": {
|
|
102
|
-
"@dagrejs/dagre": "1.1.
|
|
103
|
-
"@fontsource/ibm-plex-sans": "^5.2.
|
|
104
|
-
"@mantine/core": "8.1.
|
|
105
|
-
"@mantine/hooks": "8.1.
|
|
106
|
+
"@dagrejs/dagre": "1.1.5",
|
|
107
|
+
"@fontsource/ibm-plex-sans": "^5.2.6",
|
|
108
|
+
"@mantine/core": "8.1.2",
|
|
109
|
+
"@mantine/hooks": "8.1.2",
|
|
106
110
|
"@nanostores/react": "1.0.0",
|
|
107
|
-
"@pandacss/dev": "^0.
|
|
111
|
+
"@pandacss/dev": "^0.54.0",
|
|
108
112
|
"@react-hookz/web": "^25.1.1",
|
|
109
113
|
"@tabler/icons-react": "3.31.0",
|
|
110
114
|
"@tanstack/react-router": "^1.114.13",
|
|
111
115
|
"@tanstack/router-cli": "^1.114.13",
|
|
112
116
|
"@tanstack/router-vite-plugin": "^1.114.13",
|
|
113
|
-
"@types/node": "~20.19.
|
|
117
|
+
"@types/node": "~20.19.1",
|
|
114
118
|
"@types/picomatch": "^4.0.0",
|
|
115
|
-
"@types/react": "19.1.
|
|
116
|
-
"@types/react-dom": "19.1.
|
|
119
|
+
"@types/react": "19.1.8",
|
|
120
|
+
"@types/react-dom": "19.1.6",
|
|
117
121
|
"@types/semver": "^7.7.0",
|
|
118
122
|
"@types/yargs": "^17.0.33",
|
|
119
123
|
"@xyflow/react": "^12.6.4",
|
|
@@ -125,13 +129,14 @@
|
|
|
125
129
|
"consola": "^3.4.2",
|
|
126
130
|
"defu": "^6.1.4",
|
|
127
131
|
"dts-bundle-generator": "^9.5.1",
|
|
128
|
-
"esbuild": "
|
|
129
|
-
"esbuild-node-externals": "
|
|
132
|
+
"esbuild": "0.25.5",
|
|
133
|
+
"esbuild-node-externals": "1.18.0",
|
|
130
134
|
"esm-env": "^1.2.2",
|
|
131
135
|
"fast-equals": "^5.2.2",
|
|
132
|
-
"fdir": "
|
|
136
|
+
"fdir": "6.4.6",
|
|
133
137
|
"get-port": "^7.1.0",
|
|
134
138
|
"html-to-image": "^1.11.13",
|
|
139
|
+
"is-inside-container": "^1.0.0",
|
|
135
140
|
"json5": "^2.2.3",
|
|
136
141
|
"ky": "^1.8.1",
|
|
137
142
|
"langium": "3.5.0",
|
|
@@ -141,8 +146,8 @@
|
|
|
141
146
|
"nano-spawn": "^1.0.2",
|
|
142
147
|
"nanostores": "1.0.1",
|
|
143
148
|
"npm-run-all2": "^8.0.4",
|
|
144
|
-
"p-limit": "
|
|
145
|
-
"package-manager-detector": "
|
|
149
|
+
"p-limit": "6.2.0",
|
|
150
|
+
"package-manager-detector": "1.3.0",
|
|
146
151
|
"package-up": "^5.0.0",
|
|
147
152
|
"picomatch": "^4.0.2",
|
|
148
153
|
"postcss": "8.5.5",
|
|
@@ -150,9 +155,9 @@
|
|
|
150
155
|
"react": "^19.1.0",
|
|
151
156
|
"react-dom": "^19.1.0",
|
|
152
157
|
"react-error-boundary": "^6.0.0",
|
|
153
|
-
"react-resizable-panels": "^3.0.
|
|
158
|
+
"react-resizable-panels": "^3.0.3",
|
|
154
159
|
"react-shadow": "^20.6.0",
|
|
155
|
-
"remeda": "^2.23.
|
|
160
|
+
"remeda": "^2.23.1",
|
|
156
161
|
"semver": "^7.7.2",
|
|
157
162
|
"std-env": "^3.9.0",
|
|
158
163
|
"strip-indent": "^4.0.0",
|
|
@@ -160,12 +165,12 @@
|
|
|
160
165
|
"tsx": "4.19.4",
|
|
161
166
|
"turbo": "2.5.4",
|
|
162
167
|
"typescript": "5.8.3",
|
|
163
|
-
"ufo": "
|
|
168
|
+
"ufo": "1.6.1",
|
|
164
169
|
"unbuild": "3.5.0",
|
|
165
170
|
"vite-plugin-dts": "^4.5.4",
|
|
166
171
|
"vite-plugin-inspect": "^11.1.0",
|
|
167
172
|
"vite-plugin-singlefile": "^2.2.0",
|
|
168
|
-
"vitest": "3.2.
|
|
173
|
+
"vitest": "3.2.4",
|
|
169
174
|
"vscode-jsonrpc": "8.2.0",
|
|
170
175
|
"vscode-languageserver": "9.0.1",
|
|
171
176
|
"vscode-languageserver-types": "3.17.5",
|
|
@@ -173,15 +178,15 @@
|
|
|
173
178
|
"which": "^5.0.0",
|
|
174
179
|
"wireit": "0.14.12",
|
|
175
180
|
"yargs": "17.7.2",
|
|
176
|
-
"@likec4/
|
|
177
|
-
"@likec4/
|
|
178
|
-
"@likec4/
|
|
179
|
-
"@likec4/layouts": "1.
|
|
180
|
-
"@likec4/
|
|
181
|
-
"@likec4/
|
|
182
|
-
"@likec4/
|
|
183
|
-
"@likec4/
|
|
184
|
-
"@likec4/tsconfig": "1.
|
|
181
|
+
"@likec4/generators": "1.34.0",
|
|
182
|
+
"@likec4/icons": "1.34.0",
|
|
183
|
+
"@likec4/diagram": "1.34.0",
|
|
184
|
+
"@likec4/layouts": "1.34.0",
|
|
185
|
+
"@likec4/language-server": "1.34.0",
|
|
186
|
+
"@likec4/style-preset": "1.34.0",
|
|
187
|
+
"@likec4/log": "1.34.0",
|
|
188
|
+
"@likec4/styles": "1.34.0",
|
|
189
|
+
"@likec4/tsconfig": "1.34.0"
|
|
185
190
|
},
|
|
186
191
|
"scripts": {
|
|
187
192
|
"typecheck": "tsc --build --verbose",
|
|
@@ -193,6 +198,7 @@
|
|
|
193
198
|
"generate:icons": "tsx --conditions=sources scripts/generate-icons.ts",
|
|
194
199
|
"pack": "pnpm pack",
|
|
195
200
|
"lint": "run -T eslint src/ --fix",
|
|
201
|
+
"lint:package": "pnpx publint ./package.tgz",
|
|
196
202
|
"clean": "pnpm rimraf lib dist app/dist dev/.export dev/dist node_modules/.vite react/*.mjs react/*.d.mts icons",
|
|
197
203
|
"start": "tsx --conditions=sources src/cli/index.ts",
|
|
198
204
|
"dev": "pnpm cli:serve dev",
|