likec4 1.56.0 → 1.58.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.
Files changed (207) hide show
  1. package/__app__/codegen/react.mjs +7 -8
  2. package/__app__/codegen/webcomponent.mjs +77 -736
  3. package/__app__/src/aichat/index.mjs +8 -0
  4. package/__app__/src/chunks/AIChat.mjs +959 -0
  5. package/__app__/src/chunks/DiagramActorProvider.mjs +7638 -0
  6. package/__app__/src/chunks/LikeC4Styles.mjs +1866 -0
  7. package/__app__/src/chunks/Markdown.mjs +146 -0
  8. package/__app__/src/chunks/NavigationPanel.mjs +61 -0
  9. package/__app__/src/chunks/ProjectsOverview.mjs +540 -0
  10. package/__app__/src/chunks/adhoc-editor.mjs +3386 -0
  11. package/__app__/src/chunks/es.mjs +439 -0
  12. package/__app__/src/chunks/hooks.mjs +145 -0
  13. package/__app__/src/chunks/libs/@dagrejs/dagre.mjs +1894 -0
  14. package/__app__/src/chunks/libs/@floating-ui.mjs +2218 -0
  15. package/__app__/src/chunks/libs/@mantine.mjs +12070 -0
  16. package/__app__/src/chunks/libs/@tabler/icons-react.mjs +252 -0
  17. package/__app__/src/chunks/libs/@tanstack-ai.mjs +1768 -0
  18. package/__app__/src/chunks/libs/@tanstack.mjs +2718 -0
  19. package/__app__/src/chunks/libs/@xstate/react.mjs +1982 -0
  20. package/__app__/src/chunks/libs/@xyflow/react.mjs +5256 -0
  21. package/__app__/src/chunks/libs/bezier-js.mjs +1003 -0
  22. package/__app__/src/chunks/libs/d3.mjs +2842 -0
  23. package/__app__/src/chunks/libs/fast-equals.mjs +268 -0
  24. package/__app__/src/chunks/libs/framer.mjs +5872 -0
  25. package/__app__/src/chunks/libs/remeda.mjs +642 -0
  26. package/__app__/src/chunks/libs/zod.mjs +3170 -0
  27. package/__app__/src/chunks/rolldown-runtime.mjs +23 -0
  28. package/__app__/src/chunks/styled-system.mjs +1040 -0
  29. package/__app__/src/fonts.css +1 -1
  30. package/__app__/src/main.mjs +14847 -1
  31. package/__app__/src/style.css +1 -1
  32. package/config/schema.json +14 -41
  33. package/dist/chunks/enableServer.mjs +1 -0
  34. package/dist/chunks/filenames.mjs +2 -2
  35. package/dist/chunks/index2.d.mts +2057 -722
  36. package/dist/chunks/libs/@chevrotain/gast.mjs +1 -1
  37. package/dist/chunks/libs/@logtape/logtape.mjs +4 -3
  38. package/dist/chunks/libs/@ts-graphviz/ast.mjs +3 -0
  39. package/dist/chunks/libs/@ts-graphviz/common.d.mts +9 -0
  40. package/dist/chunks/libs/@ts-graphviz/core.mjs +1 -0
  41. package/dist/chunks/libs/chevrotain-allstar.mjs +2 -2
  42. package/dist/chunks/libs/chevrotain.mjs +26 -26
  43. package/dist/chunks/libs/langium.d.mts +5 -5
  44. package/dist/chunks/libs/langium.mjs +10 -10
  45. package/dist/chunks/libs/merge-error-cause.mjs +1 -1
  46. package/dist/chunks/libs/pako.mjs +3 -1
  47. package/dist/chunks/libs/pretty-ms.mjs +1 -1
  48. package/dist/chunks/libs/remeda.mjs +1 -1
  49. package/dist/chunks/libs/ufo.mjs +1 -1
  50. package/dist/chunks/libs/unstorage.mjs +1 -1
  51. package/dist/chunks/libs/which.mjs +1 -1
  52. package/dist/chunks/libs/zod.d.mts +60 -25
  53. package/dist/chunks/libs/zod.mjs +65 -0
  54. package/dist/chunks/node.mjs +84 -56
  55. package/dist/chunks/sequence-view.mjs +1 -1
  56. package/dist/chunks/vite-plugin.mjs +593 -0
  57. package/dist/cli/index.mjs +184 -141
  58. package/dist/index.d.mts +2 -131
  59. package/dist/index.mjs +1 -1
  60. package/dist/model/index.d.mts +2 -2
  61. package/dist/vite-plugin/index.d.mts +53 -2
  62. package/dist/vite-plugin/index.mjs +1 -1
  63. package/dist/vite-plugin/internal/index.d.mts +327 -4
  64. package/dist/vite-plugin/internal/index.mjs +946 -1
  65. package/package.json +85 -72
  66. package/react/index.d.mts +174 -73
  67. package/react/index.mjs +42468 -38926
  68. package/vite-plugin-modules.d.ts +4 -0
  69. package/__app__/chunks/ColorSchemeToggle.mjs +0 -1
  70. package/__app__/chunks/DiagramActorProvider.mjs +0 -10
  71. package/__app__/chunks/Fallback.mjs +0 -1
  72. package/__app__/chunks/Header.mjs +0 -13
  73. package/__app__/chunks/IconRenderer.mjs +0 -1
  74. package/__app__/chunks/LikeC4Diagram.mjs +0 -19
  75. package/__app__/chunks/LikeC4ModelContext.mjs +0 -1
  76. package/__app__/chunks/LikeC4ModelContext2.mjs +0 -1
  77. package/__app__/chunks/LikeC4Styles.mjs +0 -48
  78. package/__app__/chunks/NavigationPanel.mjs +0 -1
  79. package/__app__/chunks/StaticLikeC4Diagram.mjs +0 -1
  80. package/__app__/chunks/ViewReact.mjs +0 -1
  81. package/__app__/chunks/__root.mjs +0 -1
  82. package/__app__/chunks/adhoc-editor.mjs +0 -1
  83. package/__app__/chunks/hooks.mjs +0 -1
  84. package/__app__/chunks/libs/@dagrejs/dagre.mjs +0 -1
  85. package/__app__/chunks/libs/@floating-ui/core.mjs +0 -1
  86. package/__app__/chunks/libs/@floating-ui/dom.mjs +0 -1
  87. package/__app__/chunks/libs/@floating-ui/react.mjs +0 -1
  88. package/__app__/chunks/libs/@mantine/core.mjs +0 -41
  89. package/__app__/chunks/libs/@mantine/hooks.mjs +0 -1
  90. package/__app__/chunks/libs/@nanostores/react.mjs +0 -1
  91. package/__app__/chunks/libs/@react-hookz/web.mjs +0 -1
  92. package/__app__/chunks/libs/@tabler/icons-react.mjs +0 -15
  93. package/__app__/chunks/libs/@tanstack/history.mjs +0 -1
  94. package/__app__/chunks/libs/@tanstack/react-router.mjs +0 -3
  95. package/__app__/chunks/libs/@tanstack/router-core.mjs +0 -1
  96. package/__app__/chunks/libs/@xstate/react.mjs +0 -1
  97. package/__app__/chunks/libs/@xstate/store.mjs +0 -1
  98. package/__app__/chunks/libs/@xyflow/react.mjs +0 -7
  99. package/__app__/chunks/libs/@zag-js/anatomy.mjs +0 -1
  100. package/__app__/chunks/libs/@zag-js/collection.mjs +0 -1
  101. package/__app__/chunks/libs/@zag-js/core.mjs +0 -1
  102. package/__app__/chunks/libs/@zag-js/react.mjs +0 -1
  103. package/__app__/chunks/libs/@zag-js/tree-view.mjs +0 -1
  104. package/__app__/chunks/libs/bezier-js.mjs +0 -1
  105. package/__app__/chunks/libs/d3-path.mjs +0 -1
  106. package/__app__/chunks/libs/d3-shape.mjs +0 -1
  107. package/__app__/chunks/libs/fast-equals.mjs +0 -1
  108. package/__app__/chunks/libs/framer-motion.mjs +0 -9
  109. package/__app__/chunks/libs/html-to-image.mjs +0 -2
  110. package/__app__/chunks/libs/motion-dom.mjs +0 -1
  111. package/__app__/chunks/libs/motion.mjs +0 -1
  112. package/__app__/chunks/libs/nanostores.mjs +0 -1
  113. package/__app__/chunks/libs/react-error-boundary.mjs +0 -1
  114. package/__app__/chunks/libs/react-resizable-panels.mjs +0 -1
  115. package/__app__/chunks/libs/remeda.mjs +0 -1
  116. package/__app__/chunks/libs/xstate.mjs +0 -1
  117. package/__app__/chunks/libs/zod.mjs +0 -39
  118. package/__app__/chunks/rolldown-runtime.mjs +0 -1
  119. package/__app__/chunks/safeCtx.mjs +0 -1
  120. package/__app__/chunks/searchParams.mjs +0 -1
  121. package/__app__/chunks/single-index.mjs +0 -1
  122. package/__app__/chunks/styled-system.mjs +0 -1
  123. package/__app__/chunks/styles.css.mjs +0 -1
  124. package/__app__/chunks/useLikeC4Project.mjs +0 -1
  125. package/__app__/chunks/useUpdateEffect.mjs +0 -1
  126. package/__app__/src/pages/AdHocViewEditor.mjs +0 -1
  127. package/__app__/src/pages/EmbedPage.mjs +0 -1
  128. package/__app__/src/pages/ExportPage.mjs +0 -1
  129. package/__app__/src/pages/ProjectsOverview.mjs +0 -1
  130. package/__app__/src/pages/ViewAsD2.mjs +0 -1
  131. package/__app__/src/pages/ViewAsDot.mjs +0 -1
  132. package/__app__/src/pages/ViewAsMmd.mjs +0 -1
  133. package/__app__/src/pages/ViewAsPuml.mjs +0 -1
  134. package/__app__/src/pages/ViewEditor.mjs +0 -1
  135. package/__app__/src/pages/ViewReact.mjs +0 -1
  136. package/__app__/src/routeTree.gen.mjs +0 -1
  137. package/__app__/src/routes/__root.mjs +0 -1
  138. package/__app__/src/routes/_single/adhoc.mjs +0 -1
  139. package/__app__/src/routes/_single/embed._viewId.mjs +0 -1
  140. package/__app__/src/routes/_single/export._viewId.mjs +0 -1
  141. package/__app__/src/routes/_single/route.mjs +0 -1
  142. package/__app__/src/routes/_single/single-index.mjs +0 -1
  143. package/__app__/src/routes/_single/view._viewId.d2.mjs +0 -1
  144. package/__app__/src/routes/_single/view._viewId.dot.mjs +0 -1
  145. package/__app__/src/routes/_single/view._viewId.index.mjs +0 -1
  146. package/__app__/src/routes/_single/view._viewId.mjs +0 -1
  147. package/__app__/src/routes/_single/view._viewId.mmd.mjs +0 -1
  148. package/__app__/src/routes/_single/view._viewId.puml.mjs +0 -1
  149. package/__app__/src/routes/_single/webcomponent._.mjs +0 -33
  150. package/__app__/src/routes/index.mjs +0 -1
  151. package/__app__/src/routes/project._projectId/-components.mjs +0 -1
  152. package/__app__/src/routes/project._projectId/adhoc.mjs +0 -1
  153. package/__app__/src/routes/project._projectId/embed._viewId.mjs +0 -1
  154. package/__app__/src/routes/project._projectId/export._viewId.mjs +0 -1
  155. package/__app__/src/routes/project._projectId/index.mjs +0 -1
  156. package/__app__/src/routes/project._projectId/route.mjs +0 -1
  157. package/__app__/src/routes/project._projectId/view._viewId.d2.mjs +0 -1
  158. package/__app__/src/routes/project._projectId/view._viewId.dot.mjs +0 -1
  159. package/__app__/src/routes/project._projectId/view._viewId.index.mjs +0 -1
  160. package/__app__/src/routes/project._projectId/view._viewId.mjs +0 -1
  161. package/__app__/src/routes/project._projectId/view._viewId.mmd.mjs +0 -1
  162. package/__app__/src/routes/project._projectId/view._viewId.puml.mjs +0 -1
  163. package/__app__/src/routes/projects.mjs +0 -1
  164. package/dist/chunks/libs/@chevrotain/utils.mjs +0 -1
  165. package/dist/chunks/libs/@hono/mcp.mjs +0 -45
  166. package/dist/chunks/libs/@hono/node-server.mjs +0 -1
  167. package/dist/chunks/libs/@logtape/logtape.d.mts +0 -1023
  168. package/dist/chunks/libs/@modelcontextprotocol/sdk.mjs +0 -12
  169. package/dist/chunks/libs/ajv.mjs +0 -1
  170. package/dist/chunks/libs/ansi-align.mjs +0 -2
  171. package/dist/chunks/libs/ansi-regex.mjs +0 -1
  172. package/dist/chunks/libs/ansi-styles.mjs +0 -1
  173. package/dist/chunks/libs/atomically.mjs +0 -1
  174. package/dist/chunks/libs/boxen.mjs +0 -22
  175. package/dist/chunks/libs/conf.mjs +0 -1
  176. package/dist/chunks/libs/defu.mjs +0 -1
  177. package/dist/chunks/libs/destr.mjs +0 -1
  178. package/dist/chunks/libs/find-up-simple.mjs +0 -1
  179. package/dist/chunks/libs/get-port.mjs +0 -1
  180. package/dist/chunks/libs/hono.mjs +0 -1
  181. package/dist/chunks/libs/is-docker.mjs +0 -1
  182. package/dist/chunks/libs/is-error-instance.mjs +0 -1
  183. package/dist/chunks/libs/is-inside-container.mjs +0 -1
  184. package/dist/chunks/libs/is-plain-obj.mjs +0 -1
  185. package/dist/chunks/libs/isexe.mjs +0 -1
  186. package/dist/chunks/libs/ky.mjs +0 -3
  187. package/dist/chunks/libs/p-debounce.mjs +0 -1
  188. package/dist/chunks/libs/p-limit.mjs +0 -1
  189. package/dist/chunks/libs/p-timeout.mjs +0 -1
  190. package/dist/chunks/libs/package-up.mjs +0 -1
  191. package/dist/chunks/libs/parse-ms.mjs +0 -1
  192. package/dist/chunks/libs/safe-stringify.mjs +0 -1
  193. package/dist/chunks/libs/strip-indent.mjs +0 -1
  194. package/dist/chunks/libs/tinyrainbow.mjs +0 -1
  195. package/dist/chunks/libs/ts-graphviz.d.mts +0 -12
  196. package/dist/chunks/libs/ts-graphviz.mjs +0 -4
  197. package/dist/chunks/libs/vscode-languageserver.mjs +0 -1
  198. package/dist/chunks/libs/word-wrap.mjs +0 -12
  199. package/dist/chunks/plugin.mjs +0 -400
  200. package/dist/vite-plugin/internal/chunks/libs/@nanostores/react.d.mts +0 -269
  201. package/dist/vite-plugin/internal/chunks/libs/@nanostores/react.mjs +0 -1
  202. package/dist/vite-plugin/internal/chunks/libs/birpc.mjs +0 -1
  203. package/dist/vite-plugin/internal/chunks/libs/fast-equals.mjs +0 -1
  204. package/dist/vite-plugin/internal/chunks/libs/nanostores.d.mts +0 -59
  205. package/dist/vite-plugin/internal/chunks/libs/nanostores.mjs +0 -1
  206. package/dist/vite-plugin/internal/chunks/libs/remeda.mjs +0 -1
  207. package/dist/vite-plugin/internal/chunks/rolldown-runtime.mjs +0 -1
