@triniwiz/nativescript-masonkit 1.0.0-alpha.33 → 1.0.0-alpha.35

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.
Files changed (33) hide show
  1. package/common.d.ts +9 -8
  2. package/common.js +95 -153
  3. package/common.js.map +1 -1
  4. package/package.json +4 -1
  5. package/platforms/android/masonkit-release.aar +0 -0
  6. package/platforms/ios/Mason.xcframework/ios-arm64/Mason.framework/Modules/Mason.swiftmodule/arm64-apple-ios.abi.json +1555 -6183
  7. package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Modules/Mason.swiftmodule/arm64-apple-ios-simulator.abi.json +1555 -6183
  8. package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Modules/Mason.swiftmodule/x86_64-apple-ios-simulator.abi.json +1555 -6183
  9. package/scroll/index.android.d.ts +0 -1
  10. package/scroll/index.android.js +3 -33
  11. package/scroll/index.android.js.map +1 -1
  12. package/scroll/index.ios.d.ts +0 -2
  13. package/scroll/index.ios.js +1 -35
  14. package/scroll/index.ios.js.map +1 -1
  15. package/style.d.ts +14 -7
  16. package/style.js +157 -188
  17. package/style.js.map +1 -1
  18. package/text/index.android.js +3 -21
  19. package/text/index.android.js.map +1 -1
  20. package/text/index.ios.d.ts +0 -2
  21. package/text/index.ios.js +6 -48
  22. package/text/index.ios.js.map +1 -1
  23. package/tree/index.android.js +14 -12
  24. package/tree/index.android.js.map +1 -1
  25. package/utils/index.android.d.ts +2 -2
  26. package/utils/index.android.js +0 -79
  27. package/utils/index.android.js.map +1 -1
  28. package/view/index.android.d.ts +0 -1
  29. package/view/index.android.js +1 -32
  30. package/view/index.android.js.map +1 -1
  31. package/view/index.ios.d.ts +0 -1
  32. package/view/index.ios.js +1 -32
  33. package/view/index.ios.js.map +1 -1
package/style.js CHANGED
@@ -1,6 +1,5 @@
1
1
  import { layout } from '@nativescript/core/utils';
2
2
  import { Length as CoreLength } from '@nativescript/core';
3
- import { _setGridAutoRows, _setGridAutoColumns, _parseGridLine, _parseGridTemplates, _setGridTemplateColumns, _setGridTemplateRows, _getGridTemplateRows, _getGridTemplateColumns } from './utils';
4
3
  var StyleKeys;
