@tylertech/forge-core 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (67) hide show
  1. package/LICENSE +202 -0
  2. package/README.md +32 -0
  3. package/esm/a11y/a11y.js +17 -0
  4. package/esm/a11y/index.js +1 -0
  5. package/esm/constants/date-constants.js +52 -0
  6. package/esm/constants/index.js +1 -0
  7. package/esm/custom-elements/component-utils.js +262 -0
  8. package/esm/custom-elements/decorators/custom-element.js +52 -0
  9. package/esm/custom-elements/decorators/foundation-property.js +147 -0
  10. package/esm/custom-elements/decorators/index.js +2 -0
  11. package/esm/custom-elements/index.js +2 -0
  12. package/esm/events/event-aware.js +34 -0
  13. package/esm/events/index.js +1 -0
  14. package/esm/index.js +13 -0
  15. package/esm/message-list/index.js +2 -0
  16. package/esm/message-list/message-list-entry.js +10 -0
  17. package/esm/message-list/message-list.js +112 -0
  18. package/esm/scroll/index.js +2 -0
  19. package/esm/scroll/scroll-axis-observer.js +114 -0
  20. package/esm/scroll/scroll-types.js +14 -0
  21. package/esm/services/index.js +1 -0
  22. package/esm/services/service-adapter.js +12 -0
  23. package/esm/utils/a11y.js +17 -0
  24. package/esm/utils/clipboard.js +38 -0
  25. package/esm/utils/dom-utils.js +780 -0
  26. package/esm/utils/event-utils.js +30 -0
  27. package/esm/utils/http-utils.js +26 -0
  28. package/esm/utils/index.js +11 -0
  29. package/esm/utils/item-manager.js +82 -0
  30. package/esm/utils/object-utils.js +101 -0
  31. package/esm/utils/platform.js +60 -0
  32. package/esm/utils/position-utils.js +59 -0
  33. package/esm/utils/string-utils.js +12 -0
  34. package/esm/utils/utils.js +261 -0
  35. package/package.json +19 -0
  36. package/typings/a11y/a11y.d.ts +5 -0
  37. package/typings/a11y/index.d.ts +1 -0
  38. package/typings/constants/date-constants.d.ts +6 -0
  39. package/typings/constants/index.d.ts +1 -0
  40. package/typings/custom-elements/component-utils.d.ts +125 -0
  41. package/typings/custom-elements/decorators/custom-element.d.ts +21 -0
  42. package/typings/custom-elements/decorators/foundation-property.d.ts +20 -0
  43. package/typings/custom-elements/decorators/index.d.ts +2 -0
  44. package/typings/custom-elements/index.d.ts +13 -0
  45. package/typings/events/event-aware.d.ts +16 -0
  46. package/typings/events/index.d.ts +1 -0
  47. package/typings/index.d.ts +13 -0
  48. package/typings/message-list/index.d.ts +2 -0
  49. package/typings/message-list/message-list-entry.d.ts +9 -0
  50. package/typings/message-list/message-list.d.ts +54 -0
  51. package/typings/scroll/index.d.ts +2 -0
  52. package/typings/scroll/scroll-axis-observer.d.ts +44 -0
  53. package/typings/scroll/scroll-types.d.ts +28 -0
  54. package/typings/services/index.d.ts +1 -0
  55. package/typings/services/service-adapter.d.ts +25 -0
  56. package/typings/utils/a11y.d.ts +2 -0
  57. package/typings/utils/clipboard.d.ts +2 -0
  58. package/typings/utils/dom-utils.d.ts +254 -0
  59. package/typings/utils/event-utils.d.ts +10 -0
  60. package/typings/utils/http-utils.d.ts +5 -0
  61. package/typings/utils/index.d.ts +11 -0
  62. package/typings/utils/item-manager.d.ts +42 -0
  63. package/typings/utils/object-utils.d.ts +43 -0
  64. package/typings/utils/platform.d.ts +26 -0
  65. package/typings/utils/position-utils.d.ts +56 -0
  66. package/typings/utils/string-utils.d.ts +6 -0
  67. package/typings/utils/utils.d.ts +104 -0