@@ -1,269 +0,0 @@
1
- import { t as __name } from "../../rolldown-runtime.mjs";
2
- import { DependencyList } from "react";
3
-
4
- //#region ../../node_modules/.pnpm/nanostores@1.2.0/node_modules/nanostores/atom/index.d.ts
5
- type AllKeys<T> = T extends any ? keyof T : never;
6
- type Primitive = boolean | number | string;
7
- type ReadonlyIfObject<Value> = Value extends undefined ? Value : Value extends ((...args: any) => any) ? Value : Value extends Primitive ? Value : Value extends object ? Readonly<Value> : Value;
8
- /**
9
- * Store object.
10
- */
11
- interface ReadableAtom<Value = any> {
12
- /**
13
- * Get store value.
14
- *
15
- * In contrast with {@link ReadableAtom#value} this value will be always
16
- * initialized even if store had no listeners.
17
- *
18
- * ```js
19
- * $store.get()
20
- * ```
21
- *
22
- * @returns Store value.
23
- */
24
- get(): Value;
25
- /**
26
- * Low-level attribute to read store’s initial value.
27
- */
28
- readonly init: undefined | Value;
29
- /**
30
- * Listeners count.
31
- */
32
- readonly lc: number;
33
- /**
34
- * Subscribe to store changes.
35
- *
36
- * In contrast with {@link Store#subscribe} it do not call listener
37
- * immediately.
38
- *
39
- * @param listener Callback with store value and old value.
40
- * @returns Function to remove listener.
41
- */
42
- listen(listener: (value: ReadonlyIfObject<Value>, oldValue: ReadonlyIfObject<Value>) => void): () => void;
43
- /**
44
- * Low-level method to notify listeners about changes in the store.
45
- *
46
- * Can cause unexpected behaviour when combined with frontend frameworks
47
- * that perform equality checks for values, such as React.
48
- */
49
- notify(oldValue?: ReadonlyIfObject<Value>): void;
50
- /**
51
- * Unbind all listeners.
52
- */
53
- off(): void;
54
- /**
55
- * Subscribe to store changes and call listener immediately.
56
- *
57
- * ```
58
- * import { $router } from '../store'
59
- *
60
- * $router.subscribe(page => {
61
- * console.log(page)
62
- * })
63
- * ```
64
- *
65
- * @param listener Callback with store value and old value.
66
- * @returns Function to remove listener.
67
- */
68
- subscribe(listener: (value: ReadonlyIfObject<Value>, oldValue?: ReadonlyIfObject<Value>) => void): () => void;
69
- /**
70
- * Low-level method to read store’s value without calling `onStart`.
71
- *
72
- * Try to use only {@link ReadableAtom#get}.
73
- * Without subscribers, value can be undefined.
74
- */
75
- readonly value: undefined | Value;
76
- }
77
- /**
78
- * Store with a way to manually change the value.
79
- */
80
- interface WritableAtom<Value = any> extends ReadableAtom<Value> {
81
- /**
82
- * Change store value.
83
- *
84
- * ```js
85
- * $router.set({ path: location.pathname, page: parse(location.pathname) })
86
- * ```
87
- *
88
- * @param newValue New store value.
89
- */
90
- set(newValue: Value): void;
91
- }
92
- interface PreinitializedWritableAtom<Value> extends WritableAtom<Value> {
93
- readonly value: Value;
94
- }
95
- type Atom<Value = any> = ReadableAtom<Value> | WritableAtom<Value>;
96
- /**
97
- * Create store with atomic value. It could be a string or an object, which you
98
- * will replace completely.
99
- *
100
- * If you want to change keys in the object inside store, use {@link map}.
101
- *
102
- * ```js
103
- * import { atom, onMount } from 'nanostores'
104
- *
105
- * // Initial value
106
- * export const $router = atom({ path: '', page: 'home' })
107
- *
108
- * function parse () {
109
- * $router.set({ path: location.pathname, page: parse(location.pathname) })
110
- * }
111
- *
112
- * // Listen for URL changes on first store’s listener.
113
- * onMount($router, () => {
114
- * parse()
115
- * window.addEventListener('popstate', parse)
116
- * return () => {
117
- * window.removeEventListener('popstate', parse)
118
- * }
119
- * })
120
- * ```
121
- *
122
- * @param initialValue Initial value of the store.
123
- * @returns The store object with methods to subscribe.
124
- */
125
- declare function atom<Value, StoreExt = object>(...args: undefined extends Value ? [] | [Value] : [Value]): PreinitializedWritableAtom<Value> & StoreExt;
126
- //#endregion
127
- //#region ../../node_modules/.pnpm/nanostores@1.2.0/node_modules/nanostores/map/index.d.ts
128
- type KeyofBase = keyof any;
129
- type Get<T, K extends KeyofBase> = Extract<T, { [K1 in K]: any }>[K];
130
- type HasIndexSignature<T> = string extends keyof T ? true : false;
131
- type ValueWithUndefinedForIndexSignatures<Value, Key extends keyof Value> = HasIndexSignature<Value> extends true ? undefined | Value[Key] : Value[Key];
132
- type WritableStore<Value = any> = (Value extends object ? MapStore<Value> : never) | WritableAtom<Value>;
133
- type Store<Value = any> = ReadableAtom<Value> | WritableStore<Value>;
134
- type AnyStore<Value = any> = {
135
- get(): Value;
136
- readonly value: undefined | Value;
137
- };
138
- type StoreValue<SomeStore> = SomeStore extends {
139
- get(): infer Value;
140
- } ? Value : any;
141
- interface MapStore<Value extends object = any> extends WritableAtom<Value> {
142
- /**
143
- * Subscribe to store changes.
144
- *
145
- * In contrast with {@link Store#subscribe} it do not call listener
146
- * immediately.
147
- *
148
- * @param listener Callback with store value and old value.
149
- * @param changedKey Key that was changed. Will present only if `setKey`
150
- * has been used to change a store.
151
- * @returns Function to remove listener.
152
- */
153
- listen(listener: (value: ReadonlyIfObject<Value>, oldValue: ReadonlyIfObject<Value>, changedKey: AllKeys<Value>) => void): () => void;
154
- /**
155
- * Low-level method to notify listeners about changes in the store.
156
- *
157
- * Can cause unexpected behaviour when combined with frontend frameworks
158
- * that perform equality checks for values, such as React.
159
- */
160
- notify(oldValue?: ReadonlyIfObject<Value>, changedKey?: AllKeys<Value>): void;
161
- /**
162
- * Change store value.
163
- *
164
- * ```js
165
- * $settings.set({ theme: 'dark' })
166
- * ```
167
- *
168
- * Operation is atomic, subscribers will be notified once with the new value.
169
- * `changedKey` will be undefined
170
- *
171
- * @param newValue New store value.
172
- */
173
- set(newValue: Value): void;
174
- /**
175
- * Change key in store value.
176
- *
177
- * ```js
178
- * $settings.setKey('theme', 'dark')
179
- * ```
180
- *
181
- * To delete key set `undefined`.
182
- *
183
- * ```js
184
- * $settings.setKey('theme', undefined)
185
- * ```
186
- *
187
- * @param key The key name.
188
- * @param value New value.
189
- */
190
- setKey<Key extends AllKeys<Value>>(key: Key, value: Get<Value, Key> | ValueWithUndefinedForIndexSignatures<Value, Key>): void;
191
- /**
192
- * Subscribe to store changes and call listener immediately.
193
- *
194
- * ```
195
- * import { $router } from '../store'
196
- *
197
- * $router.subscribe(page => {
198
- * console.log(page)
199
- * })
200
- * ```
201
- *
202
- * @param listener Callback with store value and old value.
203
- * @param changedKey Key that was changed. Will present only
204
- * if `setKey` has been used to change a store.
205
- * @returns Function to remove listener.
206
- */
207
- subscribe(listener: (value: ReadonlyIfObject<Value>, oldValue: ReadonlyIfObject<Value> | undefined, changedKey: AllKeys<Value> | undefined) => void): () => void;
208
- }
209
- interface PreinitializedMapStore<Value extends object = any> extends MapStore<Value> {
210
- readonly value: Value;
211
- }
212
- /**
213
- * Create map store. Map store is a store with key-value object
214
- * as a store value.
215
- *
216
- * @param init Initialize store and return store destructor.
217
- * @returns The store object with methods to subscribe.
218
- */
219
- declare function map<Value extends object, StoreExt extends object = object>(value?: Value): PreinitializedMapStore<Value> & StoreExt;
220
- //#endregion
221
- //#region ../../node_modules/.pnpm/@nanostores+react@1.1.0_nanostores@1.2.0_react@19.2.4/node_modules/@nanostores/react/index.d.ts
222
- type StoreKeys<T> = T extends {
223
- setKey: (k: infer K, v: any) => unknown;
224
- } ? K : never;
225
- interface UseStoreOptions<SomeStore> {
226
- /**
227
- * @default
228
- * ```ts
229
- * [store, options.keys]
230
- * ```
231
- */
232
- deps?: DependencyList;
233
- /**
234
- * Will re-render components only on specific key changes.
235
- */
236
- keys?: StoreKeys<SomeStore>[];
237
- /**
238
- * Enable SSR support. Set `initial` when store's initial value is the same on
239
- * server and client, or provide a function to return the server store state
240
- * for advanced cases (per useSyncExternalStore's getServerSnapshot).
241
- */
242
- ssr?: (() => StoreValue<SomeStore>) | 'initial' | false;
243
- }
244
- /**
245
- * Subscribe to store changes and get store’s value.
246
- *
247
- * Can be user with store builder too.
248
- *
249
- * ```js
250
- * import { useStore } from 'nanostores/react'
251
- *
252
- * import { router } from '../store/router'
253
- *
254
- * export const Layout = () => {
255
- * let page = useStore(router)
256
- * if (page.route === 'home') {
257
- * return <HomePage />
258
- * } else {
259
- * return <Error404 />
260
- * }
261
- * }
262
- * ```
263
- *
264
- * @param store Store instance.
265
- * @returns Store value.
266
- */
267
- declare function useStore<SomeStore extends Store>(store: SomeStore, options?: UseStoreOptions<SomeStore>): StoreValue<SomeStore>;
268
- //#endregion
269
- export { map as a, WritableAtom as c, StoreValue as i, atom as l, AnyStore as n, Atom as o, Store as r, ReadableAtom as s, useStore as t };
@@ -1 +0,0 @@
1
- import"../../rolldown-runtime.mjs";import{useCallback as e,useRef as t,useSyncExternalStore as n}from"react";function listenKeys(e,t,n){let r=new Set(t).add(void 0);return e.listen((e,t,i)=>{r.has(i)&&n(e,t,i)})}let emit=(e,t)=>n=>{e.current!==n&&(e.current=n,t())};function useStore(r,{keys:i,deps:a=[r,i],ssr:o}={}){let s=t();s.current=r.get();let c=e(e=>(emit(s,e)(r.value),i?.length>0?listenKeys(r,i,emit(s,e)):r.listen(emit(s,e))),a),get=()=>s.current,l=get;return o&&`init`in r&&(l=o===`initial`?()=>r.init:o),n(c,get,l)}export{useStore as t};
@@ -1 +0,0 @@
1
- import"../rolldown-runtime.mjs";function createPromiseWithResolvers(){let e,t;return{promise:new Promise((n,r)=>{e=n,t=r}),resolve:e,reject:t}}const e=Math.random.bind(Math);function nanoid(t=21){let n=``,r=t;for(;r--;)n+=`useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict`[e()*64|0];return n}const defaultSerialize=e=>e,t=defaultSerialize,{clearTimeout:n,setTimeout:r}=globalThis;function createBirpc(e,i){let{post:a,on:o,off=()=>{},eventNames:s=[],serialize:c=defaultSerialize,deserialize:l=t,resolver:u,bind:d=`rpc`,timeout:f=6e4,proxify:p=!0}=i,m=!1,h=new Map,g,_;async function _call(e,t,o,s){if(m)throw Error(`[birpc] rpc is closed, cannot call "${e}"`);let l={m:e,a:t,t:`q`};s&&(l.o=!0);let send=async e=>a(c(e));if(o){await send(l);return}if(g)try{await g}finally{g=void 0}let{promise:u,resolve:d,reject:p}=createPromiseWithResolvers(),v=nanoid();l.i=v;let y;async function handler(n=l){return f>=0&&(y=r(()=>{try{if(i.onTimeoutError?.call(_,e,t)!==!0)throw Error(`[birpc] timeout on calling "${e}"`)}catch(e){p(e)}h.delete(v)},f),typeof y==`object`&&(y=y.unref?.())),h.set(v,{resolve:d,reject:p,timeoutId:y,method:e}),await send(n),u}try{i.onRequest?await i.onRequest.call(_,l,handler,d):await handler()}catch(e){if(i.onGeneralError?.call(_,e)!==!0)throw e;return}finally{n(y),h.delete(v)}return u}let v={$call:(e,...t)=>_call(e,t,!1),$callOptional:(e,...t)=>_call(e,t,!1,!0),$callEvent:(e,...t)=>_call(e,t,!0),$callRaw:e=>_call(e.method,e.args,e.event,e.optional),$rejectPendingCalls,get $closed(){return m},get $meta(){return i.meta},$close,$functions:e};_=p?new Proxy({},{get(t,n){if(Object.prototype.hasOwnProperty.call(v,n))return v[n];if(n===`then`&&!s.includes(`then`)&&!(`then`in e))return;let sendEvent=(...e)=>_call(n,e,!0);if(s.includes(n))return sendEvent.asEvent=sendEvent,sendEvent;let sendCall=(...e)=>_call(n,e,!1);return sendCall.asEvent=sendEvent,sendCall}}):v;function $close(e){m=!0,h.forEach(({reject:t,method:n})=>{let r=Error(`[birpc] rpc is closed, cannot call "${n}"`);if(e)return e.cause??=r,t(e);t(r)}),h.clear(),off(onMessage)}function $rejectPendingCalls(e){let t=Array.from(h.values()).map(({method:t,reject:n})=>e?e({method:t,reject:n}):n(Error(`[birpc]: rejected pending call "${t}".`)));return h.clear(),t}async function onMessage(t,...r){let o;try{o=l(t)}catch(e){if(i.onGeneralError?.call(_,e)!==!0)throw e;return}if(o.t===`q`){let{m:t,a:n,o:s}=o,l,f,fn=await(u?u.call(_,t,e[t]):e[t]);if(s&&(fn||=()=>void 0),!fn)f=Error(`[birpc] function "${t}" not found`);else try{l=await fn.apply(d===`rpc`?_:e,n)}catch(e){f=e}if(o.i){if(f&&i.onFunctionError&&i.onFunctionError.call(_,f,t,n)===!0)return;if(!f)try{await a(c({t:`s`,i:o.i,r:l}),...r);return}catch(e){if(f=e,i.onGeneralError?.call(_,e,t,n)!==!0)throw e}try{await a(c({t:`s`,i:o.i,e:f}),...r)}catch(e){if(i.onGeneralError?.call(_,e,t,n)!==!0)throw e}}}else{let{i:e,r:t,e:r}=o,i=h.get(e);i&&(n(i.timeoutId),r?i.reject(r):i.resolve(t)),h.delete(e)}}return g=o(onMessage),_}export{createBirpc as t};
@@ -1 +0,0 @@
1
- import"../rolldown-runtime.mjs";const{getOwnPropertyNames:e,getOwnPropertySymbols:t}=Object,{hasOwnProperty:n}=Object.prototype;function combineComparators(e,t){return function isEqual(n,r,i){return e(n,r,i)&&t(n,r,i)}}function createIsCircular(e){return function isCircular(t,n,r){if(!t||!n||typeof t!=`object`||typeof n!=`object`)return e(t,n,r);let{cache:i}=r,a=i.get(t),o=i.get(n);if(a&&o)return a===n&&o===t;i.set(t,n),i.set(n,t);let s=e(t,n,r);return i.delete(t),i.delete(n),s}}function getStrictProperties(n){return e(n).concat(t(n))}const r=Object.hasOwn||((e,t)=>n.call(e,t)),{getOwnPropertyDescriptor:i,keys:a}=Object,o=Object.is||function sameValueEqual(e,t){return e===t?e!==0||1/e==1/t:e!==e&&t!==t};function strictEqual(e,t){return e===t}function areArrayBuffersEqual(e,t){return e.byteLength===t.byteLength&&areTypedArraysEqual(new Uint8Array(e),new Uint8Array(t))}function areArraysEqual(e,t,n){let r=e.length;if(t.length!==r)return!1;for(;r-- >0;)if(!n.equals(e[r],t[r],r,r,e,t,n))return!1;return!0}function areDataViewsEqual(e,t){return e.byteLength===t.byteLength&&areTypedArraysEqual(new Uint8Array(e.buffer,e.byteOffset,e.byteLength),new Uint8Array(t.buffer,t.byteOffset,t.byteLength))}function areDatesEqual(e,t){return o(e.getTime(),t.getTime())}function areErrorsEqual(e,t){return e.name===t.name&&e.message===t.message&&e.cause===t.cause&&e.stack===t.stack}function areMapsEqual(e,t,n){let r=e.size;if(r!==t.size)return!1;if(!r)return!0;let i=Array(r),a=e.entries(),o,s,c=0;for(;(o=a.next())&&!o.done;){let r=t.entries(),a=!1,l=0;for(;(s=r.next())&&!s.done;){if(i[l]){l++;continue}let r=o.value,u=s.value;if(n.equals(r[0],u[0],c,l,e,t,n)&&n.equals(r[1],u[1],r[0],u[0],e,t,n)){a=i[l]=!0;break}l++}if(!a)return!1;c++}return!0}function areObjectsEqual(e,t,n){let r=a(e),i=r.length;if(a(t).length!==i)return!1;for(;i-- >0;)if(!isPropertyEqual(e,t,n,r[i]))return!1;return!0}function areObjectsEqualStrict(e,t,n){let r=getStrictProperties(e),a=r.length;if(getStrictProperties(t).length!==a)return!1;let o,s,c;for(;a-- >0;)if(o=r[a],!isPropertyEqual(e,t,n,o)||(s=i(e,o),c=i(t,o),(s||c)&&(!s||!c||s.configurable!==c.configurable||s.enumerable!==c.enumerable||s.writable!==c.writable)))return!1;return!0}function arePrimitiveWrappersEqual(e,t){return o(e.valueOf(),t.valueOf())}function areRegExpsEqual(e,t){return e.source===t.source&&e.flags===t.flags}function areSetsEqual(e,t,n){let r=e.size;if(r!==t.size)return!1;if(!r)return!0;let i=Array(r),a=e.values(),o,s;for(;(o=a.next())&&!o.done;){let r=t.values(),a=!1,c=0;for(;(s=r.next())&&!s.done;){if(!i[c]&&n.equals(o.value,s.value,o.value,s.value,e,t,n)){a=i[c]=!0;break}c++}if(!a)return!1}return!0}function areTypedArraysEqual(e,t){let n=e.byteLength;if(t.byteLength!==n||e.byteOffset!==t.byteOffset)return!1;for(;n-- >0;)if(e[n]!==t[n])return!1;return!0}function areUrlsEqual(e,t){return e.hostname===t.hostname&&e.pathname===t.pathname&&e.protocol===t.protocol&&e.port===t.port&&e.hash===t.hash&&e.username===t.username&&e.password===t.password}function isPropertyEqual(e,t,n,i){return(i===`_owner`||i===`__o`||i===`__v`)&&(e.$$typeof||t.$$typeof)?!0:r(t,i)&&n.equals(e[i],t[i],i,i,e,t,n)}const s=Object.prototype.toString;function createEqualityComparator(e){let t=createSupportedComparatorMap(e),{areArraysEqual:n,areDatesEqual:r,areFunctionsEqual:i,areMapsEqual:a,areNumbersEqual:o,areObjectsEqual:c,areRegExpsEqual:l,areSetsEqual:u,getUnsupportedCustomComparator:d}=e;return function comparator(e,f,p){if(e===f)return!0;if(e==null||f==null)return!1;let m=typeof e;if(m!==typeof f)return!1;if(m!==`object`)return m===`number`||m===`bigint`?o(e,f,p):m===`function`?i(e,f,p):!1;let h=e.constructor;if(h!==f.constructor)return!1;if(h===Object)return c(e,f,p);if(h===Array)return n(e,f,p);if(h===Date)return r(e,f,p);if(h===RegExp)return l(e,f,p);if(h===Map)return a(e,f,p);if(h===Set)return u(e,f,p);if(h===Promise)return!1;if(Array.isArray(e))return n(e,f,p);let g=s.call(e),_=t[g];if(_)return _(e,f,p);let v=d&&d(e,f,p,g);return v?v(e,f,p):!1}}function createEqualityComparatorConfig({circular:e,createCustomConfig:t,strict:n}){let r={areArrayBuffersEqual,areArraysEqual:n?areObjectsEqualStrict:areArraysEqual,areDataViewsEqual,areDatesEqual,areErrorsEqual,areFunctionsEqual:strictEqual,areMapsEqual:n?combineComparators(areMapsEqual,areObjectsEqualStrict):areMapsEqual,areNumbersEqual:o,areObjectsEqual:n?areObjectsEqualStrict:areObjectsEqual,arePrimitiveWrappersEqual,areRegExpsEqual,areSetsEqual:n?combineComparators(areSetsEqual,areObjectsEqualStrict):areSetsEqual,areTypedArraysEqual:n?combineComparators(areTypedArraysEqual,areObjectsEqualStrict):areTypedArraysEqual,areUrlsEqual,getUnsupportedCustomComparator:void 0};if(t&&(r=Object.assign({},r,t(r))),e){let e=createIsCircular(r.areArraysEqual),t=createIsCircular(r.areMapsEqual),n=createIsCircular(r.areObjectsEqual),i=createIsCircular(r.areSetsEqual);r=Object.assign({},r,{areArraysEqual:e,areMapsEqual:t,areObjectsEqual:n,areSetsEqual:i})}return r}function createInternalEqualityComparator(e){return function(t,n,r,i,a,o,s){return e(t,n,s)}}function createIsEqual({circular:e,comparator:t,createState:n,equals:r,strict:i}){if(n)return function isEqual(a,o){let{cache:s=e?new WeakMap:void 0,meta:c}=n();return t(a,o,{cache:s,equals:r,meta:c,strict:i})};if(e)return function isEqual(e,n){return t(e,n,{cache:new WeakMap,equals:r,meta:void 0,strict:i})};let a={cache:void 0,equals:r,meta:void 0,strict:i};return function isEqual(e,n){return t(e,n,a)}}function createSupportedComparatorMap({areArrayBuffersEqual:e,areArraysEqual:t,areDataViewsEqual:n,areDatesEqual:r,areErrorsEqual:i,areFunctionsEqual:a,areMapsEqual:o,areNumbersEqual:s,areObjectsEqual:c,arePrimitiveWrappersEqual:l,areRegExpsEqual:u,areSetsEqual:d,areTypedArraysEqual:f,areUrlsEqual:p}){return{"[object Arguments]":c,"[object Array]":t,"[object ArrayBuffer]":e,"[object AsyncGeneratorFunction]":a,"[object BigInt]":s,"[object BigInt64Array]":f,"[object BigUint64Array]":f,"[object Boolean]":l,"[object DataView]":n,"[object Date]":r,"[object Error]":i,"[object Float16Array]":f,"[object Float32Array]":f,"[object Float64Array]":f,"[object Function]":a,"[object GeneratorFunction]":a,"[object Int8Array]":f,"[object Int16Array]":f,"[object Int32Array]":f,"[object Map]":o,"[object Number]":l,"[object Object]":(e,t,n)=>typeof e.then!=`function`&&typeof t.then!=`function`&&c(e,t,n),"[object RegExp]":u,"[object Set]":d,"[object String]":l,"[object URL]":p,"[object Uint8Array]":f,"[object Uint8ClampedArray]":f,"[object Uint16Array]":f,"[object Uint32Array]":f}}const c=createCustomEqual();createCustomEqual({strict:!0}),createCustomEqual({circular:!0}),createCustomEqual({circular:!0,strict:!0});const l=createCustomEqual({createInternalComparator:()=>o});createCustomEqual({strict:!0,createInternalComparator:()=>o}),createCustomEqual({circular:!0,createInternalComparator:()=>o}),createCustomEqual({circular:!0,createInternalComparator:()=>o,strict:!0});function createCustomEqual(e={}){let{circular:t=!1,createInternalComparator:n,createState:r,strict:i=!1}=e,a=createEqualityComparator(createEqualityComparatorConfig(e));return createIsEqual({circular:t,comparator:a,createState:r,equals:n?n(a):createInternalEqualityComparator(a),strict:i})}export{l as n,c as t};
@@ -1,59 +0,0 @@
1
- import { t as __name } from "../rolldown-runtime.mjs";
2
- import { i as StoreValue, n as AnyStore, r as Store, s as ReadableAtom } from "./@nanostores/react.mjs";
3
-
4
- //#region ../../node_modules/.pnpm/nanostores@1.2.0/node_modules/nanostores/task/index.d.ts
5
- interface Task<Value> extends Promise<Value> {
6
- t: true;
7
- }
8
- //#endregion
9
- //#region ../../node_modules/.pnpm/nanostores@1.2.0/node_modules/nanostores/computed/index.d.ts
10
- type StoreValues<Stores extends AnyStore[]> = { [Index in keyof Stores]: StoreValue<Stores[Index]> };
11
- interface Computed {
12
- /**
13
- * @deprecated Use `@nanostores/async`.
14
- */
15
- <Value, OriginStore extends Store>(stores: OriginStore, cb: (value: StoreValue<OriginStore>) => Task<Value>): ReadableAtom<undefined | Value>;
16
- /**
17
- * @deprecated Use `@nanostores/async`.
18
- */
19
- <Value, OriginStores extends AnyStore[]>(stores: [...OriginStores], cb: (...values: StoreValues<OriginStores>) => Task<Value>): ReadableAtom<undefined | Value>;
20
- <Value, OriginStore extends Store>(stores: OriginStore, cb: (value: StoreValue<OriginStore>) => Value): ReadableAtom<Value>;
21
- /**
22
- * Create derived store, which use generates value from another stores.
23
- *
24
- * ```js
25
- * import { computed } from 'nanostores'
26
- *
27
- * import { $users } from './users.js'
28
- *
29
- * export const $admins = computed($users, users => {
30
- * return users.filter(user => user.isAdmin)
31
- * })
32
- * ```
33
- *
34
- * Use `@nanostores/async` for async function.
35
- */
36
- <Value, OriginStores extends AnyStore[]>(stores: [...OriginStores], cb: (...values: StoreValues<OriginStores>) => Task<Value> | Value): ReadableAtom<Value>;
37
- }
38
- declare const computed: Computed;
39
- interface Batched {
40
- <Value, OriginStore extends Store>(stores: OriginStore, cb: (value: StoreValue<OriginStore>) => Task<Value> | Value): ReadableAtom<Value>;
41
- /**
42
- * Create derived store, which use generates value from another stores.
43
- *
44
- * ```js
45
- * import { batched } from 'nanostores'
46
- *
47
- * const $sortBy = atom('id')
48
- * const $category = atom('')
49
- *
50
- * export const $link = batched([$sortBy, $category], (sortBy, category) => {
51
- * return `/api/entities?sortBy=${sortBy}&category=${category}`
52
- * })
53
- * ```
54
- */
55
- <Value, OriginStores extends AnyStore[]>(stores: [...OriginStores], cb: (...values: StoreValues<OriginStores>) => Task<Value> | Value): ReadableAtom<Value>;
56
- }
57
- declare const batched: Batched;
58
- //#endregion
59
- export { computed as n, batched as t };
@@ -1 +0,0 @@
1
- import"../rolldown-runtime.mjs";let e=[],t=0,n=0;const atom=r=>{let i=[],a={get(){return a.lc||a.listen(()=>{})(),a.value},init:r,lc:0,listen(n){return a.lc=i.push(n),()=>{for(let r=t+4;r<e.length;)e[r]===n?e.splice(r,4):r+=4;let r=i.indexOf(n);~r&&(i.splice(r,1),--a.lc||a.off())}},notify(r,o){n++;let s=!e.length;for(let t of i)e.push(t,a.value,r,o);if(s){for(t=0;t<e.length;t+=4)e[t](e[t+1],e[t+2],e[t+3]);e.length=0}},off(){},set(e){let t=a.value;t!==e&&(a.value=e,a.notify(t))},subscribe(e){let t=a.listen(e);return e(a.value),t},value:r};return a};let on=(e,t,n,r)=>(e.events=e.events||{},e.events[n+10]||(e.events[n+10]=r(t=>{e.events[n].reduceRight((e,t)=>(t(e),e),{shared:{},...t})})),e.events[n]=e.events[n]||[],e.events[n].push(t),()=>{let r=e.events[n],i=r.indexOf(t);r.splice(i,1),r.length||(delete e.events[n],e.events[n+10](),delete e.events[n+10])}),onMount=(e,t)=>{let listener=n=>{let r=t(n);r&&e.events[6].push(r)};return on(e,listener,5,t=>{let n=e.listen;e.listen=(...r)=>(!e.lc&&!e.active&&(e.active=!0,t()),n(...r));let r=e.off;return e.events[6]=[],e.off=()=>{r(),setTimeout(()=>{if(e.active&&!e.lc){e.active=!1;for(let t of e.events[6])t();e.events[6]=[]}},1e3)},()=>{e.listen=n,e.off=r}})},computedStore=(e,t,r)=>{Array.isArray(e)||(e=[e]);let i,a,set=()=>{if(a===n)return;a=n;let r=e.map(e=>e.get());if(!i||r.some((e,t)=>e!==i[t])){i=r;let e=t(...r);e&&e.then&&e.t?e.then(e=>{i===r&&o.set(e)}):(o.set(e),a=n)}},o=atom(void 0),s=o.get;o.get=()=>(set(),s());let c,l=r?()=>{clearTimeout(c),c=setTimeout(set)}:set;return onMount(o,()=>{let t=e.map(e=>e.listen(l));return set(),()=>{for(let e of t)e()}}),o};const computed=(e,t)=>computedStore(e,t),batched=(e,t)=>computedStore(e,t,!0),map=(e={})=>{let t=atom(e);return t.setKey=function(e,n){let r=t.value;n===void 0&&e in t.value?(t.value={...t.value},delete t.value[e],t.notify(r,e)):t.value[e]!==n&&(t.value={...t.value,[e]:n},t.notify(r,e))},t};export{atom as i,batched as n,computed as r,map as t};
@@ -1 +0,0 @@
1
- import{t as i}from"../rolldown-runtime.mjs";function e(i,a,o){let r=o=>i(o,...a);return o===void 0?r:Object.assign(r,{lazy:o,lazyArgs:a})}function t$1(i,a,o){let s=i.length-a.length;if(s===0)return i(...a);if(s===1)return e(i,a,o);throw Error(`Wrong number of arguments`)}i(t$1,`t`);function t(...i){return t$1(n,i)}function n(i,a){let o={};for(let[s,c]of Object.entries(i))o[s]=a(c,s,i);return o}export{t};
@@ -1 +0,0 @@
1
- var e=Object.defineProperty,__name=(t,n)=>e(t,`name`,{value:n,configurable:!0});export{__name as t};