@fluentui/web-components 2.4.0 → 2.5.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.json +61 -1
- package/CHANGELOG.md +29 -2
- package/dist/dts/_docs/design-system/color-explorer/app.d.ts +25 -0
- package/dist/dts/_docs/design-system/color-explorer/colors.d.ts +13 -0
- package/dist/dts/_docs/design-system/color-explorer/component-types.d.ts +6 -0
- package/dist/dts/_docs/design-system/color-explorer/components/color-block.d.ts +10 -0
- package/dist/dts/_docs/design-system/color-explorer/components/color-picker/color-picker.d.ts +190 -0
- package/dist/dts/_docs/design-system/color-explorer/components/color-picker/color-picker.form-associated.d.ts +15 -0
- package/dist/dts/_docs/design-system/color-explorer/components/color-picker/color-picker.styles.d.ts +3 -0
- package/dist/dts/_docs/design-system/color-explorer/components/color-picker/color-picker.template.d.ts +8 -0
- package/dist/dts/_docs/design-system/color-explorer/components/color-picker/index.d.ts +9 -0
- package/dist/dts/_docs/design-system/color-explorer/components/control-pane/control-pane.d.ts +8 -0
- package/dist/dts/_docs/design-system/color-explorer/components/control-pane/control-pane.styles.d.ts +1 -0
- package/dist/dts/_docs/design-system/color-explorer/components/control-pane/control-pane.template.d.ts +2 -0
- package/dist/dts/_docs/design-system/color-explorer/components/control-pane/index.d.ts +6 -0
- package/dist/dts/_docs/design-system/color-explorer/components/gradient/gradient.d.ts +5 -0
- package/dist/dts/_docs/design-system/color-explorer/components/gradient/gradient.styles.d.ts +1 -0
- package/dist/dts/_docs/design-system/color-explorer/components/gradient/gradient.template.d.ts +2 -0
- package/dist/dts/_docs/design-system/color-explorer/components/gradient/index.d.ts +6 -0
- package/dist/dts/_docs/design-system/color-explorer/components/layer-background/index.d.ts +21 -0
- package/dist/dts/_docs/design-system/color-explorer/components/sample-app/index.d.ts +6 -0
- package/dist/dts/_docs/design-system/color-explorer/components/sample-app/sample-app.d.ts +3 -0
- package/dist/dts/_docs/design-system/color-explorer/components/sample-app/sample-app.styles.d.ts +1 -0
- package/dist/dts/_docs/design-system/color-explorer/components/sample-app/sample-app.template.d.ts +1 -0
- package/dist/dts/_docs/design-system/color-explorer/components/sample-page/index.d.ts +6 -0
- package/dist/dts/_docs/design-system/color-explorer/components/sample-page/sample-page.d.ts +3 -0
- package/dist/dts/_docs/design-system/color-explorer/components/sample-page/sample-page.styles.d.ts +1 -0
- package/dist/dts/_docs/design-system/color-explorer/components/sample-page/sample-page.template.d.ts +1 -0
- package/dist/dts/_docs/design-system/color-explorer/components/swatch.d.ts +30 -0
- package/dist/dts/_docs/design-system/color-explorer/custom-elements.d.ts +7 -0
- package/dist/dts/_docs/design-system/color-explorer/index.d.ts +2 -0
- package/dist/dts/design-tokens.d.ts +20 -0
- package/dist/dts/styles/patterns/index.d.ts +1 -0
- package/dist/dts/styles/patterns/type-ramp.d.ts +18 -0
- package/dist/dts/utilities/type-ramp.d.ts +12 -0
- package/dist/esm/_docs/design-system/color-explorer/app.js +247 -0
- package/dist/esm/_docs/design-system/color-explorer/colors.js +24 -0
- package/dist/esm/_docs/design-system/color-explorer/component-types.js +7 -0
- package/dist/esm/_docs/design-system/color-explorer/components/color-block.js +408 -0
- package/dist/esm/_docs/design-system/color-explorer/components/color-picker/color-picker.form-associated.js +16 -0
- package/dist/esm/_docs/design-system/color-explorer/components/color-picker/color-picker.js +297 -0
- package/dist/esm/_docs/design-system/color-explorer/components/color-picker/color-picker.styles.js +124 -0
- package/dist/esm/_docs/design-system/color-explorer/components/color-picker/color-picker.template.js +130 -0
- package/dist/esm/_docs/design-system/color-explorer/components/color-picker/index.js +15 -0
- package/dist/esm/_docs/design-system/color-explorer/components/control-pane/control-pane.js +24 -0
- package/dist/esm/_docs/design-system/color-explorer/components/control-pane/control-pane.styles.js +19 -0
- package/dist/esm/_docs/design-system/color-explorer/components/control-pane/control-pane.template.js +52 -0
- package/dist/esm/_docs/design-system/color-explorer/components/control-pane/index.js +18 -0
- package/dist/esm/_docs/design-system/color-explorer/components/gradient/gradient.js +11 -0
- package/dist/esm/_docs/design-system/color-explorer/components/gradient/gradient.styles.js +31 -0
- package/dist/esm/_docs/design-system/color-explorer/components/gradient/gradient.template.js +21 -0
- package/dist/esm/_docs/design-system/color-explorer/components/gradient/index.js +18 -0
- package/dist/esm/_docs/design-system/color-explorer/components/layer-background/index.js +70 -0
- package/dist/esm/_docs/design-system/color-explorer/components/sample-app/index.js +18 -0
- package/dist/esm/_docs/design-system/color-explorer/components/sample-app/sample-app.js +3 -0
- package/dist/esm/_docs/design-system/color-explorer/components/sample-app/sample-app.styles.js +166 -0
- package/dist/esm/_docs/design-system/color-explorer/components/sample-app/sample-app.template.js +97 -0
- package/dist/esm/_docs/design-system/color-explorer/components/sample-page/index.js +18 -0
- package/dist/esm/_docs/design-system/color-explorer/components/sample-page/sample-page.js +3 -0
- package/dist/esm/_docs/design-system/color-explorer/components/sample-page/sample-page.styles.js +130 -0
- package/dist/esm/_docs/design-system/color-explorer/components/sample-page/sample-page.template.js +82 -0
- package/dist/esm/_docs/design-system/color-explorer/components/swatch.js +163 -0
- package/dist/esm/_docs/design-system/color-explorer/custom-elements.js +3 -0
- package/dist/esm/_docs/design-system/color-explorer/index.js +14 -0
- package/dist/esm/accordion/accordion-item/accordion-item.styles.js +4 -5
- package/dist/esm/accordion/accordion.styles.js +3 -4
- package/dist/esm/badge/badge.styles.js +3 -4
- package/dist/esm/breadcrumb/breadcrumb.styles.js +2 -4
- package/dist/esm/breadcrumb-item/breadcrumb-item.styles.js +3 -4
- package/dist/esm/calendar/calendar.styles.js +3 -4
- package/dist/esm/checkbox/checkbox.styles.js +3 -4
- package/dist/esm/combobox/combobox.styles.js +3 -3
- package/dist/esm/data-grid/data-grid-cell.styles.js +3 -5
- package/dist/esm/design-tokens.js +38 -1
- package/dist/esm/listbox-option/listbox-option.styles.js +3 -4
- package/dist/esm/menu-item/menu-item.styles.js +3 -4
- package/dist/esm/radio/radio.styles.js +3 -4
- package/dist/esm/search/search.styles.js +3 -4
- package/dist/esm/select/select.styles.js +3 -4
- package/dist/esm/slider-label/slider-label.styles.js +3 -2
- package/dist/esm/styles/patterns/button.styles.js +3 -4
- package/dist/esm/styles/patterns/index.js +1 -0
- package/dist/esm/styles/patterns/input.styles.js +4 -6
- package/dist/esm/styles/patterns/type-ramp.js +74 -0
- package/dist/esm/switch/switch.styles.js +4 -5
- package/dist/esm/tabs/tab/tab.styles.js +3 -5
- package/dist/esm/tabs/tab-panel/tab-panel.styles.js +3 -5
- package/dist/esm/tabs/tabs.styles.js +3 -4
- package/dist/esm/tooltip/tooltip.styles.js +3 -4
- package/dist/esm/tree-item/tree-item.styles.js +3 -4
- package/dist/esm/utilities/type-ramp.js +12 -0
- package/dist/fluent-web-components.api.json +534 -0
- package/dist/web-components.d.ts +57 -0
- package/dist/web-components.js +191 -28
- package/dist/web-components.min.js +211 -139
- package/docs/api-report.md +57 -0
- package/package.json +2 -2
- package/public/SegoeUI-VF.ttf +0 -0
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/** @public */
|
|
2
|
+
export declare const StandardFontWeight: {
|
|
3
|
+
readonly Thin: 100;
|
|
4
|
+
readonly ExtraLight: 200;
|
|
5
|
+
readonly Light: 300;
|
|
6
|
+
readonly Normal: 400;
|
|
7
|
+
readonly Medium: 500;
|
|
8
|
+
readonly SemiBold: 600;
|
|
9
|
+
readonly Bold: 700;
|
|
10
|
+
readonly ExtraBold: 800;
|
|
11
|
+
readonly Black: 900;
|
|
12
|
+
};
|
|
@@ -0,0 +1,247 @@
|
|
|
1
|
+
import { __decorate } from "tslib";
|
|
2
|
+
import { parseColorHexRGB } from '@microsoft/fast-colors';
|
|
3
|
+
import { attr, css, customElement, FASTElement, html, observable, ref, repeat, when } from '@microsoft/fast-element';
|
|
4
|
+
import { accentBaseColor, baseLayerLuminance, neutralBaseColor, neutralLayer1Recipe, neutralLayer2Recipe, neutralLayer3Recipe, neutralLayer4Recipe, neutralLayerCardContainerRecipe, neutralLayerFloatingRecipe, PaletteRGB, StandardLuminance, SwatchRGB, } from '../../../index-rollup';
|
|
5
|
+
import { ComponentTypes } from './component-types';
|
|
6
|
+
import { AppColorBlock } from './components/color-block';
|
|
7
|
+
import { AppControlPane } from './components/control-pane';
|
|
8
|
+
import { AppGradient } from './components/gradient';
|
|
9
|
+
import { AppSampleApp } from './components/sample-app';
|
|
10
|
+
AppColorBlock;
|
|
11
|
+
AppControlPane;
|
|
12
|
+
AppGradient;
|
|
13
|
+
AppSampleApp;
|
|
14
|
+
const sampleTemplate = html `
|
|
15
|
+
<fluent-design-system-provider
|
|
16
|
+
neutral-color="${x => x.neutralColor}"
|
|
17
|
+
accent-color="${x => x.accentColor}"
|
|
18
|
+
style="display: flex; align-items: stretch; align-content: stretch; justify-content: center; flex-grow: 1;"
|
|
19
|
+
>
|
|
20
|
+
<app-layer-background
|
|
21
|
+
id="light-mode"
|
|
22
|
+
base-layer-luminance="${StandardLuminance.LightMode}"
|
|
23
|
+
background-layer-recipe="L4"
|
|
24
|
+
style="flex-grow: 1; padding: 100px;"
|
|
25
|
+
>
|
|
26
|
+
<app-sample-app></app-sample-app>
|
|
27
|
+
</app-layer-background>
|
|
28
|
+
<app-layer-background
|
|
29
|
+
id="dark-mode"
|
|
30
|
+
base-layer-luminance="${StandardLuminance.DarkMode}"
|
|
31
|
+
background-layer-recipe="L4"
|
|
32
|
+
style="flex-grow: 1; padding: 100px;"
|
|
33
|
+
>
|
|
34
|
+
<app-sample-app></app-sample-app>
|
|
35
|
+
</app-layer-background>
|
|
36
|
+
</fluent-design-system-provider>
|
|
37
|
+
`;
|
|
38
|
+
const colorBlockTemplate = html `
|
|
39
|
+
${repeat(x => x.backgrounds(), html `
|
|
40
|
+
<app-color-block
|
|
41
|
+
id="${x => x.color.toUpperCase().replace('#', '')}"
|
|
42
|
+
index="${(x, c) => x.index}"
|
|
43
|
+
component="${(x, c) => c.parent.componentType}"
|
|
44
|
+
color="${x => x.color}"
|
|
45
|
+
layer-name="${x => x.title}"
|
|
46
|
+
></app-color-block>
|
|
47
|
+
`)}
|
|
48
|
+
`;
|
|
49
|
+
const template = html `
|
|
50
|
+
<div class="container fill">
|
|
51
|
+
<div class="row fill">
|
|
52
|
+
<div class="canvas" ${ref('canvasElement')}>
|
|
53
|
+
<div class="container fill">
|
|
54
|
+
<div class="row gradient">
|
|
55
|
+
<app-gradient :colors="${x => x.neutralPalette}" :markedColor="${x => x.neutralColor}"></app-gradient>
|
|
56
|
+
</div>
|
|
57
|
+
<div class="row gradient">
|
|
58
|
+
<app-gradient :colors="${x => x.accentPalette}" :markedColor="${x => x.accentColor}"></app-gradient>
|
|
59
|
+
</div>
|
|
60
|
+
<div class="row fill">
|
|
61
|
+
<div style="display: flex; overflow: auto;">
|
|
62
|
+
${when(x => x.componentType === ComponentTypes.sample, sampleTemplate)}
|
|
63
|
+
${when(x => x.componentType !== ComponentTypes.sample, colorBlockTemplate)}
|
|
64
|
+
</div>
|
|
65
|
+
</div>
|
|
66
|
+
</div>
|
|
67
|
+
</div>
|
|
68
|
+
<div>
|
|
69
|
+
<app-layer-background
|
|
70
|
+
id="control-pane"
|
|
71
|
+
class="control-pane-container"
|
|
72
|
+
base-layer-luminance="${StandardLuminance.DarkMode}"
|
|
73
|
+
background-layer-recipe="L2"
|
|
74
|
+
>
|
|
75
|
+
<app-control-pane
|
|
76
|
+
:componentType="${x => x.componentType}"
|
|
77
|
+
:neutralColor="${x => x.neutralColor}"
|
|
78
|
+
:accentColor="${x => x.accentColor}"
|
|
79
|
+
:showOnlyLayerBackgrounds="${x => x.showOnlyLayerBackgrounds}"
|
|
80
|
+
@formvaluechange="${(x, c) => x.controlPaneHandler(c.event)}"
|
|
81
|
+
></app-control-pane>
|
|
82
|
+
</app-layer-background>
|
|
83
|
+
</div>
|
|
84
|
+
</div>
|
|
85
|
+
</div>
|
|
86
|
+
`;
|
|
87
|
+
const styles = css `
|
|
88
|
+
:host {
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
.container {
|
|
92
|
+
display: flex;
|
|
93
|
+
flex-direction: column;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
.container.fill {
|
|
97
|
+
width: 100%;
|
|
98
|
+
height: 1200px;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
.row {
|
|
102
|
+
position: relative;
|
|
103
|
+
display: flex;
|
|
104
|
+
flex-direction: row;
|
|
105
|
+
flex-basis: auto;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
.row.fill {
|
|
109
|
+
flex: 1;
|
|
110
|
+
overflow: hidden;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
.canvas {
|
|
114
|
+
min-width: 300px;
|
|
115
|
+
flex-grow: 1;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
.gradient {
|
|
119
|
+
height: 20px;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
.control-pane-container {
|
|
123
|
+
height: 100%;
|
|
124
|
+
z-index: 1;
|
|
125
|
+
padding: 40px;
|
|
126
|
+
position: relative;
|
|
127
|
+
overflow: auto;
|
|
128
|
+
width: 310px;
|
|
129
|
+
box-sizing: border-box;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
app-color-block {
|
|
133
|
+
min-width: 400px;
|
|
134
|
+
}
|
|
135
|
+
`;
|
|
136
|
+
let App = class App extends FASTElement {
|
|
137
|
+
constructor() {
|
|
138
|
+
super(...arguments);
|
|
139
|
+
this.componentType = ComponentTypes.backplate;
|
|
140
|
+
this.neutralPalette = [];
|
|
141
|
+
this.accentPalette = [];
|
|
142
|
+
this.showOnlyLayerBackgrounds = true;
|
|
143
|
+
this.layerRecipes = [
|
|
144
|
+
[neutralLayerFloatingRecipe, 'neutralLayerFloating'],
|
|
145
|
+
[neutralLayerCardContainerRecipe, 'neutralLayerCardContainer'],
|
|
146
|
+
[neutralLayer1Recipe, 'neutralLayer1'],
|
|
147
|
+
[neutralLayer2Recipe, 'neutralLayer2'],
|
|
148
|
+
[neutralLayer3Recipe, 'neutralLayer3'],
|
|
149
|
+
[neutralLayer4Recipe, 'neutralLayer4'],
|
|
150
|
+
];
|
|
151
|
+
this.resolveLayerRecipes = (luminance) => {
|
|
152
|
+
const designSystemElement = document.createElement('div');
|
|
153
|
+
this.canvasElement.appendChild(designSystemElement);
|
|
154
|
+
baseLayerLuminance.setValueFor(designSystemElement, luminance);
|
|
155
|
+
return this.layerRecipes
|
|
156
|
+
.map((conf) => {
|
|
157
|
+
const color = conf[0].getValueFor(document.body).evaluate(designSystemElement).toColorString();
|
|
158
|
+
return {
|
|
159
|
+
index: this.neutralPalette.indexOf(color),
|
|
160
|
+
color: color,
|
|
161
|
+
title: conf[1],
|
|
162
|
+
};
|
|
163
|
+
})
|
|
164
|
+
.reduce((accum, value) => {
|
|
165
|
+
const colorIndex = accum.findIndex((config) => config.color === value.color);
|
|
166
|
+
return colorIndex === -1
|
|
167
|
+
? accum.concat(value)
|
|
168
|
+
: accum.map((config, index) => index === colorIndex
|
|
169
|
+
? {
|
|
170
|
+
index: this.neutralPalette.indexOf(value.color),
|
|
171
|
+
color: value.color,
|
|
172
|
+
title: value.title.concat(', ', config.title),
|
|
173
|
+
}
|
|
174
|
+
: config);
|
|
175
|
+
}, [])
|
|
176
|
+
.sort((a, b) => a.index - b.index);
|
|
177
|
+
};
|
|
178
|
+
}
|
|
179
|
+
neutralColorChanged(prev, next) {
|
|
180
|
+
if (this.canvasElement && next) {
|
|
181
|
+
const swatch = SwatchRGB.from(parseColorHexRGB(next));
|
|
182
|
+
neutralBaseColor.setValueFor(this.canvasElement, swatch);
|
|
183
|
+
this.neutralPalette = PaletteRGB.from(swatch).swatches.map((x) => x.toColorString());
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
accentColorChanged(prev, next) {
|
|
187
|
+
if (this.canvasElement && next) {
|
|
188
|
+
const swatch = SwatchRGB.from(parseColorHexRGB(next));
|
|
189
|
+
accentBaseColor.setValueFor(this.canvasElement, swatch);
|
|
190
|
+
this.accentPalette = PaletteRGB.from(swatch).swatches.map((x) => x.toColorString());
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
connectedCallback() {
|
|
194
|
+
super.connectedCallback();
|
|
195
|
+
this.neutralColorChanged(undefined, this.neutralColor);
|
|
196
|
+
this.accentColorChanged(undefined, this.accentColor);
|
|
197
|
+
}
|
|
198
|
+
backgrounds() {
|
|
199
|
+
const neutralLayers = this.lightModeLayers.concat(this.darkModeLayers);
|
|
200
|
+
return this.showOnlyLayerBackgrounds
|
|
201
|
+
? neutralLayers
|
|
202
|
+
: this.neutralPalette.map((color, index) => {
|
|
203
|
+
const neutralLayerIndex = neutralLayers.findIndex((config) => config.color === color);
|
|
204
|
+
return {
|
|
205
|
+
index,
|
|
206
|
+
color,
|
|
207
|
+
title: neutralLayerIndex !== -1 ? neutralLayers[neutralLayerIndex].title : undefined,
|
|
208
|
+
};
|
|
209
|
+
});
|
|
210
|
+
}
|
|
211
|
+
get lightModeLayers() {
|
|
212
|
+
return this.resolveLayerRecipes(StandardLuminance.LightMode);
|
|
213
|
+
}
|
|
214
|
+
get darkModeLayers() {
|
|
215
|
+
return this.resolveLayerRecipes(StandardLuminance.DarkMode);
|
|
216
|
+
}
|
|
217
|
+
controlPaneHandler(e) {
|
|
218
|
+
const detail = e.detail;
|
|
219
|
+
this[detail.field] = detail.value;
|
|
220
|
+
}
|
|
221
|
+
};
|
|
222
|
+
__decorate([
|
|
223
|
+
attr({ attribute: 'component-type' })
|
|
224
|
+
], App.prototype, "componentType", void 0);
|
|
225
|
+
__decorate([
|
|
226
|
+
attr({ attribute: 'neutral-color' })
|
|
227
|
+
], App.prototype, "neutralColor", void 0);
|
|
228
|
+
__decorate([
|
|
229
|
+
observable
|
|
230
|
+
], App.prototype, "neutralPalette", void 0);
|
|
231
|
+
__decorate([
|
|
232
|
+
attr({ attribute: 'accent-color' })
|
|
233
|
+
], App.prototype, "accentColor", void 0);
|
|
234
|
+
__decorate([
|
|
235
|
+
observable
|
|
236
|
+
], App.prototype, "accentPalette", void 0);
|
|
237
|
+
__decorate([
|
|
238
|
+
observable
|
|
239
|
+
], App.prototype, "showOnlyLayerBackgrounds", void 0);
|
|
240
|
+
App = __decorate([
|
|
241
|
+
customElement({
|
|
242
|
+
name: 'app-main',
|
|
243
|
+
template,
|
|
244
|
+
styles,
|
|
245
|
+
})
|
|
246
|
+
], App);
|
|
247
|
+
export { App };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export var AccentColors;
|
|
2
|
+
(function (AccentColors) {
|
|
3
|
+
AccentColors["black"] = "#000000";
|
|
4
|
+
AccentColors["white"] = "#FFFFFF";
|
|
5
|
+
AccentColors["magenta"] = "#DA1A5F";
|
|
6
|
+
AccentColors["blue"] = "#0078D4";
|
|
7
|
+
AccentColors["green"] = "#107C10";
|
|
8
|
+
AccentColors["purple"] = "#5C2D91";
|
|
9
|
+
AccentColors["orange"] = "#D83B01";
|
|
10
|
+
AccentColors["yellow"] = "#F2C812";
|
|
11
|
+
})(AccentColors || (AccentColors = {}));
|
|
12
|
+
export const neutralColors = [
|
|
13
|
+
'#808080',
|
|
14
|
+
'#73818C',
|
|
15
|
+
'#718E71',
|
|
16
|
+
'#7F738C',
|
|
17
|
+
'#8C7A73',
|
|
18
|
+
'#0078D4',
|
|
19
|
+
'#107C10',
|
|
20
|
+
'#5C2D91',
|
|
21
|
+
'#D83B01',
|
|
22
|
+
];
|
|
23
|
+
export const defaultAccentColor = AccentColors.blue;
|
|
24
|
+
export const defaultNeutralColor = neutralColors[0];
|
|
@@ -0,0 +1,408 @@
|
|
|
1
|
+
import { __decorate } from "tslib";
|
|
2
|
+
import { parseColorHexRGB } from '@microsoft/fast-colors';
|
|
3
|
+
import { attr, css, customElement, DOM, FASTElement, html, when } from '@microsoft/fast-element';
|
|
4
|
+
import { display } from '@microsoft/fast-foundation';
|
|
5
|
+
import { accentFillActive, accentFillHover, accentFillRest, accentForegroundActive, accentForegroundHover, accentForegroundRest, fillColor, focusStrokeInner, focusStrokeOuter, foregroundOnAccentRest, neutralFillActive, neutralFillHover, neutralFillInputRest, neutralFillRest, neutralFillStealthActive, neutralFillStealthHover, neutralFillStealthRest, neutralFillStrongActive, neutralFillStrongHover, neutralFillStrongRest, neutralForegroundHint, neutralForegroundRest, neutralStrokeActive, neutralStrokeDividerRest, neutralStrokeHover, neutralStrokeRest, SwatchRGB, } from '../../../../index-rollup';
|
|
6
|
+
import { ComponentTypes } from '../component-types';
|
|
7
|
+
import { AppSwatch } from './swatch';
|
|
8
|
+
AppSwatch;
|
|
9
|
+
const backplateComponents = html `
|
|
10
|
+
<template>
|
|
11
|
+
<div class="example">
|
|
12
|
+
<fluent-button appearance="accent">Accent</fluent-button>
|
|
13
|
+
</div>
|
|
14
|
+
<app-swatch
|
|
15
|
+
type="fill"
|
|
16
|
+
recipe-name="accentFillRest"
|
|
17
|
+
:fillRecipe="${x => accentFillRest}"
|
|
18
|
+
:foregroundRecipe="${x => foregroundOnAccentRest}"
|
|
19
|
+
></app-swatch>
|
|
20
|
+
<app-swatch
|
|
21
|
+
type="fill"
|
|
22
|
+
recipe-name="accentFillHover"
|
|
23
|
+
:fillRecipe="${x => accentFillHover}"
|
|
24
|
+
:foregroundRecipe="${x => foregroundOnAccentRest}"
|
|
25
|
+
></app-swatch>
|
|
26
|
+
<app-swatch
|
|
27
|
+
type="fill"
|
|
28
|
+
recipe-name="accentFillActive"
|
|
29
|
+
:fillRecipe="${x => accentFillActive}"
|
|
30
|
+
:foregroundRecipe="${x => foregroundOnAccentRest}"
|
|
31
|
+
></app-swatch>
|
|
32
|
+
<app-swatch
|
|
33
|
+
type="foreground"
|
|
34
|
+
recipe-name="foregroundOnAccent"
|
|
35
|
+
:fillRecipe="${x => accentFillRest}"
|
|
36
|
+
:foregroundRecipe="${x => foregroundOnAccentRest}"
|
|
37
|
+
></app-swatch>
|
|
38
|
+
<app-swatch
|
|
39
|
+
type="outline"
|
|
40
|
+
recipe-name="focusStrokeInner"
|
|
41
|
+
:fillRecipe="${x => focusStrokeOuter}"
|
|
42
|
+
:foregroundRecipe="${x => focusStrokeInner}"
|
|
43
|
+
:outlineRecipe="${x => focusStrokeInner}"
|
|
44
|
+
></app-swatch>
|
|
45
|
+
<app-swatch
|
|
46
|
+
type="outline"
|
|
47
|
+
recipe-name="focusStrokeOuter"
|
|
48
|
+
:fillRecipe="${x => fillColor}"
|
|
49
|
+
:foregroundRecipe="${x => focusStrokeOuter}"
|
|
50
|
+
:outlineRecipe="${x => focusStrokeOuter}"
|
|
51
|
+
></app-swatch>
|
|
52
|
+
|
|
53
|
+
<div class="example">
|
|
54
|
+
<fluent-button>Neutral</fluent-button>
|
|
55
|
+
</div>
|
|
56
|
+
<app-swatch
|
|
57
|
+
type="fill"
|
|
58
|
+
recipe-name="neutralFillRest"
|
|
59
|
+
:foregroundRecipe="${x => neutralForegroundRest}"
|
|
60
|
+
:fillRecipe="${x => neutralFillRest}"
|
|
61
|
+
></app-swatch>
|
|
62
|
+
<app-swatch
|
|
63
|
+
type="fill"
|
|
64
|
+
recipe-name="neutralFillHover"
|
|
65
|
+
:foregroundRecipe="${x => neutralForegroundRest}"
|
|
66
|
+
:fillRecipe="${x => neutralFillHover}"
|
|
67
|
+
></app-swatch>
|
|
68
|
+
<app-swatch
|
|
69
|
+
type="fill"
|
|
70
|
+
recipe-name="neutralFillActive"
|
|
71
|
+
:foregroundRecipe="${x => neutralForegroundRest}"
|
|
72
|
+
:fillRecipe="${x => neutralFillActive}"
|
|
73
|
+
></app-swatch>
|
|
74
|
+
<app-swatch
|
|
75
|
+
type="foreground"
|
|
76
|
+
recipe-name="neutralForegroundRest"
|
|
77
|
+
:fillRecipe="${x => fillColor}"
|
|
78
|
+
:foregroundRecipe="${x => neutralForegroundRest}"
|
|
79
|
+
></app-swatch>
|
|
80
|
+
<app-swatch
|
|
81
|
+
type="outline"
|
|
82
|
+
recipe-name="focusStrokeOuter"
|
|
83
|
+
:fillRecipe="${x => fillColor}"
|
|
84
|
+
:foregroundRecipe="${x => focusStrokeOuter}"
|
|
85
|
+
:outlineRecipe="${x => focusStrokeOuter}"
|
|
86
|
+
></app-swatch>
|
|
87
|
+
|
|
88
|
+
<div class="example">
|
|
89
|
+
<fluent-button appearance="outline">Outline</fluent-button>
|
|
90
|
+
</div>
|
|
91
|
+
<app-swatch
|
|
92
|
+
type="outline"
|
|
93
|
+
recipe-name="neutralStrokeRest"
|
|
94
|
+
:foregroundRecipe="${x => neutralForegroundRest}"
|
|
95
|
+
:fillRecipe="${x => fillColor}"
|
|
96
|
+
:outlineRecipe="${x => neutralStrokeRest}"
|
|
97
|
+
></app-swatch>
|
|
98
|
+
<app-swatch
|
|
99
|
+
type="outline"
|
|
100
|
+
recipe-name="neutralStrokeHover"
|
|
101
|
+
:foregroundRecipe="${x => neutralForegroundRest}"
|
|
102
|
+
:fillRecipe="${x => fillColor}"
|
|
103
|
+
:outlineRecipe="${x => neutralStrokeHover}"
|
|
104
|
+
></app-swatch>
|
|
105
|
+
<app-swatch
|
|
106
|
+
type="outline"
|
|
107
|
+
recipe-name="neutralStrokeActive"
|
|
108
|
+
:foregroundRecipe="${x => neutralForegroundRest}"
|
|
109
|
+
:fillRecipe="${x => fillColor}"
|
|
110
|
+
:outlineRecipe="${x => neutralStrokeActive}"
|
|
111
|
+
></app-swatch>
|
|
112
|
+
<app-swatch
|
|
113
|
+
type="foreground"
|
|
114
|
+
recipe-name="neutralForegroundRest"
|
|
115
|
+
:fillRecipe="${x => fillColor}"
|
|
116
|
+
:foregroundRecipe="${x => neutralForegroundRest}"
|
|
117
|
+
></app-swatch>
|
|
118
|
+
<app-swatch
|
|
119
|
+
type="outline"
|
|
120
|
+
recipe-name="focusStrokeOuter"
|
|
121
|
+
:fillRecipe="${x => fillColor}"
|
|
122
|
+
:foregroundRecipe="${x => focusStrokeOuter}"
|
|
123
|
+
:outlineRecipe="${x => focusStrokeOuter}"
|
|
124
|
+
></app-swatch>
|
|
125
|
+
|
|
126
|
+
<div class="example">
|
|
127
|
+
<fluent-button appearance="stealth">Stealth</fluent-button>
|
|
128
|
+
</div>
|
|
129
|
+
<app-swatch
|
|
130
|
+
type="fill"
|
|
131
|
+
recipe-name="neutralFillStealthRest"
|
|
132
|
+
:foregroundRecipe="${x => neutralForegroundRest}"
|
|
133
|
+
:fillRecipe="${x => neutralFillStealthRest}"
|
|
134
|
+
></app-swatch>
|
|
135
|
+
<app-swatch
|
|
136
|
+
type="fill"
|
|
137
|
+
recipe-name="neutralFillStealthHover"
|
|
138
|
+
:foregroundRecipe="${x => neutralForegroundRest}"
|
|
139
|
+
:fillRecipe="${x => neutralFillStealthHover}"
|
|
140
|
+
></app-swatch>
|
|
141
|
+
<app-swatch
|
|
142
|
+
type="fill"
|
|
143
|
+
recipe-name="neutralFillStealthActive"
|
|
144
|
+
:foregroundRecipe="${x => neutralForegroundRest}"
|
|
145
|
+
:fillRecipe="${x => neutralFillStealthActive}"
|
|
146
|
+
></app-swatch>
|
|
147
|
+
<app-swatch
|
|
148
|
+
type="foreground"
|
|
149
|
+
recipe-name="neutralForegroundRest"
|
|
150
|
+
:fillRecipe="${x => fillColor}"
|
|
151
|
+
:foregroundRecipe="${x => neutralForegroundRest}"
|
|
152
|
+
></app-swatch>
|
|
153
|
+
<app-swatch
|
|
154
|
+
type="outline"
|
|
155
|
+
recipe-name="focusStrokeOuter"
|
|
156
|
+
:fillRecipe="${x => fillColor}"
|
|
157
|
+
:foregroundRecipe="${x => focusStrokeOuter}"
|
|
158
|
+
:outlineRecipe="${x => focusStrokeOuter}"
|
|
159
|
+
></app-swatch>
|
|
160
|
+
</template>
|
|
161
|
+
`;
|
|
162
|
+
const textComponents = html `
|
|
163
|
+
<template>
|
|
164
|
+
<div class="example">
|
|
165
|
+
<p>Neutral</p>
|
|
166
|
+
</div>
|
|
167
|
+
<app-swatch
|
|
168
|
+
type="foreground"
|
|
169
|
+
recipe-name="neutralForegroundRest"
|
|
170
|
+
:fillRecipe="${x => fillColor}"
|
|
171
|
+
:foregroundRecipe="${x => neutralForegroundRest}"
|
|
172
|
+
></app-swatch>
|
|
173
|
+
|
|
174
|
+
<div class="example">
|
|
175
|
+
<p class="hint_text">Hint</p>
|
|
176
|
+
</div>
|
|
177
|
+
<app-swatch
|
|
178
|
+
type="foreground"
|
|
179
|
+
recipe-name="neutralForegroundHint"
|
|
180
|
+
:fillRecipe="${x => fillColor}"
|
|
181
|
+
:foregroundRecipe="${x => neutralForegroundHint}"
|
|
182
|
+
></app-swatch>
|
|
183
|
+
|
|
184
|
+
<div class="example">
|
|
185
|
+
<fluent-anchor href="#" appearance="hypertext">Accent</fluent-anchor>
|
|
186
|
+
</div>
|
|
187
|
+
<app-swatch
|
|
188
|
+
type="foreground"
|
|
189
|
+
recipe-name="accentForegroundRest"
|
|
190
|
+
:fillRecipe="${x => fillColor}"
|
|
191
|
+
:foregroundRecipe="${x => accentForegroundRest}"
|
|
192
|
+
></app-swatch>
|
|
193
|
+
<app-swatch
|
|
194
|
+
type="foreground"
|
|
195
|
+
recipe-name="accentForegroundHover"
|
|
196
|
+
:fillRecipe="${x => fillColor}"
|
|
197
|
+
:foregroundRecipe="${x => accentForegroundHover}"
|
|
198
|
+
></app-swatch>
|
|
199
|
+
<app-swatch
|
|
200
|
+
type="foreground"
|
|
201
|
+
recipe-name="accentForegroundActive"
|
|
202
|
+
:fillRecipe="${x => fillColor}"
|
|
203
|
+
:foregroundRecipe="${x => accentForegroundActive}"
|
|
204
|
+
></app-swatch>
|
|
205
|
+
<app-swatch
|
|
206
|
+
type="outline"
|
|
207
|
+
recipe-name="focusStrokeOuter"
|
|
208
|
+
:fillRecipe="${x => fillColor}"
|
|
209
|
+
:foregroundRecipe="${x => focusStrokeOuter}"
|
|
210
|
+
:outlineRecipe="${x => focusStrokeOuter}"
|
|
211
|
+
></app-swatch>
|
|
212
|
+
</template>
|
|
213
|
+
`;
|
|
214
|
+
const formComponents = html `
|
|
215
|
+
<template>
|
|
216
|
+
<div class="example">
|
|
217
|
+
<fluent-text-field placeholder="jerry@microsoft.com"></fluent-text-field>
|
|
218
|
+
</div>
|
|
219
|
+
<app-swatch
|
|
220
|
+
type="fill"
|
|
221
|
+
recipe-name="neutralFillInputRest"
|
|
222
|
+
:fillRecipe="${x => neutralFillInputRest}"
|
|
223
|
+
:foregroundRecipe="${x => neutralForegroundRest}"
|
|
224
|
+
></app-swatch>
|
|
225
|
+
<app-swatch
|
|
226
|
+
type="foreground"
|
|
227
|
+
recipe-name="neutralForegroundHint"
|
|
228
|
+
:fillRecipe="${x => neutralFillInputRest}"
|
|
229
|
+
:foregroundRecipe="${x => neutralForegroundHint}"
|
|
230
|
+
></app-swatch>
|
|
231
|
+
<app-swatch
|
|
232
|
+
type="foreground"
|
|
233
|
+
recipe-name="neutralForegroundRest"
|
|
234
|
+
:fillRecipe="${x => neutralFillInputRest}"
|
|
235
|
+
:foregroundRecipe="${x => neutralForegroundRest}"
|
|
236
|
+
></app-swatch>
|
|
237
|
+
<app-swatch
|
|
238
|
+
type="outline"
|
|
239
|
+
recipe-name="neutralStrokeRest"
|
|
240
|
+
:fillRecipe="${x => fillColor}"
|
|
241
|
+
:foregroundRecipe="${x => neutralForegroundRest}"
|
|
242
|
+
:outlineRecipe="${x => neutralStrokeRest}"
|
|
243
|
+
></app-swatch>
|
|
244
|
+
<app-swatch
|
|
245
|
+
type="outline"
|
|
246
|
+
recipe-name="neutralStrokeHover"
|
|
247
|
+
:fillRecipe="${x => fillColor}"
|
|
248
|
+
:foregroundRecipe="${x => neutralForegroundRest}"
|
|
249
|
+
:outlineRecipe="${x => neutralStrokeHover}"
|
|
250
|
+
></app-swatch>
|
|
251
|
+
<app-swatch
|
|
252
|
+
type="outline"
|
|
253
|
+
recipe-name="focusStrokeOuter"
|
|
254
|
+
:fillRecipe="${x => fillColor}"
|
|
255
|
+
:foregroundRecipe="${x => focusStrokeOuter}"
|
|
256
|
+
:outlineRecipe="${x => focusStrokeOuter}"
|
|
257
|
+
></app-swatch>
|
|
258
|
+
|
|
259
|
+
<div class="example">
|
|
260
|
+
<fluent-checkbox>Checkbox</fluent-checkbox>
|
|
261
|
+
</div>
|
|
262
|
+
<app-swatch
|
|
263
|
+
type="fill"
|
|
264
|
+
recipe-name="neutralFillInputRest"
|
|
265
|
+
:fillRecipe="${x => neutralFillInputRest}"
|
|
266
|
+
:foregroundRecipe="${x => neutralForegroundRest}"
|
|
267
|
+
></app-swatch>
|
|
268
|
+
<app-swatch
|
|
269
|
+
type="fill"
|
|
270
|
+
recipe-name="neutralFillStrongRest"
|
|
271
|
+
:fillRecipe="${x => neutralFillStrongRest}"
|
|
272
|
+
:foregroundRecipe="${x => neutralForegroundRest}"
|
|
273
|
+
></app-swatch>
|
|
274
|
+
<app-swatch
|
|
275
|
+
type="fill"
|
|
276
|
+
recipe-name="neutralFillStrongHover"
|
|
277
|
+
:fillRecipe="${x => neutralFillStrongHover}"
|
|
278
|
+
:foregroundRecipe="${x => neutralForegroundRest}"
|
|
279
|
+
></app-swatch>
|
|
280
|
+
<app-swatch
|
|
281
|
+
type="fill"
|
|
282
|
+
recipe-name="neutralFillStrongActive"
|
|
283
|
+
:fillRecipe="${x => neutralFillStrongActive}"
|
|
284
|
+
:foregroundRecipe="${x => neutralForegroundRest}"
|
|
285
|
+
></app-swatch>
|
|
286
|
+
<app-swatch
|
|
287
|
+
type="foreground"
|
|
288
|
+
recipe-name="neutralForegroundRest"
|
|
289
|
+
:fillRecipe="${x => neutralFillInputRest}"
|
|
290
|
+
:foregroundRecipe="${x => neutralForegroundRest}"
|
|
291
|
+
></app-swatch>
|
|
292
|
+
<app-swatch
|
|
293
|
+
type="outline"
|
|
294
|
+
recipe-name="focusStrokeOuter"
|
|
295
|
+
:fillRecipe="${x => fillColor}"
|
|
296
|
+
:foregroundRecipe="${x => focusStrokeOuter}"
|
|
297
|
+
:outlineRecipe="${x => focusStrokeOuter}"
|
|
298
|
+
></app-swatch>
|
|
299
|
+
|
|
300
|
+
<div class="example">
|
|
301
|
+
<fluent-divider class="divider"></fluent-divider>
|
|
302
|
+
</div>
|
|
303
|
+
<app-swatch
|
|
304
|
+
type="outline"
|
|
305
|
+
recipe-name="neutralStrokeDividerRest"
|
|
306
|
+
:fillRecipe="${x => fillColor}"
|
|
307
|
+
:foregroundRecipe="${x => neutralForegroundRest}"
|
|
308
|
+
:outlineRecipe="${x => neutralStrokeDividerRest}"
|
|
309
|
+
></app-swatch>
|
|
310
|
+
</template>
|
|
311
|
+
`;
|
|
312
|
+
const template = html `
|
|
313
|
+
<p class="title">
|
|
314
|
+
SWATCH ${x => x.index} - ${x => x.color.toUpperCase()}
|
|
315
|
+
${when(x => x.layerName, html `
|
|
316
|
+
<p>
|
|
317
|
+
<code>${x => x.layerName}</code>
|
|
318
|
+
</p>
|
|
319
|
+
`)}
|
|
320
|
+
</p>
|
|
321
|
+
|
|
322
|
+
<div class="content">
|
|
323
|
+
${when(x => x.component === ComponentTypes.backplate, backplateComponents)}
|
|
324
|
+
${when(x => x.component === ComponentTypes.text, textComponents)}
|
|
325
|
+
${when(x => x.component === ComponentTypes.form, formComponents)}
|
|
326
|
+
</div>
|
|
327
|
+
`;
|
|
328
|
+
const styles = css `
|
|
329
|
+
${display('flex')}
|
|
330
|
+
|
|
331
|
+
:host {
|
|
332
|
+
flex-direction: column;
|
|
333
|
+
flex-grow: 1;
|
|
334
|
+
align-items: stretch;
|
|
335
|
+
text-align: center;
|
|
336
|
+
position: relative;
|
|
337
|
+
transition: opacity 0.1s linear;
|
|
338
|
+
height: 100%;
|
|
339
|
+
min-height: 100%;
|
|
340
|
+
background-color: ${fillColor};
|
|
341
|
+
color: ${neutralForegroundRest};
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
.title {
|
|
345
|
+
margin: 16px auto 4px;
|
|
346
|
+
font-weight: 600;
|
|
347
|
+
height: 34px;
|
|
348
|
+
color: ${neutralForegroundHint};
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
.title code {
|
|
352
|
+
font-weight: normal;
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
.content {
|
|
356
|
+
flex-grow: 1;
|
|
357
|
+
display: flex;
|
|
358
|
+
flex-direction: column;
|
|
359
|
+
align-items: center;
|
|
360
|
+
padding: 0 48px 36px;
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
.example {
|
|
364
|
+
height: 60px;
|
|
365
|
+
display: flex;
|
|
366
|
+
align-items: center;
|
|
367
|
+
margin-top: 24px;
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
.hint_text {
|
|
371
|
+
color: ${neutralForegroundHint};
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
.divider {
|
|
375
|
+
width: 150px;
|
|
376
|
+
}
|
|
377
|
+
`;
|
|
378
|
+
let AppColorBlock = class AppColorBlock extends FASTElement {
|
|
379
|
+
colorChanged() {
|
|
380
|
+
DOM.queueUpdate(() => this.updateColor());
|
|
381
|
+
}
|
|
382
|
+
updateColor() {
|
|
383
|
+
if (this.color && this.$fastController.isConnected) {
|
|
384
|
+
const color = parseColorHexRGB(this.color);
|
|
385
|
+
fillColor.setValueFor(this, SwatchRGB.from(color));
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
};
|
|
389
|
+
__decorate([
|
|
390
|
+
attr
|
|
391
|
+
], AppColorBlock.prototype, "index", void 0);
|
|
392
|
+
__decorate([
|
|
393
|
+
attr
|
|
394
|
+
], AppColorBlock.prototype, "component", void 0);
|
|
395
|
+
__decorate([
|
|
396
|
+
attr
|
|
397
|
+
], AppColorBlock.prototype, "color", void 0);
|
|
398
|
+
__decorate([
|
|
399
|
+
attr({ attribute: 'layer-name' })
|
|
400
|
+
], AppColorBlock.prototype, "layerName", void 0);
|
|
401
|
+
AppColorBlock = __decorate([
|
|
402
|
+
customElement({
|
|
403
|
+
name: 'app-color-block',
|
|
404
|
+
template,
|
|
405
|
+
styles,
|
|
406
|
+
})
|
|
407
|
+
], AppColorBlock);
|
|
408
|
+
export { AppColorBlock };
|