@optique/core 1.0.0-dev.1659 → 1.0.0-dev.1661
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/dist/constructs.cjs +14 -9
- package/dist/constructs.js +14 -9
- package/package.json +1 -1
package/dist/constructs.cjs
CHANGED
|
@@ -137,7 +137,11 @@ function containsAnnotationView(value, seen = /* @__PURE__ */ new WeakSet()) {
|
|
|
137
137
|
if (Array.isArray(source)) return source.some((item) => containsAnnotationView(item, seen));
|
|
138
138
|
const proto = Object.getPrototypeOf(source);
|
|
139
139
|
if (proto !== Object.prototype && proto !== null) return false;
|
|
140
|
-
|
|
140
|
+
const descriptors = Object.getOwnPropertyDescriptors(source);
|
|
141
|
+
return Reflect.ownKeys(descriptors).some((key) => {
|
|
142
|
+
const descriptor = descriptors[key];
|
|
143
|
+
return descriptor != null && "value" in descriptor ? containsAnnotationView(descriptor.value, seen) : false;
|
|
144
|
+
});
|
|
141
145
|
}
|
|
142
146
|
function unwrapNestedAnnotationViews(value, seen = /* @__PURE__ */ new WeakMap()) {
|
|
143
147
|
if (value == null || typeof value !== "object") return value;
|
|
@@ -222,17 +226,18 @@ function getAnnotatedFieldState(parentState, field, parser) {
|
|
|
222
226
|
}
|
|
223
227
|
const annotationViewTargets = /* @__PURE__ */ new WeakMap();
|
|
224
228
|
function withAnnotationView(state, annotations) {
|
|
225
|
-
const
|
|
226
|
-
|
|
229
|
+
const target = unwrapAnnotationView(state);
|
|
230
|
+
const view = new Proxy(target, {
|
|
231
|
+
get(target$1, key) {
|
|
227
232
|
if (key === require_annotations.annotationKey) return annotations;
|
|
228
|
-
const value = Reflect.get(target, key, target);
|
|
229
|
-
return typeof value === "function" ? value.bind(target) : value;
|
|
233
|
+
const value = Reflect.get(target$1, key, target$1);
|
|
234
|
+
return typeof value === "function" ? value.bind(target$1) : value;
|
|
230
235
|
},
|
|
231
|
-
has(target, key) {
|
|
232
|
-
return key === require_annotations.annotationKey || Reflect.has(target, key);
|
|
236
|
+
has(target$1, key) {
|
|
237
|
+
return key === require_annotations.annotationKey || Reflect.has(target$1, key);
|
|
233
238
|
}
|
|
234
239
|
});
|
|
235
|
-
annotationViewTargets.set(view,
|
|
240
|
+
annotationViewTargets.set(view, target);
|
|
236
241
|
return view;
|
|
237
242
|
}
|
|
238
243
|
function getParseChildState(parentState, childState, parser) {
|
|
@@ -249,7 +254,7 @@ function getParseChildState(parentState, childState, parser) {
|
|
|
249
254
|
function getObjectParseChildState(parentState, childState, _parser) {
|
|
250
255
|
const annotations = require_annotations.getAnnotations(parentState);
|
|
251
256
|
if (annotations === void 0 || childState == null || typeof childState !== "object" || require_annotations.getAnnotations(childState) === annotations) return childState;
|
|
252
|
-
return require_annotations.
|
|
257
|
+
return require_annotations.inheritAnnotations(parentState, childState);
|
|
253
258
|
}
|
|
254
259
|
function getAnnotatedChildState(parentState, childState, parser) {
|
|
255
260
|
const annotations = require_annotations.getAnnotations(parentState);
|
package/dist/constructs.js
CHANGED
|
@@ -137,7 +137,11 @@ function containsAnnotationView(value, seen = /* @__PURE__ */ new WeakSet()) {
|
|
|
137
137
|
if (Array.isArray(source)) return source.some((item) => containsAnnotationView(item, seen));
|
|
138
138
|
const proto = Object.getPrototypeOf(source);
|
|
139
139
|
if (proto !== Object.prototype && proto !== null) return false;
|
|
140
|
-
|
|
140
|
+
const descriptors = Object.getOwnPropertyDescriptors(source);
|
|
141
|
+
return Reflect.ownKeys(descriptors).some((key) => {
|
|
142
|
+
const descriptor = descriptors[key];
|
|
143
|
+
return descriptor != null && "value" in descriptor ? containsAnnotationView(descriptor.value, seen) : false;
|
|
144
|
+
});
|
|
141
145
|
}
|
|
142
146
|
function unwrapNestedAnnotationViews(value, seen = /* @__PURE__ */ new WeakMap()) {
|
|
143
147
|
if (value == null || typeof value !== "object") return value;
|
|
@@ -222,17 +226,18 @@ function getAnnotatedFieldState(parentState, field, parser) {
|
|
|
222
226
|
}
|
|
223
227
|
const annotationViewTargets = /* @__PURE__ */ new WeakMap();
|
|
224
228
|
function withAnnotationView(state, annotations) {
|
|
225
|
-
const
|
|
226
|
-
|
|
229
|
+
const target = unwrapAnnotationView(state);
|
|
230
|
+
const view = new Proxy(target, {
|
|
231
|
+
get(target$1, key) {
|
|
227
232
|
if (key === annotationKey) return annotations;
|
|
228
|
-
const value = Reflect.get(target, key, target);
|
|
229
|
-
return typeof value === "function" ? value.bind(target) : value;
|
|
233
|
+
const value = Reflect.get(target$1, key, target$1);
|
|
234
|
+
return typeof value === "function" ? value.bind(target$1) : value;
|
|
230
235
|
},
|
|
231
|
-
has(target, key) {
|
|
232
|
-
return key === annotationKey || Reflect.has(target, key);
|
|
236
|
+
has(target$1, key) {
|
|
237
|
+
return key === annotationKey || Reflect.has(target$1, key);
|
|
233
238
|
}
|
|
234
239
|
});
|
|
235
|
-
annotationViewTargets.set(view,
|
|
240
|
+
annotationViewTargets.set(view, target);
|
|
236
241
|
return view;
|
|
237
242
|
}
|
|
238
243
|
function getParseChildState(parentState, childState, parser) {
|
|
@@ -249,7 +254,7 @@ function getParseChildState(parentState, childState, parser) {
|
|
|
249
254
|
function getObjectParseChildState(parentState, childState, _parser) {
|
|
250
255
|
const annotations = getAnnotations(parentState);
|
|
251
256
|
if (annotations === void 0 || childState == null || typeof childState !== "object" || getAnnotations(childState) === annotations) return childState;
|
|
252
|
-
return
|
|
257
|
+
return inheritAnnotations(parentState, childState);
|
|
253
258
|
}
|
|
254
259
|
function getAnnotatedChildState(parentState, childState, parser) {
|
|
255
260
|
const annotations = getAnnotations(parentState);
|