@orieljs/framework 0.1.0-alpha.0 → 0.1.0-alpha.10

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 (85) hide show
  1. package/LICENSE +202 -21
  2. package/NOTICE +16 -0
  3. package/README.md +13 -0
  4. package/TRADEMARKS.md +33 -0
  5. package/dist/chunk-7ZQZYDOC.js +3253 -0
  6. package/dist/chunk-7ZQZYDOC.js.map +1 -0
  7. package/dist/{chunk-P64C7IEP.js → chunk-GVNLZZTN.js} +11 -1
  8. package/dist/chunk-GVNLZZTN.js.map +1 -0
  9. package/dist/chunk-OXAATQA6.js +8433 -0
  10. package/dist/chunk-OXAATQA6.js.map +1 -0
  11. package/dist/chunk-VOYW3R5J.js +478 -0
  12. package/dist/chunk-VOYW3R5J.js.map +1 -0
  13. package/dist/contracts.d.ts +964 -196
  14. package/dist/contracts.js +11 -1
  15. package/dist/index.d-WQpfdIbG.d.ts +630 -0
  16. package/dist/index.d.ts +9398 -682
  17. package/dist/index.js +25374 -894
  18. package/dist/index.js.map +1 -1
  19. package/dist/jsx-runtime-6um4Mwfb.d.ts +300 -0
  20. package/dist/jsx-runtime.d.ts +3 -0
  21. package/dist/jsx-runtime.js +13 -0
  22. package/dist/jsx-runtime.js.map +1 -0
  23. package/dist/testing-CKwfWJGn.d.ts +1586 -0
  24. package/dist/testing.d.ts +3 -0
  25. package/dist/testing.js +113 -0
  26. package/dist/testing.js.map +1 -0
  27. package/docs/authentication.md +487 -0
  28. package/docs/authorization.md +435 -0
  29. package/docs/cache.md +647 -0
  30. package/docs/collections.md +2270 -0
  31. package/docs/configuration.md +334 -0
  32. package/docs/console.md +652 -0
  33. package/docs/container.md +430 -0
  34. package/docs/controllers.md +406 -0
  35. package/docs/csrf.md +126 -0
  36. package/docs/database-testing.md +144 -0
  37. package/docs/database.md +236 -0
  38. package/docs/deployment.md +276 -0
  39. package/docs/eloquent-collections.md +218 -0
  40. package/docs/eloquent-factories.md +255 -0
  41. package/docs/eloquent-mutators.md +254 -0
  42. package/docs/eloquent-observers.md +145 -0
  43. package/docs/eloquent-relationships.md +557 -0
  44. package/docs/eloquent.md +494 -0
  45. package/docs/encryption.md +104 -0
  46. package/docs/errors.md +318 -0
  47. package/docs/events.md +336 -0
  48. package/docs/facades.md +278 -0
  49. package/docs/hashing.md +118 -0
  50. package/docs/helpers.md +1281 -0
  51. package/docs/http-tests.md +386 -0
  52. package/docs/inertia.md +485 -0
  53. package/docs/installation.md +209 -0
  54. package/docs/lifecycle.md +234 -0
  55. package/docs/live-tests.md +226 -0
  56. package/docs/live.md +910 -0
  57. package/docs/logging.md +255 -0
  58. package/docs/mail.md +619 -0
  59. package/docs/middleware.md +384 -0
  60. package/docs/migrations.md +416 -0
  61. package/docs/mocking.md +264 -0
  62. package/docs/navigation.json +273 -0
  63. package/docs/notifications.md +225 -0
  64. package/docs/pagination.md +247 -0
  65. package/docs/passwords.md +207 -0
  66. package/docs/providers.md +187 -0
  67. package/docs/queries.md +600 -0
  68. package/docs/queues.md +330 -0
  69. package/docs/requests.md +533 -0
  70. package/docs/responses.md +444 -0
  71. package/docs/routing.md +738 -0
  72. package/docs/scheduling.md +277 -0
  73. package/docs/seeding.md +122 -0
  74. package/docs/session.md +409 -0
  75. package/docs/starter-kits.md +396 -0
  76. package/docs/storage.md +192 -0
  77. package/docs/structure.md +264 -0
  78. package/docs/testing.md +165 -0
  79. package/docs/time-travel.md +138 -0
  80. package/docs/validation.md +1792 -0
  81. package/docs/verification.md +152 -0
  82. package/docs/views.md +566 -0
  83. package/docs/vite.md +322 -0
  84. package/package.json +68 -10
  85. package/dist/chunk-P64C7IEP.js.map +0 -1
