@microsoft/fast-element 2.0.0-beta.2 → 2.0.0-beta.5
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/CHANGELOG.json +147 -0
- package/CHANGELOG.md +42 -1
- package/dist/dts/components/fast-definitions.d.ts +9 -8
- package/dist/dts/components/fast-element.d.ts +12 -24
- package/dist/dts/context.d.ts +1 -1
- package/dist/dts/di/di.d.ts +858 -0
- package/dist/dts/hooks.d.ts +2 -2
- package/dist/dts/interfaces.d.ts +40 -7
- package/dist/dts/observation/observable.d.ts +19 -13
- package/dist/dts/styles/element-styles.d.ts +6 -0
- package/dist/dts/templating/binding-signal.d.ts +10 -27
- package/dist/dts/templating/binding-two-way.d.ts +16 -41
- package/dist/dts/templating/binding.d.ts +79 -118
- package/dist/dts/templating/html-directive.d.ts +31 -3
- package/dist/dts/templating/render.d.ts +277 -0
- package/dist/dts/templating/repeat.d.ts +12 -16
- package/dist/dts/templating/template.d.ts +3 -3
- package/dist/dts/templating/when.d.ts +3 -3
- package/dist/dts/testing/exports.d.ts +2 -0
- package/dist/dts/testing/fixture.d.ts +90 -0
- package/dist/dts/testing/timeout.d.ts +7 -0
- package/dist/esm/components/fast-definitions.js +25 -27
- package/dist/esm/components/fast-element.js +20 -11
- package/dist/esm/context.js +5 -1
- package/dist/esm/debug.js +36 -4
- package/dist/esm/di/di.js +1351 -0
- package/dist/esm/observation/arrays.js +303 -2
- package/dist/esm/observation/observable.js +11 -6
- package/dist/esm/platform.js +1 -1
- package/dist/esm/styles/element-styles.js +14 -0
- package/dist/esm/templating/binding-signal.js +56 -61
- package/dist/esm/templating/binding-two-way.js +56 -34
- package/dist/esm/templating/binding.js +137 -156
- package/dist/esm/templating/compiler.js +30 -7
- package/dist/esm/templating/html-directive.js +16 -2
- package/dist/esm/templating/render.js +392 -0
- package/dist/esm/templating/repeat.js +57 -40
- package/dist/esm/templating/template.js +8 -5
- package/dist/esm/templating/view.js +3 -1
- package/dist/esm/templating/when.js +5 -4
- package/dist/esm/testing/exports.js +2 -0
- package/dist/esm/testing/fixture.js +88 -0
- package/dist/esm/testing/timeout.js +24 -0
- package/dist/fast-element.api.json +2828 -2758
- package/dist/fast-element.d.ts +218 -230
- package/dist/fast-element.debug.js +656 -257
- package/dist/fast-element.debug.min.js +1 -1
- package/dist/fast-element.js +620 -253
- package/dist/fast-element.min.js +1 -1
- package/dist/fast-element.untrimmed.d.ts +226 -235
- package/docs/api-report.md +88 -91
- package/package.json +15 -6
- package/dist/dts/observation/splice-strategies.d.ts +0 -13
- package/dist/esm/observation/splice-strategies.js +0 -400
package/dist/esm/context.js
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
import "./interfaces.js";
|
|
1
2
|
import { Metadata } from "./metadata.js";
|
|
3
|
+
import { FAST } from "./platform.js";
|
|
2
4
|
const contextEventType = "context-request";
|
|
3
5
|
let requestStrategy;
|
|
4
6
|
/**
|
|
@@ -19,7 +21,9 @@ export const Context = Object.freeze({
|
|
|
19
21
|
create(name, initialValue) {
|
|
20
22
|
const Interface = function (target, property, index) {
|
|
21
23
|
if (target == null || new.target !== undefined) {
|
|
22
|
-
throw
|
|
24
|
+
throw FAST.error(1501 /* Message.noRegistrationForContext */, {
|
|
25
|
+
name: Interface.name,
|
|
26
|
+
});
|
|
23
27
|
}
|
|
24
28
|
if (property) {
|
|
25
29
|
Context.defineProperty(target, property, Interface);
|
package/dist/esm/debug.js
CHANGED
|
@@ -11,19 +11,51 @@ const debugMessages = {
|
|
|
11
11
|
[1101 /* needsArrayObservation */]: "Must call enableArrayObservation before observing arrays.",
|
|
12
12
|
[1201 /* onlySetHTMLPolicyOnce */]: "The HTML policy can only be set once.",
|
|
13
13
|
[1202 /* bindingInnerHTMLRequiresTrustedTypes */]: "To bind innerHTML, you must use a TrustedTypesPolicy.",
|
|
14
|
+
[1203 /* twoWayBindingRequiresObservables */]: "View=>Model update skipped. To use twoWay binding, the target property must be observable.",
|
|
15
|
+
[1204 /* hostBindingWithoutHost */]: "No host element is present. Cannot bind host with ${name}.",
|
|
16
|
+
[1205 /* unsupportedBindingBehavior */]: "The requested binding behavior is not supported by the binding engine.",
|
|
14
17
|
[1401 /* missingElementDefinition */]: "Missing FASTElement definition.",
|
|
18
|
+
[1501 /* noRegistrationForContext */]: "No registration for Context/Interface '${name}'.",
|
|
19
|
+
[1502 /* noFactoryForResolver */]: "Dependency injection resolver for '${key}' returned a null factory.",
|
|
20
|
+
[1503 /* invalidResolverStrategy */]: "Invalid dependency injection resolver strategy specified '${strategy}'.",
|
|
21
|
+
[1504 /* cannotAutoregisterDependency */]: "Unable to autoregister dependency.",
|
|
22
|
+
[1505 /* cannotResolveKey */]: "Unable to resolve dependency injection key '${key}'.",
|
|
23
|
+
[1506 /* cannotConstructNativeFunction */]: "'${name}' is a native function and therefore cannot be safely constructed by DI. If this is intentional, please use a callback or cachedCallback resolver.",
|
|
24
|
+
[1507 /* cannotJITRegisterNonConstructor */]: "Attempted to jitRegister something that is not a constructor '${value}'. Did you forget to register this dependency?",
|
|
25
|
+
[1508 /* cannotJITRegisterIntrinsic */]: "Attempted to jitRegister an intrinsic type '${value}'. Did you forget to add @inject(Key)?",
|
|
26
|
+
[1509 /* cannotJITRegisterInterface */]: "Attempted to jitRegister an interface '${value}'.",
|
|
27
|
+
[1510 /* invalidResolver */]: "A valid resolver was not returned from the register method.",
|
|
28
|
+
[1511 /* invalidKey */]: "Key/value cannot be null or undefined. Are you trying to inject/register something that doesn't exist with DI?",
|
|
29
|
+
[1512 /* noDefaultResolver */]: "'${key}' not registered. Did you forget to add @singleton()?",
|
|
30
|
+
[1513 /* cyclicDependency */]: "Cyclic dependency found '${name}'.",
|
|
31
|
+
[1514 /* connectUpdateRequiresController */]: "Injected properties that are updated on changes to DOM connectivity require the target object to be an instance of FASTElement.",
|
|
15
32
|
};
|
|
33
|
+
const allPlaceholders = /(\$\{\w+?})/g;
|
|
34
|
+
const placeholder = /\$\{(\w+?)}/g;
|
|
35
|
+
const noValues = Object.freeze({});
|
|
36
|
+
function formatMessage(message, values) {
|
|
37
|
+
return message
|
|
38
|
+
.split(allPlaceholders)
|
|
39
|
+
.map(v => {
|
|
40
|
+
var _a;
|
|
41
|
+
const replaced = v.replace(placeholder, "$1");
|
|
42
|
+
return String((_a = values[replaced]) !== null && _a !== void 0 ? _a : v);
|
|
43
|
+
})
|
|
44
|
+
.join("");
|
|
45
|
+
}
|
|
16
46
|
Object.assign(FAST, {
|
|
17
47
|
addMessages(messages) {
|
|
18
48
|
Object.assign(debugMessages, messages);
|
|
19
49
|
},
|
|
20
|
-
warn(code,
|
|
50
|
+
warn(code, values = noValues) {
|
|
21
51
|
var _a;
|
|
22
|
-
|
|
52
|
+
const message = (_a = debugMessages[code]) !== null && _a !== void 0 ? _a : "Unknown Warning";
|
|
53
|
+
console.warn(formatMessage(message, values));
|
|
23
54
|
},
|
|
24
|
-
error(code,
|
|
55
|
+
error(code, values = noValues) {
|
|
25
56
|
var _a;
|
|
26
|
-
|
|
57
|
+
const message = (_a = debugMessages[code]) !== null && _a !== void 0 ? _a : "Unknown Error";
|
|
58
|
+
return new Error(formatMessage(message, values));
|
|
27
59
|
},
|
|
28
60
|
});
|
|
29
61
|
export {};
|