Skip to content

Commit

Permalink
Merge branch 'master' into streaming-uploads
Browse files Browse the repository at this point in the history
# Conflicts:
#	repository/Zinc-Seaside.package/ZnZincServerAdaptor.class/instance/requestHeadersFor..st
  • Loading branch information
jbrichau committed Dec 17, 2023
2 parents 652b1fb + 7976eb9 commit 6508746
Show file tree
Hide file tree
Showing 127 changed files with 174 additions and 109 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,10 @@ baselinecommon: spec
spec requires: #('Seaside-Tools-Core' 'Seaside-RenderLoop' 'Seaside-Widgets' ) ];
package: 'Seaside-Widgets' with: [
spec requires: #('Seaside-Component' 'Seaside-Canvas' ) ];
package: 'Seaside-HotwireTurbo' with: [
spec requires: #('Seaside-Core' 'Seaside-Component' 'Seaside-Canvas') ];
package: 'Seaside-HotwireTurbo-Core' with: [
spec requires: #('Seaside-Core' 'Seaside-Component' 'Seaside-Canvas' 'Seaside-RenderLoop' ) ];
package: 'Seaside-HotwireTurbo-Examples' with: [
spec requires: #('Seaside-HotwireTurbo') ];
spec requires: #('Seaside-HotwireTurbo-Core' 'Seaside-Examples') ];
package: 'Seaside-Tests-Canvas' with: [
spec requires: #('Seaside-Tests-Core' 'Seaside-Canvas' ). ];
package: 'Seaside-Tests-Component' with: [
Expand Down Expand Up @@ -100,12 +100,12 @@ baselinecommon: spec
spec
group: 'default' with: #('Core' 'JSON' 'Email' 'Javascript' 'JQuery' 'JQueryUI' 'Seaside-Examples' 'Seaside-Welcome');
group: 'OneClick' with: #('Tests' 'Development' 'Zinc');
group: 'CI' with: #('Tests' 'Development Tests' 'Seaside-HotwireTurbo');
group: 'CI' with: #('Tests' 'Development Tests' 'Seaside-HotwireTurbo-Core');
group: 'Core' with: #('Seaside-Core' 'Seaside-Continuation' 'Seaside-Canvas' 'Seaside-Session' 'Seaside-Component' 'Seaside-RenderLoop' 'Seaside-Tools-Core' 'Seaside-Flow' 'Seaside-Environment' 'Seaside-Widgets' );
group: 'Tests' with: #('Core' 'Seaside-Tests-Core' 'Seaside-Tests-Canvas' 'Seaside-Tests-Session' 'Seaside-Tests-Component' 'Seaside-Tests-RenderLoop' 'Seaside-Tests-Environment' 'Seaside-Tests-Flow' 'Seaside-Tests-UTF8' 'Seaside-Tests-InternetExplorer' 'Seaside-Tests-Email' 'Seaside-Tests-Examples' 'RSS Tests' 'Welcome Tests' 'REST Tests' 'Swagger Tests' 'Seaside-Tests-Parasol');
group: 'Hotwired' with: #('Seaside-HotwireTurbo');
group: 'Hotwired' with: #('Seaside-HotwireTurbo-Core');
group: 'Development' with: #('Core' 'Seaside-Development');
group: 'Development Tests' with: #('Development' 'Core' 'Seaside-Tests-Development');
group: 'Email' with: #('Seaside-Email');
group: 'Examples' with: #('Core' 'Seaside-Examples' 'Seaside-REST-Examples' 'Seaside-HotwireTurbo-Examples');
group: 'Base' with: #('Core') ].
group: 'Base' with: #('Core') ].
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ baselinejquery: spec
package: 'JQuery-Tests-Core' with: [
spec requires: #('JQuery-Core' 'Javascript-Tests-Core' 'Seaside-Development' 'Seaside-Tests-Functional' 'Seaside-Ajaxifier-Core') ];
package: 'JQuery-Examples' with: [
spec requires: #('JQuery-Core') ];
spec requires: #('JQuery-Core' 'Seaside-Component' 'Seaside-Examples') ];
package: 'JQuery-JSON' with: [
spec requires: #('JQuery-Core' 'Seaside-JSON-Core') ];
package: 'JQuery-Tests-JSON' with: [
Expand All @@ -19,4 +19,4 @@ baselinejquery: spec
group: 'JQuery' with: #('JQuery-Core' 'JQuery-JSON');
group: 'JQuery Tests' with: #('JQuery-Tests-Core' 'JQuery-Tests-JSON');
group: 'Examples' with: #('JQuery-Examples');
group: 'Tests' with: #( 'JQuery Tests' ) ]
group: 'Tests' with: #( 'JQuery Tests' ) ]
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ tests-creation
testHtml
self
assert: (self jQuery html: [ :html | html div: 'foo' ])
equals: self function , '("<div>foo</div>")'.
equals: self function , '("<div>foo<\/div>")'.
self
assert: (self jQuery html: [ :html | html div title: 'foo'; with: 'bar' ])
equals: self function , '("<div title=\"foo\">bar</div>")'
equals: self function , '("<div title=\"foo\">bar<\/div>")'
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ tests-with
testWithBlock
self
assert: (self jQuery: [ :html | html heading: 'jQuery' ])
equals: self function , '("<h1>jQuery</h1>")'
equals: self function , '("<h1>jQuery<\/h1>")'
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ tests-modifying
testAfter
self
assert: ((self jQuery: 'p') after: [ :html | html strong: 'Hello' ])
equals: self function , '("p").after("<strong>Hello</strong>")'.
equals: self function , '("p").after("<strong>Hello<\/strong>")'.
self
assert: ((self jQuery: 'span') insertAfter: '#foo')
equals: self function , '("span").insertAfter("#foo")'
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ tests-modifying
testAppend
self
assert: ((self jQuery: 'p') append: [ :html | html strong: 'Hello' ])
equals: self function , '("p").append("<strong>Hello</strong>")'.
equals: self function , '("p").append("<strong>Hello<\/strong>")'.
self
assert: ((self jQuery: 'span') appendTo: '#foo')
equals: self function , '("span").appendTo("#foo")'
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ tests-modifying
testBefore
self
assert: ((self jQuery: 'p') before: [ :html | html strong: 'Hello' ])
equals: self function , '("p").before("<strong>Hello</strong>")'.
equals: self function , '("p").before("<strong>Hello<\/strong>")'.
self
assert: ((self jQuery: 'span') insertBefore: '#foo')
equals: self function , '("span").insertBefore("#foo")'
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ testHtml
equals: self function , '("div").html()'.
self
assert: ((self jQuery: 'div') html: [ :html | html div ])
equals: self function , '("div").html("<div></div>")'
equals: self function , '("div").html("<div><\/div>")'
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ tests-modifying
testPrepend
self
assert: ((self jQuery: 'p') prepend: [ :html | html strong: 'Hello' ])
equals: self function , '("p").prepend("<strong>Hello</strong>")'.
equals: self function , '("p").prepend("<strong>Hello<\/strong>")'.
self
assert: ((self jQuery: 'span') prependTo: '#foo')
equals: self function , '("span").prependTo("#foo")'
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ tests-modifying
testReplace
self
assert: ((self jQuery: 'p') replaceWith: [ :html | html emphasis: 'Hello' ])
equals: self function , '("p").replaceWith("<em>Hello</em>")'.
equals: self function , '("p").replaceWith("<em>Hello<\/em>")'.
self
assert: ((self jQuery html: [ :html | html div: 'Hello' ]) replaceAll: '.foo')
equals: self function , '("<div>Hello</div>").replaceAll(".foo")'
equals: self function , '("<div>Hello<\/div>").replaceAll(".foo")'
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ tests-modifying
testWrap
self
assert: ((self jQuery: 'p') wrap: [ :html | html strong ])
equals: self function , '("p").wrap("<strong></strong>")'.
equals: self function , '("p").wrap("<strong><\/strong>")'.
self
assert: ((self jQuery: 'p') wrapAll: [ :html | html div ])
equals: self function , '("p").wrapAll("<div></div>")'.
equals: self function , '("p").wrapAll("<div><\/div>")'.
self
assert: ((self jQuery: 'p') wrapInner: [ :html | html span ])
equals: self function , '("p").wrapInner("<span></span>")'
equals: self function , '("p").wrapInner("<span><\/span>")'
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
encoding
encodeString: aString on: aStream
encodeString: aString on: aStream
"Strings have a complicated encoding in Javascript, try to optimize their serialization."


| last |
aStream nextPut: $".
1 to: aString size do: [ :index |
1 to: aString size do: [ :index |
| char value encoded |
char := aString at: index.
value := char greaseInteger.
value < JavascriptCharacters size
value < JavascriptCharacters size
ifFalse: [
"U+2028 and U+2029 have to be treaded as new lines"
"U+2028 and U+2029 have to be treated as new lines"
value = 16r2028 "Line separator"
ifTrue: [ aStream nextPutAll: '\u2028' ]
ifFalse: [
Expand All @@ -20,7 +21,12 @@ encodeString: aString on: aStream
encoded := JavascriptCharacters at: value + 1.
"we use nil markers becausee #isNil is faster than #isString because it's not
actually sent"
encoded isNil
ifTrue: [ aStream nextPut: char ]
ifFalse: [ aStream nextPutAll: encoded ] ] ].
encoded isNil
ifTrue: [
"avoid that browsers mistakenly take the output as a closing tag"
(last = $< and: [ char = $/ ])
ifTrue: [ aStream nextPutAll: '\/' ]
ifFalse: [ aStream nextPut: char ] ]
ifFalse: [ aStream nextPutAll: encoded ] ].
last := char ].
aStream nextPut: $"
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Please describe the package using the class comment of the included manifest class. The manifest class also includes other additional metadata for the package. These meta data are used by other tools such as the SmalllintManifestChecker and the critics Browser
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
code-critics
ruleTempsReadBeforeWrittenRuleV1FalsePositive

<ignoreForCoverage>
^ #(#(#(#RGMethodDefinition #(#'JSStream class' #encodeString:on: #true)) #'2023-09-27T18:22:24.916405+02:00') )
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"commentStamp" : "<historical>",
"super" : "PackageManifest",
"category" : "Javascript-Core-Manifest",
"classinstvars" : [ ],
"pools" : [ ],
"classvars" : [ ],
"instvars" : [ ],
"name" : "ManifestJavascriptCore",
"type" : "normal"
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ testModifyingInsert
equals: '$(this).insert("1")'.
self
assert: (self element insertAfter: [ :r | r div ])
equals: '$(this).insert({"after":"<div></div>"})'.
equals: '$(this).insert({"after":"<div><\/div>"})'.
self
assert: (self element insertBefore: 'abc')
equals: '$(this).insert({"before":"abc"})'.
self
assert: (self element insertTop: [ :r | r span: 5 ])
equals: '$(this).insert({"top":"<span>5</span>"})'.
equals: '$(this).insert({"top":"<span>5<\/span>"})'.
self
assert: (self element insertBottom: '5')
equals: '$(this).insert({"bottom":"5"})'
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ testModifyingReplace
equals: '$(this).replace("foo")'.
self
assert: (self element replace: [ :r | r div id: 'foo' ])
equals: '$(this).replace("<div id=\"foo\"></div>")'
equals: '$(this).replace("<div id=\"foo\"><\/div>")'
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ testModifyingUpdate
equals: '$("foo").update("bar")'.
self
assert: (self element update: [ :r | r div: 'bar' ])
equals: '$(this).update("<div>bar</div>")'
equals: '$(this).update("<div>bar<\/div>")'
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ tests-rendering
testRenderedHtml
self
assert: [ :html | html div script: (html scriptaculous element update: [ :r | r span ]) ]
renders: '<div id="id1"></div><script type="text/javascript">$("id1").update("<span></span>");</script>'
renders: '<div id="id1"></div><script type="text/javascript">$("id1").update("<span><\/span>");</script>'
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ testRenderedHtmlWithScripts
assert: [ :html |
html div script: (html scriptaculous element remove).
html div script: (html scriptaculous element update: [ :r | r span ]) ]
renders: '<div id="id1"></div><div id="id2"></div><script type="text/javascript">$("id1").remove();$("id2").update("<span></span>");</script>'
renders: '<div id="id1"></div><div id="id2"></div><script type="text/javascript">$("id1").remove();$("id2").update("<span><\/span>");</script>'

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ entityTagFor: aStringOrByteArray
| hash base64 |
hash := GRPlatform current secureHashFor: aStringOrByteArray.
"etags have to be delimited by double quotes"
base64 := GRPlatform current base64Encode: hash asByteArray.
base64 := GRPlatform current base64Encode: hash greaseAsByteArray.
^ String new: base64 size + 2 streamContents: [ :stream |
stream
nextPut: $";
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
*Seaside-HotwireTurbo-Core
turbo

^ (JSStream on: 'Turbo')
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
*Seaside-HotwireTurbo
*Seaside-HotwireTurbo-Core
turboCallback: aNiladicValuable

self turboCallback: aNiladicValuable target: (JSStream on: 'this.closest(''turbo-frame'').id')
self turboCallback: aNiladicValuable target: (JSStream on: 'this.closest(''turbo-frame'').id')
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
*Seaside-HotwireTurbo
*Seaside-HotwireTurbo-Core
turboCallback: aNiladicValuable target: frameId

self add:
Expand All @@ -8,4 +8,4 @@ turboCallback: aNiladicValuable target: frameId
(Dictionary new
add: 'action' -> 'replace';
add: 'frame' -> frameId;
yourself) })
yourself) })
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
*Seaside-HotwireTurbo
*Seaside-HotwireTurbo-Core
turbo: aBoolean

"data-turbo=""false"" disables Turbo Drive on links and forms including descendants. To reenable when an ancestor has opted out, use data-turbo=""true"". Be careful: when Turbo Drive is disabled, browsers treat link clicks as normal, but native adapters may exit the app."

self dataAttributeAt: 'turbo' put: aBoolean
self dataAttributeAt: 'turbo' put: aBoolean
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
*Seaside-HotwireTurbo
*Seaside-HotwireTurbo-Core
turboAction: aString

(#('replace' 'advance') includes: aString) ifFalse: [
self error: 'Argument for turboAction must be either ''replace'' or ''advance''.' ].
self dataAttributeAt: 'turbo-action' put: aString
self dataAttributeAt: 'turbo-action' put: aString
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
*Seaside-HotwireTurbo
*Seaside-HotwireTurbo-Core
turboTarget: aString

"data-turbo-frame identifies the Turbo Frame to navigate. Refer to the Frames documentation for further details."

self dataAttributeAt: 'turbo-frame' put: aString
self dataAttributeAt: 'turbo-frame' put: aString
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
*Seaside-HotwireTurbo
*Seaside-HotwireTurbo-Core
turboStreamCallback: aValuable

self action:
((self attributeAt: 'action') copy addField: (self storeCallback:
((WATurboStreamCallback on: aValuable) context: canvas context)))
((WATurboStreamCallback on: aValuable) context: canvas context)))
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
*Seaside-HotwireTurbo
*Seaside-HotwireTurbo-Core
turboStreamCallback: aValuable

self name: (self storeCallback: ((WATurboStreamCallback on: aValuable) context: canvas context))
self name: (self storeCallback: ((WATurboStreamCallback on: aValuable) context: canvas context))
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
*Seaside-HotwireTurbo-Core
isTurboStreamCallback

^ false
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
*Seaside-HotwireTurbo
*Seaside-HotwireTurbo-Core
findTurboStreamCallbackIn: aRequest

aRequest fields keysDo: [ :key |
callbacks at: key ifPresent: [ :callback |
callback isTurboStreamCallback
ifTrue: [ ^ callback ] ] ].
^ nil
^ nil
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
*Seaside-HotwireTurbo
*Seaside-HotwireTurbo-Core
turboCall: aComponent

aComponent addDecoration: (WATurboFrame newWithId: self turboframeDecoration id).
^ self call: aComponent
^ self call: aComponent
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
*Seaside-HotwireTurbo
*Seaside-HotwireTurbo-Core
turboframeDecoration

^ self decorations detect:[ :dec | dec isTurboFrame ] ifNone: [ nil ]
^ self decorations detect:[ :dec | dec isTurboFrame ] ifNone: [ nil ]
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
*Seaside-HotwireTurbo-Core
turboframeId

^ self turboframeDecoration id
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
*Seaside-HotwireTurbo-Core
isTurboFrame

^ false
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
*Seaside-HotwireTurbo-Core
textVndTurboStreamHtml

^ self main: 'text' sub: 'vnd.turbo-stream.html'
Loading

0 comments on commit 6508746

Please sign in to comment.