@fluentui/web-components 3.1.1 → 3.1.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/CHANGELOG.md +11 -2
- package/custom-elements.json +20 -20
- package/dist/esm/theme/set-theme.js +13 -5
- package/dist/esm/theme/set-theme.js.map +1 -1
- package/dist/web-components-all.js +16 -5
- package/dist/web-components-all.min.js +6 -6
- package/dist/web-components.js +16 -5
- package/dist/web-components.min.js +6 -6
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,12 +1,21 @@
|
|
|
1
1
|
# Change Log - @fluentui/web-components
|
|
2
2
|
|
|
3
|
-
<!-- This log was last generated on
|
|
3
|
+
<!-- This log was last generated on Fri, 21 Aug 2026 04:08:29 GMT and should not be manually modified. -->
|
|
4
4
|
|
|
5
5
|
<!-- Start content -->
|
|
6
6
|
|
|
7
|
+
## [3.1.2](https://github.com/microsoft/fluentui/tree/@fluentui/web-components_v3.1.2)
|
|
8
|
+
|
|
9
|
+
Fri, 21 Aug 2026 04:08:29 GMT
|
|
10
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/web-components_v3.1.1..@fluentui/web-components_v3.1.2)
|
|
11
|
+
|
|
12
|
+
### Patches
|
|
13
|
+
|
|
14
|
+
- fix(web-components): prevent unsafe theme token values from injecting CSS ([PR #36600](https://github.com/microsoft/fluentui/pull/36600) by machi@microsoft.com)
|
|
15
|
+
|
|
7
16
|
## [3.1.1](https://github.com/microsoft/fluentui/tree/@fluentui/web-components_v3.1.1)
|
|
8
17
|
|
|
9
|
-
Wed, 19 Aug 2026 04:08:
|
|
18
|
+
Wed, 19 Aug 2026 04:08:27 GMT
|
|
10
19
|
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/web-components_v3.1.0..@fluentui/web-components_v3.1.1)
|
|
11
20
|
|
|
12
21
|
### Patches
|
package/custom-elements.json
CHANGED
|
@@ -28281,7 +28281,7 @@
|
|
|
28281
28281
|
},
|
|
28282
28282
|
{
|
|
28283
28283
|
"kind": "javascript-module",
|
|
28284
|
-
"path": "src/accordion
|
|
28284
|
+
"path": "src/accordion/accordion.definition-async.ts",
|
|
28285
28285
|
"declarations": [
|
|
28286
28286
|
{
|
|
28287
28287
|
"kind": "variable",
|
|
@@ -28290,7 +28290,7 @@
|
|
|
28290
28290
|
"text": "PartialFASTElementDefinition"
|
|
28291
28291
|
},
|
|
28292
28292
|
"default": "{ name: tagName, registry: FluentDesignSystem.registry, template: declarativeTemplate(), }",
|
|
28293
|
-
"description": "The async definition configuration for the `<fluent-accordion
|
|
28293
|
+
"description": "The async definition configuration for the `<fluent-accordion>` element.",
|
|
28294
28294
|
"privacy": "public"
|
|
28295
28295
|
}
|
|
28296
28296
|
],
|
|
@@ -28300,20 +28300,20 @@
|
|
|
28300
28300
|
"name": "declarativeDefinition",
|
|
28301
28301
|
"declaration": {
|
|
28302
28302
|
"name": "declarativeDefinition",
|
|
28303
|
-
"module": "src/accordion
|
|
28303
|
+
"module": "src/accordion/accordion.definition-async.ts"
|
|
28304
28304
|
}
|
|
28305
28305
|
}
|
|
28306
28306
|
]
|
|
28307
28307
|
},
|
|
28308
28308
|
{
|
|
28309
28309
|
"kind": "javascript-module",
|
|
28310
|
-
"path": "src/accordion
|
|
28310
|
+
"path": "src/accordion/define-async.ts",
|
|
28311
28311
|
"declarations": [],
|
|
28312
28312
|
"exports": []
|
|
28313
28313
|
},
|
|
28314
28314
|
{
|
|
28315
28315
|
"kind": "javascript-module",
|
|
28316
|
-
"path": "src/accordion/accordion.definition-async.ts",
|
|
28316
|
+
"path": "src/accordion-item/accordion-item.definition-async.ts",
|
|
28317
28317
|
"declarations": [
|
|
28318
28318
|
{
|
|
28319
28319
|
"kind": "variable",
|
|
@@ -28322,7 +28322,7 @@
|
|
|
28322
28322
|
"text": "PartialFASTElementDefinition"
|
|
28323
28323
|
},
|
|
28324
28324
|
"default": "{ name: tagName, registry: FluentDesignSystem.registry, template: declarativeTemplate(), }",
|
|
28325
|
-
"description": "The async definition configuration for the `<fluent-accordion>` element.",
|
|
28325
|
+
"description": "The async definition configuration for the `<fluent-accordion-item>` element.",
|
|
28326
28326
|
"privacy": "public"
|
|
28327
28327
|
}
|
|
28328
28328
|
],
|
|
@@ -28332,20 +28332,20 @@
|
|
|
28332
28332
|
"name": "declarativeDefinition",
|
|
28333
28333
|
"declaration": {
|
|
28334
28334
|
"name": "declarativeDefinition",
|
|
28335
|
-
"module": "src/accordion/accordion.definition-async.ts"
|
|
28335
|
+
"module": "src/accordion-item/accordion-item.definition-async.ts"
|
|
28336
28336
|
}
|
|
28337
28337
|
}
|
|
28338
28338
|
]
|
|
28339
28339
|
},
|
|
28340
28340
|
{
|
|
28341
28341
|
"kind": "javascript-module",
|
|
28342
|
-
"path": "src/accordion/define-async.ts",
|
|
28342
|
+
"path": "src/accordion-item/define-async.ts",
|
|
28343
28343
|
"declarations": [],
|
|
28344
28344
|
"exports": []
|
|
28345
28345
|
},
|
|
28346
28346
|
{
|
|
28347
28347
|
"kind": "javascript-module",
|
|
28348
|
-
"path": "src/
|
|
28348
|
+
"path": "src/anchor-button/anchor-button.definition-async.ts",
|
|
28349
28349
|
"declarations": [
|
|
28350
28350
|
{
|
|
28351
28351
|
"kind": "variable",
|
|
@@ -28354,7 +28354,7 @@
|
|
|
28354
28354
|
"text": "PartialFASTElementDefinition"
|
|
28355
28355
|
},
|
|
28356
28356
|
"default": "{ name: tagName, registry: FluentDesignSystem.registry, template: declarativeTemplate(), }",
|
|
28357
|
-
"description": "The async definition configuration for the `<fluent-
|
|
28357
|
+
"description": "The async definition configuration for the `<fluent-anchor-button>` element.",
|
|
28358
28358
|
"privacy": "public"
|
|
28359
28359
|
}
|
|
28360
28360
|
],
|
|
@@ -28364,14 +28364,14 @@
|
|
|
28364
28364
|
"name": "declarativeDefinition",
|
|
28365
28365
|
"declaration": {
|
|
28366
28366
|
"name": "declarativeDefinition",
|
|
28367
|
-
"module": "src/
|
|
28367
|
+
"module": "src/anchor-button/anchor-button.definition-async.ts"
|
|
28368
28368
|
}
|
|
28369
28369
|
}
|
|
28370
28370
|
]
|
|
28371
28371
|
},
|
|
28372
28372
|
{
|
|
28373
28373
|
"kind": "javascript-module",
|
|
28374
|
-
"path": "src/
|
|
28374
|
+
"path": "src/anchor-button/define-async.ts",
|
|
28375
28375
|
"declarations": [],
|
|
28376
28376
|
"exports": []
|
|
28377
28377
|
},
|
|
@@ -28409,7 +28409,7 @@
|
|
|
28409
28409
|
},
|
|
28410
28410
|
{
|
|
28411
28411
|
"kind": "javascript-module",
|
|
28412
|
-
"path": "src/
|
|
28412
|
+
"path": "src/avatar/avatar.definition-async.ts",
|
|
28413
28413
|
"declarations": [
|
|
28414
28414
|
{
|
|
28415
28415
|
"kind": "variable",
|
|
@@ -28418,7 +28418,7 @@
|
|
|
28418
28418
|
"text": "PartialFASTElementDefinition"
|
|
28419
28419
|
},
|
|
28420
28420
|
"default": "{ name: tagName, registry: FluentDesignSystem.registry, template: declarativeTemplate(), }",
|
|
28421
|
-
"description": "The async definition configuration for the `<fluent-
|
|
28421
|
+
"description": "The async definition configuration for the `<fluent-avatar>` element.",
|
|
28422
28422
|
"privacy": "public"
|
|
28423
28423
|
}
|
|
28424
28424
|
],
|
|
@@ -28428,20 +28428,20 @@
|
|
|
28428
28428
|
"name": "declarativeDefinition",
|
|
28429
28429
|
"declaration": {
|
|
28430
28430
|
"name": "declarativeDefinition",
|
|
28431
|
-
"module": "src/
|
|
28431
|
+
"module": "src/avatar/avatar.definition-async.ts"
|
|
28432
28432
|
}
|
|
28433
28433
|
}
|
|
28434
28434
|
]
|
|
28435
28435
|
},
|
|
28436
28436
|
{
|
|
28437
28437
|
"kind": "javascript-module",
|
|
28438
|
-
"path": "src/
|
|
28438
|
+
"path": "src/avatar/define-async.ts",
|
|
28439
28439
|
"declarations": [],
|
|
28440
28440
|
"exports": []
|
|
28441
28441
|
},
|
|
28442
28442
|
{
|
|
28443
28443
|
"kind": "javascript-module",
|
|
28444
|
-
"path": "src/
|
|
28444
|
+
"path": "src/button/button.definition-async.ts",
|
|
28445
28445
|
"declarations": [
|
|
28446
28446
|
{
|
|
28447
28447
|
"kind": "variable",
|
|
@@ -28450,7 +28450,7 @@
|
|
|
28450
28450
|
"text": "PartialFASTElementDefinition"
|
|
28451
28451
|
},
|
|
28452
28452
|
"default": "{ name: tagName, registry: FluentDesignSystem.registry, template: declarativeTemplate(), }",
|
|
28453
|
-
"description": "The async definition configuration for the `<fluent-
|
|
28453
|
+
"description": "The async definition configuration for the `<fluent-button>` element.",
|
|
28454
28454
|
"privacy": "public"
|
|
28455
28455
|
}
|
|
28456
28456
|
],
|
|
@@ -28460,14 +28460,14 @@
|
|
|
28460
28460
|
"name": "declarativeDefinition",
|
|
28461
28461
|
"declaration": {
|
|
28462
28462
|
"name": "declarativeDefinition",
|
|
28463
|
-
"module": "src/
|
|
28463
|
+
"module": "src/button/button.definition-async.ts"
|
|
28464
28464
|
}
|
|
28465
28465
|
}
|
|
28466
28466
|
]
|
|
28467
28467
|
},
|
|
28468
28468
|
{
|
|
28469
28469
|
"kind": "javascript-module",
|
|
28470
|
-
"path": "src/
|
|
28470
|
+
"path": "src/button/define-async.ts",
|
|
28471
28471
|
"declarations": [],
|
|
28472
28472
|
"exports": []
|
|
28473
28473
|
},
|
|
@@ -52,13 +52,21 @@ export function setTheme(theme, node = document) {
|
|
|
52
52
|
setLocalTheme(theme, node);
|
|
53
53
|
}
|
|
54
54
|
}
|
|
55
|
+
const TOKEN_NAME_REGEX = /^[a-zA-Z_-][a-zA-Z0-9_-]*$/;
|
|
56
|
+
function sanitizeTokenName(name) {
|
|
57
|
+
return TOKEN_NAME_REGEX.test(name) ? name : '';
|
|
58
|
+
}
|
|
59
|
+
const TOKEN_VALUE_BLOCK_REGEX = /(;|{|}|\/\*|\*\/|@import|url\s*\(|expression\s*\(|javascript:)/i;
|
|
60
|
+
function sanitizeTokenValue(value) {
|
|
61
|
+
return TOKEN_VALUE_BLOCK_REGEX.test(value) ? '' : value;
|
|
62
|
+
}
|
|
55
63
|
function getThemeStyleText(theme) {
|
|
56
64
|
if (!themeStyleTextMap.has(theme)) {
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
65
|
+
themeStyleTextMap.set(theme, Object.keys(theme).reduce((acc, token) => {
|
|
66
|
+
const tokenName = sanitizeTokenName(token);
|
|
67
|
+
const tokenValue = sanitizeTokenValue(theme[token].toString());
|
|
68
|
+
return tokenName && tokenValue ? `${acc}--${tokenName}:${tokenValue};` : acc;
|
|
69
|
+
}, ''));
|
|
62
70
|
}
|
|
63
71
|
return themeStyleTextMap.get(theme);
|
|
64
72
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"set-theme.js","sourceRoot":"","sources":["../../../src/theme/set-theme.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAClD,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AASjD,MAAM,6BAA6B,GAAG,oBAAoB,IAAI,QAAQ,CAAC;AACvE,MAAM,kBAAkB,GAAG,cAAc,IAAI,MAAM,CAAC;AAEpD,gFAAgF;AAChF,8EAA8E;AAC9E,yCAAyC;AACzC,MAAM,iBAAiB,GAAG,IAAI,GAAG,EAAiB,CAAC;AAEnD,6EAA6E;AAC7E,sEAAsE;AACtE,8BAA8B;AAC9B,MAAM,iBAAiB,GAAG,IAAI,GAAG,EAAiB,CAAC;AAEnD,0EAA0E;AAC1E,0CAA0C;AAC1C,MAAM,0BAA0B,GAAG,IAAI,GAAG,EAA8B,CAAC;AAEzE,iEAAiE;AACjE,+DAA+D;AAC/D,MAAM,eAAe,GAAG,IAAI,GAAG,EAAsB,CAAC;AAEtD,MAAM,qBAAqB,GAAG,IAAI,aAAa,EAAE,CAAC;AAElD;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,UAAU,QAAQ,CAAC,KAAmB,EAA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AK,SAAS,EAAE,CAAC,CAAC;QACjD,CAAC;aAAM,CAAC;YACN,OAAO,CAAC,KAAK,CAAC,WAAW,CAAC,KAAK,SAAS,EAAE,EAAE,UAAU,CAAC,QAAQ,EAAE,CAAC,CAAC;QACrE,CAAC;IACH,CAAC;AACH,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,EAAE,SAAS,EAAE,EAAE,EAAE,GAAG,SAAS,CAAC;AACpC,MAAM,QAAQ,GAAG,2BAA2B,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AACtD,SAAS,YAAY,CAAC,OAAoB;IACxC,IAAI,CAAC,QAAQ,EAAE,CAAC;QACd,OAAO;IACT,CAAC;IAED,MAAM,IAAI,GAAG,YAAY,CAAC;IAC1B,MAAM,SAAS,GAAG,QAAQ,CAAC;IAC3B,MAAM,YAAY,GAAG,OAAO,CAAC,KAAK,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC;IAE1D,OAAO,CAAC,KAAK,CAAC,WAAW,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;IAE3C,OAAO,CAAC,OAAO,EAAE,CAAC;IAElB,OAAO,CAAC,KAAK,CAAC,WAAW,CAAC,IAAI,EAAE,YAAY,CAAC,CAAC;AAChD,CAAC"}
|
|
@@ -14890,13 +14890,24 @@ function setTheme(theme, node = document) {
|
|
|
14890
14890
|
setLocalTheme(theme, node);
|
|
14891
14891
|
}
|
|
14892
14892
|
}
|
|
14893
|
+
const TOKEN_NAME_REGEX = /^[a-zA-Z_-][a-zA-Z0-9_-]*$/;
|
|
14894
|
+
function sanitizeTokenName(name) {
|
|
14895
|
+
return TOKEN_NAME_REGEX.test(name) ? name : "";
|
|
14896
|
+
}
|
|
14897
|
+
const TOKEN_VALUE_BLOCK_REGEX = /(;|{|}|\/\*|\*\/|@import|url\s*\(|expression\s*\(|javascript:)/i;
|
|
14898
|
+
function sanitizeTokenValue(value) {
|
|
14899
|
+
return TOKEN_VALUE_BLOCK_REGEX.test(value) ? "" : value;
|
|
14900
|
+
}
|
|
14893
14901
|
function getThemeStyleText(theme) {
|
|
14894
14902
|
if (!themeStyleTextMap.has(theme)) {
|
|
14895
|
-
|
|
14896
|
-
|
|
14897
|
-
|
|
14898
|
-
|
|
14899
|
-
|
|
14903
|
+
themeStyleTextMap.set(
|
|
14904
|
+
theme,
|
|
14905
|
+
Object.keys(theme).reduce((acc, token) => {
|
|
14906
|
+
const tokenName = sanitizeTokenName(token);
|
|
14907
|
+
const tokenValue = sanitizeTokenValue(theme[token].toString());
|
|
14908
|
+
return tokenName && tokenValue ? `${acc}--${tokenName}:${tokenValue};` : acc;
|
|
14909
|
+
}, "")
|
|
14910
|
+
);
|
|
14900
14911
|
}
|
|
14901
14912
|
return themeStyleTextMap.get(theme);
|
|
14902
14913
|
}
|