@speclynx/apidom-parser-adapter-json 2.10.3 → 2.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,10 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # [2.11.0](https://github.com/speclynx/apidom/compare/v2.10.3...v2.11.0) (2026-02-12)
7
+
8
+ **Note:** Version bump only for package @speclynx/apidom-parser-adapter-json
9
+
6
10
  ## [2.10.3](https://github.com/speclynx/apidom/compare/v2.10.2...v2.10.3) (2026-02-10)
7
11
 
8
12
  **Note:** Version bump only for package @speclynx/apidom-parser-adapter-json
@@ -6761,7 +6761,13 @@ class Element {
6761
6761
 
6762
6762
  /** Unique identifier for this element. */
6763
6763
  get id() {
6764
- return this.getMetaProperty('id', '');
6764
+ if (this.isFrozen) {
6765
+ return this.getMetaProperty('id', '');
6766
+ }
6767
+ if (!this.hasMetaProperty('id')) {
6768
+ this.setMetaProperty('id', '');
6769
+ }
6770
+ return this.meta.get('id');
6765
6771
  }
6766
6772
  set id(value) {
6767
6773
  this.setMetaProperty('id', value);
@@ -6769,7 +6775,13 @@ class Element {
6769
6775
 
6770
6776
  /** CSS-like class names. */
6771
6777
  get classes() {
6772
- return this.getMetaProperty('classes', []);
6778
+ if (this.isFrozen) {
6779
+ return this.getMetaProperty('classes', []);
6780
+ }
6781
+ if (!this.hasMetaProperty('classes')) {
6782
+ this.setMetaProperty('classes', []);
6783
+ }
6784
+ return this.meta.get('classes');
6773
6785
  }
6774
6786
  set classes(value) {
6775
6787
  this.setMetaProperty('classes', value);
@@ -6777,7 +6789,13 @@ class Element {
6777
6789
 
6778
6790
  /** Hyperlinks associated with this element. */
6779
6791
  get links() {
6780
- return this.getMetaProperty('links', []);
6792
+ if (this.isFrozen) {
6793
+ return this.getMetaProperty('links', []);
6794
+ }
6795
+ if (!this.hasMetaProperty('links')) {
6796
+ this.setMetaProperty('links', []);
6797
+ }
6798
+ return this.meta.get('links');
6781
6799
  }
6782
6800
  set links(value) {
6783
6801
  this.setMetaProperty('links', value);
@@ -6928,16 +6946,26 @@ class Element {
6928
6946
  }
6929
6947
 
6930
6948
  /**
6931
- * Gets a meta property, creating it with default value if not present.
6949
+ * Gets a meta property.
6950
+ *
6951
+ * When the property doesn't exist:
6952
+ * - With defaultValue: returns a new refracted element instance (not cached)
6953
+ * - Without defaultValue: returns undefined
6954
+ *
6955
+ * Note: Each call with a default creates a new instance. Use setMetaProperty
6956
+ * first if you need reference equality across multiple accesses.
6932
6957
  */
6958
+
6933
6959
  getMetaProperty(name, defaultValue) {
6934
- if (!this.meta.hasKey(name)) {
6935
- if (this.isFrozen) {
6936
- const element = this.refract(defaultValue);
6960
+ if (!this.hasMetaProperty(name)) {
6961
+ if (defaultValue === undefined) {
6962
+ return undefined;
6963
+ }
6964
+ const element = this.refract(defaultValue);
6965
+ if (element && this.isFrozen) {
6937
6966
  element.freeze();
6938
- return element;
6939
6967
  }
6940
- this.meta.set(name, defaultValue);
6968
+ return element;
6941
6969
  }
6942
6970
  return this.meta.get(name);
6943
6971
  }