@lynx-js/react 0.117.0 → 0.118.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +24 -0
- package/package.json +14 -14
- package/refresh/.turbo/turbo-build.log +1 -1
- package/runtime/lazy/internal.js +8 -0
- package/runtime/lepus/jsx-runtime/index.js +17 -17
- package/runtime/lib/debug/printSnapshot.d.ts +3 -3
- package/runtime/lib/debug/printSnapshot.js +2 -2
- package/runtime/lib/debug/printSnapshot.js.map +1 -1
- package/runtime/lib/debug/profile.js +1 -2
- package/runtime/lib/debug/profile.js.map +1 -1
- package/runtime/lib/document.d.ts +2 -2
- package/runtime/lib/document.js +2 -2
- package/runtime/lib/document.js.map +1 -1
- package/runtime/lib/gesture/types.d.ts +13 -12
- package/runtime/lib/gesture/types.js +11 -12
- package/runtime/lib/gesture/types.js.map +1 -1
- package/runtime/lib/hooks/react.d.ts +2 -1
- package/runtime/lib/hooks/react.js +13 -7
- package/runtime/lib/hooks/react.js.map +1 -1
- package/runtime/lib/internal.d.ts +5 -3
- package/runtime/lib/internal.js +5 -3
- package/runtime/lib/internal.js.map +1 -1
- package/runtime/lib/lifecycle/constant.d.ts +19 -0
- package/runtime/lib/lifecycle/constant.js +17 -0
- package/runtime/lib/lifecycle/constant.js.map +1 -0
- package/runtime/lib/lifecycle/event/delayLifecycleEvents.d.ts +1 -1
- package/runtime/lib/lifecycle/event/jsReady.js +1 -1
- package/runtime/lib/lifecycle/event/jsReady.js.map +1 -1
- package/runtime/lib/lifecycle/isRendering.js +6 -8
- package/runtime/lib/lifecycle/isRendering.js.map +1 -1
- package/runtime/lib/lifecycle/patch/commit.d.ts +1 -1
- package/runtime/lib/lifecycle/patch/commit.js +10 -10
- package/runtime/lib/lifecycle/patch/commit.js.map +1 -1
- package/runtime/lib/lifecycle/patch/error.js +2 -1
- package/runtime/lib/lifecycle/patch/error.js.map +1 -1
- package/runtime/lib/lifecycle/patch/globalState.d.ts +8 -0
- package/runtime/lib/lifecycle/patch/globalState.js +14 -0
- package/runtime/lib/lifecycle/patch/globalState.js.map +1 -0
- package/runtime/lib/lifecycle/patch/snapshotPatchApply.js +1 -1
- package/runtime/lib/lifecycle/patch/snapshotPatchApply.js.map +1 -1
- package/runtime/lib/lifecycle/patch/updateMainThread.js +3 -3
- package/runtime/lib/lifecycle/patch/updateMainThread.js.map +1 -1
- package/runtime/lib/lifecycle/ref/delay.js +1 -1
- package/runtime/lib/lifecycle/ref/delay.js.map +1 -1
- package/runtime/lib/lifecycle/reload.js +9 -8
- package/runtime/lib/lifecycle/reload.js.map +1 -1
- package/runtime/lib/lifecycle/render.js +3 -15
- package/runtime/lib/lifecycle/render.js.map +1 -1
- package/runtime/lib/{list.d.ts → list/list.d.ts} +1 -1
- package/runtime/lib/{list.js → list/list.js} +3 -3
- package/runtime/lib/list/list.js.map +1 -0
- package/runtime/lib/{listUpdateInfo.d.ts → list/listUpdateInfo.d.ts} +1 -1
- package/runtime/lib/{listUpdateInfo.js → list/listUpdateInfo.js} +2 -2
- package/runtime/lib/list/listUpdateInfo.js.map +1 -0
- package/runtime/lib/list/pendingListUpdates.js.map +1 -0
- package/runtime/lib/lynx/calledByNative.js +7 -6
- package/runtime/lib/lynx/calledByNative.js.map +1 -1
- package/runtime/lib/lynx/injectLepusMethods.js +1 -1
- package/runtime/lib/lynx/injectLepusMethods.js.map +1 -1
- package/runtime/lib/lynx/performance.js +6 -13
- package/runtime/lib/lynx/performance.js.map +1 -1
- package/runtime/lib/lynx/suspense.js +2 -2
- package/runtime/lib/lynx/suspense.js.map +1 -1
- package/runtime/lib/lynx/tt.js +2 -3
- package/runtime/lib/lynx/tt.js.map +1 -1
- package/runtime/lib/lynx-api.js +1 -1
- package/runtime/lib/lynx-api.js.map +1 -1
- package/runtime/lib/renderToOpcodes/constants.d.ts +2 -0
- package/runtime/lib/renderToOpcodes/constants.js +2 -0
- package/runtime/lib/renderToOpcodes/constants.js.map +1 -1
- package/runtime/lib/{hydrate.d.ts → renderToOpcodes/hydrate.d.ts} +2 -2
- package/runtime/lib/{hydrate.js → renderToOpcodes/hydrate.js} +6 -6
- package/runtime/lib/renderToOpcodes/hydrate.js.map +1 -0
- package/runtime/lib/renderToOpcodes/index.d.ts +2 -1
- package/runtime/lib/renderToOpcodes/index.js +79 -24
- package/runtime/lib/renderToOpcodes/index.js.map +1 -1
- package/runtime/lib/{opcodes.d.ts → renderToOpcodes/opcodes.d.ts} +1 -2
- package/runtime/lib/{opcodes.js → renderToOpcodes/opcodes.js} +62 -65
- package/runtime/lib/renderToOpcodes/opcodes.js.map +1 -0
- package/runtime/lib/root.d.ts +2 -2
- package/runtime/lib/root.js +2 -2
- package/runtime/lib/root.js.map +1 -1
- package/runtime/lib/{backgroundSnapshot.d.ts → snapshot/backgroundSnapshot.d.ts} +13 -2
- package/runtime/lib/{backgroundSnapshot.js → snapshot/backgroundSnapshot.js} +77 -16
- package/runtime/lib/snapshot/backgroundSnapshot.js.map +1 -0
- package/runtime/lib/snapshot/constants.d.ts +11 -0
- package/runtime/lib/snapshot/constants.js +15 -0
- package/runtime/lib/snapshot/constants.js.map +1 -0
- package/runtime/lib/snapshot/definition.d.ts +29 -0
- package/runtime/lib/snapshot/definition.js +109 -0
- package/runtime/lib/snapshot/definition.js.map +1 -0
- package/runtime/lib/snapshot/dynamicPartType.d.ts +13 -8
- package/runtime/lib/snapshot/dynamicPartType.js +12 -9
- package/runtime/lib/snapshot/dynamicPartType.js.map +1 -1
- package/runtime/lib/snapshot/event.d.ts +1 -1
- package/runtime/lib/snapshot/event.js +1 -1
- package/runtime/lib/snapshot/event.js.map +1 -1
- package/runtime/lib/snapshot/gesture.d.ts +1 -1
- package/runtime/lib/snapshot/gesture.js +0 -1
- package/runtime/lib/snapshot/gesture.js.map +1 -1
- package/runtime/lib/snapshot/index.d.ts +4 -0
- package/runtime/lib/snapshot/index.js +8 -0
- package/runtime/lib/snapshot/index.js.map +1 -0
- package/runtime/lib/snapshot/list.d.ts +1 -1
- package/runtime/lib/snapshot/list.js +2 -2
- package/runtime/lib/snapshot/list.js.map +1 -1
- package/runtime/lib/snapshot/platformInfo.d.ts +1 -1
- package/runtime/lib/snapshot/platformInfo.js +2 -3
- package/runtime/lib/snapshot/platformInfo.js.map +1 -1
- package/runtime/lib/snapshot/ref.d.ts +1 -1
- package/runtime/lib/snapshot/ref.js.map +1 -1
- package/runtime/lib/snapshot/snapshot.d.ts +58 -0
- package/runtime/lib/{snapshot.js → snapshot/snapshot.js} +24 -172
- package/runtime/lib/snapshot/snapshot.js.map +1 -0
- package/runtime/lib/snapshot/snapshotInstanceHydrationMap.js.map +1 -0
- package/runtime/lib/snapshot/spread.d.ts +2 -2
- package/runtime/lib/snapshot/spread.js +3 -3
- package/runtime/lib/snapshot/spread.js.map +1 -1
- package/runtime/lib/snapshot/types.d.ts +19 -0
- package/runtime/lib/snapshot/types.js +5 -0
- package/runtime/lib/snapshot/types.js.map +1 -0
- package/runtime/lib/snapshot/utils.d.ts +12 -0
- package/runtime/lib/snapshot/utils.js +20 -0
- package/runtime/lib/snapshot/utils.js.map +1 -0
- package/runtime/lib/snapshot/workletEvent.d.ts +1 -1
- package/runtime/lib/snapshot/workletEvent.js +1 -1
- package/runtime/lib/snapshot/workletEvent.js.map +1 -1
- package/runtime/lib/snapshot/workletRef.d.ts +1 -1
- package/runtime/lib/tsconfig.tsbuildinfo +1 -0
- package/runtime/lib/utils.d.ts +1 -0
- package/runtime/lib/utils.js +4 -1
- package/runtime/lib/utils.js.map +1 -1
- package/runtime/lib/worklet/ref/updateInitValue.js +1 -1
- package/runtime/lib/worklet/ref/updateInitValue.js.map +1 -1
- package/runtime/lib/worklet-runtime/api/animation/animation.js.map +1 -0
- package/runtime/lib/worklet-runtime/api/animation/effect.js.map +1 -0
- package/runtime/lib/worklet-runtime/api/element.js.map +1 -0
- package/{worklet-runtime/lib → runtime/lib/worklet-runtime}/api/lepusQuerySelector.js +10 -2
- package/runtime/lib/worklet-runtime/api/lepusQuerySelector.js.map +1 -0
- package/runtime/lib/worklet-runtime/api/lynxApi.js.map +1 -0
- package/runtime/lib/worklet-runtime/bindings/bindings.js.map +1 -0
- package/runtime/lib/worklet-runtime/bindings/events.js.map +1 -0
- package/runtime/lib/worklet-runtime/bindings/index.js.map +1 -0
- package/runtime/lib/worklet-runtime/bindings/loadRuntime.js.map +1 -0
- package/runtime/lib/worklet-runtime/bindings/observers.js.map +1 -0
- package/runtime/lib/worklet-runtime/bindings/types.js.map +1 -0
- package/runtime/lib/worklet-runtime/delayRunOnBackground.js.map +1 -0
- package/runtime/lib/worklet-runtime/delayWorkletEvent.js.map +1 -0
- package/runtime/lib/worklet-runtime/eomImpl.js.map +1 -0
- package/runtime/lib/worklet-runtime/eventPropagation.js.map +1 -0
- package/runtime/lib/worklet-runtime/global.js.map +1 -0
- package/runtime/lib/worklet-runtime/hydrate.js.map +1 -0
- package/runtime/lib/worklet-runtime/index.js.map +1 -0
- package/runtime/lib/worklet-runtime/jsFunctionLifecycle.js.map +1 -0
- package/runtime/lib/worklet-runtime/listeners.js.map +1 -0
- package/runtime/lib/worklet-runtime/runOnMainThread.js.map +1 -0
- package/runtime/lib/worklet-runtime/utils/mainThreadFlushLoopGuard.js.map +1 -0
- package/runtime/lib/worklet-runtime/utils/profile.js.map +1 -0
- package/runtime/lib/worklet-runtime/utils/version.js.map +1 -0
- package/runtime/lib/worklet-runtime/workletRef.js.map +1 -0
- package/runtime/lib/worklet-runtime/workletRuntime.js.map +1 -0
- package/runtime/worklet-runtime/dev.js +629 -0
- package/{worklet-runtime/dist → runtime/worklet-runtime}/main.js +1 -1
- package/testing-library/dist/pure.js +1 -1
- package/testing-library/dist/vitest-global-setup.js +4 -5
- package/transform/dist/wasm.cjs +1 -1
- package/transform/index.d.ts +27 -1
- package/runtime/lib/backgroundSnapshot.js.map +0 -1
- package/runtime/lib/hydrate.js.map +0 -1
- package/runtime/lib/lifecycleConstant.d.ts +0 -17
- package/runtime/lib/lifecycleConstant.js +0 -19
- package/runtime/lib/lifecycleConstant.js.map +0 -1
- package/runtime/lib/list.js.map +0 -1
- package/runtime/lib/listUpdateInfo.js.map +0 -1
- package/runtime/lib/opcodes.js.map +0 -1
- package/runtime/lib/pendingListUpdates.js.map +0 -1
- package/runtime/lib/snapshot.d.ts +0 -104
- package/runtime/lib/snapshot.js.map +0 -1
- package/runtime/lib/snapshotInstanceHydrationMap.js.map +0 -1
- package/worklet-runtime/dist/dev.js +0 -625
- package/worklet-runtime/lib/api/animation/animation.js.map +0 -1
- package/worklet-runtime/lib/api/animation/effect.js.map +0 -1
- package/worklet-runtime/lib/api/element.js.map +0 -1
- package/worklet-runtime/lib/api/lepusQuerySelector.js.map +0 -1
- package/worklet-runtime/lib/api/lynxApi.js.map +0 -1
- package/worklet-runtime/lib/bindings/bindings.js.map +0 -1
- package/worklet-runtime/lib/bindings/events.js.map +0 -1
- package/worklet-runtime/lib/bindings/index.js.map +0 -1
- package/worklet-runtime/lib/bindings/loadRuntime.js.map +0 -1
- package/worklet-runtime/lib/bindings/observers.js.map +0 -1
- package/worklet-runtime/lib/bindings/types.js.map +0 -1
- package/worklet-runtime/lib/delayRunOnBackground.js.map +0 -1
- package/worklet-runtime/lib/delayWorkletEvent.js.map +0 -1
- package/worklet-runtime/lib/eomImpl.js.map +0 -1
- package/worklet-runtime/lib/eventPropagation.js.map +0 -1
- package/worklet-runtime/lib/global.js.map +0 -1
- package/worklet-runtime/lib/hydrate.js.map +0 -1
- package/worklet-runtime/lib/index.js.map +0 -1
- package/worklet-runtime/lib/jsFunctionLifecycle.js.map +0 -1
- package/worklet-runtime/lib/listeners.js.map +0 -1
- package/worklet-runtime/lib/runOnMainThread.js.map +0 -1
- package/worklet-runtime/lib/utils/mainThreadFlushLoopGuard.js.map +0 -1
- package/worklet-runtime/lib/utils/profile.js.map +0 -1
- package/worklet-runtime/lib/utils/version.js.map +0 -1
- package/worklet-runtime/lib/workletRef.js.map +0 -1
- package/worklet-runtime/lib/workletRuntime.js.map +0 -1
- /package/runtime/lib/{pendingListUpdates.d.ts → list/pendingListUpdates.d.ts} +0 -0
- /package/runtime/lib/{pendingListUpdates.js → list/pendingListUpdates.js} +0 -0
- /package/runtime/lib/{snapshotInstanceHydrationMap.d.ts → snapshot/snapshotInstanceHydrationMap.d.ts} +0 -0
- /package/runtime/lib/{snapshotInstanceHydrationMap.js → snapshot/snapshotInstanceHydrationMap.js} +0 -0
- /package/{worklet-runtime/lib → runtime/lib/worklet-runtime}/api/animation/animation.d.ts +0 -0
- /package/{worklet-runtime/lib → runtime/lib/worklet-runtime}/api/animation/animation.js +0 -0
- /package/{worklet-runtime/lib → runtime/lib/worklet-runtime}/api/animation/effect.d.ts +0 -0
- /package/{worklet-runtime/lib → runtime/lib/worklet-runtime}/api/animation/effect.js +0 -0
- /package/{worklet-runtime/lib → runtime/lib/worklet-runtime}/api/element.d.ts +0 -0
- /package/{worklet-runtime/lib → runtime/lib/worklet-runtime}/api/element.js +0 -0
- /package/{worklet-runtime/lib → runtime/lib/worklet-runtime}/api/lepusQuerySelector.d.ts +0 -0
- /package/{worklet-runtime/lib → runtime/lib/worklet-runtime}/api/lynxApi.d.ts +0 -0
- /package/{worklet-runtime/lib → runtime/lib/worklet-runtime}/api/lynxApi.js +0 -0
- /package/{worklet-runtime/lib → runtime/lib/worklet-runtime}/bindings/bindings.d.ts +0 -0
- /package/{worklet-runtime/lib → runtime/lib/worklet-runtime}/bindings/bindings.js +0 -0
- /package/{worklet-runtime/lib → runtime/lib/worklet-runtime}/bindings/events.d.ts +0 -0
- /package/{worklet-runtime/lib → runtime/lib/worklet-runtime}/bindings/events.js +0 -0
- /package/{worklet-runtime/lib → runtime/lib/worklet-runtime}/bindings/index.d.ts +0 -0
- /package/{worklet-runtime/lib → runtime/lib/worklet-runtime}/bindings/index.js +0 -0
- /package/{worklet-runtime/lib → runtime/lib/worklet-runtime}/bindings/loadRuntime.d.ts +0 -0
- /package/{worklet-runtime/lib → runtime/lib/worklet-runtime}/bindings/loadRuntime.js +0 -0
- /package/{worklet-runtime/lib → runtime/lib/worklet-runtime}/bindings/observers.d.ts +0 -0
- /package/{worklet-runtime/lib → runtime/lib/worklet-runtime}/bindings/observers.js +0 -0
- /package/{worklet-runtime/lib → runtime/lib/worklet-runtime}/bindings/types.d.ts +0 -0
- /package/{worklet-runtime/lib → runtime/lib/worklet-runtime}/bindings/types.js +0 -0
- /package/{worklet-runtime/lib → runtime/lib/worklet-runtime}/delayRunOnBackground.d.ts +0 -0
- /package/{worklet-runtime/lib → runtime/lib/worklet-runtime}/delayRunOnBackground.js +0 -0
- /package/{worklet-runtime/lib → runtime/lib/worklet-runtime}/delayWorkletEvent.d.ts +0 -0
- /package/{worklet-runtime/lib → runtime/lib/worklet-runtime}/delayWorkletEvent.js +0 -0
- /package/{worklet-runtime/lib → runtime/lib/worklet-runtime}/eomImpl.d.ts +0 -0
- /package/{worklet-runtime/lib → runtime/lib/worklet-runtime}/eomImpl.js +0 -0
- /package/{worklet-runtime/lib → runtime/lib/worklet-runtime}/eventPropagation.d.ts +0 -0
- /package/{worklet-runtime/lib → runtime/lib/worklet-runtime}/eventPropagation.js +0 -0
- /package/{worklet-runtime/lib → runtime/lib/worklet-runtime}/global.d.ts +0 -0
- /package/{worklet-runtime/lib → runtime/lib/worklet-runtime}/global.js +0 -0
- /package/{worklet-runtime/lib → runtime/lib/worklet-runtime}/hydrate.d.ts +0 -0
- /package/{worklet-runtime/lib → runtime/lib/worklet-runtime}/hydrate.js +0 -0
- /package/{worklet-runtime/lib → runtime/lib/worklet-runtime}/index.d.ts +0 -0
- /package/{worklet-runtime/lib → runtime/lib/worklet-runtime}/index.js +0 -0
- /package/{worklet-runtime/lib → runtime/lib/worklet-runtime}/jsFunctionLifecycle.d.ts +0 -0
- /package/{worklet-runtime/lib → runtime/lib/worklet-runtime}/jsFunctionLifecycle.js +0 -0
- /package/{worklet-runtime/lib → runtime/lib/worklet-runtime}/listeners.d.ts +0 -0
- /package/{worklet-runtime/lib → runtime/lib/worklet-runtime}/listeners.js +0 -0
- /package/{worklet-runtime/lib → runtime/lib/worklet-runtime}/runOnMainThread.d.ts +0 -0
- /package/{worklet-runtime/lib → runtime/lib/worklet-runtime}/runOnMainThread.js +0 -0
- /package/{worklet-runtime/lib → runtime/lib/worklet-runtime}/utils/mainThreadFlushLoopGuard.d.ts +0 -0
- /package/{worklet-runtime/lib → runtime/lib/worklet-runtime}/utils/mainThreadFlushLoopGuard.js +0 -0
- /package/{worklet-runtime/lib → runtime/lib/worklet-runtime}/utils/profile.d.ts +0 -0
- /package/{worklet-runtime/lib → runtime/lib/worklet-runtime}/utils/profile.js +0 -0
- /package/{worklet-runtime/lib → runtime/lib/worklet-runtime}/utils/version.d.ts +0 -0
- /package/{worklet-runtime/lib → runtime/lib/worklet-runtime}/utils/version.js +0 -0
- /package/{worklet-runtime/lib → runtime/lib/worklet-runtime}/workletRef.d.ts +0 -0
- /package/{worklet-runtime/lib → runtime/lib/worklet-runtime}/workletRef.js +0 -0
- /package/{worklet-runtime/lib → runtime/lib/worklet-runtime}/workletRuntime.d.ts +0 -0
- /package/{worklet-runtime/lib → runtime/lib/worklet-runtime}/workletRuntime.js +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
(()=>{"use strict";var e,t,n;let r,l,i;function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class a{cancel(){return __ElementAnimate(this.effect.target.element,[3,this.id])}pause(){return __ElementAnimate(this.effect.target.element,[2,this.id])}play(){return __ElementAnimate(this.effect.target.element,[1,this.id])}start(){return __ElementAnimate(this.effect.target.element,[0,this.id,this.effect.keyframes,this.effect.options])}constructor(e){o(this,"effect",void 0),o(this,"id",void 0),this.effect=e,this.id="__lynx-inner-js-animation-"+a.count++,this.start()}}function u(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}o(a,"count",0);class s{constructor(e,t,n){u(this,"target",void 0),u(this,"keyframes",void 0),u(this,"options",void 0),this.target=e,this.keyframes=t,this.options=n}}function c(e,t){var n;let r=(null!=(n=SystemInfo.lynxSdkVersion)?n:"1.0").split(".");return Number(r[0])>e||Number(r[0])==e&&Number(r[1])>t}let d=!1,f=!0;class y{setAttribute(e,t){__SetAttribute(this.element,e,t),this.flushElementTree()}setStyleProperty(e,t){__AddInlineStyle(this.element,e,t),this.flushElementTree()}setStyleProperties(e){for(let t in e)__AddInlineStyle(this.element,t,e[t]);this.flushElementTree()}getAttribute(e){return __GetAttributeByName(this.element,e)}getAttributeNames(){return __GetAttributeNames(this.element)}querySelector(e){let t=__QuerySelector(this.element,e,{});return t?new y(t):null}querySelectorAll(e){return __QuerySelectorAll(this.element,e,{}).map(e=>new y(e))}getComputedStyleProperty(e){if(!c(3,4))throw Error("getComputedStyleProperty requires Lynx sdk version 3.5");if(!e)throw Error("getComputedStyleProperty: key is required");return __GetComputedStyleByKey(this.element,e)}animate(e,t){return new a(new s(this,e,"number"==typeof t?{duration:t}:null!=t?t:{}))}invoke(e,t){return new Promise((n,r)=>{__InvokeUIMethod(this.element,e,null!=t?t:{},e=>{0===e.code?n(e.data):r(Error("UI method invoke: "+JSON.stringify(e)))}),this.flushElementTree()})}flushElementTree(){!d&&f&&(d=!0,Promise.resolve().then(()=>{d=!1,__FlushElementTree()}))}constructor(e){!function(e,t,n){t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n}(this,"element",void 0),Object.defineProperty(this,"element",{get:()=>e})}}class m{static get(){return null!=m.pageElement||(m.pageElement=__GetPageElement()),m.pageElement}}function h(e,t,n){let r;try{r=runWorklet(e,t)}finally{lynx.getJSContext().dispatchEvent({type:"Lynx.Worklet.FunctionCallRet",data:JSON.stringify({resolveId:n,returnValue:r})})}}t=void 0,(e="pageElement")in m?Object.defineProperty(m,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):m[e]=t;let _=(e,t)=>({current:t,_wvid:e}),p=e=>{let t,n=e._wvid;return n<0?(t=r._firstScreenWorkletRefMap[n])||(t=r._firstScreenWorkletRefMap[n]=_(n,e._initValue)):t=r._workletRefMap[n],t};function k(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function g(e,t,n){lynxWorkletImpl._workletMap[t]=n}let v=new WeakMap;function I(e,t){if("object"!=typeof e||null===e)return e;if(t){let t=v.get(e);if(t)return t}let n={main:e};return x(n,0,e),t&&v.set(e,n.main),n.main}let x=(e,t,n)=>{if(++t>=1e3)throw Error("Depth of value exceeds limit of 1000.");if("object"==typeof e&&null!==e)for(let l in e){let i=e[l];if("object"==typeof i&&null!==i){if("elementRefptr"in i){e[l]=new y(i.elementRefptr);continue}if(!(i instanceof y)){if(x(i,t,n),"_wvid"in i){e[l]=p(i);continue}if("_wkltId"in i){e[l]=lynxWorkletImpl._workletMap[i._wkltId].bind({...i}),e[l].ctx=i;continue}if("_jsFnId"in i){var r;i._execId=n._execId,null==(r=lynxWorkletImpl._jsFunctionLifecycleManager)||r.addRef(n._execId,i);continue}}}}};if(void 0===globalThis.lynxWorkletImpl){let e,t;globalThis.lynxWorkletImpl={_workletMap:{},_refImpl:r={_workletRefMap:{},_firstScreenWorkletRefMap:{},updateWorkletRef:function(e,t){p(e).current=t?new y(t):null},updateWorkletRefInitValueChanges:function(e){e.forEach(([e,t])=>{r._workletRefMap[e]||(r._workletRefMap[e]=_(e,t))})},clearFirstScreenWorkletRefMap:function(){r._firstScreenWorkletRefMap={}}},_runOnBackgroundDelayImpl:l={delayedBackgroundFunctionArray:[],delayRunOnBackground:function(e,t){var n;l.delayedBackgroundFunctionArray.push({task:t}),(null!=(n=e._delayIndices)?n:e._delayIndices=[]).push(l.delayedBackgroundFunctionArray.length-1)},runDelayedBackgroundFunctions:function(){for(let e of l.delayedBackgroundFunctionArray)e.jsFnHandle&&e.task(e.jsFnHandle._jsFnId,e.jsFnHandle._execId);l.delayedBackgroundFunctionArray.length=0}},_hydrateCtx:function(e,t){!function e(t,n,r){if(t&&"object"==typeof t&&n&&"object"==typeof n&&(!t._wkltId||t._wkltId===n._wkltId))for(let o in t)if("_wvid"===o){var l,i;l=t[o],"_initValue"in(i=n)||(lynxWorkletImpl._refImpl._workletRefMap[l]=i)}else if("_jsFn"===o)!function(e,t,n){for(let r in e){let l=e[r],i=t[r];if(!(null==i?void 0:i._delayIndices)){i&&(i._isFirstScreen=!1,i._execId=n,Object.assign(i,l));continue}for(let e of i._delayIndices){let t=lynxWorkletImpl._runOnBackgroundDelayImpl.delayedBackgroundFunctionArray[e];l._execId=n,t.jsFnHandle=l}}}(t[o],n[o],r);else{let l="function"==typeof n[o]?n[o].ctx:n[o];e(t[o],l,r)}}(e,t,e._execId)},_eventDelayImpl:i={_delayedWorkletParamsMap:new Map,runDelayedWorklet:function(e,t){(()=>{let n=i._delayedWorkletParamsMap.get(e._wkltId);if(void 0===n)return;let r=[];n.forEach(n=>{var l;let i=n[0];(null==i||null==(l=i.currentTarget)?void 0:l.elementRefptr)===t?setTimeout(()=>{runWorklet(e,n)},0):r.push(n)}),i._delayedWorkletParamsMap.set(e._wkltId,r)})()},clearDelayedWorklets:function(){i._delayedWorkletParamsMap.clear()}},_eomImpl:{setShouldFlush:function(e){f=e}},_runRunOnMainThreadTask:h},c(2,15)&&(globalThis.lynxWorkletImpl._jsFunctionLifecycleManager=new class e{addRef(e,t){var n;this.execIdRefCount.set(e,(null!=(n=this.execIdRefCount.get(e))?n:0)+1),this.registry.register(t,e)}removeRef(e){let t=this.execIdRefCount.get(e);t>1?this.execIdRefCount.set(e,t-1):(this.execIdRefCount.delete(e),this.execIdSetToFire.add(e),this.willFire||(this.willFire=!0,Promise.resolve().then(()=>{this.fire()})))}fire(){lynx.getJSContext().dispatchEvent({type:"Lynx.Worklet.releaseBackgroundWorkletCtx",data:Array.from(this.execIdSetToFire)}),this.execIdSetToFire.clear(),this.willFire=!1}constructor(){k(this,"execIdRefCount",new Map),k(this,"execIdSetToFire",new Set),k(this,"willFire",!1),k(this,"registry",void 0),this.registry=new FinalizationRegistry(this.removeRef.bind(this))}}),globalThis.registerWorklet=g,globalThis.registerWorkletInternal=g,globalThis.runWorklet=function(e,t,n){var r,l,o;let a,u;return"object"==typeof(r=e)&&null!==r&&("_wkltId"in r||"_lepusWorkletHash"in r)?"_lepusWorkletHash"in e?void(l=e._lepusWorkletHash,o=t,(u=(a=i._delayedWorkletParamsMap).get(l))?u.push(o):a.set(l,[o])):function(e,t,n){let r=(e._wkltId,I(e,!0)),l=I(t||[],!1),[i,o]=function(e,t){if(!Array.isArray(e)||"object"!=typeof e[0]||null===e[0]||(!t||1!==t.source)&&1)return[!1,{}];let n={},r=e[0];return r.stopPropagation=function(){var e;n._eventReturnResult=(null!=(e=n._eventReturnResult)?e:0)|1},r.stopImmediatePropagation=function(){var e;n._eventReturnResult=(null!=(e=n._eventReturnResult)?e:0)|2},[!0,n]}(l,n),a=r(...l);return i?{returnValue:a,eventReturnResult:o._eventReturnResult}:a}(e,t,n):void console.warn("MainThreadFunction: Invalid function object: "+JSON.stringify(e))},lynx.querySelector=function(e){let t=
|
|
1
|
+
(()=>{"use strict";var e,t,n;let r,l,i;function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class a{cancel(){return __ElementAnimate(this.effect.target.element,[3,this.id])}pause(){return __ElementAnimate(this.effect.target.element,[2,this.id])}play(){return __ElementAnimate(this.effect.target.element,[1,this.id])}start(){return __ElementAnimate(this.effect.target.element,[0,this.id,this.effect.keyframes,this.effect.options])}constructor(e){o(this,"effect",void 0),o(this,"id",void 0),this.effect=e,this.id="__lynx-inner-js-animation-"+a.count++,this.start()}}function u(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}o(a,"count",0);class s{constructor(e,t,n){u(this,"target",void 0),u(this,"keyframes",void 0),u(this,"options",void 0),this.target=e,this.keyframes=t,this.options=n}}function c(e,t){var n;let r=(null!=(n=SystemInfo.lynxSdkVersion)?n:"1.0").split(".");return Number(r[0])>e||Number(r[0])==e&&Number(r[1])>t}let d=!1,f=!0;class y{setAttribute(e,t){__SetAttribute(this.element,e,t),this.flushElementTree()}setStyleProperty(e,t){__AddInlineStyle(this.element,e,t),this.flushElementTree()}setStyleProperties(e){for(let t in e)__AddInlineStyle(this.element,t,e[t]);this.flushElementTree()}getAttribute(e){return __GetAttributeByName(this.element,e)}getAttributeNames(){return __GetAttributeNames(this.element)}querySelector(e){let t=__QuerySelector(this.element,e,{});return t?new y(t):null}querySelectorAll(e){return __QuerySelectorAll(this.element,e,{}).map(e=>new y(e))}getComputedStyleProperty(e){if(!c(3,4))throw Error("getComputedStyleProperty requires Lynx sdk version 3.5");if(!e)throw Error("getComputedStyleProperty: key is required");return __GetComputedStyleByKey(this.element,e)}animate(e,t){return new a(new s(this,e,"number"==typeof t?{duration:t}:null!=t?t:{}))}invoke(e,t){return new Promise((n,r)=>{__InvokeUIMethod(this.element,e,null!=t?t:{},e=>{0===e.code?n(e.data):r(Error("UI method invoke: "+JSON.stringify(e)))}),this.flushElementTree()})}flushElementTree(){!d&&f&&(d=!0,Promise.resolve().then(()=>{d=!1,__FlushElementTree()}))}constructor(e){!function(e,t,n){t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n}(this,"element",void 0),Object.defineProperty(this,"element",{get:()=>e})}}class m{static get(){return null!=m.pageElement||(m.pageElement=__GetPageElement()),m.pageElement}}function h(e,t,n){let r;try{r=runWorklet(e,t)}finally{lynx.getJSContext().dispatchEvent({type:"Lynx.Worklet.FunctionCallRet",data:JSON.stringify({resolveId:n,returnValue:r})})}}t=void 0,(e="pageElement")in m?Object.defineProperty(m,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):m[e]=t;let _=(e,t)=>({current:t,_wvid:e}),p=e=>{let t,n=e._wvid;return n<0?(t=r._firstScreenWorkletRefMap[n])||(t=r._firstScreenWorkletRefMap[n]=_(n,e._initValue)):t=r._workletRefMap[n],t};function k(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function g(e,t,n){lynxWorkletImpl._workletMap[t]=n}let v=new WeakMap;function I(e,t){if("object"!=typeof e||null===e)return e;if(t){let t=v.get(e);if(t)return t}let n={main:e};return x(n,0,e),t&&v.set(e,n.main),n.main}let x=(e,t,n)=>{if(++t>=1e3)throw Error("Depth of value exceeds limit of 1000.");if("object"==typeof e&&null!==e)for(let l in e){let i=e[l];if("object"==typeof i&&null!==i){if("elementRefptr"in i){e[l]=new y(i.elementRefptr);continue}if(!(i instanceof y)){if(x(i,t,n),"_wvid"in i){e[l]=p(i);continue}if("_wkltId"in i){e[l]=lynxWorkletImpl._workletMap[i._wkltId].bind({...i}),e[l].ctx=i;continue}if("_jsFnId"in i){var r;i._execId=n._execId,null==(r=lynxWorkletImpl._jsFunctionLifecycleManager)||r.addRef(n._execId,i);continue}}}}};if(void 0===globalThis.lynxWorkletImpl){let e,t;globalThis.lynxWorkletImpl={_workletMap:{},_refImpl:r={_workletRefMap:{},_firstScreenWorkletRefMap:{},updateWorkletRef:function(e,t){p(e).current=t?new y(t):null},updateWorkletRefInitValueChanges:function(e){e.forEach(([e,t])=>{r._workletRefMap[e]||(r._workletRefMap[e]=_(e,t))})},clearFirstScreenWorkletRefMap:function(){r._firstScreenWorkletRefMap={}}},_runOnBackgroundDelayImpl:l={delayedBackgroundFunctionArray:[],delayRunOnBackground:function(e,t){var n;l.delayedBackgroundFunctionArray.push({task:t}),(null!=(n=e._delayIndices)?n:e._delayIndices=[]).push(l.delayedBackgroundFunctionArray.length-1)},runDelayedBackgroundFunctions:function(){for(let e of l.delayedBackgroundFunctionArray)e.jsFnHandle&&e.task(e.jsFnHandle._jsFnId,e.jsFnHandle._execId);l.delayedBackgroundFunctionArray.length=0}},_hydrateCtx:function(e,t){!function e(t,n,r){if(t&&"object"==typeof t&&n&&"object"==typeof n&&(!t._wkltId||t._wkltId===n._wkltId))for(let o in t)if("_wvid"===o){var l,i;l=t[o],"_initValue"in(i=n)||(lynxWorkletImpl._refImpl._workletRefMap[l]=i)}else if("_jsFn"===o)!function(e,t,n){for(let r in e){let l=e[r],i=t[r];if(!(null==i?void 0:i._delayIndices)){i&&(i._isFirstScreen=!1,i._execId=n,Object.assign(i,l));continue}for(let e of i._delayIndices){let t=lynxWorkletImpl._runOnBackgroundDelayImpl.delayedBackgroundFunctionArray[e];l._execId=n,t.jsFnHandle=l}}}(t[o],n[o],r);else{let l="function"==typeof n[o]?n[o].ctx:n[o];e(t[o],l,r)}}(e,t,e._execId)},_eventDelayImpl:i={_delayedWorkletParamsMap:new Map,runDelayedWorklet:function(e,t){(()=>{let n=i._delayedWorkletParamsMap.get(e._wkltId);if(void 0===n)return;let r=[];n.forEach(n=>{var l;let i=n[0];(null==i||null==(l=i.currentTarget)?void 0:l.elementRefptr)===t?setTimeout(()=>{runWorklet(e,n)},0):r.push(n)}),i._delayedWorkletParamsMap.set(e._wkltId,r)})()},clearDelayedWorklets:function(){i._delayedWorkletParamsMap.clear()}},_eomImpl:{setShouldFlush:function(e){f=e}},_runRunOnMainThreadTask:h},c(2,15)&&(globalThis.lynxWorkletImpl._jsFunctionLifecycleManager=new class e{addRef(e,t){var n;this.execIdRefCount.set(e,(null!=(n=this.execIdRefCount.get(e))?n:0)+1),this.registry.register(t,e)}removeRef(e){let t=this.execIdRefCount.get(e);t>1?this.execIdRefCount.set(e,t-1):(this.execIdRefCount.delete(e),this.execIdSetToFire.add(e),this.willFire||(this.willFire=!0,Promise.resolve().then(()=>{this.fire()})))}fire(){lynx.getJSContext().dispatchEvent({type:"Lynx.Worklet.releaseBackgroundWorkletCtx",data:Array.from(this.execIdSetToFire)}),this.execIdSetToFire.clear(),this.willFire=!1}constructor(){k(this,"execIdRefCount",new Map),k(this,"execIdSetToFire",new Set),k(this,"willFire",!1),k(this,"registry",void 0),this.registry=new FinalizationRegistry(this.removeRef.bind(this))}}),globalThis.registerWorklet=g,globalThis.registerWorkletInternal=g,globalThis.runWorklet=function(e,t,n){var r,l,o;let a,u;return"object"==typeof(r=e)&&null!==r&&("_wkltId"in r||"_lepusWorkletHash"in r)?"_lepusWorkletHash"in e?void(l=e._lepusWorkletHash,o=t,(u=(a=i._delayedWorkletParamsMap).get(l))?u.push(o):a.set(l,[o])):function(e,t,n){let r=(e._wkltId,I(e,!0)),l=I(t||[],!1),[i,o]=function(e,t){if(!Array.isArray(e)||"object"!=typeof e[0]||null===e[0]||(!t||1!==t.source)&&1)return[!1,{}];let n={},r=e[0];return r.stopPropagation=function(){var e;n._eventReturnResult=(null!=(e=n._eventReturnResult)?e:0)|1},r.stopImmediatePropagation=function(){var e;n._eventReturnResult=(null!=(e=n._eventReturnResult)?e:0)|2},[!0,n]}(l,n),a=r(...l);return i?{returnValue:a,eventReturnResult:o._eventReturnResult}:a}(e,t,n):void console.warn("MainThreadFunction: Invalid function object: "+JSON.stringify(e))},lynx.querySelector=function(e){let t=m.get();if(!t)return null;let n=__QuerySelector(t,e,{});return n?new y(n):null},lynx.querySelectorAll=function(e){let t=m.get();return t?__QuerySelectorAll(t,e,{}).map(e=>new y(e)):[]},globalThis.setTimeout=lynx.setTimeout,globalThis.setInterval=lynx.setInterval,globalThis.clearTimeout=lynx.clearTimeout,globalThis.clearInterval=null!=(n=lynx.clearInterval)?n:lynx.clearTimeInterval,e=lynx.requestAnimationFrame,lynx.requestAnimationFrame=globalThis.requestAnimationFrame=t=>{if(!c(2,15))throw Error("requestAnimationFrame in main thread script requires Lynx sdk version 2.16");return e(t)},globalThis.cancelAnimationFrame=lynx.cancelAnimationFrame,(t=lynx.getJSContext()).addEventListener("Lynx.Worklet.runWorkletCtx",e=>{let t=JSON.parse(e.data);h(t.worklet,t.params,t.resolveId)}),t.addEventListener("Lynx.Worklet.releaseWorkletRef",e=>{var t;t=e.data.id,delete r._workletRefMap[t]})}})();
|
|
@@ -6,7 +6,7 @@ import { useEffect } from "preact/hooks";
|
|
|
6
6
|
import { act } from "preact/test-utils";
|
|
7
7
|
import { __root } from "@lynx-js/react/internal";
|
|
8
8
|
import { flushDelayedLifecycleEvents } from "../../runtime/lib/lynx/tt.js";
|
|
9
|
-
import { clearPage } from "../../runtime/lib/snapshot.js";
|
|
9
|
+
import { clearPage } from "../../runtime/lib/snapshot/index.js";
|
|
10
10
|
__webpack_require__.add({
|
|
11
11
|
"../../../node_modules/.pnpm/ansi-regex@5.0.1/node_modules/ansi-regex/index.js" (module1) {
|
|
12
12
|
module1.exports = ({ onlyFirst = false } = {})=>{
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { options } from "preact";
|
|
2
2
|
import { expect } from "vitest";
|
|
3
|
-
import { BackgroundSnapshotInstance } from "../../runtime/lib/backgroundSnapshot.js";
|
|
4
3
|
import { clearCommitTaskId, replaceCommitHook } from "../../runtime/lib/lifecycle/patch/commit.js";
|
|
5
4
|
import { deinitGlobalSnapshotPatch } from "../../runtime/lib/lifecycle/patch/snapshotPatch.js";
|
|
6
5
|
import { injectUpdateMainThread } from "../../runtime/lib/lifecycle/patch/updateMainThread.js";
|
|
@@ -10,11 +9,11 @@ import { flushDelayedLifecycleEvents, injectTt } from "../../runtime/lib/lynx/tt
|
|
|
10
9
|
import { initElementPAPICallAlog } from "../../runtime/lib/alog/elementPAPICall.js";
|
|
11
10
|
import { addCtxNotFoundEventListener } from "../../runtime/lib/lifecycle/patch/error.js";
|
|
12
11
|
import { setRoot } from "../../runtime/lib/root.js";
|
|
13
|
-
import { SnapshotInstance, backgroundSnapshotInstanceManager, snapshotInstanceManager } from "../../runtime/lib/snapshot.js";
|
|
12
|
+
import { BackgroundSnapshotInstance, SnapshotInstance, backgroundSnapshotInstanceManager, snapshotInstanceManager } from "../../runtime/lib/snapshot/index.js";
|
|
14
13
|
import { destroyWorklet } from "../../runtime/lib/worklet/destroy.js";
|
|
15
|
-
import { initApiEnv } from "../../worklet-runtime/
|
|
16
|
-
import { initEventListeners } from "../../worklet-runtime/
|
|
17
|
-
import { initWorklet } from "../../worklet-runtime/
|
|
14
|
+
import { initApiEnv } from "../../runtime/lib/worklet-runtime/api/lynxApi.js";
|
|
15
|
+
import { initEventListeners } from "../../runtime/lib/worklet-runtime/listeners.js";
|
|
16
|
+
import { initWorklet } from "../../runtime/lib/worklet-runtime/workletRuntime.js";
|
|
18
17
|
expect.addSnapshotSerializer({
|
|
19
18
|
test (val) {
|
|
20
19
|
return Boolean(val && 'object' == typeof val && Array.isArray(val.refAttr) && Object.prototype.hasOwnProperty.call(val, 'task') && 'function' == typeof val.exec);
|