@ng-native/components 0.22.1 → 0.23.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (138) hide show
  1. package/android/build.gradle +22 -0
  2. package/android/src/main/java/dev/ngnative/components/ContextMenuAccessibility.kt +71 -0
  3. package/android/src/main/java/dev/ngnative/components/ContextMenuGesture.kt +161 -0
  4. package/android/src/main/java/dev/ngnative/components/ContextMenuPopup.kt +197 -0
  5. package/android/src/main/java/dev/ngnative/components/MenuHost.kt +45 -0
  6. package/android/src/main/java/dev/ngnative/components/MenuWindowCallback.kt +76 -0
  7. package/android/src/main/java/dev/ngnative/components/MenusModule.kt +85 -0
  8. package/android/src/main/java/dev/ngnative/components/Shortcut.kt +144 -0
  9. package/android/src/main/java/dev/ngnative/components/WindowWrapper.kt +22 -0
  10. package/dist/activity-indicator.d.ts +4 -1
  11. package/dist/activity-indicator.js +6 -2
  12. package/dist/activity-indicator.js.map +1 -1
  13. package/dist/context-menu.d.ts +52 -0
  14. package/dist/context-menu.js +101 -0
  15. package/dist/context-menu.js.map +1 -0
  16. package/dist/drag-and-drop.d.ts +52 -0
  17. package/dist/drag-and-drop.js +112 -0
  18. package/dist/drag-and-drop.js.map +1 -0
  19. package/dist/gesture-backend.d.ts +32 -2
  20. package/dist/gesture-backend.js.map +1 -1
  21. package/dist/gesture-dispatch.d.ts +8 -1
  22. package/dist/gesture-dispatch.js +60 -16
  23. package/dist/gesture-dispatch.js.map +1 -1
  24. package/dist/gesture-interaction.d.ts +13 -0
  25. package/dist/gesture-interaction.js +97 -0
  26. package/dist/gesture-interaction.js.map +1 -0
  27. package/dist/gesture-tracking.d.ts +18 -0
  28. package/dist/gesture-tracking.js +28 -0
  29. package/dist/gesture-tracking.js.map +1 -0
  30. package/dist/gestures-web.d.ts +3 -1
  31. package/dist/gestures-web.js +5 -2
  32. package/dist/gestures-web.js.map +1 -1
  33. package/dist/gestures.d.ts +1 -0
  34. package/dist/gestures.js +45 -3
  35. package/dist/gestures.js.map +1 -1
  36. package/dist/image.d.ts +1 -1
  37. package/dist/index.d.ts +12 -1
  38. package/dist/index.js +12 -1
  39. package/dist/index.js.map +1 -1
  40. package/dist/interaction-observer.d.ts +11 -0
  41. package/dist/interaction-observer.js +12 -0
  42. package/dist/interaction-observer.js.map +1 -0
  43. package/dist/keyboard-avoiding-view.js +3 -3
  44. package/dist/keyboard-avoiding-view.js.map +1 -1
  45. package/dist/markdown-stream.d.ts +3 -1
  46. package/dist/markdown-stream.js +14 -2
  47. package/dist/markdown-stream.js.map +1 -1
  48. package/dist/markdown.d.ts +2 -0
  49. package/dist/markdown.js +5 -3
  50. package/dist/markdown.js.map +1 -1
  51. package/dist/menu.d.ts +71 -0
  52. package/dist/menu.js +193 -0
  53. package/dist/menu.js.map +1 -0
  54. package/dist/modal.d.ts +30 -1
  55. package/dist/modal.js +67 -6
  56. package/dist/modal.js.map +1 -1
  57. package/dist/native-button.d.ts +54 -0
  58. package/dist/native-button.js +100 -0
  59. package/dist/native-button.js.map +1 -0
  60. package/dist/native-gesture.d.ts +9 -1
  61. package/dist/native-gesture.js +32 -3
  62. package/dist/native-gesture.js.map +1 -1
  63. package/dist/native-id.d.ts +10 -0
  64. package/dist/native-id.js +70 -0
  65. package/dist/native-id.js.map +1 -0
  66. package/dist/pressable.d.ts +31 -0
  67. package/dist/pressable.js +102 -9
  68. package/dist/pressable.js.map +1 -1
  69. package/dist/safe-area-provider.js +15 -8
  70. package/dist/safe-area-provider.js.map +1 -1
  71. package/dist/scroll-view-props.d.ts +7 -1
  72. package/dist/scroll-view-props.js +54 -3
  73. package/dist/scroll-view-props.js.map +1 -1
  74. package/dist/section-list.js +2 -2
  75. package/dist/section-list.js.map +1 -1
  76. package/dist/shortcut.d.ts +21 -0
  77. package/dist/shortcut.js +34 -0
  78. package/dist/shortcut.js.map +1 -0
  79. package/dist/sidebar-item.d.ts +53 -0
  80. package/dist/sidebar-item.js +152 -0
  81. package/dist/sidebar-item.js.map +1 -0
  82. package/dist/sidebar-section.d.ts +21 -0
  83. package/dist/sidebar-section.js +74 -0
  84. package/dist/sidebar-section.js.map +1 -0
  85. package/dist/sidebar.d.ts +47 -0
  86. package/dist/sidebar.js +110 -0
  87. package/dist/sidebar.js.map +1 -0
  88. package/dist/split-view.d.ts +63 -0
  89. package/dist/split-view.js +121 -0
  90. package/dist/split-view.js.map +1 -0
  91. package/dist/switch.d.ts +9 -1
  92. package/dist/switch.js +23 -2
  93. package/dist/switch.js.map +1 -1
  94. package/dist/text-input.d.ts +8 -3
  95. package/dist/text-input.js +10 -4
  96. package/dist/text-input.js.map +1 -1
  97. package/dist/transforms.d.ts +7 -0
  98. package/dist/transforms.js +12 -3
  99. package/dist/transforms.js.map +1 -1
  100. package/dist/tray-icon.d.ts +18 -0
  101. package/dist/tray-icon.js +46 -0
  102. package/dist/tray-icon.js.map +1 -0
  103. package/dist/view-base.d.ts +42 -1
  104. package/dist/view-base.js +67 -39
  105. package/dist/view-base.js.map +1 -1
  106. package/dist/virtual-list.js +12 -1
  107. package/dist/virtual-list.js.map +1 -1
  108. package/dist/written-props.js +25 -0
  109. package/dist/written-props.js.map +1 -1
  110. package/expo-module.config.json +6 -0
  111. package/ios/NgNativeButtonComponentView.mm +132 -0
  112. package/ios/NgNativeButtonMetrics.h +28 -0
  113. package/ios/NgNativeButtonMetrics.mm +68 -0
  114. package/ios/NgNativeButtonShadowNode.h +65 -0
  115. package/ios/NgNativeButtonShadowNode.mm +40 -0
  116. package/ios/NgNativeComponents.podspec +28 -0
  117. package/ios/NgNativeDragAndDrop.mm +342 -0
  118. package/ios/NgNativeDropItems.h +29 -0
  119. package/ios/NgNativeDropItems.mm +55 -0
  120. package/ios/NgNativeMenuBuilding.h +40 -0
  121. package/ios/NgNativeMenuBuilding.mm +217 -0
  122. package/ios/NgNativeMenus.mm +320 -0
  123. package/ios/NgNativeResponderHooks.h +53 -0
  124. package/ios/NgNativeResponderHooks.mm +215 -0
  125. package/ios/NgNativeSceneKeys.h +36 -0
  126. package/ios/NgNativeSceneKeys.mm +56 -0
  127. package/ios/NgNativeSplitView.mm +433 -0
  128. package/ios/NgNativeSplitViewDelegate.h +29 -0
  129. package/ios/NgNativeSplitViewDelegate.mm +122 -0
  130. package/ios/NgNativeSplitViewShadowNodes.h +115 -0
  131. package/ios/NgNativeSplitViewShadowNodes.mm +31 -0
  132. package/ios/NgNativeUndo.mm +107 -0
  133. package/ios/NgNativeUndoSteps.h +17 -0
  134. package/ios/NgNativeUndoSteps.mm +22 -0
  135. package/ios/NgNativeViewBinder.h +54 -0
  136. package/ios/NgNativeViewBinder.mm +225 -0
  137. package/ios/NgNativeWindows.mm +1126 -0
  138. package/package.json +13 -5
