@speclynx/apidom-core 2.11.0 → 2.12.1

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.
@@ -28,6 +28,10 @@ __webpack_require__.r(__webpack_exports__);
28
28
  * @public
29
29
  */
30
30
 
31
+ /**
32
+ * @public
33
+ */
34
+
31
35
  /**
32
36
  * Returns the fixed fields for an Element class or instance.
33
37
  *
@@ -634,6 +638,7 @@ const predicates = {
634
638
  isCommentElement: _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_1__.isCommentElement,
635
639
  isParseResultElement: _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_1__.isParseResultElement,
636
640
  isSourceMapElement: _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_1__.isSourceMapElement,
641
+ hasElementStyle: _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_2__.hasElementStyle,
637
642
  hasElementSourceMap: _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_2__.hasElementSourceMap,
638
643
  includesSymbols: _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_2__.includesSymbols,
639
644
  includesClasses: _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_2__.includesClasses
@@ -704,7 +709,19 @@ const resolveSpecification = specification => {
704
709
  if ((0,ramda_adjunct__WEBPACK_IMPORTED_MODULE_5__["default"])(val) && (0,ramda__WEBPACK_IMPORTED_MODULE_0__["default"])('$ref', val) && (0,ramda__WEBPACK_IMPORTED_MODULE_3__["default"])(ramda_adjunct__WEBPACK_IMPORTED_MODULE_4__["default"], '$ref', val)) {
705
710
  const $ref = (0,ramda__WEBPACK_IMPORTED_MODULE_2__["default"])(['$ref'], val);
706
711
  const pointer = (0,ramda_adjunct__WEBPACK_IMPORTED_MODULE_6__["default"])('#/', $ref);
707
- return (0,ramda__WEBPACK_IMPORTED_MODULE_2__["default"])(pointer.split('/'), root);
712
+ const resolved = (0,ramda__WEBPACK_IMPORTED_MODULE_2__["default"])(pointer.split('/'), root);
713
+ // merge extra properties (e.g. alias) from the $ref object into the resolved value
714
+ const {
715
+ $ref: _,
716
+ ...rest
717
+ } = val;
718
+ if (Object.keys(rest).length > 0 && (0,ramda_adjunct__WEBPACK_IMPORTED_MODULE_5__["default"])(resolved)) {
719
+ return {
720
+ ...resolved,
721
+ ...rest
722
+ };
723
+ }
724
+ return resolved;
708
725
  }
709
726
  if ((0,ramda_adjunct__WEBPACK_IMPORTED_MODULE_5__["default"])(val)) {
710
727
  return traverse(val, root, newPath);
@@ -938,13 +955,78 @@ __webpack_require__.r(__webpack_exports__);
938
955
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
939
956
  /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
940
957
  /* harmony export */ });
941
- /* harmony import */ var _value_ts__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(1811);
958
+ /* harmony import */ var _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(5162);
959
+ /* harmony import */ var _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(6911);
960
+ /* harmony import */ var _value_ts__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(1811);
942
961
 
943
962
 
963
+ const getStyle = element => {
964
+ return element.style?.json ?? {};
965
+ };
966
+
944
967
  /**
945
968
  * @public
946
969
  */
947
- const serializer = (element, replacer, space) => JSON.stringify((0,_value_ts__WEBPACK_IMPORTED_MODULE_0__["default"])(element), replacer, space);
970
+
971
+ /**
972
+ * Builds a POJO from an ApiDOM element tree. Numbers with rawContent
973
+ * are replaced with sentinel strings; all other values go through toValue().
974
+ */
975
+ const toPojo = (element, sentinels) => {
976
+ const visited = new WeakSet();
977
+ const convert = node => {
978
+ if (!(0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_0__.isElement)(node)) return node;
979
+ if (visited.has(node)) return null;
980
+ visited.add(node);
981
+ if ((0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_0__.isObjectElement)(node)) {
982
+ const obj = {};
983
+ node.forEach((value, key) => {
984
+ const k = (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_0__.isElement)(key) ? (0,_value_ts__WEBPACK_IMPORTED_MODULE_2__["default"])(key) : key;
985
+ if (typeof k === 'string') obj[k] = convert(value);
986
+ });
987
+ return obj;
988
+ }
989
+ if ((0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_0__.isArrayElement)(node)) {
990
+ const arr = [];
991
+ node.forEach(item => arr.push(convert(item)));
992
+ return arr;
993
+ }
994
+ if ((0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_1__.isRefElement)(node)) return String((0,_value_ts__WEBPACK_IMPORTED_MODULE_2__["default"])(node));
995
+ if ((0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_1__.isLinkElement)(node)) return (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_0__.isStringElement)(node.href) ? (0,_value_ts__WEBPACK_IMPORTED_MODULE_2__["default"])(node.href) : '';
996
+
997
+ // number with rawContent — substitute with sentinel
998
+ if ((0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_0__.isNumberElement)(node)) {
999
+ const style = getStyle(node);
1000
+ if (typeof style.rawContent === 'string') {
1001
+ const sentinel = `\0RAW${sentinels.size}\0`;
1002
+ sentinels.set(sentinel, style.rawContent);
1003
+ return sentinel;
1004
+ }
1005
+ }
1006
+ return (0,_value_ts__WEBPACK_IMPORTED_MODULE_2__["default"])(node);
1007
+ };
1008
+ return convert(element);
1009
+ };
1010
+
1011
+ /**
1012
+ * @public
1013
+ */
1014
+ const serializer = (element, replacer, space, options) => {
1015
+ if (options?.preserveStyle) {
1016
+ const style = getStyle(element);
1017
+ const indent = typeof space === 'number' ? space : typeof style.indent === 'number' ? style.indent : 0;
1018
+ const sentinels = new Map();
1019
+ const pojo = toPojo(element, sentinels);
1020
+ let serialized = JSON.stringify(pojo, null, indent);
1021
+
1022
+ // replace quoted sentinels with raw number representations
1023
+ for (const [sentinel, raw] of sentinels) {
1024
+ serialized = serialized.replace(JSON.stringify(sentinel), raw);
1025
+ }
1026
+ return serialized;
1027
+ }
1028
+ return JSON.stringify((0,_value_ts__WEBPACK_IMPORTED_MODULE_2__["default"])(element), replacer, space);
1029
+ };
948
1030
  /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (serializer);
