@lynx-js/web-constants 0.15.1 → 0.15.2

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,22 @@
1
1
  # @lynx-js/web-constants
2
2
 
3
+ ## 0.15.2
4
+
5
+ ### Patch Changes
6
+
7
+ - feat: move SSR hydrate essential info to the ssr attribute ([#1292](https://github.com/lynx-family/lynx-stack/pull/1292))
8
+
9
+ We found that in browser there is no simple tool to decode a base64 string
10
+
11
+ Therefore we move the data to `ssr` attribute
12
+
13
+ Also fix some ssr issues
14
+
15
+ - feat: support \_\_MarkTemplateElement, \_\_MarkPartElement and \_\_GetTemplateParts for all-on-ui ([#1275](https://github.com/lynx-family/lynx-stack/pull/1275))
16
+
17
+ - Updated dependencies []:
18
+ - @lynx-js/web-worker-rpc@0.15.2
19
+
3
20
  ## 0.15.1
4
21
 
5
22
  ### Patch Changes
@@ -6,6 +6,8 @@ export declare const lynxTagAttribute: "lynx-tag";
6
6
  export declare const lynxDatasetAttribute: "l-dset";
7
7
  export declare const lynxComponentConfigAttribute: "l-comp-cfg";
8
8
  export declare const lynxDisposedAttribute: "l-disposed";
9
+ export declare const lynxElementTemplateMarkerAttribute: "l-template";
10
+ export declare const lynxPartIdAttribute: "l-part";
9
11
  export declare const lynxDefaultDisplayLinearAttribute: "lynx-default-display-linear";
10
12
  export declare const lynxDefaultOverflowVisibleAttribute: "lynx-default-overflow-visible";
11
13
  export declare const __lynx_timing_flag: "__lynx_timing_flag";
package/dist/constants.js CHANGED
@@ -9,6 +9,8 @@ export const lynxTagAttribute = 'lynx-tag';
9
9
  export const lynxDatasetAttribute = 'l-dset';
10
10
  export const lynxComponentConfigAttribute = 'l-comp-cfg';
11
11
  export const lynxDisposedAttribute = 'l-disposed';
12
+ export const lynxElementTemplateMarkerAttribute = 'l-template';
13
+ export const lynxPartIdAttribute = 'l-part';
12
14
  export const lynxDefaultDisplayLinearAttribute = 'lynx-default-display-linear';
13
15
  export const lynxDefaultOverflowVisibleAttribute = 'lynx-default-overflow-visible';
14
16
  export const __lynx_timing_flag = '__lynx_timing_flag';
@@ -35,6 +35,7 @@ export interface ElementAnimationOptions {
35
35
  timingOptions?: Record<string, any>;
36
36
  }
37
37
  export interface WebFiberElementImpl {
38
+ querySelectorAll?: (selectors: string) => WebFiberElementImpl[];
38
39
  getAttributeNames: () => string[];
39
40
  getAttribute: (name: string) => string | null;
40
41
  setAttribute: (name: string, value: string) => void;
@@ -25,7 +25,7 @@ export type SetEventsPAPI = (element: WebFiberElementImpl, listeners: {
25
25
  export type AppendElementPAPI = (parent: WebFiberElementImpl, child: WebFiberElementImpl) => void;
26
26
  export type ElementIsEqualPAPI = (left: WebFiberElementImpl, right: WebFiberElementImpl) => boolean;
27
27
  export type FirstElementPAPI = (element: WebFiberElementImpl) => WebFiberElementImpl | null;
28
- export type GetChildrenPAPI = (element: WebFiberElementImpl) => WebFiberElementImpl[];
28
+ export type GetChildrenPAPI = (element: WebFiberElementImpl) => WebFiberElementImpl[] | null;
29
29
  export type GetParentPAPI = (element: WebFiberElementImpl) => WebFiberElementImpl | null;
30
30
  export type InsertElementBeforePAPI = (parent: WebFiberElementImpl, child: WebFiberElementImpl, ref?: WebFiberElementImpl | null) => WebFiberElementImpl;
31
31
  export type LastElementPAPI = (element: WebFiberElementImpl) => WebFiberElementImpl | null;
@@ -75,11 +75,16 @@ export type AddInlineStylePAPI = (element: WebFiberElementImpl, key: number | st
75
75
  export type SetInlineStylesPAPI = (element: WebFiberElementImpl, value: string | Record<string, string> | undefined) => void;
76
76
  export type SetCSSIdPAPI = (elements: WebFiberElementImpl[], cssId: number | null) => void;
77
77
  export type GetPageElementPAPI = () => WebFiberElementImpl | undefined;
78
- export type GetTemplatePartsPAPI = (templateElement: WebFiberElementImpl) => Record<string, WebFiberElementImpl> | undefined;
78
+ export type MarkTemplateElementPAPI = (element: WebFiberElementImpl) => void;
79
+ export type MarkPartElementPAPI = (element: WebFiberElementImpl, partId: string) => void;
80
+ export type GetTemplatePartsPAPI = (templateElement: WebFiberElementImpl) => Record<string, WebFiberElementImpl>;
79
81
  interface JSErrorInfo {
80
82
  release: string;
81
83
  }
82
84
  export interface MainThreadGlobalThis {
85
+ __GetTemplateParts?: GetTemplatePartsPAPI;
86
+ __MarkPartElement: MarkPartElementPAPI;
87
+ __MarkTemplateElement: MarkTemplateElementPAPI;
83
88
  __AddEvent: AddEventPAPI;
84
89
  __GetEvent: GetEventPAPI;
85
90
  __GetEvents: GetEventsPAPI;
@@ -130,14 +135,13 @@ export interface MainThreadGlobalThis {
130
135
  __SetInlineStyles: SetInlineStylesPAPI;
131
136
  __SetCSSId: SetCSSIdPAPI;
132
137
  __GetPageElement: GetPageElementPAPI;
133
- __GetTemplateParts: GetTemplatePartsPAPI;
134
138
  __globalProps: unknown;
135
139
  SystemInfo: typeof systemInfo;
136
140
  globalThis?: MainThreadGlobalThis;
137
141
  lynx: MainThreadLynx;
138
142
  processData?: ProcessDataCallback;
139
143
  ssrEncode?: () => string;
140
- ssrHydrate?: (encodeData?: string) => void;
144
+ ssrHydrate?: (encodeData?: string | null) => void;
141
145
  _ReportError: (error: Error, _: unknown) => void;
142
146
  _SetSourceMapRelease: (errInfo: JSErrorInfo) => void;
143
147
  __OnLifecycleEvent: (lifeCycleEvent: Cloneable) => void;
@@ -0,0 +1,22 @@
1
+ import type { WebFiberElementImpl } from './Element.js';
2
+ import type { AddEventPAPI } from './MainThreadGlobalThis.js';
3
+ export type SSREventReplayInfo = [
4
+ number,
5
+ Parameters<AddEventPAPI>[1],
6
+ Parameters<AddEventPAPI>[2],
7
+ Parameters<AddEventPAPI>[3]
8
+ ];
9
+ export type SSRDumpInfo = {
10
+ ssrEncodeData: string | null | undefined;
11
+ events: SSREventReplayInfo[];
12
+ };
13
+ export interface SSRHydrateInfo extends SSRDumpInfo {
14
+ /** WeakRef<Element> */
15
+ lynxUniqueIdToElement: WeakRef<WebFiberElementImpl>[];
16
+ /** for cssog */
17
+ lynxUniqueIdToStyleRulesIndex: number[];
18
+ cardStyleElement: HTMLStyleElement | null;
19
+ }
20
+ export type SSRDehydrateHooks = {
21
+ __AddEvent: AddEventPAPI;
22
+ };
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=SSR.js.map
@@ -18,3 +18,4 @@ export * from './MainThreadLynx.js';
18
18
  export * from './I18n.js';
19
19
  export * from './BackThreadStartConfigs.js';
20
20
  export * from './MarkTiming.js';
21
+ export * from './SSR.js';
@@ -18,4 +18,5 @@ export * from './MainThreadLynx.js';
18
18
  export * from './I18n.js';
19
19
  export * from './BackThreadStartConfigs.js';
20
20
  export * from './MarkTiming.js';
21
+ export * from './SSR.js';
21
22
  //# sourceMappingURL=index.js.map
@@ -62,6 +62,10 @@ const mainThreadInjectVars = [
62
62
  'SystemInfo',
63
63
  '_I18nResourceTranslation',
64
64
  '_AddEventListener',
65
+ '__GetTemplateParts',
66
+ '__MarkPartElement',
67
+ '__MarkTemplateElement',
68
+ '__GetPageElement',
65
69
  ];
66
70
  const backgroundInjectVars = [
67
71
  'NativeModules',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lynx-js/web-constants",
3
- "version": "0.15.1",
3
+ "version": "0.15.2",
4
4
  "private": false,
5
5
  "description": "",
6
6
  "keywords": [],
@@ -23,7 +23,7 @@
23
23
  "**/*.css"
24
24
  ],
25
25
  "dependencies": {
26
- "@lynx-js/web-worker-rpc": "0.15.1"
26
+ "@lynx-js/web-worker-rpc": "0.15.2"
27
27
  },
28
28
  "devDependencies": {
29
29
  "@lynx-js/offscreen-document": "0.1.3"