@ni/nimble-components 1.0.0-beta.92 → 1.0.0
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/README.md +63 -3
- package/dist/esm/button/index.d.ts +16 -0
- package/dist/esm/button/index.js +22 -0
- package/dist/esm/button/index.js.map +1 -1
- package/dist/esm/button/styles.js +19 -9
- package/dist/esm/button/styles.js.map +1 -1
- package/dist/esm/button/types.d.ts +3 -0
- package/dist/esm/button/types.js +0 -4
- package/dist/esm/button/types.js.map +1 -1
- package/dist/esm/checkbox/index.d.ts +11 -1
- package/dist/esm/checkbox/index.js +8 -2
- package/dist/esm/checkbox/index.js.map +1 -1
- package/dist/esm/checkbox/styles.js +4 -4
- package/dist/esm/checkbox/styles.js.map +1 -1
- package/dist/esm/drawer/index.d.ts +7 -3
- package/dist/esm/drawer/index.js +8 -9
- package/dist/esm/drawer/index.js.map +1 -1
- package/dist/esm/drawer/styles.js +8 -7
- package/dist/esm/drawer/styles.js.map +1 -1
- package/dist/esm/drawer/types.d.ts +2 -0
- package/dist/esm/drawer/types.js.map +1 -1
- package/dist/esm/icon-base/styles.js +6 -6
- package/dist/esm/icon-base/styles.js.map +1 -1
- package/dist/esm/icon-base/template.js +1 -1
- package/dist/esm/icon-base/types.d.ts +11 -0
- package/dist/esm/icon-base/types.js +12 -0
- package/dist/esm/icon-base/types.js.map +1 -0
- package/dist/esm/icons/access-control.d.ts +5 -0
- package/dist/esm/icons/access-control.js.map +1 -1
- package/dist/esm/icons/admin.d.ts +5 -0
- package/dist/esm/icons/admin.js.map +1 -1
- package/dist/esm/icons/administration.d.ts +5 -0
- package/dist/esm/icons/administration.js.map +1 -1
- package/dist/esm/icons/all-icons.d.ts +11 -0
- package/dist/esm/icons/all-icons.js +11 -0
- package/dist/esm/icons/all-icons.js.map +1 -1
- package/dist/esm/icons/check.d.ts +5 -0
- package/dist/esm/icons/check.js.map +1 -1
- package/dist/esm/icons/custom-applications.d.ts +5 -0
- package/dist/esm/icons/custom-applications.js.map +1 -1
- package/dist/esm/icons/custom-status.d.ts +12 -0
- package/dist/esm/icons/custom-status.js +12 -0
- package/dist/esm/icons/custom-status.js.map +1 -0
- package/dist/esm/icons/delete.d.ts +5 -0
- package/dist/esm/icons/delete.js.map +1 -1
- package/dist/esm/icons/done.d.ts +12 -0
- package/dist/esm/icons/done.js +12 -0
- package/dist/esm/icons/done.js.map +1 -0
- package/dist/esm/icons/fail.d.ts +12 -0
- package/dist/esm/icons/fail.js +12 -0
- package/dist/esm/icons/fail.js.map +1 -0
- package/dist/esm/icons/login.d.ts +5 -0
- package/dist/esm/icons/login.js.map +1 -1
- package/dist/esm/icons/logout.d.ts +5 -0
- package/dist/esm/icons/logout.js.map +1 -1
- package/dist/esm/icons/looping.d.ts +12 -0
- package/dist/esm/icons/looping.js +12 -0
- package/dist/esm/icons/looping.js.map +1 -0
- package/dist/esm/icons/managed-systems.d.ts +5 -0
- package/dist/esm/icons/managed-systems.js.map +1 -1
- package/dist/esm/icons/measurement-data-analysis.d.ts +5 -0
- package/dist/esm/icons/measurement-data-analysis.js.map +1 -1
- package/dist/esm/icons/running.d.ts +12 -0
- package/dist/esm/icons/running.js +12 -0
- package/dist/esm/icons/running.js.map +1 -0
- package/dist/esm/icons/settings.d.ts +5 -0
- package/dist/esm/icons/settings.js.map +1 -1
- package/dist/esm/icons/skipped.d.ts +12 -0
- package/dist/esm/icons/skipped.js +12 -0
- package/dist/esm/icons/skipped.js.map +1 -0
- package/dist/esm/icons/status.d.ts +12 -0
- package/dist/esm/icons/status.js +12 -0
- package/dist/esm/icons/status.js.map +1 -0
- package/dist/esm/icons/succeeded.d.ts +12 -0
- package/dist/esm/icons/succeeded.js +12 -0
- package/dist/esm/icons/succeeded.js.map +1 -0
- package/dist/esm/icons/terminated.d.ts +12 -0
- package/dist/esm/icons/terminated.js +12 -0
- package/dist/esm/icons/terminated.js.map +1 -0
- package/dist/esm/icons/test-insights.d.ts +5 -0
- package/dist/esm/icons/test-insights.js.map +1 -1
- package/dist/esm/icons/timed-out.d.ts +12 -0
- package/dist/esm/icons/timed-out.js +12 -0
- package/dist/esm/icons/timed-out.js.map +1 -0
- package/dist/esm/icons/utilities.d.ts +5 -0
- package/dist/esm/icons/utilities.js.map +1 -1
- package/dist/esm/icons/waiting.d.ts +12 -0
- package/dist/esm/icons/waiting.js +12 -0
- package/dist/esm/icons/waiting.js.map +1 -0
- package/dist/esm/listbox-option/index.d.ts +5 -0
- package/dist/esm/listbox-option/index.js +2 -0
- package/dist/esm/listbox-option/index.js.map +1 -1
- package/dist/esm/menu/index.d.ts +8 -1
- package/dist/esm/menu/index.js +5 -2
- package/dist/esm/menu/index.js.map +1 -1
- package/dist/esm/menu-item/index.d.ts +9 -12
- package/dist/esm/menu-item/index.js +5 -2
- package/dist/esm/menu-item/index.js.map +1 -1
- package/dist/esm/nimble-components/src/button/behaviors.d.ts +12 -0
- package/dist/esm/nimble-components/src/button/index.d.ts +33 -0
- package/dist/esm/nimble-components/src/button/styles.d.ts +1 -0
- package/dist/esm/nimble-components/src/button/types.d.ts +12 -0
- package/dist/esm/nimble-components/src/checkbox/index.d.ts +12 -0
- package/dist/esm/nimble-components/src/checkbox/styles.d.ts +1 -0
- package/dist/esm/nimble-components/src/drawer/animations.d.ts +14 -0
- package/dist/esm/nimble-components/src/drawer/index.d.ts +43 -0
- package/dist/esm/nimble-components/src/drawer/styles.d.ts +1 -0
- package/dist/esm/nimble-components/src/drawer/types.d.ts +12 -0
- package/dist/esm/nimble-components/src/icon-base/index.d.ts +12 -0
- package/dist/esm/nimble-components/src/icon-base/styles.d.ts +1 -0
- package/dist/esm/nimble-components/src/icon-base/template.d.ts +2 -0
- package/dist/esm/nimble-components/src/icon-base/types.d.ts +11 -0
- package/dist/esm/nimble-components/src/icons/access-control.d.ts +12 -0
- package/dist/esm/nimble-components/src/icons/admin.d.ts +12 -0
- package/dist/esm/nimble-components/src/icons/administration.d.ts +12 -0
- package/dist/esm/nimble-components/src/icons/all-icons.d.ts +24 -0
- package/dist/esm/nimble-components/src/icons/check.d.ts +12 -0
- package/dist/esm/nimble-components/src/icons/custom-applications.d.ts +12 -0
- package/dist/esm/nimble-components/src/icons/custom-status.d.ts +12 -0
- package/dist/esm/nimble-components/src/icons/delete.d.ts +12 -0
- package/dist/esm/nimble-components/src/icons/done.d.ts +12 -0
- package/dist/esm/nimble-components/src/icons/fail.d.ts +12 -0
- package/dist/esm/nimble-components/src/icons/login.d.ts +12 -0
- package/dist/esm/nimble-components/src/icons/logout.d.ts +12 -0
- package/dist/esm/nimble-components/src/icons/looping.d.ts +12 -0
- package/dist/esm/nimble-components/src/icons/managed-systems.d.ts +12 -0
- package/dist/esm/nimble-components/src/icons/measurement-data-analysis.d.ts +12 -0
- package/dist/esm/nimble-components/src/icons/running.d.ts +12 -0
- package/dist/esm/nimble-components/src/icons/settings.d.ts +12 -0
- package/dist/esm/nimble-components/src/icons/skipped.d.ts +12 -0
- package/dist/esm/nimble-components/src/icons/status.d.ts +12 -0
- package/dist/esm/nimble-components/src/icons/succeeded.d.ts +12 -0
- package/dist/esm/nimble-components/src/icons/terminated.d.ts +12 -0
- package/dist/esm/nimble-components/src/icons/test-insights.d.ts +12 -0
- package/dist/esm/nimble-components/src/icons/timed-out.d.ts +12 -0
- package/dist/esm/nimble-components/src/icons/utilities.d.ts +12 -0
- package/dist/esm/nimble-components/src/icons/waiting.d.ts +12 -0
- package/dist/esm/nimble-components/src/listbox-option/index.d.ts +15 -0
- package/dist/esm/nimble-components/src/listbox-option/styles.d.ts +1 -0
- package/dist/esm/nimble-components/src/menu/index.d.ts +12 -0
- package/dist/esm/nimble-components/src/menu/styles.d.ts +1 -0
- package/dist/esm/nimble-components/src/menu-item/index.d.ts +12 -0
- package/dist/esm/nimble-components/src/menu-item/styles.d.ts +1 -0
- package/dist/esm/nimble-components/src/number-field/index.d.ts +12 -0
- package/dist/esm/nimble-components/src/number-field/styles.d.ts +1 -0
- package/dist/esm/nimble-components/src/select/index.d.ts +16 -0
- package/dist/esm/nimble-components/src/select/styles.d.ts +1 -0
- package/dist/esm/nimble-components/src/tab/index.d.ts +12 -0
- package/dist/esm/nimble-components/src/tab/styles.d.ts +1 -0
- package/dist/esm/nimble-components/src/tab-panel/index.d.ts +12 -0
- package/dist/esm/nimble-components/src/tab-panel/styles.d.ts +1 -0
- package/dist/esm/nimble-components/src/tabs/index.d.ts +12 -0
- package/dist/esm/nimble-components/src/tabs/styles.d.ts +1 -0
- package/dist/esm/nimble-components/src/tabs-toolbar/index.d.ts +12 -0
- package/dist/esm/nimble-components/src/tabs-toolbar/styles.d.ts +1 -0
- package/dist/esm/nimble-components/src/tabs-toolbar/template.d.ts +1 -0
- package/dist/esm/nimble-components/src/testing/async-helpers.d.ts +10 -0
- package/dist/esm/nimble-components/src/text-field/index.d.ts +12 -0
- package/dist/esm/nimble-components/src/text-field/styles.d.ts +1 -0
- package/dist/esm/nimble-components/src/text-field/types.d.ts +3 -0
- package/dist/esm/nimble-components/src/theme-provider/design-token-comments.d.ts +6 -0
- package/dist/esm/nimble-components/src/theme-provider/design-token-names.d.ts +11 -0
- package/dist/esm/nimble-components/src/theme-provider/design-tokens.d.ts +42 -0
- package/dist/esm/nimble-components/src/theme-provider/index.d.ts +22 -0
- package/dist/esm/nimble-components/src/theme-provider/styles.d.ts +1 -0
- package/dist/esm/nimble-components/src/theme-provider/template.d.ts +2 -0
- package/dist/esm/{theme-provider/themes.d.ts → nimble-components/src/theme-provider/types.d.ts} +2 -1
- package/dist/esm/nimble-components/src/tree-item/index.d.ts +34 -0
- package/dist/esm/nimble-components/src/tree-item/styles.d.ts +3 -0
- package/dist/esm/nimble-components/src/tree-view/index.d.ts +22 -0
- package/dist/esm/nimble-components/src/tree-view/styles.d.ts +1 -0
- package/dist/esm/nimble-components/src/tree-view/types.d.ts +7 -0
- package/dist/esm/nimble-components/src/utilities/style/direction.d.ts +34 -0
- package/dist/esm/nimble-components/src/utilities/style/focus.d.ts +11 -0
- package/dist/esm/nimble-components/src/utilities/style/prefers-reduced-motion.d.ts +4 -0
- package/dist/esm/nimble-components/src/utilities/style/theme.d.ts +44 -0
- package/dist/esm/number-field/index.d.ts +8 -2
- package/dist/esm/number-field/index.js +8 -1
- package/dist/esm/number-field/index.js.map +1 -1
- package/dist/esm/number-field/styles.js +3 -3
- package/dist/esm/number-field/styles.js.map +1 -1
- package/dist/esm/select/index.d.ts +6 -2
- package/dist/esm/select/index.js +9 -5
- package/dist/esm/select/index.js.map +1 -1
- package/dist/esm/tab/index.d.ts +11 -1
- package/dist/esm/tab/index.js +8 -1
- package/dist/esm/tab/index.js.map +1 -1
- package/dist/esm/tab-panel/index.d.ts +11 -1
- package/dist/esm/tab-panel/index.js +8 -1
- package/dist/esm/tab-panel/index.js.map +1 -1
- package/dist/esm/tabs/index.d.ts +11 -1
- package/dist/esm/tabs/index.js +8 -1
- package/dist/esm/tabs/index.js.map +1 -1
- package/dist/esm/tabs-toolbar/index.d.ts +7 -1
- package/dist/esm/tabs-toolbar/index.js +1 -1
- package/dist/esm/tabs-toolbar/index.js.map +1 -1
- package/dist/esm/tabs-toolbar/styles.js +3 -2
- package/dist/esm/tabs-toolbar/styles.js.map +1 -1
- package/dist/esm/testing/async-helpers.d.ts +10 -0
- package/dist/esm/testing/async-helpers.js +12 -0
- package/dist/esm/testing/async-helpers.js.map +1 -0
- package/dist/esm/text-field/index.d.ts +8 -2
- package/dist/esm/text-field/index.js +8 -1
- package/dist/esm/text-field/index.js.map +1 -1
- package/dist/esm/text-field/styles.js +20 -8
- package/dist/esm/text-field/styles.js.map +1 -1
- package/dist/esm/text-field/types.d.ts +3 -0
- package/dist/esm/text-field/types.js +3 -0
- package/dist/esm/text-field/types.js.map +1 -0
- package/dist/esm/theme-provider/design-token-comments.d.ts +6 -0
- package/dist/esm/theme-provider/design-token-comments.js +45 -0
- package/dist/esm/theme-provider/design-token-comments.js.map +1 -0
- package/dist/esm/theme-provider/design-token-names.d.ts +11 -0
- package/dist/esm/theme-provider/design-token-names.js +51 -0
- package/dist/esm/theme-provider/design-token-names.js.map +1 -0
- package/dist/esm/theme-provider/design-tokens.d.ts +4 -10
- package/dist/esm/theme-provider/design-tokens.js +94 -109
- package/dist/esm/theme-provider/design-tokens.js.map +1 -1
- package/dist/esm/theme-provider/index.d.ts +18 -6
- package/dist/esm/theme-provider/index.js +51 -26
- package/dist/esm/theme-provider/index.js.map +1 -1
- package/dist/esm/theme-provider/styles.d.ts +1 -0
- package/dist/esm/theme-provider/styles.js +7 -0
- package/dist/esm/theme-provider/styles.js.map +1 -0
- package/dist/esm/theme-provider/template.d.ts +2 -2
- package/dist/esm/theme-provider/template.js.map +1 -1
- package/dist/esm/theme-provider/types.d.ts +7 -0
- package/dist/esm/theme-provider/types.js +8 -0
- package/dist/esm/theme-provider/types.js.map +1 -0
- package/dist/esm/tree-item/index.d.ts +7 -1
- package/dist/esm/tree-item/index.js +13 -12
- package/dist/esm/tree-item/index.js.map +1 -1
- package/dist/esm/tree-item/styles.js +9 -7
- package/dist/esm/tree-item/styles.js.map +1 -1
- package/dist/esm/tree-view/index.d.ts +9 -3
- package/dist/esm/tree-view/index.js +4 -3
- package/dist/esm/tree-view/index.js.map +1 -1
- package/dist/esm/tree-view/types.d.ts +2 -1
- package/dist/esm/tree-view/types.js +5 -5
- package/dist/esm/tree-view/types.js.map +1 -1
- package/dist/esm/utilities/style/direction.d.ts +34 -0
- package/dist/esm/utilities/style/direction.js +78 -0
- package/dist/esm/utilities/style/direction.js.map +1 -0
- package/dist/esm/utilities/style/focus.js +1 -1
- package/dist/esm/utilities/style/focus.js.map +1 -1
- package/dist/esm/utilities/style/prefers-reduced-motion.d.ts +4 -0
- package/dist/esm/utilities/style/prefers-reduced-motion.js +5 -0
- package/dist/esm/utilities/style/prefers-reduced-motion.js.map +1 -0
- package/dist/esm/utilities/style/theme.d.ts +44 -0
- package/dist/esm/utilities/style/theme.js +116 -0
- package/dist/esm/utilities/style/theme.js.map +1 -0
- package/dist/fonts.scss +3 -0
- package/dist/tokens-internal.scss +255 -0
- package/dist/tokens.scss +132 -0
- package/package.json +26 -17
- package/dist/esm/testing/dom-next-update.d.ts +0 -4
- package/dist/esm/testing/dom-next-update.js +0 -6
- package/dist/esm/testing/dom-next-update.js.map +0 -1
- package/dist/esm/theme-provider/themes.js +0 -8
- package/dist/esm/theme-provider/themes.js.map +0 -1
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { DirectionalStyleSheetBehavior } from '@microsoft/fast-components';
|
|
2
1
|
import { css } from '@microsoft/fast-element';
|
|
3
2
|
import { display, TreeItem } from '@microsoft/fast-foundation';
|
|
4
3
|
import { focusVisible } from '../utilities/style/focus';
|
|
5
4
|
import { contentFontColor, fontFamily, borderColorHover, fillColorSelected, contentFontSize, fillColorHover, fillColorSelectedHover, borderWidth, iconSize } from '../theme-provider/design-tokens';
|
|
6
5
|
import { groupSelectedAttribute } from '../tree-view/types';
|
|
6
|
+
import { DirectionalStyleSheetBehavior } from '../utilities/style/direction';
|
|
7
7
|
export const styles = (context) => css `
|
|
8
8
|
${display('block')}
|
|
9
9
|
|
|
@@ -14,7 +14,7 @@ export const styles = (context) => css `
|
|
|
14
14
|
color: ${contentFontColor};
|
|
15
15
|
cursor: pointer;
|
|
16
16
|
font-family: ${fontFamily};
|
|
17
|
-
--tree-item-nested-width: 0;
|
|
17
|
+
--ni-private-tree-item-nested-width: 0;
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
${ /* this controls the side border */''}
|
|
@@ -57,7 +57,7 @@ export const styles = (context) => css `
|
|
|
57
57
|
.positioning-region::before {
|
|
58
58
|
content: '';
|
|
59
59
|
display: block;
|
|
60
|
-
width: var(--tree-item-nested-width);
|
|
60
|
+
width: var(--ni-private-tree-item-nested-width);
|
|
61
61
|
flex-shrink: 0;
|
|
62
62
|
}
|
|
63
63
|
|
|
@@ -131,8 +131,10 @@ export const styles = (context) => css `
|
|
|
131
131
|
}
|
|
132
132
|
|
|
133
133
|
::slotted(${context.tagFor(TreeItem)}) {
|
|
134
|
-
--tree-item-nested-width: 1em;
|
|
135
|
-
--expand-collapse-button-nested-width: calc(
|
|
134
|
+
--ni-private-tree-item-nested-width: 1em;
|
|
135
|
+
--ni-private-expand-collapse-button-nested-width: calc(
|
|
136
|
+
${iconSize} * -1
|
|
137
|
+
);
|
|
136
138
|
}
|
|
137
139
|
|
|
138
140
|
${
|
|
@@ -163,7 +165,7 @@ export const styles = (context) => css `
|
|
|
163
165
|
${ /* ltr styles */''}
|
|
164
166
|
:host(.nested) .expand-collapse-button {
|
|
165
167
|
left: var(
|
|
166
|
-
--expand-collapse-button-nested-width,
|
|
168
|
+
--ni-private-expand-collapse-button-nested-width,
|
|
167
169
|
calc(${iconSize} * -1)
|
|
168
170
|
);
|
|
169
171
|
}
|
|
@@ -179,7 +181,7 @@ export const styles = (context) => css `
|
|
|
179
181
|
${ /* rtl styles */''}
|
|
180
182
|
:host(.nested) .expand-collapse-button {
|
|
181
183
|
right: var(
|
|
182
|
-
--expand-collapse-button-nested-width,
|
|
184
|
+
--ni-private-expand-collapse-button-nested-width,
|
|
183
185
|
calc(${iconSize} * -1)
|
|
184
186
|
);
|
|
185
187
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styles.js","sourceRoot":"","sources":["../../../src/tree-item/styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"styles.js","sourceRoot":"","sources":["../../../src/tree-item/styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAiB,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EACH,OAAO,EAEP,QAAQ,EAEX,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EACH,gBAAgB,EAChB,UAAU,EACV,gBAAgB,EAChB,iBAAiB,EACjB,eAAe,EACf,cAAc,EACd,sBAAsB,EACtB,WAAW,EACX,QAAQ,EACX,MAAM,iCAAiC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C"}
|
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
import { TreeView as FoundationTreeView } from '@microsoft/fast-foundation';
|
|
2
|
-
import {
|
|
2
|
+
import { TreeViewSelectionMode } from './types';
|
|
3
|
+
export type { TreeView };
|
|
4
|
+
declare global {
|
|
5
|
+
interface HTMLElementTagNameMap {
|
|
6
|
+
'nimble-tree-view': TreeView;
|
|
7
|
+
}
|
|
8
|
+
}
|
|
3
9
|
/**
|
|
4
10
|
* A function that returns a nimble-tree-view registration for configuring the component with a DesignSystem.
|
|
5
11
|
* Implements {@link @microsoft/fast-foundation#treeViewTemplate}
|
|
@@ -10,7 +16,7 @@ import { SelectionMode } from './types';
|
|
|
10
16
|
* Generates HTML Element: \<nimble-tree-view\>
|
|
11
17
|
*
|
|
12
18
|
*/
|
|
13
|
-
|
|
14
|
-
selectionMode:
|
|
19
|
+
declare class TreeView extends FoundationTreeView {
|
|
20
|
+
selectionMode: TreeViewSelectionMode;
|
|
15
21
|
connectedCallback(): void;
|
|
16
22
|
}
|
|
@@ -2,7 +2,7 @@ import { __decorate } from "tslib";
|
|
|
2
2
|
import { attr } from '@microsoft/fast-element';
|
|
3
3
|
import { treeViewTemplate as template, TreeView as FoundationTreeView, DesignSystem } from '@microsoft/fast-foundation';
|
|
4
4
|
import { styles } from './styles';
|
|
5
|
-
import {
|
|
5
|
+
import { TreeViewSelectionMode } from './types';
|
|
6
6
|
/**
|
|
7
7
|
* A function that returns a nimble-tree-view registration for configuring the component with a DesignSystem.
|
|
8
8
|
* Implements {@link @microsoft/fast-foundation#treeViewTemplate}
|
|
@@ -13,11 +13,11 @@ import { SelectionMode } from './types';
|
|
|
13
13
|
* Generates HTML Element: \<nimble-tree-view\>
|
|
14
14
|
*
|
|
15
15
|
*/
|
|
16
|
-
|
|
16
|
+
class TreeView extends FoundationTreeView {
|
|
17
17
|
connectedCallback() {
|
|
18
18
|
super.connectedCallback();
|
|
19
19
|
if (!this.selectionMode) {
|
|
20
|
-
this.selectionMode =
|
|
20
|
+
this.selectionMode = TreeViewSelectionMode.All;
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
23
|
}
|
|
@@ -27,6 +27,7 @@ __decorate([
|
|
|
27
27
|
const nimbleTreeView = TreeView.compose({
|
|
28
28
|
baseName: 'tree-view',
|
|
29
29
|
baseClass: FoundationTreeView,
|
|
30
|
+
// @ts-expect-error FAST templates have incorrect type, see: https://github.com/microsoft/fast/issues/5047
|
|
30
31
|
template,
|
|
31
32
|
styles
|
|
32
33
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/tree-view/index.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,yBAAyB,CAAC;AAC/C,OAAO,EACH,gBAAgB,IAAI,QAAQ,EAC5B,QAAQ,IAAI,kBAAkB,EAC9B,YAAY,EACf,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/tree-view/index.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,yBAAyB,CAAC;AAC/C,OAAO,EACH,gBAAgB,IAAI,QAAQ,EAC5B,QAAQ,IAAI,kBAAkB,EAC9B,YAAY,EACf,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AAUhD;;;;;;;;;GASG;AACH,MAAM,QAAS,SAAQ,kBAAkB;IAI9B,iBAAiB;QACpB,KAAK,CAAC,iBAAiB,EAAE,CAAC;QAC1B,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE;YACrB,IAAI,CAAC,aAAa,GAAG,qBAAqB,CAAC,GAAG,CAAC;SAClD;IACL,CAAC;CACJ;AARG;IADC,IAAI,CAAC,EAAE,SAAS,EAAE,gBAAgB,EAAE,CAAC;+CACO;AAUjD,MAAM,cAAc,GAAG,QAAQ,CAAC,OAAO,CAAC;IACpC,QAAQ,EAAE,WAAW;IACrB,SAAS,EAAE,kBAAkB;IAC7B,0GAA0G;IAC1G,QAAQ;IACR,MAAM;CACT,CAAC,CAAC;AAEH,YAAY,CAAC,WAAW,EAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,QAAQ,CAAC,cAAc,EAAE,CAAC,CAAC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export declare const pinnedSelectedAttribute = "pinned-selected";
|
|
2
2
|
export declare const groupSelectedAttribute = "group-selected";
|
|
3
|
-
export declare enum
|
|
3
|
+
export declare enum TreeViewSelectionMode {
|
|
4
4
|
All = "all",
|
|
5
5
|
LeavesOnly = "leaves-only"
|
|
6
6
|
}
|
|
7
|
+
export declare type TreeViewSelectionModeAttribute = `${TreeViewSelectionMode}`;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
export const pinnedSelectedAttribute = 'pinned-selected';
|
|
2
2
|
export const groupSelectedAttribute = 'group-selected';
|
|
3
|
-
export var
|
|
4
|
-
(function (
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
})(
|
|
3
|
+
export var TreeViewSelectionMode;
|
|
4
|
+
(function (TreeViewSelectionMode) {
|
|
5
|
+
TreeViewSelectionMode["All"] = "all";
|
|
6
|
+
TreeViewSelectionMode["LeavesOnly"] = "leaves-only";
|
|
7
|
+
})(TreeViewSelectionMode || (TreeViewSelectionMode = {}));
|
|
8
8
|
//# sourceMappingURL=types.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/tree-view/types.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,uBAAuB,GAAG,iBAAiB,CAAC;AACzD,MAAM,CAAC,MAAM,sBAAsB,GAAG,gBAAgB,CAAC;AAEvD,MAAM,CAAN,IAAY,
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/tree-view/types.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,uBAAuB,GAAG,iBAAiB,CAAC;AACzD,MAAM,CAAC,MAAM,sBAAsB,GAAG,gBAAgB,CAAC;AAEvD,MAAM,CAAN,IAAY,qBAGX;AAHD,WAAY,qBAAqB;IAC7B,oCAAW,CAAA;IACX,mDAA0B,CAAA;AAC9B,CAAC,EAHW,qBAAqB,KAArB,qBAAqB,QAGhC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { Behavior, ElementStyles, FASTElement } from '@microsoft/fast-element';
|
|
2
|
+
/**
|
|
3
|
+
* Behavior to conditionally apply LTR and RTL stylesheets. To determine which to apply,
|
|
4
|
+
* the behavior will use the nearest DesignSystemProvider's 'direction' design system value.
|
|
5
|
+
*
|
|
6
|
+
* @public
|
|
7
|
+
* @example
|
|
8
|
+
* ```ts
|
|
9
|
+
* import { css } from "@microsoft/fast-element";
|
|
10
|
+
* import { DirectionalStyleSheetBehavior } from "@microsoft/fast-foundation";
|
|
11
|
+
*
|
|
12
|
+
* css`
|
|
13
|
+
* // ...
|
|
14
|
+
* `.withBehaviors(new DirectionalStyleSheetBehavior(
|
|
15
|
+
* css`:host { content: "ltr"}`),
|
|
16
|
+
* css`:host { content: "rtl"}`),
|
|
17
|
+
* )
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
export declare class DirectionalStyleSheetBehavior implements Behavior {
|
|
21
|
+
private ltr;
|
|
22
|
+
private rtl;
|
|
23
|
+
private cache;
|
|
24
|
+
constructor(ltr: ElementStyles | null, rtl: ElementStyles | null);
|
|
25
|
+
/**
|
|
26
|
+
* @internal
|
|
27
|
+
*/
|
|
28
|
+
bind(source: FASTElement & HTMLElement): void;
|
|
29
|
+
/**
|
|
30
|
+
* @internal
|
|
31
|
+
*/
|
|
32
|
+
unbind(source: FASTElement & HTMLElement): void;
|
|
33
|
+
private attach;
|
|
34
|
+
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
// Sourced from: https://github.com/microsoft/fast/blob/a150068ee196e73fe7a4f7b538a38752e0e506ba/packages/web-components/fast-components/src/styles/direction.ts
|
|
3
|
+
// Changes: Updated imports to reference nimble design tokens
|
|
4
|
+
import { direction as directionDesignToken } from '../../theme-provider';
|
|
5
|
+
/**
|
|
6
|
+
* Behavior to conditionally apply LTR and RTL stylesheets. To determine which to apply,
|
|
7
|
+
* the behavior will use the nearest DesignSystemProvider's 'direction' design system value.
|
|
8
|
+
*
|
|
9
|
+
* @public
|
|
10
|
+
* @example
|
|
11
|
+
* ```ts
|
|
12
|
+
* import { css } from "@microsoft/fast-element";
|
|
13
|
+
* import { DirectionalStyleSheetBehavior } from "@microsoft/fast-foundation";
|
|
14
|
+
*
|
|
15
|
+
* css`
|
|
16
|
+
* // ...
|
|
17
|
+
* `.withBehaviors(new DirectionalStyleSheetBehavior(
|
|
18
|
+
* css`:host { content: "ltr"}`),
|
|
19
|
+
* css`:host { content: "rtl"}`),
|
|
20
|
+
* )
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
export class DirectionalStyleSheetBehavior {
|
|
24
|
+
constructor(ltr, rtl) {
|
|
25
|
+
this.cache = new WeakMap();
|
|
26
|
+
this.ltr = ltr;
|
|
27
|
+
this.rtl = rtl;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* @internal
|
|
31
|
+
*/
|
|
32
|
+
bind(source) {
|
|
33
|
+
this.attach(source);
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* @internal
|
|
37
|
+
*/
|
|
38
|
+
unbind(source) {
|
|
39
|
+
const cache = this.cache.get(source);
|
|
40
|
+
if (cache) {
|
|
41
|
+
directionDesignToken.unsubscribe(cache);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
attach(source) {
|
|
45
|
+
const subscriber = this.cache.get(source) ||
|
|
46
|
+
new DirectionalStyleSheetBehaviorSubscription(this.ltr, this.rtl, source);
|
|
47
|
+
const value = directionDesignToken.getValueFor(source);
|
|
48
|
+
directionDesignToken.subscribe(subscriber);
|
|
49
|
+
subscriber.attach(value);
|
|
50
|
+
this.cache.set(source, subscriber);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Subscription for {@link DirectionalStyleSheetBehavior}
|
|
55
|
+
*/
|
|
56
|
+
class DirectionalStyleSheetBehaviorSubscription {
|
|
57
|
+
constructor(ltr, rtl, source) {
|
|
58
|
+
this.ltr = ltr;
|
|
59
|
+
this.rtl = rtl;
|
|
60
|
+
this.source = source;
|
|
61
|
+
this.attached = null;
|
|
62
|
+
}
|
|
63
|
+
handleChange({ target, token, }) {
|
|
64
|
+
this.attach(token.getValueFor(target));
|
|
65
|
+
}
|
|
66
|
+
attach(direction) {
|
|
67
|
+
if (this.attached !== this[direction]) {
|
|
68
|
+
if (this.attached !== null) {
|
|
69
|
+
this.source.$fastController.removeStyles(this.attached);
|
|
70
|
+
}
|
|
71
|
+
this.attached = this[direction];
|
|
72
|
+
if (this.attached !== null) {
|
|
73
|
+
this.source.$fastController.addStyles(this.attached);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
//# sourceMappingURL=direction.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"direction.js","sourceRoot":"","sources":["../../../../src/utilities/style/direction.ts"],"names":[],"mappings":"AAAA,oBAAoB;AACpB,gKAAgK;AAChK,6DAA6D;AAU7D,OAAO,EAAE,SAAS,IAAI,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AACzE;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,OAAO,6BAA6B;IAQtC,YAAY,GAAyB,EAAE,GAAyB;QALxD,UAAK,GAGT,IAAI,OAAO,EAAE,CAAC;QAGd,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;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AI,CAAC,SAAS,CAAC,EAAE;YACnC,IAAI,IAAI,CAAC,QAAQ,KAAK,IAAI,EAAE;gBACxB,IAAI,CAAC,MAAM,CAAC,eAAe,CAAC,YAAY,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;aAC3D;YACD,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,SAAS,CAAC,CAAC;YAChC,IAAI,IAAI,CAAC,QAAQ,KAAK,IAAI,EAAE;gBACxB,IAAI,CAAC,MAAM,CAAC,eAAe,CAAC,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;aACxD;SACJ;IACL,CAAC;CACJ"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* This file is a workaround for: https://github.com/prettier/prettier/issues/11400
|
|
3
3
|
*/
|
|
4
|
-
// eslint-disable-next-line
|
|
4
|
+
// eslint-disable-next-line no-restricted-imports
|
|
5
5
|
import { focusVisible as focusVisibleOriginal } from '@microsoft/fast-foundation';
|
|
6
6
|
/**
|
|
7
7
|
* The string representing the focus selector to be used. Value
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"focus.js","sourceRoot":"","sources":["../../../../src/utilities/style/focus.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,
|
|
1
|
+
{"version":3,"file":"focus.js","sourceRoot":"","sources":["../../../../src/utilities/style/focus.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,iDAAiD;AACjD,OAAO,EAAE,YAAY,IAAI,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAElF;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,IAAI,oBAAoB,EAAE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prefers-reduced-motion.js","sourceRoot":"","sources":["../../../../src/utilities/style/prefers-reduced-motion.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,CAAC,MAAM,8BAA8B,GAAmB,MAAM,CAAC,UAAU,CAC3E,kCAAkC,CACrC,CAAC"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { Behavior, ElementStyles, FASTElement } from '@microsoft/fast-element';
|
|
2
|
+
import type { Theme } from '../../theme-provider/types';
|
|
3
|
+
export declare type LightStyle = ElementStyles | null;
|
|
4
|
+
export declare type DarkStyleOrAlias = ElementStyles | null | Theme.Light;
|
|
5
|
+
export declare type ColorStyleOrAlias = ElementStyles | null | Theme.Light | Theme.Dark;
|
|
6
|
+
export declare type LegacyBlueStyleOrAlias = ElementStyles | null | Theme.Light | Theme.Dark | Theme.Color;
|
|
7
|
+
/**
|
|
8
|
+
* Behavior to conditionally apply theme-based stylesheets.
|
|
9
|
+
*/
|
|
10
|
+
declare class ThemeStyleSheetBehavior implements Behavior {
|
|
11
|
+
private readonly themeStyles;
|
|
12
|
+
private readonly cache;
|
|
13
|
+
constructor(lightStyle: LightStyle, darkStyleOrAlias: DarkStyleOrAlias, colorStyleOrAlias: ColorStyleOrAlias, legacyBlueStyleOrAlias: LegacyBlueStyleOrAlias);
|
|
14
|
+
private static resolveTheme;
|
|
15
|
+
/**
|
|
16
|
+
* @internal
|
|
17
|
+
*/
|
|
18
|
+
bind(source: FASTElement & HTMLElement): void;
|
|
19
|
+
/**
|
|
20
|
+
* @internal
|
|
21
|
+
*/
|
|
22
|
+
unbind(source: FASTElement & HTMLElement): void;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Behavior to conditionally apply theme-based stylesheets. To determine which to apply,
|
|
26
|
+
* the behavior will use the nearest ThemeProvider's 'theme' design system value.
|
|
27
|
+
* To re-use the same style for multiple themes you can specify the name of an already
|
|
28
|
+
* defined theme to alias them together.
|
|
29
|
+
*
|
|
30
|
+
* @public
|
|
31
|
+
* @example
|
|
32
|
+
* ```ts
|
|
33
|
+
* css`
|
|
34
|
+
* // ...
|
|
35
|
+
* `.withBehaviors(new ThemeStyleSheetBehavior(
|
|
36
|
+
* css`:host { ... Theme.Light style... }`),
|
|
37
|
+
* css`:host { ... Theme.Dark style... }`),
|
|
38
|
+
* null, // No style needed for Theme.Color style
|
|
39
|
+
* Theme.Light, // For the Theme.LegacyBlue style, re-use the previously set Theme.Light style
|
|
40
|
+
* )
|
|
41
|
+
* ```
|
|
42
|
+
*/
|
|
43
|
+
export declare const themeBehavior: (lightStyle: LightStyle, darkStyleOrAlias: DarkStyleOrAlias, colorStyleOrAlias: ColorStyleOrAlias, legacyBlueStyleOrAlias: LegacyBlueStyleOrAlias) => ThemeStyleSheetBehavior;
|
|
44
|
+
export {};
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
/* eslint-disable max-classes-per-file */
|
|
2
|
+
import { ElementStyles } from '@microsoft/fast-element';
|
|
3
|
+
import { theme as themeToken } from '../../theme-provider';
|
|
4
|
+
/**
|
|
5
|
+
* Subscription for {@link ThemeStyleSheetBehavior}
|
|
6
|
+
*/
|
|
7
|
+
class ThemeStyleSheetBehaviorSubscription {
|
|
8
|
+
constructor(themeStyles, source) {
|
|
9
|
+
this.themeStyles = themeStyles;
|
|
10
|
+
this.source = source;
|
|
11
|
+
this.attached = null;
|
|
12
|
+
}
|
|
13
|
+
handleChange({ target, token }) {
|
|
14
|
+
this.attach(token.getValueFor(target));
|
|
15
|
+
}
|
|
16
|
+
attach(theme) {
|
|
17
|
+
if (this.attached !== this.themeStyles[theme]) {
|
|
18
|
+
if (this.attached !== null) {
|
|
19
|
+
this.source.$fastController.removeStyles(this.attached);
|
|
20
|
+
}
|
|
21
|
+
this.attached = this.themeStyles[theme];
|
|
22
|
+
if (this.attached !== null) {
|
|
23
|
+
this.source.$fastController.addStyles(this.attached);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Behavior to conditionally apply theme-based stylesheets.
|
|
30
|
+
*/
|
|
31
|
+
class ThemeStyleSheetBehavior {
|
|
32
|
+
constructor(lightStyle, darkStyleOrAlias, colorStyleOrAlias, legacyBlueStyleOrAlias) {
|
|
33
|
+
this.cache = new WeakMap();
|
|
34
|
+
const light = lightStyle;
|
|
35
|
+
const dark = ThemeStyleSheetBehavior.resolveTheme(darkStyleOrAlias, {
|
|
36
|
+
light,
|
|
37
|
+
dark: null,
|
|
38
|
+
color: null,
|
|
39
|
+
'legacy-blue': null
|
|
40
|
+
});
|
|
41
|
+
const color = ThemeStyleSheetBehavior.resolveTheme(colorStyleOrAlias, {
|
|
42
|
+
light,
|
|
43
|
+
dark,
|
|
44
|
+
color: null,
|
|
45
|
+
'legacy-blue': null
|
|
46
|
+
});
|
|
47
|
+
const legacyBlue = ThemeStyleSheetBehavior.resolveTheme(legacyBlueStyleOrAlias, {
|
|
48
|
+
light,
|
|
49
|
+
dark,
|
|
50
|
+
color,
|
|
51
|
+
'legacy-blue': null
|
|
52
|
+
});
|
|
53
|
+
this.themeStyles = {
|
|
54
|
+
light,
|
|
55
|
+
dark,
|
|
56
|
+
color,
|
|
57
|
+
'legacy-blue': legacyBlue
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
static resolveTheme(value, currentThemeStyles) {
|
|
61
|
+
if (value instanceof ElementStyles || value === null) {
|
|
62
|
+
return value;
|
|
63
|
+
}
|
|
64
|
+
const currentStyle = currentThemeStyles[value];
|
|
65
|
+
if (currentStyle === null) {
|
|
66
|
+
throw new Error(`Tried to alias to theme '${value}' but the theme value is not set to a style.`);
|
|
67
|
+
}
|
|
68
|
+
return currentStyle;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* @internal
|
|
72
|
+
*/
|
|
73
|
+
bind(source) {
|
|
74
|
+
const subscriber = this.cache.get(source)
|
|
75
|
+
|| new ThemeStyleSheetBehaviorSubscription(this.themeStyles, source);
|
|
76
|
+
const value = themeToken.getValueFor(source);
|
|
77
|
+
// Currently subscriber from cache may have gone through unbind
|
|
78
|
+
// but still be in cache so always resubscribe
|
|
79
|
+
// See: https://github.com/microsoft/fast/issues/3246#issuecomment-1030424876
|
|
80
|
+
themeToken.subscribe(subscriber);
|
|
81
|
+
subscriber.attach(value);
|
|
82
|
+
this.cache.set(source, subscriber);
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* @internal
|
|
86
|
+
*/
|
|
87
|
+
unbind(source) {
|
|
88
|
+
const subscriber = this.cache.get(source);
|
|
89
|
+
if (subscriber) {
|
|
90
|
+
themeToken.unsubscribe(subscriber);
|
|
91
|
+
}
|
|
92
|
+
// Currently does not evict subscriber from cache
|
|
93
|
+
// See: https://github.com/microsoft/fast/issues/3246#issuecomment-1030424876
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Behavior to conditionally apply theme-based stylesheets. To determine which to apply,
|
|
98
|
+
* the behavior will use the nearest ThemeProvider's 'theme' design system value.
|
|
99
|
+
* To re-use the same style for multiple themes you can specify the name of an already
|
|
100
|
+
* defined theme to alias them together.
|
|
101
|
+
*
|
|
102
|
+
* @public
|
|
103
|
+
* @example
|
|
104
|
+
* ```ts
|
|
105
|
+
* css`
|
|
106
|
+
* // ...
|
|
107
|
+
* `.withBehaviors(new ThemeStyleSheetBehavior(
|
|
108
|
+
* css`:host { ... Theme.Light style... }`),
|
|
109
|
+
* css`:host { ... Theme.Dark style... }`),
|
|
110
|
+
* null, // No style needed for Theme.Color style
|
|
111
|
+
* Theme.Light, // For the Theme.LegacyBlue style, re-use the previously set Theme.Light style
|
|
112
|
+
* )
|
|
113
|
+
* ```
|
|
114
|
+
*/
|
|
115
|
+
export const themeBehavior = (lightStyle, darkStyleOrAlias, colorStyleOrAlias, legacyBlueStyleOrAlias) => new ThemeStyleSheetBehavior(lightStyle, darkStyleOrAlias, colorStyleOrAlias, legacyBlueStyleOrAlias);
|
|
116
|
+
//# sourceMappingURL=theme.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"theme.js","sourceRoot":"","sources":["../../../../src/utilities/style/theme.ts"],"names":[],"mappings":"AAAA,y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