ember-nativescript 0.0.0-stage → 0.1.2

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 (99) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +421 -2
  3. package/dist/components/NativeFrame.d.ts +28 -0
  4. package/dist/components/NativeFrame.d.ts.map +1 -0
  5. package/dist/components/NativeFrame.js +39 -0
  6. package/dist/components/NativeFrame.js.map +1 -0
  7. package/dist/components/NativeList.d.ts +32 -0
  8. package/dist/components/NativeList.d.ts.map +1 -0
  9. package/dist/components/NativeList.js +44 -0
  10. package/dist/components/NativeList.js.map +1 -0
  11. package/dist/components/Platform.d.ts +21 -0
  12. package/dist/components/Platform.d.ts.map +1 -0
  13. package/dist/components/Platform.js +22 -0
  14. package/dist/components/Platform.js.map +1 -0
  15. package/dist/src/adapter.d.ts +51 -0
  16. package/dist/src/adapter.d.ts.map +1 -0
  17. package/dist/src/bind.d.ts +12 -0
  18. package/dist/src/bind.d.ts.map +1 -0
  19. package/dist/src/bind.js +32 -0
  20. package/dist/src/bind.js.map +1 -0
  21. package/dist/src/dom.d.ts +104 -0
  22. package/dist/src/dom.d.ts.map +1 -0
  23. package/dist/src/dom.js +329 -0
  24. package/dist/src/dom.js.map +1 -0
  25. package/dist/src/elements.d.ts +17 -0
  26. package/dist/src/elements.d.ts.map +1 -0
  27. package/dist/src/elements.js +52 -0
  28. package/dist/src/elements.js.map +1 -0
  29. package/dist/src/fake-adapter.d.ts +117 -0
  30. package/dist/src/fake-adapter.d.ts.map +1 -0
  31. package/dist/src/fake-adapter.js +400 -0
  32. package/dist/src/fake-adapter.js.map +1 -0
  33. package/dist/src/frame-host.d.ts +12 -0
  34. package/dist/src/frame-host.d.ts.map +1 -0
  35. package/dist/src/frame-host.js +34 -0
  36. package/dist/src/frame-host.js.map +1 -0
  37. package/dist/src/index.d.ts +18 -0
  38. package/dist/src/index.d.ts.map +1 -0
  39. package/dist/src/index.js +17 -0
  40. package/dist/src/list.d.ts +21 -0
  41. package/dist/src/list.d.ts.map +1 -0
  42. package/dist/src/list.js +96 -0
  43. package/dist/src/list.js.map +1 -0
  44. package/dist/src/modifier.d.ts +11 -0
  45. package/dist/src/modifier.d.ts.map +1 -0
  46. package/dist/src/modifier.js +27 -0
  47. package/dist/src/modifier.js.map +1 -0
  48. package/dist/src/native-view.d.ts +11 -0
  49. package/dist/src/native-view.d.ts.map +1 -0
  50. package/dist/src/native-view.js +28 -0
  51. package/dist/src/native-view.js.map +1 -0
  52. package/dist/src/nativescript-adapter.d.ts +26 -0
  53. package/dist/src/nativescript-adapter.d.ts.map +1 -0
  54. package/dist/src/nativescript-adapter.js +172 -0
  55. package/dist/src/nativescript-adapter.js.map +1 -0
  56. package/dist/src/nativescript-app.d.ts +18 -0
  57. package/dist/src/nativescript-app.d.ts.map +1 -0
  58. package/dist/src/nativescript-app.js +32 -0
  59. package/dist/src/nativescript-app.js.map +1 -0
  60. package/dist/src/navigator.d.ts +65 -0
  61. package/dist/src/navigator.d.ts.map +1 -0
  62. package/dist/src/navigator.js +141 -0
  63. package/dist/src/navigator.js.map +1 -0
  64. package/dist/src/owner.d.ts +39 -0
  65. package/dist/src/owner.d.ts.map +1 -0
  66. package/dist/src/owner.js +185 -0
  67. package/dist/src/owner.js.map +1 -0
  68. package/dist/src/platform.d.ts +5 -0
  69. package/dist/src/platform.d.ts.map +1 -0
  70. package/dist/src/platform.js +11 -0
  71. package/dist/src/platform.js.map +1 -0
  72. package/dist/src/render.d.ts +18 -0
  73. package/dist/src/render.d.ts.map +1 -0
  74. package/dist/src/render.js +32 -0
  75. package/dist/src/render.js.map +1 -0
  76. package/dist/src/testing-core.d.ts +147 -0
  77. package/dist/src/testing-core.d.ts.map +1 -0
  78. package/dist/src/testing-core.js +110 -0
  79. package/dist/src/testing-core.js.map +1 -0
  80. package/dist/src/testing.d.ts +38 -0
  81. package/dist/src/testing.d.ts.map +1 -0
  82. package/dist/src/testing.js +74 -0
  83. package/dist/src/testing.js.map +1 -0
  84. package/dist/src/vendor-excludes.d.ts +6 -0
  85. package/dist/src/vendor-excludes.d.ts.map +1 -0
  86. package/dist/src/vendor-excludes.js +38 -0
  87. package/dist/src/vendor-excludes.js.map +1 -0
  88. package/dist/src/vite.d.ts +10 -0
  89. package/dist/src/vite.d.ts.map +1 -0
  90. package/dist/src/vite.js +14 -0
  91. package/dist/src/vite.js.map +1 -0
  92. package/dist/src/vitest.d.ts +5 -0
  93. package/dist/src/vitest.d.ts.map +1 -0
  94. package/dist/src/vitest.js +23 -0
  95. package/dist/src/vitest.js.map +1 -0
  96. package/dist/types/glint.d.ts +164 -0
  97. package/dist/vendor/runtime--fcdnjmJ.js +43 -0
  98. package/dist/vendor/runtime--fcdnjmJ.js.map +1 -0
  99. package/package.json +105 -4
