@lexriver/dome 1.3.0 → 1.4.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/out/Dome.js CHANGED
@@ -1,295 +1,295 @@
1
- // inspiration: https://github.com/vadimdemedes/dom-chef/blob/master/index.js
2
- //import svgTagNames from 'svg-tag-names'
3
- const svgTagNames = require('svg-tag-names');
4
- //import svgTagNames from 'svg-tag-names'
5
- //import * as flatten from 'arr-flatten'
6
- //import { DomeEventDispatcher } from './DomeEventDispatcher.ts.old'
7
- import { DomeManipulator } from './DomeManipulator';
8
- import { checkIfObservable } from '@lexriver/observable';
9
- import { DataTypes } from '@lexriver/data-types';
10
- const filename = '[Dome]: ';
11
- //const mountFunctionByNode = new Map<Node, (ref:any)=>void>()
12
- // https://github.com/jonschlinkert/arr-flatten/blob/master/index.js
13
- function flattenArray(arr, res = []) {
14
- var i = 0, cur;
15
- var len = arr.length;
16
- for (; i < len; i++) {
17
- cur = arr[i];
18
- Array.isArray(cur) ? flattenArray(cur, res) : res.push(cur);
19
- }
20
- return res;
21
- }
22
- function checkIfNonDimensionalCssName(name) {
23
- // Copied from Preact
24
- const IS_NON_DIMENSIONAL = /acit|ex(?:s|g|n|p|$)|rph|ows|mnc|ntw|ine[ch]|zoo|^ord/i;
25
- return IS_NON_DIMENSIONAL.test(name);
26
- }
27
- const excludeSvgTags = [
28
- 'a',
29
- 'audio',
30
- 'canvas',
31
- 'iframe',
32
- 'script',
33
- 'video'
34
- ];
35
- const svgTags = svgTagNames.filter(name => !excludeSvgTags.includes(name));
36
- const isSVG = tagName => svgTags.includes(tagName);
37
- const setCSSProps = (el, style) => {
38
- if (DataTypes.isString(style)) {
39
- el.style = style;
40
- }
41
- else if (DataTypes.isObjectWithKeys(style)) {
42
- Object.keys(style).forEach(name => {
43
- let value = style[name];
44
- if (typeof value === 'number' && !checkIfNonDimensionalCssName(name)) {
45
- value = `${value}px`;
46
- }
47
- el.style[name] = value;
48
- });
49
- }
50
- };
51
- const createElement = (tagName) => {
52
- if (isSVG(tagName)) {
53
- return document.createElementNS('http://www.w3.org/2000/svg', tagName);
54
- }
55
- if (tagName === DocumentFragment) {
56
- return document.createDocumentFragment();
57
- }
58
- return document.createElement(tagName);
59
- };
60
- // function subscribeToEventByParam(x:OnEventObject, el:HTMLElement){
61
- // if(
62
- // !x.eventName ||
63
- // Data.isString(x.eventName) == false ||
64
- // !x.eventReaction ||
65
- // Data.isFunction(x.eventReaction) == false
66
- // ){
67
- // console.error('x=', x, 'el=', el)
68
- // throw new Error(`Please provide object of type {eventName:string, eventParams:Object, eventReaction:(eventParams, htmlElement)=>void}`)
69
- // }
70
- // //DomeEventDispatcher.subscribeToEvent(el, x.eventName, x.eventParams || {}, x.eventReaction)
71
- // DomeEventDispatcher.subscribeToEvent({
72
- // eventName: x.eventName,
73
- // eventParamsFilter: x.eventParams || {},
74
- // action: x.eventReaction,
75
- // unsubscribeWhen: () => DomeManipulator.isInDom(el) == false
76
- // })
77
- // }
78
- const build = (tagName, attrs, children) => {
79
- if (!tagName) {
80
- console.trace();
81
- throw new Error('tagName=' + tagName);
82
- }
83
- // if(children && typeof children !== 'object'){
84
- // //console.log('tagName=', tagName, 'attrs=',attrs, 'children=', children)
85
- // console.log('tagName=', tagName, 'children=', children, 'typeof children=', typeof children)
86
- // }
87
- if (tagName == DocumentFragment) {
88
- //console.warn(filename, 'isDocumentFragment!')
89
- const el = createElement(tagName);
90
- el.appendChild(children);
91
- return el;
92
- }
93
- //console.log(filename, 'instaceof=', tagName instanceof DomeComponent)
94
- //console.log(filename, 'has render=', tagName.render)
95
- //console.log(filename, 'instanceof Object=', tagName instanceof Object)
96
- if (tagName.prototype && tagName.prototype['__DomeComponent']) {
97
- // we have a DomeComponent
98
- //console.warn('DomeComponent!')
99
- try {
100
- const instance = new tagName(attrs, children);
101
- //console.log('instance=', instance)
102
- if (instance['render'] && DataTypes.isFunction(instance['render'])) {
103
- //#region make ref points to instance, not element
104
- if (attrs.ref && DataTypes.isFunction(attrs.ref)) {
105
- attrs.ref(instance);
106
- }
107
- //#endregion
108
- instance['init']();
109
- instance.rootElement = instance['render']();
110
- //#region subscribe to observable attribute
111
- for (let attribute of Object.values(attrs)) {
112
- if (checkIfObservable(attribute)) {
113
- attribute.eventOnChange.subscribe(() => {
114
- //this.update()
115
- instance.scheduleUpdate();
116
- });
117
- }
118
- }
119
- //#endregion
120
- //requestAnimationFrame(() => {
121
- instance['afterRender']();
122
- //})
123
- return instance.rootElement;
124
- }
125
- }
126
- catch (error) {
127
- console.error('error while creating DomeComponent class', error);
128
- }
129
- return;
130
- }
131
- if (DataTypes.isFunction(tagName)) {
132
- // call functional component
133
- return tagName(attrs, children);
134
- }
135
- else if (DataTypes.isString(tagName)) {
136
- const el = createElement(tagName);
137
- //console.log('lex-dome', 'creating element', el)
138
- Object.keys(attrs).forEach(name => {
139
- const value = attrs[name];
140
- if (name === 'class' || name === 'className' || name === 'cssClasses') {
141
- //DomeManipulator.setCssClasses(el, value)
142
- assignDynamicCssClasses(name, value, el);
143
- }
144
- else if (name === 'style') {
145
- setCSSProps(el, value);
146
- }
147
- else if (['disabled', 'autocomplete', 'selected', 'checked'].indexOf(name) >= 0) {
148
- if (attrs[name]) {
149
- DomeManipulator.setAttribute(el, name, name);
150
- }
151
- }
152
- else if (name === 'onCreate' || name === 'ref') {
153
- if (DataTypes.isFunction(value) == false)
154
- throw new Error(`Please provide function <${tagName} ${name}={ref => myRef=ref} />`);
155
- value(el);
156
- // } else if(name === 'onEvent'){ //TODO: remove this!?
157
- // // <div onEvent={{eventName:'myCumstomEvent', eventParams:{any:'params',can:'be',here:true}, eventReaction:()=>{}}}>some text for div</div>
158
- // //#region is Object
159
- // if(Data.isObjectWithKeys(value)){
160
- // subscribeToEventByParam(value as OnEventObject, el)
161
- // return
162
- // }
163
- // //#endregion
164
- // //#region is Array
165
- // if(Data.isArray(value)){
166
- // for(let x of value){
167
- // subscribeToEventByParam(x as OnEventObject, el)
168
- // }
169
- // }
170
- // //#endregion
171
- }
172
- else if (name == 'visibleIf') { //TODO: remove this!?
173
- if (checkIfObservable(value) == false) {
174
- console.error('value=', value);
175
- throw new Error('Please provide Observable<boolean> as argument for visibleIf');
176
- }
177
- let obs = value;
178
- obs.eventOnChange.subscribe((isVisible) => {
179
- if (isVisible) {
180
- DomeManipulator.unhideElementAsync(el);
181
- }
182
- else {
183
- DomeManipulator.hideElementAsync(el);
184
- }
185
- });
186
- setTimeout(() => {
187
- obs.eventOnChange.triggerAsync(obs.get());
188
- }, 1);
189
- }
190
- else if (name.indexOf('on') === 0 && value) {
191
- const eventName = name.slice(2).toLowerCase();
192
- if (DataTypes.isFunction(value) == false) {
193
- console.error('unable to subscribe for event', eventName, 'listener is not a function', 'element=', el, 'listener=', value);
194
- return;
195
- }
196
- //console.log('adding event listener for', el, 'eventName=', eventName, 'value=', value)
197
- el.addEventListener(eventName, value);
198
- }
199
- else if (name === 'innerHtml') {
200
- el.innerHTML = value;
201
- }
202
- else if (name !== 'key' && value !== false) {
203
- DomeManipulator.setAttribute(el, name, value === true ? '' : value);
204
- }
205
- });
206
- if (!attrs.innerHtml) {
207
- el.appendChild(children);
208
- }
209
- return el;
210
- }
211
- else
212
- throw new Error("not implemented");
213
- };
214
- /**
215
- *
216
- * @param value
217
- * @param name
218
- * @param element
219
- */
220
- function assignDynamicCssClasses(name, value, element) {
221
- if (DataTypes.isObjectWithKeys(value) == false) {
222
- DomeManipulator.setCssClasses(element, value);
223
- return;
224
- //throw new Error(`Please provide object for ${name}, ex: {class1:true, class2:myVarO}`)
225
- }
226
- let resultArray = [];
227
- for (let [k, v] of Object.entries(value)) {
228
- if (v === undefined) {
229
- //skip
230
- }
231
- else if (DataTypes.isBoolean(v)) {
232
- if (v) {
233
- resultArray.push(k);
234
- }
235
- }
236
- else if (checkIfObservable(v)) {
237
- let o = v;
238
- o.eventOnChange.subscribe((showThiCssClass) => {
239
- if (!DomeManipulator.isInDom(element))
240
- return { unsubscribe: true }; //TODO: test it
241
- // reassign whole attribute
242
- DomeManipulator.setCssClasses(element, value);
243
- });
244
- if (o.get()) {
245
- resultArray.push(k);
246
- }
247
- }
248
- else {
249
- console.error(`Please provide classNames as a keys and boolean or Observable<boolean> for values., ex: {class1:true, class2:myVarO}`, 'name=', name, 'value=', value, 'typeof value =', typeof value);
250
- throw new Error('Wrong value for `class` attribute');
251
- }
252
- }
253
- DomeManipulator.setCssClasses(element, resultArray); // yes, array of classes is ok here
254
- }
255
- export function h(tagName, attrs, ...childrenArgs) {
256
- // eslint-disable-next-line prefer-rest-params
257
- //const childrenArgs = [].slice.apply(arguments, [2])
258
- const children = document.createDocumentFragment();
259
- //const childArray:any[] = []
260
- // console.log(filename, 'childrenArgs=', childrenArgs)
261
- // console.log(filename, 'childrenO=', childrenO)
262
- // if(tagName === 'hoho'){
263
- // console.warn(filename, tagName, attrs, ...childrenArgs)
264
- // }
265
- flattenArray(childrenArgs).forEach(child => {
266
- //(childrenArgs).forEach(child => {
267
- // if(tagName === 'hoho'){
268
- // console.warn(filename, 'child=', child)
269
- // }
270
- if (child instanceof Node) {
271
- children.appendChild(child);
272
- //childArray.push(child)
273
- // const mountFunction = mountFunctionByNode.get(child)
274
- // if(mountFunction){
275
- // mountFunction(child)
276
- // mountFunctionByNode.delete(child)// delete after execution
277
- // }
278
- }
279
- else if (typeof child !== 'boolean' && typeof child !== 'undefined' && child !== null) {
280
- //console.log('[Dome] child=', child)
281
- //console.warn(filename, 'text? child=', child)
282
- children.appendChild(document.createTextNode(child));
283
- //childArray.push(document.createTextNode(child))
284
- }
285
- });
286
- //return build(tagName, attrs || {}, children)
287
- return build(tagName, attrs || {}, children);
288
- }
289
- // Improve TypeScript support for DocumentFragment
290
- // https://github.com/Microsoft/TypeScript/issues/20469
291
- export const React = {
292
- createElement: h,
293
- Fragment: typeof DocumentFragment === 'function' ? DocumentFragment : () => { }
294
- };
295
- export default React;
1
+ // inspiration: https://github.com/vadimdemedes/dom-chef/blob/master/index.js
2
+ //import svgTagNames from 'svg-tag-names'
3
+ const svgTagNames = require('svg-tag-names');
4
+ //import svgTagNames from 'svg-tag-names'
5
+ //import * as flatten from 'arr-flatten'
6
+ //import { DomeEventDispatcher } from './DomeEventDispatcher.ts.old'
7
+ import { DomeManipulator } from './DomeManipulator';
8
+ import { checkIfObservable } from '@lexriver/observable';
9
+ import { DataTypes } from '@lexriver/data-types';
10
+ const filename = '[Dome]: ';
11
+ //const mountFunctionByNode = new Map<Node, (ref:any)=>void>()
12
+ // https://github.com/jonschlinkert/arr-flatten/blob/master/index.js
13
+ function flattenArray(arr, res = []) {
14
+ var i = 0, cur;
15
+ var len = arr.length;
16
+ for (; i < len; i++) {
17
+ cur = arr[i];
18
+ Array.isArray(cur) ? flattenArray(cur, res) : res.push(cur);
19
+ }
20
+ return res;
21
+ }
22
+ function checkIfNonDimensionalCssName(name) {
23
+ // Copied from Preact
24
+ const IS_NON_DIMENSIONAL = /acit|ex(?:s|g|n|p|$)|rph|ows|mnc|ntw|ine[ch]|zoo|^ord/i;
25
+ return IS_NON_DIMENSIONAL.test(name);
26
+ }
27
+ const excludeSvgTags = [
28
+ 'a',
29
+ 'audio',
30
+ 'canvas',
31
+ 'iframe',
32
+ 'script',
33
+ 'video'
34
+ ];
35
+ const svgTags = svgTagNames.filter(name => !excludeSvgTags.includes(name));
36
+ const isSVG = tagName => svgTags.includes(tagName);
37
+ const setCSSProps = (el, style) => {
38
+ if (DataTypes.isString(style)) {
39
+ el.style = style;
40
+ }
41
+ else if (DataTypes.isObjectWithKeys(style)) {
42
+ Object.keys(style).forEach(name => {
43
+ let value = style[name];
44
+ if (typeof value === 'number' && !checkIfNonDimensionalCssName(name)) {
45
+ value = `${value}px`;
46
+ }
47
+ el.style[name] = value;
48
+ });
49
+ }
50
+ };
51
+ const createElement = (tagName) => {
52
+ if (isSVG(tagName)) {
53
+ return document.createElementNS('http://www.w3.org/2000/svg', tagName);
54
+ }
55
+ if (tagName === DocumentFragment) {
56
+ return document.createDocumentFragment();
57
+ }
58
+ return document.createElement(tagName);
59
+ };
60
+ // function subscribeToEventByParam(x:OnEventObject, el:HTMLElement){
61
+ // if(
62
+ // !x.eventName ||
63
+ // Data.isString(x.eventName) == false ||
64
+ // !x.eventReaction ||
65
+ // Data.isFunction(x.eventReaction) == false
66
+ // ){
67
+ // console.error('x=', x, 'el=', el)
68
+ // throw new Error(`Please provide object of type {eventName:string, eventParams:Object, eventReaction:(eventParams, htmlElement)=>void}`)
69
+ // }
70
+ // //DomeEventDispatcher.subscribeToEvent(el, x.eventName, x.eventParams || {}, x.eventReaction)
71
+ // DomeEventDispatcher.subscribeToEvent({
72
+ // eventName: x.eventName,
73
+ // eventParamsFilter: x.eventParams || {},
74
+ // action: x.eventReaction,
75
+ // unsubscribeWhen: () => DomeManipulator.isInDom(el) == false
76
+ // })
77
+ // }
78
+ const build = (tagName, attrs, children) => {
79
+ if (!tagName) {
80
+ console.trace();
81
+ throw new Error('tagName=' + tagName);
82
+ }
83
+ // if(children && typeof children !== 'object'){
84
+ // //console.log('tagName=', tagName, 'attrs=',attrs, 'children=', children)
85
+ // console.log('tagName=', tagName, 'children=', children, 'typeof children=', typeof children)
86
+ // }
87
+ if (tagName == DocumentFragment) {
88
+ //console.warn(filename, 'isDocumentFragment!')
89
+ const el = createElement(tagName);
90
+ el.appendChild(children);
91
+ return el;
92
+ }
93
+ //console.log(filename, 'instaceof=', tagName instanceof DomeComponent)
94
+ //console.log(filename, 'has render=', tagName.render)
95
+ //console.log(filename, 'instanceof Object=', tagName instanceof Object)
96
+ if (tagName.prototype && tagName.prototype['__DomeComponent']) {
97
+ // we have a DomeComponent
98
+ //console.warn('DomeComponent!')
99
+ try {
100
+ const instance = new tagName(attrs, children);
101
+ //console.log('instance=', instance)
102
+ if (instance['render'] && DataTypes.isFunction(instance['render'])) {
103
+ //#region make ref points to instance, not element
104
+ if (attrs.ref && DataTypes.isFunction(attrs.ref)) {
105
+ attrs.ref(instance);
106
+ }
107
+ //#endregion
108
+ instance['init']();
109
+ instance.rootElement = instance['render']();
110
+ //#region subscribe to observable attribute
111
+ for (let attribute of Object.values(attrs)) {
112
+ if (checkIfObservable(attribute)) {
113
+ attribute.eventOnChange.subscribe(() => {
114
+ //this.update()
115
+ instance.scheduleUpdate();
116
+ });
117
+ }
118
+ }
119
+ //#endregion
120
+ //requestAnimationFrame(() => {
121
+ instance['afterRender']();
122
+ //})
123
+ return instance.rootElement;
124
+ }
125
+ }
126
+ catch (error) {
127
+ console.error('error while creating DomeComponent class', error);
128
+ }
129
+ return;
130
+ }
131
+ if (DataTypes.isFunction(tagName)) {
132
+ // call functional component
133
+ return tagName(attrs, children);
134
+ }
135
+ else if (DataTypes.isString(tagName)) {
136
+ const el = createElement(tagName);
137
+ //console.log('lex-dome', 'creating element', el)
138
+ Object.keys(attrs).forEach(name => {
139
+ const value = attrs[name];
140
+ if (name === 'class' || name === 'className' || name === 'cssClasses') {
141
+ //DomeManipulator.setCssClasses(el, value)
142
+ assignDynamicCssClasses(name, value, el);
143
+ }
144
+ else if (name === 'style') {
145
+ setCSSProps(el, value);
146
+ }
147
+ else if (['disabled', 'autocomplete', 'selected', 'checked'].indexOf(name) >= 0) {
148
+ if (attrs[name]) {
149
+ DomeManipulator.setAttribute(el, name, name);
150
+ }
151
+ }
152
+ else if (name === 'onCreate' || name === 'ref') {
153
+ if (DataTypes.isFunction(value) == false)
154
+ throw new Error(`Please provide function <${tagName} ${name}={ref => myRef=ref} />`);
155
+ value(el);
156
+ // } else if(name === 'onEvent'){ //TODO: remove this!?
157
+ // // <div onEvent={{eventName:'myCumstomEvent', eventParams:{any:'params',can:'be',here:true}, eventReaction:()=>{}}}>some text for div</div>
158
+ // //#region is Object
159
+ // if(Data.isObjectWithKeys(value)){
160
+ // subscribeToEventByParam(value as OnEventObject, el)
161
+ // return
162
+ // }
163
+ // //#endregion
164
+ // //#region is Array
165
+ // if(Data.isArray(value)){
166
+ // for(let x of value){
167
+ // subscribeToEventByParam(x as OnEventObject, el)
168
+ // }
169
+ // }
170
+ // //#endregion
171
+ }
172
+ else if (name == 'visibleIf') { //TODO: remove this!?
173
+ if (checkIfObservable(value) == false) {
174
+ console.error('value=', value);
175
+ throw new Error('Please provide Observable<boolean> as argument for visibleIf');
176
+ }
177
+ let obs = value;
178
+ obs.eventOnChange.subscribe((isVisible) => {
179
+ if (isVisible) {
180
+ DomeManipulator.unhideElementAsync(el);
181
+ }
182
+ else {
183
+ DomeManipulator.hideElementAsync(el);
184
+ }
185
+ });
186
+ setTimeout(() => {
187
+ obs.eventOnChange.triggerAsync(obs.get());
188
+ }, 1);
189
+ }
190
+ else if (name.indexOf('on') === 0 && value) {
191
+ const eventName = name.slice(2).toLowerCase();
192
+ if (DataTypes.isFunction(value) == false) {
193
+ console.error('unable to subscribe for event', eventName, 'listener is not a function', 'element=', el, 'listener=', value);
194
+ return;
195
+ }
196
+ //console.log('adding event listener for', el, 'eventName=', eventName, 'value=', value)
197
+ el.addEventListener(eventName, value);
198
+ }
199
+ else if (name === 'innerHtml') {
200
+ el.innerHTML = value;
201
+ }
202
+ else if (name !== 'key' && value !== false) {
203
+ DomeManipulator.setAttribute(el, name, value === true ? '' : value);
204
+ }
205
+ });
206
+ if (!attrs.innerHtml) {
207
+ el.appendChild(children);
208
+ }
209
+ return el;
210
+ }
211
+ else
212
+ throw new Error("not implemented");
213
+ };
214
+ /**
215
+ *
216
+ * @param value
217
+ * @param name
218
+ * @param element
219
+ */
220
+ function assignDynamicCssClasses(name, value, element) {
221
+ if (DataTypes.isObjectWithKeys(value) == false) {
222
+ DomeManipulator.setCssClasses(element, value);
223
+ return;
224
+ //throw new Error(`Please provide object for ${name}, ex: {class1:true, class2:myVarO}`)
225
+ }
226
+ let resultArray = [];
227
+ for (let [k, v] of Object.entries(value)) {
228
+ if (v === undefined) {
229
+ //skip
230
+ }
231
+ else if (DataTypes.isBoolean(v)) {
232
+ if (v) {
233
+ resultArray.push(k);
234
+ }
235
+ }
236
+ else if (checkIfObservable(v)) {
237
+ let o = v;
238
+ o.eventOnChange.subscribe((showThiCssClass) => {
239
+ if (!DomeManipulator.isInDom(element))
240
+ return { unsubscribe: true }; //TODO: test it
241
+ // reassign whole attribute
242
+ DomeManipulator.setCssClasses(element, value);
243
+ });
244
+ if (o.get()) {
245
+ resultArray.push(k);
246
+ }
247
+ }
248
+ else {
249
+ console.error(`Please provide classNames as a keys and boolean or Observable<boolean> for values., ex: {class1:true, class2:myVarO}`, 'name=', name, 'value=', value, 'typeof value =', typeof value);
250
+ throw new Error('Wrong value for `class` attribute');
251
+ }
252
+ }
253
+ DomeManipulator.setCssClasses(element, resultArray); // yes, array of classes is ok here
254
+ }
255
+ export function h(tagName, attrs, ...childrenArgs) {
256
+ // eslint-disable-next-line prefer-rest-params
257
+ //const childrenArgs = [].slice.apply(arguments, [2])
258
+ const children = document.createDocumentFragment();
259
+ //const childArray:any[] = []
260
+ // console.log(filename, 'childrenArgs=', childrenArgs)
261
+ // console.log(filename, 'childrenO=', childrenO)
262
+ // if(tagName === 'hoho'){
263
+ // console.warn(filename, tagName, attrs, ...childrenArgs)
264
+ // }
265
+ flattenArray(childrenArgs).forEach(child => {
266
+ //(childrenArgs).forEach(child => {
267
+ // if(tagName === 'hoho'){
268
+ // console.warn(filename, 'child=', child)
269
+ // }
270
+ if (child instanceof Node) {
271
+ children.appendChild(child);
272
+ //childArray.push(child)
273
+ // const mountFunction = mountFunctionByNode.get(child)
274
+ // if(mountFunction){
275
+ // mountFunction(child)
276
+ // mountFunctionByNode.delete(child)// delete after execution
277
+ // }
278
+ }
279
+ else if (typeof child !== 'boolean' && typeof child !== 'undefined' && child !== null) {
280
+ //console.log('[Dome] child=', child)
281
+ //console.warn(filename, 'text? child=', child)
282
+ children.appendChild(document.createTextNode(child));
283
+ //childArray.push(document.createTextNode(child))
284
+ }
285
+ });
286
+ //return build(tagName, attrs || {}, children)
287
+ return build(tagName, attrs || {}, children);
288
+ }
289
+ // Improve TypeScript support for DocumentFragment
290
+ // https://github.com/Microsoft/TypeScript/issues/20469
291
+ export const React = {
292
+ createElement: h,
293
+ Fragment: typeof DocumentFragment === 'function' ? DocumentFragment : () => { }
294
+ };
295
+ export default React;
@@ -1,19 +1,19 @@
1
- import { Animation } from './Animation';
2
- interface InternalAttrs {
3
- ref?: (ref: any) => void;
4
- onShowAnimation?: Animation;
5
- onHideAnimation?: Animation;
6
- }
7
- export declare abstract class DomeComponent<Attrs> {
8
- attrs: Attrs & InternalAttrs;
9
- children: any;
10
- rootElement: Element | HTMLElement;
11
- constructor(attrs: Attrs & InternalAttrs, children: any);
12
- protected init(): void;
13
- protected abstract render(): HTMLElement;
14
- protected afterRender(): void;
15
- updateAsync(): Promise<void>;
16
- scheduleUpdate: (this: unknown) => void;
17
- protected afterUpdate(): void;
18
- }
19
- export {};
1
+ import { Animation } from './Animation';
2
+ interface InternalAttrs {
3
+ ref?: (ref: any) => void;
4
+ onShowAnimation?: Animation;
5
+ onHideAnimation?: Animation;
6
+ }
7
+ export declare abstract class DomeComponent<Attrs> {
8
+ attrs: Attrs & InternalAttrs;
9
+ children: any;
10
+ rootElement: Element | HTMLElement;
11
+ constructor(attrs: Attrs & InternalAttrs, children: any);
12
+ protected init(): void;
13
+ protected abstract render(): HTMLElement;
14
+ protected afterRender(): void;
15
+ updateAsync(): Promise<void>;
16
+ scheduleUpdate: (this: unknown) => void;
17
+ protected afterUpdate(): void;
18
+ }
19
+ export {};