Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .changeset/add-css-source-map-diagnostics.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@lynx-js/css-serializer": patch
"@lynx-js/template-webpack-plugin": minor
---

Add CSS source map support and source-mapped template encode diagnostics.
5 changes: 5 additions & 0 deletions .changeset/enable-rspeedy-css-sourcemap.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@lynx-js/rspeedy": patch
---

Enable CSS source maps by default in Rspeedy output config.
5 changes: 5 additions & 0 deletions .changeset/fix-event-apis-panic.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@lynx-js/web-core": patch
---

fix: avoid panic in dispatch_event_by_path when element data cannot be retrieved
9 changes: 9 additions & 0 deletions .changeset/fix-react-runtime-execid-churn.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
"@lynx-js/react": patch
---

fix: reduce redundant updates for main-thread handlers and gestures

- Updates are faster when the main-thread event handler or gesture object is stable across rerenders (fewer unnecessary native updates).
- Spread props rerenders that don't semantically change the handler/gesture no longer trigger redundant updates.
- Removing a gesture from spread props reliably clears the gesture state on the target element.
5 changes: 5 additions & 0 deletions .changeset/legal-phones-tell.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@lynx-js/react-webpack-plugin": patch
---

Support `@lynx-js/template-webpack-plugin` v0.11.0.
5 changes: 5 additions & 0 deletions .changeset/tender-bees-lick.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@lynx-js/css-extract-webpack-plugin": patch
---

Support `@lynx-js/template-webpack-plugin` v0.11.0.
5 changes: 5 additions & 0 deletions .changeset/tiny-pianos-enter.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@lynx-js/web-elements": patch
---

fix: line-height of markdown-style should be added `px`
5 changes: 5 additions & 0 deletions .github/css-source-map-diagnostics.instructions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
applyTo: "packages/{tools/css-serializer,webpack/template-webpack-plugin,rspeedy/core}/**"
---

When adding CSS diagnostics or source map plumbing across Rspeedy, css-serializer, and the template webpack plugin, preserve bundle-space `loc` data during debundle so warnings can be remapped through the main CSS source map back to original source files. Keep `cssSource` stable as `/cssId/<id>.css`, and only surface real source filenames in diagnostics when the mapped source path resolves to an existing file.
2 changes: 1 addition & 1 deletion packages/lynx/gesture-runtime/src/baseGesture.ts
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ abstract class BaseGesture<
return removeUndefined(result);
};

toJSON = (): Record<string, unknown> => {
toJSON = function(this: BaseGesture): Record<string, unknown> {
return this.serialize();
};

Expand Down
2 changes: 1 addition & 1 deletion packages/lynx/gesture-runtime/src/composition.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ class ComposedGesture implements GestureKind {
};
};

toJSON = (): Record<string, unknown> => {
toJSON = function(this: ComposedGesture): Record<string, unknown> {
return this.serialize();
};
}
Expand Down
160 changes: 121 additions & 39 deletions packages/react/runtime/__test__/snapshot/gesture.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,12 @@ describe('Gesture', () => {
},
},
__isGesture: true,
toJSON: () => ({
...gesture,
__isSerialized: true,
}),
toJSON: function() {
return {
...this,
__isSerialized: true,
};
},
};

