@esportsplus/template 0.33.2 → 0.34.1
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/build/compiler/codegen.js +1 -1
- package/build/compiler/index.js +1 -1
- package/build/compiler/plugins/tsc.d.ts +1 -1
- package/build/compiler/plugins/tsc.js +1 -1
- package/build/compiler/plugins/vite.js +1 -1
- package/build/constants.js +1 -1
- package/build/utilities.js +4 -4
- package/package.json +3 -3
- package/src/compiler/codegen.ts +1 -1
- package/src/compiler/index.ts +1 -1
- package/src/compiler/plugins/tsc.ts +1 -1
- package/src/compiler/plugins/vite.ts +1 -1
- package/src/constants.ts +1 -1
- package/src/utilities.ts +6 -5
- package/tsconfig.json +1 -1
- package/build/compiler/plugins/index.d.ts +0 -2
- package/build/compiler/plugins/index.js +0 -2
- package/src/compiler/plugins/index.ts +0 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ts } from '@esportsplus/typescript';
|
|
2
|
-
import { ast, code as c, uid } from '@esportsplus/typescript/
|
|
2
|
+
import { ast, code as c, uid } from '@esportsplus/typescript/compiler';
|
|
3
3
|
import { analyzeExpression, generateAttributeBinding, generateSpreadBindings } from './type-analyzer.js';
|
|
4
4
|
import { COMPILER_ENTRYPOINT, COMPILER_NAMESPACE, COMPILER_TYPES, PACKAGE, PACKAGE_COMPILER } from '../constants.js';
|
|
5
5
|
import parser from './parser.js';
|
package/build/compiler/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { code as c } from '@esportsplus/typescript/
|
|
1
|
+
import { code as c } from '@esportsplus/typescript/compiler';
|
|
2
2
|
import { addImport, generateCode, generateReactiveInlining, needsArraySlotImport } from './codegen.js';
|
|
3
3
|
import { COMPILER_ENTRYPOINT, COMPILER_ENTRYPOINT_REACTIVITY } from '../constants.js';
|
|
4
4
|
import { findHtmlTemplates, findReactiveCalls } from './ts-parser.js';
|
package/build/constants.js
CHANGED
package/build/utilities.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { SLOT_HTML } from './constants.js';
|
|
2
|
-
let
|
|
2
|
+
let tmpl = document?.createElement('template'), txt = document?.createTextNode('');
|
|
3
3
|
const clone = typeof navigator !== 'undefined' && navigator.userAgent.includes('Firefox')
|
|
4
4
|
? document.importNode.bind(document)
|
|
5
5
|
: (node, deep = true) => node.cloneNode(deep);
|
|
6
6
|
const fragment = (html) => {
|
|
7
|
-
let element =
|
|
7
|
+
let element = tmpl.cloneNode();
|
|
8
8
|
element.innerHTML = html;
|
|
9
9
|
return element.content;
|
|
10
10
|
};
|
|
@@ -14,7 +14,7 @@ const template = (html) => {
|
|
|
14
14
|
let cached;
|
|
15
15
|
return () => {
|
|
16
16
|
if (!cached) {
|
|
17
|
-
let element =
|
|
17
|
+
let element = tmpl.cloneNode();
|
|
18
18
|
element.innerHTML = html;
|
|
19
19
|
cached = element.content;
|
|
20
20
|
}
|
|
@@ -22,7 +22,7 @@ const template = (html) => {
|
|
|
22
22
|
};
|
|
23
23
|
};
|
|
24
24
|
const text = (value) => {
|
|
25
|
-
let element =
|
|
25
|
+
let element = txt.cloneNode();
|
|
26
26
|
if (value !== '') {
|
|
27
27
|
element.nodeValue = value;
|
|
28
28
|
}
|
package/package.json
CHANGED
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
"author": "ICJR",
|
|
3
3
|
"dependencies": {
|
|
4
4
|
"@esportsplus/queue": "^0.2.0",
|
|
5
|
-
"@esportsplus/reactivity": "^0.
|
|
5
|
+
"@esportsplus/reactivity": "^0.26.0",
|
|
6
6
|
"@esportsplus/utilities": "^0.27.2",
|
|
7
7
|
"serve": "^14.2.5"
|
|
8
8
|
},
|
|
9
9
|
"devDependencies": {
|
|
10
|
-
"@esportsplus/typescript": "^0.
|
|
10
|
+
"@esportsplus/typescript": "^0.21.0",
|
|
11
11
|
"@types/node": "^25.0.3",
|
|
12
12
|
"vite": "^7.3.0",
|
|
13
13
|
"vite-tsconfig-paths": "^6.0.3"
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
},
|
|
42
42
|
"type": "module",
|
|
43
43
|
"types": "./build/index.d.ts",
|
|
44
|
-
"version": "0.
|
|
44
|
+
"version": "0.34.1",
|
|
45
45
|
"scripts": {
|
|
46
46
|
"build": "tsc",
|
|
47
47
|
"build:test": "vite build --config test/vite.config.ts",
|
package/src/compiler/codegen.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ts } from '@esportsplus/typescript';
|
|
2
|
-
import { ast, code as c, uid, type Replacement } from '@esportsplus/typescript/
|
|
2
|
+
import { ast, code as c, uid, type Replacement } from '@esportsplus/typescript/compiler';
|
|
3
3
|
import type { ReactiveCallInfo, TemplateInfo } from './ts-parser';
|
|
4
4
|
import { analyzeExpression, generateAttributeBinding, generateSpreadBindings } from './type-analyzer';
|
|
5
5
|
import {
|
package/src/compiler/index.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { code as c } from '@esportsplus/typescript/
|
|
1
|
+
import { code as c } from '@esportsplus/typescript/compiler';
|
|
2
2
|
import { addImport, generateCode, generateReactiveInlining, needsArraySlotImport } from './codegen';
|
|
3
3
|
import { COMPILER_ENTRYPOINT, COMPILER_ENTRYPOINT_REACTIVITY } from '../constants';
|
|
4
4
|
import { findHtmlTemplates, findReactiveCalls } from './ts-parser';
|
package/src/constants.ts
CHANGED
package/src/utilities.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { SLOT_HTML } from './constants';
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
let
|
|
5
|
-
|
|
4
|
+
let tmpl = document?.createElement('template'),
|
|
5
|
+
txt = document?.createTextNode('');
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
// Firefox's importNode outperforms cloneNode in certain scenarios
|
|
@@ -12,7 +12,7 @@ const clone = typeof navigator !== 'undefined' && navigator.userAgent.includes('
|
|
|
12
12
|
|
|
13
13
|
// Create a fragment from HTML string
|
|
14
14
|
const fragment = (html: string): DocumentFragment => {
|
|
15
|
-
let element =
|
|
15
|
+
let element = tmpl.cloneNode() as HTMLTemplateElement;
|
|
16
16
|
|
|
17
17
|
element.innerHTML = html;
|
|
18
18
|
|
|
@@ -29,7 +29,8 @@ const template = (html: string) => {
|
|
|
29
29
|
|
|
30
30
|
return () => {
|
|
31
31
|
if (!cached) {
|
|
32
|
-
let element =
|
|
32
|
+
let element = tmpl.cloneNode() as HTMLTemplateElement;
|
|
33
|
+
|
|
33
34
|
element.innerHTML = html;
|
|
34
35
|
cached = element.content;
|
|
35
36
|
}
|
|
@@ -39,7 +40,7 @@ const template = (html: string) => {
|
|
|
39
40
|
};
|
|
40
41
|
|
|
41
42
|
const text = (value: string) => {
|
|
42
|
-
let element =
|
|
43
|
+
let element = txt.cloneNode();
|
|
43
44
|
|
|
44
45
|
if (value !== '') {
|
|
45
46
|
element.nodeValue = value;
|
package/tsconfig.json
CHANGED