Skip to content

Commit 44e5bb7

Browse files
authored
Add support for web components
- add support for template element - add support for slot element - add support for slot attribute - add examples for web components
1 parent 1378e9e commit 44e5bb7

File tree

76 files changed

+436
-16
lines changed

Some content is hidden

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

76 files changed

+436
-16
lines changed

repository/BaselineOfSeaside3.package/BaselineOfSeaside3.class/instance/baselinecommon..st

+8-2
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,10 @@ baselinecommon: spec
5959
spec requires: #('Seaside-Core' 'Seaside-Component' 'Seaside-RenderLoop' 'Seaside-Session' ). ];
6060
package: 'Seaside-Tools-Web' with: [
6161
spec requires: #('Seaside-Tools-Core' 'Seaside-RenderLoop' 'Seaside-Widgets' ) ];
62+
package: 'Seaside-WebComponents-Core' with: [
63+
spec requires: #('Seaside-Core' 'Seaside-Canvas' 'Seaside-Component' 'Seaside-RenderLoop') ];
64+
package: 'Seaside-WebComponents-Examples' with: [
65+
spec requires: #('Seaside-WebComponents-Core' 'Seaside-Examples') ];
6266
package: 'Seaside-Widgets' with: [
6367
spec requires: #('Seaside-Component' 'Seaside-Canvas' ) ];
6468
package: 'Seaside-HotwireTurbo-Core' with: [
@@ -93,6 +97,8 @@ baselinecommon: spec
9397
spec requires: #('Seaside-Tools-Web' 'Seaside-Tests-Environment' ). ];
9498
package: 'Seaside-Tests-UTF8' with: [
9599
spec requires: #('Seaside-Tests-Core' ) ];
100+
package: 'Seaside-Tests-WebComponents' with: [
101+
spec requires: #('Seaside-WebComponents-Core' 'Seaside-Tests-Core' 'Seaside-Session' 'Seaside-Examples'). ];
96102
package: 'Seaside-Tests-Parasol' with: [
97103
spec requires: #('Parasol' 'Seaside-Tests-Functional' 'Seaside-Tools-Core') ].
98104
spec
@@ -102,9 +108,9 @@ baselinecommon: spec
102108
group: 'All' with: #('Tests' 'Development Tests');
103109

104110
group: 'Core' with: #('Seaside-Core' 'Seaside-Continuation' 'Seaside-Canvas' 'Seaside-Session' 'Seaside-Component' 'Seaside-RenderLoop' 'Seaside-Tools-Core' 'Seaside-Flow' 'Seaside-Environment' 'Seaside-Widgets' );
105-
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');
111+
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' 'Seaside-Tests-WebComponents' 'RSS Tests' 'Welcome Tests' 'REST Tests' 'Swagger Tests' 'Seaside-Tests-Parasol');
106112
group: 'Hotwired' with: #('Seaside-HotwireTurbo-Core');
107113
group: 'Development' with: #('Core' 'Seaside-Development');
108114
group: 'Development Tests' with: #('Development' 'Core' 'Seaside-Tests-Development');
109115
group: 'Email' with: #('Seaside-Email');
110-
group: 'Examples' with: #('Core' 'Seaside-Examples' 'Seaside-REST-Examples' 'Seaside-HotwireTurbo-Examples') ].
116+
group: 'Examples' with: #('Core' 'Seaside-Examples' 'Seaside-REST-Examples' 'Seaside-HotwireTurbo-Examples' 'Seaside-WebComponents-Examples') ].
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
tags-web-components
2+
slot: aBlock
3+
self slot with: aBlock
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
tags-web-components
2+
slot
3+
4+
^ self brush: WASlotTag new
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
tags-web-components
2+
template: aBlock
3+
self template with: aBlock
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
tags-web-components
2+
template
3+
4+
^ self brush: WATemplateTag new
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
attributes
2+
name: aSring
3+
"The slot's name."
4+
self attributeAt: 'name' put: aSring
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
accessing
2+
tag
3+
^ 'slot'
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"commentStamp" : "Anonymous 7/6/2024 14:52",
3+
"super" : "WATagBrush",
4+
"category" : "Seaside-Canvas-Tags",
5+
"classinstvars" : [ ],
6+
"pools" : [ ],
7+
"classvars" : [ ],
8+
"instvars" : [ ],
9+
"name" : "WASlotTag",
10+
"type" : "normal"
11+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
attributes-webcomponents
2+
slot: aString
3+
"The slot global attribute assigns a slot in a shadow DOM shadow tree to an element: An element with a slot attribute is assigned to the slot created by the <slot> element whose name attribute's value matches that slot attribute's value."
4+
5+
self attributes at: 'slot' put: aString
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
attributes
2+
shadowRootClonable: aBoolean
3+
"Sets the value of the clonable property of a ShadowRoot created using this element to true. If set, a clone of the shadow host (the parent element of this <template>) created with Node.cloneNode() or Document.importNode() will include a shadow root in the copy."
4+
self attributeAt: 'shadowrootclonable' put: aBoolean
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
attributes
2+
shadowRootDelegatesFocus: aBoolean
3+
"Sets the value of the delegatesFocus property of a ShadowRoot created using this element to true. If this is set and a non-focusable element in the shadow tree is selected, then focus is delegated to the first focusable element in the tree. The value defaults to false."
4+
self attributeAt: 'shadowrootdelegatesfocus' put: aBoolean
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
attributes
2+
shadowRootMode: aString
3+
"Creates a shadow root for the parent element. It is a declarative version of the Element.attachShadow() method and accepts the same enumerated values.
4+
5+
open
6+
Exposes the internal shadow root DOM for JavaScript (recommended for most use cases).
7+
8+
closed
9+
Hides the internal shadow root DOM from JavaScript."
10+
self attributeAt: 'shadowrootmode' put: aString
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
attributes
2+
shadowRootSerializable: aBoolean
3+
"Sets the value of the serializable property of a ShadowRoot created using this element to true. If set, the shadow root may be serialized by calling the Element.getHTML() or ShadowRoot.getHTML() methods with the options.serializableShadowRoots parameter set true. The value defaults to false."
4+
self attributeAt: 'shadowrootserializable' put: aBoolean
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
accessing
2+
tag
3+
^ 'template'
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"commentStamp" : "Anonymous 7/6/2024 14:40",
3+
"super" : "WATagBrush",
4+
"category" : "Seaside-Canvas-Tags",
5+
"classinstvars" : [ ],
6+
"pools" : [ ],
7+
"classvars" : [ ],
8+
"instvars" : [ ],
9+
"name" : "WATemplateTag",
10+
"type" : "normal"
11+
}
Original file line numberDiff line numberDiff line change
@@ -1,4 +1 @@
1-
SystemOrganization addCategory: #'Seaside-Canvas'!
2-
SystemOrganization addCategory: #'Seaside-Canvas-Base'!
3-
SystemOrganization addCategory: #'Seaside-Canvas-Canvas'!
4-
SystemOrganization addCategory: #'Seaside-Canvas-Tags'!
1+
self packageOrganizer ensurePackage: #'Seaside-Canvas' withTags: #(#Base #Canvas #Tags)!
Original file line numberDiff line numberDiff line change
@@ -1,5 +1 @@
1-
SystemOrganization addCategory: #'Seaside-Component'!
2-
SystemOrganization addCategory: #'Seaside-Component-Base'!
3-
SystemOrganization addCategory: #'Seaside-Component-Exceptions'!
4-
SystemOrganization addCategory: #'Seaside-Component-Tasks'!
5-
SystemOrganization addCategory: #'Seaside-Component-Visitors'!
1+
self packageOrganizer ensurePackage: #'Seaside-Component' withTags: #(#Base #Exceptions #Tasks #Visitors)!
Original file line numberDiff line numberDiff line change
@@ -1,4 +1 @@
1-
SystemOrganization addCategory: #'Seaside-RenderLoop'!
2-
SystemOrganization addCategory: #'Seaside-RenderLoop-Base'!
3-
SystemOrganization addCategory: #'Seaside-RenderLoop-Continuations'!
4-
SystemOrganization addCategory: #'Seaside-RenderLoop-Errors'!
1+
self packageOrganizer ensurePackage: #'Seaside-RenderLoop' withTags: #(#Base #Continuations #Errors)!
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
SystemOrganization addCategory: #'Seaside-Tests-Session'!
1+
self packageOrganizer ensurePackage: #'Seaside-Tests-Session' withTags: #()!
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"separateMethodMetaAndSource" : false,
3+
"noMethodMetaData" : true,
4+
"useCypressPropertiesFile" : true
5+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
*Seaside-Tests-WebComponents
2+
seasideTestsWebComponents
3+
^ self new
4+
name: 'Seaside-WebComponents-Examples';
5+
description: 'Tests for Seaside-WebComponents';
6+
addDependency: 'Seaside-WebComponents-Core';
7+
addDependency: 'Seaside-Tests-Core';
8+
addDependency: 'Seaside-Session';
9+
addDependency: 'Seaside-Examples';
10+
url: #seasideUrl;
11+
yourself
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"name" : "GRPackage"
3+
}

repository/Seaside-Tests-WebComponents.package/WAFragmentRenderingTest.class/README.md

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
testing
2+
shouldInheritSelectors
3+
^ false
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
private
2+
newHandler
3+
| application |
4+
application := WAApplication new.
5+
application configuration
6+
addParent: WARenderLoopConfiguration instance.
7+
^ application
8+
rootClass: WACounter;
9+
preferenceAt: #renderPhaseContinuationClass put: WAFragmentRenderPhaseContinuation;
10+
yourself
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
running
2+
requestWithMethod: aString
3+
^ WARequest
4+
method: aString
5+
uri: '/app/oneo'
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
tests
2+
testRendering
3+
| context request responseContents |
4+
request := self requestWithMethod: 'GET'.
5+
context := WARequestContext request: request response: WABufferedResponse new.
6+
[ handler handle: context ]
7+
on: WAResponseNotification
8+
do: [ :notification | ].
9+
self assert: context response status = 200.
10+
responseContents := context response contents.
11+
self assert: (responseContents beginsWith: '<h1>').
12+
self assert: (responseContents endsWith: '</a>')
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"commentStamp" : "",
3+
"super" : "WARequestHandlerTest",
4+
"category" : "Seaside-Tests-WebComponents",
5+
"classinstvars" : [ ],
6+
"pools" : [ ],
7+
"classvars" : [ ],
8+
"instvars" : [ ],
9+
"name" : "WAFragmentRenderingTest",
10+
"type" : "normal"
11+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
self packageOrganizer ensurePackage: #'Seaside-Tests-WebComponents' withTags: #()!

repository/Seaside-Tests-WebComponents.package/monticello.meta/initializers.st

Whitespace-only changes.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
(name 'Seaside-Tests-WebComponents')
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{ }
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"separateMethodMetaAndSource" : false,
3+
"noMethodMetaData" : true,
4+
"useCypressPropertiesFile" : true
5+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
*Seaside-WebComponents-Core
2+
seasideWebComponentsCore
3+
^ self new
4+
name: 'Seaside-WebComponents-Core';
5+
description: 'Allows embedding Seaside components as Web Components';
6+
addDependency: 'Seaside-Core';
7+
addDependency: 'Seaside-Canvas';
8+
addDependency: 'Seaside-Component';
9+
addDependency: 'Seaside-RenderLoop';
10+
url: #seasideUrl;
11+
yourself
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"name" : "GRPackage"
3+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
private
2+
createHtmlRootWithContext: aRenderContext
3+
^ WANilHtmlRoot new
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
updating
2+
toPresenterSendRoot: anHtmlRoot
3+
"intentionally empty"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
updating
2+
updateRoot: anHtmlRoot
3+
"intentionally empty"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"commentStamp" : "Anonymous 7/6/2024 13:05",
3+
"super" : "WARenderPhaseContinuation",
4+
"category" : "Seaside-WebComponents-Core",
5+
"classinstvars" : [ ],
6+
"pools" : [ ],
7+
"classvars" : [ ],
8+
"instvars" : [ ],
9+
"name" : "WAFragmentRenderPhaseContinuation",
10+
"type" : "normal"
11+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
updating
2+
updateRoot: anHtmlRoot
3+
self shouldNotImplement
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"commentStamp" : "xxx 7/10/2024 09:34",
3+
"super" : "WAComponent",
4+
"category" : "Seaside-WebComponents-Core",
5+
"classinstvars" : [ ],
6+
"pools" : [ ],
7+
"classvars" : [ ],
8+
"instvars" : [ ],
9+
"name" : "WAHeadlessComponent",
10+
"type" : "normal"
11+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
writing
2+
closeOn: aDocument
3+
"intentionally empty"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
writing
2+
openOn: aDocument
3+
"intentionally empty"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"commentStamp" : "Anonymous 7/6/2024 13:07",
3+
"super" : "WAObject",
4+
"category" : "Seaside-WebComponents-Core",
5+
"classinstvars" : [ ],
6+
"pools" : [ ],
7+
"classvars" : [ ],
8+
"instvars" : [ ],
9+
"name" : "WANilHtmlRoot",
10+
"type" : "normal"
11+
}

0 commit comments

Comments
 (0)