@spectrum-web-components/coachmark 1.2.0-beta.8 → 1.2.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/package.json +10 -10
- package/src/Coachmark.dev.js +1 -7
- package/src/Coachmark.dev.js.map +2 -2
- package/src/Coachmark.js +5 -5
- package/src/Coachmark.js.map +3 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@spectrum-web-components/coachmark",
|
|
3
|
-
"version": "1.2.0
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -72,14 +72,14 @@
|
|
|
72
72
|
"lit-html"
|
|
73
73
|
],
|
|
74
74
|
"dependencies": {
|
|
75
|
-
"@spectrum-web-components/asset": "^1.2.0
|
|
76
|
-
"@spectrum-web-components/base": "^1.2.0
|
|
77
|
-
"@spectrum-web-components/button": "^1.2.0
|
|
78
|
-
"@spectrum-web-components/button-group": "^1.2.0
|
|
79
|
-
"@spectrum-web-components/icon": "^1.2.0
|
|
80
|
-
"@spectrum-web-components/icons-ui": "^1.2.0
|
|
81
|
-
"@spectrum-web-components/reactive-controllers": "^1.2.0
|
|
82
|
-
"@spectrum-web-components/shared": "^1.2.0
|
|
75
|
+
"@spectrum-web-components/asset": "^1.2.0",
|
|
76
|
+
"@spectrum-web-components/base": "^1.2.0",
|
|
77
|
+
"@spectrum-web-components/button": "^1.2.0",
|
|
78
|
+
"@spectrum-web-components/button-group": "^1.2.0",
|
|
79
|
+
"@spectrum-web-components/icon": "^1.2.0",
|
|
80
|
+
"@spectrum-web-components/icons-ui": "^1.2.0",
|
|
81
|
+
"@spectrum-web-components/reactive-controllers": "^1.2.0",
|
|
82
|
+
"@spectrum-web-components/shared": "^1.2.0"
|
|
83
83
|
},
|
|
84
84
|
"devDependencies": {
|
|
85
85
|
"@spectrum-css/coachindicator": "3.0.0-s2-foundations.16",
|
|
@@ -91,5 +91,5 @@
|
|
|
91
91
|
"./sp-*.js",
|
|
92
92
|
"./**/*.dev.js"
|
|
93
93
|
],
|
|
94
|
-
"gitHead": "
|
|
94
|
+
"gitHead": "e4aec7b389e6209984e4df74f9b86b3ee0c485dd"
|
|
95
95
|
}
|
package/src/Coachmark.dev.js
CHANGED
|
@@ -17,7 +17,6 @@ import { property } from "@spectrum-web-components/base/src/decorators.js";
|
|
|
17
17
|
import { when } from "@spectrum-web-components/base/src/directives.js";
|
|
18
18
|
import coachmarkStyles from "./coachmark.css.js";
|
|
19
19
|
import chevronStyles from "@spectrum-web-components/icon/src/spectrum-icon-chevron.css.js";
|
|
20
|
-
import chevronIconOverrides from "@spectrum-web-components/icon/src/icon-chevron-overrides.css.js";
|
|
21
20
|
import "@spectrum-web-components/icons-ui/icons/sp-icon-chevron200.js";
|
|
22
21
|
import { Popover } from "@spectrum-web-components/popover";
|
|
23
22
|
import { join } from "@spectrum-web-components/base/src/directives.js";
|
|
@@ -106,12 +105,7 @@ export class Coachmark extends Popover {
|
|
|
106
105
|
};
|
|
107
106
|
}
|
|
108
107
|
static get styles() {
|
|
109
|
-
return [
|
|
110
|
-
...super.styles,
|
|
111
|
-
coachmarkStyles,
|
|
112
|
-
chevronStyles,
|
|
113
|
-
chevronIconOverrides
|
|
114
|
-
];
|
|
108
|
+
return [...super.styles, coachmarkStyles, chevronStyles];
|
|
115
109
|
}
|
|
116
110
|
// render video and images
|
|
117
111
|
renderMedia() {
|
package/src/Coachmark.dev.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["Coachmark.ts"],
|
|
4
|
-
"sourcesContent": ["/*\nCopyright 2023 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\nimport {\n CSSResultArray,\n html,\n nothing,\n TemplateResult,\n} from '@spectrum-web-components/base';\nimport { property } from '@spectrum-web-components/base/src/decorators.js';\nimport { when } from '@spectrum-web-components/base/src/directives.js';\nimport coachmarkStyles from './coachmark.css.js';\nimport chevronStyles from '@spectrum-web-components/icon/src/spectrum-icon-chevron.css.js';\nimport chevronIconOverrides from '@spectrum-web-components/icon/src/icon-chevron-overrides.css.js';\nimport '@spectrum-web-components/icons-ui/icons/sp-icon-chevron200.js';\nimport { Popover } from '@spectrum-web-components/popover';\nimport { join } from '@spectrum-web-components/base/src/directives.js';\nimport { ifDefined } from '@spectrum-web-components/base/src/directives.js';\nimport type { Placement } from '@spectrum-web-components/overlay';\nimport { MediaType } from './CoachmarkItem.dev.js'\nimport type { CoachmarkItem } from './CoachmarkItem.dev.js'\nimport '@spectrum-web-components/asset/sp-asset.js';\nimport '@spectrum-web-components/button/sp-button.js';\nimport '@spectrum-web-components/button-group/sp-button-group.js';\n\n/**\n * @element sp-coachmark\n * @fires primary - Announces that the \"primary\" button has been clicked.\n * @fires secondary - Announces that the \"secondary\" button has been clicked.\n * @slot cover-photo - This is the cover photo for Default and Quiet Coachmark\n * @slot heading - HTML content to be listed as the heading\n * @slot description - A description of the card\n * @slot actions - an `sp-action-menu` element outlining actions to take on the represened object\n * @slot step-count - Override the default pagination delivery with your own internationalized content\n */\nexport class Coachmark extends Popover {\n public static override get styles(): CSSResultArray {\n return [\n ...super.styles,\n coachmarkStyles,\n chevronStyles,\n chevronIconOverrides,\n ];\n }\n @property({ type: Object })\n public item?: CoachmarkItem;\n\n @property({ type: String })\n public override placement: Placement = 'right';\n\n @property({ type: Object, attribute: false })\n private content?: {\n title?: string;\n description?: string;\n imageAlt?: string;\n };\n\n @property({ attribute: 'shortcut-key' })\n private shortcutKey?: string;\n\n @property({ type: Array })\n public modifierKeys?: string[] = [];\n\n @property({ attribute: 'src' })\n private source?: string;\n\n @property({ attribute: 'media-type' })\n private mediaType?: MediaType;\n\n @property({ type: Boolean, attribute: 'has-asset', reflect: true })\n public hasAsset = false;\n\n @property()\n public asset?: 'file' | 'folder';\n\n @property({ type: Number, attribute: 'current-step' })\n public currentStep?: number;\n\n @property({ type: Number, attribute: 'total-steps' })\n public totalSteps?: number;\n\n @property({ type: String, attribute: 'primary-cta' })\n primaryCTA?: string;\n\n @property({ type: String, attribute: 'secondary-cta' })\n secondaryCTA?: string;\n\n // render video and images\n private renderMedia(): TemplateResult {\n const isImage = this.mediaType === MediaType.IMAGE;\n if (!isImage) {\n return html`\n <slot name=\"asset\"></slot>\n `;\n }\n return html`\n <sp-asset id=\"cover-photo\">\n <div class=\"image-wrapper\">\n <img\n class=\"image\"\n loading=\"lazy\"\n slot=\"cover-photo\"\n src=\"${ifDefined(this.source)}\"\n alt=\"${ifDefined(this?.content?.imageAlt)}\"\n />\n </div>\n </sp-asset>\n `;\n }\n // method to render modifier\n private renderModifier(\n modifierKey: string,\n type: 'modifier' | 'shortcut' = 'modifier'\n ): TemplateResult {\n return html`\n <span type=\"${type}\" class=\"keyboard-shortcut\">${modifierKey}</span>\n `;\n }\n\n private renderJoiner(): TemplateResult {\n return html`\n <span class=\"plus\">+</span>\n `;\n }\n // render heading title and modifier\n private renderHeader(): TemplateResult {\n const hasModifier = this.modifierKeys && this.modifierKeys?.length > 0;\n const hasShortcut = Boolean(this.shortcutKey);\n const hasTitle = Boolean(this.content?.title);\n if (!hasTitle && !hasModifier && !hasShortcut) {\n return html`\n <div class=\"title\"><slot name=\"title\"></slot></div>\n `;\n }\n return html`\n ${hasTitle\n ? html`\n <div class=\"title\">${this.content?.title}</div>\n `\n : nothing}\n ${hasModifier || hasShortcut\n ? html`\n <kbd class=\"keys spectrum-Body spectrum-Body--sizeS\">\n ${hasModifier\n ? join(\n this.modifierKeys?.map((k) =>\n this.renderModifier(k)\n ),\n this.renderJoiner()\n )\n : nothing}\n ${hasShortcut && hasModifier\n ? this.renderJoiner()\n : nothing}\n ${hasShortcut\n ? this.renderModifier(\n this.shortcutKey!,\n 'shortcut'\n )\n : nothing}\n </kbd>\n `\n : nothing}\n `;\n }\n // render description\n private renderContent(): TemplateResult {\n const hasDescription = Boolean(this.content?.description);\n if (!hasDescription)\n return html`\n <slot name=\"content\"></slot>\n `;\n return html`\n <div>${this.content?.description}</div>\n `;\n }\n\n // event on primary button\n private handlePrimaryCTA(): void {\n this.dispatchEvent(\n new Event('primary', {\n bubbles: true,\n composed: true,\n })\n );\n }\n // event on secondary button\n private handleSecondaryCTA(): void {\n this.dispatchEvent(\n new Event('secondary', {\n bubbles: true,\n composed: true,\n })\n );\n }\n\n private renderSecondaryButton = (): TemplateResult => {\n return html`\n <sp-button\n treatment=\"outline\"\n variant=\"secondary\"\n @click=${this.handleSecondaryCTA}\n >\n ${this.secondaryCTA}\n </sp-button>\n `;\n };\n\n private renderPrimaryButton = (): TemplateResult => {\n return html`\n <sp-button\n size=\"s\"\n treatment=\"outline\"\n variant=\"primary\"\n @click=${this.handlePrimaryCTA}\n >\n ${this.primaryCTA}\n </sp-button>\n `;\n };\n\n private renderSecondaryButtonMobile = (): TemplateResult => {\n return html`\n <sp-button\n variant=\"secondary\"\n treatment=\"outline\"\n icon-only\n aria-label=\"previous\"\n @click=${this.handleSecondaryCTA}\n >\n <sp-icon-chevron200\n size=\"s\"\n class=\"spectrum-UIIcon-ChevronLeft75\"\n slot=\"icon\"\n ></sp-icon-chevron200>\n </sp-button>\n `;\n };\n\n private renderPrimaryButtonMobile = (): TemplateResult => {\n return html`\n <sp-button\n size=\"s\"\n treatment=\"outline\"\n variant=\"primary\"\n @click=${this.handlePrimaryCTA}\n >\n ${this.primaryCTA}\n </sp-button>\n `;\n };\n\n protected renderButtons(): TemplateResult {\n return html`\n <sp-button-group class=\"spectrum-ButtonGroup buttongroup\">\n ${when(this.secondaryCTA, this.renderSecondaryButton)}\n ${when(this.primaryCTA, this.renderPrimaryButton)}\n </sp-button-group>\n <sp-button-group\n class=\"spectrum-ButtonGroup buttongroup-mobile\"\n size=\"s\"\n >\n ${when(this.secondaryCTA, this.renderSecondaryButtonMobile)}\n ${when(this.primaryCTA, this.renderPrimaryButtonMobile)}\n </sp-button-group>\n `;\n }\n\n // render steps\n protected renderSteps = (): TemplateResult => {\n return html`\n <div class=\"step\" role=\"status\">\n <span aria-live=\"polite\">\n <slot name=\"step-count\">\n ${this.currentStep} of ${this.totalSteps}\n </slot>\n </span>\n </div>\n `;\n };\n // render action menu\n protected renderActionMenu = (): TemplateResult => {\n return html`\n <div class=\"action-menu\">\n <slot name=\"actions\"></slot>\n </div>\n `;\n };\n\n protected override render(): TemplateResult {\n return html`\n ${this.renderMedia()}\n <div class=\"header\">\n <div class=\"flex-container\">${this.renderHeader()}</div>\n <div class=\"static-item\">\n ${when(\n this.secondaryCTA && this.primaryCTA,\n this.renderActionMenu\n )}\n </div>\n </div>\n\n <div class=\"content\">${this.renderContent()}</div>\n <div class=\"footer\">\n ${when(\n this.totalSteps && this.totalSteps > 1,\n this.renderSteps\n )}\n ${this.renderButtons()}\n </div>\n `;\n }\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;AAWA;AAAA,EAEI;AAAA,EACA;AAAA,OAEG;AACP,SAAS,gBAAgB;AACzB,SAAS,YAAY;AACrB,OAAO,qBAAqB;AAC5B,OAAO,mBAAmB;AAC1B,OAAO
|
|
4
|
+
"sourcesContent": ["/*\nCopyright 2023 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\nimport {\n CSSResultArray,\n html,\n nothing,\n TemplateResult,\n} from '@spectrum-web-components/base';\nimport { property } from '@spectrum-web-components/base/src/decorators.js';\nimport { when } from '@spectrum-web-components/base/src/directives.js';\nimport coachmarkStyles from './coachmark.css.js';\nimport chevronStyles from '@spectrum-web-components/icon/src/spectrum-icon-chevron.css.js';\nimport '@spectrum-web-components/icons-ui/icons/sp-icon-chevron200.js';\nimport { Popover } from '@spectrum-web-components/popover';\nimport { join } from '@spectrum-web-components/base/src/directives.js';\nimport { ifDefined } from '@spectrum-web-components/base/src/directives.js';\nimport type { Placement } from '@spectrum-web-components/overlay';\nimport { MediaType } from './CoachmarkItem.dev.js'\nimport type { CoachmarkItem } from './CoachmarkItem.dev.js'\nimport '@spectrum-web-components/asset/sp-asset.js';\nimport '@spectrum-web-components/button/sp-button.js';\nimport '@spectrum-web-components/button-group/sp-button-group.js';\n\n/**\n * @element sp-coachmark\n * @fires primary - Announces that the \"primary\" button has been clicked.\n * @fires secondary - Announces that the \"secondary\" button has been clicked.\n * @slot cover-photo - This is the cover photo for Default and Quiet Coachmark\n * @slot heading - HTML content to be listed as the heading\n * @slot description - A description of the card\n * @slot actions - an `sp-action-menu` element outlining actions to take on the represened object\n * @slot step-count - Override the default pagination delivery with your own internationalized content\n */\nexport class Coachmark extends Popover {\n public static override get styles(): CSSResultArray {\n return [...super.styles, coachmarkStyles, chevronStyles];\n }\n @property({ type: Object })\n public item?: CoachmarkItem;\n\n @property({ type: String })\n public override placement: Placement = 'right';\n\n @property({ type: Object, attribute: false })\n private content?: {\n title?: string;\n description?: string;\n imageAlt?: string;\n };\n\n @property({ attribute: 'shortcut-key' })\n private shortcutKey?: string;\n\n @property({ type: Array })\n public modifierKeys?: string[] = [];\n\n @property({ attribute: 'src' })\n private source?: string;\n\n @property({ attribute: 'media-type' })\n private mediaType?: MediaType;\n\n @property({ type: Boolean, attribute: 'has-asset', reflect: true })\n public hasAsset = false;\n\n @property()\n public asset?: 'file' | 'folder';\n\n @property({ type: Number, attribute: 'current-step' })\n public currentStep?: number;\n\n @property({ type: Number, attribute: 'total-steps' })\n public totalSteps?: number;\n\n @property({ type: String, attribute: 'primary-cta' })\n primaryCTA?: string;\n\n @property({ type: String, attribute: 'secondary-cta' })\n secondaryCTA?: string;\n\n // render video and images\n private renderMedia(): TemplateResult {\n const isImage = this.mediaType === MediaType.IMAGE;\n if (!isImage) {\n return html`\n <slot name=\"asset\"></slot>\n `;\n }\n return html`\n <sp-asset id=\"cover-photo\">\n <div class=\"image-wrapper\">\n <img\n class=\"image\"\n loading=\"lazy\"\n slot=\"cover-photo\"\n src=\"${ifDefined(this.source)}\"\n alt=\"${ifDefined(this?.content?.imageAlt)}\"\n />\n </div>\n </sp-asset>\n `;\n }\n // method to render modifier\n private renderModifier(\n modifierKey: string,\n type: 'modifier' | 'shortcut' = 'modifier'\n ): TemplateResult {\n return html`\n <span type=\"${type}\" class=\"keyboard-shortcut\">${modifierKey}</span>\n `;\n }\n\n private renderJoiner(): TemplateResult {\n return html`\n <span class=\"plus\">+</span>\n `;\n }\n // render heading title and modifier\n private renderHeader(): TemplateResult {\n const hasModifier = this.modifierKeys && this.modifierKeys?.length > 0;\n const hasShortcut = Boolean(this.shortcutKey);\n const hasTitle = Boolean(this.content?.title);\n if (!hasTitle && !hasModifier && !hasShortcut) {\n return html`\n <div class=\"title\"><slot name=\"title\"></slot></div>\n `;\n }\n return html`\n ${hasTitle\n ? html`\n <div class=\"title\">${this.content?.title}</div>\n `\n : nothing}\n ${hasModifier || hasShortcut\n ? html`\n <kbd class=\"keys spectrum-Body spectrum-Body--sizeS\">\n ${hasModifier\n ? join(\n this.modifierKeys?.map((k) =>\n this.renderModifier(k)\n ),\n this.renderJoiner()\n )\n : nothing}\n ${hasShortcut && hasModifier\n ? this.renderJoiner()\n : nothing}\n ${hasShortcut\n ? this.renderModifier(\n this.shortcutKey!,\n 'shortcut'\n )\n : nothing}\n </kbd>\n `\n : nothing}\n `;\n }\n // render description\n private renderContent(): TemplateResult {\n const hasDescription = Boolean(this.content?.description);\n if (!hasDescription)\n return html`\n <slot name=\"content\"></slot>\n `;\n return html`\n <div>${this.content?.description}</div>\n `;\n }\n\n // event on primary button\n private handlePrimaryCTA(): void {\n this.dispatchEvent(\n new Event('primary', {\n bubbles: true,\n composed: true,\n })\n );\n }\n // event on secondary button\n private handleSecondaryCTA(): void {\n this.dispatchEvent(\n new Event('secondary', {\n bubbles: true,\n composed: true,\n })\n );\n }\n\n private renderSecondaryButton = (): TemplateResult => {\n return html`\n <sp-button\n treatment=\"outline\"\n variant=\"secondary\"\n @click=${this.handleSecondaryCTA}\n >\n ${this.secondaryCTA}\n </sp-button>\n `;\n };\n\n private renderPrimaryButton = (): TemplateResult => {\n return html`\n <sp-button\n size=\"s\"\n treatment=\"outline\"\n variant=\"primary\"\n @click=${this.handlePrimaryCTA}\n >\n ${this.primaryCTA}\n </sp-button>\n `;\n };\n\n private renderSecondaryButtonMobile = (): TemplateResult => {\n return html`\n <sp-button\n variant=\"secondary\"\n treatment=\"outline\"\n icon-only\n aria-label=\"previous\"\n @click=${this.handleSecondaryCTA}\n >\n <sp-icon-chevron200\n size=\"s\"\n class=\"spectrum-UIIcon-ChevronLeft75\"\n slot=\"icon\"\n ></sp-icon-chevron200>\n </sp-button>\n `;\n };\n\n private renderPrimaryButtonMobile = (): TemplateResult => {\n return html`\n <sp-button\n size=\"s\"\n treatment=\"outline\"\n variant=\"primary\"\n @click=${this.handlePrimaryCTA}\n >\n ${this.primaryCTA}\n </sp-button>\n `;\n };\n\n protected renderButtons(): TemplateResult {\n return html`\n <sp-button-group class=\"spectrum-ButtonGroup buttongroup\">\n ${when(this.secondaryCTA, this.renderSecondaryButton)}\n ${when(this.primaryCTA, this.renderPrimaryButton)}\n </sp-button-group>\n <sp-button-group\n class=\"spectrum-ButtonGroup buttongroup-mobile\"\n size=\"s\"\n >\n ${when(this.secondaryCTA, this.renderSecondaryButtonMobile)}\n ${when(this.primaryCTA, this.renderPrimaryButtonMobile)}\n </sp-button-group>\n `;\n }\n\n // render steps\n protected renderSteps = (): TemplateResult => {\n return html`\n <div class=\"step\" role=\"status\">\n <span aria-live=\"polite\">\n <slot name=\"step-count\">\n ${this.currentStep} of ${this.totalSteps}\n </slot>\n </span>\n </div>\n `;\n };\n // render action menu\n protected renderActionMenu = (): TemplateResult => {\n return html`\n <div class=\"action-menu\">\n <slot name=\"actions\"></slot>\n </div>\n `;\n };\n\n protected override render(): TemplateResult {\n return html`\n ${this.renderMedia()}\n <div class=\"header\">\n <div class=\"flex-container\">${this.renderHeader()}</div>\n <div class=\"static-item\">\n ${when(\n this.secondaryCTA && this.primaryCTA,\n this.renderActionMenu\n )}\n </div>\n </div>\n\n <div class=\"content\">${this.renderContent()}</div>\n <div class=\"footer\">\n ${when(\n this.totalSteps && this.totalSteps > 1,\n this.renderSteps\n )}\n ${this.renderButtons()}\n </div>\n `;\n }\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;AAWA;AAAA,EAEI;AAAA,EACA;AAAA,OAEG;AACP,SAAS,gBAAgB;AACzB,SAAS,YAAY;AACrB,OAAO,qBAAqB;AAC5B,OAAO,mBAAmB;AAC1B,OAAO;AACP,SAAS,eAAe;AACxB,SAAS,YAAY;AACrB,SAAS,iBAAiB;AAE1B,SAAS,iBAAiB;AAE1B,OAAO;AACP,OAAO;AACP,OAAO;AAYA,aAAM,kBAAkB,QAAQ;AAAA,EAAhC;AAAA;AAQH,SAAgB,YAAuB;AAavC,SAAO,eAA0B,CAAC;AASlC,SAAO,WAAW;AA8HlB,SAAQ,wBAAwB,MAAsB;AAClD,aAAO;AAAA;AAAA;AAAA;AAAA,yBAIU,KAAK,kBAAkB;AAAA;AAAA,kBAE9B,KAAK,YAAY;AAAA;AAAA;AAAA,IAG/B;AAEA,SAAQ,sBAAsB,MAAsB;AAChD,aAAO;AAAA;AAAA;AAAA;AAAA;AAAA,yBAKU,KAAK,gBAAgB;AAAA;AAAA,kBAE5B,KA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,CAAC;AAAA,GAnC5C,UAoCF;AAGA;AAAA,EADN,SAAS,EAAE,MAAM,QAAQ,WAAW,cAAc,CAAC;AAAA,GAtC3C,UAuCF;AAGP;AAAA,EADC,SAAS,EAAE,MAAM,QAAQ,WAAW,cAAc,CAAC;AAAA,GAzC3C,UA0CT;AAGA;AAAA,EADC,SAAS,EAAE,MAAM,QAAQ,WAAW,gBAAgB,CAAC;AAAA,GA5C7C,UA6CT;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/src/Coachmark.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var v=Object.defineProperty;var b=Object.getOwnPropertyDescriptor;var r=(c,l,n,e)=>{for(var i=e>1?void 0:e?b(l,n):l,o=c.length-1,a;o>=0;o--)(a=c[o])&&(i=(e?a(l,n,i):a(i))||i);return e&&i&&v(l,n,i),i};import{html as t,nothing as u}from"@spectrum-web-components/base";import{property as s}from"@spectrum-web-components/base/src/decorators.js";import{when as p}from"@spectrum-web-components/base/src/directives.js";import
|
|
1
|
+
"use strict";var v=Object.defineProperty;var b=Object.getOwnPropertyDescriptor;var r=(c,l,n,e)=>{for(var i=e>1?void 0:e?b(l,n):l,o=c.length-1,a;o>=0;o--)(a=c[o])&&(i=(e?a(l,n,i):a(i))||i);return e&&i&&v(l,n,i),i};import{html as t,nothing as u}from"@spectrum-web-components/base";import{property as s}from"@spectrum-web-components/base/src/decorators.js";import{when as p}from"@spectrum-web-components/base/src/directives.js";import T from"./coachmark.css.js";import f from"@spectrum-web-components/icon/src/spectrum-icon-chevron.css.js";import"@spectrum-web-components/icons-ui/icons/sp-icon-chevron200.js";import{Popover as g}from"@spectrum-web-components/popover";import{join as $}from"@spectrum-web-components/base/src/directives.js";import{ifDefined as y}from"@spectrum-web-components/base/src/directives.js";import{MediaType as A}from"./CoachmarkItem.js";import"@spectrum-web-components/asset/sp-asset.js";import"@spectrum-web-components/button/sp-button.js";import"@spectrum-web-components/button-group/sp-button-group.js";export class Coachmark extends g{constructor(){super(...arguments);this.placement="right";this.modifierKeys=[];this.hasAsset=!1;this.renderSecondaryButton=()=>t`
|
|
2
2
|
<sp-button
|
|
3
3
|
treatment="outline"
|
|
4
4
|
variant="secondary"
|
|
@@ -50,15 +50,15 @@
|
|
|
50
50
|
<div class="action-menu">
|
|
51
51
|
<slot name="actions"></slot>
|
|
52
52
|
</div>
|
|
53
|
-
`}static get styles(){return[...super.styles,
|
|
53
|
+
`}static get styles(){return[...super.styles,T,f]}renderMedia(){var e;return this.mediaType===A.IMAGE?t`
|
|
54
54
|
<sp-asset id="cover-photo">
|
|
55
55
|
<div class="image-wrapper">
|
|
56
56
|
<img
|
|
57
57
|
class="image"
|
|
58
58
|
loading="lazy"
|
|
59
59
|
slot="cover-photo"
|
|
60
|
-
src="${
|
|
61
|
-
alt="${
|
|
60
|
+
src="${y(this.source)}"
|
|
61
|
+
alt="${y((e=this==null?void 0:this.content)==null?void 0:e.imageAlt)}"
|
|
62
62
|
/>
|
|
63
63
|
</div>
|
|
64
64
|
</sp-asset>
|
|
@@ -76,7 +76,7 @@
|
|
|
76
76
|
`:u}
|
|
77
77
|
${n||e?t`
|
|
78
78
|
<kbd class="keys spectrum-Body spectrum-Body--sizeS">
|
|
79
|
-
${n
|
|
79
|
+
${n?$((m=this.modifierKeys)==null?void 0:m.map(h=>this.renderModifier(h)),this.renderJoiner()):u}
|
|
80
80
|
${e&&n?this.renderJoiner():u}
|
|
81
81
|
${e?this.renderModifier(this.shortcutKey,"shortcut"):u}
|
|
82
82
|
</kbd>
|
package/src/Coachmark.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["Coachmark.ts"],
|
|
4
|
-
"sourcesContent": ["/*\nCopyright 2023 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\nimport {\n CSSResultArray,\n html,\n nothing,\n TemplateResult,\n} from '@spectrum-web-components/base';\nimport { property } from '@spectrum-web-components/base/src/decorators.js';\nimport { when } from '@spectrum-web-components/base/src/directives.js';\nimport coachmarkStyles from './coachmark.css.js';\nimport chevronStyles from '@spectrum-web-components/icon/src/spectrum-icon-chevron.css.js';\nimport chevronIconOverrides from '@spectrum-web-components/icon/src/icon-chevron-overrides.css.js';\nimport '@spectrum-web-components/icons-ui/icons/sp-icon-chevron200.js';\nimport { Popover } from '@spectrum-web-components/popover';\nimport { join } from '@spectrum-web-components/base/src/directives.js';\nimport { ifDefined } from '@spectrum-web-components/base/src/directives.js';\nimport type { Placement } from '@spectrum-web-components/overlay';\nimport { MediaType } from './CoachmarkItem.js';\nimport type { CoachmarkItem } from './CoachmarkItem.js';\nimport '@spectrum-web-components/asset/sp-asset.js';\nimport '@spectrum-web-components/button/sp-button.js';\nimport '@spectrum-web-components/button-group/sp-button-group.js';\n\n/**\n * @element sp-coachmark\n * @fires primary - Announces that the \"primary\" button has been clicked.\n * @fires secondary - Announces that the \"secondary\" button has been clicked.\n * @slot cover-photo - This is the cover photo for Default and Quiet Coachmark\n * @slot heading - HTML content to be listed as the heading\n * @slot description - A description of the card\n * @slot actions - an `sp-action-menu` element outlining actions to take on the represened object\n * @slot step-count - Override the default pagination delivery with your own internationalized content\n */\nexport class Coachmark extends Popover {\n public static override get styles(): CSSResultArray {\n return [\n ...super.styles,\n coachmarkStyles,\n chevronStyles,\n chevronIconOverrides,\n ];\n }\n @property({ type: Object })\n public item?: CoachmarkItem;\n\n @property({ type: String })\n public override placement: Placement = 'right';\n\n @property({ type: Object, attribute: false })\n private content?: {\n title?: string;\n description?: string;\n imageAlt?: string;\n };\n\n @property({ attribute: 'shortcut-key' })\n private shortcutKey?: string;\n\n @property({ type: Array })\n public modifierKeys?: string[] = [];\n\n @property({ attribute: 'src' })\n private source?: string;\n\n @property({ attribute: 'media-type' })\n private mediaType?: MediaType;\n\n @property({ type: Boolean, attribute: 'has-asset', reflect: true })\n public hasAsset = false;\n\n @property()\n public asset?: 'file' | 'folder';\n\n @property({ type: Number, attribute: 'current-step' })\n public currentStep?: number;\n\n @property({ type: Number, attribute: 'total-steps' })\n public totalSteps?: number;\n\n @property({ type: String, attribute: 'primary-cta' })\n primaryCTA?: string;\n\n @property({ type: String, attribute: 'secondary-cta' })\n secondaryCTA?: string;\n\n // render video and images\n private renderMedia(): TemplateResult {\n const isImage = this.mediaType === MediaType.IMAGE;\n if (!isImage) {\n return html`\n <slot name=\"asset\"></slot>\n `;\n }\n return html`\n <sp-asset id=\"cover-photo\">\n <div class=\"image-wrapper\">\n <img\n class=\"image\"\n loading=\"lazy\"\n slot=\"cover-photo\"\n src=\"${ifDefined(this.source)}\"\n alt=\"${ifDefined(this?.content?.imageAlt)}\"\n />\n </div>\n </sp-asset>\n `;\n }\n // method to render modifier\n private renderModifier(\n modifierKey: string,\n type: 'modifier' | 'shortcut' = 'modifier'\n ): TemplateResult {\n return html`\n <span type=\"${type}\" class=\"keyboard-shortcut\">${modifierKey}</span>\n `;\n }\n\n private renderJoiner(): TemplateResult {\n return html`\n <span class=\"plus\">+</span>\n `;\n }\n // render heading title and modifier\n private renderHeader(): TemplateResult {\n const hasModifier = this.modifierKeys && this.modifierKeys?.length > 0;\n const hasShortcut = Boolean(this.shortcutKey);\n const hasTitle = Boolean(this.content?.title);\n if (!hasTitle && !hasModifier && !hasShortcut) {\n return html`\n <div class=\"title\"><slot name=\"title\"></slot></div>\n `;\n }\n return html`\n ${hasTitle\n ? html`\n <div class=\"title\">${this.content?.title}</div>\n `\n : nothing}\n ${hasModifier || hasShortcut\n ? html`\n <kbd class=\"keys spectrum-Body spectrum-Body--sizeS\">\n ${hasModifier\n ? join(\n this.modifierKeys?.map((k) =>\n this.renderModifier(k)\n ),\n this.renderJoiner()\n )\n : nothing}\n ${hasShortcut && hasModifier\n ? this.renderJoiner()\n : nothing}\n ${hasShortcut\n ? this.renderModifier(\n this.shortcutKey!,\n 'shortcut'\n )\n : nothing}\n </kbd>\n `\n : nothing}\n `;\n }\n // render description\n private renderContent(): TemplateResult {\n const hasDescription = Boolean(this.content?.description);\n if (!hasDescription)\n return html`\n <slot name=\"content\"></slot>\n `;\n return html`\n <div>${this.content?.description}</div>\n `;\n }\n\n // event on primary button\n private handlePrimaryCTA(): void {\n this.dispatchEvent(\n new Event('primary', {\n bubbles: true,\n composed: true,\n })\n );\n }\n // event on secondary button\n private handleSecondaryCTA(): void {\n this.dispatchEvent(\n new Event('secondary', {\n bubbles: true,\n composed: true,\n })\n );\n }\n\n private renderSecondaryButton = (): TemplateResult => {\n return html`\n <sp-button\n treatment=\"outline\"\n variant=\"secondary\"\n @click=${this.handleSecondaryCTA}\n >\n ${this.secondaryCTA}\n </sp-button>\n `;\n };\n\n private renderPrimaryButton = (): TemplateResult => {\n return html`\n <sp-button\n size=\"s\"\n treatment=\"outline\"\n variant=\"primary\"\n @click=${this.handlePrimaryCTA}\n >\n ${this.primaryCTA}\n </sp-button>\n `;\n };\n\n private renderSecondaryButtonMobile = (): TemplateResult => {\n return html`\n <sp-button\n variant=\"secondary\"\n treatment=\"outline\"\n icon-only\n aria-label=\"previous\"\n @click=${this.handleSecondaryCTA}\n >\n <sp-icon-chevron200\n size=\"s\"\n class=\"spectrum-UIIcon-ChevronLeft75\"\n slot=\"icon\"\n ></sp-icon-chevron200>\n </sp-button>\n `;\n };\n\n private renderPrimaryButtonMobile = (): TemplateResult => {\n return html`\n <sp-button\n size=\"s\"\n treatment=\"outline\"\n variant=\"primary\"\n @click=${this.handlePrimaryCTA}\n >\n ${this.primaryCTA}\n </sp-button>\n `;\n };\n\n protected renderButtons(): TemplateResult {\n return html`\n <sp-button-group class=\"spectrum-ButtonGroup buttongroup\">\n ${when(this.secondaryCTA, this.renderSecondaryButton)}\n ${when(this.primaryCTA, this.renderPrimaryButton)}\n </sp-button-group>\n <sp-button-group\n class=\"spectrum-ButtonGroup buttongroup-mobile\"\n size=\"s\"\n >\n ${when(this.secondaryCTA, this.renderSecondaryButtonMobile)}\n ${when(this.primaryCTA, this.renderPrimaryButtonMobile)}\n </sp-button-group>\n `;\n }\n\n // render steps\n protected renderSteps = (): TemplateResult => {\n return html`\n <div class=\"step\" role=\"status\">\n <span aria-live=\"polite\">\n <slot name=\"step-count\">\n ${this.currentStep} of ${this.totalSteps}\n </slot>\n </span>\n </div>\n `;\n };\n // render action menu\n protected renderActionMenu = (): TemplateResult => {\n return html`\n <div class=\"action-menu\">\n <slot name=\"actions\"></slot>\n </div>\n `;\n };\n\n protected override render(): TemplateResult {\n return html`\n ${this.renderMedia()}\n <div class=\"header\">\n <div class=\"flex-container\">${this.renderHeader()}</div>\n <div class=\"static-item\">\n ${when(\n this.secondaryCTA && this.primaryCTA,\n this.renderActionMenu\n )}\n </div>\n </div>\n\n <div class=\"content\">${this.renderContent()}</div>\n <div class=\"footer\">\n ${when(\n this.totalSteps && this.totalSteps > 1,\n this.renderSteps\n )}\n ${this.renderButtons()}\n </div>\n `;\n }\n}\n"],
|
|
5
|
-
"mappings": "qNAWA,OAEI,QAAAA,EACA,WAAAC,MAEG,gCACP,OAAS,YAAAC,MAAgB,kDACzB,OAAS,QAAAC,MAAY,kDACrB,OAAOC,MAAqB,qBAC5B,OAAOC,MAAmB,iEAC1B,
|
|
6
|
-
"names": ["html", "nothing", "property", "when", "coachmarkStyles", "chevronStyles", "
|
|
4
|
+
"sourcesContent": ["/*\nCopyright 2023 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\nimport {\n CSSResultArray,\n html,\n nothing,\n TemplateResult,\n} from '@spectrum-web-components/base';\nimport { property } from '@spectrum-web-components/base/src/decorators.js';\nimport { when } from '@spectrum-web-components/base/src/directives.js';\nimport coachmarkStyles from './coachmark.css.js';\nimport chevronStyles from '@spectrum-web-components/icon/src/spectrum-icon-chevron.css.js';\nimport '@spectrum-web-components/icons-ui/icons/sp-icon-chevron200.js';\nimport { Popover } from '@spectrum-web-components/popover';\nimport { join } from '@spectrum-web-components/base/src/directives.js';\nimport { ifDefined } from '@spectrum-web-components/base/src/directives.js';\nimport type { Placement } from '@spectrum-web-components/overlay';\nimport { MediaType } from './CoachmarkItem.js';\nimport type { CoachmarkItem } from './CoachmarkItem.js';\nimport '@spectrum-web-components/asset/sp-asset.js';\nimport '@spectrum-web-components/button/sp-button.js';\nimport '@spectrum-web-components/button-group/sp-button-group.js';\n\n/**\n * @element sp-coachmark\n * @fires primary - Announces that the \"primary\" button has been clicked.\n * @fires secondary - Announces that the \"secondary\" button has been clicked.\n * @slot cover-photo - This is the cover photo for Default and Quiet Coachmark\n * @slot heading - HTML content to be listed as the heading\n * @slot description - A description of the card\n * @slot actions - an `sp-action-menu` element outlining actions to take on the represened object\n * @slot step-count - Override the default pagination delivery with your own internationalized content\n */\nexport class Coachmark extends Popover {\n public static override get styles(): CSSResultArray {\n return [...super.styles, coachmarkStyles, chevronStyles];\n }\n @property({ type: Object })\n public item?: CoachmarkItem;\n\n @property({ type: String })\n public override placement: Placement = 'right';\n\n @property({ type: Object, attribute: false })\n private content?: {\n title?: string;\n description?: string;\n imageAlt?: string;\n };\n\n @property({ attribute: 'shortcut-key' })\n private shortcutKey?: string;\n\n @property({ type: Array })\n public modifierKeys?: string[] = [];\n\n @property({ attribute: 'src' })\n private source?: string;\n\n @property({ attribute: 'media-type' })\n private mediaType?: MediaType;\n\n @property({ type: Boolean, attribute: 'has-asset', reflect: true })\n public hasAsset = false;\n\n @property()\n public asset?: 'file' | 'folder';\n\n @property({ type: Number, attribute: 'current-step' })\n public currentStep?: number;\n\n @property({ type: Number, attribute: 'total-steps' })\n public totalSteps?: number;\n\n @property({ type: String, attribute: 'primary-cta' })\n primaryCTA?: string;\n\n @property({ type: String, attribute: 'secondary-cta' })\n secondaryCTA?: string;\n\n // render video and images\n private renderMedia(): TemplateResult {\n const isImage = this.mediaType === MediaType.IMAGE;\n if (!isImage) {\n return html`\n <slot name=\"asset\"></slot>\n `;\n }\n return html`\n <sp-asset id=\"cover-photo\">\n <div class=\"image-wrapper\">\n <img\n class=\"image\"\n loading=\"lazy\"\n slot=\"cover-photo\"\n src=\"${ifDefined(this.source)}\"\n alt=\"${ifDefined(this?.content?.imageAlt)}\"\n />\n </div>\n </sp-asset>\n `;\n }\n // method to render modifier\n private renderModifier(\n modifierKey: string,\n type: 'modifier' | 'shortcut' = 'modifier'\n ): TemplateResult {\n return html`\n <span type=\"${type}\" class=\"keyboard-shortcut\">${modifierKey}</span>\n `;\n }\n\n private renderJoiner(): TemplateResult {\n return html`\n <span class=\"plus\">+</span>\n `;\n }\n // render heading title and modifier\n private renderHeader(): TemplateResult {\n const hasModifier = this.modifierKeys && this.modifierKeys?.length > 0;\n const hasShortcut = Boolean(this.shortcutKey);\n const hasTitle = Boolean(this.content?.title);\n if (!hasTitle && !hasModifier && !hasShortcut) {\n return html`\n <div class=\"title\"><slot name=\"title\"></slot></div>\n `;\n }\n return html`\n ${hasTitle\n ? html`\n <div class=\"title\">${this.content?.title}</div>\n `\n : nothing}\n ${hasModifier || hasShortcut\n ? html`\n <kbd class=\"keys spectrum-Body spectrum-Body--sizeS\">\n ${hasModifier\n ? join(\n this.modifierKeys?.map((k) =>\n this.renderModifier(k)\n ),\n this.renderJoiner()\n )\n : nothing}\n ${hasShortcut && hasModifier\n ? this.renderJoiner()\n : nothing}\n ${hasShortcut\n ? this.renderModifier(\n this.shortcutKey!,\n 'shortcut'\n )\n : nothing}\n </kbd>\n `\n : nothing}\n `;\n }\n // render description\n private renderContent(): TemplateResult {\n const hasDescription = Boolean(this.content?.description);\n if (!hasDescription)\n return html`\n <slot name=\"content\"></slot>\n `;\n return html`\n <div>${this.content?.description}</div>\n `;\n }\n\n // event on primary button\n private handlePrimaryCTA(): void {\n this.dispatchEvent(\n new Event('primary', {\n bubbles: true,\n composed: true,\n })\n );\n }\n // event on secondary button\n private handleSecondaryCTA(): void {\n this.dispatchEvent(\n new Event('secondary', {\n bubbles: true,\n composed: true,\n })\n );\n }\n\n private renderSecondaryButton = (): TemplateResult => {\n return html`\n <sp-button\n treatment=\"outline\"\n variant=\"secondary\"\n @click=${this.handleSecondaryCTA}\n >\n ${this.secondaryCTA}\n </sp-button>\n `;\n };\n\n private renderPrimaryButton = (): TemplateResult => {\n return html`\n <sp-button\n size=\"s\"\n treatment=\"outline\"\n variant=\"primary\"\n @click=${this.handlePrimaryCTA}\n >\n ${this.primaryCTA}\n </sp-button>\n `;\n };\n\n private renderSecondaryButtonMobile = (): TemplateResult => {\n return html`\n <sp-button\n variant=\"secondary\"\n treatment=\"outline\"\n icon-only\n aria-label=\"previous\"\n @click=${this.handleSecondaryCTA}\n >\n <sp-icon-chevron200\n size=\"s\"\n class=\"spectrum-UIIcon-ChevronLeft75\"\n slot=\"icon\"\n ></sp-icon-chevron200>\n </sp-button>\n `;\n };\n\n private renderPrimaryButtonMobile = (): TemplateResult => {\n return html`\n <sp-button\n size=\"s\"\n treatment=\"outline\"\n variant=\"primary\"\n @click=${this.handlePrimaryCTA}\n >\n ${this.primaryCTA}\n </sp-button>\n `;\n };\n\n protected renderButtons(): TemplateResult {\n return html`\n <sp-button-group class=\"spectrum-ButtonGroup buttongroup\">\n ${when(this.secondaryCTA, this.renderSecondaryButton)}\n ${when(this.primaryCTA, this.renderPrimaryButton)}\n </sp-button-group>\n <sp-button-group\n class=\"spectrum-ButtonGroup buttongroup-mobile\"\n size=\"s\"\n >\n ${when(this.secondaryCTA, this.renderSecondaryButtonMobile)}\n ${when(this.primaryCTA, this.renderPrimaryButtonMobile)}\n </sp-button-group>\n `;\n }\n\n // render steps\n protected renderSteps = (): TemplateResult => {\n return html`\n <div class=\"step\" role=\"status\">\n <span aria-live=\"polite\">\n <slot name=\"step-count\">\n ${this.currentStep} of ${this.totalSteps}\n </slot>\n </span>\n </div>\n `;\n };\n // render action menu\n protected renderActionMenu = (): TemplateResult => {\n return html`\n <div class=\"action-menu\">\n <slot name=\"actions\"></slot>\n </div>\n `;\n };\n\n protected override render(): TemplateResult {\n return html`\n ${this.renderMedia()}\n <div class=\"header\">\n <div class=\"flex-container\">${this.renderHeader()}</div>\n <div class=\"static-item\">\n ${when(\n this.secondaryCTA && this.primaryCTA,\n this.renderActionMenu\n )}\n </div>\n </div>\n\n <div class=\"content\">${this.renderContent()}</div>\n <div class=\"footer\">\n ${when(\n this.totalSteps && this.totalSteps > 1,\n this.renderSteps\n )}\n ${this.renderButtons()}\n </div>\n `;\n }\n}\n"],
|
|
5
|
+
"mappings": "qNAWA,OAEI,QAAAA,EACA,WAAAC,MAEG,gCACP,OAAS,YAAAC,MAAgB,kDACzB,OAAS,QAAAC,MAAY,kDACrB,OAAOC,MAAqB,qBAC5B,OAAOC,MAAmB,iEAC1B,MAAO,gEACP,OAAS,WAAAC,MAAe,mCACxB,OAAS,QAAAC,MAAY,kDACrB,OAAS,aAAAC,MAAiB,kDAE1B,OAAS,aAAAC,MAAiB,qBAE1B,MAAO,6CACP,MAAO,+CACP,MAAO,2DAYA,aAAM,kBAAkBH,CAAQ,CAAhC,kCAQH,KAAgB,UAAuB,QAavC,KAAO,aAA0B,CAAC,EASlC,KAAO,SAAW,GA8HlB,KAAQ,sBAAwB,IACrBN;AAAA;AAAA;AAAA;AAAA,yBAIU,KAAK,kBAAkB;AAAA;AAAA,kBAE9B,KAAK,YAAY;AAAA;AAAA,UAK/B,KAAQ,oBAAsB,IACnBA;AAAA;AAAA;AAAA;AAA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"Popover", "join", "ifDefined", "MediaType", "_a", "modifierKey", "type", "_b", "_c", "_d", "hasModifier", "hasShortcut", "hasTitle", "k", "__decorateClass"]
|
|
7
7
|
}
|