Skip to content

Commit 5f82b65

Browse files
feat(core): add non-QRL API aliases
1 parent 3268fab commit 5f82b65

52 files changed

Lines changed: 2139 additions & 300 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.changeset/non-qrl-api-compat.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
'@qwik.dev/core': patch
3+
'@qwik.dev/router': patch
4+
'@qwik.dev/react': patch
5+
---
6+
7+
feat: add non-QRL aliases for callback APIs

e2e/qwik-e2e/apps/e2e/src/components/events/events.tsx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ const EventsParent = component$(() => {
2828
passivePreventDefaultState: 'unset',
2929
passiveDocumentCount: 0,
3030
passiveWindowCount: 0,
31+
qrlNoDollarClickCount: 0,
3132
hoverOrderLog: '',
3233
});
3334
return (
@@ -190,6 +191,15 @@ const EventsParent = component$(() => {
190191
</p>
191192
<p id="count-passive-document">countPassiveDocument: {store.passiveDocumentCount}</p>
192193
<p id="count-passive-window">countPassiveWindow: {store.passiveWindowCount}</p>
194+
<button
195+
id="qrl-no-dollar-click"
196+
onClick={$(() => {
197+
store.qrlNoDollarClickCount++;
198+
})}
199+
>
200+
QRL no-dollar click
201+
</button>
202+
<p id="count-qrl-no-dollar-click">countQrlNoDollarClick: {store.qrlNoDollarClickCount}</p>
193203
<UseOnWindowConditionalRenderIssue3948 />
194204
<UndefinedEventHandler />
195205
<ExecuteAllEventHandlers />

e2e/qwik-e2e/tests/events.e2e.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,15 @@ test.describe('events', () => {
8181
await expect(page.locator('#hover-order-log')).toHaveText('red mouse out|blue mouse in');
8282
});
8383

84+
test('should execute qrl handler passed to no-dollar event', async ({ page }) => {
85+
const button = page.locator('#qrl-no-dollar-click');
86+
const count = page.locator('#count-qrl-no-dollar-click');
87+
88+
await expect(count).toHaveText('countQrlNoDollarClick: 0');
89+
await button.click();
90+
await expect(count).toHaveText('countQrlNoDollarClick: 1');
91+
});
92+
8493
test(`GIVEN "stoppropagation" is set as a attribute
8594
THEN it should stop propagation`, async ({ page }) => {
8695
const stoppedPropagationButton = page.locator('#stop-propagation');

packages/docs/src/routes/api/qwik-router/api.json

Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -394,6 +394,20 @@
394394
"editUrl": "https://github.com/QwikDev/qwik/tree/main/packages/qwik-router/src/runtime/src/types.ts",
395395
"mdFile": "router.getvalidatortype.md"
396396
},
397+
{
398+
"name": "globalAction",
399+
"id": "globalaction",
400+
"hierarchy": [
401+
{
402+
"name": "globalAction",
403+
"id": "globalaction"
404+
}
405+
],
406+
"kind": "Variable",
407+
"content": "```typescript\nglobalAction: ActionConstructor & ActionConstructorQRL\n```",
408+
"editUrl": "https://github.com/QwikDev/qwik/tree/main/packages/qwik-router/src/runtime/src/server-functions.ts",
409+
"mdFile": "router.globalaction.md"
410+
},
397411
{
398412
"name": "globalAction$",
399413
"id": "globalaction_",
@@ -842,6 +856,20 @@
842856
"editUrl": "https://github.com/QwikDev/qwik/tree/main/packages/qwik-router/src/runtime/src/types.ts",
843857
"mdFile": "router.resolveddocumenthead.md"
844858
},
859+
{
860+
"name": "routeAction",
861+
"id": "routeaction",
862+
"hierarchy": [
863+
{
864+
"name": "routeAction",
865+
"id": "routeaction"
866+
}
867+
],
868+
"kind": "Variable",
869+
"content": "```typescript\nrouteAction: ActionConstructor & ActionConstructorQRL\n```",
870+
"editUrl": "https://github.com/QwikDev/qwik/tree/main/packages/qwik-router/src/runtime/src/server-functions.ts",
871+
"mdFile": "router.routeaction.md"
872+
},
845873
{
846874
"name": "routeAction$",
847875
"id": "routeaction_",
@@ -898,6 +926,20 @@
898926
"editUrl": "https://github.com/QwikDev/qwik/tree/main/packages/qwik-router/src/runtime/src/types.ts",
899927
"mdFile": "router.routedata.md"
900928
},
929+
{
930+
"name": "routeLoader",
931+
"id": "routeloader",
932+
"hierarchy": [
933+
{
934+
"name": "routeLoader",
935+
"id": "routeloader"
936+
}
937+
],
938+
"kind": "Variable",
939+
"content": "```typescript\nrouteLoader: LoaderConstructor & LoaderConstructorQRL\n```",
940+
"editUrl": "https://github.com/QwikDev/qwik/tree/main/packages/qwik-router/src/runtime/src/server-functions.ts",
941+
"mdFile": "router.routeloader.md"
942+
},
901943
{
902944
"name": "routeLoader$",
903945
"id": "routeloader_",
@@ -954,6 +996,20 @@
954996
"editUrl": "https://github.com/QwikDev/qwik/tree/main/packages/qwik-router/src/runtime/src/router-outlet-component.tsx",
955997
"mdFile": "router.routeroutlet.md"
956998
},
999+
{
1000+
"name": "server",
1001+
"id": "server",
1002+
"hierarchy": [
1003+
{
1004+
"name": "server",
1005+
"id": "server"
1006+
}
1007+
],
1008+
"kind": "Function",
1009+
"content": "```typescript\nserver: <T extends ServerFunction>(fn: T | QRL<T>, options?: ServerConfig) => ServerQRL<T>\n```\n\n\n<table><thead><tr><th>\n\nParameter\n\n\n</th><th>\n\nType\n\n\n</th><th>\n\nDescription\n\n\n</th></tr></thead>\n<tbody><tr><td>\n\nfn\n\n\n</td><td>\n\nT \\| QRL&lt;T&gt;\n\n\n</td><td>\n\n\n</td></tr>\n<tr><td>\n\noptions\n\n\n</td><td>\n\nServerConfig\n\n\n</td><td>\n\n_(Optional)_\n\n\n</td></tr>\n</tbody></table>\n\n**Returns:**\n\n[ServerQRL](#serverqrl)<!-- -->&lt;T&gt;",
1010+
"editUrl": "https://github.com/QwikDev/qwik/tree/main/packages/qwik-router/src/runtime/src/server-functions.ts",
1011+
"mdFile": "router.server.md"
1012+
},
9571013
{
9581014
"name": "server$",
9591015
"id": "server_",
@@ -1164,6 +1220,20 @@
11641220
"editUrl": "https://github.com/QwikDev/qwik/tree/main/packages/qwik-router/src/runtime/src/use-functions.ts",
11651221
"mdFile": "router.usenavigate.md"
11661222
},
1223+
{
1224+
"name": "usePreventNavigate",
1225+
"id": "usepreventnavigate",
1226+
"hierarchy": [
1227+
{
1228+
"name": "usePreventNavigate",
1229+
"id": "usepreventnavigate"
1230+
}
1231+
],
1232+
"kind": "Function",
1233+
"content": "```typescript\nusePreventNavigate: (fn: PreventNavigateCallback | QRL<PreventNavigateCallback>) => void\n```\n\n\n<table><thead><tr><th>\n\nParameter\n\n\n</th><th>\n\nType\n\n\n</th><th>\n\nDescription\n\n\n</th></tr></thead>\n<tbody><tr><td>\n\nfn\n\n\n</td><td>\n\n[PreventNavigateCallback](#preventnavigatecallback) \\| QRL&lt;[PreventNavigateCallback](#preventnavigatecallback)<!-- -->&gt;\n\n\n</td><td>\n\n\n</td></tr>\n</tbody></table>\n\n**Returns:**\n\nvoid",
1234+
"editUrl": "https://github.com/QwikDev/qwik/tree/main/packages/qwik-router/src/runtime/src/use-functions.ts",
1235+
"mdFile": "router.usepreventnavigate.md"
1236+
},
11671237
{
11681238
"name": "usePreventNavigate$",
11691239
"id": "usepreventnavigate_",
@@ -1192,6 +1262,20 @@
11921262
"editUrl": "https://github.com/QwikDev/qwik/tree/main/packages/qwik-router/src/runtime/src/qwik-router-component.tsx",
11931263
"mdFile": "router.useqwikrouter.md"
11941264
},
1265+
{
1266+
"name": "valibot",
1267+
"id": "valibot",
1268+
"hierarchy": [
1269+
{
1270+
"name": "valibot",
1271+
"id": "valibot"
1272+
}
1273+
],
1274+
"kind": "Variable",
1275+
"content": "> This API is provided as a beta preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.\n> \n\n\n\n```typescript\nvalibot: ValibotConstructor & ValibotConstructorQRL\n```",
1276+
"editUrl": "https://github.com/QwikDev/qwik/tree/main/packages/qwik-router/src/runtime/src/server-functions.ts",
1277+
"mdFile": "router.valibot.md"
1278+
},
11951279
{
11961280
"name": "valibot$",
11971281
"id": "valibot_",
@@ -1206,6 +1290,20 @@
12061290
"editUrl": "https://github.com/QwikDev/qwik/tree/main/packages/qwik-router/src/runtime/src/server-functions.ts",
12071291
"mdFile": "router.valibot_.md"
12081292
},
1293+
{
1294+
"name": "validator",
1295+
"id": "validator",
1296+
"hierarchy": [
1297+
{
1298+
"name": "validator",
1299+
"id": "validator"
1300+
}
1301+
],
1302+
"kind": "Variable",
1303+
"content": "```typescript\nvalidator: ValidatorConstructor & ValidatorConstructorQRL\n```",
1304+
"editUrl": "https://github.com/QwikDev/qwik/tree/main/packages/qwik-router/src/runtime/src/server-functions.ts",
1305+
"mdFile": "router.validator.md"
1306+
},
12091307
{
12101308
"name": "validator$",
12111309
"id": "validator_",
@@ -1262,6 +1360,20 @@
12621360
"editUrl": "https://github.com/QwikDev/qwik/tree/main/packages/qwik-router/src/runtime/src/types.ts",
12631361
"mdFile": "router.validatorreturn.md"
12641362
},
1363+
{
1364+
"name": "zod",
1365+
"id": "zod",
1366+
"hierarchy": [
1367+
{
1368+
"name": "zod",
1369+
"id": "zod"
1370+
}
1371+
],
1372+
"kind": "Variable",
1373+
"content": "```typescript\nzod: ZodConstructor & ZodConstructorQRL\n```",
1374+
"editUrl": "https://github.com/QwikDev/qwik/tree/main/packages/qwik-router/src/runtime/src/server-functions.ts",
1375+
"mdFile": "router.zod.md"
1376+
},
12651377
{
12661378
"name": "zod$",
12671379
"id": "zod_",

0 commit comments

Comments
 (0)