@ng-native/web 0.3.0 → 0.5.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.
package/dist/reset-css.js CHANGED
@@ -55,16 +55,151 @@ body {
55
55
  -moz-osx-font-smoothing: grayscale;
56
56
  }
57
57
 
58
- [data-rn]:not([data-rn='text']) {
58
+ [data-rn]:not([data-rn='text']):not(
59
+ :where(
60
+ :is(
61
+ [data-rn='span'],
62
+ [data-rn='p'],
63
+ [data-rn='h1'],
64
+ [data-rn='h2'],
65
+ [data-rn='h3'],
66
+ [data-rn='h4'],
67
+ [data-rn='h5'],
68
+ [data-rn='h6'],
69
+ [data-rn='label'],
70
+ [data-rn='strong'],
71
+ [data-rn='b'],
72
+ [data-rn='em'],
73
+ [data-rn='i'],
74
+ [data-rn='u'],
75
+ [data-rn='s'],
76
+ [data-rn='small'],
77
+ [data-rn='code'],
78
+ [data-rn='mark'],
79
+ [data-rn='abbr'],
80
+ [data-rn='cite'],
81
+ [data-rn='time']
82
+ ):not(
83
+ :has(
84
+ [data-rn]:not(
85
+ [data-rn='text'],
86
+ [data-rn='span'],
87
+ [data-rn='p'],
88
+ [data-rn='h1'],
89
+ [data-rn='h2'],
90
+ [data-rn='h3'],
91
+ [data-rn='h4'],
92
+ [data-rn='h5'],
93
+ [data-rn='h6'],
94
+ [data-rn='label'],
95
+ [data-rn='strong'],
96
+ [data-rn='b'],
97
+ [data-rn='em'],
98
+ [data-rn='i'],
99
+ [data-rn='u'],
100
+ [data-rn='s'],
101
+ [data-rn='small'],
102
+ [data-rn='code'],
103
+ [data-rn='mark'],
104
+ [data-rn='abbr'],
105
+ [data-rn='cite'],
106
+ [data-rn='time']
107
+ )
108
+ )
109
+ )
110
+ )
111
+ ) {
59
112
  display: flex;
60
113
  flex-direction: column;
61
114
  align-items: stretch;
62
115
  }
63
116
 
64
- [data-rn='text'] {
117
+ [data-rn='text'],
118
+ :where(
119
+ :is(
120
+ [data-rn='span'],
121
+ [data-rn='p'],
122
+ [data-rn='h1'],
123
+ [data-rn='h2'],
124
+ [data-rn='h3'],
125
+ [data-rn='h4'],
126
+ [data-rn='h5'],
127
+ [data-rn='h6'],
128
+ [data-rn='label'],
129
+ [data-rn='strong'],
130
+ [data-rn='b'],
131
+ [data-rn='em'],
132
+ [data-rn='i'],
133
+ [data-rn='u'],
134
+ [data-rn='s'],
135
+ [data-rn='small'],
136
+ [data-rn='code'],
137
+ [data-rn='mark'],
138
+ [data-rn='abbr'],
139
+ [data-rn='cite'],
140
+ [data-rn='time']
141
+ ):not(
142
+ :has(
143
+ [data-rn]:not(
144
+ [data-rn='text'],
145
+ [data-rn='span'],
146
+ [data-rn='p'],
147
+ [data-rn='h1'],
148
+ [data-rn='h2'],
149
+ [data-rn='h3'],
150
+ [data-rn='h4'],
151
+ [data-rn='h5'],
152
+ [data-rn='h6'],
153
+ [data-rn='label'],
154
+ [data-rn='strong'],
155
+ [data-rn='b'],
156
+ [data-rn='em'],
157
+ [data-rn='i'],
158
+ [data-rn='u'],
159
+ [data-rn='s'],
160
+ [data-rn='small'],
161
+ [data-rn='code'],
162
+ [data-rn='mark'],
163
+ [data-rn='abbr'],
164
+ [data-rn='cite'],
165
+ [data-rn='time']
166
+ )
167
+ )
168
+ )
169
+ )[data-rn] {
65
170
  display: inline;
66
171
  }
67
172
 
173
+ :where(h1, h2, h3, h4, h5, h6, p)[data-rn] {
174
+ font-size: inherit;
175
+ font-weight: inherit;
176
+ margin: 0;
177
+ }
178
+
179
+ :where(ul, ol)[data-rn] {
180
+ list-style: none;
181
+ margin: 0;
182
+ padding: 0;
183
+ }
184
+
185
+ :where(strong, b)[data-rn] {
186
+ font-weight: bold;
187
+ }
188
+
189
+ :where(small)[data-rn] {
190
+ font-size: 80%;
191
+ }
192
+
193
+ :where(code)[data-rn] {
194
+ font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
195
+ font-size: 1em;
196
+ }
197
+
198
+ :where(mark)[data-rn] {
199
+ background-color: rgb(255, 255, 0);
200
+ color: rgb(0, 0, 0);
201
+ }
202
+
68
203
  [data-rn='scroll-view'],
69
204
  [data-rn='virtual-list'] {
70
205
  flex-grow: 1;
@@ -154,6 +289,19 @@ body {
154
289
  /* A device draws an unset placeholder grey; this is the text colour, faded, on any theme. */
155
290
  color: var(--rn-placeholder-color, color-mix(in srgb, currentColor 45%, transparent));
156
291
  }
292
+
293
+ [data-rn='gradient-text'] {
294
+ -webkit-background-clip: text;
295
+ background-clip: text;
296
+ }
297
+
298
+ [data-rn='gradient-text'] > [data-rn='text'][data-rn] {
299
+ color: transparent;
300
+ }
301
+
302
+ [data-rn='gradient-text'] > [data-rn='view'][data-rn] {
303
+ display: none;
304
+ }
157
305
  `;
158
306
  /**
159
307
  * The reset for an island inside someone else's page: `RESET_CSS` without the two rules that
@@ -1 +1 @@
1
- {"version":3,"file":"reset-css.js","sourceRoot":"","sources":["../src/reset-css.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA6IxB,CAAC;AAEF;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,SAAS,CAAC,OAAO,CAAC,6BAA6B,EAAE,EAAE,CAAC,CAAC,OAAO,CAC1F,iBAAiB,EACjB,oBAAoB,CACrB,CAAC","sourcesContent":["/**\n * `reset.css`'s content, as a string `mount()` can inject with no bundler CSS loader required.\n *\n * A second copy of `reset.css`, because this package ships raw TypeScript with no build step of\n * its own (see `package.json`), so there is nothing here to run a codegen script as part of. A\n * consumer with no CSS loader in their bundler still gets a working stylesheet from\n * `mount({ injectReset: true })` alone, and an app that would rather control ordering against\n * Tailwind imports the `.css` file instead.\n *\n * `reset.css` is the one to read and to edit. This one carries the same rules with the comments\n * stripped, and `reset-parity.test.ts` fails the moment the two disagree about a single\n * declaration - which is not a nicety. The first edit after this file was written landed in the\n * `.css` only, and the version `mount` actually injects would have gone on shipping the old\n * rules with nothing to say so.\n */\nexport const RESET_CSS = `\n[data-rn] {\n box-sizing: border-box;\n position: relative;\n flex-shrink: 0;\n min-width: 0;\n min-height: 0;\n}\n\n[data-rn]:where(:not([data-rn='root'])) {\n border-width: 0;\n border-style: solid;\n border-color: black;\n}\n\nhtml,\nbody {\n height: 100%;\n}\n\n[data-rn-root] {\n height: 100%;\n display: flex;\n flex-direction: column;\n}\n\nbody {\n font-family: var(\n --font-sans,\n system-ui,\n -apple-system,\n 'Segoe UI',\n Roboto,\n 'Helvetica Neue',\n Arial,\n sans-serif\n );\n font-size: 14px;\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n}\n\n[data-rn]:not([data-rn='text']) {\n display: flex;\n flex-direction: column;\n align-items: stretch;\n}\n\n[data-rn='text'] {\n display: inline;\n}\n\n[data-rn='scroll-view'],\n[data-rn='virtual-list'] {\n flex-grow: 1;\n flex-shrink: 1;\n flex-direction: column;\n overflow: auto;\n -webkit-overflow-scrolling: touch;\n}\n\n[data-rn='scroll-view'][flexdirection='row'] {\n flex-direction: row;\n}\n\n[data-rn='scroll-view'][scrollenabled='false'] {\n overflow: hidden;\n}\n\n[data-rn='image'] {\n background-size: cover;\n background-repeat: no-repeat;\n background-position: center;\n}\n\n:where([data-rn='image']) {\n width: var(--rn-intrinsic-width, auto);\n height: var(--rn-intrinsic-height, auto);\n}\n\n:where([data-rn='gesture-root']) {\n flex-grow: 1;\n flex-basis: 0%;\n}\n\n[data-rn='modal'] {\n position: fixed;\n inset: 0;\n z-index: 1000;\n background-color: rgb(0 0 0 / 50%);\n}\n[data-rn='modal'][hidden] {\n display: none;\n}\n\n[data-rn='input-accessory-view'] {\n position: fixed;\n left: 0;\n right: 0;\n bottom: 0;\n}\n\n[data-rn='activity-indicator'] {\n color: #999999;\n}\n[data-rn='activity-indicator']::after {\n content: '';\n box-sizing: border-box;\n flex: 1;\n border: 2px solid currentColor;\n border-right-color: transparent;\n border-radius: 50%;\n animation: rn-activity-indicator 0.8s linear infinite;\n}\n[data-rn='activity-indicator'][animating='false']::after {\n animation-play-state: paused;\n}\n[data-rn='activity-indicator'][animating='false']:not([hideswhenstopped='false'])::after {\n visibility: hidden;\n}\n@keyframes rn-activity-indicator {\n to {\n transform: rotate(360deg);\n }\n}\n\n[data-rn='text-input'] {\n background-color: transparent;\n font: inherit;\n color: inherit;\n letter-spacing: inherit;\n text-transform: inherit;\n margin: 0;\n padding: 0;\n resize: none;\n}\n\n[data-rn='text-input']::placeholder {\n /* A device draws an unset placeholder grey; this is the text colour, faded, on any theme. */\n color: var(--rn-placeholder-color, color-mix(in srgb, currentColor 45%, transparent));\n}\n`;\n\n/**\n * The reset for an island inside someone else's page: `RESET_CSS` without the two rules that\n * reach outside the island.\n *\n * `html, body { height: 100% }` and `body`'s font are right for a page this package owns, and\n * wrong for a page it is a guest on - they would resize and re-font the host app around the\n * island. So they go, and the font moves onto `[data-rn-root]`, where text inside the island\n * still inherits it. Derived rather than written out, so it cannot drift from `RESET_CSS`.\n */\nexport const ISLAND_RESET_CSS = RESET_CSS.replace(/html,\\s*body\\s*\\{[^}]*\\}\\s*/, '').replace(\n /(^|\\n)body\\s*\\{/,\n '$1[data-rn-root] {',\n);\n"]}
1
+ {"version":3,"file":"reset-css.js","sourceRoot":"","sources":["../src/reset-css.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiSxB,CAAC;AAEF;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,SAAS,CAAC,OAAO,CAAC,6BAA6B,EAAE,EAAE,CAAC,CAAC,OAAO,CAC1F,iBAAiB,EACjB,oBAAoB,CACrB,CAAC","sourcesContent":["/**\n * `reset.css`'s content, as a string `mount()` can inject with no bundler CSS loader required.\n *\n * A second copy of `reset.css`, because this package ships raw TypeScript with no build step of\n * its own (see `package.json`), so there is nothing here to run a codegen script as part of. A\n * consumer with no CSS loader in their bundler still gets a working stylesheet from\n * `mount({ injectReset: true })` alone, and an app that would rather control ordering against\n * Tailwind imports the `.css` file instead.\n *\n * `reset.css` is the one to read and to edit. This one carries the same rules with the comments\n * stripped, and `reset-parity.test.ts` fails the moment the two disagree about a single\n * declaration - which is not a nicety. The first edit after this file was written landed in the\n * `.css` only, and the version `mount` actually injects would have gone on shipping the old\n * rules with nothing to say so.\n */\nexport const RESET_CSS = `\n[data-rn] {\n box-sizing: border-box;\n position: relative;\n flex-shrink: 0;\n min-width: 0;\n min-height: 0;\n}\n\n[data-rn]:where(:not([data-rn='root'])) {\n border-width: 0;\n border-style: solid;\n border-color: black;\n}\n\nhtml,\nbody {\n height: 100%;\n}\n\n[data-rn-root] {\n height: 100%;\n display: flex;\n flex-direction: column;\n}\n\nbody {\n font-family: var(\n --font-sans,\n system-ui,\n -apple-system,\n 'Segoe UI',\n Roboto,\n 'Helvetica Neue',\n Arial,\n sans-serif\n );\n font-size: 14px;\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n}\n\n[data-rn]:not([data-rn='text']):not(\n :where(\n :is(\n [data-rn='span'],\n [data-rn='p'],\n [data-rn='h1'],\n [data-rn='h2'],\n [data-rn='h3'],\n [data-rn='h4'],\n [data-rn='h5'],\n [data-rn='h6'],\n [data-rn='label'],\n [data-rn='strong'],\n [data-rn='b'],\n [data-rn='em'],\n [data-rn='i'],\n [data-rn='u'],\n [data-rn='s'],\n [data-rn='small'],\n [data-rn='code'],\n [data-rn='mark'],\n [data-rn='abbr'],\n [data-rn='cite'],\n [data-rn='time']\n ):not(\n :has(\n [data-rn]:not(\n [data-rn='text'],\n [data-rn='span'],\n [data-rn='p'],\n [data-rn='h1'],\n [data-rn='h2'],\n [data-rn='h3'],\n [data-rn='h4'],\n [data-rn='h5'],\n [data-rn='h6'],\n [data-rn='label'],\n [data-rn='strong'],\n [data-rn='b'],\n [data-rn='em'],\n [data-rn='i'],\n [data-rn='u'],\n [data-rn='s'],\n [data-rn='small'],\n [data-rn='code'],\n [data-rn='mark'],\n [data-rn='abbr'],\n [data-rn='cite'],\n [data-rn='time']\n )\n )\n )\n )\n ) {\n display: flex;\n flex-direction: column;\n align-items: stretch;\n}\n\n[data-rn='text'],\n:where(\n :is(\n [data-rn='span'],\n [data-rn='p'],\n [data-rn='h1'],\n [data-rn='h2'],\n [data-rn='h3'],\n [data-rn='h4'],\n [data-rn='h5'],\n [data-rn='h6'],\n [data-rn='label'],\n [data-rn='strong'],\n [data-rn='b'],\n [data-rn='em'],\n [data-rn='i'],\n [data-rn='u'],\n [data-rn='s'],\n [data-rn='small'],\n [data-rn='code'],\n [data-rn='mark'],\n [data-rn='abbr'],\n [data-rn='cite'],\n [data-rn='time']\n ):not(\n :has(\n [data-rn]:not(\n [data-rn='text'],\n [data-rn='span'],\n [data-rn='p'],\n [data-rn='h1'],\n [data-rn='h2'],\n [data-rn='h3'],\n [data-rn='h4'],\n [data-rn='h5'],\n [data-rn='h6'],\n [data-rn='label'],\n [data-rn='strong'],\n [data-rn='b'],\n [data-rn='em'],\n [data-rn='i'],\n [data-rn='u'],\n [data-rn='s'],\n [data-rn='small'],\n [data-rn='code'],\n [data-rn='mark'],\n [data-rn='abbr'],\n [data-rn='cite'],\n [data-rn='time']\n )\n )\n )\n)[data-rn] {\n display: inline;\n}\n\n:where(h1, h2, h3, h4, h5, h6, p)[data-rn] {\n font-size: inherit;\n font-weight: inherit;\n margin: 0;\n}\n\n:where(ul, ol)[data-rn] {\n list-style: none;\n margin: 0;\n padding: 0;\n}\n\n:where(strong, b)[data-rn] {\n font-weight: bold;\n}\n\n:where(small)[data-rn] {\n font-size: 80%;\n}\n\n:where(code)[data-rn] {\n font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;\n font-size: 1em;\n}\n\n:where(mark)[data-rn] {\n background-color: rgb(255, 255, 0);\n color: rgb(0, 0, 0);\n}\n\n[data-rn='scroll-view'],\n[data-rn='virtual-list'] {\n flex-grow: 1;\n flex-shrink: 1;\n flex-direction: column;\n overflow: auto;\n -webkit-overflow-scrolling: touch;\n}\n\n[data-rn='scroll-view'][flexdirection='row'] {\n flex-direction: row;\n}\n\n[data-rn='scroll-view'][scrollenabled='false'] {\n overflow: hidden;\n}\n\n[data-rn='image'] {\n background-size: cover;\n background-repeat: no-repeat;\n background-position: center;\n}\n\n:where([data-rn='image']) {\n width: var(--rn-intrinsic-width, auto);\n height: var(--rn-intrinsic-height, auto);\n}\n\n:where([data-rn='gesture-root']) {\n flex-grow: 1;\n flex-basis: 0%;\n}\n\n[data-rn='modal'] {\n position: fixed;\n inset: 0;\n z-index: 1000;\n background-color: rgb(0 0 0 / 50%);\n}\n[data-rn='modal'][hidden] {\n display: none;\n}\n\n[data-rn='input-accessory-view'] {\n position: fixed;\n left: 0;\n right: 0;\n bottom: 0;\n}\n\n[data-rn='activity-indicator'] {\n color: #999999;\n}\n[data-rn='activity-indicator']::after {\n content: '';\n box-sizing: border-box;\n flex: 1;\n border: 2px solid currentColor;\n border-right-color: transparent;\n border-radius: 50%;\n animation: rn-activity-indicator 0.8s linear infinite;\n}\n[data-rn='activity-indicator'][animating='false']::after {\n animation-play-state: paused;\n}\n[data-rn='activity-indicator'][animating='false']:not([hideswhenstopped='false'])::after {\n visibility: hidden;\n}\n@keyframes rn-activity-indicator {\n to {\n transform: rotate(360deg);\n }\n}\n\n[data-rn='text-input'] {\n background-color: transparent;\n font: inherit;\n color: inherit;\n letter-spacing: inherit;\n text-transform: inherit;\n margin: 0;\n padding: 0;\n resize: none;\n}\n\n[data-rn='text-input']::placeholder {\n /* A device draws an unset placeholder grey; this is the text colour, faded, on any theme. */\n color: var(--rn-placeholder-color, color-mix(in srgb, currentColor 45%, transparent));\n}\n\n[data-rn='gradient-text'] {\n -webkit-background-clip: text;\n background-clip: text;\n}\n\n[data-rn='gradient-text'] > [data-rn='text'][data-rn] {\n color: transparent;\n}\n\n[data-rn='gradient-text'] > [data-rn='view'][data-rn] {\n display: none;\n}\n`;\n\n/**\n * The reset for an island inside someone else's page: `RESET_CSS` without the two rules that\n * reach outside the island.\n *\n * `html, body { height: 100% }` and `body`'s font are right for a page this package owns, and\n * wrong for a page it is a guest on - they would resize and re-font the host app around the\n * island. So they go, and the font moves onto `[data-rn-root]`, where text inside the island\n * still inherits it. Derived rather than written out, so it cannot drift from `RESET_CSS`.\n */\nexport const ISLAND_RESET_CSS = RESET_CSS.replace(/html,\\s*body\\s*\\{[^}]*\\}\\s*/, '').replace(\n /(^|\\n)body\\s*\\{/,\n '$1[data-rn-root] {',\n);\n"]}
package/dist/reset.css CHANGED
@@ -124,16 +124,166 @@ body {
124
124
  -moz-osx-font-smoothing: grayscale;
125
125
  }
126
126
 
127
- [data-rn]:not([data-rn='text']) {
127
+ /*
128
+ * HTML's text elements (`span`, `p`, `h1` and the rest), which the engine decides between text and
129
+ * a view by what each holds: text when it holds only text and other text elements, a view when it
130
+ * holds anything else. `:has()` asks the same question here, of any depth, since a text element
131
+ * that holds a view is a view to the one around it as well.
132
+ *
133
+ * Inside `:where()`, so the two rules weigh what they weighed before these elements were known.
134
+ */
135
+ [data-rn]:not([data-rn='text']):not(
136
+ :where(
137
+ :is(
138
+ [data-rn='span'],
139
+ [data-rn='p'],
140
+ [data-rn='h1'],
141
+ [data-rn='h2'],
142
+ [data-rn='h3'],
143
+ [data-rn='h4'],
144
+ [data-rn='h5'],
145
+ [data-rn='h6'],
146
+ [data-rn='label'],
147
+ [data-rn='strong'],
148
+ [data-rn='b'],
149
+ [data-rn='em'],
150
+ [data-rn='i'],
151
+ [data-rn='u'],
152
+ [data-rn='s'],
153
+ [data-rn='small'],
154
+ [data-rn='code'],
155
+ [data-rn='mark'],
156
+ [data-rn='abbr'],
157
+ [data-rn='cite'],
158
+ [data-rn='time']
159
+ ):not(
160
+ :has(
161
+ [data-rn]:not(
162
+ [data-rn='text'],
163
+ [data-rn='span'],
164
+ [data-rn='p'],
165
+ [data-rn='h1'],
166
+ [data-rn='h2'],
167
+ [data-rn='h3'],
168
+ [data-rn='h4'],
169
+ [data-rn='h5'],
170
+ [data-rn='h6'],
171
+ [data-rn='label'],
172
+ [data-rn='strong'],
173
+ [data-rn='b'],
174
+ [data-rn='em'],
175
+ [data-rn='i'],
176
+ [data-rn='u'],
177
+ [data-rn='s'],
178
+ [data-rn='small'],
179
+ [data-rn='code'],
180
+ [data-rn='mark'],
181
+ [data-rn='abbr'],
182
+ [data-rn='cite'],
183
+ [data-rn='time']
184
+ )
185
+ )
186
+ )
187
+ )
188
+ ) {
128
189
  display: flex;
129
190
  flex-direction: column;
130
191
  align-items: stretch;
131
192
  }
132
193
 
133
- [data-rn='text'] {
194
+ [data-rn='text'],
195
+ :where(
196
+ :is(
197
+ [data-rn='span'],
198
+ [data-rn='p'],
199
+ [data-rn='h1'],
200
+ [data-rn='h2'],
201
+ [data-rn='h3'],
202
+ [data-rn='h4'],
203
+ [data-rn='h5'],
204
+ [data-rn='h6'],
205
+ [data-rn='label'],
206
+ [data-rn='strong'],
207
+ [data-rn='b'],
208
+ [data-rn='em'],
209
+ [data-rn='i'],
210
+ [data-rn='u'],
211
+ [data-rn='s'],
212
+ [data-rn='small'],
213
+ [data-rn='code'],
214
+ [data-rn='mark'],
215
+ [data-rn='abbr'],
216
+ [data-rn='cite'],
217
+ [data-rn='time']
218
+ ):not(
219
+ :has(
220
+ [data-rn]:not(
221
+ [data-rn='text'],
222
+ [data-rn='span'],
223
+ [data-rn='p'],
224
+ [data-rn='h1'],
225
+ [data-rn='h2'],
226
+ [data-rn='h3'],
227
+ [data-rn='h4'],
228
+ [data-rn='h5'],
229
+ [data-rn='h6'],
230
+ [data-rn='label'],
231
+ [data-rn='strong'],
232
+ [data-rn='b'],
233
+ [data-rn='em'],
234
+ [data-rn='i'],
235
+ [data-rn='u'],
236
+ [data-rn='s'],
237
+ [data-rn='small'],
238
+ [data-rn='code'],
239
+ [data-rn='mark'],
240
+ [data-rn='abbr'],
241
+ [data-rn='cite'],
242
+ [data-rn='time']
243
+ )
244
+ )
245
+ )
246
+ )[data-rn] {
134
247
  display: inline;
135
248
  }
136
249
 
250
+ /*
251
+ * What a browser gives these elements that the engine does not, taken away, and the few styles
252
+ * the engine does give them (`packages/fabric/src/element-styles.ts`), said here too: a heading
253
+ * and a paragraph are plain text with no margin, a list has no markers or indent, and `strong`,
254
+ * `small`, `code` and `mark` look as they do on a device. `em`, `i`, `cite`, `u` and `s` are a
255
+ * browser's own already. All inside `:where()`, so any rule of the app's wins.
256
+ */
257
+ :where(h1, h2, h3, h4, h5, h6, p)[data-rn] {
258
+ font-size: inherit;
259
+ font-weight: inherit;
260
+ margin: 0;
261
+ }
262
+
263
+ :where(ul, ol)[data-rn] {
264
+ list-style: none;
265
+ margin: 0;
266
+ padding: 0;
267
+ }
268
+
269
+ :where(strong, b)[data-rn] {
270
+ font-weight: bold;
271
+ }
272
+
273
+ :where(small)[data-rn] {
274
+ font-size: 80%;
275
+ }
276
+
277
+ :where(code)[data-rn] {
278
+ font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
279
+ font-size: 1em;
280
+ }
281
+
282
+ :where(mark)[data-rn] {
283
+ background-color: rgb(255, 255, 0);
284
+ color: rgb(0, 0, 0);
285
+ }
286
+
137
287
  /*
138
288
  * `ScrollView.js`'s own base style (`engine.ts`'s `DEFAULT_PROPS.ScrollView`): a native scroll
139
289
  * view does not clip its content on its own, so without this the content spills straight out of
@@ -290,3 +440,22 @@ body {
290
440
  /* A device draws an unset placeholder grey; this is the text colour, faded, on any theme. */
291
441
  color: var(--rn-placeholder-color, color-mix(in srgb, currentColor 45%, transparent));
292
442
  }
443
+
444
+ /*
445
+ * `gradient-text.ts`: a background drawn through the letters. A browser has the property for it,
446
+ * so the element clips its own background to its text, the letters are transparent whatever the
447
+ * component drew them in to be a mask on a device, and the view a device paints the background on
448
+ * is not there.
449
+ */
450
+ [data-rn='gradient-text'] {
451
+ -webkit-background-clip: text;
452
+ background-clip: text;
453
+ }
454
+
455
+ [data-rn='gradient-text'] > [data-rn='text'][data-rn] {
456
+ color: transparent;
457
+ }
458
+
459
+ [data-rn='gradient-text'] > [data-rn='view'][data-rn] {
460
+ display: none;
461
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ng-native/web",
3
- "version": "0.3.0",
3
+ "version": "0.5.0",
4
4
  "description": "A browser host for Angular Native: the same components, rendered into the DOM instead of native views.",
5
5
  "keywords": [
6
6
  "angular",
@@ -35,8 +35,8 @@
35
35
  "access": "public"
36
36
  },
37
37
  "dependencies": {
38
- "@ng-native/device": "0.3.0",
39
- "@ng-native/fabric": "0.3.0",
38
+ "@ng-native/device": "0.5.0",
39
+ "@ng-native/fabric": "0.5.0",
40
40
  "@oxc-angular/vite": "0.0.38"
41
41
  },
42
42
  "peerDependencies": {
@@ -53,11 +53,11 @@
53
53
  "@angular/compiler": "22.2.0",
54
54
  "@angular/platform-browser": "22.2.0",
55
55
  "@ng-icons/core": "^36.0.0",
56
- "@ng-native/components": "0.3.0",
57
- "@ng-native/icons": "0.3.0",
58
- "@ng-native/metro": "0.3.0",
59
- "@ng-native/tailwind": "0.3.0",
60
- "@ng-native/testing": "0.3.0",
56
+ "@ng-native/components": "0.5.0",
57
+ "@ng-native/icons": "0.5.0",
58
+ "@ng-native/metro": "0.5.0",
59
+ "@ng-native/tailwind": "0.5.0",
60
+ "@ng-native/testing": "0.5.0",
61
61
  "@tailwindcss/vite": "^4.3.3",
62
62
  "@types/jsdom": "^27.0.0",
63
63
  "@vitest/browser": "^5.0.2",
package/vite.d.mts CHANGED
@@ -9,3 +9,10 @@ import type { Plugin } from 'vite';
9
9
  * `emitClassMetadata: false`.
10
10
  */
11
11
  export declare function ngNativeWeb(options?: PluginOptions): Plugin[];
12
+
13
+ /**
14
+ * `ngNativeWeb()` without the compiler, for an app whose own Angular plugin compiles its
15
+ * components, as Analog's does: the resolution, and `@oxc-angular/vite`'s linker for the
16
+ * `@ng-native/*` packages.
17
+ */
18
+ export declare function ngNativeWebLink(): Plugin[];
package/vite.mjs CHANGED
@@ -7,7 +7,9 @@
7
7
  * - `ng-native:config`, the resolution a browser build needs. React Native and Expo are reachable
8
8
  * from the packages behind guards a browser never passes, but a bundler still resolves every
9
9
  * specifier it sees, and React Native's source is Flow. Both resolve to an empty module, and a
10
- * Expo module a package `require`s, such as `expo-battery`, to one that throws.
10
+ * Expo module a package `require`s, such as `expo-battery`, to one that throws. Reanimated,
11
+ * worklets and gesture-handler resolve to inert stand-ins, so a component that builds a gesture
12
+ * or an animation builds for the browser too.
11
13
  * - `@oxc-angular/vite`'s own plugins, for the app's components and for the linker, which handles
12
14
  * the `@ng-native/*` packages as it handles every partial-compiled Angular library on npm.
13
15
  */
@@ -34,6 +36,18 @@ const NATIVE_MODULE =
34
36
  /^(expo-|@expo\/|@react-native-async-storage\/|react-native-watch-connectivity$)/;
35
37
  const MISSING = '\0ng-native:missing:';
36
38
 
39
+ /**
40
+ * The libraries an app imports itself for gestures and worklet animations, and the stand-in each
41
+ * resolves to in a browser, where there is no native recogniser and no UI-thread runtime: an
42
+ * animation lands where it ends, a gesture recognises nothing, and work scheduled for either
43
+ * runtime runs at once. Installed or not, since the libraries reach React Native's source.
44
+ */
45
+ const STAND_INS = {
46
+ 'react-native-reanimated': '@ng-native/components/stand-ins/reanimated',
47
+ 'react-native-worklets': '@ng-native/components/stand-ins/worklets',
48
+ 'react-native-gesture-handler': '@ng-native/components/stand-ins/gesture-handler',
49
+ };
50
+
37
51
  /**
38
52
  * Resolves `react-native` and `expo` to an empty module, and a `require` of an Expo module to one
39
53
  * that throws, in the build and in the dependency pre-bundle alike.
@@ -48,7 +62,11 @@ const MISSING = '\0ng-native:missing:';
48
62
  function nativeOnly() {
49
63
  return {
50
64
  name: 'ng-native:native-only',
51
- resolveId: (id, _importer, options) => {
65
+ resolveId(id, importer, options) {
66
+ // From the importer: `@ng-native/components` is the app's, not this package's.
67
+ // As resolved, so the dependency scan takes the stand-in as a dependency to pre-bundle.
68
+ if (Object.hasOwn(STAND_INS, id))
69
+ return this.resolve(STAND_INS[id], importer, { skipSelf: true });
52
70
  if (NATIVE_ONLY.test(id)) return EMPTY;
53
71
  if (options?.kind === 'require-call' && NATIVE_MODULE.test(id)) return MISSING + id;
54
72
  return null;
@@ -80,3 +98,21 @@ function config() {
80
98
  export function ngNativeWeb(options = {}) {
81
99
  return [config(), ...angular({ zoneless: true, emitClassMetadata: false, ...options })];
82
100
  }
101
+
102
+ /** The plugins of `ngNativeWeb()` that `ngNativeWebLink()` keeps. */
103
+ const LINK = new Set(['ng-native:config', '@oxc-angular/vite-linker']);
104
+
105
+ /**
106
+ * `ngNativeWeb()` without the compiler, for an app whose own Angular plugin compiles its
107
+ * components, as Analog's does: the resolution, and `@oxc-angular/vite`'s linker.
108
+ *
109
+ * The linker is the part such an app lacks. Analog's runs only on paths with `/fesm20` in them,
110
+ * where `@angular/*` ship their bundles, and the `@ng-native/*` packages ship `ngc` output in
111
+ * `dist/` instead. `@oxc-angular/vite`'s goes by what a file holds, so it links them wherever they
112
+ * are, and leaves a file it finds nothing to link in alone.
113
+ *
114
+ * @returns {import('vite').Plugin[]}
115
+ */
116
+ export function ngNativeWebLink() {
117
+ return ngNativeWeb().filter((plugin) => LINK.has(plugin.name));
118
+ }