@gjsify/adwaita-nativescript 0.64.1-next.241 → 0.64.1-next.243
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.
|
@@ -1 +1,2 @@
|
|
|
1
|
-
import"../_virtual/_rolldown/runtime.js";import{xmlBoolean as e,xmlNumber as t}from"./xml-values.js";import{applyConstructProps as n}from"./construct-props.js";import{
|
|
1
|
+
import"../_virtual/_rolldown/runtime.js";import{xmlBoolean as e,xmlNumber as t}from"./xml-values.js";import{applyConstructProps as n}from"./construct-props.js";import{androidApiLevel as r}from"./native-tooltip.js";import{withSignals as i}from"./signals.js";import{classNameWith as a,normalizeStyleClasses as o,withCssClass as s,withoutCssClass as c}from"./style-classes.js";import{DEFAULT_LABEL_LINES as l,DEFAULT_LABEL_XALIGN as u,LABEL_JUSTIFICATIONS as d,labelDisplayText as f,labelEffectiveLines as p,labelEllipsizeOverflowValue as m,normalizeLabelEllipsize as h,normalizeLabelLines as g,normalizeLabelXalign as _}from"@gjsify/adwaita-core";import{Label as v}from"@nativescript/core";const y=new Map([[0,`start`],[.5,`center`],[1,`end`]]),b={left:`start`,right:`end`,center:`center`,fill:`start`};function physical(e,t){return e===`center`?`center`:e===`start`===t?`right`:`left`}var GtkLabel=class extends i(v){static GTypeName=`GtkLabel`;_label=``;_useMarkup=!1;_useUnderline=!1;_ellipsize=`none`;_lines=-1;_styleClasses=[];_xalign=u;_xalignWritten=!1;_justify=`left`;_selectable=!1;constructor(e){super(),this.addEventListener(`loaded`,()=>{this._applySelectable(),this._applyJustificationMode()}),n(this,e)}get label(){return this._label}set label(e){this._label=e??``,this._render()}get useMarkup(){return this._useMarkup}set useMarkup(t){this._useMarkup=e(t,this._useMarkup),this._render()}get useUnderline(){return this._useUnderline}set useUnderline(t){this._useUnderline=e(t,this._useUnderline),this._render()}get wrap(){return this.textWrap}set wrap(t){let n=e(t,this.textWrap);this._applyAlignment({wrap:n}),this.textWrap=n}get ellipsize(){return this._ellipsize}set ellipsize(e){this._ellipsize=h(e),this.textOverflow=m(this._ellipsize),this._applyLines()}get lines(){return this._lines}set lines(e){this._lines=g(t(e,l)),this._applyLines()}get selectable(){return this._selectable}set selectable(t){this._selectable=e(t,this._selectable),this._applySelectable()}_applySelectable(){this.nativeViewProtected?.setTextIsSelectable?.(this._selectable)}_applyLines(){this.maxLines=p(this._lines,this._ellipsize)??0}get justify(){return this._justify}set justify(e){let n=d.includes(e)?e:d[t(e,-1)];if(n===void 0)throw TypeError(`'${String(e)}' is not a Gtk.Justification, so it cannot be 'justify'. The members are ${d.join(`, `)}, or their values 0 to 3.`);this._applyAlignment({justify:n})}get xalign(){return this._xalign}set xalign(e){let n=_(t(e,u));if(!y.has(n))throw TypeError(`Gtk.Label xalign ${n} has no NativeScript counterpart: textAlignment places text at the start, the centre or the end, so only 0, 0.5 and 1 render as written. Snapping it would show a different label than GTK does with no sign of the difference.`);this._applyAlignment({xalign:n})}_applyAlignment(e){let t=e.xalign??(this._xalignWritten?this._xalign:null),n=e.justify??this._justify,r=e.text??this.text??``,i=(e.wrap??this.textWrap)||r.includes(`
|
|
2
|
+
`),a=b[n],o=t===null?null:y.get(t),s;if(o===null)s=n===`left`?null:a;else if(o===a||!i||n===`left`)s=o;else throw TypeError(`Gtk.Label justify ${n} beside xalign ${t} has no NativeScript counterpart on a label that can show several lines: GTK places the text block at its ${o} and aligns the lines inside it to their ${a}, and textAlignment is one alignment for both. An xalign on the justify edge, or a label without wrap and newline, renders exactly.`);if(e.xalign!==void 0&&(this._xalign=e.xalign,this._xalignWritten=!0),e.justify!==void 0&&(this._justify=e.justify),s===null){(e.xalign!==void 0||e.justify!==void 0)&&(this.textAlignment=`initial`);return}let c=physical(s,this.style?.direction===`rtl`);this.textAlignment=n===`fill`&&c===`left`?`justify`:c,this._applyJustificationMode()}_applyJustificationMode(){this.textAlignment===`justify`||r()<26||this.nativeViewProtected?.setJustificationMode?.(+(this._justify===`fill`))}get styleClasses(){return[...this._styleClasses]}set styleClasses(e){this._setClasses(o(e))}get_label(){return this.label}set_label(e){this.label=e}set_markup(e){this._label=e??``,this._useMarkup=!0,this._render()}get_text(){return this.text??``}add_css_class(e){this._setClasses(s(this._styleClasses,e))}remove_css_class(e){this._setClasses(c(this._styleClasses,e))}has_css_class(e){return this._styleClasses.includes((e??``).trim())}get_css_classes(){return[...this._styleClasses]}set_css_classes(e){this._setClasses(o([...e].join(` `)))}_setClasses(e){this._styleClasses=[...e],this.className=a(``,this._styleClasses)}_render(){let e=f(this._label,this._useMarkup,this._useUnderline);this._applyAlignment({text:e}),this.text=e}};export{GtkLabel};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"../_virtual/_rolldown/runtime.js";function androidApiLevel(){return typeof android<`u`&&android?.os?.Build?.VERSION?.SDK_INT||1/0}function applyNativeTooltip(e,t,n=androidApiLevel()){if(n<26)return;let r=e.nativeViewProtected;r&&typeof r.setTooltipText==`function`&&r.setTooltipText(t===``?null:t)}export{applyNativeTooltip};
|
|
1
|
+
import"../_virtual/_rolldown/runtime.js";function androidApiLevel(){return typeof android<`u`&&android?.os?.Build?.VERSION?.SDK_INT||1/0}function applyNativeTooltip(e,t,n=androidApiLevel()){if(n<26)return;let r=e.nativeViewProtected;r&&typeof r.setTooltipText==`function`&&r.setTooltipText(t===``?null:t)}export{androidApiLevel,applyNativeTooltip};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Label } from '@nativescript/core';
|
|
2
|
-
import { type LabelEllipsizeMode } from '@gjsify/adwaita-core';
|
|
2
|
+
import { type LabelEllipsizeMode, type LabelJustification } from '@gjsify/adwaita-core';
|
|
3
3
|
import { type ConstructProps } from './construct-props.js';
|
|
4
4
|
declare const GtkLabel_base: (abstract new (...args: any[]) => {
|
|
5
5
|
connect(eventName: string, callback: (self: /*elided*/ any, data: import("@nativescript/core").EventData) => unknown): number;
|
|
@@ -59,6 +59,8 @@ export declare class GtkLabel extends GtkLabel_base {
|
|
|
59
59
|
private _lines;
|
|
60
60
|
private _styleClasses;
|
|
61
61
|
private _xalign;
|
|
62
|
+
private _xalignWritten;
|
|
63
|
+
private _justify;
|
|
62
64
|
private _selectable;
|
|
63
65
|
constructor(props?: ConstructProps<GtkLabel>);
|
|
64
66
|
/**
|
|
@@ -128,12 +130,12 @@ export declare class GtkLabel extends GtkLabel_base {
|
|
|
128
130
|
private _applySelectable;
|
|
129
131
|
private _applyLines;
|
|
130
132
|
/**
|
|
131
|
-
* `Gtk.Label:justify
|
|
132
|
-
*
|
|
133
|
-
*
|
|
133
|
+
* `Gtk.Label:justify` — how the lines align with one another; no effect on a single line.
|
|
134
|
+
* Takes a nick or the `Gtk.Justification` constant and reads back as the nick. How it shares
|
|
135
|
+
* `textAlignment` with {@link xalign}, and the one combination that throws, is in the header.
|
|
134
136
|
*/
|
|
135
|
-
get justify():
|
|
136
|
-
set justify(
|
|
137
|
+
get justify(): LabelJustification;
|
|
138
|
+
set justify(raw: LabelJustification | number | string);
|
|
137
139
|
/**
|
|
138
140
|
* `Gtk.Label:xalign` — where the text sits in the label's box, `0` the start and `1` the
|
|
139
141
|
* end. Clamped to that range as `gtk_label_set_xalign` clamps it, and painted only at the
|
|
@@ -141,6 +143,17 @@ export declare class GtkLabel extends GtkLabel_base {
|
|
|
141
143
|
*/
|
|
142
144
|
get xalign(): number;
|
|
143
145
|
set xalign(raw: number | string);
|
|
146
|
+
/**
|
|
147
|
+
* Resolve `xalign` and `justify` onto `textAlignment` for the state `next` would leave, and
|
|
148
|
+
* commit it — or throw BEFORE anything changes, so a refused write leaves the label as it was.
|
|
149
|
+
*/
|
|
150
|
+
private _applyAlignment;
|
|
151
|
+
/**
|
|
152
|
+
* FILL off NativeScript's `'justify'` word: that word also forces LEFT gravity, so an RTL
|
|
153
|
+
* FILL label sets the mode on the `TextView` itself, after the platform's `textAlignment`
|
|
154
|
+
* setter has reset it.
|
|
155
|
+
*/
|
|
156
|
+
private _applyJustificationMode;
|
|
144
157
|
/**
|
|
145
158
|
* `GtkWidget:css-classes`, spelled `styleClasses` for the reason `style-classes.ts`
|
|
146
159
|
* records: the platform owns `cssClasses` as a live `Set` and taking that name kills
|
|
@@ -1,2 +1,4 @@
|
|
|
1
|
+
/** `Build.VERSION.SDK_INT`, or `Infinity` where there is no Android runtime (nothing to gate). */
|
|
2
|
+
export declare function androidApiLevel(): number;
|
|
1
3
|
/** Push `text` onto the view's native tooltip, if the native view has one. Empty clears it. */
|
|
2
4
|
export declare function applyNativeTooltip(view: object, text: string, apiLevel?: number): void;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gjsify/adwaita-nativescript",
|
|
3
|
-
"version": "0.64.1-next.
|
|
3
|
+
"version": "0.64.1-next.243",
|
|
4
4
|
"description": "Native Adwaita widgets for the NativeScript runtime — real NativeScript components (StackLayout/GridLayout/Switch/Label) styled like Libadwaita, not a webview",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "lib/esm/index.js",
|
|
@@ -73,15 +73,15 @@
|
|
|
73
73
|
"design-system"
|
|
74
74
|
],
|
|
75
75
|
"dependencies": {
|
|
76
|
-
"@gjsify/adwaita-core": "0.64.1-next.
|
|
77
|
-
"@gjsify/adwaita-fonts": "0.64.1-next.
|
|
78
|
-
"@gjsify/adwaita-icons": "0.64.1-next.
|
|
79
|
-
"@gjsify/canvas2d-core": "0.64.1-next.
|
|
80
|
-
"@gjsify/native-platform": "0.64.1-next.
|
|
76
|
+
"@gjsify/adwaita-core": "0.64.1-next.243",
|
|
77
|
+
"@gjsify/adwaita-fonts": "0.64.1-next.243",
|
|
78
|
+
"@gjsify/adwaita-icons": "0.64.1-next.243",
|
|
79
|
+
"@gjsify/canvas2d-core": "0.64.1-next.243",
|
|
80
|
+
"@gjsify/native-platform": "0.64.1-next.243"
|
|
81
81
|
},
|
|
82
82
|
"peerDependencies": {
|
|
83
83
|
"@nativescript/core": "*",
|
|
84
|
-
"@gjsify/app-settings": "0.64.1-next.
|
|
84
|
+
"@gjsify/app-settings": "0.64.1-next.243"
|
|
85
85
|
},
|
|
86
86
|
"peerDependenciesMeta": {
|
|
87
87
|
"@nativescript/core": {
|
|
@@ -92,11 +92,11 @@
|
|
|
92
92
|
}
|
|
93
93
|
},
|
|
94
94
|
"devDependencies": {
|
|
95
|
-
"@gjsify/app-settings": "0.64.1-next.
|
|
96
|
-
"@gjsify/blueprint": "0.64.1-next.
|
|
97
|
-
"@gjsify/cli": "0.64.1-next.
|
|
98
|
-
"@gjsify/unit": "0.64.1-next.
|
|
99
|
-
"@gjsify/vite-plugin-blueprint": "0.64.1-next.
|
|
95
|
+
"@gjsify/app-settings": "0.64.1-next.243",
|
|
96
|
+
"@gjsify/blueprint": "0.64.1-next.243",
|
|
97
|
+
"@gjsify/cli": "0.64.1-next.243",
|
|
98
|
+
"@gjsify/unit": "0.64.1-next.243",
|
|
99
|
+
"@gjsify/vite-plugin-blueprint": "0.64.1-next.243",
|
|
100
100
|
"@types/node": "^25.9.2",
|
|
101
101
|
"typescript": "^6.0.3"
|
|
102
102
|
},
|
|
@@ -126,5 +126,5 @@
|
|
|
126
126
|
"url": "https://github.com/gjsify/gjsify/issues"
|
|
127
127
|
},
|
|
128
128
|
"homepage": "https://github.com/gjsify/gjsify/tree/main/packages/nativescript-bridge/adwaita#readme",
|
|
129
|
-
"gitHead": "
|
|
129
|
+
"gitHead": "f88c7b1074d454e211094963a9f4dc7d0982bf32"
|
|
130
130
|
}
|