949
1031
 
950
1032
  /***/ },
@@ -1016,19 +1098,115 @@ __webpack_require__.r(__webpack_exports__);
1016
1098
  /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
1017
1099
  /* harmony export */ });
1018
1100
  /* harmony import */ var yaml__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(3291);
1019
- /* harmony import */ var _value_ts__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(1811);
1101
+ /* harmony import */ var _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(5162);
1102
+ /* harmony import */ var _speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(6911);
1103
+ /* harmony import */ var _value_ts__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(1811);
1020
1104
 
1021
1105
 
1022
1106
 
1107
+ const getStyle = element => {
1108
+ return element.style?.yaml ?? {};
1109
+ };
1110
+
1111
+ // map our scalarStyle strings to YAML library Scalar.Type constants
1112
+ const scalarStyleMap = {
1113
+ Plain: yaml__WEBPACK_IMPORTED_MODULE_0__.Scalar.PLAIN,
1114
+ SingleQuoted: yaml__WEBPACK_IMPORTED_MODULE_0__.Scalar.QUOTE_SINGLE,
1115
+ DoubleQuoted: yaml__WEBPACK_IMPORTED_MODULE_0__.Scalar.QUOTE_DOUBLE,
1116
+ Literal: yaml__WEBPACK_IMPORTED_MODULE_0__.Scalar.BLOCK_LITERAL,
1117
+ Folded: yaml__WEBPACK_IMPORTED_MODULE_0__.Scalar.BLOCK_FOLDED
1118
+ };
1119
+
1120
+ // the YAML library prefixes comments with '#' only (no space), so we add ' ' to get '# comment'
1121
+ const applyComments = (node, style) => {
1122
+ if (style.comment) node.comment = ` ${style.comment}`;
1123
+ if (style.commentBefore) node.commentBefore = ` ${style.commentBefore}`;
1124
+ };
1125
+
1023
1126
  /**
1024
1127
  * @public
1025
1128
  */
1026
1129
 
