nn-widgets 0.1.5 → 0.1.14

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": "nn-widgets",
3
- "version": "0.1.5",
3
+ "version": "0.1.14",
4
4
  "description": "Expo config plugin for adding native widgets (iOS WidgetKit & Android App Widgets)",
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",
@@ -1 +1 @@
1
- {"version":3,"file":"withIosWidget.d.ts","sourceRoot":"","sources":["../src/withIosWidget.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EAIb,MAAM,sBAAsB,CAAC;AAG9B,OAAO,KAAK,EACV,oBAAoB,EACpB,mBAAmB,EAEpB,MAAM,SAAS,CAAC;AA8mDjB,eAAO,MAAM,aAAa,EAAE,YAAY,CAAC,oBAAoB,CAugB5D,CAAC;AAMF,wBAAgB,eAAe,CAC7B,KAAK,EAAE,oBAAoB,EAC3B,OAAO,EAAE,MAAM,EACf,gBAAgB,EAAE,MAAM,GACvB,mBAAmB,CA2GrB;AAED,eAAe,aAAa,CAAC"}
1
+ {"version":3,"file":"withIosWidget.d.ts","sourceRoot":"","sources":["../src/withIosWidget.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EAIb,MAAM,sBAAsB,CAAC;AAG9B,OAAO,KAAK,EACV,oBAAoB,EACpB,mBAAmB,EAEpB,MAAM,SAAS,CAAC;AA4oDjB,eAAO,MAAM,aAAa,EAAE,YAAY,CAAC,oBAAoB,CAugB5D,CAAC;AAMF,wBAAgB,eAAe,CAC7B,KAAK,EAAE,oBAAoB,EAC3B,OAAO,EAAE,MAAM,EACf,gBAAgB,EAAE,MAAM,GACvB,mBAAmB,CA2GrB;AAED,eAAe,aAAa,CAAC"}
@@ -139,6 +139,15 @@ struct WidgetIconConfig {
139
139
  self.borderWidth = 0
140
140
  self.borderColor = nil
141
141
  }
142
+
143
+ init(url: String, size: CGFloat, radius: CGFloat, backgroundColor: String?, borderWidth: CGFloat, borderColor: String?) {
144
+ self.url = url
145
+ self.size = size
146
+ self.radius = radius
147
+ self.backgroundColor = backgroundColor
148
+ self.borderWidth = borderWidth
149
+ self.borderColor = borderColor
150
+ }
142
151
  }
143
152
 
144
153
  struct WidgetTextConfig {
@@ -927,24 +936,24 @@ struct ${w.name}Provider: TimelineProvider {
927
936
 
928
937
  struct ${w.name}FlexCell: View {
929
938
  let item: WidgetListItem
939
+ let cellRatio: Double
930
940
  let defaultTitleColor: Color
931
941
  let defaultDescColor: Color
932
942
  let defaultAccentColor: Color
933
943
 
934
- // Determine display mode based on item data:
935
- // - hasRightIconOrDesc: show as list row (horizontal)
936
- // - hasTitle: show as card (icon top, title bottom)
937
- // - else: icon only
938
- private var isListMode: Bool {
939
- item.rightIcon != nil || item.description != nil
944
+ // Display mode based on cell ratio:
945
+ // - ratio == 1.0: list row style (icon left, text right)
946
+ // - ratio < 1.0: card style (icon top, text bottom)
947
+ private var isFullWidth: Bool {
948
+ cellRatio >= 1.0
940
949
  }
941
950
 
942
951
  private var isIconOnly: Bool {
943
- item.title.text.isEmpty && !isListMode
952
+ item.title.text.isEmpty
944
953
  }
945
954
 
946
955
  var body: some View {
947
- if isListMode {
956
+ if isFullWidth {
948
957
  // List row style: [icon] [title + desc] [rightIcon]
949
958
  HStack(spacing: 8) {
950
959
  if let icon = item.icon {
@@ -989,24 +998,42 @@ struct ${w.name}FlexCell: View {
989
998
  } else if isIconOnly {
990
999
  // Icon only mode - centered in cell
991
1000
  if let icon = item.icon {
992
- WidgetIconView(config: icon, accentColor: defaultAccentColor)
1001
+ let scaledIcon = WidgetIconConfig(
1002
+ url: icon.url,
1003
+ size: icon.size * 1.3,
1004
+ radius: icon.radius * 1.3,
1005
+ backgroundColor: icon.backgroundColor,
1006
+ borderWidth: icon.borderWidth,
1007
+ borderColor: icon.borderColor
1008
+ )
1009
+ WidgetIconView(config: scaledIcon, accentColor: defaultAccentColor)
993
1010
  }
994
1011
  } else {
995
- // Card style: icon on top, title below
1012
+ // Card style: icon on top, small title below
996
1013
  VStack(spacing: 4) {
997
1014
  if let icon = item.icon {
998
- WidgetIconView(config: icon, accentColor: defaultAccentColor)
1015
+ // Scale up icon for card style (1.3x larger)
1016
+ let scaledIcon = WidgetIconConfig(
1017
+ url: icon.url,
1018
+ size: icon.size * 1.3,
1019
+ radius: icon.radius * 1.3,
1020
+ backgroundColor: icon.backgroundColor,
1021
+ borderWidth: icon.borderWidth,
1022
+ borderColor: icon.borderColor
1023
+ )
1024
+ WidgetIconView(config: scaledIcon, accentColor: defaultAccentColor)
999
1025
  }
1000
1026
 
1001
1027
  Text(item.title.text)
1002
- .font(item.title.resolvedFont(default: .caption))
1028
+ .font(item.title.resolvedFont(default: .caption2))
1003
1029
  .fontWeight(item.title.resolvedWeight(default: .medium))
1004
1030
  .foregroundColor(
1005
1031
  item.title.color != nil
1006
1032
  ? Color(hex: item.title.color!)
1007
1033
  : defaultTitleColor
1008
1034
  )
1009
- .lineLimit(1)
1035
+ .lineLimit(2)
1036
+ .multilineTextAlignment(.center)
1010
1037
  .truncationMode(.tail)
1011
1038
  }
1012
1039
  .frame(maxWidth: .infinity, maxHeight: .infinity)
@@ -1179,6 +1206,7 @@ struct ${w.name}FlexRow: View {
1179
1206
  @ViewBuilder
1180
1207
  private func cellView(colIndex: Int, width: CGFloat) -> some View {
1181
1208
  let index = getItemIndex(rowIndex: rowIndex, colIndex: colIndex)
1209
+ let cellRatio = rowRatios[colIndex]
1182
1210
  let verticalAlignment: Alignment = {
1183
1211
  switch alignItems {
1184
1212
  case .flexStart: return .top
@@ -1193,6 +1221,7 @@ struct ${w.name}FlexRow: View {
1193
1221
  Link(destination: url) {
1194
1222
  ${w.name}FlexCell(
1195
1223
  item: item,
1224
+ cellRatio: cellRatio,
1196
1225
  defaultTitleColor: titleColor,
1197
1226
  defaultDescColor: subtitleColor,
1198
1227
  defaultAccentColor: accentColor
@@ -1202,6 +1231,7 @@ struct ${w.name}FlexRow: View {
1202
1231
  } else {
1203
1232
  ${w.name}FlexCell(
1204
1233
  item: item,
1234
+ cellRatio: cellRatio,
1205
1235
  defaultTitleColor: titleColor,
1206
1236
  defaultDescColor: subtitleColor,
1207
1237
  defaultAccentColor: accentColor