@gopherium/godmin 0.24.0 → 0.25.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 +27 -2
- package/dist/base.css +289 -27
- package/dist/breakpoints.d.ts +7 -3
- package/dist/breakpoints.js +8 -4
- package/dist/drilldown-item.d.ts +17 -0
- package/dist/drilldown-item.js +31 -0
- package/dist/frame.d.ts +16 -8
- package/dist/frame.js +44 -23
- package/dist/index.d.ts +4 -4
- package/dist/index.js +2 -2
- package/dist/list-chrome/es-ES.d.ts +1 -1
- package/dist/list-chrome/es-ES.js +5 -1
- package/dist/list-chrome/fr-FR.d.ts +1 -1
- package/dist/list-chrome/fr-FR.js +5 -1
- package/dist/list-chrome.d.ts +1 -1
- package/dist/list-chrome.js +1 -1
- package/dist/list-empty.d.ts +1 -1
- package/dist/list-empty.js +4 -2
- package/dist/menu-item.d.ts +29 -0
- package/dist/menu-item.js +33 -0
- package/dist/navigation-item.d.ts +45 -0
- package/dist/navigation-item.js +50 -0
- package/dist/navigation-list.d.ts +14 -0
- package/dist/navigation-list.js +62 -0
- package/dist/navigation-screen.d.ts +24 -0
- package/dist/navigation-screen.js +47 -0
- package/dist/navigation-state.d.ts +83 -0
- package/dist/navigation-state.js +88 -0
- package/dist/navigation.d.ts +23 -0
- package/dist/navigation.js +133 -0
- package/dist/page-tabs.d.ts +5 -4
- package/dist/page-tabs.js +12 -3
- package/dist/page.d.ts +20 -6
- package/dist/page.js +32 -10
- package/dist/path-matching.d.ts +68 -0
- package/dist/path-matching.js +126 -0
- package/dist/router.d.ts +24 -2
- package/dist/router.js +16 -3
- package/package.json +3 -6
- package/dist/nav-screen.d.ts +0 -17
- package/dist/nav-screen.js +0 -31
package/README.md
CHANGED
|
@@ -52,15 +52,40 @@ two lines do for you.
|
|
|
52
52
|
|
|
53
53
|
| Entry point | Contents |
|
|
54
54
|
| --- | --- |
|
|
55
|
-
| `@gopherium/godmin` | `AdminRoot`, `Frame`, `Page`, `PageTitle`, `PageTabs`, `PageTab`, `SectionTitle`, `InitialsAvatar`, `
|
|
55
|
+
| `@gopherium/godmin` | `AdminRoot`, `Frame`, `Page`, `PageTitle`, `PageTabs`, `PageTab`, `SectionTitle`, `InitialsAvatar`, `NavigationScreen`, `MenuCount`, `ErrorNotice`, `LoadMore`, `LogList`, `LogItem`, `LogTime`, `LoadingScreen`, `LoadingRows`, `Toaster`, `useToaster`, `RepeatRows`, `RowControls`, `useRowKeys`, `keyFromLabel`, `listChromeCatalogFor`, `LIST_CHROME_DOMAIN`, `ListEmpty`, `ConfirmBody`, `RenameBody`, `FormBody`, `FileButton`, `useServerPaging`, `pageWindow`, `paginationOf`, `runEach`, `bulkNotes`, `useListRun`, `useBulkRun`, `RunConfirm`, `viewNarrows`, `offeredView`, `offeredSize`, `sizedView`, `useMediaQuery`, `useTokenDocument`, the breakpoints `HUGE_BREAKPOINT`, `SIDEBAR_BREAKPOINT`, `EDGE_BREAKPOINT`, `DENSE_BREAKPOINT`, `SHEET_BREAKPOINT`, `TITLE_BREAKPOINT` and `SMALL_VIEWPORT`, `SUPPORTED_WPDS` |
|
|
56
56
|
| `@gopherium/godmin/base.css` | Cascade layer order, design tokens, host rules, frame and screen styles |
|
|
57
57
|
| `@gopherium/godmin/dates` | `startListDates`, `listDate`, the only entry that loads `@wordpress/date` |
|
|
58
58
|
| `@gopherium/godmin/dialogs` | `ConfirmDialog`, `FormDialog`, the only entry that loads `@wordpress/components`. Load `@wordpress/components/build-style/style.css` once in your app, as DataViews asks |
|
|
59
|
-
| `@gopherium/godmin/router` | `useListView`, `listSearch`, `openOnTap`, `useCanvas`, `useFrameLocation`, the `canvas` route static data |
|
|
59
|
+
| `@gopherium/godmin/router` | `Navigation`, `NavigationList`, `NavigationItem`, `DrilldownItem`, `useCanAccess` and the `MenuItem` type, `useListView`, `listSearch`, `openOnTap`, `useCanvas`, `useFrameLocation`, `routerDefaults`, the `canvas`, `Sidebar` and `capability` route static data |
|
|
60
60
|
| `@gopherium/godmin/testing` | `installTestEnvironment`, `renderAdmin`, `setViewport` and its `TestViewport` type, `getAnnouncement`, `clearAnnouncements`, `assertElementPatched`, `WPDS_IGNORE_SELECTOR`, `textClasses`, `badgeClasses`, `buttonClasses`, `stubLayout` |
|
|
61
61
|
| `@gopherium/godmin/vite` | `godminDedupe`, `godminSingleCopy`, `godminStylesheetFirst`, `duplicateCopies`, `hoistStylesheet` |
|
|
62
62
|
| `@gopherium/godmin/stylelint` | The design system stylelint rules |
|
|
63
63
|
|
|
64
|
+
## Translations
|
|
65
|
+
|
|
66
|
+
GodMin speaks a few words of its own: Back on a sidebar screen, the name of
|
|
67
|
+
the sidebar column and its phone drawer, and the phone menu button and the
|
|
68
|
+
drawer's close button, which only a screen reader meets. It
|
|
69
|
+
translates them in the WordPress `default` text domain, as `@wordpress/ui`
|
|
70
|
+
translates its own, so `@wordpress/i18n` is a required peer. Every app
|
|
71
|
+
already has it, since
|
|
72
|
+
`@wordpress/ui` depends on it.
|
|
73
|
+
|
|
74
|
+
`listChromeCatalogFor` returns the catalogue GodMin ships for a language,
|
|
75
|
+
Spanish and French today. Both hold these words and the list dates, and the
|
|
76
|
+
Spanish one also holds the list chrome. Load it into `LIST_CHROME_DOMAIN`, the
|
|
77
|
+
`default` domain:
|
|
78
|
+
|
|
79
|
+
```ts
|
|
80
|
+
import { setLocaleData } from '@wordpress/i18n'
|
|
81
|
+
import { LIST_CHROME_DOMAIN, listChromeCatalogFor } from '@gopherium/godmin'
|
|
82
|
+
|
|
83
|
+
const catalogue = await listChromeCatalogFor('es-ES')
|
|
84
|
+
if (catalogue !== undefined) {
|
|
85
|
+
setLocaleData(catalogue, LIST_CHROME_DOMAIN)
|
|
86
|
+
}
|
|
87
|
+
```
|
|
88
|
+
|
|
64
89
|
## Before your first build
|
|
65
90
|
|
|
66
91
|
Duplicate packages break the application, and nothing points at the cause.
|
package/dist/base.css
CHANGED
|
@@ -85,7 +85,6 @@ body {
|
|
|
85
85
|
|
|
86
86
|
.godmin-page__list .dataviews-view-table tbody .dataviews-view-table__primary-column-content > .dataviews-title-field {
|
|
87
87
|
min-block-size: 0;
|
|
88
|
-
font-weight: var(--wpds-typography-font-weight-default);
|
|
89
88
|
line-height: var(--wpds-typography-line-height-sm);
|
|
90
89
|
}
|
|
91
90
|
|
|
@@ -100,8 +99,10 @@ body {
|
|
|
100
99
|
|
|
101
100
|
@layer godmin {
|
|
102
101
|
:root {
|
|
103
|
-
--godmin-
|
|
102
|
+
--godmin-nav-sidebar-width: 300px;
|
|
104
103
|
--godmin-canvas-margin: 16px;
|
|
104
|
+
--godmin-navigation-slide-distance: 50px;
|
|
105
|
+
--godmin-navigation-slide-duration: 140ms;
|
|
105
106
|
}
|
|
106
107
|
|
|
107
108
|
.godmin-layout {
|
|
@@ -116,14 +117,14 @@ body {
|
|
|
116
117
|
flex-direction: column;
|
|
117
118
|
}
|
|
118
119
|
|
|
119
|
-
.godmin-
|
|
120
|
+
.godmin-layout__sidebar {
|
|
121
|
+
z-index: 1;
|
|
120
122
|
display: flex;
|
|
121
123
|
flex-direction: column;
|
|
122
124
|
flex-shrink: 0;
|
|
123
|
-
width: var(--godmin-
|
|
124
|
-
padding:
|
|
125
|
+
width: var(--godmin-nav-sidebar-width);
|
|
126
|
+
padding: 0;
|
|
125
127
|
box-sizing: border-box;
|
|
126
|
-
overflow-y: auto;
|
|
127
128
|
}
|
|
128
129
|
|
|
129
130
|
.godmin-layout__topbar {
|
|
@@ -138,10 +139,14 @@ body {
|
|
|
138
139
|
.godmin-layout__menu {
|
|
139
140
|
display: flex;
|
|
140
141
|
flex: none;
|
|
142
|
+
align-items: center;
|
|
143
|
+
justify-content: center;
|
|
144
|
+
inline-size: 52px;
|
|
145
|
+
block-size: 46px;
|
|
141
146
|
padding: 0;
|
|
142
147
|
border: 0;
|
|
143
148
|
background: none;
|
|
144
|
-
color:
|
|
149
|
+
color: var(--wpds-color-foreground-content-neutral);
|
|
145
150
|
cursor: var(--wpds-cursor-control);
|
|
146
151
|
}
|
|
147
152
|
|
|
@@ -156,11 +161,46 @@ body {
|
|
|
156
161
|
}
|
|
157
162
|
|
|
158
163
|
.godmin-layout__drawer {
|
|
164
|
+
top: 0;
|
|
159
165
|
display: flex;
|
|
160
166
|
flex-direction: column;
|
|
161
|
-
|
|
167
|
+
width: var(--godmin-nav-sidebar-width);
|
|
168
|
+
max-width: 85vw;
|
|
169
|
+
padding: 0;
|
|
162
170
|
box-sizing: border-box;
|
|
171
|
+
border: 0;
|
|
172
|
+
border-radius: 0;
|
|
173
|
+
background: var(--wpds-color-background-surface-neutral-weak);
|
|
174
|
+
box-shadow: 2px 0 8px rgba(0, 0, 0, 0.2);
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
[role='presentation']:has(+ * > .godmin-layout__drawer) {
|
|
178
|
+
--backdrop-opacity: 0.5;
|
|
179
|
+
background-color: #000;
|
|
180
|
+
cursor: var(--wpds-cursor-control);
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
.godmin-sidebar__content {
|
|
184
|
+
flex: 1 1 0;
|
|
185
|
+
min-height: 0;
|
|
186
|
+
overflow-x: hidden;
|
|
163
187
|
overflow-y: auto;
|
|
188
|
+
contain: content;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
.godmin-sidebar__footer {
|
|
192
|
+
display: flex;
|
|
193
|
+
flex-direction: column;
|
|
194
|
+
flex-shrink: 0;
|
|
195
|
+
gap: 8px;
|
|
196
|
+
padding: 16px;
|
|
197
|
+
border-top: 1px solid var(--wpds-color-stroke-surface-neutral);
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
.godmin-sidebar__footer-note {
|
|
201
|
+
color: var(--wpds-color-foreground-content-neutral-weak);
|
|
202
|
+
font-size: var(--wpds-typography-font-size-sm);
|
|
203
|
+
line-height: var(--wpds-typography-line-height-xs);
|
|
164
204
|
}
|
|
165
205
|
|
|
166
206
|
.godmin-menu-count__badge {
|
|
@@ -206,7 +246,7 @@ body {
|
|
|
206
246
|
overflow: hidden;
|
|
207
247
|
}
|
|
208
248
|
|
|
209
|
-
.godmin-layout:has(> .godmin-
|
|
249
|
+
.godmin-layout:has(> .godmin-layout__sidebar) .godmin-layout__canvas {
|
|
210
250
|
margin-inline-start: 0;
|
|
211
251
|
}
|
|
212
252
|
|
|
@@ -249,8 +289,8 @@ body {
|
|
|
249
289
|
pointer-events: none;
|
|
250
290
|
}
|
|
251
291
|
|
|
252
|
-
:root:has(.godmin-
|
|
253
|
-
inset-inline-start: var(--godmin-
|
|
292
|
+
:root:has(.godmin-layout__sidebar) .godmin-toasts {
|
|
293
|
+
inset-inline-start: var(--godmin-nav-sidebar-width);
|
|
254
294
|
inset-inline-end: var(--godmin-canvas-margin);
|
|
255
295
|
}
|
|
256
296
|
|
|
@@ -338,28 +378,247 @@ body {
|
|
|
338
378
|
text-decoration: none;
|
|
339
379
|
}
|
|
340
380
|
|
|
341
|
-
.godmin-
|
|
342
|
-
|
|
343
|
-
|
|
381
|
+
.godmin-navigation {
|
|
382
|
+
display: flex;
|
|
383
|
+
flex-direction: column;
|
|
384
|
+
height: 100%;
|
|
344
385
|
}
|
|
345
386
|
|
|
346
|
-
.godmin-
|
|
347
|
-
|
|
387
|
+
.godmin-navigation__screen-wrapper {
|
|
388
|
+
display: flex;
|
|
389
|
+
flex-direction: column;
|
|
390
|
+
height: 100%;
|
|
391
|
+
max-height: 100%;
|
|
392
|
+
padding: 0 12px;
|
|
393
|
+
overflow-x: auto;
|
|
394
|
+
scrollbar-width: thin;
|
|
395
|
+
scrollbar-gutter: stable;
|
|
396
|
+
scrollbar-color: transparent transparent;
|
|
397
|
+
animation-duration: var(--godmin-navigation-slide-duration);
|
|
398
|
+
animation-timing-function: ease-in-out;
|
|
399
|
+
will-change: transform, opacity;
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
.godmin-navigation__screen-wrapper:is(:hover, :focus, :focus-within) {
|
|
403
|
+
scrollbar-color: var(--wpds-color-stroke-surface-neutral-strong) transparent;
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
.godmin-navigation__screen-wrapper::-webkit-scrollbar {
|
|
407
|
+
width: 12px;
|
|
408
|
+
height: 12px;
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
.godmin-navigation__screen-wrapper::-webkit-scrollbar-track {
|
|
412
|
+
background-color: transparent;
|
|
348
413
|
}
|
|
349
414
|
|
|
350
|
-
.godmin-
|
|
415
|
+
.godmin-navigation__screen-wrapper::-webkit-scrollbar-thumb {
|
|
416
|
+
border: 3px solid transparent;
|
|
417
|
+
border-radius: 8px;
|
|
418
|
+
background-color: transparent;
|
|
419
|
+
background-clip: padding-box;
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
.godmin-navigation__screen-wrapper:hover::-webkit-scrollbar-thumb,
|
|
423
|
+
.godmin-navigation__screen-wrapper:focus::-webkit-scrollbar-thumb,
|
|
424
|
+
.godmin-navigation__screen-wrapper:focus-within::-webkit-scrollbar-thumb {
|
|
425
|
+
background-color: var(--wpds-color-stroke-surface-neutral-strong);
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
@media (hover: none) {
|
|
429
|
+
.godmin-navigation__screen-wrapper {
|
|
430
|
+
scrollbar-color: var(--wpds-color-stroke-surface-neutral-strong) transparent;
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
.godmin-navigation__screen-wrapper--forward {
|
|
435
|
+
animation-name: godmin-slide-from-end;
|
|
436
|
+
}
|
|
437
|
+
|
|
438
|
+
.godmin-navigation__screen-wrapper--backward {
|
|
439
|
+
animation-name: godmin-slide-from-start;
|
|
440
|
+
}
|
|
441
|
+
|
|
442
|
+
.godmin-navigation__screen-wrapper--forward:dir(rtl) {
|
|
443
|
+
animation-name: godmin-slide-from-start;
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
.godmin-navigation__screen-wrapper--backward:dir(rtl) {
|
|
447
|
+
animation-name: godmin-slide-from-end;
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
@keyframes godmin-slide-from-end {
|
|
451
|
+
0% {
|
|
452
|
+
opacity: 0;
|
|
453
|
+
transform: translateX(var(--godmin-navigation-slide-distance));
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
100% {
|
|
457
|
+
opacity: 1;
|
|
458
|
+
transform: none;
|
|
459
|
+
}
|
|
460
|
+
}
|
|
461
|
+
|
|
462
|
+
@keyframes godmin-slide-from-start {
|
|
463
|
+
0% {
|
|
464
|
+
opacity: 0;
|
|
465
|
+
transform: translateX(calc(-1 * var(--godmin-navigation-slide-distance)));
|
|
466
|
+
}
|
|
467
|
+
|
|
468
|
+
100% {
|
|
469
|
+
opacity: 1;
|
|
470
|
+
transform: none;
|
|
471
|
+
}
|
|
472
|
+
}
|
|
473
|
+
|
|
474
|
+
.godmin-navigation-screen {
|
|
475
|
+
display: flex;
|
|
476
|
+
flex-direction: column;
|
|
477
|
+
flex-grow: 1;
|
|
478
|
+
}
|
|
479
|
+
|
|
480
|
+
.godmin-navigation-screen__main {
|
|
481
|
+
flex-grow: 1;
|
|
482
|
+
margin-bottom: 16px;
|
|
483
|
+
}
|
|
484
|
+
|
|
485
|
+
.godmin-navigation-screen__main--has-footer {
|
|
486
|
+
margin-bottom: 0;
|
|
487
|
+
}
|
|
488
|
+
|
|
489
|
+
.godmin-navigation-screen__title-icon {
|
|
490
|
+
position: sticky;
|
|
491
|
+
top: 0;
|
|
492
|
+
z-index: 1;
|
|
493
|
+
display: flex;
|
|
494
|
+
align-items: flex-start;
|
|
495
|
+
gap: 12px;
|
|
496
|
+
margin-bottom: 8px;
|
|
497
|
+
padding-top: 32px;
|
|
498
|
+
padding-bottom: 8px;
|
|
499
|
+
background: var(--wpds-color-background-surface-neutral-weak);
|
|
500
|
+
}
|
|
501
|
+
|
|
502
|
+
.godmin-navigation-screen__title-icon--root {
|
|
503
|
+
padding-inline-start: 44px;
|
|
504
|
+
}
|
|
505
|
+
|
|
506
|
+
.godmin-navigation-screen__back {
|
|
351
507
|
display: inline-flex;
|
|
352
|
-
|
|
353
|
-
|
|
508
|
+
flex-shrink: 0;
|
|
509
|
+
align-items: center;
|
|
510
|
+
justify-content: center;
|
|
511
|
+
inline-size: 32px;
|
|
512
|
+
block-size: 32px;
|
|
513
|
+
border-radius: var(--wpds-border-radius-sm);
|
|
514
|
+
color: var(--wpds-color-foreground-interactive-neutral);
|
|
515
|
+
}
|
|
516
|
+
|
|
517
|
+
.godmin-navigation-screen__back:is(:hover, :focus) {
|
|
518
|
+
color: var(--wpds-color-foreground-interactive-neutral-active);
|
|
354
519
|
}
|
|
355
520
|
|
|
356
|
-
.godmin-
|
|
521
|
+
.godmin-navigation-screen__back:focus-visible {
|
|
357
522
|
outline: var(--wpds-border-width-focus) solid var(--wpds-color-stroke-focus);
|
|
358
|
-
outline-offset:
|
|
523
|
+
outline-offset: var(--wpds-border-width-focus);
|
|
359
524
|
}
|
|
360
525
|
|
|
361
|
-
.godmin-
|
|
362
|
-
|
|
526
|
+
.godmin-navigation-screen__back:focus:not(:focus-visible) {
|
|
527
|
+
outline: none;
|
|
528
|
+
}
|
|
529
|
+
|
|
530
|
+
.godmin-navigation-screen__title {
|
|
531
|
+
flex-grow: 1;
|
|
532
|
+
min-width: 0;
|
|
533
|
+
margin: 0;
|
|
534
|
+
color: var(--wpds-color-foreground-content-neutral);
|
|
535
|
+
font-size: var(--wpds-typography-font-size-xl);
|
|
536
|
+
font-weight: var(--wpds-typography-font-weight-emphasis);
|
|
537
|
+
line-height: var(--wpds-typography-line-height-xl);
|
|
538
|
+
overflow-wrap: break-word;
|
|
539
|
+
}
|
|
540
|
+
|
|
541
|
+
.godmin-navigation-screen__actions {
|
|
542
|
+
display: flex;
|
|
543
|
+
flex-shrink: 0;
|
|
544
|
+
}
|
|
545
|
+
|
|
546
|
+
.godmin-navigation-screen__content {
|
|
547
|
+
padding: 0 16px;
|
|
548
|
+
color: var(--wpds-color-foreground-content-neutral);
|
|
549
|
+
}
|
|
550
|
+
|
|
551
|
+
.godmin-navigation-screen__description {
|
|
552
|
+
margin: 0 0 32px;
|
|
553
|
+
color: var(--wpds-color-foreground-content-neutral);
|
|
554
|
+
}
|
|
555
|
+
|
|
556
|
+
.godmin-navigation-screen__footer {
|
|
557
|
+
position: sticky;
|
|
558
|
+
bottom: 0;
|
|
559
|
+
margin-top: 16px;
|
|
560
|
+
padding: 8px 16px;
|
|
561
|
+
border-top: 1px solid var(--wpds-color-stroke-surface-neutral);
|
|
562
|
+
background: var(--wpds-color-background-surface-neutral-weak);
|
|
563
|
+
}
|
|
564
|
+
|
|
565
|
+
.godmin-navigation-list {
|
|
566
|
+
margin-block: 0;
|
|
567
|
+
margin-inline: -16px;
|
|
568
|
+
padding: 0;
|
|
569
|
+
list-style: none;
|
|
570
|
+
}
|
|
571
|
+
|
|
572
|
+
.godmin-navigation-item {
|
|
573
|
+
display: flex;
|
|
574
|
+
align-items: center;
|
|
575
|
+
gap: var(--wpds-dimension-gap-sm);
|
|
576
|
+
box-sizing: border-box;
|
|
577
|
+
min-height: 40px;
|
|
578
|
+
padding: calc((36px - 13px * 1.4 - 2px) / 2) 12px;
|
|
579
|
+
border: 1px solid transparent;
|
|
580
|
+
border-radius: var(--wpds-border-radius-sm);
|
|
581
|
+
color: var(--wpds-color-foreground-interactive-neutral-weak);
|
|
582
|
+
font-size: var(--wpds-typography-font-size-md);
|
|
583
|
+
font-weight: var(--wpds-typography-font-weight-default);
|
|
584
|
+
line-height: normal;
|
|
585
|
+
text-decoration: none;
|
|
586
|
+
}
|
|
587
|
+
|
|
588
|
+
.godmin-navigation-item--with-suffix {
|
|
589
|
+
padding-inline-end: 16px;
|
|
590
|
+
}
|
|
591
|
+
|
|
592
|
+
.godmin-navigation-item:is(:hover, :focus) {
|
|
593
|
+
color: var(--wpds-color-foreground-interactive-neutral-weak-active);
|
|
594
|
+
}
|
|
595
|
+
|
|
596
|
+
.godmin-navigation-item[aria-current='page'] {
|
|
597
|
+
background: var(--wpds-color-background-interactive-neutral-weak-active);
|
|
598
|
+
color: var(--wpds-color-foreground-interactive-neutral-weak-active);
|
|
599
|
+
font-weight: var(--wpds-typography-font-weight-emphasis);
|
|
600
|
+
}
|
|
601
|
+
|
|
602
|
+
.godmin-navigation-item:focus-visible {
|
|
603
|
+
outline: var(--wpds-border-width-focus) solid var(--wpds-color-stroke-focus);
|
|
604
|
+
outline-offset: var(--wpds-border-width-focus);
|
|
605
|
+
transform: translateZ(0);
|
|
606
|
+
}
|
|
607
|
+
|
|
608
|
+
.godmin-navigation-item__icon,
|
|
609
|
+
.godmin-navigation-item__drilldown-indicator {
|
|
610
|
+
flex: none;
|
|
611
|
+
inline-size: 24px;
|
|
612
|
+
block-size: 24px;
|
|
613
|
+
}
|
|
614
|
+
|
|
615
|
+
.godmin-navigation-item__label {
|
|
616
|
+
flex: 1;
|
|
617
|
+
min-width: 0;
|
|
618
|
+
}
|
|
619
|
+
|
|
620
|
+
.godmin-navigation-item__suffix {
|
|
621
|
+
flex: none;
|
|
363
622
|
}
|
|
364
623
|
|
|
365
624
|
.godmin-page__head {
|
|
@@ -464,6 +723,9 @@ body {
|
|
|
464
723
|
display: flex;
|
|
465
724
|
position: relative;
|
|
466
725
|
gap: var(--wpds-dimension-gap-lg);
|
|
726
|
+
margin: 0;
|
|
727
|
+
padding: 0;
|
|
728
|
+
list-style: none;
|
|
467
729
|
overflow-x: auto;
|
|
468
730
|
overscroll-behavior-inline: none;
|
|
469
731
|
}
|
|
@@ -640,10 +902,6 @@ body {
|
|
|
640
902
|
color: var(--wpds-color-foreground-content-neutral);
|
|
641
903
|
}
|
|
642
904
|
|
|
643
|
-
.godmin-page__list .godmin-table__title {
|
|
644
|
-
font-weight: var(--wpds-typography-font-weight-default);
|
|
645
|
-
}
|
|
646
|
-
|
|
647
905
|
.godmin-table__title a {
|
|
648
906
|
color: var(--wpds-color-foreground-interactive-neutral);
|
|
649
907
|
text-decoration: none;
|
|
@@ -739,6 +997,10 @@ body {
|
|
|
739
997
|
.godmin-toast {
|
|
740
998
|
animation-duration: 1ms;
|
|
741
999
|
}
|
|
1000
|
+
|
|
1001
|
+
.godmin-navigation__screen-wrapper {
|
|
1002
|
+
animation-duration: 0s;
|
|
1003
|
+
}
|
|
742
1004
|
}
|
|
743
1005
|
|
|
744
1006
|
.godmin-loading-screen {
|
package/dist/breakpoints.d.ts
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The viewport width
|
|
2
|
+
* The viewport width from which a screen counts as huge, the WordPress huge breakpoint.
|
|
3
3
|
*/
|
|
4
|
-
export declare const
|
|
4
|
+
export declare const HUGE_BREAKPOINT = 1440;
|
|
5
|
+
/**
|
|
6
|
+
* The viewport width below which the sidebar becomes a drawer.
|
|
7
|
+
*/
|
|
8
|
+
export declare const SIDEBAR_BREAKPOINT = 1024;
|
|
5
9
|
/**
|
|
6
10
|
* The viewport width below which the canvas meets the screen edges, the WordPress medium breakpoint.
|
|
7
11
|
*/
|
|
@@ -19,6 +23,6 @@ export declare const SHEET_BREAKPOINT = 600;
|
|
|
19
23
|
*/
|
|
20
24
|
export declare const TITLE_BREAKPOINT = 404;
|
|
21
25
|
/**
|
|
22
|
-
* The media query the frame folds its
|
|
26
|
+
* The media query the frame folds its sidebar at.
|
|
23
27
|
*/
|
|
24
28
|
export declare const SMALL_VIEWPORT = "(max-width: 1023px)";
|
package/dist/breakpoints.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The viewport width
|
|
2
|
+
* The viewport width from which a screen counts as huge, the WordPress huge breakpoint.
|
|
3
3
|
*/
|
|
4
|
-
export const
|
|
4
|
+
export const HUGE_BREAKPOINT = 1440;
|
|
5
|
+
/**
|
|
6
|
+
* The viewport width below which the sidebar becomes a drawer.
|
|
7
|
+
*/
|
|
8
|
+
export const SIDEBAR_BREAKPOINT = 1024;
|
|
5
9
|
/**
|
|
6
10
|
* The viewport width below which the canvas meets the screen edges, the WordPress medium breakpoint.
|
|
7
11
|
*/
|
|
@@ -19,6 +23,6 @@ export const SHEET_BREAKPOINT = 600;
|
|
|
19
23
|
*/
|
|
20
24
|
export const TITLE_BREAKPOINT = 404;
|
|
21
25
|
/**
|
|
22
|
-
* The media query the frame folds its
|
|
26
|
+
* The media query the frame folds its sidebar at.
|
|
23
27
|
*/
|
|
24
|
-
export const SMALL_VIEWPORT = `(max-width: ${
|
|
28
|
+
export const SMALL_VIEWPORT = `(max-width: ${SIDEBAR_BREAKPOINT - 1}px)`;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { AnyRouter, LinkComponentProps, RegisteredRouter } from '@tanstack/react-router';
|
|
2
|
+
import type { ReactElement, ReactNode } from 'react';
|
|
3
|
+
/** A row whose address opens a route that declares a Sidebar. Draws the chevron. Sits inside a NavigationList. */
|
|
4
|
+
export type DrilldownItemProps<TRouter extends AnyRouter = RegisteredRouter, TFrom extends string = string, TTo extends string | undefined = undefined, TMaskFrom extends string = TFrom, TMaskTo extends string = ''> = LinkComponentProps<'a', TRouter, TFrom, TTo, TMaskFrom, TMaskTo> & {
|
|
5
|
+
/** None, since the row takes its id from its address. */
|
|
6
|
+
id?: never;
|
|
7
|
+
/** A glyph from `@wordpress/icons`, drawn at 24px. */
|
|
8
|
+
icon?: ReactElement;
|
|
9
|
+
children: ReactNode;
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* Renders a sidebar row that opens a sub menu: its icon, its label and the chevron, with an id taken from its address.
|
|
13
|
+
* A plain click inside a frame records a forward move from this row to its address.
|
|
14
|
+
* @param props - The TanStack Link props, the icon and the label.
|
|
15
|
+
* @returns The row element, or null when its address opens a route the reader may not open.
|
|
16
|
+
*/
|
|
17
|
+
export declare function DrilldownItem<TRouter extends AnyRouter = RegisteredRouter, const TFrom extends string = string, const TTo extends string | undefined = undefined, const TMaskFrom extends string = TFrom, const TMaskTo extends string = ''>({ icon, children, ...link }: DrilldownItemProps<TRouter, TFrom, TTo, TMaskFrom, TMaskTo>): import("react").JSX.Element;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
import { useRouter } from '@tanstack/react-router';
|
|
4
|
+
import { isRTL } from '@wordpress/i18n';
|
|
5
|
+
import { Icon, chevronLeftSmall, chevronRightSmall } from '@wordpress/icons';
|
|
6
|
+
import { useContext } from 'react';
|
|
7
|
+
import { ROW_CLASS, Row } from './navigation-item.js';
|
|
8
|
+
import { NavigationStateContext, isPlainClick, recordDrilldown } from './navigation-state.js';
|
|
9
|
+
import { findMoveTarget, findRowRoutes } from './path-matching.js';
|
|
10
|
+
/** The start of the id a drilldown row takes from its address. */
|
|
11
|
+
const ID_PREFIX = 'godmin-drilldown-item-';
|
|
12
|
+
/**
|
|
13
|
+
* Renders a sidebar row that opens a sub menu: its icon, its label and the chevron, with an id taken from its address.
|
|
14
|
+
* A plain click inside a frame records a forward move from this row to its address.
|
|
15
|
+
* @param props - The TanStack Link props, the icon and the label.
|
|
16
|
+
* @returns The row element, or null when its address opens a route the reader may not open.
|
|
17
|
+
*/
|
|
18
|
+
export function DrilldownItem({ icon, children, ...link }) {
|
|
19
|
+
const router = useRouter();
|
|
20
|
+
const state = useContext(NavigationStateContext);
|
|
21
|
+
const address = link;
|
|
22
|
+
const routes = findRowRoutes(router, address);
|
|
23
|
+
const id = ID_PREFIX + routes.href;
|
|
24
|
+
const onClick = (event) => {
|
|
25
|
+
address.onClick?.(event);
|
|
26
|
+
if (state !== undefined && isPlainClick(event)) {
|
|
27
|
+
recordDrilldown(state, id, findMoveTarget(router, address));
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
return (_jsx(Row, { link: { ...address, onClick }, routes: routes, icon: icon, className: ROW_CLASS, id: id, end: _jsx(Icon, { icon: isRTL() ? chevronLeftSmall : chevronRightSmall, size: 24, className: "godmin-navigation-item__drilldown-indicator" }), children: children }));
|
|
31
|
+
}
|
package/dist/frame.d.ts
CHANGED
|
@@ -10,23 +10,31 @@ export interface FrameRootProps {
|
|
|
10
10
|
canvasColor?: ThemeColor;
|
|
11
11
|
}
|
|
12
12
|
/**
|
|
13
|
-
* Frames an admin application, folding its
|
|
13
|
+
* Frames an admin application, folding its sidebar away on a narrow viewport,
|
|
14
|
+
* and holds the moves its sidebar parts share.
|
|
14
15
|
* @param props - The regions, the current location, and the region colors.
|
|
15
16
|
* @returns The frame element.
|
|
16
17
|
*/
|
|
17
18
|
declare function Root({ children, location, chromeColor, canvasColor }: FrameRootProps): import("react").JSX.Element;
|
|
18
|
-
export interface
|
|
19
|
+
export interface FrameSidebarProps {
|
|
19
20
|
children: ReactNode;
|
|
20
21
|
brand?: ReactNode;
|
|
22
|
+
/** The name of the menu button, godmin's translated "Open navigation panel" when absent. */
|
|
21
23
|
menuLabel?: string;
|
|
24
|
+
/** The name of the region the column is, godmin's translated "Navigation" when absent. */
|
|
25
|
+
label?: string;
|
|
26
|
+
/** What sits under the menu and never moves, such as the account panel. */
|
|
27
|
+
footer?: ReactNode;
|
|
28
|
+
/** One short line of small grey text under the footer, such as the version. */
|
|
29
|
+
footerNote?: ReactNode;
|
|
22
30
|
}
|
|
23
31
|
/**
|
|
24
|
-
* Renders the navigation region, as a
|
|
25
|
-
* with a drawer when there is not.
|
|
26
|
-
* @param props - The
|
|
27
|
-
* @returns The
|
|
32
|
+
* Renders the navigation region, as a sidebar when there is room and as a top bar
|
|
33
|
+
* with a drawer when there is not, its content above its footer in both.
|
|
34
|
+
* @param props - The sidebar content, the brand, the menu button label, the region name, the footer and its note.
|
|
35
|
+
* @returns The sidebar element.
|
|
28
36
|
*/
|
|
29
|
-
declare function
|
|
37
|
+
declare function Sidebar({ children, brand, menuLabel, label, footer, footerNote, }: FrameSidebarProps): import("react").JSX.Element;
|
|
30
38
|
/**
|
|
31
39
|
* How a screen fills its canvas region.
|
|
32
40
|
*/
|
|
@@ -48,7 +56,7 @@ declare function Canvas({ children, canvas, notices }: FrameCanvasProps): import
|
|
|
48
56
|
*/
|
|
49
57
|
export declare const Frame: {
|
|
50
58
|
Root: typeof Root;
|
|
51
|
-
|
|
59
|
+
Sidebar: typeof Sidebar;
|
|
52
60
|
Canvas: typeof Canvas;
|
|
53
61
|
};
|
|
54
62
|
export {};
|