streetui 1.7.0 → 1.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin.cjs +1 -1
- package/dist/bin.cjs.map +1 -1
- package/dist/bin.js +1 -1
- package/dist/bin.js.map +1 -1
- package/dist/{compile-Cte0nf06.d.cts → compile-CJJQYi71.d.cts} +137 -2
- package/dist/{compile-Cte0nf06.d.ts → compile-CJJQYi71.d.ts} +137 -2
- package/dist/create-bin.cjs +1 -1
- package/dist/create-bin.cjs.map +1 -1
- package/dist/create-bin.js +1 -1
- package/dist/create-bin.js.map +1 -1
- package/dist/{hydration-diagnostics-zK-fihvd.d.cts → hydration-diagnostics-BQeehq3i.d.cts} +1 -1
- package/dist/{hydration-diagnostics-Ddgs3Puu.d.ts → hydration-diagnostics-DNAJumYF.d.ts} +1 -1
- package/dist/index.cjs +103 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +40 -7
- package/dist/index.d.ts +40 -7
- package/dist/index.js +99 -2
- package/dist/index.js.map +1 -1
- package/dist/{server-D4A8eunr.d.cts → server-CnLEnlYU.d.cts} +1 -1
- package/dist/{server-cgmCiPsz.d.ts → server-DNlg7ou2.d.ts} +1 -1
- package/dist/server.cjs +9 -2
- package/dist/server.cjs.map +1 -1
- package/dist/server.d.cts +2 -2
- package/dist/server.d.ts +2 -2
- package/dist/server.js +9 -2
- package/dist/server.js.map +1 -1
- package/dist/testing.cjs +1088 -2
- package/dist/testing.cjs.map +1 -1
- package/dist/testing.d.cts +63 -4
- package/dist/testing.d.ts +63 -4
- package/dist/testing.js +1082 -2
- package/dist/testing.js.map +1 -1
- package/package.json +1 -1
package/dist/testing.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { S as StreetApp } from './compile-
|
|
2
|
-
export { V as VERSION } from './compile-
|
|
3
|
-
import { R as RenderHandle, H as HydrationDiagnostic } from './hydration-diagnostics-
|
|
1
|
+
import { S as StreetApp, a as ComponentDefinition, b as ContainerBuilder } from './compile-CJJQYi71.cjs';
|
|
2
|
+
export { V as VERSION } from './compile-CJJQYi71.cjs';
|
|
3
|
+
import { R as RenderHandle, H as HydrationDiagnostic } from './hydration-diagnostics-BQeehq3i.cjs';
|
|
4
4
|
export * from 'streetui/diagnostics';
|
|
5
5
|
|
|
6
6
|
/**
|
|
@@ -111,4 +111,63 @@ interface HydrateTestResult {
|
|
|
111
111
|
*/
|
|
112
112
|
declare function renderServerThenHydrate(build: () => StreetApp, options?: HydrateTestOptions): HydrateTestResult;
|
|
113
113
|
|
|
114
|
-
|
|
114
|
+
/**
|
|
115
|
+
* Component-focused testing helpers (§22).
|
|
116
|
+
*
|
|
117
|
+
* These extend `streetui/testing` for the component model. Following the spec's
|
|
118
|
+
* "add only the ones that are actually useful" directive, this module ships the
|
|
119
|
+
* helpers that remove real boilerplate and OMITS the ones that would be
|
|
120
|
+
* misleading in this architecture:
|
|
121
|
+
*
|
|
122
|
+
* • renderComponent — mount a single component in a throwaway host app.
|
|
123
|
+
* • hydrateComponent — SSR-then-hydrate that same host (the §11/§12 seam).
|
|
124
|
+
* • findComponent / findAllComponents / getComponentName — locate component
|
|
125
|
+
* instances by their inspectable `data-streetui-component` name.
|
|
126
|
+
* • trigger — dispatch a bubbling DOM event (click/input/keydown…).
|
|
127
|
+
*
|
|
128
|
+
* Deliberately NOT provided:
|
|
129
|
+
* • getComponentProps — props are passed to `setup` and captured by closure;
|
|
130
|
+
* they are not reified on the node (only the definition *name* is), so a
|
|
131
|
+
* prop-reading helper would either lie or require a private-graph backdoor.
|
|
132
|
+
* Assert on rendered output (or a signal you own) instead.
|
|
133
|
+
* • awaitResource — `waitFor(...)` and `flushUpdates()` already settle
|
|
134
|
+
* async resource state; a resource-specific alias would be redundant.
|
|
135
|
+
*/
|
|
136
|
+
|
|
137
|
+
interface RenderComponentResult extends RenderResult {
|
|
138
|
+
/** The component's root `<div>` wrapper element. */
|
|
139
|
+
readonly component: HTMLElement;
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Build a throwaway single-page host app whose only content is `def` rendered
|
|
143
|
+
* with `props` (and optional `children`), mount it, and return the usual
|
|
144
|
+
* `RenderResult` plus the component's root element. Use for unit-testing one
|
|
145
|
+
* component without hand-writing an app+page wrapper each time.
|
|
146
|
+
*/
|
|
147
|
+
declare function renderComponent<P>(def: ComponentDefinition<P>, props: P, children?: ContainerBuilder): RenderComponentResult;
|
|
148
|
+
/**
|
|
149
|
+
* SSR-render then hydrate a single component in a host app — the production
|
|
150
|
+
* server→client seam (§11/§12). `build` must return `{ def, props, children? }`;
|
|
151
|
+
* it is invoked twice (server then client) with id-counter reset between, so a
|
|
152
|
+
* component that owns per-instance signals lines up positionally on hydration.
|
|
153
|
+
*/
|
|
154
|
+
declare function hydrateComponent<P>(build: () => {
|
|
155
|
+
def: ComponentDefinition<P>;
|
|
156
|
+
props: P;
|
|
157
|
+
children?: ContainerBuilder;
|
|
158
|
+
}, options?: HydrateTestOptions): HydrateTestResult;
|
|
159
|
+
/** All component instances under `container`, optionally filtered by name. */
|
|
160
|
+
declare function findAllComponents(container: Element, name?: string): HTMLElement[];
|
|
161
|
+
/** The single component instance under `container` (throws if none/ambiguous). */
|
|
162
|
+
declare function findComponent(container: Element, name?: string): HTMLElement;
|
|
163
|
+
/** Read a component element's definition name, or `null` if `el` is not one. */
|
|
164
|
+
declare function getComponentName(el: Element): string | null;
|
|
165
|
+
/**
|
|
166
|
+
* Dispatch a bubbling, cancelable DOM event of `type` on `el`. Thin wrapper over
|
|
167
|
+
* `dispatchEvent` so tests read intentfully (`trigger(btn, 'click')`) without
|
|
168
|
+
* constructing `Event`/`KeyboardEvent` objects by hand. Extra `init` fields
|
|
169
|
+
* (e.g. `{ key: 'Escape' }`) are forwarded to the appropriate event ctor.
|
|
170
|
+
*/
|
|
171
|
+
declare function trigger(el: Element, type: string, init?: Record<string, unknown>): void;
|
|
172
|
+
|
|
173
|
+
export { type ByRoleOptions, type HydrateTestOptions, type HydrateTestResult, type RenderComponentResult, type RenderResult, type WaitForOptions, findAllByRole, findAllComponents, findByRole, findByText, findComponent, flushUpdates, getComponentName, hydrateComponent, render, renderComponent, renderOnce, renderServerThenHydrate, trigger, waitFor };
|
package/dist/testing.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { S as StreetApp } from './compile-
|
|
2
|
-
export { V as VERSION } from './compile-
|
|
3
|
-
import { R as RenderHandle, H as HydrationDiagnostic } from './hydration-diagnostics-
|
|
1
|
+
import { S as StreetApp, a as ComponentDefinition, b as ContainerBuilder } from './compile-CJJQYi71.js';
|
|
2
|
+
export { V as VERSION } from './compile-CJJQYi71.js';
|
|
3
|
+
import { R as RenderHandle, H as HydrationDiagnostic } from './hydration-diagnostics-DNAJumYF.js';
|
|
4
4
|
export * from 'streetui/diagnostics';
|
|
5
5
|
|
|
6
6
|
/**
|
|
@@ -111,4 +111,63 @@ interface HydrateTestResult {
|
|
|
111
111
|
*/
|
|
112
112
|
declare function renderServerThenHydrate(build: () => StreetApp, options?: HydrateTestOptions): HydrateTestResult;
|
|
113
113
|
|
|
114
|
-
|
|
114
|
+
/**
|
|
115
|
+
* Component-focused testing helpers (§22).
|
|
116
|
+
*
|
|
117
|
+
* These extend `streetui/testing` for the component model. Following the spec's
|
|
118
|
+
* "add only the ones that are actually useful" directive, this module ships the
|
|
119
|
+
* helpers that remove real boilerplate and OMITS the ones that would be
|
|
120
|
+
* misleading in this architecture:
|
|
121
|
+
*
|
|
122
|
+
* • renderComponent — mount a single component in a throwaway host app.
|
|
123
|
+
* • hydrateComponent — SSR-then-hydrate that same host (the §11/§12 seam).
|
|
124
|
+
* • findComponent / findAllComponents / getComponentName — locate component
|
|
125
|
+
* instances by their inspectable `data-streetui-component` name.
|
|
126
|
+
* • trigger — dispatch a bubbling DOM event (click/input/keydown…).
|
|
127
|
+
*
|
|
128
|
+
* Deliberately NOT provided:
|
|
129
|
+
* • getComponentProps — props are passed to `setup` and captured by closure;
|
|
130
|
+
* they are not reified on the node (only the definition *name* is), so a
|
|
131
|
+
* prop-reading helper would either lie or require a private-graph backdoor.
|
|
132
|
+
* Assert on rendered output (or a signal you own) instead.
|
|
133
|
+
* • awaitResource — `waitFor(...)` and `flushUpdates()` already settle
|
|
134
|
+
* async resource state; a resource-specific alias would be redundant.
|
|
135
|
+
*/
|
|
136
|
+
|
|
137
|
+
interface RenderComponentResult extends RenderResult {
|
|
138
|
+
/** The component's root `<div>` wrapper element. */
|
|
139
|
+
readonly component: HTMLElement;
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Build a throwaway single-page host app whose only content is `def` rendered
|
|
143
|
+
* with `props` (and optional `children`), mount it, and return the usual
|
|
144
|
+
* `RenderResult` plus the component's root element. Use for unit-testing one
|
|
145
|
+
* component without hand-writing an app+page wrapper each time.
|
|
146
|
+
*/
|
|
147
|
+
declare function renderComponent<P>(def: ComponentDefinition<P>, props: P, children?: ContainerBuilder): RenderComponentResult;
|
|
148
|
+
/**
|
|
149
|
+
* SSR-render then hydrate a single component in a host app — the production
|
|
150
|
+
* server→client seam (§11/§12). `build` must return `{ def, props, children? }`;
|
|
151
|
+
* it is invoked twice (server then client) with id-counter reset between, so a
|
|
152
|
+
* component that owns per-instance signals lines up positionally on hydration.
|
|
153
|
+
*/
|
|
154
|
+
declare function hydrateComponent<P>(build: () => {
|
|
155
|
+
def: ComponentDefinition<P>;
|
|
156
|
+
props: P;
|
|
157
|
+
children?: ContainerBuilder;
|
|
158
|
+
}, options?: HydrateTestOptions): HydrateTestResult;
|
|
159
|
+
/** All component instances under `container`, optionally filtered by name. */
|
|
160
|
+
declare function findAllComponents(container: Element, name?: string): HTMLElement[];
|
|
161
|
+
/** The single component instance under `container` (throws if none/ambiguous). */
|
|
162
|
+
declare function findComponent(container: Element, name?: string): HTMLElement;
|
|
163
|
+
/** Read a component element's definition name, or `null` if `el` is not one. */
|
|
164
|
+
declare function getComponentName(el: Element): string | null;
|
|
165
|
+
/**
|
|
166
|
+
* Dispatch a bubbling, cancelable DOM event of `type` on `el`. Thin wrapper over
|
|
167
|
+
* `dispatchEvent` so tests read intentfully (`trigger(btn, 'click')`) without
|
|
168
|
+
* constructing `Event`/`KeyboardEvent` objects by hand. Extra `init` fields
|
|
169
|
+
* (e.g. `{ key: 'Escape' }`) are forwarded to the appropriate event ctor.
|
|
170
|
+
*/
|
|
171
|
+
declare function trigger(el: Element, type: string, init?: Record<string, unknown>): void;
|
|
172
|
+
|
|
173
|
+
export { type ByRoleOptions, type HydrateTestOptions, type HydrateTestResult, type RenderComponentResult, type RenderResult, type WaitForOptions, findAllByRole, findAllComponents, findByRole, findByText, findComponent, flushUpdates, getComponentName, hydrateComponent, render, renderComponent, renderOnce, renderServerThenHydrate, trigger, waitFor };
|