1130
+ /**
1131
+ * Converts an ApiDOM element tree to YAML library AST nodes,
1132
+ * preserving style information from `element.style.yaml`.
1133
+ */
1134
+ const toYAMLNode = (element, visited) => {
1135
+ if (!(0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_1__.isElement)(element)) return element;
1136
+
1137
+ // cycle detection
1138
+ if (visited.has(element)) return undefined;
1139
+ visited.add(element);
1140
+ const style = getStyle(element);
1141
+ if ((0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_1__.isObjectElement)(element)) {
1142
+ const map = new yaml__WEBPACK_IMPORTED_MODULE_0__.YAMLMap();
1143
+ map.flow = style.styleGroup === 'Flow';
1144
+ applyComments(map, style);
1145
+ element.forEach((value, key, member) => {
1146
+ const memberStyle = (0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_1__.isMemberElement)(member) ? getStyle(member) : {};
1147
+ const keyNode = toYAMLNode(key, visited);
1148
+ const valueNode = toYAMLNode(value, visited);
1149
+ const pair = new yaml__WEBPACK_IMPORTED_MODULE_0__.Pair(keyNode, valueNode);
1150
+ if (memberStyle.commentBefore && (0,yaml__WEBPACK_IMPORTED_MODULE_0__.isNode)(keyNode)) {
1151
+ keyNode.commentBefore = ` ${memberStyle.commentBefore}`;
1152
+ }
1153
+ if (memberStyle.comment && (0,yaml__WEBPACK_IMPORTED_MODULE_0__.isNode)(valueNode)) {
1154
+ valueNode.comment = ` ${memberStyle.comment}`;
1155
+ }
1156
+ map.items.push(pair);
1157
+ });
1158
+ return map;
1159
+ }
1160
+ if ((0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_1__.isArrayElement)(element)) {
1161
+ const seq = new yaml__WEBPACK_IMPORTED_MODULE_0__.YAMLSeq();
1162
+ seq.flow = style.styleGroup === 'Flow';
1163
+ applyComments(seq, style);
1164
+ element.forEach(item => {
1165
+ seq.items.push(toYAMLNode(item, visited));
1166
+ });
1167
+ return seq;
1168
+ }
1169
+ if ((0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_2__.isRefElement)(element)) {
1170
+ return new yaml__WEBPACK_IMPORTED_MODULE_0__.Scalar(String((0,_value_ts__WEBPACK_IMPORTED_MODULE_3__["default"])(element)));
1171
+ }
1172
+ if ((0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_2__.isLinkElement)(element)) {
1173
+ return new yaml__WEBPACK_IMPORTED_MODULE_0__.Scalar((0,_speclynx_apidom_datamodel__WEBPACK_IMPORTED_MODULE_1__.isStringElement)(element.href) ? (0,_value_ts__WEBPACK_IMPORTED_MODULE_3__["default"])(element.href) : '');
1174
+ }
1175
+
1176
+ // scalar element (string, number, boolean, null)
1177
+ const scalarType = style.scalarStyle ? scalarStyleMap[style.scalarStyle] : undefined;
1178
+ const scalar = new yaml__WEBPACK_IMPORTED_MODULE_0__.Scalar((0,_value_ts__WEBPACK_IMPORTED_MODULE_3__["default"])(element));
1179
+ if (scalarType) {
1180
+ scalar.type = scalarType;
1181
+ }
1182
+
1183
+ // use rawContent to infer YAML library format hints for plain scalars that resolved to numbers;
1184
+ // only applies to Plain style — quoted scalars are always strings in YAML.
1185
+ // note: the YAML library may normalize the representation (e.g. 1.0e10 -> 1e+10, 0x1A -> 0x1a)
1186
+ // while preserving the format category (exponential, hex, octal, fractional digits)
1187
+ if (style.rawContent && style.scalarStyle === 'Plain' && typeof scalar.value === 'number') {
1188
+ if (/[eE]/.test(style.rawContent)) {
1189
+ scalar.format = 'EXP';
1190
+ } else if (/^0x/i.test(style.rawContent)) {
1191
+ scalar.format = 'HEX';
1192
+ } else if (/^0o/i.test(style.rawContent)) {
1193
+ scalar.format = 'OCT';
1194
+ }
1195
+ const dotMatch = style.rawContent.match(/\.(\d+)/);
1196
+ if (dotMatch) {
1197
+ scalar.minFractionDigits = dotMatch[1].length;
1198
+ }
1199
+ }
1200
+ applyComments(scalar, style);
1201
+ return scalar;
1202
+ };
1203
+
1027
1204
  /**
1028
1205
  * @public
1029
1206
  */
1030
1207
  const serializer = (element, {
1031
1208
  directive = false,
1209
+ preserveStyle = false,
1032
1210
  aliasDuplicateObjects = false,
1033
1211
  ...options
1034
1212
  } = {}) => {
@@ -1036,12 +1214,28 @@ const serializer = (element, {
1036
1214
  aliasDuplicateObjects,
1037
1215
  ...options
1038
1216
  };
1217
+ if (preserveStyle) {
1218
+ const style = getStyle(element);
1219
+ if (options.indent === undefined && typeof style.indent === 'number') {
1220
+ allOptions.indent = style.indent;
1221
+ }
1222
+ if (typeof style.flowCollectionPadding === 'boolean') {
1223
+ allOptions.flowCollectionPadding = style.flowCollectionPadding;
1224
+ }
1225
+ const rootNode = toYAMLNode(element, new WeakSet());
1226
+ const doc = new yaml__WEBPACK_IMPORTED_MODULE_0__.Document(undefined, allOptions);
1227
+ doc.contents = rootNode;
1228
+ if (directive) {
1229
+ doc.directives.yaml.explicit = true;
1230
+ }
1231
+ return doc.toString(allOptions);
1232
+ }
1039
1233
  if (directive) {
1040
- const doc = new yaml__WEBPACK_IMPORTED_MODULE_0__.Document((0,_value_ts__WEBPACK_IMPORTED_MODULE_1__["default"])(element), allOptions);
1234
+ const doc = new yaml__WEBPACK_IMPORTED_MODULE_0__.Document((0,_value_ts__WEBPACK_IMPORTED_MODULE_3__["default"])(element), allOptions);
1041
1235
  doc.directives.yaml.explicit = true;
1042
1236
  return doc.toString(allOptions);
1043
1237
  }
1044
- return (0,yaml__WEBPACK_IMPORTED_MODULE_0__.stringify)((0,_value_ts__WEBPACK_IMPORTED_MODULE_1__["default"])(element), allOptions);
1238
+ return (0,yaml__WEBPACK_IMPORTED_MODULE_0__.stringify)((0,_value_ts__WEBPACK_IMPORTED_MODULE_3__["default"])(element), allOptions);
1045
1239
  };
1046
1240
  /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (serializer);
1047
1241
 
@@ -11809,6 +12003,52 @@ var both = /*#__PURE__*/(0,_internal_curry2_js__WEBPACK_IMPORTED_MODULE_0__["def
11809
12003
 
11810
12004
  /***/ },
11811
12005
 
12006
+ /***/ 8138
12007
+ (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
12008
+
12009
+ __webpack_require__.r(__webpack_exports__);
12010
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
12011
+ /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
12012
+ /* harmony export */ });
12013
+ /* harmony import */ var _internal_clone_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(8575);
12014
+ /* harmony import */ var _internal_curry1_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(8938);
12015
+
12016
+
12017
+
12018
+ /**
12019
+ * Creates a deep copy of the source that can be used in place of the source
12020
+ * object without retaining any references to it.
12021
+ * The source object may contain (nested) `Array`s and `Object`s,
12022
+ * `Number`s, `String`s, `Boolean`s and `Date`s.
12023
+ * `Function`s are assigned by reference rather than copied.
12024
+ *
12025
+ * Dispatches to a `clone` method if present.
12026
+ *
12027
+ * Note that if the source object has multiple nodes that share a reference,
12028
+ * the returned object will have the same structure, but the references will
12029
+ * be pointed to the location within the cloned value.
12030
+ *
12031
+ * @func
12032
+ * @memberOf R
12033
+ * @since v0.1.0
12034
+ * @category Object
12035
+ * @sig {*} -> {*}
12036
+ * @param {*} value The object or array to clone
12037
+ * @return {*} A deeply cloned copy of `val`
12038
+ * @example
12039
+ *
12040
+ * const objects = [{}, {}, {}];
12041
+ * const objectsClone = R.clone(objects);
12042
+ * objects === objectsClone; //=> false
12043
+ * objects[0] === objectsClone[0]; //=> false
12044
+ */
12045
+ var clone = /*#__PURE__*/(0,_internal_curry1_js__WEBPACK_IMPORTED_MODULE_1__["default"])(function clone(value) {
12046
+ return value != null && typeof value.clone === 'function' ? value.clone() : (0,_internal_clone_js__WEBPACK_IMPORTED_MODULE_0__["default"])(value, true);
12047
+ });
12048
+ /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (clone);
12049
+
12050
+ /***/ },
12051
+
11812
12052
  /***/ 1323
