@openpresentation/opf 0.2.2 → 0.3.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/dist/index.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  export { SchemaName, audience, chartType, colorScheme, fontScheme, language, layout, narrative, presentation, purpose, schemaEntries, schemaNames, schemas, socialPlatform, theme, tone } from './schemas.js';
2
2
  export { CatalogKind, audiences, catalogEntries, catalogIndexes, catalogKinds, catalogSchemaNames, catalogs, chartTypes, colorSchemes, fontSchemes, languages, layouts, narratives, purposes, socialPlatforms, themes, tones } from './catalogs.js';
3
- export { O as OPFValidationError, P as Presentation, V as ValidationIssue, a as ValidationResult, b as assertValid, c as assertValidCatalogRecord, d as assertValidPresentation, v as validate, e as validateCatalogRecord, f as validatePresentation } from './validator-MwlR2F56.js';
3
+ export { OPFValidationError, ValidationIssue, ValidationResult, assertValid, assertValidCatalogRecord, assertValidPresentation, validate, validateCatalogRecord, validatePresentation } from './validator.js';
4
4
  export { SpecFileEntry, SpecFileKind, SpecFilePath, specFileEntries, specFileKinds, specFilePaths } from './spec-files.js';
5
5
  export { LayoutPreviewIndex, LayoutPreviewRecord, getLayoutPreview, hasLayoutPreview, layoutPreviewIndex, layoutPreviewSlugs, layoutPreviews } from './previews.js';
6
+ export { P as Presentation } from './presentation-C8BOK0-5.js';
6
7
  export { Audience, ChartType, ColorScheme, FontScheme, Language, Layout, Narrative, Purpose, SocialPlatform, Theme, Tone } from './types.js';
