@json-to-office/shared 3.1.0 → 3.2.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.
@@ -1,4 +1,4 @@
1
- import { R as ResolvedFontSource, a as RasterizeFontFace, b as ResolvedFont } from '../types-kcQwhOlf.js';
1
+ import { R as ResolvedFontSource, a as RasterizeFontFace, b as ResolvedFont } from '../types-DyQ0V9MU.js';
2
2
  import { GenerationWarning } from '../types/warnings.js';
3
3
  import '@sinclair/typebox';
4
4
 
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  export { C as ComponentDefinition, a as ComponentSchemaConfig, c as convertToJsonSchema, b as createComponentSchema, d as createComponentSchemaObject, e as exportSchemaToFile, f as fixSchemaReferences } from './schema-utils-B2i75lAT.js';
2
2
  export { AddWarningFunction, GenerationWarning } from './types/warnings.js';
3
- import { F as FontRegistryEntry, c as FontRuntimeOpts, R as ResolvedFontSource, b as ResolvedFont, a as RasterizeFontFace } from './types-kcQwhOlf.js';
4
- export { D as DEFAULT_VISUAL_DPI, d as FontFamilyNameSchema, e as FontRegistryDefinition, f as FontRegistryEntrySchema, g as FontRegistrySchema, h as FontSource, i as FontSourceSchema, H as HighchartsHeaders, j as HighchartsHeadersResolver, k as HighchartsServiceConfig, M as MAX_RASTERIZE_BATCH_SLIDES, l as MAX_RASTERIZE_FONTS, m as MAX_RASTERIZE_FONT_BYTES, n as MAX_VISUAL_DPI, o as MIN_VISUAL_DPI, P as PptxBatchRasterizer, p as PptxRasterizeBatchRequest, q as PptxRasterizeBatchResult, r as PptxRasterizeBatchSlide, s as PptxRasterizeBatchSlideResult, t as PptxRasterizeFailureStage, u as PptxRasterizeRequest, v as PptxRasterizeResult, w as PptxRasterizer, x as PptxServiceConfig, y as PptxServiceHeaders, z as PptxServiceHeadersResolver, S as SAFE_FONTS, A as SafeFontName, B as ServicesConfig, C as clampVisualDpi, E as isSafeFont } from './types-kcQwhOlf.js';
3
+ import { F as FontRegistryEntry, c as FontRuntimeOpts, R as ResolvedFontSource, b as ResolvedFont, a as RasterizeFontFace } from './types-DyQ0V9MU.js';
4
+ export { D as DEFAULT_VISUAL_DPI, d as FontFamilyNameSchema, e as FontRegistryDefinition, f as FontRegistryEntrySchema, g as FontRegistrySchema, h as FontSource, i as FontSourceSchema, H as HighchartsHeaders, j as HighchartsHeadersResolver, k as HighchartsServiceConfig, M as MAX_RASTERIZE_BATCH_SLIDES, l as MAX_RASTERIZE_FONTS, m as MAX_RASTERIZE_FONT_BYTES, n as MAX_VISUAL_DPI, o as MIN_VISUAL_DPI, P as PptxBatchRasterizer, p as PptxRasterizeBatchRequest, q as PptxRasterizeBatchResult, r as PptxRasterizeBatchSlide, s as PptxRasterizeBatchSlideResult, t as PptxRasterizeFailureStage, u as PptxRasterizeRequest, v as PptxRasterizeResult, w as PptxRasterizer, x as PptxServiceConfig, y as PptxServiceHeaders, z as PptxServiceHeadersResolver, S as SAFE_FONTS, A as SafeFontName, B as ServicesConfig, C as clampVisualDpi, E as isSafeFont } from './types-DyQ0V9MU.js';
5
5
  import { O as OfficeFormat } from './capabilities-DtPF3aBj.js';
6
6
  export { F as FeatureRequirement, a as FeatureRequirementCollector, b as OfficeRenderer, R as RENDERER_DEPENDENCY_MISSING, c as RenderOptions, d as RendererDiagnostic, e as RendererDiagnosticSeverity, f as RendererRegistry, g as RendererStatus, h as UnsupportedRendererFeatureError, i as UnsupportedRendererFeatureErrorInit, j as assertNever, k as assertRendererSupports, l as diagnoseUnsupportedFeatures, p as partitionDiagnostics, r as rendererError, m as rendererWarning } from './capabilities-DtPF3aBj.js';
