@nativescript-community/text 1.5.32 → 1.5.34

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nativescript-community/text",
3
- "version": "1.5.32",
3
+ "version": "1.5.34",
4
4
  "description": "Expands the capabilities of NativeScript's text property.",
5
5
  "main": "./index",
6
6
  "sideEffects": false,
@@ -37,5 +37,5 @@
37
37
  },
38
38
  "license": "Apache-2.0",
39
39
  "readmeFilename": "README.md",
40
- "gitHead": "a4d43aefb32b3500db07844744dd6ceec91ded79"
40
+ "gitHead": "747771199cb81e830646e839848b00be1b3b3745"
41
41
  }
@@ -3,7 +3,6 @@ package com.nativescript.text;
3
3
  import android.content.Context;
4
4
  import android.content.res.AssetManager;
5
5
  import android.graphics.Typeface;
6
- import android.graphics.Color;
7
6
  import android.os.Build;
8
7
  import android.text.SpannableStringBuilder;
9
8
  import android.text.style.AbsoluteSizeSpan;
@@ -310,7 +309,7 @@ public class Font {
310
309
  }
311
310
 
312
311
  public static SpannableStringBuilder stringBuilderFromHtmlString(Context context, String fontFolder, String parentFontFamily,
313
- String htmlString, final boolean disableLinkUnderline, final Color linkColor) {
312
+ String htmlString, final boolean disableLinkUnderline, final int linkColor) {
314
313
  if (htmlString == null) {
315
314
  return null;
316
315
  }
@@ -413,7 +412,7 @@ public class Font {
413
412
  }
414
413
  int tapIndex = span.optInt("tapIndex", -1);
415
414
  if (tapIndex != -1) {
416
- ssb.setSpan(new URLSpanNoUnderline(String.valueOf(tapIndex), false, null, true), start, end,
415
+ ssb.setSpan(new URLSpanNoUnderline(String.valueOf(tapIndex), false, 0, true), start, end,
417
416
  android.text.Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
418
417
  }
419
418
 
@@ -467,7 +466,7 @@ public class Font {
467
466
  static HtmlToSpannedConverter converter = null;
468
467
 
469
468
  public static CharSequence fromHtml(CharSequence html, Context context, String fontFolder, String parentFontFamily,
470
- final boolean disableLinkUnderline, final Color linkColor) {
469
+ final boolean disableLinkUnderline, final int linkColor) {
471
470
  // long startTime = System.nanoTime();
472
471
  // XMLReader xmlReader;
473
472
  try {
@@ -493,7 +492,7 @@ public class Font {
493
492
  return html;
494
493
  }
495
494
 
496
- public static CharSequence fromHtml(Context context, String fontFolder, String parentFontFamily, CharSequence html, final boolean disableLinkUnderline, final Color linkColor) {
495
+ public static CharSequence fromHtml(Context context, String fontFolder, String parentFontFamily, CharSequence html, final boolean disableLinkUnderline, final int linkColor) {
497
496
  return fromHtml(html, context, fontFolder, parentFontFamily, disableLinkUnderline, linkColor);
498
497
  }
499
498
  }
@@ -29,7 +29,6 @@ import android.text.style.SuperscriptSpan;
29
29
  import android.text.style.TextAppearanceSpan;
30
30
  import android.text.style.TypefaceSpan;
31
31
  import android.text.style.UnderlineSpan;
32
- import android.graphics.Color;
33
32
 
34
33
  import java.util.ArrayList;
35
34
  import java.util.Collection;
@@ -43,7 +42,7 @@ class HtmlToSpannedConverter extends DefaultHandler {
43
42
 
44
43
  // private Attributes _currentAtts = null;
45
44
  public boolean disableLinkUnderline = false;
46
- public Color linkColor = null;
45
+ public int linkColor = 0;
47
46
  private SpannableStringBuilder mSpannableStringBuilder;
48
47
 
49
48
  private Html.ImageGetter mImageGetter;
@@ -57,7 +56,7 @@ class HtmlToSpannedConverter extends DefaultHandler {
57
56
  }
58
57
 
59
58
  public HtmlToSpannedConverter(Context context, String fontFolder, String parentFontFamily, Html.ImageGetter imageGetter,
60
- Html.TagHandler tagHandler, final boolean disableLinkUnderline, final Color linkColor) {
59
+ Html.TagHandler tagHandler, final boolean disableLinkUnderline, final int linkColor) {
61
60
  mSpannableStringBuilder = new SpannableStringBuilder();
62
61
  mImageGetter = imageGetter;
63
62
  this.fontFolder = fontFolder;
@@ -5,18 +5,21 @@ import android.text.style.URLSpan;
5
5
  import android.graphics.Color;
6
6
 
7
7
  public class URLSpanNoUnderline extends URLSpan {
8
- private boolean disableStyle;
9
- private boolean showUnderline;
10
- private Color color;
11
- public URLSpanNoUnderline(String url, boolean showUnderline, Color color, boolean disableStyle) {
8
+ private boolean disableStyle = false;
9
+ private boolean showUnderline = false;
10
+ private int color = 0;
11
+ public URLSpanNoUnderline(String url, boolean showUnderline, int color, boolean disableStyle) {
12
12
  super(url);
13
13
  this.showUnderline = showUnderline;
14
14
  this.color = color;
15
15
  this.disableStyle = disableStyle;
16
16
  }
17
- public URLSpanNoUnderline(String url, boolean showUnderline, Color color) {
17
+ public URLSpanNoUnderline(String url, boolean showUnderline, int color) {
18
18
  this(url, showUnderline, color, false);
19
19
  }
20
+ public URLSpanNoUnderline(String url, boolean showUnderline) {
21
+ this(url, showUnderline, 0);
22
+ }
20
23
  @Override
21
24
  public void updateDrawState(TextPaint ds) {
22
25
  if (this.disableStyle) {
@@ -26,8 +29,8 @@ public class URLSpanNoUnderline extends URLSpan {
26
29
  if (!this.showUnderline) {
27
30
  ds.setUnderlineText(false);
28
31
  }
29
- if (this.color != null){
30
- ds.setColor(color.toArgb());
32
+ if (this.color != 0){
33
+ ds.setColor(color);
31
34
  }
32
35
  }
33
36
  @Override
@@ -67,7 +67,7 @@ class NSTextUtils: NSObject {
67
67
  (view as! UIButton).setAttributedTitle(result, for:UIControl.State.normal)
68
68
  }
69
69
  else {
70
- var attributedTextProperty = class_getProperty(type(of: view), "attributedText");
70
+ let attributedTextProperty = class_getProperty(type(of: view), "attributedText");
71
71
  if (attributedTextProperty != nil) {
72
72
  view.setValue(result, forKey: "attributedText")
73
73
  }
@@ -78,8 +78,8 @@ class NSTextUtils: NSObject {
78
78
  (view as! UIButton).setAttributedTitle(nil, for:UIControl.State.normal)
79
79
  (view as! UIButton).setTitle(text, for:UIControl.State.normal)
80
80
  } else {
81
- var attributedTextProperty = class_getProperty(type(of: view), "attributedText");
82
- var textProperty = class_getProperty(type(of: view), "text");
81
+ let attributedTextProperty = class_getProperty(type(of: view), "attributedText");
82
+ let textProperty = class_getProperty(type(of: view), "text");
83
83
  if (attributedTextProperty != nil) {
84
84
  // Clear attributedText or text won't be affected.
85
85
  view.setValue(nil, forKey: "attributedText")
package/index-common.d.ts DELETED
@@ -1,47 +0,0 @@
1
- import { Color, CoreTypes, FormattedString, InheritedCssProperty, Observable, ObservableArray, Span, Style, View } from '@nativescript/core';
2
- import { FontStyleType, FontWeightType } from '@nativescript/core/ui/styling/font';
3
- declare module '@nativescript/core/ui/text-base' {
4
- interface TextBase {
5
- createFormattedTextNative?(value: LightFormattedString | FormattedString): any;
6
- }
7
- }
8
- export interface ObjectSpans extends Partial<Pick<LightFormattedString, keyof LightFormattedString>> {
9
- spans: any;
10
- }
11
- export declare function computeBaseLineOffset(align: any, fontAscent: any, fontDescent: any, fontBottom: any, fontTop: any, fontSize: any, maxFontSize: any): number;
12
- export declare function getTransformedText(text: string, textTransform: CoreTypes.TextTransformType): string;
13
- export declare const cssProperty: (target: Object, key: string | symbol) => void;
14
- export declare type VerticalTextAlignment = 'initial' | 'top' | 'middle' | 'bottom' | 'center';
15
- export declare const verticalTextAlignmentConverter: (value: any) => VerticalTextAlignment;
16
- export declare const verticalTextAlignmentProperty: InheritedCssProperty<Style, VerticalTextAlignment>;
17
- export declare const textAlignmentConverter: (value: any) => CoreTypes.TextAlignmentType;
18
- export declare class LightFormattedString extends Observable {
19
- static get isFormattedString(): boolean;
20
- private _spans;
21
- constructor();
22
- fontFamily: string;
23
- fontSize: number;
24
- fontStyle: FontStyleType;
25
- fontWeight: FontWeightType;
26
- textAlignment: CoreTypes.TextAlignmentType;
27
- verticalTextAlignment: CoreTypes.VerticalAlignmentTextType;
28
- textDecoration: CoreTypes.TextDecorationType;
29
- color: Color;
30
- backgroundColor: Color;
31
- parent: View;
32
- get style(): this;
33
- get spans(): ObservableArray<Span>;
34
- set spans(value: ObservableArray<Span>);
35
- toString(): string;
36
- _addArrayFromBuilder(name: string, value: any[]): void;
37
- _addChildFromBuilder(name: string, value: any): void;
38
- private onSpansCollectionChanged;
39
- private addPropertyChangeHandler;
40
- private removePropertyChangeHandler;
41
- private onPropertyChange;
42
- toNativeString(): void;
43
- }
44
- export declare function getMaxFontSize(value: FormattedString | LightFormattedString | ObjectSpans): number;
45
- export declare let overrideSpanAndFormattedStringEnabled: boolean;
46
- export declare let useLightFormattedString: boolean;
47
- export declare function overrideSpanAndFormattedString(useLightFormatString?: boolean): void;
package/index-common.js DELETED
@@ -1,323 +0,0 @@
1
- import { Color, CoreTypes, FormattedString, InheritedCssProperty, Observable, ObservableArray, Span, Style, View, ViewBase, colorProperty, makeParser, makeValidator } from '@nativescript/core';
2
- import { TextBase } from '@nativescript/core/ui/text-base';
3
- import { createNativeAttributedString } from './index';
4
- import { iOSNativeHelper } from '@nativescript/core/utils';
5
- import { isNullOrUndefined, isString } from '@nativescript/core/utils/types';
6
- const CHILD_FORMATTED_TEXT = 'formattedText';
7
- // export function enableIOSDTCoreText() {}
8
- // export function usingIOSDTCoreText() {
9
- // return false;
10
- // }
11
- export function computeBaseLineOffset(align, fontAscent, fontDescent, fontBottom, fontTop, fontSize, maxFontSize) {
12
- let result = 0;
13
- switch (align) {
14
- case 'top':
15
- result = -maxFontSize - fontBottom - fontTop;
16
- break;
17
- case 'bottom':
18
- result = fontBottom;
19
- break;
20
- case 'text-top':
21
- result = -maxFontSize - fontDescent - fontAscent;
22
- break;
23
- case 'text-bottom':
24
- result = fontBottom - fontDescent;
25
- break;
26
- case 'middle':
27
- case 'center':
28
- result = (fontAscent - fontDescent) / 2 - fontAscent - maxFontSize / 2;
29
- break;
30
- case 'super':
31
- result = -(maxFontSize - fontSize);
32
- break;
33
- case 'sub':
34
- result = 0;
35
- break;
36
- }
37
- return result;
38
- }
39
- function getCapitalizedString(str) {
40
- const words = str.split(' ');
41
- const newWords = [];
42
- for (let i = 0, length = words.length; i < length; i++) {
43
- const word = words[i].toLowerCase();
44
- newWords.push(word.substring(0, 1).toUpperCase() + word.substring(1));
45
- }
46
- return newWords.join(' ');
47
- }
48
- export function getTransformedText(text, textTransform) {
49
- if (!text || !isString(text)) {
50
- return '';
51
- }
52
- switch (textTransform) {
53
- case 'uppercase':
54
- return text.toUpperCase();
55
- case 'lowercase':
56
- return text.toLowerCase();
57
- case 'capitalize':
58
- return getCapitalizedString(text);
59
- case 'none':
60
- default:
61
- return text;
62
- }
63
- }
64
- export const cssProperty = (target, key) => {
65
- // property getter
66
- const getter = function () {
67
- return this.style[key];
68
- };
69
- // property setter
70
- const setter = function (newVal) {
71
- this.style[key] = newVal;
72
- };
73
- Object.defineProperty(target, key, {
74
- get: getter,
75
- set: setter,
76
- enumerable: true,
77
- configurable: true
78
- });
79
- };
80
- export const verticalTextAlignmentConverter = makeParser(makeValidator('initial', 'top', 'middle', 'bottom', 'center'));
81
- export const verticalTextAlignmentProperty = new InheritedCssProperty({
82
- name: 'verticalTextAlignment',
83
- cssName: 'vertical-text-align',
84
- valueConverter: verticalTextAlignmentConverter
85
- });
86
- verticalTextAlignmentProperty.register(Style);
87
- export const textAlignmentConverter = makeParser(makeValidator('initial', 'left', 'right', 'center'));
88
- export class LightFormattedString extends Observable {
89
- constructor() {
90
- super();
91
- this._spans = new ObservableArray();
92
- this._spans.addEventListener(ObservableArray.changeEvent, this.onSpansCollectionChanged, this);
93
- }
94
- static get isFormattedString() {
95
- return true;
96
- }
97
- get style() {
98
- return this;
99
- }
100
- get spans() {
101
- if (!this._spans) {
102
- this._spans = new ObservableArray();
103
- }
104
- return this._spans;
105
- }
106
- set spans(value) {
107
- if (value instanceof ObservableArray) {
108
- this._spans.removeEventListener(ObservableArray.changeEvent, this.onSpansCollectionChanged, this);
109
- this._spans = value;
110
- this._spans.addEventListener(ObservableArray.changeEvent, this.onSpansCollectionChanged, this);
111
- }
112
- else if (Array.isArray(value)) {
113
- this._spans.push(...value);
114
- }
115
- else {
116
- this._spans.push(value);
117
- }
118
- }
119
- toString() {
120
- let result = '';
121
- for (let i = 0, length = this._spans.length; i < length; i++) {
122
- result += this._spans.getItem(i).text;
123
- }
124
- return result;
125
- }
126
- _addArrayFromBuilder(name, value) {
127
- if (name === 'spans') {
128
- this.spans.push(...value);
129
- }
130
- }
131
- _addChildFromBuilder(name, value) {
132
- if (value instanceof Span) {
133
- this.spans.push(value);
134
- }
135
- }
136
- onSpansCollectionChanged(eventData) {
137
- if (eventData.addedCount > 0) {
138
- for (let i = 0; i < eventData.addedCount; i++) {
139
- const span = eventData.object.getItem(eventData.index + i);
140
- span.parent = this;
141
- // Then attach handlers - we skip the first nofitication because
142
- // we raise change for the whole instance.
143
- this.addPropertyChangeHandler(span);
144
- }
145
- }
146
- if (eventData.removed && eventData.removed.length > 0) {
147
- for (let p = 0; p < eventData.removed.length; p++) {
148
- const span = eventData.removed[p];
149
- span.parent = null;
150
- // First remove handlers so that we don't listen for changes
151
- // on inherited properties.
152
- this.removePropertyChangeHandler(span);
153
- }
154
- }
155
- this.notifyPropertyChange('.', this);
156
- }
157
- addPropertyChangeHandler(span) {
158
- const style = span.style;
159
- span.on(Observable.propertyChangeEvent, this.onPropertyChange, this);
160
- style.on('fontFamilyChange', this.onPropertyChange, this);
161
- style.on('fontSizeChange', this.onPropertyChange, this);
162
- style.on('fontStyleChange', this.onPropertyChange, this);
163
- style.on('fontWeightChange', this.onPropertyChange, this);
164
- style.on('textDecorationChange', this.onPropertyChange, this);
165
- style.on('colorChange', this.onPropertyChange, this);
166
- style.on('backgroundColorChange', this.onPropertyChange, this);
167
- }
168
- removePropertyChangeHandler(span) {
169
- span.off(Observable.propertyChangeEvent, this.onPropertyChange, this);
170
- }
171
- onPropertyChange(data) {
172
- this.notifyPropertyChange(data.propertyName, this);
173
- }
174
- toNativeString() { }
175
- }
176
- export function getMaxFontSize(value) {
177
- let max = value.fontSize || 0;
178
- value.spans &&
179
- value.spans.forEach((s) => {
180
- if (s.fontSize) {
181
- max = Math.max(max, s.fontSize);
182
- }
183
- });
184
- return max;
185
- }
186
- export let overrideSpanAndFormattedStringEnabled = false;
187
- export let useLightFormattedString = false;
188
- export function overrideSpanAndFormattedString(useLightFormatString = true) {
189
- if (overrideSpanAndFormattedStringEnabled) {
190
- return;
191
- }
192
- overrideSpanAndFormattedStringEnabled = true;
193
- useLightFormattedString = useLightFormatString;
194
- TextBase.prototype._addChildFromBuilder = function (name, value) {
195
- if (name === Span.name || value.constructor.isSpan) {
196
- if (!this.formattedText) {
197
- const formattedText = useLightFormattedString ? new LightFormattedString() : new FormattedString();
198
- formattedText.spans.push(value);
199
- this.formattedText = formattedText;
200
- formattedText.parent = this;
201
- }
202
- else {
203
- this.formattedText.spans.push(value);
204
- }
205
- }
206
- else if (name === CHILD_FORMATTED_TEXT || name === FormattedString.name || name === LightFormattedString.name || value.constructor.isFormattedString) {
207
- this.formattedText = value;
208
- value.parent = this;
209
- }
210
- };
211
- const oldImplAddView = TextBase.prototype._addView;
212
- TextBase.prototype._addView = function (view) {
213
- if (view instanceof LightFormattedString) {
214
- return;
215
- }
216
- oldImplAddView.call(this, view);
217
- };
218
- const oldImplRemoveView = TextBase.prototype._addView;
219
- TextBase.prototype._removeView = function (view) {
220
- if (view instanceof LightFormattedString) {
221
- return;
222
- }
223
- oldImplRemoveView.call(this, view);
224
- };
225
- TextBase.prototype.eachChild = function (callback) {
226
- const text = this.formattedText;
227
- if (text instanceof FormattedString) {
228
- callback(text);
229
- }
230
- };
231
- TextBase.prototype.createFormattedTextNative = function (value) {
232
- return createNativeAttributedString(value, this, this['autoFontSize'], this['fontSizeRatio']);
233
- };
234
- TextBase.prototype[colorProperty.setNative] = function (value) {
235
- if (value instanceof Color) {
236
- if (__IOS__) {
237
- const color = value instanceof Color ? value.ios : value;
238
- this._setColor(color);
239
- }
240
- else if (__ANDROID__) {
241
- if (value instanceof Color) {
242
- this.nativeTextViewProtected.setTextColor(value.android);
243
- }
244
- else {
245
- this.nativeTextViewProtected.setTextColor(value);
246
- }
247
- }
248
- }
249
- };
250
- //@ts-ignore
251
- if (__IOS__ && typeof TextBase.prototype.setFormattedTextDecorationAndTransform !== 'function') {
252
- const majorVersion = iOSNativeHelper.MajorVersion;
253
- function NSStringFromNSAttributedString(source) {
254
- return NSString.stringWithString((source instanceof NSAttributedString && source.string) || source);
255
- }
256
- function getTransformedText(text, textTransform) {
257
- if (!text || !isString(text)) {
258
- return '';
259
- }
260
- switch (textTransform) {
261
- case 'uppercase':
262
- return NSStringFromNSAttributedString(text).uppercaseString;
263
- case 'lowercase':
264
- return NSStringFromNSAttributedString(text).lowercaseString;
265
- case 'capitalize':
266
- return NSStringFromNSAttributedString(text).capitalizedString;
267
- default:
268
- return text;
269
- }
270
- }
271
- TextBase.prototype._setNativeText = function (reset = false) {
272
- if (reset) {
273
- const nativeView = this.nativeTextViewProtected;
274
- if (nativeView instanceof UIButton) {
275
- // Clear attributedText or title won't be affected.
276
- nativeView.setAttributedTitleForState(null, 0 /* UIControlState.Normal */);
277
- nativeView.setTitleForState(null, 0 /* UIControlState.Normal */);
278
- }
279
- else {
280
- // Clear attributedText or text won't be affected.
281
- nativeView.attributedText = null;
282
- nativeView.text = null;
283
- }
284
- return;
285
- }
286
- if (this.formattedText) {
287
- this.setFormattedTextDecorationAndTransform();
288
- }
289
- else {
290
- this.setTextDecorationAndTransform();
291
- }
292
- };
293
- //@ts-ignore
294
- TextBase.prototype.setFormattedTextDecorationAndTransform = function () {
295
- const nativeView = this.nativeTextViewProtected;
296
- const attrText = this.createFormattedTextNative(this.formattedText);
297
- // we override parent class behavior because we apply letterSpacing and lineHeight on a per Span basis
298
- if (majorVersion >= 13 && UIColor.labelColor) {
299
- this.nativeTextViewProtected.textColor = UIColor.labelColor;
300
- }
301
- nativeView.attributedText = attrText;
302
- };
303
- //@ts-ignore
304
- TextBase.prototype.setTextDecorationAndTransform = function () {
305
- const style = this.style;
306
- const letterSpacing = style.letterSpacing ?? 0;
307
- const lineHeight = style.lineHeight ?? -1;
308
- let uiColor;
309
- if (style.color) {
310
- const color = !style.color || style.color instanceof Color ? style.color : new Color(style.color);
311
- if (color) {
312
- uiColor = color.ios;
313
- }
314
- }
315
- const text = getTransformedText(isNullOrUndefined(this.text) ? '' : `${this.text}`, this.textTransform);
316
- NSTextUtils.setTextDecorationAndTransformOnViewTextTextDecorationLetterSpacingLineHeightColor(this.nativeTextViewProtected, text, this.style.textDecoration || '', letterSpacing, lineHeight, uiColor);
317
- if (!style.color && majorVersion >= 13 && UIColor.labelColor) {
318
- this._setColor(UIColor.labelColor);
319
- }
320
- };
321
- }
322
- }
323
- //# sourceMappingURL=index-common.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index-common.js","sourceRoot":"../src/","sources":["index-common.ts"],"names":[],"mappings":"AAAA,OAAO,EAEH,KAAK,EACL,SAAS,EACT,eAAe,EACf,oBAAoB,EACpB,UAAU,EACV,eAAe,EAEf,IAAI,EACJ,KAAK,EACL,IAAI,EACJ,QAAQ,EACR,aAAa,EACb,UAAU,EACV,aAAa,EAChB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAC;AAC3D,OAAO,EAAE,4BAA4B,EAAE,MAAM,SAAS,CAAC;AACvD,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAC3D,OAAO,EAAE,iBAAiB,EAAE,QAAQ,EAAE,MAAM,gCAAgC,CAAC;AAY7E,MAAM,oBAAoB,GAAG,eAAe,CAAC;AAE7C,2CAA2C;AAC3C,yCAAyC;AACzC,oBAAoB;AACpB,IAAI;AACJ,MAAM,UAAU,qBAAqB,CAAC,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,UAAU,EAAE,OAAO,EAAE,QAAQ,EAAE,WAAW;IAC5G,IAAI,MAAM,GAAG,CAAC,CAAC;IACf,QAAQ,KAAK,EAAE;QACX,KAAK,KAAK;YACN,MAAM,GAAG,CAAC,WAAW,GAAG,UAAU,GAAG,OAAO,CAAC;YAC7C,MAAM;QAEV,KAAK,QAAQ;YACT,MAAM,GAAG,UAAU,CAAC;YACpB,MAAM;QAEV,KAAK,UAAU;YACX,MAAM,GAAG,CAAC,W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,GAAG,CAAC,KAAK,CAAC,KAAK,IAAI,KAAK,CAAC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;gBAClG,IAAI,KAAK,EAAE;oBACP,OAAO,GAAG,KAAK,CAAC,GAAG,CAAC;iBACvB;aACJ;YACD,MAAM,IAAI,GAAG,kBAAkB,CAAC,iBAAiB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,IAAI,EAAE,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC;YACxG,WAAW,CAAC,iFAAiF,CACzF,IAAI,CAAC,uBAAuB,EAC5B,IAAI,EACJ,IAAI,CAAC,KAAK,CAAC,cAAc,IAAI,EAAE,EAC/B,aAAa,EACb,UAAU,EACV,OAAO,CACV,CAAC;YAEF,IAAI,CAAC,KAAK,CAAC,KAAK,IAAI,YAAY,IAAI,EAAE,IAAI,OAAO,CAAC,UAAU,EAAE;gBAC1D,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;aACtC;QACL,CAAC,CAAC;KACL;AACL,CAAC"}
@@ -1,33 +0,0 @@
1
- import { Color, CoreTypes, FormattedString, ViewBase } from '@nativescript/core';
2
- import { ObjectSpans } from '.';
3
- export * from './index-common';
4
- export declare const typefaceCache: {
5
- [k: string]: android.graphics.Typeface;
6
- };
7
- export declare function init(): void;
8
- declare module '@nativescript/core/ui/text-base/formatted-string' {
9
- interface FormattedString {
10
- toNativeString(maxFontSize?: number): string;
11
- }
12
- }
13
- declare module '@nativescript/core/ui/text-base/span' {
14
- interface Span {
15
- toNativeString(maxFontSize?: number): string;
16
- }
17
- }
18
- export declare function createNativeAttributedString(data: {
19
- text: string;
20
- color?: Color | string | number;
21
- familyName?: string;
22
- fontSize?: number;
23
- fontWeight?: string;
24
- letterSpacing?: number;
25
- lineHeight?: number;
26
- lineBreak?: number;
27
- relativeSize?: number;
28
- linkColor?: string | Color;
29
- linkDecoration?: string;
30
- textAlignment?: number | CoreTypes.TextAlignmentType;
31
- } | FormattedString | ObjectSpans, parent?: any, parentView?: ViewBase, autoFontSizeEnabled?: boolean, fontSizeRatio?: number, // used only on iOS,
32
- density?: any): any;
33
- export declare function createSpannable(span: any, parentView: any, parent?: any, maxFontSize?: number): globalAndroid.text.SpannableStringBuilder;
package/index.android.js DELETED
@@ -1,187 +0,0 @@
1
- import { Color, CoreTypes, FormattedString, Span, Utils, ViewBase, knownFolders, path, profile } from '@nativescript/core';
2
- import { Font } from '@nativescript/core/ui/styling/font';
3
- import { getTransformedText, textDecorationProperty } from '@nativescript/core/ui/text-base';
4
- import { LightFormattedString } from './index-common';
5
- export * from './index-common';
6
- function formattedStringToNativeString(formattedString, parent, parentView = formattedString.parent, density) {
7
- let maxFontSize = formattedString?.fontSize || parentView?.fontSize || 0;
8
- formattedString.spans.forEach((s) => {
9
- if (s.fontSize) {
10
- maxFontSize = Math.max(maxFontSize, s.fontSize);
11
- }
12
- });
13
- const options = [];
14
- if (!parent) {
15
- parent = formattedString;
16
- }
17
- formattedString.spans.forEach((s, index) => {
18
- const spanDetails = spanToNativeString(s, parent, parentView, maxFontSize, index, density);
19
- if (spanDetails) {
20
- options.push(spanDetails);
21
- }
22
- });
23
- return `[${options.join(',')}]`;
24
- }
25
- function spanToNativeString(span, parent, parentView, maxFontSize, index = -1, density) {
26
- let text = span.text;
27
- if (!text || (span.visibility && span.visibility !== 'visible')) {
28
- return null;
29
- }
30
- const spanStyle = span.style;
31
- const textTransform = span.textTransform || parentView?.textTransform;
32
- let fontWeight = span.fontWeight;
33
- let fontStyle = span.fontStyle;
34
- let fontFamily = span.fontFamily;
35
- if (fontFamily || (fontWeight && fontWeight !== 'normal') || fontStyle) {
36
- fontFamily = fontFamily || parent?.fontFamily || parentView?.fontFamily;
37
- fontWeight = fontWeight || parent?.fontWeight || parentView?.fontWeight;
38
- fontStyle = fontStyle || parent?.fontStyle || parentView?.fontStyle;
39
- }
40
- const textDecoration = span?.textDecoration || parent?.textDecoration || parentView?.textDecoration;
41
- const textAlignment = span.textAlignment || parent?.textAlignment || parentView?.textAlignment;
42
- let verticalTextAlignment = span.verticalTextAlignment;
43
- // We CANT use parent verticalTextAlignment. Else it would break line height
44
- // for multiple line text you want centered in the View
45
- // if (!verticalTextAlignment || verticalTextAlignment === 'stretch') {
46
- // verticalTextAlignment = parentView?.verticalTextAlignment;
47
- // }
48
- if (text && textTransform != null && textTransform !== 'none') {
49
- text = getTransformedText(text, textTransform);
50
- }
51
- if (!density) {
52
- // that means not for canvaslabel!
53
- density = spanStyle ? Utils.layout.getDisplayDensity() : 1;
54
- verticalTextAlignment = span.verticalAlignment || parent?.verticalAlignment;
55
- }
56
- let backgroundColor = span.backgroundColor || parent?.backgroundColor;
57
- if (backgroundColor && !(backgroundColor instanceof Color)) {
58
- backgroundColor = new Color(backgroundColor);
59
- }
60
- let color = span.color || parent?.color;
61
- if (color && !(color instanceof Color)) {
62
- color = new Color(color);
63
- }
64
- const lineHeight = span.lineHeight || parent?.lineHeight;
65
- const fontSize = span.fontSize || parent?.fontSize;
66
- const letterSpacing = span.letterSpacing || parent?.letterSpacing;
67
- return JSON.stringify({
68
- text,
69
- fontFamily,
70
- fontSize: fontSize ? fontSize * density : undefined,
71
- fontWeight: fontWeight ? fontWeight + '' : undefined,
72
- fontStyle: fontStyle !== 'normal' ? fontStyle : undefined,
73
- textDecoration,
74
- textAlignment,
75
- tapIndex: span._tappable && index !== -1 ? index : undefined,
76
- maxFontSize: maxFontSize ? maxFontSize * density : undefined,
77
- relativeSize: span.relativeSize,
78
- verticalTextAlignment,
79
- lineHeight: lineHeight !== undefined ? lineHeight * density : undefined,
80
- letterSpacing: letterSpacing !== undefined ? letterSpacing * density : undefined,
81
- color: color ? color.android : undefined,
82
- backgroundColor: backgroundColor ? backgroundColor.android : undefined
83
- });
84
- }
85
- // eslint-disable-next-line no-redeclare
86
- let ClickableSpan;
87
- function initializeClickableSpan() {
88
- if (ClickableSpan) {
89
- return;
90
- }
91
- let ClickableSpanImpl = class ClickableSpanImpl extends android.text.style.ClickableSpan {
92
- constructor(owner) {
93
- super();
94
- this.owner = new WeakRef(owner);
95
- return global.__native(this);
96
- }
97
- onClick(view) {
98
- const owner = this.owner?.get();
99
- if (owner) {
100
- owner._emit(Span.linkTapEvent);
101
- }
102
- view.clearFocus();
103
- view.invalidate();
104
- }
105
- updateDrawState(tp) {
106
- // don't style as link
107
- }
108
- };
109
- ClickableSpanImpl = __decorate([
110
- NativeClass
111
- ], ClickableSpanImpl);
112
- ClickableSpan = ClickableSpanImpl;
113
- }
114
- export const typefaceCache = {};
115
- let context;
116
- const fontPath = path.join(knownFolders.currentApp().path, 'fonts');
117
- let initialized = false;
118
- export function init() {
119
- if (initialized) {
120
- return;
121
- }
122
- initialized = true;
123
- context = Utils.ad.getApplicationContext();
124
- Font.prototype.getAndroidTypeface = profile('getAndroidTypeface', function () {
125
- if (!this._typeface) {
126
- // css loader to json transform font-family: res/toto to font-family: res,toto
127
- const fontFamily = this.fontFamily?.replace(/res,/g, 'res/');
128
- const fontCacheKey = fontFamily + (this.fontWeight || '') + (this.fontStyle || '');
129
- const typeface = typefaceCache[fontCacheKey];
130
- if (!typeface) {
131
- if (!context) {
132
- context = Utils.ad.getApplicationContext();
133
- }
134
- this._typeface = typefaceCache[fontCacheKey] = com.nativescript.text.Font.createTypeface(context, fontPath, fontFamily, this.fontWeight, this.isBold, this.isItalic);
135
- }
136
- else {
137
- this._typeface = typeface;
138
- }
139
- }
140
- return this._typeface;
141
- });
142
- FormattedString.prototype.toNativeString = LightFormattedString.prototype.toNativeString = function () {
143
- return formattedStringToNativeString(this);
144
- };
145
- // const delimiter = String.fromCharCode(0x1e);
146
- Object.defineProperty(Span.prototype, 'relativeSize', {
147
- set(value) {
148
- this._relativeSize = value;
149
- this.notifyPropertyChange('relativeSize', value);
150
- },
151
- get() {
152
- return this._relativeSize;
153
- }
154
- });
155
- Span.prototype.toNativeString = function (maxFontSize) {
156
- const parent = this.parent;
157
- const grandParent = parent?.parent;
158
- return spanToNativeString(this, parent, grandParent, maxFontSize);
159
- };
160
- }
161
- export function createNativeAttributedString(data, parent, parentView, autoFontSizeEnabled = false, fontSizeRatio = 1, // used only on iOS,
162
- density // used only on Android
163
- ) {
164
- if (!context) {
165
- init();
166
- }
167
- if (data instanceof FormattedString || data instanceof LightFormattedString || data['spans']) {
168
- return com.nativescript.text.Font.stringBuilderFromFormattedString(context, fontPath, parentView?.['fontFamily'] || null, formattedStringToNativeString(data, undefined, this, density), null);
169
- }
170
- const linkColor = data.linkColor || parentView?.['linkColor'];
171
- const aLinkColor = linkColor ? android.graphics.Color.valueOf((linkColor instanceof Color ? linkColor : new Color(linkColor)).android) : null;
172
- const result = com.nativescript.text.Font.stringBuilderFromHtmlString(context, fontPath, data.familyName || parentView?.['fontFamily'] || null, data.text, (data.linkDecoration && data.linkDecoration) !== 'underline' || parentView?.['linkUnderline'] === false, aLinkColor);
173
- return result;
174
- }
175
- export function createSpannable(span, parentView, parent, maxFontSize) {
176
- const details = spanToNativeString(span, parent, parentView, maxFontSize, -1, 1);
177
- let ssb;
178
- if (details) {
179
- ssb = com.nativescript.text.Font.stringBuilderFromFormattedString(context, fontPath, parentView?.['fontFamily'] || null, `[${details}]`, span._ssb);
180
- if (span.tappable) {
181
- initializeClickableSpan();
182
- ssb.setSpan(new ClickableSpan(span), 0, length, android.text.Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
183
- }
184
- }
185
- return ssb;
186
- }
187
- //# sourceMappingURL=index.android.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.android.js","sourceRoot":"../src/","sources":["index.android.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,eAAe,EAAE,IAAI,EAAE,KAAK,EAAE,QAAQ,EAAE,YAAY,EAAE,IAAI,EAAE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AI,CAAC,IAAI,CAAC,gCAAgC,CAAC,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,CAAC,YAAY,CAAC,IAAI,IAAI,EAAE,IAAI,OAAO,GAAG,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;QACpJ,IAAI,IAAI,CAAC,QAAQ,EAAE;YACf,uBAAuB,EAAE,CAAC;YAC1B,GAAG,CAAC,OAAO,CAAC,IAAI,aAAa,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,wBAAwB,CAAC,CAAC;SAClG;KACJ;IACD,OAAO,GAAG,CAAC;AACf,CAAC"}
package/index.d.ts DELETED
@@ -1 +0,0 @@
1
- export * from './index.android';
package/index.ios.d.ts DELETED
@@ -1,30 +0,0 @@
1
- import { Color, CoreTypes, FormattedString, ViewBase } from '@nativescript/core';
2
- import { ObjectSpans } from './index-common';
3
- export * from './index-common';
4
- export declare function init(): void;
5
- export declare function createNativeAttributedString(data: {
6
- text: string;
7
- color?: Color | string | number;
8
- familyName?: string;
9
- fontSize?: number;
10
- letterSpacing?: number;
11
- lineHeight?: number;
12
- textAlignment?: NSTextAlignment | CoreTypes.TextAlignmentType;
13
- } | FormattedString | ObjectSpans, parent?: any, parentView?: ViewBase, autoFontSizeEnabled?: boolean, fontSizeRatio?: number): any;
14
- export declare function createSpannable(span: any, index: any, parentView: any, parent?: any, maxFontSize?: any, autoFontSizeEnabled?: boolean, fontSizeRatio?: number): any;
15
- export declare function createSpannableDetails(span: any, index: any, parentView: any, parent?: any, maxFontSize?: any, autoFontSizeEnabled?: boolean, fontSizeRatio?: number): {
16
- text: any;
17
- tapIndex: any;
18
- autoFontSizeEnabled: boolean;
19
- iosFont: any;
20
- realFontSize: any;
21
- fontSize: any;
22
- realMaxFontSize: number;
23
- backgroundColor: any;
24
- color: any;
25
- textDecoration: any;
26
- letterSpacing: any;
27
- lineHeight: any;
28
- verticalTextAlignment: any;
29
- textAlignment: any;
30
- };
package/index.ios.js DELETED
@@ -1,144 +0,0 @@
1
- import { Color, CoreTypes, Font, FormattedString, ViewBase, fontInternalProperty } from '@nativescript/core';
2
- import { getTransformedText } from '@nativescript/core/ui/text-base';
3
- import { getMaxFontSize, textAlignmentConverter } from './index-common';
4
- import { LightFormattedString } from './index.android';
5
- export * from './index-common';
6
- export function init() { }
7
- function _createNativeAttributedString({ text, familyName = '-apple-system', fontSize, fontWeight, letterSpacing, lineHeight, lineBreak, linkColor, linkDecoration, color, textAlignment, autoFontSizeEnabled = false, fontSizeRatio = 1, useCustomLinkTag }) {
8
- const trueFontFamily = familyName
9
- ? familyName
10
- .replace(/'/g, '')
11
- .split(',')
12
- .map((s) => `'${s}'`)
13
- .join(',')
14
- : null;
15
- // if (iOSUseDTCoreText) {
16
- let style = '';
17
- if (linkColor || linkDecoration) {
18
- style = '<style>' + `a, a:link, a:visited { ${linkColor ? `color:${linkColor.hex} !important;` : ''} text-decoration: ${linkDecoration || 'none'}; }` + '</style>';
19
- }
20
- const htmlString = style +
21
- (color || familyName || fontSize || fontWeight
22
- ? `<span style=" ${color ? `color: ${color};` : ''} ${trueFontFamily ? `font-family:${trueFontFamily};` : ''}${fontSize ? `font-size: ${fontSize * fontSizeRatio}px;` : ''}${fontWeight ? `font-weight: ${fontWeight};` : ''}">${text}</span>`
23
- : text);
24
- return NSTextUtils.createNativeHTMLAttributedString({
25
- htmlString,
26
- fontSize,
27
- fontWeight,
28
- letterSpacing,
29
- lineHeight,
30
- lineBreak,
31
- linkColor,
32
- linkDecoration,
33
- color,
34
- textAlignment,
35
- autoFontSizeEnabled,
36
- fontSizeRatio,
37
- useCustomLinkTag
38
- });
39
- }
40
- export function createNativeAttributedString(data, parent, parentView, autoFontSizeEnabled = false, fontSizeRatio = 1) {
41
- if (data instanceof FormattedString || data instanceof LightFormattedString || data['spans']) {
42
- // const ssb = NSMutableAttributedString.new();
43
- const maxFontSize = getMaxFontSize(data);
44
- // const _spanRanges = [];
45
- // let spanStart = 0;
46
- let hasLink = false;
47
- const details = [];
48
- if (!parent) {
49
- parent = data;
50
- }
51
- data['spans'].forEach((s, index) => {
52
- const spanDetails = createSpannableDetails(s, index, parentView, parent, maxFontSize, autoFontSizeEnabled, fontSizeRatio);
53
- if (spanDetails) {
54
- details.push(spanDetails);
55
- if (s._tappable) {
56
- hasLink = true;
57
- }
58
- }
59
- });
60
- if (parentView) {
61
- if (parentView['nativeTextViewProtected']) {
62
- parentView['nativeTextViewProtected'].selectable = parentView['selectable'] === true || hasLink;
63
- }
64
- if (parentView._setTappableState) {
65
- parentView._setTappableState(hasLink);
66
- }
67
- // parent['_spanRanges'] = _spanRanges;
68
- }
69
- return NSTextUtils.createNativeAttributedString({ details });
70
- // return ssb;
71
- }
72
- if (data.textAlignment && typeof data.textAlignment === 'string') {
73
- data.textAlignment = textAlignmentConverter(data.textAlignment);
74
- }
75
- // if (data.color && !(data.color instanceof Color)) {
76
- // data.color = new Color(data.color as any);
77
- // }
78
- data['autoFontSizeEnabled'] = autoFontSizeEnabled;
79
- data['fontSizeRatio'] = fontSizeRatio;
80
- return _createNativeAttributedString(data);
81
- }
82
- export function createSpannable(span, index, parentView, parent, maxFontSize, autoFontSizeEnabled = false, fontSizeRatio = 1) {
83
- const details = createSpannableDetails(span, index, parentView, parent, maxFontSize, autoFontSizeEnabled, fontSizeRatio);
84
- return details ? NSTextUtils.createNativeAttributedString({ details: [details] }) : null;
85
- }
86
- export function createSpannableDetails(span, index, parentView, parent, maxFontSize, autoFontSizeEnabled = false, fontSizeRatio = 1) {
87
- let text = span.text;
88
- if (!text || (span.visibility && span.visibility !== 'visible')) {
89
- return null;
90
- }
91
- if (!(text instanceof NSAttributedString)) {
92
- if (!(typeof text === 'string')) {
93
- text = text.toString();
94
- }
95
- if (text.indexOf('\n') !== -1) {
96
- text = text.replace(/\\n/g, '\u{2029}');
97
- }
98
- const textTransform = span.textTransform || (parent && parent.textTransform);
99
- if (textTransform) {
100
- text = getTransformedText(text, textTransform);
101
- }
102
- }
103
- const fontFamily = span.fontFamily;
104
- const fontSize = span.fontSize;
105
- let realFontSize = fontSize || (parent && parent.fontSize) || (parentView && parentView.fontSize);
106
- if (span.relativeSize) {
107
- realFontSize = ((parent && parent.fontSize) || (parentView && parentView.fontSize)) * span.relativeSize;
108
- }
109
- const realMaxFontSize = Math.max(maxFontSize, realFontSize || 0);
110
- const fontWeight = span.fontWeight;
111
- const fontstyle = span.fontStyle;
112
- const textColor = span.color || (parent && parent.color) || (parentView && !(parentView.nativeView instanceof UIButton) && parentView.color);
113
- const backgroundcolor = span.backgroundColor || (parent && parent.backgroundColor);
114
- const textDecoration = span.textDecoration || (parent && parent.textDecoration);
115
- const letterSpacing = span.letterSpacing || (parent && parent.letterSpacing);
116
- const lineHeight = span.lineHeight || (parent && parent.lineHeight);
117
- const textAlignment = span.textAlignment || (parent && parent.textAlignment) || (parentView && parentView.textAlignment);
118
- const verticalTextAlignment = span.verticalAlignment || parent?.verticalAlignment;
119
- let iosFont;
120
- if ((fontWeight && fontWeight !== 'normal') || fontstyle || fontFamily || realFontSize || fontSizeRatio !== 1) {
121
- const font = new Font(fontFamily || (parent && parent.fontFamily) || (parentView && parentView.fontFamily), realFontSize * fontSizeRatio, fontstyle || (parent && parent.fontStyle) || (parentView && parentView.fontStyle), fontWeight || (parent && parent.fontWeight) || (parentView && parentView.fontWeight));
122
- iosFont = font.getUIFont(UIFont.systemFontOfSize(realFontSize));
123
- }
124
- else {
125
- iosFont = parentView[fontInternalProperty.getDefault]();
126
- }
127
- return {
128
- text,
129
- tapIndex: span._tappable ? index : undefined,
130
- autoFontSizeEnabled,
131
- iosFont,
132
- realFontSize,
133
- fontSize: fontSize || iosFont.pointSize,
134
- realMaxFontSize,
135
- backgroundColor: backgroundcolor ? (backgroundcolor instanceof Color ? backgroundcolor.ios : new Color(backgroundcolor).ios) : null,
136
- color: textColor ? (textColor instanceof Color ? textColor.ios : new Color(textColor).ios) : null,
137
- textDecoration,
138
- letterSpacing,
139
- lineHeight,
140
- verticalTextAlignment,
141
- textAlignment
142
- };
143
- }
144
- //# sourceMappingURL=index.ios.js.map
package/index.ios.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.ios.js","sourceRoot":"../src/","sources":["index.ios.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,IAAI,EAAE,eAAe,EAAE,QAAQ,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAC7G,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AACrE,OAAO,EAAe,cAAc,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AACrF,OAAO,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AACvD,cAAc,gBAAgB,CAAC;AAE/B,MAAM,UAAU,IAAI,KAAI,CAAC;AAEzB,SAAS,6BAA6B,CAAC,EACnC,IAAI,EACJ,UAAU,GAAG,eAAe,EAC5B,QAAQ,EACR,UAAU,EACV,aAAa,EACb,UAAU,EACV,SAAS,EACT,SAAS,EACT,cAAc,EACd,KAAK,EACL,aAAa,EACb,mBAAmB,GAAG,KAAK,EAC3B,aAAa,GAAG,CAAC,EACjB,gBAAgB,EAgBnB;IACG,MAAM,cAAc,GAAG,UAAU;QAC7B,CAAC,CAAC,UAAU;aACL,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC;aACjB,KAAK,CAAC,GAAG,CAAC;aACV,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC;aACpB,IAAI,CAAC,GAAG,CAAC;QAChB,CAAC,CAAC,IAAI,CAAC;IAEX,0BAA0B;IAC1B,IAAI,KAAK,GAAG,EAAE,CAAC;IACf,IAAI,SAAS,IAAI,cAAc,EAAE;QAC7B,KAAK,GAAG,SAAS,GAAG,0BAA0B,SAAS,CAAC,CAAC,CAAC,SAAS,SAAS,CAAC,GAAG,cAAc,CAAC,CAAC,CAAC,EAAE,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,CAAC,CAAC,SAAS,YAAY,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,SAAS,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI;QACjG,cAAc;QACd,aAAa;QACb,UAAU;QACV,qBAAqB;QACrB,aAAa;KAChB,CAAC;AACN,CAAC"}
package/references.d.ts DELETED
@@ -1,3 +0,0 @@
1
- /// <reference path="./typings/android.d.ts" />
2
- /// <reference path="./typings/ios.d.ts" />
3
- /// <reference path="../../node_modules/@nativescript/types-ios/lib/ios/objc-x86_64/objc!CoreText.d.ts" />
@@ -1,22 +0,0 @@
1
- declare let DTDefaultTextAlignment: string;
2
- declare let DTDefaultFontStyle: string;
3
- declare let DTIgnoreLinkStyleOption: string;
4
- declare let DTDefaultFontFamily: string;
5
- declare let DTUseiOS6Attributes: string;
6
- declare let DTDocumentPreserveTrailingSpaces: string;
7
- declare let DTDefaultLineBreakMode: string;
8
- declare let NSTextSizeMultiplierDocumentOption: string;
9
- declare let kCTLineBreakByWordWrapping: string;
10
- declare let kCTLeftTextAlignment: string;
11
- declare let NSAttributedStringEnumerationReverse: number;
12
-
13
- declare namespace DTCoreTextFontDescriptor {
14
- function asyncPreloadFontLookupTable();
15
- }
16
-
17
- declare interface NSAttributedString {
18
- initWithHTMLDataOptionsDocumentAttributes(data, options, attr);
19
- }
20
- declare interface NSMutableAttributedString {
21
- initWithHTMLDataOptionsDocumentAttributes(data, options, attr);
22
- }
@@ -1,56 +0,0 @@
1
- declare namespace com {
2
- export namespace nativescript {
3
- export namespace text {
4
- export class CustomTypefaceSpan extends globalAndroid.text.style.TypefaceSpan {
5
- constructor(family: string, typeface: globalAndroid.graphics.Typeface);
6
- }
7
- export class CustomBackgroundSpan extends globalAndroid.text.style.ReplacementSpan {
8
- constructor(radius: number, fillColor: number, strokeColor: number, strokeWidth: number);
9
- }
10
- export class BaselineAdjustedSpan extends globalAndroid.text.style.CharacterStyle {
11
- constructor(fontSize: number, align: string, maxFontSize: number);
12
- }
13
- export class HeightSpan extends globalAndroid.text.style.CharacterStyle {
14
- constructor(size: number);
15
- }
16
- export class URLSpanNoUnderline extends globalAndroid.text.style.URLSpan {
17
- constructor(url: string, showUnderline: boolean);
18
- }
19
-
20
- export class Font {
21
- static stringBuilderFromHtmlString(
22
- context: globalAndroid.content.Context,
23
- fontPath: string,
24
- parentFontFamily: string,
25
- text: string,
26
- disableLinkUnderline: boolean,
27
- linkColor: android.graphics.Color
28
- ): globalAndroid.text.SpannableStringBuilder;
29
- static stringBuilderFromFormattedString(
30
- context: globalAndroid.content.Context,
31
- fontPath: string,
32
- parentFontFamily: string,
33
- nativeString: string,
34
- ssp: globalAndroid.text.SpannableStringBuilder
35
- ): any;
36
- static createTypeface(
37
- context: globalAndroid.content.Context,
38
- fontFolder: string,
39
- fontFamily: string,
40
- fontWeight: string,
41
- isBold: boolean,
42
- isItalic: boolean
43
- ): globalAndroid.graphics.Typeface;
44
- }
45
- export class URLSpanClickListener {
46
- constructor(impl?: { onClick(span: android.text.style.URLSpan) });
47
- onClick(span: android.text.style.URLSpan);
48
- }
49
-
50
- export class TextView extends androidx.appcompat.widget.AppCompatTextView {
51
- urlSpanClickListener: URLSpanClickListener;
52
- static attributedStringHasSpan(attributeString: android.text.Spannable, spanClass: sjava.lang.Class<any>): boolean;
53
- }
54
- }
55
- }
56
- }
package/typings/ios.d.ts DELETED
@@ -1,14 +0,0 @@
1
- declare class NSTextUtils extends NSObject {
2
-
3
- static alloc(): NSTextUtils; // inherited from NSObject
4
-
5
- static computeBaseLineOffsetWithAlignFontAscentFontDescentFontBottomFontTopFontSizeMaxFontSize(align: string, fontAscent: number, fontDescent: number, fontBottom: number, fontTop: number, fontSize: number, maxFontSize: number): number;
6
-
7
- static createNativeAttributedStringWithData(data: NSDictionary<any, any>): NSMutableAttributedString;
8
-
9
- static createNativeHTMLAttributedStringWithData(data: NSDictionary<any, any>): NSMutableAttributedString;
10
-
11
- static new(): NSTextUtils; // inherited from NSObject
12
-
13
- static setTextDecorationAndTransformOnViewTextTextDecorationLetterSpacingLineHeightColor(view: UIView, text: string, textDecoration: string, letterSpacing: number, lineHeight: number, color: UIColor): void;
14
- }