11813
12053
  (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
11814
12054
 
@@ -12719,6 +12959,144 @@ function _checkForMethod(methodname, fn) {
12719
12959
 
12720
12960
  /***/ },
12721
12961
 
12962
+ /***/ 8575
12963
+ (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
12964
+
12965
+ __webpack_require__.r(__webpack_exports__);
12966
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
12967
+ /* harmony export */ "default": () => (/* binding */ _clone)
12968
+ /* harmony export */ });
12969
+ /* harmony import */ var _cloneRegExp_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(1254);
12970
+ /* harmony import */ var _type_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(963);
12971
+
12972
+
12973
+
12974
+ /**
12975
+ * Copies an object.
12976
+ *
12977
+ * @private
12978
+ * @param {*} value The value to be copied
12979
+ * @param {Boolean} deep Whether or not to perform deep cloning.
12980
+ * @return {*} The copied value.
12981
+ */
12982
+ function _clone(value, deep, map) {
12983
+ map || (map = new _ObjectMap());
12984
+
12985
+ // this avoids the slower switch with a quick if decision removing some milliseconds in each run.
12986
+ if (_isPrimitive(value)) {
12987
+ return value;
12988
+ }
12989
+ var copy = function copy(copiedValue) {
12990
+ // Check for circular and same references on the object graph and return its corresponding clone.
12991
+ var cachedCopy = map.get(value);
12992
+ if (cachedCopy) {
12993
+ return cachedCopy;
12994
+ }
12995
+ map.set(value, copiedValue);
12996
+ for (var key in value) {
12997
+ if (Object.prototype.hasOwnProperty.call(value, key)) {
12998
+ copiedValue[key] = deep ? _clone(value[key], true, map) : value[key];
12999
+ }
13000
+ }
13001
+ return copiedValue;
13002
+ };
13003
+ switch ((0,_type_js__WEBPACK_IMPORTED_MODULE_1__["default"])(value)) {
13004
+ case 'Object':
13005
+ return copy(Object.create(Object.getPrototypeOf(value)));
13006
+ case 'Array':
13007
+ return copy(Array(value.length));
13008
+ case 'Date':
13009
+ return new Date(value.valueOf());
13010
+ case 'RegExp':
13011
+ return (0,_cloneRegExp_js__WEBPACK_IMPORTED_MODULE_0__["default"])(value);
13012
+ case 'Int8Array':
13013
+ case 'Uint8Array':
13014
+ case 'Uint8ClampedArray':
13015
+ case 'Int16Array':
13016
+ case 'Uint16Array':
13017
+ case 'Int32Array':
13018
+ case 'Uint32Array':
13019
+ case 'Float32Array':
13020
+ case 'Float64Array':
13021
+ case 'BigInt64Array':
13022
+ case 'BigUint64Array':
13023
+ return value.slice();
13024
+ default:
13025
+ return value;
13026
+ }
13027
+ }
13028
+ function _isPrimitive(param) {
13029
+ var type = typeof param;
13030
+ return param == null || type != 'object' && type != 'function';
13031
+ }
13032
+ var _ObjectMap = /*#__PURE__*/function () {
13033
+ function _ObjectMap() {
13034
+ this.map = {};
13035
+ this.length = 0;
13036
+ }
13037
+ _ObjectMap.prototype.set = function (key, value) {
13038
+ var hashedKey = this.hash(key);
13039
+ var bucket = this.map[hashedKey];
13040
+ if (!bucket) {
13041
+ this.map[hashedKey] = bucket = [];
13042
+ }
13043
+ bucket.push([key, value]);
13044
+ this.length += 1;
13045
+ };
13046
+ _ObjectMap.prototype.hash = function (key) {
13047
+ var hashedKey = [];
13048
+ for (var value in key) {
13049
+ hashedKey.push(Object.prototype.toString.call(key[value]));
13050
+ }
13051
+ return hashedKey.join();
13052
+ };
13053
+ _ObjectMap.prototype.get = function (key) {
13054
+ /**
13055
+ * depending on the number of objects to be cloned is faster to just iterate over the items in the map just because the hash function is so costly,
13056
+ * on my tests this number is 180, anything above that using the hash function is faster.
13057
+ */
13058
+ if (this.length <= 180) {
13059
+ for (var p in this.map) {
13060
+ var bucket = this.map[p];
13061
+ for (var i = 0; i < bucket.length; i += 1) {
13062
+ var element = bucket[i];
13063
+ if (element[0] === key) {
13064
+ return element[1];
13065
+ }
13066
+ }
13067
+ }
13068
+ return;
13069
+ }
13070
+ var hashedKey = this.hash(key);
13071
+ var bucket = this.map[hashedKey];
13072
+ if (!bucket) {
13073
+ return;
13074
+ }
13075
+ for (var i = 0; i < bucket.length; i += 1) {
13076
+ var element = bucket[i];
13077
+ if (element[0] === key) {
13078
+ return element[1];
13079
+ }
13080
+ }
13081
+ };
13082
+ return _ObjectMap;
13083
+ }();
13084
+
13085
+ /***/ },
13086
+
13087
+ /***/ 1254
13088
+ (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
13089
+
13090
+ __webpack_require__.r(__webpack_exports__);
13091
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
13092
+ /* harmony export */ "default": () => (/* binding */ _cloneRegExp)
13093
+ /* harmony export */ });
13094
+ function _cloneRegExp(pattern) {
13095
+ return new RegExp(pattern.source, pattern.flags ? pattern.flags : (pattern.global ? 'g' : '') + (pattern.ignoreCase ? 'i' : '') + (pattern.multiline ? 'm' : '') + (pattern.sticky ? 'y' : '') + (pattern.unicode ? 'u' : '') + (pattern.dotAll ? 's' : ''));
13096
+ }
13097
+
13098
+ /***/ },
13099
+
12722
13100
  /***/ 7940