5
4
  (function (StyleKeys) {
6
5
  StyleKeys[StyleKeys["DISPLAY"] = 0] = "DISPLAY";
@@ -280,6 +279,7 @@ export class Style {
280
279
  //console.time('fromView');
281
280
  const ret = new Style();
282
281
  ret.view_ = view;
282
+ ret.nativeView = nativeView;
283
283
  if (__ANDROID__) {
284
284
  let style = nativeView?.getStyle?.();
285
285
  if (!style) {
@@ -1882,24 +1882,28 @@ export class Style {
1882
1882
  this.setOrAppendState(StateKeys.JUSTIFY_CONTENT);
1883
1883
  }
1884
1884
  get gridAutoRows() {
1885
- return '';
1885
+ if (!this.nativeView) {
1886
+ return '';
1887
+ }
1888
+ return org.nativescript.mason.masonkit.NodeHelper.getShared().getGridAutoRows(this.nativeView);
1886
1889
  }
1887
1890
  set gridAutoRows(value) {
1888
- if (typeof value === 'string') {
1889
- _setGridAutoRows(value, this.view_);
1890
- }
1891
- else {
1891
+ if (!this.nativeView) {
1892
+ return;
1892
1893
  }
1894
+ org.nativescript.mason.masonkit.NodeHelper.getShared().setGridAutoRows(this.nativeView, value);
1893
1895
  }
1894
1896
  get gridAutoColumns() {
1895
- return '';
1897
+ if (!this.nativeView) {
1898
+ return '';
1899
+ }
1900
+ return org.nativescript.mason.masonkit.NodeHelper.getShared().getGridAutoColumns(this.nativeView);
1896
1901
  }
1897
1902
  set gridAutoColumns(value) {
1898
- if (typeof value === 'string') {
1899
- _setGridAutoColumns(value, this.view_);
1900
- }
1901
- else {
1903
+ if (!this.nativeView) {
1904
+ return;
1902
1905
  }
1906
+ org.nativescript.mason.masonkit.NodeHelper.getShared().setGridAutoColumns(this.nativeView, value);
1903
1907
  }
1904
1908
  get gridAutoFlow() {
1905
1909
  switch (getInt32(this.style_view, StyleKeys.GRID_AUTO_FLOW)) {
@@ -1942,231 +1946,174 @@ export class Style {
1942
1946
  set gridColumnGap(value) {
1943
1947
  this.columnGap = value;
1944
1948
  }
1945
- // gridArea: string;
1949
+ set gridColumn(value) {
1950
+ if (!this.nativeView) {
1951
+ return;
1952
+ }
1953
+ if (__ANDROID__) {
1954
+ org.nativescript.mason.masonkit.NodeHelper.getShared().setGridColumn(this.nativeView, value);
1955
+ }
1956
+ }
1946
1957
  get gridColumn() {
1947
- if (this.gridColumnStart === this.gridColumnEnd) {
1948
- return `${this.gridColumnStart}`;
1958
+ if (!this.nativeView) {
1959
+ return '';
1960
+ }
1961
+ if (__ANDROID__) {
1962
+ return org.nativescript.mason.masonkit.NodeHelper.getShared().getGridColumn(this.nativeView);
1949
1963
  }
1950
- return `${this.gridColumnStart} / ${this.gridColumnEnd}`;
1964
+ return '';
1951
1965
  }
1952
1966
  get gridColumnStart() {
1953
- switch (getInt32(this.style_view, StyleKeys.GRID_COLUMN_START_TYPE)) {
1954
- case 0:
1955
- return 'auto';
1956
- case 1: {
1957
- const value = getInt16(this.style_view, StyleKeys.GRID_COLUMN_START_VALUE);
1958
- // if (value === 1) {
1959
- // return 'auto';
1960
- // }
1961
- return `${value}`;
1962
- }
1963
- case 2: {
1964
- const value = getInt16(this.style_view, StyleKeys.GRID_COLUMN_START_VALUE);
1965
- if (value === 0) {
1966
- return 'span';
1967
- }
1968
- return `span ${value}`;
1969
- }
1967
+ if (!this.nativeView) {
1968
+ return '';
1969
+ }
1970
+ if (__ANDROID__) {
1971
+ return org.nativescript.mason.masonkit.NodeHelper.getShared().getGridColumnStart(this.nativeView);
1970
1972
  }
1973
+ return '';
1971
1974
  }
1972
1975
  set gridColumnStart(value) {
1973
- const line = _parseGridLine(value);
1974
- if (line === null) {
1976
+ if (!this.nativeView) {
1975
1977
  return;
1976
1978
  }
1977
- switch (line.type) {
1978
- case 'auto':
1979
- case 0:
1980
- setInt32(this.style_view, StyleKeys.GRID_COLUMN_START_TYPE, 0);
1981
- setInt16(this.style_view, StyleKeys.GRID_COLUMN_START_VALUE, 1);
1982
- break;
1983
- case 'line':
1984
- case 1:
1985
- if (line.value !== undefined) {
1986
- setInt32(this.style_view, StyleKeys.GRID_COLUMN_START_TYPE, 1);
1987
- setInt16(this.style_view, StyleKeys.GRID_COLUMN_START_VALUE, line.value);
1988
- }
1989
- break;
1990
- case 'span':
1991
- case 2:
1992
- if (line.value !== undefined) {
1993
- setInt32(this.style_view, StyleKeys.GRID_COLUMN_START_TYPE, 2);
1994
- setInt16(this.style_view, StyleKeys.GRID_COLUMN_START_VALUE, line.value);
1995
- }
1996
- break;
1979
+ if (__ANDROID__) {
1980
+ org.nativescript.mason.masonkit.NodeHelper.getShared().setGridColumnStart(this.nativeView, value);
1997
1981
  }
1998
- this.setOrAppendState(StateKeys.GRID_COLUMN);
1999
1982
  }
2000
1983
  get gridColumnEnd() {
2001
- switch (getInt32(this.style_view, StyleKeys.GRID_COLUMN_END_TYPE)) {
2002
- case 0:
2003
- return 'auto';
2004
- case 1: {
2005
- const value = getInt16(this.style_view, StyleKeys.GRID_COLUMN_END_VALUE);
2006
- // if (value === 1) {
2007
- // return 'auto';
2008
- // }
2009
- return `${value}`;
2010
- }
2011
- case 2: {
2012
- const value = getInt16(this.style_view, StyleKeys.GRID_COLUMN_END_VALUE);
2013
- if (value === 0) {
2014
- return 'span';
2015
- }
2016
- return `span ${value}`;
2017
- }
1984
+ if (!this.nativeView) {
1985
+ return '';
2018
1986
  }
1987
+ if (__ANDROID__) {
1988
+ return org.nativescript.mason.masonkit.NodeHelper.getShared().getGridColumnEnd(this.nativeView);
1989
+ }
1990
+ return '';
2019
1991
  }
2020
1992
  set gridColumnEnd(value) {
2021
- const line = _parseGridLine(value);
2022
- if (line === null) {
1993
+ if (!this.nativeView) {
2023
1994
  return;
2024
1995
  }
2025
- switch (line.type) {
2026
- case 'auto':
2027
- case 0:
2028
- setInt32(this.style_view, StyleKeys.GRID_COLUMN_END_TYPE, 0);
2029
- setInt16(this.style_view, StyleKeys.GRID_COLUMN_END_VALUE, 1);
2030
- break;
2031
- case 'line':
2032
- case 1:
2033
- if (line.value !== undefined) {
2034
- setInt32(this.style_view, StyleKeys.GRID_COLUMN_END_TYPE, 1);
2035
- setInt16(this.style_view, StyleKeys.GRID_COLUMN_END_VALUE, line.value);
2036
- }
2037
- break;
2038
- case 'span':
2039
- case 2:
2040
- if (line.value !== undefined) {
2041
- setInt32(this.style_view, StyleKeys.GRID_COLUMN_END_TYPE, 2);
2042
- setInt16(this.style_view, StyleKeys.GRID_COLUMN_END_VALUE, line.value);
2043
- }
2044
- break;
1996
+ if (__ANDROID__) {
1997
+ org.nativescript.mason.masonkit.NodeHelper.getShared().setGridColumnEnd(this.nativeView, value);
1998
+ }
1999
+ }
2000
+ set gridRow(value) {
2001
+ if (!this.nativeView) {
2002
+ return;
2003
+ }
2004
+ if (__ANDROID__) {
2005
+ org.nativescript.mason.masonkit.NodeHelper.getShared().setGridRow(this.nativeView, value);
2045
2006
  }
2046
- this.setOrAppendState(StateKeys.GRID_COLUMN);
2047
2007
  }
2048
2008
  get gridRow() {
2049
- if (this.gridRowStart === this.gridRowEnd) {
2050
- return `${this.gridRowStart}`;
2009
+ if (!this.nativeView) {
2010
+ return '';
2051
2011
  }
2052
- return `${this.gridRowStart} / ${this.gridRowEnd}`;
2012
+ if (__ANDROID__) {
2013
+ return org.nativescript.mason.masonkit.NodeHelper.getShared().getGridRow(this.nativeView);
2014
+ }
2015
+ return '';
2053
2016
  }
2054
2017
  get gridRowStart() {
2055
- switch (getInt32(this.style_view, StyleKeys.GRID_ROW_START_TYPE)) {
2056
- case 0:
2057
- return 'auto';
2058
- case 1: {
2059
- const value = getInt16(this.style_view, StyleKeys.GRID_ROW_START_VALUE);
2060
- // if (value === 1) {
2061
- // return 'auto';
2062
- // }
2063
- return `${value}`;
2064
- }
2065
- case 2: {
2066
- const value = getInt16(this.style_view, StyleKeys.GRID_ROW_START_VALUE);
2067
- if (value === 0) {
2068
- return 'span';
2069
- }
2070
- return `span ${value}`;
2071
- }
2018
+ if (!this.nativeView) {
2019
+ return '';
2020
+ }
2021
+ if (__ANDROID__) {
2022
+ return org.nativescript.mason.masonkit.NodeHelper.getShared().getGridRowStart(this.nativeView);
2072
2023
  }
2024
+ return '';
2073
2025
  }
2074
2026
  set gridRowStart(value) {
2075
- const line = _parseGridLine(value);
2076
- if (line === null) {
2027
+ if (!this.nativeView) {
2077
2028
  return;
2078
2029
  }
2079
- switch (line.type) {
2080
- case 'auto':
2081
- case 0:
2082
- setInt32(this.style_view, StyleKeys.GRID_ROW_START_TYPE, 0);
2083
- setInt16(this.style_view, StyleKeys.GRID_ROW_START_VALUE, 1);
2084
- break;
2085
- case 'line':
2086
- case 1:
2087
- if (line.value !== undefined) {
2088
- setInt32(this.style_view, StyleKeys.GRID_ROW_START_TYPE, 1);
2089
- setInt16(this.style_view, StyleKeys.GRID_ROW_START_VALUE, line.value);
2090
- }
2091
- break;
2092
- case 'span':
2093
- case 2:
2094
- if (line.value !== undefined) {
2095
- setInt32(this.style_view, StyleKeys.GRID_ROW_START_TYPE, 2);
2096
- setInt16(this.style_view, StyleKeys.GRID_ROW_START_VALUE, line.value);
2097
- }
2098
- break;
2030
+ if (__ANDROID__) {
2031
+ org.nativescript.mason.masonkit.NodeHelper.getShared().setGridRowStart(this.nativeView, value);
2099
2032
  }
2100
- this.setOrAppendState(StateKeys.GRID_ROW);
2101
2033
  }
2102
2034
  get gridRowEnd() {
2103
- switch (getInt32(this.style_view, StyleKeys.GRID_ROW_END_TYPE)) {
2104
- case 0:
2105
- return 'auto';
2106
- case 1: {
2107
- const value = getInt16(this.style_view, StyleKeys.GRID_ROW_END_VALUE);
2108
- // if (value === 1) {
2109
- // return 'auto';
2110
- // }
2111
- return `${value}`;
2112
- }
2113
- case 2: {
2114
- const value = getInt16(this.style_view, StyleKeys.GRID_ROW_END_VALUE);
2115
- if (value === 0) {
2116
- return 'span';
2117
- }
2118
- return `span ${value}`;
2119
- }
2035
+ if (!this.nativeView) {
2036
+ return '';
2120
2037
  }
2038
+ if (__ANDROID__) {
2039
+ return org.nativescript.mason.masonkit.NodeHelper.getShared().getGridRowEnd(this.nativeView);
2040
+ }
2041
+ return '';
2121
2042
  }
2122
2043
  set gridRowEnd(value) {
2123
- const line = _parseGridLine(value);
2124
- if (line === null) {
2044
+ if (!this.nativeView) {
2125
2045
  return;
2126
2046
  }
2127
- switch (line.type) {
2128
- case 'auto':
2129
- case 0:
2130
- setInt32(this.style_view, StyleKeys.GRID_ROW_END_TYPE, 0);
2131
- setInt16(this.style_view, StyleKeys.GRID_ROW_END_VALUE, 1);
2132
- break;
2133
- case 'line':
2134
- case 1:
2135
- if (line.value !== undefined) {
2136
- setInt32(this.style_view, StyleKeys.GRID_ROW_END_TYPE, 1);
2137
- setInt16(this.style_view, StyleKeys.GRID_ROW_END_VALUE, line.value);
2138
- }
2139
- break;
2140
- case 'span':
2141
- case 2:
2142
- if (line.value !== undefined) {
2143
- setInt32(this.style_view, StyleKeys.GRID_ROW_END_TYPE, 2);
2144
- setInt16(this.style_view, StyleKeys.GRID_ROW_END_VALUE, line.value);
2145
- }
2146
- break;
2047
+ if (__ANDROID__) {
2048
+ org.nativescript.mason.masonkit.NodeHelper.getShared().setGridRowEnd(this.nativeView, value);
2147
2049
  }
2148
- this.setOrAppendState(StateKeys.GRID_ROW);
2050
+ }
2051
+ set gridArea(value) {
2052
+ if (!this.nativeView) {
2053
+ return;
2054
+ }
2055
+ if (__ANDROID__) {
2056
+ org.nativescript.mason.masonkit.NodeHelper.getShared().setGridArea(this.nativeView, value);
2057
+ }
2058
+ }
2059
+ get gridArea() {
2060
+ if (!this.nativeView) {
2061
+ return '';
2062
+ }
2063
+ if (__ANDROID__) {
2064
+ return org.nativescript.mason.masonkit.NodeHelper.getShared().getGridArea(this.nativeView);
2065
+ }
2066
+ return '';
2149
2067
  }
2150
2068
  set gridTemplateRows(value) {
2151
- if (Array.isArray(value)) {
2152
- _setGridTemplateRows(value, this.view);
2069
+ if (!this.nativeView) {
2070
+ return;
2153
2071
  }
2154
- else {
2155
- _setGridTemplateRows(_parseGridTemplates(value), this.view);
2072
+ if (__ANDROID__) {
2073
+ org.nativescript.mason.masonkit.NodeHelper.getShared().setGridTemplateRows(this.nativeView, value);
2156
2074
  }
2157
2075
  }
2158
2076
  get gridTemplateRows() {
2159
- return _getGridTemplateRows(this.view);
2077
+ if (!this.nativeView) {
2078
+ return '';
2079
+ }
2080
+ if (__ANDROID__) {
2081
+ return org.nativescript.mason.masonkit.NodeHelper.getShared().getGridTemplateRows(this.nativeView);
2082
+ }
2083
+ return '';
2160
2084
  }
2161
2085
  get gridTemplateColumns() {
2162
- return _getGridTemplateColumns(this.view);
2086
+ if (!this.nativeView) {
2087
+ return '';
2088
+ }
2089
+ if (__ANDROID__) {
2090
+ return org.nativescript.mason.masonkit.NodeHelper.getShared().getGridTemplateColumns(this.nativeView);
2091
+ }
2092
+ return '';
2163
2093
  }
2164
2094
  set gridTemplateColumns(value) {
2165
- if (Array.isArray(value)) {
2166
- _setGridTemplateColumns(value, this.view);
2095
+ if (!this.nativeView) {
2096
+ return;
2167
2097
  }
2168
- else {
2169
- _setGridTemplateColumns(_parseGridTemplates(value), this.view);
2098
+ if (__ANDROID__) {
2099
+ org.nativescript.mason.masonkit.NodeHelper.getShared().setGridTemplateColumns(this.nativeView, value);
2100
+ }
2101
+ }
2102
+ get gridTemplateAreas() {
2103
+ if (!this.nativeView) {
2104
+ return '';
2105
+ }
2106
+ if (__ANDROID__) {
2107
+ return org.nativescript.mason.masonkit.NodeHelper.getShared().getGridTemplateAreas(this.nativeView);
2108
+ }
2109
+ return '';
2110
+ }
2111
+ set gridTemplateAreas(value) {
2112
+ if (!this.nativeView) {
2113
+ return;
2114
+ }
2115
+ if (__ANDROID__) {
2116
+ org.nativescript.mason.masonkit.NodeHelper.getShared().setGridTemplateAreas(this.nativeView, value);
2170
2117
  }
2171
2118
  }
2172
2119
  get overflow() {
@@ -2258,6 +2205,14 @@ export class Style {
2258
2205
  dirty = true;
2259
2206
  setInt32(this.style_view, StyleKeys.OVERFLOW_X, 2);
2260
2207
  break;
2208
+ case 'clip':
2209
+ dirty = true;
2210
+ setInt32(this.style_view, StyleKeys.OVERFLOW_X, 3);
2211
+ break;
2212
+ case 'auto':
2213
+ dirty = true;
2214
+ setInt32(this.style_view, StyleKeys.OVERFLOW_X, 4);
2215
+ break;
2261
2216
  }
2262
2217
  if (dirty) {
2263
2218
  this.setOrAppendState(StateKeys.OVERFLOW_X);
@@ -2271,6 +2226,10 @@ export class Style {
2271
2226
  return 'hidden';
2272
2227
  case 2:
2273
2228
  return 'scroll';
2229
+ case 3:
2230
+ return 'clip';
2231
+ case 4:
2232
+ return 'auto';
2274
2233
  }
2275
2234
  }
2276
2235
  set overflowY(value) {
@@ -2286,6 +2245,15 @@ export class Style {
2286
2245
  break;
2287
2246
  case 'scroll':
2288
2247
  setInt32(this.style_view, StyleKeys.OVERFLOW_Y, 2);
2248
+ org.nativescript.mason.masonkit.NodeHelper.getShared().setOverflowX(this.nativeView, org.nativescript.mason.masonkit.enums.Overflow.Scroll);
2249
+ dirty = true;
2250
+ break;
2251
+ case 'clip':
2252
+ setInt32(this.style_view, StyleKeys.OVERFLOW_Y, 3);
2253
+ dirty = true;
2254
+ break;
2255
+ case 'auto':
2256
+ setInt32(this.style_view, StyleKeys.OVERFLOW_Y, 4);
2289
2257
  dirty = true;
2290
2258
  break;
2291
2259
  }
@@ -2539,6 +2507,7 @@ export class Style {
2539
2507
  flexShrink: this.flexShrink,
2540
2508
  scrollBarWidth: this.scrollBarWidth,
2541
2509
  gap: this.gap,
2510
+ gridArea: this.gridArea,
2542
2511
  gridAutoFlow: this.gridAutoFlow,
2543
2512
  gridAutoColumns: this.gridAutoColumns,
2544
2513
  gridAutoRows: this.gridAutoRows,