craft-native 0.0.350 → 0.0.352

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.
@@ -212,6 +212,24 @@ private data class CraftNativeLength(
212
212
  }
213
213
  }
214
214
 
215
+ /** A screen root owns its viewport unless the document explicitly sizes it.
216
+ * Keep this parent constraint out of the protocol document, and apply it to
217
+ * targeted style updates too. An unstyled fragment with flex children would
218
+ * otherwise measure at their zero flex bases and collapse the entire screen. */
219
+ internal fun craftNativeScreenRootStyle(style: JSONObject): JSONObject {
220
+ val rootStyle = JSONObject()
221
+ val keys = style.keys()
222
+ while (keys.hasNext()) {
223
+ val key = keys.next()
224
+ rootStyle.put(key, style.opt(key))
225
+ }
226
+ if (rootStyle.isNull("height")) {
227
+ if (rootStyle.isNull("flex")) rootStyle.put("flex", 1)
228
+ rootStyle.put("height", "100%")
229
+ }
230
+ return rootStyle
231
+ }
232
+
215
233
  private data class CraftNativeLayoutStyle(
216
234
  val width: CraftNativeLength? = null,
217
235
  val height: CraftNativeLength? = null,
@@ -1132,14 +1150,23 @@ internal class CraftNativeFlexLayout(context: Context) : LinearLayout(context) {
1132
1150
  invalidateMeasurements()
1133
1151
  }
1134
1152
 
1153
+ private var viewportChild: View? = null
1154
+
1155
+ fun setViewportChild(view: View?) {
1156
+ viewportChild = view
1157
+ invalidateMeasurements()
1158
+ }
1159
+
1135
1160
  fun setChildStyle(view: View, style: JSONObject, density: Float) {
1136
- styles[view] = CraftNativeLayoutStyle.from(style, density)
1161
+ val effective = if (view === viewportChild) craftNativeScreenRootStyle(style) else style
1162
+ styles[view] = CraftNativeLayoutStyle.from(effective, density)
1137
1163
  invalidateMeasurements()
1138
1164
  invalidateMeasurementAncestors(parent)
1139
1165
  }
1140
1166
 
1141
1167
  override fun onViewRemoved(child: View) {
1142
1168
  val parentBeforeRemoval = parent
1169
+ if (child === viewportChild) viewportChild = null
1143
1170
  styles.remove(child)
1144
1171
  super.onViewRemoved(child)
1145
1172
  invalidateMeasurements()
@@ -5434,6 +5461,7 @@ class MainActivity : AppCompatActivity() {
5434
5461
  screen.controls.clear()
5435
5462
  screen.controls.putAll(next)
5436
5463
  screen.handlers.keys.retainAll(retainedViews(screen))
5464
+ screen.view.setViewportChild(tree)
5437
5465
  screen.view.setChildStyle(tree, document.optJSONObject("style") ?: JSONObject(), resources.displayMetrics.density)
5438
5466
  promoteModalOverlays(screen)
5439
5467
  updateSafeAreaViews()
package/dist/cli.js CHANGED
@@ -356,7 +356,19 @@ async function packageMacOS(config, outDir) {
356
356
  results.push({ success: true, platform: "macos", format: "app", outputPath: appBundlePath });
357
357
  if (opts.dmg !== false) {
358
358
  const outputPath = join2(outDir, `${name}-${version}.dmg`);
359
- const dmgResult = await createDMG({ appBundlePath, outputPath, volumeName: name });
359
+ let dmgResult = await createDMG({ appBundlePath, outputPath, volumeName: name });
360
+ if (dmgResult.success && opts.signIdentity) {
361
+ const signed = await runTool("codesign", codesignArguments({
362
+ path: outputPath,
363
+ identity: opts.signIdentity,
364
+ keychain: opts.signingKeychain,
365
+ hardenedRuntime: false,
366
+ deep: false
367
+ }));
368
+ const verified = signed.success ? await runTool("codesign", ["--verify", "--strict", outputPath]) : signed;
369
+ if (!verified.success)
370
+ dmgResult = { success: false, error: verified.error };
371
+ }
360
372
  results.push({
361
373
  success: dmgResult.success,
362
374
  platform: "macos",
@@ -3035,7 +3047,7 @@ function pinCraftNativeDependency(packagePath, craftVersion) {
3035
3047
  `);
3036
3048
  }
3037
3049
  // package.json
3038
- var version = "0.0.350";
3050
+ var version = "0.0.352";
3039
3051
 
3040
3052
  // bin/cli.ts
3041
3053
  var spawnedFrom = process6.env[CRAFT_CLI_SPAWN_MARKER];
package/dist/index.cjs CHANGED
@@ -375,7 +375,7 @@ function craftBinaryNotFoundMessage(triedPath) {
375
375
  `);
376
376
  }
377
377
  // package.json
378
- var version = "0.0.350";
378
+ var version = "0.0.352";
379
379
 
380
380
  // src/sdk-version.ts
381
381
  var SDK_VERSION = version;
@@ -722,7 +722,19 @@ async function packageMacOS(config, outDir) {
722
722
  results.push({ success: true, platform: "macos", format: "app", outputPath: appBundlePath });
723
723
  if (opts.dmg !== false) {
724
724
  const outputPath = import_path.join(outDir, `${name}-${version}.dmg`);
725
- const dmgResult = await createDMG({ appBundlePath, outputPath, volumeName: name });
725
+ let dmgResult = await createDMG({ appBundlePath, outputPath, volumeName: name });
726
+ if (dmgResult.success && opts.signIdentity) {
727
+ const signed = await runTool("codesign", codesignArguments({
728
+ path: outputPath,
729
+ identity: opts.signIdentity,
730
+ keychain: opts.signingKeychain,
731
+ hardenedRuntime: false,
732
+ deep: false
733
+ }));
734
+ const verified = signed.success ? await runTool("codesign", ["--verify", "--strict", outputPath]) : signed;
735
+ if (!verified.success)
736
+ dmgResult = { success: false, error: verified.error };
737
+ }
726
738
  results.push({
727
739
  success: dmgResult.success,
728
740
  platform: "macos",
package/dist/index.js CHANGED
@@ -117,7 +117,7 @@ function craftBinaryNotFoundMessage(triedPath) {
117
117
  `);
118
118
  }
119
119
  // package.json
120
- var version = "0.0.350";
120
+ var version = "0.0.352";
121
121
 
122
122
  // src/sdk-version.ts
123
123
  var SDK_VERSION = version;
@@ -478,7 +478,19 @@ async function packageMacOS(config, outDir) {
478
478
  results.push({ success: true, platform: "macos", format: "app", outputPath: appBundlePath });
479
479
  if (opts.dmg !== false) {
480
480
  const outputPath = join2(outDir, `${name}-${version}.dmg`);
481
- const dmgResult = await createDMG({ appBundlePath, outputPath, volumeName: name });
481
+ let dmgResult = await createDMG({ appBundlePath, outputPath, volumeName: name });
482
+ if (dmgResult.success && opts.signIdentity) {
483
+ const signed = await runTool("codesign", codesignArguments({
484
+ path: outputPath,
485
+ identity: opts.signIdentity,
486
+ keychain: opts.signingKeychain,
487
+ hardenedRuntime: false,
488
+ deep: false
489
+ }));
490
+ const verified = signed.success ? await runTool("codesign", ["--verify", "--strict", outputPath]) : signed;
491
+ if (!verified.success)
492
+ dmgResult = { success: false, error: verified.error };
493
+ }
482
494
  results.push({
483
495
  success: dmgResult.success,
484
496
  platform: "macos",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "craft-native",
3
- "version": "0.0.350",
3
+ "version": "0.0.352",
4
4
  "type": "module",
5
5
  "description": "Build desktop apps with web languages - TypeScript SDK for Craft",
6
6
  "author": "Chris Breuer <chris@stacksjs.org>",