12723
13101
  (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
12724
13102
 
@@ -24908,20 +25286,22 @@ class ShallowCloneError extends _CloneError_mjs__WEBPACK_IMPORTED_MODULE_0__["de
24908
25286
 
24909
25287
  __webpack_require__.r(__webpack_exports__);
24910
25288
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
24911
- /* harmony export */ CloneError: () => (/* reexport safe */ _errors_CloneError_mjs__WEBPACK_IMPORTED_MODULE_7__["default"]),
24912
- /* harmony export */ DeepCloneError: () => (/* reexport safe */ _errors_DeepCloneError_mjs__WEBPACK_IMPORTED_MODULE_5__["default"]),
24913
- /* harmony export */ ShallowCloneError: () => (/* reexport safe */ _errors_ShallowCloneError_mjs__WEBPACK_IMPORTED_MODULE_6__["default"]),
25289
+ /* harmony export */ CloneError: () => (/* reexport safe */ _errors_CloneError_mjs__WEBPACK_IMPORTED_MODULE_8__["default"]),
25290
+ /* harmony export */ DeepCloneError: () => (/* reexport safe */ _errors_DeepCloneError_mjs__WEBPACK_IMPORTED_MODULE_6__["default"]),
25291
+ /* harmony export */ ShallowCloneError: () => (/* reexport safe */ _errors_ShallowCloneError_mjs__WEBPACK_IMPORTED_MODULE_7__["default"]),
24914
25292
  /* harmony export */ cloneDeep: () => (/* binding */ cloneDeep),
24915
25293
  /* harmony export */ cloneShallow: () => (/* binding */ cloneShallow)
24916
25294
  /* harmony export */ });
24917
- /* harmony import */ var _ObjectSlice_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(8504);
24918
- /* harmony import */ var _KeyValuePair_mjs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(6663);
24919
- /* harmony import */ var _predicates_index_mjs__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(8252);
24920
- /* harmony import */ var _predicates_index_mjs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(5162);
24921
- /* harmony import */ var _elements_SourceMap_mjs__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(5810);
24922
- /* harmony import */ var _errors_DeepCloneError_mjs__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(5018);
24923
- /* harmony import */ var _errors_ShallowCloneError_mjs__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(3686);
24924
- /* harmony import */ var _errors_CloneError_mjs__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(3772);
25295
+ /* harmony import */ var ramda__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(8138);
25296
+ /* harmony import */ var _ObjectSlice_mjs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(8504);
25297
+ /* harmony import */ var _KeyValuePair_mjs__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(6663);
25298
+ /* harmony import */ var _predicates_index_mjs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(8252);
25299
+ /* harmony import */ var _predicates_index_mjs__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(5162);
25300
+ /* harmony import */ var _elements_SourceMap_mjs__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(5810);
25301
+ /* harmony import */ var _errors_DeepCloneError_mjs__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(5018);
25302
+ /* harmony import */ var _errors_ShallowCloneError_mjs__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(3686);
25303
+ /* harmony import */ var _errors_CloneError_mjs__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(3772);
25304
+
24925
25305
 
24926
25306
 
24927
25307
 
