@ng-native/components 0.28.0 → 0.30.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/android/src/main/java/dev/ngnative/components/ColorSchemeModule.kt +116 -11
- package/dist/activity-indicator.js +3 -3
- package/dist/animated-style.js +3 -3
- package/dist/animations-web.js +3 -3
- package/dist/animations.js +3 -3
- package/dist/content-container.js +3 -3
- package/dist/context-menu.js +3 -3
- package/dist/drag-and-drop.js +6 -6
- package/dist/gestures-web.js +6 -6
- package/dist/gestures.js +6 -6
- package/dist/gradient-text.d.ts +1 -1
- package/dist/gradient-text.js +4 -4
- package/dist/gradient-text.js.map +1 -1
- package/dist/image-background.js +3 -3
- package/dist/image.js +3 -3
- package/dist/index.d.ts +3 -2
- package/dist/index.js +3 -2
- package/dist/index.js.map +1 -1
- package/dist/input-accessory-view.js +3 -3
- package/dist/keyboard-avoiding-view.js +3 -3
- package/dist/keyboard-dock.js +15 -15
- package/dist/markdown-blocks.d.ts +2 -1
- package/dist/markdown-blocks.js +22 -18
- package/dist/markdown-blocks.js.map +1 -1
- package/dist/markdown-columns.js +3 -3
- package/dist/markdown-stream.js +8 -5
- package/dist/markdown-stream.js.map +1 -1
- package/dist/markdown.js +5 -5
- package/dist/markdown.js.map +1 -1
- package/dist/menu.d.ts +11 -5
- package/dist/menu.js +24 -44
- package/dist/menu.js.map +1 -1
- package/dist/modal.js +8 -3
- package/dist/modal.js.map +1 -1
- package/dist/native-button.d.ts +25 -3
- package/dist/native-button.js +102 -8
- package/dist/native-button.js.map +1 -1
- package/dist/native-gesture.js +3 -3
- package/dist/native-ref.js +3 -3
- package/dist/press-menu.d.ts +38 -8
- package/dist/press-menu.js +80 -19
- package/dist/press-menu.js.map +1 -1
- package/dist/pressable.js +14 -13
- package/dist/pressable.js.map +1 -1
- package/dist/reanimated-web.js +6 -6
- package/dist/reanimated.js +6 -6
- package/dist/refresh-control.js +3 -3
- package/dist/safe-area-provider.js +3 -3
- package/dist/safe-area-view.js +3 -3
- package/dist/scroll-view-props.js +3 -3
- package/dist/scroll-view.d.ts +3 -1
- package/dist/scroll-view.js +10 -5
- package/dist/scroll-view.js.map +1 -1
- package/dist/section-list.d.ts +4 -4
- package/dist/section-list.js +37 -34
- package/dist/section-list.js.map +1 -1
- package/dist/shortcut.js +3 -3
- package/dist/sidebar-item.js +3 -3
- package/dist/sidebar-section.d.ts +12 -5
- package/dist/sidebar-section.js +32 -12
- package/dist/sidebar-section.js.map +1 -1
- package/dist/sidebar.d.ts +11 -3
- package/dist/sidebar.js +18 -8
- package/dist/sidebar.js.map +1 -1
- package/dist/split-view.d.ts +23 -2
- package/dist/split-view.js +36 -9
- package/dist/split-view.js.map +1 -1
- package/dist/stand-ins/animations.js +3 -3
- package/dist/sticky-headers.d.ts +19 -0
- package/dist/sticky-headers.js +67 -10
- package/dist/sticky-headers.js.map +1 -1
- package/dist/sticky-rows.d.ts +13 -11
- package/dist/sticky-rows.js +35 -21
- package/dist/sticky-rows.js.map +1 -1
- package/dist/svg-icon.d.ts +16 -2
- package/dist/svg-icon.js +19 -3
- package/dist/svg-icon.js.map +1 -1
- package/dist/switch.js +3 -3
- package/dist/template-slot.js +3 -3
- package/dist/text-input.js +3 -3
- package/dist/text.js +3 -3
- package/dist/touchable-opacity.js +3 -3
- package/dist/tray-icon.d.ts +7 -1
- package/dist/tray-icon.js +17 -5
- package/dist/tray-icon.js.map +1 -1
- package/dist/view-base.d.ts +18 -2
- package/dist/view-base.js +42 -10
- package/dist/view-base.js.map +1 -1
- package/dist/view.js +3 -3
- package/dist/virtual-list-layout.d.ts +5 -0
- package/dist/virtual-list-layout.js.map +1 -1
- package/dist/virtual-list-num-columns.d.ts +8 -4
- package/dist/virtual-list-num-columns.js +13 -5
- package/dist/virtual-list-num-columns.js.map +1 -1
- package/dist/virtual-list-sticky-level.d.ts +0 -6
- package/dist/virtual-list-sticky-level.js +5 -29
- package/dist/virtual-list-sticky-level.js.map +1 -1
- package/dist/virtual-list.d.ts +72 -11
- package/dist/virtual-list.js +285 -74
- package/dist/virtual-list.js.map +1 -1
- package/dist/visual-effect.d.ts +37 -0
- package/dist/visual-effect.js +60 -0
- package/dist/visual-effect.js.map +1 -0
- package/dist/worklet-scroll.js +3 -3
- package/dist/worklet-style.js +3 -3
- package/dist/written-props.js +9 -0
- package/dist/written-props.js.map +1 -1
- package/ios/NgNativeButtonComponentView.mm +8 -4
- package/ios/NgNativeButtonMetrics.h +9 -2
- package/ios/NgNativeButtonMetrics.mm +33 -4
- package/ios/NgNativeButtonShadowNode.h +2 -0
- package/ios/NgNativeButtonShadowNode.mm +5 -1
- package/ios/NgNativeComponents.podspec +2 -2
- package/ios/NgNativeKeyboardFocus.h +21 -0
- package/ios/NgNativeKeyboardFocus.mm +28 -0
- package/ios/NgNativeKeyboardFocusModule.mm +203 -0
- package/ios/NgNativeMenus.mm +62 -2
- package/ios/NgNativePressMenu.h +36 -0
- package/ios/NgNativePressMenu.mm +79 -0
- package/ios/NgNativeViewBinder.h +5 -0
- package/ios/NgNativeViewBinder.mm +31 -4
- package/package.json +6 -6
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,EA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a,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,EAAE,mBAAmB,EAA0B,MAAM,0BAA0B,CAAC;AACvF,OAAO,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AACtE,OAAO,EAAE,mBAAmB,EAA0B,MAAM,0BAA0B,CAAC;AACvF,OAAO,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AACxE,OAAO,EAA6D,MAAM,sBAAsB,CAAC;AACjG,OAAO,EACL,aAAa,EACb,YAAY,GAMb,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,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 { PRESS_MENU, PressMenu } from './press-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 {\n SplitView,\n SplitViewContent,\n type SplitViewContentStyle,\n type SplitViewShowing,\n} 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 {\n VisualEffect,\n type VisualEffectBlendingMode,\n type VisualEffectMaterial,\n type VisualEffectState,\n} from './visual-effect.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 flattenSections,\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 { VIRTUAL_LIST_LAYOUT, type VirtualListLayout } from './virtual-list-layout.ts';\nexport { VirtualListNumColumns } from './virtual-list-num-columns.ts';\nexport { VIRTUAL_LIST_STICKY, type VirtualListSticky } from './virtual-list-sticky.ts';\nexport { VirtualListStickyLevel } from './virtual-list-sticky-level.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';\nexport { releaseOnDestroy } from './release-on-destroy.ts';\n"]}
|
|
@@ -13,10 +13,10 @@ export class InputAccessoryView extends ViewBase {
|
|
|
13
13
|
/** The bar's background. */
|
|
14
14
|
backgroundColor = input(/* @ts-ignore */
|
|
15
15
|
...(ngDevMode ? [undefined, { debugName: "backgroundColor" }] : /* istanbul ignore next */ []));
|
|
16
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.
|
|
17
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.
|
|
16
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.3.0", ngImport: i0, type: InputAccessoryView, deps: null, target: i0.ɵɵFactoryTarget.Directive });
|
|
17
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.3.0", type: InputAccessoryView, isStandalone: true, selector: "input-accessory-view", inputs: { backgroundColor: { classPropertyName: "backgroundColor", publicName: "backgroundColor", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "backgroundColor": "backgroundColor()", "style.position": "\"absolute\"" } }, usesInheritance: true, ngImport: i0 });
|
|
18
18
|
}
|
|
19
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.
|
|
19
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.3.0", ngImport: i0, type: InputAccessoryView, decorators: [{
|
|
20
20
|
type: Directive,
|
|
21
21
|
args: [{
|
|
22
22
|
selector: 'input-accessory-view',
|
|
@@ -163,8 +163,8 @@ export class KeyboardAvoidingView extends ViewBase {
|
|
|
163
163
|
this.engine.measure(this.node, (frame) => (top = frame.y));
|
|
164
164
|
return top;
|
|
165
165
|
}
|
|
166
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.
|
|
167
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.
|
|
166
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.3.0", ngImport: i0, type: KeyboardAvoidingView, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
167
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.3.0", type: KeyboardAvoidingView, isStandalone: true, selector: "keyboard-avoiding-view", inputs: { behavior: { classPropertyName: "behavior", publicName: "behavior", isSignal: true, isRequired: false, transformFunction: null }, contentContainerStyle: { classPropertyName: "contentContainerStyle", publicName: "contentContainerStyle", isSignal: true, isRequired: false, transformFunction: null }, contentContainerClass: { classPropertyName: "contentContainerClass", publicName: "contentContainerClass", isSignal: true, isRequired: false, transformFunction: null }, enabled: { classPropertyName: "enabled", publicName: "enabled", isSignal: true, isRequired: false, transformFunction: null }, keyboardVerticalOffset: { classPropertyName: "keyboardVerticalOffset", publicName: "keyboardVerticalOffset", isSignal: true, isRequired: false, transformFunction: null } }, host: { listeners: { "layout": "onLayout($event)" }, properties: { "styleOverride": "avoidance()" } }, usesInheritance: true, ngImport: i0, template: `
|
|
168
168
|
@if (behavior() === 'position') {
|
|
169
169
|
<view
|
|
170
170
|
[contentContainerOf]="node"
|
|
@@ -177,7 +177,7 @@ export class KeyboardAvoidingView extends ViewBase {
|
|
|
177
177
|
}
|
|
178
178
|
`, isInline: true, dependencies: [{ kind: "directive", type: ContentContainer, selector: "[contentContainerOf]", inputs: ["contentContainerOf", "contentContainerClass"] }, { kind: "directive", type: View, selector: "view" }] });
|
|
179
179
|
}
|
|
180
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.
|
|
180
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.3.0", ngImport: i0, type: KeyboardAvoidingView, decorators: [{
|
|
181
181
|
type: Component,
|
|
182
182
|
args: [{
|
|
183
183
|
selector: 'keyboard-avoiding-view',
|
package/dist/keyboard-dock.js
CHANGED
|
@@ -38,10 +38,10 @@ export class KeyboardControllerView {
|
|
|
38
38
|
registerViewName('keyboard-controller-view', 'KeyboardControllerView');
|
|
39
39
|
claimHost(inject(ElementRef).nativeElement);
|
|
40
40
|
}
|
|
41
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.
|
|
42
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.
|
|
41
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.3.0", ngImport: i0, type: KeyboardControllerView, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
42
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.3.0", type: KeyboardControllerView, isStandalone: true, selector: "keyboard-controller-view", host: { properties: { "enabled": "true" } }, ngImport: i0 });
|
|
43
43
|
}
|
|
44
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.
|
|
44
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.3.0", ngImport: i0, type: KeyboardControllerView, decorators: [{
|
|
45
45
|
type: Directive,
|
|
46
46
|
args: [{
|
|
47
47
|
selector: 'keyboard-controller-view',
|
|
@@ -59,10 +59,10 @@ export class KeyboardMotionView {
|
|
|
59
59
|
registerViewName('keyboard-motion-view', motion.viewName);
|
|
60
60
|
claimHost(inject(ElementRef).nativeElement);
|
|
61
61
|
}
|
|
62
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.
|
|
63
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.
|
|
62
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.3.0", ngImport: i0, type: KeyboardMotionView, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
63
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.3.0", type: KeyboardMotionView, isStandalone: true, selector: "keyboard-motion-view", ngImport: i0 });
|
|
64
64
|
}
|
|
65
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.
|
|
65
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.3.0", ngImport: i0, type: KeyboardMotionView, decorators: [{
|
|
66
66
|
type: Directive,
|
|
67
67
|
args: [{ selector: 'keyboard-motion-view' }]
|
|
68
68
|
}], ctorParameters: () => [] });
|
|
@@ -79,10 +79,10 @@ export class KeyboardGestureArea {
|
|
|
79
79
|
registerViewName('keyboard-gesture-area', 'KeyboardGestureArea');
|
|
80
80
|
claimHost(inject(ElementRef).nativeElement);
|
|
81
81
|
}
|
|
82
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.
|
|
83
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.
|
|
82
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.3.0", ngImport: i0, type: KeyboardGestureArea, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
83
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.3.0", type: KeyboardGestureArea, isStandalone: true, selector: "keyboard-gesture-area", inputs: { offset: { classPropertyName: "offset", publicName: "offset", isSignal: true, isRequired: false, transformFunction: null }, textInputNativeID: { classPropertyName: "textInputNativeID", publicName: "textInputNativeID", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "offset": "offset()", "textInputNativeID": "textInputNativeID()" } }, ngImport: i0 });
|
|
84
84
|
}
|
|
85
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.
|
|
85
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.3.0", ngImport: i0, type: KeyboardGestureArea, decorators: [{
|
|
86
86
|
type: Directive,
|
|
87
87
|
args: [{
|
|
88
88
|
selector: 'keyboard-gesture-area',
|
|
@@ -254,8 +254,8 @@ export class KeyboardDock extends ViewBase {
|
|
|
254
254
|
return;
|
|
255
255
|
this.engine.measure(this.node, (frame) => this.bottomEdge.set(frame.y + frame.height));
|
|
256
256
|
}
|
|
257
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.
|
|
258
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.
|
|
257
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.3.0", ngImport: i0, type: KeyboardDock, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
258
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.3.0", type: KeyboardDock, isStandalone: true, selector: "keyboard-dock", inputs: { backgroundColor: { classPropertyName: "backgroundColor", publicName: "backgroundColor", isSignal: true, isRequired: false, transformFunction: null } }, host: { listeners: { "layout": "onLayout()" }, properties: { "style.paddingBottom": "padding()", "style.backgroundColor": "backgroundColor()" } }, queries: [{ propertyName: "field", first: true, predicate: TextInput, descendants: true, read: ElementRef, isSignal: true }, { propertyName: "fieldInput", first: true, predicate: TextInput, descendants: true, isSignal: true }], exportAs: ["keyboardDock"], usesInheritance: true, ngImport: i0, template: `
|
|
259
259
|
<ng-template #content><ng-content /></ng-template>
|
|
260
260
|
@if (lifts) {
|
|
261
261
|
@if (motion) {
|
|
@@ -287,7 +287,7 @@ export class KeyboardDock extends ViewBase {
|
|
|
287
287
|
}
|
|
288
288
|
`, isInline: true, dependencies: [{ kind: "directive", type: KeyboardControllerView, selector: "keyboard-controller-view" }, { kind: "directive", type: KeyboardGestureArea, selector: "keyboard-gesture-area", inputs: ["offset", "textInputNativeID"] }, { kind: "directive", type: KeyboardMotionView, selector: "keyboard-motion-view" }, { kind: "directive", type: TemplateSlot, selector: "[templateSlot]", inputs: ["templateSlot", "templateSlotContext"] }, { kind: "directive", type: View, selector: "view" }] });
|
|
289
289
|
}
|
|
290
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.
|
|
290
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.3.0", ngImport: i0, type: KeyboardDock, decorators: [{
|
|
291
291
|
type: Component,
|
|
292
292
|
args: [{
|
|
293
293
|
selector: 'keyboard-dock',
|
|
@@ -368,10 +368,10 @@ export class KeyboardLift {
|
|
|
368
368
|
});
|
|
369
369
|
inject(DestroyRef).onDestroy(() => drive?.stop());
|
|
370
370
|
}
|
|
371
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.
|
|
372
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.
|
|
371
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.3.0", ngImport: i0, type: KeyboardLift, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
372
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.3.0", type: KeyboardLift, isStandalone: true, selector: "[keyboardLift]", inputs: { dock: { classPropertyName: "dock", publicName: "keyboardLift", isSignal: true, isRequired: true, transformFunction: null } }, host: { properties: { "style.paddingBottom": "padding()" } }, ngImport: i0 });
|
|
373
373
|
}
|
|
374
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.
|
|
374
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.3.0", ngImport: i0, type: KeyboardLift, decorators: [{
|
|
375
375
|
type: Directive,
|
|
376
376
|
args: [{
|
|
377
377
|
selector: '[keyboardLift]',
|
|
@@ -104,6 +104,7 @@ export declare function blockKey(block: MarkdownBlock): number;
|
|
|
104
104
|
* `next`, with every part of it that equals the same part of `previous` replaced by that part, so
|
|
105
105
|
* a block that did not change is the object drawn already and is not drawn again. The two are
|
|
106
106
|
* matched from each end, so a block added or removed in the middle leaves those either side of it
|
|
107
|
-
* kept; what is left between is matched by position.
|
|
107
|
+
* kept; what is left between is matched by position. Only that last match keeps a part that
|
|
108
|
+
* changed, so no part of `previous` is matched with two of `next` and no two blocks share a key.
|
|
108
109
|
*/
|
|
109
110
|
export declare function shareBlocks(previous: readonly MarkdownBlock[] | undefined, next: readonly MarkdownBlock[]): readonly MarkdownBlock[];
|
package/dist/markdown-blocks.js
CHANGED
|
@@ -276,7 +276,8 @@ export function blockKey(block) {
|
|
|
276
276
|
* `next`, with every part of it that equals the same part of `previous` replaced by that part, so
|
|
277
277
|
* a block that did not change is the object drawn already and is not drawn again. The two are
|
|
278
278
|
* matched from each end, so a block added or removed in the middle leaves those either side of it
|
|
279
|
-
* kept; what is left between is matched by position.
|
|
279
|
+
* kept; what is left between is matched by position. Only that last match keeps a part that
|
|
280
|
+
* changed, so no part of `previous` is matched with two of `next` and no two blocks share a key.
|
|
280
281
|
*/
|
|
281
282
|
export function shareBlocks(previous, next) {
|
|
282
283
|
return previous ? share(previous, next) : next;
|
|
@@ -296,30 +297,33 @@ function shareArray(previous, next) {
|
|
|
296
297
|
const out = next.slice();
|
|
297
298
|
// Each pair is compared once: the passes below meet at the same position, and comparing a
|
|
298
299
|
// changed block again in each of them made a nested one cost three times as much a level.
|
|
299
|
-
const compared = new
|
|
300
|
+
const compared = new Map();
|
|
300
301
|
const shareAt = (was, at) => {
|
|
301
|
-
if (was
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
compared.
|
|
305
|
-
|
|
306
|
-
|
|
302
|
+
if (was !== at)
|
|
303
|
+
return share(previous[was], next[at]);
|
|
304
|
+
if (!compared.has(at))
|
|
305
|
+
compared.set(at, share(previous[at], next[at]));
|
|
306
|
+
return compared.get(at);
|
|
307
|
+
};
|
|
308
|
+
const keepAt = (was, at) => {
|
|
309
|
+
const kept = shareAt(was, at);
|
|
310
|
+
if (kept !== previous[was])
|
|
311
|
+
return false;
|
|
312
|
+
out[at] = kept;
|
|
313
|
+
return true;
|
|
307
314
|
};
|
|
308
315
|
let start = 0;
|
|
309
|
-
while (start < out.length && start < previous.length)
|
|
310
|
-
if (shareAt(start, start) !== previous[start])
|
|
311
|
-
break;
|
|
316
|
+
while (start < out.length && start < previous.length && keepAt(start, start))
|
|
312
317
|
start++;
|
|
313
|
-
}
|
|
314
318
|
let end = 0;
|
|
315
|
-
while (end < out.length - start &&
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
break;
|
|
319
|
+
while (end < out.length - start &&
|
|
320
|
+
end < previous.length - start &&
|
|
321
|
+
keepAt(previous.length - 1 - end, out.length - 1 - end)) {
|
|
319
322
|
end++;
|
|
320
323
|
}
|
|
321
|
-
for (let i = start; i < out.length - end && i < previous.length - end; i++)
|
|
322
|
-
shareAt(i, i);
|
|
324
|
+
for (let i = start; i < out.length - end && i < previous.length - end; i++) {
|
|
325
|
+
out[i] = shareAt(i, i);
|
|
326
|
+
}
|
|
323
327
|
const same = out.length === previous.length && out.every((one, i) => one === previous[i]);
|
|
324
328
|
return same ? previous : out;
|
|
325
329
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"markdown-blocks.js","sourceRoot":"","sources":["../src/markdown-blocks.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,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AAG,IAAI,CAAC;IACnB,CAAC;IACD,IAAI,IAAI;QAAE,OAAO,QAAQ,CAAC;IAC1B,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;IAC/B,IAAI,GAAG,KAAK,SAAS;QAAE,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;IAC1C,OAAO,GAAG,CAAC;AACb,CAAC","sourcesContent":["/**\n * Marked's tokens, turned into the blocks `<markdown>` draws: the entities decoded, the links and\n * images held to the schemes they may use, raw HTML made plain text, and an image lifted out of\n * its paragraph, since a `<text>` cannot hold one.\n *\n * Plain functions with no Angular in them, so the policy is the same wherever the tokens came from:\n * `marked.lexer` on the device, or a build step that lexed them ahead of time.\n */\nimport type { Token, Tokens } from 'marked';\nimport { HTML_ENTITIES } from './html-entities.ts';\n\n/** The elements a document is drawn with, by the HTML names the Markdown would have produced. */\nexport type MarkdownElement =\n | 'h1'\n | 'h2'\n | 'h3'\n | 'h4'\n | 'h5'\n | 'h6'\n | 'p'\n | 'blockquote'\n | 'ul'\n | 'ol'\n | 'li'\n | 'marker'\n | 'pre'\n | 'code'\n | 'strong'\n | 'em'\n | 'del'\n | 'a'\n | 'hr'\n | 'img'\n | 'table'\n | 'tr'\n | 'th'\n | 'td';\n\nexport type MarkdownInline =\n | { readonly kind: 'text'; readonly text: string }\n | { readonly kind: 'strong' | 'em' | 'del'; readonly children: readonly MarkdownInline[] }\n | { readonly kind: 'code'; readonly text: string }\n | {\n readonly kind: 'link';\n readonly href: string;\n readonly title: string | null;\n readonly children: readonly MarkdownInline[];\n };\n\nexport interface MarkdownListItem {\n readonly marker: string;\n readonly children: readonly MarkdownBlock[];\n}\n\nexport type MarkdownBlock =\n | {\n readonly kind: 'heading';\n readonly element: 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';\n readonly children: readonly MarkdownInline[];\n }\n | { readonly kind: 'paragraph'; readonly children: readonly MarkdownInline[] }\n | { readonly kind: 'image'; readonly src: string; readonly alt: string }\n | { readonly kind: 'blockquote'; readonly children: readonly MarkdownBlock[] }\n | {\n readonly kind: 'list';\n readonly element: 'ul' | 'ol';\n readonly items: readonly MarkdownListItem[];\n }\n | { readonly kind: 'code'; readonly text: string }\n | { readonly kind: 'hr' }\n | {\n readonly kind: 'table';\n readonly header: readonly (readonly MarkdownInline[])[];\n readonly rows: readonly (readonly (readonly MarkdownInline[])[])[];\n };\n\nlet namedEntities: Map<string, string> | undefined;\n\n/** The character HTML names `name`, from its full table, built on the first name looked up. */\nfunction namedEntity(name: string): string | undefined {\n if (!namedEntities) {\n namedEntities = new Map();\n const pairs = HTML_ENTITIES.split(' ');\n for (let i = 0; i + 1 < pairs.length; i += 2) namedEntities.set(pairs[i]!, pairs[i + 1]!);\n }\n return namedEntities.get(name);\n}\n\nconst ENTITY = /&(?:#(\\d{1,7})|#[xX]([0-9a-fA-F]{1,6})|([a-zA-Z][a-zA-Z0-9]{1,31}));/g;\n\n/**\n * The text an HTML reader would show for `text`, in one pass so `&lt;` is `<` and not `<`.\n * A reference to no character, or to one outside Unicode, is the replacement character, as HTML\n * makes it; a name HTML does not have stays as written.\n */\nexport function decodeEntities(text: string): string {\n if (!text.includes('&')) return text;\n return text.replace(ENTITY, (whole, decimal?: string, hex?: string, name?: string) => {\n if (name !== undefined) return namedEntity(name) ?? whole;\n const code = decimal !== undefined ? Number(decimal) : parseInt(hex!, 16);\n const valid = code > 0 && code <= 0x10ffff && (code < 0xd800 || code > 0xdfff);\n return valid ? String.fromCodePoint(code) : '�';\n });\n}\n\n/**\n * What a URL parser ignores while it reads a scheme: the C0 controls and the space, and the C1\n * controls and DEL beside them. `java\\tscript:` is `javascript:` to the thing that opens it.\n */\nconst IGNORED_IN_SCHEME = /[\\u0000- \\u007f-\\u009f]/g;\nconst SCHEME = /^([a-z][a-z0-9+.-]*):/;\n\n/** The scheme `url` would be opened with, lowercased, or null for a relative one. */\nexport function schemeOf(url: string): string | null {\n return SCHEME.exec(url.replace(IGNORED_IN_SCHEME, '').toLowerCase())?.[1] ?? null;\n}\n\nconst LINK_SCHEMES = new Set(['http', 'https', 'mailto', 'tel']);\nconst IMAGE_SCHEMES = new Set(['http', 'https']);\n\n/** The schemes an app lists for `<markdown>` to draw links in, lowercased. See {@link linkSchemeSet}. */\nexport type AppLinkSchemes = ReadonlySet<string>;\n\n/** No app scheme: what a document is drawn with when the app lists none. */\nexport const NO_APP_SCHEMES: AppLinkSchemes = new Set();\n\nconst SCHEME_NAME = /^[a-z][a-z0-9+.-]*$/;\n\n/**\n * The set of schemes an app lists, as {@link linkTarget} reads them. Each is trimmed, lowercased\n * and stripped of one trailing colon, so `'MyApp:'` and `'myapp'` are the same; an entry that\n * cannot be a scheme is dropped.\n */\nexport function linkSchemeSet(schemes: readonly string[]): AppLinkSchemes {\n const set = new Set<string>();\n for (const one of schemes) {\n const name = one.trim().toLowerCase().replace(/:$/, '');\n if (SCHEME_NAME.test(name)) set.add(name);\n }\n return set.size ? set : NO_APP_SCHEMES;\n}\n\n/**\n * A link's target if it may be drawn as a link: `http`, `https`, `mailto`, `tel`, a scheme the app\n * listed in `appSchemes`, or relative, which is the app's to resolve. Anything else,\n * `javascript:`, `data:`, `vbscript:` and `file:` among them, is null, and the link is drawn as\n * its text. The scheme is read after the trim, so whitespace the trim strips cannot hide one.\n */\nexport function linkTarget(\n href: string,\n appSchemes: AppLinkSchemes = NO_APP_SCHEMES,\n): string | null {\n const target = href.trim();\n const scheme = schemeOf(target);\n return scheme === null || LINK_SCHEMES.has(scheme) || appSchemes.has(scheme) ? target : null;\n}\n\n/**\n * Whether `href` is absolute in one of the built-in schemes a link is followed to, and so is\n * opened on press. A scheme the app listed is drawn as a link but never opens here.\n */\nexport function opensOnPress(href: string): boolean {\n const scheme = schemeOf(href.trim());\n return scheme !== null && LINK_SCHEMES.has(scheme);\n}\n\n/**\n * An image's address if it may be loaded: `http`, `https`, or a picture written into the document\n * as a `data:` url of a raster type. A pasted screenshot arrives that way from a web editor, and\n * a native image only decodes such a picture: nothing in it runs. Any other `data:` url, an SVG\n * or HTML among them, is refused, as is every other scheme.\n */\nexport function imageSource(href: string): string | null {\n const source = href.trim();\n const scheme = schemeOf(source);\n if (scheme === null) return null;\n if (IMAGE_SCHEMES.has(scheme)) return source;\n if (scheme !== 'data') return null;\n // A native loader may not decode a url with whitespace in it, so a wrapped payload is joined.\n const joined = source.replace(/\\s+/g, '');\n return DATA_IMAGE.test(joined) ? joined : null;\n}\n\n/** A base64 `data:` url of a raster picture: PNG, JPEG, GIF or WebP. */\nconst DATA_IMAGE = /^data:image\\/(?:png|jpe?g|gif|webp);base64,[a-z0-9+/=]+$/i;\n\n/** A link's or an image's target with its entities decoded, or null when it is not a string. */\nfunction hrefOf(token: Token): string | null {\n const href: unknown = (token as Tokens.Link).href;\n return typeof href === 'string' ? decodeEntities(href) : null;\n}\n\nconst HEADINGS = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6'] as const;\n\n/** The blocks a document of `tokens` is drawn as, with links in `appSchemes` drawn as links too. */\nexport function markdownBlocks(\n tokens: readonly Token[],\n appSchemes: AppLinkSchemes = NO_APP_SCHEMES,\n): MarkdownBlock[] {\n return tokens.flatMap((token) => block(token, appSchemes));\n}\n\n/** What each kind of block token is drawn as. A kind not here is drawn as its source text. */\nconst BLOCKS: Readonly<Record<string, (token: Token, app: AppLinkSchemes) => MarkdownBlock[]>> = {\n heading: (token, app) => {\n const heading = token as Tokens.Heading;\n const depth = Math.min(Math.max(heading.depth, 1), 6);\n const children = trimmedEnd(inlines(heading.tokens, app));\n return [{ kind: 'heading', element: HEADINGS[depth - 1]!, children }];\n },\n paragraph: (token, app) => paragraphs((token as Tokens.Paragraph).tokens, app),\n text: (token, app) => {\n const text = token as Tokens.Text;\n return text.tokens\n ? paragraphs(text.tokens, app)\n : [{ kind: 'paragraph', children: [plain(softBreaks(text.text))] }];\n },\n blockquote: (token, app) => [\n { kind: 'blockquote', children: markdownBlocks((token as Tokens.Blockquote).tokens, app) },\n ],\n list: (token, app) => [list(token as Tokens.List, app)],\n code: (token) => [{ kind: 'code', text: indented((token as Tokens.Code).text) }],\n hr: () => [{ kind: 'hr' }],\n table: (token, app) => {\n const table = token as Tokens.Table;\n return [\n {\n kind: 'table',\n header: table.header.map((cell) => inlines(cell.tokens, app)),\n rows: table.rows.map((row) => row.map((cell) => inlines(cell.tokens, app))),\n },\n ];\n },\n html: (token) => literal((token as Tokens.HTML).text),\n space: () => [],\n def: () => [],\n checkbox: () => [],\n};\n\nfunction block(token: Token, app: AppLinkSchemes): MarkdownBlock[] {\n const draw = Object.hasOwn(BLOCKS, token.type) ? BLOCKS[token.type]! : null;\n return draw ? draw(token, app) : literal(token.raw ?? '');\n}\n\n/**\n * A code block's text with its first line's indent made of no-break spaces: a paragraph loses the\n * spaces at its start, and a block's indent is part of the code.\n */\nfunction indented(text: string): string {\n return text.replace(/^ +/, (spaces) => '\\u00a0'.repeat(spaces.length));\n}\n\n/** Text drawn as written, which is what raw HTML and a token nothing here knows become. */\nfunction literal(text: string): MarkdownBlock[] {\n const trimmed = text.replace(/\\n+$/, '');\n return trimmed.trim() ? [{ kind: 'paragraph', children: [{ kind: 'text', text: trimmed }] }] : [];\n}\n\nfunction list(token: Tokens.List, app: AppLinkSchemes): MarkdownBlock {\n const start = typeof token.start === 'number' ? token.start : 1;\n return {\n kind: 'list',\n element: token.ordered ? 'ol' : 'ul',\n items: token.items.map((item, index) => ({\n marker: item.task ? (item.checked ? '☑' : '☐') : token.ordered ? `${start + index}.` : '•',\n children: markdownBlocks(item.tokens, app),\n })),\n };\n}\n\n/**\n * A paragraph's runs, split around the images at its top level: an image is a block of its own,\n * and the text either side of it a paragraph each. An image whose address is refused, and one\n * inside a link or an emphasis, is its alt text instead.\n */\nfunction paragraphs(tokens: readonly Token[], app: AppLinkSchemes): MarkdownBlock[] {\n const out: MarkdownBlock[] = [];\n let run: MarkdownInline[] = [];\n const flush = () => {\n if (run.some((one) => one.kind !== 'text' || one.text.trim())) {\n out.push({ kind: 'paragraph', children: trimmedEnd(run) });\n }\n run = [];\n };\n for (const token of tokens) {\n const href = token.type === 'image' ? hrefOf(token) : null;\n const src = href === null ? null : imageSource(href);\n if (src === null) {\n run.push(...inline(token, app));\n continue;\n }\n flush();\n out.push({ kind: 'image', src, alt: decodeEntities((token as Tokens.Image).text) });\n }\n flush();\n return out;\n}\n\n/**\n * Runs without the whitespace at their end, which a paragraph does not draw. The engine works out\n * that trim when a run changes, not when a run arrives after it, so a run that ended a streaming\n * paragraph and stops ending it would otherwise keep its trimmed space: `Run ` and then a code\n * span would read as one word.\n */\nfunction trimmedEnd(runs: MarkdownInline[]): MarkdownInline[] {\n const last = runs.at(-1);\n if (last?.kind !== 'text') return runs;\n const text = last.text.replace(/[ \\t\\n\\r\\f]+$/, '');\n if (text === last.text) return runs;\n return text ? [...runs.slice(0, -1), { kind: 'text', text }] : runs.slice(0, -1);\n}\n\nfunction inlines(tokens: readonly Token[] | undefined, app: AppLinkSchemes): MarkdownInline[] {\n return (tokens ?? []).flatMap((token) => inline(token, app));\n}\n\n/**\n * Text with each line break the source wrapped it at made a space, as CommonMark reads a soft\n * break, with the spaces around it. A hard break is a `br` token of its own, and stays one.\n */\nfunction softBreaks(text: string): string {\n return text.replace(/ *\\n */g, ' ');\n}\n\nfunction plain(text: string): MarkdownInline {\n return { kind: 'text', text: decodeEntities(text) };\n}\n\nfunction emphasis(token: Token, app: AppLinkSchemes): MarkdownInline[] {\n const kind = token.type as 'strong' | 'em' | 'del';\n return [{ kind, children: inlines((token as Tokens.Strong).tokens, app) }];\n}\n\n/** What each kind of inline token is drawn as. A kind not here is drawn as its source text. */\nconst INLINES: Readonly<Record<string, (token: Token, app: AppLinkSchemes) => MarkdownInline[]>> = {\n text: (token, app) => {\n const text = token as Tokens.Text;\n return text.tokens ? inlines(text.tokens, app) : [plain(softBreaks(text.text))];\n },\n escape: (token) => [plain((token as Tokens.Escape).text)],\n strong: emphasis,\n em: emphasis,\n del: emphasis,\n codespan: (token) => [{ kind: 'code', text: (token as Tokens.Codespan).text }],\n br: () => [{ kind: 'text', text: '\\n' }],\n link: (token, app) => {\n const link = token as Tokens.Link;\n const children = inlines(link.tokens, app);\n const decoded = hrefOf(link);\n const href = decoded === null ? null : linkTarget(decoded, app);\n if (href === null) return children;\n const title = link.title ? decodeEntities(link.title) : null;\n return [{ kind: 'link', href, title, children }];\n },\n image: (token) => [plain((token as Tokens.Image).text)],\n html: (token) => [{ kind: 'text', text: (token as Tokens.HTML).text }],\n checkbox: () => [],\n};\n\nfunction inline(token: Token, app: AppLinkSchemes): MarkdownInline[] {\n const draw = Object.hasOwn(INLINES, token.type) ? INLINES[token.type]! : null;\n if (draw) return draw(token, app);\n return token.raw ? [{ kind: 'text', text: token.raw }] : [];\n}\n\nconst keys = new WeakMap<object, number>();\nlet lastKey = 0;\n\n/**\n * A key for `block` that stays the same while it is drawn: a block kept from the document before\n * keeps its own, and one {@link shareBlocks} made in place of an edited one takes that one's.\n */\nexport function blockKey(block: MarkdownBlock): number {\n let key = keys.get(block);\n if (key === undefined) keys.set(block, (key = ++lastKey));\n return key;\n}\n\n/**\n * `next`, with every part of it that equals the same part of `previous` replaced by that part, so\n * a block that did not change is the object drawn already and is not drawn again. The two are\n * matched from each end, so a block added or removed in the middle leaves those either side of it\n * kept; what is left between is matched by position.\n */\nexport function shareBlocks(\n previous: readonly MarkdownBlock[] | undefined,\n next: readonly MarkdownBlock[],\n): readonly MarkdownBlock[] {\n return previous ? (share(previous, next) as readonly MarkdownBlock[]) : next;\n}\n\nfunction share(previous: unknown, next: unknown): unknown {\n if (previous === next || typeof previous !== 'object' || typeof next !== 'object') return next;\n if (previous === null || next === null) return next;\n if (Array.isArray(previous) !== Array.isArray(next)) return next;\n if (Array.isArray(previous)) return shareArray(previous, next as unknown[]);\n return shareObject(previous as Record<string, unknown>, next as Record<string, unknown>);\n}\n\nfunction shareArray(previous: readonly unknown[], next: readonly unknown[]): readonly unknown[] {\n const out = next.slice();\n // Each pair is compared once: the passes below meet at the same position, and comparing a\n // changed block again in each of them made a nested one cost three times as much a level.\n const compared = new Set<number>();\n const shareAt = (was: number, at: number): unknown => {\n if (was === at) {\n if (compared.has(at)) return out[at];\n compared.add(at);\n }\n return (out[at] = share(previous[was], out[at]));\n };\n let start = 0;\n while (start < out.length && start < previous.length) {\n if (shareAt(start, start) !== previous[start]) break;\n start++;\n }\n let end = 0;\n while (end < out.length - start && end < previous.length - start) {\n const was = previous.length - 1 - end;\n if (shareAt(was, out.length - 1 - end) !== previous[was]) break;\n end++;\n }\n for (let i = start; i < out.length - end && i < previous.length - end; i++) shareAt(i, i);\n const same = out.length === previous.length && out.every((one, i) => one === previous[i]);\n return same ? previous : out;\n}\n\nfunction shareObject(\n previous: Record<string, unknown>,\n next: Record<string, unknown>,\n): Record<string, unknown> {\n if (previous['kind'] !== next['kind']) return next;\n const names = Object.keys(next);\n let same = names.length === Object.keys(previous).length;\n const out: Record<string, unknown> = {};\n for (const name of names) {\n const was = previous[name];\n const kept = Object.hasOwn(previous, name) ? share(was, next[name]) : next[name];\n if (kept !== was) same = false;\n out[name] = kept;\n }\n if (same) return previous;\n const key = keys.get(previous);\n if (key !== undefined) keys.set(out, key);\n return out;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"markdown-blocks.js","sourceRoot":"","sources":["../src/markdown-blocks.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAmEnD,IAAI,aAA8C,CAAC;AAEnD,+FAA+F;AAC/F,SAAS,WAAW,CAAC,IAAY;IAC/B,IAAI,CAAC,aAAa,EAAE,CAAC;QACnB,aAAa,GAAG,IAAI,GAAG,EAAE,CAAC;QAC1B,MAAM,KAAK,GAAG,aAAa,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QACvC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,IAAI,CAAC;YAA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C,QAAQ,CAAC,CAAC;IAC/B,IAAI,GAAG,KAAK,SAAS;QAAE,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;IAC1C,OAAO,GAAG,CAAC;AACb,CAAC","sourcesContent":["/**\n * Marked's tokens, turned into the blocks `<markdown>` draws: the entities decoded, the links and\n * images held to the schemes they may use, raw HTML made plain text, and an image lifted out of\n * its paragraph, since a `<text>` cannot hold one.\n *\n * Plain functions with no Angular in them, so the policy is the same wherever the tokens came from:\n * `marked.lexer` on the device, or a build step that lexed them ahead of time.\n */\nimport type { Token, Tokens } from 'marked';\nimport { HTML_ENTITIES } from './html-entities.ts';\n\n/** The elements a document is drawn with, by the HTML names the Markdown would have produced. */\nexport type MarkdownElement =\n | 'h1'\n | 'h2'\n | 'h3'\n | 'h4'\n | 'h5'\n | 'h6'\n | 'p'\n | 'blockquote'\n | 'ul'\n | 'ol'\n | 'li'\n | 'marker'\n | 'pre'\n | 'code'\n | 'strong'\n | 'em'\n | 'del'\n | 'a'\n | 'hr'\n | 'img'\n | 'table'\n | 'tr'\n | 'th'\n | 'td';\n\nexport type MarkdownInline =\n | { readonly kind: 'text'; readonly text: string }\n | { readonly kind: 'strong' | 'em' | 'del'; readonly children: readonly MarkdownInline[] }\n | { readonly kind: 'code'; readonly text: string }\n | {\n readonly kind: 'link';\n readonly href: string;\n readonly title: string | null;\n readonly children: readonly MarkdownInline[];\n };\n\nexport interface MarkdownListItem {\n readonly marker: string;\n readonly children: readonly MarkdownBlock[];\n}\n\nexport type MarkdownBlock =\n | {\n readonly kind: 'heading';\n readonly element: 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';\n readonly children: readonly MarkdownInline[];\n }\n | { readonly kind: 'paragraph'; readonly children: readonly MarkdownInline[] }\n | { readonly kind: 'image'; readonly src: string; readonly alt: string }\n | { readonly kind: 'blockquote'; readonly children: readonly MarkdownBlock[] }\n | {\n readonly kind: 'list';\n readonly element: 'ul' | 'ol';\n readonly items: readonly MarkdownListItem[];\n }\n | { readonly kind: 'code'; readonly text: string }\n | { readonly kind: 'hr' }\n | {\n readonly kind: 'table';\n readonly header: readonly (readonly MarkdownInline[])[];\n readonly rows: readonly (readonly (readonly MarkdownInline[])[])[];\n };\n\nlet namedEntities: Map<string, string> | undefined;\n\n/** The character HTML names `name`, from its full table, built on the first name looked up. */\nfunction namedEntity(name: string): string | undefined {\n if (!namedEntities) {\n namedEntities = new Map();\n const pairs = HTML_ENTITIES.split(' ');\n for (let i = 0; i + 1 < pairs.length; i += 2) namedEntities.set(pairs[i]!, pairs[i + 1]!);\n }\n return namedEntities.get(name);\n}\n\nconst ENTITY = /&(?:#(\\d{1,7})|#[xX]([0-9a-fA-F]{1,6})|([a-zA-Z][a-zA-Z0-9]{1,31}));/g;\n\n/**\n * The text an HTML reader would show for `text`, in one pass so `&lt;` is `<` and not `<`.\n * A reference to no character, or to one outside Unicode, is the replacement character, as HTML\n * makes it; a name HTML does not have stays as written.\n */\nexport function decodeEntities(text: string): string {\n if (!text.includes('&')) return text;\n return text.replace(ENTITY, (whole, decimal?: string, hex?: string, name?: string) => {\n if (name !== undefined) return namedEntity(name) ?? whole;\n const code = decimal !== undefined ? Number(decimal) : parseInt(hex!, 16);\n const valid = code > 0 && code <= 0x10ffff && (code < 0xd800 || code > 0xdfff);\n return valid ? String.fromCodePoint(code) : '�';\n });\n}\n\n/**\n * What a URL parser ignores while it reads a scheme: the C0 controls and the space, and the C1\n * controls and DEL beside them. `java\\tscript:` is `javascript:` to the thing that opens it.\n */\nconst IGNORED_IN_SCHEME = /[\\u0000- \\u007f-\\u009f]/g;\nconst SCHEME = /^([a-z][a-z0-9+.-]*):/;\n\n/** The scheme `url` would be opened with, lowercased, or null for a relative one. */\nexport function schemeOf(url: string): string | null {\n return SCHEME.exec(url.replace(IGNORED_IN_SCHEME, '').toLowerCase())?.[1] ?? null;\n}\n\nconst LINK_SCHEMES = new Set(['http', 'https', 'mailto', 'tel']);\nconst IMAGE_SCHEMES = new Set(['http', 'https']);\n\n/** The schemes an app lists for `<markdown>` to draw links in, lowercased. See {@link linkSchemeSet}. */\nexport type AppLinkSchemes = ReadonlySet<string>;\n\n/** No app scheme: what a document is drawn with when the app lists none. */\nexport const NO_APP_SCHEMES: AppLinkSchemes = new Set();\n\nconst SCHEME_NAME = /^[a-z][a-z0-9+.-]*$/;\n\n/**\n * The set of schemes an app lists, as {@link linkTarget} reads them. Each is trimmed, lowercased\n * and stripped of one trailing colon, so `'MyApp:'` and `'myapp'` are the same; an entry that\n * cannot be a scheme is dropped.\n */\nexport function linkSchemeSet(schemes: readonly string[]): AppLinkSchemes {\n const set = new Set<string>();\n for (const one of schemes) {\n const name = one.trim().toLowerCase().replace(/:$/, '');\n if (SCHEME_NAME.test(name)) set.add(name);\n }\n return set.size ? set : NO_APP_SCHEMES;\n}\n\n/**\n * A link's target if it may be drawn as a link: `http`, `https`, `mailto`, `tel`, a scheme the app\n * listed in `appSchemes`, or relative, which is the app's to resolve. Anything else,\n * `javascript:`, `data:`, `vbscript:` and `file:` among them, is null, and the link is drawn as\n * its text. The scheme is read after the trim, so whitespace the trim strips cannot hide one.\n */\nexport function linkTarget(\n href: string,\n appSchemes: AppLinkSchemes = NO_APP_SCHEMES,\n): string | null {\n const target = href.trim();\n const scheme = schemeOf(target);\n return scheme === null || LINK_SCHEMES.has(scheme) || appSchemes.has(scheme) ? target : null;\n}\n\n/**\n * Whether `href` is absolute in one of the built-in schemes a link is followed to, and so is\n * opened on press. A scheme the app listed is drawn as a link but never opens here.\n */\nexport function opensOnPress(href: string): boolean {\n const scheme = schemeOf(href.trim());\n return scheme !== null && LINK_SCHEMES.has(scheme);\n}\n\n/**\n * An image's address if it may be loaded: `http`, `https`, or a picture written into the document\n * as a `data:` url of a raster type. A pasted screenshot arrives that way from a web editor, and\n * a native image only decodes such a picture: nothing in it runs. Any other `data:` url, an SVG\n * or HTML among them, is refused, as is every other scheme.\n */\nexport function imageSource(href: string): string | null {\n const source = href.trim();\n const scheme = schemeOf(source);\n if (scheme === null) return null;\n if (IMAGE_SCHEMES.has(scheme)) return source;\n if (scheme !== 'data') return null;\n // A native loader may not decode a url with whitespace in it, so a wrapped payload is joined.\n const joined = source.replace(/\\s+/g, '');\n return DATA_IMAGE.test(joined) ? joined : null;\n}\n\n/** A base64 `data:` url of a raster picture: PNG, JPEG, GIF or WebP. */\nconst DATA_IMAGE = /^data:image\\/(?:png|jpe?g|gif|webp);base64,[a-z0-9+/=]+$/i;\n\n/** A link's or an image's target with its entities decoded, or null when it is not a string. */\nfunction hrefOf(token: Token): string | null {\n const href: unknown = (token as Tokens.Link).href;\n return typeof href === 'string' ? decodeEntities(href) : null;\n}\n\nconst HEADINGS = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6'] as const;\n\n/** The blocks a document of `tokens` is drawn as, with links in `appSchemes` drawn as links too. */\nexport function markdownBlocks(\n tokens: readonly Token[],\n appSchemes: AppLinkSchemes = NO_APP_SCHEMES,\n): MarkdownBlock[] {\n return tokens.flatMap((token) => block(token, appSchemes));\n}\n\n/** What each kind of block token is drawn as. A kind not here is drawn as its source text. */\nconst BLOCKS: Readonly<Record<string, (token: Token, app: AppLinkSchemes) => MarkdownBlock[]>> = {\n heading: (token, app) => {\n const heading = token as Tokens.Heading;\n const depth = Math.min(Math.max(heading.depth, 1), 6);\n const children = trimmedEnd(inlines(heading.tokens, app));\n return [{ kind: 'heading', element: HEADINGS[depth - 1]!, children }];\n },\n paragraph: (token, app) => paragraphs((token as Tokens.Paragraph).tokens, app),\n text: (token, app) => {\n const text = token as Tokens.Text;\n return text.tokens\n ? paragraphs(text.tokens, app)\n : [{ kind: 'paragraph', children: [plain(softBreaks(text.text))] }];\n },\n blockquote: (token, app) => [\n { kind: 'blockquote', children: markdownBlocks((token as Tokens.Blockquote).tokens, app) },\n ],\n list: (token, app) => [list(token as Tokens.List, app)],\n code: (token) => [{ kind: 'code', text: indented((token as Tokens.Code).text) }],\n hr: () => [{ kind: 'hr' }],\n table: (token, app) => {\n const table = token as Tokens.Table;\n return [\n {\n kind: 'table',\n header: table.header.map((cell) => inlines(cell.tokens, app)),\n rows: table.rows.map((row) => row.map((cell) => inlines(cell.tokens, app))),\n },\n ];\n },\n html: (token) => literal((token as Tokens.HTML).text),\n space: () => [],\n def: () => [],\n checkbox: () => [],\n};\n\nfunction block(token: Token, app: AppLinkSchemes): MarkdownBlock[] {\n const draw = Object.hasOwn(BLOCKS, token.type) ? BLOCKS[token.type]! : null;\n return draw ? draw(token, app) : literal(token.raw ?? '');\n}\n\n/**\n * A code block's text with its first line's indent made of no-break spaces: a paragraph loses the\n * spaces at its start, and a block's indent is part of the code.\n */\nfunction indented(text: string): string {\n return text.replace(/^ +/, (spaces) => '\\u00a0'.repeat(spaces.length));\n}\n\n/** Text drawn as written, which is what raw HTML and a token nothing here knows become. */\nfunction literal(text: string): MarkdownBlock[] {\n const trimmed = text.replace(/\\n+$/, '');\n return trimmed.trim() ? [{ kind: 'paragraph', children: [{ kind: 'text', text: trimmed }] }] : [];\n}\n\nfunction list(token: Tokens.List, app: AppLinkSchemes): MarkdownBlock {\n const start = typeof token.start === 'number' ? token.start : 1;\n return {\n kind: 'list',\n element: token.ordered ? 'ol' : 'ul',\n items: token.items.map((item, index) => ({\n marker: item.task ? (item.checked ? '☑' : '☐') : token.ordered ? `${start + index}.` : '•',\n children: markdownBlocks(item.tokens, app),\n })),\n };\n}\n\n/**\n * A paragraph's runs, split around the images at its top level: an image is a block of its own,\n * and the text either side of it a paragraph each. An image whose address is refused, and one\n * inside a link or an emphasis, is its alt text instead.\n */\nfunction paragraphs(tokens: readonly Token[], app: AppLinkSchemes): MarkdownBlock[] {\n const out: MarkdownBlock[] = [];\n let run: MarkdownInline[] = [];\n const flush = () => {\n if (run.some((one) => one.kind !== 'text' || one.text.trim())) {\n out.push({ kind: 'paragraph', children: trimmedEnd(run) });\n }\n run = [];\n };\n for (const token of tokens) {\n const href = token.type === 'image' ? hrefOf(token) : null;\n const src = href === null ? null : imageSource(href);\n if (src === null) {\n run.push(...inline(token, app));\n continue;\n }\n flush();\n out.push({ kind: 'image', src, alt: decodeEntities((token as Tokens.Image).text) });\n }\n flush();\n return out;\n}\n\n/**\n * Runs without the whitespace at their end, which a paragraph does not draw. The engine works out\n * that trim when a run changes, not when a run arrives after it, so a run that ended a streaming\n * paragraph and stops ending it would otherwise keep its trimmed space: `Run ` and then a code\n * span would read as one word.\n */\nfunction trimmedEnd(runs: MarkdownInline[]): MarkdownInline[] {\n const last = runs.at(-1);\n if (last?.kind !== 'text') return runs;\n const text = last.text.replace(/[ \\t\\n\\r\\f]+$/, '');\n if (text === last.text) return runs;\n return text ? [...runs.slice(0, -1), { kind: 'text', text }] : runs.slice(0, -1);\n}\n\nfunction inlines(tokens: readonly Token[] | undefined, app: AppLinkSchemes): MarkdownInline[] {\n return (tokens ?? []).flatMap((token) => inline(token, app));\n}\n\n/**\n * Text with each line break the source wrapped it at made a space, as CommonMark reads a soft\n * break, with the spaces around it. A hard break is a `br` token of its own, and stays one.\n */\nfunction softBreaks(text: string): string {\n return text.replace(/ *\\n */g, ' ');\n}\n\nfunction plain(text: string): MarkdownInline {\n return { kind: 'text', text: decodeEntities(text) };\n}\n\nfunction emphasis(token: Token, app: AppLinkSchemes): MarkdownInline[] {\n const kind = token.type as 'strong' | 'em' | 'del';\n return [{ kind, children: inlines((token as Tokens.Strong).tokens, app) }];\n}\n\n/** What each kind of inline token is drawn as. A kind not here is drawn as its source text. */\nconst INLINES: Readonly<Record<string, (token: Token, app: AppLinkSchemes) => MarkdownInline[]>> = {\n text: (token, app) => {\n const text = token as Tokens.Text;\n return text.tokens ? inlines(text.tokens, app) : [plain(softBreaks(text.text))];\n },\n escape: (token) => [plain((token as Tokens.Escape).text)],\n strong: emphasis,\n em: emphasis,\n del: emphasis,\n codespan: (token) => [{ kind: 'code', text: (token as Tokens.Codespan).text }],\n br: () => [{ kind: 'text', text: '\\n' }],\n link: (token, app) => {\n const link = token as Tokens.Link;\n const children = inlines(link.tokens, app);\n const decoded = hrefOf(link);\n const href = decoded === null ? null : linkTarget(decoded, app);\n if (href === null) return children;\n const title = link.title ? decodeEntities(link.title) : null;\n return [{ kind: 'link', href, title, children }];\n },\n image: (token) => [plain((token as Tokens.Image).text)],\n html: (token) => [{ kind: 'text', text: (token as Tokens.HTML).text }],\n checkbox: () => [],\n};\n\nfunction inline(token: Token, app: AppLinkSchemes): MarkdownInline[] {\n const draw = Object.hasOwn(INLINES, token.type) ? INLINES[token.type]! : null;\n if (draw) return draw(token, app);\n return token.raw ? [{ kind: 'text', text: token.raw }] : [];\n}\n\nconst keys = new WeakMap<object, number>();\nlet lastKey = 0;\n\n/**\n * A key for `block` that stays the same while it is drawn: a block kept from the document before\n * keeps its own, and one {@link shareBlocks} made in place of an edited one takes that one's.\n */\nexport function blockKey(block: MarkdownBlock): number {\n let key = keys.get(block);\n if (key === undefined) keys.set(block, (key = ++lastKey));\n return key;\n}\n\n/**\n * `next`, with every part of it that equals the same part of `previous` replaced by that part, so\n * a block that did not change is the object drawn already and is not drawn again. The two are\n * matched from each end, so a block added or removed in the middle leaves those either side of it\n * kept; what is left between is matched by position. Only that last match keeps a part that\n * changed, so no part of `previous` is matched with two of `next` and no two blocks share a key.\n */\nexport function shareBlocks(\n previous: readonly MarkdownBlock[] | undefined,\n next: readonly MarkdownBlock[],\n): readonly MarkdownBlock[] {\n return previous ? (share(previous, next) as readonly MarkdownBlock[]) : next;\n}\n\nfunction share(previous: unknown, next: unknown): unknown {\n if (previous === next || typeof previous !== 'object' || typeof next !== 'object') return next;\n if (previous === null || next === null) return next;\n if (Array.isArray(previous) !== Array.isArray(next)) return next;\n if (Array.isArray(previous)) return shareArray(previous, next as unknown[]);\n return shareObject(previous as Record<string, unknown>, next as Record<string, unknown>);\n}\n\nfunction shareArray(previous: readonly unknown[], next: readonly unknown[]): readonly unknown[] {\n const out = next.slice();\n // Each pair is compared once: the passes below meet at the same position, and comparing a\n // changed block again in each of them made a nested one cost three times as much a level.\n const compared = new Map<number, unknown>();\n const shareAt = (was: number, at: number): unknown => {\n if (was !== at) return share(previous[was], next[at]);\n if (!compared.has(at)) compared.set(at, share(previous[at], next[at]));\n return compared.get(at);\n };\n const keepAt = (was: number, at: number): boolean => {\n const kept = shareAt(was, at);\n if (kept !== previous[was]) return false;\n out[at] = kept;\n return true;\n };\n let start = 0;\n while (start < out.length && start < previous.length && keepAt(start, start)) start++;\n let end = 0;\n while (\n end < out.length - start &&\n end < previous.length - start &&\n keepAt(previous.length - 1 - end, out.length - 1 - end)\n ) {\n end++;\n }\n for (let i = start; i < out.length - end && i < previous.length - end; i++) {\n out[i] = shareAt(i, i);\n }\n const same = out.length === previous.length && out.every((one, i) => one === previous[i]);\n return same ? previous : out;\n}\n\nfunction shareObject(\n previous: Record<string, unknown>,\n next: Record<string, unknown>,\n): Record<string, unknown> {\n if (previous['kind'] !== next['kind']) return next;\n const names = Object.keys(next);\n let same = names.length === Object.keys(previous).length;\n const out: Record<string, unknown> = {};\n for (const name of names) {\n const was = previous[name];\n const kept = Object.hasOwn(previous, name) ? share(was, next[name]) : next[name];\n if (kept !== was) same = false;\n out[name] = kept;\n }\n if (same) return previous;\n const key = keys.get(previous);\n if (key !== undefined) keys.set(out, key);\n return out;\n}\n"]}
|
package/dist/markdown-columns.js
CHANGED
|
@@ -48,10 +48,10 @@ export class MarkdownColumns {
|
|
|
48
48
|
changed[column] = next;
|
|
49
49
|
this.columns.set({ cells, widths: changed });
|
|
50
50
|
}
|
|
51
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.
|
|
52
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.
|
|
51
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.3.0", ngImport: i0, type: MarkdownColumns, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
52
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.3.0", type: MarkdownColumns, isStandalone: true, selector: "[markdownColumns]", inputs: { table: { classPropertyName: "table", publicName: "markdownColumns", isSignal: true, isRequired: true, transformFunction: null } }, exportAs: ["markdownColumns"], ngImport: i0 });
|
|
53
53
|
}
|
|
54
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.
|
|
54
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.3.0", ngImport: i0, type: MarkdownColumns, decorators: [{
|
|
55
55
|
type: Directive,
|
|
56
56
|
args: [{ selector: '[markdownColumns]', exportAs: 'markdownColumns' }]
|
|
57
57
|
}], propDecorators: { table: [{ type: i0.Input, args: [{ isSignal: true, alias: "markdownColumns", required: true }] }] } });
|
package/dist/markdown-stream.js
CHANGED
|
@@ -152,12 +152,15 @@ function heldInline(inline, tail, start) {
|
|
|
152
152
|
return null;
|
|
153
153
|
}
|
|
154
154
|
/**
|
|
155
|
-
* A line of `=`, of dashes with pipes, colons and spaces,
|
|
156
|
-
* `.` or `)`,
|
|
157
|
-
*
|
|
158
|
-
* so it would draw as text in the
|
|
155
|
+
* A line of `=`, of dashes with pipes, colons and spaces, of a lone `+`, `*` or number with or
|
|
156
|
+
* without its `.` or `)`, or of three or more `*` or `_` with spaces, after any quote markers.
|
|
157
|
+
* Until it ends it may be a setext underline, a list item, a table's delimiter row or a thematic
|
|
158
|
+
* break, and a marker with no text yet is not a list item, so it would draw as text in the
|
|
159
|
+
* paragraph above. A number whose `.` has not arrived, or a run of `*` or `_` that more text turns
|
|
160
|
+
* into an emphasis, would otherwise end the block above as it lexes, and keep it ended: a list
|
|
161
|
+
* split in two, or a paragraph whose next line starts `***Note:***` drawn as two.
|
|
159
162
|
*/
|
|
160
|
-
const UNDERLINE = /^(?:[ \t]*>)*(?:[ \t]*=+[ \t]*|[|: \t]*-[-|: \t]*|[ \t]*(?:[+*]|\d{1,9}[.)])[ \t]*)$/;
|
|
163
|
+
const UNDERLINE = /^(?:[ \t]*>)*(?:[ \t]*=+[ \t]*|[|: \t]*-[-|: \t]*|[ \t]*(?:[+*]|\d{1,9}[.)]?|(?:\*[ \t]*){3,}|(?:_[ \t]*){3,})[ \t]*)$/;
|
|
161
164
|
/** Where `tail` is cut so its last block shows nothing half written, or null to show all of it. */
|
|
162
165
|
function holdBackAt(tail, tokens) {
|
|
163
166
|
const block = lastBlock(tokens);
|
|
@@ -1 +1 @@
|
|
|
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,eA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AAM,KAAK,GAAG,IAAI,CAAC,CAAC,CAAE,CAAC;YACvB,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,KAAK,CAAC,GAAG,EAAE,MAAM,CAAC;gBAAE,MAAM;YACjD,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;YACjB,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"]}
|
|
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,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C,CAAC;QACzD,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC;QACxB,OAAO,CAAC,GAAG,OAAO,EAAE,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC;IACtC,CAAC;IAED;;;OAGG;IACK,MAAM,CAAC,MAAc,EAAE,OAAgB,EAAE,MAAc,EAAE,KAAY,EAAE,IAAa;QAC1F,MAAM,IAAI,GAAG,gBAAgB,CAAC,IAAI,CAAC,CAAC;QACpC,MAAM,IAAI,GAAG,CAAC,GAAG,OAAO,CAAC,CAAC;QAC1B,MAAM,SAAS,GAAG,EAAE,GAAG,KAAK,EAAE,CAAC;QAC/B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,EAAE,CAAC,EAAE,EAAE,CAAC;YAC9B,MAAM,KAAK,GAAG,IAAI,CAAC,CAAC,CAAE,CAAC;YACvB,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,KAAK,CAAC,GAAG,EAAE,MAAM,CAAC;gBAAE,MAAM;YACjD,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;YACjB,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, of a lone `+`, `*` or number with or\n * without its `.` or `)`, or of three or more `*` or `_` with spaces, after any quote markers.\n * Until it ends it may be a setext underline, a list item, a table's delimiter row or a thematic\n * break, and a marker with no text yet is not a list item, so it would draw as text in the\n * paragraph above. A number whose `.` has not arrived, or a run of `*` or `_` that more text turns\n * into an emphasis, would otherwise end the block above as it lexes, and keep it ended: a list\n * split in two, or a paragraph whose next line starts `***Note:***` drawn as two.\n */\nconst UNDERLINE =\n /^(?:[ \\t]*>)*(?:[ \\t]*=+[ \\t]*|[|: \\t]*-[-|: \\t]*|[ \\t]*(?:[+*]|\\d{1,9}[.)]?|(?:\\*[ \\t]*){3,}|(?:_[ \\t]*){3,})[ \\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"]}
|