@orieljs/framework 0.1.0-alpha.5 → 0.1.0-alpha.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/NOTICE +7 -0
- package/README.md +10 -1
- package/TRADEMARKS.md +33 -0
- package/dist/{chunk-WNJP46B7.js → chunk-4MWG3B7G.js} +1785 -626
- package/dist/chunk-4MWG3B7G.js.map +1 -0
- package/dist/chunk-7ZQZYDOC.js +3253 -0
- package/dist/chunk-7ZQZYDOC.js.map +1 -0
- package/dist/{chunk-BSQKOLSK.js → chunk-GVNLZZTN.js} +1 -1
- package/dist/chunk-GVNLZZTN.js.map +1 -0
- package/dist/{chunk-A5XRLEWM.js → chunk-VOYW3R5J.js} +4 -4
- package/dist/chunk-VOYW3R5J.js.map +1 -0
- package/dist/contracts.d.ts +535 -17
- package/dist/contracts.js +1 -1
- package/dist/index.d-WQpfdIbG.d.ts +630 -0
- package/dist/index.d.ts +2202 -5952
- package/dist/index.js +4900 -944
- package/dist/index.js.map +1 -1
- package/dist/{jsx-runtime-WKTl3EEw.d.ts → jsx-runtime-6um4Mwfb.d.ts} +97 -51
- package/dist/jsx-runtime.d.ts +2 -2
- package/dist/jsx-runtime.js +3 -3
- package/dist/{testing-BErengYY.d.ts → testing-CKwfWJGn.d.ts} +313 -994
- package/dist/testing.d.ts +2 -2
- package/dist/testing.js +19 -5
- package/docs/authentication.md +487 -0
- package/docs/authorization.md +435 -0
- package/docs/cache.md +647 -0
- package/docs/collections.md +2270 -0
- package/docs/configuration.md +334 -0
- package/docs/console.md +651 -0
- package/docs/container.md +430 -0
- package/docs/controllers.md +406 -0
- package/docs/csrf.md +126 -0
- package/docs/database-testing.md +144 -0
- package/docs/database.md +236 -0
- package/docs/deployment.md +276 -0
- package/docs/eloquent-collections.md +218 -0
- package/docs/eloquent-factories.md +255 -0
- package/docs/eloquent-mutators.md +254 -0
- package/docs/eloquent-observers.md +145 -0
- package/docs/eloquent-relationships.md +557 -0
- package/docs/eloquent.md +494 -0
- package/docs/encryption.md +104 -0
- package/docs/errors.md +318 -0
- package/docs/events.md +336 -0
- package/docs/facades.md +278 -0
- package/docs/hashing.md +118 -0
- package/docs/helpers.md +1281 -0
- package/docs/http-tests.md +386 -0
- package/docs/inertia.md +485 -0
- package/docs/installation.md +209 -0
- package/docs/lifecycle.md +234 -0
- package/docs/live-tests.md +226 -0
- package/docs/live.md +910 -0
- package/docs/logging.md +255 -0
- package/docs/mail.md +619 -0
- package/docs/middleware.md +384 -0
- package/docs/migrations.md +416 -0
- package/docs/mocking.md +264 -0
- package/docs/navigation.json +273 -0
- package/docs/notifications.md +225 -0
- package/docs/pagination.md +247 -0
- package/docs/passwords.md +207 -0
- package/docs/providers.md +187 -0
- package/docs/queries.md +600 -0
- package/docs/queues.md +330 -0
- package/docs/requests.md +533 -0
- package/docs/responses.md +444 -0
- package/docs/routing.md +738 -0
- package/docs/scheduling.md +277 -0
- package/docs/seeding.md +122 -0
- package/docs/session.md +409 -0
- package/docs/starter-kits.md +396 -0
- package/docs/storage.md +192 -0
- package/docs/structure.md +264 -0
- package/docs/testing.md +165 -0
- package/docs/time-travel.md +138 -0
- package/docs/validation.md +1792 -0
- package/docs/verification.md +152 -0
- package/docs/views.md +566 -0
- package/docs/vite.md +322 -0
- package/package.json +34 -32
- package/dist/chunk-A5XRLEWM.js.map +0 -1
- package/dist/chunk-BSQKOLSK.js.map +0 -1
- package/dist/chunk-PM5YTG57.js +0 -880
- package/dist/chunk-PM5YTG57.js.map +0 -1
- package/dist/chunk-WNJP46B7.js.map +0 -1
- package/dist/index.d-DOlTeG-8.d.ts +0 -99
|
@@ -1,50 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
interface Htmlable {
|
|
5
|
-
toHtml(): string;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
interface View$1 extends Htmlable {
|
|
9
|
-
readonly name: string;
|
|
10
|
-
with(key: string | Record<string, unknown>, value?: unknown): this;
|
|
11
|
-
render(): Promise<string>;
|
|
12
|
-
}
|
|
13
|
-
/** Resolves 'posts.index' → resources/views/posts/index.tsx and renders it to HTML on the server. */
|
|
14
|
-
interface ViewFactory {
|
|
15
|
-
make(name: string, data?: Record<string, unknown>): View$1;
|
|
16
|
-
exists(name: string): boolean;
|
|
17
|
-
share(key: string | Record<string, unknown>, value?: unknown): void;
|
|
18
|
-
composer(views: string | string[], composer: (view: View$1) => void | Promise<void>): void;
|
|
19
|
-
/** Renders TSX (an element, a string, an Htmlable, a View, promises of them) to HTML, like Blade::render(). */
|
|
20
|
-
renderToString(node: unknown): Promise<string>;
|
|
21
|
-
}
|
|
22
|
-
declare const ViewFactory: Token<ViewFactory>;
|
|
23
|
-
|
|
24
|
-
type ErrorKind = 'Http' | 'Server' | 'ModelNotFound' | 'Validation' | 'Authentication' | 'Authorization' | 'TokenMismatch' | 'BindingResolution' | 'CircularDependency' | 'ContainerNotAvailable';
|
|
25
|
-
/** Every error thrown by the framework implements this. The exception handler switches on `kind`. */
|
|
26
|
-
interface OrielError extends Error {
|
|
27
|
-
readonly kind: ErrorKind;
|
|
28
|
-
/** HTTP status the error should render as, when relevant. */
|
|
29
|
-
readonly status?: number;
|
|
30
|
-
readonly headers?: Record<string, string>;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
declare abstract class ServiceProvider implements ServiceProvider$1 {
|
|
34
|
-
protected readonly app: Application;
|
|
35
|
-
constructor(app: Application);
|
|
36
|
-
register(): void;
|
|
37
|
-
boot(): void | Promise<void>;
|
|
38
|
-
/** Package defaults under `key`; values the app already set win (shallow merge, like Laravel). */
|
|
39
|
-
protected mergeConfigFrom(defaults: Record<string, unknown>, key: string): void;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
interface FacadeStatics<T> {
|
|
43
|
-
getFacadeRoot(): T;
|
|
44
|
-
/** Replace the instance in the current container (used by X.fake()). */
|
|
45
|
-
swap(instance: T): void;
|
|
46
|
-
}
|
|
47
|
-
type Facade<T, X = object> = T & X & FacadeStatics<T>;
|
|
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';
|
|
48
3
|
|
|
49
4
|
/** Marks the objects jsx() returns (Symbol.for, so two copies of the package agree). */
|
|
50
5
|
declare const ELEMENT: unique symbol;
|
|
@@ -97,6 +52,93 @@ declare function renderToString(node: Renderable): Promise<string>;
|
|
|
97
52
|
/** Renders to a UTF-8 byte stream, sending everything rendered so far each time rendering waits on a promise. */
|
|
98
53
|
declare function renderToStream(node: Renderable): ReadableStream<Uint8Array>;
|
|
99
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
|
+
|
|
100
142
|
/**
|
|
101
143
|
* The automatic JSX runtime (`jsxImportSource: "@orieljs/view"`). jsx() only describes elements; rendering
|
|
102
144
|
* (escaping, async components) happens in renderToString()/renderToStream().
|
|
@@ -105,8 +147,13 @@ declare function renderToStream(node: Renderable): ReadableStream<Uint8Array>;
|
|
|
105
147
|
declare function jsx(type: ElementType, props: Props | null, key?: string | number): OrielElement;
|
|
106
148
|
/** Same as jsx(); the compiler uses it when there are several static children. */
|
|
107
149
|
declare const jsxs: typeof jsx;
|
|
108
|
-
/**
|
|
109
|
-
|
|
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 {
|
|
110
157
|
children?: Renderable;
|
|
111
158
|
class?: ClassValue;
|
|
112
159
|
className?: ClassValue;
|
|
@@ -114,7 +161,6 @@ interface HtmlAttributes {
|
|
|
114
161
|
dangerouslySetInnerHTML?: {
|
|
115
162
|
__html: string;
|
|
116
163
|
};
|
|
117
|
-
[attribute: string]: unknown;
|
|
118
164
|
}
|
|
119
165
|
declare namespace JSX {
|
|
120
166
|
type Element = OrielElement;
|
|
@@ -251,4 +297,4 @@ declare class ViewServiceProvider extends ServiceProvider {
|
|
|
251
297
|
register(): void;
|
|
252
298
|
}
|
|
253
299
|
|
|
254
|
-
export { type ClassValue as C, ELEMENT as E, FileViewFinder as F, type HtmlAttributes as H, InvalidViewError as I, JSX as J, 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
|
|
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 };
|
package/dist/jsx-runtime.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { a as Fragment, H as HtmlAttributes, J as JSX,
|
|
1
|
+
export { a as Fragment, H as HtmlAttributes, J as JSX, u as jsx, w as jsxs } from './jsx-runtime-6um4Mwfb.js';
|
|
2
2
|
import './contracts.js';
|
|
3
|
-
import './index.d-
|
|
3
|
+
import './index.d-WQpfdIbG.js';
|
package/dist/jsx-runtime.js
CHANGED