@valbuild/shared 0.150.2 → 0.150.3

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/CHANGELOG.md CHANGED
@@ -1,5 +1,24 @@
1
1
  # @valbuild/shared
2
2
 
3
+ ## 0.150.3
4
+
5
+ ### Patch Changes
6
+
7
+ - [#954](https://github.com/valbuild/val/pull/954) [`bc0cc43`](https://github.com/valbuild/val/commit/bc0cc433e157cca08f9ee384a4fb8be9bd3dad2c) Thanks [@freekh](https://github.com/freekh)! - Proposals in the Studio, reworked:
8
+
9
+ - **Save becomes Publish.** In a proposal, one split button stands where Publish is on the site. Its main half is the next step (Save, then Build, then Publish), and its caret offers every step, so you can publish straight away: Publish saves first. The separate Publish button beside the switcher is gone.
10
+ - **The switcher is where the proposal is managed**, as on a phone: its name and changes, Compare with the site, Rename, Copy link and Close, then where else to go.
11
+ - **Upgrade proposals** have one Publish (the bar's), say what they upgrade in the Publish dialog, cannot be published while Val Build is still working them out, are discarded rather than closed, and have their own icon.
12
+ - **A published proposal** shows a dialog with the ways out (the site, a new proposal, all proposals), since nothing more can be done in it.
13
+ - **Notices about where you are** (an upgrade, an upgrade under way, a restore) pop up from the bottom right and stay until dismissed; a dismissed one folds into the status bar and comes back from there.
14
+ - **No more flash of the site's chrome** at a proposal's address: the bar says "Loading…" until it knows, a return visit starts in the proposal at once, and opening a proposal says "Opening …" while the browser gets there.
15
+ - **After a save**, "Updating the preview…" and a failed render check are shown beside the switcher, and the status bar counts what is not saved to the proposal instead of saying "All changes saved".
16
+ - **Dialogs** dim the Studio instead of hiding it.
17
+ - **`theme.proposal`** in `s.settings()` sets the colour the Studio wears in a proposal (Val's violet when unset), under Settings → Studio. Like the accent, its shades are generated so text on them stays legible.
18
+
19
+ - Updated dependencies [[`bc0cc43`](https://github.com/valbuild/val/commit/bc0cc433e157cca08f9ee384a4fb8be9bd3dad2c)]:
20
+ - @valbuild/core@0.150.3
21
+
3
22
  ## 0.150.2
4
23
 
5
24
  ### Patch Changes
@@ -71,7 +71,27 @@ export declare function themeCustomProperties(theme: {
71
71
  accent?: string | null;
72
72
  /** A `--radius` length. The caller maps the named step; see `THEME_RADIUS_LENGTHS`. */
73
73
  radius?: string | null;
74
+ /** The proposal colour, a hex. See {@link proposalCustomProperties}. */
75
+ proposal?: string | null;
74
76
  }): Record<string, string>;
77
+ /**
78
+ * The proposal colour's tokens, for light and dark at once.
79
+ *
80
+ * The six `--*-proposal` tokens are declared per mode in `index.css`, each as
81
+ * `var(--theme-proposal-<mode>-<token>, <Val's violet>)`, so the ones written
82
+ * here are picked up where the mode block is declared -- on every element the
83
+ * Studio stamps `data-mode` on, which is where these go (see
84
+ * `themeCustomProperties` on why a `var()` resolves where it is declared).
85
+ * Both modes' values are written because an element does not know which mode
86
+ * its subtree will be in by the time it is styled.
87
+ *
88
+ * From the same ramp as the accent: the hue is the project's, the lightness
89
+ * of each step Val's, so the steps chosen here have the contrast Val's violet
90
+ * had. Text on the filled colour is white unless white would not read, then
91
+ * the ramp's darkest step. Empty for a value that is not a usable hex, so
92
+ * Val's violet stays.
93
+ */
94
+ export declare function proposalCustomProperties(hex: string): Record<string, string>;
75
95
  /**
76
96
  * WCAG relative luminance of a six-digit hex.
77
97
  *
@@ -7530,7 +7530,7 @@ function accentRamp(accent) {
7530
7530
  * Empty when nothing is set, which is what makes "no theme" cost nothing.
7531
7531
  */
7532
7532
  function themeCustomProperties(theme) {
7533
- var properties = {};
7533
+ var properties = createForOfIteratorHelper._objectSpread2({}, theme.proposal ? proposalCustomProperties(theme.proposal) : {});
7534
7534
  if (theme.accent) {
7535
7535
  var ramp = accentRamp(theme.accent);
7536
7536
  if (ramp !== null) {
@@ -7589,6 +7589,50 @@ function themeCustomProperties(theme) {
7589
7589
  return properties;
7590
7590
  }
7591
7591
 
7592
+ /**
7593
+ * The proposal colour's tokens, for light and dark at once.
7594
+ *
7595
+ * The six `--*-proposal` tokens are declared per mode in `index.css`, each as
7596
+ * `var(--theme-proposal-<mode>-<token>, <Val's violet>)`, so the ones written
7597
+ * here are picked up where the mode block is declared -- on every element the
7598
+ * Studio stamps `data-mode` on, which is where these go (see
7599
+ * `themeCustomProperties` on why a `var()` resolves where it is declared).
7600
+ * Both modes' values are written because an element does not know which mode
7601
+ * its subtree will be in by the time it is styled.
7602
+ *
7603
+ * From the same ramp as the accent: the hue is the project's, the lightness
7604
+ * of each step Val's, so the steps chosen here have the contrast Val's violet
7605
+ * had. Text on the filled colour is white unless white would not read, then
7606
+ * the ramp's darkest step. Empty for a value that is not a usable hex, so
7607
+ * Val's violet stays.
7608
+ */
7609
+ function proposalCustomProperties(hex) {
7610
+ var ramp = accentRamp(hex);
7611
+ if (ramp === null) return {};
7612
+ var onFill = function onFill(fill) {
7613
+ return contrastRatio("#ffffff", fill) >= 4.5 ? "#ffffff" : ramp[1000];
7614
+ };
7615
+ var soft = hexToRgb(ramp[500]);
7616
+ var softDark = soft === null ? ramp[900] : "rgba(".concat(soft.map(function (c) {
7617
+ return Math.round(c * 255);
7618
+ }).join(", "), ", 0.16)");
7619
+ return {
7620
+ "--theme-proposal-light-bg": ramp[700],
7621
+ "--theme-proposal-light-bg-hover": ramp[800],
7622
+ "--theme-proposal-light-bg-soft": ramp[100],
7623
+ "--theme-proposal-light-fg": ramp[700],
7624
+ "--theme-proposal-light-fg-on": onFill(ramp[700]),
7625
+ "--theme-proposal-light-border": ramp[400],
7626
+ // 700 in dark too: 600 left white text below AA for some hues.
7627
+ "--theme-proposal-dark-bg": ramp[700],
7628
+ "--theme-proposal-dark-bg-hover": ramp[600],
7629
+ "--theme-proposal-dark-bg-soft": softDark,
7630
+ "--theme-proposal-dark-fg": ramp[300],
7631
+ "--theme-proposal-dark-fg-on": onFill(ramp[700]),
7632
+ "--theme-proposal-dark-border": ramp[700]
7633
+ };
7634
+ }
7635
+
7592
7636
  /**
7593
7637
  * WCAG relative luminance of a six-digit hex.
7594
7638
  *
@@ -8792,6 +8836,7 @@ exports.memoizePerRequest = memoizePerRequest;
8792
8836
  exports.newestCommitSha = newestCommitSha;
8793
8837
  exports.partitionValidationErrors = partitionValidationErrors;
8794
8838
  exports.performSearch = performSearch;
8839
+ exports.proposalCustomProperties = proposalCustomProperties;
8795
8840
  exports.relativeLuminance = relativeLuminance;
8796
8841
  exports.remirrorToRichTextSource = remirrorToRichTextSource;
8797
8842
  exports.removeModule = removeModule;
@@ -7530,7 +7530,7 @@ function accentRamp(accent) {
7530
7530
  * Empty when nothing is set, which is what makes "no theme" cost nothing.
7531
7531
  */
7532
7532
  function themeCustomProperties(theme) {
7533
- var properties = {};
7533
+ var properties = createForOfIteratorHelper._objectSpread2({}, theme.proposal ? proposalCustomProperties(theme.proposal) : {});
7534
7534
  if (theme.accent) {
7535
7535
  var ramp = accentRamp(theme.accent);
7536
7536
  if (ramp !== null) {
@@ -7589,6 +7589,50 @@ function themeCustomProperties(theme) {
7589
7589
  return properties;
7590
7590
  }
7591
7591
 
7592
+ /**
7593
+ * The proposal colour's tokens, for light and dark at once.
7594
+ *
7595
+ * The six `--*-proposal` tokens are declared per mode in `index.css`, each as
7596
+ * `var(--theme-proposal-<mode>-<token>, <Val's violet>)`, so the ones written
7597
+ * here are picked up where the mode block is declared -- on every element the
7598
+ * Studio stamps `data-mode` on, which is where these go (see
7599
+ * `themeCustomProperties` on why a `var()` resolves where it is declared).
7600
+ * Both modes' values are written because an element does not know which mode
7601
+ * its subtree will be in by the time it is styled.
7602
+ *
7603
+ * From the same ramp as the accent: the hue is the project's, the lightness
7604
+ * of each step Val's, so the steps chosen here have the contrast Val's violet
7605
+ * had. Text on the filled colour is white unless white would not read, then
7606
+ * the ramp's darkest step. Empty for a value that is not a usable hex, so
7607
+ * Val's violet stays.
7608
+ */
7609
+ function proposalCustomProperties(hex) {
7610
+ var ramp = accentRamp(hex);
7611
+ if (ramp === null) return {};
7612
+ var onFill = function onFill(fill) {
7613
+ return contrastRatio("#ffffff", fill) >= 4.5 ? "#ffffff" : ramp[1000];
7614
+ };
7615
+ var soft = hexToRgb(ramp[500]);
7616
+ var softDark = soft === null ? ramp[900] : "rgba(".concat(soft.map(function (c) {
7617
+ return Math.round(c * 255);
7618
+ }).join(", "), ", 0.16)");
7619
+ return {
7620
+ "--theme-proposal-light-bg": ramp[700],
7621
+ "--theme-proposal-light-bg-hover": ramp[800],
7622
+ "--theme-proposal-light-bg-soft": ramp[100],
7623
+ "--theme-proposal-light-fg": ramp[700],
7624
+ "--theme-proposal-light-fg-on": onFill(ramp[700]),
7625
+ "--theme-proposal-light-border": ramp[400],
7626
+ // 700 in dark too: 600 left white text below AA for some hues.
7627
+ "--theme-proposal-dark-bg": ramp[700],
7628
+ "--theme-proposal-dark-bg-hover": ramp[600],
7629
+ "--theme-proposal-dark-bg-soft": softDark,
7630
+ "--theme-proposal-dark-fg": ramp[300],
7631
+ "--theme-proposal-dark-fg-on": onFill(ramp[700]),
7632
+ "--theme-proposal-dark-border": ramp[700]
7633
+ };
7634
+ }
7635
+
7592
7636
  /**
7593
7637
  * WCAG relative luminance of a six-digit hex.
7594
7638
  *
@@ -8792,6 +8836,7 @@ exports.memoizePerRequest = memoizePerRequest;
8792
8836
  exports.newestCommitSha = newestCommitSha;
8793
8837
  exports.partitionValidationErrors = partitionValidationErrors;
8794
8838
  exports.performSearch = performSearch;
8839
+ exports.proposalCustomProperties = proposalCustomProperties;
8795
8840
  exports.relativeLuminance = relativeLuminance;
8796
8841
  exports.remirrorToRichTextSource = remirrorToRichTextSource;
8797
8842
  exports.removeModule = removeModule;
@@ -7523,7 +7523,7 @@ function accentRamp(accent) {
7523
7523
  * Empty when nothing is set, which is what makes "no theme" cost nothing.
7524
7524
  */
7525
7525
  function themeCustomProperties(theme) {
7526
- var properties = {};
7526
+ var properties = _objectSpread2({}, theme.proposal ? proposalCustomProperties(theme.proposal) : {});
7527
7527
  if (theme.accent) {
7528
7528
  var ramp = accentRamp(theme.accent);
7529
7529
  if (ramp !== null) {
@@ -7582,6 +7582,50 @@ function themeCustomProperties(theme) {
7582
7582
  return properties;
7583
7583
  }
7584
7584
 
7585
+ /**
7586
+ * The proposal colour's tokens, for light and dark at once.
7587
+ *
7588
+ * The six `--*-proposal` tokens are declared per mode in `index.css`, each as
7589
+ * `var(--theme-proposal-<mode>-<token>, <Val's violet>)`, so the ones written
7590
+ * here are picked up where the mode block is declared -- on every element the
7591
+ * Studio stamps `data-mode` on, which is where these go (see
7592
+ * `themeCustomProperties` on why a `var()` resolves where it is declared).
7593
+ * Both modes' values are written because an element does not know which mode
7594
+ * its subtree will be in by the time it is styled.
7595
+ *
7596
+ * From the same ramp as the accent: the hue is the project's, the lightness
7597
+ * of each step Val's, so the steps chosen here have the contrast Val's violet
7598
+ * had. Text on the filled colour is white unless white would not read, then
7599
+ * the ramp's darkest step. Empty for a value that is not a usable hex, so
7600
+ * Val's violet stays.
7601
+ */
7602
+ function proposalCustomProperties(hex) {
7603
+ var ramp = accentRamp(hex);
7604
+ if (ramp === null) return {};
7605
+ var onFill = function onFill(fill) {
7606
+ return contrastRatio("#ffffff", fill) >= 4.5 ? "#ffffff" : ramp[1000];
7607
+ };
7608
+ var soft = hexToRgb(ramp[500]);
7609
+ var softDark = soft === null ? ramp[900] : "rgba(".concat(soft.map(function (c) {
7610
+ return Math.round(c * 255);
7611
+ }).join(", "), ", 0.16)");
7612
+ return {
7613
+ "--theme-proposal-light-bg": ramp[700],
7614
+ "--theme-proposal-light-bg-hover": ramp[800],
7615
+ "--theme-proposal-light-bg-soft": ramp[100],
7616
+ "--theme-proposal-light-fg": ramp[700],
7617
+ "--theme-proposal-light-fg-on": onFill(ramp[700]),
7618
+ "--theme-proposal-light-border": ramp[400],
7619
+ // 700 in dark too: 600 left white text below AA for some hues.
7620
+ "--theme-proposal-dark-bg": ramp[700],
7621
+ "--theme-proposal-dark-bg-hover": ramp[600],
7622
+ "--theme-proposal-dark-bg-soft": softDark,
7623
+ "--theme-proposal-dark-fg": ramp[300],
7624
+ "--theme-proposal-dark-fg-on": onFill(ramp[700]),
7625
+ "--theme-proposal-dark-border": ramp[700]
7626
+ };
7627
+ }
7628
+
7585
7629
  /**
7586
7630
  * WCAG relative luminance of a six-digit hex.
7587
7631
  *
@@ -8608,4 +8652,4 @@ var messageOf = function messageOf(error) {
8608
8652
  return error instanceof Error ? error.message : String(error);
8609
8653
  };
8610
8654
 
8611
- export { AA_LARGE, AA_TEXT, AnalyticsBeacon, Api, BRAND_CONTRAST_PAIRS, BinaryFileRef, CodeOptions, ColorOptions, DEFAULT_ERROR_MESSAGE, DateOptions, ENCODE_DEFAULTS, ENCODE_MIME_TYPE_OF, FileOptions, HistoricalCommit, HistoricalModule, HistoricalPatchSet, HistoryError, ImageEncodeOption, ImageOptions, JSONValue, JSON_ENTRIES_BATCH_MAX, LOCAL_FILE_IN_REMOTE_PROJECT_HINT, LOCAL_FILE_IN_REMOTE_PROJECT_WARNING, ModuleComparison, NEVER_ENCODED, ParentRef$1 as ParentRef, Patch, PatchBlock, PatchId, PatchJSON, PatchSets, PlanRefusalError, RAMP_STEPS, RemirrorBr, RemirrorBulletList, RemirrorHeading, RemirrorImage, RemirrorJSON, RemirrorLinkMark, RemirrorListItem, RemirrorOrderedList, RemirrorParagraph, RemirrorText, RemirrorTextMark, RestoreVerdict, RichTextOptions, SCHEMA_SOURCE_FIXES, SELF_CHECK_VERSION, STUDIO_FIXES, SerializedArraySchema, SerializedBooleanSchema, SerializedCodeSchema, SerializedColorSchema, SerializedDateSchema, SerializedDateTimeSchema, SerializedDiscriminatedUnionSchema, SerializedEnumSchema, SerializedFileSchema, SerializedImageSchema, SerializedKeyOfSchema, SerializedLiteralSchema, SerializedLocaleSchema, SerializedNumberSchema, SerializedObjectSchema, SerializedRecordSchema, SerializedRichTextSchema, SerializedRouteSchema, SerializedSchema, SerializedSettingsSchema, SerializedStringSchema, SerializedValViewSchema, SerializedVideoSchema, SharedValConfig, VAL_ENABLE_COOKIE_NAME, VAL_GREEN_RAMP, VAL_SESSION_COOKIE, VAL_STATE_COOKIE, VAL_STUDIO_HEADER, ValCommit, ValDeployment, VideoOptions, VideoStreamOption, WARNING_FIXES, WASM_ENCODED_MIME_TYPES, accentRamp, buildDuplicatePatch, buildEmptyAtPathPatch, buildFileRefValue, buildImageGalleryPatch, buildRemoveImageGalleryEntryPatch, buildSearchIndex, chainHeadOf, checkCompatibility, chooseEncoded, concatModulePath, contrastRatio, createRegExpFromPattern, createSearchIndex, createValClient, declaredLocales, describeContainerAtPath, emptyOf, enumLocaleTag, explainIncompatible, fallbackMimeType, filterBlockingValidationErrors, filterRoutesByPatterns, findSimilar, fitWithin, flattenRichText, forEachRichTextImage, getErrorMessageFromUnknownJson, getFilenameFromRef, getInlineImgInfo, getKeyOfRecordAt, getRefParts, getRoutesOf, getRoutesWithModulePaths, getSourceAt, getValDemo, indexModule, isInsidePatchSetPath, isLocaleSchema, isMimeTypeAccepted, isRemoteSchema, isRepairedOnSave, isSchemaSourceFixError, isSkippedSource, isStudioFix, isValidationWarning, isWarningFix, joinSharedChanges, keyOfRecordPath, levenshtein, localeAt, localeMeantBy, memoizePerRequest, newestCommitSha, partitionValidationErrors, performSearch, relativeLuminance, remirrorToRichTextSource, removeModule, resolveEncodeSettings, resolvePairGround, resolveSchemaSourceFixForError, resolveSchemaSourceFixes, resolveSerializedSchemaAtPath, richTextImageSchema, richTextToRemirror, safeParsePatch, schemaErrorsOf, schemaTypesOfPath, selectionClosure, selfCheck, shouldEncodeWithWasm, sideFiles, sideSource, sourcePathOfChild, themeCustomProperties, toolNames, traverseSchemaSource, urlOf, validateRoutePatterns, withExtension };
8655
+ export { AA_LARGE, AA_TEXT, AnalyticsBeacon, Api, BRAND_CONTRAST_PAIRS, BinaryFileRef, CodeOptions, ColorOptions, DEFAULT_ERROR_MESSAGE, DateOptions, ENCODE_DEFAULTS, ENCODE_MIME_TYPE_OF, FileOptions, HistoricalCommit, HistoricalModule, HistoricalPatchSet, HistoryError, ImageEncodeOption, ImageOptions, JSONValue, JSON_ENTRIES_BATCH_MAX, LOCAL_FILE_IN_REMOTE_PROJECT_HINT, LOCAL_FILE_IN_REMOTE_PROJECT_WARNING, ModuleComparison, NEVER_ENCODED, ParentRef$1 as ParentRef, Patch, PatchBlock, PatchId, PatchJSON, PatchSets, PlanRefusalError, RAMP_STEPS, RemirrorBr, RemirrorBulletList, RemirrorHeading, RemirrorImage, RemirrorJSON, RemirrorLinkMark, RemirrorListItem, RemirrorOrderedList, RemirrorParagraph, RemirrorText, RemirrorTextMark, RestoreVerdict, RichTextOptions, SCHEMA_SOURCE_FIXES, SELF_CHECK_VERSION, STUDIO_FIXES, SerializedArraySchema, SerializedBooleanSchema, SerializedCodeSchema, SerializedColorSchema, SerializedDateSchema, SerializedDateTimeSchema, SerializedDiscriminatedUnionSchema, SerializedEnumSchema, SerializedFileSchema, SerializedImageSchema, SerializedKeyOfSchema, SerializedLiteralSchema, SerializedLocaleSchema, SerializedNumberSchema, SerializedObjectSchema, SerializedRecordSchema, SerializedRichTextSchema, SerializedRouteSchema, SerializedSchema, SerializedSettingsSchema, SerializedStringSchema, SerializedValViewSchema, SerializedVideoSchema, SharedValConfig, VAL_ENABLE_COOKIE_NAME, VAL_GREEN_RAMP, VAL_SESSION_COOKIE, VAL_STATE_COOKIE, VAL_STUDIO_HEADER, ValCommit, ValDeployment, VideoOptions, VideoStreamOption, WARNING_FIXES, WASM_ENCODED_MIME_TYPES, accentRamp, buildDuplicatePatch, buildEmptyAtPathPatch, buildFileRefValue, buildImageGalleryPatch, buildRemoveImageGalleryEntryPatch, buildSearchIndex, chainHeadOf, checkCompatibility, chooseEncoded, concatModulePath, contrastRatio, createRegExpFromPattern, createSearchIndex, createValClient, declaredLocales, describeContainerAtPath, emptyOf, enumLocaleTag, explainIncompatible, fallbackMimeType, filterBlockingValidationErrors, filterRoutesByPatterns, findSimilar, fitWithin, flattenRichText, forEachRichTextImage, getErrorMessageFromUnknownJson, getFilenameFromRef, getInlineImgInfo, getKeyOfRecordAt, getRefParts, getRoutesOf, getRoutesWithModulePaths, getSourceAt, getValDemo, indexModule, isInsidePatchSetPath, isLocaleSchema, isMimeTypeAccepted, isRemoteSchema, isRepairedOnSave, isSchemaSourceFixError, isSkippedSource, isStudioFix, isValidationWarning, isWarningFix, joinSharedChanges, keyOfRecordPath, levenshtein, localeAt, localeMeantBy, memoizePerRequest, newestCommitSha, partitionValidationErrors, performSearch, proposalCustomProperties, relativeLuminance, remirrorToRichTextSource, removeModule, resolveEncodeSettings, resolvePairGround, resolveSchemaSourceFixForError, resolveSchemaSourceFixes, resolveSerializedSchemaAtPath, richTextImageSchema, richTextToRemirror, safeParsePatch, schemaErrorsOf, schemaTypesOfPath, selectionClosure, selfCheck, shouldEncodeWithWasm, sideFiles, sideSource, sourcePathOfChild, themeCustomProperties, toolNames, traverseSchemaSource, urlOf, validateRoutePatterns, withExtension };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@valbuild/shared",
3
- "version": "0.150.2",
3
+ "version": "0.150.3",
4
4
  "private": false,
5
5
  "description": "Val shared types and utilities",
6
6
  "repository": {
@@ -53,7 +53,7 @@
53
53
  "yaml": "^2.9.0",
54
54
  "zod": "^4.4.3",
55
55
  "zod-validation-error": "^5.0.0",
56
- "@valbuild/core": "0.150.2"
56
+ "@valbuild/core": "0.150.3"
57
57
  },
58
58
  "files": [
59
59
  "CHANGELOG.md",