vue-lynx 0.1.0-pre-alpha.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/LICENSE +190 -0
- package/NOTICE +18 -0
- package/README.md +67 -0
- package/internal/dist/ops.d.ts +36 -0
- package/internal/dist/ops.js +39 -0
- package/internal/dist/ops.js.map +1 -0
- package/main-thread/dist/__test__/raw-worklet-registrations.d.ts +1 -0
- package/main-thread/dist/__test__/raw-worklet-registrations.js +15 -0
- package/main-thread/dist/element-registry.js +6 -0
- package/main-thread/dist/entry-main.d.ts +1 -0
- package/main-thread/dist/entry-main.js +37 -0
- package/main-thread/dist/list-apply.d.ts +18 -0
- package/main-thread/dist/list-apply.js +129 -0
- package/main-thread/dist/ops-apply.d.ts +6 -0
- package/main-thread/dist/ops-apply.js +177 -0
- package/main-thread/dist/run-on-background-mt.d.ts +10 -0
- package/main-thread/dist/run-on-background-mt.js +44 -0
- package/main-thread/dist/worklet-apply.d.ts +8 -0
- package/main-thread/dist/worklet-apply.js +45 -0
- package/package.json +98 -0
- package/plugin/dist/index.d.ts +73 -0
- package/plugin/dist/index.js +386 -0
- package/plugin/dist/loaders/ignore-css-loader.d.ts +6 -0
- package/plugin/dist/loaders/ignore-css-loader.js +6 -0
- package/plugin/dist/loaders/vue-sfc-script-extractor.d.ts +6 -0
- package/plugin/dist/loaders/vue-sfc-script-extractor.js +10 -0
- package/plugin/dist/loaders/worklet-loader-mt.d.ts +6 -0
- package/plugin/dist/loaders/worklet-loader-mt.js +129 -0
- package/plugin/dist/loaders/worklet-loader.d.ts +6 -0
- package/plugin/dist/loaders/worklet-loader.js +29 -0
- package/runtime/dist/Transition.d.ts +40 -0
- package/runtime/dist/Transition.js +177 -0
- package/runtime/dist/TransitionGroup.js +188 -0
- package/runtime/dist/app-registry.d.ts +11 -0
- package/runtime/dist/app-registry.js +12 -0
- package/runtime/dist/cross-thread.d.ts +21 -0
- package/runtime/dist/cross-thread.js +18 -0
- package/runtime/dist/entry-background.d.ts +1 -0
- package/runtime/dist/entry-background.js +10 -0
- package/runtime/dist/event-registry.d.ts +12 -0
- package/runtime/dist/event-registry.js +39 -0
- package/runtime/dist/flush.d.ts +8 -0
- package/runtime/dist/flush.js +35 -0
- package/runtime/dist/function-call.d.ts +7 -0
- package/runtime/dist/function-call.js +26 -0
- package/runtime/dist/index.d.ts +550 -0
- package/runtime/dist/index.js +210 -0
- package/runtime/dist/main-thread-ref.d.ts +46 -0
- package/runtime/dist/main-thread-ref.js +40 -0
- package/runtime/dist/node-ops.d.ts +6 -0
- package/runtime/dist/node-ops.js +172 -0
- package/runtime/dist/ops.d.ts +3 -0
- package/runtime/dist/ops.js +12 -0
- package/runtime/dist/run-on-background.d.ts +20 -0
- package/runtime/dist/run-on-background.js +70 -0
- package/runtime/dist/shadow-element.d.ts +46 -0
- package/runtime/dist/shadow-element.js +87 -0
- package/runtime/dist/transform-to-worklet.d.ts +11 -0
- package/runtime/dist/transform-to-worklet.js +17 -0
- package/runtime/dist/worklet-types.d.ts +28 -0
- package/runtime/dist/worklet-types.js +0 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to the Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by the Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding any notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
Copyright 2026-present Xuan Huang (huxpro)
|
|
179
|
+
|
|
180
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
181
|
+
you may not use this file except in compliance with the License.
|
|
182
|
+
You may obtain a copy of the License at
|
|
183
|
+
|
|
184
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
185
|
+
|
|
186
|
+
Unless required by applicable law or agreed to in writing, software
|
|
187
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
188
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
189
|
+
See the License for the specific language governing permissions and
|
|
190
|
+
limitations under the License.
|
package/NOTICE
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
vue-lynx
|
|
2
|
+
Copyright 2026-present Xuan Huang (huxpro)
|
|
3
|
+
|
|
4
|
+
This product contains code derived from or inspired by the following projects:
|
|
5
|
+
|
|
6
|
+
- React Lynx (Apache-2.0)
|
|
7
|
+
https://github.com/lynx-family/lynx-stack
|
|
8
|
+
Copyright Lynx Authors
|
|
9
|
+
Files: runtime/src/run-on-background.ts, main-thread/src/run-on-background-mt.ts
|
|
10
|
+
|
|
11
|
+
- Rsbuild (MIT)
|
|
12
|
+
https://github.com/web-infra-dev/rsbuild
|
|
13
|
+
Copyright 2023-present Bytedance, Inc. and its affiliates
|
|
14
|
+
Files: plugin/src/css.ts (normalizeCssLoaderOptions)
|
|
15
|
+
|
|
16
|
+
- Vue.js (MIT)
|
|
17
|
+
https://github.com/vuejs/core
|
|
18
|
+
Copyright 2018-present Yuxi (Evan) You
|
package/README.md
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
# vue-lynx
|
|
2
|
+
|
|
3
|
+
Vue 3 custom renderer for building [Lynx](https://lynxjs.org) apps.
|
|
4
|
+
|
|
5
|
+
> [!WARNING]
|
|
6
|
+
> **Pre-Alpha** — Expect bugs and enjoy!
|
|
7
|
+
|
|
8
|
+
[](https://vue.lynxjs.org)
|
|
9
|
+
[](https://vue.lynxjs.org)
|
|
10
|
+
[](LICENSE)
|
|
11
|
+
|
|
12
|
+
## Documentation
|
|
13
|
+
|
|
14
|
+
Visit **[vue.lynxjs.org](https://vue.lynxjs.org)** for full documentation, including:
|
|
15
|
+
|
|
16
|
+
- [Introduction](https://vue.lynxjs.org/guide/introduction.html)
|
|
17
|
+
- [Quick Start](https://vue.lynxjs.org/guide/quick-start.html)
|
|
18
|
+
- [Gallery Tutorial](https://vue.lynxjs.org/tutorials/gallery.html)
|
|
19
|
+
- [Swiper Tutorial](https://vue.lynxjs.org/tutorials/swiper.html)
|
|
20
|
+
|
|
21
|
+
## Examples
|
|
22
|
+
|
|
23
|
+
See the [`examples/`](examples/) directory for complete working examples:
|
|
24
|
+
|
|
25
|
+
- [`hello-world`](examples/hello-world) — Minimal starter
|
|
26
|
+
- [`basic`](examples/basic) — Core features (events, refs, reactivity)
|
|
27
|
+
- [`todomvc`](examples/todomvc) — TodoMVC with CSS Selectors
|
|
28
|
+
- [`option-api`](examples/option-api) — Options API style
|
|
29
|
+
- [`vue-router`](examples/vue-router) — Vue Router integration
|
|
30
|
+
- [`pinia`](examples/pinia) — Pinia state management
|
|
31
|
+
- [`suspense`](examples/suspense) — Suspense API
|
|
32
|
+
- [`tailwindcss`](examples/tailwindcss) — Tailwind CSS styling
|
|
33
|
+
- [`gallery`](examples/gallery) — Photo gallery
|
|
34
|
+
- [`swiper`](examples/swiper) — Swiper component
|
|
35
|
+
- [`7guis`](examples/7guis) — 7GUIs benchmark tasks
|
|
36
|
+
|
|
37
|
+
## Contributing
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
git clone https://github.com/Huxpro/vue-lynx.git
|
|
41
|
+
cd vue-lynx
|
|
42
|
+
pnpm install
|
|
43
|
+
pnpm build
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
### Scripts
|
|
47
|
+
|
|
48
|
+
| Command | Description |
|
|
49
|
+
| --- | --- |
|
|
50
|
+
| `pnpm build` | Build all packages (internal, runtime, main-thread, plugin) |
|
|
51
|
+
| `pnpm dev` | Watch mode for runtime, main-thread, and plugin |
|
|
52
|
+
| `pnpm test` | Run tests (testing-library) |
|
|
53
|
+
| `pnpm test:upstream` | Run upstream Vue compatibility tests |
|
|
54
|
+
| `pnpm test:dev-smoke` | Run dev smoke tests |
|
|
55
|
+
| `pnpm lint` | Lint with Biome |
|
|
56
|
+
|
|
57
|
+
### Run examples locally
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
cd examples/basic
|
|
61
|
+
pnpm install
|
|
62
|
+
pnpm dev
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
## License
|
|
66
|
+
|
|
67
|
+
[Apache-2.0](LICENSE)
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Flat-array operation codes — the wire protocol between BG Thread and Main Thread.
|
|
3
|
+
*
|
|
4
|
+
* Format (all numbers/strings, JSON-serializable):
|
|
5
|
+
* CREATE: [0, id, type]
|
|
6
|
+
* CREATE_TEXT: [1, id]
|
|
7
|
+
* INSERT: [2, parentId, childId, anchorId] anchorId=-1 means append
|
|
8
|
+
* REMOVE: [3, parentId, childId]
|
|
9
|
+
* SET_PROP: [4, id, key, value]
|
|
10
|
+
* SET_TEXT: [5, id, text]
|
|
11
|
+
* SET_EVENT: [6, id, eventType, eventName, sign]
|
|
12
|
+
* REMOVE_EVENT: [7, id, eventType, eventName]
|
|
13
|
+
* SET_STYLE: [8, id, styleObject]
|
|
14
|
+
* SET_CLASS: [9, id, classString]
|
|
15
|
+
* SET_ID: [10, id, idString]
|
|
16
|
+
* SET_WORKLET_EVENT: [11, id, eventType, eventName, workletCtx]
|
|
17
|
+
* SET_MT_REF: [12, id, refImpl]
|
|
18
|
+
* INIT_MT_REF: [13, wvid, initValue]
|
|
19
|
+
*/
|
|
20
|
+
export declare const OP: {
|
|
21
|
+
readonly CREATE: 0;
|
|
22
|
+
readonly CREATE_TEXT: 1;
|
|
23
|
+
readonly INSERT: 2;
|
|
24
|
+
readonly REMOVE: 3;
|
|
25
|
+
readonly SET_PROP: 4;
|
|
26
|
+
readonly SET_TEXT: 5;
|
|
27
|
+
readonly SET_EVENT: 6;
|
|
28
|
+
readonly REMOVE_EVENT: 7;
|
|
29
|
+
readonly SET_STYLE: 8;
|
|
30
|
+
readonly SET_CLASS: 9;
|
|
31
|
+
readonly SET_ID: 10;
|
|
32
|
+
readonly SET_WORKLET_EVENT: 11;
|
|
33
|
+
readonly SET_MT_REF: 12;
|
|
34
|
+
readonly INIT_MT_REF: 13;
|
|
35
|
+
};
|
|
36
|
+
export type OpCode = (typeof OP)[keyof typeof OP];
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
// Copyright 2026 Xuan Huang (huxpro). All rights reserved.
|
|
2
|
+
// Licensed under the Apache License Version 2.0 that can be found in the
|
|
3
|
+
// LICENSE file in the root directory of this source tree.
|
|
4
|
+
/**
|
|
5
|
+
* Flat-array operation codes — the wire protocol between BG Thread and Main Thread.
|
|
6
|
+
*
|
|
7
|
+
* Format (all numbers/strings, JSON-serializable):
|
|
8
|
+
* CREATE: [0, id, type]
|
|
9
|
+
* CREATE_TEXT: [1, id]
|
|
10
|
+
* INSERT: [2, parentId, childId, anchorId] anchorId=-1 means append
|
|
11
|
+
* REMOVE: [3, parentId, childId]
|
|
12
|
+
* SET_PROP: [4, id, key, value]
|
|
13
|
+
* SET_TEXT: [5, id, text]
|
|
14
|
+
* SET_EVENT: [6, id, eventType, eventName, sign]
|
|
15
|
+
* REMOVE_EVENT: [7, id, eventType, eventName]
|
|
16
|
+
* SET_STYLE: [8, id, styleObject]
|
|
17
|
+
* SET_CLASS: [9, id, classString]
|
|
18
|
+
* SET_ID: [10, id, idString]
|
|
19
|
+
* SET_WORKLET_EVENT: [11, id, eventType, eventName, workletCtx]
|
|
20
|
+
* SET_MT_REF: [12, id, refImpl]
|
|
21
|
+
* INIT_MT_REF: [13, wvid, initValue]
|
|
22
|
+
*/
|
|
23
|
+
export const OP = {
|
|
24
|
+
CREATE: 0,
|
|
25
|
+
CREATE_TEXT: 1,
|
|
26
|
+
INSERT: 2,
|
|
27
|
+
REMOVE: 3,
|
|
28
|
+
SET_PROP: 4,
|
|
29
|
+
SET_TEXT: 5,
|
|
30
|
+
SET_EVENT: 6,
|
|
31
|
+
REMOVE_EVENT: 7,
|
|
32
|
+
SET_STYLE: 8,
|
|
33
|
+
SET_CLASS: 9,
|
|
34
|
+
SET_ID: 10,
|
|
35
|
+
SET_WORKLET_EVENT: 11,
|
|
36
|
+
SET_MT_REF: 12,
|
|
37
|
+
INIT_MT_REF: 13,
|
|
38
|
+
};
|
|
39
|
+
//# sourceMappingURL=ops.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ops.js","sourceRoot":"","sources":["../src/ops.ts"],"names":[],"mappings":"AAAA,2DAA2D;AAC3D,yEAAyE;AACzE,0DAA0D;AAE1D;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,CAAC,MAAM,EAAE,GAAG;IAChB,MAAM,EAAE,CAAC;IACT,WAAW,EAAE,CAAC;IACd,MAAM,EAAE,CAAC;IACT,MAAM,EAAE,CAAC;IACT,QAAQ,EAAE,CAAC;IACX,QAAQ,EAAE,CAAC;IACX,SAAS,EAAE,CAAC;IACZ,YAAY,EAAE,CAAC;IACf,SAAS,EAAE,CAAC;IACZ,SAAS,EAAE,CAAC;IACZ,MAAM,EAAE,EAAE;IACV,iBAAiB,EAAE,EAAE;IACrB,UAAU,EAAE,EAAE;IACd,WAAW,EAAE,EAAE;CACP,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
registerWorkletInternal('main-thread', 'main-thread-draggable-raw:onScroll', function(...args) {
|
|
2
|
+
const event = args[0];
|
|
3
|
+
const detail = event.detail;
|
|
4
|
+
const scrollTop = detail?.scrollTop ?? 0;
|
|
5
|
+
const DEFAULT_X = 0;
|
|
6
|
+
const DEFAULT_Y = 500;
|
|
7
|
+
const newX = DEFAULT_X;
|
|
8
|
+
const newY = DEFAULT_Y - scrollTop;
|
|
9
|
+
const c = this['_c'];
|
|
10
|
+
if (!c?._mtRef?._wvid) return;
|
|
11
|
+
const wvid = c._mtRef._wvid;
|
|
12
|
+
const impl = globalThis['lynxWorkletImpl'];
|
|
13
|
+
const refEntry = impl?._refImpl?._workletRefMap?.[wvid];
|
|
14
|
+
if (refEntry?.current && 'function' == typeof refEntry.current.setStyleProperty) refEntry.current.setStyleProperty('transform', `translate(${newX}px, ${newY}px)`);
|
|
15
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import * as __WEBPACK_EXTERNAL_MODULE__element_registry_js_05e5c264__ from "./element-registry.js";
|
|
2
|
+
import * as __WEBPACK_EXTERNAL_MODULE__ops_apply_js_02ee6267__ from "./ops-apply.js";
|
|
3
|
+
import * as __WEBPACK_EXTERNAL_MODULE__run_on_background_mt_js_2816b941__ from "./run-on-background-mt.js";
|
|
4
|
+
const g = globalThis;
|
|
5
|
+
g['SystemInfo'] = ('undefined' != typeof lynx && lynx.SystemInfo) ?? {};
|
|
6
|
+
g['runOnBackground'] = __WEBPACK_EXTERNAL_MODULE__run_on_background_mt_js_2816b941__.runOnBackground;
|
|
7
|
+
if ('undefined' == typeof __LoadLepusChunk) console.warn('[vue-mt] __LoadLepusChunk not available, worklet events will not work');
|
|
8
|
+
else {
|
|
9
|
+
const chunkOpts = {
|
|
10
|
+
chunkType: 0
|
|
11
|
+
};
|
|
12
|
+
if ('undefined' != typeof globDynamicComponentEntry) chunkOpts['dynamicComponentEntry'] = globDynamicComponentEntry;
|
|
13
|
+
const loaded = __LoadLepusChunk('worklet-runtime', chunkOpts);
|
|
14
|
+
if (loaded) console.info('[vue-mt] worklet-runtime chunk loaded');
|
|
15
|
+
else console.error('[vue-mt] __LoadLepusChunk("worklet-runtime") returned false — registerWorkletInternal will not be available. Check browser console for loadScriptSync errors.');
|
|
16
|
+
}
|
|
17
|
+
const PAGE_ROOT_ID = 1;
|
|
18
|
+
g['processData'] = function(data, _processorName) {
|
|
19
|
+
return data ?? {};
|
|
20
|
+
};
|
|
21
|
+
g['renderPage'] = function(_data) {
|
|
22
|
+
console.info('[vue-mt] renderPage called');
|
|
23
|
+
(0, __WEBPACK_EXTERNAL_MODULE__ops_apply_js_02ee6267__.resetMainThreadState)();
|
|
24
|
+
const page = __CreatePage('0', 0);
|
|
25
|
+
const component = __CreateComponent(__GetElementUniqueID(page), 'vue-root', 0, 'undefined' != typeof globDynamicComponentEntry ? globDynamicComponentEntry : '', 'vue-root', '/', null, null);
|
|
26
|
+
__AppendElement(page, component);
|
|
27
|
+
(0, __WEBPACK_EXTERNAL_MODULE__element_registry_js_05e5c264__.setRootComponentUniqueId)(__GetElementUniqueID(component));
|
|
28
|
+
__WEBPACK_EXTERNAL_MODULE__element_registry_js_05e5c264__.elements.set(PAGE_ROOT_ID, component);
|
|
29
|
+
__FlushElementTree(page);
|
|
30
|
+
console.info('[vue-mt] renderPage done, page root id=1 stored');
|
|
31
|
+
};
|
|
32
|
+
g['updatePage'] = function(_data) {};
|
|
33
|
+
g['updateGlobalProps'] = function(_data) {};
|
|
34
|
+
g['vuePatchUpdate'] = function({ data }) {
|
|
35
|
+
const ops = JSON.parse(data);
|
|
36
|
+
(0, __WEBPACK_EXTERNAL_MODULE__ops_apply_js_02ee6267__.applyOps)(ops);
|
|
37
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/** Check if a parent element ID is a <list> element */
|
|
2
|
+
export declare function isListParent(parentId: number): boolean;
|
|
3
|
+
/** Check if a prop key is a platform-info attribute for list items */
|
|
4
|
+
export declare function isPlatformInfoAttr(key: string): boolean;
|
|
5
|
+
/** CREATE case: create a native <list> element and set up tracking state */
|
|
6
|
+
export declare function createListElement(id: number): LynxElement;
|
|
7
|
+
/** INSERT case: collect a child into a <list> parent's item array */
|
|
8
|
+
export declare function insertListItem(parentId: number, child: LynxElement, childId: number): void;
|
|
9
|
+
/** SET_PROP case: store a platform-info attribute for a list item */
|
|
10
|
+
export declare function setPlatformInfoProp(id: number, key: string, value: unknown): void;
|
|
11
|
+
/**
|
|
12
|
+
* Post-ops flush: for any <list> elements with newly-inserted items, tell the
|
|
13
|
+
* native list via the 'update-list-info' attribute. Only send items added since
|
|
14
|
+
* the last applyOps call to avoid "duplicated item-key" errors.
|
|
15
|
+
*/
|
|
16
|
+
export declare function flushListUpdates(): void;
|
|
17
|
+
/** Reset all list state — for testing only. */
|
|
18
|
+
export declare function resetListState(): void;
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import * as __WEBPACK_EXTERNAL_MODULE__element_registry_js_05e5c264__ from "./element-registry.js";
|
|
2
|
+
const listItems = new Map();
|
|
3
|
+
const listElementIds = new Set();
|
|
4
|
+
const itemKeyMap = new Map();
|
|
5
|
+
const PLATFORM_INFO_ATTRS = new Set([
|
|
6
|
+
'item-key',
|
|
7
|
+
'estimated-main-axis-size-px',
|
|
8
|
+
'estimated-height-px',
|
|
9
|
+
'estimated-height',
|
|
10
|
+
'reuse-identifier',
|
|
11
|
+
'full-span',
|
|
12
|
+
'sticky-top',
|
|
13
|
+
'sticky-bottom',
|
|
14
|
+
'recyclable'
|
|
15
|
+
]);
|
|
16
|
+
const listItemPlatformInfo = new Map();
|
|
17
|
+
const listItemsReported = new Map();
|
|
18
|
+
function enqueueComponentNoop() {}
|
|
19
|
+
function createListCallbacks(bgId) {
|
|
20
|
+
const componentAtIndex = (list, listID, cellIndex, operationID)=>{
|
|
21
|
+
const items = listItems.get(bgId);
|
|
22
|
+
if (!items || cellIndex < 0 || cellIndex >= items.length) return;
|
|
23
|
+
const item = items[cellIndex].el;
|
|
24
|
+
__AppendElement(list, item);
|
|
25
|
+
const sign = __GetElementUniqueID(item);
|
|
26
|
+
__FlushElementTree(item, {
|
|
27
|
+
triggerLayout: true,
|
|
28
|
+
operationID,
|
|
29
|
+
elementID: sign,
|
|
30
|
+
listID
|
|
31
|
+
});
|
|
32
|
+
return sign;
|
|
33
|
+
};
|
|
34
|
+
const enqueueComponent = enqueueComponentNoop;
|
|
35
|
+
const componentAtIndexes = (list, listID, cellIndexes, operationIDs)=>{
|
|
36
|
+
const items = listItems.get(bgId);
|
|
37
|
+
if (!items) return;
|
|
38
|
+
const elementIDs = [];
|
|
39
|
+
for(let j = 0; j < cellIndexes.length; j++){
|
|
40
|
+
const cellIndex = cellIndexes[j];
|
|
41
|
+
operationIDs[j];
|
|
42
|
+
if (cellIndex < 0 || cellIndex >= items.length) {
|
|
43
|
+
elementIDs.push(-1);
|
|
44
|
+
continue;
|
|
45
|
+
}
|
|
46
|
+
const item = items[cellIndex].el;
|
|
47
|
+
__AppendElement(list, item);
|
|
48
|
+
const sign = __GetElementUniqueID(item);
|
|
49
|
+
elementIDs.push(sign);
|
|
50
|
+
}
|
|
51
|
+
__FlushElementTree(list, {
|
|
52
|
+
triggerLayout: true,
|
|
53
|
+
operationIDs,
|
|
54
|
+
elementIDs,
|
|
55
|
+
listID
|
|
56
|
+
});
|
|
57
|
+
};
|
|
58
|
+
return {
|
|
59
|
+
componentAtIndex,
|
|
60
|
+
enqueueComponent,
|
|
61
|
+
componentAtIndexes
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
function isListParent(parentId) {
|
|
65
|
+
return listElementIds.has(parentId);
|
|
66
|
+
}
|
|
67
|
+
function isPlatformInfoAttr(key) {
|
|
68
|
+
return PLATFORM_INFO_ATTRS.has(key);
|
|
69
|
+
}
|
|
70
|
+
function createListElement(id) {
|
|
71
|
+
listElementIds.add(id);
|
|
72
|
+
listItems.set(id, []);
|
|
73
|
+
listItemsReported.set(id, 0);
|
|
74
|
+
const cbs = createListCallbacks(id);
|
|
75
|
+
const el = __CreateList(__WEBPACK_EXTERNAL_MODULE__element_registry_js_05e5c264__.rootComponentUniqueId, cbs.componentAtIndex, cbs.enqueueComponent, {}, cbs.componentAtIndexes);
|
|
76
|
+
__SetCSSId([
|
|
77
|
+
el
|
|
78
|
+
], 0);
|
|
79
|
+
return el;
|
|
80
|
+
}
|
|
81
|
+
function insertListItem(parentId, child, childId) {
|
|
82
|
+
const items = listItems.get(parentId);
|
|
83
|
+
if (items) items.push({
|
|
84
|
+
el: child,
|
|
85
|
+
bgId: childId
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
function setPlatformInfoProp(id, key, value) {
|
|
89
|
+
const info = listItemPlatformInfo.get(id);
|
|
90
|
+
if (info) info[key] = value;
|
|
91
|
+
else listItemPlatformInfo.set(id, {
|
|
92
|
+
[key]: value
|
|
93
|
+
});
|
|
94
|
+
if ('item-key' === key) itemKeyMap.set(id, String(value));
|
|
95
|
+
}
|
|
96
|
+
function flushListUpdates() {
|
|
97
|
+
for (const [bgId, items] of listItems){
|
|
98
|
+
const reported = listItemsReported.get(bgId) ?? 0;
|
|
99
|
+
if (items.length <= reported) continue;
|
|
100
|
+
const listEl = __WEBPACK_EXTERNAL_MODULE__element_registry_js_05e5c264__.elements.get(bgId);
|
|
101
|
+
if (!listEl) continue;
|
|
102
|
+
const insertAction = [];
|
|
103
|
+
for(let j = reported; j < items.length; j++){
|
|
104
|
+
const entry = items[j];
|
|
105
|
+
const action = {
|
|
106
|
+
position: j,
|
|
107
|
+
type: 'list-item',
|
|
108
|
+
'item-key': itemKeyMap.get(entry.bgId) ?? String(j)
|
|
109
|
+
};
|
|
110
|
+
const pInfo = listItemPlatformInfo.get(entry.bgId);
|
|
111
|
+
if (pInfo) Object.assign(action, pInfo);
|
|
112
|
+
insertAction.push(action);
|
|
113
|
+
}
|
|
114
|
+
__SetAttribute(listEl, 'update-list-info', {
|
|
115
|
+
insertAction,
|
|
116
|
+
removeAction: [],
|
|
117
|
+
updateAction: []
|
|
118
|
+
});
|
|
119
|
+
listItemsReported.set(bgId, items.length);
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
function resetListState() {
|
|
123
|
+
listItems.clear();
|
|
124
|
+
listElementIds.clear();
|
|
125
|
+
itemKeyMap.clear();
|
|
126
|
+
listItemPlatformInfo.clear();
|
|
127
|
+
listItemsReported.clear();
|
|
128
|
+
}
|
|
129
|
+
export { createListElement, flushListUpdates, insertListItem, isListParent, isPlatformInfoAttr, resetListState, setPlatformInfoProp };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { elements } from './element-registry.js';
|
|
2
|
+
export declare function applyOps(ops: unknown[]): void;
|
|
3
|
+
/** Expose elements map so entry-main.ts can seed the page-root entry. */
|
|
4
|
+
export { elements };
|
|
5
|
+
/** Reset module state – for testing only. */
|
|
6
|
+
export declare function resetMainThreadState(): void;
|