@tecof/theme-editor 0.0.9 → 0.0.12

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.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  import * as React__default from 'react';
2
2
  import React__default__default, { createContext, memo, forwardRef, createElement, useRef, useContext, useState, useCallback, useEffect, useMemo, useLayoutEffect } from 'react';
3
3
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
4
- import { fieldsPlugin, Puck, Render } from '@puckeditor/core';
4
+ import { fieldsPlugin, Puck, Render, FieldLabel } from '@puckeditor/core';
5
5
  import { useEditor, EditorContent } from '@tiptap/react';
6
6
  import Document from '@tiptap/extension-document';
7
7
  import Paragraph from '@tiptap/extension-paragraph';
@@ -26,9 +26,10 @@ import ReactDOM__default from 'react-dom';
26
26
 
27
27
  // src/api.ts
28
28
  var TecofApiClient = class {
29
- constructor(apiUrl, secretKey) {
29
+ constructor(apiUrl, secretKey, customCdnUrl) {
30
30
  this.apiUrl = apiUrl.replace(/\/+$/, "");
31
31
  this.secretKey = secretKey;
32
+ this.customCdnUrl = customCdnUrl ? customCdnUrl.replace(/\/+$/, "") : void 0;
32
33
  }
33
34
  get headers() {
34
35
  return {
@@ -189,20 +190,21 @@ var TecofApiClient = class {
189
190
  };
190
191
  }
191
192
  }
192
- /** CDN base URL (derived from apiUrl) */
193
+ /** CDN base URL (defaults to apiUrl if not set) */
193
194
  get cdnUrl() {
194
- return this.apiUrl;
195
+ return this.customCdnUrl || this.apiUrl;
195
196
  }
196
197
  };
197
198
  var TecofContext = createContext(null);
198
- var TecofProvider = ({ apiUrl, secretKey, children }) => {
199
+ var TecofProvider = ({ apiUrl, secretKey, cdnUrl, children }) => {
199
200
  const value = useMemo(
200
201
  () => ({
201
- apiClient: new TecofApiClient(apiUrl, secretKey),
202
+ apiClient: new TecofApiClient(apiUrl, secretKey, cdnUrl),
202
203
  secretKey,
203
- apiUrl
204
+ apiUrl,
205
+ cdnUrl
204
206
  }),
205
- [apiUrl, secretKey]
207
+ [apiUrl, secretKey, cdnUrl]
206
208
  );
207
209
  return /* @__PURE__ */ jsx(TecofContext.Provider, { value, children });
208
210
  };
@@ -1007,7 +1009,7 @@ var createLanguageField = (options = {}) => {
1007
1009
  label,
1008
1010
  labelIcon,
1009
1011
  visible,
1010
- render: ({ value, onChange, readOnly, field, name: name3, id }) => /* @__PURE__ */ jsx(
1012
+ render: ({ value, onChange, readOnly, field, name: name3, id }) => /* @__PURE__ */ jsx(FieldLabel, { label: label || "", icon: labelIcon, readOnly, children: /* @__PURE__ */ jsx(
1011
1013
  LanguageField,
1012
1014
  {
1013
1015
  field,
@@ -1018,7 +1020,7 @@ var createLanguageField = (options = {}) => {
1018
1020
  readOnly,
1019
1021
  ...fieldOptions
1020
1022
  }
1021
- )
1023
+ ) })
1022
1024
  };
1023
1025
  };
1024
1026
  var createExtensions = () => [
@@ -1297,7 +1299,7 @@ var createEditorField = (options = {}) => {
1297
1299
  label,
1298
1300
  labelIcon,
1299
1301
  visible,
1300
- render: ({ value, onChange, readOnly, field, name: name3, id }) => /* @__PURE__ */ jsx(
1302
+ render: ({ value, onChange, readOnly, field, name: name3, id }) => /* @__PURE__ */ jsx(FieldLabel, { label: label || "", icon: labelIcon, readOnly, children: /* @__PURE__ */ jsx(
1301
1303
  EditorField,
1302
1304
  {
1303
1305
  field,
@@ -1308,7 +1310,7 @@ var createEditorField = (options = {}) => {
1308
1310
  readOnly,
1309
1311
  ...fieldOptions
1310
1312
  }
1311
- )
1313
+ ) })
1312
1314
  };
1313
1315
  };
1314
1316
 
@@ -20772,6 +20774,8 @@ var Root = Dialog;
20772
20774
  var Portal2 = DialogPortal;
20773
20775
  var Overlay = DialogOverlay;
20774
20776
  var Content = DialogContent;
20777
+ var Title = DialogTitle;
20778
+ var Description = DialogDescription;
20775
20779
  function __insertCSS(code) {
20776
20780
  if (typeof document == "undefined") return;
20777
20781
  let head = document.head || document.getElementsByTagName("head")[0];
@@ -22233,7 +22237,10 @@ var Drawer = {
22233
22237
  Root: Root2,
22234
22238
  Content: Content2,
22235
22239
  Overlay: Overlay2,
22236
- Portal: Portal3};
22240
+ Portal: Portal3,
22241
+ Title,
22242
+ Description
22243
+ };
22237
22244
  registerPlugin(
22238
22245
  filepond_plugin_file_validate_size_esm_default,
22239
22246
  filepond_plugin_file_validate_type_esm_default,
@@ -22676,6 +22683,8 @@ var UploadField = ({
22676
22683
  }, children: /* @__PURE__ */ jsxs(Drawer.Portal, { children: [
22677
22684
  /* @__PURE__ */ jsx(Drawer.Overlay, { className: "tecof-upload-drawer-overlay" }),
22678
22685
  /* @__PURE__ */ jsxs(Drawer.Content, { className: "tecof-upload-drawer-content", children: [
22686
+ /* @__PURE__ */ jsx(Drawer.Title, { className: "tecof-sr-only", children: "Medya Y\xF6neticisi" }),
22687
+ /* @__PURE__ */ jsx(Drawer.Description, { className: "tecof-sr-only", children: "Sunucudaki dosyalardan birini se\xE7in veya yeni dosya y\xFCkleyin" }),
22679
22688
  /* @__PURE__ */ jsx("div", { className: "tecof-upload-drawer-handle" }),
22680
22689
  /* @__PURE__ */ jsxs("div", { className: "tecof-upload-drawer-inner", children: [
22681
22690
  /* @__PURE__ */ jsxs("div", { className: "tecof-upload-drawer-header", children: [
@@ -22769,7 +22778,7 @@ var createUploadField = (options = {}) => {
22769
22778
  label,
22770
22779
  labelIcon,
22771
22780
  visible,
22772
- render: ({ value, onChange, readOnly, field, name: name3, id }) => /* @__PURE__ */ jsx(
22781
+ render: ({ value, onChange, readOnly, field, name: name3, id }) => /* @__PURE__ */ jsx(FieldLabel, { label: label || "", icon: labelIcon, readOnly, children: /* @__PURE__ */ jsx(
22773
22782
  UploadField,
22774
22783
  {
22775
22784
  field,
@@ -22780,7 +22789,7 @@ var createUploadField = (options = {}) => {
22780
22789
  readOnly,
22781
22790
  ...fieldOptions
22782
22791
  }
22783
- )
22792
+ ) })
22784
22793
  };
22785
22794
  };
22786
22795
 
@@ -23458,7 +23467,7 @@ var createCodeEditorField = (options = {}) => {
23458
23467
  label,
23459
23468
  labelIcon,
23460
23469
  visible,
23461
- render: ({ value, onChange, readOnly, field, name: name3, id }) => /* @__PURE__ */ jsx(
23470
+ render: ({ value, onChange, readOnly, field, name: name3, id }) => /* @__PURE__ */ jsx(FieldLabel, { label: label || "", icon: labelIcon, readOnly, children: /* @__PURE__ */ jsx(
23462
23471
  CodeEditorField,
23463
23472
  {
23464
23473
  field,
@@ -23469,7 +23478,7 @@ var createCodeEditorField = (options = {}) => {
23469
23478
  readOnly,
23470
23479
  ...fieldOptions
23471
23480
  }
23472
- )
23481
+ ) })
23473
23482
  };
23474
23483
  };
23475
23484
  var LinkField = ({
@@ -23608,6 +23617,8 @@ var LinkField = ({
23608
23617
  /* @__PURE__ */ jsx(Drawer.Root, { open: drawerOpen, onOpenChange: setDrawerOpen, children: /* @__PURE__ */ jsxs(Drawer.Portal, { children: [
23609
23618
  /* @__PURE__ */ jsx(Drawer.Overlay, { className: "tecof-link-drawer-overlay" }),
23610
23619
  /* @__PURE__ */ jsxs(Drawer.Content, { className: "tecof-link-drawer-content", children: [
23620
+ /* @__PURE__ */ jsx(Drawer.Title, { className: "tecof-sr-only", children: "Ba\u011Flant\u0131 Sayfas\u0131 Se\xE7ici" }),
23621
+ /* @__PURE__ */ jsx(Drawer.Description, { className: "tecof-sr-only", children: "Sayfa listesinden se\xE7im yap\u0131n veya arama yap\u0131n" }),
23611
23622
  /* @__PURE__ */ jsxs("div", { className: "tecof-link-drawer-header", children: [
23612
23623
  /* @__PURE__ */ jsx("h2", { className: "tecof-link-drawer-title", children: "Sayfa Se\xE7" }),
23613
23624
  /* @__PURE__ */ jsx("button", { className: "tecof-link-drawer-close-btn", onClick: () => setDrawerOpen(false), children: /* @__PURE__ */ jsx(X, { size: 16 }) })
@@ -23659,18 +23670,18 @@ var createLinkField = (options = {}) => {
23659
23670
  label,
23660
23671
  labelIcon,
23661
23672
  visible,
23662
- render: ({ value, onChange, readOnly, field, name: name3, id }) => /* @__PURE__ */ jsx(
23673
+ render: ({ value, onChange, readOnly, field, name: name3, id }) => /* @__PURE__ */ jsx(FieldLabel, { label: label || "", icon: labelIcon, readOnly, children: /* @__PURE__ */ jsx(
23663
23674
  LinkField,
23664
23675
  {
23665
23676
  field,
23666
23677
  name: name3,
23667
23678
  id,
23668
- value: value || null,
23679
+ value: value || { url: "" },
23669
23680
  onChange,
23670
23681
  readOnly,
23671
23682
  ...fieldOptions
23672
23683
  }
23673
- )
23684
+ ) })
23674
23685
  };
23675
23686
  };
23676
23687
  var PRESET_COLORS = [
@@ -23934,7 +23945,7 @@ var createColorField = (options = {}) => {
23934
23945
  label,
23935
23946
  labelIcon,
23936
23947
  visible,
23937
- render: ({ value, onChange, readOnly, field, name: name3, id }) => /* @__PURE__ */ jsx(
23948
+ render: ({ value, onChange, readOnly, field, name: name3, id }) => /* @__PURE__ */ jsx(FieldLabel, { label: label || "", icon: labelIcon, readOnly, children: /* @__PURE__ */ jsx(
23938
23949
  ColorField,
23939
23950
  {
23940
23951
  field,
@@ -23945,7 +23956,7 @@ var createColorField = (options = {}) => {
23945
23956
  readOnly,
23946
23957
  ...fieldOptions
23947
23958
  }
23948
- )
23959
+ ) })
23949
23960
  };
23950
23961
  };
23951
23962