@aurelia/runtime-html
Advanced tools
Comparing version 2.0.0-beta.19 to 2.0.0-beta.20
@@ -51,2 +51,4 @@ import { type Class, type Constructable } from '@aurelia/kernel'; | ||
getAll(Type: Constructable): readonly BindableDefinition[]; | ||
/** @internal */ | ||
_add(bindable: BindableDefinition, Type: Constructable): void; | ||
}>; | ||
@@ -53,0 +55,0 @@ export declare class BindableDefinition { |
{ | ||
"name": "@aurelia/runtime-html", | ||
"version": "2.0.0-beta.19", | ||
"version": "2.0.0-beta.20", | ||
"main": "dist/cjs/index.cjs", | ||
@@ -57,9 +57,9 @@ "module": "dist/esm/index.mjs", | ||
"dependencies": { | ||
"@aurelia/kernel": "2.0.0-beta.19", | ||
"@aurelia/metadata": "2.0.0-beta.19", | ||
"@aurelia/platform": "2.0.0-beta.19", | ||
"@aurelia/platform-browser": "2.0.0-beta.19", | ||
"@aurelia/runtime": "2.0.0-beta.19", | ||
"@aurelia/expression-parser": "2.0.0-beta.19", | ||
"@aurelia/template-compiler": "2.0.0-beta.19" | ||
"@aurelia/kernel": "2.0.0-beta.20", | ||
"@aurelia/metadata": "2.0.0-beta.20", | ||
"@aurelia/platform": "2.0.0-beta.20", | ||
"@aurelia/platform-browser": "2.0.0-beta.20", | ||
"@aurelia/runtime": "2.0.0-beta.20", | ||
"@aurelia/expression-parser": "2.0.0-beta.20", | ||
"@aurelia/template-compiler": "2.0.0-beta.20" | ||
}, | ||
@@ -66,0 +66,0 @@ "devDependencies": { |
@@ -173,2 +173,10 @@ import { kebabCase, getPrototypeChain, noop, type Class, createLookup, isString, type Constructable } from '@aurelia/kernel'; | ||
}, | ||
/** @internal */ | ||
_add(bindable: BindableDefinition, Type: Constructable) { | ||
let bindables = getMetadata<Record<string, BindableDefinition>>(baseName, Type); | ||
if (bindables == null) { | ||
defineMetadata(bindables = createLookup(), Type, baseName); | ||
} | ||
bindables[bindable.name] = bindable; | ||
} | ||
}); | ||
@@ -175,0 +183,0 @@ |
@@ -153,2 +153,5 @@ import { mergeArrays, firstDefined, Key, resourceBaseName, getResourceKeyFor, isFunction, isString, ILogger } from '@aurelia/kernel'; | ||
for(const bindable of Object.values(Bindable.from(def.bindables))) { | ||
Bindable._add(bindable, Type); | ||
} | ||
return new CustomAttributeDefinition( | ||
@@ -155,0 +158,0 @@ Type, |
@@ -264,2 +264,5 @@ import { | ||
for(const bindable of Object.values(Bindable.from(def.bindables))) { | ||
Bindable._add(bindable, Type); | ||
} | ||
return new CustomElementDefinition( | ||
@@ -323,2 +326,6 @@ Type, | ||
const name = fromDefinitionOrDefault('name', nameOrDef, generateElementName); | ||
for(const bindable of Object.values(Bindable.from(nameOrDef.bindables))) { | ||
Bindable._add(bindable, Type); | ||
} | ||
return new CustomElementDefinition( | ||
@@ -325,0 +332,0 @@ Type, |
@@ -242,3 +242,22 @@ import { | ||
let caseId = 0; | ||
const bindables: (string | PartialBindableDefinition & { name: string })[] = [ | ||
'value', | ||
{ | ||
name: 'fallThrough', | ||
mode: oneTime, | ||
set(v: unknown): boolean { | ||
switch (v) { | ||
case 'true': return true; | ||
case 'false': return false; | ||
// eslint-disable-next-line @typescript-eslint/strict-boolean-expressions | ||
default: return !!v; | ||
} | ||
} | ||
} | ||
]; | ||
export class Case implements ICustomAttributeViewModel { | ||
static { | ||
defineAttribute({ name: 'case', bindables, isTemplateController: true }, Case); | ||
} | ||
/** @internal */ public readonly id: number = ++caseId; | ||
@@ -347,27 +366,3 @@ public readonly $controller!: ICustomAttributeController<this>; // This is set by the controller after this instance is constructed | ||
static { | ||
// Notes: | ||
// - The usage of $au is intentionally avoided here. | ||
// Once the 'case' TC is defined, the TC definition is put to the Class[Symbol.metadata], that is implicitly inherited by the 'default-case' TC. | ||
// Thus, when resolving the definition, the definition from the 'case' TC is found and used, rendering the $au property not-useful. | ||
// - The order of the 'case' and 'default-case' TC definitions is important also because of above said reason. | ||
// We want to deliberately define the 'case' TC second, so that the 'default-case' cannot inherit the metadata. | ||
const bindables: (string | PartialBindableDefinition & { name: string })[] = [ | ||
'value', | ||
{ | ||
name: 'fallThrough', | ||
mode: oneTime, | ||
set(v: unknown): boolean { | ||
switch (v) { | ||
case 'true': return true; | ||
case 'false': return false; | ||
// eslint-disable-next-line @typescript-eslint/strict-boolean-expressions | ||
default: return !!v; | ||
} | ||
} | ||
} | ||
]; | ||
defineAttribute({ name: 'default-case', bindables, isTemplateController: true }, DefaultCase); | ||
defineAttribute({ name: 'case', bindables, isTemplateController: true }, Case); | ||
} | ||
@@ -374,0 +369,0 @@ |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
4302070
78316
+ Added@aurelia/expression-parser@2.0.0-beta.20(transitive)
+ Added@aurelia/kernel@2.0.0-beta.20(transitive)
+ Added@aurelia/metadata@2.0.0-beta.20(transitive)
+ Added@aurelia/platform@2.0.0-beta.20(transitive)
+ Added@aurelia/platform-browser@2.0.0-beta.20(transitive)
+ Added@aurelia/runtime@2.0.0-beta.20(transitive)
+ Added@aurelia/template-compiler@2.0.0-beta.20(transitive)
- Removed@aurelia/expression-parser@2.0.0-beta.19(transitive)
- Removed@aurelia/kernel@2.0.0-beta.19(transitive)
- Removed@aurelia/metadata@2.0.0-beta.19(transitive)
- Removed@aurelia/platform@2.0.0-beta.19(transitive)
- Removed@aurelia/platform-browser@2.0.0-beta.19(transitive)
- Removed@aurelia/runtime@2.0.0-beta.19(transitive)
- Removed@aurelia/template-compiler@2.0.0-beta.19(transitive)