@ng-native/fabric 0.10.0 → 0.12.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/dist/engine.d.ts +6 -0
- package/dist/engine.js +18 -3
- package/dist/engine.js.map +1 -1
- package/package.json +1 -1
package/dist/engine.d.ts
CHANGED
|
@@ -397,6 +397,12 @@ export interface ViewNameOptions {
|
|
|
397
397
|
* typed wrapper for it, says so with `keepNativeView`.
|
|
398
398
|
*/
|
|
399
399
|
readonly yieldsToComponents?: boolean;
|
|
400
|
+
/**
|
|
401
|
+
* The element a run of text written straight into the view is drawn by, where that is not a
|
|
402
|
+
* paragraph: an SVG text draws its words by a span, which is no child a template wrote. The
|
|
403
|
+
* element is the engine's own, as the paragraph a view is given for its loose text is.
|
|
404
|
+
*/
|
|
405
|
+
readonly looseText?: string;
|
|
400
406
|
}
|
|
401
407
|
/**
|
|
402
408
|
* A view whose native name differs by platform. Chosen when the view is looked up rather than when
|
package/dist/engine.js
CHANGED
|
@@ -1092,8 +1092,14 @@ export function registerViewName(elementName, viewName, defaultProps, options) {
|
|
|
1092
1092
|
DEFAULT_PROPS[name] = defaultProps;
|
|
1093
1093
|
if (options?.textContent)
|
|
1094
1094
|
TEXT_CONTENT_PROPS[name] = options.textContent;
|
|
1095
|
+
if (options?.looseText)
|
|
1096
|
+
LOOSE_TEXT[name] = options.looseText;
|
|
1097
|
+
else
|
|
1098
|
+
delete LOOSE_TEXT[name];
|
|
1095
1099
|
}
|
|
1096
1100
|
}
|
|
1101
|
+
/** The element loose text in a view is drawn by, for the views that say. See `ViewNameOptions`. */
|
|
1102
|
+
const LOOSE_TEXT = {};
|
|
1097
1103
|
/** The registered names that give way to a component's own host. See `ViewNameOptions`. */
|
|
1098
1104
|
const YIELDING = new Set();
|
|
1099
1105
|
/** The prop each view that takes its text content as a prop reads it from. See `ViewNameOptions`. */
|
|
@@ -5057,15 +5063,21 @@ export class Engine {
|
|
|
5057
5063
|
text.box = undefined;
|
|
5058
5064
|
return this.reconcileUnder(parent, text, context);
|
|
5059
5065
|
}
|
|
5060
|
-
const box = this.looseText(parent, text);
|
|
5066
|
+
const box = this.looseText(parent, text, LOOSE_TEXT[viewName]);
|
|
5061
5067
|
return box ? this.reconcileUnder(parent, box, context) : null;
|
|
5062
5068
|
}
|
|
5063
|
-
looseText(parent, text) {
|
|
5069
|
+
looseText(parent, text, drawnBy = 'text') {
|
|
5064
5070
|
if (!trimEnds(text.text))
|
|
5065
5071
|
return null;
|
|
5066
5072
|
let box = text.box;
|
|
5073
|
+
// One made for another element, before the view was registered again, is done with.
|
|
5074
|
+
if (box && box.name !== drawnBy) {
|
|
5075
|
+
if (box.committed)
|
|
5076
|
+
this.forgetCommitted(box);
|
|
5077
|
+
box = undefined;
|
|
5078
|
+
}
|
|
5067
5079
|
if (!box) {
|
|
5068
|
-
box = new RetainedNode('element',
|
|
5080
|
+
box = new RetainedNode('element', drawnBy, this);
|
|
5069
5081
|
box.anonymous = true;
|
|
5070
5082
|
box.children = [text];
|
|
5071
5083
|
text.box = box;
|
|
@@ -5074,6 +5086,9 @@ export class Engine {
|
|
|
5074
5086
|
// The text is not under the box in the tree, so a change to it never marked the box.
|
|
5075
5087
|
if (!this.isClean(text)) {
|
|
5076
5088
|
box.subtreeDirty = true;
|
|
5089
|
+
// An element that says its words as a prop is merged again for them.
|
|
5090
|
+
if (drawnBy !== 'text')
|
|
5091
|
+
box.propsDirty = true;
|
|
5077
5092
|
// Nor had it merged again where the text became one word, or stopped being one.
|
|
5078
5093
|
if (box.oneWord !== undefined && unbroken(box) !== box.oneWord)
|
|
5079
5094
|
box.propsDirty = true;
|