@@ -0,0 +1,147 @@
1
+ class FoundationPropertyOptions {
2
+ constructor(options) {
3
+ this.get = true;
4
+ this.set = true;
5
+ if (options) {
6
+ Object.assign(this, options);
7
+ }
8
+ }
9
+ }
10
+ // eslint-disable-next-line @typescript-eslint/explicit-function-return-type
11
+ const foundationPropertyNotFoundMessage = (className, propertyName) => `${className}\'s foundation does not contain the property \"${propertyName}\"`;
12
+ // eslint-disable-next-line @typescript-eslint/explicit-function-return-type
13
+ const foundationNotFoundMessage = (className) => `${className} does not have a foundation`;
14
+ function runIfVerified(target, propertyName, action) {
15
+ if (target._foundation) {
16
+ if (propertyName in target._foundation) {
17
+ return action();
18
+ }
19
+ else {
20
+ throw new Error(foundationPropertyNotFoundMessage(target.localName, propertyName));
21
+ }
22
+ }
23
+ else {
24
+ throw new Error(foundationNotFoundMessage(target.localName));
25
+ }
26
+ }
27
+ export function FoundationProperty(options) {
28
+ const allOptions = new FoundationPropertyOptions(options);
29
+ return (target, name, descriptor) => {
30
+ let defaultGet;
31
+ let defaultSet;
32
+ const propertyName = name;
33
+ const foundationPropertyName = ((options && options.name) || name).toString();
34
+ if (descriptor) {
35
+ defaultGet = descriptor.get;
36
+ defaultSet = descriptor.set;
37
+ descriptor.configurable = true;
38
+ descriptor.enumerable = true;
39
+ if (allOptions.set) {
40
+ descriptor.set = function (value) {
41
+ return wireDescriptorSet(this, foundationPropertyName, attributes => {
42
+ const desc = Object.getOwnPropertyDescriptor(target, foundationPropertyName);
43
+ desc.set = attributes.set;
44
+ Reflect.defineProperty(target, propertyName, desc);
45
+ attributes.set(value);
46
+ }, defaultSet);
47
+ };
48
+ }
49
+ if (allOptions.get) {
50
+ descriptor.get = function () {
51
+ return wireDescriptorGet(this, foundationPropertyName, attributes => {
52
+ const desc = Object.getOwnPropertyDescriptor(target, foundationPropertyName);
53
+ desc.get = attributes.get;
54
+ Reflect.defineProperty(target, propertyName, desc);
55
+ return attributes.get();
56
+ }, defaultGet);
57
+ };
58
+ }
59
+ }
60
+ else {
61
+ if (allOptions.set || allOptions.get) {
62
+ const attributes = { configurable: true, enumerable: true };
63
+ const get = {
64
+ get() {
65
+ const that = this;
66
+ return wireDescriptorGet(that, foundationPropertyName, attrs => {
67
+ let setter;
68
+ // We have to wire the setter here as well
69
+ if (allOptions.set) {
70
+ setter = Object.assign({}, set);
71
+ }
72
+ Reflect.defineProperty(that, foundationPropertyName, Object.assign(Object.assign({ configurable: true, enumerable: true }, attrs), setter));
73
+ return attrs.get();
74
+ });
75
+ }
76
+ };
77
+ const set = {
78
+ set(value) {
79
+ const that = this;
80
+ return wireDescriptorSet(that, foundationPropertyName, attrs => {
81
+ let getter;
82
+ // We have to wire the getter here as well
83
+ if (allOptions.get) {
84
+ getter = Object.assign({}, get);
85
+ }
86
+ Reflect.defineProperty(that, foundationPropertyName, Object.assign(Object.assign({ configurable: true, enumerable: true }, attrs), getter));
87
+ attrs.set(value);
88
+ });
89
+ }
90
+ };
91
+ if (allOptions.get) {
92
+ Object.assign(attributes, Object.assign({}, get));
93
+ }
94
+ if (allOptions.set) {
95
+ Object.assign(attributes, Object.assign({}, set));
96
+ }
97
+ Reflect.defineProperty(target, propertyName, attributes);
98
+ }
99
+ }
100
+ };
101
+ }
102
+ function setFoundation(target, value, propertyName) {
103
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
104
+ target._foundation[propertyName] = value;
105
+ }
106
+ function getFoundation(target, propertyName) {
107
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
108
+ return target._foundation[propertyName];
109
+ }
110
+ function wireDescriptorSet(target, propertyName, wireAction, defaultSet) {
111
+ let attributes;
112
+ if (defaultSet) {
113
+ attributes = {
114
+ set(value) {
115
+ defaultSet.call(target, value);
116
+ setFoundation(target, value, propertyName);
117
+ }
118
+ };
119
+ }
120
+ else {
121
+ attributes = {
122
+ set(value) {
123
+ setFoundation(target, value, propertyName);
124
+ }
125
+ };
126
+ }
127
+ return runIfVerified(target, propertyName, () => wireAction(attributes));
128
+ }
129
+ function wireDescriptorGet(target, propertyName, wireAction, defaultGet) {
130
+ let attributes;
131
+ if (defaultGet) {
132
+ attributes = {
133
+ get() {
134
+ defaultGet.call(target);
135
+ return getFoundation(target, propertyName);
136
+ }
137
+ };
138
+ }
139
+ else {
140
+ attributes = {
141
+ get() {
142
+ return getFoundation(target, propertyName);
143
+ }
144
+ };
145
+ }
146
+ return runIfVerified(target, propertyName, () => wireAction(attributes));
147
+ }
@@ -0,0 +1,2 @@
1
+ export * from './custom-element';
2
+ export * from './foundation-property';
@@ -0,0 +1,2 @@
1
+ export * from './decorators';
2
+ export * from './component-utils';
@@ -0,0 +1,34 @@
1
+ export class EventAware {
2
+ constructor() {
3
+ this._listenerMap = new Map();
4
+ }
5
+ _emit(type, data) {
6
+ const listeners = this._listenerMap.get(type);
7
+ if (listeners && listeners.length) {
8
+ listeners.forEach(cb => cb({ type, data }));
9
+ }
10
+ }
11
+ hasListeners(type) {
12
+ return type ? this._listenerMap.has(type) : this._listenerMap.size > 0;
13
+ }
14
+ addListener(type, listener) {
15
+ if (!this._listenerMap.has(type)) {
16
+ this._listenerMap.set(type, [listener]);
17
+ }
18
+ else {
19
+ const listeners = this._listenerMap.get(type);
20
+ if (listeners) {
21
+ listeners.push(listener);
22
+ }
23
+ }
24
+ }
25
+ removeListener(type, listener) {
26
+ const listeners = this._listenerMap.get(type);
27
+ if (listeners && listeners.length && listeners.includes(listener)) {
28
+ listeners.splice(listeners.indexOf(listener), 1);
29
+ if (!listeners.length) {
30
+ this._listenerMap.delete(type);
31
+ }
32
+ }
33
+ }
34
+ }
@@ -0,0 +1 @@
1
+ export * from './event-aware';
package/esm/index.js ADDED
@@ -0,0 +1,13 @@
1
+ /**
2
+ * @license
3
+ * Copyright (c) 2022 Tyler Technologies, Inc.
4
+ * License: Apache-2.0
5
+ */
6
+ export * from './a11y';
7
+ export * from './constants';
8
+ export * from './custom-elements';
9
+ export * from './events';
10
+ export * from './message-list';
11
+ export * from './scroll';
12
+ export * from './services';
13
+ export * from './utils';
@@ -0,0 +1,2 @@
1
+ export * from './message-list-entry';
2
+ export * from './message-list';
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Represents a single message list entry containing a string message and its identifier.
3
+ */
4
+ export class MessageListEntry {
5
+ constructor(message, identifier) {
6
+ this.message = message;
7
+ this.identifier = identifier;
8
+ this.originalMessage = message;
9
+ }
10
+ }
@@ -0,0 +1,112 @@
1
+ import { MessageListEntry } from './message-list-entry';
2
+ /**
3
+ * Represents a message list of any type. This class can be used to attach a string message to
4
+ * a generic identifier.
5
+ */
6
+ export class MessageList {
7
+ constructor(useAutoEllipsis = true) {
8
+ this._useAutoEllipsis = true;
9
+ this._useAutoEllipsis = useAutoEllipsis;
10
+ this.reset();
11
+ }
12
+ /**
13
+ * True if ellipsis management occurs automatically. Default is true.
14
+ */
15
+ get useAutoEllipsis() {
16
+ return this._useAutoEllipsis;
17
+ }
18
+ set useAutoEllipsis(value) {
19
+ this._useAutoEllipsis = value;
20
+ this._updateMessage();
21
+ }
22
+ /**
23
+ * Adds a message to the entry map.
24
+ * @param {string} message The message string.
25
+ * @param {T} identifier The message identifier.
26
+ * @returns {MessageList<T>} A reference to `this` for chaining.
27
+ */
28
+ add(message, identifier) {
29
+ this._messages.push(new MessageListEntry(message, identifier));
30
+ this._updateMessage();
31
+ return this;
32
+ }
33
+ /**
34
+ * Removes a message using the provided identifier.
35
+ * @param {T} identifier The message identifier.
36
+ * @returns {MessageList<T>} A reference to `this` for chaining.
37
+ */
38
+ remove(identifier) {
39
+ const index = this._getMessageIndex(identifier);
40
+ if (index >= 0) {
41
+ this._messages.splice(index, 1);
42
+ this._updateMessage();
43
+ }
44
+ return this;
45
+ }
46
+ /**
47
+ * Updates an existing message value.
48
+ * @param {string} message The message string.
49
+ * @param {T} identifier The existing message identifier.
50
+ * @returns {MessageList<T>} A reference to `this` for chaining.
51
+ */
52
+ update(message, identifier) {
53
+ const index = this._getMessageIndex(identifier);
54
+ if (index >= 0) {
55
+ this._messages[index].message = message;
56
+ this._updateMessage();
57
+ }
58
+ return this;
59
+ }
60
+ /**
61
+ * Gets the number of messages in the list.
62
+ * @returns {number}
63
+ */
64
+ get messageCount() {
65
+ return this._messages.length;
66
+ }
67
+ /**
68
+ * Resets the message list to it's original state and removes all messages.
69
+ */
70
+ reset() {
71
+ this._messages = [];
72
+ this.message = '';
73
+ }
74
+ /**
75
+ * Determines if a message with the provided identifier exists.
76
+ * @param {T} identifier The message identifier.
77
+ */
78
+ hasMessage(identifier) {
79
+ return this._getMessageIndex(identifier) >= 0;
80
+ }
81
+ _updateMessage() {
82
+ this.message = '';
83
+ this._messages.forEach((item, index) => {
84
+ if (this.useAutoEllipsis) {
85
+ const hasEllipsis = item.message.substr(item.message.length - 3) === '...';
86
+ if (index === this._messages.length - 1) {
87
+ if (!hasEllipsis) {
88
+ item.message += '...';
89
+ }
90
+ }
91
+ else if (hasEllipsis) {
92
+ item.message = item.message.substr(0, item.message.length - 3);
93
+ }
94
+ }
95
+ else {
96
+ item.message = item.originalMessage;
97
+ }
98
+ this.message += item.message + (index < this._messages.length - 1 ? ', ' : '');
99
+ });
100
+ return this;
101
+ }
102
+ _getMessageIndex(identifier) {
103
+ let index = -1;
104
+ for (let i = 0; i < this._messages.length; i++) {
105
+ if (this._messages[i].identifier === identifier) {
106
+ index = i;
107
+ break;
108
+ }
109
+ }
110
+ return index;
111
+ }
112
+ }
@@ -0,0 +1,2 @@
1
+ export * from './scroll-axis-observer';
2
+ export * from './scroll-types';
@@ -0,0 +1,114 @@
1
+ import { EventAware } from '../events/event-aware';
2
+ import { ScrollEvents, ScrollDirection } from './scroll-types';
3
+ import { isDefined, throttle, isNumber } from '../utils';
4
+ const DEFAULT_SCROLL_THROTTLE = 100;
5
+ /**
6
+ * Provides facilties for observing and reacting to scroll events and information on a given element.
7
+ */
8
+ export class ScrollAxisObserver extends EventAware {
9
+ constructor(_element, _config = {}) {
10
+ super();
11
+ this._element = _element;
12
+ this._config = _config;
13
+ this._axis = 'vertical';
14
+ this._scrollThreshold = 0;
15
+ this._lastScrollPosition = 0;
16
+ this._lastScrollTop = 0;
17
+ this._lastScrollLeft = 0;
18
+ this._isListening = false;
19
+ this._initialize();
20
+ }
21
+ destroy() {
22
+ this.stop();
23
+ }
24
+ start() {
25
+ if (!this._isListening) {
26
+ this._element.addEventListener('scroll', this._scrollListener);
27
+ this._isListening = true;
28
+ }
29
+ }
30
+ stop() {
31
+ this._element.removeEventListener('scroll', this._scrollListener);
32
+ this._isListening = false;
33
+ }
34
+ _initialize() {
35
+ if (this._config.throttle) {
36
+ const wait = this._config.throttleTime || DEFAULT_SCROLL_THROTTLE;
37
+ this._scrollListener = throttle(() => this._onScroll(), wait);
38
+ }
39
+ else {
40
+ this._scrollListener = () => this._onScroll();
41
+ }
42
+ if (!isDefined(this._config.paused) || !this._config.paused) {
43
+ this.start();
44
+ }
45
+ if (isDefined(this._config.axis)) {
46
+ this._axis = this._config.axis;
47
+ }
48
+ if (isDefined(this._config.scrollThreshold) && isNumber(this._config.scrollThreshold)) {
49
+ this._scrollThreshold = this._config.scrollThreshold;
50
+ }
51
+ }
52
+ _isScrollAxis() {
53
+ const isVertical = this._lastScrollTop !== this._element.scrollTop;
54
+ const isHorizontal = this._lastScrollLeft !== this._element.scrollLeft;
55
+ return (this._axis === 'vertical' && isVertical) || (this._axis === 'horizontal' && isHorizontal);
56
+ }
57
+ _onScroll() {
58
+ if (!this._isScrollAxis()) {
59
+ return;
60
+ }
61
+ const position = this.scrollPosition;
62
+ const direction = this._lastScrollPosition - position < 0 ? this._axis === 'vertical' ? ScrollDirection.Down : ScrollDirection.Right : this._axis === 'vertical' ? ScrollDirection.Up : ScrollDirection.Left;
63
+ this._emit(ScrollEvents.Scroll, { direction, position });
64
+ if (this._lastScrollPosition <= this._scrollThreshold && position > this._scrollThreshold) {
65
+ this._emit(ScrollEvents.Scrolled, true);
66
+ }
67
+ else if (this._lastScrollPosition >= this._scrollThreshold && (this._scrollThreshold > 0 ? position < this._scrollThreshold : position === 0)) {
68
+ this._emit(ScrollEvents.Scrolled, false);
69
+ }
70
+ const scrollStart = Math.round(position - this._scrollThreshold);
71
+ const scrollEnd = Math.round(this.scrollSize - position);
72
+ if (this._lastScrollPosition >= this._scrollThreshold && scrollStart <= 0) {
73
+ this._emit(ScrollEvents.ScrolledStart);
74
+ }
75
+ else if (this._lastScrollPosition <= (this.scrollSize - this._scrollThreshold) && scrollEnd <= this._scrollThreshold) {
76
+ this._emit(ScrollEvents.ScrolledEnd);
77
+ }
78
+ this._lastScrollPosition = position || 0;
79
+ this._lastScrollTop = this._element.scrollTop || 0;
80
+ this._lastScrollLeft = this._element.scrollLeft || 0;
81
+ }
82
+ get scrollPosition() {
83
+ return this._axis === 'vertical' ? this._element.scrollTop : this._element.scrollLeft;
84
+ }
85
+ get isScrolled() {
86
+ return this.scrollPosition > this._scrollThreshold;
87
+ }
88
+ get isScrolledStart() {
89
+ return this.scrollPosition === 0;
90
+ }
91
+ get isScrolledEnd() {
92
+ return this.scrollPosition === this._element.scrollWidth;
93
+ }
94
+ get isScrollable() {
95
+ if (this._axis === 'vertical') {
96
+ return this._element.scrollHeight > this._element.clientHeight;
97
+ }
98
+ return this._element.scrollWidth > this._element.clientWidth;
99
+ }
100
+ get scrollSize() {
101
+ return (this._axis === 'vertical' ? this._element.scrollHeight : this._element.scrollWidth) - this.elementSize;
102
+ }
103
+ get elementSize() {
104
+ return this._axis === 'vertical' ? this._element.clientHeight : this._element.clientWidth;
105
+ }
106
+ setScrollPosition(position) {
107
+ if (this._axis === 'vertical') {
108
+ this._element.scrollTop = position;
109
+ }
110
+ else {
111
+ this._element.scrollLeft = position;
112
+ }
113
+ }
114
+ }
@@ -0,0 +1,14 @@
1
+ export var ScrollDirection;
2
+ (function (ScrollDirection) {
3
+ ScrollDirection["Up"] = "up";
4
+ ScrollDirection["Down"] = "down";
5
+ ScrollDirection["Left"] = "left";
6
+ ScrollDirection["Right"] = "right";
7
+ })(ScrollDirection || (ScrollDirection = {}));
8
+ export var ScrollEvents;
9
+ (function (ScrollEvents) {
10
+ ScrollEvents["Scroll"] = "scroll";
11
+ ScrollEvents["Scrolled"] = "scrolled";
12
+ ScrollEvents["ScrolledStart"] = "scrolled-start";
13
+ ScrollEvents["ScrolledEnd"] = "scrolled-end";
14
+ })(ScrollEvents || (ScrollEvents = {}));
@@ -0,0 +1 @@
1
+ export * from './service-adapter';
@@ -0,0 +1,12 @@
1
+ export var ServiceRequestMethod;
2
+ (function (ServiceRequestMethod) {
3
+ ServiceRequestMethod["GET"] = "GET";
4
+ ServiceRequestMethod["POST"] = "POST";
5
+ ServiceRequestMethod["PUT"] = "PUT";
6
+ ServiceRequestMethod["DELETE"] = "DELETE";
7
+ ServiceRequestMethod["PATCH"] = "PATCH";
8
+ ServiceRequestMethod["HEAD"] = "HEAD";
9
+ ServiceRequestMethod["CONNECT"] = "CONNECT";
10
+ ServiceRequestMethod["OPTIONS"] = "OPTIONS";
11
+ ServiceRequestMethod["TRACE"] = "TRACE";
12
+ })(ServiceRequestMethod || (ServiceRequestMethod = {}));
@@ -0,0 +1,17 @@
1
+ /** Constructs a visually hidden element and returns the element instance. */
2
+ export function createVisuallyHiddenElement(attr = 'data-forge-live-announcer') {
3
+ const div = document.createElement('div');
4
+ div.style.position = 'absolute';
5
+ div.style.top = '0';
6
+ div.style.height = '1px';
7
+ div.style.width = '1px';
8
+ div.style.padding = '1px';
9
+ div.style.overflow = 'hidden';
10
+ div.style.clip = 'rect(0px, 0px, 0px, 0px)';
11
+ div.style.whiteSpace = 'nowrap';
12
+ div.style.border = '0px';
13
+ if (attr) {
14
+ div.setAttribute(attr, '');
15
+ }
16
+ return div;
17
+ }
@@ -0,0 +1,38 @@
1
+ /** Copy the text value to the clipboard. */
2
+ export function copyToClipboard(text) {
3
+ let textarea = _createTextareaAndSelect(text);
4
+ const copySuccessful = document.execCommand('copy');
5
+ if (textarea) {
6
+ document.body.removeChild(textarea);
7
+ textarea = null;
8
+ }
9
+ return copySuccessful;
10
+ }
11
+ /**
12
+ * Creates a hidden textarea element, sets its value from `text` property,
13
+ * and makes a selection on it.
14
+ */
15
+ function _createTextareaAndSelect(text) {
16
+ var _a;
17
+ const textarea = document.createElement('textarea');
18
+ textarea.style.fontSize = '12pt';
19
+ textarea.style.border = '0';
20
+ textarea.style.clip = 'rect(0 0 0 0)';
21
+ textarea.style.height = '1px';
22
+ textarea.style.margin = '-1px';
23
+ textarea.style.overflow = 'hidden';
24
+ textarea.style.padding = '0';
25
+ textarea.style.position = 'absolute';
26
+ textarea.style.width = '1px';
27
+ textarea.style.outline = '0';
28
+ textarea.style.setProperty('-webkit-appearance', 'none');
29
+ textarea.style.setProperty('-moz-appearance', 'none');
30
+ const yPosition = window.pageYOffset || ((_a = document.documentElement) === null || _a === void 0 ? void 0 : _a.scrollTop);
31
+ textarea.style.top = yPosition + 'px';
32
+ textarea.setAttribute('readonly', '');
33
+ textarea.value = text;
34
+ document.body.appendChild(textarea);
35
+ textarea.select();
36
+ textarea.setSelectionRange(0, textarea.value.length);
37
+ return textarea;
38
+ }