dom-render 1.0.96 → 1.0.98

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/DomRenderProxy.js CHANGED
@@ -104,7 +104,10 @@ var DomRenderProxy = /** @class */ (function () {
104
104
  };
105
105
  DomRenderProxy.prototype.initRender = function (target) {
106
106
  var _this = this;
107
- var _a, _b, _c, _d, _e;
107
+ var _a, _b, _c, _d;
108
+ if (target instanceof Element) {
109
+ target.innerHTML = target.innerHTML.replace(/@this@/g, 'this');
110
+ }
108
111
  var onCreate = (_b = (_a = target).getAttribute) === null || _b === void 0 ? void 0 : _b.call(_a, RawSet_1.RawSet.DR_ON_CREATE_ARGUMENTS_OPTIONNAME);
109
112
  var createParam = [];
110
113
  if (onCreate) {
@@ -114,7 +117,7 @@ var DomRenderProxy = /** @class */ (function () {
114
117
  }
115
118
  }
116
119
  (_d = (_c = this._domRender_proxy) === null || _c === void 0 ? void 0 : _c.onCreateRender) === null || _d === void 0 ? void 0 : _d.call.apply(_d, __spreadArray([_c], createParam, false));
117
- var innerHTML = (_e = target.innerHTML) !== null && _e !== void 0 ? _e : '';
120
+ // const innerHTML = (target as any).innerHTML ?? '';
118
121
  this._targets.add(target);
119
122
  var rawSets = RawSet_1.RawSet.checkPointCreates(target, this._domRender_proxy, this.config);
120
123
  // console.log('initRender -------rawSet', rawSets)
package/README.MD CHANGED
@@ -125,13 +125,13 @@ const data = DomRender.run(new Data(), document.querySelector('#app')!);
125
125
  ```html
126
126
  <h3>appender</h3>
127
127
  <ul>
128
- <li dr-appender="this.appender">
128
+ <li dr-appender="@this@.appender">
129
129
  ${#it#}$
130
130
  </li>
131
131
  </ul>
132
- <button dr-event-click="this.append()">appending</button>
133
- <button dr-event-click="this.modifyAppender(0)">idx 0 modify</button>
134
- <button dr-event-click="this.clearAppend()">appender clear</button>
132
+ <button dr-event-click="@this@.append()">appending</button>
133
+ <button dr-event-click="@this@.modifyAppender(0)">idx 0 modify</button>
134
+ <button dr-event-click="@this@.clearAppend()">appender clear</button>
135
135
  ```
136
136
 
137
137
  ```typescript
@@ -187,12 +187,12 @@ class Data {
187
187
  * ref: element
188
188
  * variable: $event, $target
189
189
  ```html
190
- click: <button dr-event-click="this.name = 'name' + new Date()">click</button> <br>
191
- change: <input type="text" dr-event-change="this.name = $target.value"> <br>
192
- input: <input type="text" dr-event-input="this.name = $target.value"> <br>
193
- keyup: <input type="text" dr-event-keyup="this.name = $target.value"> <br>
190
+ click: <button dr-event-click="@this@.name = 'name' + new Date()">click</button> <br>
191
+ change: <input type="text" dr-event-change="@this@.name = $target.value"> <br>
192
+ input: <input type="text" dr-event-input="@this@.name = $target.value"> <br>
193
+ keyup: <input type="text" dr-event-keyup="@this@.name = $target.value"> <br>
194
194
  ...
195
- keydown: <input type="text" dr-event-keydown="this.name = $target.value"><br>
195
+ keydown: <input type="text" dr-event-keydown="@this@.name = $target.value"><br>
196
196
  submit: <form dr-event-submit="console.log($event); $event.preventDefault();"><input type="text"> <button type="submit">submit</button></form><br>
197
197
  ```
198
198
  </details>
@@ -204,7 +204,7 @@ submit: <form dr-event-submit="console.log($event); $event.preventDefault();"><i
204
204
  * variable: $target
205
205
 
206
206
  ```html
207
- window-event-popstate: <input type="text" dr-window-event-popstate="alert(this.name)"><br>
207
+ window-event-popstate: <input type="text" dr-window-event-popstate="alert(@this@.name)"><br>
208
208
  ```
209
209
  </details>
210
210
 
@@ -222,6 +222,47 @@ window-event-popstate: <input type="text" dr-window-event-popstate="alert(this.n
222
222
  </details>
223
223
 
224
224
 
225
+ ## this
226
+ <details>
227
+ <summary>dr-this<strong>🔻(click)</strong></summary>
228
+ * dr-this
229
+ * object mapping
230
+
231
+ ```typescript
232
+ class data {
233
+ dictionary = {
234
+ name: 'visualkhh'
235
+ }
236
+ }
237
+ ```
238
+ ```html
239
+ <div dr-this="@this@.dictionary">
240
+ ${@this@.name}$
241
+ </div>
242
+ ```
243
+ </details>
244
+
245
+ <details>
246
+ <summary>dr-this-property<strong>🔻(click)</strong></summary>
247
+ * dr-property
248
+ * property forEach in object
249
+ * dynamic add, delete
250
+
251
+ ```typescript
252
+ class data {
253
+ dictionary = {
254
+ name1: 'visualkhh1',
255
+ name2: 'visualkhh2',
256
+ name3: 'visualkhh3'
257
+ }
258
+ }
259
+ ```
260
+ ```html
261
+ <home dr-this-property="@this@.dictionary" dr-on-init:arguments="[2,#this#]">
262
+ ${this}$
263
+ </home>
264
+ ```
265
+ </details>
225
266
 
226
267
  ## value
227
268
  <details>
@@ -233,8 +274,8 @@ window-event-popstate: <input type="text" dr-window-event-popstate="alert(this.n
233
274
  * Value and variable values are referencing each other. It affects each other when changing. (Immediate reflection event: input)
234
275
 
235
276
  ```html
236
- dr-value: <input type="text" dr-value="this.office.name"> <br>
237
- dr-value-link: <input type="text" dr-value-link="this.office.addr.street"> <br>
277
+ dr-value: <input type="text" dr-value="@this@.office.name"> <br>
278
+ dr-value-link: <input type="text" dr-value-link="@this@.office.addr.street"> <br>
238
279
  ```
239
280
  </details>
240
281
 
@@ -243,7 +284,7 @@ dr-value-link: <input type="text" dr-value-link="this.office.addr.street"> <br>
243
284
  <summary>dr-attr<strong>🔻(click)</strong></summary>
244
285
 
245
286
  ```html
246
- <textarea dr-attr="{rows: this.age/2, cols: this.age}"></textarea>
287
+ <textarea dr-attr="{rows: @this@.age/2, cols: @this@.age}"></textarea>
247
288
  <div dr-attr="{wow: '123', good: 123444}"></div>
248
289
  <div dr-attr="['wow=123', 'good=123444']"></div>
249
290
  <div dr-attr="'wow=123, good=123444'"></div>
@@ -254,8 +295,8 @@ dr-value-link: <input type="text" dr-value-link="this.office.addr.street"> <br>
254
295
  <summary>dr-class<strong>🔻(click)</strong></summary>
255
296
 
256
297
  ```html
257
- <div dr-class="{big: this.age > 50, red: this.age > 50}"></div>
258
- <div dr-class="'big yellow ' + (this.age > 50 ? 'old' : 'young')"></div>
298
+ <div dr-class="{big: @this@.age > 50, red: @this@.age > 50}"></div>
299
+ <div dr-class="'big yellow ' + (@this@.age > 50 ? 'old' : 'young')"></div>
259
300
  <div dr-class="['small', 'yellow']"></div>
260
301
  ```
261
302
  </details>
@@ -264,10 +305,10 @@ dr-value-link: <input type="text" dr-value-link="this.office.addr.street"> <br>
264
305
  <summary>dr-style<strong>🔻(click)</strong></summary>
265
306
 
266
307
  ```html
267
- <div dr-style="{fontSize: this.age + 'px'}"> style </div>
308
+ <div dr-style="{fontSize: @this@.age + 'px'}"> style </div>
268
309
  <div dr-style="{'font-size': '20px'}"> style</div>
269
- <div dr-style="'font-size: ' + this.age +'px; margin: ' + this.age + 'px'"> style </div>
270
- <div dr-style="['font-size: ' + this.age +'px', 'margin: ' + this.age + 'px']"> style </div>
310
+ <div dr-style="'font-size: ' + @this@.age +'px; margin: ' + @this@.age + 'px'"> style </div>
311
+ <div dr-style="['font-size: ' + @this@.age +'px', 'margin: ' + @this@.age + 'px']"> style </div>
271
312
  ```
272
313
  </details>
273
314
 
@@ -291,8 +332,8 @@ dr-value-link: <input type="text" dr-value-link="this.office.addr.street"> <br>
291
332
  <summary>dr-complete<strong>🔻(click)</strong></summary>
292
333
 
293
334
  ```html
294
- <select dr-value-link="this.currentContry" dr-event-change="this.contryChange($event)">
295
- <option dr-for-of="this.languages" dr-value="#it#.key" dr-complete="this.currentContry='defaultValue'">${#it#.title}$</option>
335
+ <select dr-value-link="@this@.currentContry" dr-event-change="@this@.contryChange($event)">
336
+ <option dr-for-of="@this@.languages" dr-value="#it#.key" dr-complete="@this@.currentContry='defaultValue'">${#it#.title}$</option>
296
337
  </select>
297
338
  ```
298
339
  </details>
@@ -307,7 +348,7 @@ dr-value-link: <input type="text" dr-value-link="this.office.addr.street"> <br>
307
348
 
308
349
  ```html
309
350
  <body id="app">
310
- <form dr-form="this.form" dr-event-submit="this.submit(); $event.preventDefault();">
351
+ <form dr-form="@this@.form" dr-event-submit="@this@.submit(); $event.preventDefault();">
311
352
  name: <input name="name">
312
353
  age: <input name="age">
313
354
  <button type="submit">submit</button>
@@ -332,7 +373,7 @@ dr-value-link: <input type="text" dr-value-link="this.office.addr.street"> <br>
332
373
 
333
374
  ```html
334
375
  <body id="app">
335
- <form dr-form="this.form" dr-event-submit="this.submit(); $event.preventDefault();">
376
+ <form dr-form="@this@.form" dr-event-submit="@this@.submit(); $event.preventDefault();">
336
377
  name: <input name="name">
337
378
  age: <input name="age">
338
379
  <button type="submit">submit</button>
@@ -416,7 +457,7 @@ const data = DomRender.run(new Data(), document.querySelector('#app')!, config);
416
457
  ```html
417
458
  <header>
418
459
  <h1>examples header</h1>
419
- <h2>${this.name}$</h2>
460
+ <h2>${@this@.name}$</h2>
420
461
  <div>
421
462
  <div><button dr-event-click="$router.go('/')">main</button></div>
422
463
  <div>
@@ -435,7 +476,7 @@ const data = DomRender.run(new Data(), document.querySelector('#app')!, config);
435
476
  <page-second dr-if="$router.testRegexp('/second/wow$')">wow</page-second>
436
477
  <page-detail url='/detail/{id:[0-9]+}' dr-if="$router.test($attribute.url)" dr-on-create:callback="$component.routerData($router.getRouteData($attribute.url))" ></page-detail>
437
478
  <div>
438
- <button dr-event-click="this.plusCount()">${this.count}$ count pluse++</button>
479
+ <button dr-event-click="@this@.plusCount()">${@this@.count}$ count pluse++</button>
439
480
  </div>
440
481
  </main>
441
482
  <hr>
@@ -636,29 +677,29 @@ const data = config.scripts.concat('head', 'tail')
636
677
  - [examples](./examples/component_script_attr) lazy load (html, css)
637
678
  ```html
638
679
  <body id="app">
639
- ${this.name}$
680
+ ${@this@.name}$
640
681
  <h1>component</h1>
641
682
  <profile dr-on-create:callback="$component.name='jhone'; $component.age=55;"><b>${#component#.details}$</b></profile>
642
683
  <profile dr-on-create:callback="$component.name='cal'; $component.age=56;"><b>detail-2</b></profile>
643
684
  <profile dr-on-create:callback="$component.name='rose'; $component.age=57;">
644
685
  <profile dr-on-create:callback="$component.name='rose-sub'; $component.age=156;">
645
- <b>${this.name}$</b>
686
+ <b>${@this@.name}$</b>
646
687
  </profile>
647
688
  </profile>
648
689
  <h3>component data link and detect</h3>
649
- <Profile dr-if="this.toggle" dr-detect="$component.age = this.age" dr-on-create:callback="$component.name='papa'; $component.age=58;">
650
- <b>${this.name}$</b>
690
+ <Profile dr-if="@this@.toggle" dr-detect="$component.age = @this@.age" dr-on-create:callback="$component.name='papa'; $component.age=58;">
691
+ <b>${@this@.name}$</b>
651
692
  </Profile>
652
- <Profile dr-if="this.toggle" dr-detect="$component.age = this.age" dr-on-constructor:arguments="[1,2]">
653
- <b>${this.name}$</b>
693
+ <Profile dr-if="@this@.toggle" dr-detect="$component.age = @this@.age" dr-on-constructor:arguments="[1,2]">
694
+ <b>${@this@.name}$</b>
654
695
  </Profile>
655
696
 
656
- <button dr-event-click="this.name = new Date().toString();">change name</button>
657
- <button dr-event-click="this.age = Date.now();">change age</button>
658
- <button dr-event-click="this.toggle = !this.toggle;">change toggle</button>
697
+ <button dr-event-click="@this@.name = new Date().toString();">change name</button>
698
+ <button dr-event-click="@this@.age = Date.now();">change age</button>
699
+ <button dr-event-click="@this@.toggle = !@this@.toggle;">change toggle</button>
659
700
 
660
701
  <j1>component constructor, on-create, dr-on-create:callback</j1>
661
- <home dr-constructor="[this.name, this.age, 'home welcom']" dr-on-create-arguments="{type: 'onCreate', data: 'datadata'}" dr-on-create:callback="$component.onInit('data')"></home>
702
+ <home dr-constructor="[@this@.name, @this@.age, 'home welcom']" dr-on-create-arguments="{type: 'onCreate', data: 'datadata'}" dr-on-create:callback="$component.onInit('data')"></home>
662
703
 
663
704
 
664
705
 
@@ -668,7 +709,7 @@ ${this.name}$
668
709
  </div>
669
710
 
670
711
  <h1>attr</h1>
671
- <button link="this.link">
712
+ <button link="@this@.link">
672
713
  link attribute
673
714
  </button>
674
715
  <h1>attrCallBack</h1>
@@ -717,7 +758,7 @@ using component
717
758
  ```html
718
759
  <my-element dr-on-create:callback="$component.say();"></my-element>
719
760
 
720
- <home value="${this.name}$" wow="${this.color}$">
761
+ <home value="${@this@.name}$" wow="${@this@.color}$">
721
762
  ${#component#.homeName}$
722
763
  <home value="${#component#.homeName}$" wow="${#component#.homeColor}$" dr-component-name="sub_component" dr-component-inner-html-name="innerHTML">
723
764
  ${#sub_component#.homeName}$
@@ -0,0 +1 @@
1
+ export default function _default(css: any, options: any): any;