@microsoft/fast-element 2.10.1 → 2.10.3

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.
Files changed (41) hide show
  1. package/ARCHITECTURE_FASTELEMENT.md +1 -1
  2. package/ARCHITECTURE_HTML_TAGGED_TEMPLATE_LITERAL.md +3 -1
  3. package/ARCHITECTURE_INTRO.md +1 -1
  4. package/ARCHITECTURE_OVERVIEW.md +1 -1
  5. package/CHANGELOG.json +153 -1
  6. package/CHANGELOG.md +18 -2
  7. package/DESIGN.md +506 -0
  8. package/biome.json +4 -0
  9. package/dist/context/context.api.json +17 -1
  10. package/dist/di/di.api.json +17 -1
  11. package/dist/dts/hydration/target-builder.d.ts +17 -1
  12. package/dist/dts/templating/html-binding-directive.d.ts +39 -4
  13. package/dist/dts/templating/html-directive.d.ts +7 -1
  14. package/dist/dts/templating/template.d.ts +19 -1
  15. package/dist/dts/templating/view.d.ts +11 -0
  16. package/dist/dts/testing/models.d.ts +20 -0
  17. package/dist/dts/tsdoc-metadata.json +1 -1
  18. package/dist/esm/components/element-controller.js +3 -0
  19. package/dist/esm/components/hydration.js +17 -0
  20. package/dist/esm/hydration/target-builder.js +22 -1
  21. package/dist/esm/templating/compiler.js +29 -11
  22. package/dist/esm/templating/html-binding-directive.js +59 -4
  23. package/dist/esm/templating/html-directive.js +7 -1
  24. package/dist/esm/templating/install-hydratable-view-templates.js +6 -0
  25. package/dist/esm/templating/markup.js +8 -0
  26. package/dist/esm/templating/template.js +19 -1
  27. package/dist/esm/templating/view.js +13 -0
  28. package/dist/esm/testing/models.js +58 -0
  29. package/dist/fast-element.api.json +20 -4
  30. package/dist/fast-element.debug.js +179 -227
  31. package/dist/fast-element.debug.min.js +2 -2
  32. package/dist/fast-element.js +179 -227
  33. package/dist/fast-element.min.js +2 -2
  34. package/dist/fast-element.untrimmed.d.ts +76 -6
  35. package/docs/api-report.api.md +3 -3
  36. package/package.json +7 -19
  37. package/playwright.config.ts +8 -0
  38. package/test/main.ts +95 -1
  39. package/tsconfig.api-extractor.json +6 -0
  40. package/.eslintrc.json +0 -19
  41. package/karma.conf.cjs +0 -148
package/test/main.ts CHANGED
@@ -1,10 +1,104 @@
1
+ import "../src/debug.js";
2
+
1
3
  export { customElement, FASTElement } from "../src/components/fast-element.js";
4
+ export {
5
+ attr,
6
+ AttributeConfiguration,
7
+ AttributeDefinition,
8
+ } from "../src/components/attributes.js";
9
+ export {
10
+ ElementController,
11
+ HydratableElementController,
12
+ AdoptedStyleSheetsStrategy,
13
+ StyleElementStrategy,
14
+ needsHydrationAttribute,
15
+ deferHydrationAttribute,
16
+ } from "../src/components/element-controller.js";
17
+ export { FASTElementDefinition } from "../src/components/fast-definitions.js";
18
+ export { HydrationMarkup } from "../src/components/hydration.js";
2
19
  export { Context } from "../src/context.js";
20
+ export {
21
+ Container,
22
+ ContainerConfiguration,
23
+ ContainerImpl,
24
+ DefaultResolver,
25
+ DI,
26
+ FactoryImpl,
27
+ all,
28
+ inject,
29
+ lazy,
30
+ optional,
31
+ Registration,
32
+ ResolverImpl,
33
+ ResolverStrategy,
34
+ singleton,
35
+ transient,
36
+ } from "../src/di/di.js";
3
37
  export { DOM, DOMAspect } from "../src/dom.js";
4
38
  export { DOMPolicy } from "../src/dom-policy.js";
5
- export { observable } from "../src/observation/observable.js";
39
+ export { Observable, observable, volatile } from "../src/observation/observable.js";
6
40
  export { Updates } from "../src/observation/update-queue.js";
41
+ export { css } from "../src/styles/css.js";
42
+ export { ElementStyles } from "../src/styles/element-styles.js";
7
43
  export { ref } from "../src/templating/ref.js";
