@lingxia/elements 0.14.0 → 0.16.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.
Files changed (69) hide show
  1. package/dist/index.d.ts +3 -2
  2. package/dist/index.js +1 -0
  3. package/dist/inline-native/commit.d.ts +39 -0
  4. package/dist/inline-native/commit.js +94 -0
  5. package/dist/inline-native/elements.d.ts +104 -0
  6. package/dist/inline-native/elements.js +749 -0
  7. package/dist/inline-native/errors.d.ts +8 -0
  8. package/dist/inline-native/errors.js +23 -0
  9. package/dist/inline-native/events.d.ts +10 -0
  10. package/dist/inline-native/events.js +16 -0
  11. package/dist/inline-native/geometry.d.ts +78 -0
  12. package/dist/inline-native/geometry.js +40 -0
  13. package/dist/inline-native/identity.d.ts +28 -0
  14. package/dist/inline-native/identity.js +51 -0
  15. package/dist/inline-native/index.d.ts +14 -0
  16. package/dist/inline-native/index.js +19 -0
  17. package/dist/inline-native/layout.d.ts +2 -0
  18. package/dist/inline-native/layout.js +58 -0
  19. package/dist/inline-native/lease.d.ts +13 -0
  20. package/dist/inline-native/lease.js +31 -0
  21. package/dist/inline-native/runtime.d.ts +64 -0
  22. package/dist/inline-native/runtime.js +119 -0
  23. package/dist/inline-native/schema.d.ts +111 -0
  24. package/dist/inline-native/schema.js +210 -0
  25. package/dist/inline-native/structure.d.ts +22 -0
  26. package/dist/inline-native/structure.js +706 -0
  27. package/dist/inline-native/style.d.ts +7 -0
  28. package/dist/inline-native/style.js +119 -0
  29. package/dist/inline-native/types.d.ts +82 -0
  30. package/dist/inline-native/types.js +7 -0
  31. package/dist/inline-native/unwrap.d.ts +10 -0
  32. package/dist/inline-native/unwrap.js +32 -0
  33. package/dist/inline-native/video.d.ts +65 -0
  34. package/dist/inline-native/video.js +69 -0
  35. package/dist/native_component_wrapper_shared.d.ts +3 -2
  36. package/dist/native_component_wrapper_shared.js +6 -3
  37. package/dist/nativecomponent.d.ts +1 -1
  38. package/dist/nativecomponent.js +8 -11
  39. package/dist/navigator.d.ts +2 -2
  40. package/dist/navigator.js +5 -5
  41. package/dist/picker.js +12 -4
  42. package/dist/video-events.d.ts +2 -0
  43. package/dist/video-events.js +18 -0
  44. package/dist/video.d.ts +98 -79
  45. package/dist/video.js +182 -757
  46. package/package.json +2 -1
  47. package/src/index.ts +58 -1
  48. package/src/inline-native/commit.ts +141 -0
  49. package/src/inline-native/elements.ts +829 -0
  50. package/src/inline-native/errors.ts +35 -0
  51. package/src/inline-native/events.ts +31 -0
  52. package/src/inline-native/geometry.ts +86 -0
  53. package/src/inline-native/identity.ts +102 -0
  54. package/src/inline-native/index.ts +103 -0
  55. package/src/inline-native/layout.ts +58 -0
  56. package/src/inline-native/lease.ts +48 -0
  57. package/src/inline-native/runtime.ts +185 -0
  58. package/src/inline-native/schema.ts +247 -0
  59. package/src/inline-native/structure.ts +823 -0
  60. package/src/inline-native/style.ts +111 -0
  61. package/src/inline-native/types.ts +105 -0
  62. package/src/inline-native/unwrap.ts +34 -0
  63. package/src/inline-native/video.ts +125 -0
  64. package/src/native_component_wrapper_shared.ts +8 -6
  65. package/src/nativecomponent.ts +8 -13
  66. package/src/navigator.ts +9 -9
  67. package/src/picker.ts +13 -4
  68. package/src/video-events.ts +16 -0
  69. package/src/video.ts +245 -839
