@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.
@@ -49,7 +49,14 @@ export declare class BrowserEngine extends HostEngine {
49
49
  createElementNode(name: string): BrowserNode;
50
50
  createTextNode(value: string): BrowserNode;
51
51
  createAnchorNode(): BrowserNode;
52
- /** Wrap an existing real element - the app's own mount point - as the tree's root node. */
52
+ /**
53
+ * Wrap an existing real element - the app's own mount point - as the tree's root node.
54
+ *
55
+ * `ngSkipHydration` is Angular's own opt-out, and true of every tree this engine renders: none
56
+ * is server-rendered, so there is no markup to reuse. With hydration on, Angular reads it on a
57
+ * root component's host element, and without it walks that element's DOM for text markers,
58
+ * which a node is not.
59
+ */
53
60
  wrapRoot(el: Element): BrowserNode;
54
61
  /**
55
62
  * Whether `node` is a mount point `wrapRoot` wrapped. It belongs to whoever called `mount`, not
@@ -165,10 +165,18 @@ export class BrowserEngine extends HostEngine {
165
165
  createAnchorNode() {
166
166
  return makeAnchorNode(this.document.createComment(''));
167
167
  }
168
- /** Wrap an existing real element - the app's own mount point - as the tree's root node. */
168
+ /**
169
+ * Wrap an existing real element - the app's own mount point - as the tree's root node.
170
+ *
171
+ * `ngSkipHydration` is Angular's own opt-out, and true of every tree this engine renders: none
172
+ * is server-rendered, so there is no markup to reuse. With hydration on, Angular reads it on a
173
+ * root component's host element, and without it walks that element's DOM for text markers,
174
+ * which a node is not.
175
+ */
169
176
  wrapRoot(el) {
170
177
  const node = makeElementNode(el.tagName.toLowerCase(), el);
171
178
  el.setAttribute('data-rn', 'root');
179
+ el.setAttribute('ngSkipHydration', '');
172
180
  this.roots.add(node);
173
181
  this.owned.add(node);
174
182
  return node;
@@ -1 +1 @@
1
- {"version":3,"file":"browser-engine.js","sourceRoot":"","sources":["../src/browser-engine.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,EACL,aAAa,EACb,UAAU,EACV,cAAc,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O,CAAE,EAAE;YACtD,KAAK,EAAE,KAAK,CAAC,KAAK;YAClB,KAAK,EAAE,KAAK,CAAC,KAAK;YAClB,UAAU,EAAE,KAAK,CAAC,SAAS;SAC5B,CAAC,CAAC;IACL,CAAC;IAEO,aAAa,CAAC,KAAiB,EAAE,OAAgB;QACvD,MAAM,IAAI,GAAG,aAAa,CAAC,KAAK,CAAC,MAAwB,CAAC,CAAC;QAC3D,IAAI,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC;YAAE,OAAO;QAC3C,IAAI,OAAO;YAAE,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC;aAChC,IAAI,IAAI,CAAC,WAAW,KAAK,IAAI;YAAE,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC;QAC5D,IAAI,CAAC,aAAa,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,SAAS,EAAE,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC,CAAC;IAC5E,CAAC;CACF","sourcesContent":["/**\n * `HostEngine` over real DOM APIs: the browser counterpart to `packages/fabric/src/engine.ts`'s\n * `Engine`.\n *\n * One instance per `mount()` call. It owns the prop/DOM translation (`props.ts`), the element\n * mapping (`elements.ts`), and the responder negotiation (`responder.ts`); this file is mostly\n * the wiring between them and the handful of DOM event listeners the whole tree shares - one\n * `pointerdown`/`pointermove`/`pointerup`/`pointercancel` set on `document` for the responder\n * system, one `focusin`/`focusout` set for `:focus` tracking, because both need to see every\n * node's events rather than each node installing its own (Fabric's own engine is exactly this\n * shape: one `registerEventHandler` callback for the whole tree, not one per view).\n *\n * `dispatchEvent` mirrors `engine.ts`'s method of the same name step for step: run the responder\n * negotiation first, then propagate to whatever `(eventName)` bindings are listening, in the\n * same two-phase order a real touch would arrive in on native.\n */\nimport {\n DIRECT_EVENTS,\n HostEngine,\n SyntheticEvent,\n type ResponderEvent,\n type ResponderHandlers,\n type WindowFrame,\n} from '@ng-native/fabric';\nimport {\n makeAnchorNode,\n makeElementNode,\n makeTextNode,\n nearestNodeOf,\n nodeOf,\n rebindElement,\n type BrowserNode,\n} from './dom-node.ts';\nimport { createDomElement, textFieldLike } from './elements.ts';\nimport { applyProp } from './props.ts';\nimport { ResponderSystem } from './responder.ts';\n\nconst TOUCH_EVENT_NAMES: Record<string, string> = {\n pointerdown: 'topTouchStart',\n pointermove: 'topTouchMove',\n pointerup: 'topTouchEnd',\n pointercancel: 'topTouchCancel',\n};\n\nfunction scrollToEnd(el: HTMLElement, args: readonly unknown[]): void {\n const [animated = true] = args as [boolean?];\n const horizontal = el.scrollWidth > el.clientWidth && el.scrollHeight <= el.clientHeight;\n el.scrollTo(\n horizontal\n ? { left: el.scrollWidth, behavior: animated ? 'smooth' : 'auto' }\n : { top: el.scrollHeight, behavior: animated ? 'smooth' : 'auto' },\n );\n}\n\n/** Focuses `field` with the caret or selection `old` had, as a field swapped in for it. */\nfunction focusLike(field: HTMLInputElement | HTMLTextAreaElement, old: typeof field): void {\n field.focus();\n const { selectionStart, selectionEnd, selectionDirection } = old;\n if (selectionStart === null || selectionEnd === null) return;\n field.setSelectionRange(selectionStart, selectionEnd, selectionDirection ?? undefined);\n}\n\nfunction setTextAndSelection(el: HTMLElement, args: readonly unknown[]): void {\n const [, text, start, end] = args as [number, string | null, number, number];\n const textarea = el as HTMLTextAreaElement;\n if (text !== null && text !== undefined) textarea.value = text;\n if (start !== -1) textarea.setSelectionRange(start, end === -1 ? start : end);\n}\n\n/**\n * View commands, by name. A lookup table for the same reason `props.ts`'s tables are one: it is\n * where a review sees which commands do something and which do not, in one place, rather than\n * spread across a `switch`'s branches.\n *\n * `flashScrollIndicators`, `zoomToRect`, `hotspotUpdate`, `setPressed`, `setNativeRefreshing`:\n * no web equivalent (a browser's scrollbar has no imperative \"flash\", pinch-zoom is not\n * scriptable, and there is no Android ripple to drive) - absent rather than a `noop` entry,\n * because unlike a prop there is no generic fallback for a command name to fall through to; an\n * absent command is already silently ignored below.\n */\nconst COMMANDS: Record<string, (el: HTMLElement, args: readonly unknown[]) => void> = {\n focus: (el) => el.focus(),\n blur: (el) => el.blur(),\n scrollTo: (el, args) => {\n const [x = 0, y = 0, animated = true] = args as [number?, number?, boolean?];\n el.scrollTo({ left: x, top: y, behavior: animated ? 'smooth' : 'auto' });\n },\n scrollToEnd,\n setTextAndSelection,\n // `<switch>` putting back a flip the app refused; the checkbox is what the user clicked.\n setValue: (el, [value]) => {\n (el as HTMLInputElement).checked = value === true;\n },\n};\n\n/**\n * The events this engine owns, which are React Native's rather than the DOM's.\n *\n * Each is either synthesised here from something else - `topLayout` from a `ResizeObserver`,\n * `topTouch*` from pointer events, `topFocus` from `focusin` - or not implemented yet. Either way\n * a handler bound to one expects React Native's `{ nativeEvent }` payload with React Native's own\n * fields in it, so they must not be wired straight to the DOM event of the same name: a\n * `scroll-view`'s `(scroll)` reads `nativeEvent.contentOffset`, and handing it a raw DOM `Event`\n * would turn a binding that quietly does nothing into one that throws on the first scroll.\n *\n * The list is the events `@ng-native/components` actually binds, found by\n * reading their host and template bindings rather than guessed. Anything outside it is a plain\n * DOM event and is bound as one.\n *\n * `topLoad` and `topError` are deliberately *not* here, though an `<image>` binds both. A\n * background image fires neither on its own, so `props.ts` loads the URL with a detached `Image()`\n * and dispatches a real DOM `load` or `error` on the element - which means there is a genuine DOM\n * event of each name to bind, and the general path is the right one. Reserving them was what left\n * a broken image URL blank rather than showing a fallback.\n */\nconst ENGINE_EVENTS = new Set([\n 'topLayout',\n 'topChange',\n 'topContentSizeChange',\n 'topRefresh',\n 'topScroll',\n 'topEndReached',\n 'topSelectionChange',\n 'topMomentumScrollBegin',\n 'topMomentumScrollEnd',\n 'topTouchStart',\n 'topTouchMove',\n 'topTouchEnd',\n 'topTouchCancel',\n 'topFocus',\n 'topBlur',\n 'topPointerEnter',\n 'topPointerLeave',\n]);\n\nexport class BrowserEngine extends HostEngine {\n private readonly document: Document;\n private readonly responders = new ResponderSystem();\n private focusedNode: BrowserNode | null = null;\n /** `TextInput`'s echo protocol: a change count that only ever goes up. One counter per field. */\n private readonly eventCounts = new WeakMap<BrowserNode, number>();\n /** Mount points `wrapRoot` wrapped; see `isRoot`. */\n private readonly roots = new WeakSet<BrowserNode>();\n /**\n * The node each in-progress gesture began on, by `pointerId`, so `pointermove`/`pointerup`\n * resolve to the same node however far the finger has travelled - `setPointerCapture` keeps\n * the browser routing them there; this is what this class trusts instead of re-reading\n * `event.target`. Keyed by `pointerId` rather than holding just one, so two fingers on two\n * different controls (a phone reports multi-touch) do not clobber each other.\n */\n private readonly activeTouches = new Map<number, BrowserNode>();\n /**\n * The element nodes this engine made, and so the only ones its document listeners act for.\n *\n * Every engine listens on the one `document`, and a page can hold several - one per island, or\n * the documentation site's three roots - while `nearestNodeOf` finds a node whichever engine\n * made it. Without this, each engine delivered every focus, blur and touch in any root on the\n * page, so a text field's `(blur)` ran once per island.\n */\n private readonly owned = new WeakSet<BrowserNode>();\n /** Removes the document listeners, once the app they served is gone; see `dispose`. */\n private readonly listening: AbortController;\n\n constructor(document: Document) {\n super();\n this.document = document;\n // The document's own, so the signal is one its `addEventListener` recognises.\n this.listening = new (document.defaultView?.AbortController ?? AbortController)();\n this.installGlobalListeners();\n }\n\n /** Stop listening to the document. `mount` calls this as its app is destroyed. */\n dispose(): void {\n this.listening.abort();\n this.activeTouches.clear();\n }\n\n // --- element creation, called from BrowserRenderer ----------------------------------------\n\n createElementNode(name: string): BrowserNode {\n const el = createDomElement(this.document, name);\n const node = makeElementNode(name, el);\n this.owned.add(node);\n this.wireAlwaysOnListeners(node);\n return node;\n }\n\n createTextNode(value: string): BrowserNode {\n return makeTextNode(this.document.createTextNode(value));\n }\n\n createAnchorNode(): BrowserNode {\n return makeAnchorNode(this.document.createComment(''));\n }\n\n /** Wrap an existing real element - the app's own mount point - as the tree's root node. */\n wrapRoot(el: Element): BrowserNode {\n const node = makeElementNode(el.tagName.toLowerCase(), el);\n el.setAttribute('data-rn', 'root');\n this.roots.add(node);\n this.owned.add(node);\n return node;\n }\n\n /**\n * Whether `node` is a mount point `wrapRoot` wrapped. It belongs to whoever called `mount`, not\n * to the app rendered into it, so the renderer empties it rather than removing it.\n */\n isRoot(node: BrowserNode): boolean {\n return this.roots.has(node);\n }\n\n // --- HostEngine -----------------------------------------------------------------------------\n\n setProp(node: BrowserNode, key: string, value: unknown): void {\n const clear = value === undefined || value === null;\n if (clear) {\n if (!(key in node.props)) return;\n delete node.props[key];\n } else {\n if (node.props[key] === value) return;\n node.props[key] = value;\n }\n if (key === 'multiline' && node.name === 'text-input') this.fieldFor(node, value === true);\n applyProp(node, key, value, clear);\n }\n\n /**\n * A `<textarea>` for a multiline field and an `<input>` for a one-line one, swapped in place when\n * `multiline` arrives, which is after the element was made (see `elements.ts`).\n *\n * The new element takes the old one's attributes (inline style and scoping attributes among\n * them), its value, its focus and its selection, and the engine's own listeners are installed on it again.\n */\n private fieldFor(node: BrowserNode, multiline: boolean): void {\n const old = node.el as HTMLInputElement | HTMLTextAreaElement;\n if ((old.tagName === 'TEXTAREA') === multiline) return;\n const field = textFieldLike(old, multiline);\n // An input strips line breaks from its value, so text set before `multiline` lost them. Taken\n // from the prop again unless the user has typed since.\n const text = node.props['text'];\n if (multiline && text != null && old.value === String(text).replace(/[\\r\\n]/g, '')) {\n field.value = String(text);\n }\n const focused = this.document.activeElement === old;\n this.layoutObservers.get(node)?.disconnect();\n old.replaceWith(field);\n rebindElement(node, field);\n this.wireAlwaysOnListeners(node);\n const optedIn = node.optedIn;\n node.optedIn = null;\n for (const type of optedIn ?? []) this.wireOptIn(node, type);\n for (const key of ['secureTextEntry', 'keyboardType', 'numberOfLines']) {\n if (key in node.props) applyProp(node, key, node.props[key], false);\n }\n if (focused) focusLike(field, old);\n }\n\n /** Each node's `topLayout` observer, so a field swapped for another stops watching the old one. */\n private readonly layoutObservers = new WeakMap<BrowserNode, ResizeObserver>();\n\n setEventListener(\n node: BrowserNode,\n topLevelType: string,\n fn: (event: unknown) => void,\n ): () => void {\n const listeners = (node.listeners ??= new Map());\n let set = listeners.get(topLevelType);\n if (!set) listeners.set(topLevelType, (set = new Set()));\n set.add(fn);\n this.wireOptIn(node, topLevelType);\n return () => set!.delete(fn);\n }\n\n setResponder(node: BrowserNode, handlers: ResponderHandlers): () => void {\n return this.responders.setResponder(node, handlers);\n }\n\n /**\n * Where a node is, relative to the mount root rather than to the viewport.\n *\n * `measureInWindow` on native answers in window coordinates, and the overlay host is a\n * full-screen absolutely positioned view at the window's origin, so the two agree and an\n * anchored overlay can use one as the other. `getBoundingClientRect` answers in *viewport*\n * coordinates, and `<overlay-host>` is absolutely positioned inside the mount root - so\n * those two agree only when the root sits at the top left of an unscrolled viewport.\n *\n * That is true of a full-page app, which is why every popover in the gallery lands correctly\n * and this went unnoticed. It is false in the two cases that matter: an app mounted into a box\n * partway down a page, where every overlay is offset by the box's own position, and a document\n * that scrolls, where the offset changes as you scroll. Subtracting the root's own rect from a\n * viewport-relative one cancels the scroll term as well as the offset, since both rects move\n * together as the page scrolls - so one subtraction fixes both cases at once.\n *\n * `closest`, not `querySelector`: a page can hold more than one mounted root at a time (the\n * documentation site's own home page does, three of them), and `querySelector` always answers\n * the first one in document order regardless of which root's own tree `node` actually lives in.\n * That made every root after the first measure its overlays against someone else's box.\n * `closest` walks up from the node itself, so each root only ever measures against its own.\n */\n measure(node: BrowserNode, into: (frame: WindowFrame) => void): void {\n const el = node.el as Element;\n const rect = el.getBoundingClientRect();\n const root = el.closest('[data-rn-root]');\n const origin = root ? root.getBoundingClientRect() : { x: 0, y: 0 };\n into({ x: rect.x - origin.x, y: rect.y - origin.y, width: rect.width, height: rect.height });\n }\n\n dispatchCommand(node: BrowserNode, name: string, args: readonly unknown[] = []): void {\n COMMANDS[name]?.(node.el as HTMLElement, args);\n }\n\n /**\n * The scoping attribute Angular's emulated encapsulation stamps on `like`, stamped on `node`,\n * or taken off again when `like` is null.\n */\n override adoptScope(node: BrowserNode, like: BrowserNode | null): void {\n const el = node.el as Element;\n for (const name of this.adopted.get(node) ?? []) el.removeAttribute(name);\n const names = like\n ? [...(like.el as Element).attributes]\n .map((attribute) => attribute.name)\n .filter((name) => name.startsWith('_ngcontent-') && !el.hasAttribute(name))\n : [];\n for (const name of names) el.setAttribute(name, '');\n this.adopted.set(node, names);\n }\n\n /** The scoping attributes `adoptScope` added to each node, which it alone takes off. */\n private readonly adopted = new WeakMap<BrowserNode, string[]>();\n\n commit(): boolean {\n // Every write above already reached the DOM synchronously; there is nothing batched to flush.\n return false;\n }\n\n get focused(): BrowserNode | null {\n if (this.focusedNode && !this.isAttached(this.focusedNode)) this.focusedNode = null;\n return this.focusedNode;\n }\n\n private isAttached(node: BrowserNode): boolean {\n return (node.el as Element).isConnected;\n }\n\n /**\n * A `require()`d numeric asset has no web analogue - there is no bundler-provided asset\n * registry this package can read at runtime - so it resolves to nothing rather than a guess.\n * A `{uri}` source, or an array of them, passes through unchanged: `props.ts`'s image handler\n * reads it directly.\n */\n resolveAsset(value: unknown): unknown {\n if (typeof value === 'number') return undefined;\n return value;\n }\n\n /**\n * A colour the app wrote is passed straight through: CSS accepts the same hex/rgb/named\n * strings RN does. `platform-color(...)`'s semantic iOS/Android names have no web colour\n * system to resolve against, so they resolve to nothing rather than to a wrong guess.\n */\n color(value: unknown): unknown {\n if (value === undefined) return undefined;\n if (typeof value === 'object' && value !== null && 'platformColor' in value) return undefined;\n return value;\n }\n\n // --- event dispatch, mirrors engine.ts's `dispatchEvent` -----------------------------------\n\n dispatchEvent(target: BrowserNode, topLevelType: string, nativeEvent: unknown): void {\n const event = new SyntheticEvent(nativeEvent, target) as ResponderEvent & SyntheticEvent;\n if (topLevelType.startsWith('topTouch'))\n this.responders.runResponder(target, topLevelType, event);\n this.propagate(target, topLevelType, event);\n }\n\n /** As on native: a listener that stops the event ends the bubble after its own node. */\n private propagate(target: BrowserNode, topLevelType: string, event: SyntheticEvent): void {\n for (\n let node: BrowserNode | null = target;\n node && !event.isPropagationStopped();\n node = DIRECT_EVENTS.has(topLevelType) ? null : node.parent\n ) {\n const listeners = node.listeners?.get(topLevelType);\n if (listeners) for (const fn of [...listeners]) fn(event);\n }\n }\n\n // --- always-on listeners, installed once per element at creation ---------------------------\n\n private wireAlwaysOnListeners(node: BrowserNode): void {\n if (node.name === 'scroll-view' || node.name === 'virtual-list') this.wireScroll(node);\n if (node.name === 'text-input') this.wireTextInput(node);\n if (node.name === 'switch') this.wireSwitch(node);\n }\n\n /**\n * `scroll` does not bubble, so this is a real per-node listener rather than a document one.\n *\n * `scrollend` is the browser saying the scroll has come to rest, whatever moved it: a wheel's\n * or a trackpad's glide, a flick, or an animated `scrollTo`. That is the moment a device reports\n * as `(momentumScrollEnd)` - iOS sends it after an animated `scrollTo` as well as after a fling -\n * and the event a paging carousel reads its page from, which never arrived here at all.\n */\n private wireScroll(node: BrowserNode): void {\n const el = node.el as HTMLElement;\n const offsets = () => ({\n contentOffset: { x: el.scrollLeft, y: el.scrollTop },\n contentSize: { width: el.scrollWidth, height: el.scrollHeight },\n layoutMeasurement: { width: el.clientWidth, height: el.clientHeight },\n contentInset: { top: 0, left: 0, bottom: 0, right: 0 },\n zoomScale: 1,\n });\n el.addEventListener('scroll', () => {\n this.responders.notifyScroll(node);\n this.dispatchEvent(node, 'topScroll', offsets());\n });\n el.addEventListener('scrollend', () => {\n this.dispatchEvent(node, 'topMomentumScrollEnd', offsets());\n });\n }\n\n private wireTextInput(node: BrowserNode): void {\n const el = node.el as HTMLTextAreaElement;\n const nextCount = () => {\n const count = (this.eventCounts.get(node) ?? 0) + 1;\n this.eventCounts.set(node, count);\n return count;\n };\n el.addEventListener('input', () => {\n this.dispatchEvent(node, 'topChange', { text: el.value, eventCount: nextCount(), target: 0 });\n });\n el.addEventListener('focus', () => {\n if (el.hasAttribute('data-select-on-focus')) el.select();\n });\n el.addEventListener('blur', () => {\n this.dispatchEvent(node, 'topEndEditing', {\n text: el.value,\n eventCount: nextCount(),\n target: 0,\n });\n });\n // `Enter` does what `submitBehavior` says, as on a device: `newline` inserts one, `submit`\n // submits and keeps focus, and `blurAndSubmit` submits and then lets go of the field. The\n // component resolves the default, `blurAndSubmit` on one line and `newline` on many; the\n // fallback here is the same rule, for a field whose binding has not landed yet. An `Enter`\n // that confirms an IME composition belongs to the composition, not to the field.\n el.addEventListener('keydown', (event) => {\n if (event.key !== 'Enter' || event.isComposing) return;\n const behavior =\n node.props['submitBehavior'] ??\n (el.hasAttribute('data-multiline') ? 'newline' : 'blurAndSubmit');\n if (behavior === 'newline') return;\n event.preventDefault();\n this.dispatchEvent(node, 'topSubmitEditing', {\n text: el.value,\n eventCount: nextCount(),\n target: 0,\n });\n if (behavior === 'blurAndSubmit') el.blur();\n });\n }\n\n private wireSwitch(node: BrowserNode): void {\n const el = node.el as HTMLInputElement;\n el.addEventListener('change', () => {\n this.dispatchEvent(node, 'topChange', { value: el.checked, target: 0 });\n });\n }\n\n /**\n * `topLayout` and hover, opted into once per node the first time something listens for them -\n * never torn down again, exactly as `engine.ts`'s own `EVENT_OPT_IN_PROPS` never unsets the\n * native prop it wrote either. A second listener for the same type on the same node (unusual,\n * but not forbidden) shares the one observer rather than getting a duplicate.\n */\n private wireOptIn(node: BrowserNode, topLevelType: string): void {\n const optedIn = (node.optedIn ??= new Set());\n if (optedIn.has(topLevelType)) return;\n optedIn.add(topLevelType);\n\n if (topLevelType === 'topLayout') {\n /*\n * The observer says *when*, and the bounding rect says *how big*. The size deliberately\n * does not come from the entry's `contentBoxSize`, which is what it used to come from.\n *\n * Yoga lays out border-box: a React Native view styled `width: 192` with `padding: 16` and\n * a hairline border is 192 wide, and `onLayout` reports 192. `contentBoxSize` is the CSS\n * *content* box, so the same element in a browser reported 158 - the padding and the border\n * subtracted. Every `(layout)` consumer in the library was therefore being handed a size\n * smaller than its native counterpart by however much padding the element happened to have,\n * and each one used it for something different: an accordion animated to a height that cut\n * its own padding off, and an anchored overlay both centred itself on a width it did not\n * have and decided it had room on a side where it did not, because `fits()` was asked about\n * a shorter card than the one about to be painted.\n *\n * `measure()` in this same file has always answered from `getBoundingClientRect()`, which\n * is the border box - so the engine was reporting two different sizes for one element\n * depending on which way you asked. This is the half that was wrong.\n *\n * `x`/`y` are the other half, and a different frame from `measure()`'s: `engine.ts`'s own\n * doc comment for `measure()` says it plainly - \"`(layout)` reports a frame in the parent's\n * coordinates\" - because a layout tells a view how big it is and where it sits inside\n * whatever it is stacked in, not where it is on screen. Reporting the raw viewport rect here\n * answered a question nothing asked: a consumer that reads `layout.y` as an item's offset\n * within its scrolling parent compares it against a scroll position in that same space, so\n * a viewport-relative `y` was wrong by the scroll container's own position on the page - right only for a scroll view\n * pinned at the top of an unscrolled full-page app, wrong the moment it sits lower on the\n * page or the page itself scrolls. Subtracting the immediate DOM parent's rect - never an\n * anchor comment; `browser-renderer.ts`'s `appendChild`/`insertBefore` only ever set\n * `child.parent` to a node backed by a real element - puts it back in the parent's frame.\n */\n const observer = new ResizeObserver(() => {\n const rect = (node.el as Element).getBoundingClientRect();\n const parent = node.parent?.el as Element | undefined;\n const origin = parent ? parent.getBoundingClientRect() : { x: 0, y: 0 };\n this.dispatchEvent(node, 'topLayout', {\n layout: {\n x: rect.x - origin.x,\n y: rect.y - origin.y,\n width: rect.width,\n height: rect.height,\n },\n });\n });\n observer.observe(node.el as Element);\n this.layoutObservers.set(node, observer);\n return;\n }\n if (topLevelType === 'topPointerEnter' || topLevelType === 'topPointerLeave') {\n const domName = topLevelType === 'topPointerEnter' ? 'pointerenter' : 'pointerleave';\n (node.el as Element).addEventListener(domName, () =>\n this.dispatchEvent(node, topLevelType, {}),\n );\n return;\n }\n\n /*\n * Anything else is an ordinary DOM event, bound for real.\n *\n * Without this, `renderer.listen` put the callback in the node's map and stopped: the map is\n * only ever read by `dispatchEvent`, and nothing dispatches a `topClick`. So `(click)`,\n * `(keydown)`, `(input)` and every other plain binding registered successfully and never\n * fired - including Angular's own `RouterLink`, which is why no link in the gallery navigated\n * and no `(click)` anywhere in an app would have worked.\n *\n * The name maps straight down: DOM event types are lowercase, so `topClick` is `click` and\n * `topKeyDown` is `keydown`.\n *\n * The event reaches the handler raw, not wrapped in `{ nativeEvent }`, because that is what a\n * handler written for a browser expects - `RouterLink` reads `button`, `ctrlKey` and\n * `metaKey` off it and calls `preventDefault` itself. Returning `false` from a binding\n * prevents the default, as it does in any Angular app.\n *\n * Delivered only to this node's own listeners rather than through `propagate`, and that is\n * the subtle half. `propagate` walks this package's retained tree to emulate the bubbling\n * React Native does in JavaScript. The DOM already bubbles, so a click on a child arrives at\n * an ancestor's listener by itself, and running both would call every ancestor handler twice.\n */\n if (ENGINE_EVENTS.has(topLevelType)) return;\n (node.el as Element).addEventListener(topLevelType.slice(3).toLowerCase(), (event) => {\n for (const listener of [...(node.listeners?.get(topLevelType) ?? [])]) {\n if ((listener as (value: unknown) => unknown)(event) === false) event.preventDefault();\n }\n });\n }\n\n // --- document-level listeners, shared by the whole tree ------------------------------------\n\n private installGlobalListeners(): void {\n const on = <K extends keyof DocumentEventMap>(\n type: K,\n listener: (event: DocumentEventMap[K]) => void,\n ): void => this.document.addEventListener(type, listener, { signal: this.listening.signal });\n for (const type of ['pointerdown', 'pointermove', 'pointerup', 'pointercancel'] as const) {\n on(type, (event) => this.onPointer(event, type));\n }\n on('focusin', (event) => this.onFocusChange(event, true));\n on('focusout', (event) => this.onFocusChange(event, false));\n on('keydown', (event) => this.onKey(event, true));\n on('keyup', (event) => this.onKey(event, false));\n }\n\n /** The control a held Space is pressing, released on the matching `keyup`. */\n private keyPress: BrowserNode | null = null;\n\n /**\n * Enter and Space press the focused control, as they press a `<button>`.\n *\n * A pressable is focusable and announces itself as a button, but it presses through the\n * responder negotiation, which only pointer events drove - so a keyboard user could tab to it\n * and do nothing with it. The key becomes the same touch a finger would make, on the control\n * itself, so `pressIn`, `press` and `pressOut` all fire, in order, through the same code.\n *\n * Enter presses on the way down and Space on the way up, which is the browser's own rule for a\n * button; Space is also kept from scrolling the page. A text field and a switch are left alone,\n * because the browser's own control already does the right thing with both keys.\n */\n private onKey(event: KeyboardEvent, down: boolean): void {\n if (event.key !== 'Enter' && event.key !== ' ') return;\n const space = event.key === ' ';\n if (!down) {\n const node = this.keyPress;\n if (!space || !node) return;\n this.keyPress = null;\n this.dispatchEvent(node, 'topTouchEnd', this.keyTouch(node));\n return;\n }\n const node = this.keyTarget(event);\n if (!node) return;\n event.preventDefault();\n if (event.repeat || this.keyPress) return;\n this.dispatchEvent(node, 'topTouchStart', this.keyTouch(node));\n if (space) this.keyPress = node;\n else this.dispatchEvent(node, 'topTouchEnd', this.keyTouch(node));\n }\n\n /** The focused control a key would press, or null where the key belongs to something else. */\n private keyTarget(event: KeyboardEvent): BrowserNode | null {\n if (event.defaultPrevented || event.altKey || event.ctrlKey || event.metaKey) return null;\n const node = nodeOf(event.target as Element | null);\n if (!node || node.name === 'text-input' || node.name === 'switch') return null;\n return this.responders.responds(node) ? node : null;\n }\n\n /** A touch at the control's centre, so nothing downstream mistakes it for a drag. */\n private keyTouch(node: BrowserNode): { pageX: number; pageY: number; identifier: number } {\n const rect = (node.el as Element).getBoundingClientRect();\n return { pageX: rect.x + rect.width / 2, pageY: rect.y + rect.height / 2, identifier: -1 };\n }\n\n private onPointer(event: PointerEvent, domType: keyof typeof TOUCH_EVENT_NAMES): void {\n let target: BrowserNode | undefined;\n if (domType === 'pointerdown') {\n // A right or middle click opens a menu or a tab; only the primary button presses.\n if (event.button > 0) return;\n target = nearestNodeOf(event.target as Element | null) ?? undefined;\n if (!target || !this.owned.has(target)) return;\n this.activeTouches.set(event.pointerId, target);\n // Pins every later event in this gesture to the element the finger actually landed on,\n // regardless of where it wanders - what makes the negotiation's `target` mean the same\n // thing `topTouchMove`/`topTouchEnd` that Fabric's continuous per-finger delivery does.\n (event.target as Element).setPointerCapture?.(event.pointerId);\n } else {\n target = this.activeTouches.get(event.pointerId);\n if (!target) return;\n if (domType === 'pointerup' || domType === 'pointercancel')\n this.activeTouches.delete(event.pointerId);\n }\n this.dispatchEvent(target, TOUCH_EVENT_NAMES[domType]!, {\n pageX: event.pageX,\n pageY: event.pageY,\n identifier: event.pointerId,\n });\n }\n\n private onFocusChange(event: FocusEvent, focused: boolean): void {\n const node = nearestNodeOf(event.target as Element | null);\n if (!node || !this.owned.has(node)) return;\n if (focused) this.focusedNode = node;\n else if (this.focusedNode === node) this.focusedNode = null;\n this.dispatchEvent(node, focused ? 'topFocus' : 'topBlur', { target: 0 });\n }\n}\n"]}
1
+ {"version":3,"file":"browser-engine.js","sourceRoot":"","sources":["../src/browser-engine.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,EACL,aAAa,EACb,UAAU,EACV,cAAc,GAIf,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACL,cAAc,EACd,eAAe,EACf,YAAY,EACZ,aAAa,EACb,MAAM,EACN,aAAa,GAEd,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAChE,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACvC,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAEjD,MAAM,iBAAiB,GAA2B;IAChD,WAAW,EAAE,eAAe;IAC5B,WAAW,EAAE,cAAc;IAC3B,SAAS,EAAE,aAAa;IACxB,aAAa,EAAE,gBAAgB;CAChC,CAAC;AAEF,SAAS,WAAW,CAAC,EAAe,EAAE,IAAwB;IAC5D,MAAM,CAAC,QAAQ,GAAG,IAAI,CAAC,GAAG,IAAkB,CAAC;IAC7C,MAAM,UAAU,GAAG,EAAE,CAAC,WAAW,GAAG,EAAE,CAAC,WAAW,IAAI,EAAE,CAAC,YAAY,IAAI,EAAE,CAAC,YAAY,CAAC;IACzF,EAAE,CAAC,QAAQ,CACT,UAAU;QACR,CAAC,CAAC,EAAE,IAAI,EAAE,EAAE,CAAC,WAAW,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,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n *\n * One instance per `mount()` call. It owns the prop/DOM translation (`props.ts`), the element\n * mapping (`elements.ts`), and the responder negotiation (`responder.ts`); this file is mostly\n * the wiring between them and the handful of DOM event listeners the whole tree shares - one\n * `pointerdown`/`pointermove`/`pointerup`/`pointercancel` set on `document` for the responder\n * system, one `focusin`/`focusout` set for `:focus` tracking, because both need to see every\n * node's events rather than each node installing its own (Fabric's own engine is exactly this\n * shape: one `registerEventHandler` callback for the whole tree, not one per view).\n *\n * `dispatchEvent` mirrors `engine.ts`'s method of the same name step for step: run the responder\n * negotiation first, then propagate to whatever `(eventName)` bindings are listening, in the\n * same two-phase order a real touch would arrive in on native.\n */\nimport {\n DIRECT_EVENTS,\n HostEngine,\n SyntheticEvent,\n type ResponderEvent,\n type ResponderHandlers,\n type WindowFrame,\n} from '@ng-native/fabric';\nimport {\n makeAnchorNode,\n makeElementNode,\n makeTextNode,\n nearestNodeOf,\n nodeOf,\n rebindElement,\n type BrowserNode,\n} from './dom-node.ts';\nimport { createDomElement, textFieldLike } from './elements.ts';\nimport { applyProp } from './props.ts';\nimport { ResponderSystem } from './responder.ts';\n\nconst TOUCH_EVENT_NAMES: Record<string, string> = {\n pointerdown: 'topTouchStart',\n pointermove: 'topTouchMove',\n pointerup: 'topTouchEnd',\n pointercancel: 'topTouchCancel',\n};\n\nfunction scrollToEnd(el: HTMLElement, args: readonly unknown[]): void {\n const [animated = true] = args as [boolean?];\n const horizontal = el.scrollWidth > el.clientWidth && el.scrollHeight <= el.clientHeight;\n el.scrollTo(\n horizontal\n ? { left: el.scrollWidth, behavior: animated ? 'smooth' : 'auto' }\n : { top: el.scrollHeight, behavior: animated ? 'smooth' : 'auto' },\n );\n}\n\n/** Focuses `field` with the caret or selection `old` had, as a field swapped in for it. */\nfunction focusLike(field: HTMLInputElement | HTMLTextAreaElement, old: typeof field): void {\n field.focus();\n const { selectionStart, selectionEnd, selectionDirection } = old;\n if (selectionStart === null || selectionEnd === null) return;\n field.setSelectionRange(selectionStart, selectionEnd, selectionDirection ?? undefined);\n}\n\nfunction setTextAndSelection(el: HTMLElement, args: readonly unknown[]): void {\n const [, text, start, end] = args as [number, string | null, number, number];\n const textarea = el as HTMLTextAreaElement;\n if (text !== null && text !== undefined) textarea.value = text;\n if (start !== -1) textarea.setSelectionRange(start, end === -1 ? start : end);\n}\n\n/**\n * View commands, by name. A lookup table for the same reason `props.ts`'s tables are one: it is\n * where a review sees which commands do something and which do not, in one place, rather than\n * spread across a `switch`'s branches.\n *\n * `flashScrollIndicators`, `zoomToRect`, `hotspotUpdate`, `setPressed`, `setNativeRefreshing`:\n * no web equivalent (a browser's scrollbar has no imperative \"flash\", pinch-zoom is not\n * scriptable, and there is no Android ripple to drive) - absent rather than a `noop` entry,\n * because unlike a prop there is no generic fallback for a command name to fall through to; an\n * absent command is already silently ignored below.\n */\nconst COMMANDS: Record<string, (el: HTMLElement, args: readonly unknown[]) => void> = {\n focus: (el) => el.focus(),\n blur: (el) => el.blur(),\n scrollTo: (el, args) => {\n const [x = 0, y = 0, animated = true] = args as [number?, number?, boolean?];\n el.scrollTo({ left: x, top: y, behavior: animated ? 'smooth' : 'auto' });\n },\n scrollToEnd,\n setTextAndSelection,\n // `<switch>` putting back a flip the app refused; the checkbox is what the user clicked.\n setValue: (el, [value]) => {\n (el as HTMLInputElement).checked = value === true;\n },\n};\n\n/**\n * The events this engine owns, which are React Native's rather than the DOM's.\n *\n * Each is either synthesised here from something else - `topLayout` from a `ResizeObserver`,\n * `topTouch*` from pointer events, `topFocus` from `focusin` - or not implemented yet. Either way\n * a handler bound to one expects React Native's `{ nativeEvent }` payload with React Native's own\n * fields in it, so they must not be wired straight to the DOM event of the same name: a\n * `scroll-view`'s `(scroll)` reads `nativeEvent.contentOffset`, and handing it a raw DOM `Event`\n * would turn a binding that quietly does nothing into one that throws on the first scroll.\n *\n * The list is the events `@ng-native/components` actually binds, found by\n * reading their host and template bindings rather than guessed. Anything outside it is a plain\n * DOM event and is bound as one.\n *\n * `topLoad` and `topError` are deliberately *not* here, though an `<image>` binds both. A\n * background image fires neither on its own, so `props.ts` loads the URL with a detached `Image()`\n * and dispatches a real DOM `load` or `error` on the element - which means there is a genuine DOM\n * event of each name to bind, and the general path is the right one. Reserving them was what left\n * a broken image URL blank rather than showing a fallback.\n */\nconst ENGINE_EVENTS = new Set([\n 'topLayout',\n 'topChange',\n 'topContentSizeChange',\n 'topRefresh',\n 'topScroll',\n 'topEndReached',\n 'topSelectionChange',\n 'topMomentumScrollBegin',\n 'topMomentumScrollEnd',\n 'topTouchStart',\n 'topTouchMove',\n 'topTouchEnd',\n 'topTouchCancel',\n 'topFocus',\n 'topBlur',\n 'topPointerEnter',\n 'topPointerLeave',\n]);\n\nexport class BrowserEngine extends HostEngine {\n private readonly document: Document;\n private readonly responders = new ResponderSystem();\n private focusedNode: BrowserNode | null = null;\n /** `TextInput`'s echo protocol: a change count that only ever goes up. One counter per field. */\n private readonly eventCounts = new WeakMap<BrowserNode, number>();\n /** Mount points `wrapRoot` wrapped; see `isRoot`. */\n private readonly roots = new WeakSet<BrowserNode>();\n /**\n * The node each in-progress gesture began on, by `pointerId`, so `pointermove`/`pointerup`\n * resolve to the same node however far the finger has travelled - `setPointerCapture` keeps\n * the browser routing them there; this is what this class trusts instead of re-reading\n * `event.target`. Keyed by `pointerId` rather than holding just one, so two fingers on two\n * different controls (a phone reports multi-touch) do not clobber each other.\n */\n private readonly activeTouches = new Map<number, BrowserNode>();\n /**\n * The element nodes this engine made, and so the only ones its document listeners act for.\n *\n * Every engine listens on the one `document`, and a page can hold several - one per island, or\n * the documentation site's three roots - while `nearestNodeOf` finds a node whichever engine\n * made it. Without this, each engine delivered every focus, blur and touch in any root on the\n * page, so a text field's `(blur)` ran once per island.\n */\n private readonly owned = new WeakSet<BrowserNode>();\n /** Removes the document listeners, once the app they served is gone; see `dispose`. */\n private readonly listening: AbortController;\n\n constructor(document: Document) {\n super();\n this.document = document;\n // The document's own, so the signal is one its `addEventListener` recognises.\n this.listening = new (document.defaultView?.AbortController ?? AbortController)();\n this.installGlobalListeners();\n }\n\n /** Stop listening to the document. `mount` calls this as its app is destroyed. */\n dispose(): void {\n this.listening.abort();\n this.activeTouches.clear();\n }\n\n // --- element creation, called from BrowserRenderer ----------------------------------------\n\n createElementNode(name: string): BrowserNode {\n const el = createDomElement(this.document, name);\n const node = makeElementNode(name, el);\n this.owned.add(node);\n this.wireAlwaysOnListeners(node);\n return node;\n }\n\n createTextNode(value: string): BrowserNode {\n return makeTextNode(this.document.createTextNode(value));\n }\n\n createAnchorNode(): BrowserNode {\n return makeAnchorNode(this.document.createComment(''));\n }\n\n /**\n * Wrap an existing real element - the app's own mount point - as the tree's root node.\n *\n * `ngSkipHydration` is Angular's own opt-out, and true of every tree this engine renders: none\n * is server-rendered, so there is no markup to reuse. With hydration on, Angular reads it on a\n * root component's host element, and without it walks that element's DOM for text markers,\n * which a node is not.\n */\n wrapRoot(el: Element): BrowserNode {\n const node = makeElementNode(el.tagName.toLowerCase(), el);\n el.setAttribute('data-rn', 'root');\n el.setAttribute('ngSkipHydration', '');\n this.roots.add(node);\n this.owned.add(node);\n return node;\n }\n\n /**\n * Whether `node` is a mount point `wrapRoot` wrapped. It belongs to whoever called `mount`, not\n * to the app rendered into it, so the renderer empties it rather than removing it.\n */\n isRoot(node: BrowserNode): boolean {\n return this.roots.has(node);\n }\n\n // --- HostEngine -----------------------------------------------------------------------------\n\n setProp(node: BrowserNode, key: string, value: unknown): void {\n const clear = value === undefined || value === null;\n if (clear) {\n if (!(key in node.props)) return;\n delete node.props[key];\n } else {\n if (node.props[key] === value) return;\n node.props[key] = value;\n }\n if (key === 'multiline' && node.name === 'text-input') this.fieldFor(node, value === true);\n applyProp(node, key, value, clear);\n }\n\n /**\n * A `<textarea>` for a multiline field and an `<input>` for a one-line one, swapped in place when\n * `multiline` arrives, which is after the element was made (see `elements.ts`).\n *\n * The new element takes the old one's attributes (inline style and scoping attributes among\n * them), its value, its focus and its selection, and the engine's own listeners are installed on it again.\n */\n private fieldFor(node: BrowserNode, multiline: boolean): void {\n const old = node.el as HTMLInputElement | HTMLTextAreaElement;\n if ((old.tagName === 'TEXTAREA') === multiline) return;\n const field = textFieldLike(old, multiline);\n // An input strips line breaks from its value, so text set before `multiline` lost them. Taken\n // from the prop again unless the user has typed since.\n const text = node.props['text'];\n if (multiline && text != null && old.value === String(text).replace(/[\\r\\n]/g, '')) {\n field.value = String(text);\n }\n const focused = this.document.activeElement === old;\n this.layoutObservers.get(node)?.disconnect();\n old.replaceWith(field);\n rebindElement(node, field);\n this.wireAlwaysOnListeners(node);\n const optedIn = node.optedIn;\n node.optedIn = null;\n for (const type of optedIn ?? []) this.wireOptIn(node, type);\n for (const key of ['secureTextEntry', 'keyboardType', 'numberOfLines']) {\n if (key in node.props) applyProp(node, key, node.props[key], false);\n }\n if (focused) focusLike(field, old);\n }\n\n /** Each node's `topLayout` observer, so a field swapped for another stops watching the old one. */\n private readonly layoutObservers = new WeakMap<BrowserNode, ResizeObserver>();\n\n setEventListener(\n node: BrowserNode,\n topLevelType: string,\n fn: (event: unknown) => void,\n ): () => void {\n const listeners = (node.listeners ??= new Map());\n let set = listeners.get(topLevelType);\n if (!set) listeners.set(topLevelType, (set = new Set()));\n set.add(fn);\n this.wireOptIn(node, topLevelType);\n return () => set!.delete(fn);\n }\n\n setResponder(node: BrowserNode, handlers: ResponderHandlers): () => void {\n return this.responders.setResponder(node, handlers);\n }\n\n /**\n * Where a node is, relative to the mount root rather than to the viewport.\n *\n * `measureInWindow` on native answers in window coordinates, and the overlay host is a\n * full-screen absolutely positioned view at the window's origin, so the two agree and an\n * anchored overlay can use one as the other. `getBoundingClientRect` answers in *viewport*\n * coordinates, and `<overlay-host>` is absolutely positioned inside the mount root - so\n * those two agree only when the root sits at the top left of an unscrolled viewport.\n *\n * That is true of a full-page app, which is why every popover in the gallery lands correctly\n * and this went unnoticed. It is false in the two cases that matter: an app mounted into a box\n * partway down a page, where every overlay is offset by the box's own position, and a document\n * that scrolls, where the offset changes as you scroll. Subtracting the root's own rect from a\n * viewport-relative one cancels the scroll term as well as the offset, since both rects move\n * together as the page scrolls - so one subtraction fixes both cases at once.\n *\n * `closest`, not `querySelector`: a page can hold more than one mounted root at a time (the\n * documentation site's own home page does, three of them), and `querySelector` always answers\n * the first one in document order regardless of which root's own tree `node` actually lives in.\n * That made every root after the first measure its overlays against someone else's box.\n * `closest` walks up from the node itself, so each root only ever measures against its own.\n */\n measure(node: BrowserNode, into: (frame: WindowFrame) => void): void {\n const el = node.el as Element;\n const rect = el.getBoundingClientRect();\n const root = el.closest('[data-rn-root]');\n const origin = root ? root.getBoundingClientRect() : { x: 0, y: 0 };\n into({ x: rect.x - origin.x, y: rect.y - origin.y, width: rect.width, height: rect.height });\n }\n\n dispatchCommand(node: BrowserNode, name: string, args: readonly unknown[] = []): void {\n COMMANDS[name]?.(node.el as HTMLElement, args);\n }\n\n /**\n * The scoping attribute Angular's emulated encapsulation stamps on `like`, stamped on `node`,\n * or taken off again when `like` is null.\n */\n override adoptScope(node: BrowserNode, like: BrowserNode | null): void {\n const el = node.el as Element;\n for (const name of this.adopted.get(node) ?? []) el.removeAttribute(name);\n const names = like\n ? [...(like.el as Element).attributes]\n .map((attribute) => attribute.name)\n .filter((name) => name.startsWith('_ngcontent-') && !el.hasAttribute(name))\n : [];\n for (const name of names) el.setAttribute(name, '');\n this.adopted.set(node, names);\n }\n\n /** The scoping attributes `adoptScope` added to each node, which it alone takes off. */\n private readonly adopted = new WeakMap<BrowserNode, string[]>();\n\n commit(): boolean {\n // Every write above already reached the DOM synchronously; there is nothing batched to flush.\n return false;\n }\n\n get focused(): BrowserNode | null {\n if (this.focusedNode && !this.isAttached(this.focusedNode)) this.focusedNode = null;\n return this.focusedNode;\n }\n\n private isAttached(node: BrowserNode): boolean {\n return (node.el as Element).isConnected;\n }\n\n /**\n * A `require()`d numeric asset has no web analogue - there is no bundler-provided asset\n * registry this package can read at runtime - so it resolves to nothing rather than a guess.\n * A `{uri}` source, or an array of them, passes through unchanged: `props.ts`'s image handler\n * reads it directly.\n */\n resolveAsset(value: unknown): unknown {\n if (typeof value === 'number') return undefined;\n return value;\n }\n\n /**\n * A colour the app wrote is passed straight through: CSS accepts the same hex/rgb/named\n * strings RN does. `platform-color(...)`'s semantic iOS/Android names have no web colour\n * system to resolve against, so they resolve to nothing rather than to a wrong guess.\n */\n color(value: unknown): unknown {\n if (value === undefined) return undefined;\n if (typeof value === 'object' && value !== null && 'platformColor' in value) return undefined;\n return value;\n }\n\n // --- event dispatch, mirrors engine.ts's `dispatchEvent` -----------------------------------\n\n dispatchEvent(target: BrowserNode, topLevelType: string, nativeEvent: unknown): void {\n const event = new SyntheticEvent(nativeEvent, target) as ResponderEvent & SyntheticEvent;\n if (topLevelType.startsWith('topTouch'))\n this.responders.runResponder(target, topLevelType, event);\n this.propagate(target, topLevelType, event);\n }\n\n /** As on native: a listener that stops the event ends the bubble after its own node. */\n private propagate(target: BrowserNode, topLevelType: string, event: SyntheticEvent): void {\n for (\n let node: BrowserNode | null = target;\n node && !event.isPropagationStopped();\n node = DIRECT_EVENTS.has(topLevelType) ? null : node.parent\n ) {\n const listeners = node.listeners?.get(topLevelType);\n if (listeners) for (const fn of [...listeners]) fn(event);\n }\n }\n\n // --- always-on listeners, installed once per element at creation ---------------------------\n\n private wireAlwaysOnListeners(node: BrowserNode): void {\n if (node.name === 'scroll-view' || node.name === 'virtual-list') this.wireScroll(node);\n if (node.name === 'text-input') this.wireTextInput(node);\n if (node.name === 'switch') this.wireSwitch(node);\n }\n\n /**\n * `scroll` does not bubble, so this is a real per-node listener rather than a document one.\n *\n * `scrollend` is the browser saying the scroll has come to rest, whatever moved it: a wheel's\n * or a trackpad's glide, a flick, or an animated `scrollTo`. That is the moment a device reports\n * as `(momentumScrollEnd)` - iOS sends it after an animated `scrollTo` as well as after a fling -\n * and the event a paging carousel reads its page from, which never arrived here at all.\n */\n private wireScroll(node: BrowserNode): void {\n const el = node.el as HTMLElement;\n const offsets = () => ({\n contentOffset: { x: el.scrollLeft, y: el.scrollTop },\n contentSize: { width: el.scrollWidth, height: el.scrollHeight },\n layoutMeasurement: { width: el.clientWidth, height: el.clientHeight },\n contentInset: { top: 0, left: 0, bottom: 0, right: 0 },\n zoomScale: 1,\n });\n el.addEventListener('scroll', () => {\n this.responders.notifyScroll(node);\n this.dispatchEvent(node, 'topScroll', offsets());\n });\n el.addEventListener('scrollend', () => {\n this.dispatchEvent(node, 'topMomentumScrollEnd', offsets());\n });\n }\n\n private wireTextInput(node: BrowserNode): void {\n const el = node.el as HTMLTextAreaElement;\n const nextCount = () => {\n const count = (this.eventCounts.get(node) ?? 0) + 1;\n this.eventCounts.set(node, count);\n return count;\n };\n el.addEventListener('input', () => {\n this.dispatchEvent(node, 'topChange', { text: el.value, eventCount: nextCount(), target: 0 });\n });\n el.addEventListener('focus', () => {\n if (el.hasAttribute('data-select-on-focus')) el.select();\n });\n el.addEventListener('blur', () => {\n this.dispatchEvent(node, 'topEndEditing', {\n text: el.value,\n eventCount: nextCount(),\n target: 0,\n });\n });\n // `Enter` does what `submitBehavior` says, as on a device: `newline` inserts one, `submit`\n // submits and keeps focus, and `blurAndSubmit` submits and then lets go of the field. The\n // component resolves the default, `blurAndSubmit` on one line and `newline` on many; the\n // fallback here is the same rule, for a field whose binding has not landed yet. An `Enter`\n // that confirms an IME composition belongs to the composition, not to the field.\n el.addEventListener('keydown', (event) => {\n if (event.key !== 'Enter' || event.isComposing) return;\n const behavior =\n node.props['submitBehavior'] ??\n (el.hasAttribute('data-multiline') ? 'newline' : 'blurAndSubmit');\n if (behavior === 'newline') return;\n event.preventDefault();\n this.dispatchEvent(node, 'topSubmitEditing', {\n text: el.value,\n eventCount: nextCount(),\n target: 0,\n });\n if (behavior === 'blurAndSubmit') el.blur();\n });\n }\n\n private wireSwitch(node: BrowserNode): void {\n const el = node.el as HTMLInputElement;\n el.addEventListener('change', () => {\n this.dispatchEvent(node, 'topChange', { value: el.checked, target: 0 });\n });\n }\n\n /**\n * `topLayout` and hover, opted into once per node the first time something listens for them -\n * never torn down again, exactly as `engine.ts`'s own `EVENT_OPT_IN_PROPS` never unsets the\n * native prop it wrote either. A second listener for the same type on the same node (unusual,\n * but not forbidden) shares the one observer rather than getting a duplicate.\n */\n private wireOptIn(node: BrowserNode, topLevelType: string): void {\n const optedIn = (node.optedIn ??= new Set());\n if (optedIn.has(topLevelType)) return;\n optedIn.add(topLevelType);\n\n if (topLevelType === 'topLayout') {\n /*\n * The observer says *when*, and the bounding rect says *how big*. The size deliberately\n * does not come from the entry's `contentBoxSize`, which is what it used to come from.\n *\n * Yoga lays out border-box: a React Native view styled `width: 192` with `padding: 16` and\n * a hairline border is 192 wide, and `onLayout` reports 192. `contentBoxSize` is the CSS\n * *content* box, so the same element in a browser reported 158 - the padding and the border\n * subtracted. Every `(layout)` consumer in the library was therefore being handed a size\n * smaller than its native counterpart by however much padding the element happened to have,\n * and each one used it for something different: an accordion animated to a height that cut\n * its own padding off, and an anchored overlay both centred itself on a width it did not\n * have and decided it had room on a side where it did not, because `fits()` was asked about\n * a shorter card than the one about to be painted.\n *\n * `measure()` in this same file has always answered from `getBoundingClientRect()`, which\n * is the border box - so the engine was reporting two different sizes for one element\n * depending on which way you asked. This is the half that was wrong.\n *\n * `x`/`y` are the other half, and a different frame from `measure()`'s: `engine.ts`'s own\n * doc comment for `measure()` says it plainly - \"`(layout)` reports a frame in the parent's\n * coordinates\" - because a layout tells a view how big it is and where it sits inside\n * whatever it is stacked in, not where it is on screen. Reporting the raw viewport rect here\n * answered a question nothing asked: a consumer that reads `layout.y` as an item's offset\n * within its scrolling parent compares it against a scroll position in that same space, so\n * a viewport-relative `y` was wrong by the scroll container's own position on the page - right only for a scroll view\n * pinned at the top of an unscrolled full-page app, wrong the moment it sits lower on the\n * page or the page itself scrolls. Subtracting the immediate DOM parent's rect - never an\n * anchor comment; `browser-renderer.ts`'s `appendChild`/`insertBefore` only ever set\n * `child.parent` to a node backed by a real element - puts it back in the parent's frame.\n */\n const observer = new ResizeObserver(() => {\n const rect = (node.el as Element).getBoundingClientRect();\n const parent = node.parent?.el as Element | undefined;\n const origin = parent ? parent.getBoundingClientRect() : { x: 0, y: 0 };\n this.dispatchEvent(node, 'topLayout', {\n layout: {\n x: rect.x - origin.x,\n y: rect.y - origin.y,\n width: rect.width,\n height: rect.height,\n },\n });\n });\n observer.observe(node.el as Element);\n this.layoutObservers.set(node, observer);\n return;\n }\n if (topLevelType === 'topPointerEnter' || topLevelType === 'topPointerLeave') {\n const domName = topLevelType === 'topPointerEnter' ? 'pointerenter' : 'pointerleave';\n (node.el as Element).addEventListener(domName, () =>\n this.dispatchEvent(node, topLevelType, {}),\n );\n return;\n }\n\n /*\n * Anything else is an ordinary DOM event, bound for real.\n *\n * Without this, `renderer.listen` put the callback in the node's map and stopped: the map is\n * only ever read by `dispatchEvent`, and nothing dispatches a `topClick`. So `(click)`,\n * `(keydown)`, `(input)` and every other plain binding registered successfully and never\n * fired - including Angular's own `RouterLink`, which is why no link in the gallery navigated\n * and no `(click)` anywhere in an app would have worked.\n *\n * The name maps straight down: DOM event types are lowercase, so `topClick` is `click` and\n * `topKeyDown` is `keydown`.\n *\n * The event reaches the handler raw, not wrapped in `{ nativeEvent }`, because that is what a\n * handler written for a browser expects - `RouterLink` reads `button`, `ctrlKey` and\n * `metaKey` off it and calls `preventDefault` itself. Returning `false` from a binding\n * prevents the default, as it does in any Angular app.\n *\n * Delivered only to this node's own listeners rather than through `propagate`, and that is\n * the subtle half. `propagate` walks this package's retained tree to emulate the bubbling\n * React Native does in JavaScript. The DOM already bubbles, so a click on a child arrives at\n * an ancestor's listener by itself, and running both would call every ancestor handler twice.\n */\n if (ENGINE_EVENTS.has(topLevelType)) return;\n (node.el as Element).addEventListener(topLevelType.slice(3).toLowerCase(), (event) => {\n for (const listener of [...(node.listeners?.get(topLevelType) ?? [])]) {\n if ((listener as (value: unknown) => unknown)(event) === false) event.preventDefault();\n }\n });\n }\n\n // --- document-level listeners, shared by the whole tree ------------------------------------\n\n private installGlobalListeners(): void {\n const on = <K extends keyof DocumentEventMap>(\n type: K,\n listener: (event: DocumentEventMap[K]) => void,\n ): void => this.document.addEventListener(type, listener, { signal: this.listening.signal });\n for (const type of ['pointerdown', 'pointermove', 'pointerup', 'pointercancel'] as const) {\n on(type, (event) => this.onPointer(event, type));\n }\n on('focusin', (event) => this.onFocusChange(event, true));\n on('focusout', (event) => this.onFocusChange(event, false));\n on('keydown', (event) => this.onKey(event, true));\n on('keyup', (event) => this.onKey(event, false));\n }\n\n /** The control a held Space is pressing, released on the matching `keyup`. */\n private keyPress: BrowserNode | null = null;\n\n /**\n * Enter and Space press the focused control, as they press a `<button>`.\n *\n * A pressable is focusable and announces itself as a button, but it presses through the\n * responder negotiation, which only pointer events drove - so a keyboard user could tab to it\n * and do nothing with it. The key becomes the same touch a finger would make, on the control\n * itself, so `pressIn`, `press` and `pressOut` all fire, in order, through the same code.\n *\n * Enter presses on the way down and Space on the way up, which is the browser's own rule for a\n * button; Space is also kept from scrolling the page. A text field and a switch are left alone,\n * because the browser's own control already does the right thing with both keys.\n */\n private onKey(event: KeyboardEvent, down: boolean): void {\n if (event.key !== 'Enter' && event.key !== ' ') return;\n const space = event.key === ' ';\n if (!down) {\n const node = this.keyPress;\n if (!space || !node) return;\n this.keyPress = null;\n this.dispatchEvent(node, 'topTouchEnd', this.keyTouch(node));\n return;\n }\n const node = this.keyTarget(event);\n if (!node) return;\n event.preventDefault();\n if (event.repeat || this.keyPress) return;\n this.dispatchEvent(node, 'topTouchStart', this.keyTouch(node));\n if (space) this.keyPress = node;\n else this.dispatchEvent(node, 'topTouchEnd', this.keyTouch(node));\n }\n\n /** The focused control a key would press, or null where the key belongs to something else. */\n private keyTarget(event: KeyboardEvent): BrowserNode | null {\n if (event.defaultPrevented || event.altKey || event.ctrlKey || event.metaKey) return null;\n const node = nodeOf(event.target as Element | null);\n if (!node || node.name === 'text-input' || node.name === 'switch') return null;\n return this.responders.responds(node) ? node : null;\n }\n\n /** A touch at the control's centre, so nothing downstream mistakes it for a drag. */\n private keyTouch(node: BrowserNode): { pageX: number; pageY: number; identifier: number } {\n const rect = (node.el as Element).getBoundingClientRect();\n return { pageX: rect.x + rect.width / 2, pageY: rect.y + rect.height / 2, identifier: -1 };\n }\n\n private onPointer(event: PointerEvent, domType: keyof typeof TOUCH_EVENT_NAMES): void {\n let target: BrowserNode | undefined;\n if (domType === 'pointerdown') {\n // A right or middle click opens a menu or a tab; only the primary button presses.\n if (event.button > 0) return;\n target = nearestNodeOf(event.target as Element | null) ?? undefined;\n if (!target || !this.owned.has(target)) return;\n this.activeTouches.set(event.pointerId, target);\n // Pins every later event in this gesture to the element the finger actually landed on,\n // regardless of where it wanders - what makes the negotiation's `target` mean the same\n // thing `topTouchMove`/`topTouchEnd` that Fabric's continuous per-finger delivery does.\n (event.target as Element).setPointerCapture?.(event.pointerId);\n } else {\n target = this.activeTouches.get(event.pointerId);\n if (!target) return;\n if (domType === 'pointerup' || domType === 'pointercancel')\n this.activeTouches.delete(event.pointerId);\n }\n this.dispatchEvent(target, TOUCH_EVENT_NAMES[domType]!, {\n pageX: event.pageX,\n pageY: event.pageY,\n identifier: event.pointerId,\n });\n }\n\n private onFocusChange(event: FocusEvent, focused: boolean): void {\n const node = nearestNodeOf(event.target as Element | null);\n if (!node || !this.owned.has(node)) return;\n if (focused) this.focusedNode = node;\n else if (this.focusedNode === node) this.focusedNode = null;\n this.dispatchEvent(node, focused ? 'topFocus' : 'topBlur', { target: 0 });\n }\n}\n"]}
@@ -27,6 +27,14 @@ export interface BrowserNode extends HostNode {
27
27
  readonly name: string;
28
28
  /** `name` again on an element, for Angular 22.0, which reads it on a component's host element. */
29
29
  readonly tagName?: string;
30
+ /**
31
+ * The wrapped element's attributes, on an element, for Angular's hydration. Once an app on the
32
+ * page calls `provideClientHydration()`, every component's host element is asked for
33
+ * `ngSkipHydration` and `ngh`, an island's included, whatever renderer created it. See
34
+ * `BrowserEngine.wrapRoot` for the answer that keeps hydration out of an island.
35
+ */
36
+ readonly hasAttribute?: (this: BrowserNode, name: string) => boolean;
37
+ readonly getAttribute?: (this: BrowserNode, name: string) => string | null;
30
38
  props: Record<string, unknown>;
31
39
  text: string;
32
40
  children: BrowserNode[];
package/dist/dom-node.js CHANGED
@@ -6,7 +6,21 @@ const registry = new WeakMap();
6
6
  * own to paint (react-native-svg's `Line` never reads `fill` either), so there is nothing an
7
7
  * explicit `fill="none"` there could mean.
8
8
  */
9
- const SVG_BRUSH_ELEMENTS = new Set(['svg-g', 'svg-path', 'svg-circle', 'svg-ellipse', 'svg-rect']);
9
+ const SVG_BRUSH_ELEMENTS = new Set([
10
+ 'svg-g',
11
+ 'svg-path',
12
+ 'svg-circle',
13
+ 'svg-ellipse',
14
+ 'svg-rect',
15
+ 'svg-text',
16
+ 'svg-tspan',
17
+ ]);
18
+ function hasAttribute(name) {
19
+ return this.el.hasAttribute(name);
20
+ }
21
+ function getAttribute(name) {
22
+ return this.el.getAttribute(name);
23
+ }
10
24
  export function makeElementNode(name, el) {
11
25
  const props = {};
12
26
  // `packages/icons/src/svg-props.ts`'s `brushOf` turns a literal `fill="none"`/`stroke="none"`
@@ -31,6 +45,8 @@ export function makeElementNode(name, el) {
31
45
  el,
32
46
  name,
33
47
  tagName: name,
48
+ hasAttribute,
49
+ getAttribute,
34
50
  props,
35
51
  text: '',
36
52
  children: [],
@@ -1 +1 @@
1
- {"version":3,"file":"dom-node.js","sourceRoot":"","sources":["../src/dom-node.ts"],"names":[],"mappings":"AAgDA,mGAAmG;AACnG,MAAM,QAAQ,GAAG,IAAI,OAAO,EAAyC,CAAC;AAEtE;;;;;GAKG;AACH,MAAM,kBAAkB,GAAG,IAAI,GAAG,CAAC,CAAC,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,aAAa,EAAE,UAAU,CAAC,CAAC,CAAC;AAEnG,MAAM,UAAU,eAAe,CAAC,IAAY,EAAE,EAAW;IACvD,MAAM,KAAK,GAA4B,EAAE,CAAC;IAC1C,8FAA8F;IAC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AE,CAAC;AACxB,CAAC","sourcesContent":["/**\n * The retained node this package hands Angular as `ElementRef.nativeElement`, and the thing every\n * `HostEngine` method actually operates on.\n *\n * `packages/fabric/src/engine.ts`'s `EngineNode` is not reusable here (its constructor-free shape\n * still carries Fabric-only bookkeeping - `committed`, `styleCache`, `sheet`...), but the shared\n * packages never ask for that: they ask for `HostNode`'s five fields, plus whatever a component\n * reads directly off `this.node` after `inject(ElementRef).nativeElement as EngineNode` casts it\n * back. Grepping every such read (`view-base.ts`, `pressable.ts`'s `TouchableBase`, `scroll-view.ts`,\n * `select.ts`'s `textOf`) turns up exactly `kind`, `props`, `text`, `children` and `parent` - so a\n * class that implements `HostNode` honestly, backed by a real DOM node, satisfies every one of\n * them without a cast.\n *\n * `children`/`parent` are maintained by hand rather than read live off the DOM (`el.parentElement`,\n * `el.childNodes`) for the same reason `Engine` keeps its own tree: a live DOM walk would have to\n * filter out nodes this package did not create (there are none today, but a consumer's own\n * `document.createElement` inside a projected template is not this package's to assume against),\n * and `select.ts`'s `textOf` recursion wants exactly the nodes Angular put here, in order.\n */\nimport type { HostNode } from '@ng-native/fabric';\n\nexport type BrowserNodeKind = 'element' | 'text' | 'anchor';\n\nexport interface BrowserNode extends HostNode {\n readonly kind: BrowserNodeKind;\n /** The real DOM node this wraps. An `Element` for `element`, a `Text` for `text`. */\n readonly el: Element | Text | Comment;\n /** Lowercase template spelling, e.g. `view`. Mirrors `EngineNode.name`; never the DOM tag. */\n readonly name: string;\n /** `name` again on an element, for Angular 22.0, which reads it on a component's host element. */\n readonly tagName?: string;\n props: Record<string, unknown>;\n text: string;\n children: BrowserNode[];\n parent: BrowserNode | null;\n /**\n * Registered listeners, by top-level type (`topTouchStart`, `topChange`, ...). `null` until\n * the first one, so a node nothing ever listens to costs one field rather than one `Map`.\n */\n listeners: Map<string, Set<(event: unknown) => void>> | null;\n /**\n * Which opt-in event types (`topLayout`, `topPointerEnter`, `topPointerLeave`) already have\n * their real DOM listener installed - `browser-engine.ts`'s `wireOptIn` guard. `null` until\n * the first one, matching `listeners` above.\n */\n optedIn: Set<string> | null;\n}\n\n/** `event.target`, and anything else holding a real DOM node, back to the `BrowserNode` for it. */\nconst registry = new WeakMap<Element | Text | Comment, BrowserNode>();\n\n/**\n * The SVG names whose `fill`/`stroke` need a seeded `props` entry from the moment they are\n * created - see the block below for why. `svg-line` is left out: a `<line>` has no fill of its\n * own to paint (react-native-svg's `Line` never reads `fill` either), so there is nothing an\n * explicit `fill=\"none\"` there could mean.\n */\nconst SVG_BRUSH_ELEMENTS = new Set(['svg-g', 'svg-path', 'svg-circle', 'svg-ellipse', 'svg-rect']);\n\nexport function makeElementNode(name: string, el: Element): BrowserNode {\n const props: Record<string, unknown> = {};\n // `packages/icons/src/svg-props.ts`'s `brushOf` turns a literal `fill=\"none\"`/`stroke=\"none\"`\n // into `null` - a real, meaningful value (\"paint nothing\"), not an absent one. But\n // `BrowserEngine.setProp` treats `null` exactly like `undefined` on a key it has never seen\n // before: `if (!(key in node.props)) return;`, its fast path for \"nothing to remove, so nothing\n // changed\". That path is right for almost everything a `null` prop could mean, and wrong here -\n // it would skip `applyProp` entirely on a chart line's `fill=\"none\"` (`chart-line.ts`,\n // `chart-area.ts`), leaving the attribute unset, and an unset `fill` defaults to opaque black in\n // a browser (the real SVG initial value) rather than to unpainted (what react-native-svg's own\n // `propList` convention, and every one of these charts, is relying on). Seeding the key here -\n // present, value `undefined` - costs nothing on a shape that never touches the prop again, and\n // is what lets that first `null` reach `props.ts`'s real translation instead of being dropped by\n // the fast path. See `props.ts`'s `applyBrush` for the other half: it is what turns a seeded\n // key's `null` into a written `fill=\"none\"`/`stroke=\"none\"` rather than a removed attribute.\n if (SVG_BRUSH_ELEMENTS.has(name)) {\n props['fill'] = undefined;\n props['stroke'] = undefined;\n }\n const node: BrowserNode = {\n kind: 'element',\n el,\n name,\n tagName: name,\n props,\n text: '',\n children: [],\n parent: null,\n listeners: null,\n optedIn: null,\n };\n registry.set(el, node);\n return node;\n}\n\nexport function makeTextNode(text: Text): BrowserNode {\n const node: BrowserNode = {\n kind: 'text',\n el: text,\n name: '#text',\n props: {},\n text: text.data,\n children: [],\n parent: null,\n listeners: null,\n optedIn: null,\n };\n registry.set(text, node);\n return node;\n}\n\n/** Angular's `@if`/`@for`/`ViewContainerRef` markers, backed by a real `Comment`. */\nexport function makeAnchorNode(comment: Comment): BrowserNode {\n const node: BrowserNode = {\n kind: 'anchor',\n el: comment,\n name: '#anchor',\n props: {},\n text: '',\n children: [],\n parent: null,\n listeners: null,\n optedIn: null,\n };\n registry.set(comment, node);\n return node;\n}\n\n/** Puts `el` in place of the element `node` wraps, so `nodeOf` finds the node from either. */\nexport function rebindElement(node: BrowserNode, el: Element): void {\n registry.delete(node.el);\n (node as { el: Element | Text | Comment }).el = el;\n registry.set(el, node);\n}\n\n/** The `BrowserNode` a real DOM node was created with, or `null` for one this package did not make. */\nexport function nodeOf(el: Element | Text | Comment | null): BrowserNode | null {\n return el ? (registry.get(el) ?? null) : null;\n}\n\n/**\n * The nearest `BrowserNode` starting at a real `Element` and walking up `parentElement`.\n *\n * Used to resolve `event.target` for events this package listens for on `document` rather than\n * per-node (the responder system's pointer events, focus/blur, selection change): the physical\n * hit is always a real element this package created, but it is not always one with its own\n * listeners, so the search has to climb past any that are not tracked before it gets to `body`\n * and turns up nothing.\n */\nexport function nearestNodeOf(el: Element | null): BrowserNode | null {\n for (let current = el; current; current = current.parentElement) {\n const node = registry.get(current);\n if (node) return node;\n }\n return null;\n}\n\n/** Root-first path from the tree's root to `node`, inclusive. Mirrors `Engine`'s own `pathTo`. */\nexport function pathTo(node: BrowserNode): BrowserNode[] {\n const path: BrowserNode[] = [];\n for (let current: BrowserNode | null = node; current; current = current.parent)\n path.push(current);\n return path.reverse();\n}\n"]}
1
+ {"version":3,"file":"dom-node.js","sourceRoot":"","sources":["../src/dom-node.ts"],"names":[],"mappings":"AAwDA,mGAAmG;AACnG,MAAM,QAAQ,GAAG,IAAI,OAAO,EAAyC,CA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IAC9C,KAAK,IAAI,OAAO,GAAG,EAAE,EAAE,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,aAAa,EAAE,CAAC;QAChE,MAAM,IAAI,GAAG,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;QACnC,IAAI,IAAI;YAAE,OAAO,IAAI,CAAC;IACxB,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAED,kGAAkG;AAClG,MAAM,UAAU,MAAM,CAAC,IAAiB;IACtC,MAAM,IAAI,GAAkB,EAAE,CAAC;IAC/B,KAAK,IAAI,OAAO,GAAuB,IAAI,EAAE,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,MAAM;QAC5E,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACrB,OAAO,IAAI,CAAC,OAAO,EAAE,CAAC;AACxB,CAAC","sourcesContent":["/**\n * The retained node this package hands Angular as `ElementRef.nativeElement`, and the thing every\n * `HostEngine` method actually operates on.\n *\n * `packages/fabric/src/engine.ts`'s `EngineNode` is not reusable here (its constructor-free shape\n * still carries Fabric-only bookkeeping - `committed`, `styleCache`, `sheet`...), but the shared\n * packages never ask for that: they ask for `HostNode`'s five fields, plus whatever a component\n * reads directly off `this.node` after `inject(ElementRef).nativeElement as EngineNode` casts it\n * back. Grepping every such read (`view-base.ts`, `pressable.ts`'s `TouchableBase`, `scroll-view.ts`,\n * `select.ts`'s `textOf`) turns up exactly `kind`, `props`, `text`, `children` and `parent` - so a\n * class that implements `HostNode` honestly, backed by a real DOM node, satisfies every one of\n * them without a cast.\n *\n * `children`/`parent` are maintained by hand rather than read live off the DOM (`el.parentElement`,\n * `el.childNodes`) for the same reason `Engine` keeps its own tree: a live DOM walk would have to\n * filter out nodes this package did not create (there are none today, but a consumer's own\n * `document.createElement` inside a projected template is not this package's to assume against),\n * and `select.ts`'s `textOf` recursion wants exactly the nodes Angular put here, in order.\n */\nimport type { HostNode } from '@ng-native/fabric';\n\nexport type BrowserNodeKind = 'element' | 'text' | 'anchor';\n\nexport interface BrowserNode extends HostNode {\n readonly kind: BrowserNodeKind;\n /** The real DOM node this wraps. An `Element` for `element`, a `Text` for `text`. */\n readonly el: Element | Text | Comment;\n /** Lowercase template spelling, e.g. `view`. Mirrors `EngineNode.name`; never the DOM tag. */\n readonly name: string;\n /** `name` again on an element, for Angular 22.0, which reads it on a component's host element. */\n readonly tagName?: string;\n /**\n * The wrapped element's attributes, on an element, for Angular's hydration. Once an app on the\n * page calls `provideClientHydration()`, every component's host element is asked for\n * `ngSkipHydration` and `ngh`, an island's included, whatever renderer created it. See\n * `BrowserEngine.wrapRoot` for the answer that keeps hydration out of an island.\n */\n readonly hasAttribute?: (this: BrowserNode, name: string) => boolean;\n readonly getAttribute?: (this: BrowserNode, name: string) => string | null;\n props: Record<string, unknown>;\n text: string;\n children: BrowserNode[];\n parent: BrowserNode | null;\n /**\n * Registered listeners, by top-level type (`topTouchStart`, `topChange`, ...). `null` until\n * the first one, so a node nothing ever listens to costs one field rather than one `Map`.\n */\n listeners: Map<string, Set<(event: unknown) => void>> | null;\n /**\n * Which opt-in event types (`topLayout`, `topPointerEnter`, `topPointerLeave`) already have\n * their real DOM listener installed - `browser-engine.ts`'s `wireOptIn` guard. `null` until\n * the first one, matching `listeners` above.\n */\n optedIn: Set<string> | null;\n}\n\n/** `event.target`, and anything else holding a real DOM node, back to the `BrowserNode` for it. */\nconst registry = new WeakMap<Element | Text | Comment, BrowserNode>();\n\n/**\n * The SVG names whose `fill`/`stroke` need a seeded `props` entry from the moment they are\n * created - see the block below for why. `svg-line` is left out: a `<line>` has no fill of its\n * own to paint (react-native-svg's `Line` never reads `fill` either), so there is nothing an\n * explicit `fill=\"none\"` there could mean.\n */\nconst SVG_BRUSH_ELEMENTS = new Set([\n 'svg-g',\n 'svg-path',\n 'svg-circle',\n 'svg-ellipse',\n 'svg-rect',\n 'svg-text',\n 'svg-tspan',\n]);\n\nfunction hasAttribute(this: BrowserNode, name: string): boolean {\n return (this.el as Element).hasAttribute(name);\n}\n\nfunction getAttribute(this: BrowserNode, name: string): string | null {\n return (this.el as Element).getAttribute(name);\n}\n\nexport function makeElementNode(name: string, el: Element): BrowserNode {\n const props: Record<string, unknown> = {};\n // `packages/icons/src/svg-props.ts`'s `brushOf` turns a literal `fill=\"none\"`/`stroke=\"none\"`\n // into `null` - a real, meaningful value (\"paint nothing\"), not an absent one. But\n // `BrowserEngine.setProp` treats `null` exactly like `undefined` on a key it has never seen\n // before: `if (!(key in node.props)) return;`, its fast path for \"nothing to remove, so nothing\n // changed\". That path is right for almost everything a `null` prop could mean, and wrong here -\n // it would skip `applyProp` entirely on a chart line's `fill=\"none\"` (`chart-line.ts`,\n // `chart-area.ts`), leaving the attribute unset, and an unset `fill` defaults to opaque black in\n // a browser (the real SVG initial value) rather than to unpainted (what react-native-svg's own\n // `propList` convention, and every one of these charts, is relying on). Seeding the key here -\n // present, value `undefined` - costs nothing on a shape that never touches the prop again, and\n // is what lets that first `null` reach `props.ts`'s real translation instead of being dropped by\n // the fast path. See `props.ts`'s `applyBrush` for the other half: it is what turns a seeded\n // key's `null` into a written `fill=\"none\"`/`stroke=\"none\"` rather than a removed attribute.\n if (SVG_BRUSH_ELEMENTS.has(name)) {\n props['fill'] = undefined;\n props['stroke'] = undefined;\n }\n const node: BrowserNode = {\n kind: 'element',\n el,\n name,\n tagName: name,\n hasAttribute,\n getAttribute,\n props,\n text: '',\n children: [],\n parent: null,\n listeners: null,\n optedIn: null,\n };\n registry.set(el, node);\n return node;\n}\n\nexport function makeTextNode(text: Text): BrowserNode {\n const node: BrowserNode = {\n kind: 'text',\n el: text,\n name: '#text',\n props: {},\n text: text.data,\n children: [],\n parent: null,\n listeners: null,\n optedIn: null,\n };\n registry.set(text, node);\n return node;\n}\n\n/** Angular's `@if`/`@for`/`ViewContainerRef` markers, backed by a real `Comment`. */\nexport function makeAnchorNode(comment: Comment): BrowserNode {\n const node: BrowserNode = {\n kind: 'anchor',\n el: comment,\n name: '#anchor',\n props: {},\n text: '',\n children: [],\n parent: null,\n listeners: null,\n optedIn: null,\n };\n registry.set(comment, node);\n return node;\n}\n\n/** Puts `el` in place of the element `node` wraps, so `nodeOf` finds the node from either. */\nexport function rebindElement(node: BrowserNode, el: Element): void {\n registry.delete(node.el);\n (node as { el: Element | Text | Comment }).el = el;\n registry.set(el, node);\n}\n\n/** The `BrowserNode` a real DOM node was created with, or `null` for one this package did not make. */\nexport function nodeOf(el: Element | Text | Comment | null): BrowserNode | null {\n return el ? (registry.get(el) ?? null) : null;\n}\n\n/**\n * The nearest `BrowserNode` starting at a real `Element` and walking up `parentElement`.\n *\n * Used to resolve `event.target` for events this package listens for on `document` rather than\n * per-node (the responder system's pointer events, focus/blur, selection change): the physical\n * hit is always a real element this package created, but it is not always one with its own\n * listeners, so the search has to climb past any that are not tracked before it gets to `body`\n * and turns up nothing.\n */\nexport function nearestNodeOf(el: Element | null): BrowserNode | null {\n for (let current = el; current; current = current.parentElement) {\n const node = registry.get(current);\n if (node) return node;\n }\n return null;\n}\n\n/** Root-first path from the tree's root to `node`, inclusive. Mirrors `Engine`'s own `pathTo`. */\nexport function pathTo(node: BrowserNode): BrowserNode[] {\n const path: BrowserNode[] = [];\n for (let current: BrowserNode | null = node; current; current = current.parent)\n path.push(current);\n return path.reverse();\n}\n"]}
@@ -44,7 +44,7 @@
44
44
  * enough to make that work here: an element born outside the SVG namespace never paints as SVG no
45
45
  * matter what tag string it is given (`document.createElement` always mints an
46
46
  * `HTMLUnknownElement` for a name a browser does not recognise, SVG names very much included), so
47
- * these seven names are the only ones in this file that need `ns` - everything else is content
47
+ * these names are the only ones in this file that need `ns` - everything else is content
48
48
  * HTML has no opinion on and is happy to create by string alone.
49
49
  */
50
50
  export interface ElementSpec {
package/dist/elements.js CHANGED
@@ -14,6 +14,11 @@ const SPECS = {
14
14
  'svg-ellipse': { tag: 'ellipse', ns: SVG_NAMESPACE },
15
15
  'svg-rect': { tag: 'rect', ns: SVG_NAMESPACE },
16
16
  'svg-line': { tag: 'line', ns: SVG_NAMESPACE },
17
+ 'svg-defs': { tag: 'defs', ns: SVG_NAMESPACE },
18
+ 'svg-linear-gradient': { tag: 'linearGradient', ns: SVG_NAMESPACE },
19
+ 'svg-radial-gradient': { tag: 'radialGradient', ns: SVG_NAMESPACE },
20
+ 'svg-text': { tag: 'text', ns: SVG_NAMESPACE },
21
+ 'svg-tspan': { tag: 'tspan', ns: SVG_NAMESPACE },
17
22
  // The root. Commits as the same Fabric view natively (`svg-elements.ts`'s own doc comment); a
18
23
  // plain `<svg>` here too; `props.ts`'s `SVG_ROOT_HANDLERS` is what reads `NgIcon`'s own host
19
24
  // bindings into its `viewBox`/size.
@@ -1 +1 @@
1
- {"version":3,"file":"elements.js","sourceRoot":"","sources":["../src/elements.ts"],"names":[],"mappings":"AA0DA,0DAA0D;AAC1D,MAAM,CAAC,MAAM,aAAa,GAAG,4BAA4B,CAAC;AAE1D,MAAM,KAAK,GAAgC;IACzC,YAAY,EAAE,EAAE,GAAG,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE;IACvD,MAAM,EAAE,EAAE,GAAG,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,UAAU,EAAE,EAAE;IACrD,oBAAoB,EAAE,EAAE,GAAG,EAAE,oBAAoB,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,aAAa,EAAE,EAAE;IACnF,mGAAmG;IACnG,0FAA0F;IAC1F,0FAA0F;IAC1F,uDAAuD;IACvD,OAAO,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,EAAE,EAAE,aAAa,EAAE;IACxC,UAAU,EAAE,EAAE,GAAG,EAAE,MAAM,EAAE,EAAE,EAAE,aAAa,EAAE;IAC9C,YAAY,EAAE,EAAE,GAAG,EAAE,QAAQ,EAAE,EAAE,EAAE,aAAa,EAAE;IAClD,aAAa,EAAE,EAAE,GAAG,EAAE,SAAS,EAAE,EAAE,EAAE,aAAa,EAAE;I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,CAAC,aAAa,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC;IAChF,KAAK,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,GAAG,CAAC,UAAU,EAAE,CAAC;QAC7C,IAAI,IAAI,KAAK,MAAM,IAAI,IAAI,KAAK,MAAM;YAAE,KAAK,CAAC,YAAY,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IAC1E,CAAC;IACD,KAAK,CAAC,KAAK,CAAC,cAAc,CAAC,uBAAuB,CAAC,CAAC;IACpD,IAAI,SAAS;QAAE,KAAK,CAAC,YAAY,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC/C,KAAK,CAAC,KAAK,GAAG,GAAG,CAAC,KAAK,CAAC;IACxB,OAAO,KAAK,CAAC;AACf,CAAC","sourcesContent":["/**\n * The DOM tag each element name commits as.\n *\n * Every name Angular ever creates a host element for - `view`, `text`, `pressable`, and also\n * every component's own selector (a caller's own `x-widget`, say) - becomes a real element with\n * exactly that tag. A browser accepts any tag name and gives it no built-in\n * unregistered name to a plain `View`, because native only has a fixed set of *real* native views\n * to commit as and an arbitrary string is not one of them. A browser has no such list - there is\n * nothing to fall back from - so this file does not reproduce that fallback; the reason for it on\n * native does not exist on the web. `data-rn=\"<name>\"` still goes on every element regardless (it\n * is what `reset.css` selects on, and what the two exceptions below need it for), but the tag\n * itself is always the literal name unless this table says otherwise.\n *\n * ## The two exceptions\n *\n * `ViewBase`'s own prop writes (a real ARIA `role`, `tabindex`, `aria-*`) are enough accessible\n * behaviour for a view, a piece of text, or a scroll container - no amount of them makes a\n * `<view>` accept a text cursor or a space-bar toggle, though, because those are behaviours the\n * browser's own form controls implement in C++, not CSS or JavaScript this package could add. So:\n *\n * - `text-input` commits as a real `<input>`, and as a `<textarea>` while `multiline` is on. The\n * tag a field needs is not known here: `multiline` is a prop set *after* creation (an Angular\n * host binding, run on the first change detection pass), so `browser-engine.ts` swaps the\n * element when it arrives. Only an `<input>` centres its line in a taller box, as a device's\n * one-line field does, and only an `<input>` can be `type=\"password\"` for `secureTextEntry`. A\n * multiline field masks with the non-standard `-webkit-text-security` instead (see `props.ts`).\n * - `switch` commits as a real `<input type=\"checkbox\">`. Its accessible role still comes from\n * `ViewBase`'s normal prop pipeline (`Switch.roleByDefault()` returns `'switch'`, which\n * `props.ts`'s `ROLE_MAP` turns into `role=\"switch\"`) - this file only has to make the element\n * a genuine, keyboard- and screen-reader-operable checkbox underneath that role.\n *\n * `image` stays a plain `data-rn=\"image\"` element rather than a real `<img>`, on purpose: RN's\n * `Image` is a box that a picture fills, sized by flex like any other view, not a replaced\n * inline element with its own intrinsic size fighting the layout. `browser-engine.ts` paints the\n * picture with `background-image`, which is what lets `resizeMode` map straight onto\n * `background-size` instead of needing a wrapper element `object-fit` does not.\n *\n * ## The third exception: SVG\n *\n * `packages/icons/src/svg-elements.ts` registers `svg-g`/`svg-path`/`svg-circle`/`svg-ellipse`/\n * `svg-rect`/`svg-line` and its root (`ng-icon`) against Fabric view names (`RNSVGPath` and so\n * on) so that native drives `react-native-svg` directly with no React component of its own in\n * between - see that file's doc comment. A tag created with `document.createElement` is not\n * enough to make that work here: an element born outside the SVG namespace never paints as SVG no\n * matter what tag string it is given (`document.createElement` always mints an\n * `HTMLUnknownElement` for a name a browser does not recognise, SVG names very much included), so\n * these seven names are the only ones in this file that need `ns` - everything else is content\n * HTML has no opinion on and is happy to create by string alone.\n */\nexport interface ElementSpec {\n readonly tag: string;\n /** Attributes set once, at creation, because the DOM tag needs them to behave at all. */\n readonly attrs?: Readonly<Record<string, string>>;\n /** The element's creation namespace, when it is not HTML's. `createDomElement` reads this to\n * choose `createElementNS` over `createElement` - see \"The third exception: SVG\" above. */\n readonly ns?: string;\n}\n\n/** The one non-HTML namespace this package ever needs. */\nexport const SVG_NAMESPACE = 'http://www.w3.org/2000/svg';\n\nconst SPECS: Record<string, ElementSpec> = {\n 'text-input': { tag: 'input', attrs: { type: 'text' } },\n switch: { tag: 'input', attrs: { type: 'checkbox' } },\n 'activity-indicator': { tag: 'activity-indicator', attrs: { role: 'progressbar' } },\n // The shapes `@ng-native/icons`' `svg-elements.ts` registers. Real SVG tag names, not the prefixed\n // template names - `svg-path` would otherwise ask the DOM for an element literally called\n // `<svg-path>`, which the SVG namespace has no such thing as and so mints as an unstyled,\n // unpainted `SVGUnknownElement` instead of a `<path>`.\n 'svg-g': { tag: 'g', ns: SVG_NAMESPACE },\n 'svg-path': { tag: 'path', ns: SVG_NAMESPACE },\n 'svg-circle': { tag: 'circle', ns: SVG_NAMESPACE },\n 'svg-ellipse': { tag: 'ellipse', ns: SVG_NAMESPACE },\n 'svg-rect': { tag: 'rect', ns: SVG_NAMESPACE },\n 'svg-line': { tag: 'line', ns: SVG_NAMESPACE },\n // The root. Commits as the same Fabric view natively (`svg-elements.ts`'s own doc comment); a\n // plain `<svg>` here too; `props.ts`'s `SVG_ROOT_HANDLERS` is what reads `NgIcon`'s own host\n // bindings into its `viewBox`/size.\n 'ng-icon': { tag: 'svg', ns: SVG_NAMESPACE },\n};\n\n/**\n * Register a name that needs a real DOM tag or baseline attributes beyond the default (its own\n * name, no attributes) - the web counterpart to `engine.ts`'s `registerViewName`. Nothing in this\n * package needs to guess at an unknown name the way `viewNameOf` does; see the file doc comment\n * for why.\n */\nexport function registerElementName(name: string, spec: ElementSpec): void {\n SPECS[name] = spec;\n}\n\nexport function specFor(name: string): ElementSpec {\n return SPECS[name] ?? { tag: name };\n}\n\n/**\n * Create the real DOM element for a template tag name, with its `data-rn` marker and attrs.\n *\n * `createElementNS` rather than `createElement` whenever a spec names a namespace - see \"The\n * third exception: SVG\" above. `setAttribute`, on the other hand, is namespace-agnostic either\n * way (an attribute has no namespace of its own unless explicitly qualified, which `data-rn` and\n * every attribute this package writes never is), so nothing below the element's own creation\n * needs to change for it.\n */\nexport function createDomElement(document: Document, name: string): Element {\n const spec = specFor(name);\n const el = spec.ns\n ? document.createElementNS(spec.ns, spec.tag)\n : document.createElement(spec.tag);\n el.setAttribute('data-rn', name);\n for (const [attr, value] of Object.entries(spec.attrs ?? {})) el.setAttribute(attr, value);\n return el;\n}\n\n/**\n * A `<textarea>` for a multiline `text-input`, or an `<input>` for a one-line one, standing in for\n * `old`: its attributes (inline style and scoping attributes among them) and its value. What the\n * two tags do differently (`type`, `rows` and a textarea's masking) is left for the caller to\n * write again.\n */\nexport function textFieldLike(\n old: HTMLInputElement | HTMLTextAreaElement,\n multiline: boolean,\n): HTMLInputElement | HTMLTextAreaElement {\n const field = old.ownerDocument.createElement(multiline ? 'textarea' : 'input');\n for (const { name, value } of old.attributes) {\n if (name !== 'type' && name !== 'rows') field.setAttribute(name, value);\n }\n field.style.removeProperty('-webkit-text-security');\n if (multiline) field.setAttribute('rows', '1');\n field.value = old.value;\n return field;\n}\n"]}
1
+ {"version":3,"file":"elements.js","sourceRoot":"","sources":["../src/elements.ts"],"names":[],"mappings":"AA0DA,0DAA0D;AAC1D,MAAM,CAAC,MAAM,aAAa,GAAG,4BAA4B,CAAC;AAE1D,MAAM,KAAK,GAAgC;IACzC,YAAY,EAAE,EAAE,GAAG,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE;IACvD,MAAM,EAAE,EAAE,GAAG,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,UAAU,EAAE,EAAE;IACrD,oBAAoB,EAAE,EAAE,GAAG,EAAE,oBAAoB,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,aAAa,EAAE,EAAE;IACnF,mGAAmG;IACnG,0FAA0F;IAC1F,0FAA0F;IAC1F,uDAAuD;IACvD,OAAO,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,EAAE,EAAE,aAAa,EAAE;IACxC,UAAU,EAAE,EAAE,GAAG,EAAE,MAAM,EAAE,EAAE,EAAE,aAAa,EAAE;IAC9C,YAAY,EAAE,EAAE,GAAG,EAAE,QAAQ,EA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,EAAE,IAAI,CAAC,GAAG,CAAC;QAC7C,CAAC,CAAC,QAAQ,CAAC,aAAa,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACrC,EAAE,CAAC,YAAY,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;IACjC,KAAK,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,IAAI,EAAE,CAAC;QAAE,EAAE,CAAC,YAAY,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IAC3F,OAAO,EAAE,CAAC;AACZ,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,aAAa,CAC3B,GAA2C,EAC3C,SAAkB;IAElB,MAAM,KAAK,GAAG,GAAG,CAAC,aAAa,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC;IAChF,KAAK,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,GAAG,CAAC,UAAU,EAAE,CAAC;QAC7C,IAAI,IAAI,KAAK,MAAM,IAAI,IAAI,KAAK,MAAM;YAAE,KAAK,CAAC,YAAY,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IAC1E,CAAC;IACD,KAAK,CAAC,KAAK,CAAC,cAAc,CAAC,uBAAuB,CAAC,CAAC;IACpD,IAAI,SAAS;QAAE,KAAK,CAAC,YAAY,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC/C,KAAK,CAAC,KAAK,GAAG,GAAG,CAAC,KAAK,CAAC;IACxB,OAAO,KAAK,CAAC;AACf,CAAC","sourcesContent":["/**\n * The DOM tag each element name commits as.\n *\n * Every name Angular ever creates a host element for - `view`, `text`, `pressable`, and also\n * every component's own selector (a caller's own `x-widget`, say) - becomes a real element with\n * exactly that tag. A browser accepts any tag name and gives it no built-in\n * unregistered name to a plain `View`, because native only has a fixed set of *real* native views\n * to commit as and an arbitrary string is not one of them. A browser has no such list - there is\n * nothing to fall back from - so this file does not reproduce that fallback; the reason for it on\n * native does not exist on the web. `data-rn=\"<name>\"` still goes on every element regardless (it\n * is what `reset.css` selects on, and what the two exceptions below need it for), but the tag\n * itself is always the literal name unless this table says otherwise.\n *\n * ## The two exceptions\n *\n * `ViewBase`'s own prop writes (a real ARIA `role`, `tabindex`, `aria-*`) are enough accessible\n * behaviour for a view, a piece of text, or a scroll container - no amount of them makes a\n * `<view>` accept a text cursor or a space-bar toggle, though, because those are behaviours the\n * browser's own form controls implement in C++, not CSS or JavaScript this package could add. So:\n *\n * - `text-input` commits as a real `<input>`, and as a `<textarea>` while `multiline` is on. The\n * tag a field needs is not known here: `multiline` is a prop set *after* creation (an Angular\n * host binding, run on the first change detection pass), so `browser-engine.ts` swaps the\n * element when it arrives. Only an `<input>` centres its line in a taller box, as a device's\n * one-line field does, and only an `<input>` can be `type=\"password\"` for `secureTextEntry`. A\n * multiline field masks with the non-standard `-webkit-text-security` instead (see `props.ts`).\n * - `switch` commits as a real `<input type=\"checkbox\">`. Its accessible role still comes from\n * `ViewBase`'s normal prop pipeline (`Switch.roleByDefault()` returns `'switch'`, which\n * `props.ts`'s `ROLE_MAP` turns into `role=\"switch\"`) - this file only has to make the element\n * a genuine, keyboard- and screen-reader-operable checkbox underneath that role.\n *\n * `image` stays a plain `data-rn=\"image\"` element rather than a real `<img>`, on purpose: RN's\n * `Image` is a box that a picture fills, sized by flex like any other view, not a replaced\n * inline element with its own intrinsic size fighting the layout. `browser-engine.ts` paints the\n * picture with `background-image`, which is what lets `resizeMode` map straight onto\n * `background-size` instead of needing a wrapper element `object-fit` does not.\n *\n * ## The third exception: SVG\n *\n * `packages/icons/src/svg-elements.ts` registers `svg-g`/`svg-path`/`svg-circle`/`svg-ellipse`/\n * `svg-rect`/`svg-line` and its root (`ng-icon`) against Fabric view names (`RNSVGPath` and so\n * on) so that native drives `react-native-svg` directly with no React component of its own in\n * between - see that file's doc comment. A tag created with `document.createElement` is not\n * enough to make that work here: an element born outside the SVG namespace never paints as SVG no\n * matter what tag string it is given (`document.createElement` always mints an\n * `HTMLUnknownElement` for a name a browser does not recognise, SVG names very much included), so\n * these names are the only ones in this file that need `ns` - everything else is content\n * HTML has no opinion on and is happy to create by string alone.\n */\nexport interface ElementSpec {\n readonly tag: string;\n /** Attributes set once, at creation, because the DOM tag needs them to behave at all. */\n readonly attrs?: Readonly<Record<string, string>>;\n /** The element's creation namespace, when it is not HTML's. `createDomElement` reads this to\n * choose `createElementNS` over `createElement` - see \"The third exception: SVG\" above. */\n readonly ns?: string;\n}\n\n/** The one non-HTML namespace this package ever needs. */\nexport const SVG_NAMESPACE = 'http://www.w3.org/2000/svg';\n\nconst SPECS: Record<string, ElementSpec> = {\n 'text-input': { tag: 'input', attrs: { type: 'text' } },\n switch: { tag: 'input', attrs: { type: 'checkbox' } },\n 'activity-indicator': { tag: 'activity-indicator', attrs: { role: 'progressbar' } },\n // The shapes `@ng-native/icons`' `svg-elements.ts` registers. Real SVG tag names, not the prefixed\n // template names - `svg-path` would otherwise ask the DOM for an element literally called\n // `<svg-path>`, which the SVG namespace has no such thing as and so mints as an unstyled,\n // unpainted `SVGUnknownElement` instead of a `<path>`.\n 'svg-g': { tag: 'g', ns: SVG_NAMESPACE },\n 'svg-path': { tag: 'path', ns: SVG_NAMESPACE },\n 'svg-circle': { tag: 'circle', ns: SVG_NAMESPACE },\n 'svg-ellipse': { tag: 'ellipse', ns: SVG_NAMESPACE },\n 'svg-rect': { tag: 'rect', ns: SVG_NAMESPACE },\n 'svg-line': { tag: 'line', ns: SVG_NAMESPACE },\n 'svg-defs': { tag: 'defs', ns: SVG_NAMESPACE },\n 'svg-linear-gradient': { tag: 'linearGradient', ns: SVG_NAMESPACE },\n 'svg-radial-gradient': { tag: 'radialGradient', ns: SVG_NAMESPACE },\n 'svg-text': { tag: 'text', ns: SVG_NAMESPACE },\n 'svg-tspan': { tag: 'tspan', ns: SVG_NAMESPACE },\n // The root. Commits as the same Fabric view natively (`svg-elements.ts`'s own doc comment); a\n // plain `<svg>` here too; `props.ts`'s `SVG_ROOT_HANDLERS` is what reads `NgIcon`'s own host\n // bindings into its `viewBox`/size.\n 'ng-icon': { tag: 'svg', ns: SVG_NAMESPACE },\n};\n\n/**\n * Register a name that needs a real DOM tag or baseline attributes beyond the default (its own\n * name, no attributes) - the web counterpart to `engine.ts`'s `registerViewName`. Nothing in this\n * package needs to guess at an unknown name the way `viewNameOf` does; see the file doc comment\n * for why.\n */\nexport function registerElementName(name: string, spec: ElementSpec): void {\n SPECS[name] = spec;\n}\n\nexport function specFor(name: string): ElementSpec {\n return SPECS[name] ?? { tag: name };\n}\n\n/**\n * Create the real DOM element for a template tag name, with its `data-rn` marker and attrs.\n *\n * `createElementNS` rather than `createElement` whenever a spec names a namespace - see \"The\n * third exception: SVG\" above. `setAttribute`, on the other hand, is namespace-agnostic either\n * way (an attribute has no namespace of its own unless explicitly qualified, which `data-rn` and\n * every attribute this package writes never is), so nothing below the element's own creation\n * needs to change for it.\n */\nexport function createDomElement(document: Document, name: string): Element {\n const spec = specFor(name);\n const el = spec.ns\n ? document.createElementNS(spec.ns, spec.tag)\n : document.createElement(spec.tag);\n el.setAttribute('data-rn', name);\n for (const [attr, value] of Object.entries(spec.attrs ?? {})) el.setAttribute(attr, value);\n return el;\n}\n\n/**\n * A `<textarea>` for a multiline `text-input`, or an `<input>` for a one-line one, standing in for\n * `old`: its attributes (inline style and scoping attributes among them) and its value. What the\n * two tags do differently (`type`, `rows` and a textarea's masking) is left for the caller to\n * write again.\n */\nexport function textFieldLike(\n old: HTMLInputElement | HTMLTextAreaElement,\n multiline: boolean,\n): HTMLInputElement | HTMLTextAreaElement {\n const field = old.ownerDocument.createElement(multiline ? 'textarea' : 'input');\n for (const { name, value } of old.attributes) {\n if (name !== 'type' && name !== 'rows') field.setAttribute(name, value);\n }\n field.style.removeProperty('-webkit-text-security');\n if (multiline) field.setAttribute('rows', '1');\n field.value = old.value;\n return field;\n}\n"]}
package/dist/jsdom-env.js CHANGED
@@ -49,6 +49,7 @@ export function installJsdomEnvironment() {
49
49
  HTMLElement: window.HTMLElement,
50
50
  Text: window.Text,
51
51
  Comment: window.Comment,
52
+ NodeFilter: window.NodeFilter,
52
53
  Event: window.Event,
53
54
  PointerEvent: window.PointerEvent ?? window.MouseEvent,
54
55
  KeyboardEvent: window.KeyboardEvent,
@@ -1 +1 @@
1
- {"version":3,"file":"jsdom-env.js","sourceRoot":"","sources":["../src/jsdom-env.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,EAAE,KAAK,EAAE,MAAM,OAAO,CAAC;AAE9B,MAAM,UAAU,uBAAuB;IACrC,MAAM,GAAG,GAAG,IAAI,KAAK,CAAC,oEAAoE,EAAE;QAC1F,GAAG,EAAE,mBAAmB;KACzB,CAAC,CAAC;IACH,MAAM,MAAM,GAAG,GAAG,CAAC,MAA+C,CAAC;IAEnE,MAAM,kBAAkB;QACL,QAAQ,CAAyB;QAClD,YAAY,QAAgC;YAC1C,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QAC3B,CAAC;QACD,OAAO,CAAC,MAAe;YACrB,cAAc,CAAC,GAAG,EAAE;gBAClB,MAAM,IAAI,GAAG,MAAM,CAAC,qBAAqB,EAAE,CAAC;gBAC5C,IAAI,CAAC,QAAQ,CACX;oBACE;wBACE,MAAM;wBACN,cAAc,EAAE,CAAC,EAAE,UAAU,EAAE,IAAI,CAAC,KAAK,EAAE,SAAS,EAAE,IAAI,CAAC,MAAM,EAAE,CAAC;qBACnC;iBACpC,EACD,IAAiC,CAClC,CAAC;YACJ,CAAC,CAAC,CAAC;QACL,CAAC;QACD,SAAS,KAAU,CAAC;QACpB,UAAU,KAAU,CAAC;KACtB;IAED,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,iBAAiB,EAAE,CAAC;QAChD,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,iBAAiB,GAAG,cAAmB,CAAC,CAAC;QAClE,M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/C,CAAC","sourcesContent":["/**\n * A browser environment for Node, so this package's tests can run with `node --test` rather than\n * needing a real browser window. Ported from the prototype at\n * `examples/web-button/src/jsdom-env.ts` (see the report for what that prototype found), which\n * exists to be read rather than imported - this package cannot depend on an example.\n *\n * Two gaps jsdom leaves that this fills: it has no `ResizeObserver` at all, and no `PointerEvent`\n * constructor with the pointer-specific fields (`pointerId`) or `setPointerCapture` on `Element`.\n * Both are stubbed minimally - just enough for `BrowserEngine` to observe a size once and to run\n * its pointer-based responder negotiation. Neither stub ships; it exists only for this test file.\n */\nimport { JSDOM } from 'jsdom';\n\nexport function installJsdomEnvironment(): { document: Document; window: Window } {\n const dom = new JSDOM('<!doctype html><html><body><div id=\"app-root\"></div></body></html>', {\n url: 'http://localhost/',\n });\n const window = dom.window as unknown as Window & typeof globalThis;\n\n class FakeResizeObserver {\n private readonly callback: ResizeObserverCallback;\n constructor(callback: ResizeObserverCallback) {\n this.callback = callback;\n }\n observe(target: Element): void {\n queueMicrotask(() => {\n const rect = target.getBoundingClientRect();\n this.callback(\n [\n {\n target,\n contentBoxSize: [{ inlineSize: rect.width, blockSize: rect.height }],\n } as unknown as ResizeObserverEntry,\n ],\n this as unknown as ResizeObserver,\n );\n });\n }\n unobserve(): void {}\n disconnect(): void {}\n }\n\n if (!window.Element.prototype.setPointerCapture) {\n window.Element.prototype.setPointerCapture = function (): void {};\n window.Element.prototype.releasePointerCapture = function (): void {};\n window.Element.prototype.hasPointerCapture = function (): boolean {\n return false;\n };\n }\n\n const globals: Record<string, unknown> = {\n window,\n document: window.document,\n Node: window.Node,\n Element: window.Element,\n HTMLElement: window.HTMLElement,\n Text: window.Text,\n Comment: window.Comment,\n Event: window.Event,\n PointerEvent: window.PointerEvent ?? window.MouseEvent,\n KeyboardEvent: window.KeyboardEvent,\n CustomEvent: window.CustomEvent,\n ResizeObserver: FakeResizeObserver,\n Image: window.Image,\n getComputedStyle: window.getComputedStyle.bind(window),\n requestAnimationFrame: (cb: FrameRequestCallback) => window.setTimeout(() => cb(Date.now()), 0),\n cancelAnimationFrame: (id: number) => window.clearTimeout(id),\n };\n for (const [key, value] of Object.entries(globals)) {\n (globalThis as Record<string, unknown>)[key] = value;\n }\n\n return { document: window.document, window };\n}\n"]}
1
+ {"version":3,"file":"jsdom-env.js","sourceRoot":"","sources":["../src/jsdom-env.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,EAAE,KAAK,EAAE,MAAM,OAAO,CAAC;AAE9B,MAAM,UAAU,uBAAuB;IACrC,MAAM,GAAG,GAAG,IAAI,KAAK,CAAC,oEAAoE,EAAE;QAC1F,GAAG,EAAE,mBAAmB;KACzB,CAAC,CAAC;IACH,MAAM,MAAM,GAAG,GAAG,CAAC,MAA+C,CAAC;IAEnE,MAAM,kBAAkB;QACL,QAAQ,CAAyB;QAClD,YAAY,QAAgC;YAC1C,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QAC3B,CAAC;QACD,OAAO,CAAC,MAAe;YACrB,cAAc,CAAC,GAAG,EAAE;gBAClB,MAAM,IAAI,GAAG,MAAM,CAAC,qBAAqB,EAAE,CAAC;gBAC5C,IAAI,CAAC,QAAQ,CACX;oBACE;wBACE,MAAM;wBACN,cAAc,EAAE,CAAC,EAAE,UAAU,EAAE,IAAI,CAAC,KAAK,EAAE,SAAS,EAAE,IAAI,CAAC,MAAM,EAAE,CAAC;qBACnC;iBACpC,EACD,IAAiC,CAClC,CAAC;YACJ,CAAC,CAAC,CAAC;QACL,CAAC;QACD,SAAS,KAAU,CAAC;QACpB,UAAU,KAAU,CAAC;KACtB;IAED,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,iBAAiB,EAAE,CAAC;QAChD,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,iBAAiB,GAAG,cAAmB,CAAC,CAAC;QAClE,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,qBAAqB,GAAG,cAAmB,CAAC,CAAC;QACtE,MAAM,CAAC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node --test` rather than\n * needing a real browser window. Ported from the prototype at\n * `examples/web-button/src/jsdom-env.ts` (see the report for what that prototype found), which\n * exists to be read rather than imported - this package cannot depend on an example.\n *\n * Two gaps jsdom leaves that this fills: it has no `ResizeObserver` at all, and no `PointerEvent`\n * constructor with the pointer-specific fields (`pointerId`) or `setPointerCapture` on `Element`.\n * Both are stubbed minimally - just enough for `BrowserEngine` to observe a size once and to run\n * its pointer-based responder negotiation. Neither stub ships; it exists only for this test file.\n */\nimport { JSDOM } from 'jsdom';\n\nexport function installJsdomEnvironment(): { document: Document; window: Window } {\n const dom = new JSDOM('<!doctype html><html><body><div id=\"app-root\"></div></body></html>', {\n url: 'http://localhost/',\n });\n const window = dom.window as unknown as Window & typeof globalThis;\n\n class FakeResizeObserver {\n private readonly callback: ResizeObserverCallback;\n constructor(callback: ResizeObserverCallback) {\n this.callback = callback;\n }\n observe(target: Element): void {\n queueMicrotask(() => {\n const rect = target.getBoundingClientRect();\n this.callback(\n [\n {\n target,\n contentBoxSize: [{ inlineSize: rect.width, blockSize: rect.height }],\n } as unknown as ResizeObserverEntry,\n ],\n this as unknown as ResizeObserver,\n );\n });\n }\n unobserve(): void {}\n disconnect(): void {}\n }\n\n if (!window.Element.prototype.setPointerCapture) {\n window.Element.prototype.setPointerCapture = function (): void {};\n window.Element.prototype.releasePointerCapture = function (): void {};\n window.Element.prototype.hasPointerCapture = function (): boolean {\n return false;\n };\n }\n\n const globals: Record<string, unknown> = {\n window,\n document: window.document,\n Node: window.Node,\n Element: window.Element,\n HTMLElement: window.HTMLElement,\n Text: window.Text,\n Comment: window.Comment,\n NodeFilter: window.NodeFilter,\n Event: window.Event,\n PointerEvent: window.PointerEvent ?? window.MouseEvent,\n KeyboardEvent: window.KeyboardEvent,\n CustomEvent: window.CustomEvent,\n ResizeObserver: FakeResizeObserver,\n Image: window.Image,\n getComputedStyle: window.getComputedStyle.bind(window),\n requestAnimationFrame: (cb: FrameRequestCallback) => window.setTimeout(() => cb(Date.now()), 0),\n cancelAnimationFrame: (id: number) => window.clearTimeout(id),\n };\n for (const [key, value] of Object.entries(globals)) {\n (globalThis as Record<string, unknown>)[key] = value;\n }\n\n return { document: window.document, window };\n}\n"]}
package/dist/mount.js CHANGED
@@ -88,13 +88,15 @@ export function mount(rootElement, component, options = {}) {
88
88
  rootElement.classList.add('platform-web');
89
89
  const engine = new BrowserEngine(document);
90
90
  const factory = new BrowserRendererFactory(engine, document);
91
+ // `wrapRoot` marks the element `ngSkipHydration`; an island gives back what it had on unmount.
92
+ const skipHydration = rootElement.getAttribute('ngSkipHydration');
91
93
  const rootNode = engine.wrapRoot(rootElement);
92
94
  const own = hostProviders(engine, factory, document.defaultView);
93
95
  const mounted = host
94
96
  ? mountInside(host, rootElement, rootNode, component, [...own, ...extraProviders], inputs, {
95
97
  factory,
96
98
  engine,
97
- })
99
+ }, skipHydration)
98
100
  : mountAlone(rootNode, component, [...own, ...extraProviders], inputs, document, {
99
101
  factory,
100
102
  engine,
@@ -212,7 +214,7 @@ function mountAlone(rootNode, component, providers, inputs, document, host) {
212
214
  * The host's element injector goes in too, so a service a component above the island provides
213
215
  * is visible to it as well as one the app does.
214
216
  */
215
- function mountInside(hostInjector, rootElement, rootNode, component, providers, inputs, host) {
217
+ function mountInside(hostInjector, rootElement, rootNode, component, providers, inputs, host, skipHydration) {
216
218
  const injector = createEnvironmentInjector([Screen, ColorScheme, Direction, HardwareBack, StatusBar, ...providers], hostInjector.get(EnvironmentInjector));
217
219
  const componentRef = createComponent(component, {
218
220
  environmentInjector: injector,
@@ -232,6 +234,10 @@ function mountInside(hostInjector, rootElement, rootNode, component, providers,
232
234
  componentRef.destroy();
233
235
  injector.destroy();
234
236
  rootElement.removeAttribute('data-rn-root');
237
+ if (skipHydration === null)
238
+ rootElement.removeAttribute('ngSkipHydration');
239
+ else
240
+ rootElement.setAttribute('ngSkipHydration', skipHydration);
235
241
  rootElement.classList.remove('platform-web');
236
242
  },
237
243
  };