8
44
  export { html } from "../src/templating/template.js";
9
45
  export { uniqueElementName } from "../src/testing/fixture.js";
46
+ export { ChildModel, DerivedModel, Model } from "../src/testing/models.js";
47
+ export { Fake } from "../src/testing/fakes.js";
10
48
  export { composedContains, composedParent } from "../src/utilities.js";
49
+ export const conditionalTimeout = function (
50
+ condition: boolean,
51
+ iteration = 0
52
+ ): Promise<boolean> {
53
+ return new Promise(function (resolve) {
54
+ setTimeout(() => {
55
+ if (iteration === 10 || condition) {
56
+ resolve(true);
57
+ }
58
+
59
+ conditionalTimeout(condition, iteration + 1);
60
+ }, 5);
61
+ });
62
+ };
63
+ export { ArrayObserver, lengthOf, Splice } from "../src/observation/arrays.js";
64
+ export { ownedState, reactive, state, watch } from "../src/state/exports.js";
65
+ export { fixture } from "../src/testing/fixture.js";
66
+ export { CSSBindingDirective } from "../src/styles/css-binding-directive.js";
67
+ export { cssDirective, CSSDirective } from "../src/styles/css-directive.js";
68
+ export { ExecutionContext } from "../src/observation/observable.js";
69
+ export { Binding } from "../src/binding/binding.js";
70
+ export { oneTime } from "../src/binding/one-time.js";
71
+ export { oneWay, listener } from "../src/binding/one-way.js";
72
+ export { Signal, signal } from "../src/binding/signal.js";
73
+ export { twoWay } from "../src/binding/two-way.js";
74
+ export { HTMLBindingDirective } from "../src/templating/html-binding-directive.js";
75
+ export { ViewTemplate } from "../src/templating/template.js";
76
+ export { HTMLView } from "../src/templating/view.js";
77
+ export { HTMLDirective, htmlDirective } from "../src/templating/html-directive.js";
78
+ export { nextId } from "../src/templating/markup.js";
79
+ export { createTrackableDOMPolicy, toHTML } from "../src/__test__/helpers.js";
80
+ export { children, ChildrenDirective } from "../src/templating/children.js";
81
+ export { elements } from "../src/templating/node-observation.js";
82
+ export { Compiler } from "../src/templating/compiler.js";
83
+ export { Markup, Parser } from "../src/templating/markup.js";
84
+ export { when } from "../src/templating/when.js";
85
+ export {
86
+ render,
87
+ RenderBehavior,
88
+ RenderDirective,
89
+ RenderInstruction,
90
+ NodeTemplate,
91
+ renderWith,
92
+ } from "../src/templating/render.js";
93
+ export { repeat, RepeatBehavior, RepeatDirective } from "../src/templating/repeat.js";
94
+ export { slotted, SlottedDirective } from "../src/templating/slotted.js";
95
+ export { isString } from "../src/interfaces.js";
96
+ export { FAST, emptyArray } from "../src/platform.js";
97
+ export { Metadata } from "../src/metadata.js";
98
+ export function removeWhitespace(str: string): string {
99
+ return str
100
+ .trim()
101
+ .split("\n")
102
+ .map(s => s.trim())
103
+ .join("");
104
+ }
@@ -0,0 +1,6 @@
1
+ {
2
+ "extends": "./tsconfig.json",
3
+ "compilerOptions": {
4
+ "types": []
5
+ }
6
+ }
package/.eslintrc.json DELETED
@@ -1,19 +0,0 @@
1
- {
2
- "extends": ["../../.eslintrc.js"],
3
- "rules": {
4
- "max-classes-per-file": "off",
5
- "no-case-declarations": "off",
6
- "@typescript-eslint/no-non-null-assertion": "off",
7
- "@typescript-eslint/ban-types": [
8
- "error",
9
- {
10
- "types": {
11
- "{}": false,
12
- "Function": false,
13
- "Object": false
14
- },
15
- "extendDefaults": true
16
- }
17
- ]
18
- }
19
- }
package/karma.conf.cjs DELETED
@@ -1,148 +0,0 @@
1
- const path = require("path");
2
- const basePath = path.resolve(__dirname);
3
-
4
- const commonChromeFlags = [
5
- "--no-default-browser-check",
6
- "--no-first-run",
7
- "--no-sandbox",
8
- "--no-managed-user-acknowledgment-check",
9
- "--disable-background-timer-throttling",
10
- "--disable-backing-store-limit",
11
- "--disable-boot-animation",
12
- "--disable-cloud-import",
13
- "--disable-contextual-search",
14
- "--disable-default-apps",
15
- "--disable-extensions",
16
- "--disable-infobars",
17
- "--disable-translate",
18
- ];
19
-
20
- module.exports = function (config) {
21
- let browsers;
22
- if (process.env.BROWSERS) {
23
- browsers = [process.env.BROWSERS];
24
- } else if (config.browsers) {
25
- browsers = config.browsers;
26
- } else {
27
- browsers = ["Chrome"];
28
- }
29
-
30
- const setup = "setup-browser" + (config.package ? "-" + config.package : "");
31
- const options = {
32
- basePath,
33
- browserDisconnectTimeout: 10000,
34
- processKillTimeout: 10000,
35
- frameworks: ["source-map-support", "mocha"],
36
- plugins: [
37
- require("karma-mocha"),
38
- require("karma-mocha-reporter"),
39
- require("karma-webpack"),
40
- require("karma-source-map-support"),
41
- require("karma-sourcemap-loader"),
42
- require("karma-coverage"),
43
- require("karma-chrome-launcher"),
44
- require("karma-firefox-launcher"),
45
- ],
46
- files: [`src/__test__/${setup}.cjs`],
47
- preprocessors: {
48
- [`src/__test__/${setup}.cjs`]: ["webpack", "sourcemap"],
49
- },
50
- webpackMiddleware: {
51
- // webpack-dev-middleware configuration
52
- // i. e.
53
- stats: "errors-only",
54
- },
55
- webpack: {
56
- mode: "development",
57
- resolve: {
58
- extensions: [".js"],
59
- modules: ["dist", "node_modules"],
60
- mainFields: ["module", "main"],
61
- },
62
- devtool: "inline-source-map",
63
- performance: {
64
- hints: false,
65
- },
66
- optimization: {
67
- usedExports: true,
68
- flagIncludedChunks: false,
69
- sideEffects: true,
70
- concatenateModules: true,
71
- splitChunks: {
72
- name: false,
73
- },
74
- runtimeChunk: false,
75
- noEmitOnErrors: false,
76
- checkWasmTypes: false,
77
- minimize: false,
78
- },
79
- module: {
80
- rules: [
81
- {
82
- test: /\.js\.map$/,
83
- use: ["ignore-loader"],
84
- },
85
- {
86
- test: /\.js$/,
87
- use: ["source-map-loader"],
88
- enforce: "pre",
89
- },
90
- ],
91
- },
92
- },
93
- mime: {
94
- "text/x-typescript": ["ts"],
95
- },
96
- reporters: [config.reporter || (process.env.CI ? "min" : "progress")],
97
- browsers: browsers,
98
- customLaunchers: {
99
- ChromeDebugging: {
100
- base: "Chrome",
101
- flags: [...commonChromeFlags, "--remote-debugging-port=9333"],
102
- debug: true,
103
- },
104
- ChromeHeadlessOpt: {
105
- base: "ChromeHeadless",
106
- flags: [...commonChromeFlags],
107
- },
108
- },
109
- client: {
110
- captureConsole: true,
111
- mocha: {
112
- bail: config["bail"],
113
- ui: "bdd",
114
- timeout: 5000,
115
- },
116
- },
117
- logLevel: config.LOG_ERROR, // to disable the WARN 404 for image requests,
118
- };
119
-
120
- if (config.coverage) {
121
- options.webpack.module.rules.push({
122
- enforce: "post",
123
- exclude: /(__tests__|testing|node_modules|\.spec\.[tj]s$)/,
124
- loader: '@jsdevtools/coverage-istanbul-loader',
125
- options: { esModules: true },
126
- test: /\.[tj]s$/,
127
- });
128
- options.reporters = ["coverage", ...options.reporters];
129
- options.coverageReporter = {
130
- dir: path.join(basePath, "coverage"),
131
- reporters: [
132
- { type: "html", subdir: "html" },
133
- { type: "text-summary" },
134
- { type: "json", subdir: ".", file: "coverage.json" },
135
- { type: "lcovonly", subdir: ".", file: "lcov.info" },
136
- { type: "cobertura", subdir: ".", file: "cobertura-coverage.xml" },
137
- ],
138
- fixWebpackSourcePaths: true,
139
- };
140
- options.junitReporter = {
141
- outputDir: "coverage",
142
- outputFile: "test-results.xml",
143
- useBrowserName: false,
144
- };
145
- }
146
-
147
- config.set(options);
148
- };