@dereekb/dbx-web 13.41.0 → 13.43.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.
@@ -5,6 +5,7 @@
5
5
  @use './zip/zip';
6
6
  @use './help/help';
7
7
  @use './pdf/pdf';
8
+ @use './download/download';
8
9
 
9
10
  @mixin all-extension-core($theme-config) {
10
11
  $calendar-enabled: 1;
@@ -36,6 +37,7 @@
36
37
  }
37
38
 
38
39
  @include pdf.core();
40
+ @include download.core();
39
41
  }
40
42
 
41
43
  @mixin all-extension-typography($theme-config-or-typography-config) {
@@ -71,4 +73,5 @@
71
73
  }
72
74
 
73
75
  @include pdf.theme($theme-config);
76
+ @include download.theme($theme-config);
74
77
  }
@@ -0,0 +1,23 @@
1
+ @use '../../style/theming';
2
+
3
+ // MARK: Mixin
4
+ @mixin core() {
5
+ // The row borrows .dbx-list-item-padded/.dbx-list-two-line-item from _list.scss, so it only needs to be
6
+ // told to fill its container — otherwise a row placed in a flex column collapses to its content width.
7
+ .dbx-file-list,
8
+ .dbx-file-list-item {
9
+ width: 100%;
10
+ }
11
+
12
+ // the details line is assembled from separate spans (a label and a date), so the gap stands in for the
13
+ // space between them that the template has no reliable way to emit
14
+ .dbx-file-list-item .item-details {
15
+ display: flex;
16
+ flex-wrap: wrap;
17
+ align-items: baseline;
18
+ column-gap: var(--dbx-file-list-item-details-gap, 0.25em);
19
+ }
20
+ }
21
+
22
+ @mixin theme($theme-config) {
23
+ }
@@ -9,13 +9,23 @@ $dbx-flex-group-columns-count: 6;
9
9
  /// @dbx-utility flex-bar
10
10
  /// @intent horizontal action bar — flex row that scrolls horizontally before wrapping
11
11
  /// @role flex
12
- /// @see-also dbx-flex-center, dbx-flex-fill
12
+ /// @see-also dbx-flex-center, dbx-flex-fill, card-horizontal
13
13
  .dbx-flex-bar {
14
14
  display: flex;
15
15
  align-items: center;
16
16
  overflow-x: auto;
17
17
  overflow-y: hidden;
18
18
 
19
+ // `overflow-x: auto` makes this a scroll container, and a `box-shadow` never
20
+ // contributes to the scrollable overflow region — so an elevated child's shadow is
21
+ // CLIPPED at the edge rather than scrolled to. With `align-items: center` and no
22
+ // fixed height the bar hugs its tallest child exactly, putting the clip edge right on
23
+ // a raised button's border box. Reserve the shadow's reach as vertical padding so it
24
+ // lives INSIDE the padding box (the same fix `.dbx-card-horizontal` uses for its
25
+ // poking tab). Block axis only: `padding-inline` would push the first button off the
26
+ // bar's leading edge, and the horizontal cut is not what reads as broken.
27
+ padding-block: var(--dbx-shadow-gutter, 4px);
28
+
19
29
  // Constrain touch targets to prevent overflow scrollbar (48px default > 40px button)
20
30
  --mat-icon-button-touch-target-size: 40px;
21
31
  --mat-button-text-touch-target-size: 40px;
@@ -47,6 +47,13 @@ $header-left-reserved-space-small-screen: 120px;
47
47
 
48
48
  display: flex;
49
49
  align-items: center;
50
+
51
+ // The header row is a `.dbx-flex-bar`, so it carries the `--dbx-shadow-gutter`
52
+ // block padding that keeps a raised button's shadow from being clipped. Border-box
53
+ // makes the header's `min-height` / `height` absorb that gutter instead of adding
54
+ // to it, so the 48px row stays 48px (40px button + the gutter) rather than growing
55
+ // to 56px and overflowing a fixed-height section-page header.
56
+ box-sizing: border-box;
50
57
  }
