ember-nativescript 0.1.2 → 0.3.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 (96) hide show
  1. package/README.md +16 -3
  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/components/RouteError.d.ts +8 -0
  7. package/dist/components/RouteError.d.ts.map +1 -0
  8. package/dist/components/RouteError.js +13 -0
  9. package/dist/components/RouteError.js.map +1 -0
  10. package/dist/src/adapter.d.ts +3 -2
  11. package/dist/src/adapter.d.ts.map +1 -1
  12. package/dist/src/application-entry.d.ts +4 -0
  13. package/dist/src/application-entry.d.ts.map +1 -0
  14. package/dist/src/application-entry.js +4 -0
  15. package/dist/src/application-testing.d.ts +19 -0
  16. package/dist/src/application-testing.d.ts.map +1 -0
  17. package/dist/src/application-testing.js +32 -0
  18. package/dist/src/application-testing.js.map +1 -0
  19. package/dist/src/application.d.ts +45 -0
  20. package/dist/src/application.d.ts.map +1 -0
  21. package/dist/src/application.js +136 -0
  22. package/dist/src/application.js.map +1 -0
  23. package/dist/src/dom.js +1 -1
  24. package/dist/src/dom.js.map +1 -1
  25. package/dist/src/index.d.ts +2 -2
  26. package/dist/src/index.d.ts.map +1 -1
  27. package/dist/src/index.js +3 -3
  28. package/dist/src/nativescript-application.d.ts +8 -0
  29. package/dist/src/nativescript-application.d.ts.map +1 -0
  30. package/dist/src/nativescript-application.js +23 -0
  31. package/dist/src/nativescript-application.js.map +1 -0
  32. package/dist/src/navigator.d.ts +6 -0
  33. package/dist/src/navigator.d.ts.map +1 -1
  34. package/dist/src/navigator.js +6 -1
  35. package/dist/src/navigator.js.map +1 -1
  36. package/dist/src/platform.d.ts +4 -2
  37. package/dist/src/platform.d.ts.map +1 -1
  38. package/dist/src/platform.js +2 -1
  39. package/dist/src/platform.js.map +1 -1
  40. package/dist/src/render.d.ts.map +1 -1
  41. package/dist/src/render.js.map +1 -1
  42. package/dist/src/testing.d.ts +2 -0
  43. package/dist/src/testing.d.ts.map +1 -1
  44. package/dist/src/testing.js +7 -2
  45. package/dist/src/testing.js.map +1 -1
  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.map +1 -1
  51. package/dist/src/vite.js +4 -1
  52. package/dist/src/vite.js.map +1 -1
  53. package/dist/src/vitest.d.ts.map +1 -1
  54. package/dist/src/vitest.js +1 -0
  55. package/dist/src/vitest.js.map +1 -1
  56. package/dist/src/web-adapter.d.ts +31 -0
  57. package/dist/src/web-adapter.d.ts.map +1 -0
  58. package/dist/src/web-adapter.js +664 -0
  59. package/dist/src/web-adapter.js.map +1 -0
  60. package/dist/src/web-app.d.ts +29 -0
  61. package/dist/src/web-app.d.ts.map +1 -0
  62. package/dist/src/web-app.js +61 -0
  63. package/dist/src/web-app.js.map +1 -0
  64. package/dist/src/web-application.d.ts +10 -0
  65. package/dist/src/web-application.d.ts.map +1 -0
  66. package/dist/src/web-application.js +37 -0
  67. package/dist/src/web-application.js.map +1 -0
  68. package/dist/src/web-core.d.ts +56 -0
  69. package/dist/src/web-core.d.ts.map +1 -0
  70. package/dist/src/web-core.js +84 -0
  71. package/dist/src/web-core.js.map +1 -0
  72. package/dist/src/web-css.d.ts +7 -0
  73. package/dist/src/web-css.d.ts.map +1 -0
  74. package/dist/src/web-css.js +118 -0
  75. package/dist/src/web-css.js.map +1 -0
  76. package/dist/src/web-host.d.ts +25 -0
  77. package/dist/src/web-host.d.ts.map +1 -0
  78. package/dist/src/web-host.js +172 -0
  79. package/dist/src/web-host.js.map +1 -0
  80. package/dist/src/web-list.d.ts +18 -0
  81. package/dist/src/web-list.d.ts.map +1 -0
  82. package/dist/src/web-list.js +224 -0
  83. package/dist/src/web-list.js.map +1 -0
  84. package/dist/src/web-router.d.ts +51 -0
  85. package/dist/src/web-router.d.ts.map +1 -0
  86. package/dist/src/web-router.js +83 -0
  87. package/dist/src/web-router.js.map +1 -0
  88. package/dist/src/web-styles.d.ts +4 -0
  89. package/dist/src/web-styles.d.ts.map +1 -0
  90. package/dist/src/web-styles.js +160 -0
  91. package/dist/src/web-styles.js.map +1 -0
  92. package/dist/src/web.d.ts +7 -0
  93. package/dist/src/web.d.ts.map +1 -0
  94. package/dist/src/web.js +7 -0
  95. package/dist/types/glint.d.ts +6 -1
  96. package/package.json +35 -16
package/README.md CHANGED
@@ -26,11 +26,22 @@ export default class Home extends Component<{ Args: { nav: Navigator } }> {
26
26
  }
