@bettercms-ai/types 1.55.0 → 1.58.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.js CHANGED
@@ -2887,6 +2887,7 @@ var DOCK_ICON_NAMES = [
2887
2887
  "file-certificate",
2888
2888
  "file-code",
2889
2889
  "file-download",
2890
+ "file-settings",
2890
2891
  "file-text",
2891
2892
  "filter",
2892
2893
  "flag",
@@ -4553,7 +4554,7 @@ function planSections(slots, blocks) {
4553
4554
 
4554
4555
  // src/kit-v2.ts
4555
4556
  var TAB_MAX = 8;
4556
- var TAB_MAX_RENDERABLE_NOW = 3;
4557
+ var TAB_MAX_RENDERABLE_NOW = TAB_MAX;
4557
4558
  var SEGMENTED_MIN = 2;
4558
4559
  var SEGMENTED_MAX = 8;
4559
4560
  var DEPTH_MAX = 10;
@@ -4621,6 +4622,10 @@ var BLOCK_FIELD_TYPES_RENDERABLE_NOW = [
4621
4622
  "datetime",
4622
4623
  "boolean"
4623
4624
  ];
4625
+ var OPEN_MODES = ["inline", "drill", "popover", "dialog"];
4626
+ var OPEN_MODE_TYPES = ["object", "array", "group", "repeater", "table", "code"];
4627
+ var SHOW_IF_SCOPES = ["parent", "root"];
4628
+ var LIST_PREVIEW_SLOTS = ["title", "subtitle", "media", "fallback", "icon"];
4624
4629
  var V2_SHAPES = ["block", "page", "entry", "global", "object"];
4625
4630
  var V2_PLACEMENTS = ["inline", "section", "page"];
4626
4631
  var KIT_CATEGORIES = [
@@ -4639,6 +4644,8 @@ var KIT_CATEGORIES = [
4639
4644
  "Data & interactive",
4640
4645
  "Advanced patterns"
4641
4646
  ];
4647
+ var CATEGORY_ORDER = KIT_CATEGORIES;
4648
+ var CATEGORY_ID_MAX = 32;
4642
4649
  var V2_KEYS = {
4643
4650
  components: ["shape", "placement"],
4644
4651
  content_models: ["shape", "placement", "category", "variants"],
@@ -4661,12 +4668,32 @@ var UI_REFUSAL_CODES = {
4661
4668
  "derived_field",
4662
4669
  "feature_unknown"
4663
4670
  ],
4664
- build: ["peer_missing", "kit_major_unsupported", "compile_error", "nondeterministic", "size_exceeded"],
4671
+ build: [
4672
+ "peer_missing",
4673
+ "kit_major_unsupported",
4674
+ "compile_error",
4675
+ "nondeterministic",
4676
+ "size_exceeded",
4677
+ // CMS-stored UI (dock-ui.ts): an import off the allow-list; one name in both the repo and the CMS
4678
+ "import_denied",
4679
+ "name_conflict"
4680
+ ],
4665
4681
  protocol: ["unsupported", "handshake_timeout", "origin_mismatch", "write_denied"],
4666
4682
  runtime: ["crashed", "blank", "csp_violation"],
4667
- policy: ["confirmation_required", "flag_off"]
4683
+ // not_approved: publish_dock_ui on a version no one approved
4684
+ policy: ["confirmation_required", "flag_off", "not_approved"]
4668
4685
  };
4686
+ var UI_REFUSAL_IDS = Object.keys(UI_REFUSAL_CODES).flatMap(
4687
+ (f) => UI_REFUSAL_CODES[f].map((c) => `${f}.${c}`)
4688
+ );
4669
4689
  var uiRefusalId = (r) => `${r.family}.${r.code}`;
4690
+ var FRAME_REFUSALS = [
4691
+ "runtime.crashed",
4692
+ "runtime.blank",
4693
+ "runtime.csp_violation",
4694
+ "protocol.unsupported"
4695
+ ];
4696
+ var UI_PROTOCOLS = ["bcms-ui/2", "bcms-input/1", "bcms-panel/1"];
4670
4697
  var isUiRefusal = (v) => {
4671
4698
  if (typeof v !== "object" || v === null) return false;
4672
4699
  const { family, code, message } = v;
@@ -4720,6 +4747,23 @@ function schemaHashInput(table, def) {
4720
4747
  return Object.fromEntries(SCHEMA_HASH_INPUTS[table].map((k) => [k, def[k] ?? (LIST_INPUTS.has(k) ? [] : null)]));
4721
4748
  }
4722
4749
 
4750
+ // src/dock-ui.ts
4751
+ var DOCK_UI_LIMITS = {
4752
+ sourcesPerProject: 64,
4753
+ bytesPerProject: 4 * 1024 * 1024,
4754
+ bytesPerVersion: 256 * 1024,
4755
+ bytesPerBundle: 512 * 1024
4756
+ };
4757
+ var DOCK_UI_NAME = /^[a-z0-9](?:[a-z0-9-]{0,62}[a-z0-9])?$/;
4758
+ var DOCK_UI_IMPORTS = ["react", "react-dom", "@bettercms-ai/kit/*", "@bettercms-ai/dock-input"];
4759
+ var isDockUiImportAllowed = (specifier) => {
4760
+ if (specifier.startsWith("cms:")) return DOCK_UI_NAME.test(specifier.slice(4));
4761
+ if (specifier === "react" || specifier.startsWith("react/") || specifier === "react-dom" || specifier.startsWith("react-dom/")) return true;
4762
+ if (specifier === "@bettercms-ai/dock-input") return true;
4763
+ return specifier.startsWith("@bettercms-ai/kit/") && specifier.length > "@bettercms-ai/kit/".length;
4764
+ };
4765
+ var dockUiMerkleKey = (name, version) => `cms:${name}@${version}`;
4766
+
4723
4767
  // src/richtext-features.ts
4724
4768
  var RICHTEXT_MARK_FEATURES = ["bold", "italic", "underline", "strikethrough", "code", "highlight"];
4725
4769
  var RICHTEXT_TOGGLE_FEATURES = [
@@ -4802,6 +4846,25 @@ var richTextRefusal = (code, detail) => ({
4802
4846
  message: `richtext.${code}:${detail}`
4803
4847
  });
4804
4848
 
4849
+ // src/reference-create.ts
4850
+ var REFERENCE_CREATE_REFUSAL_CODES = [
4851
+ "no_title_field",
4852
+ "not_an_entry_model",
4853
+ "singleton",
4854
+ "model_not_found",
4855
+ "forbidden",
4856
+ "branch_readonly",
4857
+ "title_invalid",
4858
+ "locale_required",
4859
+ "slug_exhausted",
4860
+ "unique_conflict",
4861
+ "in_progress"
4862
+ ];
4863
+ var referenceCreateRefusal = (code, detail) => ({
4864
+ code: `reference_create.${code}`,
4865
+ reason: `reference_create.${code}:${detail}`
4866
+ });
4867
+
4805
4868
  // src/heading-id.ts
4806
4869
  var slugify = (s) => s.toLowerCase().normalize("NFKD").replace(/[\u0300-\u036f]/g, "").replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 60) || "section";
4807
4870
  export {
@@ -4819,6 +4882,8 @@ export {
4819
4882
  BUTTON_SIZES,
4820
4883
  BUTTON_VARIANTS,
4821
4884
  CANVAS_GESTURE_NAMES,
4885
+ CATEGORY_ID_MAX,
4886
+ CATEGORY_ORDER,
4822
4887
  CODE_SLOT_PREFIX,
4823
4888
  COMPONENT_PROP_TYPES,
4824
4889
  CONTROL_HELP,
@@ -4828,9 +4893,13 @@ export {
4828
4893
  DOCK_BUDGET,
4829
4894
  DOCK_ICON_NAMES,
4830
4895
  DOCK_ICON_NAME_SET,
4896
+ DOCK_UI_IMPORTS,
4897
+ DOCK_UI_LIMITS,
4898
+ DOCK_UI_NAME,
4831
4899
  FIELD_SIZE_ZOOM,
4832
4900
  FIELD_STYLE_KEYS,
4833
4901
  FOOTER_SECTION_ID,
4902
+ FRAME_REFUSALS,
4834
4903
  HELP_CAPS,
4835
4904
  HELP_MAX,
4836
4905
  IMAGE_ASPECTS,
@@ -4846,12 +4915,16 @@ export {
4846
4915
  LINK_RELS,
4847
4916
  LINK_VALUE_TYPES,
4848
4917
  LIST_ITEMS_CAP,
4918
+ LIST_PREVIEW_SLOTS,
4849
4919
  LOCATOR_PATH,
4850
4920
  MAIN_SELECTOR,
4851
4921
  NAVIGATION_SECTION_ID,
4922
+ OPEN_MODES,
4923
+ OPEN_MODE_TYPES,
4852
4924
  OPTION_DESCRIPTION_MAX,
4853
4925
  PAGE_CONTENT_ANCHOR_ID,
4854
4926
  PRIMITIVE_ARRAY_RULE,
4927
+ REFERENCE_CREATE_REFUSAL_CODES,
4855
4928
  RESPONSIVE_CSS,
4856
4929
  RICHTEXT_ADVANCED_ELEMENTS,
4857
4930
  RICHTEXT_BLOCK_ELEMENTS,
@@ -4870,6 +4943,7 @@ export {
4870
4943
  SECTION_SPACE_TOKENS,
4871
4944
  SEGMENTED_MAX,
4872
4945
  SEGMENTED_MIN,
4946
+ SHOW_IF_SCOPES,
4873
4947
  SIDE_SPACE_MIN_PX,
4874
4948
  SIDE_SPACE_TOKENS,
4875
4949
  SLOT_CHILD_KEYS,
@@ -4887,7 +4961,9 @@ export {
4887
4961
  TAB_MAX,
4888
4962
  TAB_MAX_RENDERABLE_NOW,
4889
4963
  TAG_HEADS,
4964
+ UI_PROTOCOLS,
4890
4965
  UI_REFUSAL_CODES,
4966
+ UI_REFUSAL_IDS,
4891
4967
  V2_KEYS,
4892
4968
  V2_PLACEMENTS,
4893
4969
  V2_SHAPES,
@@ -4916,6 +4992,7 @@ export {
4916
4992
  derivedPairs,
4917
4993
  dockBudget,
4918
4994
  dockScreens,
4995
+ dockUiMerkleKey,
4919
4996
  exampleFor,
4920
4997
  expandBlockBindings,
4921
4998
  fieldGroupOf,
@@ -4934,6 +5011,7 @@ export {
4934
5011
  isChromeLandmark,
4935
5012
  isCodeButton,
4936
5013
  isDeriveReservedKey,
5014
+ isDockUiImportAllowed,
4937
5015
  isLinkObject,
4938
5016
  isReservedKey,
4939
5017
  isRoleKey,
@@ -4963,6 +5041,7 @@ export {
4963
5041
  readButtonValue,
4964
5042
  readNumberFormat,
4965
5043
  readPath,
5044
+ referenceCreateRefusal,
4966
5045
  regionOf,
4967
5046
  renderTableHtml,
4968
5047
  richTextRefusal,