@@ -24954,9 +25334,9 @@ const cloneDeepElement = (element, options) => {
24954
25334
  } = element;
24955
25335
  if (Array.isArray(content)) {
24956
25336
  copy.content = content.map(el => cloneDeepElement(el, passThroughOptions));
24957
- } else if ((0,_predicates_index_mjs__WEBPACK_IMPORTED_MODULE_3__.isElement)(content)) {
25337
+ } else if ((0,_predicates_index_mjs__WEBPACK_IMPORTED_MODULE_4__.isElement)(content)) {
24958
25338
  copy.content = cloneDeepElement(content, passThroughOptions);
24959
- } else if (content instanceof _KeyValuePair_mjs__WEBPACK_IMPORTED_MODULE_1__["default"]) {
25339
+ } else if (content instanceof _KeyValuePair_mjs__WEBPACK_IMPORTED_MODULE_2__["default"]) {
24960
25340
  copy.content = cloneDeepKeyValuePair(content, passThroughOptions);
24961
25341
  } else {
24962
25342
  copy.content = content;
@@ -24980,7 +25360,7 @@ const cloneDeepKeyValuePair = (kvp, options) => {
24980
25360
  } = kvp;
24981
25361
  const keyCopy = key !== undefined ? cloneDeepElement(key, passThroughOptions) : undefined;
24982
25362
  const valueCopy = value !== undefined ? cloneDeepElement(value, passThroughOptions) : undefined;
24983
- const copy = new _KeyValuePair_mjs__WEBPACK_IMPORTED_MODULE_1__["default"](keyCopy, valueCopy);
25363
+ const copy = new _KeyValuePair_mjs__WEBPACK_IMPORTED_MODULE_2__["default"](keyCopy, valueCopy);
24984
25364
  visited.set(kvp, copy);
24985
25365
  return copy;
24986
25366
  };
@@ -24996,7 +25376,7 @@ const cloneDeepObjectSlice = (slice, options) => {
24996
25376
  return visited.get(slice);
24997
25377
  }
24998
25378
  const items = [...slice].map(element => cloneDeepElement(element, passThroughOptions));
24999
- const copy = new _ObjectSlice_mjs__WEBPACK_IMPORTED_MODULE_0__["default"](items);
25379
+ const copy = new _ObjectSlice_mjs__WEBPACK_IMPORTED_MODULE_1__["default"](items);
25000
25380
  visited.set(slice, copy);
25001
25381
  return copy;
25002
25382
  };
