-
Notifications
You must be signed in to change notification settings - Fork 642
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: support spread event handlers on native tag (#2231)
- Loading branch information
1 parent
9d94b0d
commit 2200c45
Showing
26 changed files
with
500 additions
and
61 deletions.
There are no files selected for viewing
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 |
---|---|---|
|
@@ -7,8 +7,8 @@ | |
{ | ||
"name": "*", | ||
"total": { | ||
"min": 13393, | ||
"brotli": 5228 | ||
"min": 13478, | ||
"brotli": 5270 | ||
} | ||
}, | ||
{ | ||
|
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
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 |
---|---|---|
|
@@ -13,6 +13,7 @@ export { | |
html, | ||
attr, | ||
attrs, | ||
attrsEvents, | ||
classAttr, | ||
styleAttr, | ||
props, | ||
|
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
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
36 changes: 36 additions & 0 deletions
36
...src/__tests__/fixtures/body-content-new/__snapshots__/csr-sanitized.expected.md
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,36 @@ | ||
# Render {} | ||
```html | ||
<button> | ||
0 | ||
</button> | ||
``` | ||
|
||
|
||
# Render | ||
container.querySelector("button").click() | ||
|
||
```html | ||
<button> | ||
1 | ||
</button> | ||
``` | ||
|
||
|
||
# Render | ||
container.querySelector("button").click() | ||
|
||
```html | ||
<button> | ||
2 | ||
</button> | ||
``` | ||
|
||
|
||
# Render | ||
container.querySelector("button").click() | ||
|
||
```html | ||
<button> | ||
3 | ||
</button> | ||
``` |
56 changes: 56 additions & 0 deletions
56
...ator-tags/src/__tests__/fixtures/body-content-new/__snapshots__/csr.expected.md
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,56 @@ | ||
# Render {} | ||
```html | ||
<button> | ||
0 | ||
</button> | ||
``` | ||
|
||
# Mutations | ||
``` | ||
inserted button0 | ||
``` | ||
|
||
|
||
# Render | ||
container.querySelector("button").click() | ||
|
||
```html | ||
<button> | ||
1 | ||
</button> | ||
``` | ||
|
||
# Mutations | ||
``` | ||
button0/#text0: "0" => "1" | ||
``` | ||
|
||
|
||
# Render | ||
container.querySelector("button").click() | ||
|
||
```html | ||
<button> | ||
2 | ||
</button> | ||
``` | ||
|
||
# Mutations | ||
``` | ||
button0/#text0: "1" => "2" | ||
``` | ||
|
||
|
||
# Render | ||
container.querySelector("button").click() | ||
|
||
```html | ||
<button> | ||
3 | ||
</button> | ||
``` | ||
|
||
# Mutations | ||
``` | ||
button0/#text0: "2" => "3" | ||
``` |
27 changes: 27 additions & 0 deletions
27
.../__tests__/fixtures/body-content-new/__snapshots__/dom.expected/components/FancyButton.js
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,27 @@ | ||
import { attrs as _attrs2, attrsEvents as _attrsEvents, conditional as _conditional, register as _register, queueEffect as _queueEffect, value as _value, createRenderer as _createRenderer, createTemplate as _createTemplate } from "@marko/runtime-tags/debug/dom"; | ||
const _dynamicTagName = /* @__PURE__ */_conditional("#text/1"); | ||
const _attrs_effect = _register("packages/translator-tags/src/__tests__/fixtures/body-content-new/components/FancyButton.marko_0_attrs", _scope => _attrsEvents(_scope, "#button/0")); | ||
const _attrs = /* @__PURE__ */_value("attrs", (_scope, attrs) => { | ||
_attrs2(_scope, "#button/0", attrs); | ||
_queueEffect(_scope, _attrs_effect); | ||
}); | ||
const _renderBody = /* @__PURE__ */_value("renderBody", (_scope, renderBody) => _dynamicTagName(_scope, renderBody), void 0, _dynamicTagName); | ||
const _destructure2 = (_scope, _destructure, _clean) => { | ||
let renderBody, attrs; | ||
if (!_clean) ({ | ||
renderBody, | ||
...attrs | ||
} = _destructure); | ||
_renderBody(_scope, renderBody, _clean); | ||
_attrs(_scope, attrs, _clean); | ||
}; | ||
const _input = /* @__PURE__ */_value("input", (_scope, input) => _destructure2(_scope, input), void 0, _destructure2); | ||
export const _args_ = (_scope, _destructure3, _clean) => { | ||
let input; | ||
if (!_clean) [input] = _destructure3; | ||
_input(_scope, input, _clean); | ||
}; | ||
export const _template_ = "<button><!></button>"; | ||
export const _walks_ = /* get, next(1), replace, out(1) */" D%l"; | ||
export const _setup_ = function () {}; | ||
export default /* @__PURE__ */_createTemplate( /* @__PURE__ */_createRenderer(_template_, _walks_, _setup_, void 0, void 0, _args_), "packages/translator-tags/src/__tests__/fixtures/body-content-new/components/FancyButton.marko"); |
4 changes: 4 additions & 0 deletions
4
...gs/src/__tests__/fixtures/body-content-new/__snapshots__/dom.expected/template.hydrate.js
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 @@ | ||
import { init } from "@marko/runtime-tags/debug/dom"; | ||
import "./template.marko"; | ||
import "./components/FancyButton.marko"; | ||
init(); |
24 changes: 24 additions & 0 deletions
24
...lator-tags/src/__tests__/fixtures/body-content-new/__snapshots__/dom.expected/template.js
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,24 @@ | ||
import { queueSource as _queueSource, data as _data, register as _register, bindRenderer as _bindRenderer, inChild as _inChild, dynamicClosure as _dynamicClosure, registerSubscriber as _registerSubscriber, createRenderer as _createRenderer, dynamicSubscribers as _dynamicSubscribers, value as _value, createTemplate as _createTemplate } from "@marko/runtime-tags/debug/dom"; | ||
import { _setup_ as _FancyButton, _args_ as _FancyButton_args, _template_ as _FancyButton_template, _walks_ as _FancyButton_walks } from "./components/FancyButton.marko"; | ||
const _onClick = _register("packages/translator-tags/src/__tests__/fixtures/body-content-new/template.marko_0/onClick", _scope => { | ||
const { | ||
clickCount | ||
} = _scope; | ||
return function () { | ||
_queueSource(_scope, _clickCount, clickCount + 1); | ||
}; | ||
}); | ||
const _clickCount$FancyButtonBody = _registerSubscriber("packages/translator-tags/src/__tests__/fixtures/body-content-new/template.marko_1_clickCount/subscriber", /* @__PURE__ */_dynamicClosure("clickCount", (_scope, clickCount) => _data(_scope["#text/0"], clickCount))); | ||
const _FancyButtonBody = _register("packages/translator-tags/src/__tests__/fixtures/body-content-new/template.marko_1_renderer", /* @__PURE__ */_createRenderer(" ", /* get */" ", void 0, [_clickCount$FancyButtonBody])); | ||
const _clickCount = /* @__PURE__ */_value("clickCount", (_scope, clickCount) => _FancyButton_args(_scope["#childScope/0"], [{ | ||
onClick: _onClick(_scope), | ||
renderBody: /* @__PURE__ */_bindRenderer(_scope, _FancyButtonBody) | ||
}]), _dynamicSubscribers("clickCount"), _inChild("#childScope/0", _FancyButton_args)); | ||
const _setup = _scope => { | ||
_FancyButton(_scope["#childScope/0"]); | ||
_clickCount(_scope, 0); | ||
}; | ||
export const _template_ = `${_FancyButton_template}`; | ||
export const _walks_ = /* beginChild, _FancyButton_walks, endChild */`/${_FancyButton_walks}&`; | ||
export const _setup_ = _setup; | ||
export default /* @__PURE__ */_createTemplate( /* @__PURE__ */_createRenderer(_template_, _walks_, _setup_), "packages/translator-tags/src/__tests__/fixtures/body-content-new/template.marko"); |
18 changes: 18 additions & 0 deletions
18
...__tests__/fixtures/body-content-new/__snapshots__/html.expected/components/FancyButton.js
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,18 @@ | ||
import { attrs as _attrs2, write as _write, dynamicTagInput as _dynamicTagInput, markResumeControlEnd as _markResumeControlEnd, markResumeNode as _markResumeNode, writeEffect as _writeEffect, writeScope as _writeScope, nextScopeId as _nextScopeId, createRenderer as _createRenderer, createTemplate as _createTemplate } from "@marko/runtime-tags/debug/html"; | ||
const _renderer = /* @__PURE__ */_createRenderer((input, _tagVar) => { | ||
const _scope0_id = _nextScopeId(); | ||
const { | ||
renderBody, | ||
...attrs | ||
} = input; | ||
_write(`<button${_attrs2(attrs, "#button/0", _scope0_id)}>`); | ||
const _dynamicScope = _dynamicTagInput(renderBody, {}); | ||
_write(`${_markResumeControlEnd(_scope0_id, "#text/1")}</button>${_markResumeNode(_scope0_id, "#button/0")}`); | ||
_writeEffect(_scope0_id, "packages/translator-tags/src/__tests__/fixtures/body-content-new/components/FancyButton.marko_0_attrs"); | ||
_writeScope(_scope0_id, { | ||
"attrs": attrs, | ||
"#text/1!": _dynamicScope, | ||
"#text/1(": renderBody | ||
}); | ||
}); | ||
export default /* @__PURE__ */_createTemplate(_renderer, "packages/translator-tags/src/__tests__/fixtures/body-content-new/components/FancyButton.marko"); |
25 changes: 25 additions & 0 deletions
25
...ator-tags/src/__tests__/fixtures/body-content-new/__snapshots__/html.expected/template.js
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,25 @@ | ||
import { escapeXML as _escapeXML, markResumeNode as _markResumeNode, write as _write, ensureScopeWithId as _ensureScopeWithId, writeEffect as _writeEffect, writeScope as _writeScope, nextScopeId as _nextScopeId, register as _register, createRenderer as _createRenderer, peekNextScope as _peekNextScope, createTemplate as _createTemplate } from "@marko/runtime-tags/debug/html"; | ||
import _FancyButton from "./components/FancyButton.marko"; | ||
const _renderer = /* @__PURE__ */_createRenderer((input, _tagVar) => { | ||
const _scope0_id = _nextScopeId(); | ||
const clickCount = 0; | ||
const _childScope = _peekNextScope(); | ||
_FancyButton._({ | ||
onClick: _register(function () { | ||
clickCount++; | ||
}, "packages/translator-tags/src/__tests__/fixtures/body-content-new/template.marko_0/onClick", _scope0_id), | ||
renderBody: /* @__PURE__ */_createRenderer(() => { | ||
const _scope1_id = _nextScopeId(); | ||
_write(`${_escapeXML(clickCount)}${_markResumeNode(_scope1_id, "#text/0")}`); | ||
_writeEffect(_scope1_id, "packages/translator-tags/src/__tests__/fixtures/body-content-new/template.marko_1_clickCount/subscriber"); | ||
_writeScope(_scope1_id, { | ||
"_": _ensureScopeWithId(_scope0_id) | ||
}); | ||
}) | ||
}); | ||
_writeScope(_scope0_id, { | ||
"clickCount": clickCount, | ||
"#childScope/0": _childScope | ||
}); | ||
}); | ||
export default /* @__PURE__ */_createTemplate(_renderer, "packages/translator-tags/src/__tests__/fixtures/body-content-new/template.marko"); |
Oops, something went wrong.