27
27
  ```
28
28
 
29
- **Status:** early (0.1). Everything below is tested in Node against an in-memory toolkit, typechecked against
29
+ **Docs:** https://betocantu93.github.io/ember-nativescript/
30
+
31
+ **Status:** early (0.3). Everything below is tested in Node against an in-memory toolkit, typechecked against
30
32
  @nativescript/core, and bundles for both platforms with @nativescript/vite. On iOS it runs: the demo on the simulator,
31
33
  and Pace (`run/`: MapKit, the GPS, animations, navigation) on an iPhone. Android hasn't run yet, nor a release build;
32
34
  see [Proven and unverified](#proven-and-unverified).
33
35
 
36
+ **Screens or routes, your choice:** open screens with a navigator (`createNativeApp`, as in NativeScript-Vue), or
37
+ boot a full Ember Application with its router, routes and `model()` hooks (`createNativeApplication` from
38
+ `ember-nativescript/application`, opt-in and experimental), and each route is a native screen. Same views, same back,
39
+ same tests. See [Two ways](https://betocantu93.github.io/ember-nativescript/guide/two-ways).
40
+
41
+ **In a browser, too (experimental):** the same screens on HTML elements, each at its own URL, with the browser's back
42
+ button as back: `npm run web` in an app from the template. For links, demos and previews; native code needs a
43
+ `__WEB__` branch. See [In a browser](https://betocantu93.github.io/ember-nativescript/guide/web).
44
+
34
45
  ## Start an app
35
46
 
36
47
  ```bash
@@ -345,8 +356,10 @@ refuse. `pnpm build` writes `dist/` (JavaScript, declarations, the Glint types).
345
356
  `pnpm test` also runs the template's tests against this source, and `pnpm typecheck` checks the template, so a
346
357
  change that breaks a new app fails here.
347
358
 
348
- To publish a version, raise `version` in both package.json files (the root and `template/`, whose `ember-nativescript`
349
- range follows it), add it to CHANGELOG.md, then publish the package before the template, which depends on it:
359
+ To publish a version, raise `version` in the root package.json and the `ember-nativescript` range in
360
+ `template/package.json`, add it to CHANGELOG.md, then publish the package before the template, which depends on it. The
361
+ template's own version follows NativeScript's major (9.x), as NativeScript's templates do: `ns create --template` without
362
+ a version asks for `^<CLI major>.0.0`.
350
363
 