51
58
  }
52
59
 
@@ -119,6 +126,14 @@ $header-left-reserved-space-small-screen: 120px;
119
126
  max-height: $content-navbar-height;
120
127
  max-width: 100%;
121
128
 
129
+ // Unlike the regular `.dbx-section` header (which only sets `min-height` and can
130
+ // absorb the gutter), this row is height-LOCKED to the navbar height and its title
131
+ // already fills it. The `.dbx-flex-bar` shadow gutter would eat 8px of that budget
132
+ // and shave the title, so opt this row out. A raised button in a section-PAGE
133
+ // header therefore still clips its shadow — the pre-existing behaviour; use a
134
+ // regular `.dbx-section` header when the action needs elevation.
135
+ #{theming.$shadow-gutter-var}: 0px;
136
+
122
137
  .dbx-section-header-content-title {
123
138
  max-width: calc(80% - var(--dbx-section-page-header-reserved-space, #{$header-left-reserved-space}));
124
139
  min-width: 48px;
@@ -31,6 +31,8 @@
31
31
  #{theming.$padding-4-var}: theming.get-dbx-layout-padding($theme-config, 4);
32
32
  #{theming.$padding-5-var}: theming.get-dbx-layout-padding($theme-config, 5);
33
33
 
34
+ #{theming.$shadow-gutter-var}: 4px;
35
+
34
36
  #{theming.$two-column-left-width-var}: theming.get-dbx-two-column-left-width($theme-config);
35
37
 
36
38
  #{theming.$dbx-app-height-additional-offset-var}: 0px;
@@ -43,6 +43,16 @@ $padding-4-var: --dbx-padding-4;
43
43
  /// @utility .dbx-p5, .dbx-mb5
44
44
  $padding-5-var: --dbx-padding-5;
45
45
 
46
+ /// Shadow gutter — the room a clipping/scrolling container must reserve INSIDE its
47
+ /// padding box so an elevated child's `box-shadow` isn't clipped at the edge.
48
+ /// Sized against Material's raised-button elevation: the resting shadow reaches
49
+ /// 2.5px below the border box and the hover shadow reaches 5px, so 4px clears the
50
+ /// resting state outright and all but the faintest 12% hover layer. Raise it to 5px
51
+ /// to clear hover completely, or set it to 0px to opt out.
52
+ /// @intent shadow gutter, elevation room, keep box-shadow from being clipped
53
+ /// @role spacing
54
+ $shadow-gutter-var: --dbx-shadow-gutter;
55
+
46
56
  $two-column-left-width-var: --dbx-two-column-left-width;
47
57
 
48
58
  $dbx-color-var: --dbx-color-current;
package/mapbox/README.md CHANGED
@@ -3,4 +3,53 @@
3
3
 
4
4
  The sources for this package are in the main [@dereekb/dbx-components](https://github.com/dereekb/dbx-components) repo. Please file issues and pull requests against that repo.
5
5
 
6
+ ## Required build asset: the mapbox-gl web worker
7
+
8
+ Apps using `provideDbxMapbox()` must copy mapbox-gl's prebuilt CSP web worker into their
9
+ assets. Add this entry to the `assets` array of the app's `build` target in `project.json`:
10
+
11
+ ```json
12
+ {
13
+ "input": "node_modules/mapbox-gl/dist",
14
+ "glob": "mapbox-gl-csp-worker.js",
15
+ "output": "assets/mapbox-gl"
16
+ }
17
+ ```
18
+
19
+ `provideDbxMapbox()` registers an app initializer that points `mapboxgl.workerUrl` at
20
+ `assets/mapbox-gl/mapbox-gl-csp-worker.js` before any map is created, and logs an error
21
+ naming this snippet if the asset is not reachable.
22
+
23
+ ### Why
24
+
25
+ mapbox-gl builds its web worker by stringifying two of its own functions into a `Blob`.
26
+ Only those function *bodies* are serialized, so anything the bundler hoists to module scope
27
+ is missing inside the worker. `@angular/build` unconditionally disables esbuild's
28
+ `object-rest-spread` support (a V8 performance workaround, still present in Angular 22), which
29
+ rewrites every object spread into exactly such a hoisted helper. From mapbox-gl **3.26.0** on
30
+ there are object spreads in the serialized worker code, so the worker dies while loading tiles:
31
+
32
+ ```
33
+ ReferenceError: __spreadValues is not defined at Ie.loadTile
34
+ ```
35
+
36
+ (In a production build the helper name is minified, so the same failure reads as
37
+ `ReferenceError: <mangled> is not defined`.)
38
+
39
+ Loading the worker from a real file instead of the generated blob — mapbox's own documented
40
+ `workerUrl` escape hatch — avoids the problem entirely at any mapbox-gl version. Copying the
41
+ asset out of the app's own `node_modules` keeps the worker in version lockstep with the
42
+ `mapbox-gl` the app bundles.
43
+
44
+ ### Options
45
+
46
+ `provideDbxMapbox({ worker })` accepts:
47
+
48
+ - `workerUrl` — serve the asset from somewhere other than the default path.
49
+ - `enabled: false` — restore mapbox-gl's stock blob worker. Only safe below mapbox-gl 3.26.0.
50
+
51
+ Note the CSP worker does not support the dynamically loaded RTL text plugin
52
+ (`setRTLTextPlugin`) or `addTileProvider` modules, which rely on a hook the blob worker
53
+ provides. Apps needing those must set `enabled: false` and stay below mapbox-gl 3.26.0.
54
+
6
55
  License: MIT
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dereekb/dbx-web",
3
- "version": "13.41.0",
3
+ "version": "13.43.0",
4
4
  "sideEffects": [
5
5
  "*.scss",
6
6
  "*.css"
@@ -13,12 +13,12 @@
13
13
  "@angular/material": "^21.2.9",
14
14
  "@angular/platform-browser": "21.2.11",
15
15
  "@cantoo/pdf-lib": "^2.6.5",
16
- "@dereekb/browser": "13.41.0",
17
- "@dereekb/date": "13.41.0",
18
- "@dereekb/dbx-core": "13.41.0",
19
- "@dereekb/rxjs": "13.41.0",
20
- "@dereekb/util": "13.41.0",
21
- "@dereekb/vitest": "13.41.0",
16
+ "@dereekb/browser": "13.43.0",
17
+ "@dereekb/date": "13.43.0",
18
+ "@dereekb/dbx-core": "13.43.0",
19
+ "@dereekb/rxjs": "13.43.0",
20
+ "@dereekb/util": "13.43.0",
21
+ "@dereekb/vitest": "13.43.0",
22
22
  "@ngbracket/ngx-layout": "^21.0.0",
23
23
  "@ngrx/component-store": "^21.1.0",
24
24
  "@ngrx/effects": "^21.1.0",
@@ -759,16 +759,98 @@ declare class DbxMapboxModule {
759
759
  static ɵinj: i0.ɵɵInjectorDeclaration<DbxMapboxModule>;
760
760
  }
761
761
 
762
+ /**
763
+ * Relative url the mapbox-gl CSP web worker asset is expected to be served from.
764
+ *
765
+ * The asset itself is copied out of `node_modules/mapbox-gl/dist/mapbox-gl-csp-worker.js`
766
+ * by the consuming app's build configuration, which keeps it in version lockstep with the
767
+ * `mapbox-gl` the app actually bundles.
768
+ */
769
+ declare const DEFAULT_DBX_MAPBOX_WORKER_URL = "assets/mapbox-gl/mapbox-gl-csp-worker.js";
770
+ /**
771
+ * Configuration for {@link configureDbxMapboxWorker}.
772
+ */
773
+ interface DbxMapboxWorkerConfig {
774
+ /**
775
+ * Whether or not to load mapbox-gl's web worker from a self-hosted asset instead of the
776
+ * default blob url.
777
+ *
778
+ * True by default. Set to false only to restore mapbox-gl's stock blob worker, which is
779
+ * broken in Angular/esbuild apps on mapbox-gl 3.26.0 and up.
780
+ */
781
+ readonly enabled?: Maybe<boolean>;
782
+ /**
783
+ * Url the mapbox-gl CSP web worker asset is served from.
784
+ *
785
+ * Defaults to {@link DEFAULT_DBX_MAPBOX_WORKER_URL}.
786
+ */
787
+ readonly workerUrl?: Maybe<string>;
788
+ }
789
+ /**
790
+ * Result of {@link configureDbxMapboxWorker}.
791
+ */
792
+ interface DbxMapboxWorkerConfigurationResult {
793
+ /**
794
+ * Whether or not the self-hosted worker was configured on mapbox-gl.
795
+ */
796
+ readonly configured: boolean;
797
+ /**
798
+ * Url that was configured, if any.
799
+ */
800
+ readonly workerUrl: Maybe<string>;
801
+ /**
802
+ * Whether or not the configured worker asset could be retrieved.
803
+ *
804
+ * Null when no check was performed.
805
+ */
806
+ readonly available: Maybe<boolean>;
807
+ }
808
+ /**
809
+ * Checks whether the mapbox-gl web worker asset is actually served from the given url.
810
+ *
811
+ * @param workerUrl - Url the worker asset is expected at.
812
+ * @returns True when the asset responds successfully.
813
+ */
814
+ declare function isDbxMapboxWorkerAssetAvailable(workerUrl: string): Promise<boolean>;
815
+ /**
816
+ * Configures mapbox-gl to load its web worker from a self-hosted copy of mapbox's prebuilt
817
+ * CSP worker rather than from the blob url it generates itself.
818
+ *
819
+ * mapbox-gl's default worker is built by stringifying two of its own functions into a blob.
820
+ * Only those function bodies are serialized, so any helper the bundler hoists to module
821
+ * scope is missing at runtime. `@angular/build` unconditionally disables esbuild's
822
+ * `object-rest-spread` support, which rewrites every object spread in mapbox-gl 3.26.0+ into
823
+ * exactly such a hoisted helper, and the worker then dies with a `ReferenceError` while
824
+ * loading tiles. Pointing `workerUrl` at a real file — mapbox's own documented CSP escape
825
+ * hatch — sidesteps the bug entirely, at any mapbox-gl version.
826
+ *
827
+ * Must be applied before the first `Map` is constructed.
828
+ *
829
+ * @param inputConfig - Configuration. Optional.
830
+ * @returns The applied configuration.
831
+ */
832
+ declare function configureDbxMapboxWorker(inputConfig?: Maybe<DbxMapboxWorkerConfig>): Promise<DbxMapboxWorkerConfigurationResult>;
833
+
762
834
  /**
763
835
  * Configuration for provideDbxMapbox().
764
836
  */
765
837
  interface ProvideDbxMapboxConfig {
766
838
  readonly dbxMapboxConfig: DbxMapboxConfig;
767
839
  readonly ngxMapboxGLModuleConfig: Parameters<typeof provideMapboxGL>[0];
840
+ /**
841
+ * Configuration for the self-hosted mapbox-gl web worker.
842
+ *
843
+ * Enabled by default. See {@link configureDbxMapboxWorker} for why it is needed and
844
+ * which build asset the app must copy.
845
+ */
846
+ readonly worker?: Maybe<DbxMapboxWorkerConfig>;
768
847
  }
769
848
  /**
770
849
  * Creates EnvironmentProviders for providing DbxMapboxConfig and configuring the NgxMapboxGLModule.
771
850
  *
851
+ * Also registers an app initializer that points mapbox-gl at the self-hosted CSP web worker
852
+ * asset before any map is created.
853
+ *
772
854
  * @param config - Configuration.
773
855
  * @returns EnvironmentProviders.
774
856
  */
@@ -785,5 +867,5 @@ interface DbxMapboxEnvironmentOptions extends DbxMapboxConfig {
785
867
  */
786
868
  type DbxMapboxOptions = DbxMapboxEnvironmentOptions;
787
869
 
788
- export { DEFAULT_MAPBOX_CENTER, DEFAULT_MAPBOX_LAYOUT_DRAWER_WIDTH, DEFAULT_MAPBOX_MAP_STORE_TIMER_REFRESH_PERIOD, DEFAULT_MAPBOX_STYLE, DEFAULT_MAPBOX_ZOOM, DbxMapboxChangeService, DbxMapboxConfig, DbxMapboxInjectionComponent, DbxMapboxInjectionStore, DbxMapboxInjectionStoreInjectionBlockDirective, DbxMapboxInjectionStoreProviderBlock, DbxMapboxLayoutComponent, DbxMapboxLayoutDrawerComponent, DbxMapboxLayoutVirtualResizeSyncComponent, DbxMapboxMapDirective, DbxMapboxMapStore, DbxMapboxMapStoreInjectionBlockDirective, DbxMapboxMapStoreProviderBlock, DbxMapboxMarkerComponent, DbxMapboxMarkersComponent, DbxMapboxMenuComponent, DbxMapboxModule, DbxMapboxService, KNOWN_MAPBOX_STYLES, MAPBOX_MAX_ZOOM_LEVEL, MAPBOX_MIN_ZOOM_LEVEL, dbxMapboxColoredDotStyle, filterByMapboxViewportBound, mapboxViewportBoundFunction, mapboxZoomLevel, provideDbxMapbox, provideMapboxInjectionStoreIfParentIsUnavailable, provideMapboxStoreIfParentIsUnavailable, updateDbxMapboxMapInjectionStoreStateWithInjectionConfig, updateDbxMapboxMapInjectionStoreStateWithRemovedKey };
789
- export type { DbxMapboxClickEvent, DbxMapboxEnvironmentOptions, DbxMapboxInjectionConfig, DbxMapboxInjectionKey, DbxMapboxLayoutMode, DbxMapboxLayoutSide, DbxMapboxMapInjectionStoreState, DbxMapboxMarginCalculationSizing, DbxMapboxMarker, DbxMapboxMarkerDisplayConfig, DbxMapboxMarkerFactory, DbxMapboxMarkerPresentation, DbxMapboxMarkerSize, DbxMapboxOptions, DbxMapboxStoreBoundRefreshSettings, DbxMapboxStoreBoundRefreshType, DbxMapboxStoreState, FilterMapboxBoundConfig, FilterMapboxBoundReadItemValueFunction, KnownMapboxStyle, MapboxBearing, MapboxEaseTo, MapboxEaseToOptions, MapboxEaseToPositionOptions, MapboxEventData, MapboxFitBounds, MapboxFitBoundsOptions, MapboxFitPositions, MapboxFlyTo, MapboxFlyToOptions, MapboxFlyToPositionOptions, MapboxJumpTo, MapboxJumpToPositionOptions, MapboxMapLifecycleState, MapboxMapMoveState, MapboxMapRotateState, MapboxMapZoomState, MapboxPitch, MapboxResetNorth, MapboxResetNorthPitch, MapboxRotateTo, MapboxSetStyleOptions, MapboxSnapToNorth, MapboxStyleConfig, MapboxTileSize, MapboxViewportBoundFunction, MapboxViewportBoundFunctionConfig, MapboxViewportBoundFunctionInput, MapboxViewportBoundFunctionItem, MapboxViewportBoundFunctionItemValue, MapboxZoomLevel, MapboxZoomLevelRange, ProvideDbxMapboxConfig, StringMapboxListenerPair, TypedMapboxListenerPair };
870
+ export { DEFAULT_DBX_MAPBOX_WORKER_URL, DEFAULT_MAPBOX_CENTER, DEFAULT_MAPBOX_LAYOUT_DRAWER_WIDTH, DEFAULT_MAPBOX_MAP_STORE_TIMER_REFRESH_PERIOD, DEFAULT_MAPBOX_STYLE, DEFAULT_MAPBOX_ZOOM, DbxMapboxChangeService, DbxMapboxConfig, DbxMapboxInjectionComponent, DbxMapboxInjectionStore, DbxMapboxInjectionStoreInjectionBlockDirective, DbxMapboxInjectionStoreProviderBlock, DbxMapboxLayoutComponent, DbxMapboxLayoutDrawerComponent, DbxMapboxLayoutVirtualResizeSyncComponent, DbxMapboxMapDirective, DbxMapboxMapStore, DbxMapboxMapStoreInjectionBlockDirective, DbxMapboxMapStoreProviderBlock, DbxMapboxMarkerComponent, DbxMapboxMarkersComponent, DbxMapboxMenuComponent, DbxMapboxModule, DbxMapboxService, KNOWN_MAPBOX_STYLES, MAPBOX_MAX_ZOOM_LEVEL, MAPBOX_MIN_ZOOM_LEVEL, configureDbxMapboxWorker, dbxMapboxColoredDotStyle, filterByMapboxViewportBound, isDbxMapboxWorkerAssetAvailable, mapboxViewportBoundFunction, mapboxZoomLevel, provideDbxMapbox, provideMapboxInjectionStoreIfParentIsUnavailable, provideMapboxStoreIfParentIsUnavailable, updateDbxMapboxMapInjectionStoreStateWithInjectionConfig, updateDbxMapboxMapInjectionStoreStateWithRemovedKey };
871
+ export type { DbxMapboxClickEvent, DbxMapboxEnvironmentOptions, DbxMapboxInjectionConfig, DbxMapboxInjectionKey, DbxMapboxLayoutMode, DbxMapboxLayoutSide, DbxMapboxMapInjectionStoreState, DbxMapboxMarginCalculationSizing, DbxMapboxMarker, DbxMapboxMarkerDisplayConfig, DbxMapboxMarkerFactory, DbxMapboxMarkerPresentation, DbxMapboxMarkerSize, DbxMapboxOptions, DbxMapboxStoreBoundRefreshSettings, DbxMapboxStoreBoundRefreshType, DbxMapboxStoreState, DbxMapboxWorkerConfig, DbxMapboxWorkerConfigurationResult, FilterMapboxBoundConfig, FilterMapboxBoundReadItemValueFunction, KnownMapboxStyle, MapboxBearing, MapboxEaseTo, MapboxEaseToOptions, MapboxEaseToPositionOptions, MapboxEventData, MapboxFitBounds, MapboxFitBoundsOptions, MapboxFitPositions, MapboxFlyTo, MapboxFlyToOptions, MapboxFlyToPositionOptions, MapboxJumpTo, MapboxJumpToPositionOptions, MapboxMapLifecycleState, MapboxMapMoveState, MapboxMapRotateState, MapboxMapZoomState, MapboxPitch, MapboxResetNorth, MapboxResetNorthPitch, MapboxRotateTo, MapboxSetStyleOptions, MapboxSnapToNorth, MapboxStyleConfig, MapboxTileSize, MapboxViewportBoundFunction, MapboxViewportBoundFunctionConfig, MapboxViewportBoundFunctionInput, MapboxViewportBoundFunctionItem, MapboxViewportBoundFunctionItemValue, MapboxZoomLevel, MapboxZoomLevelRange, ProvideDbxMapboxConfig, StringMapboxListenerPair, TypedMapboxListenerPair };