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
@@ -0,0 +1,4 @@
1
+ export declare const WEB_STYLES = "\n.ns-app {\n position: fixed;\n inset: 0;\n display: flex;\n flex-direction: column;\n overflow: hidden;\n margin: 0 auto;\n max-width: 520px;\n font: 17px/1.3 -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;\n color: #000;\n background: #fff;\n -webkit-font-smoothing: antialiased;\n -webkit-tap-highlight-color: transparent;\n --ns-accent: #007aff;\n --ns-separator: rgba(60, 60, 67, 0.18);\n --ns-bar: rgba(249, 249, 249, 0.94);\n --ns-fill: rgba(118, 118, 128, 0.12);\n --ns-secondary: #8a8a8e;\n}\n.ns-app.ns-dark {\n color: #fff;\n background: #000;\n --ns-accent: #0a84ff;\n --ns-separator: rgba(84, 84, 88, 0.6);\n --ns-bar: rgba(29, 29, 31, 0.94);\n --ns-fill: rgba(118, 118, 128, 0.24);\n}\n@media (min-width: 560px) {\n .ns-app { inset: 24px auto; left: 50%; transform: translateX(-50%); width: 420px; border-radius: 28px;\n box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.08), 0 24px 60px rgba(0, 0, 0, 0.18); }\n body:has(> * > .ns-app), body:has(> .ns-app) { background: #e9e9ee; }\n}\n.ns-app *, .ns-app *::before, .ns-app *::after { box-sizing: border-box; }\n.ns-app [hidden] { display: none !important; }\n\n/* Frames and pages: the page on top shows, the ones under it wait, as in a UINavigationController. */\n.ns-frame { position: relative; flex: 1 1 auto; min-height: 0; min-width: 0; overflow: hidden; }\n.ns-page { position: absolute; inset: 0; display: flex; flex-direction: column; }\n/* :where keeps these below an app's own Page { \u2026 } rules. */\n:where(.ns-app) .ns-page { background-color: #fff; }\n:where(.ns-app.ns-dark) .ns-page { background-color: #000; }\n.ns-page:not(.ns-current) { visibility: hidden; }\n.ns-page > :not(.ns-actionBar) { flex: 1 1 auto; min-height: 0; }\n.ns-tabViewItem > .ns-frame, .ns-contentView > * { flex: 1 1 auto; }\n\n/* ActionBar: a title between the back button and the action items. */\n.ns-actionBar { flex: none; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; min-height: 44px;\n padding: env(safe-area-inset-top) 8px 0; background: var(--ns-bar); border-bottom: 0.5px solid var(--ns-separator);\n backdrop-filter: blur(20px); }\n.ns-actionBar-title { font-weight: 600; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }\n.ns-actionBar-left { justify-self: start; display: flex; }\n.ns-actionBar-right { justify-self: end; display: flex; gap: 4px; }\n.ns-navigationButton, .ns-actionItem { font: inherit; color: var(--ns-accent); background: none; border: 0; padding: 8px;\n cursor: pointer; }\n.ns-navigationButton::before { content: '\u2039'; font-size: 30px; line-height: 0; vertical-align: -3px; margin-right: 4px; }\n\n/* Layouts. Children stretch across, as NativeScript's do, unless aligned. */\n.ns-stackLayout { display: flex; }\n.ns-stackLayout.ns-vertical { flex-direction: column; }\n.ns-stackLayout.ns-vertical > * { align-self: var(--ns-ha, stretch); flex: none; }\n.ns-stackLayout.ns-horizontal { flex-direction: row; }\n.ns-stackLayout.ns-horizontal > * { align-self: var(--ns-va, stretch); flex: none; }\n.ns-gridLayout { display: grid; grid-template-rows: minmax(0, 1fr); grid-template-columns: minmax(0, 1fr); }\n.ns-gridLayout > * { grid-row: 1; grid-column: 1; justify-self: var(--ns-ha, stretch); align-self: var(--ns-va, stretch);\n min-width: 0; min-height: 0; }\n.ns-flexboxLayout { display: flex; }\n.ns-wrapLayout { display: flex; flex-wrap: wrap; align-content: flex-start; }\n.ns-wrapLayout.ns-vertical { flex-direction: column; }\n.ns-wrapLayout > * { width: var(--ns-item-width, auto); height: var(--ns-item-height, auto); }\n.ns-absoluteLayout { position: relative; }\n.ns-absoluteLayout > * { position: absolute; left: 0; top: 0; }\n.ns-dockLayout { display: flex; }\n.ns-rootLayout { display: grid; }\n.ns-rootLayout > * { grid-area: 1 / 1; }\n.ns-scrollView { display: flex; flex-direction: column; overflow-y: auto; overscroll-behavior: contain; }\n.ns-scrollView > * { flex: none; }\n.ns-scrollView.ns-horizontal { flex-direction: row; overflow-y: hidden; overflow-x: auto; }\n.ns-contentView { display: flex; flex-direction: column; }\n\n/* Text. A label is one line, cut with an ellipsis, unless textWrap, and centered vertically in its space. */\n.ns-label { display: flex; align-items: center; min-width: 0; }\n.ns-label-text { flex: 1 1 auto; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }\n.ns-label.ns-wrap > .ns-label-text { white-space: normal; overflow-wrap: anywhere; }\n.ns-label > .ns-formattedString { flex: 1 1 auto; min-width: 0; }\n.ns-button { font: inherit; color: var(--ns-accent); background: none; border: 0; padding: 10px 12px; min-height: 44px;\n cursor: pointer; text-align: center; }\n.ns-button:active { opacity: 0.6; }\n.ns-button:disabled, .ns-disabled { opacity: 0.4; cursor: default; }\n.ns-textField, .ns-searchBar, .ns-textView, .ns-listPicker, .ns-datePicker, .ns-timePicker { font: inherit; color: inherit;\n min-width: 0; border: 0; border-radius: 0; background: transparent; padding: 10px 0; outline: none; }\n.ns-textField::placeholder, .ns-textView::placeholder, .ns-searchBar::placeholder { color: var(--ns-secondary); }\n.ns-searchBar { background: var(--ns-fill); border-radius: 10px; padding: 8px 12px; margin: 8px; }\n.ns-textView { resize: none; min-height: 80px; }\n.ns-image { display: block; min-width: 0; min-height: 0; max-width: 100%; object-fit: contain; }\n\n/* Switch: iOS's toggle. */\n.ns-switch { position: relative; display: inline-block; width: 51px; height: 31px; flex: none; cursor: pointer; }\n.ns-switch-input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }\n.ns-switch-track { position: absolute; inset: 0; border-radius: 16px; background: var(--ns-fill); transition: background 0.2s; }\n.ns-switch-track::after { content: ''; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%;\n background: #fff; box-shadow: 0 3px 8px rgba(0, 0, 0, 0.15), 0 1px 1px rgba(0, 0, 0, 0.16); transition: transform 0.2s; }\n.ns-switch-input:checked + .ns-switch-track { background: #34c759; }\n.ns-switch-input:checked + .ns-switch-track::after { transform: translateX(20px); }\n.ns-switch-input:focus-visible + .ns-switch-track { outline: 2px solid var(--ns-accent); outline-offset: 2px; }\n\n.ns-slider { accent-color: var(--ns-accent); margin: 10px 0; }\n.ns-progress { accent-color: var(--ns-accent); width: 100%; height: 4px; }\n.ns-activityIndicator { display: none; width: 22px; height: 22px; border-radius: 50%; border: 2.5px solid var(--ns-fill);\n border-top-color: var(--ns-secondary); animation: ns-spin 0.8s linear infinite; align-self: center; }\n.ns-activityIndicator.ns-busy { display: block; }\n@keyframes ns-spin { to { transform: rotate(360deg); } }\n\n.ns-segmentedBar { display: flex; padding: 2px; border-radius: 9px; background: var(--ns-fill); }\n.ns-segmentedBarItem { flex: 1; font: inherit; font-size: 13px; font-weight: 500; color: inherit; background: none; border: 0;\n border-radius: 7px; padding: 6px 8px; cursor: pointer; }\n.ns-segmentedBarItem[aria-selected='true'] { background: #fff; box-shadow: 0 3px 8px rgba(0, 0, 0, 0.12); }\n.ns-dark .ns-segmentedBarItem[aria-selected='true'] { background: #636366; }\n\n/* TabView: the items, and a tab bar under them. */\n.ns-tabView { display: flex; flex-direction: column; min-height: 0; }\n.ns-tabView-items { position: relative; flex: 1 1 auto; min-height: 0; display: flex; }\n.ns-tabViewItem { flex: 1 1 auto; min-width: 0; min-height: 0; display: flex; flex-direction: column; }\n.ns-tabView-bar { flex: none; display: flex; background: var(--ns-bar); border-top: 0.5px solid var(--ns-separator);\n padding-bottom: env(safe-area-inset-bottom); }\n.ns-tabView-tab { flex: 1; font: inherit; font-size: 11px; font-weight: 500; color: var(--ns-secondary); background: none;\n border: 0; padding: 14px 4px; cursor: pointer; }\n.ns-tabView-tab[aria-selected='true'] { color: var(--ns-accent); }\n\n/* Lists: a column that scrolls, rows separated by a hairline. Only the rows on screen exist, each placed at its\n row's offset in an element as tall as all of them (web-list.ts). */\n.ns-listView { display: block; position: relative; overflow-y: auto; overscroll-behavior: contain; }\n.ns-listView-content { position: relative; width: 100%; }\n.ns-listView-cell { position: absolute; top: 0; left: 0; right: 0; cursor: pointer;\n border-bottom: 0.5px solid var(--ns-separator); }\n.ns-listView-cell:active { background: var(--ns-fill); }\n.ns-webView { border: 0; width: 100%; height: 100%; }\n\n/* Modals: a sheet from the bottom over a dimmed screen. */\n.ns-modal-backdrop { position: absolute; inset: 0; z-index: 10; display: flex; align-items: flex-end;\n background: rgba(0, 0, 0, 0.35); }\n.ns-modal { width: 100%; max-height: 92%; border-radius: 12px 12px 0 0; background: #fff; overflow: auto;\n padding-bottom: env(safe-area-inset-bottom); }\n.ns-modal-fullscreen { position: absolute; inset: 0; background: #fff; overflow: auto; }\n.ns-dark .ns-modal, .ns-dark .ns-modal-fullscreen { background: #1c1c1e; }\n";
2
+ /** Adds the styles to the document, once. */
3
+ export declare function installStyles(): void;
4
+ //# sourceMappingURL=web-styles.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"web-styles.d.ts","sourceRoot":"","sources":["../../src/web-styles.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,UAAU,89RAiJtB,CAAC;AAIF,6CAA6C;AAC7C,wBAAgB,aAAa,IAAI,IAAI,CAOpC"}
@@ -0,0 +1,160 @@
1
+ // src/web-styles.ts
2
+ var WEB_STYLES = `
3
+ .ns-app {
4
+ position: fixed;
5
+ inset: 0;
6
+ display: flex;
7
+ flex-direction: column;
8
+ overflow: hidden;
9
+ margin: 0 auto;
10
+ max-width: 520px;
11
+ font: 17px/1.3 -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
12
+ color: #000;
13
+ background: #fff;
14
+ -webkit-font-smoothing: antialiased;
15
+ -webkit-tap-highlight-color: transparent;
16
+ --ns-accent: #007aff;
17
+ --ns-separator: rgba(60, 60, 67, 0.18);
18
+ --ns-bar: rgba(249, 249, 249, 0.94);
19
+ --ns-fill: rgba(118, 118, 128, 0.12);
20
+ --ns-secondary: #8a8a8e;
21
+ }
22
+ .ns-app.ns-dark {
23
+ color: #fff;
24
+ background: #000;
25
+ --ns-accent: #0a84ff;
26
+ --ns-separator: rgba(84, 84, 88, 0.6);
27
+ --ns-bar: rgba(29, 29, 31, 0.94);
28
+ --ns-fill: rgba(118, 118, 128, 0.24);
29
+ }
30
+ @media (min-width: 560px) {
31
+ .ns-app { inset: 24px auto; left: 50%; transform: translateX(-50%); width: 420px; border-radius: 28px;
32
+ box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.08), 0 24px 60px rgba(0, 0, 0, 0.18); }
33
+ body:has(> * > .ns-app), body:has(> .ns-app) { background: #e9e9ee; }
34
+ }
35
+ .ns-app *, .ns-app *::before, .ns-app *::after { box-sizing: border-box; }
36
+ .ns-app [hidden] { display: none !important; }
37
+
38
+ /* Frames and pages: the page on top shows, the ones under it wait, as in a UINavigationController. */
39
+ .ns-frame { position: relative; flex: 1 1 auto; min-height: 0; min-width: 0; overflow: hidden; }
40
+ .ns-page { position: absolute; inset: 0; display: flex; flex-direction: column; }
41
+ /* :where keeps these below an app's own Page { … } rules. */
42
+ :where(.ns-app) .ns-page { background-color: #fff; }
43
+ :where(.ns-app.ns-dark) .ns-page { background-color: #000; }
44
+ .ns-page:not(.ns-current) { visibility: hidden; }
45
+ .ns-page > :not(.ns-actionBar) { flex: 1 1 auto; min-height: 0; }
46
+ .ns-tabViewItem > .ns-frame, .ns-contentView > * { flex: 1 1 auto; }
47
+
48
+ /* ActionBar: a title between the back button and the action items. */
49
+ .ns-actionBar { flex: none; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; min-height: 44px;
50
+ padding: env(safe-area-inset-top) 8px 0; background: var(--ns-bar); border-bottom: 0.5px solid var(--ns-separator);
51
+ backdrop-filter: blur(20px); }
52
+ .ns-actionBar-title { font-weight: 600; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
53
+ .ns-actionBar-left { justify-self: start; display: flex; }
54
+ .ns-actionBar-right { justify-self: end; display: flex; gap: 4px; }
55
+ .ns-navigationButton, .ns-actionItem { font: inherit; color: var(--ns-accent); background: none; border: 0; padding: 8px;
56
+ cursor: pointer; }
57
+ .ns-navigationButton::before { content: '‹'; font-size: 30px; line-height: 0; vertical-align: -3px; margin-right: 4px; }
58
+
59
+ /* Layouts. Children stretch across, as NativeScript's do, unless aligned. */
60
+ .ns-stackLayout { display: flex; }
61
+ .ns-stackLayout.ns-vertical { flex-direction: column; }
62
+ .ns-stackLayout.ns-vertical > * { align-self: var(--ns-ha, stretch); flex: none; }
63
+ .ns-stackLayout.ns-horizontal { flex-direction: row; }
64
+ .ns-stackLayout.ns-horizontal > * { align-self: var(--ns-va, stretch); flex: none; }
65
+ .ns-gridLayout { display: grid; grid-template-rows: minmax(0, 1fr); grid-template-columns: minmax(0, 1fr); }
66
+ .ns-gridLayout > * { grid-row: 1; grid-column: 1; justify-self: var(--ns-ha, stretch); align-self: var(--ns-va, stretch);
67
+ min-width: 0; min-height: 0; }
68
+ .ns-flexboxLayout { display: flex; }
69
+ .ns-wrapLayout { display: flex; flex-wrap: wrap; align-content: flex-start; }
70
+ .ns-wrapLayout.ns-vertical { flex-direction: column; }
71
+ .ns-wrapLayout > * { width: var(--ns-item-width, auto); height: var(--ns-item-height, auto); }
72
+ .ns-absoluteLayout { position: relative; }
73
+ .ns-absoluteLayout > * { position: absolute; left: 0; top: 0; }
74
+ .ns-dockLayout { display: flex; }
75
+ .ns-rootLayout { display: grid; }
76
+ .ns-rootLayout > * { grid-area: 1 / 1; }
77
+ .ns-scrollView { display: flex; flex-direction: column; overflow-y: auto; overscroll-behavior: contain; }
78
+ .ns-scrollView > * { flex: none; }
79
+ .ns-scrollView.ns-horizontal { flex-direction: row; overflow-y: hidden; overflow-x: auto; }
80
+ .ns-contentView { display: flex; flex-direction: column; }
81
+
82
+ /* Text. A label is one line, cut with an ellipsis, unless textWrap, and centered vertically in its space. */
83
+ .ns-label { display: flex; align-items: center; min-width: 0; }
84
+ .ns-label-text { flex: 1 1 auto; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
85
+ .ns-label.ns-wrap > .ns-label-text { white-space: normal; overflow-wrap: anywhere; }
86
+ .ns-label > .ns-formattedString { flex: 1 1 auto; min-width: 0; }
87
+ .ns-button { font: inherit; color: var(--ns-accent); background: none; border: 0; padding: 10px 12px; min-height: 44px;
88
+ cursor: pointer; text-align: center; }
89
+ .ns-button:active { opacity: 0.6; }
90
+ .ns-button:disabled, .ns-disabled { opacity: 0.4; cursor: default; }
91
+ .ns-textField, .ns-searchBar, .ns-textView, .ns-listPicker, .ns-datePicker, .ns-timePicker { font: inherit; color: inherit;
92
+ min-width: 0; border: 0; border-radius: 0; background: transparent; padding: 10px 0; outline: none; }
93
+ .ns-textField::placeholder, .ns-textView::placeholder, .ns-searchBar::placeholder { color: var(--ns-secondary); }
94
+ .ns-searchBar { background: var(--ns-fill); border-radius: 10px; padding: 8px 12px; margin: 8px; }
95
+ .ns-textView { resize: none; min-height: 80px; }
96
+ .ns-image { display: block; min-width: 0; min-height: 0; max-width: 100%; object-fit: contain; }
97
+
98
+ /* Switch: iOS's toggle. */
99
+ .ns-switch { position: relative; display: inline-block; width: 51px; height: 31px; flex: none; cursor: pointer; }
100
+ .ns-switch-input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
101
+ .ns-switch-track { position: absolute; inset: 0; border-radius: 16px; background: var(--ns-fill); transition: background 0.2s; }
102
+ .ns-switch-track::after { content: ''; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%;
103
+ background: #fff; box-shadow: 0 3px 8px rgba(0, 0, 0, 0.15), 0 1px 1px rgba(0, 0, 0, 0.16); transition: transform 0.2s; }
104
+ .ns-switch-input:checked + .ns-switch-track { background: #34c759; }
105
+ .ns-switch-input:checked + .ns-switch-track::after { transform: translateX(20px); }
106
+ .ns-switch-input:focus-visible + .ns-switch-track { outline: 2px solid var(--ns-accent); outline-offset: 2px; }
107
+
108
+ .ns-slider { accent-color: var(--ns-accent); margin: 10px 0; }
109
+ .ns-progress { accent-color: var(--ns-accent); width: 100%; height: 4px; }
110
+ .ns-activityIndicator { display: none; width: 22px; height: 22px; border-radius: 50%; border: 2.5px solid var(--ns-fill);
111
+ border-top-color: var(--ns-secondary); animation: ns-spin 0.8s linear infinite; align-self: center; }
112
+ .ns-activityIndicator.ns-busy { display: block; }
113
+ @keyframes ns-spin { to { transform: rotate(360deg); } }
114
+
115
+ .ns-segmentedBar { display: flex; padding: 2px; border-radius: 9px; background: var(--ns-fill); }
116
+ .ns-segmentedBarItem { flex: 1; font: inherit; font-size: 13px; font-weight: 500; color: inherit; background: none; border: 0;
117
+ border-radius: 7px; padding: 6px 8px; cursor: pointer; }
118
+ .ns-segmentedBarItem[aria-selected='true'] { background: #fff; box-shadow: 0 3px 8px rgba(0, 0, 0, 0.12); }
119
+ .ns-dark .ns-segmentedBarItem[aria-selected='true'] { background: #636366; }
120
+
121
+ /* TabView: the items, and a tab bar under them. */
122
+ .ns-tabView { display: flex; flex-direction: column; min-height: 0; }
123
+ .ns-tabView-items { position: relative; flex: 1 1 auto; min-height: 0; display: flex; }
124
+ .ns-tabViewItem { flex: 1 1 auto; min-width: 0; min-height: 0; display: flex; flex-direction: column; }
125
+ .ns-tabView-bar { flex: none; display: flex; background: var(--ns-bar); border-top: 0.5px solid var(--ns-separator);
126
+ padding-bottom: env(safe-area-inset-bottom); }
127
+ .ns-tabView-tab { flex: 1; font: inherit; font-size: 11px; font-weight: 500; color: var(--ns-secondary); background: none;
128
+ border: 0; padding: 14px 4px; cursor: pointer; }
129
+ .ns-tabView-tab[aria-selected='true'] { color: var(--ns-accent); }
130
+
131
+ /* Lists: a column that scrolls, rows separated by a hairline. Only the rows on screen exist, each placed at its
132
+ row's offset in an element as tall as all of them (web-list.ts). */
133
+ .ns-listView { display: block; position: relative; overflow-y: auto; overscroll-behavior: contain; }
134
+ .ns-listView-content { position: relative; width: 100%; }
135
+ .ns-listView-cell { position: absolute; top: 0; left: 0; right: 0; cursor: pointer;
136
+ border-bottom: 0.5px solid var(--ns-separator); }
137
+ .ns-listView-cell:active { background: var(--ns-fill); }
138
+ .ns-webView { border: 0; width: 100%; height: 100%; }
139
+
140
+ /* Modals: a sheet from the bottom over a dimmed screen. */
141
+ .ns-modal-backdrop { position: absolute; inset: 0; z-index: 10; display: flex; align-items: flex-end;
142
+ background: rgba(0, 0, 0, 0.35); }
143
+ .ns-modal { width: 100%; max-height: 92%; border-radius: 12px 12px 0 0; background: #fff; overflow: auto;
144
+ padding-bottom: env(safe-area-inset-bottom); }
145
+ .ns-modal-fullscreen { position: absolute; inset: 0; background: #fff; overflow: auto; }
146
+ .ns-dark .ns-modal, .ns-dark .ns-modal-fullscreen { background: #1c1c1e; }
147
+ `;
148
+ var installed = false;
149
+ /** Adds the styles to the document, once. */
150
+ function installStyles() {
151
+ if (installed) return;
152
+ installed = true;
153
+ const style = document.createElement("style");
154
+ style.dataset.emberNativescript = "";
155
+ style.textContent = WEB_STYLES;
156
+ document.head.prepend(style);
157
+ }
158
+ export { WEB_STYLES, installStyles };
159
+
160
+ //# sourceMappingURL=web-styles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"web-styles.js","names":["WEB_STYLES","installed","installStyles","style","document","createElement","dataset","emberNativescript","textContent","head","prepend"],"sources":["../../src/web-styles.ts"],"sourcesContent":["// The CSS that gives NativeScript's views their layout and look in a browser. Sizes are device-independent pixels,\n// which are CSS pixels. The look is iOS's defaults, since that's where the app was seen first; an app's own CSS\n// (converted by the web Vite config) goes on top.\n\nexport const WEB_STYLES = /* css */ `\n.ns-app {\n position: fixed;\n inset: 0;\n display: flex;\n flex-direction: column;\n overflow: hidden;\n margin: 0 auto;\n max-width: 520px;\n font: 17px/1.3 -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;\n color: #000;\n background: #fff;\n -webkit-font-smoothing: antialiased;\n -webkit-tap-highlight-color: transparent;\n --ns-accent: #007aff;\n --ns-separator: rgba(60, 60, 67, 0.18);\n --ns-bar: rgba(249, 249, 249, 0.94);\n --ns-fill: rgba(118, 118, 128, 0.12);\n --ns-secondary: #8a8a8e;\n}\n.ns-app.ns-dark {\n color: #fff;\n background: #000;\n --ns-accent: #0a84ff;\n --ns-separator: rgba(84, 84, 88, 0.6);\n --ns-bar: rgba(29, 29, 31, 0.94);\n --ns-fill: rgba(118, 118, 128, 0.24);\n}\n@media (min-width: 560px) {\n .ns-app { inset: 24px auto; left: 50%; transform: translateX(-50%); width: 420px; border-radius: 28px;\n box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.08), 0 24px 60px rgba(0, 0, 0, 0.18); }\n body:has(> * > .ns-app), body:has(> .ns-app) { background: #e9e9ee; }\n}\n.ns-app *, .ns-app *::before, .ns-app *::after { box-sizing: border-box; }\n.ns-app [hidden] { display: none !important; }\n\n/* Frames and pages: the page on top shows, the ones under it wait, as in a UINavigationController. */\n.ns-frame { position: relative; flex: 1 1 auto; min-height: 0; min-width: 0; overflow: hidden; }\n.ns-page { position: absolute; inset: 0; display: flex; flex-direction: column; }\n/* :where keeps these below an app's own Page { … } rules. */\n:where(.ns-app) .ns-page { background-color: #fff; }\n:where(.ns-app.ns-dark) .ns-page { background-color: #000; }\n.ns-page:not(.ns-current) { visibility: hidden; }\n.ns-page > :not(.ns-actionBar) { flex: 1 1 auto; min-height: 0; }\n.ns-tabViewItem > .ns-frame, .ns-contentView > * { flex: 1 1 auto; }\n\n/* ActionBar: a title between the back button and the action items. */\n.ns-actionBar { flex: none; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; min-height: 44px;\n padding: env(safe-area-inset-top) 8px 0; background: var(--ns-bar); border-bottom: 0.5px solid var(--ns-separator);\n backdrop-filter: blur(20px); }\n.ns-actionBar-title { font-weight: 600; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }\n.ns-actionBar-left { justify-self: start; display: flex; }\n.ns-actionBar-right { justify-self: end; display: flex; gap: 4px; }\n.ns-navigationButton, .ns-actionItem { font: inherit; color: var(--ns-accent); background: none; border: 0; padding: 8px;\n cursor: pointer; }\n.ns-navigationButton::before { content: '‹'; font-size: 30px; line-height: 0; vertical-align: -3px; margin-right: 4px; }\n\n/* Layouts. Children stretch across, as NativeScript's do, unless aligned. */\n.ns-stackLayout { display: flex; }\n.ns-stackLayout.ns-vertical { flex-direction: column; }\n.ns-stackLayout.ns-vertical > * { align-self: var(--ns-ha, stretch); flex: none; }\n.ns-stackLayout.ns-horizontal { flex-direction: row; }\n.ns-stackLayout.ns-horizontal > * { align-self: var(--ns-va, stretch); flex: none; }\n.ns-gridLayout { display: grid; grid-template-rows: minmax(0, 1fr); grid-template-columns: minmax(0, 1fr); }\n.ns-gridLayout > * { grid-row: 1; grid-column: 1; justify-self: var(--ns-ha, stretch); align-self: var(--ns-va, stretch);\n min-width: 0; min-height: 0; }\n.ns-flexboxLayout { display: flex; }\n.ns-wrapLayout { display: flex; flex-wrap: wrap; align-content: flex-start; }\n.ns-wrapLayout.ns-vertical { flex-direction: column; }\n.ns-wrapLayout > * { width: var(--ns-item-width, auto); height: var(--ns-item-height, auto); }\n.ns-absoluteLayout { position: relative; }\n.ns-absoluteLayout > * { position: absolute; left: 0; top: 0; }\n.ns-dockLayout { display: flex; }\n.ns-rootLayout { display: grid; }\n.ns-rootLayout > * { grid-area: 1 / 1; }\n.ns-scrollView { display: flex; flex-direction: column; overflow-y: auto; overscroll-behavior: contain; }\n.ns-scrollView > * { flex: none; }\n.ns-scrollView.ns-horizontal { flex-direction: row; overflow-y: hidden; overflow-x: auto; }\n.ns-contentView { display: flex; flex-direction: column; }\n\n/* Text. A label is one line, cut with an ellipsis, unless textWrap, and centered vertically in its space. */\n.ns-label { display: flex; align-items: center; min-width: 0; }\n.ns-label-text { flex: 1 1 auto; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }\n.ns-label.ns-wrap > .ns-label-text { white-space: normal; overflow-wrap: anywhere; }\n.ns-label > .ns-formattedString { flex: 1 1 auto; min-width: 0; }\n.ns-button { font: inherit; color: var(--ns-accent); background: none; border: 0; padding: 10px 12px; min-height: 44px;\n cursor: pointer; text-align: center; }\n.ns-button:active { opacity: 0.6; }\n.ns-button:disabled, .ns-disabled { opacity: 0.4; cursor: default; }\n.ns-textField, .ns-searchBar, .ns-textView, .ns-listPicker, .ns-datePicker, .ns-timePicker { font: inherit; color: inherit;\n min-width: 0; border: 0; border-radius: 0; background: transparent; padding: 10px 0; outline: none; }\n.ns-textField::placeholder, .ns-textView::placeholder, .ns-searchBar::placeholder { color: var(--ns-secondary); }\n.ns-searchBar { background: var(--ns-fill); border-radius: 10px; padding: 8px 12px; margin: 8px; }\n.ns-textView { resize: none; min-height: 80px; }\n.ns-image { display: block; min-width: 0; min-height: 0; max-width: 100%; object-fit: contain; }\n\n/* Switch: iOS's toggle. */\n.ns-switch { position: relative; display: inline-block; width: 51px; height: 31px; flex: none; cursor: pointer; }\n.ns-switch-input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }\n.ns-switch-track { position: absolute; inset: 0; border-radius: 16px; background: var(--ns-fill); transition: background 0.2s; }\n.ns-switch-track::after { content: ''; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%;\n background: #fff; box-shadow: 0 3px 8px rgba(0, 0, 0, 0.15), 0 1px 1px rgba(0, 0, 0, 0.16); transition: transform 0.2s; }\n.ns-switch-input:checked + .ns-switch-track { background: #34c759; }\n.ns-switch-input:checked + .ns-switch-track::after { transform: translateX(20px); }\n.ns-switch-input:focus-visible + .ns-switch-track { outline: 2px solid var(--ns-accent); outline-offset: 2px; }\n\n.ns-slider { accent-color: var(--ns-accent); margin: 10px 0; }\n.ns-progress { accent-color: var(--ns-accent); width: 100%; height: 4px; }\n.ns-activityIndicator { display: none; width: 22px; height: 22px; border-radius: 50%; border: 2.5px solid var(--ns-fill);\n border-top-color: var(--ns-secondary); animation: ns-spin 0.8s linear infinite; align-self: center; }\n.ns-activityIndicator.ns-busy { display: block; }\n@keyframes ns-spin { to { transform: rotate(360deg); } }\n\n.ns-segmentedBar { display: flex; padding: 2px; border-radius: 9px; background: var(--ns-fill); }\n.ns-segmentedBarItem { flex: 1; font: inherit; font-size: 13px; font-weight: 500; color: inherit; background: none; border: 0;\n border-radius: 7px; padding: 6px 8px; cursor: pointer; }\n.ns-segmentedBarItem[aria-selected='true'] { background: #fff; box-shadow: 0 3px 8px rgba(0, 0, 0, 0.12); }\n.ns-dark .ns-segmentedBarItem[aria-selected='true'] { background: #636366; }\n\n/* TabView: the items, and a tab bar under them. */\n.ns-tabView { display: flex; flex-direction: column; min-height: 0; }\n.ns-tabView-items { position: relative; flex: 1 1 auto; min-height: 0; display: flex; }\n.ns-tabViewItem { flex: 1 1 auto; min-width: 0; min-height: 0; display: flex; flex-direction: column; }\n.ns-tabView-bar { flex: none; display: flex; background: var(--ns-bar); border-top: 0.5px solid var(--ns-separator);\n padding-bottom: env(safe-area-inset-bottom); }\n.ns-tabView-tab { flex: 1; font: inherit; font-size: 11px; font-weight: 500; color: var(--ns-secondary); background: none;\n border: 0; padding: 14px 4px; cursor: pointer; }\n.ns-tabView-tab[aria-selected='true'] { color: var(--ns-accent); }\n\n/* Lists: a column that scrolls, rows separated by a hairline. Only the rows on screen exist, each placed at its\n row's offset in an element as tall as all of them (web-list.ts). */\n.ns-listView { display: block; position: relative; overflow-y: auto; overscroll-behavior: contain; }\n.ns-listView-content { position: relative; width: 100%; }\n.ns-listView-cell { position: absolute; top: 0; left: 0; right: 0; cursor: pointer;\n border-bottom: 0.5px solid var(--ns-separator); }\n.ns-listView-cell:active { background: var(--ns-fill); }\n.ns-webView { border: 0; width: 100%; height: 100%; }\n\n/* Modals: a sheet from the bottom over a dimmed screen. */\n.ns-modal-backdrop { position: absolute; inset: 0; z-index: 10; display: flex; align-items: flex-end;\n background: rgba(0, 0, 0, 0.35); }\n.ns-modal { width: 100%; max-height: 92%; border-radius: 12px 12px 0 0; background: #fff; overflow: auto;\n padding-bottom: env(safe-area-inset-bottom); }\n.ns-modal-fullscreen { position: absolute; inset: 0; background: #fff; overflow: auto; }\n.ns-dark .ns-modal, .ns-dark .ns-modal-fullscreen { background: #1c1c1e; }\n`;\n\nlet installed = false;\n\n/** Adds the styles to the document, once. */\nexport function installStyles(): void {\n if (installed) return;\n installed = true;\n const style = document.createElement('style');\n style.dataset.emberNativescript = '';\n style.textContent = WEB_STYLES;\n document.head.prepend(style);\n}\n"],"mappings":";AAIA,IAAaA,aAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmJpC,IAAIC,YAAY;;AAGhB,SAAgBC,gBAAsB;CACpC,IAAID,WAAW;CACfA,YAAY;CACZ,MAAME,QAAQC,SAASC,cAAc,OAAO;CAC5CF,MAAMG,QAAQC,oBAAoB;CAClCJ,MAAMK,cAAcR;CACpBI,SAASK,KAAKC,QAAQP,KAAK;AAC7B"}
@@ -0,0 +1,7 @@
1
+ export { createWebApp, type WebApp, type WebAppOptions } from './web-app.js';
2
+ export { emit, emitLoaded, WebAdapter } from './web-adapter.js';
3
+ export { WebFrameHost } from './web-host.js';
4
+ export { type RouteDefinition, type RouteParams, type Routes, WebRouter } from './web-router.js';
5
+ export { installStyles, WEB_STYLES } from './web-styles.js';
6
+ export { convertNativeScriptCss } from './web-css.js';
7
+ //# sourceMappingURL=web.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"web.d.ts","sourceRoot":"","sources":["../../src/web.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,YAAY,EAAE,KAAK,MAAM,EAAE,KAAK,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7E,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAChE,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,EAAE,KAAK,eAAe,EAAE,KAAK,WAAW,EAAE,KAAK,MAAM,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACjG,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC5D,OAAO,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC"}
@@ -0,0 +1,7 @@
1
+ import { createWebApp } from "./web-app.js";
2
+ import { WebAdapter, emit, emitLoaded } from "./web-adapter.js";
3
+ import { WebFrameHost } from "./web-host.js";
4
+ import { WebRouter } from "./web-router.js";
5
+ import { WEB_STYLES, installStyles } from "./web-styles.js";
6
+ import { convertNativeScriptCss } from "./web-css.js";
7
+ export { WEB_STYLES, WebAdapter, WebFrameHost, WebRouter, convertNativeScriptCss, createWebApp, emit, emitLoaded, installStyles };
@@ -104,7 +104,9 @@ export interface CommonNativeAttributes {
104
104
  flexWrapBefore?: boolean | 'true' | 'false';
105
105
  alignSelf?: NS.AlignSelf;
106
106
  /** Set on one platform only: `ios:text='Tap'`. A dotted name sets a nested property: `ios.position='right'`. */
107
- [platformOnly: `ios:${string}` | `android:${string}` | `ios.${string}` | `android.${string}`]: unknown;
107
+ [
108
+ platformOnly: `ios:${string}` | `android:${string}` | `web:${string}` | `ios.${string}` | `android.${string}`
109
+ ]: unknown;
108
110
  }