return (
Expand Down Expand Up @@ -171,10 +173,12 @@ describe('Gesture', () => {
simultaneousWith: [{ id: 2 }],
continueWith: [{ id: 2 }],
__isGesture: true,
toJSON: () => ({
...panGesture,
__isSerialized: true,
}),
toJSON: function() {
return {
...this,
__isSerialized: true,
};
},
};
const tapGesture = {
id: 2,
Expand All @@ -186,20 +190,24 @@ describe('Gesture', () => {
},
__isGesture: true,
waitFor: [{ id: 1 }],
toJSON: () => ({
...tapGesture,
__isSerialized: true,
}),
toJSON: function() {
return {
...this,
__isSerialized: true,
};
},
};

const gesture = {
type: -1,
__isGesture: true,
gestures: [panGesture, tapGesture],
toJSON: () => ({
...gesture,
__isSerialized: true,
}),
toJSON: function() {
return {
...this,
__isSerialized: true,
};
},
};

return (
Expand Down Expand Up @@ -302,10 +310,9 @@ describe('Gesture', () => {
},
},
__isGesture: true,
toJSON() {
const { toJSON, ...rest } = this;
toJSON: function() {
return {
...rest,
...this,
__isSerialized: true,
};
},
Expand Down Expand Up @@ -443,10 +450,9 @@ describe('Gesture', () => {
},
},
__isGesture: true,
toJSON() {
const { toJSON, ...rest } = this;
toJSON: function() {
return {
...rest,
...this,
__isSerialized: true,
};
},
Expand Down Expand Up @@ -568,10 +574,12 @@ describe('Gesture', () => {
minDistance: 100,
},
__isGesture: true,
toJSON: () => ({
...gesture,
__isSerialized: true,
}),
toJSON: function() {
return {
...this,
__isSerialized: true,
};
},
};

return (
Expand Down Expand Up @@ -676,10 +684,12 @@ describe('Gesture in spread', () => {
},
},
__isGesture: true,
toJSON: () => ({
...gesture,
__isSerialized: true,
}),
toJSON: function() {
return {
...this,
__isSerialized: true,
};
},
};

const props = {
Expand Down Expand Up @@ -806,10 +816,9 @@ describe('Gesture in spread', () => {
},
},
__isGesture: true,
toJSON() {
const { toJSON, ...rest } = this;
toJSON: function() {
return {
...rest,
...this,
__isSerialized: true,
};
},
Expand Down Expand Up @@ -915,10 +924,9 @@ describe('Gesture in spread', () => {
},
},
__isGesture: true,
toJSON() {
const { toJSON, ...rest } = this;
toJSON: function() {
return {
...rest,
...this,
__isSerialized: true,
};
},
Expand Down Expand Up @@ -1041,10 +1049,9 @@ describe('Gesture in spread', () => {
},
},
__isGesture: true,
toJSON() {
const { toJSON, ...rest } = this;
toJSON: function() {
return {
...rest,
...this,
__isSerialized: true,
};
},
Expand Down Expand Up @@ -1117,6 +1124,81 @@ describe('Gesture in spread', () => {
expect(elementTree.__GetGestureDetectorIds(textElement).includes(1)).toBe(false);
}
});
it('keeps flatten when spread removes gesture but retains no-flatten attrs', async function() {
const spyRemoveGesture = vi.spyOn(globalThis, '__RemoveGestureDetector');
let _gesture = {
id: 1,
type: 0,
callbacks: {
onUpdate: {
_wkltId: 'bdd4:dd564:2',
},
},
__isGesture: true,
toJSON: function() {
return {
...this,
__isSerialized: true,
};
},
};
let keepGesture = true;

function Comp() {
const props = keepGesture
? {
'clip-radius': 8,
'main-thread:gesture': _gesture,
}
: {
'clip-radius': 8,
};
return (
<view>
<text {...props}>1</text>
</view>
);
}

{
__root.__jsx = <Comp />;
renderPage();
}

{
globalEnvManager.switchToBackground();
render(<Comp />, __root);
}

{
lynxCoreInject.tt.OnLifecycleEvent(...globalThis.__OnLifecycleEvent.mock.calls[0]);

globalEnvManager.switchToMainThread();
const rLynxChange = lynx.getNativeApp().callLepusMethod.mock.calls[0];
globalThis[rLynxChange[0]](rLynxChange[1]);
}

{
globalEnvManager.switchToBackground();
lynx.getNativeApp().callLepusMethod.mockClear();
spyRemoveGesture.mockClear();
keepGesture = false;

render(<Comp />, __root);

globalEnvManager.switchToMainThread();
const rLynxChange = lynx.getNativeApp().callLepusMethod.mock.calls[0];
globalThis[rLynxChange[0]](rLynxChange[1]);
const textElement = __root.__element_root.children[0].children[0];

expect(spyRemoveGesture).toHaveBeenCalledTimes(1);
expect(spyRemoveGesture).toHaveBeenCalledWith(textElement, 1);
expect(textElement.props['clip-radius']).toBe(8);
expect(textElement.props.flatten).toBe(false);
expect(textElement.props['has-react-gesture']).toBeUndefined();
expect(textElement.props.gesture).toBeUndefined();
}
});
it('remove stale detector ids when gesture count shrinks on diff', async function() {
const spySetGesture = vi.spyOn(globalThis, '__SetGestureDetector');
const spyRemoveGesture = vi.spyOn(globalThis, '__RemoveGestureDetector');
Expand Down
Loading
Loading