@@ -0,0 +1,300 @@
1
+ import { Htmlable, OrielError, ErrorKind, View as View$1, ViewFactory } from './contracts.js';
2
+ import { F as Facade, S as ServiceProvider } from './index.d-WQpfdIbG.js';
3
+
4
+ /** Marks the objects jsx() returns (Symbol.for, so two copies of the package agree). */
5
+ declare const ELEMENT: unique symbol;
6
+ type Props = Record<string, unknown>;
7
+ /** Anything that can appear as a child: text is escaped, Htmlable is emitted as-is, promises are awaited. */
8
+ type Renderable = OrielElement | string | number | bigint | boolean | null | undefined | Htmlable | Promise<Renderable> | Iterable<Renderable>;
9
+ /** A function component. It may be async: the renderer awaits it. */
10
+ type Component<P = Props> = (props: P) => Renderable | Promise<Renderable>;
11
+ /**
12
+ * `<>…</>` and `<Fragment>`: renders its children only. A symbol at runtime; typed as a component so that
13
+ * `<Fragment>` type-checks as a JSX tag.
14
+ */
15
+ declare const Fragment: (props: {
16
+ children?: Renderable;
17
+ }) => Renderable;
18
+ type ElementType = string | Component<never>;
19
+ /** What `<div />` evaluates to: an inert description, rendered later by renderToString()/renderToStream(). */
20
+ interface OrielElement {
21
+ readonly [ELEMENT]: true;
22
+ readonly type: ElementType;
23
+ readonly props: Props;
24
+ readonly key: string | number | undefined;
25
+ }
26
+ declare function createElement(type: ElementType, props: Props | null | undefined, key?: string | number): OrielElement;
27
+ declare function isElement(value: unknown): value is OrielElement;
28
+
29
+ /** Markup that must not be escaped again (Laravel's Illuminate\Support\HtmlString). */
30
+ declare class HtmlString implements Htmlable {
31
+ private readonly html;
32
+ constructor(html?: string);
33
+ toHtml(): string;
34
+ toString(): string;
35
+ isEmpty(): boolean;
36
+ }
37
+ /** Marks trusted markup so the renderer emits it unescaped: {raw(markdownHtml)}. Never pass user input. */
38
+ declare function raw(html: string): HtmlString;
39
+ declare function isHtmlable(value: unknown): value is Htmlable;
40
+ /** Laravel's e(): htmlspecialchars(ENT_QUOTES, double-encode). Htmlable values pass through; null is ''. */
41
+ declare function e(value: unknown): string;
42
+
43
+ type ClassValue = string | number | null | undefined | false | ClassValue[] | Record<string, unknown>;
44
+ type StyleObject = Record<string, string | number | null | undefined | false>;
45
+ /** `class` accepts strings, arrays and `{ name: condition }` objects, like Blade's @class. */
46
+ declare function classNames(value: ClassValue): string;
47
+ /** `{ marginTop: 4, '--gap': '1rem' }` → `margin-top:4px;--gap:1rem`. */
48
+ declare function styleString(style: StyleObject): string;
49
+
50
+ /** Renders JSX (or any Renderable) to an HTML string. Async components and promises are awaited in order. */
51
+ declare function renderToString(node: Renderable): Promise<string>;
52
+ /** Renders to a UTF-8 byte stream, sending everything rendered so far each time rendering waits on a promise. */
53
+ declare function renderToStream(node: Renderable): ReadableStream<Uint8Array>;
54
+
55
+ /**
56
+ * The `o:` attributes of Live components, typed for TSX: a directive (`o:model`, `o:loading`, …) or an action on a DOM
57
+ * event (`o:click="save"`), with modifiers joined by `-` (`o:model-live`, `o:keydown-enter`). An `o:` name that is
58
+ * neither doesn't compile (`o:clik`, `o:modle`), and the forms listed here are completed by editors and have their
59
+ * values checked. TypeScript doesn't check JSX attribute names that contain a `-` unless the type lists them, so a
60
+ * form that isn't listed (a duration such as `o:model-live-debounce-500ms`, an event's modifiers) is accepted as
61
+ * written, and so is a misspelt one (`o:model-lvie`).
62
+ */
63
+ type ModelTrigger = 'live' | 'blur' | 'change' | 'lazy';
64
+ type ElementChange = 'remove' | 'class' | 'class-remove' | 'attr';
65
+ /**
66
+ * The directives that aren't DOM events, by name: the value each takes (`boolean` for one that can be written bare,
67
+ * `<a o:navigate>`, or from an expression, `o:navigate={external}`: `false` leaves it out) and its modifier forms, the
68
+ * `-`-joined text after the name (`never` for none). A new directive adds a member here, and its name to the Live
69
+ * client's reserved directives.
70
+ */
71
+ interface LiveDirectives {
72
+ /** o:model="title": binds an input to a public property, sent with the next request unless live, blur, change or lazy. */
73
+ model: {
74
+ value: string;
75
+ modifiers: ModelTrigger | 'number' | 'debounce' | 'live-debounce' | `${ModelTrigger}-number`;
76
+ };
77
+ /** o:loading: shown (or changed) while the component's request runs. */
78
+ loading: {
79
+ value: boolean | string;
80
+ modifiers: ElementChange | 'delay' | `delay-${ElementChange}`;
81
+ };
82
+ /** o:target="save,title": the actions or properties o:loading waits for. */
83
+ target: {
84
+ value: string;
85
+ modifiers: never;
86
+ };
87
+ /** o:poll="refresh": calls the method ($refresh without one) every 2.5 s, or every `o:poll-<n>s`. */
88
+ poll: {
89
+ value: boolean | string;
90
+ modifiers: 'keep-alive' | 'visible';
91
+ };
92
+ /** o:navigate on a link: fetches the page and swaps it in; `-hover` prefetches on hover. */
93
+ navigate: {
94
+ value: boolean;
95
+ modifiers: 'hover';
96
+ };
97
+ /** o:offline: shown (or changed) while the browser is offline. */
98
+ offline: {
99
+ value: boolean | string;
100
+ modifiers: ElementChange;
101
+ };
102
+ /** o:key: keeps an element's identity across re-renders. */
103
+ key: {
104
+ value: string | number;
105
+ modifiers: never;
106
+ };
107
+ /** o:confirm="Delete this tag?": asks before the element's action runs; `-prompt` asks for a typed answer. */
108
+ confirm: {
109
+ value: boolean | string;
110
+ modifiers: 'prompt';
111
+ };
112
+ /** o:announce on a status region: an action that leaves the same message announces it again. */
113
+ announce: {
114
+ value: boolean;
115
+ modifiers: never;
116
+ };
117
+ }
118
+ /**
119
+ * The DOM events `o:<event>` runs an action on. A name with a `-` can't be written in TSX (modifiers are `-`
120
+ * segments), and `offline` is the o:offline directive, not the event. An event this list doesn't have (a custom
121
+ * event a component dispatches) is spread: `<div {...{ 'o:saved': 'refresh' }} />`.
122
+ */
123
+ type LiveEvent = 'click' | 'dblclick' | 'auxclick' | 'contextmenu' | 'mousedown' | 'mouseup' | 'mousemove' | 'mouseover' | 'mouseout' | 'mouseenter' | 'mouseleave' | 'wheel' | 'pointerdown' | 'pointerup' | 'pointermove' | 'pointerover' | 'pointerout' | 'pointerenter' | 'pointerleave' | 'pointercancel' | 'gotpointercapture' | 'lostpointercapture' | 'keydown' | 'keyup' | 'keypress' | 'input' | 'beforeinput' | 'change' | 'submit' | 'reset' | 'invalid' | 'select' | 'formdata' | 'search' | 'focus' | 'blur' | 'focusin' | 'focusout' | 'copy' | 'cut' | 'paste' | 'drag' | 'dragstart' | 'dragend' | 'dragenter' | 'dragleave' | 'dragover' | 'drop' | 'touchstart' | 'touchend' | 'touchmove' | 'touchcancel' | 'compositionstart' | 'compositionupdate' | 'compositionend' | 'play' | 'pause' | 'playing' | 'ended' | 'timeupdate' | 'volumechange' | 'ratechange' | 'durationchange' | 'loadstart' | 'loadeddata' | 'loadedmetadata' | 'canplay' | 'canplaythrough' | 'seeking' | 'seeked' | 'waiting' | 'stalled' | 'suspend' | 'emptied' | 'progress' | 'abort' | 'error' | 'load' | 'animationstart' | 'animationend' | 'animationiteration' | 'animationcancel' | 'transitionstart' | 'transitionend' | 'transitionrun' | 'transitioncancel' | 'scroll' | 'scrollend' | 'resize' | 'toggle' | 'beforetoggle' | 'close' | 'cancel' | 'online' | 'popstate' | 'hashchange' | 'beforeunload' | 'pagehide' | 'pageshow' | 'storage' | 'message' | 'visibilitychange' | 'selectionchange' | 'fullscreenchange' | 'slotchange' | 'cuechange';
124
+ /** `o:model`, `o:model-live`, …: each directive and each of its modifier forms, with the directive's value. */
125
+ type LiveDirectiveAttributes = {
126
+ [N in keyof LiveDirectives as `o:${N}` | `o:${N}-${LiveDirectives[N]['modifiers']}`]?: LiveDirectives[N]['value'];
127
+ };
128
+ /** `o:click="save"`: an action (a method, `method(args)`, `$refresh`, `$set(…)`, `$dispatch(…)`) on a DOM event. */
129
+ type LiveEventAttributes = {
130
+ [E in LiveEvent as `o:${E}`]?: string;
131
+ };
132
+ type Letter = 'a' | 'b' | 'c' | 'd' | 'e' | 'f' | 'g' | 'h' | 'i' | 'j' | 'k' | 'l' | 'm' | 'n' | 'o' | 'p' | 'q' | 'r' | 's' | 't' | 'u' | 'v' | 'w' | 'x' | 'y' | 'z';
133
+ type Digit = '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9';
134
+ /**
135
+ * Every other attribute, with any value: each name that doesn't start with `o:` (`o`, `href`, `onclick`, `open`,
136
+ * `xlink:href`, `viewBox`; names with a `-`, such as `data-*`, `aria-*` and `hx-post`, are never checked).
137
+ */
138
+ type OtherAttributes = {
139
+ [K in 'o' | `${Exclude<Letter, 'o'> | Uppercase<Letter> | '_' | '$'}${string}` | `o${Letter | Uppercase<Letter> | Digit | '_' | '.' | '$'}${string}`]?: unknown;
140
+ };
141
+
142
+ /**
143
+ * The automatic JSX runtime (`jsxImportSource: "@orieljs/view"`). jsx() only describes elements; rendering
144
+ * (escaping, async components) happens in renderToString()/renderToStream().
145
+ */
146
+
147
+ declare function jsx(type: ElementType, props: Props | null, key?: string | number): OrielElement;
148
+ /** Same as jsx(); the compiler uses it when there are several static children. */
149
+ declare const jsxs: typeof jsx;
150
+ /**
151
+ * Attributes every intrinsic element accepts. Any attribute is allowed (hx-*, x-*, data-*, …) except an `o:` name
152
+ * that isn't a Live directive or `o:<event>` (directives.ts), so a typo such as `o:clik` doesn't compile. An `o:` form
153
+ * with a `-` that the type doesn't list compiles unchecked (TypeScript doesn't check a hyphenated JSX name the type
154
+ * leaves out), and a custom event name is spread: `<div {...{ 'o:saved': 'refresh' }} />`.
155
+ */
156
+ interface HtmlAttributes extends OtherAttributes, LiveDirectiveAttributes, LiveEventAttributes {
157
+ children?: Renderable;
158
+ class?: ClassValue;
159
+ className?: ClassValue;
160
+ style?: string | StyleObject;
161
+ dangerouslySetInnerHTML?: {
162
+ __html: string;
163
+ };
164
+ }
165
+ declare namespace JSX {
166
+ type Element = OrielElement;
167
+ /** Lets components be async: `async function Posts() { … }` is a valid element type. */
168
+ type ElementType = string | Component<never>;
169
+ interface ElementChildrenAttribute {
170
+ children: unknown;
171
+ }
172
+ interface IntrinsicAttributes {
173
+ key?: string | number;
174
+ }
175
+ interface IntrinsicElements {
176
+ [element: string]: HtmlAttributes;
177
+ }
178
+ }
179
+
180
+ /**
181
+ * Programmer errors (Laravel throws InvalidArgumentException for these). Not an HTTP condition, so kind 'Server':
182
+ * the exception handler reports them and renders a 500 whose message is hidden unless app.debug is on.
183
+ */
184
+ declare class ViewRenderError extends Error implements OrielError {
185
+ readonly name: string;
186
+ readonly kind: ErrorKind;
187
+ readonly status = 500;
188
+ }
189
+ /** Laravel's "View [x] not found." (InvalidArgumentException). */
190
+ declare class ViewNotFoundError extends Error implements OrielError {
191
+ readonly view: string;
192
+ readonly searched: string[];
193
+ readonly name: string;
194
+ readonly kind: ErrorKind;
195
+ readonly status = 500;
196
+ constructor(view: string, searched?: string[]);
197
+ }
198
+ /** A view file that doesn't default-export a component. */
199
+ declare class InvalidViewError extends Error implements OrielError {
200
+ readonly name: string;
201
+ readonly kind: ErrorKind;
202
+ readonly status = 500;
203
+ }
204
+
205
+ /**
206
+ * Laravel's FileViewFinder: 'posts.index' → <location>/posts/index.<ext> for the first location and extension
207
+ * that exist. Found paths are cached; misses are not, so a view created later is found.
208
+ */
209
+ declare class FileViewFinder {
210
+ private readonly extensions;
211
+ static readonly defaultExtensions: string[];
212
+ private readonly locations;
213
+ private readonly hints;
214
+ private readonly views;
215
+ constructor(paths: string[], extensions?: string[]);
216
+ /** The absolute path of the view file. Throws ViewNotFoundError. */
217
+ find(name: string): string;
218
+ addLocation(path: string): void;
219
+ prependLocation(path: string): void;
220
+ /** Views under a namespace: addNamespace('mail', dir) makes 'mail::message' resolve to <dir>/message.tsx. */
221
+ addNamespace(namespace: string, hints: string | string[]): void;
222
+ replaceNamespace(namespace: string, hints: string | string[]): void;
223
+ getPaths(): string[];
224
+ getHints(): Record<string, string[]>;
225
+ /** Forget cached lookups. */
226
+ flush(): void;
227
+ /** [locations to search, relative file stem]. Dots become directories, so '..' can't climb out of a location. */
228
+ private parse;
229
+ }
230
+
231
+ /** What TsxView needs from its factory. */
232
+ interface ViewEnvironment {
233
+ getShared(): Record<string, unknown>;
234
+ callComposer(view: View$1): Promise<void>;
235
+ load(path: string, name: string): Promise<Component>;
236
+ }
237
+ /**
238
+ * One view: its name, file and data. render() runs the composers, imports the file and renders its default
239
+ * export with { ...shared, ...data } as props. toHtml() returns the HTML of the last render().
240
+ */
241
+ declare class TsxView implements View$1 {
242
+ private readonly environment;
243
+ readonly name: string;
244
+ readonly path: string;
245
+ private data;
246
+ private html;
247
+ constructor(environment: ViewEnvironment, name: string, path: string, data?: Record<string, unknown>);
248
+ with(key: string | Record<string, unknown>, value?: unknown): this;
249
+ /** The view's own data (Laravel's getData()). */
250
+ getData(): Record<string, unknown>;
251
+ /** Shared data overlaid with the view's data: exactly the props the component receives. */
252
+ gatherData(): Record<string, unknown>;
253
+ render(): Promise<string>;
254
+ toHtml(): string;
255
+ }
256
+
257
+ type Composer = (view: View$1) => void | Promise<void>;
258
+ /** Laravel's view Factory: finds views by dotted name, shares data app-wide and runs view composers. */
259
+ declare class Factory implements ViewFactory, ViewEnvironment {
260
+ private readonly finder;
261
+ private readonly shared;
262
+ private readonly composers;
263
+ constructor(finder: FileViewFinder);
264
+ /** Throws ViewNotFoundError ("View [x] not found.") when no file matches. */
265
+ make(name: string, data?: Record<string, unknown>): TsxView;
266
+ /** The first view that exists (Laravel's View::first()). */
267
+ first(names: string[], data?: Record<string, unknown>): TsxView;
268
+ exists(name: string): boolean;
269
+ /** App-wide data every view receives as props (view data wins on conflicts). */
270
+ share(key: string | Record<string, unknown>, value?: unknown): void;
271
+ getShared(): Record<string, unknown>;
272
+ /** Runs before matching views render. Patterns use `*` wildcards: 'posts.*', '*'. */
273
+ composer(views: string | string[], composer: Composer): void;
274
+ callComposer(view: View$1): Promise<void>;
275
+ /** Renders TSX, a string, an Htmlable or a View (or promises of them) to HTML, like Laravel's Blade::render(). */
276
+ renderToString(node: unknown): Promise<string>;
277
+ /** Imports the view file (Node's module cache keeps it) and returns its default-export component. */
278
+ load(path: string, name: string): Promise<Component>;
279
+ addLocation(path: string): void;
280
+ addNamespace(namespace: string, hints: string | string[]): this;
281
+ getFinder(): FileViewFinder;
282
+ }
283
+
284
+ /** view() → the ViewFactory; view('posts.index', data) → a View to return from a route or render. */
285
+ declare function view(): ViewFactory;
286
+ declare function view(name: string, data?: Record<string, unknown>): View$1;
287
+ /** Blade's @csrf / csrf_field(): the hidden _token input for the current request's session. */
288
+ declare function csrfField(): HtmlString;
289
+ /** Blade's @method('PUT') / method_field(): spoofs PUT/PATCH/DELETE from an HTML form. */
290
+ declare function methodField(method: string): HtmlString;
291
+
292
+ /** The View facade: View.make(), View.exists(), View.share(), View.composer(), View.first(), View.addNamespace(). */
293
+ declare const View: Facade<Factory, object>;
294
+
295
+ /** Binds the ViewFactory (resources/views by default) and merges the `view` config, like Laravel's config/view.php. */
296
+ declare class ViewServiceProvider extends ServiceProvider {
297
+ register(): void;
298
+ }
299
+
300
+ export { type ClassValue as C, ELEMENT as E, FileViewFinder as F, type HtmlAttributes as H, InvalidViewError as I, JSX as J, type LiveDirectives as L, type OrielElement as O, type Props as P, type Renderable as R, type StyleObject as S, TsxView as T, View as V, Fragment as a, HtmlString as b, type LiveEvent as c, type Component as d, type ViewEnvironment as e, Factory as f, ViewNotFoundError as g, ViewRenderError as h, ViewServiceProvider as i, classNames as j, createElement as k, csrfField as l, e as m, isElement as n, isHtmlable as o, methodField as p, renderToStream as q, raw as r, renderToString as s, styleString as t, jsx as u, view as v, jsxs as w };
@@ -0,0 +1,3 @@
1
+ export { a as Fragment, H as HtmlAttributes, J as JSX, u as jsx, w as jsxs } from './jsx-runtime-6um4Mwfb.js';
2
+ import './contracts.js';
3
+ import './index.d-WQpfdIbG.js';
@@ -0,0 +1,13 @@
1
+ import {
2
+ Fragment,
3
+ jsx,
4
+ jsxs
5
+ } from "./chunk-VOYW3R5J.js";
6
+ import "./chunk-7ZQZYDOC.js";
7
+ import "./chunk-GVNLZZTN.js";
8
+ export {
9
+ Fragment,
10
+ jsx,
11
+ jsxs
12
+ };
13
+ //# sourceMappingURL=jsx-runtime.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}