@nstudio/nativescript-compiler-effect-ui 9.2.0-alpha.22 → 9.2.0-alpha.24

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/dist/transform.js CHANGED
@@ -106,7 +106,14 @@ export function transformEffectSource(code, fileName) {
106
106
  out = out
107
107
  .replace(/class MasonAnchor extends \(A as unknown as new \(\) => NSView & \{ followHref: \(\) => void \}\) \{/, 'class MasonAnchor extends A {')
108
108
  .replace(/CSSType\('a'\)\(MasonAnchor\);/, '')
109
- .replace(/function makeBlockElement\(tag: string\): ElementConstructor \{\s*class MasonBlockElement extends Div \{\}\s*CSSType\(tag\)\(MasonBlockElement\);\s*return MasonBlockElement as unknown as ElementConstructor;\s*\}/, `function makeBlockElement(_tag: string): ElementConstructor {\n return Div as unknown as ElementConstructor;\n}`);
109
+ .replace(/function makeBlockElement\(tag: string\): ElementConstructor \{\s*class MasonBlockElement extends Div \{\}\s*CSSType\(tag\)\(MasonBlockElement\);\s*return MasonBlockElement as unknown as ElementConstructor;\s*\}/, (fn) => preserveLines(fn, `function makeBlockElement(tag: string): ElementConstructor {\n return (masonBlockElements[tag] ?? Div) as unknown as ElementConstructor;\n}`));
110
+ // A class made per tag at run time is one class per listed tag, each its tag's CSS type (`button { … }` rules).
111
+ const tags = /const BLOCK_OVERRIDE_TAGS = \[([^\]]*)\]/.exec(out)?.[1].match(/'[a-z][a-z0-9]*'/g)?.map((t) => t.slice(1, -1)) ?? [];
112
+ if (out.includes('masonBlockElements[tag]')) {
113
+ out +=
114
+ `\n${tags.map((t) => `@CSSType('${t}')\nclass MasonBlockElement_${t} extends Div {}`).join('\n')}\n` +
115
+ `const masonBlockElements: Record<string, ElementConstructor> = { ${tags.map((t) => `${t}: MasonBlockElement_${t} as unknown as ElementConstructor`).join(', ')} };\n`;
116
+ }
110
117
  }
111
118
  if (norm.endsWith('/mason/input-native.ts')) {
112
119
  return `import type { View as NSView } from '@nativescript/core';\nexport interface NativeInputHooks { readonly onEdit: () => void; readonly onReturn: () => void; }\nexport function syncNativeInput(_view: NSView, _tag: string): void {}\nexport function setNativeInputHooks(_view: NSView, _tag: string, _hooks: NativeInputHooks): void {}\nexport function dismissKeyboard(): void {}\nexport function installTapToDismissKeyboard(_view: NSView): () => void { return () => {}; }\n`;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nstudio/nativescript-compiler-effect-ui",
3
- "version": "9.2.0-alpha.22",
3
+ "version": "9.2.0-alpha.24",
4
4
  "description": "The Effect UI adapter of @nstudio/nativescript-compiler: compiles a NativeScript app written with @effect/ui and Effect v4 into a native iOS or Android app with no JavaScript runtime.",
5
5
  "type": "module",
6
6
  "exports": {
@@ -24,7 +24,7 @@
24
24
  "directory": "packages/effect-ui"
25
25
  },
26
26
  "peerDependencies": {
27
- "@nstudio/nativescript-compiler": "9.2.0-alpha.22"
27
+ "@nstudio/nativescript-compiler": "9.2.0-alpha.24"
28
28
  },
29
29
  "nativescript": {
30
30
  "compilerAdapter": {