109
111
 
110
112
  export type NativeAttributes<View> = {
@@ -120,6 +122,9 @@ type NativeTagAttributes = {
120
122
  };
121
123
 
122
124
  declare global {
125
+ /** True in the web build (`ember-nativescript/vite-web`), false in the NativeScript bundles. */
126
+ const __WEB__: boolean;
127
+
123
128
  // `label`, `button`, `span`, `progress` and `frame` are also HTML tags: their element type stays HTML's, but their
124
129
  // attributes are looked up by name, here first.
125
130
  interface GlintCustomElementTagNameMap extends NativeTags {}
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "ember-nativescript",
3
- "version": "0.1.2",
3
+ "version": "0.3.0",
4
4
  "description": "Ember components rendering real native views on iOS and Android, through NativeScript.",
5
5
  "license": "MIT",
6
6
  "type": "module",
7
- "homepage": "https://github.com/betocantu93/ember-nativescript#readme",
7
+ "homepage": "https://betocantu93.github.io/ember-nativescript/",
8
8
  "repository": {
9
9
  "type": "git",
10
10
  "url": "git+https://github.com/betocantu93/ember-nativescript.git"
@@ -46,21 +46,25 @@
46
46
  "types": "./dist/src/vitest.d.ts",
47
47
  "default": "./dist/src/vitest.js"
48
48
  },
49
+ "./application": {
50
+ "types": "./dist/src/application-entry.d.ts",
51
+ "default": "./dist/src/application-entry.js"
52
+ },
53
+ "./application/testing": {
54
+ "types": "./dist/src/application-testing.d.ts",
55
+ "default": "./dist/src/application-testing.js"
56
+ },
57
+ "./web": {
58
+ "types": "./dist/src/web.d.ts",
59
+ "default": "./dist/src/web.js"
60
+ },
61
+ "./vite-web": {
62
+ "types": "./dist/src/vite-web.d.ts",
63
+ "default": "./dist/src/vite-web.js"
64
+ },
49
65
  "./package.json": "./package.json"
50
66
  },
51
67
  "sideEffects": false,
52
- "scripts": {
53
- "build": "node scripts/build.mjs",
54
- "test": "vitest run && vitest run -c vitest.template.config.ts",
55
- "typecheck": "ember-tsc --noEmit -p tsconfig.glint.json && ember-tsc --noEmit -p run/tsconfig.json && ember-tsc --noEmit -p template/tsconfig.repo.json",
56
- "format": "prettier --write .",
57
- "format:check": "prettier --check .",
58
- "build:android": "pnpm build && pnpm --filter ember-nativescript-demo build:android",
59
- "build:ios": "pnpm build && pnpm --filter ember-nativescript-demo build:ios",
60
- "build:run:android": "pnpm build && pnpm --filter ember-nativescript-run build:android",
61
- "build:run:ios": "pnpm build && pnpm --filter ember-nativescript-run build:ios",
62
- "prepack": "pnpm build"
63
- },
64
68
  "peerDependencies": {
65
69
  "@glimmer/component": "^2.0.0",
66
70
  "@glint/template": "^1.11.0",
@@ -103,5 +107,20 @@
103
107
  "vite-plugin-ember-gts": "^0.1.0",
104
108
  "vitest": "5.1.1"
105
109
  },
106
- "packageManager": "pnpm@10.28.0"
107
- }
110
+ "scripts": {
111
+ "build": "node scripts/build.mjs",
112
+ "test": "vitest run && vitest run -c vitest.template.config.ts",
113
+ "typecheck": "ember-tsc --noEmit -p tsconfig.glint.json && ember-tsc --noEmit -p run/tsconfig.json && ember-tsc --noEmit -p template/tsconfig.repo.json",
114
+ "format": "prettier --write .",
115
+ "format:check": "prettier --check .",
116
+ "build:android": "pnpm build && pnpm --filter ember-nativescript-demo build:android",
117
+ "build:ios": "pnpm build && pnpm --filter ember-nativescript-demo build:ios",
118
+ "build:run:android": "pnpm build && pnpm --filter ember-nativescript-run build:android",
119
+ "build:run:ios": "pnpm build && pnpm --filter ember-nativescript-run build:ios",
120
+ "docs:dev": "pnpm --filter ember-nativescript-docs dev",
121
+ "docs:build": "pnpm --filter ember-nativescript-docs build",
122
+ "web:template": "vite -c web.template.config.ts",
123
+ "web:demo": "vite -c web.demo.config.ts",
124
+ "web:routed": "vite -c web.routed.config.ts"
125
+ }
126
+ }