@@ -25007,16 +25387,16 @@ const cloneDeepObjectSlice = (slice, options) => {
25007
25387
  * @public
25008
25388
  */
25009
25389
  const cloneDeep = (value, options = {}) => {
25010
- if (value instanceof _KeyValuePair_mjs__WEBPACK_IMPORTED_MODULE_1__["default"]) {
25390
+ if (value instanceof _KeyValuePair_mjs__WEBPACK_IMPORTED_MODULE_2__["default"]) {
25011
25391
  return cloneDeepKeyValuePair(value, options);
25012
25392
  }
25013
- if (value instanceof _ObjectSlice_mjs__WEBPACK_IMPORTED_MODULE_0__["default"]) {
25393
+ if (value instanceof _ObjectSlice_mjs__WEBPACK_IMPORTED_MODULE_1__["default"]) {
25014
25394
  return cloneDeepObjectSlice(value, options);
25015
25395
  }
25016
- if ((0,_predicates_index_mjs__WEBPACK_IMPORTED_MODULE_3__.isElement)(value)) {
25396
+ if ((0,_predicates_index_mjs__WEBPACK_IMPORTED_MODULE_4__.isElement)(value)) {
25017
25397
  return cloneDeepElement(value, options);
25018
25398
  }
25019
- throw new _errors_DeepCloneError_mjs__WEBPACK_IMPORTED_MODULE_5__["default"]("Value provided to cloneDeep function couldn't be cloned", {
25399
+ throw new _errors_DeepCloneError_mjs__WEBPACK_IMPORTED_MODULE_6__["default"]("Value provided to cloneDeep function couldn't be cloned", {
25020
25400
  value
25021
25401
  });
25022
25402
  };
@@ -25032,11 +25412,11 @@ const cloneShallowKeyValuePair = keyValuePair => {
25032
25412
  key,
25033
25413
  value
25034
25414
  } = keyValuePair;
25035
- return new _KeyValuePair_mjs__WEBPACK_IMPORTED_MODULE_1__["default"](key, value);
25415
+ return new _KeyValuePair_mjs__WEBPACK_IMPORTED_MODULE_2__["default"](key, value);
25036
25416
  };
25037
25417
  const cloneShallowObjectSlice = objectSlice => {
25038
25418
  const items = [...objectSlice];
25039
- return new _ObjectSlice_mjs__WEBPACK_IMPORTED_MODULE_0__["default"](items);
25419
+ return new _ObjectSlice_mjs__WEBPACK_IMPORTED_MODULE_1__["default"](items);
25040
25420
  };
25041
25421
  const cloneShallowElement = element => {
25042
25422
  const Ctor = element.constructor;
@@ -25048,17 +25428,20 @@ const cloneShallowElement = element => {
25048
25428
  if (!element.isAttributesEmpty) {
25049
25429
  copy.attributes = cloneDeep(element.attributes);
25050
25430
  }
25051
- if ((0,_predicates_index_mjs__WEBPACK_IMPORTED_MODULE_2__.hasElementSourceMap)(element)) {
25052
- _elements_SourceMap_mjs__WEBPACK_IMPORTED_MODULE_4__["default"].transfer(element, copy);
25431
+ if ((0,_predicates_index_mjs__WEBPACK_IMPORTED_MODULE_3__.hasElementSourceMap)(element)) {
25432
+ _elements_SourceMap_mjs__WEBPACK_IMPORTED_MODULE_5__["default"].transfer(element, copy);
25433
+ }
25434
+ if ((0,_predicates_index_mjs__WEBPACK_IMPORTED_MODULE_3__.hasElementStyle)(element)) {
25435
+ copy.style = (0,ramda__WEBPACK_IMPORTED_MODULE_0__["default"])(element.style);
25053
25436
  }
25054
25437
  const {
25055
25438
  content
25056
25439
  } = element;
25057
- if ((0,_predicates_index_mjs__WEBPACK_IMPORTED_MODULE_3__.isElement)(content)) {
25440
+ if ((0,_predicates_index_mjs__WEBPACK_IMPORTED_MODULE_4__.isElement)(content)) {
25058
25441
  copy.content = cloneShallowElement(content);
25059
25442
  } else if (Array.isArray(content)) {
25060
25443
  copy.content = [...content];
25061
- } else if (content instanceof _KeyValuePair_mjs__WEBPACK_IMPORTED_MODULE_1__["default"]) {
25444
+ } else if (content instanceof _KeyValuePair_mjs__WEBPACK_IMPORTED_MODULE_2__["default"]) {
25062
25445
  copy.content = cloneShallowKeyValuePair(content);
25063
25446
  } else {
25064
25447
  copy.content = content;
@@ -25073,16 +25456,16 @@ const cloneShallowElement = element => {
25073
25456
  * @public
25074
25457
  */
25075
25458
  const cloneShallow = value => {
25076
- if (value instanceof _KeyValuePair_mjs__WEBPACK_IMPORTED_MODULE_1__["default"]) {
25459
+ if (value instanceof _KeyValuePair_mjs__WEBPACK_IMPORTED_MODULE_2__["default"]) {
25077
25460
  return cloneShallowKeyValuePair(value);
25078
25461
  }
25079
- if (value instanceof _ObjectSlice_mjs__WEBPACK_IMPORTED_MODULE_0__["default"]) {
25462
+ if (value instanceof _ObjectSlice_mjs__WEBPACK_IMPORTED_MODULE_1__["default"]) {
25080
25463
  return cloneShallowObjectSlice(value);
25081
25464
  }
25082
- if ((0,_predicates_index_mjs__WEBPACK_IMPORTED_MODULE_3__.isElement)(value)) {
25465
+ if ((0,_predicates_index_mjs__WEBPACK_IMPORTED_MODULE_4__.isElement)(value)) {
25083
25466
  return cloneShallowElement(value);
25084
25467
  }
25085
- throw new _errors_ShallowCloneError_mjs__WEBPACK_IMPORTED_MODULE_6__["default"]("Value provided to cloneShallow function couldn't be cloned", {
25468
+ throw new _errors_ShallowCloneError_mjs__WEBPACK_IMPORTED_MODULE_7__["default"]("Value provided to cloneShallow function couldn't be cloned", {
25086
25469
  value
25087
25470
  });
25088
25471
  };
@@ -25503,6 +25886,65 @@ function unpackSourceMap(packed) {
25503
25886
 
25504
25887
  /***/ },
25505
25888
 
25889
+ /***/ 9686
25890
+ (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
25891
+
25892
+ __webpack_require__.r(__webpack_exports__);
25893
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
25894
+ /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
25895
+ /* harmony export */ });
25896
+ /* harmony import */ var _primitives_ObjectElement_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(7071);
25897
+
25898
+ /**
25899
+ * Shape with optional style property.
25900
+ * @public
25901
+ */
25902
+ /**
25903
+ * StyleElement stores format-specific style information for round-trip preservation.
25904
+ *
25905
+ * The style data is stored as a plain object with format-specific namespaces
25906
+ * (e.g., `yaml`, `json`). This element exists only during serialization/deserialization
25907
+ * (refract format) - in memory, style lives directly on `element.style`.
25908
+ *
25909
+ * Follows the same pattern as SourceMapElement with __mappings__.
25910
+ *
25911
+ * @public
25912
+ */
25913
+ class StyleElement extends _primitives_ObjectElement_mjs__WEBPACK_IMPORTED_MODULE_0__["default"] {
25914
+ constructor(content, meta, attributes) {
25915
+ super(content, meta, attributes);
25916
+ this.element = '__styles__';
25917
+ }
25918
+
25919
+ /**
25920
+ * Transfers style property from one element to another.
25921
+ */
25922
+ static transfer(from, to) {
25923
+ to.style = from.style;
25924
+ }
25925
+
25926
+ /**
25927
+ * Creates a StyleElement from an element's style property.
25928
+ * Returns undefined if the element has no style.
25929
+ */
25930
+ static from(source) {
25931
+ if (!source.style) {
25932
+ return undefined;
25933
+ }
25934
+ return new StyleElement(source.style);
25935
+ }
25936
+
25937
+ /**
25938
+ * Restores the style property on the target element from this StyleElement.
25939
+ */
25940
+ applyTo(target) {
25941
+ target.style = this.toValue();
25942
+ }
25943
+ }
25944
+ /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (StyleElement);
25945
+
25946
+ /***/ },
25947
+
25506
25948
  /***/ 6911
25507
25949
  (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
25508
25950
 
@@ -25565,6 +26007,7 @@ const isSourceMapElement = element => element instanceof _elements_SourceMap_mjs
25565
26007
  __webpack_require__.r(__webpack_exports__);
25566
26008
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
25567
26009
  /* harmony export */ hasElementSourceMap: () => (/* binding */ hasElementSourceMap),
26010
+ /* harmony export */ hasElementStyle: () => (/* binding */ hasElementStyle),
25568
26011
  /* harmony export */ includesClasses: () => (/* binding */ includesClasses),
25569
26012
  /* harmony export */ includesSymbols: () => (/* binding */ includesSymbols),
25570
26013
  /* harmony export */ isAnnotationElement: () => (/* reexport safe */ _elements_mjs__WEBPACK_IMPORTED_MODULE_1__.isAnnotationElement),
@@ -25589,6 +26032,14 @@ __webpack_require__.r(__webpack_exports__);
25589
26032
 
25590
26033
 
25591
26034
 
26035
+ /**
26036
+ * Checks if an element has format-specific style information.
26037
+ * @public
26038
+ */
26039
+ const hasElementStyle = element => {
26040
+ return element.style !== undefined;
26041
+ };
26042
+
25592
26043
  /**
25593
26044
  * Checks if an element has complete source position information.
25594
26045
  * Returns true only if all 6 position properties are numbers.
@@ -26125,6 +26576,12 @@ class Element {
26125
26576
  */
26126
26577
  parent;
26127
26578
 
26579
+ /**
26580
+ * Format-specific style information for round-trip preservation.
26581
+ * Each format owns its own namespace (e.g., `yaml`, `json`).
26582
+ */
26583
+ style;
26584
+
26128
26585
  // ============================================================================
26129
26586
  // Source Position (LSP-compatible, TextDocument-compatible, UTF-16 code units)
26130
26587
  // web-tree-sitter automatically provides position data in UTF-16 code units.
@@ -27005,6 +27462,8 @@ __webpack_require__.r(__webpack_exports__);
27005
27462
  /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
27006
27463
  /* harmony export */ });
27007
27464
  /* harmony import */ var _elements_SourceMap_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(5810);
27465
+ /* harmony import */ var _elements_Style_mjs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(9686);
27466
+
27008
27467
 
27009
27468
  /**
27010
27469
  * Serialized representation of an Element in JSON Refract format.
@@ -27063,6 +27522,17 @@ class JSONSerialiser {
27063
27522
  payload.meta.__mappings__ = this.serialise(sourceMap);
27064
27523
  }
27065
27524
  }
27525
+
27526
+ // Serialize style as __styles__ in meta (skip for StyleElement itself)
27527
+ if (!(element instanceof _elements_Style_mjs__WEBPACK_IMPORTED_MODULE_1__["default"])) {
27528
+ const styleElement = _elements_Style_mjs__WEBPACK_IMPORTED_MODULE_1__["default"].from(element);
27529
+ if (styleElement) {
27530
+ if (!payload.meta) {
27531
+ payload.meta = {};
27532
+ }
27533
+ payload.meta.__styles__ = this.serialise(styleElement);
27534
+ }
27535
+ }
27066
27536
  const content = this.serialiseContent(element.content);
27067
27537
  if (content !== undefined) {
27068
27538
  payload.content = content;
@@ -27083,15 +27553,18 @@ class JSONSerialiser {
27083
27553
  element.element = value.element;
27084
27554
  }
27085
27555
 
27086
- // Extract __mappings__ without mutating input, filter remaining meta
27556
+ // Extract __mappings__ and __styles__ without mutating input, filter remaining meta
27087
27557
  let mappingsDoc;
27558
+ let stylesDoc;
27088
27559
  let metaToDeserialize = value.meta;
27089
- if (value.meta?.__mappings__) {
27560
+ if (value.meta?.__mappings__ || value.meta?.__styles__) {
27090
27561
  const {
27091
27562
  __mappings__,
27563
+ __styles__,
27092
27564
  ...rest
27093
27565
  } = value.meta;
27094
27566
  mappingsDoc = __mappings__;
27567
+ stylesDoc = __styles__;
27095
27568
  metaToDeserialize = Object.keys(rest).length > 0 ? rest : undefined;
27096
27569
  }
27097
27570
  if (metaToDeserialize) {
@@ -27103,6 +27576,12 @@ class JSONSerialiser {
27103
27576
  const sourceMap = this.deserialise(mappingsDoc);
27104
27577
  sourceMap.applyTo(element);
27105
27578
  }
27579
+
27580
+ // Restore style from __styles__
27581
+ if (stylesDoc) {
27582
+ const styleElement = this.deserialise(stylesDoc);
27583
+ styleElement.applyTo(element);
27584
+ }
27106
27585
  if (value.attributes) {
27107
27586
  this.deserialiseObject(value.attributes, element.attributes);
27108
27587
  }