351
364
  ```bash
352
365
  npm publish
@@ -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"}
@@ -0,0 +1,8 @@
1
+ import type { TOC } from '@ember/component/template-only';
2
+ declare const RouteError: TOC<{
3
+ Args: {
4
+ message: string;
5
+ };
6
+ }>;
7
+ export default RouteError;
8
+ //# sourceMappingURL=RouteError.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RouteError.d.ts","sourceRoot":"","sources":["../../components/RouteError.gts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,gCAAgC,CAAC;AAE1D,QAAA,MAAM,UAAU,EAAE,GAAG,CAAC;IAAE,IAAI,EAAE;QAAE,OAAO,EAAE,MAAM,CAAA;KAAE,CAAA;CAAE,CAKxC,CAAC;AAEZ,eAAe,UAAU,CAAC"}
@@ -0,0 +1,13 @@
1
+ import { setComponentTemplate } from "@ember/component";
2
+ import { createTemplateFactory } from "@ember/template-factory";
3
+ import templateOnly from "@ember/component/template-only";
4
+ // components/RouteError.gts
5
+ var RouteError = setComponentTemplate(createTemplateFactory({
6
+ "id": null,
7
+ "block": "[[[10,\"actionBar\"],[14,\"title\",\"Error\"],[12],[13],[10,\"stackLayout\"],[14,\"padding\",\"16\"],[12],[10,\"label\"],[14,1,\"ember-nativescript-error\"],[14,\"textWrap\",\"true\"],[14,\"color\",\"#c62828\"],[15,\"text\",[30,1]],[12],[13],[13]],[\"@message\"],[]]",
8
+ "moduleName": "(unknown template module)",
9
+ "isStrictMode": true
10
+ }), templateOnly());
11
+ export { RouteError as default };
12
+
13
+ //# sourceMappingURL=RouteError.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RouteError.js","names":["RouteError"],"sources":["../../components/RouteError.gts"],"sourcesContent":["// What a route shows when it can't show its own screen, in the full Ember Application: the reason, on the screen and\n// in the console, instead of a crash.\nimport type { TOC } from '@ember/component/template-only';\n\nconst RouteError: TOC<{ Args: { message: string } }> = <template>\n <actionBar title='Error' />\n <stackLayout padding='16'>\n <label id='ember-nativescript-error' textWrap='true' color='#c62828' text={{@message}} />\n </stackLayout>\n</template>;\n\nexport default RouteError;\n"],"mappings":";;;;AAIA,IAAMA,a;;;;;AAKI,CAAA,GAAA,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,8DAA8D;AAC9D,MAAM,WAAW,WAAW;IAC1B,6GAA6G;IAC7G,KAAK,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC1B,uCAAuC;IACvC,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC;CACpC;AAED,MAAM,WAAW,WAAW;IAC1B,2GAA2G;IAC3G,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,8BAA8B;IAC9B,OAAO,IAAI,IAAI,CAAC;CACjB;AAED,MAAM,WAAW,aAAa,CAAC,IAAI,GAAG,OAAO;IAC3C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C;CAClH"}
@@ -0,0 +1,4 @@
1
+ export { type RoutedApp, type StartApplicationOptions, startRoutedApp } from './application.js';
2
+ export { createNativeApplication } from './nativescript-application.js';
3
+ export { createWebApplication, type WebApplicationOptions } from './web-application.js';
4
+ //# sourceMappingURL=application-entry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"application-entry.d.ts","sourceRoot":"","sources":["../../src/application-entry.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,SAAS,EAAE,KAAK,uBAAuB,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAChG,OAAO,EAAE,uBAAuB,EAAE,MAAM,+BAA+B,CAAC;AACxE,OAAO,EAAE,oBAAoB,EAAE,KAAK,qBAAqB,EAAE,MAAM,sBAAsB,CAAC"}
@@ -0,0 +1,4 @@
1
+ import { startRoutedApp } from "./application.js";
2
+ import { createNativeApplication } from "./nativescript-application.js";
3
+ import { createWebApplication } from "./web-application.js";
4
+ export { createNativeApplication, createWebApplication, startRoutedApp };
@@ -0,0 +1,19 @@
1
+ import type ApplicationInstance from '@ember/application/instance';
2
+ import type RouterService from '@ember/routing/router-service';
3
+ import { type StartApplicationOptions } from './application.js';
4
+ import { type TestApp } from './testing.js';
5
+ export interface ApplicationTestOptions extends StartApplicationOptions {
6
+ platform?: 'ios' | 'android';
7
+ }
8
+ export interface ApplicationTestApp extends Omit<TestApp, 'owner'> {
9
+ owner: ApplicationInstance;
10
+ router: RouterService;
11
+ /** The URLs of the screens in the stack, from the first to the one on top. */
12
+ readonly urls: string[];
13
+ /** Transitions to a URL or a route, as `router.transitionTo` does, and waits for its screen. */
14
+ visit(...args: Parameters<RouterService['transitionTo']>): Promise<void>;
15
+ destroy(): void;
16
+ }
17
+ /** Boots the Application at its first URL on fake views, as createNativeApplication does on a phone. */
18
+ export declare function startApplication(options?: ApplicationTestOptions): Promise<ApplicationTestApp>;
19
+ //# sourceMappingURL=application-testing.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"application-testing.d.ts","sourceRoot":"","sources":["../../src/application-testing.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,mBAAmB,MAAM,6BAA6B,CAAC;AACnE,OAAO,KAAK,aAAa,MAAM,+BAA+B,CAAC;AAE/D,OAAO,EAAkB,KAAK,uBAAuB,EAAkB,MAAM,kBAAkB,CAAC;AAIhG,OAAO,EAAE,KAAK,OAAO,EAAW,MAAM,cAAc,CAAC;AAErD,MAAM,WAAW,sBAAuB,SAAQ,uBAAuB;IACrE,QAAQ,CAAC,EAAE,KAAK,GAAG,SAAS,CAAC;CAC9B;AAED,MAAM,WAAW,kBAAmB,SAAQ,IAAI,CAAC,OAAO,EAAE,OAAO,CAAC;IAChE,KAAK,EAAE,mBAAmB,CAAC;IAC3B,MAAM,EAAE,aAAa,CAAC;IACtB,8EAA8E;IAC9E,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,CAAC;IACxB,gGAAgG;IAChG,KAAK,CAAC,GAAG,IAAI,EAAE,UAAU,CAAC,aAAa,CAAC,cAAc,CAAC,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACzE,OAAO,IAAI,IAAI,CAAC;CACjB;AAED,wGAAwG;AACxG,wBAAsB,gBAAgB,CAAC,OAAO,GAAE,sBAA2B,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAwBxG"}
@@ -0,0 +1,32 @@
1
+ import { startRoutedApp } from "./application.js";
2
+ import { FakeAdapter, FakeFrame } from "./fake-adapter.js";
3
+ import { createDocument } from "./render.js";
4
+ import { testApp } from "./testing.js";
5
+ // src/application-testing.ts
6
+ /** Boots the Application at its first URL on fake views, as createNativeApplication does on a phone. */
7
+ async function startApplication(options = {}) {
8
+ const document = createDocument(new FakeAdapter(options.platform ?? "ios"));
9
+ const frame = new FakeFrame();
10
+ const routed = await startRoutedApp(document, frame, options);
11
+ const helpers = testApp(routed.instance, routed.navigator, frame);
12
+ await helpers.settled();
13
+ const app = helpers;
14
+ Object.defineProperty(app, "urls", { get: () => routed.urls });
15
+ return Object.assign(app, {
16
+ owner: routed.instance,
17
+ router: routed.router,
18
+ async visit(...args) {
19
+ await routed.router.transitionTo(...args);
20
+ await helpers.settled();
21
+ },
22
+ async back() {
23
+ frame.back();
24
+ await routed.routed();
25
+ await helpers.settled();
26
+ },
27
+ destroy: routed.destroy
28
+ });
29
+ }
30
+ export { startApplication };
31
+
32
+ //# sourceMappingURL=application-testing.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"application-testing.js","names":["startRoutedApp","FakeAdapter","FakeFrame","createDocument","testApp","startApplication","options","document","platform","frame","routed","helpers","instance","navigator","settled","app","Object","defineProperty","get","urls","assign","owner","router","visit","args","transitionTo","back","destroy"],"sources":["../../src/application-testing.ts"],"sourcesContent":["// Tests for an app on the full Ember Application, in Node: the router, routes and model hooks run as in the app, and\n// each route's screen renders into the fake views and Frame that startApp uses.\n//\n// const app = await startApplication({ modules: import.meta.glob('../src/{router.ts,routes,templates}/**', { eager: true }) });\n// await app.visit('/rides/42');\n// expect(app.find('.title').text).toBe('Ride 42');\n// await app.back();\n// expect(app.router.currentURL).toBe('/');\n\nimport type ApplicationInstance from '@ember/application/instance';\nimport type RouterService from '@ember/routing/router-service';\n\nimport { type RoutedApp, type StartApplicationOptions, startRoutedApp } from './application.ts';\nimport { FakeAdapter, FakeFrame } from './fake-adapter.ts';\nimport type { NativeOwner } from './owner.ts';\nimport { createDocument } from './render.ts';\nimport { type TestApp, testApp } from './testing.ts';\n\nexport interface ApplicationTestOptions extends StartApplicationOptions {\n platform?: 'ios' | 'android';\n}\n\nexport interface ApplicationTestApp extends Omit<TestApp, 'owner'> {\n owner: ApplicationInstance;\n router: RouterService;\n /** The URLs of the screens in the stack, from the first to the one on top. */\n readonly urls: string[];\n /** Transitions to a URL or a route, as `router.transitionTo` does, and waits for its screen. */\n visit(...args: Parameters<RouterService['transitionTo']>): Promise<void>;\n destroy(): void;\n}\n\n/** Boots the Application at its first URL on fake views, as createNativeApplication does on a phone. */\nexport async function startApplication(options: ApplicationTestOptions = {}): Promise<ApplicationTestApp> {\n const document = createDocument(new FakeAdapter(options.platform ?? 'ios'));\n const frame = new FakeFrame();\n const routed: RoutedApp = await startRoutedApp(document, frame, options);\n const helpers = testApp(routed.instance as unknown as NativeOwner, routed.navigator, frame);\n await helpers.settled();\n\n const app = helpers as unknown as ApplicationTestApp;\n Object.defineProperty(app, 'urls', { get: () => routed.urls });\n return Object.assign(app, {\n owner: routed.instance,\n router: routed.router,\n async visit(...args: Parameters<RouterService['transitionTo']>) {\n await routed.router.transitionTo(...args);\n await helpers.settled();\n },\n // The system's back: the page leaves, then the router follows it.\n async back() {\n frame.back();\n await routed.routed();\n await helpers.settled();\n },\n destroy: routed.destroy,\n });\n}\n"],"mappings":";;;;;;AAiCA,eAAsBK,iBAAiBC,UAAkC,CAAC,GAAgC;CACxG,MAAMC,WAAWJ,eAAe,IAAIF,YAAYK,QAAQE,YAAY,KAAK,CAAC;CAC1E,MAAMC,QAAQ,IAAIP,UAAU;CAC5B,MAAMQ,SAAoB,MAAMV,eAAeO,UAAUE,OAAOH,OAAO;CACvE,MAAMK,UAAUP,QAAQM,OAAOE,UAAoCF,OAAOG,WAAWJ,KAAK;CAC1F,MAAME,QAAQG,QAAQ;CAEtB,MAAMC,MAAMJ;CACZK,OAAOC,eAAeF,KAAK,QAAQ,EAAEG,WAAWR,OAAOS,KAAK,CAAC;CAC7D,OAAOH,OAAOI,OAAOL,KAAK;EACxBM,OAAOX,OAAOE;EACdU,QAAQZ,OAAOY;EACf,MAAMC,MAAM,GAAGC,MAAiD;GAC9D,MAAMd,OAAOY,OAAOG,aAAa,GAAGD,IAAI;GACxC,MAAMb,QAAQG,QAAQ;EACxB;EAEA,MAAMY,OAAO;GACXjB,MAAMiB,KAAK;GACX,MAAMhB,OAAOA,OAAO;GACpB,MAAMC,QAAQG,QAAQ;EACxB;EACAa,SAASjB,OAAOiB;CAClB,CAAC;AACH"}
@@ -0,0 +1,45 @@
1
+ import Application from '@ember/application';
2
+ import type ApplicationInstance from '@ember/application/instance';
3
+ import type RouterService from '@ember/routing/router-service';
4
+ import type { NativeDocument } from './dom.js';
5
+ import { type FrameHost, Navigator } from './navigator.js';
6
+ export interface StartApplicationOptions {
7
+ /**
8
+ * The modules Ember's resolver looks in, from `import.meta.glob`: `./router.ts`, `./routes/`, `./templates/`,
9
+ * `./controllers/`, `./services/`. Optional when `Application` already has its `modules`.
10
+ */
11
+ modules?: Record<string, unknown>;
12
+ /** An Application subclass to boot, for its initializers. Defaults to Ember's Application. */
13
+ Application?: typeof Application;
14
+ /** The URL the app starts at. Defaults to `/`. */
15
+ url?: string;
16
+ /**
17
+ * The screen under a deep link: when `url` is another, the app shows this one first and the URL's screen over it,
18
+ * so back from a link goes home, as a native app's does. Defaults to `/`; `null` shows the URL's screen alone.
19
+ */
20
+ home?: string | null;
21
+ }
22
+ interface InternalOptions extends StartApplicationOptions {
23
+ /** Runs once the router is there, before the first screen shows (the web host reads URLs from it). */
24
+ onBoot?: (router: RouterService) => void;
25
+ }
26
+ export interface RoutedApp {
27
+ app: Application;
28
+ instance: ApplicationInstance;
29
+ router: RouterService;
30
+ /** The `navigator` service: `back()`, `showModal()`, and `navigate()` for a screen that isn't a route. */
31
+ navigator: Navigator;
32
+ /** The URLs of the screens in the stack, from the first to the one on top. */
33
+ readonly urls: string[];
34
+ /** Resolves once the router has followed a back to the screen now on top. */
35
+ routed(): Promise<void>;
36
+ destroy(): void;
37
+ }
38
+ /**
39
+ * Boots an Ember Application, shows the route at `url` as the first screen, and pushes a screen for each route the
40
+ * router goes to after. The platform's entry (`createNativeApplication`, or `startApplication` in tests) passes the
41
+ * document and the Frame.
42
+ */
43
+ export declare function startRoutedApp(document: NativeDocument, host: FrameHost, options?: InternalOptions): Promise<RoutedApp>;
44
+ export {};
45
+ //# sourceMappingURL=application.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"application.d.ts","sourceRoot":"","sources":["../../src/application.ts"],"names":[],"mappings":"AAuBA,OAAO,WAAW,MAAM,oBAAoB,CAAC;AAC7C,OAAO,KAAK,mBAAmB,MAAM,6BAA6B,CAAC;AAEnE,OAAO,KAAK,aAAa,MAAM,+BAA+B,CAAC;AAI/D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAC/C,OAAO,EAAE,KAAK,SAAS,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAG3D,MAAM,WAAW,uBAAuB;IACtC;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAClC,8FAA8F;IAC9F,WAAW,CAAC,EAAE,OAAO,WAAW,CAAC;IACjC,kDAAkD;IAClD,GAAG,CAAC,EAAE,MAAM,CAAC;IACb;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACtB;AAED,UAAU,eAAgB,SAAQ,uBAAuB;IACvD,sGAAsG;IACtG,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,aAAa,KAAK,IAAI,CAAC;CAC1C;AAED,MAAM,WAAW,SAAS;IACxB,GAAG,EAAE,WAAW,CAAC;IACjB,QAAQ,EAAE,mBAAmB,CAAC;IAC9B,MAAM,EAAE,aAAa,CAAC;IACtB,0GAA0G;IAC1G,SAAS,EAAE,SAAS,CAAC;IACrB,8EAA8E;IAC9E,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,CAAC;IACxB,6EAA6E;IAC7E,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACxB,OAAO,IAAI,IAAI,CAAC;CACjB;AAeD;;;;GAIG;AACH,wBAAsB,cAAc,CAClC,QAAQ,EAAE,cAAc,EACxB,IAAI,EAAE,SAAS,EACf,OAAO,GAAE,eAAoB,GAC5B,OAAO,CAAC,SAAS,CAAC,CAmDpB"}
@@ -0,0 +1,136 @@
1
+ import Application from "@ember/application";
2
+ import RouteError from "../components/RouteError.js";
3
+ import { Navigator } from "./navigator.js";
4
+ // src/application.ts
5
+ /**
6
+ * Boots an Ember Application, shows the route at `url` as the first screen, and pushes a screen for each route the
7
+ * router goes to after. The platform's entry (`createNativeApplication`, or `startApplication` in tests) passes the
8
+ * document and the Frame.
9
+ */
10
+ async function startRoutedApp(document, host, options = {}) {
11
+ const Base = options.Application ?? Application;
12
+ const modules = options.modules;
13
+ const app = (modules ? class extends Base {
14
+ modules = modules;
15
+ } : Base).create({ autoboot: false });
16
+ const url = options.url ?? "/";
17
+ const home = options.home === void 0 ? "/" : options.home;
18
+ const first = home !== null && home !== url ? home : url;
19
+ const instance = await app.visit(first, {
20
+ isBrowser: false,
21
+ shouldRender: false,
22
+ location: "none"
23
+ });
24
+ const navigator = new Navigator(document, host, instance);
25
+ instance.register("service:navigator", navigator, { instantiate: false });
26
+ const router = instance.lookup("service:router");
27
+ options.onBoot?.(router);
28
+ const screens = new RouteScreens(instance, router, navigator);
29
+ screens.show(false);
30
+ router.on("routeDidChange", screens.onRouteDidChange);
31
+ if (first !== url) {
32
+ screens.animate = false;
33
+ try {
34
+ await router.transitionTo(url);
35
+ } finally {
36
+ screens.animate = true;
37
+ }
38
+ }
39
+ return {
40
+ app,
41
+ instance,
42
+ router,
43
+ navigator,
44
+ get urls() {
45
+ return screens.urls;
46
+ },
47
+ routed: () => screens.routed(),
48
+ destroy() {
49
+ router.off("routeDidChange", screens.onRouteDidChange);
50
+ navigator.destroy();
51
+ instance.destroy();
52
+ app.destroy();
53
+ }
54
+ };
55
+ }
56
+ var RouteScreens = class {
57
+ #entries = [];
58
+ /** Whether the next screens slide in. */
59
+ animate = true;
60
+ #back;
61
+ constructor(instance, router, navigator) {
62
+ this.instance = instance;
63
+ this.router = router;
64
+ this.navigator = navigator;
65
+ }
66
+ get urls() {
67
+ return this.#entries.map((entry) => entry.url);
68
+ }
69
+ async routed() {
70
+ if (this.#back) await Promise.resolve(this.#back).catch(() => void 0);
71
+ }
72
+ onRouteDidChange = (transition) => {
73
+ if (transition === this.#back) {
74
+ this.#back = void 0;
75
+ return;
76
+ }
77
+ const to = transition.to;
78
+ if (!to || isSubstate(to.name)) return;
79
+ const top = this.#entries.at(-1);
80
+ if (top && top.route === to.name && top.params === JSON.stringify(to.params)) {
81
+ top.url = this.router.currentURL ?? top.url;
82
+ return;
83
+ }
84
+ this.show(this.animate);
85
+ };
86
+ /** Pushes a screen for the route the router is on. */
87
+ show(animated) {
88
+ const name = this.router.currentRouteName;
89
+ if (!name) return;
90
+ const route = this.instance.lookup(`route:${name}`);
91
+ const templateName = route?.templateName ?? name.replace(/\./g, "/");
92
+ const template = this.instance.lookup(`template:${templateName}`);
93
+ let root;
94
+ if (template) root = this.navigator.navigate(template, {
95
+ name,
96
+ animated,
97
+ args: {
98
+ model: route?.modelFor(name),
99
+ controller: route?.controller
100
+ }
101
+ });
102
+ else {
103
+ const message = `[ember-nativescript] The route '${name}' has no template to show: add templates/${templateName}.gts.`;
104
+ console.error(message);
105
+ root = this.navigator.navigate(RouteError, {
106
+ name,
107
+ animated,
108
+ args: { message }
109
+ });
110
+ }
111
+ const entry = {
112
+ url: this.router.currentURL ?? "/",
113
+ route: name,
114
+ params: JSON.stringify(this.router.currentRoute?.params ?? {}),
115
+ root
116
+ };
117
+ root.element.addEventListener("navigatedFrom", (data) => {
118
+ if (data.isBackNavigation) this.#left(entry);
119
+ });
120
+ this.#entries.push(entry);
121
+ }
122
+ #left(entry) {
123
+ const index = this.#entries.indexOf(entry);
124
+ if (index === -1) return;
125
+ this.#entries.splice(index, 1);
126
+ const top = this.#entries.at(-1);
127
+ if (!top || top.url === this.router.currentURL) return;
128
+ const back = this.router.transitionTo(top.url);
129
+ this.#back = back;
130
+ back.catch(() => void 0);
131
+ }
132
+ };
133
+ var isSubstate = (name) => /(^|[._])loading$/.test(name);
134
+ export { startRoutedApp };
135
+
136
+ //# sourceMappingURL=application.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"application.js","names":["Application","RouteError","Navigator","startRoutedApp","document","host","options","Base","modules","App","app","create","autoboot","url","home","undefined","first","instance","visit","isBrowser","shouldRender","location","navigator","register","instantiate","router","lookup","onBoot","screens","RouteScreens","show","on","onRouteDidChange","animate","transitionTo","urls","routed","destroy","off","back","constructor","map","entry","Promise","resolve","catch","transition","to","isSubstate","name","top","at","route","params","JSON","stringify","currentURL","animated","currentRouteName","templateName","replace","template","root","navigate","args","model","modelFor","controller","message","console","error","currentRoute","element","addEventListener","data","isBackNavigation","push","index","indexOf","splice","test"],"sources":["../../src/application.ts"],"sourcesContent":["// Opt-in: a full Ember Application on native views, with Ember's router deciding where the app is and each route\n// shown as a screen of its own.\n//\n// What a phone does doesn't change: each screen is a page in NativeScript's Frame, pushed with its animation, and\n// the system's back (Android's button, iOS's swipe) pops it. What changes is who says where to go: the router, with\n// `router.transitionTo('rides.ride', 42)`, routes, `model()` hooks, controllers and the router service, as in any\n// Ember app.\n//\n// How the two fit:\n//\n// - The Application boots as FastBoot boots one, outside a browser and without rendering (`shouldRender: false`), so\n// the router runs and Ember's renderer doesn't. Each route's template is rendered here, with Ember's public\n// `renderComponent`, into a page of its own.\n// - A transition that lands on a route pushes a page with that route's template, given `@model` and `@controller`.\n// The model is the one the route had then, and stays: the screens under the top one keep what they showed, as a\n// native app's do, however the router moves on. So the same route twice (a profile from a profile) is two pages.\n// - A page that leaves by a back (the system's, or `navigator.back()`) takes the router back to the URL of the page\n// now on top, without rendering it again: it's still there.\n// - The router's location is `none`: on a phone there's no URL bar. `router.currentURL` still says where the app is.\n//\n// Only the leaf route's template is shown: the application template and those of parent routes, with their\n// {{outlet}}, aren't (yet). A parent's model is there with `modelFor` in the leaf's route.\n\nimport Application from '@ember/application';\nimport type ApplicationInstance from '@ember/application/instance';\nimport type Route from '@ember/routing/route';\nimport type RouterService from '@ember/routing/router-service';\nimport type Transition from '@ember/routing/transition';\n\nimport RouteError from '../components/RouteError.gts';\nimport type { NativeDocument } from './dom.ts';\nimport { type FrameHost, Navigator } from './navigator.ts';\nimport type { NativeRoot } from './render.ts';\n\nexport interface StartApplicationOptions {\n /**\n * The modules Ember's resolver looks in, from `import.meta.glob`: `./router.ts`, `./routes/`, `./templates/`,\n * `./controllers/`, `./services/`. Optional when `Application` already has its `modules`.\n */\n modules?: Record<string, unknown>;\n /** An Application subclass to boot, for its initializers. Defaults to Ember's Application. */\n Application?: typeof Application;\n /** The URL the app starts at. Defaults to `/`. */\n url?: string;\n /**\n * The screen under a deep link: when `url` is another, the app shows this one first and the URL's screen over it,\n * so back from a link goes home, as a native app's does. Defaults to `/`; `null` shows the URL's screen alone.\n */\n home?: string | null;\n}\n\ninterface InternalOptions extends StartApplicationOptions {\n /** Runs once the router is there, before the first screen shows (the web host reads URLs from it). */\n onBoot?: (router: RouterService) => void;\n}\n\nexport interface RoutedApp {\n app: Application;\n instance: ApplicationInstance;\n router: RouterService;\n /** The `navigator` service: `back()`, `showModal()`, and `navigate()` for a screen that isn't a route. */\n navigator: Navigator;\n /** The URLs of the screens in the stack, from the first to the one on top. */\n readonly urls: string[];\n /** Resolves once the router has followed a back to the screen now on top. */\n routed(): Promise<void>;\n destroy(): void;\n}\n\ninterface Entry {\n url: string;\n route: string;\n params: string;\n root: NativeRoot;\n}\n\ninterface NavigatedData {\n isBackNavigation?: boolean;\n}\n\ntype BootOptions = Parameters<Application['visit']>[1];\n\n/**\n * Boots an Ember Application, shows the route at `url` as the first screen, and pushes a screen for each route the\n * router goes to after. The platform's entry (`createNativeApplication`, or `startApplication` in tests) passes the\n * document and the Frame.\n */\nexport async function startRoutedApp(\n document: NativeDocument,\n host: FrameHost,\n options: InternalOptions = {},\n): Promise<RoutedApp> {\n const Base = options.Application ?? Application;\n const modules = options.modules;\n const App = modules\n ? class extends Base {\n modules = modules;\n }\n : Base;\n const app = App.create({ autoboot: false });\n const url = options.url ?? '/';\n const home = options.home === undefined ? '/' : options.home;\n const first = home !== null && home !== url ? home : url;\n const instance = (await app.visit(first, {\n isBrowser: false,\n shouldRender: false,\n location: 'none',\n } as BootOptions)) as ApplicationInstance;\n\n const navigator = new Navigator(document, host, instance);\n instance.register('service:navigator', navigator, { instantiate: false });\n const router = instance.lookup('service:router') as RouterService;\n options.onBoot?.(router);\n const screens = new RouteScreens(instance, router, navigator);\n screens.show(false);\n router.on('routeDidChange', screens.onRouteDidChange);\n if (first !== url) {\n // The deep link, over the home screen, without an animation: it's where the app opens.\n screens.animate = false;\n try {\n await router.transitionTo(url);\n } finally {\n screens.animate = true;\n }\n }\n\n return {\n app,\n instance,\n router,\n navigator,\n get urls() {\n return screens.urls;\n },\n routed: () => screens.routed(),\n destroy() {\n router.off('routeDidChange', screens.onRouteDidChange);\n navigator.destroy();\n instance.destroy();\n app.destroy();\n },\n };\n}\n\nclass RouteScreens {\n readonly #entries: Entry[] = [];\n /** Whether the next screens slide in. */\n animate = true;\n // The transition that takes the router back after a page left: the page it lands on is already shown.\n #back: Transition | undefined;\n\n constructor(\n readonly instance: ApplicationInstance,\n readonly router: RouterService,\n readonly navigator: Navigator,\n ) {}\n\n get urls(): string[] {\n return this.#entries.map((entry) => entry.url);\n }\n\n async routed(): Promise<void> {\n if (this.#back) await Promise.resolve(this.#back).catch(() => undefined);\n }\n\n onRouteDidChange = (transition: Transition): void => {\n if (transition === this.#back) {\n this.#back = undefined;\n return;\n }\n const to = transition.to;\n if (!to || isSubstate(to.name)) return;\n const top = this.#entries.at(-1);\n // Only the query params changed: same screen, a new URL.\n if (top && top.route === to.name && top.params === JSON.stringify(to.params)) {\n top.url = this.router.currentURL ?? top.url;\n return;\n }\n this.show(this.animate);\n };\n\n /** Pushes a screen for the route the router is on. */\n show(animated: boolean): void {\n const name = this.router.currentRouteName;\n if (!name) return;\n const route = this.instance.lookup(`route:${name}`) as Route | undefined;\n const templateName = route?.templateName ?? name.replace(/\\./g, '/');\n const template = this.instance.lookup(`template:${templateName}`) as object | undefined;\n let root: NativeRoot;\n if (template) {\n root = this.navigator.navigate(template, {\n name,\n animated,\n args: { model: route?.modelFor(name), controller: route?.controller },\n });\n } else {\n // A screen that says what's wrong, rather than an error thrown from the router's event, which would end the app.\n const message = `[ember-nativescript] The route '${name}' has no template to show: add templates/${templateName}.gts.`;\n console.error(message);\n root = this.navigator.navigate(RouteError, { name, animated, args: { message } });\n }\n const entry: Entry = {\n url: this.router.currentURL ?? '/',\n route: name,\n params: JSON.stringify(this.router.currentRoute?.params ?? {}),\n root,\n };\n root.element.addEventListener('navigatedFrom', (data: unknown) => {\n if ((data as NavigatedData).isBackNavigation) this.#left(entry);\n });\n this.#entries.push(entry);\n }\n\n // A page left by a back: the router goes back to the URL of the page now on top.\n #left(entry: Entry): void {\n const index = this.#entries.indexOf(entry);\n if (index === -1) return;\n this.#entries.splice(index, 1);\n const top = this.#entries.at(-1);\n if (!top || top.url === this.router.currentURL) return;\n const back = this.router.transitionTo(top.url);\n this.#back = back;\n // A back the app redirects elsewhere (a guard in beforeModel) is a new screen: onRouteDidChange shows it.\n back.catch(() => undefined);\n }\n}\n\nconst isSubstate = (name: string): boolean => /(^|[._])loading$/.test(name);\n"],"mappings":";;;;;;;;;AAuFA,eAAsBG,eACpBC,UACAC,MACAC,UAA2B,CAAC,GACR;CACpB,MAAMC,OAAOD,QAAQN,eAAeA;CACpC,MAAMQ,UAAUF,QAAQE;CAMxB,MAAME,OALMF,UACR,cAAcD,KAAK;EACjBC,UAAUA;CACZ,IACAD,KAAAA,CACYI,OAAO,EAAEC,UAAU,MAAM,CAAC;CAC1C,MAAMC,MAAMP,QAAQO,OAAO;CAC3B,MAAMC,OAAOR,QAAQQ,SAASC,KAAAA,IAAY,MAAMT,QAAQQ;CACxD,MAAME,QAAQF,SAAS,QAAQA,SAASD,MAAMC,OAAOD;CACrD,MAAMI,WAAY,MAAMP,IAAIQ,MAAMF,OAAO;EACvCG,WAAW;EACXC,cAAc;EACdC,UAAU;CACZ,CAAgB;CAEhB,MAAMC,YAAY,IAAIpB,UAAUE,UAAUC,MAAMY,QAAQ;CACxDA,SAASM,SAAS,qBAAqBD,WAAW,EAAEE,aAAa,MAAM,CAAC;C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GAAG,EAAE;EAC/B,IAAI,CAACD,OAAOA,IAAIrC,QAAQ,KAAKY,OAAO+B,YAAY;EAChD,MAAMjB,OAAO,KAAKd,OAAOS,aAAagB,IAAIrC,GAAG;EAC7C,KAAK,QAAQ0B;EAEbA,KAAKM,YAAY9B,KAAAA,CAAS;CAC5B;AACF;AAEA,IAAMiC,cAAcC,SAA0B,mBAAmB+B,KAAK/B,IAAI"}
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;AAE9B,IAAM,eAAe,SAAwB;CAC3C,MAAM,IAAI,MAAM,wBAAwB,KAAK,4BAA4B;AAC3E;AAEA,IAAsB,aAAtB,MAAiC;CAMV;CAJrB,aAAkC;CAClC,kBAA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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,KAAK,IAAI,OAAO,KAAK,YAAY,MAAM,OAAO,KAAK,aAAa,MAAM,KAAK,IAAI;EAC/E,OAAO;CACT;CAEA,YAAkC,MAAY;EAC5C,OAAO,KAAK,aAAa,M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,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"}
@@ -7,12 +7,12 @@ export { type FrameHost, type ModalOptions, type NavigateOptions, Navigator, typ
7
7
  export { createNativeApp, FrameNavigationHost, type NativeApp, type NativeAppOptions } from './nativescript-app.js';
8
8
  export { NativeScriptAdapter, registerElement } from './nativescript-adapter.js';
9
9
  export { createOwner, type CreateOwnerOptions, type NativeOwner, type ServiceEntry } from './owner.js';
10
- export { isAndroid, isIOS, platform } from './platform.js';
10
+ export { isAndroid, isIOS, isWeb, platform, type Platform } from './platform.js';
11
11
  export { createDocument, type NativeRoot, renderNative } from './render.js';
12
12
  export { bind } from './bind.js';
13
13
  export { nativeView } from './native-view.js';
14
14
  export { default as NativeFrame } from '../components/NativeFrame.js';
15
15
  export { default as NativeList } from '../components/NativeList.js';
16
- export { Android, IOS } from '../components/Platform.js';
16
+ export { Android, IOS, Web } from '../components/Platform.js';
17
17
  export type { NativeAttributes, NativeElementFor, NativeElementTagNameMap, NativeEvent } from '../types/glint.js';
18
18
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,WAAW,EAAE,QAAQ,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AACtF,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzD,OAAO,EAAE,aAAa,EAAE,KAAK,iBAAiB,EAAE,KAAK,IAAI,EAAE,MAAM,eAAe,CAAC;AACjF,OAAO,EAAE,YAAY,EAAE,KAAK,QAAQ,EAAE,MAAM,WAAW,CAAC;AACxD,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,KAAK,SAAS,EAAE,KAAK,YAAY,EAAE,KAAK,eAAe,EAAE,SAAS,EAAE,KAAK,WAAW,EAAE,MAAM,gBAAgB,CAAC;AACtH,OAAO,EAAE,eAAe,EAAE,mBAAmB,EAAE,KAAK,SAAS,EAAE,KAAK,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACpH,OAAO,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AACjF,OAAO,EAAE,WAAW,EAAE,KAAK,kBAAkB,EAAE,KAAK,WAAW,EAAE,KAAK,YAAY,EAAE,MAAM,YAAY,CAAC;AACvG,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,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