ember-nativescript 0.1.0 → 0.2.0

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 (90) hide show
  1. package/README.md +111 -35
  2. package/dist/components/Platform.d.ts +7 -0
  3. package/dist/components/Platform.d.ts.map +1 -1
  4. package/dist/components/Platform.js +9 -2
  5. package/dist/components/Platform.js.map +1 -1
  6. package/dist/src/adapter.d.ts +3 -2
  7. package/dist/src/adapter.d.ts.map +1 -1
  8. package/dist/src/dom.js +1 -1
  9. package/dist/src/dom.js.map +1 -1
  10. package/dist/src/fake-adapter.d.ts +4 -0
  11. package/dist/src/fake-adapter.d.ts.map +1 -1
  12. package/dist/src/fake-adapter.js +12 -3
  13. package/dist/src/fake-adapter.js.map +1 -1
  14. package/dist/src/index.d.ts +2 -2
  15. package/dist/src/index.d.ts.map +1 -1
  16. package/dist/src/index.js +3 -3
  17. package/dist/src/native-view.d.ts +2 -1
  18. package/dist/src/native-view.d.ts.map +1 -1
  19. package/dist/src/native-view.js +21 -1
  20. package/dist/src/native-view.js.map +1 -1
  21. package/dist/src/nativescript-adapter.d.ts.map +1 -1
  22. package/dist/src/nativescript-adapter.js +4 -0
  23. package/dist/src/nativescript-adapter.js.map +1 -1
  24. package/dist/src/navigator.d.ts +6 -0
  25. package/dist/src/navigator.d.ts.map +1 -1
  26. package/dist/src/navigator.js +6 -1
  27. package/dist/src/navigator.js.map +1 -1
  28. package/dist/src/platform.d.ts +4 -2
  29. package/dist/src/platform.d.ts.map +1 -1
  30. package/dist/src/platform.js +2 -1
  31. package/dist/src/platform.js.map +1 -1
  32. package/dist/src/render.d.ts.map +1 -1
  33. package/dist/src/render.js.map +1 -1
  34. package/dist/src/testing-core.d.ts +147 -0
  35. package/dist/src/testing-core.d.ts.map +1 -0
  36. package/dist/src/testing-core.js +110 -0
  37. package/dist/src/testing-core.js.map +1 -0
  38. package/dist/src/testing.d.ts +38 -0
  39. package/dist/src/testing.d.ts.map +1 -0
  40. package/dist/src/testing.js +74 -0
  41. package/dist/src/testing.js.map +1 -0
  42. package/dist/src/vendor-excludes.d.ts +6 -0
  43. package/dist/src/vendor-excludes.d.ts.map +1 -0
  44. package/dist/src/vendor-excludes.js +38 -0
  45. package/dist/src/vendor-excludes.js.map +1 -0
  46. package/dist/src/vite-web.d.ts +5 -0
  47. package/dist/src/vite-web.d.ts.map +1 -0
  48. package/dist/src/vite-web.js +41 -0
  49. package/dist/src/vite-web.js.map +1 -0
  50. package/dist/src/vite.d.ts +10 -0
  51. package/dist/src/vite.d.ts.map +1 -0
  52. package/dist/src/vite.js +17 -0
  53. package/dist/src/vite.js.map +1 -0
  54. package/dist/src/vitest.d.ts +5 -0
  55. package/dist/src/vitest.d.ts.map +1 -0
  56. package/dist/src/vitest.js +24 -0
  57. package/dist/src/vitest.js.map +1 -0
  58. package/dist/src/web-adapter.d.ts +31 -0
  59. package/dist/src/web-adapter.d.ts.map +1 -0
  60. package/dist/src/web-adapter.js +701 -0
  61. package/dist/src/web-adapter.js.map +1 -0
  62. package/dist/src/web-app.d.ts +23 -0
  63. package/dist/src/web-app.d.ts.map +1 -0
  64. package/dist/src/web-app.js +53 -0
  65. package/dist/src/web-app.js.map +1 -0
  66. package/dist/src/web-core.d.ts +56 -0
  67. package/dist/src/web-core.d.ts.map +1 -0
  68. package/dist/src/web-core.js +84 -0
  69. package/dist/src/web-core.js.map +1 -0
  70. package/dist/src/web-css.d.ts +7 -0
  71. package/dist/src/web-css.d.ts.map +1 -0
  72. package/dist/src/web-css.js +118 -0
  73. package/dist/src/web-css.js.map +1 -0
  74. package/dist/src/web-host.d.ts +18 -0
  75. package/dist/src/web-host.d.ts.map +1 -0
  76. package/dist/src/web-host.js +165 -0
  77. package/dist/src/web-host.js.map +1 -0
  78. package/dist/src/web-router.d.ts +51 -0
  79. package/dist/src/web-router.d.ts.map +1 -0
  80. package/dist/src/web-router.js +83 -0
  81. package/dist/src/web-router.js.map +1 -0
  82. package/dist/src/web-styles.d.ts +4 -0
  83. package/dist/src/web-styles.d.ts.map +1 -0
  84. package/dist/src/web-styles.js +157 -0
  85. package/dist/src/web-styles.js.map +1 -0
  86. package/dist/src/web.d.ts +7 -0
  87. package/dist/src/web.d.ts.map +1 -0
  88. package/dist/src/web.js +7 -0
  89. package/dist/types/glint.d.ts +6 -1
  90. package/package.json +58 -15
package/README.md CHANGED
@@ -26,27 +26,35 @@ export default class Home extends Component<{ Args: { nav: Navigator } }> {
26
26
  }
27
27
  ```
28
28
 
29
- **Status:** everything below is tested in Node against an in-memory toolkit, typechecked against @nativescript/core,
30
- and bundles for both platforms with @nativescript/vite. **Nothing has run on a device or simulator yet**; see
31
- [Proven and unverified](#proven-and-unverified).
29
+ **Docs:** https://betocantu93.github.io/ember-nativescript/
32
30
 
33
- ## Start an app
31
+ **Status:** early (0.2). Everything below is tested in Node against an in-memory toolkit, typechecked against
32
+ @nativescript/core, and bundles for both platforms with @nativescript/vite. On iOS it runs: the demo on the simulator,
33
+ and Pace (`run/`: MapKit, the GPS, animations, navigation) on an iPhone. Android hasn't run yet, nor a release build;
34
+ see [Proven and unverified](#proven-and-unverified).
34
35
 
35
- `template/` is an app with a screen, a second one, a service and Glint set up. Until it is published on its own, copy
36
- it, then add the native resources every NativeScript app has:
36
+ **In a browser, too (experimental):** the same screens on HTML elements, each at its own URL, with the browser's back
37
+ button as back: `npm run web` in an app from the template. For links, demos and previews; native code needs a
38
+ `__WEB__` branch. See [In a browser](https://betocantu93.github.io/ember-nativescript/guide/web).
37
39
 
38
- ```bash
39
- cp -r template my-app && cd my-app && pnpm install
40
- ```
40
+ ## Start an app
41
41
 
42
42
  ```bash
43
- ns create resources --template @nativescript/template-blank-ts && cp -r resources/App_Resources . && rm -rf resources
43
+ ns create my-app --template ember-nativescript-template
44
44
  ```
45
45
 
46
46
  ```bash
47
- pnpm ios
47
+ cd my-app && ns run ios
48
48
  ```
49
49
 
50
+ The template is a small to-do app: three screens as .gts components, a recycling list, a service kept with
51
+ ApplicationSettings, Glint, and tests that run in Node (`npm test`). `ns create` gives it the app id you pass with
52
+ `--appid` and NativeScript's default App_Resources. Don't name the app's folder `app`: NativeScript names the iOS binary
53
+ after it, and the app's JavaScript goes in an `app` folder inside the bundle, so Xcode fails with "Multiple commands
54
+ produce …/app.app/app".
55
+
56
+ An app is a first screen and its services:
57
+
50
58
  ```ts
51
59
  // src/app.ts
52
60
  import { createNativeApp } from 'ember-nativescript';
@@ -56,6 +64,18 @@ import Session from './services/session.ts';
56
64
  createNativeApp({ main: Home, services: { session: Session } });
57
65
  ```
58
66
 
67
+ ```ts
68
+ // vite.config.mts
69
+ import { defineConfig } from 'vite';
70
+ import { emberConfig } from 'ember-nativescript/vite';
71
+
72
+ export default defineConfig(({ mode }) => emberConfig({ mode }));
73
+ ```
74
+
75
+ `emberConfig` is NativeScript's TypeScript config with vite-plugin-ember-gts, and keeps Ember out of the vendor bundle
76
+ that `ns run` (HMR) pre-bundles with esbuild: ember-source has no root entry, and `@ember/*` and `@glimmer/*` only
77
+ resolve through the plugin, so Ember and the packages that build on it are served module by module instead.
78
+
59
79
  `createNativeApp` makes an owner, a NativeScript `Frame` and a `Navigator`, registers the navigator as the
60
80
  `navigator` service, and shows `main` as the first screen. Services are singletons looked up lazily, as in an Ember
61
81
  app; `modules` takes an `import.meta.glob('./services/**/*.ts', { eager: true })` instead.