@@ -1 +1 @@
1
- {"version":3,"file":"gestures.js","sourceRoot":"","sources":["../src/gestures.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8CG;AACH,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACzE,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,gBAAgB,EAAiB,MAAM,mBAAmB,CAAC;AAC/F,OAAO,EACL,iBAAiB,GAGlB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,QAAQ,EAAuB,MAAM,sBAAsB,CAAC;AACrE,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;;AAExD,+FAA+F;AAC/F,gGAAgG;AAChG,+FAA+F;AAC/F,mDAAmD;AACnD,OAAO,CAAC,8BAA8B,CAAC,CAAC;AAExC,OAAO,EAAwC,MAAM,sBAAsB,CAAC;AAE5E;;;;;;;;GAQG;AACH,MAAM,EAAE,cAAc,EAAE,GACtB,OAAO,CAAC,sFAAsF,CAQ7F,CAAC;AAEJ,MAAM,EAAE,YAAY,EAAE,GACpB,OAAO,CAAC,oFAAoF,CAE3F,CAAC;AAEJ;;;GAGG;AACH,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B,CAAC,CAAC,CAAC,SAAS,EAAE;YACjF,IAAI,EAAE,CAAC;YACP,GAAG,CAAC,OAAO,IAAI,QAAQ,KAAK,SAAS,IAAI,EAAE,QAAQ,EAAE,CAAC;SACvD,CAAC,CAAC;QACH,SAAS,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,aAAyB,CAAC,CAAC;QACxD,wFAAwF;QACxF,wFAAwF;QACxF,qBAAqB,EAAE,CAAC;IAC1B,CAAC;uGAdU,WAAW;2FAAX,WAAW,wEADyB,gBAAgB;;2FACpD,WAAW;kBADvB,SAAS;mBAAC,EAAE,QAAQ,EAAE,cAAc,EAAE,QAAQ,EAAE,gBAAgB,EAAE","sourcesContent":["/**\n * react-native-gesture-handler, without React: a native gesture attached to one of our nodes.\n *\n * ```ts\n * import { Gesture } from 'react-native-gesture-handler';\n * import { NativeGesture } from '@ng-native/components/gestures';\n *\n * protected readonly pan = Gesture.Pan().onUpdate((event) => {\n * 'worklet';\n * x.value = event.translationX;\n * });\n * ```\n * ```html\n * <gesture-root>\n * <view [gesture]=\"pan\" [workletStyle]=\"slide\"></view>\n * </gesture-root>\n * ```\n *\n * `GestureDetector` is a React component whose job is to hold a ref, turn it into a view tag, and\n * hand that tag to the native module. Everything under it is a plain function of that tag:\n * `attachHandlers` and `dropHandlers` import no React at runtime, so they are used here as they\n * are, and the gesture objects themselves - `Gesture.Pan()`, the compositions, the config - are\n * the library's own public API and come across untouched.\n *\n * What is written out is the part `useAnimatedGesture` does with hooks: a worklet that turns the\n * raw stream of events into the callbacks a gesture declares. Reanimated's `registerEventHandler`\n * is the same call their `WorkletEventHandler` makes, once per event name per view tag.\n *\n * A gesture whose callbacks are not worklets needs none of that: the library attaches it as a\n * JavaScript-function gesture and its own event receiver, started when the package is first\n * imported, calls them on the JavaScript thread.\n *\n * **A gesture callback must not read `this`, on either thread.** The Babel plugin rewrites one\n * into a worklet whether or not it will run on the UI thread, and a rewritten callback has no\n * `this`; `runOnJS(true)` decides where it runs, not what it may close over. Read what it needs\n * through a local, as a worklet style does.\n *\n * **The internals are reached through `src/`, and that is load-bearing.** Both libraries point\n * their `react-native` package field at their TypeScript source, and Metro prefers that field, so\n * `react-native-gesture-handler` in an app resolves to `src/index.ts`. Importing the built `lib/`\n * copy of a file instead gives a second, parallel copy of the library with its own module state:\n * handlers registered in one copy's registry, the event receiver listening in the other's, and\n * every JavaScript gesture silently doing nothing.\n *\n * Deliberately outside the barrel: everything here reaches React Native's Flow source, which Node\n * cannot parse, and the rest of the package has to stay loadable in the test suite.\n */\nimport { Component, Directive, ElementRef, inject } from '@angular/core';\nimport { claimHost, nativePlatform, registerViewName, type HostNode } from '@ng-native/fabric';\nimport {\n gestureDispatcher,\n type GestureCallbacks,\n type GestureStateManager,\n} from './gesture-dispatch.ts';\nimport { GESTURES, type GestureBackend } from './gesture-backend.ts';\nimport { NativeGestureBase } from './native-gesture.ts';\n\n// For the side effect: evaluating the package's index is what starts its event receiver, which\n// is what delivers a gesture whose callbacks are ordinary functions. An app importing `Gesture`\n// does this too; this file does not depend on that. A `require`, so the published types do not\n// name a library a web app may not have installed.\nrequire('react-native-gesture-handler');\n\nexport { type GestureSpec, type GestureTarget } from './gesture-backend.ts';\n\n/**\n * The internals, required rather than imported, and each with a literal path because Metro builds\n * its graph from those.\n *\n * Not for laziness: a static import would put these TypeScript sources into our own type-checking\n * program, where they fail against settings of ours they were never written for\n * (`verbatimModuleSyntax`, `erasableSyntaxOnly`). `require` asks Metro for the module and leaves\n * the compiler out of it, which is the same trade `@ng-native/device` makes for React Native.\n */\nconst { attachHandlers } =\n require('react-native-gesture-handler/src/handlers/gestures/GestureDetector/attachHandlers.ts') as {\n attachHandlers(config: {\n preparedGesture: object;\n gestureConfig: object;\n gesturesToAttach: readonly object[];\n viewTag: number;\n webEventHandlersRef: object;\n }): void;\n };\n\nconst { dropHandlers } =\n require('react-native-gesture-handler/src/handlers/gestures/GestureDetector/dropHandlers.ts') as {\n dropHandlers(prepared: object): void;\n };\n\n/**\n * Gesture handler 2 installs its JSI bindings here, once Fabric is up. Gesture handler 3 (Expo SDK\n * 58) has no such step: `attachHandlers` loads its Reanimated wrapper, which installs them.\n */\nconst { maybeInitializeFabric = () => {} } =\n require('react-native-gesture-handler/src/init.ts') as {\n maybeInitializeFabric?(): void;\n };\n\nconst { GestureStateManager } =\n require('react-native-gesture-handler/src/handlers/gestures/gestureStateManager.ts') as {\n GestureStateManager: { create(handlerTag: number): GestureStateManager };\n };\n\n/**\n * The same call Reanimated's own `WorkletEventHandler` makes: one registration per event name per\n * view tag, which is all a gesture needs to reach the UI runtime. Not public either.\n */\nconst { registerEventHandler, unregisterEventHandler } =\n require('react-native-reanimated/src/core.ts') as {\n registerEventHandler(\n worklet: (event: never) => void,\n eventName: string,\n emitterReactTag: number,\n ): number;\n unregisterEventHandler(id: number): void;\n };\n\n/** The gesture object, as far as this file needs to know it. */\ninterface Attachable {\n initialize(): void;\n prepare(): void;\n toGestureArray(): { handlers: GestureCallbacks; shouldUseReanimated: boolean }[];\n}\n\nconst EVENT_NAMES = ['onGestureHandlerStateChange', 'onGestureHandlerEvent'];\n\n/**\n * A gesture's own state controller, for the touch callbacks: a worklet that accepts or rejects\n * the gesture while it is still being recognised. Wrapped in a worklet of ours because everything\n * the dispatcher closes over is serialised onto the UI runtime with it.\n */\nconst createManager = (handlerTag: number): GestureStateManager => {\n 'worklet';\n return GestureStateManager.create(handlerTag);\n};\n\nconst backend: GestureBackend = {\n attach: (target, gesture) => {\n maybeInitializeFabric();\n const config = gesture as Attachable;\n const gesturesToAttach = config.toGestureArray();\n // The library's own state object. Only `isMounted` is read back by anything of ours - the\n // microtasks `attachHandlers` queues check it, so a directive torn down in the same tick as\n // it was created does not attach a handler nobody will drop.\n const prepared = {\n attachedGestures: [],\n animatedEventHandler: null,\n animatedHandlers: null,\n shouldUseReanimated: gesturesToAttach.some((g) => g.shouldUseReanimated),\n isMounted: true,\n };\n attachHandlers({\n preparedGesture: prepared,\n gestureConfig: config,\n gesturesToAttach,\n viewTag: target.tag,\n // Web only, and there is no web here. The library reads `.current` off it on that platform.\n webEventHandlersRef: { current: {} },\n });\n\n // One dispatcher for both event names, as the library's own event handler is: a gesture's\n // state changes and its updates arrive on different names and share the same state.\n const animated = gesturesToAttach.filter((g) => g.shouldUseReanimated);\n const dispatch = gestureDispatcher(\n animated.map((g) => g.handlers),\n createManager,\n );\n const registrations = animated.length\n ? EVENT_NAMES.map((name) => registerEventHandler(dispatch, name, target.tag))\n : [];\n\n return () => {\n prepared.isMounted = false;\n for (const id of registrations) unregisterEventHandler(id);\n dropHandlers(prepared);\n };\n },\n};\n\n@Directive({\n selector: '[gesture]',\n providers: [{ provide: GESTURES, useValue: backend }],\n})\nexport class NativeGesture extends NativeGestureBase {}\n\n/**\n * The root the gestures are recognised inside. Wrap the app in one, as the library's own\n * `GestureHandlerRootView` is wrapped.\n *\n * **It is a different view on each platform, and that is the library's own split.**\n * `RNGestureHandlerRootView` is an Android view group that intercepts touches before the rest of\n * the tree sees them; on iOS the recognisers hang off the target view itself, the component\n * provider returns nil, and their own root view renders a plain `View`. Registering the native\n * name on both would render an unimplemented component on iOS.\n */\n@Component({ selector: 'gesture-root', template: '<ng-content />' })\nexport class GestureRoot {\n constructor() {\n const android = nativePlatform() === 'android';\n // Gesture handler 3's Android root finds its registry by the native module's id, which the\n // module puts on the runtime, and throws without one. Gesture handler 2 has neither.\n const moduleId = (globalThis as { _RNGH_MODULE_ID?: number })._RNGH_MODULE_ID;\n registerViewName('gesture-root', android ? 'RNGestureHandlerRootView' : 'RCTView', {\n flex: 1,\n ...(android && moduleId !== undefined && { moduleId }),\n });\n claimHost(inject(ElementRef).nativeElement as HostNode);\n // The library does this in its root view's render: it installs the JSI bindings the new\n // architecture needs, and it can only happen once Fabric is there to install them into.\n maybeInitializeFabric();\n }\n}\n"]}
1
+ {"version":3,"file":"gestures.js","sourceRoot":"","sources":["../src/gestures.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;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OAAO,EAAE,CAAC;;2FAE1C,aAAa;kBAJzB,SAAS;mBAAC;oBACT,QAAQ,EAAE,WAAW;oBACrB,SAAS,EAAE,CAAC,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC;iBACtD;;AAGD;;;;;;;;;GASG;AAEH,MAAM,OAAO,WAAW;IACtB;QACE,MAAM,OAAO,GAAG,cAAc,EAAE,KAAK,SAAS,CAAC;QAC/C,2FAA2F;QAC3F,qFAAqF;QACrF,MAAM,QAAQ,GAAI,UAA2C,CAAC,eAAe,CAAC;QAC9E,gBAAgB,CAAC,cAAc,EAAE,OAAO,CAAC,CAAC,CAAC,0BAA0B,CAAC,CAAC,CAAC,SAAS,EAAE;YACjF,IAAI,EAAE,CAAC;YACP,GAAG,CAAC,OAAO,IAAI,QAAQ,KAAK,SAAS,IAAI,EAAE,QAAQ,EAAE,CAAC;SACvD,CAAC,CAAC;QACH,SAAS,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,aAAyB,CAAC,CAAC;QACxD,wFAAwF;QACxF,wFAAwF;QACxF,qBAAqB,EAAE,CAAC;IAC1B,CAAC;uGAdU,WAAW;2FAAX,WAAW,wEADyB,gBAAgB;;2FACpD,WAAW;kBADvB,SAAS;mBAAC,EAAE,QAAQ,EAAE,cAAc,EAAE,QAAQ,EAAE,gBAAgB,EAAE","sourcesContent":["/**\n * react-native-gesture-handler, without React: a native gesture attached to one of our nodes.\n *\n * ```ts\n * import { Gesture } from 'react-native-gesture-handler';\n * import { NativeGesture } from '@ng-native/components/gestures';\n *\n * protected readonly pan = Gesture.Pan().onUpdate((event) => {\n * 'worklet';\n * x.value = event.translationX;\n * });\n * ```\n * ```html\n * <gesture-root>\n * <view [gesture]=\"pan\" [workletStyle]=\"slide\"></view>\n * </gesture-root>\n * ```\n *\n * `GestureDetector` is a React component whose job is to hold a ref, turn it into a view tag, and\n * hand that tag to the native module. Everything under it is a plain function of that tag:\n * `attachHandlers` and `dropHandlers` import no React at runtime, so they are used here as they\n * are, and the gesture objects themselves - `Gesture.Pan()`, the compositions, the config - are\n * the library's own public API and come across untouched.\n *\n * What is written out is the part `useAnimatedGesture` does with hooks: a worklet that turns the\n * raw stream of events into the callbacks a gesture declares. Reanimated's `registerEventHandler`\n * is the same call their `WorkletEventHandler` makes, once per event name per view tag.\n *\n * A gesture whose callbacks are not worklets needs none of that: the library attaches it as a\n * JavaScript-function gesture and its own event receiver, started when the package is first\n * imported, calls them on the JavaScript thread.\n *\n * **A gesture callback must not read `this`, on either thread.** The Babel plugin rewrites one\n * into a worklet whether or not it will run on the UI thread, and a rewritten callback has no\n * `this`; `runOnJS(true)` decides where it runs, not what it may close over. Read what it needs\n * through a local, as a worklet style does.\n *\n * **The internals are reached through `src/`, and that is load-bearing.** Both libraries point\n * their `react-native` package field at their TypeScript source, and Metro prefers that field, so\n * `react-native-gesture-handler` in an app resolves to `src/index.ts`. Importing the built `lib/`\n * copy of a file instead gives a second, parallel copy of the library with its own module state:\n * handlers registered in one copy's registry, the event receiver listening in the other's, and\n * every JavaScript gesture silently doing nothing.\n *\n * Deliberately outside the barrel: everything here reaches React Native's Flow source, which Node\n * cannot parse, and the rest of the package has to stay loadable in the test suite.\n */\nimport { Component, Directive, ElementRef, inject } from '@angular/core';\nimport { claimHost, nativePlatform, registerViewName, type HostNode } from '@ng-native/fabric';\nimport {\n gestureDispatcher,\n type GestureCallbacks,\n type GestureEndReport,\n type GestureEvent,\n type GestureStateManager,\n} from './gesture-dispatch.ts';\nimport {\n GESTURES,\n type EndedGesture,\n type GestureBackend,\n type GestureEndValues,\n} from './gesture-backend.ts';\nimport { NativeGestureBase } from './native-gesture.ts';\nimport { trackedGestures } from './gesture-tracking.ts';\n\n// For the side effect: evaluating the package's index is what starts its event receiver, which\n// is what delivers a gesture whose callbacks are ordinary functions. An app importing `Gesture`\n// does this too; this file does not depend on that. A `require`, so the published types do not\n// name a library a web app may not have installed.\nrequire('react-native-gesture-handler');\n\nexport { type GestureSpec, type GestureTarget } from './gesture-backend.ts';\nexport { untrackedGesture } from './gesture-tracking.ts';\n\n/**\n * The internals, required rather than imported, and each with a literal path because Metro builds\n * its graph from those.\n *\n * Not for laziness: a static import would put these TypeScript sources into our own type-checking\n * program, where they fail against settings of ours they were never written for\n * (`verbatimModuleSyntax`, `erasableSyntaxOnly`). `require` asks Metro for the module and leaves\n * the compiler out of it, which is the same trade `@ng-native/device` makes for React Native.\n */\nconst { attachHandlers } =\n require('react-native-gesture-handler/src/handlers/gestures/GestureDetector/attachHandlers.ts') as {\n attachHandlers(config: {\n preparedGesture: object;\n gestureConfig: object;\n gesturesToAttach: readonly object[];\n viewTag: number;\n webEventHandlersRef: object;\n }): void;\n };\n\nconst { dropHandlers } =\n require('react-native-gesture-handler/src/handlers/gestures/GestureDetector/dropHandlers.ts') as {\n dropHandlers(prepared: object): void;\n };\n\n/**\n * Gesture handler 2 installs its JSI bindings here, once Fabric is up. Gesture handler 3 (Expo SDK\n * 58) has no such step: `attachHandlers` loads its Reanimated wrapper, which installs them.\n */\nconst { maybeInitializeFabric = () => {} } =\n require('react-native-gesture-handler/src/init.ts') as {\n maybeInitializeFabric?(): void;\n };\n\nconst { GestureStateManager } =\n require('react-native-gesture-handler/src/handlers/gestures/gestureStateManager.ts') as {\n GestureStateManager: { create(handlerTag: number): GestureStateManager };\n };\n\n/**\n * The same call Reanimated's own `WorkletEventHandler` makes: one registration per event name per\n * view tag, which is all a gesture needs to reach the UI runtime. Not public either.\n */\nconst { registerEventHandler, unregisterEventHandler } =\n require('react-native-reanimated/src/core.ts') as {\n registerEventHandler(\n worklet: (event: never) => void,\n eventName: string,\n emitterReactTag: number,\n ): number;\n unregisterEventHandler(id: number): void;\n };\n\n/**\n * How a report leaves the UI runtime: the call a worklet makes to run a function on the\n * JavaScript thread. Reanimated depends on the package, so an app with worklet gestures has it.\n */\nconst { scheduleOnRN } = require('react-native-worklets') as {\n scheduleOnRN<A extends unknown[]>(fn: (...args: A) => unknown, ...args: A): void;\n};\n\n/**\n * Where native sends the events of a gesture whose callbacks run on the JavaScript thread. The\n * library's own receiver listens here too; a second listener only observes.\n */\nconst { DeviceEventEmitter } = require('react-native') as {\n DeviceEventEmitter: {\n addListener(name: string, listener: (event: GestureEvent) => void): { remove(): void };\n };\n};\n\n/** One of the gestures a gesture object attaches, as far as this file needs to know it. */\ninterface Attached {\n handlers: GestureCallbacks;\n handlerName: string;\n config: { direction?: number };\n shouldUseReanimated: boolean;\n}\n\n/** The gesture object, as far as this file needs to know it. */\ninterface Attachable {\n initialize(): void;\n prepare(): void;\n toGestureArray(): Attached[];\n}\n\nconst EVENT_NAMES = ['onGestureHandlerStateChange', 'onGestureHandlerEvent'];\n\n/**\n * A gesture's own state controller, for the touch callbacks: a worklet that accepts or rejects\n * the gesture while it is still being recognised. Wrapped in a worklet of ours because everything\n * the dispatcher closes over is serialised onto the UI runtime with it.\n */\nconst createManager = (handlerTag: number): GestureStateManager => {\n 'worklet';\n return GestureStateManager.create(handlerTag);\n};\n\n/**\n * Hand each of `gestures` that ends successfully to `report`: worklet gestures from the UI runtime\n * through `fromUI`, the rest through a listener of ours beside the library's. Both are fed to the\n * same state machine the callbacks are, so a report means what `onEnd` with success means.\n */\nfunction reporting(\n gestures: readonly Attached[],\n report: (ended: EndedGesture) => void,\n): { fromUI: GestureEndReport; stop(): void } {\n const byTag = new Map(gestures.map((g) => [g.handlers.handlerTag, g]));\n const onJS = (end: GestureEndValues) => {\n const g = byTag.get(end.handlerTag);\n if (g) report({ handlerName: g.handlerName, directions: g.config.direction, end });\n };\n const fromUI: GestureEndReport = (end) => {\n 'worklet';\n scheduleOnRN(onJS, end);\n };\n\n const onThread = gestures.filter((g) => !g.shouldUseReanimated);\n if (!onThread.length) return { fromUI, stop: () => {} };\n const observe = gestureDispatcher(\n onThread.map((g) => ({ handlerTag: g.handlers.handlerTag })),\n createManager,\n onJS,\n );\n const listeners = EVENT_NAMES.map((name) =>\n DeviceEventEmitter.addListener(name, (event) => {\n // State changes only: the touch callbacks are the library's to run here, not ours.\n if (event.oldState != null) observe(event);\n }),\n );\n return { fromUI, stop: () => listeners.forEach((listener) => listener.remove()) };\n}\n\nconst backend: GestureBackend = {\n attach: (target, gesture, report) => {\n maybeInitializeFabric();\n const config = gesture as Attachable;\n const gesturesToAttach = config.toGestureArray();\n // The library's own state object. Only `isMounted` is read back by anything of ours - the\n // microtasks `attachHandlers` queues check it, so a directive torn down in the same tick as\n // it was created does not attach a handler nobody will drop.\n const prepared = {\n attachedGestures: [],\n animatedEventHandler: null,\n animatedHandlers: null,\n shouldUseReanimated: gesturesToAttach.some((g) => g.shouldUseReanimated),\n isMounted: true,\n };\n attachHandlers({\n preparedGesture: prepared,\n gestureConfig: config,\n gesturesToAttach,\n viewTag: target.tag,\n // Web only, and there is no web here. The library reads `.current` off it on that platform.\n webEventHandlersRef: { current: {} },\n });\n\n // One dispatcher for both event names, as the library's own event handler is: a gesture's\n // state changes and its updates arrive on different names and share the same state.\n const animated = gesturesToAttach.filter((g) => g.shouldUseReanimated);\n const tracked = report ? trackedGestures(gesturesToAttach) : [];\n const reports = report && tracked.length ? reporting(tracked, report) : null;\n const dispatch = gestureDispatcher(\n animated.map((g) => g.handlers),\n createManager,\n reports?.fromUI,\n tracked.map((g) => g.handlers.handlerTag),\n );\n const registrations = animated.length\n ? EVENT_NAMES.map((name) => registerEventHandler(dispatch, name, target.tag))\n : [];\n\n return () => {\n prepared.isMounted = false;\n for (const id of registrations) unregisterEventHandler(id);\n reports?.stop();\n dropHandlers(prepared);\n };\n },\n};\n\n@Directive({\n selector: '[gesture]',\n providers: [{ provide: GESTURES, useValue: backend }],\n})\nexport class NativeGesture extends NativeGestureBase {}\n\n/**\n * The root the gestures are recognised inside. Wrap the app in one, as the library's own\n * `GestureHandlerRootView` is wrapped.\n *\n * **It is a different view on each platform, and that is the library's own split.**\n * `RNGestureHandlerRootView` is an Android view group that intercepts touches before the rest of\n * the tree sees them; on iOS the recognisers hang off the target view itself, the component\n * provider returns nil, and their own root view renders a plain `View`. Registering the native\n * name on both would render an unimplemented component on iOS.\n */\n@Component({ selector: 'gesture-root', template: '<ng-content />' })\nexport class GestureRoot {\n constructor() {\n const android = nativePlatform() === 'android';\n // Gesture handler 3's Android root finds its registry by the native module's id, which the\n // module puts on the runtime, and throws without one. Gesture handler 2 has neither.\n const moduleId = (globalThis as { _RNGH_MODULE_ID?: number })._RNGH_MODULE_ID;\n registerViewName('gesture-root', android ? 'RNGestureHandlerRootView' : 'RCTView', {\n flex: 1,\n ...(android && moduleId !== undefined && { moduleId }),\n });\n claimHost(inject(ElementRef).nativeElement as HostNode);\n // The library does this in its root view's render: it installs the JSI bindings the new\n // architecture needs, and it can only happen once Fabric is there to install them into.\n maybeInitializeFabric();\n }\n}\n"]}
package/dist/image.d.ts CHANGED
@@ -44,7 +44,7 @@ export declare class Image extends ViewBase {
44
44
  /** How the image fits its box. Defaults to `cover`. */
45
45
  readonly resizeMode: import("@angular/core").InputSignal<ImageResizeMode | undefined>;
46
46
  /** Android: how a large image is scaled down while decoding. */
47
- readonly resizeMethod: import("@angular/core").InputSignal<"none" | "auto" | "resize" | "scale" | undefined>;
47
+ readonly resizeMethod: import("@angular/core").InputSignal<"none" | "auto" | "scale" | "resize" | undefined>;
48
48
  /** Android: the factor `resizeMethod: 'resize'` scales by. */
49
49
  readonly resizeMultiplier: import("@angular/core").InputSignalWithTransform<number | undefined, unknown>;
50
50
  /** A blur applied to the image. */
package/dist/index.d.ts CHANGED
@@ -16,9 +16,20 @@ export { ImageBackground } from './image-background.ts';
16
16
  export { InputAccessoryView } from './input-accessory-view.ts';
17
17
  export { KEYBOARD_CONTROLLER, KeyboardDock, KeyboardLift, provideKeyboardController, } from './keyboard-dock.ts';
18
18
  export { KeyboardAvoidingView, type KeyboardAvoidingBehavior } from './keyboard-avoiding-view.ts';
19
- export { Modal, type ModalOrientation, type ModalPresentationStyle } from './modal.ts';
19
+ export { Modal, type ModalAnchor, type ModalOrientation, type ModalPresentationStyle, } from './modal.ts';
20
+ export { MenuBar, MenuGroup, MenuItem, MenuSeparator, treeOrder } from './menu.ts';
21
+ export { CONTEXT_MENU, ContextMenu } from './context-menu.ts';
22
+ export { Shortcut } from './shortcut.ts';
23
+ export { DragItem, FileDrop, type DragItemValue, type DroppedFile, type FileDropEvent, } from './drag-and-drop.ts';
24
+ export { TrayIcon } from './tray-icon.ts';
25
+ export { SplitView, SplitViewContent, type SplitViewShowing } from './split-view.ts';
26
+ export { Sidebar, type SidebarRow } from './sidebar.ts';
27
+ export { SidebarSection } from './sidebar-section.ts';
28
+ export { SidebarItem, type SidebarItemIcon } from './sidebar-item.ts';
29
+ export { NativeButton, type ButtonIcon, type ButtonKind } from './native-button.ts';
20
30
  export { NativeRef } from './native-ref.ts';
21
31
  export { ControlBase, PressBehavior, Pressable, TouchableBase, type AndroidRipple, type PressEvent, } from './pressable.ts';
32
+ export { INTERACTION_OBSERVERS, SWIPE_VELOCITY, provideInteractionObserver, type InteractionDirection, type InteractionEvent, type InteractionGesture, type InteractionObserver, type InteractionType, } from './interaction-observer.ts';
22
33
  export { RefreshControl } from './refresh-control.ts';
23
34
  export { GradientText } from './gradient-text.ts';
24
35
  export { type SafeAreaEdge, type SafeAreaEdges } from './safe-area.ts';
package/dist/index.js CHANGED
@@ -16,9 +16,20 @@ export { ImageBackground } from "./image-background.js";
16
16
  export { InputAccessoryView } from "./input-accessory-view.js";
17
17
  export { KEYBOARD_CONTROLLER, KeyboardDock, KeyboardLift, provideKeyboardController, } from "./keyboard-dock.js";
18
18
  export { KeyboardAvoidingView } from "./keyboard-avoiding-view.js";
19
- export { Modal } from "./modal.js";
19
+ export { Modal, } from "./modal.js";
20
+ export { MenuBar, MenuGroup, MenuItem, MenuSeparator, treeOrder } from "./menu.js";
21
+ export { CONTEXT_MENU, ContextMenu } from "./context-menu.js";
22
+ export { Shortcut } from "./shortcut.js";
23
+ export { DragItem, FileDrop, } from "./drag-and-drop.js";
24
+ export { TrayIcon } from "./tray-icon.js";
25
+ export { SplitView, SplitViewContent } from "./split-view.js";
26
+ export { Sidebar } from "./sidebar.js";
27
+ export { SidebarSection } from "./sidebar-section.js";
28
+ export { SidebarItem } from "./sidebar-item.js";
29
+ export { NativeButton } from "./native-button.js";
20
30
  export { NativeRef } from "./native-ref.js";
21
31
  export { ControlBase, PressBehavior, Pressable, TouchableBase, } from "./pressable.js";
32
+ export { INTERACTION_OBSERVERS, SWIPE_VELOCITY, provideInteractionObserver, } from "./interaction-observer.js";
22
33
  export { RefreshControl } from "./refresh-control.js";
23
34
  export { GradientText } from "./gradient-text.js";
24
35
  export {} from "./safe-area.js";
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,EAAmD,MAAM,gBAAgB,CAAC;AACjF,OAAO,EAwCN,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,KAAK,EAA+D,MAAM,YAAY,CAAC;AAChG,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAC/D,OAAO,EACL,mBAAmB,EACnB,YAAY,EACZ,YAAY,EACZ,yBAAyB,GAC1B,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,oBAAoB,EAAiC,MAAM,6BAA6B,CAAC;AAClG,OAAO,EAAE,KAAK,EAAsD,MAAM,YAAY,CAAC;AACvF,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EACL,WAAW,EACX,aAAa,EACb,SAAS,EACT,aAAa,GAGd,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAyC,MAAM,gBAAgB,CAAC;AACvE,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,YAAY,EAAyB,MAAM,qBAAqB,CAAC;AAC1E,OAAO,EAAkC,MAAM,oBAAoB,CAAC;AACpE,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EACL,oBAAoB,EACpB,aAAa,EACb,aAAa,EACb,WAAW,EACX,WAAW,EACX,gBAAgB,GAOjB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,IAAI,EAA4C,MAAM,WAAW,CAAC;AAC3E,OAAO,EACL,SAAS,GAIV,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAClE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EACL,QAAQ,EACR,YAAY,EACZ,uBAAuB,GAWxB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,WAAW,EACX,cAAc,EACd,oBAAoB,GAMrB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAA6D,MAAM,sBAAsB,CAAC;AACjG,OAAO,EACL,aAAa,EACb,YAAY,GAMb,MAAM,eAAe,CAAC","sourcesContent":["/**\n * The host primitives, and the platform-capability tokens they inject.\n *\n * Every element a template renders natively is a component here and must be imported by the\n * component whose template uses it, as any Angular component must. A template that uses one\n * without importing it compiles, renders a plain view, and is reported in dev builds.\n *\n * Importing this barrel evaluates decorators, so anything a Node test needs at runtime has to\n * be reached as a source file instead - see the note in `packages/integration-tests/compile.ts`.\n */\nexport { ActivityIndicator } from './activity-indicator.ts';\nexport { type AnimatedPropsHandle, type AnimationBackend } from './animation.ts';\nexport {\n type AccessibilityActionEvent,\n type AccessibilityActionPayload,\n type ContentSizeChangeEvent,\n type ImageErrorEvent,\n type ImageErrorPayload,\n type ImageLoadEvent,\n type ImageLoadPayload,\n type ImageProgressEvent,\n type ImageProgressPayload,\n type Insets,\n type KeyPressEvent,\n type KeyPressPayload,\n type LayoutEvent,\n type LayoutPayload,\n type OrientationChangeEvent,\n type OrientationChangePayload,\n type Point,\n type Rect,\n type ScrollEvent,\n type ScrollPayload,\n type SelectionChangeEvent,\n type SelectionChangePayload,\n type Size,\n type SwitchChangeEvent,\n type SwitchChangePayload,\n type TextInputChangeEvent,\n type TextInputChangePayload,\n type TextInputContentSizeEvent,\n type TextInputContentSizePayload,\n type TextInputEditingEvent,\n type TextInputFocusEvent,\n type TextInputFocusPayload,\n type TextInputScrollEvent,\n type TextInputScrollPayload,\n type TextLayoutEvent,\n type TextLayoutLine,\n type TextLayoutPayload,\n type TouchEvent,\n type TouchEventPayload,\n} from './events.ts';\nexport { Image, type ImageResizeMode, type ImageSource, type ImageURISource } from './image.ts';\nexport { ImageBackground } from './image-background.ts';\nexport { InputAccessoryView } from './input-accessory-view.ts';\nexport {\n KEYBOARD_CONTROLLER,\n KeyboardDock,\n KeyboardLift,\n provideKeyboardController,\n} from './keyboard-dock.ts';\nexport { KeyboardAvoidingView, type KeyboardAvoidingBehavior } from './keyboard-avoiding-view.ts';\nexport { Modal, type ModalOrientation, type ModalPresentationStyle } from './modal.ts';\nexport { NativeRef } from './native-ref.ts';\nexport {\n ControlBase,\n PressBehavior,\n Pressable,\n TouchableBase,\n type AndroidRipple,\n type PressEvent,\n} from './pressable.ts';\nexport { RefreshControl } from './refresh-control.ts';\nexport { GradientText } from './gradient-text.ts';\nexport { type SafeAreaEdge, type SafeAreaEdges } from './safe-area.ts';\nexport { SafeAreaProvider } from './safe-area-provider.ts';\nexport { SafeAreaView, type SafeAreaEdgeMode } from './safe-area-view.ts';\nexport { type KeyboardShouldPersistTaps } from './keyboard-taps.ts';\nexport { ScrollView } from './scroll-view.ts';\nexport {\n SectionEdgeSeparator,\n SectionFooter,\n SectionHeader,\n SectionItem,\n SectionList,\n SectionSeparator,\n type SectionContext,\n type SectionEdgeSeparatorContext,\n type SectionItemContext,\n type SectionListSection,\n type SectionRow,\n type SectionSeparatorContext,\n} from './section-list.ts';\nexport { Switch } from './switch.ts';\nexport { Text, type DynamicTypeRamp, type EllipsizeMode } from './text.ts';\nexport {\n TextInput,\n type KeyboardType,\n type ReturnKeyType,\n type SubmitBehavior,\n} from './text-input.ts';\nexport { TouchableOpacity } from './touchable-opacity.ts';\nexport { optionalBoolean, optionalNumber } from './transforms.ts';\nexport { View } from './view.ts';\nexport {\n ViewBase,\n ViewBehavior,\n contributeAccessibility,\n type AccessibilityAction,\n type AccessibilityContribution,\n type AccessibilityLiveRegion,\n type AccessibilityRole,\n type Role,\n type AccessibilityState,\n type AccessibilityValue,\n type AndroidDrawable,\n type ImportantForAccessibility,\n type PointerEvents,\n} from './view-base.ts';\nexport {\n VirtualList,\n VirtualListRow,\n VirtualListSeparator,\n type VirtualItemHeight,\n type VirtualListSeparatorContext,\n type VirtualListPadding,\n type VirtualListVisiblePosition,\n type VirtualRow,\n} from './virtual-list.ts';\nexport { type GestureBackend, type GestureSpec, type GestureTarget } from './gesture-backend.ts';\nexport {\n workletScroll,\n workletStyle,\n type SharedValue,\n type WorkletBackend,\n type WorkletScrollSpec,\n type WorkletStyleSpec,\n type WorkletTarget,\n} from './worklets.ts';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,EAAmD,MAAM,gBAAgB,CAAC;AACjF,OAAO,EAwCN,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,KAAK,EAA+D,MAAM,YAAY,CAAC;AAChG,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2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AAyB,MAAM,qBAAqB,CAAC;AAC1E,OAAO,EAAkC,MAAM,oBAAoB,CAAC;AACpE,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EACL,oBAAoB,EACpB,aAAa,EACb,aAAa,EACb,WAAW,EACX,WAAW,EACX,gBAAgB,GAOjB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,IAAI,EAA4C,MAAM,WAAW,CAAC;AAC3E,OAAO,EACL,SAAS,GAIV,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAClE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EACL,QAAQ,EACR,YAAY,EACZ,uBAAuB,GAWxB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,WAAW,EACX,cAAc,EACd,oBAAoB,GAMrB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAA6D,MAAM,sBAAsB,CAAC;AACjG,OAAO,EACL,aAAa,EACb,YAAY,GAMb,MAAM,eAAe,CAAC","sourcesContent":["/**\n * The host primitives, and the platform-capability tokens they inject.\n *\n * Every element a template renders natively is a component here and must be imported by the\n * component whose template uses it, as any Angular component must. A template that uses one\n * without importing it compiles, renders a plain view, and is reported in dev builds.\n *\n * Importing this barrel evaluates decorators, so anything a Node test needs at runtime has to\n * be reached as a source file instead - see the note in `packages/integration-tests/compile.ts`.\n */\nexport { ActivityIndicator } from './activity-indicator.ts';\nexport { type AnimatedPropsHandle, type AnimationBackend } from './animation.ts';\nexport {\n type AccessibilityActionEvent,\n type AccessibilityActionPayload,\n type ContentSizeChangeEvent,\n type ImageErrorEvent,\n type ImageErrorPayload,\n type ImageLoadEvent,\n type ImageLoadPayload,\n type ImageProgressEvent,\n type ImageProgressPayload,\n type Insets,\n type KeyPressEvent,\n type KeyPressPayload,\n type LayoutEvent,\n type LayoutPayload,\n type OrientationChangeEvent,\n type OrientationChangePayload,\n type Point,\n type Rect,\n type ScrollEvent,\n type ScrollPayload,\n type SelectionChangeEvent,\n type SelectionChangePayload,\n type Size,\n type SwitchChangeEvent,\n type SwitchChangePayload,\n type TextInputChangeEvent,\n type TextInputChangePayload,\n type TextInputContentSizeEvent,\n type TextInputContentSizePayload,\n type TextInputEditingEvent,\n type TextInputFocusEvent,\n type TextInputFocusPayload,\n type TextInputScrollEvent,\n type TextInputScrollPayload,\n type TextLayoutEvent,\n type TextLayoutLine,\n type TextLayoutPayload,\n type TouchEvent,\n type TouchEventPayload,\n} from './events.ts';\nexport { Image, type ImageResizeMode, type ImageSource, type ImageURISource } from './image.ts';\nexport { ImageBackground } from './image-background.ts';\nexport { InputAccessoryView } from './input-accessory-view.ts';\nexport {\n KEYBOARD_CONTROLLER,\n KeyboardDock,\n KeyboardLift,\n provideKeyboardController,\n} from './keyboard-dock.ts';\nexport { KeyboardAvoidingView, type KeyboardAvoidingBehavior } from './keyboard-avoiding-view.ts';\nexport {\n Modal,\n type ModalAnchor,\n type ModalOrientation,\n type ModalPresentationStyle,\n} from './modal.ts';\nexport { MenuBar, MenuGroup, MenuItem, MenuSeparator, treeOrder } from './menu.ts';\nexport { CONTEXT_MENU, ContextMenu } from './context-menu.ts';\nexport { Shortcut } from './shortcut.ts';\nexport {\n DragItem,\n FileDrop,\n type DragItemValue,\n type DroppedFile,\n type FileDropEvent,\n} from './drag-and-drop.ts';\nexport { TrayIcon } from './tray-icon.ts';\nexport { SplitView, SplitViewContent, type SplitViewShowing } from './split-view.ts';\nexport { Sidebar, type SidebarRow } from './sidebar.ts';\nexport { SidebarSection } from './sidebar-section.ts';\nexport { SidebarItem, type SidebarItemIcon } from './sidebar-item.ts';\nexport { NativeButton, type ButtonIcon, type ButtonKind } from './native-button.ts';\nexport { NativeRef } from './native-ref.ts';\nexport {\n ControlBase,\n PressBehavior,\n Pressable,\n TouchableBase,\n type AndroidRipple,\n type PressEvent,\n} from './pressable.ts';\nexport {\n INTERACTION_OBSERVERS,\n SWIPE_VELOCITY,\n provideInteractionObserver,\n type InteractionDirection,\n type InteractionEvent,\n type InteractionGesture,\n type InteractionObserver,\n type InteractionType,\n} from './interaction-observer.ts';\nexport { RefreshControl } from './refresh-control.ts';\nexport { GradientText } from './gradient-text.ts';\nexport { type SafeAreaEdge, type SafeAreaEdges } from './safe-area.ts';\nexport { SafeAreaProvider } from './safe-area-provider.ts';\nexport { SafeAreaView, type SafeAreaEdgeMode } from './safe-area-view.ts';\nexport { type KeyboardShouldPersistTaps } from './keyboard-taps.ts';\nexport { ScrollView } from './scroll-view.ts';\nexport {\n SectionEdgeSeparator,\n SectionFooter,\n SectionHeader,\n SectionItem,\n SectionList,\n SectionSeparator,\n type SectionContext,\n type SectionEdgeSeparatorContext,\n type SectionItemContext,\n type SectionListSection,\n type SectionRow,\n type SectionSeparatorContext,\n} from './section-list.ts';\nexport { Switch } from './switch.ts';\nexport { Text, type DynamicTypeRamp, type EllipsizeMode } from './text.ts';\nexport {\n TextInput,\n type KeyboardType,\n type ReturnKeyType,\n type SubmitBehavior,\n} from './text-input.ts';\nexport { TouchableOpacity } from './touchable-opacity.ts';\nexport { optionalBoolean, optionalNumber } from './transforms.ts';\nexport { View } from './view.ts';\nexport {\n ViewBase,\n ViewBehavior,\n contributeAccessibility,\n type AccessibilityAction,\n type AccessibilityContribution,\n type AccessibilityLiveRegion,\n type AccessibilityRole,\n type Role,\n type AccessibilityState,\n type AccessibilityValue,\n type AndroidDrawable,\n type ImportantForAccessibility,\n type PointerEvents,\n} from './view-base.ts';\nexport {\n VirtualList,\n VirtualListRow,\n VirtualListSeparator,\n type VirtualItemHeight,\n type VirtualListSeparatorContext,\n type VirtualListPadding,\n type VirtualListVisiblePosition,\n type VirtualRow,\n} from './virtual-list.ts';\nexport { type GestureBackend, type GestureSpec, type GestureTarget } from './gesture-backend.ts';\nexport {\n workletScroll,\n workletStyle,\n type SharedValue,\n type WorkletBackend,\n type WorkletScrollSpec,\n type WorkletStyleSpec,\n type WorkletTarget,\n} from './worklets.ts';\n"]}
@@ -0,0 +1,11 @@
1
+ /**
2
+ * The interaction observers live in `@ng-native/device`, so that `@ng-native/expo` and
3
+ * `@ng-native/router` can report their controls too. Re-exported here, where the press machine
4
+ * reads them and where apps import them from.
5
+ */
6
+ export { INTERACTION_OBSERVERS, MAX_TEXT_LENGTH, describeElement, interactionObservers, notifyInteraction, provideInteractionObserver, textWithin, type InteractionDirection, type InteractionEvent, type InteractionGesture, type InteractionObserver, type InteractionType, } from '@ng-native/device';
7
+ /**
8
+ * How fast, in points per millisecond, a drag has to be moving as the finger lifts to be a swipe
9
+ * rather than a scroll: a flick that leaves the content gliding on, not a drag set down.
10
+ */
11
+ export declare const SWIPE_VELOCITY = 0.5;
@@ -0,0 +1,12 @@
1
+ /**
2
+ * The interaction observers live in `@ng-native/device`, so that `@ng-native/expo` and
3
+ * `@ng-native/router` can report their controls too. Re-exported here, where the press machine
4
+ * reads them and where apps import them from.
5
+ */
6
+ export { INTERACTION_OBSERVERS, MAX_TEXT_LENGTH, describeElement, interactionObservers, notifyInteraction, provideInteractionObserver, textWithin, } from '@ng-native/device';
7
+ /**
8
+ * How fast, in points per millisecond, a drag has to be moving as the finger lifts to be a swipe
9
+ * rather than a scroll: a flick that leaves the content gliding on, not a drag set down.
10
+ */
11
+ export const SWIPE_VELOCITY = 0.5;
12
+ //# sourceMappingURL=interaction-observer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"interaction-observer.js","sourceRoot":"","sources":["../src/interaction-observer.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EACL,qBAAqB,EACrB,eAAe,EACf,eAAe,EACf,oBAAoB,EACpB,iBAAiB,EACjB,0BAA0B,EAC1B,UAAU,GAMX,MAAM,mBAAmB,CAAC;AAE3B;;;GAGG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,GAAG,CAAC","sourcesContent":["/**\n * The interaction observers live in `@ng-native/device`, so that `@ng-native/expo` and\n * `@ng-native/router` can report their controls too. Re-exported here, where the press machine\n * reads them and where apps import them from.\n */\nexport {\n INTERACTION_OBSERVERS,\n MAX_TEXT_LENGTH,\n describeElement,\n interactionObservers,\n notifyInteraction,\n provideInteractionObserver,\n textWithin,\n type InteractionDirection,\n type InteractionEvent,\n type InteractionGesture,\n type InteractionObserver,\n type InteractionType,\n} from '@ng-native/device';\n\n/**\n * How fast, in points per millisecond, a drag has to be moving as the finger lifts to be a swipe\n * rather than a scroll: a flick that leaves the content gliding on, not a drag set down.\n */\nexport const SWIPE_VELOCITY = 0.5;\n"]}
@@ -1,9 +1,9 @@
1
- import { Component, computed, effect, inject, input, signal, booleanAttribute, } from '@angular/core';
1
+ import { Component, computed, effect, inject, input, signal } from '@angular/core';
2
2
  import { Keyboard, LayoutAnimation } from '@ng-native/device';
3
3
  import { ContentContainer } from "./content-container.js";
4
4
  import { View } from "./view.js";
5
5
  import { ViewBase } from "./view-base.js";
6
- import { numberOr } from "./transforms.js";
6
+ import { booleanOr, numberOr } from "./transforms.js";
7
7
  import * as i0 from "@angular/core";
8
8
  /**
9
9
  * The names `LayoutEasing` knows. `'keyboard'` is among them: iOS reports its keyboard's own
@@ -66,7 +66,7 @@ export class KeyboardAvoidingView extends ViewBase {
66
66
  contentContainerClass = input(/* @ts-ignore */
67
67
  ...(ngDevMode ? [undefined, { debugName: "contentContainerClass" }] : /* istanbul ignore next */ []));
68
68
  /** Set to false to stop avoiding without removing the view. */
69
- enabled = input(true, { ...(ngDevMode ? { debugName: "enabled" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
69
+ enabled = input(true, { ...(ngDevMode ? { debugName: "enabled" } : /* istanbul ignore next */ {}), transform: booleanOr(true) });
70
70
  /**
71
71
  * Extra room to leave above the keyboard, in points. RN's name, and in RN the place to put a
72
72
  * header's height; here the view is measured in the window, so a navigation b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AE,wBAAwB;oBAClC,OAAO,EAAE,CAAC,gBAAgB,EAAE,IAAI,CAAC;oBACjC,QAAQ,EAAE;;;;;;;;;;;GAWT;oBACD,IAAI,EAAE;wBACJ,iBAAiB,EAAE,aAAa;wBAChC,UAAU,EAAE,kBAAkB;qBAC/B;iBACF","sourcesContent":["import {\n Component,\n computed,\n effect,\n inject,\n input,\n signal,\n booleanAttribute,\n} from '@angular/core';\nimport { Keyboard, LayoutAnimation, type LayoutEasing } from '@ng-native/device';\nimport type { NativeSyntheticEvent } from '@ng-native/fabric';\nimport type { Rect } from './events.ts';\nimport { ContentContainer } from './content-container.ts';\nimport { View } from './view.ts';\nimport { ViewBase } from './view-base.ts';\nimport { numberOr } from './transforms.ts';\n\nexport type KeyboardAvoidingBehavior = 'padding' | 'height' | 'position';\n\n/**\n * The names `LayoutEasing` knows. `'keyboard'` is among them: iOS reports its keyboard's own\n * curve by that name, and RN's KeyboardAvoidingView animates on it.\n */\nconst LAYOUT_EASINGS: ReadonlySet<string> = new Set([\n 'linear',\n 'easeInEaseOut',\n 'easeIn',\n 'easeOut',\n 'spring',\n 'keyboard',\n]);\n\n/** A keyboard event's `easing`, narrowed to what `LayoutAnimation` accepts, or left to its default. */\nfunction layoutEasingOf(easing: string | undefined): LayoutEasing | undefined {\n return easing !== undefined && LAYOUT_EASINGS.has(easing) ? (easing as LayoutEasing) : undefined;\n}\n\n/**\n * Moves its content clear of the keyboard.\n *\n * RN's KeyboardAvoidingView is a JS composite: there is no native component, only a view whose\n * padding, height or position tracks the keyboard. Off a device the `Keyboard` service reports\n * nothing, so this renders as a plain view and does nothing, which is also the right behaviour on\n * a platform with no soft keyboard.\n *\n * The overlap is the view's own frame against the keyboard's top edge, so a view that does not\n * reach the bottom of the screen moves only as far as it must. Unlike RN, the frame's top is\n * measured in the window, and the keyboard's `screenY` brought into it: `(layout)` reports the top\n * in the parent's coordinates, and on a screen under a navigation bar those start a bar's height\n * down. RN leaves that to `keyboardVerticalOffset`, and a view that was not told came up short by\n * exactly that much, its bottom edge still behind the keyboard. On Android, when React Native's\n * edge-to-edge flag is off (Expo Go leaves it off), the window starts below the status bar while\n * `screenY` counts from the top of the screen, so the keyboard's top is taken `Keyboard.windowTop`\n * higher in the window, or the view comes up short by the status bar; when the flag is on,\n * `Keyboard.windowTop` is zero. The overlap never exceeds the\n * view's own height either: padding a view by more than it has pushes its content out of it.\n * When the keyboard source reports no `screenY`, the keyboard's height stands in.\n *\n * The adjustment itself animates with the keyboard's own motion, the way RN's own\n * KeyboardAvoidingView does: a keyboard event's `duration` and `easing` configure the next\n * layout animation before the style change that moves this view, so the two run together rather\n * than the padding, height or position jumping to its resting place in one step. Android animates\n * no layout unless an app turns that on, and reports no duration, so there the view jumps; with\n * `@ng-native/expo`'s `provideNativeKeyboard()` it follows the keyboard frame by frame instead.\n */\n@Component({\n selector: 'keyboard-avoiding-view',\n imports: [ContentContainer, View],\n template: `\n @if (behavior() === 'position') {\n <view\n [contentContainerOf]=\"node\"\n [contentContainerClass]=\"contentContainerClass()\"\n [style]=\"positioned()\"\n ><ng-content\n /></view>\n } @else {\n <ng-content />\n }\n `,\n host: {\n '[styleOverride]': 'avoidance()',\n '(layout)': 'onLayout($event)',\n },\n})\nexport class KeyboardAvoidingView extends ViewBase {\n /**\n * How to make room: pad the bottom, shrink the height, or shift the content up. RN leaves this\n * unset and does nothing; `padding` is the default here because that is what a form wants.\n */\n readonly behavior = input<KeyboardAvoidingBehavior>('padding');\n /** Styles for the inner view that `position` moves. */\n readonly contentContainerStyle = input<Record<string, unknown>>();\n /**\n * Classes for the inner view that `position` moves, matched as if it were written in the\n * template this view is. See `ContentContainer`.\n */\n readonly contentContainerClass = input<string>();\n /** Set to false to stop avoiding without removing the view. */\n readonly enabled = input(true, { transform: booleanAttribute });\n /**\n * Extra room to leave above the keyboard, in points. RN's name, and in RN the place to put a\n * header's height; here the view is measured in the window, so a navigation bar needs none.\n */\n readonly keyboardVerticalOffset = input(0, { transform: numberOr(0) });\n\n private readonly keyboardService = inject(Keyboard);\n /** Where the keyboard is, at every frame of its motion where the platform says. */\n private readonly keyboard = this.keyboardService.position;\n private readonly layoutAnimation = inject(LayoutAnimation);\n private readonly frame = signal<Rect | null>(null);\n /** The height before any adjustment, which `height` mode shrinks from. */\n private initialHeight: number | null = null;\n\n /** How far the keyboard intrudes into this view, in points. */\n protected readonly overlap = computed(() => {\n if (!this.enabled()) return 0;\n const { height, screenY } = this.keyboard();\n if (height === 0) return 0;\n const frame = this.frame();\n const offset = this.keyboardVerticalOffset();\n if (!frame) return Math.max(0, height - offset);\n // In `height` mode the frame is the one this view already shrank, so measure the height it\n // had before, as RN adds its current adjustment back; otherwise the room it made reads as no\n // overlap and the height springs back under the keyboard.\n const extent =\n this.behavior() === 'height' ? (this.initialHeight ?? frame.height) : frame.height;\n const top = screenY === undefined ? undefined : screenY - this.keyboardService.windowTop;\n const overlap = top === undefined ? height - offset : frame.y + extent - (top - offset);\n return Math.min(extent, Math.max(0, overlap));\n });\n\n /**\n * The adjustment, or nothing to adjust. Bound as the engine's style override rather than as\n * host style, because Angular ranks a host style binding under the template's: a caller's\n * `[style]=\"{flex: 1}\"` would otherwise keep its flex in height mode and the view would not\n * shrink at all. RN composes the adjustment after the caller's style, so it wins there too.\n */\n protected readonly avoidance = computed(() => {\n const overlap = this.overlap();\n const behavior = this.behavior();\n if (overlap === 0 || behavior === 'position') return undefined;\n if (behavior === 'height') {\n const base = this.initialHeight ?? this.frame()?.height;\n return base === undefined ? undefined : { height: base - overlap, flex: 0 };\n }\n return { paddingBottom: overlap };\n });\n\n protected readonly positioned = computed(() => ({\n ...this.contentContainerStyle(),\n bottom: this.overlap(),\n }));\n\n constructor() {\n super();\n // A duration of zero is Android's own keyboard event, which says nothing of the motion; there\n // is nothing to configure alongside it. Nor where the view follows the motion frame by frame.\n // `appear`/`leave` are turned off because this is an update to a view already on screen, not\n // one appearing or leaving - RN's own bare `LayoutAnimation.configureNext({duration, update})`\n // animates nothing else either.\n effect(() => {\n const { duration, easing } = this.keyboardService.metrics();\n if (!this.enabled() || !duration || this.keyboardService.followsMotion) return;\n void this.layoutAnimation.animate(() => {}, {\n duration,\n easing: layoutEasingOf(easing),\n appear: 'none',\n leave: 'none',\n });\n });\n }\n\n protected onLayout(event: NativeSyntheticEvent<{ layout?: Rect }>): void {\n const layout = event.nativeEvent?.layout;\n if (!layout) return;\n // Only a layout of the view as nothing adjusted it counts as the natural height: not one it\n // shrank to, nor one its padding grew. The keyboard can be up at the first one already, before\n // the view had a frame to shrink.\n const adjusted = this.avoidance() !== undefined;\n this.frame.set({ ...layout, y: this.windowTop(layout.y) });\n if (!adjusted) this.initialHeight = layout.height;\n }\n\n /**\n * Where this view's top edge is in the window, or `fallback` where the platform cannot say.\n * Synchronous on the new architecture, so it answers for the layout being reported.\n */\n private windowTop(fallback: number): number {\n let top = fallback;\n this.engine.measure(this.node, (frame) => (top = frame.y));\n return top;\n }\n}\n"]}
1
+ {"version":3,"file":"keyboard-avoiding-view.js","sourceRoot":"","sources":["../src/keyboard-avoiding-view.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACnF,OAAO,EAAE,QAAQ,EAAE,eAAe,EAAqB,MAAM,mBAAmB,CAAC;AAGjF,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;;AAItD;;;GAGG;AACH,MAAM,cAAc,GAAwB,IAAI,GAAG,CAAC;IAClD,QAAQ;IACR,eAAe;IACf,QAAQ;IACR,SAAS;IACT,QAAQ;IACR,UAAU;CACX,CAAC,CAAC;AAEH,uGAAuG;AACvG,SAAS,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AE,CAAC,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;QAC3D,IAAI,CAAC,QAAQ;YAAE,IAAI,CAAC,aAAa,GAAG,MAAM,CAAC,MAAM,CAAC;IACpD,CAAC;IAED;;;OAGG;IACK,SAAS,CAAC,QAAgB;QAChC,IAAI,GAAG,GAAG,QAAQ,CAAC;QACnB,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,GAAG,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;QAC3D,OAAO,GAAG,CAAC;IACb,CAAC;uGA3GU,oBAAoB;2FAApB,oBAAoB,s9BAjBrB;;;;;;;;;;;GAWT,4DAZS,gBAAgB,0HAAE,IAAI;;2FAkBrB,oBAAoB;kBApBhC,SAAS;mBAAC;oBACT,QAAQ,EAAE,wBAAwB;oBAClC,OAAO,EAAE,CAAC,gBAAgB,EAAE,IAAI,CAAC;oBACjC,QAAQ,EAAE;;;;;;;;;;;GAWT;oBACD,IAAI,EAAE;wBACJ,iBAAiB,EAAE,aAAa;wBAChC,UAAU,EAAE,kBAAkB;qBAC/B;iBACF","sourcesContent":["import { Component, computed, effect, inject, input, signal } from '@angular/core';\nimport { Keyboard, LayoutAnimation, type LayoutEasing } from '@ng-native/device';\nimport type { NativeSyntheticEvent } from '@ng-native/fabric';\nimport type { Rect } from './events.ts';\nimport { ContentContainer } from './content-container.ts';\nimport { View } from './view.ts';\nimport { ViewBase } from './view-base.ts';\nimport { booleanOr, numberOr } from './transforms.ts';\n\nexport type KeyboardAvoidingBehavior = 'padding' | 'height' | 'position';\n\n/**\n * The names `LayoutEasing` knows. `'keyboard'` is among them: iOS reports its keyboard's own\n * curve by that name, and RN's KeyboardAvoidingView animates on it.\n */\nconst LAYOUT_EASINGS: ReadonlySet<string> = new Set([\n 'linear',\n 'easeInEaseOut',\n 'easeIn',\n 'easeOut',\n 'spring',\n 'keyboard',\n]);\n\n/** A keyboard event's `easing`, narrowed to what `LayoutAnimation` accepts, or left to its default. */\nfunction layoutEasingOf(easing: string | undefined): LayoutEasing | undefined {\n return easing !== undefined && LAYOUT_EASINGS.has(easing) ? (easing as LayoutEasing) : undefined;\n}\n\n/**\n * Moves its content clear of the keyboard.\n *\n * RN's KeyboardAvoidingView is a JS composite: there is no native component, only a view whose\n * padding, height or position tracks the keyboard. Off a device the `Keyboard` service reports\n * nothing, so this renders as a plain view and does nothing, which is also the right behaviour on\n * a platform with no soft keyboard.\n *\n * The overlap is the view's own frame against the keyboard's top edge, so a view that does not\n * reach the bottom of the screen moves only as far as it must. Unlike RN, the frame's top is\n * measured in the window, and the keyboard's `screenY` brought into it: `(layout)` reports the top\n * in the parent's coordinates, and on a screen under a navigation bar those start a bar's height\n * down. RN leaves that to `keyboardVerticalOffset`, and a view that was not told came up short by\n * exactly that much, its bottom edge still behind the keyboard. On Android, when React Native's\n * edge-to-edge flag is off (Expo Go leaves it off), the window starts below the status bar while\n * `screenY` counts from the top of the screen, so the keyboard's top is taken `Keyboard.windowTop`\n * higher in the window, or the view comes up short by the status bar; when the flag is on,\n * `Keyboard.windowTop` is zero. The overlap never exceeds the\n * view's own height either: padding a view by more than it has pushes its content out of it.\n * When the keyboard source reports no `screenY`, the keyboard's height stands in.\n *\n * The adjustment itself animates with the keyboard's own motion, the way RN's own\n * KeyboardAvoidingView does: a keyboard event's `duration` and `easing` configure the next\n * layout animation before the style change that moves this view, so the two run together rather\n * than the padding, height or position jumping to its resting place in one step. Android animates\n * no layout unless an app turns that on, and reports no duration, so there the view jumps; with\n * `@ng-native/expo`'s `provideNativeKeyboard()` it follows the keyboard frame by frame instead.\n */\n@Component({\n selector: 'keyboard-avoiding-view',\n imports: [ContentContainer, View],\n template: `\n @if (behavior() === 'position') {\n <view\n [contentContainerOf]=\"node\"\n [contentContainerClass]=\"contentContainerClass()\"\n [style]=\"positioned()\"\n ><ng-content\n /></view>\n } @else {\n <ng-content />\n }\n `,\n host: {\n '[styleOverride]': 'avoidance()',\n '(layout)': 'onLayout($event)',\n },\n})\nexport class KeyboardAvoidingView extends ViewBase {\n /**\n * How to make room: pad the bottom, shrink the height, or shift the content up. RN leaves this\n * unset and does nothing; `padding` is the default here because that is what a form wants.\n */\n readonly behavior = input<KeyboardAvoidingBehavior>('padding');\n /** Styles for the inner view that `position` moves. */\n readonly contentContainerStyle = input<Record<string, unknown>>();\n /**\n * Classes for the inner view that `position` moves, matched as if it were written in the\n * template this view is. See `ContentContainer`.\n */\n readonly contentContainerClass = input<string>();\n /** Set to false to stop avoiding without removing the view. */\n readonly enabled = input(true, { transform: booleanOr(true) });\n /**\n * Extra room to leave above the keyboard, in points. RN's name, and in RN the place to put a\n * header's height; here the view is measured in the window, so a navigation bar needs none.\n */\n readonly keyboardVerticalOffset = input(0, { transform: numberOr(0) });\n\n private readonly keyboardService = inject(Keyboard);\n /** Where the keyboard is, at every frame of its motion where the platform says. */\n private readonly keyboard = this.keyboardService.position;\n private readonly layoutAnimation = inject(LayoutAnimation);\n private readonly frame = signal<Rect | null>(null);\n /** The height before any adjustment, which `height` mode shrinks from. */\n private initialHeight: number | null = null;\n\n /** How far the keyboard intrudes into this view, in points. */\n protected readonly overlap = computed(() => {\n if (!this.enabled()) return 0;\n const { height, screenY } = this.keyboard();\n if (height === 0) return 0;\n const frame = this.frame();\n const offset = this.keyboardVerticalOffset();\n if (!frame) return Math.max(0, height - offset);\n // In `height` mode the frame is the one this view already shrank, so measure the height it\n // had before, as RN adds its current adjustment back; otherwise the room it made reads as no\n // overlap and the height springs back under the keyboard.\n const extent =\n this.behavior() === 'height' ? (this.initialHeight ?? frame.height) : frame.height;\n const top = screenY === undefined ? undefined : screenY - this.keyboardService.windowTop;\n const overlap = top === undefined ? height - offset : frame.y + extent - (top - offset);\n return Math.min(extent, Math.max(0, overlap));\n });\n\n /**\n * The adjustment, or nothing to adjust. Bound as the engine's style override rather than as\n * host style, because Angular ranks a host style binding under the template's: a caller's\n * `[style]=\"{flex: 1}\"` would otherwise keep its flex in height mode and the view would not\n * shrink at all. RN composes the adjustment after the caller's style, so it wins there too.\n */\n protected readonly avoidance = computed(() => {\n const overlap = this.overlap();\n const behavior = this.behavior();\n if (overlap === 0 || behavior === 'position') return undefined;\n if (behavior === 'height') {\n const base = this.initialHeight ?? this.frame()?.height;\n return base === undefined ? undefined : { height: base - overlap, flex: 0 };\n }\n return { paddingBottom: overlap };\n });\n\n protected readonly positioned = computed(() => ({\n ...this.contentContainerStyle(),\n bottom: this.overlap(),\n }));\n\n constructor() {\n super();\n // A duration of zero is Android's own keyboard event, which says nothing of the motion; there\n // is nothing to configure alongside it. Nor where the view follows the motion frame by frame.\n // `appear`/`leave` are turned off because this is an update to a view already on screen, not\n // one appearing or leaving - RN's own bare `LayoutAnimation.configureNext({duration, update})`\n // animates nothing else either.\n effect(() => {\n const { duration, easing } = this.keyboardService.metrics();\n if (!this.enabled() || !duration || this.keyboardService.followsMotion) return;\n void this.layoutAnimation.animate(() => {}, {\n duration,\n easing: layoutEasingOf(easing),\n appear: 'none',\n leave: 'none',\n });\n });\n }\n\n protected onLayout(event: NativeSyntheticEvent<{ layout?: Rect }>): void {\n const layout = event.nativeEvent?.layout;\n if (!layout) return;\n // Only a layout of the view as nothing adjusted it counts as the natural height: not one it\n // shrank to, nor one its padding grew. The keyboard can be up at the first one already, before\n // the view had a frame to shrink.\n const adjusted = this.avoidance() !== undefined;\n this.frame.set({ ...layout, y: this.windowTop(layout.y) });\n if (!adjusted) this.initialHeight = layout.height;\n }\n\n /**\n * Where this view's top edge is in the window, or `fallback` where the platform cannot say.\n * Synchronous on the new architecture, so it answers for the layout being reported.\n */\n private windowTop(fallback: number): number {\n let top = fallback;\n this.engine.measure(this.node, (frame) => (top = frame.y));\n return top;\n }\n}\n"]}
@@ -2,7 +2,9 @@
2
2
  * A Markdown source that grows as it streams in, lexed a chunk at a time: the blocks before the
3
3
  * last one are kept, only the last is lexed again, and syntax still open at its end is held back
4
4
  * until it closes, so a half-written code span, emphasis, link, image, table row or code fence
5
- * line never shows as the characters it is written with.
5
+ * line never shows as the characters it is written with. A last line of only dashes, `=` or a
6
+ * list marker waits for its end too, since until then it may make the text above a heading, a
7
+ * list or a table.
6
8
  *
7
9
  * Plain functions and a class with no Angular in them, beside `markdown-blocks.ts`.
8
10
  */
@@ -2,7 +2,9 @@
2
2
  * A Markdown source that grows as it streams in, lexed a chunk at a time: the blocks before the
3
3
  * last one are kept, only the last is lexed again, and syntax still open at its end is held back
4
4
  * until it closes, so a half-written code span, emphasis, link, image, table row or code fence
5
- * line never shows as the characters it is written with.
5
+ * line never shows as the characters it is written with. A last line of only dashes, `=` or a
6
+ * list marker waits for its end too, since until then it may make the text above a heading, a
7
+ * list or a table.
6
8
  *
7
9
  * Plain functions and a class with no Angular in them, beside `markdown-blocks.ts`.
8
10
  */
@@ -149,6 +151,13 @@ function heldInline(inline, tail, start) {
149
151
  }
150
152
  return null;
151
153
  }
154
+ /**
155
+ * A line of `=`, of dashes with pipes, colons and spaces, or of a lone `+`, `*` or number with
156
+ * `.` or `)`, after any quote markers. Until it ends it may be a setext underline, a list item,
157
+ * a table's delimiter row or a thematic break, and a marker with no text yet is not a list item,
158
+ * so it would draw as text in the paragraph above.
159
+ */
160
+ const UNDERLINE = /^(?:[ \t]*>)*(?:[ \t]*=+[ \t]*|[|: \t]*-[-|: \t]*|[ \t]*(?:[+*]|\d{1,9}[.)])[ \t]*)$/;
152
161
  /** Where `tail` is cut so its last block shows nothing half written, or null to show all of it. */
153
162
  function holdBackAt(tail, tokens) {
154
163
  const block = lastBlock(tokens);
@@ -156,8 +165,11 @@ function holdBackAt(tail, tokens) {
156
165
  return null;
157
166
  if (block.type === 'code')
158
167
  return heldFence(block, tail);
168
+ const lineStart = tail.lastIndexOf('\n') + 1;
159
169
  if (block.type === 'table')
160
- return tail.endsWith('\n') ? null : tail.lastIndexOf('\n') + 1;
170
+ return tail.endsWith('\n') ? null : lineStart;
171
+ if (UNDERLINE.test(tail.slice(lineStart)))
172
+ return lineStart;
161
173
  const header = block.type === 'paragraph' ? heldHeaderRow(block, tail) : null;
162
174
  if (header !== null)
163
175
  return header;
@@ -1 +1 @@
1
- {"version":3,"file":"markdown-stream.js","sourceRoot":"","sources":["../src/markdown-stream.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EAAE,KAAK,EAA4C,MAAM,QAAQ,CAAC;AAIzE,0EAA0E;AAC1E,SAAS,gBAAgB,CAAC,MAAwB;IAChD,IAAI,EAAE,GAAG,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC;IAC3B,OAAO,EAAE,IAAI,CAAC,IAAI,MAAM,CAAC,EAAE,CAAE,CAAC,IAAI,KAAK,OAAO;QAAE,EAAE,EAAE,CAAC;IACrD,OAAO,EAAE,CAAC;AACZ,CAAC;AAED,8FAA8F;AAC9F,SAAS,SAAS,CAAC,MAAwB;IACzC,MAAM,IAAI,GAAG,MAAM,CAAC,gBAAgB,CAAC,MAAM,CAAC,CAAC,CAAC;IAC9C,IAAI,IAAI,EAAE,IAAI,KAAK,MAAM,EAAE,CAAC;QAC1B,MAAM,IAAI,GAAI,IAAoB,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;QAChD,OAAO,CAAC,IAAI,IAAI,SAAS,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,IAAI,IAAI,CAAC;IAClD,CAAC;IACD,IAAI,IAAI,EAAE,IAAI,KAAK,YAAY;QAAE,OAAO,SAAS,CAAE,IAA0B,CAAC,MAAM,CAAC,IAAI,IAAI,CAAC;IAC9F,OAAO,IAAI,CAAC;AACd,CAAC;AAED,MAAM,UAAU,GAAG,IAAI,CAAC;AACxB,MAAM,IAAI,GAAG,eAAe,CAAC;AAC7B,MAAM,WAAW,GAAG,eAAe,CAAC;AACpC,MAAM,UAAU,GAAG,eAAe,CAAC;AAQnC;;;GAGG;AACH,SAAS,QAAQ,CAAC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C,OAAO,GAAG,IAAI,CAAC;QACpB,IAAI,CAAC,aAAa,GAAG,MAAM,CAAC;QAC5B,IAAI,CAAC,YAAY,GAAG,SAAS,CAAC;IAChC,CAAC;CACF","sourcesContent":["/**\n * A Markdown source that grows as it streams in, lexed a chunk at a time: the blocks before the\n * last one are kept, only the last is lexed again, and syntax still open at its end is held back\n * until it closes, so a half-written code span, emphasis, link, image, table row or code fence\n * line never shows as the characters it is written with.\n *\n * Plain functions and a class with no Angular in them, beside `markdown-blocks.ts`.\n */\nimport { Lexer, type Token, type Tokens, type TokensList } from 'marked';\n\ntype Links = TokensList['links'];\n\n/** Where the last token in `tokens` that is not blank space is, or -1. */\nfunction lastIndexOfBlock(tokens: readonly Token[]): number {\n let at = tokens.length - 1;\n while (at >= 0 && tokens[at]!.type === 'space') at--;\n return at;\n}\n\n/** The last block in `tokens` that is not blank space, inside the last quote or list item. */\nfunction lastBlock(tokens: readonly Token[]): Token | undefined {\n const last = tokens[lastIndexOfBlock(tokens)];\n if (last?.type === 'list') {\n const item = (last as Tokens.List).items.at(-1);\n return (item && lastBlock(item.tokens)) ?? last;\n }\n if (last?.type === 'blockquote') return lastBlock((last as Tokens.Blockquote).tokens) ?? last;\n return last;\n}\n\nconst WHITESPACE = /\\s/;\nconst WORD = /[\\p{L}\\p{N}]/u;\nconst PUNCTUATION = /[\\p{P}\\p{S}]/u;\nconst DELIMITERS = /`+|\\*+|_+|~+/g;\n\n/** A text token marked left as text, and where it is in the tail, or -1 when it was not found. */\ninterface Leaf {\n readonly raw: string;\n readonly at: number;\n}\n\n/**\n * The text tokens in `inline`, in order, each found in `tail` after the one before it, starting\n * from `from`. A link or an image is passed over whole, as it closed.\n */\nfunction leavesOf(inline: readonly Token[], tail: string, from: number, leaves: Leaf[] = []) {\n let cursor = from;\n for (const token of inline) {\n const at = tail.indexOf(token.raw, cursor);\n const children = (token as Tokens.Generic).tokens;\n if (token.type === 'text' && !children?.length) leaves.push({ raw: token.raw, at });\n else if (children && token.type !== 'link' && token.type !== 'image') {\n leavesOf(children, tail, at < 0 ? cursor : at, leaves);\n }\n if (at >= 0) cursor = at + token.raw.length;\n }\n return leaves;\n}\n\n/**\n * Where the first delimiter in a text token at `at` in `tail` is that could still open a code span\n * or an emphasis. A backtick left as text always could. An asterisk, underscore or tilde could\n * when what follows is not a space, or has not arrived yet, and is not punctuation straight after\n * a letter or digit; an underscore inside a word cannot. What is before and after the delimiter\n * is read from `tail`, since a text token can end where another token starts.\n */\nfunction openerIn(raw: string, at: number, tail: string): number | null {\n for (const match of raw.matchAll(DELIMITERS)) {\n const from = at + match.index;\n const next = tail[from + match[0].length];\n if (canOpen(match[0], tail[from - 1], next)) return from;\n }\n return null;\n}\n\n/** Whether a delimiter run, between `before` and `next`, could open a code span or an emphasis. */\nfunction canOpen(run: string, before: string | undefined, next: string | undefined) {\n if (run[0] === '`') return true;\n if (next !== undefined && WHITESPACE.test(next)) return false;\n const afterWord = before !== undefined && WORD.test(before);\n if (afterWord && next !== undefined && PUNCTUATION.test(next)) return false;\n if (run[0] === '_' && afterWord) return false;\n return !(run[0] === '~' && run.length > 2);\n}\n\n/** Where a fenced code block's half-written fence line starts, or null when it has none. */\nfunction heldFence(block: Token, tail: string): number | null {\n const fence = /^ {0,3}(`{3,}|~{3,})/.exec(block.raw);\n if (!fence) return null;\n const lineStart = tail.lastIndexOf('\\n') + 1;\n // An opening fence whose info string is still arriving.\n if (!block.raw.includes('\\n')) return lineStart;\n // A closing fence, or a line of the fence's own marker that may yet grow into one: a run too\n // short to close it can grow only while nothing follows it. The block's own last line, since in\n // a quote or a list item the source line starts with their markers.\n const closing = fence[1]![0] === '`' ? /^ {0,3}(`+)(\\s*)$/ : /^ {0,3}(~+)(\\s*)$/;\n const last = closing.exec(block.raw.slice(block.raw.lastIndexOf('\\n') + 1));\n const grows = last && (!last[2] || last[1]!.length >= fence[1]!.length);\n return grows && !tail.endsWith('\\n') ? lineStart : null;\n}\n\n/**\n * Where a paragraph that starts like a table row starts, while it is a header row whose delimiter\n * row has not arrived, or is arriving, and so a table once it does.\n */\nfunction heldHeaderRow(block: Token, tail: string): number | null {\n const lines = block.raw.trimEnd().split('\\n');\n // A header row has a pipe, leading or not, as in marked's table syntax.\n if (!lines[0]!.includes('|')) return null;\n if (lines.length > 2) return null;\n // A second line that has ended, or that can no longer be a delimiter row, made no table.\n if (lines.length === 2 && (tail.endsWith('\\n') || !/^[\\s|:-]*$/.test(lines[1]!))) return null;\n const first = tail.lastIndexOf(lines[0]!.trim());\n return first < 0 ? null : tail.lastIndexOf('\\n', first - 1) + 1;\n}\n\n/**\n * From where in `tail` a bracket starts an unfinished link: a label still open, a label that a\n * target may yet follow, or a target still open. Each has at most one closing bracket after its\n * opening one, so the two last closing brackets in `tail` bound where it can start.\n */\nfunction unfinishedLinksFrom(tail: string): number {\n const close = tail.lastIndexOf(']');\n if (close < 0) return 0;\n const after = tail.slice(close + 1);\n const open = after === '' || after[0] === '[' || (after[0] === '(' && !after.includes(')'));\n return open ? tail.lastIndexOf(']', close - 1) + 1 : close + 1;\n}\n\n/**\n * Where the first unfinished link, code span or emphasis in `inline` starts in `tail`, found in\n * one pass over its text tokens. Cutting at the first, rather than the last, means the source is\n * lexed again only when the cut opens a span that closed after it, not once for each delimiter\n * that never closes.\n */\nfunction heldInline(inline: readonly Token[], tail: string, start: number): number | null {\n const leaves = leavesOf(inline, tail, start);\n const links = unfinishedLinksFrom(tail);\n for (const { raw, at } of leaves) {\n if (at < 0) continue;\n const opener = openerIn(raw, at, tail);\n for (let bracket = raw.indexOf('['); bracket >= 0; bracket = raw.indexOf('[', bracket + 1)) {\n const from = at + bracket;\n if (opener !== null && from > opener) break;\n if (from >= links) return tail[from - 1] === '!' ? from - 1 : from;\n }\n if (opener !== null) return opener;\n }\n return null;\n}\n\n/** Where `tail` is cut so its last block shows nothing half written, or null to show all of it. */\nfunction holdBackAt(tail: string, tokens: readonly Token[]): number | null {\n const block = lastBlock(tokens);\n if (!block) return null;\n if (block.type === 'code') return heldFence(block, tail);\n if (block.type === 'table') return tail.endsWith('\\n') ? null : tail.lastIndexOf('\\n') + 1;\n const header = block.type === 'paragraph' ? heldHeaderRow(block, tail) : null;\n if (header !== null) return header;\n const inline = (block as Tokens.Generic).tokens;\n return inline ? heldInline(inline, tail, floorOf(tail, tokens)) : null;\n}\n\n/**\n * Where the last block starts in `tail`, inside a quote or a list item too, found by its first\n * line since there each source line starts with their markers.\n */\nfunction floorOf(tail: string, tokens: readonly Token[]): number {\n const block = lastBlock(tokens);\n if (!block) return tail.length;\n // Its whole source when that is in the tail as it is, since its first line can come again.\n const whole = tail.lastIndexOf(block.raw.trimEnd());\n return Math.max(0, whole >= 0 ? whole : tail.lastIndexOf(block.raw.split('\\n')[0]!));\n}\n\n/** A line's quote and list item markers, up to where the block they hold starts. */\nconst MARKERS = /^(?:[ \\t]*(?:>|[-+*](?=[ \\t])|\\d{1,9}[.)](?=[ \\t])))*[ \\t]*$/;\n\n/**\n * Where the markers before `at` on its line start, when only markers are before it, or `at`. A\n * block held back whole takes its markers with it, or a list item marker left behind would join\n * the paragraph before it.\n */\nfunction markersStart(tail: string, at: number): number {\n const line = tail.lastIndexOf('\\n', at - 1) + 1;\n return MARKERS.test(tail.slice(line, at)) ? line : at;\n}\n\n/**\n * `tail` lexed, cut back until nothing at its end is half written. Only its last block is cut:\n * once a cut reaches where that block starts, the blocks before it, in its quote or list item\n * too, are drawn as they are.\n */\nfunction lexHeldBack(tail: string, links: Links): { tokens: Token[]; links: Links } {\n let floor: number | undefined;\n for (;;) {\n const lexer = new Lexer();\n Object.assign(lexer.tokens.links, links);\n const tokens = lexer.lex(tail);\n floor ??= floorOf(tail, tokens);\n const cut = floor < tail.length ? holdBackAt(tail, tokens) : null;\n if (cut === null || cut >= tail.length) return { tokens, links: tokens.links };\n tail = tail.slice(0, cut > floor ? cut : markersStart(tail, floor));\n }\n}\n\n/** Adds the link references `token` defines, in a quote or a list item too, as marked does. */\nfunction addDefinitions(token: Token, links: Links) {\n if (token.type === 'def') {\n const def = token as Tokens.Def;\n links[def.tag] ??= { href: def.href, title: def.title };\n }\n const inner =\n token.type === 'list'\n ? (token as Tokens.List).items\n : token.type === 'blockquote' || token.type === 'list_item'\n ? (token as Tokens.Generic).tokens\n : undefined;\n for (const child of inner ?? []) addDefinitions(child, links);\n}\n\nfunction sameLinks(next: Links, previous: Links): boolean {\n const names = Object.keys(next);\n if (names.length !== Object.keys(previous).length) return false;\n return names.every(\n (name) =>\n previous[name]?.href === next[name]!.href && previous[name]?.title === next[name]!.title,\n );\n}\n\n/**\n * Lexes a source that grows, keeping the blocks before the last one from the lex before. A source\n * that does not start with the one before is lexed whole, as is one whose new tail defines a link\n * reference or changes one, since that can change a block already kept.\n */\nexport class MarkdownStream {\n private source = '';\n /** The blocks before the last one, whose raw text is the start of the source exactly. */\n private settled: Token[] = [];\n /** How much of the source the settled blocks are. */\n private settledLength = 0;\n /** The link references the settled blocks define. */\n private settledLinks: Links = {};\n /** The link references the whole source defines. */\n private links: Links = {};\n\n lex(text: string): Token[] {\n const source = text.replace(/\\r\\n?/g, '\\n');\n const grown = source.startsWith(this.source);\n let settled = grown ? this.settled : [];\n let offset = grown ? this.settledLength : 0;\n let links = grown ? this.settledLinks : {};\n let tail = lexHeldBack(source.slice(offset), links);\n if (settled.length && !sameLinks(tail.links, this.links)) {\n settled = [];\n offset = 0;\n links = {};\n tail = lexHeldBack(source, links);\n }\n this.settle(source, settled, offset, links, tail.tokens);\n this.source = source;\n this.links = tail.links;\n return [...settled, ...tail.tokens];\n }\n\n /**\n * Keeps the tail's blocks before its last one as settled, as far as their raw text is the\n * source's: marked trims some blocks' raw text, and the lex after starts again from there.\n */\n private settle(source: string, settled: Token[], offset: number, links: Links, tail: Token[]) {\n const last = lastIndexOfBlock(tail);\n const kept = [...settled];\n const keptLinks = { ...links };\n for (let i = 0; i < last; i++) {\n const token = tail[i]!;\n if (!source.startsWith(token.raw, offset)) break;\n kept.push(token);\n offset += token.raw.length;\n addDefinitions(token, keptLinks);\n }\n this.settled = kept;\n this.settledLength = offset;\n this.settledLinks = keptLinks;\n }\n}\n"]}
1
+ {"version":3,"file":"markdown-stream.js","sourceRoot":"","sources":["../src/markdown-stream.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,EAAE,KAAK,EAA4C,MAAM,QAAQ,CAAC;AAIzE,0EAA0E;AAC1E,SAAS,gBAAgB,CAAC,MAAwB;IAChD,IAAI,EAAE,GAAG,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC;IAC3B,OAAO,EAAE,IAAI,CAAC,IAAI,MAAM,CAAC,EAAE,CAAE,CAAC,IAAI,KAAK,OAAO;QAAE,EAAE,EAAE,CAAC;IACrD,OAAO,EAAE,CAAC;AACZ,CAAC;AAED,8FAA8F;AAC9F,SAAS,SAAS,CAAC,MAAwB;IACzC,MAAM,IAAI,GAAG,MAAM,CAAC,gBAAgB,CAAC,MAAM,CAAC,CAAC,CAAC;IAC9C,IAAI,IAAI,EAAE,IAAI,KAAK,MAAM,EAAE,CAAC;QAC1B,MAAM,IAAI,GAAI,IAAoB,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;QAChD,OAAO,CAAC,IAAI,IAAI,SAAS,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,IAAI,IAAI,CAAC;IAClD,CAAC;IACD,IAAI,IAAI,EAAE,IAAI,KAAK,YAAY;QAAE,OAAO,SAAS,CAAE,IAA0B,CAAC,MAAM,CAAC,IAAI,IAAI,CAAC;IAC9F,OAAO,IAAI,CAAC;AACd,CAAC;AAED,MAAM,UAAU,GAAG,IAAI,CAAC;AACxB,MAAM,IAAI,GAAG,eAAe,CAAC;AAC7B,MAAM,WAAW,GAAG,eAAe,CAAC;AACpC,MAAM,UAAU,GAAG,eAAe,CAAC;AAQnC;;;GAGG;AACH,SAAS,QAAQ,CAAC,MAAwB,EAAE,IAAY,EAAE,IAAY,EAAE,SAAiB,EAAE;IACzF,IAAI,MAAM,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,MAAM,IAAI,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC;YAC3B,cAAc,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC;QACnC,CAAC;QACD,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;QACpB,IAAI,CAAC,aAAa,GAAG,MAAM,CAAC;QAC5B,IAAI,CAAC,YAAY,GAAG,SAAS,CAAC;IAChC,CAAC;CACF","sourcesContent":["/**\n * A Markdown source that grows as it streams in, lexed a chunk at a time: the blocks before the\n * last one are kept, only the last is lexed again, and syntax still open at its end is held back\n * until it closes, so a half-written code span, emphasis, link, image, table row or code fence\n * line never shows as the characters it is written with. A last line of only dashes, `=` or a\n * list marker waits for its end too, since until then it may make the text above a heading, a\n * list or a table.\n *\n * Plain functions and a class with no Angular in them, beside `markdown-blocks.ts`.\n */\nimport { Lexer, type Token, type Tokens, type TokensList } from 'marked';\n\ntype Links = TokensList['links'];\n\n/** Where the last token in `tokens` that is not blank space is, or -1. */\nfunction lastIndexOfBlock(tokens: readonly Token[]): number {\n let at = tokens.length - 1;\n while (at >= 0 && tokens[at]!.type === 'space') at--;\n return at;\n}\n\n/** The last block in `tokens` that is not blank space, inside the last quote or list item. */\nfunction lastBlock(tokens: readonly Token[]): Token | undefined {\n const last = tokens[lastIndexOfBlock(tokens)];\n if (last?.type === 'list') {\n const item = (last as Tokens.List).items.at(-1);\n return (item && lastBlock(item.tokens)) ?? last;\n }\n if (last?.type === 'blockquote') return lastBlock((last as Tokens.Blockquote).tokens) ?? last;\n return last;\n}\n\nconst WHITESPACE = /\\s/;\nconst WORD = /[\\p{L}\\p{N}]/u;\nconst PUNCTUATION = /[\\p{P}\\p{S}]/u;\nconst DELIMITERS = /`+|\\*+|_+|~+/g;\n\n/** A text token marked left as text, and where it is in the tail, or -1 when it was not found. */\ninterface Leaf {\n readonly raw: string;\n readonly at: number;\n}\n\n/**\n * The text tokens in `inline`, in order, each found in `tail` after the one before it, starting\n * from `from`. A link or an image is passed over whole, as it closed.\n */\nfunction leavesOf(inline: readonly Token[], tail: string, from: number, leaves: Leaf[] = []) {\n let cursor = from;\n for (const token of inline) {\n const at = tail.indexOf(token.raw, cursor);\n const children = (token as Tokens.Generic).tokens;\n if (token.type === 'text' && !children?.length) leaves.push({ raw: token.raw, at });\n else if (children && token.type !== 'link' && token.type !== 'image') {\n leavesOf(children, tail, at < 0 ? cursor : at, leaves);\n }\n if (at >= 0) cursor = at + token.raw.length;\n }\n return leaves;\n}\n\n/**\n * Where the first delimiter in a text token at `at` in `tail` is that could still open a code span\n * or an emphasis. A backtick left as text always could. An asterisk, underscore or tilde could\n * when what follows is not a space, or has not arrived yet, and is not punctuation straight after\n * a letter or digit; an underscore inside a word cannot. What is before and after the delimiter\n * is read from `tail`, since a text token can end where another token starts.\n */\nfunction openerIn(raw: string, at: number, tail: string): number | null {\n for (const match of raw.matchAll(DELIMITERS)) {\n const from = at + match.index;\n const next = tail[from + match[0].length];\n if (canOpen(match[0], tail[from - 1], next)) return from;\n }\n return null;\n}\n\n/** Whether a delimiter run, between `before` and `next`, could open a code span or an emphasis. */\nfunction canOpen(run: string, before: string | undefined, next: string | undefined) {\n if (run[0] === '`') return true;\n if (next !== undefined && WHITESPACE.test(next)) return false;\n const afterWord = before !== undefined && WORD.test(before);\n if (afterWord && next !== undefined && PUNCTUATION.test(next)) return false;\n if (run[0] === '_' && afterWord) return false;\n return !(run[0] === '~' && run.length > 2);\n}\n\n/** Where a fenced code block's half-written fence line starts, or null when it has none. */\nfunction heldFence(block: Token, tail: string): number | null {\n const fence = /^ {0,3}(`{3,}|~{3,})/.exec(block.raw);\n if (!fence) return null;\n const lineStart = tail.lastIndexOf('\\n') + 1;\n // An opening fence whose info string is still arriving.\n if (!block.raw.includes('\\n')) return lineStart;\n // A closing fence, or a line of the fence's own marker that may yet grow into one: a run too\n // short to close it can grow only while nothing follows it. The block's own last line, since in\n // a quote or a list item the source line starts with their markers.\n const closing = fence[1]![0] === '`' ? /^ {0,3}(`+)(\\s*)$/ : /^ {0,3}(~+)(\\s*)$/;\n const last = closing.exec(block.raw.slice(block.raw.lastIndexOf('\\n') + 1));\n const grows = last && (!last[2] || last[1]!.length >= fence[1]!.length);\n return grows && !tail.endsWith('\\n') ? lineStart : null;\n}\n\n/**\n * Where a paragraph that starts like a table row starts, while it is a header row whose delimiter\n * row has not arrived, or is arriving, and so a table once it does.\n */\nfunction heldHeaderRow(block: Token, tail: string): number | null {\n const lines = block.raw.trimEnd().split('\\n');\n // A header row has a pipe, leading or not, as in marked's table syntax.\n if (!lines[0]!.includes('|')) return null;\n if (lines.length > 2) return null;\n // A second line that has ended, or that can no longer be a delimiter row, made no table.\n if (lines.length === 2 && (tail.endsWith('\\n') || !/^[\\s|:-]*$/.test(lines[1]!))) return null;\n const first = tail.lastIndexOf(lines[0]!.trim());\n return first < 0 ? null : tail.lastIndexOf('\\n', first - 1) + 1;\n}\n\n/**\n * From where in `tail` a bracket starts an unfinished link: a label still open, a label that a\n * target may yet follow, or a target still open. Each has at most one closing bracket after its\n * opening one, so the two last closing brackets in `tail` bound where it can start.\n */\nfunction unfinishedLinksFrom(tail: string): number {\n const close = tail.lastIndexOf(']');\n if (close < 0) return 0;\n const after = tail.slice(close + 1);\n const open = after === '' || after[0] === '[' || (after[0] === '(' && !after.includes(')'));\n return open ? tail.lastIndexOf(']', close - 1) + 1 : close + 1;\n}\n\n/**\n * Where the first unfinished link, code span or emphasis in `inline` starts in `tail`, found in\n * one pass over its text tokens. Cutting at the first, rather than the last, means the source is\n * lexed again only when the cut opens a span that closed after it, not once for each delimiter\n * that never closes.\n */\nfunction heldInline(inline: readonly Token[], tail: string, start: number): number | null {\n const leaves = leavesOf(inline, tail, start);\n const links = unfinishedLinksFrom(tail);\n for (const { raw, at } of leaves) {\n if (at < 0) continue;\n const opener = openerIn(raw, at, tail);\n for (let bracket = raw.indexOf('['); bracket >= 0; bracket = raw.indexOf('[', bracket + 1)) {\n const from = at + bracket;\n if (opener !== null && from > opener) break;\n if (from >= links) return tail[from - 1] === '!' ? from - 1 : from;\n }\n if (opener !== null) return opener;\n }\n return null;\n}\n\n/**\n * A line of `=`, of dashes with pipes, colons and spaces, or of a lone `+`, `*` or number with\n * `.` or `)`, after any quote markers. Until it ends it may be a setext underline, a list item,\n * a table's delimiter row or a thematic break, and a marker with no text yet is not a list item,\n * so it would draw as text in the paragraph above.\n */\nconst UNDERLINE =\n /^(?:[ \\t]*>)*(?:[ \\t]*=+[ \\t]*|[|: \\t]*-[-|: \\t]*|[ \\t]*(?:[+*]|\\d{1,9}[.)])[ \\t]*)$/;\n\n/** Where `tail` is cut so its last block shows nothing half written, or null to show all of it. */\nfunction holdBackAt(tail: string, tokens: readonly Token[]): number | null {\n const block = lastBlock(tokens);\n if (!block) return null;\n if (block.type === 'code') return heldFence(block, tail);\n const lineStart = tail.lastIndexOf('\\n') + 1;\n if (block.type === 'table') return tail.endsWith('\\n') ? null : lineStart;\n if (UNDERLINE.test(tail.slice(lineStart))) return lineStart;\n const header = block.type === 'paragraph' ? heldHeaderRow(block, tail) : null;\n if (header !== null) return header;\n const inline = (block as Tokens.Generic).tokens;\n return inline ? heldInline(inline, tail, floorOf(tail, tokens)) : null;\n}\n\n/**\n * Where the last block starts in `tail`, inside a quote or a list item too, found by its first\n * line since there each source line starts with their markers.\n */\nfunction floorOf(tail: string, tokens: readonly Token[]): number {\n const block = lastBlock(tokens);\n if (!block) return tail.length;\n // Its whole source when that is in the tail as it is, since its first line can come again.\n const whole = tail.lastIndexOf(block.raw.trimEnd());\n return Math.max(0, whole >= 0 ? whole : tail.lastIndexOf(block.raw.split('\\n')[0]!));\n}\n\n/** A line's quote and list item markers, up to where the block they hold starts. */\nconst MARKERS = /^(?:[ \\t]*(?:>|[-+*](?=[ \\t])|\\d{1,9}[.)](?=[ \\t])))*[ \\t]*$/;\n\n/**\n * Where the markers before `at` on its line start, when only markers are before it, or `at`. A\n * block held back whole takes its markers with it, or a list item marker left behind would join\n * the paragraph before it.\n */\nfunction markersStart(tail: string, at: number): number {\n const line = tail.lastIndexOf('\\n', at - 1) + 1;\n return MARKERS.test(tail.slice(line, at)) ? line : at;\n}\n\n/**\n * `tail` lexed, cut back until nothing at its end is half written. Only its last block is cut:\n * once a cut reaches where that block starts, the blocks before it, in its quote or list item\n * too, are drawn as they are.\n */\nfunction lexHeldBack(tail: string, links: Links): { tokens: Token[]; links: Links } {\n let floor: number | undefined;\n for (;;) {\n const lexer = new Lexer();\n Object.assign(lexer.tokens.links, links);\n const tokens = lexer.lex(tail);\n floor ??= floorOf(tail, tokens);\n const cut = floor < tail.length ? holdBackAt(tail, tokens) : null;\n if (cut === null || cut >= tail.length) return { tokens, links: tokens.links };\n tail = tail.slice(0, cut > floor ? cut : markersStart(tail, floor));\n }\n}\n\n/** Adds the link references `token` defines, in a quote or a list item too, as marked does. */\nfunction addDefinitions(token: Token, links: Links) {\n if (token.type === 'def') {\n const def = token as Tokens.Def;\n links[def.tag] ??= { href: def.href, title: def.title };\n }\n const inner =\n token.type === 'list'\n ? (token as Tokens.List).items\n : token.type === 'blockquote' || token.type === 'list_item'\n ? (token as Tokens.Generic).tokens\n : undefined;\n for (const child of inner ?? []) addDefinitions(child, links);\n}\n\nfunction sameLinks(next: Links, previous: Links): boolean {\n const names = Object.keys(next);\n if (names.length !== Object.keys(previous).length) return false;\n return names.every(\n (name) =>\n previous[name]?.href === next[name]!.href && previous[name]?.title === next[name]!.title,\n );\n}\n\n/**\n * Lexes a source that grows, keeping the blocks before the last one from the lex before. A source\n * that does not start with the one before is lexed whole, as is one whose new tail defines a link\n * reference or changes one, since that can change a block already kept.\n */\nexport class MarkdownStream {\n private source = '';\n /** The blocks before the last one, whose raw text is the start of the source exactly. */\n private settled: Token[] = [];\n /** How much of the source the settled blocks are. */\n private settledLength = 0;\n /** The link references the settled blocks define. */\n private settledLinks: Links = {};\n /** The link references the whole source defines. */\n private links: Links = {};\n\n lex(text: string): Token[] {\n const source = text.replace(/\\r\\n?/g, '\\n');\n const grown = source.startsWith(this.source);\n let settled = grown ? this.settled : [];\n let offset = grown ? this.settledLength : 0;\n let links = grown ? this.settledLinks : {};\n let tail = lexHeldBack(source.slice(offset), links);\n if (settled.length && !sameLinks(tail.links, this.links)) {\n settled = [];\n offset = 0;\n links = {};\n tail = lexHeldBack(source, links);\n }\n this.settle(source, settled, offset, links, tail.tokens);\n this.source = source;\n this.links = tail.links;\n return [...settled, ...tail.tokens];\n }\n\n /**\n * Keeps the tail's blocks before its last one as settled, as far as their raw text is the\n * source's: marked trims some blocks' raw text, and the lex after starts again from there.\n */\n private settle(source: string, settled: Token[], offset: number, links: Links, tail: Token[]) {\n const last = lastIndexOfBlock(tail);\n const kept = [...settled];\n const keptLinks = { ...links };\n for (let i = 0; i < last; i++) {\n const token = tail[i]!;\n if (!source.startsWith(token.raw, offset)) break;\n kept.push(token);\n offset += token.raw.length;\n addDefinitions(token, keptLinks);\n }\n this.settled = kept;\n this.settledLength = offset;\n this.settledLinks = keptLinks;\n }\n}\n"]}
@@ -90,6 +90,8 @@ export declare class Markdown {
90
90
  private readonly injector;
91
91
  /** Which monospace font code is drawn in, as the platform names it. */
92
92
  protected readonly platform: string;
93
+ /** Menlo, which iOS and macOS both have. */
94
+ protected readonly apple: boolean;
93
95
  /** The Markdown to draw. */
94
96
  readonly source: import("@angular/core").InputSignal<string | undefined>;
95
97
  /** Tokens `marked.lexer` made already, drawn in place of `source`. */
package/dist/markdown.js CHANGED
@@ -11,7 +11,7 @@
11
11
  */
12
12
  import { Component, Injector, InjectionToken, booleanAttribute, computed, inject, input, linkedSignal, output, } from '@angular/core';
13
13
  import { DeepLinks } from '@ng-native/device';
14
- import { nativePlatform } from '@ng-native/fabric';
14
+ import { isApplePlatform, nativePlatform } from '@ng-native/fabric';
15
15
  import { lexer } from 'marked';
16
16
  import { Image } from "./image.js";
17
17
  import { blockKey, linkSchemeSet, markdownBlocks, opensOnPress, shareBlocks, } from "./markdown-blocks.js";
@@ -97,6 +97,8 @@ export class Markdown {
97
97
  injector = inject(Injector);
98
98
  /** Which monospace font code is drawn in, as the platform names it. */
99
99
  platform = nativePlatform();
100
+ /** Menlo, which iOS and macOS both have. */
101
+ apple = isApplePlatform();
100
102
  /** The Markdown to draw. */
101
103
  source = input(/* @ts-ignore */
102
104
  ...(ngDevMode ? [undefined, { debugName: "source" }] : /* istanbul ignore next */ []));
@@ -269,7 +271,7 @@ export class Markdown {
269
271
  this.injector.get(DeepLinks).open(link.href);
270
272
  }
271
273
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.2.0", ngImport: i0, type: Markdown, deps: [], target: i0.ɵɵFactoryTarget.Component });
272
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.2.0", type: Markdown, isStandalone: true, selector: "markdown", inputs: { source: { classPropertyName: "source", publicName: "source", isSignal: true, isRequired: false, transformFunction: null }, tokens: { classPropertyName: "tokens", publicName: "tokens", isSignal: true, isRequired: false, transformFunction: null }, streaming: { classPropertyName: "streaming", publicName: "streaming", isSignal: true, isRequired: false, transformFunction: null }, linkSchemes: { classPropertyName: "linkSchemes", publicName: "linkSchemes", isSignal: true, isRequired: false, transformFunction: null }, classes: { classPropertyName: "classes", publicName: "classes", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { linkPress: "linkPress" }, host: { properties: { "class.md-ios": "platform === 'ios'", "class.md-android": "platform === 'android'" } }, ngImport: i0, template: `
274
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.2.0", type: Markdown, isStandalone: true, selector: "markdown", inputs: { source: { classPropertyName: "source", publicName: "source", isSignal: true, isRequired: false, transformFunction: null }, tokens: { classPropertyName: "tokens", publicName: "tokens", isSignal: true, isRequired: false, transformFunction: null }, streaming: { classPropertyName: "streaming", publicName: "streaming", isSignal: true, isRequired: false, transformFunction: null }, linkSchemes: { classPropertyName: "linkSchemes", publicName: "linkSchemes", isSignal: true, isRequired: false, transformFunction: null }, classes: { classPropertyName: "classes", publicName: "classes", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { linkPress: "linkPress" }, host: { properties: { "class.md-ios": "apple", "class.md-android": "platform === 'android'" } }, ngImport: i0, template: `
273
275
  <ng-template #blockTemplate let-list>
274
276
  @for (block of list; track blockKey(block)) {
275
277
  @switch (block.kind) {
@@ -516,7 +518,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.0", ngImpor
516
518
 
517
519
  <ng-container *templateSlot="blockTemplate; context: { $implicit: blocks() }" />
518
520
  `, host: {
519
- '[class.md-ios]': "platform === 'ios'",
521
+ '[class.md-ios]': 'apple',
520
522
  '[class.md-android]': "platform === 'android'",
521
523
  }, styles: ["/* What a document looks like with no `classes` of the app's, in light and in dark. */\n\n:host {\n gap: 12px;\n color: #1c1c1e;\n}\n\n.md-h1,\n.md-h2,\n.md-h3,\n.md-h4,\n.md-h5,\n.md-h6 {\n font-weight: 700;\n}\n\n.md-h1 {\n font-size: 28px;\n line-height: 34px;\n}\n\n.md-h2 {\n font-size: 22px;\n line-height: 28px;\n}\n\n.md-h3 {\n font-size: 20px;\n line-height: 25px;\n}\n\n.md-h4 {\n font-size: 17px;\n line-height: 22px;\n}\n\n.md-h5 {\n font-size: 15px;\n line-height: 20px;\n}\n\n.md-h6 {\n font-size: 13px;\n line-height: 18px;\n color: #6c6c70;\n}\n\n.md-p,\n.md-marker,\n.md-th,\n.md-td {\n font-size: 16px;\n line-height: 23px;\n}\n\n.md-strong {\n font-weight: 700;\n}\n\n.md-em {\n font-style: italic;\n}\n\n.md-del {\n text-decoration-line: line-through;\n}\n\n.md-a {\n color: #0a66d8;\n text-decoration-line: underline;\n}\n\n.md-code {\n background-color: rgba(120, 120, 128, 0.16);\n}\n\n.md-code,\n.md-pre {\n font-family: Courier New;\n}\n\n:host(.md-ios) .md-code,\n:host(.md-ios) .md-pre {\n font-family: Menlo;\n}\n\n:host(.md-android) .md-code,\n:host(.md-android) .md-pre {\n font-family: monospace;\n}\n\n.md-blockquote {\n gap: 8px;\n padding-left: 12px;\n border-left-width: 3px;\n border-left-color: #d1d1d6;\n color: #6c6c70;\n}\n\n.md-ul,\n.md-ol {\n gap: 4px;\n}\n\n.md-li {\n flex-direction: row;\n gap: 8px;\n}\n\n.md-marker {\n min-width: 16px;\n}\n\n.md-li-body {\n flex: 1;\n gap: 4px;\n}\n\n.md-pre {\n flex-grow: 0;\n border-radius: 8px;\n background-color: #f2f2f7;\n}\n\n.md-pre-text {\n padding: 12px;\n font-size: 14px;\n line-height: 20px;\n}\n\n.md-hr {\n height: 1px;\n background-color: #d1d1d6;\n}\n\n.md-img {\n width: var(--md-img-width, 100%);\n max-width: 100%;\n height: 200px;\n border-radius: 8px;\n}\n\n.md-table {\n border-width: 1px;\n border-color: #d1d1d6;\n border-radius: 8px;\n overflow: hidden;\n}\n\n.md-tr {\n flex-direction: row;\n}\n\n/* The text hugs its content inside the column's least width, so it can report a narrower one. */\n.md-cell {\n align-items: flex-start;\n}\n\n.md-th,\n.md-td {\n max-width: 280px;\n padding: 6px 8px;\n}\n\n.md-cell-body {\n border-top-width: 1px;\n border-top-color: #d1d1d6;\n}\n\n.md-th {\n font-weight: 600;\n}\n\n@media (prefers-color-scheme: dark) {\n :host {\n color: #f2f2f7;\n }\n\n .md-h6,\n .md-blockquote {\n color: #98989f;\n }\n\n .md-a {\n color: #4c9bff;\n }\n\n .md-code {\n background-color: rgba(120, 120, 128, 0.32);\n }\n\n .md-pre {\n background-color: #1c1c1e;\n }\n\n .md-blockquote,\n .md-table,\n .md-cell-body {\n border-color: #38383a;\n }\n\n .md-hr {\n background-color: #38383a;\n }\n}\n"] }]
522
524
  }], propDecorators: { source: [{ type: i0.Input, args: [{ isSignal: true, alias: "source", required: false }] }], tokens: [{ type: i0.Input, args: [{ isSignal: true, alias: "tokens", required: false }] }], streaming: [{ type: i0.Input, args: [{ isSignal: true, alias: "streaming", required: false }] }], linkSchemes: [{ type: i0.Input, args: [{ isSignal: true, alias: "linkSchemes", required: false }] }], classes: [{ type: i0.Input, args: [{ isSignal: true, alias: "classes", required: false }] }], linkPress: [{ type: i0.Output, args: ["linkPress"] }] } });