@mustib/web-components 0.0.0-alpha.1 → 0.0.0-alpha.3

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.
@@ -1,8 +1,7 @@
1
- import { _ as __decorate, p as parseJson } from '../mu-element-CZDI_RCY.js';
1
+ import { _ as __decorate, p as parseJson } from '../mu-element-C36Rgp-m.js';
2
+ import { property } from 'lit/decorators.js';
2
3
  import { MuTransparent } from './mu-transparent.js';
3
- import { staticProperty } from '../decorators.js';
4
4
  import 'lit';
5
- import 'lit/decorators.js';
6
5
 
7
6
  /**
8
7
  * `<mu-trigger>` is a helper element that listens for a specified event
@@ -79,14 +78,21 @@ class MuTrigger extends MuTransparent {
79
78
  const { dispatchElement, eventName, shouldDispatch } = this._createDispatchEvent(e);
80
79
  if (!shouldDispatch)
81
80
  return;
82
- dispatchElement.dispatchEvent(new CustomEvent(eventName, { bubbles: !this.noBubble, composed: true, cancelable: !this.noCancelable, detail: this.detail }));
81
+ dispatchElement.dispatchEvent(new CustomEvent(eventName, {
82
+ bubbles: !this.noBubble,
83
+ composed: true,
84
+ cancelable: !this.noCancelable,
85
+ detail: this.detail,
86
+ }));
83
87
  };
84
88
  }
85
89
  /**
86
90
  * The current target of the event.
87
91
  */
