@ng-prism/core 22.2.1 → 22.4.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 +34 -36
- package/builders.json +11 -11
- package/dist/app/canvas/canvas-bg.styles.d.ts +7 -12
- package/dist/app/canvas/canvas-bg.styles.d.ts.map +1 -1
- package/dist/app/canvas/canvas-bg.styles.js +37 -22
- package/dist/app/canvas/measure-geometry.d.ts +140 -0
- package/dist/app/canvas/measure-geometry.d.ts.map +1 -0
- package/dist/app/canvas/measure-geometry.js +217 -0
- package/dist/app/canvas/measure-keyboard.d.ts +20 -0
- package/dist/app/canvas/measure-keyboard.d.ts.map +1 -0
- package/dist/app/canvas/measure-keyboard.js +34 -0
- package/dist/app/canvas/measure-quad.d.ts +114 -0
- package/dist/app/canvas/measure-quad.d.ts.map +1 -0
- package/dist/app/canvas/measure-quad.js +173 -0
- package/dist/app/canvas/measure-snap.d.ts +35 -0
- package/dist/app/canvas/measure-snap.d.ts.map +1 -0
- package/dist/app/canvas/measure-snap.js +63 -0
- package/dist/app/canvas/prism-canvas-bg-pill.component.d.ts.map +1 -1
- package/dist/app/canvas/prism-canvas-bg-pill.component.js +3 -18
- package/dist/app/canvas/prism-canvas-measure.component.d.ts +142 -0
- package/dist/app/canvas/prism-canvas-measure.component.d.ts.map +1 -0
- package/dist/app/canvas/prism-canvas-measure.component.js +554 -0
- package/dist/app/canvas/prism-canvas-pin-row.component.d.ts +23 -0
- package/dist/app/canvas/prism-canvas-pin-row.component.d.ts.map +1 -0
- package/dist/app/canvas/prism-canvas-pin-row.component.js +64 -0
- package/dist/app/canvas/prism-canvas-rulers.component.d.ts +1 -0
- package/dist/app/canvas/prism-canvas-rulers.component.d.ts.map +1 -1
- package/dist/app/canvas/prism-canvas-rulers.component.js +9 -14
- package/dist/app/canvas/prism-canvas-toolbar.component.d.ts +28 -28
- package/dist/app/canvas/prism-canvas-toolbar.component.d.ts.map +1 -1
- package/dist/app/canvas/prism-canvas-toolbar.component.js +124 -162
- package/dist/app/canvas/prism-template-popover.component.d.ts.map +1 -1
- package/dist/app/canvas/prism-template-popover.component.js +8 -49
- package/dist/app/canvas/viewport-snap.d.ts +12 -0
- package/dist/app/canvas/viewport-snap.d.ts.map +1 -0
- package/dist/app/canvas/viewport-snap.js +23 -0
- package/dist/app/component-head/head-metrics.d.ts +2 -2
- package/dist/app/component-head/head-metrics.d.ts.map +1 -1
- package/dist/app/component-head/head-metrics.js +3 -3
- package/dist/app/component-head/prism-component-head.component.d.ts +3 -3
- package/dist/app/component-head/prism-component-head.component.d.ts.map +1 -1
- package/dist/app/component-head/prism-component-head.component.js +24 -64
- package/dist/app/component-head/prism-head-gauge.component.d.ts.map +1 -1
- package/dist/app/component-head/prism-head-gauge.component.js +4 -36
- package/dist/app/component-head/prism-head-info.component.d.ts +1 -1
- package/dist/app/component-head/prism-head-info.component.d.ts.map +1 -1
- package/dist/app/component-head/prism-head-info.component.js +4 -37
- package/dist/app/component-head/prism-stat.component.d.ts +1 -1
- package/dist/app/component-head/prism-stat.component.d.ts.map +1 -1
- package/dist/app/component-head/prism-stat.component.js +4 -15
- package/dist/app/controls/boolean-control.component.d.ts.map +1 -1
- package/dist/app/controls/boolean-control.component.js +4 -12
- package/dist/app/controls/json-control.component.d.ts.map +1 -1
- package/dist/app/controls/json-control.component.js +4 -24
- package/dist/app/controls/number-control.component.d.ts.map +1 -1
- package/dist/app/controls/number-control.component.js +4 -11
- package/dist/app/controls/string-control.component.d.ts.map +1 -1
- package/dist/app/controls/string-control.component.js +4 -11
- package/dist/app/controls/union-control.component.d.ts.map +1 -1
- package/dist/app/controls/union-control.component.js +4 -16
- package/dist/app/directives/prism-resizer.directive.d.ts +24 -1
- package/dist/app/directives/prism-resizer.directive.d.ts.map +1 -1
- package/dist/app/directives/prism-resizer.directive.js +44 -7
- package/dist/app/directives/resize-value.d.ts +22 -0
- package/dist/app/directives/resize-value.d.ts.map +1 -0
- package/dist/app/directives/resize-value.js +23 -0
- package/dist/app/discovery-manifest.d.ts +2 -2
- package/dist/app/discovery-manifest.d.ts.map +1 -1
- package/dist/app/discovery-manifest.js +16 -22
- package/dist/app/header/prism-header-widget-host.component.d.ts.map +1 -1
- package/dist/app/header/prism-header-widget-host.component.js +4 -8
- package/dist/app/header/prism-header.component.d.ts.map +1 -1
- package/dist/app/header/prism-header.component.js +9 -78
- package/dist/app/hmr.d.ts.map +1 -1
- package/dist/app/icons/icon-registry.d.ts +2 -2
- package/dist/app/icons/icon-registry.d.ts.map +1 -1
- package/dist/app/icons/icon-registry.js +5 -3
- package/dist/app/icons/prism-icon.component.d.ts +2 -2
- package/dist/app/icons/prism-icon.component.d.ts.map +1 -1
- package/dist/app/icons/prism-icon.component.js +9 -9
- package/dist/app/index.d.ts +3 -3
- package/dist/app/index.d.ts.map +1 -1
- package/dist/app/index.js +17 -24
- package/dist/app/layout-menu/prism-layout-menu.component.d.ts.map +1 -1
- package/dist/app/layout-menu/prism-layout-menu.component.js +3 -77
- package/dist/app/overview/overview-panel.js +1 -1
- package/dist/app/overview/overview-visibility.d.ts +1 -1
- package/dist/app/overview/overview-visibility.d.ts.map +1 -1
- package/dist/app/overview/overview-visibility.js +1 -1
- package/dist/app/overview/prism-overview-cell.component.d.ts +2 -2
- package/dist/app/overview/prism-overview-cell.component.d.ts.map +1 -1
- package/dist/app/overview/prism-overview-cell.component.js +17 -25
- package/dist/app/overview/prism-overview.component.d.ts +2 -2
- package/dist/app/overview/prism-overview.component.d.ts.map +1 -1
- package/dist/app/overview/prism-overview.component.js +6 -14
- package/dist/app/page-renderer/prism-page-renderer.component.d.ts.map +1 -1
- package/dist/app/page-renderer/prism-page-renderer.component.js +4 -17
- package/dist/app/panels/a11y/a11y-audit.service.d.ts.map +1 -1
- package/dist/app/panels/a11y/a11y-audit.service.js +14 -2
- package/dist/app/panels/a11y/a11y-core.plugin.d.ts.map +1 -1
- package/dist/app/panels/a11y/a11y-core.plugin.js +1 -1
- package/dist/app/panels/a11y/a11y-dom-utils.d.ts.map +1 -1
- package/dist/app/panels/a11y/a11y-dom-utils.js +9 -6
- package/dist/app/panels/a11y/a11y-header-badge.component.d.ts.map +1 -1
- package/dist/app/panels/a11y/a11y-header-badge.component.js +6 -22
- package/dist/app/panels/a11y/a11y-keyboard-overlay.component.d.ts.map +1 -1
- package/dist/app/panels/a11y/a11y-keyboard-overlay.component.js +6 -25
- package/dist/app/panels/a11y/a11y-keyboard.component.d.ts.map +1 -1
- package/dist/app/panels/a11y/a11y-keyboard.component.js +5 -36
- package/dist/app/panels/a11y/a11y-keyboard.service.d.ts.map +1 -1
- package/dist/app/panels/a11y/a11y-keyboard.service.js +2 -2
- package/dist/app/panels/a11y/a11y-overlay-host.component.d.ts.map +1 -1
- package/dist/app/panels/a11y/a11y-overlay-host.component.js +5 -32
- package/dist/app/panels/a11y/a11y-panel-state.service.d.ts.map +1 -1
- package/dist/app/panels/a11y/a11y-panel.component.d.ts +1 -1
- package/dist/app/panels/a11y/a11y-panel.component.d.ts.map +1 -1
- package/dist/app/panels/a11y/a11y-panel.component.js +7 -69
- package/dist/app/panels/a11y/a11y-perspective.service.d.ts.map +1 -1
- package/dist/app/panels/a11y/a11y-score.component.d.ts.map +1 -1
- package/dist/app/panels/a11y/a11y-score.component.js +4 -31
- package/dist/app/panels/a11y/a11y-sr-overlay.component.d.ts.map +1 -1
- package/dist/app/panels/a11y/a11y-sr-overlay.component.js +8 -28
- package/dist/app/panels/a11y/a11y-sr.component.d.ts.map +1 -1
- package/dist/app/panels/a11y/a11y-sr.component.js +5 -28
- package/dist/app/panels/a11y/a11y-sr.service.d.ts.map +1 -1
- package/dist/app/panels/a11y/a11y-sr.service.js +4 -7
- package/dist/app/panels/a11y/a11y-summary.d.ts +3 -4
- package/dist/app/panels/a11y/a11y-summary.d.ts.map +1 -1
- package/dist/app/panels/a11y/a11y-summary.js +5 -9
- package/dist/app/panels/a11y/a11y-thresholds.d.ts +1 -1
- package/dist/app/panels/a11y/a11y-thresholds.d.ts.map +1 -1
- package/dist/app/panels/a11y/a11y-thresholds.js +2 -2
- package/dist/app/panels/a11y/a11y-tree.component.d.ts.map +1 -1
- package/dist/app/panels/a11y/a11y-tree.component.js +9 -46
- package/dist/app/panels/a11y/a11y-tree.service.d.ts.map +1 -1
- package/dist/app/panels/a11y/a11y-tree.service.js +3 -5
- package/dist/app/panels/a11y/a11y-violations.component.d.ts.map +1 -1
- package/dist/app/panels/a11y/a11y-violations.component.js +7 -58
- package/dist/app/panels/a11y/a11y.types.d.ts +1 -1
- package/dist/app/panels/a11y/a11y.types.d.ts.map +1 -1
- package/dist/app/panels/builtin-header-widgets.js +2 -2
- package/dist/app/panels/builtin-navigation-decorations.d.ts +1 -1
- package/dist/app/panels/builtin-navigation-decorations.d.ts.map +1 -1
- package/dist/app/panels/builtin-navigation-decorations.js +3 -3
- package/dist/app/panels/builtin-panels.d.ts.map +1 -1
- package/dist/app/panels/builtin-panels.js +2 -7
- package/dist/app/panels/controls/controls-plugin.js +3 -3
- package/dist/app/panels/controls/non-editable-input-types.d.ts.map +1 -1
- package/dist/app/panels/controls/non-editable-input-types.js +2 -6
- package/dist/app/panels/controls/prism-controls-panel.component.d.ts.map +1 -1
- package/dist/app/panels/controls/prism-controls-panel.component.js +5 -95
- package/dist/app/panels/events/events-plugin.js +3 -3
- package/dist/app/panels/events/prism-events-panel.component.d.ts.map +1 -1
- package/dist/app/panels/events/prism-events-panel.component.js +5 -23
- package/dist/app/panels/events/prism-json-node.component.d.ts.map +1 -1
- package/dist/app/panels/events/prism-json-node.component.js +4 -86
- package/dist/app/panels/events/prism-json-node.utils.d.ts.map +1 -1
- package/dist/app/panels/panel-host/panel-badge.d.ts +1 -1
- package/dist/app/panels/panel-host/panel-badge.d.ts.map +1 -1
- package/dist/app/panels/panel-host/panel-badge.js +2 -4
- package/dist/app/panels/panel-host/prism-panel-host.component.d.ts +1 -1
- package/dist/app/panels/panel-host/prism-panel-host.component.d.ts.map +1 -1
- package/dist/app/panels/panel-host/prism-panel-host.component.js +12 -67
- package/dist/app/provide-prism.d.ts +1 -1
- package/dist/app/provide-prism.d.ts.map +1 -1
- package/dist/app/provide-prism.js +8 -12
- package/dist/app/renderer/known-inputs.d.ts +1 -1
- package/dist/app/renderer/known-inputs.d.ts.map +1 -1
- package/dist/app/renderer/known-inputs.js +1 -1
- package/dist/app/renderer/overlay-resolver.d.ts +17 -3
- package/dist/app/renderer/overlay-resolver.d.ts.map +1 -1
- package/dist/app/renderer/overlay-resolver.js +10 -5
- package/dist/app/renderer/prism-renderer.component.d.ts +28 -3
- package/dist/app/renderer/prism-renderer.component.d.ts.map +1 -1
- package/dist/app/renderer/prism-renderer.component.js +107 -80
- package/dist/app/renderer/projectable-content.d.ts.map +1 -1
- package/dist/app/renderer/projectable-content.js +4 -6
- package/dist/app/renderer/snippet-generator.d.ts +1 -1
- package/dist/app/renderer/snippet-generator.d.ts.map +1 -1
- package/dist/app/renderer/snippet-generator.js +7 -22
- package/dist/app/services/navigation-item.types.d.ts +1 -1
- package/dist/app/services/navigation-item.types.d.ts.map +1 -1
- package/dist/app/services/prism-canvas.service.d.ts +33 -0
- package/dist/app/services/prism-canvas.service.d.ts.map +1 -1
- package/dist/app/services/prism-canvas.service.js +71 -6
- package/dist/app/services/prism-capture.service.d.ts +24 -50
- package/dist/app/services/prism-capture.service.d.ts.map +1 -1
- package/dist/app/services/prism-capture.service.js +62 -146
- package/dist/app/services/prism-event-log.service.d.ts.map +1 -1
- package/dist/app/services/prism-event-log.service.js +1 -4
- package/dist/app/services/prism-layout.service.d.ts.map +1 -1
- package/dist/app/services/prism-layout.service.js +5 -4
- package/dist/app/services/prism-manifest.service.d.ts +1 -1
- package/dist/app/services/prism-manifest.service.d.ts.map +1 -1
- package/dist/app/services/prism-manifest.service.js +1 -1
- package/dist/app/services/prism-measure.service.d.ts +44 -0
- package/dist/app/services/prism-measure.service.d.ts.map +1 -0
- package/dist/app/services/prism-measure.service.js +91 -0
- package/dist/app/services/prism-navigation.service.d.ts +1 -1
- package/dist/app/services/prism-navigation.service.d.ts.map +1 -1
- package/dist/app/services/prism-navigation.service.js +5 -13
- package/dist/app/services/prism-panel.service.d.ts +2 -2
- package/dist/app/services/prism-panel.service.d.ts.map +1 -1
- package/dist/app/services/prism-panel.service.js +4 -7
- package/dist/app/services/prism-persistence.service.d.ts.map +1 -1
- package/dist/app/services/prism-persistence.service.js +9 -11
- package/dist/app/services/prism-plugin.service.d.ts.map +1 -1
- package/dist/app/services/prism-renderer.service.d.ts.map +1 -1
- package/dist/app/services/prism-renderer.service.js +5 -9
- package/dist/app/services/prism-search.service.d.ts.map +1 -1
- package/dist/app/services/prism-search.service.js +1 -2
- package/dist/app/services/prism-theme.service.d.ts.map +1 -1
- package/dist/app/services/prism-theme.service.js +6 -4
- package/dist/app/services/prism-url-state.service.d.ts.map +1 -1
- package/dist/app/services/prism-url-state.service.js +4 -10
- package/dist/app/services/prism-variant-bg.service.d.ts +10 -24
- package/dist/app/services/prism-variant-bg.service.d.ts.map +1 -1
- package/dist/app/services/prism-variant-bg.service.js +13 -29
- package/dist/app/shared/prism-metric-badge.component.d.ts +9 -15
- package/dist/app/shared/prism-metric-badge.component.d.ts.map +1 -1
- package/dist/app/shared/prism-metric-badge.component.js +13 -32
- package/dist/app/shell/prism-shell.component.d.ts.map +1 -1
- package/dist/app/shell/prism-shell.component.js +26 -125
- package/dist/app/sidebar/navigation-decorations.d.ts +4 -4
- package/dist/app/sidebar/navigation-decorations.d.ts.map +1 -1
- package/dist/app/sidebar/navigation-decorations.js +3 -3
- package/dist/app/sidebar/prism-sidebar.component.d.ts +3 -3
- package/dist/app/sidebar/prism-sidebar.component.d.ts.map +1 -1
- package/dist/app/sidebar/prism-sidebar.component.js +21 -156
- package/dist/app/theme/prism-default-theme.d.ts.map +1 -1
- package/dist/app/theme/prism-default-theme.js +6 -6
- package/dist/app/tokens/prism-tokens.d.ts.map +1 -1
- package/dist/app/tokens/prism-tokens.js +1 -1
- package/dist/app/variant-ribbon/prism-variant-ribbon.component.d.ts.map +1 -1
- package/dist/app/variant-ribbon/prism-variant-ribbon.component.js +4 -49
- package/dist/app/variant-ribbon/spectrum.d.ts +1 -1
- package/dist/app/variant-ribbon/spectrum.d.ts.map +1 -1
- package/dist/app/variant-ribbon/spectrum.js +1 -1
- package/dist/app/view-tab-bar/next-view-id.d.ts +1 -1
- package/dist/app/view-tab-bar/next-view-id.d.ts.map +1 -1
- package/dist/app/view-tab-bar/next-view-id.js +2 -4
- package/dist/app/view-tab-bar/prism-view-panel-host.component.d.ts.map +1 -1
- package/dist/app/view-tab-bar/prism-view-panel-host.component.js +5 -17
- package/dist/app/view-tab-bar/prism-view-tab-bar.component.d.ts.map +1 -1
- package/dist/app/view-tab-bar/prism-view-tab-bar.component.js +4 -27
- package/dist/builder/a11y/a11y-report-reader.d.ts +2 -2
- package/dist/builder/a11y/a11y-report-reader.d.ts.map +1 -1
- package/dist/builder/a11y/a11y-report-reader.js +8 -8
- package/dist/builder/build/index.d.ts.map +1 -1
- package/dist/builder/build/index.js +5 -9
- package/dist/builder/build/schema.d.ts.map +1 -1
- package/dist/builder/config-loader/config-loader.d.ts.map +1 -1
- package/dist/builder/config-loader/config-loader.js +4 -5
- package/dist/builder/manifest/host-parser.d.ts.map +1 -1
- package/dist/builder/manifest/host-parser.js +1 -1
- package/dist/builder/manifest/runtime-manifest.generator.d.ts +1 -1
- package/dist/builder/manifest/runtime-manifest.generator.d.ts.map +1 -1
- package/dist/builder/manifest/runtime-manifest.generator.js +14 -35
- package/dist/builder/plugin-runner/plugin-runner.d.ts.map +1 -1
- package/dist/builder/plugin-runner/plugin-runner.js +2 -4
- package/dist/builder/scanner/ast-utils.d.ts +46 -2
- package/dist/builder/scanner/ast-utils.d.ts.map +1 -1
- package/dist/builder/scanner/ast-utils.js +338 -38
- package/dist/builder/scanner/class-hierarchy.d.ts +33 -0
- package/dist/builder/scanner/class-hierarchy.d.ts.map +1 -0
- package/dist/builder/scanner/class-hierarchy.js +87 -0
- package/dist/builder/scanner/component.scanner.d.ts +7 -1
- package/dist/builder/scanner/component.scanner.d.ts.map +1 -1
- package/dist/builder/scanner/component.scanner.js +113 -72
- package/dist/builder/scanner/entry-point-discovery.d.ts.map +1 -1
- package/dist/builder/scanner/entry-point-discovery.js +3 -5
- package/dist/builder/scanner/entry-point.scanner.d.ts.map +1 -1
- package/dist/builder/scanner/entry-point.scanner.js +1 -3
- package/dist/builder/scanner/index.d.ts +1 -1
- package/dist/builder/scanner/index.d.ts.map +1 -1
- package/dist/builder/scanner/input.extractor.d.ts +7 -4
- package/dist/builder/scanner/input.extractor.d.ts.map +1 -1
- package/dist/builder/scanner/input.extractor.js +157 -76
- package/dist/builder/scanner/manifest.generator.d.ts.map +1 -1
- package/dist/builder/scanner/manifest.generator.js +8 -6
- package/dist/builder/scanner/scanner.d.ts +3 -1
- package/dist/builder/scanner/scanner.d.ts.map +1 -1
- package/dist/builder/scanner/scanner.js +10 -8
- package/dist/builder/scanner/showcase-diagnostics.d.ts +25 -0
- package/dist/builder/scanner/showcase-diagnostics.d.ts.map +1 -0
- package/dist/builder/scanner/showcase-diagnostics.js +96 -0
- package/dist/builder/serve/index.d.ts.map +1 -1
- package/dist/builder/serve/index.js +8 -10
- package/dist/builder/serve/schema.d.ts.map +1 -1
- package/dist/builder/shared/index.d.ts +1 -1
- package/dist/builder/shared/index.d.ts.map +1 -1
- package/dist/builder/shared/index.js +1 -1
- package/dist/builder/shared/prism-pipeline.d.ts +1 -1
- package/dist/builder/shared/prism-pipeline.d.ts.map +1 -1
- package/dist/builder/shared/prism-pipeline.js +29 -38
- package/dist/builder/shared/resolve-cache-dir.d.ts.map +1 -1
- package/dist/builder/shared/resolve-cache-dir.js +1 -1
- package/dist/builder/watcher/index.d.ts +1 -1
- package/dist/builder/watcher/index.d.ts.map +1 -1
- package/dist/builder/watcher/prism-watcher.d.ts.map +1 -1
- package/dist/builder/watcher/prism-watcher.js +14 -12
- package/dist/config/index.d.ts +2 -2
- package/dist/config/index.d.ts.map +1 -1
- package/dist/config/index.js +1 -1
- package/dist/decorator/index.d.ts +1 -1
- package/dist/decorator/index.d.ts.map +1 -1
- package/dist/decorator/showcase.decorator.d.ts.map +1 -1
- package/dist/decorator/showcase.types.d.ts +11 -9
- package/dist/decorator/showcase.types.d.ts.map +1 -1
- package/dist/index.js +3 -3
- package/dist/plugin/define-config.js +1 -1
- package/dist/plugin/index.d.ts +4 -4
- package/dist/plugin/index.d.ts.map +1 -1
- package/dist/plugin/index.js +7 -11
- package/dist/plugin/page-helpers.d.ts +1 -1
- package/dist/plugin/page-helpers.d.ts.map +1 -1
- package/dist/plugin/page-helpers.js +2 -2
- package/dist/plugin/page.types.d.ts.map +1 -1
- package/dist/plugin/plugin.types.d.ts +31 -14
- package/dist/plugin/plugin.types.d.ts.map +1 -1
- package/dist/schematics/migrations/v21-13-manifest-cache/index.d.ts.map +1 -1
- package/dist/schematics/migrations/v21-13-manifest-cache/index.js +4 -10
- package/dist/schematics/migrations/v22-0-cache-dir-rename/index.d.ts.map +1 -1
- package/dist/schematics/migrations/v22-0-cache-dir-rename/index.js +6 -10
- package/dist/schematics/ng-add/index.d.ts.map +1 -1
- package/dist/schematics/ng-add/index.js +122 -56
- package/dist/schematics/ng-add/schema.d.ts.map +1 -1
- package/dist/schematics/utils/config-ast.d.ts.map +1 -1
- package/dist/schematics/utils/config-ast.js +8 -15
- package/dist/schematics/utils/tsconfig-paths.d.ts.map +1 -1
- package/dist/schematics/utils/tsconfig-paths.js +1 -1
- package/dist/shared/canvas-bg.type.d.ts +5 -6
- package/dist/shared/canvas-bg.type.d.ts.map +1 -1
- package/dist/shared/canvas-bg.type.js +5 -13
- package/dist/shared/canvas-layout.type.d.ts.map +1 -1
- package/dist/shared/canvas-layout.type.js +1 -4
- package/dist/shared/measure.type.d.ts +52 -0
- package/dist/shared/measure.type.d.ts.map +1 -0
- package/dist/shared/measure.type.js +21 -0
- package/dist/shared/variant-bg.d.ts +20 -31
- package/dist/shared/variant-bg.d.ts.map +1 -1
- package/dist/shared/variant-bg.js +20 -31
- package/dist/shared/viewport.type.d.ts +43 -0
- package/dist/shared/viewport.type.d.ts.map +1 -0
- package/dist/shared/viewport.type.js +44 -0
- package/dist/transformer/cli.js +0 -0
- package/dist/transformer/index.d.ts +2 -2
- package/dist/transformer/index.d.ts.map +1 -1
- package/dist/transformer/index.js +2 -2
- package/dist/transformer/showcase-strip.transformer.d.ts.map +1 -1
- package/dist/transformer/showcase-strip.transformer.js +7 -16
- package/dist/transformer/strip-directory.d.ts.map +1 -1
- package/dist/transformer/strip-directory.js +2 -4
- package/package.json +5 -2
- package/schematics/collection.json +7 -7
- package/schematics/migrations.json +12 -12
- package/schematics/ng-add/schema.json +22 -22
- package/src/builder/build/schema.json +36 -36
- package/src/builder/serve/schema.json +37 -37
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { Vec } from './measure-geometry.js';
|
|
2
|
+
/**
|
|
3
|
+
* The moved point — or `null` when the key does not belong here.
|
|
4
|
+
*
|
|
5
|
+
* Tab is deliberately not one of `nudge`'s keys. Spec §10 reserves it for
|
|
6
|
+
* stepping through the specimen's snap targets — the accessible substitute
|
|
7
|
+
* for the pointer, and arguably the more precise input, not a consolation
|
|
8
|
+
* prize for lacking one: edges are exactly what one wants to measure in the
|
|
9
|
+
* first place. Arrow keys only come in afterwards, to nudge off an edge once
|
|
10
|
+
* a free point is what's wanted; `nudge` only ever moves a point that
|
|
11
|
+
* already exists, it does not place one. Someone will eventually be tempted
|
|
12
|
+
* to fold Tab in here as "simpler" free-pixel movement — resist it, and see
|
|
13
|
+
* `onKey` in the component for why returning `null` here (rather than the
|
|
14
|
+
* unchanged point) is what makes that possible to resist safely.
|
|
15
|
+
*
|
|
16
|
+
* The step sizes are the pair Spec §10 fixes for this tool: 1px plain, 10px
|
|
17
|
+
* with Shift.
|
|
18
|
+
*/
|
|
19
|
+
export declare function nudge(point: Vec, key: string, shift: boolean): Vec | null;
|
|
20
|
+
//# sourceMappingURL=measure-keyboard.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"measure-keyboard.d.ts","sourceRoot":"","sources":["../../../src/app/canvas/measure-keyboard.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAC;AAKjD;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,KAAK,CAAC,KAAK,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,GAAG,GAAG,IAAI,CAezE"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
const STEP = 1;
|
|
2
|
+
const STEP_COARSE = 10;
|
|
3
|
+
/**
|
|
4
|
+
* The moved point — or `null` when the key does not belong here.
|
|
5
|
+
*
|
|
6
|
+
* Tab is deliberately not one of `nudge`'s keys. Spec §10 reserves it for
|
|
7
|
+
* stepping through the specimen's snap targets — the accessible substitute
|
|
8
|
+
* for the pointer, and arguably the more precise input, not a consolation
|
|
9
|
+
* prize for lacking one: edges are exactly what one wants to measure in the
|
|
10
|
+
* first place. Arrow keys only come in afterwards, to nudge off an edge once
|
|
11
|
+
* a free point is what's wanted; `nudge` only ever moves a point that
|
|
12
|
+
* already exists, it does not place one. Someone will eventually be tempted
|
|
13
|
+
* to fold Tab in here as "simpler" free-pixel movement — resist it, and see
|
|
14
|
+
* `onKey` in the component for why returning `null` here (rather than the
|
|
15
|
+
* unchanged point) is what makes that possible to resist safely.
|
|
16
|
+
*
|
|
17
|
+
* The step sizes are the pair Spec §10 fixes for this tool: 1px plain, 10px
|
|
18
|
+
* with Shift.
|
|
19
|
+
*/
|
|
20
|
+
export function nudge(point, key, shift) {
|
|
21
|
+
const d = shift ? STEP_COARSE : STEP;
|
|
22
|
+
switch (key) {
|
|
23
|
+
case 'ArrowRight':
|
|
24
|
+
return { x: point.x + d, y: point.y };
|
|
25
|
+
case 'ArrowLeft':
|
|
26
|
+
return { x: point.x - d, y: point.y };
|
|
27
|
+
case 'ArrowDown':
|
|
28
|
+
return { x: point.x, y: point.y + d };
|
|
29
|
+
case 'ArrowUp':
|
|
30
|
+
return { x: point.x, y: point.y - d };
|
|
31
|
+
default:
|
|
32
|
+
return null;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import type { EdgeSide } from '../../shared/measure.type.js';
|
|
2
|
+
import { type RenderedLine, type Vec } from './measure-geometry.js';
|
|
3
|
+
/** An axis-aligned box in `.demo-wrap`-local CSS pixels. */
|
|
4
|
+
export interface Box {
|
|
5
|
+
left: number;
|
|
6
|
+
top: number;
|
|
7
|
+
right: number;
|
|
8
|
+
bottom: number;
|
|
9
|
+
}
|
|
10
|
+
/** A box in the form an SVG `<rect>` takes. */
|
|
11
|
+
export interface OutlineRect {
|
|
12
|
+
x: number;
|
|
13
|
+
y: number;
|
|
14
|
+
width: number;
|
|
15
|
+
height: number;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* A {@link Box} as an SVG `<rect>`.
|
|
19
|
+
*
|
|
20
|
+
* Spec §4.5 asks for the anchor and the target to be outlined alongside the
|
|
21
|
+
* four numbers, and `<rect>` wants an origin and a size where `Box` carries
|
|
22
|
+
* two opposite corners. Trivial arithmetic, kept out of the component for
|
|
23
|
+
* the same reason the rest of this module is: the component should hold
|
|
24
|
+
* nothing but the DOM reads.
|
|
25
|
+
*/
|
|
26
|
+
export declare function outlineOf(box: Box): OutlineRect;
|
|
27
|
+
export interface QuadResult {
|
|
28
|
+
top: number;
|
|
29
|
+
right: number;
|
|
30
|
+
bottom: number;
|
|
31
|
+
left: number;
|
|
32
|
+
/** True when one box lies entirely inside the other, in either order — see the explanation below. */
|
|
33
|
+
contained: boolean;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* The point the spans run through: the middle of the inner box when one
|
|
37
|
+
* contains the other, the middle of the target otherwise.
|
|
38
|
+
*
|
|
39
|
+
* Exported because `quadLines` needs the same point to place short labels
|
|
40
|
+
* away from, and both orders of a containment have to agree on it — or the
|
|
41
|
+
* same reading would put its labels on different sides depending on which
|
|
42
|
+
* box was clicked first.
|
|
43
|
+
*/
|
|
44
|
+
export declare function quadCentre(anchor: Box, target: Box): Vec;
|
|
45
|
+
/**
|
|
46
|
+
* The distances between two boxes, border-box to border-box.
|
|
47
|
+
*
|
|
48
|
+
* Two reading modes, because two different questions sit behind them. When
|
|
49
|
+
* one box lies **inside** the other (in either order, see {@link nesting}),
|
|
50
|
+
* what you want is the four insets — that is the case where 16/16 makes a
|
|
51
|
+
* container's padding visible. When the boxes sit **beside** each other,
|
|
52
|
+
* there are no four insets, only a gap per axis; reporting an inset there
|
|
53
|
+
* would mean presenting negative numbers as distances.
|
|
54
|
+
*
|
|
55
|
+
* Partial overlap counts as "not contained": there, exactly one side would
|
|
56
|
+
* go negative, and one negative inset next to three positive ones reads as a
|
|
57
|
+
* measurement fault rather than as the statement "sticks out".
|
|
58
|
+
*
|
|
59
|
+
* A target that overlaps the anchor on both axes — the partial-overlap case
|
|
60
|
+
* above included — reports zero on every side, because there is no gap on
|
|
61
|
+
* either axis to put a number on. A caller that draws one measurement line
|
|
62
|
+
* per non-zero side will then correctly draw no lines at all for that pair;
|
|
63
|
+
* that is the intended reading, not a bug to chase down.
|
|
64
|
+
*/
|
|
65
|
+
export declare function quadDistances(anchor: Box, target: Box): QuadResult;
|
|
66
|
+
export interface QuadSpan {
|
|
67
|
+
a: Vec;
|
|
68
|
+
b: Vec;
|
|
69
|
+
value: number;
|
|
70
|
+
side: EdgeSide;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* The four distances as drawable spans.
|
|
74
|
+
*
|
|
75
|
+
* Each span runs through {@link quadCentre}, so that four simultaneous
|
|
76
|
+
* measurement lines don't cross each other, and covers exactly the distance
|
|
77
|
+
* it is labelled with. Nested boxes span from the outer edge in to the inner
|
|
78
|
+
* one. Disjoint boxes span the gap between the two edges that *face* each
|
|
79
|
+
* other — measured from the anchor's edge to the target's far one instead,
|
|
80
|
+
* the line overshot the gap by the whole target, and a heading 4px above its
|
|
81
|
+
* subtitle drew a 24px line labelled 4.
|
|
82
|
+
*
|
|
83
|
+
* Sides with no distance are dropped: a measurement line of length 0 is not
|
|
84
|
+
* the statement "0 pixels" — it is no statement at all, and two ticks
|
|
85
|
+
* stacked on top of each other read as a drawing fault.
|
|
86
|
+
*/
|
|
87
|
+
export declare function quadSpans(anchor: Box, target: Box): QuadSpan[];
|
|
88
|
+
/**
|
|
89
|
+
* Turns spans into the exact shape the template draws, using the same
|
|
90
|
+
* tick/label helpers the primary drag measurement uses.
|
|
91
|
+
*
|
|
92
|
+
* Every hover line is unpinned and carries no snap echoes — an element-to-
|
|
93
|
+
* element span has no single snapped-to edge to retrace. The value is
|
|
94
|
+
* divided by `zoom` because `quadSpans`' boxes come from
|
|
95
|
+
* `getBoundingClientRect` and so arrive in screen pixels, unlike the drag
|
|
96
|
+
* measurement's points, which are already `.demo-wrap`-local CSS pixels; the
|
|
97
|
+
* division goes through `safeZoom`, the same guard `toLocal` and `toScreen`
|
|
98
|
+
* use, so that a zoom of 0 cannot turn the text into `NaN` and a negative
|
|
99
|
+
* one cannot flip the sign of every reading. The text itself carries no
|
|
100
|
+
* unit: four `px` values in a tight space would be noise, the same
|
|
101
|
+
* reasoning `formatMeasure`'s own doc gives.
|
|
102
|
+
*/
|
|
103
|
+
export declare function quadLines(spans: QuadSpan[], centre: Vec, zoom: number): RenderedLine[];
|
|
104
|
+
/**
|
|
105
|
+
* The same four values as one line of text, for the live region.
|
|
106
|
+
*
|
|
107
|
+
* The drawn readout drops the unit and relies on position to say which side
|
|
108
|
+
* each number belongs to — neither of which survives being read aloud, so
|
|
109
|
+
* this names the side and keeps the `px`. Without it the four-sided readout
|
|
110
|
+
* is announced to nobody: the live region only ever carried the drag
|
|
111
|
+
* measurement, and alt-hover never produces one.
|
|
112
|
+
*/
|
|
113
|
+
export declare function quadSummary(spans: QuadSpan[], zoom: number): string;
|
|
114
|
+
//# sourceMappingURL=measure-quad.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"measure-quad.d.ts","sourceRoot":"","sources":["../../../src/app/canvas/measure-quad.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AAC7D,OAAO,EAAiC,KAAK,YAAY,EAA2B,KAAK,GAAG,EAAE,MAAM,uBAAuB,CAAC;AAE5H,4DAA4D;AAC5D,MAAM,WAAW,GAAG;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAClB;AAED,+CAA+C;AAC/C,MAAM,WAAW,WAAW;IACxB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAClB;AAED;;;;;;;;GAQG;AACH,wBAAgB,SAAS,CAAC,GAAG,EAAE,GAAG,GAAG,WAAW,CAE/C;AAED,MAAM,WAAW,UAAU;IACvB,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,qGAAqG;IACrG,SAAS,EAAE,OAAO,CAAC;CACtB;AAyBD;;;;;;;;GAQG;AACH,wBAAgB,UAAU,CAAC,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,GAAG,GAAG,CAIxD;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,GAAG,UAAU,CAyBlE;AAED,MAAM,WAAW,QAAQ;IACrB,CAAC,EAAE,GAAG,CAAC;IACP,CAAC,EAAE,GAAG,CAAC;IACP,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,QAAQ,CAAC;CAClB;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,SAAS,CAAC,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,GAAG,QAAQ,EAAE,CA2B9D;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,QAAQ,EAAE,EAAE,MAAM,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,GAAG,YAAY,EAAE,CAatF;AAED;;;;;;;;GAQG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,QAAQ,EAAE,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAInE"}
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
import { formatMeasure, labelPlacement, safeZoom, tickEndpoints } from './measure-geometry.js';
|
|
2
|
+
/**
|
|
3
|
+
* A {@link Box} as an SVG `<rect>`.
|
|
4
|
+
*
|
|
5
|
+
* Spec §4.5 asks for the anchor and the target to be outlined alongside the
|
|
6
|
+
* four numbers, and `<rect>` wants an origin and a size where `Box` carries
|
|
7
|
+
* two opposite corners. Trivial arithmetic, kept out of the component for
|
|
8
|
+
* the same reason the rest of this module is: the component should hold
|
|
9
|
+
* nothing but the DOM reads.
|
|
10
|
+
*/
|
|
11
|
+
export function outlineOf(box) {
|
|
12
|
+
return { x: box.left, y: box.top, width: box.right - box.left, height: box.bottom - box.top };
|
|
13
|
+
}
|
|
14
|
+
/** True when `inner` lies entirely inside `outer`, shared edges included. */
|
|
15
|
+
function within(inner, outer) {
|
|
16
|
+
return inner.left >= outer.left && inner.top >= outer.top && inner.right <= outer.right && inner.bottom <= outer.bottom;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* The two boxes as container and contained, or `null` when neither holds
|
|
20
|
+
* the other.
|
|
21
|
+
*
|
|
22
|
+
* Which of the two was picked first says nothing about which one is the
|
|
23
|
+
* container: alt-clicking a label and hovering its card asks exactly the
|
|
24
|
+
* question that alt-clicking the card and hovering the label does. Checking
|
|
25
|
+
* only the target-inside-anchor order sent the other one to the disjoint
|
|
26
|
+
* reading, where two nested boxes overlap on both axes and every side comes
|
|
27
|
+
* back 0 — two outlines on screen and not a single number between them.
|
|
28
|
+
*/
|
|
29
|
+
function nesting(anchor, target) {
|
|
30
|
+
if (within(target, anchor))
|
|
31
|
+
return { outer: anchor, inner: target };
|
|
32
|
+
if (within(anchor, target))
|
|
33
|
+
return { outer: target, inner: anchor };
|
|
34
|
+
return null;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* The point the spans run through: the middle of the inner box when one
|
|
38
|
+
* contains the other, the middle of the target otherwise.
|
|
39
|
+
*
|
|
40
|
+
* Exported because `quadLines` needs the same point to place short labels
|
|
41
|
+
* away from, and both orders of a containment have to agree on it — or the
|
|
42
|
+
* same reading would put its labels on different sides depending on which
|
|
43
|
+
* box was clicked first.
|
|
44
|
+
*/
|
|
45
|
+
export function quadCentre(anchor, target) {
|
|
46
|
+
const { left, top, right, bottom } = nesting(anchor, target)?.inner ?? target;
|
|
47
|
+
return { x: (left + right) / 2, y: (top + bottom) / 2 };
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* The distances between two boxes, border-box to border-box.
|
|
51
|
+
*
|
|
52
|
+
* Two reading modes, because two different questions sit behind them. When
|
|
53
|
+
* one box lies **inside** the other (in either order, see {@link nesting}),
|
|
54
|
+
* what you want is the four insets — that is the case where 16/16 makes a
|
|
55
|
+
* container's padding visible. When the boxes sit **beside** each other,
|
|
56
|
+
* there are no four insets, only a gap per axis; reporting an inset there
|
|
57
|
+
* would mean presenting negative numbers as distances.
|
|
58
|
+
*
|
|
59
|
+
* Partial overlap counts as "not contained": there, exactly one side would
|
|
60
|
+
* go negative, and one negative inset next to three positive ones reads as a
|
|
61
|
+
* measurement fault rather than as the statement "sticks out".
|
|
62
|
+
*
|
|
63
|
+
* A target that overlaps the anchor on both axes — the partial-overlap case
|
|
64
|
+
* above included — reports zero on every side, because there is no gap on
|
|
65
|
+
* either axis to put a number on. A caller that draws one measurement line
|
|
66
|
+
* per non-zero side will then correctly draw no lines at all for that pair;
|
|
67
|
+
* that is the intended reading, not a bug to chase down.
|
|
68
|
+
*/
|
|
69
|
+
export function quadDistances(anchor, target) {
|
|
70
|
+
const nested = nesting(anchor, target);
|
|
71
|
+
if (nested) {
|
|
72
|
+
const { outer, inner } = nested;
|
|
73
|
+
return {
|
|
74
|
+
top: inner.top - outer.top,
|
|
75
|
+
right: outer.right - inner.right,
|
|
76
|
+
bottom: outer.bottom - inner.bottom,
|
|
77
|
+
left: inner.left - outer.left,
|
|
78
|
+
contained: true
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
const gapX = Math.max(0, Math.max(anchor.left - target.right, target.left - anchor.right));
|
|
82
|
+
const gapY = Math.max(0, Math.max(anchor.top - target.bottom, target.top - anchor.bottom));
|
|
83
|
+
return {
|
|
84
|
+
top: target.bottom <= anchor.top ? gapY : 0,
|
|
85
|
+
right: target.left >= anchor.right ? gapX : 0,
|
|
86
|
+
bottom: target.top >= anchor.bottom ? gapY : 0,
|
|
87
|
+
left: target.right <= anchor.left ? gapX : 0,
|
|
88
|
+
contained: false
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* The four distances as drawable spans.
|
|
93
|
+
*
|
|
94
|
+
* Each span runs through {@link quadCentre}, so that four simultaneous
|
|
95
|
+
* measurement lines don't cross each other, and covers exactly the distance
|
|
96
|
+
* it is labelled with. Nested boxes span from the outer edge in to the inner
|
|
97
|
+
* one. Disjoint boxes span the gap between the two edges that *face* each
|
|
98
|
+
* other — measured from the anchor's edge to the target's far one instead,
|
|
99
|
+
* the line overshot the gap by the whole target, and a heading 4px above its
|
|
100
|
+
* subtitle drew a 24px line labelled 4.
|
|
101
|
+
*
|
|
102
|
+
* Sides with no distance are dropped: a measurement line of length 0 is not
|
|
103
|
+
* the statement "0 pixels" — it is no statement at all, and two ticks
|
|
104
|
+
* stacked on top of each other read as a drawing fault.
|
|
105
|
+
*/
|
|
106
|
+
export function quadSpans(anchor, target) {
|
|
107
|
+
const d = quadDistances(anchor, target);
|
|
108
|
+
const nested = nesting(anchor, target);
|
|
109
|
+
const { x: cx, y: cy } = quadCentre(anchor, target);
|
|
110
|
+
// Per side, the two coordinates the span runs between along its axis —
|
|
111
|
+
// top and left first, so every span points the same way in both readings.
|
|
112
|
+
const [top, right, bottom, left] = nested
|
|
113
|
+
? [
|
|
114
|
+
[nested.outer.top, nested.inner.top],
|
|
115
|
+
[nested.inner.right, nested.outer.right],
|
|
116
|
+
[nested.inner.bottom, nested.outer.bottom],
|
|
117
|
+
[nested.outer.left, nested.inner.left]
|
|
118
|
+
]
|
|
119
|
+
: [
|
|
120
|
+
[target.bottom, anchor.top],
|
|
121
|
+
[anchor.right, target.left],
|
|
122
|
+
[anchor.bottom, target.top],
|
|
123
|
+
[target.right, anchor.left]
|
|
124
|
+
];
|
|
125
|
+
const all = [
|
|
126
|
+
{ a: { x: cx, y: top[0] }, b: { x: cx, y: top[1] }, value: d.top, side: 'top' },
|
|
127
|
+
{ a: { x: right[0], y: cy }, b: { x: right[1], y: cy }, value: d.right, side: 'right' },
|
|
128
|
+
{ a: { x: cx, y: bottom[0] }, b: { x: cx, y: bottom[1] }, value: d.bottom, side: 'bottom' },
|
|
129
|
+
{ a: { x: left[0], y: cy }, b: { x: left[1], y: cy }, value: d.left, side: 'left' }
|
|
130
|
+
];
|
|
131
|
+
return all.filter((s) => s.value !== 0);
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Turns spans into the exact shape the template draws, using the same
|
|
135
|
+
* tick/label helpers the primary drag measurement uses.
|
|
136
|
+
*
|
|
137
|
+
* Every hover line is unpinned and carries no snap echoes — an element-to-
|
|
138
|
+
* element span has no single snapped-to edge to retrace. The value is
|
|
139
|
+
* divided by `zoom` because `quadSpans`' boxes come from
|
|
140
|
+
* `getBoundingClientRect` and so arrive in screen pixels, unlike the drag
|
|
141
|
+
* measurement's points, which are already `.demo-wrap`-local CSS pixels; the
|
|
142
|
+
* division goes through `safeZoom`, the same guard `toLocal` and `toScreen`
|
|
143
|
+
* use, so that a zoom of 0 cannot turn the text into `NaN` and a negative
|
|
144
|
+
* one cannot flip the sign of every reading. The text itself carries no
|
|
145
|
+
* unit: four `px` values in a tight space would be noise, the same
|
|
146
|
+
* reasoning `formatMeasure`'s own doc gives.
|
|
147
|
+
*/
|
|
148
|
+
export function quadLines(spans, centre, zoom) {
|
|
149
|
+
const z = safeZoom(zoom);
|
|
150
|
+
return spans.map(({ a, b, value }) => ({
|
|
151
|
+
a,
|
|
152
|
+
b,
|
|
153
|
+
tickA: tickEndpoints(a, b, 'a'),
|
|
154
|
+
tickB: tickEndpoints(a, b, 'b'),
|
|
155
|
+
label: labelPlacement(a, b, centre),
|
|
156
|
+
text: formatMeasure(value / z),
|
|
157
|
+
pinned: false,
|
|
158
|
+
echoes: []
|
|
159
|
+
}));
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* The same four values as one line of text, for the live region.
|
|
163
|
+
*
|
|
164
|
+
* The drawn readout drops the unit and relies on position to say which side
|
|
165
|
+
* each number belongs to — neither of which survives being read aloud, so
|
|
166
|
+
* this names the side and keeps the `px`. Without it the four-sided readout
|
|
167
|
+
* is announced to nobody: the live region only ever carried the drag
|
|
168
|
+
* measurement, and alt-hover never produces one.
|
|
169
|
+
*/
|
|
170
|
+
export function quadSummary(spans, zoom) {
|
|
171
|
+
const z = safeZoom(zoom);
|
|
172
|
+
return spans.map(({ side, value }) => `${side} ${formatMeasure(value / z)} px`).join(', ');
|
|
173
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { type EdgeSide, type SnapKind } from '../../shared/measure.type.js';
|
|
2
|
+
import type { Vec } from './measure-geometry.js';
|
|
3
|
+
import type { Box } from './measure-quad.js';
|
|
4
|
+
export type Sides = Record<EdgeSide, number>;
|
|
5
|
+
export interface ElementBox {
|
|
6
|
+
rect: Box;
|
|
7
|
+
border: Sides;
|
|
8
|
+
padding: Sides;
|
|
9
|
+
}
|
|
10
|
+
export interface SnapTarget {
|
|
11
|
+
kind: SnapKind;
|
|
12
|
+
side: EdgeSide;
|
|
13
|
+
/** Which coordinate the edge fixes — `left`/`right` are x, the other two are y. */
|
|
14
|
+
axis: 'x' | 'y';
|
|
15
|
+
at: number;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* The impure half: translating an element into plain numbers.
|
|
19
|
+
*
|
|
20
|
+
* Kept separate from {@link snapTargetsFor} so the edge arithmetic stays
|
|
21
|
+
* testable without a DOM — the same relationship as between `getBoxModel()`
|
|
22
|
+
* and its presentation in the box-model plugin.
|
|
23
|
+
*/
|
|
24
|
+
export declare function readElementBox(element: Element): ElementBox;
|
|
25
|
+
/** An element's border, padding and content edges — twelve of them. */
|
|
26
|
+
export declare function snapTargetsFor(box: ElementBox): SnapTarget[];
|
|
27
|
+
/**
|
|
28
|
+
* The edge a point snaps to — or `null`.
|
|
29
|
+
*
|
|
30
|
+
* `null` is not a failure case but an equally valid result: a free point.
|
|
31
|
+
* A tool that always latched could not measure exactly the things that lie
|
|
32
|
+
* between edges.
|
|
33
|
+
*/
|
|
34
|
+
export declare function nearestSnap(point: Vec, targets: readonly SnapTarget[], tolerance?: number): SnapTarget | null;
|
|
35
|
+
//# sourceMappingURL=measure-snap.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"measure-snap.d.ts","sourceRoot":"","sources":["../../../src/app/canvas/measure-snap.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,QAAQ,EAA0B,KAAK,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AACpG,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAC;AACjD,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAE7C,MAAM,MAAM,KAAK,GAAG,MAAM,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;AAE7C,MAAM,WAAW,UAAU;IACvB,IAAI,EAAE,GAAG,CAAC;IACV,MAAM,EAAE,KAAK,CAAC;IACd,OAAO,EAAE,KAAK,CAAC;CAClB;AAED,MAAM,WAAW,UAAU;IACvB,IAAI,EAAE,QAAQ,CAAC;IACf,IAAI,EAAE,QAAQ,CAAC;IACf,mFAAmF;IACnF,IAAI,EAAE,GAAG,GAAG,GAAG,CAAC;IAChB,EAAE,EAAE,MAAM,CAAC;CACd;AAQD;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,OAAO,GAAG,UAAU,CAS3D;AAED,uEAAuE;AACvE,wBAAgB,cAAc,CAAC,GAAG,EAAE,UAAU,GAAG,UAAU,EAAE,CAwB5D;AAED;;;;;;GAMG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,GAAG,EAAE,OAAO,EAAE,SAAS,UAAU,EAAE,EAAE,SAAS,GAAE,MAA+B,GAAG,UAAU,GAAG,IAAI,CAcrI"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { MEASURE_SNAP_TOLERANCE } from '../../shared/measure.type.js';
|
|
2
|
+
function parseSides(style, prefix, suffix) {
|
|
3
|
+
const read = (side) => parseFloat(style.getPropertyValue(`${prefix}-${side}${suffix}`)) || 0;
|
|
4
|
+
return { top: read('top'), right: read('right'), bottom: read('bottom'), left: read('left') };
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* The impure half: translating an element into plain numbers.
|
|
8
|
+
*
|
|
9
|
+
* Kept separate from {@link snapTargetsFor} so the edge arithmetic stays
|
|
10
|
+
* testable without a DOM — the same relationship as between `getBoxModel()`
|
|
11
|
+
* and its presentation in the box-model plugin.
|
|
12
|
+
*/
|
|
13
|
+
export function readElementBox(element) {
|
|
14
|
+
const style = window.getComputedStyle(element);
|
|
15
|
+
const r = element.getBoundingClientRect();
|
|
16
|
+
return {
|
|
17
|
+
rect: { left: r.left, top: r.top, right: r.right, bottom: r.bottom },
|
|
18
|
+
border: parseSides(style, 'border', '-width'),
|
|
19
|
+
padding: parseSides(style, 'padding', '')
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
/** An element's border, padding and content edges — twelve of them. */
|
|
23
|
+
export function snapTargetsFor(box) {
|
|
24
|
+
const { rect, border, padding } = box;
|
|
25
|
+
const insets = {
|
|
26
|
+
border: { top: 0, right: 0, bottom: 0, left: 0 },
|
|
27
|
+
padding: border,
|
|
28
|
+
content: {
|
|
29
|
+
top: border.top + padding.top,
|
|
30
|
+
right: border.right + padding.right,
|
|
31
|
+
bottom: border.bottom + padding.bottom,
|
|
32
|
+
left: border.left + padding.left
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
const targets = [];
|
|
36
|
+
for (const kind of ['border', 'padding', 'content']) {
|
|
37
|
+
const i = insets[kind];
|
|
38
|
+
targets.push({ kind, side: 'left', axis: 'x', at: rect.left + i.left });
|
|
39
|
+
targets.push({ kind, side: 'right', axis: 'x', at: rect.right - i.right });
|
|
40
|
+
targets.push({ kind, side: 'top', axis: 'y', at: rect.top + i.top });
|
|
41
|
+
targets.push({ kind, side: 'bottom', axis: 'y', at: rect.bottom - i.bottom });
|
|
42
|
+
}
|
|
43
|
+
return targets;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* The edge a point snaps to — or `null`.
|
|
47
|
+
*
|
|
48
|
+
* `null` is not a failure case but an equally valid result: a free point.
|
|
49
|
+
* A tool that always latched could not measure exactly the things that lie
|
|
50
|
+
* between edges.
|
|
51
|
+
*/
|
|
52
|
+
export function nearestSnap(point, targets, tolerance = MEASURE_SNAP_TOLERANCE) {
|
|
53
|
+
let best = null;
|
|
54
|
+
let bestDistance = Infinity;
|
|
55
|
+
for (const target of targets) {
|
|
56
|
+
const distance = Math.abs((target.axis === 'x' ? point.x : point.y) - target.at);
|
|
57
|
+
if (distance <= tolerance && distance < bestDistance) {
|
|
58
|
+
best = target;
|
|
59
|
+
bestDistance = distance;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
return best;
|
|
63
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prism-canvas-bg-pill.component.d.ts","sourceRoot":"","sources":["../../../src/app/canvas/prism-canvas-bg-pill.component.ts"],"names":[],"mappings":";AAGA,
|
|
1
|
+
{"version":3,"file":"prism-canvas-bg-pill.component.d.ts","sourceRoot":"","sources":["../../../src/app/canvas/prism-canvas-bg-pill.component.ts"],"names":[],"mappings":";AAGA,qBAOa,0BAA0B;IACnC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAiC;IAE3D,SAAS,CAAC,QAAQ,CAAC,WAAW,gGAA8B;IAC5D,SAAS,CAAC,QAAQ,CAAC,OAAO,0CAA8B;IAExD,SAAS,CAAC,KAAK,IAAI,IAAI;yCANd,0BAA0B;2CAA1B,0BAA0B;CAStC"}
|
|
@@ -27,25 +27,10 @@ export class PrismCanvasBgPillComponent {
|
|
|
27
27
|
i0.ɵɵconditionalCreate(0, PrismCanvasBgPillComponent_Conditional_0_Template, 5, 1, "div", 0);
|
|
28
28
|
} if (rf & 2) {
|
|
29
29
|
i0.ɵɵconditional(ctx.visible() ? 0 : -1);
|
|
30
|
-
} }, styles: ["\n\n\n\n\n\n
|
|
30
|
+
} }, styles: ["\n\n\n\n\n\n[_nghost-%COMP%] {\n position: absolute;\n top: var(--%NS%prism-canvas-overlay-top, 12px);\n left: var(--%NS%prism-canvas-overlay-inline, 20px);\n z-index: 2;\n pointer-events: none;\n transition:\n top var(--%NS%dur-base),\n left var(--%NS%dur-base);\n}\n\n.prism-bg-pill[_ngcontent-%COMP%] {\n display: inline-flex;\n gap: 8px;\n align-items: center;\n padding: 4px 4px 4px 10px;\n font-family: var(--%NS%font-sans);\n font-size: var(--%NS%fs-xs);\n color: var(--%NS%prism-text-muted);\n pointer-events: auto;\n background: color-mix(in srgb, var(--%NS%prism-bg-elevated) 90%, transparent);\n border: 1px solid var(--%NS%prism-border);\n border-radius: 999px;\n backdrop-filter: blur(8px);\n animation: _ngcontent-%COMP%_fade-in var(--%NS%dur-base) ease-out;\n}\n\n.label[_ngcontent-%COMP%] {\n letter-spacing: 0.02em;\n}\n\n.reset[_ngcontent-%COMP%] {\n height: 22px;\n padding: 0 10px;\n font-family: inherit;\n font-size: inherit;\n font-weight: 500;\n color: var(--%NS%prism-text);\n cursor: pointer;\n background: color-mix(in srgb, var(--%NS%prism-primary) 12%, transparent);\n border: 1px solid color-mix(in srgb, var(--%NS%prism-primary) 25%, transparent);\n border-radius: 999px;\n transition: background var(--%NS%dur-fast);\n}\n\n.reset[_ngcontent-%COMP%]:hover {\n background: color-mix(in srgb, var(--%NS%prism-primary) 20%, transparent);\n}\n\n@keyframes _ngcontent-%COMP%_fade-in {\n from {\n opacity: 0;\n transform: translateY(-4px);\n }\n\n to {\n opacity: 1;\n transform: translateY(0);\n }\n}"] });
|
|
31
31
|
}
|
|
32
32
|
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(PrismCanvasBgPillComponent, [{
|
|
33
33
|
type: Component,
|
|
34
|
-
args: [{ selector: 'prism-canvas-bg-pill', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, template:
|
|
35
|
-
@if (visible()) {
|
|
36
|
-
<div class="prism-bg-pill">
|
|
37
|
-
<span class="label">Recommended: {{ recommended() }}</span>
|
|
38
|
-
<button
|
|
39
|
-
type="button"
|
|
40
|
-
class="reset"
|
|
41
|
-
title="Reset to recommended background"
|
|
42
|
-
aria-label="Reset to recommended background"
|
|
43
|
-
(click)="reset()"
|
|
44
|
-
>
|
|
45
|
-
Reset
|
|
46
|
-
</button>
|
|
47
|
-
</div>
|
|
48
|
-
}
|
|
49
|
-
`, styles: ["\n /* Top left, opposite the tool rail. Both used to claim the right corner and\n the rail won, hiding a notice whose whole job is to be noticed. The rail\n is permanent and the notice is not, so the permanent thing keeps the\n corner it sits in and this moves. Nothing else occupies the left corner:\n the zoom badge that used to live here was a duplicate of the readout the\n rail carries. */\n :host {\n position: absolute;\n top: var(--prism-canvas-overlay-top, 12px);\n left: var(--prism-canvas-overlay-inline, 20px);\n pointer-events: none;\n z-index: 2;\n transition: top var(--dur-base), left var(--dur-base);\n }\n .prism-bg-pill {\n display: inline-flex;\n align-items: center;\n gap: 8px;\n padding: 4px 4px 4px 10px;\n border-radius: 999px;\n font-size: var(--fs-xs);\n font-family: var(--font-sans);\n background: color-mix(in srgb, var(--prism-bg-elevated) 90%, transparent);\n border: 1px solid var(--prism-border);\n color: var(--prism-text-muted);\n backdrop-filter: blur(8px);\n pointer-events: auto;\n animation: fadeIn var(--dur-base) ease-out;\n }\n .label { letter-spacing: 0.02em; }\n .reset {\n height: 22px;\n padding: 0 10px;\n border-radius: 999px;\n background: color-mix(in srgb, var(--prism-primary) 12%, transparent);\n color: var(--prism-text);\n border: 1px solid color-mix(in srgb, var(--prism-primary) 25%, transparent);\n font-family: inherit;\n font-size: inherit;\n font-weight: 500;\n cursor: pointer;\n transition: background var(--dur-fast);\n }\n .reset:hover {\n background: color-mix(in srgb, var(--prism-primary) 20%, transparent);\n }\n @keyframes fadeIn {\n from { opacity: 0; transform: translateY(-4px); }\n to { opacity: 1; transform: translateY(0); }\n }\n "] }]
|
|
34
|
+
args: [{ selector: 'prism-canvas-bg-pill', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, template: "@if (visible()) {\n <div class=\"prism-bg-pill\">\n <span class=\"label\">Recommended: {{ recommended() }}</span>\n <button\n type=\"button\"\n class=\"reset\"\n title=\"Reset to recommended background\"\n aria-label=\"Reset to recommended background\"\n (click)=\"reset()\">\n Reset\n </button>\n </div>\n}\n", styles: ["/* Top left, opposite the tool rail. Both used to claim the right corner and\n the rail won, hiding a notice whose whole job is to be noticed. The rail\n is permanent and the notice is not, so the permanent thing keeps the\n corner it sits in and this moves. Nothing else occupies the left corner:\n the zoom badge that used to live here was a duplicate of the readout the\n rail carries. */\n:host {\n position: absolute;\n top: var(--prism-canvas-overlay-top, 12px);\n left: var(--prism-canvas-overlay-inline, 20px);\n z-index: 2;\n pointer-events: none;\n transition:\n top var(--dur-base),\n left var(--dur-base);\n}\n\n.prism-bg-pill {\n display: inline-flex;\n gap: 8px;\n align-items: center;\n padding: 4px 4px 4px 10px;\n font-family: var(--font-sans);\n font-size: var(--fs-xs);\n color: var(--prism-text-muted);\n pointer-events: auto;\n background: color-mix(in srgb, var(--prism-bg-elevated) 90%, transparent);\n border: 1px solid var(--prism-border);\n border-radius: 999px;\n backdrop-filter: blur(8px);\n animation: fade-in var(--dur-base) ease-out;\n}\n\n.label {\n letter-spacing: 0.02em;\n}\n\n.reset {\n height: 22px;\n padding: 0 10px;\n font-family: inherit;\n font-size: inherit;\n font-weight: 500;\n color: var(--prism-text);\n cursor: pointer;\n background: color-mix(in srgb, var(--prism-primary) 12%, transparent);\n border: 1px solid color-mix(in srgb, var(--prism-primary) 25%, transparent);\n border-radius: 999px;\n transition: background var(--dur-fast);\n}\n\n.reset:hover {\n background: color-mix(in srgb, var(--prism-primary) 20%, transparent);\n}\n\n@keyframes fade-in {\n from {\n opacity: 0;\n transform: translateY(-4px);\n }\n\n to {\n opacity: 1;\n transform: translateY(0);\n }\n}\n"] }]
|
|
50
35
|
}], null, null); })();
|
|
51
|
-
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(PrismCanvasBgPillComponent, { className: "PrismCanvasBgPillComponent", filePath: "app/canvas/prism-canvas-bg-pill.component.ts", lineNumber:
|
|
36
|
+
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(PrismCanvasBgPillComponent, { className: "PrismCanvasBgPillComponent", filePath: "app/canvas/prism-canvas-bg-pill.component.ts", lineNumber: 11 }); })();
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import { type MeasurePoint } from '../../shared/measure.type.js';
|
|
2
|
+
import { PrismMeasureService } from '../services/prism-measure.service.js';
|
|
3
|
+
import { type RenderedLine, type Vec } from './measure-geometry.js';
|
|
4
|
+
import { type OutlineRect } from './measure-quad.js';
|
|
5
|
+
import * as i0 from "@angular/core";
|
|
6
|
+
/**
|
|
7
|
+
* The topmost element under a screen point that belongs to the specimen.
|
|
8
|
+
*
|
|
9
|
+
* `elementsFromPoint`, the plural one, and the loop are what make this work
|
|
10
|
+
* at all. The overlay host sits above `.demo-wrap` (see the `z-index` in the
|
|
11
|
+
* stylesheet and why it has to be there) and is the one layer that takes
|
|
12
|
+
* pointer events across the whole stage — so the singular `elementFromPoint`
|
|
13
|
+
* answers the overlay itself for every point over the specimen, `contains`
|
|
14
|
+
* then rejects it, and snapping and alt-click anchoring both stop working
|
|
15
|
+
* entirely. Walking the hit list past the overlay's own subtree is what
|
|
16
|
+
* gives the element actually underneath it.
|
|
17
|
+
*
|
|
18
|
+
* The `contains` check stays, and is still not optional: the toolrail and
|
|
19
|
+
* the viewport grips sit *above* the overlay, so they appear in the hit list
|
|
20
|
+
* ahead of anything in the specimen. Only the first hit the rendered root
|
|
21
|
+
* owns is the one the tool may latch onto.
|
|
22
|
+
*/
|
|
23
|
+
export declare function elementUnderPoint(x: number, y: number, root: Element | null): Element | null;
|
|
24
|
+
export declare function echoFor(point: MeasurePoint, screen: Vec): [Vec, Vec] | null;
|
|
25
|
+
/**
|
|
26
|
+
* Wires the two triggers that tell `lines` its drawn geometry might be
|
|
27
|
+
* stale, and returns how to undo them.
|
|
28
|
+
*
|
|
29
|
+
* A `ResizeObserver` on `stage` and `wrap` covers window resize, panel
|
|
30
|
+
* resize, and the specimen itself changing size. Resize alone is not enough
|
|
31
|
+
* because scrolling moves the specimen without resizing anything — a
|
|
32
|
+
* `ResizeObserver` does not fire on scroll — so `stage` also gets its own
|
|
33
|
+
* `scroll` listener. Dropping either one leaves the lines drawn at a screen
|
|
34
|
+
* position the specimen has since left, which is the worst impression a
|
|
35
|
+
* measuring tool can make.
|
|
36
|
+
*
|
|
37
|
+
* Takes the `ResizeObserver` constructor as a parameter instead of reading
|
|
38
|
+
* the global directly so the wiring stays testable without a real one:
|
|
39
|
+
* jsdom does not implement `ResizeObserver` at all, the same gap
|
|
40
|
+
* `elementsFromPoint` has above.
|
|
41
|
+
*/
|
|
42
|
+
export declare function watchGeometry(stage: Element, wrap: Element | null, onChange: () => void, ResizeObserverCtor?: typeof ResizeObserver): () => void;
|
|
43
|
+
/** Everything alt-hover mode puts on screen for one anchor/target pair. */
|
|
44
|
+
export interface HoverReadout {
|
|
45
|
+
/** The up-to-four spans between the anchor and the hovered element. */
|
|
46
|
+
lines: RenderedLine[];
|
|
47
|
+
/** The same values named and spoken, for the live region. Empty when there is nothing to say. */
|
|
48
|
+
summary: string;
|
|
49
|
+
/** The anchor's box, drawn dashed (Spec §4.5). Set as soon as an anchor is. */
|
|
50
|
+
anchor: OutlineRect | null;
|
|
51
|
+
/** The hovered element's box, drawn solid (Spec §4.5). */
|
|
52
|
+
target: OutlineRect | null;
|
|
53
|
+
/**
|
|
54
|
+
* True while `anchor` is only a prediction: Alt is held, nothing is
|
|
55
|
+
* anchored yet, and this is what a click would take. Drawn fainter, so the
|
|
56
|
+
* click visibly firms it up rather than changing nothing.
|
|
57
|
+
*/
|
|
58
|
+
preview: boolean;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Keyboard support here only operates a draft that already exists: nudge,
|
|
62
|
+
* commit, cancel. There is deliberately no keyboard path to *start* one —
|
|
63
|
+
* Spec §10 calls for Tab to step through the specimen's snap targets as the
|
|
64
|
+
* accessible substitute for a pointer-down, and that is not built. Tab is
|
|
65
|
+
* left strictly alone by `onKey` (see its doc, and `nudge`'s) precisely so
|
|
66
|
+
* it stays free for that mechanism once it exists, rather than being
|
|
67
|
+
* repurposed here as a stand-in. The `aria-label` below only promises what
|
|
68
|
+
* this component actually does today; it does not mention Tab, because
|
|
69
|
+
* nothing happens when a user presses it. What the real interaction should
|
|
70
|
+
* be is still undecided — a tool covering the whole canvas cannot simply
|
|
71
|
+
* grab Tab for its own stepping without first deciding how a keyboard user
|
|
72
|
+
* gets back out, and that is a product decision, not one this task makes.
|
|
73
|
+
*/
|
|
74
|
+
export declare class PrismCanvasMeasureComponent {
|
|
75
|
+
private readonly el;
|
|
76
|
+
private readonly destroyRef;
|
|
77
|
+
private readonly canvas;
|
|
78
|
+
private readonly renderer;
|
|
79
|
+
protected readonly measure: PrismMeasureService;
|
|
80
|
+
/**
|
|
81
|
+
* Bumped whenever geometry `lines` depends on might have moved without
|
|
82
|
+
* touching zoom, pins or the draft — see {@link watchGeometry} below.
|
|
83
|
+
*
|
|
84
|
+
* `getBoundingClientRect()` inside `origin()`, `hostRect()`,
|
|
85
|
+
* `specimenCentre()` and `boxOf()` is not itself a reactive signal:
|
|
86
|
+
* without an explicit nudge like this one, nothing would tell `lines` to
|
|
87
|
+
* re-run after a scroll or a resize, and the drawn lines would stay put
|
|
88
|
+
* while the specimen moves out from under them. It covers the host's own
|
|
89
|
+
* rect too, so reading that per evaluation costs no new trigger.
|
|
90
|
+
*/
|
|
91
|
+
private readonly geometryTick;
|
|
92
|
+
/** Origin and zoom the projection runs from, in viewport coordinates. */
|
|
93
|
+
private origin;
|
|
94
|
+
/**
|
|
95
|
+
* The host's own rect — what every drawn coordinate is measured against.
|
|
96
|
+
*
|
|
97
|
+
* Read once per `lines()` / `hover()` evaluation and handed to
|
|
98
|
+
* {@link toHostSpace}, which carries the full explanation of why the
|
|
99
|
+
* subtraction exists at all.
|
|
100
|
+
*/
|
|
101
|
+
private hostRect;
|
|
102
|
+
protected readonly lines: import("@angular/core").Signal<RenderedLine[]>;
|
|
103
|
+
/**
|
|
104
|
+
* Everything the alt-hover mode draws, in one evaluation.
|
|
105
|
+
*
|
|
106
|
+
* One computed rather than three because all of it comes out of the same
|
|
107
|
+
* two `getBoundingClientRect()` reads, and splitting it would read the
|
|
108
|
+
* anchor's box once per consumer on every change detection pass.
|
|
109
|
+
*/
|
|
110
|
+
protected readonly hover: import("@angular/core").Signal<HoverReadout>;
|
|
111
|
+
/** The element under the pointer while alt-hovering, `null` otherwise. */
|
|
112
|
+
private readonly hoverTarget;
|
|
113
|
+
/**
|
|
114
|
+
* An element's current rectangle as a {@link Box}, already in host
|
|
115
|
+
* space.
|
|
116
|
+
*
|
|
117
|
+
* Projected here rather than at the four call sites downstream: a box
|
|
118
|
+
* that reached `quadSpans` in viewport coordinates would produce correct
|
|
119
|
+
* *distances* — a constant offset cancels in a subtraction — and draw
|
|
120
|
+
* them in the wrong place, which is the half that is actually visible.
|
|
121
|
+
*/
|
|
122
|
+
private boxOf;
|
|
123
|
+
private specimenCentre;
|
|
124
|
+
/** A pointer point, snapped to the nearest edge, in local coordinates. */
|
|
125
|
+
private pointAt;
|
|
126
|
+
/**
|
|
127
|
+
* Keyboard operation of the running draft.
|
|
128
|
+
*
|
|
129
|
+
* `Escape` and `Enter` act regardless of what `nudge` would say about the
|
|
130
|
+
* key; everything else only matters while a draft is open.
|
|
131
|
+
* `preventDefault` is called only on the branches that actually consumed
|
|
132
|
+
* the key — never for `Tab`, which `nudge` returns `null` for and this
|
|
133
|
+
* method then leaves untouched. Swallowing it here would break keyboard
|
|
134
|
+
* navigation of the whole shell for the sake of a tool that, as shipped,
|
|
135
|
+
* has nothing of its own to put Tab to — see `nudge`'s doc.
|
|
136
|
+
*/
|
|
137
|
+
protected onKey(event: KeyboardEvent): void;
|
|
138
|
+
constructor();
|
|
139
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<PrismCanvasMeasureComponent, never>;
|
|
140
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<PrismCanvasMeasureComponent, "prism-canvas-measure", never, {}, {}, never, never, true, never>;
|
|
141
|
+
}
|
|
142
|
+
//# sourceMappingURL=prism-canvas-measure.component.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prism-canvas-measure.component.d.ts","sourceRoot":"","sources":["../../../src/app/canvas/prism-canvas-measure.component.ts"],"names":[],"mappings":"AACA,OAAO,EAA0B,KAAK,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAEzF,OAAO,EAAE,mBAAmB,EAAE,MAAM,sCAAsC,CAAC;AAE3E,OAAO,EAMH,KAAK,YAAY,EAKjB,KAAK,GAAG,EACX,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EAAuB,KAAK,WAAW,EAAiD,MAAM,mBAAmB,CAAC;;AAGzH;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,iBAAiB,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,GAAG,IAAI,GAAG,OAAO,GAAG,IAAI,CAQ5F;AAWD,wBAAgB,OAAO,CAAC,KAAK,EAAE,YAAY,EAAE,MAAM,EAAE,GAAG,GAAG,CAAC,GAAG,EAAE,GAAG,CAAC,GAAG,IAAI,CAa3E;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,GAAG,IAAI,EAAE,QAAQ,EAAE,MAAM,IAAI,EAAE,kBAAkB,GAAE,OAAO,cAA+B,GAAG,MAAM,IAAI,CAWhK;AAED,2EAA2E;AAC3E,MAAM,WAAW,YAAY;IACzB,uEAAuE;IACvE,KAAK,EAAE,YAAY,EAAE,CAAC;IACtB,iGAAiG;IACjG,OAAO,EAAE,MAAM,CAAC;IAChB,+EAA+E;IAC/E,MAAM,EAAE,WAAW,GAAG,IAAI,CAAC;IAC3B,0DAA0D;IAC1D,MAAM,EAAE,WAAW,GAAG,IAAI,CAAC;IAC3B;;;;OAIG;IACH,OAAO,EAAE,OAAO,CAAC;CACpB;AAID;;;;;;;;;;;;;GAaG;AACH,qBAyBa,2BAA2B;IACpC,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAmC;IACtD,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAsB;IACjD,OAAO,CAAC,QAAQ,CAAC,MAAM,CAA8B;IACrD,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAgC;IACzD,SAAS,CAAC,QAAQ,CAAC,OAAO,sBAA+B;IAEzD;;;;;;;;;;OAUG;IACH,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAa;IAE1C,yEAAyE;IACzE,OAAO,CAAC,MAAM;IAOd;;;;;;OAMG;IACH,OAAO,CAAC,QAAQ;IAIhB,SAAS,CAAC,QAAQ,CAAC,KAAK,iDAkCrB;IAEH;;;;;;OAMG;IACH,SAAS,CAAC,QAAQ,CAAC,KAAK,+CAsDrB;IAEH,0EAA0E;IAC1E,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAgC;IAE5D;;;;;;;;OAQG;IACH,OAAO,CAAC,KAAK;IAQb,OAAO,CAAC,cAAc;IAMtB,0EAA0E;IAC1E,OAAO,CAAC,OAAO;IAqBf;;;;;;;;;;OAUG;IACH,SAAS,CAAC,KAAK,CAAC,KAAK,EAAE,aAAa,GAAG,IAAI;;yCArMlC,2BAA2B;2CAA3B,2BAA2B;CAkUvC"}
|