round-core 0.0.6 → 0.0.7
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/dist/index.d.ts +18 -3
- package/extension/.vscodeignore +5 -0
- package/extension/LICENSE +21 -0
- package/extension/cgmanifest.json +45 -0
- package/extension/extension.js +163 -0
- package/extension/images/round-config-dark.svg +10 -0
- package/extension/images/round-config-light.svg +10 -0
- package/extension/images/round-dark.svg +10 -0
- package/extension/images/round-light.svg +10 -0
- package/extension/javascript-language-configuration.json +241 -0
- package/extension/package-lock.json +97 -0
- package/extension/package.json +119 -0
- package/extension/package.nls.json +4 -0
- package/extension/round-0.1.0.vsix +0 -0
- package/extension/round-lsp/package-lock.json +185 -0
- package/extension/round-lsp/package.json +21 -0
- package/extension/round-lsp/src/round-transformer-lsp.js +248 -0
- package/extension/round-lsp/src/server.js +396 -0
- package/extension/snippets/javascript.code-snippets +266 -0
- package/extension/snippets/round.code-snippets +109 -0
- package/extension/syntaxes/JavaScript.tmLanguage.json +6001 -0
- package/extension/syntaxes/JavaScriptReact.tmLanguage.json +6066 -0
- package/extension/syntaxes/Readme.md +12 -0
- package/extension/syntaxes/Regular Expressions (JavaScript).tmLanguage +237 -0
- package/extension/syntaxes/Round.tmLanguage.json +290 -0
- package/extension/syntaxes/RoundInject.tmLanguage.json +20 -0
- package/extension/tags-language-configuration.json +152 -0
- package/extension/temp_astro/package-lock.json +912 -0
- package/extension/temp_astro/package.json +16 -0
- package/extension/types/round-core.d.ts +326 -0
- package/package.json +1 -1
- package/src/index.d.ts +18 -3
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "temp_astro",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "",
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"test": "echo \"Error: no test specified\" && exit 1"
|
|
8
|
+
},
|
|
9
|
+
"keywords": [],
|
|
10
|
+
"author": "",
|
|
11
|
+
"license": "ISC",
|
|
12
|
+
"type": "commonjs",
|
|
13
|
+
"dependencies": {
|
|
14
|
+
"@astrojs/language-server": "^2.16.2"
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -0,0 +1,326 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Round Framework Type Definitions
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
export interface RoundSignal<T> {
|
|
6
|
+
/**
|
|
7
|
+
* Get or set the current value.
|
|
8
|
+
*/
|
|
9
|
+
(newValue?: T): T;
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Get the current value (reactive).
|
|
13
|
+
*/
|
|
14
|
+
value: T;
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Get the current value without tracking dependencies.
|
|
18
|
+
*/
|
|
19
|
+
peek(): T;
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Creates a transformed view of this signal.
|
|
23
|
+
*/
|
|
24
|
+
transform<U>(fromInput: (v: U) => T, toOutput: (v: T) => U): RoundSignal<U>;
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Attaches validation logic to the signal.
|
|
28
|
+
*/
|
|
29
|
+
validate(validator: (next: T, prev: T) => string | boolean | undefined | null, options?: {
|
|
30
|
+
/** Timing of validation: 'input' (default) or 'blur'. */
|
|
31
|
+
validateOn?: 'input' | 'blur';
|
|
32
|
+
/** Whether to run validation immediately on startup. */
|
|
33
|
+
validateInitial?: boolean;
|
|
34
|
+
}): RoundSignal<T> & {
|
|
35
|
+
/** Signal containing the current validation error message. */
|
|
36
|
+
error: RoundSignal<string | null>;
|
|
37
|
+
/** Manually trigger validation check. Returns true if valid. */
|
|
38
|
+
check(): boolean
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Creates a read/write view of a specific property path.
|
|
43
|
+
*/
|
|
44
|
+
$pick<K extends keyof T>(path: K): RoundSignal<T[K]>;
|
|
45
|
+
$pick(path: string | string[]): RoundSignal<any>;
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Internal: marks the signal as bindable for two-way bindings.
|
|
49
|
+
*/
|
|
50
|
+
bind?: boolean;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Creates a reactive signal.
|
|
55
|
+
*/
|
|
56
|
+
export function signal<T>(initialValue?: T): RoundSignal<T>;
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Creates a bindable signal intended for two-way DOM bindings.
|
|
60
|
+
*/
|
|
61
|
+
export function bindable<T>(initialValue?: T): RoundSignal<T>;
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Run a function without tracking any signals it reads.
|
|
65
|
+
* Any signals accessed inside the function will not become dependencies of the current effect.
|
|
66
|
+
*/
|
|
67
|
+
export function untrack<T>(fn: () => T): T;
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Create a reactive side-effect that runs whenever its signal dependencies change.
|
|
71
|
+
*/
|
|
72
|
+
export function effect(fn: () => void | (() => void), options?: {
|
|
73
|
+
/** If false, the effect won't run immediately on creation. Defaults to true. */
|
|
74
|
+
onLoad?: boolean
|
|
75
|
+
}): () => void;
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Create a reactive side-effect with explicit dependencies.
|
|
79
|
+
*/
|
|
80
|
+
export function effect(deps: any[], fn: () => void | (() => void), options?: {
|
|
81
|
+
/** If false, the effect won't run immediately on creation. Defaults to true. */
|
|
82
|
+
onLoad?: boolean
|
|
83
|
+
}): () => void;
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Create a read-only computed signal derived from other signals.
|
|
87
|
+
*/
|
|
88
|
+
export function derive<T>(fn: () => T): () => T;
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Create a read/write view of a specific path within a signal object.
|
|
92
|
+
*/
|
|
93
|
+
export function pick<T = any>(root: RoundSignal<any>, path: string | string[]): RoundSignal<T>;
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* Store API
|
|
97
|
+
*/
|
|
98
|
+
export interface RoundStore<T> {
|
|
99
|
+
/**
|
|
100
|
+
* Access a specific key from the store as a bindable signal.
|
|
101
|
+
*/
|
|
102
|
+
use<K extends keyof T>(key: K): RoundSignal<T[K]>;
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* Update a specific key in the store.
|
|
106
|
+
*/
|
|
107
|
+
set<K extends keyof T>(key: K, value: T[K]): T[K];
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* Batch update multiple keys in the store.
|
|
111
|
+
*/
|
|
112
|
+
patch(obj: Partial<T>): void;
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* Get a snapshot of the current state.
|
|
116
|
+
*/
|
|
117
|
+
snapshot(options?: {
|
|
118
|
+
/** If true, the returned values will be reactive signals. */
|
|
119
|
+
reactive?: boolean
|
|
120
|
+
}): T;
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* Enable persistence for the store.
|
|
124
|
+
*/
|
|
125
|
+
persist(storageKey: string, options?: {
|
|
126
|
+
/** The storage implementation (defaults to localStorage). */
|
|
127
|
+
storage?: Storage;
|
|
128
|
+
/** Debounce time in milliseconds for writes. */
|
|
129
|
+
debounce?: number;
|
|
130
|
+
/** Array of keys to exclude from persistence. */
|
|
131
|
+
exclude?: string[];
|
|
132
|
+
}): RoundStore<T>;
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* Action methods defined during store creation.
|
|
136
|
+
*/
|
|
137
|
+
actions: Record<string, Function>;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* Create a shared global state store with actions and optional persistence.
|
|
142
|
+
*/
|
|
143
|
+
export function createStore<T, A extends Record<string, (state: T, ...args: any[]) => Partial<T> | void>>(
|
|
144
|
+
initialState: T,
|
|
145
|
+
actions?: A
|
|
146
|
+
): RoundStore<T> & { [K in keyof A]: (...args: Parameters<A[K]> extends [any, ...infer P] ? P : never) => any };
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* Router API
|
|
150
|
+
*/
|
|
151
|
+
export interface RouteProps {
|
|
152
|
+
/** The path to match. Must start with a forward slash. */
|
|
153
|
+
route?: string;
|
|
154
|
+
/** If true, only matches if the path is exactly the same. */
|
|
155
|
+
exact?: boolean;
|
|
156
|
+
/** Page title to set in the document header when active. */
|
|
157
|
+
title?: string;
|
|
158
|
+
/** Meta description to set in the document header when active. */
|
|
159
|
+
description?: string;
|
|
160
|
+
/** Advanced head configuration including links and meta tags. */
|
|
161
|
+
head?: any;
|
|
162
|
+
/** Fragment or elements to render when matched. */
|
|
163
|
+
children?: any;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
/**
|
|
167
|
+
* Define a route that renders its children when the path matches.
|
|
168
|
+
*/
|
|
169
|
+
export function Route(props: RouteProps): any;
|
|
170
|
+
|
|
171
|
+
/**
|
|
172
|
+
* An alias for Route, typically used for top-level pages.
|
|
173
|
+
*/
|
|
174
|
+
export function Page(props: RouteProps): any;
|
|
175
|
+
|
|
176
|
+
export interface LinkProps {
|
|
177
|
+
/** The destination path. */
|
|
178
|
+
href: string;
|
|
179
|
+
/** Alias for href. */
|
|
180
|
+
to?: string;
|
|
181
|
+
/** Use SPA navigation (prevents full page reloads). Defaults to true. */
|
|
182
|
+
spa?: boolean;
|
|
183
|
+
/** Force a full page reload on navigation. */
|
|
184
|
+
reload?: boolean;
|
|
185
|
+
/** Custom click event handler. */
|
|
186
|
+
onClick?: (e: MouseEvent) => void;
|
|
187
|
+
/** Link content (text or elements). */
|
|
188
|
+
children?: any;
|
|
189
|
+
[key: string]: any;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
/**
|
|
193
|
+
* A standard link component that performs SPA navigation.
|
|
194
|
+
*/
|
|
195
|
+
export function Link(props: LinkProps): any;
|
|
196
|
+
|
|
197
|
+
/**
|
|
198
|
+
* Define a fallback component or content for when no routes match.
|
|
199
|
+
*/
|
|
200
|
+
export function NotFound(props: {
|
|
201
|
+
/** Optional component to render for the 404 state. */
|
|
202
|
+
component?: any;
|
|
203
|
+
/** Fallback content. ignored if 'component' is provided. */
|
|
204
|
+
children?: any
|
|
205
|
+
}): any;
|
|
206
|
+
|
|
207
|
+
/**
|
|
208
|
+
* Navigate to a different path programmatically.
|
|
209
|
+
*/
|
|
210
|
+
export function navigate(to: string, options?: {
|
|
211
|
+
/** If true, replaces the current history entry instead of pushing. */
|
|
212
|
+
replace?: boolean
|
|
213
|
+
}): void;
|
|
214
|
+
|
|
215
|
+
/**
|
|
216
|
+
* Hook to get a reactive function returning the current normalized pathname.
|
|
217
|
+
*/
|
|
218
|
+
export function usePathname(): () => string;
|
|
219
|
+
|
|
220
|
+
/**
|
|
221
|
+
* Get the current normalized pathname.
|
|
222
|
+
*/
|
|
223
|
+
export function getPathname(): string;
|
|
224
|
+
|
|
225
|
+
/**
|
|
226
|
+
* Hook to get a reactive function returning the current location object.
|
|
227
|
+
*/
|
|
228
|
+
export function useLocation(): () => { pathname: string; search: string; hash: string };
|
|
229
|
+
|
|
230
|
+
/**
|
|
231
|
+
* Get the current location object (pathname, search, hash).
|
|
232
|
+
*/
|
|
233
|
+
export function getLocation(): { pathname: string; search: string; hash: string };
|
|
234
|
+
|
|
235
|
+
/**
|
|
236
|
+
* Hook to get a reactive function returning whether the current path has no matches.
|
|
237
|
+
*/
|
|
238
|
+
export function useIsNotFound(): () => boolean;
|
|
239
|
+
|
|
240
|
+
/**
|
|
241
|
+
* Get whether the current path is NOT matched by any defined route.
|
|
242
|
+
*/
|
|
243
|
+
export function getIsNotFound(): boolean;
|
|
244
|
+
|
|
245
|
+
/**
|
|
246
|
+
* DOM & Context API
|
|
247
|
+
*/
|
|
248
|
+
|
|
249
|
+
/**
|
|
250
|
+
* Create a DOM element or instance a component.
|
|
251
|
+
*/
|
|
252
|
+
export function createElement(tag: any, props?: any, ...children: any[]): any;
|
|
253
|
+
|
|
254
|
+
/**
|
|
255
|
+
* A grouping component that returns its children without a wrapper element.
|
|
256
|
+
*/
|
|
257
|
+
export function Fragment(props: { children?: any }): any;
|
|
258
|
+
|
|
259
|
+
export interface Context<T> {
|
|
260
|
+
/** Internal identifier for the context. */
|
|
261
|
+
id: number;
|
|
262
|
+
/** Default value used when no Provider is found in the tree. */
|
|
263
|
+
defaultValue: T;
|
|
264
|
+
/** Component that provides a value to all its descendants. */
|
|
265
|
+
Provider: (props: { value: T; children?: any }) => any;
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
/**
|
|
269
|
+
* Create a new Context object for sharing state between components.
|
|
270
|
+
*/
|
|
271
|
+
export function createContext<T>(defaultValue?: T): Context<T>;
|
|
272
|
+
|
|
273
|
+
/**
|
|
274
|
+
* Read the current value of a context from the component tree.
|
|
275
|
+
*/
|
|
276
|
+
export function readContext<T>(ctx: Context<T>): T;
|
|
277
|
+
|
|
278
|
+
/**
|
|
279
|
+
* Returns a reactive function that reads the current context value.
|
|
280
|
+
*/
|
|
281
|
+
export function bindContext<T>(ctx: Context<T>): () => T;
|
|
282
|
+
|
|
283
|
+
/**
|
|
284
|
+
* Async & Code Splitting
|
|
285
|
+
*/
|
|
286
|
+
|
|
287
|
+
/**
|
|
288
|
+
* Mark a component for lazy loading (code-splitting).
|
|
289
|
+
* Expects a function returning a dynamic import promise.
|
|
290
|
+
*/
|
|
291
|
+
export function lazy<T>(fn: () => Promise<{ default: T }>): T;
|
|
292
|
+
|
|
293
|
+
export interface SuspenseProps {
|
|
294
|
+
/** Content to show while children (e.g. lazy components) are loading. */
|
|
295
|
+
fallback: any;
|
|
296
|
+
/** Content that might trigger a loading state. */
|
|
297
|
+
children?: any;
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
/**
|
|
301
|
+
* Component that boundaries async operations and renders a fallback while loading.
|
|
302
|
+
*/
|
|
303
|
+
export function Suspense(props: SuspenseProps): any;
|
|
304
|
+
|
|
305
|
+
/**
|
|
306
|
+
* Head Management
|
|
307
|
+
*/
|
|
308
|
+
|
|
309
|
+
/**
|
|
310
|
+
* Define static head metadata (titles, meta tags, favicons, etc.).
|
|
311
|
+
*/
|
|
312
|
+
export function startHead(head: any): any;
|
|
313
|
+
|
|
314
|
+
/**
|
|
315
|
+
* Markdown
|
|
316
|
+
*/
|
|
317
|
+
|
|
318
|
+
/**
|
|
319
|
+
* Component that renders Markdown content into HTML.
|
|
320
|
+
*/
|
|
321
|
+
export function Markdown(props: {
|
|
322
|
+
/** The markdown string or a function returning it. */
|
|
323
|
+
content: string | (() => string);
|
|
324
|
+
/** Remark/Rehype configuration options. */
|
|
325
|
+
options?: any
|
|
326
|
+
}): any;
|
package/package.json
CHANGED
package/src/index.d.ts
CHANGED
|
@@ -50,15 +50,28 @@ export interface RoundSignal<T> {
|
|
|
50
50
|
bind?: boolean;
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
+
export interface Signal {
|
|
54
|
+
<T>(initialValue?: T): RoundSignal<T>;
|
|
55
|
+
object<T extends object>(initialState: T): { [K in keyof T]: RoundSignal<T[K]> };
|
|
56
|
+
}
|
|
57
|
+
|
|
53
58
|
/**
|
|
54
59
|
* Creates a reactive signal.
|
|
55
60
|
*/
|
|
56
|
-
export
|
|
61
|
+
export const signal: Signal;
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Creates a bindable signal intended for two-way DOM bindings.
|
|
65
|
+
*/
|
|
66
|
+
export interface Bindable {
|
|
67
|
+
<T>(initialValue?: T): RoundSignal<T>;
|
|
68
|
+
object<T extends object>(initialState: T): { [K in keyof T]: RoundSignal<T[K]> };
|
|
69
|
+
}
|
|
57
70
|
|
|
58
71
|
/**
|
|
59
72
|
* Creates a bindable signal intended for two-way DOM bindings.
|
|
60
73
|
*/
|
|
61
|
-
export
|
|
74
|
+
export const bindable: Bindable;
|
|
62
75
|
|
|
63
76
|
/**
|
|
64
77
|
* Run a function without tracking any signals it reads.
|
|
@@ -288,7 +301,9 @@ export function bindContext<T>(ctx: Context<T>): () => T;
|
|
|
288
301
|
* Mark a component for lazy loading (code-splitting).
|
|
289
302
|
* Expects a function returning a dynamic import promise.
|
|
290
303
|
*/
|
|
291
|
-
export function lazy<T>(fn: () => Promise<{ default: T }>):
|
|
304
|
+
export function lazy<T>(fn: () => Promise<{ default: T } | T>): any;
|
|
305
|
+
|
|
306
|
+
declare module "*.round";
|
|
292
307
|
|
|
293
308
|
export interface SuspenseProps {
|
|
294
309
|
/** Content to show while children (e.g. lazy components) are loading. */
|