@hashicorp/design-system-components 5.0.0-rc-20251007215008 → 5.0.0-rc-20251010191136
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/addon-main.cjs +6 -11
- package/declarations/components/hds/flyout/index.d.ts +1 -18
- package/declarations/components/hds/modal/index.d.ts +2 -2
- package/dist/components/hds/flyout/index.js +31 -54
- package/dist/components/hds/flyout/index.js.map +1 -1
- package/dist/components/hds/modal/index.js +48 -35
- package/dist/components/hds/modal/index.js.map +1 -1
- package/dist/instance-initializers/load-sprite.js +3 -5
- package/dist/instance-initializers/load-sprite.js.map +1 -1
- package/dist/modifiers/hds-code-editor.js +2 -3
- package/dist/modifiers/hds-code-editor.js.map +1 -1
- package/package.json +5 -6
package/addon-main.cjs
CHANGED
|
@@ -4,19 +4,14 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
const { addonV1Shim } = require('@embroider/addon-shim');
|
|
7
|
-
const flightIconSprite = require('@hashicorp/flight-icons/svg-sprite/svg-sprite-module');
|
|
8
7
|
|
|
9
8
|
module.exports = {
|
|
10
9
|
...addonV1Shim(__dirname),
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
config.__flightIconsSpriteLoaded = true;
|
|
18
|
-
|
|
19
|
-
return flightIconSprite;
|
|
20
|
-
}
|
|
10
|
+
options: {
|
|
11
|
+
'@embroider/macros': {
|
|
12
|
+
setOwnConfig: {
|
|
13
|
+
flightIconsSpriteLazyEmbed: true,
|
|
14
|
+
},
|
|
15
|
+
},
|
|
21
16
|
},
|
|
22
17
|
};
|
|
@@ -37,28 +37,11 @@ export default class HdsFlyout extends Component<HdsFlyoutSignature> {
|
|
|
37
37
|
_element: HTMLDialogElement;
|
|
38
38
|
private _body;
|
|
39
39
|
private _bodyInitialOverflowValue;
|
|
40
|
-
/**
|
|
41
|
-
* Sets the size of the flyout
|
|
42
|
-
* Accepted values: medium, large
|
|
43
|
-
*
|
|
44
|
-
* @param size
|
|
45
|
-
* @type {string}
|
|
46
|
-
* @default 'medium'
|
|
47
|
-
*/
|
|
48
40
|
get size(): HdsFlyoutSizes;
|
|
49
|
-
/**
|
|
50
|
-
* Calculates the unique ID to assign to the title
|
|
51
|
-
*/
|
|
52
41
|
get id(): string;
|
|
53
|
-
/**
|
|
54
|
-
* Get the class names to apply to the component.
|
|
55
|
-
* @method classNames
|
|
56
|
-
* @return {string} The "class" attribute to apply to the component.
|
|
57
|
-
*/
|
|
58
42
|
get classNames(): string;
|
|
59
43
|
registerOnCloseCallback(event: Event): void;
|
|
60
|
-
|
|
61
|
-
willDestroyNode(): void;
|
|
44
|
+
private _registerDialog;
|
|
62
45
|
open(): void;
|
|
63
46
|
onDismiss(): Promise<void>;
|
|
64
47
|
}
|
|
@@ -38,14 +38,14 @@ export default class HdsModal extends Component<HdsModalSignature> {
|
|
|
38
38
|
private _element;
|
|
39
39
|
private _body;
|
|
40
40
|
private _bodyInitialOverflowValue;
|
|
41
|
+
private _clickOutsideToDismissHandler;
|
|
41
42
|
get isDismissDisabled(): boolean;
|
|
42
43
|
get size(): HdsModalSizes;
|
|
43
44
|
get color(): HdsModalColors;
|
|
44
45
|
get id(): string;
|
|
45
46
|
get classNames(): string;
|
|
46
47
|
registerOnCloseCallback(event: Event): void;
|
|
47
|
-
|
|
48
|
-
willDestroyNode(): void;
|
|
48
|
+
private _registerDialog;
|
|
49
49
|
open(): void;
|
|
50
50
|
onDismiss(): Promise<void>;
|
|
51
51
|
}
|
|
@@ -4,6 +4,7 @@ import { action } from '@ember/object';
|
|
|
4
4
|
import { assert } from '@ember/debug';
|
|
5
5
|
import { getElementId } from '../../../utils/hds-get-element-id.js';
|
|
6
6
|
import { buildWaiter } from '@ember/test-waiters';
|
|
7
|
+
import { modifier } from 'ember-modifier';
|
|
7
8
|
import { HdsFlyoutSizesValues } from './types.js';
|
|
8
9
|
import '../dialog-primitive/body.js';
|
|
9
10
|
import '../dialog-primitive/description.js';
|
|
@@ -13,7 +14,7 @@ import { precompileTemplate } from '@ember/template-compilation';
|
|
|
13
14
|
import { g, i, n } from 'decorator-transforms/runtime';
|
|
14
15
|
import { setComponentTemplate } from '@ember/component';
|
|
15
16
|
|
|
16
|
-
var TEMPLATE = precompileTemplate("{{!\n Copyright (c) HashiCorp, Inc.\n SPDX-License-Identifier: MPL-2.0\n}}\n<Hds::DialogPrimitive::Wrapper\n class={{this.classNames}}\n ...attributes\n aria-labelledby={{this.id}}\n {{
|
|
17
|
+
var TEMPLATE = precompileTemplate("{{!\n Copyright (c) HashiCorp, Inc.\n SPDX-License-Identifier: MPL-2.0\n}}\n<Hds::DialogPrimitive::Wrapper\n class={{this.classNames}}\n ...attributes\n aria-labelledby={{this.id}}\n {{this._registerDialog}}\n {{! @glint-expect-error - https://github.com/josemarluedke/ember-focus-trap/issues/86 }}\n {{focus-trap isActive=this._isOpen focusTrapOptions=(hash onDeactivate=this.onDismiss clickOutsideDeactivates=true)}}\n>\n <:header>\n {{yield\n (hash\n Header=(component\n \"hds/dialog-primitive/header\"\n id=this.id\n onDismiss=this.onDismiss\n contextualClassPrefix=\"hds-flyout\"\n titleTag=\"h1\"\n )\n Description=(component \"hds/dialog-primitive/description\" contextualClass=\"hds-flyout__description\")\n )\n }}\n </:header>\n <:body>\n {{yield (hash Body=(component \"hds/dialog-primitive/body\" contextualClass=\"hds-flyout__body\"))}}\n </:body>\n <:footer>\n {{yield\n (hash\n Footer=(component \"hds/dialog-primitive/footer\" onDismiss=this.onDismiss contextualClass=\"hds-flyout__footer\")\n )\n }}\n </:footer>\n</Hds::DialogPrimitive::Wrapper>\n\n{{#if this._isOpen}}\n <Hds::DialogPrimitive::Overlay @contextualClass=\"hds-flyout__overlay\" />\n{{/if}}");
|
|
17
18
|
|
|
18
19
|
/**
|
|
19
20
|
* Copyright (c) HashiCorp, Inc.
|
|
@@ -36,15 +37,6 @@ class HdsFlyout extends Component {
|
|
|
36
37
|
_element;
|
|
37
38
|
_body;
|
|
38
39
|
_bodyInitialOverflowValue = '';
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* Sets the size of the flyout
|
|
42
|
-
* Accepted values: medium, large
|
|
43
|
-
*
|
|
44
|
-
* @param size
|
|
45
|
-
* @type {string}
|
|
46
|
-
* @default 'medium'
|
|
47
|
-
*/
|
|
48
40
|
get size() {
|
|
49
41
|
const {
|
|
50
42
|
size = DEFAULT_SIZE
|
|
@@ -52,19 +44,9 @@ class HdsFlyout extends Component {
|
|
|
52
44
|
assert(`@size for "Hds::Flyout" must be one of the following: ${SIZES.join(', ')}; received: ${size}`, SIZES.includes(size));
|
|
53
45
|
return size;
|
|
54
46
|
}
|
|
55
|
-
|
|
56
|
-
/**
|
|
57
|
-
* Calculates the unique ID to assign to the title
|
|
58
|
-
*/
|
|
59
47
|
get id() {
|
|
60
48
|
return getElementId(this);
|
|
61
49
|
}
|
|
62
|
-
|
|
63
|
-
/**
|
|
64
|
-
* Get the class names to apply to the component.
|
|
65
|
-
* @method classNames
|
|
66
|
-
* @return {string} The "class" attribute to apply to the component.
|
|
67
|
-
*/
|
|
68
50
|
get classNames() {
|
|
69
51
|
const classes = ['hds-flyout'];
|
|
70
52
|
|
|
@@ -77,11 +59,31 @@ class HdsFlyout extends Component {
|
|
|
77
59
|
this.args.onClose(event);
|
|
78
60
|
}
|
|
79
61
|
this._isOpen = false;
|
|
62
|
+
|
|
63
|
+
// Reset page `overflow` property
|
|
64
|
+
if (this._body) {
|
|
65
|
+
this._body.style.removeProperty('overflow');
|
|
66
|
+
if (this._bodyInitialOverflowValue === '') {
|
|
67
|
+
if (this._body.style.length === 0) {
|
|
68
|
+
this._body.removeAttribute('style');
|
|
69
|
+
}
|
|
70
|
+
} else {
|
|
71
|
+
this._body.style.setProperty('overflow', this._bodyInitialOverflowValue);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
// Return focus to a specific element (if provided)
|
|
76
|
+
if (this.args.returnFocusTo) {
|
|
77
|
+
const initiator = document.getElementById(this.args.returnFocusTo);
|
|
78
|
+
if (initiator) {
|
|
79
|
+
initiator.focus();
|
|
80
|
+
}
|
|
81
|
+
}
|
|
80
82
|
}
|
|
81
83
|
static {
|
|
82
84
|
n(this.prototype, "registerOnCloseCallback", [action]);
|
|
83
85
|
}
|
|
84
|
-
|
|
86
|
+
_registerDialog = modifier(element => {
|
|
85
87
|
// Store references of `<dialog>` and `<body>` elements
|
|
86
88
|
this._element = element;
|
|
87
89
|
this._body = document.body;
|
|
@@ -98,20 +100,16 @@ class HdsFlyout extends Component {
|
|
|
98
100
|
if (!this._element.open) {
|
|
99
101
|
this.open();
|
|
100
102
|
}
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
this._element.removeEventListener('close',
|
|
103
|
+
return () => {
|
|
104
|
+
// if the <dialog> is removed from the dom while open we emulate the close event
|
|
105
|
+
if (this._isOpen) {
|
|
106
|
+
this._element?.dispatchEvent(new Event('close'));
|
|
107
|
+
}
|
|
108
|
+
this._element?.removeEventListener('close',
|
|
108
109
|
// eslint-disable-next-line @typescript-eslint/unbound-method
|
|
109
110
|
this.registerOnCloseCallback, true);
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
static {
|
|
113
|
-
n(this.prototype, "willDestroyNode", [action]);
|
|
114
|
-
}
|
|
111
|
+
};
|
|
112
|
+
});
|
|
115
113
|
open() {
|
|
116
114
|
// Make flyout dialog visible using the native `showModal` method
|
|
117
115
|
this._element.showModal();
|
|
@@ -131,7 +129,6 @@ class HdsFlyout extends Component {
|
|
|
131
129
|
async onDismiss() {
|
|
132
130
|
// allow ember test helpers to be aware of when the `close` event fires
|
|
133
131
|
// when using `click` or other helpers from '@ember/test-helpers'
|
|
134
|
-
// Notice: this code will get stripped out in production builds (DEBUG evaluates to `true` in dev/test builds, but `false` in prod builds)
|
|
135
132
|
if (this._element.open) {
|
|
136
133
|
const token = waiter.beginAsync();
|
|
137
134
|
const listener = () => {
|
|
@@ -143,26 +140,6 @@ class HdsFlyout extends Component {
|
|
|
143
140
|
|
|
144
141
|
// Make flyout dialog invisible using the native `close` method
|
|
145
142
|
this._element.close();
|
|
146
|
-
|
|
147
|
-
// Reset page `overflow` property
|
|
148
|
-
if (this._body) {
|
|
149
|
-
this._body.style.removeProperty('overflow');
|
|
150
|
-
if (this._bodyInitialOverflowValue === '') {
|
|
151
|
-
if (this._body.style.length === 0) {
|
|
152
|
-
this._body.removeAttribute('style');
|
|
153
|
-
}
|
|
154
|
-
} else {
|
|
155
|
-
this._body.style.setProperty('overflow', this._bodyInitialOverflowValue);
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
// Return focus to a specific element (if provided)
|
|
160
|
-
if (this.args.returnFocusTo) {
|
|
161
|
-
const initiator = document.getElementById(this.args.returnFocusTo);
|
|
162
|
-
if (initiator) {
|
|
163
|
-
initiator.focus();
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
143
|
}
|
|
167
144
|
static {
|
|
168
145
|
n(this.prototype, "onDismiss", [action]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../src/components/hds/flyout/index.ts"],"sourcesContent":["/**\n * Copyright (c) HashiCorp, Inc.\n * SPDX-License-Identifier: MPL-2.0\n */\n\nimport Component from '@glimmer/component';\nimport { tracked } from '@glimmer/tracking';\nimport { action } from '@ember/object';\nimport { assert } from '@ember/debug';\nimport { getElementId } from '../../../utils/hds-get-element-id.ts';\nimport { buildWaiter } from '@ember/test-waiters';\nimport type { WithBoundArgs } from '@glint/template';\n\nimport type { HdsFlyoutSizes } from './types.ts';\n\nimport { HdsFlyoutSizesValues } from './types.ts';\nimport HdsDialogPrimitiveBodyComponent from '../dialog-primitive/body.ts';\nimport HdsDialogPrimitiveDescriptionComponent from '../dialog-primitive/description.ts';\nimport HdsDialogPrimitiveFooterComponent from '../dialog-primitive/footer.ts';\nimport HdsDialogPrimitiveHeaderComponent from '../dialog-primitive/header.ts';\n\nconst waiter = buildWaiter('@hashicorp/design-system-components:flyout');\n\nexport const DEFAULT_SIZE = HdsFlyoutSizesValues.Medium;\nexport const DEFAULT_HAS_OVERLAY = true;\nexport const SIZES: HdsFlyoutSizes[] = Object.values(HdsFlyoutSizesValues);\n\nexport interface HdsFlyoutSignature {\n Args: {\n size?: HdsFlyoutSizes;\n returnFocusTo?: string;\n onOpen?: () => void;\n onClose?: (event: Event) => void;\n };\n Blocks: {\n default: [\n {\n Header?: WithBoundArgs<\n typeof HdsDialogPrimitiveHeaderComponent,\n 'id' | 'onDismiss' | 'contextualClassPrefix'\n >;\n Description?: WithBoundArgs<\n typeof HdsDialogPrimitiveDescriptionComponent,\n 'contextualClass'\n >;\n Body?: WithBoundArgs<\n typeof HdsDialogPrimitiveBodyComponent,\n 'contextualClass'\n >;\n Footer?: WithBoundArgs<\n typeof HdsDialogPrimitiveFooterComponent,\n 'onDismiss' | 'contextualClass'\n >;\n },\n ];\n };\n Element: HTMLDialogElement;\n}\n\nexport default class HdsFlyout extends Component<HdsFlyoutSignature> {\n @tracked private _isOpen = false;\n // TODO: make this property private; currently blocked by our consumers relying on it despite not being part of the public API: https://github.com/hashicorp/cloud-ui/blob/main/engines/waypoint/addon/components/preview-pane.ts#L15\n // private _element!: HTMLDialogElement;\n _element!: HTMLDialogElement;\n private _body!: HTMLElement;\n private _bodyInitialOverflowValue = '';\n\n /**\n * Sets the size of the flyout\n * Accepted values: medium, large\n *\n * @param size\n * @type {string}\n * @default 'medium'\n */\n get size(): HdsFlyoutSizes {\n const { size = DEFAULT_SIZE } = this.args;\n\n assert(\n `@size for \"Hds::Flyout\" must be one of the following: ${SIZES.join(\n ', '\n )}; received: ${size}`,\n SIZES.includes(size)\n );\n\n return size;\n }\n\n /**\n * Calculates the unique ID to assign to the title\n */\n get id(): string {\n return getElementId(this);\n }\n\n /**\n * Get the class names to apply to the component.\n * @method classNames\n * @return {string} The \"class\" attribute to apply to the component.\n */\n get classNames(): string {\n const classes = ['hds-flyout'];\n\n // add a class based on the @size argument\n classes.push(`hds-flyout--size-${this.size}`);\n\n return classes.join(' ');\n }\n\n @action registerOnCloseCallback(event: Event) {\n if (this.args.onClose && typeof this.args.onClose === 'function') {\n this.args.onClose(event);\n }\n\n this._isOpen = false;\n }\n\n @action\n didInsert(element: HTMLDialogElement): void {\n // Store references of `<dialog>` and `<body>` elements\n this._element = element;\n this._body = document.body;\n\n if (this._body) {\n // Store the initial `overflow` value of `<body>` so we can reset to it\n this._bodyInitialOverflowValue =\n this._body.style.getPropertyValue('overflow');\n }\n\n // Register \"onClose\" callback function to be called when a native 'close' event is dispatched\n // eslint-disable-next-line @typescript-eslint/unbound-method\n this._element.addEventListener('close', this.registerOnCloseCallback, true);\n\n // If the flyout dialog is not already open\n if (!this._element.open) {\n this.open();\n }\n }\n\n @action\n willDestroyNode(): void {\n if (this._element) {\n this._element.removeEventListener(\n 'close',\n // eslint-disable-next-line @typescript-eslint/unbound-method\n this.registerOnCloseCallback,\n true\n );\n }\n }\n\n @action\n open(): void {\n // Make flyout dialog visible using the native `showModal` method\n this._element.showModal();\n this._isOpen = true;\n\n // Prevent page from scrolling when the dialog is open\n if (this._body) this._body.style.setProperty('overflow', 'hidden');\n\n // Call \"onOpen\" callback function\n if (this.args.onOpen && typeof this.args.onOpen === 'function') {\n this.args.onOpen();\n }\n }\n\n @action\n // eslint-disable-next-line @typescript-eslint/require-await\n async onDismiss(): Promise<void> {\n // allow ember test helpers to be aware of when the `close` event fires\n // when using `click` or other helpers from '@ember/test-helpers'\n // Notice: this code will get stripped out in production builds (DEBUG evaluates to `true` in dev/test builds, but `false` in prod builds)\n if (this._element.open) {\n const token = waiter.beginAsync();\n const listener = () => {\n waiter.endAsync(token);\n this._element.removeEventListener('close', listener);\n };\n this._element.addEventListener('close', listener);\n }\n\n // Make flyout dialog invisible using the native `close` method\n this._element.close();\n\n // Reset page `overflow` property\n if (this._body) {\n this._body.style.removeProperty('overflow');\n if (this._bodyInitialOverflowValue === '') {\n if (this._body.style.length === 0) {\n this._body.removeAttribute('style');\n }\n } else {\n this._body.style.setProperty(\n 'overflow',\n this._bodyInitialOverflowValue\n );\n }\n }\n\n // Return focus to a specific element (if provided)\n if (this.args.returnFocusTo) {\n const initiator = document.getElementById(this.args.returnFocusTo);\n if (initiator) {\n initiator.focus();\n }\n }\n }\n}\n"],"names":["waiter","buildWaiter","DEFAULT_SIZE","HdsFlyoutSizesValues","Medium","DEFAULT_HAS_OVERLAY","SIZES","Object","values","HdsFlyout","Component","g","prototype","tracked","i","void 0","_element","_body","_bodyInitialOverflowValue","size","args","assert","join","includes","id","getElementId","classNames","classes","push","registerOnCloseCallback","event","onClose","_isOpen","n","action","didInsert","element","document","body","style","getPropertyValue","addEventListener","open","willDestroyNode","removeEventListener","showModal","setProperty","onOpen","onDismiss","token","beginAsync","listener","endAsync","close","removeProperty","length","removeAttribute","returnFocusTo","initiator","getElementById","focus","setComponentTemplate","TEMPLATE"],"mappings":";;;;;;;;;;;;;;;;;AAAA;AACA;AACA;AACA;;AAkBA,MAAMA,MAAM,GAAGC,WAAW,CAAC,4CAA4C,CAAC;AAEjE,MAAMC,YAAY,GAAGC,oBAAoB,CAACC;AAC1C,MAAMC,mBAAmB,GAAG;AAC5B,MAAMC,KAAuB,GAAGC,MAAM,CAACC,MAAM,CAACL,oBAAoB;AAkC1D,MAAMM,SAAS,SAASC,SAAS,CAAqB;AAAA,EAAA;IAAAC,CAAA,CAAA,IAAA,CAAAC,SAAA,EAAA,SAAA,EAAA,CAClEC,OAAO,CAAA,EAAA,YAAA;AAAA,MAAA,OAAmB,KAAK;AAAA,IAAA,CAAA,CAAA;AAAA;AAAA,EAAA,QAAA,IAAAC,CAAA,CAAA,IAAA,EAAA,SAAA,CAAA,EAAAC,MAAA;AAChC;AACA;EACAC,QAAQ;EACAC,KAAK;AACLC,EAAAA,yBAAyB,GAAG,EAAE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A,SAAS,CAACE,KAAK,EAAE;AACnB,MAAA;AACF,IAAA;AACF,EAAA;AAAC,EAAA;IAAA3B,CAAA,CAAA,IAAA,CAAArB,SAAA,EAAA,WAAA,EAAA,CAxCAsB,MAAM,CAAA,CAAA;AAAA;AAyCT;AAAC2B,oBAAA,CAAAC,QAAA,EApJoBrD,SAAS,CAAA;;;;"}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../src/components/hds/flyout/index.ts"],"sourcesContent":["/**\n * Copyright (c) HashiCorp, Inc.\n * SPDX-License-Identifier: MPL-2.0\n */\n\nimport Component from '@glimmer/component';\nimport { tracked } from '@glimmer/tracking';\nimport { action } from '@ember/object';\nimport { assert } from '@ember/debug';\nimport { getElementId } from '../../../utils/hds-get-element-id.ts';\nimport { buildWaiter } from '@ember/test-waiters';\nimport type { WithBoundArgs } from '@glint/template';\nimport { modifier } from 'ember-modifier';\n\nimport type { HdsFlyoutSizes } from './types.ts';\n\nimport { HdsFlyoutSizesValues } from './types.ts';\nimport HdsDialogPrimitiveBodyComponent from '../dialog-primitive/body.ts';\nimport HdsDialogPrimitiveDescriptionComponent from '../dialog-primitive/description.ts';\nimport HdsDialogPrimitiveFooterComponent from '../dialog-primitive/footer.ts';\nimport HdsDialogPrimitiveHeaderComponent from '../dialog-primitive/header.ts';\n\nconst waiter = buildWaiter('@hashicorp/design-system-components:flyout');\n\nexport const DEFAULT_SIZE = HdsFlyoutSizesValues.Medium;\nexport const DEFAULT_HAS_OVERLAY = true;\nexport const SIZES: HdsFlyoutSizes[] = Object.values(HdsFlyoutSizesValues);\n\nexport interface HdsFlyoutSignature {\n Args: {\n size?: HdsFlyoutSizes;\n returnFocusTo?: string;\n onOpen?: () => void;\n onClose?: (event: Event) => void;\n };\n Blocks: {\n default: [\n {\n Header?: WithBoundArgs<\n typeof HdsDialogPrimitiveHeaderComponent,\n 'id' | 'onDismiss' | 'contextualClassPrefix'\n >;\n Description?: WithBoundArgs<\n typeof HdsDialogPrimitiveDescriptionComponent,\n 'contextualClass'\n >;\n Body?: WithBoundArgs<\n typeof HdsDialogPrimitiveBodyComponent,\n 'contextualClass'\n >;\n Footer?: WithBoundArgs<\n typeof HdsDialogPrimitiveFooterComponent,\n 'onDismiss' | 'contextualClass'\n >;\n },\n ];\n };\n Element: HTMLDialogElement;\n}\n\nexport default class HdsFlyout extends Component<HdsFlyoutSignature> {\n @tracked private _isOpen = false;\n // TODO: make this property private; currently blocked by our consumers relying on it despite not being part of the public API: https://github.com/hashicorp/cloud-ui/blob/main/engines/waypoint/addon/components/preview-pane.ts#L15\n // private _element!: HTMLDialogElement;\n _element!: HTMLDialogElement;\n private _body!: HTMLElement;\n private _bodyInitialOverflowValue = '';\n\n get size(): HdsFlyoutSizes {\n const { size = DEFAULT_SIZE } = this.args;\n\n assert(\n `@size for \"Hds::Flyout\" must be one of the following: ${SIZES.join(\n ', '\n )}; received: ${size}`,\n SIZES.includes(size)\n );\n\n return size;\n }\n\n get id(): string {\n return getElementId(this);\n }\n\n get classNames(): string {\n const classes = ['hds-flyout'];\n\n // add a class based on the @size argument\n classes.push(`hds-flyout--size-${this.size}`);\n\n return classes.join(' ');\n }\n\n @action registerOnCloseCallback(event: Event) {\n if (this.args.onClose && typeof this.args.onClose === 'function') {\n this.args.onClose(event);\n }\n\n this._isOpen = false;\n\n // Reset page `overflow` property\n if (this._body) {\n this._body.style.removeProperty('overflow');\n if (this._bodyInitialOverflowValue === '') {\n if (this._body.style.length === 0) {\n this._body.removeAttribute('style');\n }\n } else {\n this._body.style.setProperty(\n 'overflow',\n this._bodyInitialOverflowValue\n );\n }\n }\n\n // Return focus to a specific element (if provided)\n if (this.args.returnFocusTo) {\n const initiator = document.getElementById(this.args.returnFocusTo);\n if (initiator) {\n initiator.focus();\n }\n }\n }\n\n private _registerDialog = modifier((element: HTMLDialogElement) => {\n // Store references of `<dialog>` and `<body>` elements\n this._element = element;\n this._body = document.body;\n\n if (this._body) {\n // Store the initial `overflow` value of `<body>` so we can reset to it\n this._bodyInitialOverflowValue =\n this._body.style.getPropertyValue('overflow');\n }\n\n // Register \"onClose\" callback function to be called when a native 'close' event is dispatched\n // eslint-disable-next-line @typescript-eslint/unbound-method\n this._element.addEventListener('close', this.registerOnCloseCallback, true);\n\n // If the flyout dialog is not already open\n if (!this._element.open) {\n this.open();\n }\n\n return () => {\n // if the <dialog> is removed from the dom while open we emulate the close event\n if (this._isOpen) {\n this._element?.dispatchEvent(new Event('close'));\n }\n\n this._element?.removeEventListener(\n 'close',\n // eslint-disable-next-line @typescript-eslint/unbound-method\n this.registerOnCloseCallback,\n true\n );\n };\n });\n\n @action\n open(): void {\n // Make flyout dialog visible using the native `showModal` method\n this._element.showModal();\n this._isOpen = true;\n\n // Prevent page from scrolling when the dialog is open\n if (this._body) this._body.style.setProperty('overflow', 'hidden');\n\n // Call \"onOpen\" callback function\n if (this.args.onOpen && typeof this.args.onOpen === 'function') {\n this.args.onOpen();\n }\n }\n\n @action\n // eslint-disable-next-line @typescript-eslint/require-await\n async onDismiss(): Promise<void> {\n // allow ember test helpers to be aware of when the `close` event fires\n // when using `click` or other helpers from '@ember/test-helpers'\n if (this._element.open) {\n const token = waiter.beginAsync();\n const listener = () => {\n waiter.endAsync(token);\n this._element.removeEventListener('close', listener);\n };\n this._element.addEventListener('close', listener);\n }\n\n // Make flyout dialog invisible using the native `close` method\n this._element.close();\n }\n}\n"],"names":["waiter","buildWaiter","DEFAULT_SIZE","HdsFlyoutSizesValues","Medium","DEFAULT_HAS_OVERLAY","SIZES","Object","values","HdsFlyout","Component","g","prototype","tracked","i","void 0","_element","_body","_bodyInitialOverflowValue","size","args","assert","join","includes","id","getElementId","classNames","classes","push","registerOnCloseCallback","event","onClose","_isOpen","style","removeProperty","length","removeAttribute","setProperty","returnFocusTo","initiator","document","getElementById","focus","n","action","_registerDialog","modifier","element","body","getPropertyValue","addEventListener","open","dispatchEvent","Event","removeEventListener","showModal","onOpen","onDismiss","token","beginAsync","listener","endAsync","close","setComponentTemplate","TEMPL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AAkB;AAC/B;AACA;AACA,IAAA,IAAI,IAAI,CAACzC,QAAQ,CAACmC,IAAI,EAAE;AACtB,MAAA,MAAMO,KAAK,GAAG1D,MAAM,CAAC2D,UAAU,EAAE;MACjC,MAAMC,QAAQ,GAAGA,MAAM;AACrB5D,QAAAA,MAAM,CAAC6D,QAAQ,CAACH,KAAK,CAAC;QACtB,IAAI,CAAC1C,QAAQ,CAACsC,mBAAmB,CAAC,OAAO,EAAEM,QAAQ,CAAC;MACtD,CAAC;MACD,IAAI,CAAC5C,QAAQ,CAACkC,gBAAgB,CAAC,OAAO,EAAEU,QAAQ,CAAC;AACnD,IAAA;;AAEA;AACA,IAAA,IAAI,CAAC5C,QAAQ,CAAC8C,KAAK,EAAE;AACvB,EAAA;AAAC,EAAA;IAAAnB,CAAA,CAAA,IAAA,CAAA/B,SAAA,EAAA,WAAA,EAAA,CAhBAgC,MAAM,CAAA,CAAA;AAAA;AAiBT;AAACmB,oBAAA,CAAAC,QAAA,EApIoBvD,SAAS,CAAA;;;;"}
|
|
@@ -4,6 +4,7 @@ import { action } from '@ember/object';
|
|
|
4
4
|
import { assert } from '@ember/debug';
|
|
5
5
|
import { getElementId } from '../../../utils/hds-get-element-id.js';
|
|
6
6
|
import { buildWaiter } from '@ember/test-waiters';
|
|
7
|
+
import { modifier } from 'ember-modifier';
|
|
7
8
|
import '../dialog-primitive/header.js';
|
|
8
9
|
import '../dialog-primitive/body.js';
|
|
9
10
|
import '../dialog-primitive/footer.js';
|
|
@@ -12,7 +13,7 @@ import { precompileTemplate } from '@ember/template-compilation';
|
|
|
12
13
|
import { g, i, n } from 'decorator-transforms/runtime';
|
|
13
14
|
import { setComponentTemplate } from '@ember/component';
|
|
14
15
|
|
|
15
|
-
var TEMPLATE = precompileTemplate("{{!\n Copyright (c) HashiCorp, Inc.\n SPDX-License-Identifier: MPL-2.0\n}}\n<Hds::DialogPrimitive::Wrapper\n class={{this.classNames}}\n ...attributes\n aria-labelledby={{this.id}}\n {{
|
|
16
|
+
var TEMPLATE = precompileTemplate("{{!\n Copyright (c) HashiCorp, Inc.\n SPDX-License-Identifier: MPL-2.0\n}}\n<Hds::DialogPrimitive::Wrapper\n class={{this.classNames}}\n ...attributes\n aria-labelledby={{this.id}}\n {{this._registerDialog}}\n {{! @glint-expect-error - https://github.com/josemarluedke/ember-focus-trap/issues/86 }}\n {{focus-trap isActive=this._isOpen focusTrapOptions=(hash onDeactivate=this.onDismiss)}}\n>\n <:header>\n {{yield\n (hash\n Header=(component\n \"hds/dialog-primitive/header\"\n id=this.id\n onDismiss=this.onDismiss\n contextualClassPrefix=\"hds-modal\"\n titleTag=\"h1\"\n )\n )\n }}\n </:header>\n <:body>\n {{yield (hash Body=(component \"hds/dialog-primitive/body\" contextualClass=\"hds-modal__body\"))}}\n </:body>\n <:footer>\n {{yield\n (hash\n Footer=(component \"hds/dialog-primitive/footer\" onDismiss=this.onDismiss contextualClass=\"hds-modal__footer\")\n )\n }}\n </:footer>\n</Hds::DialogPrimitive::Wrapper>\n\n{{#if this._isOpen}}\n <Hds::DialogPrimitive::Overlay @contextualClass=\"hds-modal__overlay\" />\n{{/if}}");
|
|
16
17
|
|
|
17
18
|
/**
|
|
18
19
|
* Copyright (c) HashiCorp, Inc.
|
|
@@ -34,6 +35,7 @@ class HdsModal extends Component {
|
|
|
34
35
|
_element;
|
|
35
36
|
_body;
|
|
36
37
|
_bodyInitialOverflowValue = '';
|
|
38
|
+
_clickOutsideToDismissHandler;
|
|
37
39
|
get isDismissDisabled() {
|
|
38
40
|
return this.args.isDismissDisabled ?? false;
|
|
39
41
|
}
|
|
@@ -80,12 +82,32 @@ class HdsModal extends Component {
|
|
|
80
82
|
}
|
|
81
83
|
} else {
|
|
82
84
|
this._isOpen = false;
|
|
85
|
+
|
|
86
|
+
// Reset page `overflow` property
|
|
87
|
+
if (this._body) {
|
|
88
|
+
this._body.style.removeProperty('overflow');
|
|
89
|
+
if (this._bodyInitialOverflowValue === '') {
|
|
90
|
+
if (this._body.style.length === 0) {
|
|
91
|
+
this._body.removeAttribute('style');
|
|
92
|
+
}
|
|
93
|
+
} else {
|
|
94
|
+
this._body.style.setProperty('overflow', this._bodyInitialOverflowValue);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
// Return focus to a specific element (if provided)
|
|
99
|
+
if (this.args.returnFocusTo) {
|
|
100
|
+
const initiator = document.getElementById(this.args.returnFocusTo);
|
|
101
|
+
if (initiator) {
|
|
102
|
+
initiator.focus();
|
|
103
|
+
}
|
|
104
|
+
}
|
|
83
105
|
}
|
|
84
106
|
}
|
|
85
107
|
static {
|
|
86
108
|
n(this.prototype, "registerOnCloseCallback", [action]);
|
|
87
109
|
}
|
|
88
|
-
|
|
110
|
+
_registerDialog = modifier(element => {
|
|
89
111
|
// Store references of `<dialog>` and `<body>` elements
|
|
90
112
|
this._element = element;
|
|
91
113
|
this._body = document.body;
|
|
@@ -102,20 +124,32 @@ class HdsModal extends Component {
|
|
|
102
124
|
if (!this._element.open) {
|
|
103
125
|
this.open();
|
|
104
126
|
}
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
127
|
+
|
|
128
|
+
// Note: because the Modal has the `@isDismissedDisabled` argument, we need to add our own click outside to dismiss logic. This is because `ember-focus-trap` treats the `focusTrapOptions` as static, so we can't update it dynamically if `@isDismissDisabled` changes.
|
|
129
|
+
this._clickOutsideToDismissHandler = event => {
|
|
130
|
+
// check if the click is outside the modal and the modal is open
|
|
131
|
+
if (!this._element.contains(event.target) && this._isOpen) {
|
|
132
|
+
if (!this.isDismissDisabled) {
|
|
133
|
+
// here we use `void` because `onDismiss` is an async function, but in reality we don't need to handle the result or wait for its completion
|
|
134
|
+
void this.onDismiss();
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
};
|
|
138
|
+
document.addEventListener('click', this._clickOutsideToDismissHandler, {
|
|
139
|
+
capture: true,
|
|
140
|
+
passive: false
|
|
141
|
+
});
|
|
142
|
+
return () => {
|
|
143
|
+
// if the <dialog> is removed from the dom while open we emulate the close event
|
|
144
|
+
if (this._isOpen) {
|
|
145
|
+
this._element?.dispatchEvent(new Event('close'));
|
|
146
|
+
}
|
|
147
|
+
this._element?.removeEventListener('close',
|
|
112
148
|
// eslint-disable-next-line @typescript-eslint/unbound-method
|
|
113
149
|
this.registerOnCloseCallback, true);
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
n(this.prototype, "willDestroyNode", [action]);
|
|
118
|
-
}
|
|
150
|
+
document.removeEventListener('click', this._clickOutsideToDismissHandler, true);
|
|
151
|
+
};
|
|
152
|
+
});
|
|
119
153
|
open() {
|
|
120
154
|
// Make modal dialog visible using the native `showModal` method
|
|
121
155
|
this._element.showModal();
|
|
@@ -135,7 +169,6 @@ class HdsModal extends Component {
|
|
|
135
169
|
async onDismiss() {
|
|
136
170
|
// allow ember test helpers to be aware of when the `close` event fires
|
|
137
171
|
// when using `click` or other helpers from '@ember/test-helpers'
|
|
138
|
-
// Notice: this code will get stripped out in production builds (DEBUG evaluates to `true` in dev/test builds, but `false` in prod builds)
|
|
139
172
|
if (this._element.open) {
|
|
140
173
|
const token = waiter.beginAsync();
|
|
141
174
|
const listener = () => {
|
|
@@ -147,26 +180,6 @@ class HdsModal extends Component {
|
|
|
147
180
|
|
|
148
181
|
// Make modal dialog invisible using the native `close` method
|
|
149
182
|
this._element.close();
|
|
150
|
-
|
|
151
|
-
// Reset page `overflow` property
|
|
152
|
-
if (this._body) {
|
|
153
|
-
this._body.style.removeProperty('overflow');
|
|
154
|
-
if (this._bodyInitialOverflowValue === '') {
|
|
155
|
-
if (this._body.style.length === 0) {
|
|
156
|
-
this._body.removeAttribute('style');
|
|
157
|
-
}
|
|
158
|
-
} else {
|
|
159
|
-
this._body.style.setProperty('overflow', this._bodyInitialOverflowValue);
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
// Return focus to a specific element (if provided)
|
|
164
|
-
if (this.args.returnFocusTo) {
|
|
165
|
-
const initiator = document.getElementById(this.args.returnFocusTo);
|
|
166
|
-
if (initiator) {
|
|
167
|
-
initiator.focus();
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
183
|
}
|
|
171
184
|
static {
|
|
172
185
|
n(this.prototype, "onDismiss", [action]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../src/components/hds/modal/index.ts"],"sourcesContent":["/**\n * Copyright (c) HashiCorp, Inc.\n * SPDX-License-Identifier: MPL-2.0\n */\n\nimport Component from '@glimmer/component';\nimport { tracked } from '@glimmer/tracking';\nimport { action } from '@ember/object';\nimport { assert } from '@ember/debug';\nimport { getElementId } from '../../../utils/hds-get-element-id.ts';\nimport { buildWaiter } from '@ember/test-waiters';\n\nimport type { WithBoundArgs } from '@glint/template';\nimport type { HdsModalSizes, HdsModalColors } from './types.ts';\n\nimport HdsDialogPrimitiveHeaderComponent from '../dialog-primitive/header.ts';\nimport HdsDialogPrimitiveBodyComponent from '../dialog-primitive/body.ts';\nimport HdsDialogPrimitiveFooterComponent from '../dialog-primitive/footer.ts';\nimport { HdsModalSizeValues, HdsModalColorValues } from './types.ts';\n\nconst waiter = buildWaiter('@hashicorp/design-system-components:modal');\n\nexport const DEFAULT_SIZE = HdsModalSizeValues.Medium;\nexport const DEFAULT_COLOR = HdsModalColorValues.Neutral;\n\nexport const SIZES: HdsModalSizes[] = Object.values(HdsModalSizeValues);\nexport const COLORS: HdsModalColors[] = Object.values(HdsModalColorValues);\n\nexport interface HdsModalSignature {\n Args: {\n isDismissDisabled?: boolean;\n size?: HdsModalSizes;\n color?: HdsModalColors;\n returnFocusTo?: string;\n onOpen?: () => void;\n onClose?: (event: Event) => void;\n };\n Blocks: {\n default: [\n {\n Header?: WithBoundArgs<\n typeof HdsDialogPrimitiveHeaderComponent,\n 'id' | 'onDismiss' | 'contextualClassPrefix'\n >;\n Body?: WithBoundArgs<\n typeof HdsDialogPrimitiveBodyComponent,\n 'contextualClass'\n >;\n Footer?: WithBoundArgs<\n typeof HdsDialogPrimitiveFooterComponent,\n 'onDismiss' | 'contextualClass'\n >;\n },\n ];\n };\n Element: HTMLDialogElement;\n}\n\nexport default class HdsModal extends Component<HdsModalSignature> {\n @tracked private _isOpen = false;\n private _element!: HTMLDialogElement;\n private _body!: HTMLElement;\n private _bodyInitialOverflowValue = '';\n\n get isDismissDisabled(): boolean {\n return this.args.isDismissDisabled ?? false;\n }\n\n get size(): HdsModalSizes {\n const { size = DEFAULT_SIZE } = this.args;\n\n assert(\n `@size for \"Hds::Modal\" must be one of the following: ${SIZES.join(\n ', '\n )}; received: ${size}`,\n SIZES.includes(size)\n );\n\n return size;\n }\n\n get color(): HdsModalColors {\n const { color = DEFAULT_COLOR } = this.args;\n\n assert(\n `@color for \"Hds::Modal\" must be one of the following: ${COLORS.join(\n ', '\n )}; received: ${color}`,\n COLORS.includes(color)\n );\n\n return color;\n }\n\n get id(): string {\n return getElementId(this);\n }\n\n get classNames(): string {\n const classes = ['hds-modal'];\n\n // add a class based on the @size argument\n classes.push(`hds-modal--size-${this.size}`);\n\n // add a class based on the @color argument\n classes.push(`hds-modal--color-${this.color}`);\n\n return classes.join(' ');\n }\n\n @action registerOnCloseCallback(event: Event): void {\n if (\n !this.isDismissDisabled &&\n this.args.onClose &&\n typeof this.args.onClose === 'function'\n ) {\n this.args.onClose(event);\n }\n\n // If the dismissal of the modal is disabled, we keep the modal open/visible otherwise we mark it as closed\n if (this.isDismissDisabled) {\n // If, in a chain of events, the element is not attached to the DOM, the `showModal` would fail\n // so we add this safeguard condition that checks for the `<dialog>` to have a parent\n if (this._element.parentElement) {\n // As there is no way to `preventDefault` on `close` events, we call the `showModal` function\n // preserving the state of the modal dialog\n this._element.showModal();\n }\n } else {\n this._isOpen = false;\n }\n }\n\n @action\n didInsert(element: HTMLDialogElement): void {\n // Store references of `<dialog>` and `<body>` elements\n this._element = element;\n this._body = document.body;\n\n if (this._body) {\n // Store the initial `overflow` value of `<body>` so we can reset to it\n this._bodyInitialOverflowValue =\n this._body.style.getPropertyValue('overflow');\n }\n\n // Register \"onClose\" callback function to be called when a native 'close' event is dispatched\n // eslint-disable-next-line @typescript-eslint/unbound-method\n this._element.addEventListener('close', this.registerOnCloseCallback, true);\n\n // If the modal dialog is not already open\n if (!this._element.open) {\n this.open();\n }\n }\n\n @action\n willDestroyNode(): void {\n if (this._element) {\n this._element.removeEventListener(\n 'close',\n // eslint-disable-next-line @typescript-eslint/unbound-method\n this.registerOnCloseCallback,\n true\n );\n }\n }\n\n @action\n open(): void {\n // Make modal dialog visible using the native `showModal` method\n this._element.showModal();\n this._isOpen = true;\n\n // Prevent page from scrolling when the dialog is open\n if (this._body) this._body.style.setProperty('overflow', 'hidden');\n\n // Call \"onOpen\" callback function\n if (this.args.onOpen && typeof this.args.onOpen === 'function') {\n this.args.onOpen();\n }\n }\n\n @action\n // eslint-disable-next-line @typescript-eslint/require-await\n async onDismiss(): Promise<void> {\n // allow ember test helpers to be aware of when the `close` event fires\n // when using `click` or other helpers from '@ember/test-helpers'\n // Notice: this code will get stripped out in production builds (DEBUG evaluates to `true` in dev/test builds, but `false` in prod builds)\n if (this._element.open) {\n const token = waiter.beginAsync();\n const listener = () => {\n waiter.endAsync(token);\n this._element.removeEventListener('close', listener);\n };\n this._element.addEventListener('close', listener);\n }\n\n // Make modal dialog invisible using the native `close` method\n this._element.close();\n\n // Reset page `overflow` property\n if (this._body) {\n this._body.style.removeProperty('overflow');\n if (this._bodyInitialOverflowValue === '') {\n if (this._body.style.length === 0) {\n this._body.removeAttribute('style');\n }\n } else {\n this._body.style.setProperty(\n 'overflow',\n this._bodyInitialOverflowValue\n );\n }\n }\n\n // Return focus to a specific element (if provided)\n if (this.args.returnFocusTo) {\n const initiator = document.getElementById(this.args.returnFocusTo);\n if (initiator) {\n initiator.focus();\n }\n }\n }\n}\n"],"names":["waiter","buildWaiter","DEFAULT_SIZE","HdsModalSizeValues","Medium","DEFAULT_COLOR","HdsModalColorValues","Neutral","SIZES","Object","values","COLORS","HdsModal","Component","g","prototype","tracked","i","void 0","_element","_body","_bodyInitialOverflowValue","isDismissDisabled","args","size","assert","join","includes","color","id","getElementId","classNames","classes","push","registerOnCloseCallback","event","onClose","parentElement","showModal","_isOpen","n","action","didInsert","element","document","body","style","getPropertyValue","addEventListener","open","willDestroyNode","removeEventListener","setProperty","onOpen","onDismiss","token","beginAsync","listener","endAsync","close","removeProperty","length","removeAttribute","returnFocusTo","initiator","getElementById","focus","setComponentTemplate","TEMPLATE"],"mappings":";;;;;;;;;;;;;;;;AAAA;AACA;AACA;AACA;;AAiBA,MAAMA,MAAM,GAAGC,WAAW,CAAC,2CAA2C,CAAC;AAEhE,MAAMC,YAAY,GAAGC,kBAAkB,CAACC;AACxC,MAAMC,aAAa,GAAGC,mBAAmB,CAACC;AAE1C,MAAMC,KAAsB,GAAGC,MAAM,CAACC,MAAM,CAACP,kBAAkB;AAC/D,MAAMQ,MAAwB,GAAGF,MAAM,CAACC,MAAM,CAACJ,mBAAmB;AAgC1D,MAAMM,QAAQ,SAASC,SAAS,CAAoB;AAAA,EAAA;IAAAC,CAAA,CAAA,IAAA,CAAAC,SAAA,EAAA,SAAA,EAAA,CAChEC,OAAO,CAAA,EAAA,YAAA;AAAA,MAAA,OAAmB,KAAK;AAAA,IAAA,CAAA,CAAA;AAAA;AAAA,EAAA,QAAA,IAAAC,CAAA,CAAA,IAAA,EAAA,SAAA,CAAA,EAAAC,MAAA;EACxBC,QAAQ;EACRC,KAAK;AACLC,EAAAA,yBAAyB,GAAG,EAAE;EAEtC,IAAIC,iBAAiBA,GAAY;AAC/B,IAAA,OAAO,IAAI,CAACC,IAAI,CAACD,iBAAiB,IAAI,KAAK;AAC7C,EAAA;EAEA,IAAIE,IAAIA,GAAkB;IACxB,MAAM;AAAEA,MAAAA,IAAI,GAAGtB;KAAc,GAAG,IAAI,CAACqB,IAAI;AAEzCE,IAAAA,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CAACD,KAAK,CAAC0B,KAAK,CAACe,MAAM,KAAK,CAAC,EAAE;AACjC,UAAA,IAAI,CAACzC,KAAK,CAAC0C,eAAe,CAAC,OAAO,CAAC;AACrC,QAAA;AACF,MAAA,CAAC,MAAM;AACL,QAAA,IAAI,CAAC1C,KAAK,CAAC0B,KAAK,CAACM,WAAW,CAC1B,UAAU,EACV,IAAI,CAAC/B,yBACP,CAAC;AACH,MAAA;AACF,IAAA;;AAEA;AACA,IAAA,IAAI,IAAI,CAACE,IAAI,CAACwC,aAAa,EAAE;MAC3B,MAAMC,SAAS,GAAGpB,QAAQ,CAACqB,cAAc,CAAC,IAAI,CAAC1C,IAAI,CAACwC,aAAa,CAAC;AAClE,MAAA,IAAIC,SAAS,EAAE;QACbA,SAAS,CAACE,KAAK,EAAE;AACnB,MAAA;AACF,IAAA;AACF,EAAA;AAAC,EAAA;IAAA1B,CAAA,CAAA,IAAA,CAAAzB,SAAA,EAAA,WAAA,EAAA,CAxCA0B,MAAM,CAAA,CAAA;AAAA;AAyCT;AAAC0B,oBAAA,CAAAC,QAAA,EArKoBxD,QAAQ,CAAA;;;;"}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../src/components/hds/modal/index.ts"],"sourcesContent":["/**\n * Copyright (c) HashiCorp, Inc.\n * SPDX-License-Identifier: MPL-2.0\n */\n\nimport Component from '@glimmer/component';\nimport { tracked } from '@glimmer/tracking';\nimport { action } from '@ember/object';\nimport { assert } from '@ember/debug';\nimport { getElementId } from '../../../utils/hds-get-element-id.ts';\nimport { buildWaiter } from '@ember/test-waiters';\nimport { modifier } from 'ember-modifier';\n\nimport type { WithBoundArgs } from '@glint/template';\nimport type { HdsModalSizes, HdsModalColors } from './types.ts';\n\nimport HdsDialogPrimitiveHeaderComponent from '../dialog-primitive/header.ts';\nimport HdsDialogPrimitiveBodyComponent from '../dialog-primitive/body.ts';\nimport HdsDialogPrimitiveFooterComponent from '../dialog-primitive/footer.ts';\nimport { HdsModalSizeValues, HdsModalColorValues } from './types.ts';\n\nconst waiter = buildWaiter('@hashicorp/design-system-components:modal');\n\nexport const DEFAULT_SIZE = HdsModalSizeValues.Medium;\nexport const DEFAULT_COLOR = HdsModalColorValues.Neutral;\n\nexport const SIZES: HdsModalSizes[] = Object.values(HdsModalSizeValues);\nexport const COLORS: HdsModalColors[] = Object.values(HdsModalColorValues);\n\nexport interface HdsModalSignature {\n Args: {\n isDismissDisabled?: boolean;\n size?: HdsModalSizes;\n color?: HdsModalColors;\n returnFocusTo?: string;\n onOpen?: () => void;\n onClose?: (event: Event) => void;\n };\n Blocks: {\n default: [\n {\n Header?: WithBoundArgs<\n typeof HdsDialogPrimitiveHeaderComponent,\n 'id' | 'onDismiss' | 'contextualClassPrefix'\n >;\n Body?: WithBoundArgs<\n typeof HdsDialogPrimitiveBodyComponent,\n 'contextualClass'\n >;\n Footer?: WithBoundArgs<\n typeof HdsDialogPrimitiveFooterComponent,\n 'onDismiss' | 'contextualClass'\n >;\n },\n ];\n };\n Element: HTMLDialogElement;\n}\n\nexport default class HdsModal extends Component<HdsModalSignature> {\n @tracked private _isOpen = false;\n private _element!: HTMLDialogElement;\n private _body!: HTMLElement;\n private _bodyInitialOverflowValue = '';\n private _clickOutsideToDismissHandler!: (event: MouseEvent) => void;\n\n get isDismissDisabled(): boolean {\n return this.args.isDismissDisabled ?? false;\n }\n\n get size(): HdsModalSizes {\n const { size = DEFAULT_SIZE } = this.args;\n\n assert(\n `@size for \"Hds::Modal\" must be one of the following: ${SIZES.join(\n ', '\n )}; received: ${size}`,\n SIZES.includes(size)\n );\n\n return size;\n }\n\n get color(): HdsModalColors {\n const { color = DEFAULT_COLOR } = this.args;\n\n assert(\n `@color for \"Hds::Modal\" must be one of the following: ${COLORS.join(\n ', '\n )}; received: ${color}`,\n COLORS.includes(color)\n );\n\n return color;\n }\n\n get id(): string {\n return getElementId(this);\n }\n\n get classNames(): string {\n const classes = ['hds-modal'];\n\n // add a class based on the @size argument\n classes.push(`hds-modal--size-${this.size}`);\n\n // add a class based on the @color argument\n classes.push(`hds-modal--color-${this.color}`);\n\n return classes.join(' ');\n }\n\n @action registerOnCloseCallback(event: Event): void {\n if (\n !this.isDismissDisabled &&\n this.args.onClose &&\n typeof this.args.onClose === 'function'\n ) {\n this.args.onClose(event);\n }\n\n // If the dismissal of the modal is disabled, we keep the modal open/visible otherwise we mark it as closed\n if (this.isDismissDisabled) {\n // If, in a chain of events, the element is not attached to the DOM, the `showModal` would fail\n // so we add this safeguard condition that checks for the `<dialog>` to have a parent\n if (this._element.parentElement) {\n // As there is no way to `preventDefault` on `close` events, we call the `showModal` function\n // preserving the state of the modal dialog\n this._element.showModal();\n }\n } else {\n this._isOpen = false;\n\n // Reset page `overflow` property\n if (this._body) {\n this._body.style.removeProperty('overflow');\n if (this._bodyInitialOverflowValue === '') {\n if (this._body.style.length === 0) {\n this._body.removeAttribute('style');\n }\n } else {\n this._body.style.setProperty(\n 'overflow',\n this._bodyInitialOverflowValue\n );\n }\n }\n\n // Return focus to a specific element (if provided)\n if (this.args.returnFocusTo) {\n const initiator = document.getElementById(this.args.returnFocusTo);\n if (initiator) {\n initiator.focus();\n }\n }\n }\n }\n\n private _registerDialog = modifier((element: HTMLDialogElement) => {\n // Store references of `<dialog>` and `<body>` elements\n this._element = element;\n this._body = document.body;\n\n if (this._body) {\n // Store the initial `overflow` value of `<body>` so we can reset to it\n this._bodyInitialOverflowValue =\n this._body.style.getPropertyValue('overflow');\n }\n\n // Register \"onClose\" callback function to be called when a native 'close' event is dispatched\n // eslint-disable-next-line @typescript-eslint/unbound-method\n this._element.addEventListener('close', this.registerOnCloseCallback, true);\n\n // If the modal dialog is not already open\n if (!this._element.open) {\n this.open();\n }\n\n // Note: because the Modal has the `@isDismissedDisabled` argument, we need to add our own click outside to dismiss logic. This is because `ember-focus-trap` treats the `focusTrapOptions` as static, so we can't update it dynamically if `@isDismissDisabled` changes.\n this._clickOutsideToDismissHandler = (event: MouseEvent) => {\n // check if the click is outside the modal and the modal is open\n if (!this._element.contains(event.target as Node) && this._isOpen) {\n if (!this.isDismissDisabled) {\n // here we use `void` because `onDismiss` is an async function, but in reality we don't need to handle the result or wait for its completion\n void this.onDismiss();\n }\n }\n };\n\n document.addEventListener('click', this._clickOutsideToDismissHandler, {\n capture: true,\n passive: false,\n });\n\n return () => {\n // if the <dialog> is removed from the dom while open we emulate the close event\n if (this._isOpen) {\n this._element?.dispatchEvent(new Event('close'));\n }\n\n this._element?.removeEventListener(\n 'close',\n // eslint-disable-next-line @typescript-eslint/unbound-method\n this.registerOnCloseCallback,\n true\n );\n\n document.removeEventListener(\n 'click',\n this._clickOutsideToDismissHandler,\n true\n );\n };\n });\n\n @action\n open(): void {\n // Make modal dialog visible using the native `showModal` method\n this._element.showModal();\n this._isOpen = true;\n\n // Prevent page from scrolling when the dialog is open\n if (this._body) this._body.style.setProperty('overflow', 'hidden');\n\n // Call \"onOpen\" callback function\n if (this.args.onOpen && typeof this.args.onOpen === 'function') {\n this.args.onOpen();\n }\n }\n\n @action\n // eslint-disable-next-line @typescript-eslint/require-await\n async onDismiss(): Promise<void> {\n // allow ember test helpers to be aware of when the `close` event fires\n // when using `click` or other helpers from '@ember/test-helpers'\n if (this._element.open) {\n const token = waiter.beginAsync();\n const listener = () => {\n waiter.endAsync(token);\n this._element.removeEventListener('close', listener);\n };\n this._element.addEventListener('close', listener);\n }\n\n // Make modal dialog invisible using the native `close` method\n this._element.close();\n }\n}\n"],"names":["waiter","buildWaiter","DEFAULT_SIZE","HdsModalSizeValues","Medium","DEFAULT_COLOR","HdsModalColorValues","Neutral","SIZES","Object","values","COLORS","HdsModal","Component","g","prototype","tracked","i","void 0","_element","_body","_bodyInitialOverflowValue","_clickOutsideToDismissHandler","isDismissDisabled","args","size","assert","join","includes","color","id","getElementId","classNames","classes","push","registerOnCloseCallback","event","onClose","parentElement","showModal","_isOpen","style","removeProperty","length","removeAttribute","setProperty","returnFocusTo","initiator","document","getElementById","focus","n","action","_registerDialog","modifier","element","body","getPropertyValue","addEventListener","open","contains","target","onDismiss","capture","passive","dispatchEvent","Event","removeEventListener","onOpen","token","beginAsync","listener","endAsync","close","setComponentTemplate","TEMPLATE"],"mappings":";;;;;;;;;;;;;;;;;AAAA;AACA;AACA;AACA;;AAkBA,MAAMA,MAAM,GAAGC,WAAW,CAAC,2CAA2C,CAAC;AAEhE,MAAMC,YAAY,GAAGC,kBAAkB,CAACC;AACxC,MAAMC,aAAa,GAAGC,mBAAmB,CAACC;AAE1C,MAAMC,KAAsB,GAAGC,MAAM,CAACC,MAAM,CAACP,kBAAkB;AAC/D,MAAMQ,MAAwB,GAAGF,MAAM,CAACC,MAAM,CAACJ,mBAAmB;AAgC1D,MAAMM,QAAQ,SAASC,SAAS,CAAoB;AAAA,EAAA;IAAAC,CAAA,CAAA,IAAA,CAAAC,SAAA,EAAA,SAAA,EAAA,CAChEC,OAAO,CAAA,EAAA,YAAA;AAAA,MAAA,OAAmB,KAAK;AAAA,IAAA,CAAA,CAAA;AAAA;AAAA,EAAA,QAAA,IAAAC,CAAA,CAAA,IAAA,EAAA,SAAA,CAAA,EAAAC,MAAA;EACxBC,QAAQ;EACRC,KAAK;AACLC,EAAAA,yBAAyB,GAAG,EAAE;EAC9BC,6BAA6B;EAErC,IAAIC,iBAAiBA,GAAY;AAC/B,IAAA,OAAO,IAAI,CAACC,IAAI,CAACD,iBAAiB,IAAI,KAAK;AAC7C,EAAA;EAEA,IAAIE,IAAIA,GAAkB;IACxB,MAAM;AAAEA,MAAAA,IAAI,GAAGvB;KAAc,GAAG,IAAI,CAACsB,IAAI;AAEzCE,IAAAA,MAAM,CACJ,CAAA,qDAAA,EAAwDlB,KAAK,CAACmB,IAAI,CAChE,IACF,CAAC,CAAA,YAAA,EAAeF,IAAI,CAAA,CAAE,EACtBjB,KAAK,CAACoB,QAAQ,CAACH,IAAI,CACrB,CAAC;AAED,IAAA,OAAOA,IAAI;AACb,EAAA;EAEA,IAAII,KAAKA,GAAmB;IAC1B,MAAM;AAAEA,MA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AC4C,MAAM,IAAI,OAAO,IAAI,CAAC5C,IAAI,CAAC4C,MAAM,KAAK,UAAU,EAAE;AAC9D,MAAA,IAAI,CAAC5C,IAAI,CAAC4C,MAAM,EAAE;AACpB,IAAA;AACF,EAAA;AAAC,EAAA;IAAAjB,CAAA,CAAA,IAAA,CAAApC,SAAA,EAAA,MAAA,EAAA,CAbAqC,MAAM,CAAA,CAAA;AAAA;EAeP,MAEMU,SAASA,GAAkB;AAC/B;AACA;AACA,IAAA,IAAI,IAAI,CAAC3C,QAAQ,CAACwC,IAAI,EAAE;AACtB,MAAA,MAAMU,KAAK,GAAGrE,MAAM,CAACsE,UAAU,EAAE;MACjC,MAAMC,QAAQ,GAAGA,MAAM;AACrBvE,QAAAA,MAAM,CAACwE,QAAQ,CAACH,KAAK,CAAC;QACtB,IAAI,CAAClD,QAAQ,CAACgD,mBAAmB,CAAC,OAAO,EAAEI,QAAQ,CAAC;MACtD,CAAC;MACD,IAAI,CAACpD,QAAQ,CAACuC,gBAAgB,CAAC,OAAO,EAAEa,QAAQ,CAAC;AACnD,IAAA;;AAEA;AACA,IAAA,IAAI,CAACpD,QAAQ,CAACsD,KAAK,EAAE;AACvB,EAAA;AAAC,EAAA;IAAAtB,CAAA,CAAA,IAAA,CAAApC,SAAA,EAAA,WAAA,EAAA,CAhBAqC,MAAM,CAAA,CAAA;AAAA;AAiBT;AAACsB,oBAAA,CAAAC,QAAA,EA5LoB/D,QAAQ,CAAA;;;;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { macroCondition, getOwnConfig, isTesting } from '@embroider/macros';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Copyright (c) HashiCorp, Inc.
|
|
@@ -6,16 +6,14 @@ import config from 'ember-get-config';
|
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
async function initialize() {
|
|
9
|
-
|
|
10
|
-
if (config?.flightIconsSpriteLazyEmbed) {
|
|
9
|
+
if (macroCondition(getOwnConfig().flightIconsSpriteLazyEmbed)) {
|
|
11
10
|
const {
|
|
12
11
|
default: svgSprite
|
|
13
12
|
} = await import('@hashicorp/flight-icons/svg-sprite/svg-sprite-module');
|
|
14
13
|
|
|
15
14
|
// in test environments we can inject the sprite directly into the ember testing container
|
|
16
15
|
// to avoid issues with tools like Percy that only consider content inside that element
|
|
17
|
-
|
|
18
|
-
if (config.environment === 'test') {
|
|
16
|
+
if (macroCondition(isTesting())) {
|
|
19
17
|
const container = window.document?.getElementById('ember-testing');
|
|
20
18
|
if (container && !container.querySelector('.flight-sprite-container')) {
|
|
21
19
|
container.insertAdjacentHTML('afterbegin', svgSprite);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"load-sprite.js","sources":["../../src/instance-initializers/load-sprite.ts"],"sourcesContent":["/**\n * Copyright (c) HashiCorp, Inc.\n * SPDX-License-Identifier: MPL-2.0\n */\n\nimport
|
|
1
|
+
{"version":3,"file":"load-sprite.js","sources":["../../src/instance-initializers/load-sprite.ts"],"sourcesContent":["/**\n * Copyright (c) HashiCorp, Inc.\n * SPDX-License-Identifier: MPL-2.0\n */\n\nimport { macroCondition, isTesting, getOwnConfig } from '@embroider/macros';\n\ninterface Config {\n flightIconsSpriteLazyEmbed: boolean;\n}\n\nexport async function initialize() {\n if (macroCondition(getOwnConfig<Config>().flightIconsSpriteLazyEmbed)) {\n const { default: svgSprite } = await import(\n '@hashicorp/flight-icons/svg-sprite/svg-sprite-module'\n );\n\n // in test environments we can inject the sprite directly into the ember testing container\n // to avoid issues with tools like Percy that only consider content inside that element\n if (macroCondition(isTesting())) {\n const container = window.document?.getElementById('ember-testing');\n\n if (container && !container.querySelector('.flight-sprite-container')) {\n container.insertAdjacentHTML('afterbegin', svgSprite);\n }\n } else {\n const container = window.document?.body;\n\n if (container && !container.querySelector('.flight-sprite-container')) {\n container.insertAdjacentHTML('beforeend', svgSprite);\n }\n }\n }\n}\n\nexport default {\n initialize,\n};\n"],"names":["initialize","macroCondition","getOwnConfig","flightIconsSpriteLazyEmbed","default","svgSprite","isTesting","container","window","document","getElementById","querySelector","insertAdjacentHTML","body"],"mappings":";;AAAA;AACA;AACA;AACA;;AAQO,eAAeA,UAAUA,GAAG;EACjC,IAAIC,cAAc,CAACC,YAAY,EAAU,CAACC,0BAA0B,CAAC,EAAE;IACrE,MAAM;AAAEC,MAAAA,OAAO,EAAEC;AAAU,KAAC,GAAG,MAAM,OACnC,sDACF,CAAC;;AAED;AACA;AACA,IAAA,IAAIJ,cAAc,CAACK,SAAS,EAAE,CAAC,EAAE;MAC/B,MAAMC,SAAS,GAAGC,MAAM,CAACC,QAAQ,EAAEC,cAAc,CAAC,eAAe,CAAC;MAElE,IAAIH,SAAS,IAAI,CAACA,SAAS,CAACI,aAAa,CAAC,0BAA0B,CAAC,EAAE;AACrEJ,QAAAA,SAAS,CAACK,kBAAkB,CAAC,YAAY,EAAEP,SAAS,CAAC;AACvD,MAAA;AACF,IAAA,CAAC,MAAM;AACL,MAAA,MAAME,SAAS,GAAGC,MAAM,CAACC,QAAQ,EAAEI,IAAI;MAEvC,IAAIN,SAAS,IAAI,CAACA,SAAS,CAACI,aAAa,CAAC,0BAA0B,CAAC,EAAE;AACrEJ,QAAAA,SAAS,CAACK,kBAAkB,CAAC,WAAW,EAAEP,SAAS,CAAC;AACtD,MAAA;AACF,IAAA;AACF,EAAA;AACF;AAEA,iBAAe;AACbL,EAAAA;AACF,CAAC;;;;"}
|
|
@@ -3,7 +3,7 @@ import Modifier from 'ember-modifier';
|
|
|
3
3
|
import { assert, warn } from '@ember/debug';
|
|
4
4
|
import { registerDestructor } from '@ember/destroyable';
|
|
5
5
|
import 'ember-concurrency';
|
|
6
|
-
import
|
|
6
|
+
import { macroCondition, isTesting } from '@embroider/macros';
|
|
7
7
|
import { Compartment } from '@codemirror/state';
|
|
8
8
|
import { EditorView } from '@codemirror/view';
|
|
9
9
|
import { guidFor } from '@ember/object/internals';
|
|
@@ -130,8 +130,7 @@ class HdsCodeEditorModifier extends Modifier {
|
|
|
130
130
|
// if the editor does not exist, setup the editor
|
|
131
131
|
else {
|
|
132
132
|
// the intersection observer makes loading unreliable in tests
|
|
133
|
-
|
|
134
|
-
if (config.environment === 'test') {
|
|
133
|
+
if (macroCondition(isTesting())) {
|
|
135
134
|
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
136
135
|
this._setupTask.perform(element, positional, named);
|
|
137
136
|
} else {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hds-code-editor.js","sources":["../../src/modifiers/hds-code-editor.ts"],"sourcesContent":["/**\n * Copyright (c) HashiCorp, Inc.\n * SPDX-License-Identifier: MPL-2.0\n */\n\nimport Modifier from 'ember-modifier';\nimport { assert, warn } from '@ember/debug';\nimport { registerDestructor } from '@ember/destroyable';\nimport { task } from 'ember-concurrency';\nimport config from 'ember-get-config';\nimport { Compartment } from '@codemirror/state';\nimport { EditorView } from '@codemirror/view';\nimport { guidFor } from '@ember/object/internals';\nimport { isEmpty } from '@ember/utils';\nimport { service } from '@ember/service';\n\n// hds-dark theme\nimport hdsDarkTheme from './hds-code-editor/themes/hds-dark-theme.ts';\nimport hdsDarkHighlightStyle from './hds-code-editor/highlight-styles/hds-dark-highlight-style.ts';\n\nimport type HdsIntlService from '../services/hds-intl.ts';\nimport type { HdsCodeEditorLanguages } from './hds-code-editor/types.ts';\nimport type { ArgsFor, PositionalArgs, NamedArgs } from 'ember-modifier';\nimport type {\n StreamLanguage as StreamLanguageType,\n StreamParser as StreamParserType,\n} from '@codemirror/language';\nimport type { Extension } from '@codemirror/state';\nimport type {\n EditorView as EditorViewType,\n KeyBinding,\n ViewUpdate,\n} from '@codemirror/view';\nimport type { Diagnostic as DiagnosticType } from '@codemirror/lint';\nimport type Owner from '@ember/owner';\n\ntype HTMLElementWithEditor = HTMLElement & { editor: EditorViewType };\n\ntype HdsCodeEditorBlurHandler = (\n editor: EditorViewType,\n event: FocusEvent\n) => void;\n\ninterface HdsCodeEditorExtraKeys {\n [key: string]: () => void;\n}\n\nexport interface HdsCodeEditorSignature {\n Args: {\n Named: {\n ariaDescribedBy?: string;\n ariaLabel?: string;\n ariaLabelledBy?: string;\n cspNonce?: string;\n extraKeys?: HdsCodeEditorExtraKeys;\n hasLineWrapping?: boolean;\n isLintingEnabled?: boolean;\n language?: HdsCodeEditorLanguages;\n value?: string;\n onInput?: (newValue: string, editor: EditorViewType) => void;\n onBlur?: HdsCodeEditorBlurHandler;\n onLint?: (\n diagnostics: DiagnosticType[],\n newValue: string,\n editor: EditorViewType\n ) => void;\n onSetup?: (editor: EditorViewType) => unknown;\n };\n };\n}\n\nasync function defineStreamLanguage(streamParser: StreamParserType<unknown>) {\n const { StreamLanguage } = await import('@codemirror/language');\n\n return StreamLanguage.define(streamParser);\n}\n\nexport function getCSPNonceFromMeta(): string | undefined {\n const meta = document.querySelector(\n 'meta[http-equiv=\"Content-Security-Policy\"]'\n );\n\n if (meta === null) {\n return undefined;\n }\n\n const content = meta.getAttribute('content');\n\n if (content === null) {\n return undefined;\n }\n\n // searches for either \"style-src\" or \"script-src\" followed by anything until a token like 'nonce-<value>'\n const match = content.match(/(?:style-src|script-src)[^;]*'nonce-([^']+)'/);\n\n return match ? match[1] : undefined;\n}\n\nconst LOADER_HEIGHT = '164px';\n\nconst LANGUAGES: Record<\n HdsCodeEditorLanguages,\n {\n load: () => Promise<Extension | StreamLanguageType<unknown>>;\n loadLinter?: (\n onLint?: HdsCodeEditorSignature['Args']['Named']['onLint']\n ) => Promise<Extension>;\n }\n> = {\n rego: {\n load: async () => {\n const { rego } = await import('./hds-code-editor/languages/rego.ts');\n return defineStreamLanguage(rego);\n },\n },\n ruby: {\n load: async () => {\n const { ruby } = await import('@codemirror/legacy-modes/mode/ruby');\n return defineStreamLanguage(ruby);\n },\n },\n sentinel: {\n load: async () => {\n const { sentinel } = await import(\n './hds-code-editor/languages/sentinel.ts'\n );\n return defineStreamLanguage(sentinel);\n },\n },\n shell: {\n load: async () => {\n const { shell } = await import('@codemirror/legacy-modes/mode/shell');\n return defineStreamLanguage(shell);\n },\n },\n go: {\n load: async () => (await import('@codemirror/lang-go')).go(),\n },\n hcl: {\n load: async () => (await import('codemirror-lang-hcl')).hcl(),\n },\n javascript: {\n load: async () =>\n (await import('@codemirror/lang-javascript')).javascript(),\n },\n json: {\n load: async () => (await import('@codemirror/lang-json')).json(),\n loadLinter: async (onLint) => {\n const linter = await import('./hds-code-editor/linters/json-linter.ts');\n\n return linter.default(onLint);\n },\n },\n markdown: {\n load: async () => (await import('@codemirror/lang-markdown')).markdown(),\n },\n sql: {\n load: async () => (await import('@codemirror/lang-sql')).sql(),\n },\n yaml: {\n load: async () => (await import('@codemirror/lang-yaml')).yaml(),\n },\n} as const;\n\nexport default class HdsCodeEditorModifier extends Modifier<HdsCodeEditorSignature> {\n @service declare hdsIntl: HdsIntlService;\n\n editor!: EditorViewType;\n element!: HTMLElementWithEditor;\n\n onBlur: HdsCodeEditorSignature['Args']['Named']['onBlur'];\n onInput: HdsCodeEditorSignature['Args']['Named']['onInput'];\n\n blurHandler!: (event: FocusEvent) => void;\n intersectionObserver!: IntersectionObserver;\n mutationObserver!: MutationObserver;\n\n lineWrappingCompartment = new Compartment();\n\n constructor(owner: Owner, args: ArgsFor<HdsCodeEditorSignature>) {\n super(owner, args);\n\n registerDestructor(this, () => {\n this.intersectionObserver?.disconnect();\n this.mutationObserver?.disconnect();\n\n if (this.onBlur !== undefined) {\n this.element.removeEventListener('blur', this.blurHandler);\n }\n });\n }\n\n modify(\n element: HTMLElementWithEditor,\n positional: PositionalArgs<HdsCodeEditorSignature>,\n named: NamedArgs<HdsCodeEditorSignature>\n ): void {\n const { hasLineWrapping = false } = named;\n\n // if the editor already exists, update the line wrapping\n if (this.editor) {\n this.editor.dispatch({\n effects: this.lineWrappingCompartment.reconfigure(\n hasLineWrapping ? EditorView.lineWrapping : []\n ),\n });\n }\n // if the editor does not exist, setup the editor\n else {\n // the intersection observer makes loading unreliable in tests\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n if (config.environment === 'test') {\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n this._setupTask.perform(element, positional, named);\n } else {\n this.intersectionObserver = new IntersectionObserver(\n (entries) => {\n entries.forEach((entry) => {\n if (entry.isIntersecting && this.editor === undefined) {\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n this._setupTask.perform(element, positional, named);\n }\n });\n },\n {\n rootMargin: LOADER_HEIGHT,\n }\n );\n\n this.intersectionObserver.observe(element);\n }\n }\n }\n\n private _setupEditorBlurHandler(\n element: HTMLElementWithEditor,\n onBlur: HdsCodeEditorBlurHandler\n ) {\n const inputElement = element.querySelector('.cm-content');\n\n if (inputElement === null) {\n return;\n }\n\n this.blurHandler = (event: FocusEvent) => onBlur(this.editor, event);\n\n (inputElement as HTMLElement).addEventListener('blur', this.blurHandler);\n }\n\n private _setupEditorAriaLabel(\n editor: EditorViewType,\n {\n ariaLabel,\n ariaLabelledBy,\n }: Pick<\n HdsCodeEditorSignature['Args']['Named'],\n 'ariaLabel' | 'ariaLabelledBy'\n >\n ) {\n assert(\n '`hds-code-editor` modifier - Either `ariaLabel` or `ariaLabelledBy` must be provided',\n ariaLabel !== undefined || ariaLabelledBy !== undefined\n );\n\n if (ariaLabel !== undefined) {\n editor.dom\n .querySelector('[role=\"textbox\"]')\n ?.setAttribute('aria-label', ariaLabel);\n } else if (ariaLabelledBy !== undefined) {\n editor.dom\n .querySelector('[role=\"textbox\"]')\n ?.setAttribute('aria-labelledby', ariaLabelledBy);\n }\n }\n\n private _setupEditorAriaDescribedBy(\n editor: EditorViewType,\n {\n ariaDescribedBy,\n lintingDescriptionElement,\n }: {\n ariaDescribedBy?: string;\n lintingDescriptionElement?: HTMLParagraphElement;\n }\n ) {\n if (\n ariaDescribedBy === undefined &&\n lintingDescriptionElement === undefined\n ) {\n return;\n }\n\n const ariaDescribedByArray = [];\n\n if (ariaDescribedBy !== undefined) {\n ariaDescribedByArray.push(ariaDescribedBy);\n }\n\n if (lintingDescriptionElement !== undefined) {\n ariaDescribedByArray.push(lintingDescriptionElement.id);\n }\n\n editor.dom\n .querySelector('[role=\"textbox\"]')\n ?.setAttribute('aria-describedby', ariaDescribedByArray.join(' '));\n }\n\n private _createLintingDescriptionElement(): HTMLParagraphElement {\n const element = document.createElement('p');\n\n element.id = `lint-panel-instructions-${this.element.id}`;\n element.classList.add('sr-only');\n element.textContent = this.hdsIntl.t(\n 'hds.modifiers.hds-code-editor.lint-panel-description',\n {\n default:\n 'Press `Ctrl-Shift-m` (`Cmd-Shift-m` on macOS) while focus is on the textbox to open the linting panel',\n }\n );\n\n this.element.insertAdjacentElement('beforebegin', element);\n\n return element;\n }\n\n private _setupEditorAriaAttributes(\n editor: EditorViewType,\n {\n ariaDescribedBy,\n ariaLabel,\n ariaLabelledBy,\n lintingDescriptionElement,\n }: Pick<\n HdsCodeEditorSignature['Args']['Named'],\n 'ariaDescribedBy' | 'ariaLabel' | 'ariaLabelledBy'\n > & { lintingDescriptionElement?: HTMLParagraphElement }\n ) {\n this._setupEditorAriaLabel(editor, { ariaLabel, ariaLabelledBy });\n this._setupEditorAriaDescribedBy(editor, {\n ariaDescribedBy,\n lintingDescriptionElement,\n });\n }\n\n private _loadLanguageExtensionsTask = task(\n { drop: true },\n async ({\n language,\n isLintingEnabled,\n onLint,\n }: {\n language?: HdsCodeEditorLanguages;\n isLintingEnabled?: boolean;\n onLint?: HdsCodeEditorSignature['Args']['Named']['onLint'];\n }) => {\n if (language === undefined) {\n return;\n }\n\n try {\n const validLanguageKeys = Object.keys(LANGUAGES);\n\n assert(\n `\\`hds-code-editor\\` modifier - \\`language\\` must be one of the following: ${validLanguageKeys.join(\n ', '\n )}; received: ${language}`,\n validLanguageKeys.includes(language)\n );\n\n let extensionPromises = [LANGUAGES[language].load()];\n\n if (isLintingEnabled && LANGUAGES[language].loadLinter) {\n extensionPromises = [\n ...extensionPromises,\n LANGUAGES[language].loadLinter(onLint),\n ];\n }\n\n return Promise.all(extensionPromises);\n } catch (error) {\n warn(\n `\\`hds-code-editor\\` modifier - Failed to dynamically import the CodeMirror language module for '${language}'. Error: ${JSON.stringify(\n error\n )}`,\n {\n id: 'hds-code-editor.load-language-task.import-failed',\n }\n );\n }\n }\n );\n\n private _buildExtensionsTask = task(\n { drop: true },\n async ({\n cspNonce,\n extraKeys,\n language,\n hasLineWrapping,\n isLintingEnabled,\n onLint,\n }) => {\n const [\n {\n keymap,\n lineNumbers,\n highlightActiveLineGutter,\n highlightSpecialChars,\n highlightActiveLine,\n },\n { defaultKeymap, history, historyKeymap },\n { bracketMatching, syntaxHighlighting },\n ] = await Promise.all([\n import('@codemirror/view'),\n import('@codemirror/commands'),\n import('@codemirror/language'),\n ]);\n\n const languageExtensions = await this._loadLanguageExtensionsTask.perform(\n {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n language,\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n isLintingEnabled,\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n onLint,\n }\n );\n\n const handleUpdateExtension = EditorView.updateListener.of(\n (update: ViewUpdate) => {\n // toggle a class if the update has/does not have a selection\n if (update.selectionSet) {\n update.view.dom.classList.toggle(\n 'cm-hasSelection',\n !update.state.selection.main.empty\n );\n }\n\n // call the onInput callback if the document has changed\n if (!update.docChanged || this.onInput === undefined) {\n return;\n }\n this.onInput(update.state.doc.toString(), update.view);\n }\n );\n\n const lineWrappingExtension = this.lineWrappingCompartment.of(\n hasLineWrapping ? EditorView.lineWrapping : []\n );\n\n let extensions = [\n lineWrappingExtension,\n bracketMatching(),\n highlightActiveLine(),\n highlightActiveLineGutter(),\n highlightSpecialChars(),\n history(),\n keymap.of([...defaultKeymap, ...historyKeymap]),\n // custom extensions\n handleUpdateExtension,\n // hds dark theme\n hdsDarkTheme,\n syntaxHighlighting(hdsDarkHighlightStyle),\n ];\n\n if (extraKeys !== undefined) {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-argument\n const customKeyMap = Object.entries(extraKeys).map(([key, value]) => ({\n key: key,\n run: value,\n }));\n\n extensions = [keymap.of(customKeyMap as KeyBinding[]), ...extensions];\n }\n\n if (languageExtensions !== undefined) {\n extensions = [...extensions, ...languageExtensions];\n }\n\n // add nonce to the editor view if it exists\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n const nonce = cspNonce ?? getCSPNonceFromMeta();\n\n if (nonce !== undefined) {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-argument\n extensions = [...extensions, EditorView.cspNonce.of(nonce)];\n }\n\n // ensure we add lineNumber last in the stack to create the right gutter order for linting\n extensions = [...extensions, lineNumbers()];\n\n return extensions;\n }\n );\n\n private _createEditorTask = task(\n { drop: true },\n async (\n element: HTMLElementWithEditor,\n {\n cspNonce,\n language,\n extraKeys,\n value,\n hasLineWrapping,\n isLintingEnabled,\n onLint,\n }: Pick<\n HdsCodeEditorSignature['Args']['Named'],\n | 'cspNonce'\n | 'language'\n | 'extraKeys'\n | 'value'\n | 'hasLineWrapping'\n | 'isLintingEnabled'\n | 'onLint'\n >\n ) => {\n try {\n const { EditorState } = await import('@codemirror/state');\n\n const extensions = await this._buildExtensionsTask.perform({\n cspNonce,\n extraKeys,\n language,\n hasLineWrapping: hasLineWrapping ?? false,\n isLintingEnabled,\n onLint,\n });\n\n const state = EditorState.create({\n doc: value,\n extensions,\n });\n\n const editor = new EditorView({\n state,\n parent: element,\n });\n\n return editor;\n } catch (error) {\n console.error(\n `\\`hds-code-editor\\` modifier - Failed to setup the CodeMirror editor. Error: ${JSON.stringify(error)}`\n );\n }\n }\n );\n\n private _setupEditorMutationObserver() {\n this.mutationObserver = new MutationObserver((mutations) => {\n mutations.forEach((mutation) => {\n mutation.removedNodes.forEach((node) => {\n if (!(node instanceof HTMLElement)) {\n return;\n }\n\n const removedNodeContainsLintPanel =\n node.querySelector('.cm-panel-lint') !== null;\n\n if (removedNodeContainsLintPanel) {\n this.editor.focus();\n }\n });\n });\n });\n\n this.mutationObserver.observe(this.element, {\n childList: true,\n subtree: true,\n });\n }\n\n private _setupTask = task(\n { drop: true },\n async (\n element: HTMLElementWithEditor,\n _positional: PositionalArgs<HdsCodeEditorSignature>,\n named: NamedArgs<HdsCodeEditorSignature>\n ) => {\n const {\n onBlur,\n onInput,\n onLint,\n onSetup,\n ariaDescribedBy,\n ariaLabel,\n ariaLabelledBy,\n cspNonce,\n extraKeys,\n hasLineWrapping,\n isLintingEnabled,\n language,\n value,\n } = named;\n\n this.onInput = onInput;\n this.onBlur = onBlur;\n\n this.element = element;\n this.element.id = isEmpty(this.element.id)\n ? guidFor(this)\n : this.element.id;\n\n const editor = await this._createEditorTask.perform(element, {\n onLint,\n cspNonce,\n hasLineWrapping,\n isLintingEnabled,\n extraKeys,\n language,\n value,\n });\n\n if (editor === undefined) {\n return;\n }\n\n this.editor = editor;\n element.editor = editor;\n\n if (onBlur !== undefined) {\n this._setupEditorBlurHandler(element, onBlur);\n }\n\n let lintingDescriptionElement: HTMLParagraphElement | null = null;\n\n if (\n isLintingEnabled &&\n language !== undefined &&\n LANGUAGES[language]?.loadLinter !== undefined\n ) {\n // insert a new dom element above the editor\n lintingDescriptionElement = this._createLintingDescriptionElement();\n\n this._setupEditorMutationObserver();\n }\n\n this._setupEditorAriaAttributes(editor, {\n ariaDescribedBy,\n ariaLabel,\n ariaLabelledBy,\n lintingDescriptionElement: lintingDescriptionElement ?? undefined,\n });\n\n onSetup?.(this.editor);\n }\n );\n}\n"],"names":["defineStreamLanguage","streamParser","StreamLanguage","define","getCSPNonceFromMeta","meta","document","querySelector","undefined","content","getAttribute","match","LOADER_HEIGHT","LANGUAGES","rego","load","ruby","sentinel","shell","go","hcl","javascript","json","loadLinter","onLint","linter","default","markdown","sql","yaml","HdsCodeEditorModifier","Modifier","g","prototype","service","i","void 0","editor","element","onBlur","onInput","blurHandler","intersectionObserver","mutationObserver","lineWrappingCompartment","Compartment","constructor","owner","args","registerDestructor","disconnect","removeEventListener","modify","positional","named","hasLineWrapping","dispatch","effects","reconfigure","EditorView","lineWrapping","config","environment","_setupTask","perform","IntersectionObserver","entries","forEach","entry","isIntersecting","rootMargin","observe","_setupEditorBlurHandler","inputElement","event","addEventListener","_setupEditorAriaLabel","ariaLabel","ariaLabelledBy","assert","dom","setAttribute","_setupEditorAriaDescribedBy","ariaDescribedBy","lintingDescriptionElement","ariaDescribedByArray","push","id","join","_createLintingDescriptionElement","createElement","classList","add","textContent","hdsIntl","t","insertAdjacentElement","_setupEditorAriaAttributes","_loadLanguageExtensionsTask","_buildTask","context","generator","language","isLintingEnabled","validLanguageKeys","Object","keys","includes","extensionPromises","Promise","all","error","warn","JSON","stringify","drop","_buildExtensionsTask","cspNonce","extraKeys","keymap","lineNumbers","highlightActiveLineGutter","highlightSpecialChars","highlightActiveLine","defaultKeymap","history","historyKeymap","bracketMatching","syntaxHighlighting","languageExtensions","handleUpdateExtension","updateListener","of","update","selectionSet","view","toggle","state","selection","main","empty","docChanged","doc","toString","lineWrappingExtension","extensions","hdsDarkTheme","hdsDarkHighlightStyle","customKeyMap","map","key","value","run","nonce","_createEditorTask","EditorState","create","parent","console","_setupEditorMutationObserver","MutationObserver","mutations","mutation","removedNodes","node","HTMLElement","removedNodeContainsLintPanel","focus","childList","subtree","_positional","onSetup","isEmpty","guidFor"],"mappings":";;;;;;;;;;;;;;;AAuEA,eAAeA,oBAAoBA,CAACC,YAAuC,EAAE;EAC3E,MAAM;AAAEC,IAAAA;AAAe,GAAC,GAAG,MAAM,OAAO,sBAAsB,CAAC;AAE/D,EAAA,OAAOA,cAAc,CAACC,MAAM,CAACF,YAAY,CAAC;AAC5C;AAEO,SAASG,mBAAmBA,GAAuB;AACxD,EAAA,MAAMC,IAAI,GAAGC,QAAQ,CAACC,aAAa,CACjC,4CACF,CAAC;EAED,IAAIF,IAAI,KAAK,IAAI,EAAE;AACjB,IAAA,OAAOG,SAAS;AAClB,EAAA;AAEA,EAAA,MAAMC,OAAO,GAAGJ,IAAI,CAACK,YAAY,CAAC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AAI,CAAC,GACb,IAAI,CAACvI,OAAO,CAACiD,EAAE;MAEnB,MAAMlD,MAAM,SAAS,IAAI,CAACqH,iBAAiB,CAAC1F,OAAO,CAAC1B,OAAO,EAAE;QAC3Dd,MAAM;QACN6F,QAAQ;QACR9D,eAAe;QACfgD,gBAAgB;QAChBe,SAAS;QACThB,QAAQ;AACRiD,QAAAA;AACF,OAAC,CAAC;MAEF,IAAIlH,MAAM,KAAK7B,SAAS,EAAE;AACxB,QAAA;AACF,MAAA;MAEA,IAAI,CAAC6B,MAAM,GAAGA,MAAM;MACpBC,OAAO,CAACD,MAAM,GAAGA,MAAM;MAEvB,IAAIE,MAAM,KAAK/B,SAAS,EAAE;AACxB,QAAA,IAAI,CAACgE,uBAAuB,CAAClC,OAAO,EAAEC,MAAM,CAAC;AAC/C,MAAA;MAEA,IAAI6C,yBAAsD,GAAG,IAAI;AAEjE,MAAA,IACEmB,gBAAgB,IAChBD,QAAQ,KAAK9F,SAAS,IACtBK,SAAS,CAACyF,QAAQ,CAAC,EAAE/E,UAAU,KAAKf,SAAS,EAC7C;AACA;AACA4E,QAAAA,yBAAyB,GAAG,IAAI,CAACK,gCAAgC,EAAE;QAEnE,IAAI,CAACsE,4BAA4B,EAAE;AACrC,MAAA;AAEA,MAAA,IAAI,CAAC9D,0BAA0B,CAAC5D,MAAM,EAAE;QACtC8C,eAAe;QACfN,SAAS;QACTC,cAAc;QACdM,yBAAyB,EAAEA,yBAAyB,IAAI5E;AAC1D,OAAC,CAAC;AAEFmK,MAAAA,OAAO,GAAG,IAAI,CAACtI,MAAM,CAAC;AACxB,IAAA;GAAC,CAAA,EAxED;AAAE8E,IAAAA,IAAI,EAAE;GAAM,EAAA,YAAA,EAAA,IAAA,CAAA;AA0ElB;;;;"}
|
|
1
|
+
{"version":3,"file":"hds-code-editor.js","sources":["../../src/modifiers/hds-code-editor.ts"],"sourcesContent":["/**\n * Copyright (c) HashiCorp, Inc.\n * SPDX-License-Identifier: MPL-2.0\n */\n\nimport Modifier from 'ember-modifier';\nimport { assert, warn } from '@ember/debug';\nimport { registerDestructor } from '@ember/destroyable';\nimport { task } from 'ember-concurrency';\nimport { macroCondition, isTesting } from '@embroider/macros';\nimport { Compartment } from '@codemirror/state';\nimport { EditorView } from '@codemirror/view';\nimport { guidFor } from '@ember/object/internals';\nimport { isEmpty } from '@ember/utils';\nimport { service } from '@ember/service';\n\n// hds-dark theme\nimport hdsDarkTheme from './hds-code-editor/themes/hds-dark-theme.ts';\nimport hdsDarkHighlightStyle from './hds-code-editor/highlight-styles/hds-dark-highlight-style.ts';\n\nimport type HdsIntlService from '../services/hds-intl.ts';\nimport type { HdsCodeEditorLanguages } from './hds-code-editor/types.ts';\nimport type { ArgsFor, PositionalArgs, NamedArgs } from 'ember-modifier';\nimport type {\n StreamLanguage as StreamLanguageType,\n StreamParser as StreamParserType,\n} from '@codemirror/language';\nimport type { Extension } from '@codemirror/state';\nimport type {\n EditorView as EditorViewType,\n KeyBinding,\n ViewUpdate,\n} from '@codemirror/view';\nimport type { Diagnostic as DiagnosticType } from '@codemirror/lint';\nimport type Owner from '@ember/owner';\n\ntype HTMLElementWithEditor = HTMLElement & { editor: EditorViewType };\n\ntype HdsCodeEditorBlurHandler = (\n editor: EditorViewType,\n event: FocusEvent\n) => void;\n\ninterface HdsCodeEditorExtraKeys {\n [key: string]: () => void;\n}\n\nexport interface HdsCodeEditorSignature {\n Args: {\n Named: {\n ariaDescribedBy?: string;\n ariaLabel?: string;\n ariaLabelledBy?: string;\n cspNonce?: string;\n extraKeys?: HdsCodeEditorExtraKeys;\n hasLineWrapping?: boolean;\n isLintingEnabled?: boolean;\n language?: HdsCodeEditorLanguages;\n value?: string;\n onInput?: (newValue: string, editor: EditorViewType) => void;\n onBlur?: HdsCodeEditorBlurHandler;\n onLint?: (\n diagnostics: DiagnosticType[],\n newValue: string,\n editor: EditorViewType\n ) => void;\n onSetup?: (editor: EditorViewType) => unknown;\n };\n };\n}\n\nasync function defineStreamLanguage(streamParser: StreamParserType<unknown>) {\n const { StreamLanguage } = await import('@codemirror/language');\n\n return StreamLanguage.define(streamParser);\n}\n\nexport function getCSPNonceFromMeta(): string | undefined {\n const meta = document.querySelector(\n 'meta[http-equiv=\"Content-Security-Policy\"]'\n );\n\n if (meta === null) {\n return undefined;\n }\n\n const content = meta.getAttribute('content');\n\n if (content === null) {\n return undefined;\n }\n\n // searches for either \"style-src\" or \"script-src\" followed by anything until a token like 'nonce-<value>'\n const match = content.match(/(?:style-src|script-src)[^;]*'nonce-([^']+)'/);\n\n return match ? match[1] : undefined;\n}\n\nconst LOADER_HEIGHT = '164px';\n\nconst LANGUAGES: Record<\n HdsCodeEditorLanguages,\n {\n load: () => Promise<Extension | StreamLanguageType<unknown>>;\n loadLinter?: (\n onLint?: HdsCodeEditorSignature['Args']['Named']['onLint']\n ) => Promise<Extension>;\n }\n> = {\n rego: {\n load: async () => {\n const { rego } = await import('./hds-code-editor/languages/rego.ts');\n return defineStreamLanguage(rego);\n },\n },\n ruby: {\n load: async () => {\n const { ruby } = await import('@codemirror/legacy-modes/mode/ruby');\n return defineStreamLanguage(ruby);\n },\n },\n sentinel: {\n load: async () => {\n const { sentinel } = await import(\n './hds-code-editor/languages/sentinel.ts'\n );\n return defineStreamLanguage(sentinel);\n },\n },\n shell: {\n load: async () => {\n const { shell } = await import('@codemirror/legacy-modes/mode/shell');\n return defineStreamLanguage(shell);\n },\n },\n go: {\n load: async () => (await import('@codemirror/lang-go')).go(),\n },\n hcl: {\n load: async () => (await import('codemirror-lang-hcl')).hcl(),\n },\n javascript: {\n load: async () =>\n (await import('@codemirror/lang-javascript')).javascript(),\n },\n json: {\n load: async () => (await import('@codemirror/lang-json')).json(),\n loadLinter: async (onLint) => {\n const linter = await import('./hds-code-editor/linters/json-linter.ts');\n\n return linter.default(onLint);\n },\n },\n markdown: {\n load: async () => (await import('@codemirror/lang-markdown')).markdown(),\n },\n sql: {\n load: async () => (await import('@codemirror/lang-sql')).sql(),\n },\n yaml: {\n load: async () => (await import('@codemirror/lang-yaml')).yaml(),\n },\n} as const;\n\nexport default class HdsCodeEditorModifier extends Modifier<HdsCodeEditorSignature> {\n @service declare hdsIntl: HdsIntlService;\n\n editor!: EditorViewType;\n element!: HTMLElementWithEditor;\n\n onBlur: HdsCodeEditorSignature['Args']['Named']['onBlur'];\n onInput: HdsCodeEditorSignature['Args']['Named']['onInput'];\n\n blurHandler!: (event: FocusEvent) => void;\n intersectionObserver!: IntersectionObserver;\n mutationObserver!: MutationObserver;\n\n lineWrappingCompartment = new Compartment();\n\n constructor(owner: Owner, args: ArgsFor<HdsCodeEditorSignature>) {\n super(owner, args);\n\n registerDestructor(this, () => {\n this.intersectionObserver?.disconnect();\n this.mutationObserver?.disconnect();\n\n if (this.onBlur !== undefined) {\n this.element.removeEventListener('blur', this.blurHandler);\n }\n });\n }\n\n modify(\n element: HTMLElementWithEditor,\n positional: PositionalArgs<HdsCodeEditorSignature>,\n named: NamedArgs<HdsCodeEditorSignature>\n ): void {\n const { hasLineWrapping = false } = named;\n\n // if the editor already exists, update the line wrapping\n if (this.editor) {\n this.editor.dispatch({\n effects: this.lineWrappingCompartment.reconfigure(\n hasLineWrapping ? EditorView.lineWrapping : []\n ),\n });\n }\n // if the editor does not exist, setup the editor\n else {\n // the intersection observer makes loading unreliable in tests\n if (macroCondition(isTesting())) {\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n this._setupTask.perform(element, positional, named);\n } else {\n this.intersectionObserver = new IntersectionObserver(\n (entries) => {\n entries.forEach((entry) => {\n if (entry.isIntersecting && this.editor === undefined) {\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n this._setupTask.perform(element, positional, named);\n }\n });\n },\n {\n rootMargin: LOADER_HEIGHT,\n }\n );\n\n this.intersectionObserver.observe(element);\n }\n }\n }\n\n private _setupEditorBlurHandler(\n element: HTMLElementWithEditor,\n onBlur: HdsCodeEditorBlurHandler\n ) {\n const inputElement = element.querySelector('.cm-content');\n\n if (inputElement === null) {\n return;\n }\n\n this.blurHandler = (event: FocusEvent) => onBlur(this.editor, event);\n\n (inputElement as HTMLElement).addEventListener('blur', this.blurHandler);\n }\n\n private _setupEditorAriaLabel(\n editor: EditorViewType,\n {\n ariaLabel,\n ariaLabelledBy,\n }: Pick<\n HdsCodeEditorSignature['Args']['Named'],\n 'ariaLabel' | 'ariaLabelledBy'\n >\n ) {\n assert(\n '`hds-code-editor` modifier - Either `ariaLabel` or `ariaLabelledBy` must be provided',\n ariaLabel !== undefined || ariaLabelledBy !== undefined\n );\n\n if (ariaLabel !== undefined) {\n editor.dom\n .querySelector('[role=\"textbox\"]')\n ?.setAttribute('aria-label', ariaLabel);\n } else if (ariaLabelledBy !== undefined) {\n editor.dom\n .querySelector('[role=\"textbox\"]')\n ?.setAttribute('aria-labelledby', ariaLabelledBy);\n }\n }\n\n private _setupEditorAriaDescribedBy(\n editor: EditorViewType,\n {\n ariaDescribedBy,\n lintingDescriptionElement,\n }: {\n ariaDescribedBy?: string;\n lintingDescriptionElement?: HTMLParagraphElement;\n }\n ) {\n if (\n ariaDescribedBy === undefined &&\n lintingDescriptionElement === undefined\n ) {\n return;\n }\n\n const ariaDescribedByArray = [];\n\n if (ariaDescribedBy !== undefined) {\n ariaDescribedByArray.push(ariaDescribedBy);\n }\n\n if (lintingDescriptionElement !== undefined) {\n ariaDescribedByArray.push(lintingDescriptionElement.id);\n }\n\n editor.dom\n .querySelector('[role=\"textbox\"]')\n ?.setAttribute('aria-describedby', ariaDescribedByArray.join(' '));\n }\n\n private _createLintingDescriptionElement(): HTMLParagraphElement {\n const element = document.createElement('p');\n\n element.id = `lint-panel-instructions-${this.element.id}`;\n element.classList.add('sr-only');\n element.textContent = this.hdsIntl.t(\n 'hds.modifiers.hds-code-editor.lint-panel-description',\n {\n default:\n 'Press `Ctrl-Shift-m` (`Cmd-Shift-m` on macOS) while focus is on the textbox to open the linting panel',\n }\n );\n\n this.element.insertAdjacentElement('beforebegin', element);\n\n return element;\n }\n\n private _setupEditorAriaAttributes(\n editor: EditorViewType,\n {\n ariaDescribedBy,\n ariaLabel,\n ariaLabelledBy,\n lintingDescriptionElement,\n }: Pick<\n HdsCodeEditorSignature['Args']['Named'],\n 'ariaDescribedBy' | 'ariaLabel' | 'ariaLabelledBy'\n > & { lintingDescriptionElement?: HTMLParagraphElement }\n ) {\n this._setupEditorAriaLabel(editor, { ariaLabel, ariaLabelledBy });\n this._setupEditorAriaDescribedBy(editor, {\n ariaDescribedBy,\n lintingDescriptionElement,\n });\n }\n\n private _loadLanguageExtensionsTask = task(\n { drop: true },\n async ({\n language,\n isLintingEnabled,\n onLint,\n }: {\n language?: HdsCodeEditorLanguages;\n isLintingEnabled?: boolean;\n onLint?: HdsCodeEditorSignature['Args']['Named']['onLint'];\n }) => {\n if (language === undefined) {\n return;\n }\n\n try {\n const validLanguageKeys = Object.keys(LANGUAGES);\n\n assert(\n `\\`hds-code-editor\\` modifier - \\`language\\` must be one of the following: ${validLanguageKeys.join(\n ', '\n )}; received: ${language}`,\n validLanguageKeys.includes(language)\n );\n\n let extensionPromises = [LANGUAGES[language].load()];\n\n if (isLintingEnabled && LANGUAGES[language].loadLinter) {\n extensionPromises = [\n ...extensionPromises,\n LANGUAGES[language].loadLinter(onLint),\n ];\n }\n\n return Promise.all(extensionPromises);\n } catch (error) {\n warn(\n `\\`hds-code-editor\\` modifier - Failed to dynamically import the CodeMirror language module for '${language}'. Error: ${JSON.stringify(\n error\n )}`,\n {\n id: 'hds-code-editor.load-language-task.import-failed',\n }\n );\n }\n }\n );\n\n private _buildExtensionsTask = task(\n { drop: true },\n async ({\n cspNonce,\n extraKeys,\n language,\n hasLineWrapping,\n isLintingEnabled,\n onLint,\n }) => {\n const [\n {\n keymap,\n lineNumbers,\n highlightActiveLineGutter,\n highlightSpecialChars,\n highlightActiveLine,\n },\n { defaultKeymap, history, historyKeymap },\n { bracketMatching, syntaxHighlighting },\n ] = await Promise.all([\n import('@codemirror/view'),\n import('@codemirror/commands'),\n import('@codemirror/language'),\n ]);\n\n const languageExtensions = await this._loadLanguageExtensionsTask.perform(\n {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n language,\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n isLintingEnabled,\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n onLint,\n }\n );\n\n const handleUpdateExtension = EditorView.updateListener.of(\n (update: ViewUpdate) => {\n // toggle a class if the update has/does not have a selection\n if (update.selectionSet) {\n update.view.dom.classList.toggle(\n 'cm-hasSelection',\n !update.state.selection.main.empty\n );\n }\n\n // call the onInput callback if the document has changed\n if (!update.docChanged || this.onInput === undefined) {\n return;\n }\n this.onInput(update.state.doc.toString(), update.view);\n }\n );\n\n const lineWrappingExtension = this.lineWrappingCompartment.of(\n hasLineWrapping ? EditorView.lineWrapping : []\n );\n\n let extensions = [\n lineWrappingExtension,\n bracketMatching(),\n highlightActiveLine(),\n highlightActiveLineGutter(),\n highlightSpecialChars(),\n history(),\n keymap.of([...defaultKeymap, ...historyKeymap]),\n // custom extensions\n handleUpdateExtension,\n // hds dark theme\n hdsDarkTheme,\n syntaxHighlighting(hdsDarkHighlightStyle),\n ];\n\n if (extraKeys !== undefined) {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-argument\n const customKeyMap = Object.entries(extraKeys).map(([key, value]) => ({\n key: key,\n run: value,\n }));\n\n extensions = [keymap.of(customKeyMap as KeyBinding[]), ...extensions];\n }\n\n if (languageExtensions !== undefined) {\n extensions = [...extensions, ...languageExtensions];\n }\n\n // add nonce to the editor view if it exists\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n const nonce = cspNonce ?? getCSPNonceFromMeta();\n\n if (nonce !== undefined) {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-argument\n extensions = [...extensions, EditorView.cspNonce.of(nonce)];\n }\n\n // ensure we add lineNumber last in the stack to create the right gutter order for linting\n extensions = [...extensions, lineNumbers()];\n\n return extensions;\n }\n );\n\n private _createEditorTask = task(\n { drop: true },\n async (\n element: HTMLElementWithEditor,\n {\n cspNonce,\n language,\n extraKeys,\n value,\n hasLineWrapping,\n isLintingEnabled,\n onLint,\n }: Pick<\n HdsCodeEditorSignature['Args']['Named'],\n | 'cspNonce'\n | 'language'\n | 'extraKeys'\n | 'value'\n | 'hasLineWrapping'\n | 'isLintingEnabled'\n | 'onLint'\n >\n ) => {\n try {\n const { EditorState } = await import('@codemirror/state');\n\n const extensions = await this._buildExtensionsTask.perform({\n cspNonce,\n extraKeys,\n language,\n hasLineWrapping: hasLineWrapping ?? false,\n isLintingEnabled,\n onLint,\n });\n\n const state = EditorState.create({\n doc: value,\n extensions,\n });\n\n const editor = new EditorView({\n state,\n parent: element,\n });\n\n return editor;\n } catch (error) {\n console.error(\n `\\`hds-code-editor\\` modifier - Failed to setup the CodeMirror editor. Error: ${JSON.stringify(error)}`\n );\n }\n }\n );\n\n private _setupEditorMutationObserver() {\n this.mutationObserver = new MutationObserver((mutations) => {\n mutations.forEach((mutation) => {\n mutation.removedNodes.forEach((node) => {\n if (!(node instanceof HTMLElement)) {\n return;\n }\n\n const removedNodeContainsLintPanel =\n node.querySelector('.cm-panel-lint') !== null;\n\n if (removedNodeContainsLintPanel) {\n this.editor.focus();\n }\n });\n });\n });\n\n this.mutationObserver.observe(this.element, {\n childList: true,\n subtree: true,\n });\n }\n\n private _setupTask = task(\n { drop: true },\n async (\n element: HTMLElementWithEditor,\n _positional: PositionalArgs<HdsCodeEditorSignature>,\n named: NamedArgs<HdsCodeEditorSignature>\n ) => {\n const {\n onBlur,\n onInput,\n onLint,\n onSetup,\n ariaDescribedBy,\n ariaLabel,\n ariaLabelledBy,\n cspNonce,\n extraKeys,\n hasLineWrapping,\n isLintingEnabled,\n language,\n value,\n } = named;\n\n this.onInput = onInput;\n this.onBlur = onBlur;\n\n this.element = element;\n this.element.id = isEmpty(this.element.id)\n ? guidFor(this)\n : this.element.id;\n\n const editor = await this._createEditorTask.perform(element, {\n onLint,\n cspNonce,\n hasLineWrapping,\n isLintingEnabled,\n extraKeys,\n language,\n value,\n });\n\n if (editor === undefined) {\n return;\n }\n\n this.editor = editor;\n element.editor = editor;\n\n if (onBlur !== undefined) {\n this._setupEditorBlurHandler(element, onBlur);\n }\n\n let lintingDescriptionElement: HTMLParagraphElement | null = null;\n\n if (\n isLintingEnabled &&\n language !== undefined &&\n LANGUAGES[language]?.loadLinter !== undefined\n ) {\n // insert a new dom element above the editor\n lintingDescriptionElement = this._createLintingDescriptionElement();\n\n this._setupEditorMutationObserver();\n }\n\n this._setupEditorAriaAttributes(editor, {\n ariaDescribedBy,\n ariaLabel,\n ariaLabelledBy,\n lintingDescriptionElement: lintingDescriptionElement ?? undefined,\n });\n\n onSetup?.(this.editor);\n }\n );\n}\n"],"names":["defineStreamLanguage","streamParser","StreamLanguage","define","getCSPNonceFromMeta","meta","document","querySelector","undefined","content","getAttribute","match","LOADER_HEIGHT","LANGUAGES","rego","load","ruby","sentinel","shell","go","hcl","javascript","json","loadLinter","onLint","linter","default","markdown","sql","yaml","HdsCodeEditorModifier","Modifier","g","prototype","service","i","void 0","editor","element","onBlur","onInput","blurHandler","intersectionObserver","mutationObserver","lineWrappingCompartment","Compartment","constructor","owner","args","registerDestructor","disconnect","removeEventListener","modify","positional","named","hasLineWrapping","dispatch","effects","reconfigure","EditorView","lineWrapping","macroCondition","isTesting","_setupTask","perform","IntersectionObserver","entries","forEach","entry","isIntersecting","rootMargin","observe","_setupEditorBlurHandler","inputElement","event","addEventListener","_setupEditorAriaLabel","ariaLabel","ariaLabelledBy","assert","dom","setAttribute","_setupEditorAriaDescribedBy","ariaDescribedBy","lintingDescriptionElement","ariaDescribedByArray","push","id","join","_createLintingDescriptionElement","createElement","classList","add","textContent","hdsIntl","t","insertAdjacentElement","_setupEditorAriaAttributes","_loadLanguageExtensionsTask","_buildTask","context","generator","language","isLintingEnabled","validLanguageKeys","Object","keys","includes","extensionPromises","Promise","all","error","warn","JSON","stringify","drop","_buildExtensionsTask","cspNonce","extraKeys","keymap","lineNumbers","highlightActiveLineGutter","highlightSpecialChars","highlightActiveLine","defaultKeymap","history","historyKeymap","bracketMatching","syntaxHighlighting","languageExtensions","handleUpdateExtension","updateListener","of","update","selectionSet","view","toggle","state","selection","main","empty","docChanged","doc","toString","lineWrappingExtension","extensions","hdsDarkTheme","hdsDarkHighlightStyle","customKeyMap","map","key","value","run","nonce","_createEditorTask","EditorState","create","parent","console","_setupEditorMutationObserver","MutationObserver","mutations","mutation","removedNodes","node","HTMLElement","removedNodeContainsLintPanel","focus","childList","subtree","_positional","onSetup","isEmpty","guidFor"],"mappings":";;;;;;;;;;;;;;;AAuEA,eAAeA,oBAAoBA,CAACC,YAAuC,EAAE;EAC3E,MAAM;AAAEC,IAAAA;AAAe,GAAC,GAAG,MAAM,OAAO,sBAAsB,CAAC;AAE/D,EAAA,OAAOA,cAAc,CAACC,MAAM,CAACF,YAAY,CAAC;AAC5C;AAEO,SAASG,mBAAmBA,GAAuB;AACxD,EAAA,MAAMC,IAAI,GAAGC,QAAQ,CAACC,aAAa,CACjC,4CACF,CAAC;EAED,IAAIF,IAAI,KAAK,IAAI,EAAE;AACjB,IAAA,OAAOG,SAAS;AAClB,EAAA;AAEA,EAAA,MAAMC,OAAO,GAAGJ,IAAI,CAACK,YAAY,CAAC,SAAS,CAAC;EAE5C,IAAID,OAAO,KAAK,IAAI,EAAE;AACpB,IAAA,OAAOD,SAAS;AAClB,EAAA;;AAEA;AACA,EAAA,MAAMG,KAAK,GAAGF,OAAO,CAACE,KAAK,CAAC,8CAA8C,CAAC;AAE3E,EAAA,OAAOA,KAAK,GAAGA,KAAK,CAAC,CAAC,CAAC,GAAGH,SAAS;AACrC;AAEA,MAAMI,aAAa,GAAG,OAAO;AAE7B,MAAMC,SAQL,GAAG;AACFC,EAAAA,IAAI,EAAE;IACJC,IAAI,EAAE,YAAY;MAChB,MAAM;AAAED,QAAAA;AAAK,OAAC,GAAG,MAAM,OAAO,qCAAqC,CAAC;MACpE,OAAOd,oBAAoB,CAACc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,CAACgE,uBAAuB,CAAClC,OAAO,EAAEC,MAAM,CAAC;AAC/C,MAAA;MAEA,IAAI6C,yBAAsD,GAAG,IAAI;AAEjE,MAAA,IACEmB,gBAAgB,IAChBD,QAAQ,KAAK9F,SAAS,IACtBK,SAAS,CAACyF,QAAQ,CAAC,EAAE/E,UAAU,KAAKf,SAAS,EAC7C;AACA;AACA4E,QAAAA,yBAAyB,GAAG,IAAI,CAACK,gCAAgC,EAAE;QAEnE,IAAI,CAACsE,4BAA4B,EAAE;AACrC,MAAA;AAEA,MAAA,IAAI,CAAC9D,0BAA0B,CAAC5D,MAAM,EAAE;QACtC8C,eAAe;QACfN,SAAS;QACTC,cAAc;QACdM,yBAAyB,EAAEA,yBAAyB,IAAI5E;AAC1D,OAAC,CAAC;AAEFmK,MAAAA,OAAO,GAAG,IAAI,CAACtI,MAAM,CAAC;AACxB,IAAA;GAAC,CAAA,EAxED;AAAE8E,IAAAA,IAAI,EAAE;GAAM,EAAA,YAAA,EAAA,IAAA,CAAA;AA0ElB;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hashicorp/design-system-components",
|
|
3
|
-
"version": "5.0.0-rc-
|
|
3
|
+
"version": "5.0.0-rc-20251010191136",
|
|
4
4
|
"description": "Helios Design System Components",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"hashicorp",
|
|
@@ -29,14 +29,14 @@
|
|
|
29
29
|
"@codemirror/lint": "^6.8.4",
|
|
30
30
|
"@codemirror/state": "^6.5.0",
|
|
31
31
|
"@codemirror/view": "^6.36.2",
|
|
32
|
-
"@ember/render-modifiers": "^
|
|
32
|
+
"@ember/render-modifiers": "^3.0.0",
|
|
33
33
|
"@ember/test-waiters": "^3.1.0",
|
|
34
34
|
"@embroider/addon-shim": "^1.10.0",
|
|
35
35
|
"@embroider/macros": "^1.18.1",
|
|
36
36
|
"@embroider/util": "^1.13.4",
|
|
37
37
|
"@floating-ui/dom": "^1.6.12",
|
|
38
38
|
"@hashicorp/design-system-tokens": "^3.0.0",
|
|
39
|
-
"@hashicorp/flight-icons": "4.0.0-rc-
|
|
39
|
+
"@hashicorp/flight-icons": "4.0.0-rc-20251010191136",
|
|
40
40
|
"@lezer/highlight": "^1.2.1",
|
|
41
41
|
"@nullvoxpopuli/ember-composable-helpers": "^5.2.11",
|
|
42
42
|
"clipboard-polyfill": "^4.1.1",
|
|
@@ -46,10 +46,9 @@
|
|
|
46
46
|
"ember-concurrency": "^4.0.4",
|
|
47
47
|
"ember-element-helper": "^0.8.6",
|
|
48
48
|
"ember-focus-trap": "^1.1.1",
|
|
49
|
-
"ember-get-config": "^2.1.1",
|
|
50
49
|
"ember-modifier": "^4.2.2",
|
|
51
50
|
"ember-power-select": "^8.7.1",
|
|
52
|
-
"ember-stargate": "^0.
|
|
51
|
+
"ember-stargate": "^1.0.2",
|
|
53
52
|
"ember-style-modifier": "^4.4.0",
|
|
54
53
|
"ember-truth-helpers": "^4.0.3",
|
|
55
54
|
"luxon": "^3.4.2",
|
|
@@ -105,7 +104,7 @@
|
|
|
105
104
|
},
|
|
106
105
|
"peerDependencies": {
|
|
107
106
|
"@ember/string": "^3.1.1 || ^4.0.0",
|
|
108
|
-
"ember-basic-dropdown": "^7.3.0 || ^8.
|
|
107
|
+
"ember-basic-dropdown": "^7.3.0 || ^8.6.1",
|
|
109
108
|
"ember-engines": ">= 0.11.0",
|
|
110
109
|
"ember-intl": "^7.3.0"
|
|
111
110
|
},
|