@lynx-js/web-mainthread-apis-canary 0.15.5 → 0.15.6-canary-20250812-214898bb

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 CHANGED
@@ -1,5 +1,15 @@
1
1
  # @lynx-js/web-mainthread-apis
2
2
 
3
+ ## 0.15.6-canary-20250812043229-214898bb9c74fc9b44e68cb220a4c02485102ce2
4
+
5
+ ### Patch Changes
6
+
7
+ - fix: all attributes except `id` and `type` under ElementTemplateData are optional. ([#1483](https://github.com/lynx-family/lynx-stack/pull/1483))
8
+
9
+ - Updated dependencies [[`214898b`](https://github.com/lynx-family/lynx-stack/commit/214898bb9c74fc9b44e68cb220a4c02485102ce2)]:
10
+ - @lynx-js/web-constants@0.15.6-canary-20250812043229-214898bb9c74fc9b44e68cb220a4c02485102ce2
11
+ - @lynx-js/web-style-transformer@0.15.6-canary-20250812043229-214898bb9c74fc9b44e68cb220a4c02485102ce2
12
+
3
13
  ## 0.15.5
4
14
 
5
15
  ### Patch Changes
@@ -146,25 +156,25 @@
146
156
  lynxView.initI18nResources = [
147
157
  {
148
158
  options: {
149
- locale: 'en',
150
- channel: '1',
151
- fallback_url: '',
159
+ locale: "en",
160
+ channel: "1",
161
+ fallback_url: "",
152
162
  },
153
163
  resource: {
154
- hello: 'hello',
155
- lynx: 'lynx web platform1',
164
+ hello: "hello",
165
+ lynx: "lynx web platform1",
156
166
  },
157
167
  },
158
168
  ];
159
- lynxView.addEventListener('i18nResourceMissed', (e) => {
169
+ lynxView.addEventListener("i18nResourceMissed", (e) => {
160
170
  console.log(e);
161
171
  });
162
172
 
163
173
  // mts
164
174
  _I18nResourceTranslation({
165
- locale: 'en',
166
- channel: '1',
167
- fallback_url: '',
175
+ locale: "en",
176
+ channel: "1",
177
+ fallback_url: "",
168
178
  });
169
179
  ```
170
180
 
@@ -380,14 +380,14 @@ export function createMainThreadGlobalThis(config) {
380
380
  const createElementForElementTemplateData = (data, parentComponentUniId) => {
381
381
  const element = __CreateElement(data.type, parentComponentUniId);
382
382
  __SetID(element, data.id);
383
- __SetClasses(element, data.class.join(' '));
384
- for (const [key, value] of Object.entries(data.attributes)) {
383
+ data.class && __SetClasses(element, data.class.join(' '));
384
+ for (const [key, value] of Object.entries(data.attributes || {})) {
385
385
  __SetAttribute(element, key, value);
386
386
  }
387
- for (const [key, value] of Object.entries(data.builtinAttributes)) {
387
+ for (const [key, value] of Object.entries(data.builtinAttributes || {})) {
388
388
  __SetAttribute(element, key, value);
389
389
  }
390
- for (const childData of data.children) {
390
+ for (const childData of data.children || []) {
391
391
  __AppendElement(element, createElementForElementTemplateData(childData, parentComponentUniId));
392
392
  }
393
393
  return element;
@@ -395,12 +395,12 @@ export function createMainThreadGlobalThis(config) {
395
395
  const applyEventsForElementTemplate = (data, element) => {
396
396
  const uniqueId = uniqueIdInc++;
397
397
  element.setAttribute(lynxUniqueIdAttribute, uniqueId + '');
398
- for (const event of data.events) {
398
+ for (const event of data.events || []) {
399
399
  const { type, name, value } = event;
400
400
  __AddEvent(element, type, name, value);
401
401
  }
402
- for (let ii = 0; ii < data.children.length; ii++) {
403
- const childData = data.children[ii];
402
+ for (let ii = 0; ii < (data.children || []).length; ii++) {
403
+ const childData = (data.children || [])[ii];
404
404
  const childElement = element.children[ii];
405
405
  if (childData && childElement) {
406
406
  applyEventsForElementTemplate(childData, childElement);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lynx-js/web-mainthread-apis-canary",
3
- "version": "0.15.5",
3
+ "version": "0.15.6-canary-20250812-214898bb",
4
4
  "private": false,
5
5
  "description": "",
6
6
  "keywords": [],
@@ -24,8 +24,8 @@
24
24
  "**/*.css"
25
25
  ],
26
26
  "dependencies": {
27
- "@lynx-js/web-constants": "npm:@lynx-js/web-constants-canary@0.15.5",
28
- "@lynx-js/web-style-transformer": "npm:@lynx-js/web-style-transformer-canary@0.15.5",
27
+ "@lynx-js/web-constants": "npm:@lynx-js/web-constants-canary@0.15.6-canary-20250812-214898bb",
28
+ "@lynx-js/web-style-transformer": "npm:@lynx-js/web-style-transformer-canary@0.15.6-canary-20250812-214898bb",
29
29
  "hyphenate-style-name": "^1.1.0"
30
30
  }
31
31
  }