88
92
  get _currentTarget() {
89
- const currTarget = this.currentTargetSelector ? this.closestPierce(this.currentTargetSelector) : this;
93
+ const currTarget = this.currentTargetSelector
94
+ ? this.closestPierce(this.currentTargetSelector)
95
+ : this;
90
96
  if (!currTarget) {
91
97
  console.warn(`no element found with selector (${this.currentTargetSelector}) as the current target to listen to (${this.listenTo}) events.\nFalling back to the current element`, this);
92
98
  }
@@ -97,7 +103,9 @@ class MuTrigger extends MuTransparent {
97
103
  * If not provided, the trigger dispatches the event on itself.
98
104
  */
99
105
  _getDispatchElement() {
100
- const element = this.dispatchToSelector ? this.closestPierce(this.dispatchToSelector) : this;
106
+ const element = this.dispatchToSelector
107
+ ? this.closestPierce(this.dispatchToSelector)
108
+ : this;
101
109
  if (!element)
102
110
  console.warn(`no element found with selector ${this.dispatchToSelector} to dispatch ${this.dispatch} to.\nFalling back to the current element`, this);
103
111
  return element || this;
@@ -114,11 +122,11 @@ class MuTrigger extends MuTransparent {
114
122
  * @param e The original event that was fired.
115
123
  * @returns {Object} An object with the properties above.
116
124
  */
117
- _createDispatchEvent(e) {
125
+ _createDispatchEvent(_e) {
118
126
  return {
119
127
  shouldDispatch: true,
120
128
  eventName: this.dispatch,
121
- dispatchElement: this._getDispatchElement()
129
+ dispatchElement: this._getDispatchElement(),
122
130
  };
123
131
  }
124
132
  /**
@@ -126,49 +134,77 @@ class MuTrigger extends MuTransparent {
126
134
  */
127
135
  connectedCallback() {
128
136
  super.connectedCallback();
129
- this._currentTarget.addEventListener(this.listenTo, this._listener, { capture: !this.noCapture });
137
+ this._currentTarget.addEventListener(this.listenTo, this._listener, {
138
+ capture: !this.noCapture,
139
+ });
130
140
  }
131
141
  disconnectedCallback() {
132
142
  super.disconnectedCallback();
133
- this._currentTarget.removeEventListener(this.listenTo, this._listener, { capture: !this.noCapture });
143
+ this._currentTarget.removeEventListener(this.listenTo, this._listener, {
144
+ capture: !this.noCapture,
145
+ });
134
146
  }
135
147
  }
136
148
  __decorate([
137
- staticProperty()
149
+ property({
150
+ attribute: 'listen-to',
151
+ })
138
152
  ], MuTrigger.prototype, "listenTo", void 0);
139
153
  __decorate([
140
- staticProperty({
154
+ property({
141
155
  converter(value) {
142
156
  return value ? parseJson(value) : undefined;
143
157
  },
144
158
  })
145
159
  ], MuTrigger.prototype, "detail", void 0);
146
160
  __decorate([
147
- staticProperty({ converter: Boolean })
161
+ property({
162
+ type: Boolean,
163
+ attribute: 'stop-propagation',
164
+ })
148
165
  ], MuTrigger.prototype, "stopPropagation", void 0);
149
166
  __decorate([
150
- staticProperty({ converter: Boolean })
167
+ property({
168
+ type: Boolean,
169
+ attribute: 'stop-immediate-propagation',
170
+ })
151
171
  ], MuTrigger.prototype, "stopImmediatePropagation", void 0);
152
172
  __decorate([
153
- staticProperty()
173
+ property()
154
174
  ], MuTrigger.prototype, "dispatch", void 0);
155
175
  __decorate([
156
- staticProperty({ converter: Boolean })
176
+ property({
177
+ type: Boolean,
178
+ attribute: 'no-cancelable',
179
+ })
157
180
  ], MuTrigger.prototype, "noCancelable", void 0);
158
181
  __decorate([
159
- staticProperty({ converter: Boolean })
182
+ property({
183
+ type: Boolean,
184
+ attribute: 'no-bubble',
185
+ })
160
186
  ], MuTrigger.prototype, "noBubble", void 0);
161
187
  __decorate([
162
- staticProperty({ converter: Boolean })
188
+ property({
189
+ type: Boolean,
190
+ attribute: 'no-capture',
191
+ })
163
192
  ], MuTrigger.prototype, "noCapture", void 0);
164
193
  __decorate([
165
- staticProperty()
194
+ property({
195
+ attribute: 'current-target-selector',
196
+ })
166
197
  ], MuTrigger.prototype, "currentTargetSelector", void 0);
167
198
  __decorate([
168
- staticProperty({ converter: Boolean })
199
+ property({
200
+ type: Boolean,
201
+ attribute: 'no-prevent-default',
202
+ })
169
203
  ], MuTrigger.prototype, "noPreventDefault", void 0);
170
204
  __decorate([
171
- staticProperty()
205
+ property({
206
+ attribute: 'dispatch-to-selector',
207
+ })
172
208
  ], MuTrigger.prototype, "dispatchToSelector", void 0);
173
209
  MuTrigger.register('mu-trigger');
174
210
 
package/index.d.ts CHANGED
@@ -1,15 +1,48 @@
1
- import './components/mu-transparent.js';
2
- import './components/mu-trigger.js';
3
- import './components/mu-select.js';
4
- import './components/mu-select-item.js';
5
- import './components/mu-select-items.js';
6
- import './components/mu-select-label.js';
7
- import './components/mu-select-label-content.js';
8
- import './components/mu-range.js';
9
- import './components/mu-range-thumb.js';
10
- import './components/mu-icon.js';
11
- import './components/mu-element.js';
1
+ import { MuIconComponent } from './components/mu-icon.js';
2
+ export { MuIcon } from './components/mu-icon.js';
3
+ import { MuRangeComponent } from './components/mu-range.js';
4
+ export { MuRange } from './components/mu-range.js';
5
+ import { MuRangeFillComponent } from './components/mu-range-fill.js';
6
+ export { MuRangeFill } from './components/mu-range-fill.js';
7
+ import { MuRangeThumbComponent } from './components/mu-range-thumb.js';
8
+ export { MuRangeThumb } from './components/mu-range-thumb.js';
9
+ import { MuRangeThumbValueComponent } from './components/mu-range-thumb-value.js';
10
+ export { MuRangeThumbValue } from './components/mu-range-thumb-value.js';
11
+ import { MuSelectComponent } from './components/mu-select.js';
12
+ export { MuSelect } from './components/mu-select.js';
13
+ import { MuSelectItemComponent } from './components/mu-select-item.js';
14
+ export { MuSelectItem } from './components/mu-select-item.js';
15
+ import { MuSelectItemsComponent } from './components/mu-select-items.js';
16
+ export { Events, MuSelectItems } from './components/mu-select-items.js';
17
+ import { MuSelectLabelComponent } from './components/mu-select-label.js';
18
+ export { MuSelectLabel } from './components/mu-select-label.js';
19
+ import { MuSelectLabelContentComponent } from './components/mu-select-label-content.js';
20
+ export { MuSelectLabelContent } from './components/mu-select-label-content.js';
21
+ import { MuTransparentComponent } from './components/mu-transparent.js';
22
+ export { MuTransparent } from './components/mu-transparent.js';
23
+ import { MuTriggerComponent } from './components/mu-trigger.js';
24
+ export { MuTrigger } from './components/mu-trigger.js';
25
+ export { MuElement, MuElementComponent } from './components/mu-element.js';
12
26
  import 'lit';
13
27
  import '@mustib/utils/browser';
14
- import './components/mu-range-fill.js';
15
- import './components/mu-range-thumb-value.js';
28
+
29
+ type ComponentsAttributes = {
30
+ 'mu-select': MuSelectComponent['attributes'];
31
+ 'mu-select-items': MuSelectItemsComponent['attributes'];
32
+ 'mu-select-item': MuSelectItemComponent['attributes'];
33
+ 'mu-select-label': MuSelectLabelComponent['attributes'];
34
+ 'mu-select-label-content': MuSelectLabelContentComponent['attributes'];
35
+ 'mu-range': MuRangeComponent['attributes'];
36
+ 'mu-range-fill': MuRangeFillComponent['attributes'];
37
+ 'mu-range-thumb': MuRangeThumbComponent['attributes'];
38
+ 'mu-range-thumb-value': MuRangeThumbValueComponent['attributes'];
39
+ 'mu-icon': MuIconComponent['attributes'];
40
+ 'mu-transparent': MuTransparentComponent['attributes'];
41
+ 'mu-trigger': MuTriggerComponent['attributes'];
42
+ };
43
+ type MuComponentsAttributes<GlobalAttributes = Record<string, any>> = {
44
+ [key in keyof ComponentsAttributes]: Partial<ComponentsAttributes[key]> & GlobalAttributes;
45
+ };
46
+
47
+ export { MuIconComponent, MuRangeComponent, MuRangeFillComponent, MuRangeThumbComponent, MuRangeThumbValueComponent, MuSelectComponent, MuSelectItemComponent, MuSelectItemsComponent, MuSelectLabelComponent, MuSelectLabelContentComponent, MuTransparentComponent, MuTriggerComponent };
48
+ export type { MuComponentsAttributes };
package/index.js CHANGED
@@ -1,17 +1,16 @@
1
- import './mu-element-CZDI_RCY.js';
2
- import './components/mu-transparent.js';
3
- import './components/mu-trigger.js';
4
- import './components/mu-select.js';
5
- import './components/mu-select-item.js';
6
- import './components/mu-select-items.js';
7
- import './components/mu-select-label.js';
8
- import './components/mu-select-label-content.js';
9
- import './components/mu-range.js';
10
- import './components/mu-range-fill.js';
11
- import './components/mu-range-thumb.js';
12
- import './components/mu-range-thumb-value.js';
13
- import './components/mu-icon.js';
1
+ export { M as MuElement } from './mu-element-C36Rgp-m.js';
2
+ export { MuIcon } from './components/mu-icon.js';
3
+ export { MuRange } from './components/mu-range.js';
4
+ export { MuRangeFill } from './components/mu-range-fill.js';
5
+ export { MuRangeThumb } from './components/mu-range-thumb.js';
6
+ export { MuRangeThumbValue } from './components/mu-range-thumb-value.js';
7
+ export { MuSelect } from './components/mu-select.js';
8
+ export { MuSelectItem } from './components/mu-select-item.js';
9
+ export { MuSelectItems } from './components/mu-select-items.js';
10
+ export { MuSelectLabel } from './components/mu-select-label.js';
11
+ export { MuSelectLabelContent } from './components/mu-select-label-content.js';
12
+ export { MuTransparent } from './components/mu-transparent.js';
13
+ export { MuTrigger } from './components/mu-trigger.js';
14
14
  import 'lit';
15
15
  import 'lit/decorators.js';
16
- import './decorators.js';
17
16
  import 'lit/directives/repeat.js';
@@ -1,6 +1,5 @@
1
1
  import { css, LitElement } from 'lit';
2
2
  import { property } from 'lit/decorators.js';
3
- import { staticProperty } from './decorators.js';
4
3
 
5
4
  /******************************************************************************
6
5
  Copyright (c) Microsoft Corporation.
@@ -894,12 +893,13 @@ class EventAction {
894
893
  };
895
894
  }
896
895
 
897
- var _a, _MUElement_muElements;
896
+ var _a, _MuElement_muElements;
898
897
  let count = 0;
899
- class MUElement extends LitElement {
898
+ class MuElement extends LitElement {
900
899
  static register(tagName) {
901
900
  if (customElements.get(tagName))
902
901
  return;
902
+ // biome-ignore lint/complexity/noThisInStatic: <>
903
903
  customElements.define(tagName, this);
904
904
  }
905
905
  get interactable() {
@@ -919,12 +919,12 @@ class MUElement extends LitElement {
919
919
  value: `mu-element-${++count}`,
920
920
  configurable: false,
921
921
  writable: false,
922
- enumerable: true
922
+ enumerable: true,
923
923
  });
924
924
  }
925
925
  generateIsReadyPromise({ timeout = 1000, onTimeout = () => {
926
926
  console.warn('timeout reached for isReady promise', this);
927
- } } = {}) {
927
+ }, } = {}) {
928
928
  const obj = {
929
929
  status: 'pending',
930
930
  resolved: false,
@@ -950,7 +950,7 @@ class MUElement extends LitElement {
950
950
  return obj;
951
951
  }
952
952
  getMuElementById(id) {
953
- return __classPrivateFieldGet(_a, _a, "f", _MUElement_muElements).get(id);
953
+ return __classPrivateFieldGet(_a, _a, "f", _MuElement_muElements).get(id);
954
954
  }
955
955
  closestPierce(selector) {
956
956
  return _a.closestPierce(selector, this);
@@ -974,9 +974,9 @@ class MUElement extends LitElement {
974
974
  * - `shouldBreak` - An optional function that takes an item and returns a boolean indicating whether to break the loop.
975
975
  */
976
976
  getNavigationItem(data) {
977
- const { direction, switchBack = false, items, fromIndex = direction === 'next' ? -1 : items.length, isNavigable, shouldBreak } = data;
977
+ const { direction, switchBack = false, items, fromIndex = direction === 'next' ? -1 : items.length, isNavigable, shouldBreak, } = data;
978
978
  let navigationItem;
979
- const getItem = ({ endIndex, startIndex }) => {
979
+ const getItem = ({ endIndex, startIndex, }) => {
980
980
  const numOfRetries = endIndex + 1 - startIndex;
981
981
  for (let i = 0; i < numOfRetries && !navigationItem; i++) {
982
982
  const itemIndex = direction === 'next' ? startIndex + i : endIndex - i;
@@ -993,26 +993,26 @@ class MUElement extends LitElement {
993
993
  if (direction === 'next') {
994
994
  getItem({
995
995
  startIndex: fromIndex + 1,
996
- endIndex: items.length - 1
996
+ endIndex: items.length - 1,
997
997
  });
998
998
  }
999
999
  else {
1000
1000
  getItem({
1001
1001
  startIndex: 0,
1002
- endIndex: fromIndex - 1
1002
+ endIndex: fromIndex - 1,
1003
1003
  });
1004
1004
  }
1005
1005
  if (!navigationItem && switchBack) {
1006
1006
  if (direction === 'next') {
1007
1007
  getItem({
1008
1008
  startIndex: 0,
1009
- endIndex: fromIndex - 1
1009
+ endIndex: fromIndex - 1,
1010
1010
  });
1011
1011
  }
1012
1012
  else {
1013
1013
  getItem({
1014
1014
  startIndex: fromIndex + 1,
1015
- endIndex: items.length - 1
1015
+ endIndex: items.length - 1,
1016
1016
  });
1017
1017
  }
1018
1018
  }
@@ -1023,7 +1023,7 @@ class MUElement extends LitElement {
1023
1023
  this.dataset.muId = this.muId;
1024
1024
  if (!this.id)
1025
1025
  this.id = this.muId;
1026
- __classPrivateFieldGet(_a, _a, "f", _MUElement_muElements).set(this.muId, { element: this });
1026
+ __classPrivateFieldGet(_a, _a, "f", _MuElement_muElements).set(this.muId, { element: this });
1027
1027
  this.updateComplete.then(() => {
1028
1028
  this.eventActionData?.eventAction.addListeners(this, this.eventActionEvents || this.eventActionData.events);
1029
1029
  if (!this.noEventActionAttributes)
@@ -1032,20 +1032,20 @@ class MUElement extends LitElement {
1032
1032
  }
1033
1033
  disconnectedCallback() {
1034
1034
  super.disconnectedCallback();
1035
- __classPrivateFieldGet(_a, _a, "f", _MUElement_muElements).delete(this.muId);
1035
+ __classPrivateFieldGet(_a, _a, "f", _MuElement_muElements).delete(this.muId);
1036
1036
  this.eventActionData?.eventAction.removeListeners(this, this.eventActionEvents || this.eventActionData.events);
1037
1037
  }
1038
1038
  }
1039
- _a = MUElement;
1040
- _MUElement_muElements = { value: new Map() };
1041
- MUElement.closestPierce = closestPierce;
1042
- MUElement.css = {
1039
+ _a = MuElement;
1040
+ _MuElement_muElements = { value: new Map() };
1041
+ MuElement.closestPierce = closestPierce;
1042
+ MuElement.css = {
1043
1043
  focus: css `
1044
1044
  --focus-color: oklch(from currentColor l c h / 0.5);
1045
1045
  box-shadow: 0 0 0 var(--focus-width, 2px) var(--mu-focus-color, var(--focus-color)) inset;
1046
- `
1046
+ `,
1047
1047
  };
1048
- MUElement.cssColors = css `
1048
+ MuElement.cssColors = css `
1049
1049
  --mu-color-100: hsl(var(--mu-hue), 20%, 95%);
1050
1050
  --mu-color-200: hsl(var(--mu-hue), 30%, 85%);
1051
1051
  --mu-color-300: hsl(var(--mu-hue), 40%, 75%);
@@ -1056,7 +1056,7 @@ MUElement.cssColors = css `
1056
1056
  --mu-color-800: hsl(var(--mu-hue), 90%, 25%);
1057
1057
  --mu-color-900: hsl(var(--mu-hue), 100%, 15%);
1058
1058
  `;
1059
- MUElement.cssBase = css `
1059
+ MuElement.cssBase = css `
1060
1060
  *, *::before, *::after, :where(:host) {
1061
1061
  margin: 0;
1062
1062
  padding: 0;
@@ -1099,19 +1099,28 @@ MUElement.cssBase = css `
1099
1099
  `;
1100
1100
  __decorate([
1101
1101
  property({ type: Boolean, reflect: true })
1102
- ], MUElement.prototype, "disabled", void 0);
1102
+ ], MuElement.prototype, "disabled", void 0);
1103
1103
  __decorate([
1104
1104
  property({ type: Boolean, reflect: true })
1105
- ], MUElement.prototype, "readonly", void 0);
1105
+ ], MuElement.prototype, "readonly", void 0);
1106
1106
  __decorate([
1107
- staticProperty({
1108
- converter: Boolean
1107
+ property({
1108
+ type: Boolean,
1109
+ attribute: 'no-event-action-attributes',
1109
1110
  })
1110
- ], MUElement.prototype, "noEventActionAttributes", void 0);
1111
+ ], MuElement.prototype, "noEventActionAttributes", void 0);
1111
1112
  __decorate([
1112
- staticProperty({
1113
- converter: parseJson
1113
+ property({
1114
+ converter: {
1115
+ toAttribute(value, _type) {
1116
+ return JSON.stringify(value);
1117
+ },
1118
+ fromAttribute(value, _type) {
1119
+ return value === null ? [] : parseJson(value);
1120
+ },
1121
+ },
1122
+ attribute: 'event-action-events',
1114
1123
  })
1115
- ], MUElement.prototype, "eventActionEvents", void 0);
1124
+ ], MuElement.prototype, "eventActionEvents", void 0);
1116
1125
 
1117
- export { EventAction as E, MUElement as M, __decorate as _, disableElementScroll as a, debounce as d, enableElementScroll as e, getElementBoundaries as g, parseJson as p, throttle as t, wait as w };
1126
+ export { EventAction as E, MuElement as M, __decorate as _, disableElementScroll as a, debounce as d, enableElementScroll as e, getElementBoundaries as g, parseJson as p, throttle as t, wait as w };
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "type": "module",
4
4
  "description": "A customizable web-components library with lit",
5
5
  "private": false,
6
- "version": "0.0.0-alpha.1",
6
+ "version": "0.0.0-alpha.3",
7
7
  "dependencies": {
8
8
  "@mustib/utils": "2.7.0"
9
9
  },
@@ -11,6 +11,7 @@
11
11
  "lit": "^3.3.1"
12
12
  },
13
13
  "devDependencies": {
14
+ "@biomejs/biome": "2.3.5",
14
15
  "@rollup/plugin-multi-entry": "^7.1.0",
15
16
  "@rollup/plugin-node-resolve": "^16.0.3",
16
17
  "@rollup/plugin-typescript": "^12.3.0",
@@ -29,12 +30,6 @@
29
30
  "default": "./index.js"
30
31
  }
31
32
  },
32
- "./decorators": {
33
- "import": {
34
- "types": "./decorators.d.ts",
35
- "default": "./decorators.js"
36
- }
37
- },
38
33
  "./*": {
39
34
  "import": {
40
35
  "types": "./*.d.ts",
package/decorators.d.ts DELETED
@@ -1,34 +0,0 @@
1
- type Options = {
2
- /**
3
- * The HTML attribute to get the value from.
4
- * If not provided, it defaults to the kebab case version of the property name.
5
- * @example If the property name is "propName", the attribute will default to "prop-name".
6
- */
7
- attribute?: string;
8
- /**
9
- * A function that converts the attribute value to the property value.
10
- */
11
- converter?: (value: string | null) => any;
12
- /**
13
- * Whether to reflect the default value of the property to the attribute.
14
- *
15
- * The default value is the value that is assigned to the property on the class definition like so:
16
- * `propName = value` or basically any value that calls the setter before the first call to the getter.
17
- *
18
- * This is useful when you want the attribute to have the same value as the property by default.
19
- *
20
- * For example, if you have a property `visible` with a default value of `true`, and you want the attribute `visible` to have the value `"true"` by default, you can set `reflectDefault` to `true`.
21
- *
22
- * @default false
23
- */
24
- reflectDefault?: boolean;
25
- /**
26
- * A function that converts the default property value to the attribute value.
27
- *
28
- * this is only used if `reflectDefault` is true
29
- */
30
- reflectConverter?: (value: any) => string;
31
- };
32
- declare function staticProperty(options?: Options): <T extends HTMLElement>(target: T, key: string) => void;
33
-
34
- export { staticProperty };
package/decorators.js DELETED
@@ -1,50 +0,0 @@
1
- const defaultConverter = (value) => (value ?? undefined);
2
- const toKebabCase = (str) => str.replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase();
3
- const defaultReflectConverter = (value) => value.toString();
4
- function staticProperty(options) {
5
- return function staticPropertyDecorator(target, key) {
6
- if (!Reflect.has(target, '__staticProperties')) {
7
- Reflect.set(target, '__staticProperties', new WeakMap());
8
- }
9
- const { attribute = toKebabCase(key), converter = defaultConverter, reflectDefault = false, reflectConverter = defaultReflectConverter } = options ?? {};
10
- Reflect.defineProperty(target, key, {
11
- configurable: false,
12
- enumerable: true,
13
- set(v) {
14
- const mapData = getOrCreateMapData(this, key);
15
- if (mapData.hasBeenCalled) {
16
- throw new Error(`cannot set ${v} for a static property ${key} after first call to get`);
17
- }
18
- if (reflectDefault) {
19
- this.setAttribute(attribute, reflectConverter(v));
20
- }
21
- mapData.defaultValue = v;
22
- },
23
- get() {
24
- const mapData = getOrCreateMapData(this, key);
25
- if (mapData.hasBeenCalled)
26
- return mapData.value;
27
- mapData.hasBeenCalled = true;
28
- const attrValue = this.getAttribute(attribute);
29
- if (attrValue === null && mapData.defaultValue !== undefined) {
30
- mapData.value = mapData.defaultValue;
31
- }
32
- else
33
- mapData.value = converter(attrValue);
34
- return mapData.value;
35
- },
36
- });
37
- };
38
- }
39
- function getOrCreateMapData(instance, key) {
40
- let properties = Reflect.get(Reflect.getPrototypeOf(instance), '__staticProperties');
41
- let _mapData = properties.get(instance) || properties.set(instance, {}).get(instance);
42
- const staticData = _mapData[key] ||= {
43
- value: undefined,
44
- hasBeenCalled: false,
45
- defaultValue: undefined
46
- };
47
- return staticData;
48
- }
49
-
50
- export { staticProperty };