@@ -0,0 +1,247 @@
1
+ /**
2
+ * Machine-readable inline-native contract. Wrappers, the structure compiler,
3
+ * and the host applicator share this object; unknown names are out of contract.
4
+ */
5
+ export const NATIVE_ERROR_CODES = [
6
+ "NATIVE_ROOT_UNAVAILABLE",
7
+ "NATIVE_ROOT_INCOMPATIBLE",
8
+ "NATIVE_ROOT_INVALID_STRUCTURE",
9
+ "NATIVE_ROOT_FAILED",
10
+ "NATIVE_ROOT_UNSUPPORTED_LAYOUT",
11
+ "NATIVE_COMPONENT_INVALID_PROPS",
12
+ "NATIVE_COMPONENT_MOUNT_FAILED",
13
+ "NATIVE_COMPONENT_COMMAND_FAILED",
14
+ "NATIVE_ROOT_UNSUPPORTED_STYLE",
15
+ "NATIVE_ROOT_DESTROYED",
16
+ ] as const;
17
+
18
+ export const PUBLIC_COMPONENT_NAMES = [
19
+ "LxNativeRoot",
20
+ "LxNativeView",
21
+ "LxNativeCover",
22
+ "LxNativeText",
23
+ "LxNativeButton",
24
+ "LxVideo",
25
+ ] as const;
26
+
27
+ export const PUBLIC_ELEMENT_TAGS = [
28
+ "lx-native-root",
29
+ "lx-native-view",
30
+ "lx-native-cover",
31
+ "lx-native-text",
32
+ "lx-native-button",
33
+ "lx-video",
34
+ ] as const;
35
+
36
+ export const CORE_KINDS = ["root", "view", "text", "tappable"] as const;
37
+
38
+ export const HOST_FACTORY_KINDS = ["root", "view", "text", "tappable", "video"] as const;
39
+
40
+ export const AUTHOR_COMPONENT_TO_TAG = {
41
+ LxNativeRoot: "lx-native-root",
42
+ LxNativeView: "lx-native-view",
43
+ LxNativeCover: "lx-native-cover",
44
+ LxNativeText: "lx-native-text",
45
+ LxNativeButton: "lx-native-button",
46
+ LxVideo: "lx-video",
47
+ } as const;
48
+
49
+ export const TAG_TO_AUTHOR_COMPONENT = {
50
+ "lx-native-root": "LxNativeRoot",
51
+ "lx-native-view": "LxNativeView",
52
+ "lx-native-cover": "LxNativeCover",
53
+ "lx-native-text": "LxNativeText",
54
+ "lx-native-button": "LxNativeButton",
55
+ "lx-video": "LxVideo",
56
+ } as const;
57
+
58
+ export const NATIVE_ACTION_ICONS = [
59
+ "close",
60
+ "play",
61
+ "pause",
62
+ "mute",
63
+ "unmute",
64
+ "fullscreen",
65
+ "more",
66
+ ] as const;
67
+
68
+ export const POINTER_EVENTS_VALUES = ["auto", "none", "box-only", "box-none"] as const;
69
+
70
+ export const COVER_SCRIM_VALUES = ["none", "top", "bottom", "full"] as const;
71
+
72
+ export const STRUCTURE_ROLE_VALUES = [
73
+ "group",
74
+ "region",
75
+ "status",
76
+ "presentation",
77
+ "none",
78
+ ] as const;
79
+
80
+ export const BUTTON_INTENT_VALUES = ["neutral", "accent", "destructive"] as const;
81
+
82
+ export const BUTTON_EMPHASIS_VALUES = ["primary", "secondary", "quiet"] as const;
83
+
84
+ export const BUTTON_SIZE_VALUES = ["compact", "regular"] as const;
85
+
86
+ export const BUTTON_ICON_POSITION_VALUES = ["start", "end"] as const;
87
+
88
+ export const VIDEO_OBJECT_FIT_VALUES = ["contain", "cover", "fill", "none"] as const;
89
+
90
+ export const VIDEO_CONTENT_ROTATE_VALUES = [0, 90, 180, 270] as const;
91
+
92
+ export const WATERMARK_CORNER_VALUES = [
93
+ "top-start",
94
+ "top-end",
95
+ "bottom-start",
96
+ "bottom-end",
97
+ ] as const;
98
+
99
+ /** Layout fields measured from the DOM anchor. */
100
+ export const NATIVE_STYLE_LAYOUT_FIELDS = [
101
+ "display",
102
+ "position",
103
+ "top",
104
+ "right",
105
+ "bottom",
106
+ "left",
107
+ "inset",
108
+ "width",
109
+ "height",
110
+ "minWidth",
111
+ "minHeight",
112
+ "maxWidth",
113
+ "maxHeight",
114
+ "flex",
115
+ "flexGrow",
116
+ "flexShrink",
117
+ "flexBasis",
118
+ "flexDirection",
119
+ "flexWrap",
120
+ "alignItems",
121
+ "alignSelf",
122
+ "justifyContent",
123
+ "gap",
124
+ "rowGap",
125
+ "columnGap",
126
+ "gridTemplateColumns",
127
+ "gridTemplateRows",
128
+ "gridColumn",
129
+ "gridRow",
130
+ "margin",
131
+ "marginTop",
132
+ "marginRight",
133
+ "marginBottom",
134
+ "marginLeft",
135
+ "padding",
136
+ "paddingTop",
137
+ "paddingRight",
138
+ "paddingBottom",
139
+ "paddingLeft",
140
+ "overflow",
141
+ "aspectRatio",
142
+ "boxSizing",
143
+ ] as const;
144
+
145
+ export const NATIVE_STYLE_PAINT_FIELDS = [
146
+ "backgroundColor",
147
+ "opacity",
148
+ "border",
149
+ "borderWidth",
150
+ "borderColor",
151
+ "borderStyle",
152
+ "borderRadius",
153
+ ] as const;
154
+
155
+ export const NATIVE_STYLE_UNSUPPORTED_LAYOUT_FIELDS = [
156
+ "transform",
157
+ "translate",
158
+ "rotate",
159
+ "scale",
160
+ "perspective",
161
+ "clipPath",
162
+ "maskImage",
163
+ ] as const;
164
+
165
+ export const NATIVE_STYLE_UNSUPPORTED_PAINT_FIELDS = [
166
+ "boxShadow",
167
+ "filter",
168
+ "backdropFilter",
169
+ "mixBlendMode",
170
+ "backgroundImage",
171
+ "background",
172
+ "animation",
173
+ "transition",
174
+ "textDecoration",
175
+ "fontStyle",
176
+ "letterSpacing",
177
+ "textShadow",
178
+ ] as const;
179
+
180
+ export const TEXT_STYLE_PROP_FIELDS = [
181
+ "fontSize",
182
+ "fontWeight",
183
+ "lineHeight",
184
+ "textAlign",
185
+ "color",
186
+ ] as const;
187
+
188
+ export const INTERACTIVE_AUTHOR_COMPONENTS = [
189
+ "LxNativeButton",
190
+ "LxVideo",
191
+ ] as const;
192
+
193
+ export const CONTAINER_AUTHOR_COMPONENTS = [
194
+ "LxNativeRoot",
195
+ "LxNativeView",
196
+ "LxNativeCover",
197
+ ] as const;
198
+
199
+ export const INLINE_NATIVE_SCHEMA = {
200
+ version: 1,
201
+ publicComponents: PUBLIC_COMPONENT_NAMES,
202
+ publicElementTags: PUBLIC_ELEMENT_TAGS,
203
+ coreKinds: CORE_KINDS,
204
+ hostFactoryKinds: HOST_FACTORY_KINDS,
205
+ errorCodes: NATIVE_ERROR_CODES,
206
+ authorComponentToTag: AUTHOR_COMPONENT_TO_TAG,
207
+ tagToAuthorComponent: TAG_TO_AUTHOR_COMPONENT,
208
+ nativeActionIcons: NATIVE_ACTION_ICONS,
209
+ pointerEvents: POINTER_EVENTS_VALUES,
210
+ coverScrim: COVER_SCRIM_VALUES,
211
+ structureRoles: STRUCTURE_ROLE_VALUES,
212
+ buttonIntent: BUTTON_INTENT_VALUES,
213
+ buttonEmphasis: BUTTON_EMPHASIS_VALUES,
214
+ buttonSize: BUTTON_SIZE_VALUES,
215
+ buttonIconPosition: BUTTON_ICON_POSITION_VALUES,
216
+ videoObjectFit: VIDEO_OBJECT_FIT_VALUES,
217
+ videoContentRotate: VIDEO_CONTENT_ROTATE_VALUES,
218
+ watermarkCorners: WATERMARK_CORNER_VALUES,
219
+ nativeStyle: {
220
+ layout: NATIVE_STYLE_LAYOUT_FIELDS,
221
+ paint: NATIVE_STYLE_PAINT_FIELDS,
222
+ unsupportedLayout: NATIVE_STYLE_UNSUPPORTED_LAYOUT_FIELDS,
223
+ unsupportedPaint: NATIVE_STYLE_UNSUPPORTED_PAINT_FIELDS,
224
+ text: TEXT_STYLE_PROP_FIELDS,
225
+ },
226
+ interactiveAuthorComponents: INTERACTIVE_AUTHOR_COMPONENTS,
227
+ containerAuthorComponents: CONTAINER_AUTHOR_COMPONENTS,
228
+ recipes: {
229
+ LxNativeCover: { expandsTo: "view", hostKind: false },
230
+ LxNativeButton: { expandsTo: "tappable", hostKind: false },
231
+ },
232
+ capabilityLeaves: {
233
+ LxVideo: { hostKind: "video", mustBeDirectRootChild: true },
234
+ },
235
+ } as const;
236
+
237
+ export type NativeErrorCode = (typeof NATIVE_ERROR_CODES)[number];
238
+ export type PublicComponentName = (typeof PUBLIC_COMPONENT_NAMES)[number];
239
+ export type PublicElementTag = (typeof PUBLIC_ELEMENT_TAGS)[number];
240
+ export type CoreKind = (typeof CORE_KINDS)[number];
241
+ export type HostFactoryKind = (typeof HOST_FACTORY_KINDS)[number];
242
+ export type NativeActionIcon = (typeof NATIVE_ACTION_ICONS)[number];
243
+
244
+ export type NativeStyleProperty =
245
+ | (typeof NATIVE_STYLE_LAYOUT_FIELDS)[number]
246
+ | (typeof NATIVE_STYLE_PAINT_FIELDS)[number]
247
+ | (typeof TEXT_STYLE_PROP_FIELDS)[number];