element-book 7.0.1 → 7.0.2

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.
@@ -15,6 +15,6 @@ export type BaseBookEntry = {
15
15
  * A description that will be displayed below the entry title. Each item in the array will be a
16
16
  * separate paragraph.
17
17
  */
18
- descriptionParagraphs: string[];
18
+ descriptionParagraphs: ReadonlyArray<string>;
19
19
  errors: Error[];
20
20
  };
@@ -1,5 +1,5 @@
1
+ import { SetOptionalAndNullable } from '@augment-vir/common';
1
2
  import { PropertyInitMapBase } from 'element-vir';
2
- import { SetOptional } from 'type-fest';
3
3
  import { InfiniteRecursionLimiter } from '../../../util/type';
4
4
  import { BookElementExampleInit } from '../book-element-example/book-element-example';
5
5
  import { BookPage } from './book-page';
@@ -11,7 +11,7 @@ export type ElementExamplesDefiner<ControlsInit extends BookPageControlsInitBase
11
11
  type CollapseControlsInit<ParentPage extends BookPage | undefined, CurrentControlsInit extends BookPageControlsInitBase,
12
12
  /** Prevent infinite recursion TypeScript errors. */
13
13
  RecursionDepth = InfiniteRecursionLimiter> = CurrentControlsInit & (RecursionDepth extends [any, ...infer RemainingDepth] ? ParentPage extends BookPage<infer GrandParentPage, infer ParentControls> ? CollapseControlsInit<GrandParentPage, ParentControls, RemainingDepth> : {} : {});
