-
Notifications
You must be signed in to change notification settings - Fork 71
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added first version of turbo frame navigation and turbostream rendering
- Loading branch information
Showing
39 changed files
with
157 additions
and
8 deletions.
There are no files selected for viewing
4 changes: 4 additions & 0 deletions
4
repository/Seaside-Canvas.package/WATagBrush.class/instance/dataAttributeAt..st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
accessing-attributes | ||
dataAttributeAt: aString | ||
|
||
^ self attributes at: 'data-',aString |
4 changes: 4 additions & 0 deletions
4
repository/Seaside-Canvas.package/WATagBrush.class/instance/dataAttributeAt.ifAbsent..st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
accessing-attributes | ||
dataAttributeAt: aString ifAbsent: aBlock | ||
|
||
^ self attributes at: 'data-',aString ifAbsent: aBlock |
4 changes: 4 additions & 0 deletions
4
repository/Seaside-Canvas.package/WATagBrush.class/instance/dataAttributeAt.put..st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
accessing-attributes | ||
dataAttributeAt: aString put: aValue | ||
|
||
self attributes at: 'data-',aString put: aValue |
4 changes: 4 additions & 0 deletions
4
repository/Seaside-Canvas.package/WATagBrush.class/instance/dataAttributeAt.put.if..st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
accessing-attributes | ||
dataAttributeAt: aString put: aValue if: aBoolean | ||
|
||
aBoolean ifTrue:[ self dataAttributeAt: aString put: aValue ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
repository/Seaside-HotwireTurbo.package/WAAnchorTag.extension/instance/turboAction..st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
*Seaside-HotwireTurbo | ||
turboAction: aString | ||
(#('replace' 'advance') includes: aString) ifFalse: [ | ||
self error. ]. | ||
self dataAttributeAt: 'turbo-action' put: aString |
4 changes: 4 additions & 0 deletions
4
repository/Seaside-HotwireTurbo.package/WAAnchorTag.extension/instance/turboFrameTarget..st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
*Seaside-HotwireTurbo | ||
turboFrameTarget: aString | ||
|
||
self dataAttributeAt: 'turbo-frame' put: aString |
5 changes: 3 additions & 2 deletions
5
repository/Seaside-HotwireTurbo.package/WAAnchorTag.extension/instance/turbocallback..st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
*Seaside-HotwireTurbo | ||
turbocallback: aNiladicValuable | ||
aNiladicValuable argumentCount > 0 ifTrue: [ GRInvalidArgumentCount signal: 'Anchors expect a niladic callback.' ]. | ||
turboCallback: aNiladicValuable | ||
aNiladicValuable argumentCount > 0 ifTrue: [ | ||
GRInvalidArgumentCount signal: 'Anchors expect a niladic callback.' ]. | ||
self url addField: (self storeCallback: (WATurboFrameActionCallback on: aNiladicValuable)) |
5 changes: 5 additions & 0 deletions
5
repository/Seaside-HotwireTurbo.package/WAButtonTag.extension/instance/turboCallback..st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
*Seaside-HotwireTurbo | ||
turboCallback: aNiladicValuable | ||
aNiladicValuable argumentCount > 0 ifTrue: [ | ||
GRInvalidArgumentCount signal: 'Buttons expect a niladic callback.' ]. | ||
self name: (self storeCallback: (WATurboFrameActionCallback on: aNiladicValuable)) |
4 changes: 4 additions & 0 deletions
4
...itory/Seaside-HotwireTurbo.package/WAButtonTag.extension/instance/turboStreamCallback..st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
*Seaside-HotwireTurbo | ||
turboStreamCallback: aValuable | ||
|
||
self name: (self storeCallback: ((WATurboStreamCallback on: aValuable) context: canvas context)) |
3 changes: 3 additions & 0 deletions
3
repository/Seaside-HotwireTurbo.package/WAButtonTag.extension/properties.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"name" : "WAButtonTag" | ||
} |
4 changes: 4 additions & 0 deletions
4
...itory/Seaside-HotwireTurbo.package/WAComponent.extension/instance/turboframeDecoration.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
*Seaside-HotwireTurbo | ||
turboframeDecoration | ||
|
||
^ self decorations detect:[ :dec | dec class == WATurboFrame ] |
3 changes: 3 additions & 0 deletions
3
repository/Seaside-HotwireTurbo.package/WAComponent.extension/properties.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"name" : "WAComponent" | ||
} |
5 changes: 5 additions & 0 deletions
5
...itory/Seaside-HotwireTurbo.package/WASubmitButtonTag.extension/instance/turboCallback..st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
*Seaside-HotwireTurbo | ||
turboCallback: aNiladicValuable | ||
aNiladicValuable argumentCount > 0 ifTrue: [ | ||
GRInvalidArgumentCount signal: 'Submit buttons expect a niladic callback.' ]. | ||
self name: (self storeCallback: (WATurboFrameActionCallback on: aNiladicValuable)) |
4 changes: 4 additions & 0 deletions
4
...ry/Seaside-HotwireTurbo.package/WASubmitButtonTag.extension/instance/turboFrameTarget..st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
*Seaside-HotwireTurbo | ||
turboFrameTarget: aString | ||
|
||
self dataAttributeAt: 'turbo-frame' put: aString |
3 changes: 3 additions & 0 deletions
3
repository/Seaside-HotwireTurbo.package/WASubmitButtonTag.extension/properties.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"name" : "WASubmitButtonTag" | ||
} |
3 changes: 3 additions & 0 deletions
3
repository/Seaside-HotwireTurbo.package/WATurboFrame.class/class/new.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
instance creation | ||
new | ||
^ self basicNew initializeWithId: 'id-', UUIDGenerator default next asString |
3 changes: 3 additions & 0 deletions
3
repository/Seaside-HotwireTurbo.package/WATurboFrame.class/class/newWithId..st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
instance creation | ||
newWithId: aString | ||
^ self basicNew initializeWithId: aString |
2 changes: 1 addition & 1 deletion
2
repository/Seaside-HotwireTurbo.package/WATurboFrame.class/instance/id.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
accessing | ||
id | ||
^ 'id-',id | ||
^ id |
4 changes: 0 additions & 4 deletions
4
repository/Seaside-HotwireTurbo.package/WATurboFrame.class/instance/initialize.st
This file was deleted.
Oops, something went wrong.
4 changes: 4 additions & 0 deletions
4
repository/Seaside-HotwireTurbo.package/WATurboFrame.class/instance/initializeWithId..st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
initialization | ||
initializeWithId: aString | ||
self initialize. | ||
id := aString |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,6 @@ | |
"pools" : [ ], | ||
"classvars" : [ ], | ||
"instvars" : [ | ||
"counter", | ||
"id" | ||
], | ||
"name" : "WATurboFrame", | ||
|
Empty file.
4 changes: 4 additions & 0 deletions
4
...ry/Seaside-HotwireTurbo.package/WATurboStreamBuilder.class/class/newWithRenderContext..st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
instance creation | ||
newWithRenderContext: aRenderContext | ||
|
||
^ self new initializeWithContext: aRenderContext; yourself |
3 changes: 3 additions & 0 deletions
3
repository/Seaside-HotwireTurbo.package/WATurboStreamBuilder.class/instance/after.with..st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
actions | ||
after: anId with: aRenderable | ||
self turboStreamAction: 'after' target: anId with: aRenderable |
3 changes: 3 additions & 0 deletions
3
repository/Seaside-HotwireTurbo.package/WATurboStreamBuilder.class/instance/append.with..st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
actions | ||
append: anId with: aRenderable | ||
self turboStreamAction: 'append' target: anId with: aRenderable |
3 changes: 3 additions & 0 deletions
3
repository/Seaside-HotwireTurbo.package/WATurboStreamBuilder.class/instance/before.with..st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
actions | ||
before: anId with: aRenderable | ||
self turboStreamAction: 'before' target: anId with: aRenderable |
4 changes: 4 additions & 0 deletions
4
...easide-HotwireTurbo.package/WATurboStreamBuilder.class/instance/initializeWithContext..st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
initialize | ||
initializeWithContext: aRenderContext | ||
|
||
canvas := WAHtmlCanvas context: aRenderContext |
3 changes: 3 additions & 0 deletions
3
repository/Seaside-HotwireTurbo.package/WATurboStreamBuilder.class/instance/prepend.with..st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
actions | ||
prepend: anId with: aRenderable | ||
self turboStreamAction: 'prepend' target: anId with: aRenderable |
3 changes: 3 additions & 0 deletions
3
repository/Seaside-HotwireTurbo.package/WATurboStreamBuilder.class/instance/remove..st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
actions | ||
remove: anId | ||
self turboStreamAction: 'remove' target: anId with: nil |
3 changes: 3 additions & 0 deletions
3
repository/Seaside-HotwireTurbo.package/WATurboStreamBuilder.class/instance/replace.with..st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
actions | ||
replace: anId with: aRenderable | ||
self turboStreamAction: 'replace' target: anId with: aRenderable |
9 changes: 9 additions & 0 deletions
9
...otwireTurbo.package/WATurboStreamBuilder.class/instance/turboStreamAction.target.with..st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
private | ||
turboStreamAction: aName target: anId with: aRenderable | ||
(canvas tag: 'turbo-stream') | ||
attributeAt: 'action' put: aName; | ||
attributeAt: 'target' put: anId; | ||
with: [ | ||
aRenderable ifNotNil:[ | ||
(canvas tag: 'template') | ||
with:[ aRenderable renderOn: canvas ] ] ] |
3 changes: 3 additions & 0 deletions
3
repository/Seaside-HotwireTurbo.package/WATurboStreamBuilder.class/instance/update.with..st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
actions | ||
update: anId with: aRenderable | ||
self turboStreamAction: 'update' target: anId with: aRenderable |
13 changes: 13 additions & 0 deletions
13
repository/Seaside-HotwireTurbo.package/WATurboStreamBuilder.class/properties.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"commentStamp" : "", | ||
"super" : "WAObject", | ||
"category" : "Seaside-HotwireTurbo", | ||
"classinstvars" : [ ], | ||
"pools" : [ ], | ||
"classvars" : [ ], | ||
"instvars" : [ | ||
"canvas" | ||
], | ||
"name" : "WATurboStreamBuilder", | ||
"type" : "normal" | ||
} |
Empty file.
3 changes: 3 additions & 0 deletions
3
repository/Seaside-HotwireTurbo.package/WATurboStreamCallback.class/instance/context..st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
accessing | ||
context: aContext | ||
renderContext := aContext |
8 changes: 8 additions & 0 deletions
8
...easide-HotwireTurbo.package/WATurboStreamCallback.class/instance/evaluateWithArgument..st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
evaluation | ||
evaluateWithArgument: anObject | ||
|
||
self requestContext respond: [ :response | | ||
response | ||
doNotCache; | ||
contentType: 'text/vnd.turbo-stream.html'. | ||
self renderTurboStreamOn: response stream ] |
11 changes: 11 additions & 0 deletions
11
...Seaside-HotwireTurbo.package/WATurboStreamCallback.class/instance/renderTurboStreamOn..st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
evaluation | ||
renderTurboStreamOn: aStream | ||
|
||
| document | | ||
document := (WAHtmlDocument | ||
on: aStream | ||
codec: self requestContext codec) | ||
scriptGenerator: self requestContext handler scriptGeneratorClass new; | ||
yourself. | ||
renderContext document: document during: [ | ||
block value: (WATurboStreamBuilder newWithRenderContext: renderContext) ] |
13 changes: 13 additions & 0 deletions
13
repository/Seaside-HotwireTurbo.package/WATurboStreamCallback.class/properties.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"commentStamp" : "", | ||
"super" : "WAActionCallback", | ||
"category" : "Seaside-HotwireTurbo", | ||
"classinstvars" : [ ], | ||
"pools" : [ ], | ||
"classvars" : [ ], | ||
"instvars" : [ | ||
"renderContext" | ||
], | ||
"name" : "WATurboStreamCallback", | ||
"type" : "normal" | ||
} |