package/dist/index.js CHANGED
@@ -6338,7 +6338,7 @@ var audiences = [
6338
6338
  "decisionPower": "advisory",
6339
6339
  "attentionBudgetMinutes": 45,
6340
6340
  "recommendedNarratives": [
6341
- "engineering-update",
6341
+ "status-update",
6342
6342
  "challenge-resolution",
6343
6343
  "innovation",
6344
6344
  "weekly-progress"
@@ -6854,7 +6854,7 @@ var tones = [
6854
6854
  "weekly-progress",
6855
6855
  "status-update",
6856
6856
  "company-intro",
6857
- "all-hands"
6857
+ "focus"
6858
6858
  ],
6859
6859
  "tags": [
6860
6860
  "internal",
@@ -6924,7 +6924,7 @@ var tones = [
6924
6924
  "challenge-resolution",
6925
6925
  "innovation",
6926
6926
  "conference-talk",
6927
- "engineering-update"
6927
+ "status-update"
6928
6928
  ],
6929
6929
  "tags": [
6930
6930
  "technical",
@@ -7027,7 +7027,7 @@ var tones = [
7027
7027
  "If you take one thing from this section, take this."
7028
7028
  ],
7029
7029
  "recommendedNarratives": [
7030
- "all-hands",
7030
+ "focus",
7031
7031
  "company-intro",
7032
7032
  "weekly-progress",
7033
7033
  "performance-review"
@@ -24774,6 +24774,413 @@ var catalogEntries = [
24774
24774
  "yu-gothic.json"
24775
24775
  ], records: fontSchemes, index: catalogIndexes.fontSchemes }
24776
24776
  ];
24777
+
24778
+ // src/generated/catalog-ids.ts
24779
+ var catalogIds = {
24780
+ audiences: [
24781
+ "executives",
24782
+ "board",
24783
+ "engineering-team",
24784
+ "investors",
24785
+ "customers",
24786
+ "sales-team",
24787
+ "marketing-team",
24788
+ "all-hands",
24789
+ "candidates",
24790
+ "regulators"
24791
+ ],
24792
+ purposes: [
24793
+ "inform",
24794
+ "decide",
24795
+ "align",
24796
+ "persuade",
24797
+ "educate",
24798
+ "report",
24799
+ "pitch",
24800
+ "sell",
24801
+ "plan"
24802
+ ],
24803
+ tones: [
24804
+ "formal",
24805
+ "casual",
24806
+ "inspirational",
24807
+ "technical",
24808
+ "persuasive",
24809
+ "authoritative",
24810
+ "conversational"
24811
+ ],
24812
+ themes: [
24813
+ "bold",
24814
+ "classic",
24815
+ "dark",
24816
+ "minimal"
24817
+ ],
24818
+ layouts: [
24819
+ "blank",
24820
+ "chart-1x",
24821
+ "chart-2x",
24822
+ "chart-3x",
24823
+ "code-1x",
24824
+ "image-1x",
24825
+ "image-2x",
24826
+ "image-3x",
24827
+ "image-bleed",
24828
+ "list-1x",
24829
+ "list-2x",
24830
+ "list-3x",
24831
+ "list-4x",
24832
+ "list-5x",
24833
+ "list-6x",
24834
+ "media-1x",
24835
+ "number-1x",
24836
+ "number-2x",
24837
+ "number-3x",
24838
+ "number-4x",
24839
+ "number-5x",
24840
+ "number-6x",
24841
+ "table-1x",
24842
+ "text-1x",
24843
+ "text-2x",
24844
+ "text-3x",
24845
+ "title",
24846
+ "title-subtitle"
24847
+ ],
24848
+ chartTypes: [
24849
+ "100pct-bullet-bar",
24850
+ "100pct-bullet-bar-2x",
24851
+ "100pct-bullet-bar-3x",
24852
+ "100pct-bullet-column",
24853
+ "100pct-bullet-column-2x",
24854
+ "100pct-bullet-column-3x",
24855
+ "100pct-progress-bar",
24856
+ "100pct-stacked-area-2x",
24857
+ "100pct-stacked-area-3x",
24858
+ "100pct-stacked-bar-2x",
24859
+ "100pct-stacked-bar-3x",
24860
+ "100pct-stacked-column-2x",
24861
+ "100pct-stacked-column-3x",
24862
+ "area",
24863
+ "australia",
24864
+ "bar",
24865
+ "box-and-whisker",
24866
+ "box-and-whisker-2x",
24867
+ "box-and-whisker-3x",
24868
+ "bullet-bar",
24869
+ "bullet-bar-2x",
24870
+ "bullet-bar-3x",
24871
+ "bullet-column",
24872
+ "bullet-column-2x",
24873
+ "bullet-column-3x",
24874
+ "canada",
24875
+ "clustered-bar-2x",
24876
+ "clustered-column",
24877
+ "column",
24878
+ "dot-plot",
24879
+ "dot-plot-2x",
24880
+ "dot-plot-3x",
24881
+ "dot-plot-4x",
24882
+ "dot-plot-5x",
24883
+ "dot-plot-6x",
24884
+ "doughnut",
24885
+ "dumbbell",
24886
+ "filled-radar",
24887
+ "funnel",
24888
+ "histogram",
24889
+ "line",
24890
+ "line-2x",
24891
+ "line-3x",
24892
+ "line-with-high-low",
24893
+ "line-with-high-low-and-markers",
24894
+ "line-with-markers",
24895
+ "line-with-markers-2x",
24896
+ "line-with-markers-3x",
24897
+ "pareto",
24898
+ "pie",
24899
+ "radar",
24900
+ "radar-with-markers",
24901
+ "scatter",
24902
+ "sparkline",
24903
+ "sparkline-2x",
24904
+ "sparkline-3x",
24905
+ "sparkline-4x",
24906
+ "sparkline-5x",
24907
+ "sparkline-6x",
24908
+ "stacked-area-2x",
24909
+ "stacked-area-3x",
24910
+ "stacked-bar-2x",
24911
+ "stacked-bar-3x",
24912
+ "stacked-column-2x",
24913
+ "stacked-column-3x",
24914
+ "stacked-line-2x",
24915
+ "stacked-line-3x",
24916
+ "stacked-line-with-markers-2x",
24917
+ "stacked-line-with-markers-3x",
24918
+ "treemap",
24919
+ "treemap-2x",
24920
+ "treemap-3x",
24921
+ "united-kingdom",
24922
+ "united-states",
24923
+ "waterfall",
24924
+ "world"
24925
+ ],
24926
+ narratives: [
24927
+ "problem-solution",
24928
+ "scqa",
24929
+ "strategic-narrative",
24930
+ "golden-circle",
24931
+ "conference-talk",
24932
+ "transformation-arc",
24933
+ "pitch-deck",
24934
+ "early-startup-pitch",
24935
+ "venture-pitch",
24936
+ "persuasive-sales",
24937
+ "company-intro",
24938
+ "marketing-strategy",
24939
+ "product-launch",
24940
+ "strategic-advisory",
24941
+ "challenge-resolution",
24942
+ "project-proposal",
24943
+ "failure-analysis",
24944
+ "classic-story",
24945
+ "business-narrative",
24946
+ "rags-to-riches",
24947
+ "underdog-victory",
24948
+ "survival-story",
24949
+ "educate",
24950
+ "persuade",
24951
+ "reveal",
24952
+ "justice",
24953
+ "innovation",
24954
+ "focus",
24955
+ "qbr",
24956
+ "business-review",
24957
+ "board-meeting",
24958
+ "weekly-progress",
24959
+ "status-update",
24960
+ "performance-review",
24961
+ "survey-analysis",
24962
+ "trend-analysis",
24963
+ "employee-review",
24964
+ "performance-improvement-plan",
24965
+ "capacity-planning"
24966
+ ],
24967
+ socialPlatforms: [
24968
+ "linkedin",
24969
+ "x",
24970
+ "github",
24971
+ "youtube",
24972
+ "instagram",
24973
+ "facebook",
24974
+ "tiktok",
24975
+ "threads",
24976
+ "mastodon",
24977
+ "bluesky"
24978
+ ],
24979
+ languages: [
24980
+ "afrikaans",
24981
+ "albanian",
24982
+ "amharic",
24983
+ "arabic",
24984
+ "armenian",
24985
+ "aymara",
24986
+ "azerbaijani",
24987
+ "bengali",
24988
+ "berber-latin",
24989
+ "bosnian-latin",
24990
+ "bulgarian",
24991
+ "catalan",
24992
+ "cebuano",
24993
+ "chinese-simplified",
24994
+ "chinese-traditional",
24995
+ "chittagonian",
24996
+ "croatian",
24997
+ "czech",
24998
+ "danish",
24999
+ "dutch",
25000
+ "english",
25001
+ "english-au",
25002
+ "english-ca",
25003
+ "english-gb",
25004
+ "english-in",
25005
+ "english-us",
25006
+ "estonian",
25007
+ "filipino",
25008
+ "finnish",
25009
+ "french",
25010
+ "fulfulde",
25011
+ "galician",
25012
+ "georgian",
25013
+ "german",
25014
+ "greek",
25015
+ "gujarati",
25016
+ "hausa",
25017
+ "hebrew",
25018
+ "hindi",
25019
+ "hungarian",
25020
+ "igbo",
25021
+ "indonesian",
25022
+ "italian",
25023
+ "japanese",
25024
+ "kannada",
25025
+ "kazakh",
25026
+ "khmer",
25027
+ "kinyarwanda",
25028
+ "korean",
25029
+ "kurmanji",
25030
+ "latvian",
25031
+ "lithuanian",
25032
+ "macedonian",
25033
+ "malagasy",
25034
+ "malay",
25035
+ "malayalam",
25036
+ "maori",
25037
+ "marathi",
25038
+ "mongolian",
25039
+ "nepali",
25040
+ "norwegian",
25041
+ "odia",
25042
+ "oromo",
25043
+ "pashto",
25044
+ "persian",
25045
+ "polish",
25046
+ "portuguese",
25047
+ "punjabi-gurmukhi",
25048
+ "punjabi-shahmukhi",
25049
+ "romanian",
25050
+ "russian",
25051
+ "serbian-cyrillic",
25052
+ "serbian-latin",
25053
+ "shona",
25054
+ "slovak",
25055
+ "slovenian",
25056
+ "somali",
25057
+ "spanish",
25058
+ "swahili",
25059
+ "swedish",
25060
+ "tagalog",
25061
+ "tajik",
25062
+ "tamil",
25063
+ "telugu",
25064
+ "thai",
25065
+ "turkish",
25066
+ "ukrainian",
25067
+ "urdu",
25068
+ "uzbek-latin",
25069
+ "vietnamese-quoc-ngu",
25070
+ "xhosa",
25071
+ "yoruba",
25072
+ "zulu"
25073
+ ],
25074
+ colorSchemes: [
25075
+ "black-and-white",
25076
+ "bold-red",
25077
+ "boost",
25078
+ "burnt-orange",
25079
+ "cool-horizon",
25080
+ "corporate-blue",
25081
+ "deep-purple",
25082
+ "forest-green",
25083
+ "golden-yellow",
25084
+ "luxury",
25085
+ "pastel-red",
25086
+ "slate-gray",
25087
+ "steel-blue",
25088
+ "vibes"
25089
+ ],
25090
+ fontSchemes: [
25091
+ "angsana-new",
25092
+ "aparajita",
25093
+ "aptos",
25094
+ "arabic-typesetting",
25095
+ "arial",
25096
+ "batang",
25097
+ "bookman",
25098
+ "calibri",
25099
+ "century-schoolbook",
25100
+ "consolas",
25101
+ "constantia",
25102
+ "courier-new",
25103
+ "daunpenh",
25104
+ "david",
25105
+ "dilleniaupc",
25106
+ "fangsong",
25107
+ "garamond",
25108
+ "gautami",
25109
+ "georgia",
25110
+ "gisha",
25111
+ "grandview",
25112
+ "gungsuh",
25113
+ "impact",
25114
+ "kalinga",
25115
+ "kartika",
25116
+ "khmer-ui",
25117
+ "latha",
25118
+ "lucida-sans",
25119
+ "malgun-gothic",
25120
+ "mangal",
25121
+ "meiryo",
25122
+ "microsoft-jhenghei",
25123
+ "microsoft-yahei",
25124
+ "mingliu",
25125
+ "miriam",
25126
+ "montserrat",
25127
+ "ms-mincho",
25128
+ "nirmala-ui",
25129
+ "noto-naksh-arabic",
25130
+ "noto-nastaliq-urdu",
25131
+ "noto-sans",
25132
+ "noto-sans-arabic",
25133
+ "noto-sans-armenian",
25134
+ "noto-sans-bengali",
25135
+ "noto-sans-devangari",
25136
+ "noto-sans-ethiopic",
25137
+ "noto-sans-georgian",
25138
+ "noto-sans-gujarati",
25139
+ "noto-sans-gurmukhi",
25140
+ "noto-sans-hebrew",
25141
+ "noto-sans-jp",
25142
+ "noto-sans-kannada",
25143
+ "noto-sans-khmer",
25144
+ "noto-sans-kr",
25145
+ "noto-sans-malayalam",
25146
+ "noto-sans-mongolian",
25147
+ "noto-sans-oriya",
25148
+ "noto-sans-sc",
25149
+ "noto-sans-tamil",
25150
+ "noto-sans-tc",
25151
+ "noto-sans-telugu",
25152
+ "noto-sans-thai",
25153
+ "nyala",
25154
+ "open-sans",
25155
+ "pmingliu",
25156
+ "poppins",
25157
+ "pt-serif",
25158
+ "raavi",
25159
+ "raleway",
25160
+ "roboto",
25161
+ "rockwell",
25162
+ "sakkal-majalla",
25163
+ "seaford",
25164
+ "segoe-ui",
25165
+ "segoe-ui-light",
25166
+ "shonar-bangla",
25167
+ "shruti",
25168
+ "simsun",
25169
+ "skeena",
25170
+ "sylfaen",
25171
+ "tahoma",
25172
+ "tenorite",
25173
+ "times-new-roman",
25174
+ "traditional-arabic",
25175
+ "trebuchet-ms",
25176
+ "tunga",
25177
+ "verdana",
25178
+ "vrinda",
25179
+ "yu-gothic"
25180
+ ]
25181
+ };
25182
+
25183
+ // src/validator.ts
24777
25184
  var OPFValidationError = class extends Error {
24778
25185
  issues;
24779
25186
  result;
@@ -25173,6 +25580,126 @@ function validatePresentationSemantics(value) {
25173
25580
  });
25174
25581
  return issues;
25175
25582
  }
25583
+ var bareIdPattern = /^[a-z0-9][a-z0-9-]*$/;
25584
+ function inlineCatalogEntry(context, kind) {
25585
+ const catalogsField = context.document.catalogs;
25586
+ if (!isRecord(catalogsField)) {
25587
+ return void 0;
25588
+ }
25589
+ const entry = catalogsField[kind];
25590
+ return isRecord(entry) ? entry : void 0;
25591
+ }
25592
+ function unknownIdWarning(kind, value, path, context) {
25593
+ if (typeof value !== "string" || !bareIdPattern.test(value)) {
25594
+ return void 0;
25595
+ }
25596
+ if (context) {
25597
+ const entry = inlineCatalogEntry(context, kind);
25598
+ if (entry) {
25599
+ if (Array.isArray(entry.records) && entry.records.some((record) => isRecord(record) && record.id === value)) {
25600
+ return void 0;
25601
+ }
25602
+ if (typeof entry.source === "string") {
25603
+ return void 0;
25604
+ }
25605
+ }
25606
+ }
25607
+ if (catalogIds[kind].includes(value)) {
25608
+ return void 0;
25609
+ }
25610
+ return semanticIssue(path, `unknown ${kind} catalog id '${value}'`, { kind, id: value });
25611
+ }
25612
+ function referenceObjectWarning(kind, value, path, context) {
25613
+ if (typeof value === "string") {
25614
+ return unknownIdWarning(kind, value, path, context);
25615
+ }
25616
+ if (isRecord(value)) {
25617
+ return unknownIdWarning(kind, value.id, pathFor(path, "id"), context);
25618
+ }
25619
+ return void 0;
25620
+ }
25621
+ function pushIfDefined(issues, issue) {
25622
+ if (issue) {
25623
+ issues.push(issue);
25624
+ }
25625
+ }
25626
+ function designReferenceWarnings(design, path, context) {
25627
+ if (!isRecord(design)) {
25628
+ return [];
25629
+ }
25630
+ const issues = [];
25631
+ pushIfDefined(issues, referenceObjectWarning("themes", design.theme, pathFor(path, "theme"), context));
25632
+ pushIfDefined(issues, referenceObjectWarning("colorSchemes", design.colorScheme, pathFor(path, "colorScheme"), context));
25633
+ pushIfDefined(issues, referenceObjectWarning("fontSchemes", design.fontScheme, pathFor(path, "fontScheme"), context));
25634
+ if (isRecord(design.theme)) {
25635
+ const themePath = pathFor(path, "theme");
25636
+ pushIfDefined(issues, referenceObjectWarning("colorSchemes", design.theme.colorScheme, pathFor(themePath, "colorScheme"), context));
25637
+ pushIfDefined(issues, referenceObjectWarning("fontSchemes", design.theme.fontScheme, pathFor(themePath, "fontScheme"), context));
25638
+ }
25639
+ return issues;
25640
+ }
25641
+ function chartTypeWarnings(payload, path, context) {
25642
+ if (!isRecord(payload)) {
25643
+ return [];
25644
+ }
25645
+ const issues = [];
25646
+ if (isRecord(payload.chart)) {
25647
+ pushIfDefined(issues, unknownIdWarning("chartTypes", payload.chart.type, `${pathFor(path, "chart")}/type`, context));
25648
+ }
25649
+ if (Array.isArray(payload.blocks)) {
25650
+ payload.blocks.forEach((block, index) => {
25651
+ issues.push(...chartTypeWarnings(block, `${pathFor(path, "blocks")}/${index}`, context));
25652
+ });
25653
+ }
25654
+ return issues;
25655
+ }
25656
+ function presentationReferenceWarnings(value) {
25657
+ if (!isRecord(value) || !Array.isArray(value.slides)) {
25658
+ return [];
25659
+ }
25660
+ const context = { document: value };
25661
+ const issues = [];
25662
+ if (typeof value.narrative === "string") {
25663
+ pushIfDefined(issues, unknownIdWarning("narratives", value.narrative, "/narrative", context));
25664
+ }
25665
+ issues.push(...designReferenceWarnings(value.design, "/design", context));
25666
+ value.slides.forEach((slide, index) => {
25667
+ if (!isRecord(slide)) {
25668
+ return;
25669
+ }
25670
+ const slidePath = `/slides/${index}`;
25671
+ issues.push(...designReferenceWarnings(slide.design, pathFor(slidePath, "design"), context));
25672
+ issues.push(...chartTypeWarnings(slide, slidePath, context));
25673
+ for (const key of Object.keys(slide)) {
25674
+ if (promotedRegionKeySet.has(key)) {
25675
+ issues.push(...chartTypeWarnings(slide[key], pathFor(slidePath, key), context));
25676
+ }
25677
+ }
25678
+ });
25679
+ return issues;
25680
+ }
25681
+ var catalogCrossLinkFields = {
25682
+ audience: { recommendedNarratives: "narratives", recommendedTones: "tones" },
25683
+ purpose: { recommendedNarratives: "narratives", recommendedTones: "tones" },
25684
+ tone: { recommendedNarratives: "narratives" }
25685
+ };
25686
+ function catalogCrossLinkWarnings(schemaName, value) {
25687
+ const fields = catalogCrossLinkFields[schemaName];
25688
+ if (!fields || !isRecord(value)) {
25689
+ return [];
25690
+ }
25691
+ const issues = [];
25692
+ for (const [field, kind] of Object.entries(fields)) {
25693
+ const links = value[field];
25694
+ if (!Array.isArray(links)) {
25695
+ continue;
25696
+ }
25697
+ links.forEach((link, index) => {
25698
+ pushIfDefined(issues, unknownIdWarning(kind, link, `${pathFor("/", field)}/${index}`));
25699
+ });
25700
+ }
25701
+ return issues;
25702
+ }
25176
25703
  function validateLanguageSemantics(value) {
25177
25704
  if (!isRecord(value)) {
25178
25705
  return [];
@@ -25188,14 +25715,20 @@ function validate(value, schemaOrKind = "presentation") {
25188
25715
  const resolved = resolveValidator(schemaOrKind);
25189
25716
  const valid = resolved.validate(value) === true;
25190
25717
  const errors = valid ? [] : (resolved.validate.errors ?? []).map(toIssue);
25718
+ const warnings = [];
25191
25719
  if (resolved.schemaName === "presentation") {
25192
25720
  errors.push(...validatePresentationSemantics(value));
25721
+ warnings.push(...presentationReferenceWarnings(value));
25193
25722
  } else if (resolved.schemaName === "language") {
25194
25723
  errors.push(...validateLanguageSemantics(value));
25195
25724
  }
25725
+ if (resolved.schemaName) {
25726
+ warnings.push(...catalogCrossLinkWarnings(resolved.schemaName, value));
25727
+ }
25196
25728
  return {
25197
25729
  valid: errors.length === 0,
25198
25730
  errors,
25731
+ warnings,
25199
25732
  schemaName: resolved.schemaName,
25200
25733
  catalogKind: resolved.catalogKind
25201
25734
  };
@@ -25222,6 +25755,12 @@ function assertValidCatalogRecord(kind, value) {
25222
25755
 
25223
25756
  // src/generated/spec-files.ts
25224
25757
  var specFileEntries = [
25758
+ {
25759
+ "path": "README.md",
25760
+ "packagePath": "@openpresentation/opf/spec/README.md",
25761
+ "kind": "spec",
25762
+ "mediaType": "text/markdown"
25763
+ },
25225
25764
  {
25226
25765
  "path": "catalogs/audiences/all-hands.json",
25227
25766
  "packagePath": "@openpresentation/opf/spec/catalogs/audiences/all-hands.json",
@@ -28080,6 +28619,7 @@ var specFileEntries = [
28080
28619
  }
28081
28620
  ];
28082
28621
  var specFilePaths = [
28622
+ "README.md",
28083
28623
  "catalogs/audiences/all-hands.json",
28084
28624
  "catalogs/audiences/board.json",
28085
28625
  "catalogs/audiences/candidates.json",
@@ -28558,10 +29098,10 @@ var specFilePaths = [
28558
29098
  "schemas/tone.schema.json"
28559
29099
  ];
28560
29100
  var specFileKinds = [
29101
+ "spec",
28561
29102
  "catalogRecord",
28562
29103
  "catalogIndex",
28563
29104
  "openapi",
28564
- "spec",
28565
29105
  "reference",
28566
29106
  "schema"
28567
29107
  ];