From 18581ba982f400609f90807b6d1f0a74e9553254 Mon Sep 17 00:00:00 2001 From: Gerard Burns Date: Fri, 12 Apr 2024 14:18:41 +0100 Subject: [PATCH] wip --- .../ExplanationModal/index.svelte | 5 +- .../subjects/DatesAsNumbers.svelte | 2 +- .../subjects/ScalarJsonOnly.svelte | 64 +++++++++++++++++++ .../subjects/components/Block.svelte | 26 ++++++++ .../subjects/components/Section.svelte | 2 + .../subjects/components/index.js | 1 + .../ExplanationModal/subjects/index.js | 1 + .../controls/FieldContext/FieldContext.svelte | 1 + .../lines/JSONPrimitivesOnly.svelte | 9 +-- .../FieldContext/lines/StringNumber.svelte | 4 +- .../controls/FieldContext/subjects.js | 1 + .../FieldContext/typography/Comma.svelte | 3 +- .../typography/DocumentationLink.svelte | 3 +- .../FieldContext/typography/InfoWord.svelte | 7 +- .../FieldContext/typography/Line.svelte | 3 +- .../FieldContext/typography/Period.svelte | 3 +- .../FieldContext/typography/Space.svelte | 1 - .../FieldContext/typography/Text.svelte | 46 +++++-------- 18 files changed, 134 insertions(+), 48 deletions(-) create mode 100644 packages/builder/src/components/design/settings/controls/FieldContext/ExplanationModal/subjects/ScalarJsonOnly.svelte create mode 100644 packages/builder/src/components/design/settings/controls/FieldContext/ExplanationModal/subjects/components/Block.svelte diff --git a/packages/builder/src/components/design/settings/controls/FieldContext/ExplanationModal/index.svelte b/packages/builder/src/components/design/settings/controls/FieldContext/ExplanationModal/index.svelte index 4c9e54ee31..0bb714cab6 100644 --- a/packages/builder/src/components/design/settings/controls/FieldContext/ExplanationModal/index.svelte +++ b/packages/builder/src/components/design/settings/controls/FieldContext/ExplanationModal/index.svelte @@ -1,10 +1,11 @@ @@ -26,6 +27,8 @@ {:else if subject === subjects.datesAsNumbers} + {:else if subject === subjects.scalarJsonOnly} + {/if} diff --git a/packages/builder/src/components/design/settings/controls/FieldContext/ExplanationModal/subjects/DatesAsNumbers.svelte b/packages/builder/src/components/design/settings/controls/FieldContext/ExplanationModal/subjects/DatesAsNumbers.svelte index 683fa24356..3a51eace80 100644 --- a/packages/builder/src/components/design/settings/controls/FieldContext/ExplanationModal/subjects/DatesAsNumbers.svelte +++ b/packages/builder/src/components/design/settings/controls/FieldContext/ExplanationModal/subjects/DatesAsNumbers.svelte @@ -4,6 +4,6 @@
- A Date can be used in place of a numeric value, but it will be parsed as a UNIX epoch timestamp, which is the number of milliseconds since Jan 1st 1970. + A date can be used in place of a numeric value, but it will be parsed as a UNIX epoch timestamp, which is the number of milliseconds since Jan 1st 1970.
diff --git a/packages/builder/src/components/design/settings/controls/FieldContext/ExplanationModal/subjects/ScalarJsonOnly.svelte b/packages/builder/src/components/design/settings/controls/FieldContext/ExplanationModal/subjects/ScalarJsonOnly.svelte new file mode 100644 index 0000000000..102c7718d0 --- /dev/null +++ b/packages/builder/src/components/design/settings/controls/FieldContext/ExplanationModal/subjects/ScalarJsonOnly.svelte @@ -0,0 +1,64 @@ + + + +
+ JSON objects can't be used here, but any number, string or boolean values nested within said object can be if they are otherwise compatible with the component. These scalar values can be selected from the same menu as this parent and take the form parent.child. +
+ + {#if scalarDescendants.length > 0} +
+ Examples of scalar descendants of this object are: + {#if scalarDescendants[0]} + {scalarDescendants[0]} + {/if} + {#if scalarDescendants.length === 2} + {" and "} + {:else if scalarDescendants.length === 3} + {", "} + {/if} + {#if scalarDescendants[1]} + {scalarDescendants[1]} + {/if} + {#if scalarDescendants.length === 3} + {" and "} + {/if} + {#if scalarDescendants[2]} + {scalarDescendants[2]} + {/if} +
+ {/if} +
diff --git a/packages/builder/src/components/design/settings/controls/FieldContext/ExplanationModal/subjects/components/Block.svelte b/packages/builder/src/components/design/settings/controls/FieldContext/ExplanationModal/subjects/components/Block.svelte new file mode 100644 index 0000000000..95fa9309dd --- /dev/null +++ b/packages/builder/src/components/design/settings/controls/FieldContext/ExplanationModal/subjects/components/Block.svelte @@ -0,0 +1,26 @@ + + + + + + + diff --git a/packages/builder/src/components/design/settings/controls/FieldContext/ExplanationModal/subjects/components/Section.svelte b/packages/builder/src/components/design/settings/controls/FieldContext/ExplanationModal/subjects/components/Section.svelte index 41f919fd10..f4b25bc19c 100644 --- a/packages/builder/src/components/design/settings/controls/FieldContext/ExplanationModal/subjects/components/Section.svelte +++ b/packages/builder/src/components/design/settings/controls/FieldContext/ExplanationModal/subjects/components/Section.svelte @@ -4,6 +4,8 @@ diff --git a/packages/builder/src/components/design/settings/controls/FieldContext/ExplanationModal/subjects/components/index.js b/packages/builder/src/components/design/settings/controls/FieldContext/ExplanationModal/subjects/components/index.js index 4ea7a2ca88..57e512f5ce 100644 --- a/packages/builder/src/components/design/settings/controls/FieldContext/ExplanationModal/subjects/components/index.js +++ b/packages/builder/src/components/design/settings/controls/FieldContext/ExplanationModal/subjects/components/index.js @@ -1,3 +1,4 @@ export { default as Subject } from "./Subject.svelte" export { default as Property } from "./Property.svelte" export { default as Section } from "./Section.svelte" +export { default as Block } from "./Block.svelte" diff --git a/packages/builder/src/components/design/settings/controls/FieldContext/ExplanationModal/subjects/index.js b/packages/builder/src/components/design/settings/controls/FieldContext/ExplanationModal/subjects/index.js index 32d04e8b0e..e77d12d2bf 100644 --- a/packages/builder/src/components/design/settings/controls/FieldContext/ExplanationModal/subjects/index.js +++ b/packages/builder/src/components/design/settings/controls/FieldContext/ExplanationModal/subjects/index.js @@ -3,3 +3,4 @@ export { default as NotRequired } from "./NotRequired.svelte" export { default as StringsAsNumbers } from "./StringsAsNumbers.svelte" export { default as Support } from "./Support.svelte" export { default as DatesAsNumbers } from "./DatesAsNumbers.svelte" +export { default as ScalarJsonOnly } from "./ScalarJsonOnly.svelte" diff --git a/packages/builder/src/components/design/settings/controls/FieldContext/FieldContext.svelte b/packages/builder/src/components/design/settings/controls/FieldContext/FieldContext.svelte index efa8f86bd0..3cc353c3a9 100644 --- a/packages/builder/src/components/design/settings/controls/FieldContext/FieldContext.svelte +++ b/packages/builder/src/components/design/settings/controls/FieldContext/FieldContext.svelte @@ -78,6 +78,7 @@ {#if explanationModal} + setExplanationSubject(subjects.scalarJsonOnly)} + on:mouseleave={() => setExplanationSubject(subjects.none)} +>Scalar JSON values - diff --git a/packages/builder/src/components/design/settings/controls/FieldContext/lines/StringNumber.svelte b/packages/builder/src/components/design/settings/controls/FieldContext/lines/StringNumber.svelte index da9e2ea28e..9c9f001f48 100644 --- a/packages/builder/src/components/design/settings/controls/FieldContext/lines/StringNumber.svelte +++ b/packages/builder/src/components/design/settings/controls/FieldContext/lines/StringNumber.svelte @@ -6,11 +6,11 @@ - + setExplanationSubject(subjects.stringsAsNumbers)} on:mouseleave={() => setExplanationSubject(subjects.none)} text="non-number values" /> - + diff --git a/packages/builder/src/components/design/settings/controls/FieldContext/subjects.js b/packages/builder/src/components/design/settings/controls/FieldContext/subjects.js index bad3c88df2..a58564d2bd 100644 --- a/packages/builder/src/components/design/settings/controls/FieldContext/subjects.js +++ b/packages/builder/src/components/design/settings/controls/FieldContext/subjects.js @@ -4,6 +4,7 @@ const subjects = { stringsAsNumbers: Symbol("explanation-modal-strings-as-numbers"), datesAsNumbers: Symbol("explanation-modal-dates-as-numbers"), notRequired: Symbol("explanation-modal-not-required"), + scalarJsonOnly: Symbol("explanation-scalar-json-only"), none: Symbol("explanation-modal-none") } diff --git a/packages/builder/src/components/design/settings/controls/FieldContext/typography/Comma.svelte b/packages/builder/src/components/design/settings/controls/FieldContext/typography/Comma.svelte index 03a7f0d51e..f16bd16054 100644 --- a/packages/builder/src/components/design/settings/controls/FieldContext/typography/Comma.svelte +++ b/packages/builder/src/components/design/settings/controls/FieldContext/typography/Comma.svelte @@ -5,9 +5,10 @@ color: var(--grey-6); font-size: 17px; display: inline block; - line-height: 26px; margin-left: 2px; margin-right: 2px; flex-shrink: 0; + position: relative; + bottom: 2px; } diff --git a/packages/builder/src/components/design/settings/controls/FieldContext/typography/DocumentationLink.svelte b/packages/builder/src/components/design/settings/controls/FieldContext/typography/DocumentationLink.svelte index dbff157c50..982745ac07 100644 --- a/packages/builder/src/components/design/settings/controls/FieldContext/typography/DocumentationLink.svelte +++ b/packages/builder/src/components/design/settings/controls/FieldContext/typography/DocumentationLink.svelte @@ -32,8 +32,7 @@ .link { display: inline-flex; box-sizing: border-box; - padding: 3px 0 2px; - vertical-align: sub; + padding: 1px 0; filter: brightness(100%); overflow: hidden; diff --git a/packages/builder/src/components/design/settings/controls/FieldContext/typography/InfoWord.svelte b/packages/builder/src/components/design/settings/controls/FieldContext/typography/InfoWord.svelte index 7ace69daf3..582e07f9fe 100644 --- a/packages/builder/src/components/design/settings/controls/FieldContext/typography/InfoWord.svelte +++ b/packages/builder/src/components/design/settings/controls/FieldContext/typography/InfoWord.svelte @@ -51,17 +51,14 @@ diff --git a/packages/builder/src/components/design/settings/controls/FieldContext/typography/Space.svelte b/packages/builder/src/components/design/settings/controls/FieldContext/typography/Space.svelte index 1003a8c577..30aeefef16 100644 --- a/packages/builder/src/components/design/settings/controls/FieldContext/typography/Space.svelte +++ b/packages/builder/src/components/design/settings/controls/FieldContext/typography/Space.svelte @@ -3,7 +3,6 @@