14
- export type BookPageInit<ParentPage extends BookPage | undefined, CurrentControlsInit extends BookPageControlsInitBase> = SetOptional<Omit<BookPage<ParentPage, CurrentControlsInit>, 'entryType' | 'elementExamples' | 'errors'>, 'controls' | 'descriptionParagraphs'> & {
14
+ export type BookPageInit<ParentPage extends BookPage | undefined, CurrentControlsInit extends BookPageControlsInitBase> = SetOptionalAndNullable<Omit<BookPage<ParentPage, CurrentControlsInit>, 'entryType' | 'elementExamples' | 'errors'>, 'controls' | 'descriptionParagraphs'> & {
15
15
  elementExamplesCallback?: ElementExamplesDefiner<CollapseControlsInit<ParentPage, CurrentControlsInit>> | undefined;
16
16
  };
17
17
  export declare function defineBookPage<const ParentPage extends BookPage | undefined, const ControlsInit extends BookPageControlsInitBase = {}>(pageInit: BookPageInit<ParentPage, ControlsInit>): BookPage<ParentPage, ControlsInit>;
@@ -25,14 +25,14 @@ export const BookEntryDisplay = defineBookElement()({
25
25
  }
26
26
 
27
27
  .inline-entry {
28
- margin-top: 32px;
28
+ margin: 8px;
29
29
  }
30
30
 
31
- .inline-entry + .inline-entry {
32
- margin-left: 16px;
31
+ * + .block-entry {
32
+ margin-top: 32px;
33
33
  }
34
34
 
35
- * + .block-entry {
35
+ .block-entry + * {
36
36
  margin-top: 32px;
37
37
  }
38
38
 
@@ -1,6 +1,7 @@
1
1
  import { extractEventTarget } from '@augment-vir/browser';
2
2
  import { isRuntimeTypeOf } from '@augment-vir/common';
3
- import { css, defineElementEvent, html, listen } from 'element-vir';
3
+ import { assign, css, defineElementEvent, html, listen, renderIf } from 'element-vir';
4
+ import { Options24Icon, ViraIcon } from 'vira';
4
5
  import { BookPageControlTypeEnum, isControlInitType, } from '../../../../data/book-entry/book-page/book-page-controls';
5
6
  import { colorThemeCssVars } from '../../../color-theme/color-theme';
6
7
  import { defineBookElement } from '../../define-book-element';
@@ -16,8 +17,11 @@ export const BookPageControls = defineBookElement()({
16
17
  :host {
17
18
  display: flex;
18
19
  flex-wrap: wrap;
19
- opacity: 0.7;
20
+ align-items: flex-end;
21
+ padding-left: 36px;
22
+ align-content: flex-start;
20
23
  gap: 16px;
24
+ row-gap: 10px;
21
25
  color: ${colorThemeCssVars['element-book-page-foreground-faint-level-1-color'].value};
22
26
  }
23
27
 
@@ -26,6 +30,7 @@ export const BookPageControls = defineBookElement()({
26
30
  }
27
31
 
28
32
  .control-wrapper {
33
+ position: relative;
29
34
  display: flex;
30
35
  gap: 4px;
31
36
  flex-direction: column;
@@ -35,12 +40,19 @@ export const BookPageControls = defineBookElement()({
35
40
  font-weight: bold;
36
41
  color: red;
37
42
  }
43
+
44
+ ${ViraIcon}.options-icon {
45
+ position: absolute;
46
+ left: 0;
47
+ bottom: 0;
48
+ margin-left: -32px;
49
+ }
38
50
  `,
39
51
  renderCallback({ inputs, dispatch, events }) {
40
52
  if (!Object.entries(inputs.config).length) {
41
53
  return '';
42
54
  }
43
- return Object.entries(inputs.config).map(([controlName, controlInit,]) => {
55
+ return Object.entries(inputs.config).map(([controlName, controlInit,], index) => {
44
56
  if (controlInit.controlType === BookPageControlTypeEnum.Hidden) {
45
57
  return '';
46
58
  }
@@ -60,10 +72,18 @@ export const BookPageControls = defineBookElement()({
60
72
  }));
61
73
  });
62
74
  return html `
63
- <label class="control-wrapper">
64
- <span>${controlName}</span>
65
- ${controlInputTemplate}
66
- </label>
75
+ <div class="control-wrapper">
76
+ ${renderIf(index === 0, html `
77
+ <${ViraIcon}
78
+ class="options-icon"
79
+ ${assign(ViraIcon, { icon: Options24Icon })}
80
+ ></${ViraIcon}>
81
+ `)}
82
+ <label class="control-wrapper">
83
+ <span>${controlName}</span>
84
+ ${controlInputTemplate}
85
+ </label>
86
+ </div>
67
87
  `;
68
88
  });
69
89
  },
@@ -31,6 +31,10 @@ export const BookElementExampleWrapper = defineBookElement()({
31
31
  }
32
32
 
33
33
  ${BookElementExampleControls} {
34
+ color: ${colorThemeCssVars['element-book-page-foreground-faint-level-1-color'].value};
35
+ }
36
+
37
+ :host(:hover) ${BookElementExampleControls} {
34
38
  color: ${colorThemeCssVars['element-book-accent-icon-color'].value};
35
39
  }
36
40
  `,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "element-book",
3
- "version": "7.0.1",
3
+ "version": "7.0.2",
4
4
  "keywords": [
5
5
  "book",
6
6
  "design system",
@@ -39,18 +39,18 @@
39
39
  "test:watch": "web-test-runner --color --watch --config configs/web-test-runner.config.mjs"
40
40
  },
41
41
  "dependencies": {
42
- "@augment-vir/browser": "^15.1.0",
43
- "@augment-vir/common": "^15.1.0",
42
+ "@augment-vir/browser": "^15.2.1",
43
+ "@augment-vir/common": "^15.2.1",
44
44
  "colorjs.io": "0.4.3",
45
- "element-vir": "^14.0.0",
45
+ "element-vir": "^14.0.3",
46
46
  "lit-css-vars": "^2.0.3",
47
47
  "object-shape-tester": "^0.3.0",
48
48
  "spa-router-vir": "^2.1.0",
49
49
  "typed-event-target": "^1.2.1",
50
- "vira": "^0.4.0"
50
+ "vira": "^0.5.0"
51
51
  },
52
52
  "devDependencies": {
53
- "@augment-vir/browser-testing": "^15.1.0",
53
+ "@augment-vir/browser-testing": "^15.2.1",
54
54
  "@open-wc/testing": "^3.2.0",
55
55
  "@types/chai": "^4.3.5",
56
56
  "@types/mocha": "^10.0.1",