ember-source 7.0.0-beta.1 → 7.1.0-alpha.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/build-metadata.json +3 -3
- package/dist/dev/packages/@ember/-internals/glimmer/index.js +7 -7
- package/dist/dev/packages/@ember/application/index.js +5 -5
- package/dist/dev/packages/@ember/application/instance.js +4 -4
- package/dist/dev/packages/@ember/component/helper.js +4 -4
- package/dist/dev/packages/@ember/component/index.js +4 -4
- package/dist/dev/packages/@ember/component/template-only.js +2 -2
- package/dist/dev/packages/@ember/engine/index.js +5 -5
- package/dist/dev/packages/@ember/helper/index.js +24 -6
- package/dist/dev/packages/@ember/modifier/index.js +4 -4
- package/dist/dev/packages/@ember/modifier/on.js +2 -2
- package/dist/dev/packages/@ember/renderer/index.js +4 -4
- package/dist/dev/packages/@ember/routing/index.js +4 -4
- package/dist/dev/packages/@ember/template/index.js +4 -4
- package/dist/dev/packages/@ember/template-compiler/lib/compile-options.js +48 -6
- package/dist/dev/packages/@ember/template-compiler/lib/plugins/auto-import-builtins.js +57 -0
- package/dist/dev/packages/@ember/template-compiler/lib/plugins/index.js +3 -1
- package/dist/dev/packages/@ember/template-compiler/lib/template.js +29 -13
- package/dist/dev/packages/@ember/template-factory/index.js +1 -1
- package/dist/dev/packages/@glimmer/node/index.js +4 -4
- package/dist/dev/packages/@glimmer/opcode-compiler/index.js +2 -2
- package/dist/dev/packages/@glimmer/program/index.js +1 -1
- package/dist/dev/packages/@glimmer/runtime/index.js +5 -5
- package/dist/dev/packages/ember/version.js +1 -1
- package/dist/dev/packages/ember-template-compiler/index.js +2 -2
- package/dist/dev/packages/shared-chunks/{compiler-CNj62pww.js → compiler-BenCxenr.js} +0 -3
- package/dist/dev/packages/shared-chunks/{constants-eoaL3OJQ.js → constants-DKn6zqFX.js} +1 -1
- package/dist/dev/packages/shared-chunks/{dynamic-CFg3dljk.js → dynamic-Cu9Xpdzc.js} +2 -18
- package/dist/dev/packages/shared-chunks/{element-builder-BOxP8emt.js → element-builder-Dw_Ic9cD.js} +1 -1
- package/dist/dev/packages/shared-chunks/{index-PxU6E7q8.js → index-AD_RxZjB.js} +117 -21
- package/dist/dev/packages/shared-chunks/{index-Q7JnrdBn.js → index-CtPSmMCE.js} +2 -2
- package/dist/dev/packages/shared-chunks/{invoke-DxRPE05O.js → invoke-D0D6CvD5.js} +1 -1
- package/dist/dev/packages/shared-chunks/{program-context-BRjCC_BA.js → program-context-yOi1EExe.js} +1 -1
- package/dist/dev/packages/shared-chunks/{rehydrate-builder-DPImr9e9.js → rehydrate-builder-CfBtYUkk.js} +2 -2
- package/dist/dev/packages/shared-chunks/{render-sg8BuFaE.js → render-t-LAXUYI.js} +3 -3
- package/dist/dev/packages/shared-chunks/{serialize-builder-b_gSYCSS.js → serialize-builder-BUG9CxHC.js} +3 -3
- package/dist/dev/packages/shared-chunks/{setup-registry-DGdDOxrk.js → setup-registry-CxXWLs26.js} +6 -6
- package/dist/prod/packages/@ember/-internals/glimmer/index.js +7 -7
- package/dist/prod/packages/@ember/application/index.js +5 -5
- package/dist/prod/packages/@ember/application/instance.js +4 -4
- package/dist/prod/packages/@ember/component/helper.js +4 -4
- package/dist/prod/packages/@ember/component/index.js +4 -4
- package/dist/prod/packages/@ember/component/template-only.js +2 -2
- package/dist/prod/packages/@ember/engine/index.js +5 -5
- package/dist/prod/packages/@ember/helper/index.js +24 -6
- package/dist/prod/packages/@ember/modifier/index.js +4 -4
- package/dist/prod/packages/@ember/modifier/on.js +2 -2
- package/dist/prod/packages/@ember/renderer/index.js +4 -4
- package/dist/prod/packages/@ember/routing/index.js +4 -4
- package/dist/prod/packages/@ember/template/index.js +4 -4
- package/dist/prod/packages/@ember/template-compiler/lib/compile-options.js +45 -6
- package/dist/prod/packages/@ember/template-compiler/lib/plugins/auto-import-builtins.js +57 -0
- package/dist/prod/packages/@ember/template-compiler/lib/plugins/index.js +3 -1
- package/dist/prod/packages/@ember/template-compiler/lib/template.js +29 -13
- package/dist/prod/packages/@ember/template-factory/index.js +1 -1
- package/dist/prod/packages/@glimmer/node/index.js +4 -4
- package/dist/prod/packages/@glimmer/opcode-compiler/index.js +2 -2
- package/dist/prod/packages/@glimmer/program/index.js +1 -1
- package/dist/prod/packages/@glimmer/runtime/index.js +5 -5
- package/dist/prod/packages/ember/version.js +1 -1
- package/dist/prod/packages/ember-template-compiler/index.js +2 -2
- package/dist/prod/packages/shared-chunks/{compiler-Ddfo5StE.js → compiler-Rwrmj1ki.js} +0 -3
- package/dist/prod/packages/shared-chunks/{constants-b-2IVErl.js → constants-CB3pk7dH.js} +1 -1
- package/dist/prod/packages/shared-chunks/{element-builder-CiLTrXD6.js → element-builder-DbktcGKV.js} +1 -1
- package/dist/prod/packages/shared-chunks/{index-DZLHQAlb.js → index-BVy-auLZ.js} +110 -21
- package/dist/prod/packages/shared-chunks/{index-CSVCFS_p.js → index-nW__r2nX.js} +2 -2
- package/dist/prod/packages/shared-chunks/{invoke-DxL00a1D.js → invoke-BuwCkcVB.js} +1 -1
- package/dist/prod/packages/shared-chunks/{on-CrTl7JQU.js → on-ByzWKBWe.js} +2 -18
- package/dist/prod/packages/shared-chunks/{program-context-C-JdYXRA.js → program-context-BdUXf-jj.js} +1 -1
- package/dist/prod/packages/shared-chunks/{rehydrate-builder-CSn1aIO1.js → rehydrate-builder-M_dh82nR.js} +2 -2
- package/dist/prod/packages/shared-chunks/{render-C1ZnScKH.js → render-DJ-BzvgU.js} +3 -3
- package/dist/prod/packages/shared-chunks/{serialize-builder-CVQ3q8rJ.js → serialize-builder-BpVMgrCr.js} +3 -3
- package/dist/prod/packages/shared-chunks/{setup-registry-CMNYh2jY.js → setup-registry-KYxkFexK.js} +6 -6
- package/docs/data.json +154 -51
- package/package.json +7 -6
- package/types/stable/@ember/-internals/glimmer/index.d.ts +1 -0
- package/types/stable/@ember/-internals/glimmer/lib/component-managers/mount.d.ts +1 -1
- package/types/stable/@ember/-internals/glimmer/lib/component-managers/route-template.d.ts +1 -2
- package/types/stable/@ember/-internals/glimmer/lib/helpers/element.d.ts +29 -0
- package/types/stable/@ember/helper/index.d.ts +20 -0
- package/types/stable/@ember/template-compiler/lib/compile-options.d.ts +8 -0
- package/types/stable/@ember/template-compiler/lib/plugins/auto-import-builtins.d.ts +14 -0
- package/types/stable/@ember/template-compiler/lib/plugins/index.d.ts +3 -1
- package/types/stable/@ember/template-compiler/lib/types.d.ts +22 -3
- package/types/stable/@glimmer/global-context/index.d.ts +0 -3
- package/types/stable/@glimmer/interfaces/lib/compile/wire-format/api.d.ts +0 -1
- package/types/stable/@glimmer/interfaces/lib/managers/internal/component.d.ts +1 -2
- package/types/stable/@glimmer/interfaces/lib/runtime/debug-render-tree.d.ts +0 -2
- package/types/stable/@glimmer/runtime/lib/debug-render-tree.d.ts +0 -1
- package/types/stable/@glimmer/syntax/lib/parser/tokenizer-event-handlers.d.ts +0 -7
- package/types/stable/ember-template-compiler/lib/plugins/auto-import-builtins.d.ts +5 -0
- package/types/stable/index.d.ts +3 -0
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import '../../shared-chunks/fragment-EpVz5Xuc.js';
|
|
2
2
|
import '../../@glimmer/validator/index.js';
|
|
3
3
|
import '../../shared-chunks/reference-BNqcwZWH.js';
|
|
4
|
-
import '../../shared-chunks/index-
|
|
4
|
+
import '../../shared-chunks/index-nW__r2nX.js';
|
|
5
5
|
import '../../shared-chunks/capabilities-DGmQ_mz4.js';
|
|
6
|
-
export { f as renderComponent, r as renderSettled } from '../../shared-chunks/index-
|
|
6
|
+
export { f as renderComponent, r as renderSettled } from '../../shared-chunks/index-BVy-auLZ.js';
|
|
7
7
|
import '../-internals/container/index.js';
|
|
8
8
|
import '../../shared-chunks/super-Cm_a_cLQ.js';
|
|
9
9
|
import '../-internals/environment/index.js';
|
|
10
|
-
import '../../shared-chunks/on-
|
|
11
|
-
import '../../shared-chunks/constants-
|
|
10
|
+
import '../../shared-chunks/on-ByzWKBWe.js';
|
|
11
|
+
import '../../shared-chunks/constants-CB3pk7dH.js';
|
|
12
12
|
import '../runloop/index.js';
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import '../../shared-chunks/fragment-EpVz5Xuc.js';
|
|
2
2
|
import '../../@glimmer/validator/index.js';
|
|
3
3
|
import '../../shared-chunks/reference-BNqcwZWH.js';
|
|
4
|
-
import '../../shared-chunks/index-
|
|
4
|
+
import '../../shared-chunks/index-nW__r2nX.js';
|
|
5
5
|
import '../../shared-chunks/capabilities-DGmQ_mz4.js';
|
|
6
|
-
export { L as LinkTo } from '../../shared-chunks/index-
|
|
6
|
+
export { L as LinkTo } from '../../shared-chunks/index-BVy-auLZ.js';
|
|
7
7
|
import '../-internals/container/index.js';
|
|
8
8
|
import '../../shared-chunks/super-Cm_a_cLQ.js';
|
|
9
9
|
import '../-internals/environment/index.js';
|
|
10
|
-
import '../../shared-chunks/on-
|
|
11
|
-
import '../../shared-chunks/constants-
|
|
10
|
+
import '../../shared-chunks/on-ByzWKBWe.js';
|
|
11
|
+
import '../../shared-chunks/constants-CB3pk7dH.js';
|
|
12
12
|
import '../runloop/index.js';
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import '../../shared-chunks/fragment-EpVz5Xuc.js';
|
|
2
2
|
import '../../@glimmer/validator/index.js';
|
|
3
3
|
import '../../shared-chunks/reference-BNqcwZWH.js';
|
|
4
|
-
import '../../shared-chunks/index-
|
|
4
|
+
import '../../shared-chunks/index-nW__r2nX.js';
|
|
5
5
|
import '../../shared-chunks/capabilities-DGmQ_mz4.js';
|
|
6
|
-
export { d as htmlSafe, i as isHTMLSafe, e as isTrustedHTML, t as trustHTML } from '../../shared-chunks/index-
|
|
6
|
+
export { d as htmlSafe, i as isHTMLSafe, e as isTrustedHTML, t as trustHTML } from '../../shared-chunks/index-BVy-auLZ.js';
|
|
7
7
|
import '../-internals/container/index.js';
|
|
8
8
|
import '../../shared-chunks/super-Cm_a_cLQ.js';
|
|
9
9
|
import '../-internals/environment/index.js';
|
|
10
|
-
import '../../shared-chunks/on-
|
|
11
|
-
import '../../shared-chunks/constants-
|
|
10
|
+
import '../../shared-chunks/on-ByzWKBWe.js';
|
|
11
|
+
import '../../shared-chunks/constants-CB3pk7dH.js';
|
|
12
12
|
import '../runloop/index.js';
|
|
@@ -1,13 +1,37 @@
|
|
|
1
|
+
import { fn } from '../../helper/index.js';
|
|
2
|
+
import '../../../@glimmer/validator/index.js';
|
|
3
|
+
import '../../../shared-chunks/reference-BNqcwZWH.js';
|
|
4
|
+
import '../../../shared-chunks/capabilities-DGmQ_mz4.js';
|
|
5
|
+
import { on } from '../../modifier/on.js';
|
|
6
|
+
import '../../../shared-chunks/fragment-EpVz5Xuc.js';
|
|
7
|
+
import '../../../shared-chunks/index-nW__r2nX.js';
|
|
8
|
+
import '../../../shared-chunks/index-BVy-auLZ.js';
|
|
9
|
+
import '../../-internals/container/index.js';
|
|
10
|
+
import '../../../shared-chunks/super-Cm_a_cLQ.js';
|
|
1
11
|
import '../../-internals/environment/index.js';
|
|
12
|
+
import '../../../shared-chunks/on-ByzWKBWe.js';
|
|
13
|
+
import '../../../shared-chunks/constants-CB3pk7dH.js';
|
|
14
|
+
import '../../runloop/index.js';
|
|
2
15
|
import { STRICT_MODE_KEYWORDS, STRICT_MODE_TRANSFORMS, RESOLUTION_MODE_TRANSFORMS } from './plugins/index.js';
|
|
3
16
|
import { ALLOWED_GLOBALS } from './plugins/allowed-globals.js';
|
|
4
17
|
import COMPONENT_NAME_SIMPLE_DASHERIZE_CACHE from './dasherize-component-name.js';
|
|
5
18
|
|
|
6
19
|
let USER_PLUGINS = [];
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* The variable name used to inject the keywords object into the
|
|
23
|
+
* template's evaluation scope. auto-import-builtins rewrites bare
|
|
24
|
+
* keyword references (e.g. `on`) to property accesses on this
|
|
25
|
+
* variable (e.g. `__ember_keywords__.on`).
|
|
26
|
+
*/
|
|
27
|
+
const RUNTIME_KEYWORDS_NAME = '__ember_keywords__';
|
|
28
|
+
const keywords = {
|
|
29
|
+
fn,
|
|
30
|
+
on
|
|
31
|
+
};
|
|
7
32
|
function buildCompileOptions(_options) {
|
|
8
33
|
let moduleName = _options.moduleName;
|
|
9
34
|
let options = {
|
|
10
|
-
meta: {},
|
|
11
35
|
isProduction: false,
|
|
12
36
|
plugins: {
|
|
13
37
|
ast: []
|
|
@@ -18,10 +42,21 @@ function buildCompileOptions(_options) {
|
|
|
18
42
|
return COMPONENT_NAME_SIMPLE_DASHERIZE_CACHE.get(tagname);
|
|
19
43
|
}
|
|
20
44
|
};
|
|
21
|
-
|
|
45
|
+
options.meta ||= {};
|
|
46
|
+
options.meta.emberRuntime ||= {
|
|
47
|
+
lookupKeyword(name) {
|
|
48
|
+
return `${RUNTIME_KEYWORDS_NAME}.${name}`;
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
if ('eval' in options && options.eval) {
|
|
22
52
|
const localScopeEvaluator = options.eval;
|
|
23
53
|
const globalScopeEvaluator = value => new Function(`return ${value};`)();
|
|
24
54
|
options.lexicalScope = variable => {
|
|
55
|
+
// The keywords container variable is always "in scope" —
|
|
56
|
+
// we inject it via the evaluator in template.ts.
|
|
57
|
+
if (variable === RUNTIME_KEYWORDS_NAME) {
|
|
58
|
+
return true;
|
|
59
|
+
}
|
|
25
60
|
if (ALLOWED_GLOBALS.has(variable)) {
|
|
26
61
|
return variable in globalThis;
|
|
27
62
|
}
|
|
@@ -34,11 +69,15 @@ function buildCompileOptions(_options) {
|
|
|
34
69
|
}
|
|
35
70
|
if ('scope' in options) {
|
|
36
71
|
const scope = options.scope();
|
|
37
|
-
options.lexicalScope = variable =>
|
|
38
|
-
return variable in scope;
|
|
39
|
-
};
|
|
72
|
+
options.lexicalScope = variable => variable in scope || variable === RUNTIME_KEYWORDS_NAME;
|
|
40
73
|
delete options.scope;
|
|
41
74
|
}
|
|
75
|
+
|
|
76
|
+
// When neither eval nor scope is provided, the keywords container
|
|
77
|
+
// still needs to be visible to the compiler.
|
|
78
|
+
if (!options.lexicalScope) {
|
|
79
|
+
options.lexicalScope = variable => variable === RUNTIME_KEYWORDS_NAME;
|
|
80
|
+
}
|
|
42
81
|
if ('locals' in options && !options.locals) {
|
|
43
82
|
// Glimmer's precompile options declare `locals` like:
|
|
44
83
|
// locals?: string[]
|
|
@@ -100,4 +139,4 @@ function inScope(variable, evaluator) {
|
|
|
100
139
|
}
|
|
101
140
|
}
|
|
102
141
|
|
|
103
|
-
export { compileOptions as default };
|
|
142
|
+
export { RUNTIME_KEYWORDS_NAME, compileOptions as default, keywords };
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { trackLocals, isPath } from './utils.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
@module ember
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
A Glimmer2 AST transformation that makes importable keywords work
|
|
9
|
+
|
|
10
|
+
@private
|
|
11
|
+
@class TransformActionSyntax
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
function autoImportBuiltins(env) {
|
|
15
|
+
let {
|
|
16
|
+
hasLocal,
|
|
17
|
+
visitor
|
|
18
|
+
} = trackLocals(env);
|
|
19
|
+
return {
|
|
20
|
+
name: 'auto-import-built-ins',
|
|
21
|
+
visitor: {
|
|
22
|
+
...visitor,
|
|
23
|
+
ElementModifierStatement(node) {
|
|
24
|
+
if (isOn(node, hasLocal)) {
|
|
25
|
+
rewriteKeyword(env, node, 'on', '@ember/modifier');
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
SubExpression(node) {
|
|
29
|
+
if (isFn(node, hasLocal)) {
|
|
30
|
+
rewriteKeyword(env, node, 'fn', '@ember/helper');
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
MustacheStatement(node) {
|
|
34
|
+
if (isFn(node, hasLocal)) {
|
|
35
|
+
rewriteKeyword(env, node, 'fn', '@ember/helper');
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
function rewriteKeyword(env, node, name, moduleSpecifier) {
|
|
42
|
+
if (env.meta?.jsutils) {
|
|
43
|
+
node.path.original = env.meta.jsutils.bindImport(moduleSpecifier, name, node, {
|
|
44
|
+
name
|
|
45
|
+
});
|
|
46
|
+
} else if (env.meta?.emberRuntime) {
|
|
47
|
+
node.path.original = env.meta.emberRuntime.lookupKeyword(name);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
function isOn(node, hasLocal) {
|
|
51
|
+
return isPath(node.path) && node.path.original === 'on' && !hasLocal('on');
|
|
52
|
+
}
|
|
53
|
+
function isFn(node, hasLocal) {
|
|
54
|
+
return isPath(node.path) && node.path.original === 'fn' && !hasLocal('fn');
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export { autoImportBuiltins as default };
|
|
@@ -9,8 +9,10 @@ import transformInElement from './transform-in-element.js';
|
|
|
9
9
|
import transformQuotedBindingsIntoJustBindings from './transform-quoted-bindings-into-just-bindings.js';
|
|
10
10
|
import { Z as transformResolutions } from '../../../../shared-chunks/transform-resolutions-C7wq_Q_c.js';
|
|
11
11
|
import transformWrapMountAndOutlet from './transform-wrap-mount-and-outlet.js';
|
|
12
|
+
import autoImportBuiltins from './auto-import-builtins.js';
|
|
12
13
|
|
|
13
14
|
const INTERNAL_PLUGINS = {
|
|
15
|
+
AutoImportBuiltins: autoImportBuiltins,
|
|
14
16
|
AssertAgainstAttrs: assertAgainstAttrs,
|
|
15
17
|
AssertAgainstNamedOutlets: assertAgainstNamedOutlets,
|
|
16
18
|
AssertInputHelperWithoutBlock: errorOnInputWithContent,
|
|
@@ -26,7 +28,7 @@ const INTERNAL_PLUGINS = {
|
|
|
26
28
|
|
|
27
29
|
// order of plugins is important
|
|
28
30
|
const RESOLUTION_MODE_TRANSFORMS = Object.freeze([transformQuotedBindingsIntoJustBindings, assertReservedNamedArguments, transformActionSyntax, assertAgainstAttrs, transformEachInIntoEach, errorOnInputWithContent, transformInElement, transformEachTrackArray, assertAgainstNamedOutlets, transformWrapMountAndOutlet, transformResolutions]);
|
|
29
|
-
const STRICT_MODE_TRANSFORMS = Object.freeze([transformQuotedBindingsIntoJustBindings, assertReservedNamedArguments, transformActionSyntax, transformEachInIntoEach, transformInElement, transformEachTrackArray, assertAgainstNamedOutlets, transformWrapMountAndOutlet]);
|
|
31
|
+
const STRICT_MODE_TRANSFORMS = Object.freeze([autoImportBuiltins, transformQuotedBindingsIntoJustBindings, assertReservedNamedArguments, transformActionSyntax, transformEachInIntoEach, transformInElement, transformEachTrackArray, assertAgainstNamedOutlets, transformWrapMountAndOutlet]);
|
|
30
32
|
const STRICT_MODE_KEYWORDS = Object.freeze(['action', 'mut', 'readonly', 'unbound',
|
|
31
33
|
// TransformEachInIntoEach
|
|
32
34
|
'-each-in',
|
|
@@ -2,13 +2,13 @@ import './plugins/allowed-globals.js';
|
|
|
2
2
|
import templateOnly from '../../component/template-only.js';
|
|
3
3
|
import '../../../shared-chunks/fragment-EpVz5Xuc.js';
|
|
4
4
|
import '../../../@glimmer/wire-format/index.js';
|
|
5
|
-
import { p as precompile } from '../../../shared-chunks/compiler-
|
|
5
|
+
import { p as precompile } from '../../../shared-chunks/compiler-Rwrmj1ki.js';
|
|
6
6
|
import '../../../@glimmer/validator/index.js';
|
|
7
7
|
import '../../../shared-chunks/reference-BNqcwZWH.js';
|
|
8
8
|
import '../../../shared-chunks/capabilities-DGmQ_mz4.js';
|
|
9
9
|
import { s as setComponentTemplate } from '../../../shared-chunks/template-Dc_cBOoX.js';
|
|
10
|
-
import { t as templateFactory } from '../../../shared-chunks/index-
|
|
11
|
-
import compileOptions from './compile-options.js';
|
|
10
|
+
import { t as templateFactory } from '../../../shared-chunks/index-nW__r2nX.js';
|
|
11
|
+
import compileOptions, { RUNTIME_KEYWORDS_NAME, keywords } from './compile-options.js';
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
14
|
* All possible options passed to `template()` may specify a `moduleName`.
|
|
@@ -206,24 +206,40 @@ function template(templateString, providedOptions) {
|
|
|
206
206
|
const normalizedOptions = compileOptions(options);
|
|
207
207
|
const component = normalizedOptions.component ?? templateOnly();
|
|
208
208
|
const source = precompile(templateString, normalizedOptions);
|
|
209
|
-
const
|
|
209
|
+
const wire = evaluate(`(${source})`);
|
|
210
|
+
const template = templateFactory(wire);
|
|
210
211
|
setComponentTemplate(template, component);
|
|
211
212
|
return component;
|
|
212
213
|
}
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
214
|
+
|
|
215
|
+
/**
|
|
216
|
+
* Builds the source wireformat JSON block
|
|
217
|
+
*
|
|
218
|
+
* @param options
|
|
219
|
+
* @returns
|
|
220
|
+
*/
|
|
216
221
|
function buildEvaluator(options) {
|
|
217
|
-
if (options === undefined) {
|
|
218
|
-
return evaluator;
|
|
219
|
-
}
|
|
220
222
|
if (options.eval) {
|
|
221
|
-
|
|
223
|
+
const userEval = options.eval;
|
|
224
|
+
|
|
225
|
+
// Wrap the compiled source in a function that receives the keywords
|
|
226
|
+
// container as a parameter. The user's eval evaluates this in the
|
|
227
|
+
// caller's scope, so local variables (like `handleClick`) are captured
|
|
228
|
+
// via closure, while `__keywords__` comes from the function parameter.
|
|
229
|
+
return source => {
|
|
230
|
+
let wrapperFn = userEval(`(function(${RUNTIME_KEYWORDS_NAME}){ return (${source}); })`);
|
|
231
|
+
return wrapperFn(keywords);
|
|
232
|
+
};
|
|
222
233
|
} else {
|
|
223
|
-
|
|
234
|
+
let scope = options.scope?.();
|
|
224
235
|
if (!scope) {
|
|
225
|
-
return
|
|
236
|
+
return source => {
|
|
237
|
+
return new Function(RUNTIME_KEYWORDS_NAME, `return (${source})`)(keywords);
|
|
238
|
+
};
|
|
226
239
|
}
|
|
240
|
+
scope = Object.assign({
|
|
241
|
+
[RUNTIME_KEYWORDS_NAME]: keywords
|
|
242
|
+
}, scope);
|
|
227
243
|
return source => {
|
|
228
244
|
let hasThis = Object.prototype.hasOwnProperty.call(scope, 'this');
|
|
229
245
|
let thisValue = hasThis ? scope.this : undefined;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import '../../shared-chunks/fragment-EpVz5Xuc.js';
|
|
2
2
|
import '../../@glimmer/validator/index.js';
|
|
3
3
|
import '../../shared-chunks/reference-BNqcwZWH.js';
|
|
4
|
-
export { t as createTemplateFactory } from '../../shared-chunks/index-
|
|
4
|
+
export { t as createTemplateFactory } from '../../shared-chunks/index-nW__r2nX.js';
|
|
5
5
|
import '../../shared-chunks/capabilities-DGmQ_mz4.js';
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import '../../shared-chunks/fragment-EpVz5Xuc.js';
|
|
2
2
|
import '../validator/index.js';
|
|
3
3
|
import '../../shared-chunks/reference-BNqcwZWH.js';
|
|
4
|
-
import { C as ConcreteBounds } from '../../shared-chunks/on-
|
|
5
|
-
import '../../shared-chunks/constants-
|
|
4
|
+
import { C as ConcreteBounds } from '../../shared-chunks/on-ByzWKBWe.js';
|
|
5
|
+
import '../../shared-chunks/constants-CB3pk7dH.js';
|
|
6
6
|
import '../../shared-chunks/capabilities-DGmQ_mz4.js';
|
|
7
7
|
import createHTMLDocument from '../../@simple-dom/document/index.js';
|
|
8
|
-
import { D as DOMTreeConstruction } from '../../shared-chunks/element-builder-
|
|
9
|
-
export { s as serializeBuilder } from '../../shared-chunks/serialize-builder-
|
|
8
|
+
import { D as DOMTreeConstruction } from '../../shared-chunks/element-builder-DbktcGKV.js';
|
|
9
|
+
export { s as serializeBuilder } from '../../shared-chunks/serialize-builder-BpVMgrCr.js';
|
|
10
10
|
|
|
11
11
|
class NodeDOMTreeConstruction extends DOMTreeConstruction {
|
|
12
12
|
// Hides property on base class
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export { E as EMPTY_BLOCKS, W as WrappedBuilder, c as compilable, b as compileStatements, I as invokeStaticBlock, d as invokeStaticBlockWithStack, m as meta, a as templateCacheCounters, e as templateCompilationContext, t as templateFactory } from '../../shared-chunks/index-
|
|
1
|
+
export { E as EMPTY_BLOCKS, W as WrappedBuilder, c as compilable, b as compileStatements, I as invokeStaticBlock, d as invokeStaticBlockWithStack, m as meta, a as templateCacheCounters, e as templateCompilationContext, t as templateFactory } from '../../shared-chunks/index-nW__r2nX.js';
|
|
2
2
|
import '../../shared-chunks/fragment-EpVz5Xuc.js';
|
|
3
3
|
import '../validator/index.js';
|
|
4
4
|
import '../../shared-chunks/reference-BNqcwZWH.js';
|
|
5
|
-
export { E as EvaluationContextImpl, S as StdLib, c as compileStd } from '../../shared-chunks/program-context-
|
|
5
|
+
export { E as EvaluationContextImpl, S as StdLib, c as compileStd } from '../../shared-chunks/program-context-BdUXf-jj.js';
|
|
6
6
|
|
|
7
7
|
let debugCompiler;
|
|
8
8
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as ConstantsImpl } from '../../shared-chunks/constants-
|
|
1
|
+
import { C as ConstantsImpl } from '../../shared-chunks/constants-CB3pk7dH.js';
|
|
2
2
|
import { a as ProgramHeapImpl } from '../../shared-chunks/program-B7SJZ5NF.js';
|
|
3
3
|
export { P as ProgramImpl, R as RuntimeOpImpl } from '../../shared-chunks/program-B7SJZ5NF.js';
|
|
4
4
|
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import '../../shared-chunks/fragment-EpVz5Xuc.js';
|
|
2
2
|
import '../validator/index.js';
|
|
3
3
|
import '../../shared-chunks/reference-BNqcwZWH.js';
|
|
4
|
-
export { C as ConcreteBounds, a as CurriedValue, b as CursorImpl, D as DOMChanges, E as EMPTY_ARGS, c as EMPTY_NAMED, d as EMPTY_POSITIONAL, e as IDOMChanges, T as TEMPLATE_ONLY_COMPONENT_MANAGER, f as TemplateOnlyComponent, g as TemplateOnlyComponentManager, h as array, i as clear, j as concat, k as createCapturedArgs, l as curry, m as fn, n as get, o as hash, p as isWhitespace, q as on, r as reifyArgs, s as reifyNamed, t as reifyPositional, u as resetDebuggerCallback, v as setDebuggerCallback, w as templateOnlyComponent } from '../../shared-chunks/on-
|
|
5
|
-
export { D as DOMTreeConstruction, a as DynamicAttribute, N as NewTreeBuilder, R as RemoteBlock, b as ResettableBlockImpl, S as SimpleDynamicAttribute, c as clientBuilder, d as dynamicAttribute, n as normalizeProperty } from '../../shared-chunks/element-builder-
|
|
6
|
-
export { D as DynamicScopeImpl, E as EnvironmentImpl, L as LowLevelVM, S as ScopeImpl, U as UpdatingVM, i as inTransaction, r as renderComponent, a as renderMain, b as renderSync, c as runtimeOptions } from '../../shared-chunks/render-
|
|
7
|
-
export { i as invokeHelper } from '../../shared-chunks/invoke-
|
|
4
|
+
export { C as ConcreteBounds, a as CurriedValue, b as CursorImpl, D as DOMChanges, E as EMPTY_ARGS, c as EMPTY_NAMED, d as EMPTY_POSITIONAL, e as IDOMChanges, T as TEMPLATE_ONLY_COMPONENT_MANAGER, f as TemplateOnlyComponent, g as TemplateOnlyComponentManager, h as array, i as clear, j as concat, k as createCapturedArgs, l as curry, m as fn, n as get, o as hash, p as isWhitespace, q as on, r as reifyArgs, s as reifyNamed, t as reifyPositional, u as resetDebuggerCallback, v as setDebuggerCallback, w as templateOnlyComponent } from '../../shared-chunks/on-ByzWKBWe.js';
|
|
5
|
+
export { D as DOMTreeConstruction, a as DynamicAttribute, N as NewTreeBuilder, R as RemoteBlock, b as ResettableBlockImpl, S as SimpleDynamicAttribute, c as clientBuilder, d as dynamicAttribute, n as normalizeProperty } from '../../shared-chunks/element-builder-DbktcGKV.js';
|
|
6
|
+
export { D as DynamicScopeImpl, E as EnvironmentImpl, L as LowLevelVM, S as ScopeImpl, U as UpdatingVM, i as inTransaction, r as renderComponent, a as renderMain, b as renderSync, c as runtimeOptions } from '../../shared-chunks/render-DJ-BzvgU.js';
|
|
7
|
+
export { i as invokeHelper } from '../../shared-chunks/invoke-BuwCkcVB.js';
|
|
8
8
|
export { destroy, isDestroyed, isDestroying, registerDestructor } from '../destroyable/index.js';
|
|
9
|
-
export { R as RehydrateTree, S as SERIALIZATION_FIRST_NODE_STRING, i as isSerializationFirstNode, r as rehydrationBuilder } from '../../shared-chunks/rehydrate-builder-
|
|
9
|
+
export { R as RehydrateTree, S as SERIALIZATION_FIRST_NODE_STRING, i as isSerializationFirstNode, r as rehydrationBuilder } from '../../shared-chunks/rehydrate-builder-M_dh82nR.js';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import '../shared-chunks/fragment-EpVz5Xuc.js';
|
|
2
2
|
import '../@glimmer/wire-format/index.js';
|
|
3
|
-
import { p as precompile$1 } from '../shared-chunks/compiler-
|
|
4
|
-
export { a as _preprocess, b as _print } from '../shared-chunks/compiler-
|
|
3
|
+
import { p as precompile$1 } from '../shared-chunks/compiler-Rwrmj1ki.js';
|
|
4
|
+
export { a as _preprocess, b as _print } from '../shared-chunks/compiler-Rwrmj1ki.js';
|
|
5
5
|
import '../@ember/-internals/environment/index.js';
|
|
6
6
|
import { STRICT_MODE_KEYWORDS, STRICT_MODE_TRANSFORMS, RESOLUTION_MODE_TRANSFORMS } from '../@ember/template-compiler/lib/plugins/index.js';
|
|
7
7
|
import '../shared-chunks/super-Cm_a_cLQ.js';
|
|
@@ -6768,9 +6768,6 @@ const SCOPE_PLACEHOLDER = '796d24e6-2450-4fb0-8cdf-b65638b5ef70';
|
|
|
6768
6768
|
*/
|
|
6769
6769
|
function precompile(source, options = defaultOptions) {
|
|
6770
6770
|
const [block, usedLocals] = precompileJSON(source, options);
|
|
6771
|
-
if ('emit' in options && options.emit?.debugSymbols && usedLocals.length > 0) {
|
|
6772
|
-
block.push(usedLocals);
|
|
6773
|
-
}
|
|
6774
6771
|
const moduleName = options.meta?.moduleName;
|
|
6775
6772
|
const idFn = options.id || defaultId;
|
|
6776
6773
|
const blockJSON = JSON.stringify(block);
|
|
@@ -7,7 +7,7 @@ import './reference-BNqcwZWH.js';
|
|
|
7
7
|
import { c as capabilityFlagsFrom, m as managerHasCapability } from './capabilities-DGmQ_mz4.js';
|
|
8
8
|
import { g as getComponentTemplate } from './template-Dc_cBOoX.js';
|
|
9
9
|
import { I as InternalComponentCapabilities } from './flags-B9qxc-pB.js';
|
|
10
|
-
import { t as templateFactory } from './index-
|
|
10
|
+
import { t as templateFactory } from './index-nW__r2nX.js';
|
|
11
11
|
import { SexpOpcodes as opcodes } from '../@glimmer/wire-format/index.js';
|
|
12
12
|
|
|
13
13
|
function unwrapHandle(handle) {
|
package/dist/prod/packages/shared-chunks/{element-builder-CiLTrXD6.js → element-builder-DbktcGKV.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as DOMOperations, B as isSafeString, F as normalizeStringValue, N as NS_SVG, b as CursorImpl, C as ConcreteBounds, i as clear } from './on-
|
|
1
|
+
import { A as DOMOperations, B as isSafeString, F as normalizeStringValue, N as NS_SVG, b as CursorImpl, C as ConcreteBounds, i as clear } from './on-ByzWKBWe.js';
|
|
2
2
|
import { a as assert } from './assert-CUCJBR2C.js';
|
|
3
3
|
import { s as setLocalDebugType } from './debug-brand-B1TWjOCH.js';
|
|
4
4
|
import { S as StackImpl, e as expect } from './collections-GpG8lT2g.js';
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import './fragment-EpVz5Xuc.js';
|
|
2
2
|
import { untrack, consumeTag, tagFor, createCache, getValue, valueForTag, beginUntrackFrame, endUntrackFrame, beginTrackFrame, endTrackFrame, validateTag, createTag, dirtyTag as DIRTY_TAG$1, CONSTANT_TAG, isTracking, CURRENT_TAG } from '../@glimmer/validator/index.js';
|
|
3
|
-
import { v as valueForRef, a as createConstRef, i as isConstRef, l as isUpdatableRef, u as updateRef, c as createComputeRef, d as createPrimitiveRef, b as childRefFor, f as childRefFromParts, U as UNDEFINED_REFERENCE, h as createInvokableRef, j as createReadOnlyRef, k as createUnboundRef } from './reference-BNqcwZWH.js';
|
|
4
|
-
import { t as templateFactory } from './index-
|
|
3
|
+
import { v as valueForRef, a as createConstRef, i as isConstRef, l as isUpdatableRef, u as updateRef, c as createComputeRef, d as createPrimitiveRef, b as childRefFor, f as childRefFromParts, U as UNDEFINED_REFERENCE, h as createInvokableRef, j as createReadOnlyRef, k as createUnboundRef, N as NULL_REFERENCE } from './reference-BNqcwZWH.js';
|
|
4
|
+
import { t as templateFactory } from './index-nW__r2nX.js';
|
|
5
5
|
import { c as capabilityFlagsFrom } from './capabilities-DGmQ_mz4.js';
|
|
6
6
|
import { getFactoryFor, privatize } from '../@ember/-internals/container/index.js';
|
|
7
7
|
import { g as guidFor, i as isObject } from './super-Cm_a_cLQ.js';
|
|
8
8
|
import { ENV } from '../@ember/-internals/environment/index.js';
|
|
9
|
-
import { t as reifyPositional, E as EMPTY_ARGS, k as createCapturedArgs, d as EMPTY_POSITIONAL, l as curry, o as hash, n as get$1, m as fn, j as concat, h as array, q as on$1, T as TEMPLATE_ONLY_COMPONENT_MANAGER, w as templateOnlyComponent } from './on-
|
|
10
|
-
import './constants-
|
|
9
|
+
import { t as reifyPositional, E as EMPTY_ARGS, k as createCapturedArgs, d as EMPTY_POSITIONAL, l as curry, o as hash, n as get$1, m as fn, j as concat, h as array, q as on$1, T as TEMPLATE_ONLY_COMPONENT_MANAGER, w as templateOnlyComponent } from './on-ByzWKBWe.js';
|
|
10
|
+
import './constants-CB3pk7dH.js';
|
|
11
11
|
import { join, schedule, _backburner, _getCurrentRunLoop } from '../@ember/runloop/index.js';
|
|
12
12
|
import { h as hasDOM } from './has-dom-DdQORPzI.js';
|
|
13
13
|
import { action } from '../@ember/object/index.js';
|
|
@@ -36,7 +36,7 @@ import { contentFor } from '../@ember/-internals/runtime/lib/mixins/-proxy.js';
|
|
|
36
36
|
import '../@ember/enumerable/mutable.js';
|
|
37
37
|
import TargetActionSupport from '../@ember/-internals/runtime/lib/mixins/target_action_support.js';
|
|
38
38
|
import '../@ember/-internals/runtime/lib/ext/rsvp.js';
|
|
39
|
-
import { n as normalizeProperty, c as clientBuilder } from './element-builder-
|
|
39
|
+
import { n as normalizeProperty, c as clientBuilder } from './element-builder-DbktcGKV.js';
|
|
40
40
|
import { E as EMPTY_ARRAY$2 } from './array-utils-CZQxrdD3.js';
|
|
41
41
|
import { dasherize } from '../@ember/-internals/string/index.js';
|
|
42
42
|
import { registerDestructor, associateDestroyableChild, isDestroyed, destroy, isDestroying } from '../@glimmer/destroyable/index.js';
|
|
@@ -47,7 +47,7 @@ import { setHelperManager } from '../@glimmer/manager/index.js';
|
|
|
47
47
|
import { d as dict } from './collections-GpG8lT2g.js';
|
|
48
48
|
import { artifacts } from '../@glimmer/program/index.js';
|
|
49
49
|
import { R as RuntimeOpImpl } from './program-B7SJZ5NF.js';
|
|
50
|
-
import { c as runtimeOptions, i as inTransaction, r as renderComponent$1, a as renderMain } from './render-
|
|
50
|
+
import { c as runtimeOptions, i as inTransaction, r as renderComponent$1, a as renderMain } from './render-DJ-BzvgU.js';
|
|
51
51
|
import { a as RSVP } from './rsvp-CnCSY930.js';
|
|
52
52
|
import '../@ember/engine/instance.js';
|
|
53
53
|
import setGlobalContext from '../@glimmer/global-context/index.js';
|
|
@@ -59,7 +59,7 @@ import '../route-recognizer/index.js';
|
|
|
59
59
|
import './unrecognized-url-error-DDBwfzdm.js';
|
|
60
60
|
import '../@ember/routing/lib/routing-service.js';
|
|
61
61
|
import { generateControllerFactory } from '../@ember/routing/lib/generate_controller.js';
|
|
62
|
-
import { E as EvaluationContextImpl } from './program-context-
|
|
62
|
+
import { E as EvaluationContextImpl } from './program-context-BdUXf-jj.js';
|
|
63
63
|
|
|
64
64
|
const RootTemplate = templateFactory(
|
|
65
65
|
/*
|
|
@@ -3584,8 +3584,7 @@ class OutletComponentManager {
|
|
|
3584
3584
|
// "main" used to be the outlet name, keeping it around for compatibility
|
|
3585
3585
|
name: 'main',
|
|
3586
3586
|
args: EMPTY_ARGS,
|
|
3587
|
-
instance: undefined
|
|
3588
|
-
template: undefined
|
|
3587
|
+
instance: undefined
|
|
3589
3588
|
});
|
|
3590
3589
|
if (state.engine) {
|
|
3591
3590
|
nodes.push({
|
|
@@ -3593,8 +3592,7 @@ class OutletComponentManager {
|
|
|
3593
3592
|
type: 'engine',
|
|
3594
3593
|
name: state.engine.mountPoint,
|
|
3595
3594
|
args: EMPTY_ARGS,
|
|
3596
|
-
instance: state.engine.instance
|
|
3597
|
-
template: undefined
|
|
3595
|
+
instance: state.engine.instance
|
|
3598
3596
|
});
|
|
3599
3597
|
}
|
|
3600
3598
|
return nodes;
|
|
@@ -4597,7 +4595,7 @@ class MountManager {
|
|
|
4597
4595
|
}) {
|
|
4598
4596
|
return name;
|
|
4599
4597
|
}
|
|
4600
|
-
getDebugCustomRenderTree(definition, state, args
|
|
4598
|
+
getDebugCustomRenderTree(definition, state, args) {
|
|
4601
4599
|
return [{
|
|
4602
4600
|
bucket: state.engine,
|
|
4603
4601
|
instance: state.engine,
|
|
@@ -4609,8 +4607,7 @@ class MountManager {
|
|
|
4609
4607
|
instance: state.controller,
|
|
4610
4608
|
type: 'route-template',
|
|
4611
4609
|
name: 'application',
|
|
4612
|
-
args
|
|
4613
|
-
template: templateModuleName
|
|
4610
|
+
args
|
|
4614
4611
|
}];
|
|
4615
4612
|
}
|
|
4616
4613
|
getSelf({
|
|
@@ -4754,16 +4751,14 @@ class RouteTemplateManager {
|
|
|
4754
4751
|
return `route-template (${name})`;
|
|
4755
4752
|
}
|
|
4756
4753
|
getDebugCustomRenderTree({
|
|
4757
|
-
name
|
|
4758
|
-
templateName
|
|
4754
|
+
name
|
|
4759
4755
|
}, state, args) {
|
|
4760
4756
|
return [{
|
|
4761
4757
|
bucket: state,
|
|
4762
4758
|
type: 'route-template',
|
|
4763
4759
|
name,
|
|
4764
4760
|
args,
|
|
4765
|
-
instance: state.controller
|
|
4766
|
-
template: templateName
|
|
4761
|
+
instance: state.controller
|
|
4767
4762
|
}];
|
|
4768
4763
|
}
|
|
4769
4764
|
getCapabilities() {
|
|
@@ -4800,8 +4795,7 @@ class RouteTemplate {
|
|
|
4800
4795
|
// message. Is that desirable?
|
|
4801
4796
|
this.resolvedName = name;
|
|
4802
4797
|
this.state = {
|
|
4803
|
-
name
|
|
4804
|
-
templateName: unwrapped.moduleName
|
|
4798
|
+
name
|
|
4805
4799
|
};
|
|
4806
4800
|
this.compilable = unwrapped.asLayout();
|
|
4807
4801
|
}
|
|
@@ -5839,4 +5833,99 @@ const OutletTemplate = templateFactory(
|
|
|
5839
5833
|
"isStrictMode": true
|
|
5840
5834
|
});
|
|
5841
5835
|
|
|
5842
|
-
|
|
5836
|
+
/**
|
|
5837
|
+
@module @ember/helper
|
|
5838
|
+
*/
|
|
5839
|
+
|
|
5840
|
+
|
|
5841
|
+
// ============ Element Component (for string tag names) ============
|
|
5842
|
+
// Renders content wrapped in the specified HTML element, or just renders
|
|
5843
|
+
// content without a wrapper for empty string.
|
|
5844
|
+
|
|
5845
|
+
const ELEMENT_CAPABILITIES = {
|
|
5846
|
+
createInstance: true,
|
|
5847
|
+
wrapped: true
|
|
5848
|
+
};
|
|
5849
|
+
class ElementComponentManager {
|
|
5850
|
+
getCapabilities() {
|
|
5851
|
+
return ELEMENT_CAPABILITIES;
|
|
5852
|
+
}
|
|
5853
|
+
getDebugName(state) {
|
|
5854
|
+
return `(element "${state.tagName}")`;
|
|
5855
|
+
}
|
|
5856
|
+
getSelf() {
|
|
5857
|
+
return NULL_REFERENCE;
|
|
5858
|
+
}
|
|
5859
|
+
getDestroyable() {
|
|
5860
|
+
return null;
|
|
5861
|
+
}
|
|
5862
|
+
didCreateElement() {}
|
|
5863
|
+
create(_owner, state) {
|
|
5864
|
+
// For empty string, return null so getTagName returns null (no wrapper element)
|
|
5865
|
+
return state.tagName || null;
|
|
5866
|
+
}
|
|
5867
|
+
getTagName(state) {
|
|
5868
|
+
return state;
|
|
5869
|
+
}
|
|
5870
|
+
didRenderLayout() {}
|
|
5871
|
+
didUpdateLayout() {}
|
|
5872
|
+
didCreate() {}
|
|
5873
|
+
didUpdate() {}
|
|
5874
|
+
}
|
|
5875
|
+
const ELEMENT_COMPONENT_MANAGER = new ElementComponentManager();
|
|
5876
|
+
class ElementComponentDefinition {
|
|
5877
|
+
constructor(tagName) {
|
|
5878
|
+
this.tagName = tagName;
|
|
5879
|
+
}
|
|
5880
|
+
toString() {
|
|
5881
|
+
return `(element "${this.tagName}")`;
|
|
5882
|
+
}
|
|
5883
|
+
}
|
|
5884
|
+
setInternalComponentManager(ELEMENT_COMPONENT_MANAGER, ElementComponentDefinition.prototype);
|
|
5885
|
+
|
|
5886
|
+
// Cache component definitions per tag name to avoid creating duplicate definitions
|
|
5887
|
+
const ELEMENT_DEFINITIONS = new Map();
|
|
5888
|
+
function getElementDefinition(tagName) {
|
|
5889
|
+
let definition = ELEMENT_DEFINITIONS.get(tagName);
|
|
5890
|
+
if (definition === undefined) {
|
|
5891
|
+
definition = new ElementComponentDefinition(tagName);
|
|
5892
|
+
ELEMENT_DEFINITIONS.set(tagName, definition);
|
|
5893
|
+
}
|
|
5894
|
+
return definition;
|
|
5895
|
+
}
|
|
5896
|
+
|
|
5897
|
+
// ============ Element Helper ============
|
|
5898
|
+
|
|
5899
|
+
/**
|
|
5900
|
+
The `element` helper lets you dynamically set the tag name of an element.
|
|
5901
|
+
|
|
5902
|
+
```handlebars
|
|
5903
|
+
{{#let (element @tagName) as |Tag|}}
|
|
5904
|
+
<Tag class="my-element">Hello</Tag>
|
|
5905
|
+
{{/let}}
|
|
5906
|
+
```
|
|
5907
|
+
|
|
5908
|
+
When `@tagName` is `"h1"`, this renders `<h1 class="my-element">Hello</h1>`.
|
|
5909
|
+
|
|
5910
|
+
When `@tagName` is an empty string `""`, the block content is rendered without
|
|
5911
|
+
a wrapping element.
|
|
5912
|
+
|
|
5913
|
+
Passing `null`, `undefined`, or non-string values will throw an assertion error.
|
|
5914
|
+
|
|
5915
|
+
Changing the tag name will tear down and recreate the element and its contents.
|
|
5916
|
+
|
|
5917
|
+
@method element
|
|
5918
|
+
@for Ember.Templates.helpers
|
|
5919
|
+
@public
|
|
5920
|
+
*/
|
|
5921
|
+
const glimmerElement = internalHelper(({
|
|
5922
|
+
positional,
|
|
5923
|
+
named
|
|
5924
|
+
}) => {
|
|
5925
|
+
return createComputeRef(() => {
|
|
5926
|
+
let tagName = valueForRef(positional[0]);
|
|
5927
|
+
return getElementDefinition(tagName);
|
|
5928
|
+
}, null, 'element');
|
|
5929
|
+
});
|
|
5930
|
+
|
|
5931
|
+
export { Component as C, Helper as H, Input as I, LinkTo as L, OutletView as O, RootTemplate as R, SafeString as S, Textarea as T, _resetRenderers as _, OutletTemplate as a, Renderer as b, TrustedHTML as c, htmlSafe as d, isTrustedHTML as e, renderComponent as f, glimmerElement as g, helper$1 as h, isHTMLSafe as i, renderSettled as r, trustHTML as t, uniqueId$1 as u };
|
|
@@ -849,13 +849,13 @@ function CompilePositional(op, positional) {
|
|
|
849
849
|
return positional.length;
|
|
850
850
|
}
|
|
851
851
|
function meta(layout) {
|
|
852
|
-
let [, locals, upvars
|
|
852
|
+
let [, locals, upvars] = layout.block;
|
|
853
853
|
let scopeRecord = layout.scope?.() ?? null;
|
|
854
854
|
return {
|
|
855
855
|
symbols: {
|
|
856
856
|
locals,
|
|
857
857
|
upvars,
|
|
858
|
-
lexical: scopeRecord ? Object.keys(scopeRecord) :
|
|
858
|
+
lexical: scopeRecord ? Object.keys(scopeRecord) : undefined
|
|
859
859
|
},
|
|
860
860
|
scopeValues: scopeRecord ? Object.values(scopeRecord) : null,
|
|
861
861
|
isStrictMode: layout.isStrictMode,
|
|
@@ -4,7 +4,7 @@ import { createCache, getValue } from '../@glimmer/validator/index.js';
|
|
|
4
4
|
import './reference-BNqcwZWH.js';
|
|
5
5
|
import './capabilities-DGmQ_mz4.js';
|
|
6
6
|
import { getOwner } from '../@glimmer/owner/index.js';
|
|
7
|
-
import { E as EMPTY_ARGS, c as EMPTY_NAMED, d as EMPTY_POSITIONAL } from './on-
|
|
7
|
+
import { E as EMPTY_ARGS, c as EMPTY_NAMED, d as EMPTY_POSITIONAL } from './on-ByzWKBWe.js';
|
|
8
8
|
|
|
9
9
|
function getArgs(proxy) {
|
|
10
10
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion -- @fixme
|