@cancia/toolbar 0.1.0 → 0.4.1

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/cancia.d.ts CHANGED
@@ -11,8 +11,12 @@ interface CanciaConfig {
11
11
  accentColor?: string;
12
12
  /** Skip session auth and always show the toolbar (demo/public mode) */
13
13
  public?: boolean;
14
- /** Whether a deploy hook is configured — controls publish button state */
15
- hasDeployHook?: boolean;
14
+ /**
15
+ * Whether a publish mechanism is configured (deploy hook OR dispatch repo) —
16
+ * controls the Publish button's enabled state. Defaults to enabled when the
17
+ * integration doesn't inject it (older setups).
18
+ */
19
+ canPublish?: boolean;
16
20
  }
17
21
  interface CMSEntry {
18
22
  /** Full flat key: page.section.field */
@@ -677,10 +677,10 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
677
677
  `;let o=!1,t=bi(`<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round">
678
678
  <path d="M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"/>
679
679
  <path d="M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z"/>
680
- </svg>`,"Edit",()=>u());i.appendChild(t);let r=z.config?.hasDeployHook??!0,a=bi(`<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round">
680
+ </svg>`,"Edit",()=>u());i.appendChild(t);let r=z.config?.canPublish??!0,a=bi(`<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round">
681
681
  <path d="M22 2L11 13"/>
682
682
  <path d="M22 2L15 22l-4-9-9-4 20-7z"/>
683
- </svg>`,r?"Publish":"Publish (no deploy hook configured)",()=>kh(a));r||(a.disabled=!0,a.style.opacity="0.3",a.style.cursor="not-allowed"),i.appendChild(a);let c=bi(`<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round">
683
+ </svg>`,r?"Publish":"Publish (no publish method configured)",()=>kh(a));r||(a.disabled=!0,a.style.opacity="0.3",a.style.cursor="not-allowed"),i.appendChild(a);let c=bi(`<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round">
684
684
  <path d="M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4"/>
685
685
  <path d="M16 17l5-5-5-5"/>
686
686
  <path d="M21 12H9"/>
package/dist/cancia.js CHANGED
@@ -2807,16 +2807,16 @@ function buildToolbar() {
2807
2807
  () => toggleEditMode()
2808
2808
  );
2809
2809
  controls.appendChild(editBtn);
2810
- const hasHook = state.config?.hasDeployHook ?? true;
2810
+ const canPublish = state.config?.canPublish ?? true;
2811
2811
  const publishBtn = makeIconButton(
2812
2812
  `<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round">
2813
2813
  <path d="M22 2L11 13"/>
2814
2814
  <path d="M22 2L15 22l-4-9-9-4 20-7z"/>
2815
2815
  </svg>`,
2816
- hasHook ? "Publish" : "Publish (no deploy hook configured)",
2816
+ canPublish ? "Publish" : "Publish (no publish method configured)",
2817
2817
  () => handlePublish(publishBtn)
2818
2818
  );
2819
- if (!hasHook) {
2819
+ if (!canPublish) {
2820
2820
  publishBtn.disabled = true;
2821
2821
  publishBtn.style.opacity = "0.3";
2822
2822
  publishBtn.style.cursor = "not-allowed";