@blazetrails/turbo 0.0.0-stage → 0.1.0-alpha0.2
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/.trails/views/layouts/turbo_rails/frame.html.tse.js +39 -0
- package/.trails/views/layouts/turbo_rails/frame.html.tse.js.map +1 -0
- package/LICENSE +21 -0
- package/dist/.trails/views/layouts/turbo_rails/frame.html.tse.js +39 -0
- package/dist/.trails/views/layouts/turbo_rails/frame.html.tse.js.map +1 -0
- package/dist/app/channels/turbo/streams/broadcasts.js +150 -0
- package/dist/app/channels/turbo/streams/broadcasts.js.map +1 -0
- package/dist/app/channels/turbo/streams/stream-name.js +29 -0
- package/dist/app/channels/turbo/streams/stream-name.js.map +1 -0
- package/dist/app/channels/turbo/streams-channel.js +24 -0
- package/dist/app/channels/turbo/streams-channel.js.map +1 -0
- package/dist/app/controllers/concerns/turbo/request-id-tracking.js +14 -0
- package/dist/app/controllers/concerns/turbo/request-id-tracking.js.map +1 -0
- package/dist/app/controllers/turbo/frames/frame-request.js +24 -0
- package/dist/app/controllers/turbo/frames/frame-request.js.map +1 -0
- package/dist/app/controllers/turbo/native/navigation-controller.js +15 -0
- package/dist/app/controllers/turbo/native/navigation-controller.js.map +1 -0
- package/dist/app/controllers/turbo/native/navigation.js +49 -0
- package/dist/app/controllers/turbo/native/navigation.js.map +1 -0
- package/dist/app/controllers/turbo/streams/turbo-streams-tag-builder.js +10 -0
- package/dist/app/controllers/turbo/streams/turbo-streams-tag-builder.js.map +1 -0
- package/dist/app/helpers/turbo/drive-helper.js +38 -0
- package/dist/app/helpers/turbo/drive-helper.js.map +1 -0
- package/dist/app/helpers/turbo/frames-helper.js +20 -0
- package/dist/app/helpers/turbo/frames-helper.js.map +1 -0
- package/dist/app/helpers/turbo/includes-helper.js +8 -0
- package/dist/app/helpers/turbo/includes-helper.js.map +1 -0
- package/dist/app/helpers/turbo/streams/action-helper.js +42 -0
- package/dist/app/helpers/turbo/streams/action-helper.js.map +1 -0
- package/dist/app/helpers/turbo/streams-helper.js +23 -0
- package/dist/app/helpers/turbo/streams-helper.js.map +1 -0
- package/dist/app/jobs/turbo/streams/action-broadcast-job.js +14 -0
- package/dist/app/jobs/turbo/streams/action-broadcast-job.js.map +1 -0
- package/dist/app/jobs/turbo/streams/broadcast-job.js +14 -0
- package/dist/app/jobs/turbo/streams/broadcast-job.js.map +1 -0
- package/dist/app/jobs/turbo/streams/broadcast-stream-job.js +14 -0
- package/dist/app/jobs/turbo/streams/broadcast-stream-job.js.map +1 -0
- package/dist/app/models/concerns/turbo/broadcastable.js +291 -0
- package/dist/app/models/concerns/turbo/broadcastable.js.map +1 -0
- package/dist/app/models/turbo/debouncer.js +29 -0
- package/dist/app/models/turbo/debouncer.js.map +1 -0
- package/dist/app/models/turbo/immediate-debouncer.js +14 -0
- package/dist/app/models/turbo/immediate-debouncer.js.map +1 -0
- package/dist/app/models/turbo/streams/tag-builder.js +126 -0
- package/dist/app/models/turbo/streams/tag-builder.js.map +1 -0
- package/dist/app/models/turbo/thread-debouncer.js +39 -0
- package/dist/app/models/turbo/thread-debouncer.js.map +1 -0
- package/dist/app/views/layouts/turbo_rails/frame.html.tse +9 -0
- package/dist/broadcastable/test-helper.js +45 -0
- package/dist/broadcastable/test-helper.js.map +1 -0
- package/dist/config/routes.js +19 -0
- package/dist/config/routes.js.map +1 -0
- package/dist/constants.action-broadcast-job.generated.js +4 -0
- package/dist/constants.action-broadcast-job.generated.js.map +1 -0
- package/dist/constants.broadcast-job.generated.js +4 -0
- package/dist/constants.broadcast-job.generated.js.map +1 -0
- package/dist/constants.broadcast-stream-job.generated.js +4 -0
- package/dist/constants.broadcast-stream-job.generated.js.map +1 -0
- package/dist/constants.streams-channel.generated.js +4 -0
- package/dist/constants.streams-channel.generated.js.map +1 -0
- package/dist/engine.js +169 -0
- package/dist/engine.js.map +1 -0
- package/dist/install/turbo-with-bun.js +18 -0
- package/dist/install/turbo-with-bun.js.map +1 -0
- package/dist/install/turbo-with-node.js +19 -0
- package/dist/install/turbo-with-node.js.map +1 -0
- package/dist/system-test-helper.js +147 -0
- package/dist/system-test-helper.js.map +1 -0
- package/dist/tasks/turbo-tasks.js +39 -0
- package/dist/tasks/turbo-tasks.js.map +1 -0
- package/dist/test-assertions/integration-test-assertions.js +17 -0
- package/dist/test-assertions/integration-test-assertions.js.map +1 -0
- package/dist/test-assertions.js +49 -0
- package/dist/test-assertions.js.map +1 -0
- package/dist/turbo-trails.js +56 -0
- package/dist/turbo-trails.js.map +1 -0
- package/dist/types/app/channels/turbo/streams/broadcasts.d.ts +47 -0
- package/dist/types/app/channels/turbo/streams/stream-name.d.ts +20 -0
- package/dist/types/app/channels/turbo/streams-channel.d.ts +33 -0
- package/dist/types/app/controllers/concerns/turbo/request-id-tracking.d.ts +13 -0
- package/dist/types/app/controllers/turbo/frames/frame-request.d.ts +17 -0
- package/dist/types/app/controllers/turbo/native/navigation-controller.d.ts +7 -0
- package/dist/types/app/controllers/turbo/native/navigation.d.ts +31 -0
- package/dist/types/app/controllers/turbo/streams/turbo-streams-tag-builder.d.ts +6 -0
- package/dist/types/app/helpers/turbo/drive-helper.d.ts +28 -0
- package/dist/types/app/helpers/turbo/frames-helper.d.ts +14 -0
- package/dist/types/app/helpers/turbo/includes-helper.d.ts +9 -0
- package/dist/types/app/helpers/turbo/streams/action-helper.d.ts +22 -0
- package/dist/types/app/helpers/turbo/streams-helper.d.ts +14 -0
- package/dist/types/app/jobs/turbo/streams/action-broadcast-job.d.ts +6 -0
- package/dist/types/app/jobs/turbo/streams/broadcast-job.d.ts +6 -0
- package/dist/types/app/jobs/turbo/streams/broadcast-stream-job.d.ts +8 -0
- package/dist/types/app/models/concerns/turbo/broadcastable.d.ts +105 -0
- package/dist/types/app/models/turbo/debouncer.d.ts +16 -0
- package/dist/types/app/models/turbo/immediate-debouncer.d.ts +9 -0
- package/dist/types/app/models/turbo/streams/tag-builder.d.ts +39 -0
- package/dist/types/app/models/turbo/thread-debouncer.d.ts +29 -0
- package/dist/types/broadcastable/test-helper.d.ts +18 -0
- package/dist/types/config/routes.d.ts +2 -0
- package/dist/types/constants.action-broadcast-job.generated.d.ts +2 -0
- package/dist/types/constants.broadcast-job.generated.d.ts +2 -0
- package/dist/types/constants.broadcast-stream-job.generated.d.ts +2 -0
- package/dist/types/constants.streams-channel.generated.d.ts +2 -0
- package/dist/types/engine.d.ts +54 -0
- package/dist/types/install/turbo-with-bun.d.ts +7 -0
- package/dist/types/install/turbo-with-node.d.ts +8 -0
- package/dist/types/system-test-helper.d.ts +39 -0
- package/dist/types/tasks/turbo-tasks.d.ts +5 -0
- package/dist/types/test-assertions/integration-test-assertions.d.ts +21 -0
- package/dist/types/test-assertions.d.ts +27 -0
- package/dist/types/turbo-trails.d.ts +76 -0
- package/package.json +68 -3
- package/README.md +0 -3
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { hashAref as __hashAref, keys as __keys } from "@blazetrails/ruby-compat";
|
|
2
|
+
import { TopLevel } from "@blazetrails/actionview";
|
|
3
|
+
export default async function render(context, locals, __block) {
|
|
4
|
+
void context;
|
|
5
|
+
void locals;
|
|
6
|
+
const localAssigns = locals;
|
|
7
|
+
void localAssigns;
|
|
8
|
+
const __view = context;
|
|
9
|
+
context = Object.create(__view, { yield: { value: (...name) => (name.length > 0 ? __block(...name) : __block !== undefined ? __block() : Reflect.get(__view, "yield")) } });
|
|
10
|
+
const _ob = context.outputBuffer;
|
|
11
|
+
const __own = Object.create(null);
|
|
12
|
+
const __lookup = (name, guarded = false) => { for (const scope of [...[locals, this, TopLevel], __own, globalThis])
|
|
13
|
+
if (scope === localAssigns ? __keys(localAssigns).includes(name) : name in scope) {
|
|
14
|
+
const value = scope === localAssigns ? __hashAref(localAssigns, name) : Reflect.get(scope, name);
|
|
15
|
+
return scope === this && typeof value === "function" ? value.bind(this) : value;
|
|
16
|
+
} if (guarded)
|
|
17
|
+
return undefined; const error = new ReferenceError(name + " is not defined"); Error.captureStackTrace?.(error, __lookup); throw error; };
|
|
18
|
+
const __assign = (name, value) => { for (const scope of [locals, this, TopLevel])
|
|
19
|
+
if (name in scope) {
|
|
20
|
+
Reflect.set(scope, name, value);
|
|
21
|
+
return value;
|
|
22
|
+
} __own[name] = value; return value; };
|
|
23
|
+
void __assign;
|
|
24
|
+
const __sink = new Proxy({}, { set: (_target, name, value) => (__assign(name, value), true) });
|
|
25
|
+
void __sink;
|
|
26
|
+
if (__view.annotateRenderedViewWithFilenames)
|
|
27
|
+
_ob.safeAppend("<!-- BEGIN /home/runner/work/trails/trails/packages/turbo/app/views/layouts/turbo_rails/frame.html.tse -->");
|
|
28
|
+
_ob.safeAppend("<html>\n <head>\n ");
|
|
29
|
+
_ob.append(await (__lookup("csrfMetaTags")()));
|
|
30
|
+
_ob.safeAppend("\n ");
|
|
31
|
+
_ob.append(await (context.yield("head")));
|
|
32
|
+
_ob.safeAppend("\n </head>\n <body>\n ");
|
|
33
|
+
_ob.append(await (context.yield()));
|
|
34
|
+
_ob.safeAppend("\n </body>\n</html>\n");
|
|
35
|
+
if (__view.annotateRenderedViewWithFilenames)
|
|
36
|
+
_ob.safeAppend("<!-- END /home/runner/work/trails/trails/packages/turbo/app/views/layouts/turbo_rails/frame.html.tse -->");
|
|
37
|
+
return _ob;
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=frame.html.tse.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"frame.html.tse.js","sourceRoot":"","sources":["../../../../app/views/layouts/turbo_rails/frame.html.tse"],"sourcesContent":["<html>\n <head>\n <%= csrfMetaTags() %>\n <%= yield(\"head\") %>\n </head>\n <body>\n <%= yield %>\n </body>\n</html>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;IAAE,GAAG,CAAC,UAAU,CAAC,wBAAwB,CAAC,CAAC;IAEnC,GAAA,CAAA,MAAA,CAAA,MAAA,CAAA,wBAAY,EAAE,CAAC,CAAC,CAAC;IAAvB,GAAG,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC;IACb,GAAA,CAAA,MAAA,CAAA,MAAA,CAAA,OAAA,CAAA,KAAA,CAAA,MAAM,CAAC,CAAC,CAAC,CAAC;IAAtB,GAAG,CAAC,UAAU,CAAC,6BAA6B,CAAC,CAAC;IAGxC,GAAA,CAAA,MAAA,CAAA,MAAA,CAAA,OAAO,CAAC,KAAH,EAAE,CAAC,CAAC,CAAC;IAAhB,GAAG,CAAC,UAAU,CAAC,wBAAwB,CAAC,CAAC"}
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Dean Marano and Trails contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
|
13
|
+
all copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { hashAref as __hashAref, keys as __keys } from "@blazetrails/ruby-compat";
|
|
2
|
+
import { TopLevel } from "@blazetrails/actionview";
|
|
3
|
+
export default async function render(context, locals, __block) {
|
|
4
|
+
void context;
|
|
5
|
+
void locals;
|
|
6
|
+
const localAssigns = locals;
|
|
7
|
+
void localAssigns;
|
|
8
|
+
const __view = context;
|
|
9
|
+
context = Object.create(__view, { yield: { value: (...name) => (name.length > 0 ? __block(...name) : __block !== undefined ? __block() : Reflect.get(__view, "yield")) } });
|
|
10
|
+
const _ob = context.outputBuffer;
|
|
11
|
+
const __own = Object.create(null);
|
|
12
|
+
const __lookup = (name, guarded = false) => { for (const scope of [...[locals, this, TopLevel], __own, globalThis])
|
|
13
|
+
if (scope === localAssigns ? __keys(localAssigns).includes(name) : name in scope) {
|
|
14
|
+
const value = scope === localAssigns ? __hashAref(localAssigns, name) : Reflect.get(scope, name);
|
|
15
|
+
return scope === this && typeof value === "function" ? value.bind(this) : value;
|
|
16
|
+
} if (guarded)
|
|
17
|
+
return undefined; const error = new ReferenceError(name + " is not defined"); Error.captureStackTrace?.(error, __lookup); throw error; };
|
|
18
|
+
const __assign = (name, value) => { for (const scope of [locals, this, TopLevel])
|
|
19
|
+
if (name in scope) {
|
|
20
|
+
Reflect.set(scope, name, value);
|
|
21
|
+
return value;
|
|
22
|
+
} __own[name] = value; return value; };
|
|
23
|
+
void __assign;
|
|
24
|
+
const __sink = new Proxy({}, { set: (_target, name, value) => (__assign(name, value), true) });
|
|
25
|
+
void __sink;
|
|
26
|
+
if (__view.annotateRenderedViewWithFilenames)
|
|
27
|
+
_ob.safeAppend("<!-- BEGIN /home/runner/work/trails/trails/packages/turbo/dist/app/views/layouts/turbo_rails/frame.html.tse -->");
|
|
28
|
+
_ob.safeAppend("<html>\n <head>\n ");
|
|
29
|
+
_ob.append(await (__lookup("csrfMetaTags")()));
|
|
30
|
+
_ob.safeAppend("\n ");
|
|
31
|
+
_ob.append(await (context.yield("head")));
|
|
32
|
+
_ob.safeAppend("\n </head>\n <body>\n ");
|
|
33
|
+
_ob.append(await (context.yield()));
|
|
34
|
+
_ob.safeAppend("\n </body>\n</html>\n");
|
|
35
|
+
if (__view.annotateRenderedViewWithFilenames)
|
|
36
|
+
_ob.safeAppend("<!-- END /home/runner/work/trails/trails/packages/turbo/dist/app/views/layouts/turbo_rails/frame.html.tse -->");
|
|
37
|
+
return _ob;
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=frame.html.tse.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"frame.html.tse.js","sourceRoot":"","sources":["../../../../app/views/layouts/turbo_rails/frame.html.tse"],"sourcesContent":["<html>\n <head>\n <%= csrfMetaTags() %>\n <%= yield(\"head\") %>\n </head>\n <body>\n <%= yield %>\n </body>\n</html>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;IAAE,GAAG,CAAC,UAAU,CAAC,wBAAwB,CAAC,CAAC;IAEnC,GAAA,CAAA,MAAA,CAAA,MAAA,CAAA,wBAAY,EAAE,CAAC,CAAC,CAAC;IAAvB,GAAG,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC;IACb,GAAA,CAAA,MAAA,CAAA,MAAA,CAAA,OAAA,CAAA,KAAA,CAAA,MAAM,CAAC,CAAC,CAAC,CAAC;IAAtB,GAAG,CAAC,UAAU,CAAC,6BAA6B,CAAC,CAAC;IAGxC,GAAA,CAAA,MAAA,CAAA,MAAA,CAAA,OAAO,CAAC,KAAH,EAAE,CAAC,CAAC,CAAC;IAAhB,GAAG,CAAC,UAAU,CAAC,wBAAwB,CAAC,CAAC"}
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
import { ActionCable } from "@blazetrails/actioncable";
|
|
2
|
+
import { compactBlank, extractOptionsBang, isPresent, } from "@blazetrails/activesupport";
|
|
3
|
+
import { TopLevel, constGet, include } from "@blazetrails/ruby-compat";
|
|
4
|
+
import { Turbo } from "../../../../turbo-trails.js";
|
|
5
|
+
import { ActionHelper } from "../../../helpers/turbo/streams/action-helper.js";
|
|
6
|
+
import { ThreadDebouncer } from "../../../models/turbo/thread-debouncer.js";
|
|
7
|
+
export const Broadcasts = {
|
|
8
|
+
broadcastRemoveTo(...streamables) {
|
|
9
|
+
const opts = extractOptionsBang(streamables);
|
|
10
|
+
return this.broadcastActionTo(...streamables, { action: "remove", render: false, ...opts });
|
|
11
|
+
},
|
|
12
|
+
broadcastReplaceTo(...streamables) {
|
|
13
|
+
const opts = extractOptionsBang(streamables);
|
|
14
|
+
return this.broadcastActionTo(...streamables, { action: "replace", ...opts });
|
|
15
|
+
},
|
|
16
|
+
broadcastUpdateTo(...streamables) {
|
|
17
|
+
const opts = extractOptionsBang(streamables);
|
|
18
|
+
return this.broadcastActionTo(...streamables, { action: "update", ...opts });
|
|
19
|
+
},
|
|
20
|
+
broadcastBeforeTo(...streamables) {
|
|
21
|
+
const opts = extractOptionsBang(streamables);
|
|
22
|
+
return this.broadcastActionTo(...streamables, { action: "before", ...opts });
|
|
23
|
+
},
|
|
24
|
+
broadcastAfterTo(...streamables) {
|
|
25
|
+
const opts = extractOptionsBang(streamables);
|
|
26
|
+
return this.broadcastActionTo(...streamables, { action: "after", ...opts });
|
|
27
|
+
},
|
|
28
|
+
broadcastAppendTo(...streamables) {
|
|
29
|
+
const opts = extractOptionsBang(streamables);
|
|
30
|
+
return this.broadcastActionTo(...streamables, { action: "append", ...opts });
|
|
31
|
+
},
|
|
32
|
+
broadcastPrependTo(...streamables) {
|
|
33
|
+
const opts = extractOptionsBang(streamables);
|
|
34
|
+
return this.broadcastActionTo(...streamables, { action: "prepend", ...opts });
|
|
35
|
+
},
|
|
36
|
+
broadcastRefreshTo(...streamables) {
|
|
37
|
+
const attributes = extractOptionsBang(streamables);
|
|
38
|
+
return this.broadcastStreamTo(...streamables, {
|
|
39
|
+
content: this.turboStreamRefreshTag(attributes),
|
|
40
|
+
});
|
|
41
|
+
},
|
|
42
|
+
async broadcastActionTo(...streamables) {
|
|
43
|
+
const { action, target = null, targets = null, attributes = {}, ...rendering } = extractOptionsBang(streamables);
|
|
44
|
+
return await this.broadcastStreamTo(...streamables, {
|
|
45
|
+
content: this.turboStreamActionTag(action, {
|
|
46
|
+
target,
|
|
47
|
+
targets,
|
|
48
|
+
template: await this.renderBroadcastAction(rendering),
|
|
49
|
+
...attributes,
|
|
50
|
+
}),
|
|
51
|
+
});
|
|
52
|
+
},
|
|
53
|
+
broadcastReplaceLaterTo(...streamables) {
|
|
54
|
+
const opts = extractOptionsBang(streamables);
|
|
55
|
+
return this.broadcastActionLaterTo(...streamables, { action: "replace", ...opts });
|
|
56
|
+
},
|
|
57
|
+
broadcastUpdateLaterTo(...streamables) {
|
|
58
|
+
const opts = extractOptionsBang(streamables);
|
|
59
|
+
return this.broadcastActionLaterTo(...streamables, { action: "update", ...opts });
|
|
60
|
+
},
|
|
61
|
+
broadcastBeforeLaterTo(...streamables) {
|
|
62
|
+
const opts = extractOptionsBang(streamables);
|
|
63
|
+
return this.broadcastActionLaterTo(...streamables, { action: "before", ...opts });
|
|
64
|
+
},
|
|
65
|
+
broadcastAfterLaterTo(...streamables) {
|
|
66
|
+
const opts = extractOptionsBang(streamables);
|
|
67
|
+
return this.broadcastActionLaterTo(...streamables, { action: "after", ...opts });
|
|
68
|
+
},
|
|
69
|
+
broadcastAppendLaterTo(...streamables) {
|
|
70
|
+
const opts = extractOptionsBang(streamables);
|
|
71
|
+
return this.broadcastActionLaterTo(...streamables, { action: "append", ...opts });
|
|
72
|
+
},
|
|
73
|
+
broadcastPrependLaterTo(...streamables) {
|
|
74
|
+
const opts = extractOptionsBang(streamables);
|
|
75
|
+
return this.broadcastActionLaterTo(...streamables, { action: "prepend", ...opts });
|
|
76
|
+
},
|
|
77
|
+
broadcastRefreshLaterTo(...streamables) {
|
|
78
|
+
const { requestId = Turbo.currentRequestId, ...opts } = extractOptionsBang(streamables);
|
|
79
|
+
const streamName = this.streamNameFrom(streamables);
|
|
80
|
+
return this.refreshDebouncerFor(...streamables, { requestId }).debounce(() => Turbo.Streams.BroadcastStreamJob.performLater(streamName, {
|
|
81
|
+
content: this.turboStreamRefreshTag({ requestId, ...opts }).toStr(),
|
|
82
|
+
}));
|
|
83
|
+
},
|
|
84
|
+
async broadcastActionLaterTo(...streamables) {
|
|
85
|
+
const { action, attributes = {}, ...rendering } = extractOptionsBang(streamables);
|
|
86
|
+
let { target = null, targets = null } = rendering;
|
|
87
|
+
delete rendering.target;
|
|
88
|
+
delete rendering.targets;
|
|
89
|
+
streamables = compactBlank(streamables.flat(Infinity));
|
|
90
|
+
if (isPresent(streamables)) {
|
|
91
|
+
target = this.convertToTurboStreamDomId(target);
|
|
92
|
+
targets = this.convertToTurboStreamDomId(targets, { includeSelector: true });
|
|
93
|
+
return await Turbo.Streams.ActionBroadcastJob.performLater(this.streamNameFrom(streamables), {
|
|
94
|
+
action,
|
|
95
|
+
target,
|
|
96
|
+
targets,
|
|
97
|
+
attributes,
|
|
98
|
+
...rendering,
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
return null;
|
|
102
|
+
},
|
|
103
|
+
async broadcastRenderTo(...streamables) {
|
|
104
|
+
const rendering = extractOptionsBang(streamables);
|
|
105
|
+
return await this.broadcastStreamTo(...streamables, {
|
|
106
|
+
content: await this.renderFormat(":turbo_stream", rendering),
|
|
107
|
+
});
|
|
108
|
+
},
|
|
109
|
+
broadcastRenderLaterTo(...streamables) {
|
|
110
|
+
const rendering = extractOptionsBang(streamables);
|
|
111
|
+
return Turbo.Streams.BroadcastJob.performLater(this.streamNameFrom(streamables), rendering);
|
|
112
|
+
},
|
|
113
|
+
async broadcastStreamTo(...streamables) {
|
|
114
|
+
const { content } = extractOptionsBang(streamables);
|
|
115
|
+
streamables = compactBlank(streamables.flat(Infinity));
|
|
116
|
+
if (isPresent(streamables)) {
|
|
117
|
+
return await ActionCable.server().broadcast(this.streamNameFrom(streamables), content);
|
|
118
|
+
}
|
|
119
|
+
return null;
|
|
120
|
+
},
|
|
121
|
+
/** @internal */
|
|
122
|
+
refreshDebouncerFor(...streamables) {
|
|
123
|
+
const { requestId = null } = extractOptionsBang(streamables);
|
|
124
|
+
return ThreadDebouncer.for(`turbo-refresh-debouncer-${this.streamNameFrom([...streamables, requestId])}`);
|
|
125
|
+
},
|
|
126
|
+
/** @internal */
|
|
127
|
+
renderFormat(format, rendering = {}) {
|
|
128
|
+
return constGet(TopLevel, "ApplicationController").render({
|
|
129
|
+
formats: [format],
|
|
130
|
+
...rendering,
|
|
131
|
+
});
|
|
132
|
+
},
|
|
133
|
+
/** @internal */
|
|
134
|
+
async renderBroadcastAction(rendering) {
|
|
135
|
+
const { content = null, html = null, render = null, ...rest } = rendering;
|
|
136
|
+
if (render === false) {
|
|
137
|
+
return null;
|
|
138
|
+
}
|
|
139
|
+
else {
|
|
140
|
+
if (content != null && content !== false)
|
|
141
|
+
return content;
|
|
142
|
+
if (html != null && html !== false)
|
|
143
|
+
return html;
|
|
144
|
+
return isPresent(rest) ? await this.renderFormat(":html", rest) : null;
|
|
145
|
+
}
|
|
146
|
+
},
|
|
147
|
+
};
|
|
148
|
+
include(Broadcasts, ActionHelper);
|
|
149
|
+
Turbo.Streams.Broadcasts = Broadcasts;
|
|
150
|
+
//# sourceMappingURL=broadcasts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"broadcasts.js","sourceRoot":"","sources":["../../../../../lib/app/channels/turbo/streams/broadcasts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAEvD,OAAO,EACL,YAAY,EACZ,kBAAkB,EAClB,SAAS,GAEV,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAC;AACvE,OAAO,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,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G,CACxB,2BAA2B,IAAI,CAAC,cAAc,CAAC,CAAC,GAAG,WAAW,EAAE,SAAS,CAAC,CAAC,EAAE,CAC9E,CAAC;IACJ,CAAC;IAED,gBAAgB;IAChB,YAAY,CAAC,MAAc,EAAE,SAAS,GAAY,EAAE;QAClD,OAAQ,QAAQ,CAAC,QAAQ,EAAE,uBAAuB,CAAkC,CAAC,MAAM,CAAC;YAC1F,OAAO,EAAE,CAAC,MAAM,CAAC;YACjB,GAAG,SAAS;SACb,CAAC,CAAC;IACL,CAAC;IAED,gBAAgB;IAChB,KAAK,CAAC,qBAAqB,CAAuB,SAAkB;QAClE,MAAM,EAAE,OAAO,GAAG,IAAI,EAAE,IAAI,GAAG,IAAI,EAAE,MAAM,GAAG,IAAI,EAAE,GAAG,IAAI,EAAE,GAAG,SAAS,CAAC;QAE1E,IAAI,MAAM,KAAK,KAAK,EAAE,CAAC;YACrB,OAAO,IAAI,CAAC;QACd,CAAC;aAAM,CAAC;YACN,IAAI,OAAO,IAAI,IAAI,IAAI,OAAO,KAAK,KAAK;gBAAE,OAAO,OAAO,CAAC;YACzD,IAAI,IAAI,IAAI,IAAI,IAAI,IAAI,KAAK,KAAK;gBAAE,OAAO,IAAI,CAAC;YAChD,OAAO,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,MAAM,IAAI,CAAC,YAAY,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;QACzE,CAAC;IACH,CAAC;CACF,CAAC;AACF,OAAO,CAAC,UAAU,EAAE,YAAY,CAAC,CAAC;AAClC,KAAK,CAAC,OAAO,CAAC,UAAU,GAAG,UAAU,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { toParam, tryCall } from "@blazetrails/activesupport";
|
|
2
|
+
import { hashAref } from "@blazetrails/ruby-compat";
|
|
3
|
+
import { Turbo } from "../../../../turbo-trails.js";
|
|
4
|
+
export const StreamName = {
|
|
5
|
+
verifiedStreamName(signedStreamName) {
|
|
6
|
+
return Turbo.signedStreamVerifier().verified(signedStreamName);
|
|
7
|
+
},
|
|
8
|
+
signedStreamName(streamables) {
|
|
9
|
+
return Turbo.signedStreamVerifier().generate(this.streamNameFrom(streamables));
|
|
10
|
+
},
|
|
11
|
+
ClassMethods: {
|
|
12
|
+
verifiedStreamNameFromParams() {
|
|
13
|
+
return this.constructor.verifiedStreamName(hashAref(this.params, "signed_stream_name"));
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
/** @internal */
|
|
17
|
+
streamNameFrom(streamables) {
|
|
18
|
+
if (Array.isArray(streamables)) {
|
|
19
|
+
return streamables.map((streamable) => this.streamNameFrom(streamable)).join(":");
|
|
20
|
+
}
|
|
21
|
+
else {
|
|
22
|
+
const streamable = streamables;
|
|
23
|
+
const gidParam = tryCall(streamable, "toGidParam");
|
|
24
|
+
return (gidParam != null && gidParam !== false ? gidParam : toParam(streamable));
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
};
|
|
28
|
+
Turbo.Streams.StreamName = StreamName;
|
|
29
|
+
//# sourceMappingURL=stream-name.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stream-name.js","sourceRoot":"","sources":["../../../../../lib/app/channels/turbo/streams/stream-name.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AACpD,OAAO,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AASpD,MAAM,CAAC,MAAM,UAAU,GAAG;IACxB,kBAAkB,CAAC,gBAAyB;QAC1C,OAAO,KAAK,CAAC,oBAAoB,EAAE,CAAC,QAAQ,CAAC,gBAA0B,CAAC,CAAC;IAC3E,CAAC;IAED,gBAAgB,CAAuB,WAAoB;QACzD,OAAO,KAAK,CAAC,oBAAoB,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,cAAc,CAAC,WAAW,CAAC,CAAC,CAAC;IACjF,CAAC;IAED,YAAY,EAAE;QACZ,4BAA4B;YAC1B,OAAO,IAAI,CAAC,WAAW,CAAC,kBAAkB,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,EAAE,oBAAoB,CAAC,CAAC,CAAC;QAC1F,CAAC;KACF;IAED,gBAAgB;IAChB,cAAc,CAAuB,WAAoB;QACvD,IAAI,KAAK,CAAC,OAAO,CAAC,WAAW,CAAC,EAAE,CAAC;YAC/B,OAAO,WAAW,CAAC,GAAG,CAAC,CAAC,UAAU,EAAE,EAAE,CAAC,IAAI,CAAC,cAAc,CAAC,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QACpF,CAAC;aAAM,CAAC;YACN,MAAM,UAAU,GAAG,WAAqB,CAAC;YACzC,MAAM,QAAQ,GAAG,OAAO,CAAC,UAAU,EAAE,YAAY,CAAC,CAAC;YACnD,OAAO,CAAC,QAAQ,IAAI,IAAI,IAAI,QAAQ,KAAK,KAAK,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,UAAU,CAAC,CAAW,CAAC;QAC7F,CAAC;IACH,CAAC;CACF,CAAC;AACF,KAAK,CAAC,OAAO,CAAC,UAAU,GAAG,UAAU,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import "../../../constants.streams-channel.generated.js";
|
|
2
|
+
import { Base } from "@blazetrails/actioncable/channel/base";
|
|
3
|
+
import { extend, include } from "@blazetrails/ruby-compat";
|
|
4
|
+
import { Turbo } from "../../../turbo-trails.js";
|
|
5
|
+
import { Broadcasts } from "./streams/broadcasts.js";
|
|
6
|
+
import { StreamName } from "./streams/stream-name.js";
|
|
7
|
+
export class StreamsChannel extends Base {
|
|
8
|
+
static {
|
|
9
|
+
extend(this, Broadcasts);
|
|
10
|
+
extend(this, StreamName);
|
|
11
|
+
include(this, StreamName.ClassMethods);
|
|
12
|
+
}
|
|
13
|
+
subscribed() {
|
|
14
|
+
const streamName = this.verifiedStreamNameFromParams();
|
|
15
|
+
if (streamName != null && streamName !== false) {
|
|
16
|
+
return this.streamFrom(streamName);
|
|
17
|
+
}
|
|
18
|
+
else {
|
|
19
|
+
return this.reject();
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
Turbo.StreamsChannel = StreamsChannel;
|
|
24
|
+
//# sourceMappingURL=streams-channel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"streams-channel.js","sourceRoot":"","sources":["../../../../lib/app/channels/turbo/streams-channel.ts"],"names":[],"mappings":"AAAA,OAAO,iDAAiD,CAAC;AACzD,OAAO,EAAE,IAAI,EAAE,MAAM,uCAAuC,CAAC;AAC7D,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAC;AAC3D,OAAO,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAC;AACjD,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAItD,MAAM,OAAO,cAAe,SAAQ,IAAI;IAyBtC;QACE,MAAM,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC;QACzB,MAAM,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC;QACzB,OAAO,CAAC,IAAI,EAAE,UAAU,CAAC,YAAY,CAAC,CAAC;IACzC,CAAC;IAEkB,UAAU;QAC3B,MAAM,UAAU,GAAG,IAAI,CAAC,4BAA4B,EAAE,CAAC;QACvD,IAAI,UAAU,IAAI,IAAI,IAAI,UAAU,KAAK,KAAK,EAAE,CAAC;YAC/C,OAAO,IAAI,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC;QACrC,CAAC;aAAM,CAAC;YACN,OAAO,IAAI,CAAC,MAAM,EAAE,CAAC;QACvB,CAAC;IACH,CAAC;CACF;AACD,KAAK,CAAC,cAAc,GAAG,cAAc,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Concern, extend } from "@blazetrails/activesupport";
|
|
2
|
+
import { Turbo } from "../../../../turbo-trails.js";
|
|
3
|
+
export const RequestIdTracking = {
|
|
4
|
+
/** @internal */
|
|
5
|
+
turboTrackingRequestId(block) {
|
|
6
|
+
return Turbo.withRequestId(this.request.headers.get("X-Turbo-Request-Id") ?? null, block);
|
|
7
|
+
},
|
|
8
|
+
};
|
|
9
|
+
extend(RequestIdTracking, Concern);
|
|
10
|
+
RequestIdTracking.included(null, function () {
|
|
11
|
+
this.aroundAction(":turboTrackingRequestId");
|
|
12
|
+
});
|
|
13
|
+
Turbo.RequestIdTracking = RequestIdTracking;
|
|
14
|
+
//# sourceMappingURL=request-id-tracking.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"request-id-tracking.js","sourceRoot":"","sources":["../../../../../lib/app/controllers/concerns/turbo/request-id-tracking.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AAC7D,OAAO,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AAMpD,MAAM,CAAC,MAAM,iBAAiB,GAAG;IAC/B,gBAAgB;IAChB,sBAAsB,CAAiC,KAAc;QACnE,OAAO,KAAK,CAAC,aAAa,CACvB,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,oBAAoB,CAA+B,IAAI,IAAI,EACrF,KAAK,CACN,CAAC;IACJ,CAAC;CACF,CAAC;AACF,MAAM,CAAC,iBAAiB,EAAE,OAAO,CAAC,CAAC;AAEjC,iBAGD,CAAC,QAAQ,CAAC,IAAI,EAAE;IACf,IAAI,CAAC,YAAY,CAAC,yBAAyB,CAAC,CAAC;AAC/C,CAAC,CAAC,CAAC;AACH,KAAK,CAAC,iBAAiB,GAAG,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Concern, extend, isPresent } from "@blazetrails/activesupport";
|
|
2
|
+
import { Turbo } from "../../../../turbo-trails.js";
|
|
3
|
+
export const FrameRequest = {
|
|
4
|
+
/** @internal */
|
|
5
|
+
isTurboFrameRequest() {
|
|
6
|
+
return isPresent(this.turboFrameRequestId());
|
|
7
|
+
},
|
|
8
|
+
/** @internal */
|
|
9
|
+
turboFrameRequestId() {
|
|
10
|
+
return this.request.headers.get("Turbo-Frame");
|
|
11
|
+
},
|
|
12
|
+
};
|
|
13
|
+
extend(FrameRequest, Concern);
|
|
14
|
+
FrameRequest.included(null, function () {
|
|
15
|
+
this.layout(function () {
|
|
16
|
+
return this.isTurboFrameRequest() ? "turbo_rails/frame" : null;
|
|
17
|
+
});
|
|
18
|
+
this.etag(function () {
|
|
19
|
+
return this.isTurboFrameRequest() ? "frame" : null;
|
|
20
|
+
});
|
|
21
|
+
this.helperMethod("isTurboFrameRequest", "turboFrameRequestId");
|
|
22
|
+
});
|
|
23
|
+
Turbo.Frames.FrameRequest = FrameRequest;
|
|
24
|
+
//# sourceMappingURL=frame-request.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"frame-request.js","sourceRoot":"","sources":["../../../../../lib/app/controllers/turbo/frames/frame-request.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AACxE,OAAO,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AAcpD,MAAM,CAAC,MAAM,YAAY,GAAG;IAC1B,gBAAgB;IAChB,mBAAmB;QACjB,OAAO,SAAS,CAAC,IAAI,CAAC,mBAAmB,EAAE,CAAC,CAAC;IAC/C,CAAC;IAED,gBAAgB;IAChB,mBAAmB;QACjB,OAAO,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;IACjD,CAAC;CACF,CAAC;AACF,MAAM,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC;AAE5B,YAGD,CAAC,QAAQ,CAAC,IAAI,EAAE;IACf,IAAI,CAAC,MAAM,CAAC;QACV,OAAO,IAAI,CAAC,mBAAmB,EAAE,CAAC,CAAC,CAAC,mBAAmB,CAAC,CAAC,CAAC,IAAI,CAAC;IACjE,CAAC,CAAC,CAAC;IACH,IAAI,CAAC,IAAI,CAAC;QACR,OAAO,IAAI,CAAC,mBAAmB,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC;IACrD,CAAC,CAAC,CAAC;IAEH,IAAI,CAAC,YAAY,CAAC,qBAAqB,EAAE,qBAAqB,CAAC,CAAC;AAClE,CAAC,CAAC,CAAC;AACH,KAAK,CAAC,MAAM,CAAC,YAAY,GAAG,YAAY,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ActionController } from "@blazetrails/actionpack";
|
|
2
|
+
import { Turbo } from "../../../../turbo-trails.js";
|
|
3
|
+
export class NavigationController extends ActionController.Base {
|
|
4
|
+
async recede() {
|
|
5
|
+
await this.render({ html: "Going back…" });
|
|
6
|
+
}
|
|
7
|
+
async refresh() {
|
|
8
|
+
await this.render({ html: "Refreshing…" });
|
|
9
|
+
}
|
|
10
|
+
async resume() {
|
|
11
|
+
await this.render({ html: "Staying put…" });
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
Turbo.Native.NavigationController = NavigationController;
|
|
15
|
+
//# sourceMappingURL=navigation-controller.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"navigation-controller.js","sourceRoot":"","sources":["../../../../../lib/app/controllers/turbo/native/navigation-controller.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AAEpD,MAAM,OAAO,oBAAqB,SAAQ,gBAAgB,CAAC,IAAI;IAC7D,KAAK,CAAC,MAAM;QACV,MAAM,IAAI,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,aAAa,EAAE,CAAC,CAAC;IAC7C,CAAC;IAED,KAAK,CAAC,OAAO;QACX,MAAM,IAAI,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,aAAa,EAAE,CAAC,CAAC;IAC7C,CAAC;IAED,KAAK,CAAC,MAAM;QACV,MAAM,IAAI,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,cAAc,EAAE,CAAC,CAAC;IAC9C,CAAC;CACF;AACD,KAAK,CAAC,MAAM,CAAC,oBAAoB,GAAG,oBAAoB,CAAC"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { Concern, extend } from "@blazetrails/activesupport";
|
|
2
|
+
import { Turbo } from "../../../../turbo-trails.js";
|
|
3
|
+
export const Navigation = {
|
|
4
|
+
isHotwireNativeApp() {
|
|
5
|
+
return /(Turbo|Hotwire) Native/.test(this.request.userAgent ?? "");
|
|
6
|
+
},
|
|
7
|
+
isTurboNativeApp: undefined,
|
|
8
|
+
recedeOrRedirectTo(url, options = {}) {
|
|
9
|
+
return this.turboNativeActionOrRedirect(url, "recede", "to", options);
|
|
10
|
+
},
|
|
11
|
+
resumeOrRedirectTo(url, options = {}) {
|
|
12
|
+
return this.turboNativeActionOrRedirect(url, "resume", "to", options);
|
|
13
|
+
},
|
|
14
|
+
refreshOrRedirectTo(url, options = {}) {
|
|
15
|
+
return this.turboNativeActionOrRedirect(url, "refresh", "to", options);
|
|
16
|
+
},
|
|
17
|
+
recedeOrRedirectBackOrTo(url, options = {}) {
|
|
18
|
+
return this.turboNativeActionOrRedirect(url, "recede", "back", options);
|
|
19
|
+
},
|
|
20
|
+
resumeOrRedirectBackOrTo(url, options = {}) {
|
|
21
|
+
return this.turboNativeActionOrRedirect(url, "resume", "back", options);
|
|
22
|
+
},
|
|
23
|
+
refreshOrRedirectBackOrTo(url, options = {}) {
|
|
24
|
+
return this.turboNativeActionOrRedirect(url, "refresh", "back", options);
|
|
25
|
+
},
|
|
26
|
+
/** @internal */
|
|
27
|
+
turboNativeActionOrRedirect(url, action, redirectType, options = {}) {
|
|
28
|
+
const { nativeParams = null, ...rest } = options;
|
|
29
|
+
options = rest;
|
|
30
|
+
const nativeParamsOrDefault = nativeParams ?? {};
|
|
31
|
+
if (this.isTurboNativeApp()) {
|
|
32
|
+
const name = `turbo${(action[0].toUpperCase() + action.slice(1))}HistoricalLocationUrl`;
|
|
33
|
+
return this.redirectTo(this[name]({ notice: options["notice"] ?? null, ...nativeParamsOrDefault }));
|
|
34
|
+
}
|
|
35
|
+
else if (redirectType === "back") {
|
|
36
|
+
return this.redirectBack({ fallbackLocation: url, ...options });
|
|
37
|
+
}
|
|
38
|
+
else {
|
|
39
|
+
return this.redirectTo(url, options);
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
};
|
|
43
|
+
Navigation.isTurboNativeApp = Navigation.isHotwireNativeApp;
|
|
44
|
+
extend(Navigation, Concern);
|
|
45
|
+
Navigation.included(null, function () {
|
|
46
|
+
this.helperMethod("isHotwireNativeApp", "isTurboNativeApp");
|
|
47
|
+
});
|
|
48
|
+
Turbo.Native.Navigation = Navigation;
|
|
49
|
+
//# sourceMappingURL=navigation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"navigation.js","sourceRoot":"","sources":["../../../../../lib/app/controllers/turbo/native/navigation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AAC7D,OAAO,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AAuBpD,MAAM,CAAC,MAAM,UAAU,GAAG;IACxB,kBAAkB;QAChB,OAAO,wBAAwB,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,SAAS,IAAI,EAAE,CAAC,CAAC;IACrE,CAAC;IAED,gBAAgB,EAAE,SAAyD;IAE3E,kBAAkB,CAAuB,GAAW,EAAE,OAAO,GAAY,EAAE;QACzE,OAAO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CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAA6B,uBAAgC,CAAC;YAClH,OAAO,IAAI,CAAC,UAAU,CACpB,IAAI,CAAC,IAAI,CAAC,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,QAAQ,CAAC,IAAI,IAAI,EAAE,GAAG,qBAAqB,EAAE,CAAC,CAC5E,CAAC;QACJ,CAAC;aAAM,IAAI,YAAY,KAAK,MAAM,EAAE,CAAC;YACnC,OAAO,IAAI,CAAC,YAAY,CAAC,EAAE,gBAAgB,EAAE,GAAG,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;QAClE,CAAC;aAAM,CAAC;YACN,OAAO,IAAI,CAAC,UAAU,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;QACvC,CAAC;IACH,CAAC;CACF,CAAC;AACF,UAAU,CAAC,gBAAgB,GAAG,UAAU,CAAC,kBAAkB,CAAC;AAC5D,MAAM,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;AAE1B,UAGD,CAAC,QAAQ,CAAC,IAAI,EAAE;IACf,IAAI,CAAC,YAAY,CAAC,oBAAoB,EAAE,kBAAkB,CAAC,CAAC;AAC9D,CAAC,CAAC,CAAC;AACH,KAAK,CAAC,MAAM,CAAC,UAAU,GAAG,UAAU,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Turbo } from "../../../../turbo-trails.js";
|
|
2
|
+
import { TagBuilder } from "../../../models/turbo/streams/tag-builder.js";
|
|
3
|
+
export const TurboStreamsTagBuilder = {
|
|
4
|
+
/** @internal */
|
|
5
|
+
get turboStream() {
|
|
6
|
+
return new TagBuilder(this.viewContext());
|
|
7
|
+
},
|
|
8
|
+
};
|
|
9
|
+
Turbo.Streams.TurboStreamsTagBuilder = TurboStreamsTagBuilder;
|
|
10
|
+
//# sourceMappingURL=turbo-streams-tag-builder.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"turbo-streams-tag-builder.js","sourceRoot":"","sources":["../../../../../lib/app/controllers/turbo/streams/turbo-streams-tag-builder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,MAAM,8CAA8C,CAAC;AAE1E,MAAM,CAAC,MAAM,sBAAsB,GAAG;IACpC,gBAAgB;IAChB,IAAI,WAAW;QACb,OAAO,IAAI,UAAU,CAAE,IAA6C,CAAC,WAAW,EAAE,CAAC,CAAC;IACtF,CAAC;CACF,CAAC;AACF,KAAK,CAAC,OAAO,CAAC,sBAAsB,GAAG,sBAAsB,CAAC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { ArgumentError } from "@blazetrails/activesupport";
|
|
2
|
+
import { Turbo } from "../../../turbo-trails.js";
|
|
3
|
+
export const DriveHelper = {
|
|
4
|
+
turboExemptsPageFromCache() {
|
|
5
|
+
return this.provide("head", this.turboExemptsPageFromCacheTag());
|
|
6
|
+
},
|
|
7
|
+
turboExemptsPageFromCacheTag() {
|
|
8
|
+
return this.tag().meta({ name: "turbo-cache-control", content: "no-cache" });
|
|
9
|
+
},
|
|
10
|
+
turboExemptsPageFromPreview() {
|
|
11
|
+
return this.provide("head", this.turboExemptsPageFromPreviewTag());
|
|
12
|
+
},
|
|
13
|
+
turboExemptsPageFromPreviewTag() {
|
|
14
|
+
return this.tag().meta({ name: "turbo-cache-control", content: "no-preview" });
|
|
15
|
+
},
|
|
16
|
+
turboPageRequiresReload() {
|
|
17
|
+
return this.provide("head", this.turboPageRequiresReloadTag());
|
|
18
|
+
},
|
|
19
|
+
turboPageRequiresReloadTag() {
|
|
20
|
+
return this.tag().meta({ name: "turbo-visit-control", content: "reload" });
|
|
21
|
+
},
|
|
22
|
+
turboRefreshesWith({ method = "replace", scroll = "reset" } = {}) {
|
|
23
|
+
this.provide("head", this.turboRefreshMethodTag(method));
|
|
24
|
+
return this.provide("head", this.turboRefreshScrollTag(scroll));
|
|
25
|
+
},
|
|
26
|
+
turboRefreshMethodTag(method = "replace") {
|
|
27
|
+
if (!["replace", "morph"].includes(String(method)))
|
|
28
|
+
throw new ArgumentError(`Invalid refresh option '${method}'`);
|
|
29
|
+
return this.tag().meta({ name: "turbo-refresh-method", content: method });
|
|
30
|
+
},
|
|
31
|
+
turboRefreshScrollTag(scroll = "reset") {
|
|
32
|
+
if (!["reset", "preserve"].includes(String(scroll)))
|
|
33
|
+
throw new ArgumentError(`Invalid scroll option '${scroll}'`);
|
|
34
|
+
return this.tag().meta({ name: "turbo-refresh-scroll", content: scroll });
|
|
35
|
+
},
|
|
36
|
+
};
|
|
37
|
+
Turbo.DriveHelper = DriveHelper;
|
|
38
|
+
//# sourceMappingURL=drive-helper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"drive-helper.js","sourceRoot":"","sources":["../../../../lib/app/helpers/turbo/drive-helper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAmB,MAAM,4BAA4B,CAAC;AAC5E,OAAO,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAC;AAYjD,MAAM,CAAC,MAAM,WAAW,GAAG;IACzB,yBAAyB;QACvB,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,IAAI,CAAC,4BAA4B,EAAE,CAAC,CAAC;IACnE,CAAC;IAED,4BAA4B;QAC1B,OAAO,IAAI,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,qBAAqB,EAAE,OAAO,EAAE,UAAU,EAAE,CAAC,CAAC;IAC/E,CAAC;IAED,2BAA2B;QACzB,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,IAAI,CAAC,8BAA8B,EAAE,CAAC,CAAC;IACrE,CAAC;IAED,8BAA8B;QAC5B,OAAO,IAAI,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,qBAAqB,EAAE,OAAO,EAAE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AAE,CAAC,CAAC;IAC5E,CAAC;CACF,CAAC;AACF,KAAK,CAAC,WAAW,GAAG,WAAW,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { compact, extractOptionsBang, isPresent, } from "@blazetrails/activesupport";
|
|
2
|
+
import { RecordIdentifier } from "@blazetrails/actionview/record-identifier.js";
|
|
3
|
+
import { rbBlockGivenP, rbObjRespondTo } from "@blazetrails/ruby-compat";
|
|
4
|
+
import { Turbo } from "../../../turbo-trails.js";
|
|
5
|
+
export const FramesHelper = {
|
|
6
|
+
turboFrameTag(...ids) {
|
|
7
|
+
const block = rbBlockGivenP(ids.at(-1)) ? ids.pop() : undefined;
|
|
8
|
+
const { src: srcOption = null, target = null, ...attributes } = extractOptionsBang(ids);
|
|
9
|
+
let src = srcOption;
|
|
10
|
+
const id = rbObjRespondTo(ids[0], "toKey") || typeof ids[0] === "function"
|
|
11
|
+
? RecordIdentifier.domId(ids[0], ids[1] ?? null)
|
|
12
|
+
: ids.flat(Infinity).join("_");
|
|
13
|
+
if (isPresent(src))
|
|
14
|
+
src = this.urlFor(src);
|
|
15
|
+
const options = compact({ ...attributes, id, src, target });
|
|
16
|
+
return this.tag().turbo_frame(options, block);
|
|
17
|
+
},
|
|
18
|
+
};
|
|
19
|
+
Turbo.FramesHelper = FramesHelper;
|
|
20
|
+
//# sourceMappingURL=frames-helper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"frames-helper.js","sourceRoot":"","sources":["../../../../lib/app/helpers/turbo/frames-helper.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,EACP,kBAAkB,EAClB,SAAS,GAEV,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,gBAAgB,EAAE,MAAM,8CAA8C,CAAC;AAChF,OAAO,EAAE,aAAa,EAAE,cAAc,EAAc,MAAM,0BAA0B,CAAC;AACrF,OAAO,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAC;AAWjD,MAAM,CAAC,MAAM,YAAY,GAAG;IAC1B,aAAa,CAAyB,GAAG,GAAc;QACrD,MAAM,KAAK,GAAG,aAAa,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAE,GAAG,CAAC,GAAG,EAAqB,CAAC,CAAC,CAAC,SAAS,CAAC;QACpF,MAAM,EACJ,GAAG,EAAE,SAAS,GAAG,IAAI,EACrB,MAAM,GAAG,IAAI,EACb,GAAG,UAAU,EACd,GAAG,kBAAkB,CAAC,GAAG,CAAY,CAAC;QACvC,IAAI,GAAG,GAAG,SAAS,CAAC;QACpB,MAAM,EAAE,GACN,cAAc,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,IAAI,OAAO,GAAG,CAAC,CAAC,CAAC,KAAK,UAAU;YAC7D,CAAC,CAAC,gBAAgB,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAG,GAAG,CAAC,CAAC,CAAwB,IAAI,IAAI,CAAC;YACxE,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QACnC,IAAI,SAAS,CAAC,GAAG,CAAC;YAAE,GAAG,GAAG,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;QAE3C,MAAM,OAAO,GAAG,OAAO,CAAC,EAAE,GAAG,UAAU,EAAE,EAAE,EAAE,GAAG,EAAE,MAAM,EAAE,CAAC,CAAC;QAC5D,OAAO,IAAI,CAAC,GAAG,EAAE,CAAC,WAAW,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;IAChD,CAAC;CACF,CAAC;AACF,KAAK,CAAC,YAAY,GAAG,YAAY,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Turbo } from "../../../turbo-trails.js";
|
|
2
|
+
export const IncludesHelper = {
|
|
3
|
+
turboIncludeTags() {
|
|
4
|
+
return this.javascriptIncludeTag("turbo", { type: "module" });
|
|
5
|
+
},
|
|
6
|
+
};
|
|
7
|
+
Turbo.IncludesHelper = IncludesHelper;
|
|
8
|
+
//# sourceMappingURL=includes-helper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"includes-helper.js","sourceRoot":"","sources":["../../../../lib/app/helpers/turbo/includes-helper.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAC;AAMjD,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B,gBAAgB;QACd,OAAO,IAAI,CAAC,oBAAoB,CAAC,OAAO,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC,CAAC;IAChE,CAAC;CACF,CAAC;AACF,KAAK,CAAC,cAAc,GAAG,cAAc,CAAC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { htmlSafe, presence, wrap } from "@blazetrails/activesupport";
|
|
2
|
+
import { TagHelper } from "@blazetrails/actionview/helpers/tag-helper.js";
|
|
3
|
+
import { RecordIdentifier } from "@blazetrails/actionview/record-identifier.js";
|
|
4
|
+
import { include, rbObjAsString, rbObjRespondTo } from "@blazetrails/ruby-compat";
|
|
5
|
+
import { Turbo } from "../../../../turbo-trails.js";
|
|
6
|
+
export const ActionHelper = {
|
|
7
|
+
turboStreamActionTag(action, { target = null, targets = null, template = null, ...attributes } = {}) {
|
|
8
|
+
template = ["remove", "refresh"].includes(String(action))
|
|
9
|
+
? ""
|
|
10
|
+
: this.tag().template(htmlSafe(rbObjAsString(template)));
|
|
11
|
+
if ((target = this.convertToTurboStreamDomId(target)) != null && target !== false) {
|
|
12
|
+
return this.tag()["turbo-stream"](template, { ...attributes, action, target });
|
|
13
|
+
}
|
|
14
|
+
else if ((targets = this.convertToTurboStreamDomId(targets, { includeSelector: true })) != null &&
|
|
15
|
+
targets !== false) {
|
|
16
|
+
return this.tag()["turbo-stream"](template, { ...attributes, action, targets });
|
|
17
|
+
}
|
|
18
|
+
else {
|
|
19
|
+
return this.tag()["turbo-stream"](template, { ...attributes, action });
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
turboStreamRefreshTag(options = {}) {
|
|
23
|
+
const { requestId = Turbo.currentRequestId, ...attributes } = options;
|
|
24
|
+
return this.turboStreamActionTag("refresh", {
|
|
25
|
+
"request-id": presence(requestId),
|
|
26
|
+
...attributes,
|
|
27
|
+
});
|
|
28
|
+
},
|
|
29
|
+
/** @internal */
|
|
30
|
+
convertToTurboStreamDomId(target, { includeSelector = false } = {}) {
|
|
31
|
+
const targetArray = wrap(target);
|
|
32
|
+
if (targetArray.some((value) => rbObjRespondTo(value, "toKey") || typeof value === "function")) {
|
|
33
|
+
return `${includeSelector ? "#" : ""}${RecordIdentifier.domId(targetArray[0], targetArray[1] ?? null)}`;
|
|
34
|
+
}
|
|
35
|
+
else {
|
|
36
|
+
return target;
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
};
|
|
40
|
+
include(ActionHelper, TagHelper);
|
|
41
|
+
Turbo.Streams.ActionHelper = ActionHelper;
|
|
42
|
+
//# sourceMappingURL=action-helper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"action-helper.js","sourceRoot":"","sources":["../../../../../lib/app/helpers/turbo/streams/action-helper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAmB,MAAM,4BAA4B,CAAC;AACvF,OAAO,EAAE,SAAS,EAAE,MAAM,+CAA+C,CAAC;AAC1E,OAAO,EAAE,gBAAgB,EAAE,MAAM,8CAA8C,CAAC;AAChF,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAClF,OAAO,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AAapD,MAAM,CAAC,MAAM,YAAY,GAAG;IAC1B,oBAAoB,CAElB,MAAc,EACd,EAAE,MAAM,GAAG,IAAI,EAAE,OAAO,GAAG,IAAI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