@nativescript-community/ui-label 1.2.15 → 1.2.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +4 -0
- package/label-common.js +1 -1
- package/label.android.d.ts +3 -3
- package/label.android.js +1 -1
- package/label.ios.js +6 -6
- package/package.json +2 -2
- package/references.d.ts +1 -0
- package/typings/DTCoreText.ios.d.ts +23 -0
- package/typings/android.d.ts +11 -0
package/CHANGELOG.md
CHANGED
@@ -3,6 +3,10 @@
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
5
5
|
|
6
|
+
## [1.2.16](https://github.com/nativescript-community/ui-label/compare/v1.2.15...v1.2.16) (2022-12-01)
|
7
|
+
|
8
|
+
**Note:** Version bump only for package @nativescript-community/ui-label
|
9
|
+
|
6
10
|
## [1.2.15](https://github.com/nativescript-community/ui-label/compare/v1.2.14...v1.2.15) (2022-11-21)
|
7
11
|
|
8
12
|
**Note:** Version bump only for package @nativescript-community/ui-label
|
package/label-common.js
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
import { cssProperty, init } from '@nativescript-community/text';
|
2
2
|
import { CSSType, Color, CssProperty, Property, Style, Label as TNLabel, booleanConverter, fontInternalProperty } from '@nativescript/core';
|
3
|
-
import { layout } from '@nativescript/core/utils/
|
3
|
+
import { layout } from '@nativescript/core/utils/layout-helper';
|
4
4
|
// declare module '@nativescript/core/ui/text-base/formatted-string' {
|
5
5
|
// interface FormattedString {
|
6
6
|
// addPropertyChangeHandler(span: Span);
|
package/label.android.d.ts
CHANGED
@@ -2,7 +2,7 @@ import { VerticalTextAlignment } from '@nativescript-community/text';
|
|
2
2
|
import { CoreTypes, FormattedString, Property, PropertyChangeData, View } from '@nativescript/core';
|
3
3
|
import { Color } from '@nativescript/core/color';
|
4
4
|
import { CSSShadow } from '@nativescript/core/ui/styling/css-shadow';
|
5
|
-
import {
|
5
|
+
import { FontStyleType, FontWeightType } from '@nativescript/core/ui/styling/font';
|
6
6
|
import { Label as LabelViewDefinition, LineBreak } from './label';
|
7
7
|
export { createNativeAttributedString, enableIOSDTCoreText } from '@nativescript-community/text';
|
8
8
|
export * from './label-common';
|
@@ -32,8 +32,8 @@ declare abstract class LabelBase extends View implements LabelViewDefinition {
|
|
32
32
|
_setTappableState(value: boolean): void;
|
33
33
|
fontFamily: string;
|
34
34
|
fontSize: number;
|
35
|
-
fontStyle:
|
36
|
-
fontWeight:
|
35
|
+
fontStyle: FontStyleType;
|
36
|
+
fontWeight: FontWeightType;
|
37
37
|
letterSpacing: number;
|
38
38
|
lineHeight: number;
|
39
39
|
lineBreak: LineBreak;
|
package/label.android.js
CHANGED
@@ -6,7 +6,7 @@ import { Length, colorProperty, fontInternalProperty, fontSizeProperty, paddingB
|
|
6
6
|
import { letterSpacingProperty, lineHeightProperty, textAlignmentProperty, textDecorationProperty, textTransformProperty, whiteSpaceProperty } from '@nativescript/core/ui/text-base';
|
7
7
|
import { maxLinesProperty } from '@nativescript/core/ui/text-base/text-base-common';
|
8
8
|
import lazy from '@nativescript/core/utils/lazy';
|
9
|
-
import { layout } from '@nativescript/core/utils/
|
9
|
+
import { layout } from '@nativescript/core/utils/layout-helper';
|
10
10
|
import { autoFontSizeProperty, lineBreakProperty, selectableProperty, textShadowProperty } from './label-common';
|
11
11
|
export { createNativeAttributedString, enableIOSDTCoreText } from '@nativescript-community/text';
|
12
12
|
export * from './label-common';
|
package/label.ios.js
CHANGED
@@ -5,8 +5,9 @@ import { borderBottomWidthProperty, borderLeftWidthProperty, borderRightWidthPro
|
|
5
5
|
import { formattedTextProperty, letterSpacingProperty, lineHeightProperty, whiteSpaceProperty } from '@nativescript/core/ui/text-base';
|
6
6
|
import { maxLinesProperty } from '@nativescript/core/ui/text-base/text-base-common';
|
7
7
|
import { isNullOrUndefined, isString } from '@nativescript/core/utils/types';
|
8
|
-
import {
|
8
|
+
import { layout } from '@nativescript/core/utils/layout-helper';
|
9
9
|
import { LabelBase, autoFontSizeProperty, htmlProperty, lineBreakProperty, linkColorProperty, linkUnderlineProperty, needFormattedStringComputation, selectableProperty, textShadowProperty } from './label-common';
|
10
|
+
import { iOSNativeHelper } from '@nativescript/core/utils';
|
10
11
|
export { createNativeAttributedString, enableIOSDTCoreText } from '@nativescript-community/text';
|
11
12
|
export * from './label-common';
|
12
13
|
const majorVersion = iOSNativeHelper.MajorVersion;
|
@@ -177,7 +178,6 @@ export class Label extends LabelBase {
|
|
177
178
|
return result.height;
|
178
179
|
}
|
179
180
|
updateTextContainerInset(applyVerticalTextAlignment = true) {
|
180
|
-
var _e, _f;
|
181
181
|
const tv = this.nativeTextViewProtected;
|
182
182
|
const top = layout.toDeviceIndependentPixels(this.effectivePaddingTop + this.effectiveBorderTopWidth);
|
183
183
|
const right = layout.toDeviceIndependentPixels(this.effectivePaddingRight + this.effectiveBorderRightWidth);
|
@@ -185,7 +185,7 @@ export class Label extends LabelBase {
|
|
185
185
|
const left = layout.toDeviceIndependentPixels(this.effectivePaddingLeft + this.effectiveBorderLeftWidth);
|
186
186
|
if (!applyVerticalTextAlignment ||
|
187
187
|
!this.verticalTextAlignment ||
|
188
|
-
(
|
188
|
+
(tv.text?.length === 0 && tv.attributedText?.length === 0)) {
|
189
189
|
tv.textContainerInset = {
|
190
190
|
top,
|
191
191
|
left,
|
@@ -301,7 +301,7 @@ export class Label extends LabelBase {
|
|
301
301
|
const span = this.formattedText.spans.getItem(i);
|
302
302
|
if (span && span.tappable) {
|
303
303
|
// if the span is found and tappable emit the linkTap event
|
304
|
-
span.notify({ eventName: Span.linkTapEvent, link: url
|
304
|
+
span.notify({ eventName: Span.linkTapEvent, link: url?.toString() });
|
305
305
|
}
|
306
306
|
break;
|
307
307
|
}
|
@@ -316,7 +316,7 @@ export class Label extends LabelBase {
|
|
316
316
|
else {
|
317
317
|
const font = this.nativeViewProtected.font;
|
318
318
|
if (!fontSize) {
|
319
|
-
fontSize = this.fontSize ||
|
319
|
+
fontSize = this.fontSize || font?.pointSize || 17;
|
320
320
|
}
|
321
321
|
const fontWeight = this.style.fontWeight;
|
322
322
|
const familyName = this.style.fontFamily || (this.style.fontInternal && this.style.fontInternal.fontFamily) || undefined;
|
@@ -324,7 +324,7 @@ export class Label extends LabelBase {
|
|
324
324
|
text: this.html,
|
325
325
|
fontSize,
|
326
326
|
familyName,
|
327
|
-
fontWeight,
|
327
|
+
fontWeight: fontWeight,
|
328
328
|
// color: this.color,
|
329
329
|
letterSpacing: this.letterSpacing,
|
330
330
|
lineHeight: this.lineHeight,
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@nativescript-community/ui-label",
|
3
|
-
"version": "1.2.
|
3
|
+
"version": "1.2.16",
|
4
4
|
"description": "Alternative to the built-in NativeScript Label but with better performance and additional features such as HTML rendering and more.",
|
5
5
|
"main": "./label",
|
6
6
|
"sideEffects": false,
|
@@ -34,5 +34,5 @@
|
|
34
34
|
"dependencies": {
|
35
35
|
"@nativescript-community/text": "^1.5.9"
|
36
36
|
},
|
37
|
-
"gitHead": "
|
37
|
+
"gitHead": "f00f8a1e5c2ba68a3fd44b9a7c5818ced99100f1"
|
38
38
|
}
|
package/references.d.ts
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
/// <reference path="./typings/DTCoreText.ios.d.ts" />
|
@@ -0,0 +1,23 @@
|
|
1
|
+
declare var DTDefaultTextAlignment: string;
|
2
|
+
declare var DTDefaultFontStyle: string;
|
3
|
+
declare var DTIgnoreLinkStyleOption: string;
|
4
|
+
declare var DTDefaultFontFamily: string;
|
5
|
+
declare var DTUseiOS6Attributes: string;
|
6
|
+
declare var DTDocumentPreserveTrailingSpaces: string;
|
7
|
+
declare var DTDefaultLineBreakMode: string;
|
8
|
+
declare var NSTextSizeMultiplierDocumentOption: string;
|
9
|
+
declare var kCTLineBreakByWordWrapping: string;
|
10
|
+
declare var kCTLeftTextAlignment: string;
|
11
|
+
declare var NSAttributedStringEnumerationReverse: number;
|
12
|
+
|
13
|
+
|
14
|
+
declare namespace DTCoreTextFontDescriptor {
|
15
|
+
function asyncPreloadFontLookupTable()
|
16
|
+
}
|
17
|
+
|
18
|
+
declare interface NSAttributedString {
|
19
|
+
initWithHTMLDataOptionsDocumentAttributes(data, options, attr);
|
20
|
+
}
|
21
|
+
declare interface NSMutableAttributedString {
|
22
|
+
initWithHTMLDataOptionsDocumentAttributes(data, options, attr);
|
23
|
+
}
|