@@ -0,0 +1,22 @@
1
+ import { isAndroid, isIOS } from "../src/platform.js";
2
+ import { setComponentTemplate } from "@ember/component";
3
+ import { createTemplateFactory } from "@ember/template-factory";
4
+ import templateOnly from "@ember/component/template-only";
5
+ // components/Platform.gts
6
+ var IOS = setComponentTemplate(createTemplateFactory({
7
+ "id": null,
8
+ "block": "[[[41,[28,[32,0],null,null],[[[18,1,null]],[]],null]],[\"&default\"],[\"if\",\"yield\"]]",
9
+ "moduleName": "(unknown template module)",
10
+ "scope": () => ({ isIOS }),
11
+ "isStrictMode": true
12
+ }), templateOnly());
13
+ var Android = setComponentTemplate(createTemplateFactory({
14
+ "id": null,
15
+ "block": "[[[41,[28,[32,0],null,null],[[[18,1,null]],[]],null]],[\"&default\"],[\"if\",\"yield\"]]",
16
+ "moduleName": "(unknown template module)",
17
+ "scope": () => ({ isAndroid }),
18
+ "isStrictMode": true
19
+ }), templateOnly());
20
+ export { Android, IOS };
21
+
22
+ //# sourceMappingURL=Platform.js.map
@@ -0,0 +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"}
@@ -0,0 +1,51 @@
1
+ import type { FrameHost } from './navigator.js';
2
+ export type Listener = (data: unknown) => void;
3
+ /** A list view's rows, for {@link NativeAdapter.bindList}. */
4
+ export interface ListOptions {
5
+ /** The kinds of row, when there is more than one. The list only reuses a cell for a row of the same kind. */
6
+ kinds?: readonly string[];
7
+ /** The kind of the row at an index. */
8
+ kindOf?: (index: number) => string;
9
+ }
10
+ export interface ListBinding {
11
+ /** How many rows the list has. The list asks for the cells it shows on its next layout, not right away. */
12
+ setCount(count: number): void;
13
+ /** Stops asking for cells. */
14
+ release(): void;
15
+ }
16
+ export interface NativeAdapter<View = unknown> {
17
+ /** A view for an element's tag, or `null` for tags that have no view (they render nothing natively). */
18
+ createView(tag: string): View | null;
19
+ /**
20
+ * Sets a property from a template attribute: a string for a static attribute, as NativeScript's XML gives it, and the
21
+ * value itself for a dynamic one. `null` unsets it.
22
+ */
23
+ setProperty(view: View, name: string, value: unknown): void;
24
+ /**
25
+ * Whether the view has a property by this name. A dynamic attribute for one (`items={{this.list}}`) is set to its
26
+ * value as is; any other attribute is set as a string, as in NativeScript's XML.
27
+ */
28
+ hasProperty?(view: View, name: string): boolean;
29
+ /** Whether text children of this view become its `text` property (labels, buttons, text fields). */
30
+ 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';
33
+ /** Puts `child` at `index` among the views `parent` holds. */
34
+ insertChild(parent: View, child: View, index: number): void;
35
+ removeChild(parent: View, child: View): void;
36
+ /** Puts `child` in a property of `parent` that holds one view (a page's actionBar), or empties it with `null`. */
37
+ setSlot(parent: View, property: string, child: View | null): void;
38
+ /** Puts `child` at `index` in a property of `parent` that holds a list (an ActionBar's actionItems). */
39
+ insertInSlot(parent: View, property: string, child: View, index: number): void;
40
+ removeFromSlot(parent: View, property: string, child: View): void;
41
+ on(view: View, event: string, listener: Listener): void;
42
+ off(view: View, event: string, listener: Listener): void;
43
+ /**
44
+ * For views that make and recycle their own cells, such as NativeScript's ListView: calls `cell` with a cell's
45
+ * container, new or recycled, and the row it is about to show. `null` when the view isn't a list.
46
+ */
47
+ /** Shows screens in a frame view (a Frame inside a tab), or `null` if the view isn't one. */
48
+ frameHost?(view: View): FrameHost<View> | null;
49
+ bindList?(view: View, cell: (container: View, index: number) => void, options?: ListOptions): ListBinding | null;
50
+ }
51
+ //# sourceMappingURL=adapter.d.ts.map
@@ -0,0 +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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AM,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,GAAG,IAAI,CAAC;IAClE,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,GAAG,IAAI,CAAC;IACxD,GAAG,CAAC,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"}
@@ -0,0 +1,12 @@
1
+ import type { ModifierLike } from '@glint/template';
2
+ /** `{{bind object 'field'}}`: the field must be one of the object's own, and tracked. */
3
+ export declare const bind: abstract new <Target extends object, Key extends keyof Target & string>() => InstanceType<ModifierLike<{
4
+ Element: Element;
5
+ Args: {
6
+ Positional: [target: Target, key: Key];
7
+ Named: {
8
+ property?: string;
9
+ };
10
+ };
11
+ }>>;
12
+ //# sourceMappingURL=bind.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bind.d.ts","sourceRoot":"","sources":["../../src/bind.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AA8CpD,yFAAyF;AACzF,eAAO,MAAM,IAAI,EAA8B,QAAQ,MACrD,MAAM,SAAS,MAAM,EACrB,GAAG,SAAS,MAAM,MAAM,GAAG,MAAM,OAC5B,YAAY,CACjB,YAAY,CAAC;IAAE,OAAO,EAAE,OAAO,CAAC;IAAC,IAAI,EAAE;QAAE,UAAU,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC;QAAC,KAAK,EAAE;YAAE,QAAQ,CAAC,EAAE,MAAM,CAAA;SAAE,CAAA;KAAE,CAAA;CAAE,CAAC,CACnH,CAAC"}
@@ -0,0 +1,32 @@
1
+ import { modifier } from "./modifier.js";
2
+ // src/bind.ts
3
+ var VALUE_PROPERTY = {
4
+ textField: "text",
5
+ textView: "text",
6
+ searchBar: "text",
7
+ switch: "checked",
8
+ slider: "value",
9
+ datePicker: "date",
10
+ timePicker: "time",
11
+ listPicker: "selectedIndex",
12
+ segmentedBar: "selectedIndex",
13
+ tabView: "selectedIndex"
14
+ };
15
+ /** `{{bind object 'field'}}`: the field must be one of the object's own, and tracked. */
16
+ var bind = modifier((element, [target, key], { property }) => {
17
+ const native = element;
18
+ const name = property ?? VALUE_PROPERTY[native.localName];
19
+ if (!name) throw new Error(`[ember-nativescript] {{bind}} doesn't know which property of <${native.localName}> holds its value; pass property=.`);
20
+ const value = target[key];
21
+ if (native.properties.get(name) !== value) native.setProperty(name, value);
22
+ const changed = (data) => {
23
+ const next = data.value;
24
+ native.properties.set(name, next);
25
+ if (target[key] !== next) target[key] = next;
26
+ };
27
+ native.addEventListener(`${name}Change`, changed);
28
+ return () => native.removeEventListener(`${name}Change`, changed);
29
+ });
30
+ export { bind };
31
+
32
+ //# sourceMappingURL=bind.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bind.js","names":["modifier","VALUE_PROPERTY","textField","textView","searchBar","switch","slider","datePicker","timePicker","listPicker","segmentedBar","tabView","bindModifier","element","target","key","property","native","name","localName","Error","value","properties","get","setProperty","changed","data","next","set","addEventListener","removeEventListener","bind"],"sources":["../../src/bind.ts"],"sourcesContent":["// Two-way binding for the views that hold a value, like Vue's v-model:\n//\n// <textField {{bind this 'name'}} />\n// <switch {{bind this.settings 'notifications'}} />\n// <slider {{bind this 'volume'}} />\n//\n// The view's property follows the tracked field, and the field follows the user: the modifier listens to the\n// property's change event (`textChange`, `checkedChange`…) and writes the new value back. Which property depends on the\n// tag; `property=` picks another one.\nimport type { ModifierLike } from '@glint/template';\n\nimport type { NativeElement } from './dom.ts';\nimport { modifier } from './modifier.ts';\n\nconst VALUE_PROPERTY: Record<string, string> = {\n textField: 'text',\n textView: 'text',\n searchBar: 'text',\n switch: 'checked',\n slider: 'value',\n datePicker: 'date',\n timePicker: 'time',\n listPicker: 'selectedIndex',\n segmentedBar: 'selectedIndex',\n tabView: 'selectedIndex',\n};\n\ninterface ChangeData {\n value: unknown;\n}\n\nconst bindModifier = modifier<[target: Record<string, unknown>, key: string], { property?: string }>(\n (element, [target, key], { property }) => {\n const native = element as unknown as NativeElement;\n const name = property ?? VALUE_PROPERTY[native.localName];\n if (!name) {\n throw new Error(\n `[ember-nativescript] {{bind}} doesn't know which property of <${native.localName}> holds its value; pass property=.`,\n );\n }\n\n const value = target[key];\n // Don't write back what the user just typed: setting a TextField's text moves the cursor.\n if (native.properties.get(name) !== value) native.setProperty(name, value);\n\n const changed = (data: unknown): void => {\n const next = (data as ChangeData).value;\n native.properties.set(name, next);\n if (target[key] !== next) target[key] = next;\n };\n native.addEventListener(`${name}Change`, changed);\n return () => native.removeEventListener(`${name}Change`, changed);\n },\n);\n\n/** `{{bind object 'field'}}`: the field must be one of the object's own, and tracked. */\nexport const bind = bindModifier as unknown as abstract new <\n Target extends object,\n Key extends keyof Target & string,\n>() => InstanceType<\n ModifierLike<{ Element: Element; Args: { Positional: [target: Target, key: Key]; Named: { property?: string } } }>\n>;\n"],"mappings":";;AAcA,IAAMC,iBAAyC;CAC7CC,WAAW;CACXC,UAAU;CACVC,WAAW;CACXC,QAAQ;CACRC,QAAQ;CACRC,YAAY;CACZC,YAAY;CACZC,YAAY;CACZC,cAAc;CACdC,SAAS;AACX;;AA+BA,IAAaoB,OAzBQ/B,UAClBa,SAAS,CAACC,QAAQC,MAAM,EAAEC,eAAe;CACxC,MAAMC,SAASJ;CACf,MAAMK,OAAOF,YAAYf,eAAegB,OAAOE;CAC/C,IAAI,CAACD,MACH,MAAM,IAAIE,MACR,iEAAiEH,OAAOE,UAAS,mCACnF;CAGF,MAAME,QAAQP,OAAOC;CAErB,IAAIE,OAAOK,WAAWC,IAAIL,IAAI,MAAMG,OAAOJ,OAAOO,YAAYN,MAAMG,KAAK;CAEzE,MAAMI,WAAWC,SAAwB;EACvC,MAAMC,OAAQD,KAAoBL;EAClCJ,OAAOK,WAAWM,IAAIV,MAAMS,IAAI;EAChC,IAAIb,OAAOC,SAASY,MAAMb,OAAOC,OAAOY;CAC1C;CACAV,OAAOY,iBAAiB,GAAGX,KAAI,SAAUO,OAAO;CAChD,aAAaR,OAAOa,oBAAoB,GAAGZ,KAAI,SAAUO,OAAO;AAClE,CAIkBb"}
@@ -0,0 +1,104 @@
1
+ import type { Listener, NativeAdapter } from './adapter.js';
2
+ export declare const ELEMENT_NODE = 1;
3
+ export declare const TEXT_NODE = 3;
4
+ export declare const COMMENT_NODE = 8;
5
+ export declare const DOCUMENT_NODE = 9;
6
+ export declare const DOCUMENT_FRAGMENT_NODE = 11;
7
+ export declare const HTML_NAMESPACE = "http://www.w3.org/1999/xhtml";
8
+ export declare abstract class NativeNode {
9
+ readonly ownerDocument: NativeDocument;
10
+ abstract readonly nodeType: number;
11
+ parentNode: NativeParent | null;
12
+ previousSibling: NativeNode | null;
13
+ nextSibling: NativeNode | null;
14
+ constructor(ownerDocument: NativeDocument);
15
+ get parentElement(): NativeElement | null;
16
+ abstract get nodeName(): string;
17
+ }
18
+ declare abstract class NativeParent extends NativeNode {
19
+ firstChild: NativeNode | null;
20
+ lastChild: NativeNode | null;
21
+ get childNodes(): NativeNode[];
22
+ appendChild<T extends NativeNode>(node: T): T;
23
+ insertBefore<T extends NativeNode>(node: T, reference: NativeNode | null): T;
24
+ removeChild<T extends NativeNode>(node: T): T;
25
+ protected childInserted(_node: NativeNode): void;
26
+ protected childRemoving(_node: NativeNode): void;
27
+ protected childRemoved(_node: NativeNode): void;
28
+ }
29
+ export declare class NativeText extends NativeNode {
30
+ #private;
31
+ readonly nodeType = 3;
32
+ constructor(document: NativeDocument, data: string);
33
+ get nodeName(): string;
34
+ get nodeValue(): string;
35
+ set nodeValue(value: string);
36
+ get data(): string;
37
+ set data(value: string);
38
+ get textContent(): string;
39
+ }
40
+ export declare class NativeComment extends NativeNode {
41
+ nodeValue: string;
42
+ readonly nodeType = 8;
43
+ constructor(document: NativeDocument, nodeValue: string);
44
+ get nodeName(): string;
45
+ }
46
+ export declare class NativeFragment extends NativeParent {
47
+ readonly nodeType = 11;
48
+ get nodeName(): string;
49
+ }
50
+ export declare class NativeElement extends NativeParent {
51
+ #private;
52
+ readonly localName: string;
53
+ readonly nodeType = 1;
54
+ readonly namespaceURI = "http://www.w3.org/1999/xhtml";
55
+ readonly attributes: Map<string, string>;
56
+ /** Values set as properties, as they are: what dynamic attributes such as `items={{this.list}}` assigned. */
57
+ readonly properties: Map<string, unknown>;
58
+ readonly view: unknown;
59
+ constructor(document: NativeDocument, localName: string, view?: unknown);
60
+ get tagName(): string;
61
+ get nodeName(): string;
62
+ get id(): string;
63
+ set id(value: string);
64
+ get classList(): string[];
65
+ getAttribute(name: string): string | null;
66
+ hasAttribute(name: string): boolean;
67
+ setAttribute(name: string, value: string): void;
68
+ removeAttribute(name: string): void;
69
+ /** Sets a view property to a value as it is. Glimmer does this for dynamic attributes, through `element[name] = value`. */
70
+ setProperty(name: string, value: unknown): void;
71
+ setAttributeNS(namespace: string | null, name: string, value: string): void;
72
+ removeAttributeNS(_namespace: string | null, name: string): void;
73
+ addEventListener(event: string, listener: Listener | {
74
+ handleEvent: Listener;
75
+ }): void;
76
+ removeEventListener(event: string, listener: Listener): void;
77
+ /** How many listeners the element holds, for tests that check clean-up. */
78
+ get listenerCount(): number;
79
+ get textContent(): string;
80
+ set innerHTML(html: string);
81
+ insertAdjacentHTML(): never;
82
+ /** Recomputes the text property of a view that takes text from its text children. */
83
+ syncText(): void;
84
+ protected childInserted(node: NativeNode): void;
85
+ protected childRemoving(node: NativeNode): void;
86
+ protected childRemoved(node: NativeNode): void;
87
+ }
88
+ export declare class NativeDocument extends NativeParent {
89
+ readonly adapter: NativeAdapter;
90
+ readonly nodeType = 9;
91
+ /** Text that landed outside a view that takes text, so nothing shows it. */
92
+ readonly droppedText: string[];
93
+ constructor(adapter: NativeAdapter);
94
+ get nodeName(): string;
95
+ createElement(tag: string): NativeElement;
96
+ createElementNS(namespace: string | null, tag: string): NativeElement;
97
+ /** An element for a view the toolkit made itself, such as a list's cell, so Glimmer can render into it. */
98
+ adopt(view: unknown, tag?: string): NativeElement;
99
+ createTextNode(data: string): NativeText;
100
+ createComment(data: string): NativeComment;
101
+ createDocumentFragment(): NativeFragment;
102
+ }
103
+ export {};
104
+ //# sourceMappingURL=dom.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dom.d.ts","sourceRoot":"","sources":["../../src/dom.ts"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAG5D,eAAO,MAAM,YAAY,IAAI,CAAC;AAC9B,eAAO,MAAM,SAAS,IAAI,CAAC;AAC3B,eAAO,MAAM,YAAY,IAAI,CAAC;AAC9B,eAAO,MAAM,aAAa,IAAI,CAAC;AAC/B,eAAO,MAAM,sBAAsB,KAAK,CAAC;AAEzC,eAAO,MAAM,cAAc,iCAAiC,CAAC;AAM7D,8BAAsB,UAAU;IAMlB,QAAQ,CAAC,aAAa,EAAE,cAAc;IALlD,QAAQ,CAAC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IACnC,UAAU,EAAE,YAAY,GAAG,IAAI,CAAQ;IACvC,eAAe,EAAE,UAAU,GAAG,IAAI,CAAQ;IAC1C,WAAW,EAAE,UAAU,GAAG,IAAI,CAAQ;gBAEjB,aAAa,EAAE,cAAc;IAElD,IAAI,aAAa,IAAI,aAAa,GAAG,IAAI,CAExC;IAED,QAAQ,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AQ,CAAA;KAAE,GAAG,IAAI;IAgBrF,mBAAmB,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,GAAG,IAAI;IAQ5D,2EAA2E;IAC3E,IAAI,aAAa,IAAI,MAAM,CAI1B;IAED,IAAI,WAAW,IAAI,MAAM,CAExB;IAGD,IAAI,SAAS,CAAC,IAAI,EAAE,MAAM,EAGzB;IAED,kBAAkB,IAAI,KAAK;IAW3B,qFAAqF;IACrF,QAAQ,IAAI,IAAI;cAcG,aAAa,CAAC,IAAI,EAAE,UAAU,GAAG,IAAI;cAqBrC,aAAa,CAAC,IAAI,EAAE,UAAU,GAAG,IAAI;cASrC,YAAY,CAAC,IAAI,EAAE,UAAU,GAAG,IAAI;CAyBxD;AAgCD,qBAAa,cAAe,SAAQ,YAAY;IAKlC,QAAQ,CAAC,OAAO,EAAE,aAAa;IAJ3C,QAAQ,CAAC,QAAQ,KAAiB;IAClC,4EAA4E;IAC5E,QAAQ,CAAC,WAAW,EAAE,MAAM,EAAE,CAAM;gBAEf,OAAO,EAAE,aAAa;IAK3C,IAAI,QAAQ,IAAI,MAAM,CAErB;IAED,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,aAAa;IAIzC,eAAe,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,EAAE,GAAG,EAAE,MAAM,GAAG,aAAa;IAKrE,2GAA2G;IAC3G,KAAK,CAAC,IAAI,EAAE,OAAO,EAAE,GAAG,SAAS,GAAG,aAAa;IAIjD,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,UAAU;IAIxC,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,aAAa;IAI1C,sBAAsB,IAAI,cAAc;CAGzC"}
@@ -0,0 +1,329 @@
1
+ import { slotFor } from "./elements.js";
2
+ var HTML_NAMESPACE = "http://www.w3.org/1999/xhtml";
3
+ var unsupported = (what) => {
4
+ throw new Error(`[ember-nativescript] ${what} has no native counterpart.`);
5
+ };
6
+ var NativeNode = class {
7
+ ownerDocument;
8
+ parentNode = null;
9
+ previousSibling = null;
10
+ nextSibling = null;
11
+ constructor(ownerDocument) {
12
+ this.ownerDocument = ownerDocument;
13
+ }
14
+ get parentElement() {
15
+ return this.parentNode instanceof NativeElement ? this.parentNode : null;
16
+ }
17
+ };
18
+ var NativeParent = class extends NativeNode {
19
+ firstChild = null;
20
+ lastChild = null;
21
+ get childNodes() {
22
+ const nodes = [];
23
+ for (let node = this.firstChild; node; node = node.nextSibling) nodes.push(node);
24
+ return nodes;
25
+ }
26
+ appendChild(node) {
27
+ return this.insertBefore(node, null);
28
+ }
29
+ insertBefore(node, reference) {
30
+ if (node instanceof NativeFragment) {
31
+ for (let child = node.firstChild; child;) {
32
+ const next = child.nextSibling;
33
+ this.insertBefore(child, reference);
34
+ child = next;
35
+ }
36
+ return node;
37
+ }
38
+ if (reference && reference.parentNode !== this) throw new Error("[ember-nativescript] insertBefore: the reference node is not a child of this node.");
39
+ node.parentNode?.removeChild(node);
40
+ const previous = reference ? reference.previousSibling : this.lastChild;
41
+ node.parentNode = this;
42
+ node.previousSibling = previous;
43
+ node.nextSibling = reference;
44
+ if (previous) previous.nextSibling = node;
45
+ else this.firstChild = node;
46
+ if (reference) reference.previousSibling = node;
47
+ else this.lastChild = node;
48
+ this.childInserted(node);
49
+ return node;
50
+ }
51
+ removeChild(node) {
52
+ if (node.parentNode !== this) throw new Error("[ember-nativescript] removeChild: the node is not a child of this node.");
53
+ this.childRemoving(node);
54
+ if (node.previousSibling) node.previousSibling.nextSibling = node.nextSibling;
55
+ else this.firstChild = node.nextSibling;
56
+ if (node.nextSibling) node.nextSibling.previousSibling = node.previousSibling;
57
+ else this.lastChild = node.previousSibling;
58
+ node.parentNode = node.previousSibling = node.nextSibling = null;
59
+ this.childRemoved(node);
60
+ return node;
61
+ }
62
+ childInserted(_node) {}
63
+ childRemoving(_node) {}
64
+ childRemoved(_node) {}
65
+ };
66
+ var NativeText = class extends NativeNode {
67
+ nodeType = 3;
68
+ #data;
69
+ constructor(document, data) {
70
+ super(document);
71
+ this.#data = data;
72
+ }
73
+ get nodeName() {
74
+ return "#text";
75
+ }
76
+ get nodeValue() {
77
+ return this.#data;
78
+ }
79
+ set nodeValue(value) {
80
+ this.#data = value;
81
+ this.parentElement?.syncText();
82
+ }
83
+ get data() {
84
+ return this.#data;
85
+ }
86
+ set data(value) {
87
+ this.nodeValue = value;
88
+ }
89
+ get textContent() {
90
+ return this.#data;
91
+ }
92
+ };
93
+ var NativeComment = class extends NativeNode {
94
+ nodeValue;
95
+ nodeType = 8;
96
+ constructor(document, nodeValue) {
97
+ super(document);
98
+ this.nodeValue = nodeValue;
99
+ }
100
+ get nodeName() {
101
+ return "#comment";
102
+ }
103
+ };
104
+ var NativeFragment = class extends NativeParent {
105
+ nodeType = 11;
106
+ get nodeName() {
107
+ return "#document-fragment";
108
+ }
109
+ };
110
+ var NativeElement = class NativeElement extends NativeParent {
111
+ localName;
112
+ nodeType = 1;
113
+ namespaceURI = HTML_NAMESPACE;
114
+ attributes = /* @__PURE__ */ new Map();
115
+ /** Values set as properties, as they are: what dynamic attributes such as `items={{this.list}}` assigned. */
116
+ properties = /* @__PURE__ */ new Map();
117
+ view;
118
+ #listeners = /* @__PURE__ */ new Map();
119
+ #text;
120
+ constructor(document, localName, view) {
121
+ super(document);
122
+ this.localName = localName;
123
+ this.view = view === void 0 ? document.adapter.createView(localName) : view;
124
+ if (this.view) exposeViewProperties(this);
125
+ }
126
+ get tagName() {
127
+ return this.localName.toUpperCase();
128
+ }
129
+ get nodeName() {
130
+ return this.tagName;
131
+ }
132
+ get id() {
133
+ return this.attributes.get("id") ?? "";
134
+ }
135
+ set id(value) {
136
+ this.setAttribute("id", value);
137
+ }
138
+ get classList() {
139
+ return (this.attributes.get("class") ?? "").split(/\s+/).filter(Boolean);
140
+ }
141
+ get #adapter() {
142
+ return this.ownerDocument.adapter;
143
+ }
144
+ getAttribute(name) {
145
+ return this.attributes.get(name) ?? null;
146
+ }
147
+ hasAttribute(name) {
148
+ return this.attributes.has(name);
149
+ }
150
+ setAttribute(name, value) {
151
+ const local = this.#forThisPlatform(name);
152
+ if (local === void 0) return;
153
+ if (local !== name) return this.setAttribute(local, value);
154
+ const string = String(value);
155
+ this.attributes.set(name, string);
156
+ this.properties.delete(name);
157
+ if (this.view) this.#adapter.setProperty(this.view, name, string);
158
+ }
159
+ removeAttribute(name) {
160
+ const local = this.#forThisPlatform(name);
161
+ if (local === void 0) return;
162
+ if (local !== name) return this.removeAttribute(local);
163
+ this.attributes.delete(name);
164
+ this.properties.delete(name);
165
+ if (this.view) this.#adapter.setProperty(this.view, name, null);
166
+ }
167
+ /** Sets a view property to a value as it is. Glimmer does this for dynamic attributes, through `element[name] = value`. */
168
+ setProperty(name, value) {
169
+ const local = this.#forThisPlatform(name);
170
+ if (local === void 0) return;
171
+ if (local !== name) return this.setProperty(local, value);
172
+ if (value === null || value === void 0) {
173
+ this.attributes.delete(name);
174
+ this.properties.delete(name);
175
+ } else {
176
+ this.properties.set(name, value);
177
+ if (typeof value === "object" || typeof value === "function") this.attributes.delete(name);
178
+ else this.attributes.set(name, String(value));
179
+ }
180
+ if (this.view) this.#adapter.setProperty(this.view, name, value ?? null);
181
+ }
182
+ setAttributeNS(namespace, name, value) {
183
+ if (namespace) unsupported(`The attribute ${name} in namespace ${namespace}`);
184
+ this.setAttribute(name, value);
185
+ }
186
+ removeAttributeNS(_namespace, name) {
187
+ this.removeAttribute(name);
188
+ }
189
+ addEventListener(event, listener) {
190
+ let byListener = this.#listeners.get(event);
191
+ if (!byListener) this.#listeners.set(event, byListener = /* @__PURE__ */ new Map());
192
+ if (byListener.has(listener)) return;
193
+ const handle = typeof listener === "function" ? listener : (data) => listener.handleEvent(data);
194
+ const call = (data) => {
195
+ if (data !== null && typeof data === "object") data.currentTarget = this;
196
+ handle(data);
197
+ };
198
+ byListener.set(listener, call);
199
+ if (this.view) this.#adapter.on(this.view, event, call);
200
+ }
201
+ removeEventListener(event, listener) {
202
+ const call = this.#listeners.get(event)?.get(listener);
203
+ if (!call) return;
204
+ this.#listeners.get(event).delete(listener);
205
+ if (this.view) this.#adapter.off(this.view, event, call);
206
+ }
207
+ /** How many listeners the element holds, for tests that check clean-up. */
208
+ get listenerCount() {
209
+ let count = 0;
210
+ for (const byListener of this.#listeners.values()) count += byListener.size;
211
+ return count;
212
+ }
213
+ get textContent() {
214
+ return this.childNodes.map((node) => node.textContent ?? "").join("");
215
+ }
216
+ set innerHTML(html) {
217
+ if (html !== "") unsupported("Setting innerHTML (a triple-curly {{{html}}} or htmlSafe string)");
218
+ while (this.firstChild) this.removeChild(this.firstChild);
219
+ }
220
+ insertAdjacentHTML() {
221
+ return unsupported("insertAdjacentHTML (a triple-curly {{{html}}} or htmlSafe string)");
222
+ }
223
+ #forThisPlatform(name) {
224
+ const match = /^(ios|android):(.+)$/.exec(name);
225
+ if (!match) return name;
226
+ return match[1] === this.#adapter.platform ? match[2] : void 0;
227
+ }
228
+ /** Recomputes the text property of a view that takes text from its text children. */
229
+ syncText() {
230
+ if (!this.view || !this.#adapter.takesText(this.view)) return;
231
+ let text = "";
232
+ for (let node = this.firstChild; node; node = node.nextSibling) if (node instanceof NativeText) text += node.nodeValue;
233
+ if (text !== this.#text) {
234
+ this.#text = text;
235
+ this.#adapter.setProperty(this.view, "text", text);
236
+ }
237
+ }
238
+ childInserted(node) {
239
+ if (node instanceof NativeText) {
240
+ if (this.view && this.#adapter.takesText(this.view)) this.syncText();
241
+ else if (node.nodeValue.trim()) this.ownerDocument.droppedText.push(node.nodeValue);
242
+ return;
243
+ }
244
+ const slot = node instanceof NativeElement ? this.#slotOf(node) : void 0;
245
+ if (slot && this.view && node.view) {
246
+ const child = node.view;
247
+ if (slot.list) this.#adapter.insertInSlot(this.view, slot.property, child, this.#indexIn(slot, node));
248
+ else this.#adapter.setSlot(this.view, slot.property, child);
249
+ } else if (node instanceof NativeElement && node.view && this.view) this.#adapter.insertChild(this.view, node.view, this.#nativeIndexOf(node));
250
+ else if (node instanceof NativeElement && node.view && !this.view) unsupported(`A <${node.localName}> inside <${this.localName}>, which has no view,`);
251
+ }
252
+ childRemoving(node) {
253
+ if (!(node instanceof NativeElement) || !node.view || !this.view) return;
254
+ const slot = this.#slotOf(node);
255
+ if (slot?.list) this.#adapter.removeFromSlot(this.view, slot.property, node.view);
256
+ else if (slot) this.#adapter.setSlot(this.view, slot.property, null);
257
+ else this.#adapter.removeChild(this.view, node.view);
258
+ }
259
+ childRemoved(node) {
260
+ if (node instanceof NativeText) this.syncText();
261
+ }
262
+ #slotOf(child) {
263
+ return slotFor(this.localName, child.localName);
264
+ }
265
+ #nativeIndexOf(target) {
266
+ let index = 0;
267
+ for (let node = this.firstChild; node && node !== target; node = node.nextSibling) if (node instanceof NativeElement && node.view && !this.#slotOf(node)) index++;
268
+ return index;
269
+ }
270
+ #indexIn(slot, target) {
271
+ let index = 0;
272
+ for (let node = this.firstChild; node && node !== target; node = node.nextSibling) if (node instanceof NativeElement && node.view && this.#slotOf(node)?.property === slot.property) index++;
273
+ return index;
274
+ }
275
+ };
276
+ function exposeViewProperties(element) {
277
+ const { view } = element;
278
+ const adapter = element.ownerDocument.adapter;
279
+ const isViewProperty = (target, key) => typeof key === "string" && !Reflect.has(target, key) && Boolean(adapter.hasProperty?.(view, key));
280
+ Object.setPrototypeOf(element, new Proxy(NativeElement.prototype, {
281
+ getPrototypeOf: () => NativeElement.prototype,
282
+ has: (target, key) => Reflect.has(target, key) || isViewProperty(target, key),
283
+ get(target, key, receiver) {
284
+ return receiver === element && isViewProperty(target, key) ? element.properties.get(key) : Reflect.get(target, key, receiver);
285
+ },
286
+ set(target, key, value, receiver) {
287
+ if (receiver !== element || !isViewProperty(target, key)) return Reflect.set(target, key, value, receiver);
288
+ element.setProperty(key, value);
289
+ return true;
290
+ }
291
+ }));
292
+ }
293
+ var NativeDocument = class extends NativeParent {
294
+ adapter;
295
+ nodeType = 9;
296
+ /** Text that landed outside a view that takes text, so nothing shows it. */
297
+ droppedText = [];
298
+ constructor(adapter) {
299
+ super(void 0);
300
+ this.adapter = adapter;
301
+ this.ownerDocument = this;
302
+ }
303
+ get nodeName() {
304
+ return "#document";
305
+ }
306
+ createElement(tag) {
307
+ return new NativeElement(this, tag);
308
+ }
309
+ createElementNS(namespace, tag) {
310
+ if (namespace && namespace !== "http://www.w3.org/1999/xhtml") unsupported(`<${tag}> in namespace ${namespace} (SVG or MathML)`);
311
+ return this.createElement(tag);
312
+ }
313
+ /** An element for a view the toolkit made itself, such as a list's cell, so Glimmer can render into it. */
314
+ adopt(view, tag = "cell") {
315
+ return new NativeElement(this, tag, view);
316
+ }
317
+ createTextNode(data) {
318
+ return new NativeText(this, data);
319
+ }
320
+ createComment(data) {
321
+ return new NativeComment(this, data);
322
+ }
323
+ createDocumentFragment() {
324
+ return new NativeFragment(this);
325
+ }
326
+ };
327
+ export { HTML_NAMESPACE, NativeComment, NativeDocument, NativeElement, NativeFragment, NativeNode, NativeText };
328
+
329
+ //# sourceMappingURL=dom.js.map
@@ -0,0 +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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