@@ -117,8 +137,10 @@ fadeIn = (view: StackLayout) => {
117
137
  };
118
138
  ```
119
139
 
120
- For animations, focus, scrolling to a position, a plugin's API. If the function returns another one, that runs when
121
- the element goes away.
140
+ For animations, focus, scrolling to a position, a plugin's API. The function runs once the native view exists: on a
141
+ page that is still being navigated to, that's at the view's `loaded`, so core's animations don't read an undefined
142
+ `nativeView`. If it returns another function, that runs when the element goes away. If it throws, the error is logged
143
+ and the rest of the template still renders, its `{{on}}` handlers included.
122
144
 
123
145
  ### Platforms
124
146
 
@@ -221,6 +243,39 @@ anything per item belongs on the item. `components/Contacts.gts` is a thousand c
221
243
  `components/Feed.gts` an endless feed of day headers and posts; `tests/list.test.ts` scrolls them through a fake list
222
244
  that recycles the way ListView does.
223
245
 
246
+ ## Tests without a phone
247
+
248
+ An app's screens run in Node: they render into fake views that keep their properties, children and listeners, in a
249
+ fake Frame that navigates as NativeScript's does.
250
+
251
+ ```ts
252
+ import { startApp } from 'ember-nativescript/testing';
253
+
254
+ const app = await startApp(Home, { services: { todos: Todos } });
255
+ await app.type('#draft', 'Buy milk');
256
+ await app.tap('#add');
257
+ expect(app.findAll('.todo-title')[0]!.text).toBe('Buy milk');
258
+
259
+ await app.tapRow('#list', 0);
260
+ expect(app.find('#title').text).toBe('Buy milk');
261
+ await app.back();
262
+ ```
263
+
264
+ ```ts
265
+ // vitest.config.mts
266
+ import { defineConfig } from 'vitest/config';
267
+ import { emberTestConfig } from 'ember-nativescript/vitest';
268
+
269
+ export default defineConfig(emberTestConfig());
270
+ ```
271
+
272
+ - `find` and `findAll` take `#id`, `.class` or a tag; a miss throws with the screen printed as XML (`app.page.toXML()`).
273
+ - `tap`, `type`, `fire`, `tapRow` and `back` wait for Ember to re-render, then lay out the screen's lists as the
274
+ phone's next frame would, so the rows that fit are on screen.
275
+ - `emberTestConfig` compiles .gts and decorators, and stands a stub in for @nativescript/core: its views, `isIOS`,
276
+ `Application`, and an in-memory `ApplicationSettings`. Native code (animations, the GPS, a plugin's view) doesn't run
277
+ in Node; stub it with `vi.mock`. `{{nativeView}}` callbacks get the fake view.
278
+
224
279
  ## Compared with NativeScript-Vue
225
280
 
226
281
  From NativeScript-Vue 3's features as commonly documented; not re-checked against its current documentation.
@@ -236,9 +291,9 @@ From NativeScript-Vue 3's features as commonly documented; not re-checked agains
236
291
  | Platform blocks | `<ios>`, `<android>`, `ios:` attributes | `<IOS>`, `<Android>`, `ios:` attributes |
237
292
  | Recycling list, several row kinds | `<ListView>` with `v-template` and `if` | `NativeList` with `@rows` and `@rowKind` |
238
293
  | Dependency injection | `provide`/`inject`, plugins | services and `@service`, as in any Ember app |
239
- | Tests without a device | — | a fake toolkit that runs in Node and prints the tree as XML |
294
+ | Tests without a device | — | `startApp` in Node: tap, type, navigate, lists; the tree as XML |
240
295
  | HMR that keeps state | yes | no |
241
- | Runs on devices, community, plugins | years of it | not run on a device yet |
296
+ | Runs on devices, community, plugins | years of it | runs on an iPhone; Android and community plugins untried |
242
297
 
243
298
  ## Layout
244
299
 
@@ -257,12 +312,15 @@ From NativeScript-Vue 3's features as commonly documented; not re-checked agains
257
312
  bind.ts, native-view.ts the {{bind}} and {{nativeView}} modifiers
258
313
  modifier.ts a modifier from a function, on Ember's public modifier manager API
259
314
  fake-adapter.ts in-memory views and frame for tests in Node; prints the tree as XML
315
+ testing.ts startApp(): an app on the fake views, with tap, type, back and lists laid out
316
+ testing-core.ts, vitest.ts the @nativescript/core stub, and the Vitest config that uses it
260
317
  nativescript-adapter.ts the real adapter on @nativescript/core (typechecked, not run here)
261
318
  types/glint.d.ts Glint types for native tags, attributes and events
262
319
  components/ NativeList, NativeFrame, Platform (the package); the rest are the demo's screens
263
- template/ a starter app
320
+ template/ the starter app published as ember-nativescript-template (its tests run in pnpm test)
264
321
  tests/ vitest against the fake adapter; tests/types is checked by Glint
265
- app/ the demo on @nativescript/vite, booting components/Home.gts
322
+ demo/ the demo on @nativescript/vite, booting components/Home.gts
323
+ run/ Pace, a running app: MapKit, GPS, haptics and animations from JavaScript (see run/README.md)
266
324
  ```
267
325
 
268
326
  ## Develop
@@ -290,8 +348,25 @@ listeners behind. They run in Node with no `window` or `document` global, which
290
348
  `pnpm typecheck` runs Glint, including `tests/types/elements.gts`, which checks what the native types accept and
291
349
  refuse. `pnpm build` writes `dist/` (JavaScript, declarations, the Glint types).
292
350
 
293
- `pnpm build:android` and `pnpm build:ios` bundle the demo app in `app/`. Running it needs the platform SDKs and the
294
- native resources, as in [Start an app](#start-an-app).
351
+ `pnpm test` also runs the template's tests against this source, and `pnpm typecheck` checks the template, so a
352
+ change that breaks a new app fails here.
353
+
354
+ To publish a version, raise `version` in the root package.json and the `ember-nativescript` range in
355
+ `template/package.json`, add it to CHANGELOG.md, then publish the package before the template, which depends on it. The
356
+ template's own version follows NativeScript's major (9.x), as NativeScript's templates do: `ns create --template` without
357
+ a version asks for `^<CLI major>.0.0`.
358
+
359
+ ```bash
360
+ npm publish
361
+ ```
362
+
363
+ ```bash
364
+ cd template && npm publish
365
+ ```
366
+
367
+ `pnpm build:android` and `pnpm build:ios` bundle the demo app in `demo/`, `pnpm build:run:android` and
368
+ `pnpm build:run:ios` the running app in `run/`. Running them needs the platform SDKs; `demo/` also needs the native
369
+ resources, as in [Start an app](#start-an-app).
295
370
 
296
371
  ## What Glimmer needs from the DOM
297
372
 
@@ -327,7 +402,6 @@ a device, so the shim's element class stands in for it.
327
402
  adapter and silently keep the last one on a device.
328
403
  - HMR keeps no state, and there is no error overlay on the device.
329
404
  - CSS is NativeScript's subset; styles are NativeScript's, not a web app's.
330
- - The template isn't published as a package, so `ns create --template` can't fetch it yet.
331
405
 
332
406
  ## Proven and unverified
333
407
 
@@ -336,19 +410,21 @@ components compile with vite-plugin-ember-gts for the tests, the package and the
336
410
  with @nativescript/vite produces Android and iOS bundles; the packed tarball installed into a clean copy of the
337
411
  template builds for both platforms and passes Glint, which catches wrong attributes there.
338
412
 
339
- Not verified (no Android SDK, emulator, KVM or Xcode in this container):
340
-
341
- - Anything on a device or simulator: that the bundle boots, that Ember's runloop and microtasks behave on V8/JSC under
342
- NativeScript, that `Frame.navigate` inside `Application.run`'s `create` shows the first page.
343
- - The NativeScript adapter at runtime. It typechecks against @nativescript/core 9.1.4, but string conversion of every
344
- static property, assigning a CSS string to `style`, `insertChild` order on each layout, and the slot setters
345
- (`actionItems` rebuilt through `addItem`/`removeItem`, `spans` spliced) are assumed from how NativeScript's XML
346
- builder does it.
347
- - Navigation and modals on a device: the tests drive a fake Frame that fires `navigatedTo` and `navigatedFrom` as
348
- NativeScript's source does; that the real Frame fires them in that order on both platforms, that a Frame inside a
349
- TabView shows its first page, and that `closeCallback` fires once on a swipe-down dismissal, is unverified.
350
- - `NativeList` on a device: that `itemLoading` hands over the template's StackLayout, that `itemTemplateSelector` gets
351
- the index as NativeScript's source says, that a cell updated in the event is measured with its new content, and how
352
- scrolling a thousand rows feels.
413
+ Run on a device: Pace (`run/`) on an iPhone, under `ns run ios` with HMR: its home screen with Core Animation, taps,
414
+ navigation with a transition to the run screen, and MapKit drawing a route; an error in a `{{nativeView}}` callback
415
+ reaching the terminal while the screen keeps working. `ns create --template` with the packed template, then its tests
416
+ and both bundles, on Linux with the NativeScript CLI 9.1.2.
417
+
418
+ Not verified:
419
+
420
+ - Android: neither the demo nor Pace has run on an emulator or a device.
421
+ - A release build (`ns build --release`), and startup time and binary size on a device.
422
+ - Modals on a device, including `closeCallback` firing once on a swipe-down dismissal, and a Frame inside a TabView
423
+ showing its first page.
424
+ - The NativeScript adapter's less common paths: assigning a CSS string to `style`, the slot setters (`actionItems`
425
+ rebuilt through `addItem`/`removeItem`, `spans` spliced), and `insertChild` order on every layout.
426
+ - `NativeList` with a thousand rows on a device: that a cell updated in `itemLoading` is measured with its new
427
+ content, and how scrolling feels.
353
428
  - `{{bind}}` on a device: that setting `text` only when it differs keeps the cursor where it is while typing.
354
- - Performance: startup, bundle size on device.
429
+ - On the iPhone, still: the GPS in Pace, the countdown since `{{nativeView}}` waits for `loaded`, haptics, and the
430
+ template app itself.
@@ -17,5 +17,12 @@ export declare const Android: import("@ember/component/template-only").TemplateO
17
17
  };
18
18
  };
19
19
  }>, unknown>> & import("@glint/template/-private/integration").HasContext<import("@glint/ember-tsc/types").ComponentContext<null, Signature>>);
20
+ export declare const Web: import("@ember/component/template-only").TemplateOnlyComponent<never> & (abstract new () => import("@glint/template/-private/integration").InvokableInstance<() => import("@glint/template/-private/integration").ComponentReturn<import("@glint/template/-private/integration").FlattenBlockParams<{
21
+ default: {
22
+ Params: {
23
+ Positional: [];
24
+ };
25
+ };
26
+ }>, unknown>> & import("@glint/template/-private/integration").HasContext<import("@glint/ember-tsc/types").ComponentContext<null, Signature>>);
20
27
  export {};
21
28
  //# sourceMappingURL=Platform.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Platform.d.ts","sourceRoot":"","sources":["../../components/Platform.gts"],"names":[],"mappings":"AAQA,UAAU,SAAS;IACjB,MAAM,EAAE;QAAE,OAAO,EAAE,EAAE,CAAA;KAAE,CAAC;CACzB;AAED,eAAO,MAAM,GAAG;;;;;;8IAAgF,CAAC;AACjG,eAAO,MAAM,OAAO;;;;;;8IAAoF,CAAC"}
1
+ {"version":3,"file":"Platform.d.ts","sourceRoot":"","sources":["../../components/Platform.gts"],"names":[],"mappings":"AAQA,UAAU,SAAS;IACjB,MAAM,EAAE;QAAE,OAAO,EAAE,EAAE,CAAA;KAAE,CAAC;CACzB;AAED,eAAO,MAAM,GAAG;;;;;;8IAAgF,CAAC;AACjG,eAAO,MAAM,OAAO;;;;;;8IAAoF,CAAC;AACzG,eAAO,MAAM,GAAG;;;;;;8IAAgF,CAAC"}
@@ -1,4 +1,4 @@
1
- import { isAndroid, isIOS } from "../src/platform.js";
1
+ import { isAndroid, isIOS, isWeb } from "../src/platform.js";
2
2
  import { setComponentTemplate } from "@ember/component";
3
3
  import { createTemplateFactory } from "@ember/template-factory";
4
4
  import templateOnly from "@ember/component/template-only";
@@ -17,6 +17,13 @@ var Android = setComponentTemplate(createTemplateFactory({
17
17
  "scope": () => ({ isAndroid }),
18
18
  "isStrictMode": true
19
19
  }), templateOnly());
20
- export { Android, IOS };
20
+ var Web = setComponentTemplate(createTemplateFactory({
21
+ "id": null,
22
+ "block": "[[[41,[28,[32,0],null,null],[[[18,1,null]],[]],null]],[\"&default\"],[\"if\",\"yield\"]]",
23
+ "moduleName": "(unknown template module)",
24
+ "scope": () => ({ isWeb }),
25
+ "isStrictMode": true
26
+ }), templateOnly());
27
+ export { Android, IOS, Web };
21
28
 
22
29
  //# sourceMappingURL=Platform.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Platform.js","names":["isAndroid","isIOS","setComponentTemplate","createTemplateFactory","templateOnly","IOS","Android"],"sources":["../../components/Platform.gts"],"sourcesContent":["// What only one platform shows, like NativeScript-Vue's <ios> and <android> blocks:\n//\n// <IOS><label text='Swipe down to close' /></IOS>\n// <Android><button text='Close' {{on 'tap' @closeModal}} /></Android>\nimport type { TOC } from '@ember/component/template-only';\n\nimport { isAndroid, isIOS } from '../src/platform.ts';\n\ninterface Signature {\n Blocks: { default: [] };\n}\n\nexport const IOS = <template>{{#if (isIOS)}}{{yield}}{{/if}}</template> satisfies TOC<Signature>;\nexport const Android = <template>{{#if (isAndroid)}}{{yield}}{{/if}}</template> satisfies TOC<Signature>;\n"],"mappings":";;;;;AAYA,IAAaK,MAAAH,qBAAAC,sBAAA;CAAA,MAAA;CAAA,SAAA;CAAA,cAAA;CAAA,gBAAA,EAAAF,MAAA;CAAA,gBAAA;AAAA,CAAA,GAAAG,aAAA,CAAA;AACb,IAAaE,UAAAJ,qBAAAC,sBAAA;CAAA,MAAA;CAAA,SAAA;CAAA,cAAA;CAAA,gBAAA,EAAAH,UAAA;CAAA,gBAAA;AAAA,CAAA,GAAAI,aAAA,CAAA"}
1
+ {"version":3,"file":"Platform.js","names":["isAndroid","isIOS","isWeb","setComponentTemplate","createTemplateFactory","templateOnly","IOS","Android","Web"],"sources":["../../components/Platform.gts"],"sourcesContent":["// What only one platform shows, like NativeScript-Vue's <ios> and <android> blocks (and <Web> for the browser):\n//\n// <IOS><label text='Swipe down to close' /></IOS>\n// <Android><button text='Close' {{on 'tap' @closeModal}} /></Android>\nimport type { TOC } from '@ember/component/template-only';\n\nimport { isAndroid, isIOS, isWeb } from '../src/platform.ts';\n\ninterface Signature {\n Blocks: { default: [] };\n}\n\nexport const IOS = <template>{{#if (isIOS)}}{{yield}}{{/if}}</template> satisfies TOC<Signature>;\nexport const Android = <template>{{#if (isAndroid)}}{{yield}}{{/if}}</template> satisfies TOC<Signature>;\nexport const Web = <template>{{#if (isWeb)}}{{yield}}{{/if}}</template> satisfies TOC<Signature>;\n"],"mappings":";;;;;AAYA,IAAaM,MAAAH,qBAAAC,sBAAA;CAAA,MAAA;CAAA,SAAA;CAAA,cAAA;CAAA,gBAAA,EAAAH,MAAA;CAAA,gBAAA;AAAA,CAAA,GAAAI,aAAA,CAAA;AACb,IAAaE,UAAAJ,qBAAAC,sBAAA;CAAA,MAAA;CAAA,SAAA;CAAA,cAAA;CAAA,gBAAA,EAAAJ,UAAA;CAAA,gBAAA;AAAA,CAAA,GAAAK,aAAA,CAAA;AACb,IAAaG,MAAAL,qBAAAC,sBAAA;CAAA,MAAA;CAAA,SAAA;CAAA,cAAA;CAAA,gBAAA,EAAAF,MAAA;CAAA,gBAAA;AAAA,CAAA,GAAAG,aAAA,CAAA"}
@@ -1,4 +1,5 @@
1
1
  import type { FrameHost } from './navigator.js';
2
+ import type { Platform } from './platform.js';
2
3
  export type Listener = (data: unknown) => void;
3
4
  /** A list view's rows, for {@link NativeAdapter.bindList}. */
4
5
  export interface ListOptions {
@@ -28,8 +29,8 @@ export interface NativeAdapter<View = unknown> {
28
29
  hasProperty?(view: View, name: string): boolean;
29
30
  /** Whether text children of this view become its `text` property (labels, buttons, text fields). */
30
31
  takesText(view: View): boolean;
31
- /** Which platform the views are for, for `ios:` and `android:` attributes and the isIOS/isAndroid helpers. */
32
- readonly platform?: 'ios' | 'android';
32
+ /** Which platform the views are for, for `ios:`, `android:` and `web:` attributes and the isIOS/isAndroid helpers. */
33
+ readonly platform?: Platform;
33
34
  /** Puts `child` at `index` among the views `parent` holds. */
34
35
  insertChild(parent: View, child: View, index: number): void;
35
36
  removeChild(parent: View, child: View): void;
@@ -1 +1 @@
1
- {"version":3,"file":"adapter.d.ts","sourceRoot":"","sources":["../../src/adapter.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAEhD,MAAM,MAAM,QAAQ,GAAG,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;AAE/C,8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IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,GAAG,IAAI,CAAC;IACzD;;;OAGG;IACH,6FAA6F;IAC7F,SAAS,CAAC,CAAC,IAAI,EAAE,IAAI,GAAG,SAAS,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;IAC/C,QAAQ,CAAC,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,EAAE,OAAO,CAAC,EAAE,WAAW,GAAG,WAAW,GAAG,IAAI,CAAC;CAClH"}
package/dist/src/dom.js CHANGED
@@ -221,7 +221,7 @@ var NativeElement = class NativeElement extends NativeParent {
221
221
  return unsupported("insertAdjacentHTML (a triple-curly {{{html}}} or htmlSafe string)");
222
222
  }
223
223
  #forThisPlatform(name) {
224
- const match = /^(ios|android):(.+)$/.exec(name);
224
+ const match = /^(ios|android|web):(.+)$/.exec(name);
225
225
  if (!match) return name;
226
226
  return match[1] === this.#adapter.platform ? match[2] : void 0;
227
227
  }
@@ -1 +1 @@
1
- {"version":3,"file":"dom.js","names":[],"sources":["../../src/dom.ts"],"sourcesContent":["// A minimal DOM for Glimmer whose elements are native views. Glimmer builds and updates a tree of\n// elements, text nodes and comments through a small part of the DOM API; this file implements that part\n// and mirrors every change onto views through a NativeAdapter.\n//\n// - An element gets a view from the adapter by its tag. Its element children with views become the\n// view's children, in order; comments, text nodes and elements without views are skipped when the\n// native index is worked out.\n// - Text children of a view that takes text (label, button, textField) become its `text` property.\n// Text anywhere else has no native counterpart and is dropped (`droppedText` counts it).\n// - Some children go into a property of their parent instead (a page's ActionBar, a label's FormattedString): see\n// elements.ts.\n// - `ios:` and `android:` attributes only apply on that platform, as in NativeScript's XML.\n// - Attributes become view properties: a static attribute as the string it is, as NativeScript's XML assigns it, and\n// a dynamic one as its value (an array of items, a Date, an image), the way Vue and React set props.\n// - Event listeners become view listeners.\n// - What a native toolkit can't do (HTML strings, SVG) throws with a message instead of half-working.\n\nimport type { Listener, NativeAdapter } from './adapter.ts';\nimport { type Slot, slotFor } from './elements.ts';\n\nexport const ELEMENT_NODE = 1;\nexport const TEXT_NODE = 3;\nexport const COMMENT_NODE = 8;\nexport const DOCUMENT_NODE = 9;\nexport const DOCUMENT_FRAGMENT_NODE = 11;\n\nexport const HTML_NAMESPACE = 'http://www.w3.org/1999/xhtml';\n\nconst unsupported = (what: string): never => {\n throw new Error(`[ember-nativescript] ${what} has no native counterpart.`);\n};\n\nexport abstract class NativeNode {\n abstract readonly nodeType: number;\n parentNode: NativeParent | null = null;\n previousSibling: NativeNode | null = null;\n nextSibling: NativeNode | null = null;\n\n constructor(readonly ownerDocument: NativeDocument) {}\n\n get parentElement(): NativeElement | null {\n return this.parentNode instanceof NativeElement ? this.parentNode : null;\n }\n\n abstract get nodeName(): string;\n}\n\nabstract class NativeParent extends NativeNode {\n firstChild: NativeNode | null = null;\n lastChild: NativeNode | null = null;\n\n get childNodes(): NativeNode[] {\n const nodes: NativeNode[] = [];\n for (let node = this.firstChild; node; node = node.nextSibling) nodes.push(node);\n return nodes;\n }\n\n appendChild<T extends NativeNode>(node: T): T {\n return this.insertBefore(node, null);\n }\n\n insertBefore<T extends NativeNode>(node: T, reference: NativeNode | null): T {\n if (node instanceof NativeFragment) {\n for (let child = node.firstChild; child;) {\n const next = child.nextSibling;\n this.insertBefore(child, reference);\n child = next;\n }\n return node;\n }\n\n if (reference && reference.parentNode !== this) {\n throw new Error('[ember-nativescript] insertBefore: the reference node is not a child of this node.');\n }\n\n node.parentNode?.removeChild(node);\n\n const previous = reference ? reference.previousSibling : this.lastChild;\n node.parentNode = this;\n node.previousSibling = previous;\n node.nextSibling = reference;\n if (previous) previous.nextSibling = node;\n else this.firstChild = node;\n if (reference) reference.previousSibling = node;\n else this.lastChild = node;\n\n this.childInserted(node);\n return node;\n }\n\n removeChild<T extends NativeNode>(node: T): T {\n if (node.parentNode !== this) {\n throw new Error('[ember-nativescript] removeChild: the node is not a child of this node.');\n }\n\n this.childRemoving(node);\n\n if (node.previousSibling) node.previousSibling.nextSibling = node.nextSibling;\n else this.firstChild = node.nextSibling;\n if (node.nextSibling) node.nextSibling.previousSibling = node.previousSibling;\n else this.lastChild = node.previousSibling;\n node.parentNode = node.previousSibling = node.nextSibling = null;\n\n this.childRemoved(node);\n return node;\n }\n\n protected childInserted(_node: NativeNode): void {}\n protected childRemoving(_node: NativeNode): void {}\n protected childRemoved(_node: NativeNode): void {}\n}\n\nexport class NativeText extends NativeNode {\n readonly nodeType = TEXT_NODE;\n #data: string;\n\n constructor(document: NativeDocument, data: string) {\n super(document);\n this.#data = data;\n }\n\n get nodeName(): string {\n return '#text';\n }\n\n get nodeValue(): string {\n return this.#data;\n }\n\n // Glimmer updates dynamic text by assigning nodeValue.\n set nodeValue(value: string) {\n this.#data = value;\n this.parentElement?.syncText();\n }\n\n get data(): string {\n return this.#data;\n }\n\n set data(value: string) {\n this.nodeValue = value;\n }\n\n get textContent(): string {\n return this.#data;\n }\n}\n\nexport class NativeComment extends NativeNode {\n readonly nodeType = COMMENT_NODE;\n\n constructor(\n document: NativeDocument,\n public nodeValue: string,\n ) {\n super(document);\n }\n\n get nodeName(): string {\n return '#comment';\n }\n}\n\nexport class NativeFragment extends NativeParent {\n readonly nodeType = DOCUMENT_FRAGMENT_NODE;\n\n get nodeName(): string {\n return '#document-fragment';\n }\n}\n\nexport class NativeElement extends NativeParent {\n readonly nodeType = ELEMENT_NODE;\n readonly namespaceURI = HTML_NAMESPACE;\n readonly attributes = new Map<string, string>();\n /** Values set as properties, as they are: what dynamic attributes such as `items={{this.list}}` assigned. */\n readonly properties = new Map<string, unknown>();\n readonly view: unknown;\n readonly #listeners = new Map<string, Map<Listener, Listener>>();\n #text: string | undefined;\n\n constructor(\n document: NativeDocument,\n readonly localName: string,\n view?: unknown,\n ) {\n super(document);\n this.view = view === undefined ? document.adapter.createView(localName) : view;\n if (this.view) exposeViewProperties(this);\n }\n\n get tagName(): string {\n return this.localName.toUpperCase();\n }\n\n get nodeName(): string {\n return this.tagName;\n }\n\n // Ember's development build of {{on}} names the element in its errors with these.\n get id(): string {\n return this.attributes.get('id') ?? '';\n }\n\n // Glimmer sets a dynamic attribute as a property when `name in element`, which a getter makes true.\n set id(value: string) {\n this.setAttribute('id', value);\n }\n\n get classList(): string[] {\n return (this.attributes.get('class') ?? '').split(/\\s+/).filter(Boolean);\n }\n\n get #adapter(): NativeAdapter {\n return this.ownerDocument.adapter;\n }\n\n getAttribute(name: string): string | null {\n return this.attributes.get(name) ?? null;\n }\n\n hasAttribute(name: string): boolean {\n return this.attributes.has(name);\n }\n\n setAttribute(name: string, value: string): void {\n const local = this.#forThisPlatform(name);\n if (local === undefined) return;\n if (local !== name) return this.setAttribute(local, value);\n const string = String(value);\n this.attributes.set(name, string);\n this.properties.delete(name);\n if (this.view) this.#adapter.setProperty(this.view, name, string);\n }\n\n removeAttribute(name: string): void {\n const local = this.#forThisPlatform(name);\n if (local === undefined) return;\n if (local !== name) return this.removeAttribute(local);\n this.attributes.delete(name);\n this.properties.delete(name);\n if (this.view) this.#adapter.setProperty(this.view, name, null);\n }\n\n /** Sets a view property to a value as it is. Glimmer does this for dynamic attributes, through `element[name] = value`. */\n setProperty(name: string, value: unknown): void {\n const local = this.#forThisPlatform(name);\n if (local === undefined) return;\n if (local !== name) return this.setProperty(local, value);\n if (value === null || value === undefined) {\n this.attributes.delete(name);\n this.properties.delete(name);\n } else {\n this.properties.set(name, value);\n if (typeof value === 'object' || typeof value === 'function') this.attributes.delete(name);\n else this.attributes.set(name, String(value));\n }\n\n if (this.view) this.#adapter.setProperty(this.view, name, value ?? null);\n }\n\n // Glimmer only uses namespaced attributes for SVG and xlink.\n setAttributeNS(namespace: string | null, name: string, value: string): void {\n if (namespace) unsupported(`The attribute ${name} in namespace ${namespace}`);\n this.setAttribute(name, value);\n }\n\n removeAttributeNS(_namespace: string | null, name: string): void {\n this.removeAttribute(name);\n }\n\n addEventListener(event: string, listener: Listener | { handleEvent: Listener }): void {\n let byListener = this.#listeners.get(event);\n if (!byListener) this.#listeners.set(event, (byListener = new Map()));\n if (byListener.has(listener as Listener)) return;\n\n const handle: Listener =\n typeof listener === 'function' ? listener : (data) => (listener as { handleEvent: Listener }).handleEvent(data);\n // As on the web, the handler can tell which element it was added on.\n const call: Listener = (data) => {\n if (data !== null && typeof data === 'object') (data as { currentTarget?: unknown }).currentTarget = this;\n handle(data);\n };\n byListener.set(listener as Listener, call);\n if (this.view) this.#adapter.on(this.view, event, call);\n }\n\n removeEventListener(event: string, listener: Listener): void {\n const call = this.#listeners.get(event)?.get(listener);\n if (!call) return;\n\n this.#listeners.get(event)!.delete(listener);\n if (this.view) this.#adapter.off(this.view, event, call);\n }\n\n /** How many listeners the element holds, for tests that check clean-up. */\n get listenerCount(): number {\n let count = 0;\n for (const byListener of this.#listeners.values()) count += byListener.size;\n return count;\n }\n\n get textContent(): string {\n return this.childNodes.map((node) => (node as { textContent?: string }).textContent ?? '').join('');\n }\n\n // `renderComponent` clears its target the first time; nothing else may be assigned.\n set innerHTML(html: string) {\n if (html !== '') unsupported('Setting innerHTML (a triple-curly {{{html}}} or htmlSafe string)');\n while (this.firstChild) this.removeChild(this.firstChild);\n }\n\n insertAdjacentHTML(): never {\n return unsupported('insertAdjacentHTML (a triple-curly {{{html}}} or htmlSafe string)');\n }\n\n // `ios:title` is `title` on iOS and nothing on Android, and the other way round.\n #forThisPlatform(name: string): string | undefined {\n const match = /^(ios|android):(.+)$/.exec(name);\n if (!match) return name;\n return match[1] === this.#adapter.platform ? match[2] : undefined;\n }\n\n /** Recomputes the text property of a view that takes text from its text children. */\n syncText(): void {\n if (!this.view || !this.#adapter.takesText(this.view)) return;\n\n let text = '';\n for (let node = this.firstChild; node; node = node.nextSibling) {\n if (node instanceof NativeText) text += node.nodeValue;\n }\n\n if (text !== this.#text) {\n this.#text = text;\n this.#adapter.setProperty(this.view, 'text', text);\n }\n }\n\n protected override childInserted(node: NativeNode): void {\n if (node instanceof NativeText) {\n if (this.view && this.#adapter.takesText(this.view)) this.syncText();\n else if (node.nodeValue.trim()) this.ownerDocument.droppedText.push(node.nodeValue);\n return;\n }\n\n const slot = node instanceof NativeElement ? this.#slotOf(node) : undefined;\n\n if (slot && this.view && (node as NativeElement).view) {\n const child = (node as NativeElement).view;\n if (slot.list)\n this.#adapter.insertInSlot(this.view, slot.property, child, this.#indexIn(slot, node as NativeElement));\n else this.#adapter.setSlot(this.view, slot.property, child);\n } else if (node instanceof NativeElement && node.view && this.view) {\n this.#adapter.insertChild(this.view, node.view, this.#nativeIndexOf(node));\n } else if (node instanceof NativeElement && node.view && !this.view) {\n unsupported(`A <${node.localName}> inside <${this.localName}>, which has no view,`);\n }\n }\n\n protected override childRemoving(node: NativeNode): void {\n if (!(node instanceof NativeElement) || !node.view || !this.view) return;\n\n const slot = this.#slotOf(node);\n if (slot?.list) this.#adapter.removeFromSlot(this.view, slot.property, node.view);\n else if (slot) this.#adapter.setSlot(this.view, slot.property, null);\n else this.#adapter.removeChild(this.view, node.view);\n }\n\n protected override childRemoved(node: NativeNode): void {\n if (node instanceof NativeText) this.syncText();\n }\n\n #slotOf(child: NativeElement): Slot | undefined {\n return slotFor(this.localName, child.localName);\n }\n\n // Where a child view goes among its parent's views: children that went into a slot don't count.\n #nativeIndexOf(target: NativeElement): number {\n let index = 0;\n for (let node = this.firstChild; node && node !== target; node = node.nextSibling) {\n if (node instanceof NativeElement && node.view && !this.#slotOf(node)) index++;\n }\n return index;\n }\n\n // Where a child goes in a list slot: after the earlier children in the same slot.\n #indexIn(slot: Slot, target: NativeElement): number {\n let index = 0;\n for (let node = this.firstChild; node && node !== target; node = node.nextSibling) {\n if (node instanceof NativeElement && node.view && this.#slotOf(node)?.property === slot.property) index++;\n }\n return index;\n }\n}\n\n// Glimmer sets a dynamic attribute as a property when `name in element`, and otherwise turns its value into a string\n// for setAttribute. Each element with a view gets a prototype that answers `in` for the properties its view has\n// (adapter.hasProperty) and sends assignments to them to setProperty, so `items={{this.contacts}}` reaches a\n// ListPicker as an array. It's a proxy in the prototype chain rather than around the element, which would break the\n// element's private fields; it only sees names the element itself doesn't have.\nfunction exposeViewProperties(element: NativeElement): void {\n const { view } = element;\n const adapter = element.ownerDocument.adapter;\n const isViewProperty = (target: object, key: string | symbol): key is string =>\n typeof key === 'string' && !Reflect.has(target, key) && Boolean(adapter.hasProperty?.(view, key));\n\n Object.setPrototypeOf(\n element,\n new Proxy(NativeElement.prototype, {\n getPrototypeOf: () => NativeElement.prototype,\n has: (target, key) => Reflect.has(target, key) || isViewProperty(target, key),\n get(target, key, receiver) {\n return receiver === element && isViewProperty(target, key)\n ? element.properties.get(key)\n : Reflect.get(target, key, receiver);\n },\n set(target, key, value, receiver) {\n if (receiver !== element || !isViewProperty(target, key)) return Reflect.set(target, key, value, receiver);\n element.setProperty(key, value);\n return true;\n },\n }),\n );\n}\n\nexport class NativeDocument extends NativeParent {\n readonly nodeType = DOCUMENT_NODE;\n /** Text that landed outside a view that takes text, so nothing shows it. */\n readonly droppedText: string[] = [];\n\n constructor(readonly adapter: NativeAdapter) {\n super(undefined as unknown as NativeDocument);\n (this as { ownerDocument: NativeDocument }).ownerDocument = this;\n }\n\n get nodeName(): string {\n return '#document';\n }\n\n createElement(tag: string): NativeElement {\n return new NativeElement(this, tag);\n }\n\n createElementNS(namespace: string | null, tag: string): NativeElement {\n if (namespace && namespace !== HTML_NAMESPACE) unsupported(`<${tag}> in namespace ${namespace} (SVG or MathML)`);\n return this.createElement(tag);\n }\n\n /** An element for a view the toolkit made itself, such as a list's cell, so Glimmer can render into it. */\n adopt(view: unknown, tag = 'cell'): NativeElement {\n return new NativeElement(this, tag, view);\n }\n\n createTextNode(data: string): NativeText {\n return new NativeText(this, data);\n }\n\n createComment(data: string): NativeComment {\n return new NativeComment(this, data);\n }\n\n createDocumentFragment(): NativeFragment {\n return new NativeFragment(this);\n }\n}\n"],"mappings":";AA0BA,IAAa,iBAAiB;AAE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AAc,GAAG;CAC/B;;CAGA,MAAM,MAAe,MAAM,QAAuB;EAChD,OAAO,IAAI,cAAc,MAAM,KAAK,IAAI;CAC1C;CAEA,eAAe,MAA0B;EACvC,OAAO,IAAI,WAAW,MAAM,IAAI;CAClC;CAEA,cAAc,MAA6B;EACzC,OAAO,IAAI,cAAc,MAAM,IAAI;CACrC;CAEA,yBAAyC;EACvC,OAAO,IAAI,eAAe,IAAI;CAChC;AACF"}
1
+ {"version":3,"file":"dom.js","names":[],"sources":["../../src/dom.ts"],"sourcesContent":["// A minimal DOM for Glimmer whose elements are native views. Glimmer builds and updates a tree of\n// elements, text nodes and comments through a small part of the DOM API; this file implements that part\n// and mirrors every change onto views through a NativeAdapter.\n//\n// - An element gets a view from the adapter by its tag. Its element children with views become the\n// view's children, in order; comments, text nodes and elements without views are skipped when the\n// native index is worked out.\n// - Text children of a view that takes text (label, button, textField) become its `text` property.\n// Text anywhere else has no native counterpart and is dropped (`droppedText` counts it).\n// - Some children go into a property of their parent instead (a page's ActionBar, a label's FormattedString): see\n// elements.ts.\n// - `ios:`, `android:` and `web:` attributes only apply on that platform, as in NativeScript's XML.\n// - Attributes become view properties: a static attribute as the string it is, as NativeScript's XML assigns it, and\n// a dynamic one as its value (an array of items, a Date, an image), the way Vue and React set props.\n// - Event listeners become view listeners.\n// - What a native toolkit can't do (HTML strings, SVG) throws with a message instead of half-working.\n\nimport type { Listener, NativeAdapter } from './adapter.ts';\nimport { type Slot, slotFor } from './elements.ts';\n\nexport const ELEMENT_NODE = 1;\nexport const TEXT_NODE = 3;\nexport const COMMENT_NODE = 8;\nexport const DOCUMENT_NODE = 9;\nexport const DOCUMENT_FRAGMENT_NODE = 11;\n\nexport const HTML_NAMESPACE = 'http://www.w3.org/1999/xhtml';\n\nconst unsupported = (what: string): never => {\n throw new Error(`[ember-nativescript] ${what} has no native counterpart.`);\n};\n\nexport abstract class NativeNode {\n abstract readonly nodeType: number;\n parentNode: NativeParent | null = null;\n previousSibling: NativeNode | null = null;\n nextSibling: NativeNode | null = null;\n\n constructor(readonly ownerDocument: NativeDocument) {}\n\n get parentElement(): NativeElement | null {\n return this.parentNode instanceof NativeElement ? this.parentNode : null;\n }\n\n abstract get nodeName(): string;\n}\n\nabstract class NativeParent extends NativeNode {\n firstChild: NativeNode | null = null;\n lastChild: NativeNode | null = null;\n\n get childNodes(): NativeNode[] {\n const nodes: NativeNode[] = [];\n for (let node = this.firstChild; node; node = node.nextSibling) nodes.push(node);\n return nodes;\n }\n\n appendChild<T extends NativeNode>(node: T): T {\n return this.insertBefore(node, null);\n }\n\n insertBefore<T extends NativeNode>(node: T, reference: NativeNode | null): T {\n if (node instanceof NativeFragment) {\n for (let child = node.firstChild; child;) {\n const next = child.nextSibling;\n this.insertBefore(child, reference);\n child = next;\n }\n return node;\n }\n\n if (reference && reference.parentNode !== this) {\n throw new Error('[ember-nativescript] insertBefore: the reference node is not a child of this node.');\n }\n\n node.parentNode?.removeChild(node);\n\n const previous = reference ? reference.previousSibling : this.lastChild;\n node.parentNode = this;\n node.previousSibling = previous;\n node.nextSibling = reference;\n if (previous) previous.nextSibling = node;\n else this.firstChild = node;\n if (reference) reference.previousSibling = node;\n else this.lastChild = node;\n\n this.childInserted(node);\n return node;\n }\n\n removeChild<T extends NativeNode>(node: T): T {\n if (node.parentNode !== this) {\n throw new Error('[ember-nativescript] removeChild: the node is not a child of this node.');\n }\n\n this.childRemoving(node);\n\n if (node.previousSibling) node.previousSibling.nextSibling = node.nextSibling;\n else this.firstChild = node.nextSibling;\n if (node.nextSibling) node.nextSibling.previousSibling = node.previousSibling;\n else this.lastChild = node.previousSibling;\n node.parentNode = node.previousSibling = node.nextSibling = null;\n\n this.childRemoved(node);\n return node;\n }\n\n protected childInserted(_node: NativeNode): void {}\n protected childRemoving(_node: NativeNode): void {}\n protected childRemoved(_node: NativeNode): void {}\n}\n\nexport class NativeText extends NativeNode {\n readonly nodeType = TEXT_NODE;\n #data: string;\n\n constructor(document: NativeDocument, data: string) {\n super(document);\n this.#data = data;\n }\n\n get nodeName(): string {\n return '#text';\n }\n\n get nodeValue(): string {\n return this.#data;\n }\n\n // Glimmer updates dynamic text by assigning nodeValue.\n set nodeValue(value: string) {\n this.#data = value;\n this.parentElement?.syncText();\n }\n\n get data(): string {\n return this.#data;\n }\n\n set data(value: string) {\n this.nodeValue = value;\n }\n\n get textContent(): string {\n return this.#data;\n }\n}\n\nexport class NativeComment extends NativeNode {\n readonly nodeType = COMMENT_NODE;\n\n constructor(\n document: NativeDocument,\n public nodeValue: string,\n ) {\n super(document);\n }\n\n get nodeName(): string {\n return '#comment';\n }\n}\n\nexport class NativeFragment extends NativeParent {\n readonly nodeType = DOCUMENT_FRAGMENT_NODE;\n\n get nodeName(): string {\n return '#document-fragment';\n }\n}\n\nexport class NativeElement extends NativeParent {\n readonly nodeType = ELEMENT_NODE;\n readonly namespaceURI = HTML_NAMESPACE;\n readonly attributes = new Map<string, string>();\n /** Values set as properties, as they are: what dynamic attributes such as `items={{this.list}}` assigned. */\n readonly properties = new Map<string, unknown>();\n readonly view: unknown;\n readonly #listeners = new Map<string, Map<Listener, Listener>>();\n #text: string | undefined;\n\n constructor(\n document: NativeDocument,\n readonly localName: string,\n view?: unknown,\n ) {\n super(document);\n this.view = view === undefined ? document.adapter.createView(localName) : view;\n if (this.view) exposeViewProperties(this);\n }\n\n get tagName(): string {\n return this.localName.toUpperCase();\n }\n\n get nodeName(): string {\n return this.tagName;\n }\n\n // Ember's development build of {{on}} names the element in its errors with these.\n get id(): string {\n return this.attributes.get('id') ?? '';\n }\n\n // Glimmer sets a dynamic attribute as a property when `name in element`, which a getter makes true.\n set id(value: string) {\n this.setAttribute('id', value);\n }\n\n get classList(): string[] {\n return (this.attributes.get('class') ?? '').split(/\\s+/).filter(Boolean);\n }\n\n get #adapter(): NativeAdapter {\n return this.ownerDocument.adapter;\n }\n\n getAttribute(name: string): string | null {\n return this.attributes.get(name) ?? null;\n }\n\n hasAttribute(name: string): boolean {\n return this.attributes.has(name);\n }\n\n setAttribute(name: string, value: string): void {\n const local = this.#forThisPlatform(name);\n if (local === undefined) return;\n if (local !== name) return this.setAttribute(local, value);\n const string = String(value);\n this.attributes.set(name, string);\n this.properties.delete(name);\n if (this.view) this.#adapter.setProperty(this.view, name, string);\n }\n\n removeAttribute(name: string): void {\n const local = this.#forThisPlatform(name);\n if (local === undefined) return;\n if (local !== name) return this.removeAttribute(local);\n this.attributes.delete(name);\n this.properties.delete(name);\n if (this.view) this.#adapter.setProperty(this.view, name, null);\n }\n\n /** Sets a view property to a value as it is. Glimmer does this for dynamic attributes, through `element[name] = value`. */\n setProperty(name: string, value: unknown): void {\n const local = this.#forThisPlatform(name);\n if (local === undefined) return;\n if (local !== name) return this.setProperty(local, value);\n if (value === null || value === undefined) {\n this.attributes.delete(name);\n this.properties.delete(name);\n } else {\n this.properties.set(name, value);\n if (typeof value === 'object' || typeof value === 'function') this.attributes.delete(name);\n else this.attributes.set(name, String(value));\n }\n\n if (this.view) this.#adapter.setProperty(this.view, name, value ?? null);\n }\n\n // Glimmer only uses namespaced attributes for SVG and xlink.\n setAttributeNS(namespace: string | null, name: string, value: string): void {\n if (namespace) unsupported(`The attribute ${name} in namespace ${namespace}`);\n this.setAttribute(name, value);\n }\n\n removeAttributeNS(_namespace: string | null, name: string): void {\n this.removeAttribute(name);\n }\n\n addEventListener(event: string, listener: Listener | { handleEvent: Listener }): void {\n let byListener = this.#listeners.get(event);\n if (!byListener) this.#listeners.set(event, (byListener = new Map()));\n if (byListener.has(listener as Listener)) return;\n\n const handle: Listener =\n typeof listener === 'function' ? listener : (data) => (listener as { handleEvent: Listener }).handleEvent(data);\n // As on the web, the handler can tell which element it was added on.\n const call: Listener = (data) => {\n if (data !== null && typeof data === 'object') (data as { currentTarget?: unknown }).currentTarget = this;\n handle(data);\n };\n byListener.set(listener as Listener, call);\n if (this.view) this.#adapter.on(this.view, event, call);\n }\n\n removeEventListener(event: string, listener: Listener): void {\n const call = this.#listeners.get(event)?.get(listener);\n if (!call) return;\n\n this.#listeners.get(event)!.delete(listener);\n if (this.view) this.#adapter.off(this.view, event, call);\n }\n\n /** How many listeners the element holds, for tests that check clean-up. */\n get listenerCount(): number {\n let count = 0;\n for (const byListener of this.#listeners.values()) count += byListener.size;\n return count;\n }\n\n get textContent(): string {\n return this.childNodes.map((node) => (node as { textContent?: string }).textContent ?? '').join('');\n }\n\n // `renderComponent` clears its target the first time; nothing else may be assigned.\n set innerHTML(html: string) {\n if (html !== '') unsupported('Setting innerHTML (a triple-curly {{{html}}} or htmlSafe string)');\n while (this.firstChild) this.removeChild(this.firstChild);\n }\n\n insertAdjacentHTML(): never {\n return unsupported('insertAdjacentHTML (a triple-curly {{{html}}} or htmlSafe string)');\n }\n\n // `ios:title` is `title` on iOS and nothing elsewhere; `android:` and `web:` likewise.\n #forThisPlatform(name: string): string | undefined {\n const match = /^(ios|android|web):(.+)$/.exec(name);\n if (!match) return name;\n return match[1] === this.#adapter.platform ? match[2] : undefined;\n }\n\n /** Recomputes the text property of a view that takes text from its text children. */\n syncText(): void {\n if (!this.view || !this.#adapter.takesText(this.view)) return;\n\n let text = '';\n for (let node = this.firstChild; node; node = node.nextSibling) {\n if (node instanceof NativeText) text += node.nodeValue;\n }\n\n if (text !== this.#text) {\n this.#text = text;\n this.#adapter.setProperty(this.view, 'text', text);\n }\n }\n\n protected override childInserted(node: NativeNode): void {\n if (node instanceof NativeText) {\n if (this.view && this.#adapter.takesText(this.view)) this.syncText();\n else if (node.nodeValue.trim()) this.ownerDocument.droppedText.push(node.nodeValue);\n return;\n }\n\n const slot = node instanceof NativeElement ? this.#slotOf(node) : undefined;\n\n if (slot && this.view && (node as NativeElement).view) {\n const child = (node as NativeElement).view;\n if (slot.list)\n this.#adapter.insertInSlot(this.view, slot.property, child, this.#indexIn(slot, node as NativeElement));\n else this.#adapter.setSlot(this.view, slot.property, child);\n } else if (node instanceof NativeElement && node.view && this.view) {\n this.#adapter.insertChild(this.view, node.view, this.#nativeIndexOf(node));\n } else if (node instanceof NativeElement && node.view && !this.view) {\n unsupported(`A <${node.localName}> inside <${this.localName}>, which has no view,`);\n }\n }\n\n protected override childRemoving(node: NativeNode): void {\n if (!(node instanceof NativeElement) || !node.view || !this.view) return;\n\n const slot = this.#slotOf(node);\n if (slot?.list) this.#adapter.removeFromSlot(this.view, slot.property, node.view);\n else if (slot) this.#adapter.setSlot(this.view, slot.property, null);\n else this.#adapter.removeChild(this.view, node.view);\n }\n\n protected override childRemoved(node: NativeNode): void {\n if (node instanceof NativeText) this.syncText();\n }\n\n #slotOf(child: NativeElement): Slot | undefined {\n return slotFor(this.localName, child.localName);\n }\n\n // Where a child view goes among its parent's views: children that went into a slot don't count.\n #nativeIndexOf(target: NativeElement): number {\n let index = 0;\n for (let node = this.firstChild; node && node !== target; node = node.nextSibling) {\n if (node instanceof NativeElement && node.view && !this.#slotOf(node)) index++;\n }\n return index;\n }\n\n // Where a child goes in a list slot: after the earlier children in the same slot.\n #indexIn(slot: Slot, target: NativeElement): number {\n let index = 0;\n for (let node = this.firstChild; node && node !== target; node = node.nextSibling) {\n if (node instanceof NativeElement && node.view && this.#slotOf(node)?.property === slot.property) index++;\n }\n return index;\n }\n}\n\n// Glimmer sets a dynamic attribute as a property when `name in element`, and otherwise turns its value into a string\n// for setAttribute. Each element with a view gets a prototype that answers `in` for the properties its view has\n// (adapter.hasProperty) and sends assignments to them to setProperty, so `items={{this.contacts}}` reaches a\n// ListPicker as an array. It's a proxy in the prototype chain rather than around the element, which would break the\n// element's private fields; it only sees names the element itself doesn't have.\nfunction exposeViewProperties(element: NativeElement): void {\n const { view } = element;\n const adapter = element.ownerDocument.adapter;\n const isViewProperty = (target: object, key: string | symbol): key is string =>\n typeof key === 'string' && !Reflect.has(target, key) && Boolean(adapter.hasProperty?.(view, key));\n\n Object.setPrototypeOf(\n element,\n new Proxy(NativeElement.prototype, {\n getPrototypeOf: () => NativeElement.prototype,\n has: (target, key) => Reflect.has(target, key) || isViewProperty(target, key),\n get(target, key, receiver) {\n return receiver === element && isViewProperty(target, key)\n ? element.properties.get(key)\n : Reflect.get(target, key, receiver);\n },\n set(target, key, value, receiver) {\n if (receiver !== element || !isViewProperty(target, key)) return Reflect.set(target, key, value, receiver);\n element.setProperty(key, value);\n return true;\n },\n }),\n );\n}\n\nexport class NativeDocument extends NativeParent {\n readonly nodeType = DOCUMENT_NODE;\n /** Text that landed outside a view that takes text, so nothing shows it. */\n readonly droppedText: string[] = [];\n\n constructor(readonly adapter: NativeAdapter) {\n super(undefined as unknown as NativeDocument);\n (this as { ownerDocument: NativeDocument }).ownerDocument = this;\n }\n\n get nodeName(): string {\n return '#document';\n }\n\n createElement(tag: string): NativeElement {\n return new NativeElement(this, tag);\n }\n\n createElementNS(namespace: string | null, tag: string): NativeElement {\n if (namespace && namespace !== HTML_NAMESPACE) unsupported(`<${tag}> in namespace ${namespace} (SVG or MathML)`);\n return this.createElement(tag);\n }\n\n /** An element for a view the toolkit made itself, such as a list's cell, so Glimmer can render into it. */\n adopt(view: unknown, tag = 'cell'): NativeElement {\n return new NativeElement(this, tag, view);\n }\n\n createTextNode(data: string): NativeText {\n return new NativeText(this, data);\n }\n\n createComment(data: string): NativeComment {\n return new NativeComment(this, data);\n }\n\n createDocumentFragment(): NativeFragment {\n return new NativeFragment(this);\n }\n}\n"],"mappings":";AA0BA,IAAa,iBAAiB;AAE9B,IAAM,eAAe,SAAwB;CAC3C,MAAM,IAAI,MAAM,wBAAwB,KAAK,4BAA4B;AAC3E;AAEA,IAAsB,aAAtB,MAAiC;CAMV;CAJrB,aAAkC;CAClC,kBAAqC;CACrC,cAAiC;CAEjC,YAAqB,eAA+B;EAA/B,KAAA,gBAAA;CAAgC;CAErD,IAAI,gBAAsC;EACxC,OAAO,KAAK,sBAAsB,gBAAgB,KAAK,aAAa;CACtE;AAGF;AAEA,IAAe,eAAf,cAAoC,WAAW;CAC7C,aAAgC;CAChC,YAA+B;CAE/B,IAAI,aAA2B;EAC7B,MAAM,QAAsB,CAAC;EAC7B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sB,cAAc;EACpC,MAAM,QAAQ,QAAQ,QAAQ,IAAI,QAAQ,GAAG,KAAK,eAAe,QAAQ,GAAG;EAC5E,IAAI,QAAQ,KAAK,UAAU;GACzB,OAAO,aAAa,WAAW,eAAe,QAAQ,GAAG,IACrD,QAAQ,WAAW,IAAI,GAAG,IAC1B,QAAQ,IAAI,QAAQ,KAAK,QAAQ;EACvC;EACA,IAAI,QAAQ,KAAK,OAAO,UAAU;GAChC,IAAI,aAAa,WAAW,CAAC,eAAe,QAAQ,GAAG,GAAG,OAAO,QAAQ,IAAI,QAAQ,KAAK,OAAO,QAAQ;GACzG,QAAQ,YAAY,KAAK,KAAK;GAC9B,OAAO;EACT;CACF,CAAC,CACH;AACF;AAEA,IAAa,iBAAb,cAAoC,aAAa;CAK1B;CAJZ,WAAA;;CAEA,cAAwB,CAAC;CAElC,YAAqB,SAAwB;EAC3C,MAAM,KAAA,CAAsC;EADzB,KAAA,UAAA;EAElB,KAA2C,gBAAgB;CAC9D;CAEA,IAAI,WAAmB;EACrB,OAAO;CACT;CAEA,cAAc,KAA4B;EACxC,OAAO,IAAI,cAAc,MAAM,GAAG;CACpC;CAEA,gBAAgB,WAA0B,KAA4B;EACpE,IAAI,aAAa,cAAA,gCAA8B,YAAY,IAAI,IAAI,iBAAiB,UAAU,iBAAiB;EAC/G,OAAO,KAAK,cAAc,GAAG;CAC/B;;CAGA,MAAM,MAAe,MAAM,QAAuB;EAChD,OAAO,IAAI,cAAc,MAAM,KAAK,IAAI;CAC1C;CAEA,eAAe,MAA0B;EACvC,OAAO,IAAI,WAAW,MAAM,IAAI;CAClC;CAEA,cAAc,MAA6B;EACzC,OAAO,IAAI,cAAc,MAAM,IAAI;CACrC;CAEA,yBAAyC;EACvC,OAAO,IAAI,eAAe,IAAI;CAChC;AACF"}
@@ -1,6 +1,8 @@
1
1
  import type { ListBinding, Listener, ListOptions, NativeAdapter } from './adapter.js';
2
2
  import type { FrameHost, ModalHostOptions, ShowOptions } from './navigator.js';
3
3
  export declare const FAKE_TAGS: Set<string>;
4
+ /** Tags whose views start without a native view, like those on a page still being navigated to, until `loaded`. */
5
+ export declare const FAKE_UNLOADED_TAGS: Set<string>;
4
6
  export declare class FakeView {
5
7
  readonly tag: string;
6
8
  /** Properties as strings, for toXML() and assertions. */
@@ -16,6 +18,8 @@ export declare class FakeView {
16
18
  list?: FakeList;
17
19
  /** For a frame: its pages and modals. */
18
20
  frame?: FakeFrame;
21
+ /** Whether its native view exists; see FAKE_UNLOADED_TAGS. `notify('loaded')` sets it. */
22
+ isLoaded: boolean;
19
23
  constructor(tag: string);
20
24
  get content(): FakeView | undefined;
21
25
  get text(): string | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"fake-adapter.d.ts","sourceRoot":"","sources":["../../src/fake-adapter.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AACtF,OAAO,KAAK,EAAE,SAAS,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAuD/E,eAAO,MAAM,SAAS,aAAyD,CAAC;AAEhF,qBAAa,QAAQ;IAeP,QAAQ,CAAC,GAAG,EAAE,MAAM;IAdhC,yDAAyD;IACzD,QAAQ,CAAC,KAAK,sBAA6B;IAC3C,mCAAmC;IACnC,QAAQ,CAAC,MAAM,uBAA8B;IAC7C,QAAQ,CAAC,QAAQ,EAAE,QAAQ,EAAE,CAAM;IACnC,QAAQ,CAAC,SAAS,6BAAoC;IACtD,2FAA2F;IAC3F,QAAQ,CAAC,KAAK,qCAA4C;IAC1D,MAAM,EAAE,QAAQ,GAAG,IAAI,CAAQ;IAC/B,wEAAwE;IACxE,IAAI,CAAC,EAAE,QAAQ,CAAC;IAChB,yCAAyC;IACzC,KAAK,CAAC,EAAE,SAAS,CAAC;gBAEG,GAAG,EAAE,MAAM;IAEhC,IAAI,OAAO,IAAI,QAAQ,GAAG,SAAS,C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native view, like those on a page still being navigated to, until `loaded`. */
67
+ var FAKE_UNLOADED_TAGS = /* @__PURE__ */ new Set();
66
68
  var FakeView = class {
67
69
  tag;
68
70
  /** Properties as strings, for toXML() and assertions. */
@@ -78,8 +80,11 @@ var FakeView = class {
78
80
  list;
79
81
  /** For a frame: its pages and modals. */
80
82
  frame;
83
+ /** Whether its native view exists; see FAKE_UNLOADED_TAGS. `notify('loaded')` sets it. */
84
+ isLoaded;
81
85
  constructor(tag) {
82
86
  this.tag = tag;
87
+ this.isLoaded = !FAKE_UNLOADED_TAGS.has(tag);
83
88
  }
84
89
  get content() {
85
90
  return CONTENT_VIEWS.has(this.tag) ? this.children[0] : void 0;
@@ -89,6 +94,7 @@ var FakeView = class {
89
94
  }
90
95
  /** Fires an event the way NativeScript's View.notify does, with { eventName, object }. */
91
96
  notify(eventName, extra = {}) {
97
+ if (eventName === "loaded") this.isLoaded = true;
92
98
  for (const listener of [...this.listeners.get(eventName) ?? []]) listener({
93
99
  eventName,
94
100
  object: this,
@@ -341,8 +347,11 @@ var FakeAdapter = class {
341
347
  const current = parent.slots.get(property);
342
348
  if (current && !Array.isArray(current)) current.parent = null;
343
349
  if (!child) {
344
- parent.slots.delete(property);
345
- return;
350
+ if (parent.tag === "page" && property === "actionBar") child = new FakeView("actionBar");
351
+ else {
352
+ parent.slots.delete(property);
353
+ return;
354
+ }
346
355
  }
347
356
  if (child.parent) throw new Error(`<${child.tag}> already has a parent`);
348
357
  child.parent = parent;
@@ -386,6 +395,6 @@ var FakeAdapter = class {
386
395
  };
387
396
  }
388
397
  };
389
- export { FAKE_TAGS, FakeAdapter, FakeFrame, FakeList, FakeView };
398
+ export { FAKE_TAGS, FAKE_UNLOADED_TAGS, FakeAdapter, FakeFrame, FakeList, FakeView };
390
399
 
391
400
  //# sourceMappingURL=fake-adapter.js.map