7
7
  export { DEFAULT_ERROR_CONFIG, ERROR_EMOJIS, ErrorFormatterConfig, calculatePosition, clearComponentNamesCache, createErrorConfig, createJsonParseError, extractStandardComponentNames, formatErrorMessage, formatErrorSummary, getLiteralValue, getObjectSchemaPropertyNames, getSchemaMetadata, groupErrorsByPath, isLiteralSchema, isObjectSchema, isUnionSchema, transformValueError, transformValueErrors } from './validation/unified/index.js';
@@ -2043,4 +2043,25 @@ declare function blockReferencesFromDocument(document: unknown, source: {
2043
2043
  */
2044
2044
  declare function mergeWithDefaults<T>(userConfig: T, themeDefaults: Partial<T>): T;
2045
2045
 
2046
- export { BLOCK_SLOT_PLACEMENT_PROPS, BLOCK_SLOT_ROLES, type BlockComposition, type BlockCompositionOptions, BlockDefinitionsSchema, type BlockEnvironment, BlockEvaluationError, type BlockEvaluatorOptions, type BlockInvocationExample, BlockInvocationPropsSchema, type BlockIssue, type BlockReference, type BlockSectionEffect, type BlockSlideEffect, type BlockSlot, type BlockSlotBudget, type BlockSlotRole, type BlockSlotRoleValue, BlockSlotSchema, type BlockSourceMap, CANVASES, type ChartTypography, ChromeSchema, DEFAULT_CHART_THEME_COLORS, type DesignCanvas, DesignSpacingSchema, type DesignSystem, DesignSystemProperties, DesignSystemSchema, type DocumentBlockTarget, type ExpandedBlocks, FONT_URL_ALLOWLIST, type FontIssueCode, FontRegistry, FontRegistryEntry, type FontRegistryInput, type FontResolutionIssue, FontRuntimeOpts, type FontSubstitution, type FontValidationInput, type FontValidationResult, type JsonBlockDefinition, JsonBlockDefinitionSchema, JsonBlockEvaluator, MotifSchema, OfficeFormat, POINTS_PER_PIXEL_96DPI, POPULAR_GOOGLE_FONTS, PaletteSchema, type PopularGoogleFont, ROLE_SCALE_STEPS, RasterizeFontFace, ResolvedFont, ResolvedFontSource, type SynthesizedFamily, TYPE_ROLES, TextCaseSchema, type TypeRole, type TypeRoleName, TypeRoleNameSchema, TypeRoleSchema, TypeRolesSchema, TypographySchema, UPSTREAM_OVERRIDES, type UpstreamOverride, type UpstreamVariant, WEIGHT_LABELS, applyDocumentBlocksToSchema, applyExportMode, applyFontSubstitution, blockDependencies, blockInvocationExample, blockInvocationPropsSchema, blockPointerKey, blockReferencesFromDocument, blockSlotBudgets, blockSlotEditorSchema, blockSlotFacts, blockSlotJsonSchema, blockSlotMarkdown, blockSlotRoles, blockSlotsEditorSchema, blockSlotsJsonSchema, blockValueAt, blockWordCount, buildDefaultSubstitutionMap, capsFormatting, chartFamilyResolver, chartFontFaceCss, chartPointsPerPixel, collectFontNamesFromDocx, collectFontNamesFromPptx, composeBlocksWithPlugins, createBlockAuthoringSchema, cssFontFamily, defaultSubstituteFor, designCanvas, designColors, detectFontFormat, documentBlockMetadata, documentFontRegistry, fetchGoogleFontSources, getUpstreamOverride, isAllowedFontUrl, isBlockRecord, mergeFontRegistries, mergeWithDefaults, readBlockDefinitions, resolveBlockSlot, resolveDesignColor, resolveTypeRoles, restructureNameDiscriminatedUnions, rewriteFontFamilyName, synthesizeFamilyName, themeFontRegistry, toAuthoredBlockPointer, unionBranches, validateBlockDefinitions, validateBlockInvocations, validateDesignColors, validateFontReferences, withChartFontFaceCss, withChartTypography };
2046
+ /**
2047
+ * Whether a service URL stays on this machine or a private network.
2048
+ *
2049
+ * The question the `highcharts` component has to answer before it posts a
2050
+ * chart — every series, label and title — to an export server. Only what an
2051
+ * address itself proves counts: loopback, RFC 1918, link-local and
2052
+ * unique-local literals, `localhost`, and the special-use names reserved for
2053
+ * private resolution (`.local`, `.internal`, `.home.arpa`). A hostname that
2054
+ * DNS decides — a bare label, a `.corp` — is not guessed at: it needs
2055
+ * `services.highcharts.allowRemote`, like any other.
2056
+ */
2057
+ declare function isPrivateServiceUrl(url: string): boolean;
2058
+ /** Warning code for a chart posted outside the private network. */
2059
+ declare const REMOTE_EXPORT_WARNING = "W_HIGHCHARTS_REMOTE_EXPORT";
2060
+ /**
2061
+ * A public export server is a decision, not a default: the request carries
2062
+ * the whole chart, data included. Throws unless the caller opted in; when it
2063
+ * did, returns the sentence each pipeline records as a warning.
2064
+ */
2065
+ declare function remoteExportNotice(serverUrl: string, allowRemote: boolean | undefined): string | undefined;
2066
+
2067
+ export { BLOCK_SLOT_PLACEMENT_PROPS, BLOCK_SLOT_ROLES, type BlockComposition, type BlockCompositionOptions, BlockDefinitionsSchema, type BlockEnvironment, BlockEvaluationError, type BlockEvaluatorOptions, type BlockInvocationExample, BlockInvocationPropsSchema, type BlockIssue, type BlockReference, type BlockSectionEffect, type BlockSlideEffect, type BlockSlot, type BlockSlotBudget, type BlockSlotRole, type BlockSlotRoleValue, BlockSlotSchema, type BlockSourceMap, CANVASES, type ChartTypography, ChromeSchema, DEFAULT_CHART_THEME_COLORS, type DesignCanvas, DesignSpacingSchema, type DesignSystem, DesignSystemProperties, DesignSystemSchema, type DocumentBlockTarget, type ExpandedBlocks, FONT_URL_ALLOWLIST, type FontIssueCode, FontRegistry, FontRegistryEntry, type FontRegistryInput, type FontResolutionIssue, FontRuntimeOpts, type FontSubstitution, type FontValidationInput, type FontValidationResult, type JsonBlockDefinition, JsonBlockDefinitionSchema, JsonBlockEvaluator, MotifSchema, OfficeFormat, POINTS_PER_PIXEL_96DPI, POPULAR_GOOGLE_FONTS, PaletteSchema, type PopularGoogleFont, REMOTE_EXPORT_WARNING, ROLE_SCALE_STEPS, RasterizeFontFace, ResolvedFont, ResolvedFontSource, type SynthesizedFamily, TYPE_ROLES, TextCaseSchema, type TypeRole, type TypeRoleName, TypeRoleNameSchema, TypeRoleSchema, TypeRolesSchema, TypographySchema, UPSTREAM_OVERRIDES, type UpstreamOverride, type UpstreamVariant, WEIGHT_LABELS, applyDocumentBlocksToSchema, applyExportMode, applyFontSubstitution, blockDependencies, blockInvocationExample, blockInvocationPropsSchema, blockPointerKey, blockReferencesFromDocument, blockSlotBudgets, blockSlotEditorSchema, blockSlotFacts, blockSlotJsonSchema, blockSlotMarkdown, blockSlotRoles, blockSlotsEditorSchema, blockSlotsJsonSchema, blockValueAt, blockWordCount, buildDefaultSubstitutionMap, capsFormatting, chartFamilyResolver, chartFontFaceCss, chartPointsPerPixel, collectFontNamesFromDocx, collectFontNamesFromPptx, composeBlocksWithPlugins, createBlockAuthoringSchema, cssFontFamily, defaultSubstituteFor, designCanvas, designColors, detectFontFormat, documentBlockMetadata, documentFontRegistry, fetchGoogleFontSources, getUpstreamOverride, isAllowedFontUrl, isBlockRecord, isPrivateServiceUrl, mergeFontRegistries, mergeWithDefaults, readBlockDefinitions, remoteExportNotice, resolveBlockSlot, resolveDesignColor, resolveTypeRoles, restructureNameDiscriminatedUnions, rewriteFontFamilyName, synthesizeFamilyName, themeFontRegistry, toAuthoredBlockPointer, unionBranches, validateBlockDefinitions, validateBlockInvocations, validateDesignColors, validateFontReferences, withChartFontFaceCss, withChartTypography };
package/dist/index.js CHANGED
@@ -3428,6 +3428,38 @@ function deepMerge(target, source) {
3428
3428
  function mergeWithDefaults(userConfig, themeDefaults) {
3429
3429
  return deepMerge(themeDefaults, userConfig);
3430
3430
  }
3431
+
3432
+ // src/utils/serviceUrl.ts
3433
+ function isPrivateServiceUrl(url) {
3434
+ let hostname;
3435
+ try {
3436
+ hostname = new URL(
3437
+ /^https?:\/\//i.test(url.trim()) ? url.trim() : `http://${url.trim()}`
3438
+ ).hostname.toLowerCase();
3439
+ } catch {
3440
+ return false;
3441
+ }
3442
+ const host = hostname.replace(/^\[|\]$/g, "").replace(/\.$/, "");
3443
+ if (host === "localhost" || host.endsWith(".localhost")) return true;
3444
+ if (host === "::1" || /^f[cd][0-9a-f]{2}:/.test(host)) return true;
3445
+ if (/^fe[89ab][0-9a-f]:/.test(host)) return true;
3446
+ const v4 = /^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/.exec(host);
3447
+ if (v4) {
3448
+ const [a, b] = [Number(v4[1]), Number(v4[2])];
3449
+ return a === 127 || a === 10 || a === 172 && b >= 16 && b <= 31 || a === 192 && b === 168 || a === 169 && b === 254;
3450
+ }
3451
+ return /\.(local|internal|home\.arpa)$/.test(host);
3452
+ }
3453
+ var REMOTE_EXPORT_WARNING = "W_HIGHCHARTS_REMOTE_EXPORT";
3454
+ function remoteExportNotice(serverUrl, allowRemote) {
3455
+ if (isPrivateServiceUrl(serverUrl)) return void 0;
3456
+ if (!allowRemote) {
3457
+ throw new Error(
3458
+ `Highcharts export server ${serverUrl} is outside this machine and its private networks, and a chart is posted whole \u2014 every series, label and title. Run the export server locally (pnpm dlx highcharts-export-server --enableServer true), or set services.highcharts.allowRemote (HIGHCHARTS_ALLOW_REMOTE=1) to send chart data there deliberately.`
3459
+ );
3460
+ }
3461
+ return `Chart data \u2014 every series, label and title \u2014 was sent to ${serverUrl}, outside this machine and its private networks (services.highcharts.allowRemote).`;
3462
+ }
3431
3463
  export {
3432
3464
  BLOCK_SLOT_PLACEMENT_PROPS,
3433
3465
  BLOCK_SLOT_ROLES,
@@ -3464,6 +3496,7 @@ export {
3464
3496
  POINTS_PER_PIXEL_96DPI,
3465
3497
  POPULAR_GOOGLE_FONTS,
3466
3498
  PaletteSchema,
3499
+ REMOTE_EXPORT_WARNING,
3467
3500
  RENDERER_DEPENDENCY_MISSING,
3468
3501
  ROLE_SCALE_STEPS,
3469
3502
  RendererRegistry,
@@ -3542,6 +3575,7 @@ export {
3542
3575
  isBlockRecord,
3543
3576
  isLiteralSchema,
3544
3577
  isObjectSchema,
3578
+ isPrivateServiceUrl,
3545
3579
  isSafeFont,
3546
3580
  isUnionSchema,
3547
3581
  isValidSemver,
@@ -3552,6 +3586,7 @@ export {
3552
3586
  parseSemver,
3553
3587
  partitionDiagnostics,
3554
3588
  readBlockDefinitions,
3589
+ remoteExportNotice,
3555
3590
  rendererError,
3556
3591
  rendererWarning,
3557
3592
  resolveBlockSlot,