@flexkit/studio 0.0.27 → 0.0.28
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/chunk-CPUC4QXH.js +2 -0
- package/dist/chunk-CPUC4QXH.js.map +1 -0
- package/dist/chunk-EOCJR5EY.js +2 -0
- package/dist/chunk-EOCJR5EY.js.map +1 -0
- package/dist/{chunk-ZSSNAIMU.js → chunk-M5AH5ERI.js} +2 -2
- package/dist/{chunk-ZSSNAIMU.js.map → chunk-M5AH5ERI.js.map} +1 -1
- package/dist/chunk-R7N3MDOP.js +2 -0
- package/dist/chunk-R7N3MDOP.js.map +1 -0
- package/dist/chunk-V6R4AWQS.js +2 -0
- package/dist/chunk-V6R4AWQS.js.map +1 -0
- package/dist/chunk-W3TUEJJL.js +2 -0
- package/dist/chunk-W3TUEJJL.js.map +1 -0
- package/dist/{chunk-2PEDKE5Z.js → chunk-WZ533Y4O.js} +2 -2
- package/dist/{chunk-2PEDKE5Z.js.map → chunk-WZ533Y4O.js.map} +1 -1
- package/dist/chunk-ZEZ6TRCO.js +2 -0
- package/dist/chunk-ZEZ6TRCO.js.map +1 -0
- package/dist/datetime-NQTYGZIC.js +2 -0
- package/dist/{datetime-TWONUNXS.js.map → datetime-NQTYGZIC.js.map} +1 -1
- package/dist/editor-YIRZQR3D.js +2 -0
- package/dist/{editor-NFRMIYVJ.js.map → editor-YIRZQR3D.js.map} +1 -1
- package/dist/index.css +105 -3
- package/dist/index.d.ts +39 -8
- package/dist/index.js +176 -166
- package/dist/index.js.map +1 -1
- package/dist/{search-6ASIDGYA.js → search-YRDOJUQO.js} +2 -2
- package/dist/{search-6ASIDGYA.js.map → search-YRDOJUQO.js.map} +1 -1
- package/dist/select-A6I27JQU.js +2 -0
- package/dist/select-A6I27JQU.js.map +1 -0
- package/dist/text-6F4QTCNT.js +2 -0
- package/dist/{text-FIBUDNGR.js.map → text-6F4QTCNT.js.map} +1 -1
- package/dist/{types.d-DiA0h3ut.d.ts → types.d-DiQPwK_q.d.ts} +4 -4
- package/dist/ui.d.ts +1 -1
- package/dist/{user-nav-O5G4M2VA.js → user-nav-QYO4X7CQ.js} +2 -2
- package/dist/{user-nav-O5G4M2VA.js.map → user-nav-QYO4X7CQ.js.map} +1 -1
- package/package.json +3 -3
- package/dist/chunk-4KGH7PU7.js +0 -2
- package/dist/chunk-4KGH7PU7.js.map +0 -1
- package/dist/chunk-553TQFSU.js +0 -2
- package/dist/chunk-553TQFSU.js.map +0 -1
- package/dist/chunk-7NQ6QCJD.js +0 -2
- package/dist/chunk-7NQ6QCJD.js.map +0 -1
- package/dist/chunk-UUGIVWK4.js +0 -2
- package/dist/chunk-UUGIVWK4.js.map +0 -1
- package/dist/datetime-TWONUNXS.js +0 -2
- package/dist/editor-NFRMIYVJ.js +0 -2
- package/dist/text-FIBUDNGR.js +0 -2
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import'./index.css';import {a}from'./chunk-ZEZ6TRCO.js';import {jsx}from'react/jsx-runtime';function i({value:n}){let t=typeof n=="object"||Array.isArray(n)?JSON.stringify(n):n;return t=t==="null"||t==null?"":String(t),jsx(a,{value:t})}export{i as a};//# sourceMappingURL=chunk-CPUC4QXH.js.map
|
|
2
|
+
//# sourceMappingURL=chunk-CPUC4QXH.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/data-grid/preview-components/text.tsx"],"names":["Text","value","displayValue","jsx","CopyableTruncatedText"],"mappings":"4FAEO,SAASA,CAAAA,CAAK,CAAE,MAAAC,CAAM,CAAA,CAA2C,CACtE,IAAIC,EAAe,OAAOD,CAAAA,EAAU,UAAY,KAAA,CAAM,OAAA,CAAQA,CAAK,CAAA,CAAI,IAAA,CAAK,SAAA,CAAUA,CAAK,EAAIA,CAAAA,CAC/F,OAAAC,CAAAA,CAAeA,CAAAA,GAAiB,QAAUA,CAAAA,EAAgB,IAAA,CAAO,EAAA,CAAK,MAAA,CAAOA,CAAY,CAAA,CAElFC,GAAAA,CAACC,EAAA,CAAsB,KAAA,CAAOF,EAAc,CACrD","file":"chunk-CPUC4QXH.js","sourcesContent":["import { CopyableTruncatedText } from './copyable-truncated-text';\n\nexport function Text({ value }: { value: string | object | unknown[] }) {\n let displayValue = typeof value === 'object' || Array.isArray(value) ? JSON.stringify(value) : value;\n displayValue = displayValue === 'null' || displayValue == null ? '' : String(displayValue);\n\n return <CopyableTruncatedText value={displayValue} />;\n}\n"]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import'./index.css';import {a}from'./chunk-ZEZ6TRCO.js';import {generateText}from'@tiptap/core';import {TiptapLink,TiptapImage,UploadImagesPlugin,TaskList,TaskItem,HorizontalRule,StarterKit,CodeBlockLowlight,Youtube,Twitter,Mathematics,CharacterCount,Placeholder,AIHighlight,TiptapUnderline,HighlightExtension,TextStyle,Color,CustomKeymap,GlobalDragHandle}from'novel';import {Markdown}from'tiptap-markdown';import {cx}from'class-variance-authority';import {createLowlight,common}from'lowlight';import {jsx}from'react/jsx-runtime';var I=AIHighlight,B=Placeholder,P=TiptapLink.configure({HTMLAttributes:{class:cx("fk:text-muted-foreground fk:underline fk:underline-offset-[3px] fk:hover:text-primary fk:transition-colors fk:cursor-pointer")}}),v=Markdown.configure({html:true,tightLists:true,tightListClass:"tight",bulletListMarker:"-",linkify:false,breaks:false,transformPastedText:false,transformCopiedText:false}),z=TiptapImage.extend({addProseMirrorPlugins(){return [UploadImagesPlugin({imageClass:cx("fk:opacity-40 fk:rounded-lg fk:border fk:border-stone-200")})]}}).configure({allowBase64:true,HTMLAttributes:{class:cx("fk:rounded-lg fk:border fk:border-muted")}}),K=TaskList.configure({HTMLAttributes:{class:cx("fk:not-prose fk:pl-2 ")}}),O=TaskItem.configure({HTMLAttributes:{class:cx("fk:flex gap-2 fk:items-start fk:my-2")},nested:true}),R=HorizontalRule.configure({HTMLAttributes:{class:cx("mt-4 mb-6 border-t border-muted-foreground")}}),S=StarterKit.configure({bulletList:{HTMLAttributes:{class:cx("fk:list-disc fk:list-outside fk:leading-3 fk:-mt-2")}},orderedList:{HTMLAttributes:{class:cx("fk:list-decimal fk:list-outside fk:leading-3 fk:-mt-2")}},listItem:{HTMLAttributes:{class:cx("fk:leading-normal fk:-mb-2")}},blockquote:{HTMLAttributes:{class:cx("fk:border-l-4 fk:border-primary")}},codeBlock:false,code:{HTMLAttributes:{class:cx("fk:rounded-md fk:bg-muted fk:px-1.5 fk:py-1 fk:font-mono fk:font-medium"),spellcheck:"false"}},horizontalRule:false,dropcursor:{color:"#DBEAFE",width:4},gapcursor:false}),D=CodeBlockLowlight.configure({lowlight:createLowlight(common)}),G=Youtube.configure({HTMLAttributes:{class:cx("fk:rounded-lg fk:border fk:border-muted")},inline:false}),N=Twitter.configure({HTMLAttributes:{class:cx("fk:not-prose")},inline:false}),U=Mathematics.configure({HTMLAttributes:{class:cx("fk:text-foreground fk:rounded-sm fk:p-1 fk:hover:bg-muted fk:cursor-pointer")},katexOptions:{throwOnError:false}}),q=CharacterCount.configure(),s=[S,B,P,z,K,O,R,I,D,G,N,U,q,TiptapUnderline,v,HighlightExtension,TextStyle,Color,CustomKeymap,GlobalDragHandle];var i=100;function j({value:r}){let e;try{e=generateText(JSON.parse(r),s).substring(0,i);}catch{e=r?.substring(0,i)??"";}return jsx(a,{value:e})}export{s as a,j as b};//# sourceMappingURL=chunk-EOCJR5EY.js.map
|
|
2
|
+
//# sourceMappingURL=chunk-EOCJR5EY.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/form/fields/editor/extensions.ts","../src/data-grid/preview-components/editor.tsx"],"names":["aiHighlight","AIHighlight","placeholder","Placeholder","tiptapLink","TiptapLink","cx","markdownExtension","Markdown","tiptapImage","TiptapImage","UploadImagesPlugin","taskList","TaskList","taskItem","TaskItem","horizontalRule","HorizontalRule","starterKit","StarterKit","codeBlockLowlight","CodeBlockLowlight","createLowlight","common","youtube","Youtube","twitter","Twitter","mathematics","Mathematics","characterCount","CharacterCount","defaultExtensions","TiptapUnderline","HighlightExtension","TextStyle","Color","CustomKeymap","GlobalDragHandle","MAX_LENGTH","Editor","value","textValue","generateText","jsx","CopyableTruncatedText"],"mappings":"shBA2BMA,CAAAA,CAAcC,WAAAA,CAEdC,EAAcC,WAAAA,CACdC,CAAAA,CAAaC,WAAW,SAAA,CAAU,CACtC,eAAgB,CACd,KAAA,CAASC,GACP,8HACF,CACF,CACF,CAAC,CAAA,CAEKC,EAAoBC,QAAAA,CAAS,SAAA,CAAU,CAC3C,IAAA,CAAM,IAAA,CACN,WAAY,IAAA,CACZ,cAAA,CAAgB,QAChB,gBAAA,CAAkB,GAAA,CAClB,QAAS,KAAA,CACT,MAAA,CAAQ,KAAA,CACR,mBAAA,CAAqB,MACrB,mBAAA,CAAqB,KACvB,CAAC,CAAA,CAEKC,CAAAA,CAAcC,YAAY,MAAA,CAAO,CACrC,uBAAwB,CACtB,OAAO,CACLC,kBAAAA,CAAmB,CACjB,WAAYL,EAAAA,CAAG,2DAA2D,CAC5E,CAAC,CACH,CACF,CACF,CAAC,EAAE,SAAA,CAAU,CACX,YAAa,IAAA,CACb,cAAA,CAAgB,CACd,KAAA,CAAOA,EAAAA,CAAG,yCAAyC,CACrD,CACF,CAAC,CAAA,CAEKM,CAAAA,CAAWC,SAAS,SAAA,CAAU,CAClC,eAAgB,CACd,KAAA,CAAOP,GAAG,uBAAuB,CACnC,CACF,CAAC,CAAA,CACKQ,EAAWC,QAAAA,CAAS,SAAA,CAAU,CAClC,cAAA,CAAgB,CACd,MAAST,EAAAA,CAAG,sCAAsC,CACpD,CAAA,CACA,MAAA,CAAQ,IACV,CAAC,CAAA,CAEKU,EAAiBC,cAAAA,CAAe,SAAA,CAAU,CAC9C,cAAA,CAAgB,CACd,MAASX,EAAAA,CAAG,4CAA4C,CAC1D,CACF,CAAC,EAEKY,CAAAA,CAAaC,UAAAA,CAAW,UAAU,CACtC,UAAA,CAAY,CACV,cAAA,CAAgB,CACd,MAAS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AA,CACAE,CAAAA,CACAE,EACAE,CAAAA,CACAG,eAAAA,CACA1B,EACA2B,kBAAAA,CACAC,SAAAA,CACAC,MACAC,YAAAA,CACAC,gBACF,ECrKA,IAAMC,CAAAA,CAAa,IAKZ,SAASC,CAAAA,CAAO,CAAE,KAAA,CAAAC,CAAM,EAAsB,CACnD,IAAIC,EAEJ,GAAI,CACFA,EAAYC,YAAAA,CAAa,IAAA,CAAK,MAAMF,CAAK,CAAA,CAAGT,CAA+B,CAAA,CAAE,SAAA,CAAU,EAAGO,CAAU,EACtG,MAAQ,CACNG,CAAAA,CAAYD,GAAO,SAAA,CAAU,CAAA,CAAGF,CAAU,CAAA,EAAK,GACjD,CAEA,OAAOK,GAAAA,CAACC,EAAA,CAAsB,KAAA,CAAOH,EAAW,CAClD","file":"chunk-EOCJR5EY.js","sourcesContent":["import {\n AIHighlight,\n CharacterCount,\n CodeBlockLowlight,\n Color,\n CustomKeymap,\n GlobalDragHandle,\n HighlightExtension,\n HorizontalRule,\n Placeholder,\n StarterKit,\n TaskItem,\n TaskList,\n TextStyle,\n TiptapImage,\n TiptapLink,\n TiptapUnderline,\n Twitter,\n Youtube,\n Mathematics,\n UploadImagesPlugin,\n} from 'novel';\nimport { Markdown } from 'tiptap-markdown';\nimport { cx } from 'class-variance-authority';\nimport { common, createLowlight } from 'lowlight';\n\n//TODO I am using cx here to get tailwind autocomplete working, idk if someone else can write a regex to just capture the class key in objects\nconst aiHighlight = AIHighlight;\n//You can overwrite the placeholder with your own configuration\nconst placeholder = Placeholder;\nconst tiptapLink = TiptapLink.configure({\n HTMLAttributes: {\n 'class': cx(\n 'fk:text-muted-foreground fk:underline fk:underline-offset-[3px] fk:hover:text-primary fk:transition-colors fk:cursor-pointer'\n ),\n },\n});\n\nconst markdownExtension = Markdown.configure({\n html: true,\n tightLists: true,\n tightListClass: 'tight',\n bulletListMarker: '-',\n linkify: false,\n breaks: false,\n transformPastedText: false,\n transformCopiedText: false,\n});\n\nconst tiptapImage = TiptapImage.extend({\n addProseMirrorPlugins() {\n return [\n UploadImagesPlugin({\n imageClass: cx('fk:opacity-40 fk:rounded-lg fk:border fk:border-stone-200'),\n }),\n ];\n },\n}).configure({\n allowBase64: true,\n HTMLAttributes: {\n class: cx('fk:rounded-lg fk:border fk:border-muted'),\n },\n});\n\nconst taskList = TaskList.configure({\n HTMLAttributes: {\n class: cx('fk:not-prose fk:pl-2 '),\n },\n});\nconst taskItem = TaskItem.configure({\n HTMLAttributes: {\n 'class': cx('fk:flex gap-2 fk:items-start fk:my-2'),\n },\n nested: true,\n});\n\nconst horizontalRule = HorizontalRule.configure({\n HTMLAttributes: {\n 'class': cx('mt-4 mb-6 border-t border-muted-foreground'),\n },\n});\n\nconst starterKit = StarterKit.configure({\n bulletList: {\n HTMLAttributes: {\n 'class': cx('fk:list-disc fk:list-outside fk:leading-3 fk:-mt-2'),\n },\n },\n orderedList: {\n HTMLAttributes: {\n 'class': cx('fk:list-decimal fk:list-outside fk:leading-3 fk:-mt-2'),\n },\n },\n listItem: {\n HTMLAttributes: {\n 'class': cx('fk:leading-normal fk:-mb-2'),\n },\n },\n blockquote: {\n HTMLAttributes: {\n 'class': cx('fk:border-l-4 fk:border-primary'),\n },\n },\n codeBlock: false,\n code: {\n HTMLAttributes: {\n 'class': cx('fk:rounded-md fk:bg-muted fk:px-1.5 fk:py-1 fk:font-mono fk:font-medium'),\n spellcheck: 'false',\n },\n },\n horizontalRule: false,\n dropcursor: {\n color: '#DBEAFE',\n width: 4,\n },\n gapcursor: false,\n});\n\nconst codeBlockLowlight = CodeBlockLowlight.configure({\n // configure lowlight: common / all / use highlightJS in case there is a need to specify certain language grammars only\n // common: covers 37 language grammars which should be good enough in most cases\n lowlight: createLowlight(common),\n});\n\nconst youtube = Youtube.configure({\n HTMLAttributes: {\n 'class': cx('fk:rounded-lg fk:border fk:border-muted'),\n },\n inline: false,\n});\n\nconst twitter = Twitter.configure({\n HTMLAttributes: {\n 'class': cx('fk:not-prose'),\n },\n inline: false,\n});\n\nconst mathematics = Mathematics.configure({\n HTMLAttributes: {\n 'class': cx('fk:text-foreground fk:rounded-sm fk:p-1 fk:hover:bg-muted fk:cursor-pointer'),\n },\n katexOptions: {\n throwOnError: false,\n },\n});\n\nconst characterCount = CharacterCount.configure();\n\nexport const defaultExtensions: readonly unknown[] = [\n starterKit,\n placeholder,\n tiptapLink,\n tiptapImage,\n taskList,\n taskItem,\n horizontalRule,\n aiHighlight,\n codeBlockLowlight,\n youtube,\n twitter,\n mathematics,\n characterCount,\n TiptapUnderline,\n markdownExtension,\n HighlightExtension,\n TextStyle,\n Color,\n CustomKeymap,\n GlobalDragHandle,\n];\n","import { generateText } from '@tiptap/core';\nimport { defaultExtensions } from '../../form/fields/editor/extensions';\nimport { Extensions } from '@tiptap/core';\nimport { CopyableTruncatedText } from './copyable-truncated-text';\n\nconst MAX_LENGTH = 100;\n\n/**\n * Renders a preview of the editor content.\n */\nexport function Editor({ value }: { value: string }) {\n let textValue;\n\n try {\n textValue = generateText(JSON.parse(value), defaultExtensions as Extensions).substring(0, MAX_LENGTH);\n } catch {\n textValue = value?.substring(0, MAX_LENGTH) ?? '';\n }\n\n return <CopyableTruncatedText value={textValue} />;\n}\n"]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import'./index.css';import {d}from'./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import'./index.css';import {d}from'./chunk-V6R4AWQS.js';import {c}from'./chunk-WDRCARCP.js';import {createContext,useContext}from'react';import l from'swr';import {useParams}from'react-router-dom';import {jsx}from'react/jsx-runtime';function s(){let{projectId:e}=useParams(),{projects:t}=d(),o=t.find(r=>r.projectId===e)??t[0],{data:c$1,isLoading:a}=l(c(e??"").currentUser,r=>fetch(r,{mode:"cors",credentials:"include"}).then(d=>d.json()));return [a,{user:c$1,logout:async()=>{await fetch(c(e??"").logout(o?.basePath??"/"),{method:"POST",mode:"cors",credentials:"include"}),await fetch("/api/flexkit/logout",{method:"GET",credentials:"include"}),window.location.reload();}}]}var u=createContext([true,{user:null,logout:()=>Promise.resolve()}]);function L({children:e}){let[t,o]=s();return jsx(u.Provider,{value:[t,o],children:e})}function j(){return useContext(u)}export{L as a,j as b};//# sourceMappingURL=chunk-M5AH5ERI.js.map
|
|
2
|
+
//# sourceMappingURL=chunk-M5AH5ERI.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/auth/use-auth-service.ts","../src/auth/auth-context.tsx"],"names":["useAuthService","projectId","useParams","projects","useConfig","currentProject","project","user","isLoadingUser","useSWR","apiPaths","url","res","AuthContext","createContext","AuthProvider","children","isLoading","auth","jsx","useAuth","useContext"],"mappings":"yOAQe,SAARA,GAA+C,CACpD,GAAM,CAAE,SAAA,CAAAC,CAAU,CAAA,CAAIC,SAAAA,GAChB,CAAE,QAAA,CAAAC,CAAS,CAAA,CAAIC,CAAAA,GACfC,CAAAA,CAAiBF,CAAAA,CAAS,IAAA,CAAMG,CAAAA,EAAYA,EAAQ,SAAA,GAAcL,CAAS,GAAKE,CAAAA,CAAS,CAAC,EAC1F,CAAE,IAAA,CAAMI,GAAAA,CAAM,SAAA,CAAWC,CAAc,CAAA,CAAIC,CAAAA,CAAOC,CAAAA,CAAST,CAAAA,EAAa,EAAE,CAAA,CAAE,WAAA,CAAcU,CAAAA,EAC9F,KAAA,CAAMA,EAAK,CAAE,IAAA,CAAM,OAAQ,WAAA,CAAa,SAAU,CAAC,CAAA,CAAE,IAAA,CAAMC,CAAAA,EAAQA,CAAAA,CAAI,MAAuB,CAChG,EAGA,OAAO,CAFWJ,EAIhB,CACE,IAAA,CAAAD,GAAAA,CACA,MAAA,CAAQ,SAAY,CAElB,MAAM,MAAMG,CAAAA,CAAST,CAAAA,EAAa,EAAE,CAAA,CAAE,MAAA,CAAOI,CAAAA,EAAgB,QAAA,EAAY,GAAG,CAAA,CAAG,CAC7E,MAAA,CAAQ,MAAA,CACR,KAAM,MAAA,CACN,WAAA,CAAa,SACf,CAAC,EAGD,MAAM,KAAA,CAAM,sBAAuB,CAAE,MAAA,CAAQ,MAAO,WAAA,CAAa,SAAU,CAAC,CAAA,CAE5E,OAAO,QAAA,CAAS,MAAA,GAClB,CACF,CACF,CACF,CC9BA,IAAMQ,CAAAA,CAAcC,aAAAA,CAAc,CAChC,IAAA,CACA,CACE,KAAM,IAAA,CACN,MAAA,CAAQ,IAAM,OAAA,CAAQ,SACxB,CACF,CAAC,CAAA,CAEM,SAASC,CAAAA,CAAa,CAAE,QAAA,CAAAC,CAAS,EAA+C,CACrF,GAAM,CAACC,CAAAA,CAAWC,CAAI,EAAIlB,CAAAA,EAAe,CAEzC,OAAOmB,GAAAA,CAACN,EAAY,QAAA,CAAZ,CAAqB,MAAO,CAACI,CAAAA,CAAWC,CAAI,CAAA,CAAI,QAAA,CAAAF,CAAAA,CAAS,CACnE,CAEO,SAASI,CAAAA,EAAuB,CACrC,OAAOC,UAAAA,CAAWR,CAAW,CAC/B","file":"chunk-
|
|
1
|
+
{"version":3,"sources":["../src/auth/use-auth-service.ts","../src/auth/auth-context.tsx"],"names":["useAuthService","projectId","useParams","projects","useConfig","currentProject","project","user","isLoadingUser","useSWR","apiPaths","url","res","AuthContext","createContext","AuthProvider","children","isLoading","auth","jsx","useAuth","useContext"],"mappings":"yOAQe,SAARA,GAA+C,CACpD,GAAM,CAAE,SAAA,CAAAC,CAAU,CAAA,CAAIC,SAAAA,GAChB,CAAE,QAAA,CAAAC,CAAS,CAAA,CAAIC,CAAAA,GACfC,CAAAA,CAAiBF,CAAAA,CAAS,IAAA,CAAMG,CAAAA,EAAYA,EAAQ,SAAA,GAAcL,CAAS,GAAKE,CAAAA,CAAS,CAAC,EAC1F,CAAE,IAAA,CAAMI,GAAAA,CAAM,SAAA,CAAWC,CAAc,CAAA,CAAIC,CAAAA,CAAOC,CAAAA,CAAST,CAAAA,EAAa,EAAE,CAAA,CAAE,WAAA,CAAcU,CAAAA,EAC9F,KAAA,CAAMA,EAAK,CAAE,IAAA,CAAM,OAAQ,WAAA,CAAa,SAAU,CAAC,CAAA,CAAE,IAAA,CAAMC,CAAAA,EAAQA,CAAAA,CAAI,MAAuB,CAChG,EAGA,OAAO,CAFWJ,EAIhB,CACE,IAAA,CAAAD,GAAAA,CACA,MAAA,CAAQ,SAAY,CAElB,MAAM,MAAMG,CAAAA,CAAST,CAAAA,EAAa,EAAE,CAAA,CAAE,MAAA,CAAOI,CAAAA,EAAgB,QAAA,EAAY,GAAG,CAAA,CAAG,CAC7E,MAAA,CAAQ,MAAA,CACR,KAAM,MAAA,CACN,WAAA,CAAa,SACf,CAAC,EAGD,MAAM,KAAA,CAAM,sBAAuB,CAAE,MAAA,CAAQ,MAAO,WAAA,CAAa,SAAU,CAAC,CAAA,CAE5E,OAAO,QAAA,CAAS,MAAA,GAClB,CACF,CACF,CACF,CC9BA,IAAMQ,CAAAA,CAAcC,aAAAA,CAAc,CAChC,IAAA,CACA,CACE,KAAM,IAAA,CACN,MAAA,CAAQ,IAAM,OAAA,CAAQ,SACxB,CACF,CAAC,CAAA,CAEM,SAASC,CAAAA,CAAa,CAAE,QAAA,CAAAC,CAAS,EAA+C,CACrF,GAAM,CAACC,CAAAA,CAAWC,CAAI,EAAIlB,CAAAA,EAAe,CAEzC,OAAOmB,GAAAA,CAACN,EAAY,QAAA,CAAZ,CAAqB,MAAO,CAACI,CAAAA,CAAWC,CAAI,CAAA,CAAI,QAAA,CAAAF,CAAAA,CAAS,CACnE,CAEO,SAASI,CAAAA,EAAuB,CACrC,OAAOC,UAAAA,CAAWR,CAAW,CAC/B","file":"chunk-M5AH5ERI.js","sourcesContent":["'use client';\n\nimport useSWR from 'swr';\nimport { useParams } from 'react-router-dom';\nimport { apiPaths } from '../core/api-paths';\nimport { useConfig } from '../core/config/config-context';\nimport type { AuthService, User } from './types';\n\nexport default function useAuthService(): AuthService {\n const { projectId } = useParams();\n const { projects } = useConfig();\n const currentProject = projects.find((project) => project.projectId === projectId) ?? projects[0];\n const { data: user, isLoading: isLoadingUser } = useSWR(apiPaths(projectId ?? '').currentUser, (url: string) =>\n fetch(url, { mode: 'cors', credentials: 'include' }).then((res) => res.json() as Promise<User>)\n );\n const isLoading = isLoadingUser;\n\n return [\n isLoading,\n {\n user,\n logout: async () => {\n // wipe remote session\n await fetch(apiPaths(projectId ?? '').logout(currentProject?.basePath ?? '/'), {\n method: 'POST',\n mode: 'cors',\n credentials: 'include',\n });\n\n // delete first-party auth cookie\n await fetch('/api/flexkit/logout', { method: 'GET', credentials: 'include' });\n\n window.location.reload();\n },\n },\n ];\n}\n","'use client';\n\nimport { createContext, JSX, useContext } from 'react';\nimport useAuthService from './use-auth-service';\nimport type { Auth, AuthService, User } from './types';\n\nconst AuthContext = createContext([\n true,\n {\n user: null as User | null,\n logout: () => Promise.resolve(),\n } as Auth,\n]);\n\nexport function AuthProvider({ children }: { children: React.ReactNode }): JSX.Element {\n const [isLoading, auth] = useAuthService();\n\n return <AuthContext.Provider value={[isLoading, auth]}>{children}</AuthContext.Provider>;\n}\n\nexport function useAuth(): AuthService {\n return useContext(AuthContext) as AuthService;\n}\n"]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import'./index.css';import {a}from'./chunk-ZEZ6TRCO.js';import {isValid,format}from'date-fns';import {jsx}from'react/jsx-runtime';function d({value:t}){if(t==null||t===""||typeof t!="string")return jsx(a,{value:""});let e=new Date(t);if(!isValid(e))return jsx(a,{value:""});let i=format(e,"MMM d, yyyy")+" at "+format(e,"HH:mm");return jsx(a,{value:i})}export{d as a};//# sourceMappingURL=chunk-R7N3MDOP.js.map
|
|
2
|
+
//# sourceMappingURL=chunk-R7N3MDOP.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/data-grid/preview-components/datetime.tsx"],"names":["DateTime","value","jsx","CopyableTruncatedText","date","isValid","displayValue","format"],"mappings":"kIAGO,SAASA,CAAAA,CAAS,CAAE,KAAA,CAAAC,CAAM,CAAA,CAA2C,CAC1E,GAAIA,CAAAA,EAAU,IAAA,EAA+BA,CAAAA,GAAU,EAAA,EAAM,OAAOA,CAAAA,EAAU,QAAA,CAC5E,OAAOC,GAAAA,CAACC,CAAAA,CAAA,CAAsB,KAAA,CAAM,EAAA,CAAG,EAGzC,IAAMC,CAAAA,CAAO,IAAI,IAAA,CAAKH,CAAK,CAAA,CAE3B,GAAI,CAACI,OAAAA,CAAQD,CAAI,CAAA,CACf,OAAOF,GAAAA,CAACC,CAAAA,CAAA,CAAsB,KAAA,CAAM,GAAG,CAAA,CAGzC,IAAMG,CAAAA,CAAeC,MAAAA,CAAOH,CAAAA,CAAM,aAAa,CAAA,CAAI,MAAA,CAASG,OAAOH,CAAAA,CAAM,OAAO,CAAA,CAEhF,OAAOF,GAAAA,CAACC,CAAAA,CAAA,CAAsB,KAAA,CAAOG,EAAc,CACrD","file":"chunk-R7N3MDOP.js","sourcesContent":["import { format, isValid } from 'date-fns';\nimport { CopyableTruncatedText } from './copyable-truncated-text';\n\nexport function DateTime({ value }: { value: string | object | unknown[] }) {\n if (value === null || value === undefined || value === '' || typeof value !== 'string') {\n return <CopyableTruncatedText value=\"\" />;\n }\n\n const date = new Date(value);\n\n if (!isValid(date)) {\n return <CopyableTruncatedText value=\"\" />;\n }\n\n const displayValue = format(date, 'MMM d, yyyy') + ' at ' + format(date, 'HH:mm');\n\n return <CopyableTruncatedText value={displayValue} />;\n}\n"]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import'./index.css';import {createContext,useMemo,useContext}from'react';import {path,has}from'ramda';import {useParams}from'react-router-dom';import {jsx}from'react/jsx-runtime';var c={name:"_asset",plural:"_assets",menu:{hidden:true},attributes:[{name:"path",label:"Asset",scope:"global",options:{size:140},isEditable:true,dataType:"string",inputType:"text",previewType:"assetPreviewField",defaultValue:""},{name:"originalFilename",label:"Filename",scope:"global",options:{size:320},isEditable:true,dataType:"string",inputType:"text",previewType:"text",isPrimary:true,defaultValue:""},{name:"size",label:"Size",scope:"global",options:{size:120},isEditable:true,dataType:"int",inputType:"text",previewType:"text",defaultValue:""},{name:"width",label:"Width",scope:"global",options:{size:90},isEditable:true,dataType:"int",inputType:"text",previewType:"text",defaultValue:""},{name:"height",label:"Height",scope:"global",options:{size:100},isEditable:true,dataType:"int",inputType:"text",previewType:"text",defaultValue:""},{name:"mimeType",label:"Mime Type",scope:"global",options:{size:160},isEditable:true,dataType:"string",inputType:"text",previewType:"text",defaultValue:""},{name:"lqip",label:"lqip",scope:"global",isHidden:true,isEditable:true,dataType:"string",inputType:"text",previewType:"text",defaultValue:""},{name:"_updatedAt",label:"Updated At",scope:"global",options:{size:220},isEditable:false,isHidden:true,dataType:"datetime",inputType:"datetime",previewType:"datetime",defaultValue:""},{name:"tags",label:"Tags",scope:"relationship",dataType:"string",inputType:"relationship",defaultValue:"",previewType:"tags",options:{size:300},relationship:{mode:"multiple",field:"name",entity:"_tag"}}]};var d={name:"_tag",plural:"_tags",menu:{hidden:true},attributes:[{name:"name",label:"Tag Name",scope:"global",options:{size:220},isEditable:true,dataType:"string",inputType:"text",previewType:"text",isPrimary:true,defaultValue:""},{name:"_updatedAt",label:"Updated At",scope:"global",options:{size:220},isEditable:false,isHidden:true,dataType:"datetime",inputType:"datetime",previewType:"datetime",defaultValue:""},{name:"assets",label:"Assets",scope:"relationship",dataType:"string",inputType:"relationship",defaultValue:"",relationship:{mode:"multiple",field:"originalFilename",entity:"_asset"}}]};var T=createContext({contributions:{apps:[]},currentProjectId:void 0,currentProjectSchema:[],getContributionPointConfig:()=>[],plugins:[],projects:[]}),l=i=>Object.prototype.hasOwnProperty.call(i,"projectId"),g=i=>Object.prototype.hasOwnProperty.call(i,"contributes");function F({config:i,children:o}){let{projectId:n}=useParams(),t=useMemo(()=>{let e=p=>[...p.filter(b=>b.name!==c.name&&b.name!==d.name),c,d];return i.map(p=>({...p,schema:e(p.schema)}))},[i]),s=useMemo(()=>r(["plugins"],t),[t]),y=useMemo(()=>r(["plugins"],t.filter(e=>e.projectId===n)),[t,n]),f=useMemo(()=>s.filter(e=>!l(e)&&g(e)),[s]),u=useMemo(()=>y.filter(e=>!l(e)&&g(e)),[y]),O=useMemo(()=>({contributions:{apps:m("apps",[],u)},currentProjectId:n,currentProjectSchema:t.find(e=>e.projectId===n)?.schema??[],getContributionPointConfig:(e,p=[])=>m(e,p,u),plugins:f,projects:s.filter(e=>l(e))}),[f,n,u,t,s]);return jsx(T.Provider,{value:O,children:o})}function R(){return useContext(T)}function r(i,o){return Array.isArray(o)?o.reduce((n,t)=>path(i,t)?[...n,t,...r(i,path(i,t)??[])]:[...n,t],[]):[o]}function m(i,o=[],n){let t=["contributes",i,...o];return r(t.flat(),n).filter(s=>has("component",s))}function H(i){let n=r(["plugins"],i).filter(t=>!l(t)&&g(t));return m("apps",[],n)}export{c as a,d as b,F as c,R as d,H as e};//# sourceMappingURL=chunk-V6R4AWQS.js.map
|
|
2
|
+
//# sourceMappingURL=chunk-V6R4AWQS.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/entities/assets-schema.ts","../src/entities/tags-schema.ts","../src/core/config/config-context.tsx"],"names":["assetSchema","tagSchema","ConfigContext","createContext","hasProjectIdProperty","configItem","hasContributesProperty","ConfigProvider","config","children","currentProjectId","useParams","enhancedConfig","useMemo","upsertReservedEntities","schema","entity","project","globalFlattenedConfig","flattenConfigByProperty","currentProjectFlattenedConfig","item","allPlugins","currentProjectPlugins","globalConfig","_getContributionPointConfig","contributionPoint","subPath","jsx","useConfig","useContext","property","acc","curr","path","pathArray","has","getApps","plugins"],"mappings":"mLAEO,IAAMA,EAAsB,CACjC,IAAA,CAAM,QAAA,CACN,MAAA,CAAQ,UACR,IAAA,CAAM,CACJ,MAAA,CAAQ,IACV,EACA,UAAA,CAAY,CACV,CACE,IAAA,CAAM,MAAA,CACN,MAAO,OAAA,CACP,KAAA,CAAO,QAAA,CACP,OAAA,CAAS,CACP,IAAA,CAAM,GACR,EACA,UAAA,CAAY,IAAA,CACZ,SAAU,QAAA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C,OAAOC,UAAAA,CAAW5B,CAAa,CACjC,CAEA,SAASiB,CAAAA,CACPY,EACAvB,CAAAA,CACyC,CACzC,OAAK,KAAA,CAAM,OAAA,CAAQA,CAAM,CAAA,CAIlBA,EAAO,MAAA,CAA2C,CAACwB,EAAKC,CAAAA,GACzDC,IAAAA,CAAKH,EAAUE,CAAI,CAAA,CACd,CAAC,GAAGD,EAAKC,CAAAA,CAAM,GAAGd,EAAwBY,CAAAA,CAAUG,IAAAA,CAAKH,EAAUE,CAAI,CAAA,EAAK,EAAE,CAAC,CAAA,CAGjF,CAAC,GAAGD,CAAAA,CAAKC,CAAI,EACnB,EAAE,CAAA,CATI,CAACzB,CAAM,CAUlB,CAEA,SAASiB,CAAAA,CACPC,CAAAA,CACAC,EAAoB,EAAC,CACrBnB,CAAAA,CACgB,CAChB,IAAM2B,CAAAA,CAAY,CAAC,cAAeT,CAAAA,CAAmB,GAAGC,CAAO,CAAA,CAE/D,OAAOR,CAAAA,CAAwBgB,CAAAA,CAAU,MAAK,CAAG3B,CAAM,EAAE,MAAA,CAAQa,CAAAA,EAASe,IAAI,WAAA,CAAaf,CAAI,CAAC,CAClG,CAEO,SAASgB,CAAAA,CAAQ7B,EAA6C,CAEnE,IAAM8B,EADkBnB,CAAAA,CAAwB,CAAC,SAAS,CAAA,CAAGX,CAAM,CAAA,CACnC,MAAA,CAC7Ba,GAAyC,CAACjB,CAAAA,CAAqBiB,CAAI,CAAA,EAAKf,CAAAA,CAAuBe,CAAI,CACtG,EACA,OAAOI,CAAAA,CAA4B,OAAQ,EAAC,CAAGa,CAAO,CACxD","file":"chunk-V6R4AWQS.js","sourcesContent":["import type { Entity } from '../core/types';\n\nexport const assetSchema: Entity = {\n name: '_asset',\n plural: '_assets',\n menu: {\n hidden: true,\n },\n attributes: [\n {\n name: 'path',\n label: 'Asset',\n scope: 'global',\n options: {\n size: 140,\n },\n isEditable: true,\n dataType: 'string',\n inputType: 'text',\n previewType: 'assetPreviewField',\n defaultValue: '',\n },\n {\n name: 'originalFilename',\n label: 'Filename',\n scope: 'global',\n options: {\n size: 320,\n },\n isEditable: true,\n dataType: 'string',\n inputType: 'text',\n previewType: 'text',\n isPrimary: true,\n defaultValue: '',\n },\n {\n name: 'size',\n label: 'Size',\n scope: 'global',\n options: {\n size: 120,\n },\n isEditable: true,\n dataType: 'int',\n inputType: 'text',\n previewType: 'text',\n defaultValue: '',\n },\n {\n name: 'width',\n label: 'Width',\n scope: 'global',\n options: {\n size: 90,\n },\n isEditable: true,\n dataType: 'int',\n inputType: 'text',\n previewType: 'text',\n defaultValue: '',\n },\n {\n name: 'height',\n label: 'Height',\n scope: 'global',\n options: {\n size: 100,\n },\n isEditable: true,\n dataType: 'int',\n inputType: 'text',\n previewType: 'text',\n defaultValue: '',\n },\n {\n name: 'mimeType',\n label: 'Mime Type',\n scope: 'global',\n options: {\n size: 160,\n },\n isEditable: true,\n dataType: 'string',\n inputType: 'text',\n previewType: 'text',\n defaultValue: '',\n },\n {\n name: 'lqip',\n label: 'lqip',\n scope: 'global',\n isHidden: true,\n isEditable: true,\n dataType: 'string',\n inputType: 'text',\n previewType: 'text',\n defaultValue: '',\n },\n {\n name: '_updatedAt',\n label: 'Updated At',\n scope: 'global',\n options: {\n size: 220,\n },\n isEditable: false,\n isHidden: true,\n dataType: 'datetime',\n inputType: 'datetime',\n previewType: 'datetime',\n defaultValue: '',\n },\n {\n name: 'tags',\n label: 'Tags',\n scope: 'relationship',\n dataType: 'string',\n inputType: 'relationship',\n defaultValue: '',\n previewType: 'tags',\n options: {\n size: 300,\n },\n relationship: {\n mode: 'multiple',\n field: 'name',\n entity: '_tag',\n },\n },\n ],\n};\n","import type { Entity } from '../core/types';\n\nexport const tagSchema: Entity = {\n name: '_tag',\n plural: '_tags',\n menu: {\n hidden: true,\n },\n attributes: [\n {\n name: 'name',\n label: 'Tag Name',\n scope: 'global',\n options: {\n size: 220,\n },\n isEditable: true,\n dataType: 'string',\n inputType: 'text',\n previewType: 'text',\n isPrimary: true,\n defaultValue: '',\n },\n {\n name: '_updatedAt',\n label: 'Updated At',\n scope: 'global',\n options: {\n size: 220,\n },\n isEditable: false,\n isHidden: true,\n dataType: 'datetime',\n inputType: 'datetime',\n previewType: 'datetime',\n defaultValue: '',\n },\n {\n name: 'assets',\n label: 'Assets',\n scope: 'relationship',\n dataType: 'string',\n inputType: 'relationship',\n defaultValue: '',\n relationship: {\n mode: 'multiple',\n field: 'originalFilename',\n entity: '_asset',\n },\n },\n ],\n};\n","'use client';\n\nimport { createContext, useContext, useMemo } from 'react';\nimport type { JSX } from 'react';\nimport { has, path } from 'ramda';\nimport { useParams } from 'react-router-dom';\nimport { assetSchema } from '../../entities/assets-schema';\nimport { tagSchema } from '../../entities/tags-schema';\nimport type { AppOptions, PluginOptions, ProjectOptions } from './types';\nimport type { Entity } from '../types';\n\ntype Contributes = NonNullable<PluginOptions['contributes']>;\nexport interface ConfigContext {\n contributions: {\n apps: AppOptions[] | [];\n };\n currentProjectId?: string;\n currentProjectSchema: Entity[];\n getContributionPointConfig: <T extends keyof Contributes>(\n contributionPoint: T,\n subPath?: string[]\n ) => Contributes[T][] | [];\n plugins: PluginOptions[];\n projects: ProjectOptions[];\n}\n\nconst ConfigContext = createContext<ConfigContext>({\n contributions: {\n apps: [],\n },\n currentProjectId: undefined,\n currentProjectSchema: [],\n getContributionPointConfig: () => [],\n plugins: [] as PluginOptions[],\n projects: [] as ProjectOptions[],\n});\nconst hasProjectIdProperty = (configItem: ProjectOptions | PluginOptions): boolean =>\n Object.prototype.hasOwnProperty.call(configItem, 'projectId');\nconst hasContributesProperty = (configItem: ProjectOptions | PluginOptions): boolean =>\n Object.prototype.hasOwnProperty.call(configItem, 'contributes');\n\nexport function ConfigProvider({\n config,\n children,\n}: {\n config: ProjectOptions[];\n children: React.ReactNode;\n}): JSX.Element {\n /**\n * Getting the projectId from the URL via react-router-dom's useParams hook triggers a rerender of this Context\n * every time the URL changes.\n */\n const { projectId: currentProjectId } = useParams<{ projectId: string }>();\n const enhancedConfig = useMemo(() => {\n const upsertReservedEntities = (schema: Entity[]): Entity[] => {\n const withoutReserved = schema.filter(\n (entity) => entity.name !== assetSchema.name && entity.name !== tagSchema.name\n );\n\n return [...withoutReserved, assetSchema, tagSchema];\n };\n\n return config.map((project) => ({\n ...project,\n schema: upsertReservedEntities(project.schema),\n }));\n }, [config]);\n\n const globalFlattenedConfig = useMemo(() => flattenConfigByProperty(['plugins'], enhancedConfig), [enhancedConfig]);\n const currentProjectFlattenedConfig = useMemo(\n () =>\n flattenConfigByProperty(\n ['plugins'],\n enhancedConfig.filter((item) => item.projectId === currentProjectId)\n ),\n [enhancedConfig, currentProjectId]\n );\n const allPlugins = useMemo(\n () =>\n globalFlattenedConfig.filter(\n (item: ProjectOptions | PluginOptions) => !hasProjectIdProperty(item) && hasContributesProperty(item)\n ) as PluginOptions[],\n [globalFlattenedConfig]\n );\n const currentProjectPlugins = useMemo(\n () =>\n currentProjectFlattenedConfig.filter(\n (item: ProjectOptions | PluginOptions) => !hasProjectIdProperty(item) && hasContributesProperty(item)\n ) as PluginOptions[],\n [currentProjectFlattenedConfig]\n );\n\n const globalConfig = useMemo(\n () => ({\n contributions: {\n apps: _getContributionPointConfig('apps', [], currentProjectPlugins) as AppOptions[] | [],\n },\n currentProjectId,\n currentProjectSchema: enhancedConfig.find((item) => item.projectId === currentProjectId)?.schema ?? [],\n getContributionPointConfig: <T extends keyof Contributes>(\n contributionPoint: T,\n subPath: string[] = []\n ): Contributes[T][] =>\n _getContributionPointConfig(contributionPoint, subPath, currentProjectPlugins) as Contributes[T][],\n plugins: allPlugins,\n projects: globalFlattenedConfig.filter((item: ProjectOptions | PluginOptions) =>\n hasProjectIdProperty(item)\n ) as ProjectOptions[],\n }),\n [allPlugins, currentProjectId, currentProjectPlugins, enhancedConfig, globalFlattenedConfig]\n );\n\n return <ConfigContext.Provider value={globalConfig}>{children}</ConfigContext.Provider>;\n}\n\nexport function useConfig(): ConfigContext {\n return useContext(ConfigContext);\n}\n\nfunction flattenConfigByProperty(\n property: string[],\n config: (ProjectOptions | PluginOptions)[]\n): (ProjectOptions | PluginOptions)[] | [] {\n if (!Array.isArray(config)) {\n return [config];\n }\n\n return config.reduce<(ProjectOptions | PluginOptions)[]>((acc, curr) => {\n if (path(property, curr)) {\n return [...acc, curr, ...flattenConfigByProperty(property, path(property, curr) ?? [])];\n }\n\n return [...acc, curr];\n }, []);\n}\n\nfunction _getContributionPointConfig<T extends keyof Contributes>(\n contributionPoint: T,\n subPath: string[] = [],\n config: PluginOptions[]\n): Contributes[T] {\n const pathArray = ['contributes', contributionPoint, ...subPath];\n\n return flattenConfigByProperty(pathArray.flat(), config).filter((item) => has('component', item)) as Contributes[T];\n}\n\nexport function getApps(config: ProjectOptions[]): AppOptions[] | [] {\n const flattenedConfig = flattenConfigByProperty(['plugins'], config);\n const plugins = flattenedConfig.filter(\n (item: ProjectOptions | PluginOptions) => !hasProjectIdProperty(item) && hasContributesProperty(item)\n ) as PluginOptions[];\n return _getContributionPointConfig('apps', [], plugins) as AppOptions[] | [];\n}\n"]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import'./index.css';import {a}from'./chunk-ZEZ6TRCO.js';import {jsx}from'react/jsx-runtime';function s(e){return "groupLabel"in e}function u(e){return e.flatMap(t=>s(t)?t.items:[t])}function o(e,t){if(!t)return e;let n=u(t).find(i=>String(i.value)===e);return n?n.label:e}function p({value:e,options:t}){if(e==null)return jsx(a,{value:""});let n=String(e),i=o(n,t?.list);return jsx(a,{value:i})}export{p as a};//# sourceMappingURL=chunk-W3TUEJJL.js.map
|
|
2
|
+
//# sourceMappingURL=chunk-W3TUEJJL.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/data-grid/preview-components/select.tsx"],"names":["isGroupedSelectList","option","flattenSelectList","list","resolveSelectLabel","value","match","item","Select","options","jsx","CopyableTruncatedText","stringValue","displayValue"],"mappings":"4FAcA,SAASA,CAAAA,CAAoBC,EAAyE,CACpG,OAAO,eAAgBA,CACzB,CAEA,SAASC,CAAAA,CAAkBC,CAAAA,CAA+C,CACxE,OAAOA,CAAAA,CAAK,QAASF,CAAAA,EACfD,CAAAA,CAAoBC,CAAM,CAAA,CACrBA,CAAAA,CAAO,MAGT,CAACA,CAAM,CACf,CACH,CAEA,SAASG,CAAAA,CAAmBC,CAAAA,CAAeF,EAAiD,CAC1F,GAAI,CAACA,CAAAA,CACH,OAAOE,EAGT,IAAMC,CAAAA,CAAQJ,EAAkBC,CAAI,CAAA,CAAE,KAAMI,CAAAA,EAAS,MAAA,CAAOA,EAAK,KAAK,CAAA,GAAMF,CAAK,CAAA,CAEjF,OAAKC,EAIEA,CAAAA,CAAM,KAAA,CAHJD,CAIX,CAEO,SAASG,EAAO,CACrB,KAAA,CAAAH,EACA,OAAA,CAAAI,CACF,EAGgB,CACd,GAAIJ,GAAU,IAAA,CACZ,OAAOK,IAACC,CAAAA,CAAA,CAAsB,MAAM,EAAA,CAAG,CAAA,CAGzC,IAAMC,CAAAA,CAAc,MAAA,CAAOP,CAAK,CAAA,CAC1BQ,CAAAA,CAAeT,EAAmBQ,CAAAA,CAAaH,CAAAA,EAAS,IAAI,CAAA,CAElE,OAAOC,IAACC,CAAAA,CAAA,CAAsB,KAAA,CAAOE,CAAAA,CAAc,CACrD","file":"chunk-W3TUEJJL.js","sourcesContent":["import type { JSX } from 'react';\nimport type { SelectOptions } from '../../core/types';\nimport { CopyableTruncatedText } from './copyable-truncated-text';\n\ntype SelectListItem = {\n label: string;\n value: string;\n};\n\ntype GroupedSelectList = {\n groupLabel: string;\n items: SelectListItem[];\n};\n\nfunction isGroupedSelectList(option: SelectListItem | GroupedSelectList): option is GroupedSelectList {\n return 'groupLabel' in option;\n}\n\nfunction flattenSelectList(list: SelectOptions['list']): SelectListItem[] {\n return list.flatMap((option) => {\n if (isGroupedSelectList(option)) {\n return option.items;\n }\n\n return [option];\n });\n}\n\nfunction resolveSelectLabel(value: string, list: SelectOptions['list'] | undefined): string {\n if (!list) {\n return value;\n }\n\n const match = flattenSelectList(list).find((item) => String(item.value) === value);\n\n if (!match) {\n return value;\n }\n\n return match.label;\n}\n\nexport function Select({\n value,\n options,\n}: {\n value: string | number | null | undefined;\n options?: SelectOptions;\n}): JSX.Element {\n if (value === null || value === undefined) {\n return <CopyableTruncatedText value=\"\" />;\n }\n\n const stringValue = String(value);\n const displayValue = resolveSelectLabel(stringValue, options?.list);\n\n return <CopyableTruncatedText value={displayValue} />;\n}\n"]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import'./index.css';import {d}from'./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import'./index.css';import {d}from'./chunk-V6R4AWQS.js';import {c}from'./chunk-WDRCARCP.js';import {createContext,useReducer,useContext,useMemo}from'react';import {jsx}from'react/jsx-runtime';import v from'swr';import {find,propEq}from'ramda';var D="core.context.scope:",x={breadcrumbs:[],isRouteLoading:false,pageTitle:"",scope:"",relationships:{}},C=createContext(x),b=createContext(()=>{});function O(t,e){let{type:o,payload:r}=e;switch(o){case "setScope":return typeof localStorage<"u"&&r.projectId&&localStorage.setItem(`${D}${r.projectId}`,r.scope),{...t,scope:r.scope};case "setRelationship":return {...t,relationships:{...t.relationships,...r}};default:throw Error(`Unknown action: ${o}`)}}function K({children:t}){let[e,o]=useReducer(O,x);return jsx(C.Provider,{value:e,children:jsx(b.Provider,{value:o,children:t})})}function I(){return useContext(C)}function V(){return useContext(b)}function F(t,e){let{scope:o}=I(),{projects:r,currentProjectId:u}=d(),{schema:i,scopes:l}=find(propEq(u??"","projectId"))(r),s=l?.find(m=>m.isDefault)?.name??"default",a=e?.commonParams.q?JSON.stringify(e):null,{data:n,error:S,isLoading:p}=v(a,()=>fetch(c(t).search,{headers:{"Content-Type":"application/json"},body:JSON.stringify(e),method:"POST",mode:"cors"}).then(m=>m.json()));return {results:useMemo(()=>L(n?.results??[],t,i,o,s)??[],[n,s,t,i,o]),error:S,isLoading:p}}function J(t){return t.find(e=>e.isPrimary)?.name??t[0]?.name}function L(t,e,o,r,u){return t?.filter(i=>i?.hits?.length>0).map(i=>{let l=i,s=l.collection.replace(`${e}_`,"").replace(/_\d+$/,""),a=find(propEq(s,"plural"))(o);if(!a)return [];let n=J(a?.attributes??[]),S=a?.name??s;return l.hits.map(({document:p})=>{let c=p[n],w=(c&&typeof c!="string"?c[r]??c[u]:null)??p[n],E=Object.entries(p).reduce((h,[d,f])=>{if(d!==n&&d!=="id"&&d!=="_updatedAt"){let T=typeof f!="string"?f[r]??f[u]:f;h[d]=T;}return h},{});return {_id:p.id,_entityName:S,_entityNamePlural:s,[n]:w,...E}})}).flat()}export{D as a,K as b,I as c,V as d,F as e};//# sourceMappingURL=chunk-WZ533Y4O.js.map
|
|
2
|
+
//# sourceMappingURL=chunk-WZ533Y4O.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/core/app-context.tsx","../src/core/use-search.tsx"],"names":["SCOPE_STORAGE_KEY","initialState","AppContext","createContext","AppDispatchContext","reducer","state","action","type","payload","AppProvider","children","dispatch","useReducer","jsx","useAppContext","useContext","useAppDispatch","useSearch","projectId","searchRequest","scope","projects","currentProjectId","useConfig","schema","scopes","find","propEq","defaultScope","s","swrKey","data","error","isLoading","useSWR","apiPaths","res","useMemo","mapResults","getPrimaryAttributeName","schemaAttributes","attr","results","result","item","entityNamePlural","entitySchema","primaryAttributeName","entityName","document","primaryAttribute","primaryAttributeValue","attributes","acc","key","value","scopedValue"],"mappings":"mPAMO,IAAMA,CAAAA,CAAoB,sBAE3BC,CAAAA,CAAe,CACnB,WAAA,CAAa,EAAC,CACd,cAAA,CAAgB,KAAA,CAChB,SAAA,CAAW,EAAA,CACX,KAAA,CAAO,EAAA,CACP,aAAA,CAAe,EACjB,EAEMC,CAAAA,CAAaC,aAAAA,CAA8BF,CAAY,CAAA,CAEvDG,CAAAA,CAAqBD,aAAAA,CAAgE,IAAM,CAEjG,CAAC,EAED,SAASE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I,CAAAA,CAA0E,CAACC,CAAAA,CAAKC,CAAK,CAAA,GAAM,CAC1F,GAAID,CAAAA,GAAQP,GAAwBO,CAAAA,GAAQ,IAAA,EAAQA,CAAAA,GAAQ,YAAA,CAAc,CACxE,IAAME,EAAc,OAAOD,CAAAA,EAAU,QAAA,CAAYA,CAAAA,CAAMnC,CAAK,CAAA,EAAKmC,CAAAA,CAAM3B,CAAY,CAAA,CAAK2B,CAAAA,CAExFF,CAAAA,CAAIC,CAAG,CAAA,CAAIE,EACb,CAEA,OAAOH,CACT,CAAA,CACA,EACF,CAAA,CAEA,OAAO,CACL,GAAA,CAAKJ,CAAAA,CAAS,EAAA,CACd,WAAA,CAAaD,CAAAA,CACb,iBAAA,CAAmBH,EACnB,CAACE,CAAoB,EAAGI,CAAAA,CACxB,GAAGC,CACL,CACF,CAAC,CACH,CAAC,CAAA,CACA,IAAA,EACL","file":"chunk-2PEDKE5Z.js","sourcesContent":["'use client';\n\nimport { createContext, useContext, useReducer } from 'react';\nimport type { Dispatch, JSX, ReactNode } from 'react';\nimport type { ActionSetRelationship, ActionSetScope, AppContextType } from './types';\n\nexport const SCOPE_STORAGE_KEY = 'core.context.scope:';\n\nconst initialState = {\n breadcrumbs: [],\n isRouteLoading: false,\n pageTitle: '',\n scope: '',\n relationships: {},\n};\n\nconst AppContext = createContext<AppContextType>(initialState);\n\nconst AppDispatchContext = createContext<Dispatch<ActionSetRelationship | ActionSetScope>>(() => {\n /* void */\n});\n\nfunction reducer(state: AppContextType, action: ActionSetRelationship | ActionSetScope): AppContextType {\n const { type, payload } = action;\n\n switch (type) {\n case 'setScope':\n if (typeof localStorage !== 'undefined' && payload.projectId) {\n localStorage.setItem(`${SCOPE_STORAGE_KEY}${payload.projectId}`, payload.scope);\n }\n\n return {\n ...state,\n scope: payload.scope,\n };\n case 'setRelationship':\n return {\n ...state,\n relationships: { ...state.relationships, ...payload },\n };\n default:\n throw Error(`Unknown action: ${type as string}`);\n }\n}\n\nexport function AppProvider({ children }: { children: ReactNode }): JSX.Element {\n const [state, dispatch] = useReducer(reducer, initialState);\n\n return (\n <AppContext.Provider value={state}>\n <AppDispatchContext.Provider value={dispatch}>{children}</AppDispatchContext.Provider>\n </AppContext.Provider>\n );\n}\n\nexport function useAppContext(): AppContextType {\n return useContext(AppContext);\n}\n\nexport function useAppDispatch(): Dispatch<ActionSetRelationship | ActionSetScope> {\n return useContext(AppDispatchContext);\n}\n","'use client';\n\nimport { useMemo } from 'react';\nimport useSWR from 'swr';\nimport { find, propEq } from 'ramda';\nimport { apiPaths } from './api-paths';\nimport { useAppContext } from './app-context';\nimport { useConfig } from './config/config-context';\nimport type { SingleProject } from './config/types';\nimport type {\n Attribute,\n Entity,\n RawResultItem,\n RawSearchResultItems,\n SearchRequestProps,\n SearchResultItem,\n} from './types';\n\nexport function useSearch(\n projectId: string,\n searchRequest: SearchRequestProps | null\n): { results: SearchResultItem[] | []; error: Error; isLoading: boolean } {\n const { scope } = useAppContext();\n const { projects, currentProjectId } = useConfig();\n const { schema, scopes } = find(propEq(currentProjectId ?? '', 'projectId'))(projects) as SingleProject;\n const defaultScope = scopes?.find((s) => s.isDefault)?.name ?? 'default';\n const swrKey = searchRequest?.commonParams.q ? JSON.stringify(searchRequest) : null;\n const { data, error, isLoading } = useSWR(swrKey, () =>\n fetch(apiPaths(projectId).search, {\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify(searchRequest),\n method: 'POST',\n mode: 'cors',\n }).then((res) => res.json() as Promise<{ results: RawSearchResultItems }>)\n );\n const results = useMemo(\n () => mapResults(data?.results ?? [], projectId, schema, scope, defaultScope) ?? [],\n [data, defaultScope, projectId, schema, scope]\n );\n\n return { results, error, isLoading };\n}\n\n/**\n * Find the name of the attribute of an entity with isPrimary === true.\n * The value of that attribute is returned as the value for the relationship attribute\n */\nfunction getPrimaryAttributeName(schemaAttributes: Attribute[]): string {\n return schemaAttributes.find((attr) => attr.isPrimary)?.name ?? schemaAttributes[0]?.name;\n}\n\nfunction mapResults(\n results: RawSearchResultItems | undefined,\n projectId: string,\n schema: Entity[],\n scope: string,\n defaultScope: string\n): SearchResultItem[] | undefined {\n return results\n ?.filter((result) => (result as RawResultItem)?.hits?.length > 0)\n .map((result) => {\n const item = result as RawResultItem;\n const entityNamePlural = item.collection.replace(`${projectId}_`, '').replace(/_\\d+$/, '');\n const entitySchema = find<Entity>(propEq(entityNamePlural, 'plural'))(schema);\n\n if (!entitySchema) {\n return [];\n }\n\n const primaryAttributeName = getPrimaryAttributeName(entitySchema?.attributes ?? []);\n const entityName = entitySchema?.name ?? entityNamePlural;\n\n // iterate over the hits and return an object with the primary attribute value first and then the rest of the attributes.\n return item.hits.map(({ document }) => {\n const primaryAttribute = document[primaryAttributeName];\n const scopedPrimaryAttribute =\n primaryAttribute && typeof primaryAttribute !== 'string'\n ? (primaryAttribute[scope] ?? primaryAttribute[defaultScope])\n : null;\n const primaryAttributeValue = scopedPrimaryAttribute ?? document[primaryAttributeName];\n const attributes = Object.entries(document).reduce(\n (acc: Omit<SearchResultItem, '_id' | '_entityName' | '_entityNamePlural'>, [key, value]) => {\n if (key !== primaryAttributeName && key !== 'id' && key !== '_updatedAt') {\n const scopedValue = typeof value !== 'string' ? (value[scope] ?? value[defaultScope]) : value;\n\n acc[key] = scopedValue;\n }\n\n return acc;\n },\n {}\n );\n\n return {\n _id: document.id,\n _entityName: entityName,\n _entityNamePlural: entityNamePlural,\n [primaryAttributeName]: primaryAttributeValue as string,\n ...attributes,\n };\n });\n })\n .flat();\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/core/app-context.tsx","../src/core/use-search.tsx"],"names":["SCOPE_STORAGE_KEY","initialState","AppContext","createContext","AppDispatchContext","reducer","state","action","type","payload","AppProvider","children","dispatch","useReducer","jsx","useAppContext","useContext","useAppDispatch","useSearch","projectId","searchRequest","scope","projects","currentProjectId","useConfig","schema","scopes","find","propEq","defaultScope","s","swrKey","data","error","isLoading","useSWR","apiPaths","res","useMemo","mapResults","getPrimaryAttributeName","schemaAttributes","attr","results","result","item","entityNamePlural","entitySchema","primaryAttributeName","entityName","document","primaryAttribute","primaryAttributeValue","attributes","acc","key","value","scopedValue"],"mappings":"mPAMO,IAAMA,CAAAA,CAAoB,sBAE3BC,CAAAA,CAAe,CACnB,WAAA,CAAa,EAAC,CACd,cAAA,CAAgB,KAAA,CAChB,SAAA,CAAW,EAAA,CACX,KAAA,CAAO,EAAA,CACP,aAAA,CAAe,EACjB,EAEMC,CAAAA,CAAaC,aAAAA,CAA8BF,CAAY,CAAA,CAEvDG,CAAAA,CAAqBD,aAAAA,CAAgE,IAAM,CAEjG,CAAC,EAED,SAASE,CAAAA,CAAQC,CAAAA,CAAuBC,EAAgE,CACtG,GAAM,CAAE,IAAA,CAAAC,CAAAA,CAAM,OAAA,CAAAC,CAAQ,CAAA,CAAIF,CAAAA,CAE1B,OAAQC,CAAAA,EACN,KAAK,UAAA,CACH,OAAI,OAAO,YAAA,CAAiB,GAAA,EAAeC,CAAAA,CAAQ,SAAA,EACjD,YAAA,CAAa,QAAQ,CAAA,EAAGT,CAAiB,CAAA,EAAGS,CAAAA,CAAQ,SAAS,CAAA,CAAA,CAAIA,EAAQ,KAAK,CAAA,CAGzE,CACL,GAAGH,CAAAA,CACH,KAAA,CAAOG,CAAAA,CAAQ,KACjB,CAAA,CACF,KAAK,iBAAA,CACH,OAAO,CACL,GAAGH,EACH,aAAA,CAAe,CAAE,GAAGA,CAAAA,CAAM,aAAA,CAAe,GAAGG,CAAQ,CACtD,CAAA,CACF,QACE,MAAM,KAAA,CAAM,CAAA,gBAAA,EAAmBD,CAAc,EAAE,CACnD,CACF,CAEO,SAASE,CAAAA,CAAY,CAAE,QAAA,CAAAC,CAAS,CAAA,CAAyC,CAC9E,GAAM,CAACL,CAAAA,CAAOM,CAAQ,EAAIC,UAAAA,CAAWR,CAAAA,CAASJ,CAAY,CAAA,CAE1D,OACEa,GAAAA,CAACZ,EAAW,QAAA,CAAX,CAAoB,KAAA,CAAOI,CAAA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AAAA,CAAK,IAAA,CAAK,GAAA,CAAI,CAAC,CAAE,QAAA,CAAAK,CAAS,IAAM,CACrC,IAAMC,CAAAA,CAAmBD,CAAAA,CAASF,CAAoB,CAAA,CAKhDI,CAAAA,CAAAA,CAHJD,CAAAA,EAAoB,OAAOA,CAAAA,EAAqB,QAAA,CAC3CA,CAAAA,CAAiB9B,CAAK,CAAA,EAAK8B,EAAiBtB,CAAY,CAAA,CACzD,IAAA,GACkDqB,CAAAA,CAASF,CAAoB,CAAA,CAC/EK,CAAAA,CAAa,MAAA,CAAO,OAAA,CAAQH,CAAQ,CAAA,CAAE,MAAA,CAC1C,CAACI,CAAAA,CAA0E,CAACC,CAAAA,CAAKC,CAAK,CAAA,GAAM,CAC1F,GAAID,CAAAA,GAAQP,GAAwBO,CAAAA,GAAQ,IAAA,EAAQA,CAAAA,GAAQ,YAAA,CAAc,CACxE,IAAME,EAAc,OAAOD,CAAAA,EAAU,QAAA,CAAYA,CAAAA,CAAMnC,CAAK,CAAA,EAAKmC,CAAAA,CAAM3B,CAAY,CAAA,CAAK2B,CAAAA,CAExFF,CAAAA,CAAIC,CAAG,CAAA,CAAIE,EACb,CAEA,OAAOH,CACT,CAAA,CACA,EACF,CAAA,CAEA,OAAO,CACL,GAAA,CAAKJ,CAAAA,CAAS,EAAA,CACd,WAAA,CAAaD,CAAAA,CACb,iBAAA,CAAmBH,EACnB,CAACE,CAAoB,EAAGI,CAAAA,CACxB,GAAGC,CACL,CACF,CAAC,CACH,CAAC,CAAA,CACA,IAAA,EACL","file":"chunk-WZ533Y4O.js","sourcesContent":["'use client';\n\nimport { createContext, useContext, useReducer } from 'react';\nimport type { Dispatch, JSX, ReactNode } from 'react';\nimport type { ActionSetRelationship, ActionSetScope, AppContextType } from './types';\n\nexport const SCOPE_STORAGE_KEY = 'core.context.scope:';\n\nconst initialState = {\n breadcrumbs: [],\n isRouteLoading: false,\n pageTitle: '',\n scope: '',\n relationships: {},\n};\n\nconst AppContext = createContext<AppContextType>(initialState);\n\nconst AppDispatchContext = createContext<Dispatch<ActionSetRelationship | ActionSetScope>>(() => {\n /* void */\n});\n\nfunction reducer(state: AppContextType, action: ActionSetRelationship | ActionSetScope): AppContextType {\n const { type, payload } = action;\n\n switch (type) {\n case 'setScope':\n if (typeof localStorage !== 'undefined' && payload.projectId) {\n localStorage.setItem(`${SCOPE_STORAGE_KEY}${payload.projectId}`, payload.scope);\n }\n\n return {\n ...state,\n scope: payload.scope,\n };\n case 'setRelationship':\n return {\n ...state,\n relationships: { ...state.relationships, ...payload },\n };\n default:\n throw Error(`Unknown action: ${type as string}`);\n }\n}\n\nexport function AppProvider({ children }: { children: ReactNode }): JSX.Element {\n const [state, dispatch] = useReducer(reducer, initialState);\n\n return (\n <AppContext.Provider value={state}>\n <AppDispatchContext.Provider value={dispatch}>{children}</AppDispatchContext.Provider>\n </AppContext.Provider>\n );\n}\n\nexport function useAppContext(): AppContextType {\n return useContext(AppContext);\n}\n\nexport function useAppDispatch(): Dispatch<ActionSetRelationship | ActionSetScope> {\n return useContext(AppDispatchContext);\n}\n","'use client';\n\nimport { useMemo } from 'react';\nimport useSWR from 'swr';\nimport { find, propEq } from 'ramda';\nimport { apiPaths } from './api-paths';\nimport { useAppContext } from './app-context';\nimport { useConfig } from './config/config-context';\nimport type { SingleProject } from './config/types';\nimport type {\n Attribute,\n Entity,\n RawResultItem,\n RawSearchResultItems,\n SearchRequestProps,\n SearchResultItem,\n} from './types';\n\nexport function useSearch(\n projectId: string,\n searchRequest: SearchRequestProps | null\n): { results: SearchResultItem[] | []; error: Error; isLoading: boolean } {\n const { scope } = useAppContext();\n const { projects, currentProjectId } = useConfig();\n const { schema, scopes } = find(propEq(currentProjectId ?? '', 'projectId'))(projects) as SingleProject;\n const defaultScope = scopes?.find((s) => s.isDefault)?.name ?? 'default';\n const swrKey = searchRequest?.commonParams.q ? JSON.stringify(searchRequest) : null;\n const { data, error, isLoading } = useSWR(swrKey, () =>\n fetch(apiPaths(projectId).search, {\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify(searchRequest),\n method: 'POST',\n mode: 'cors',\n }).then((res) => res.json() as Promise<{ results: RawSearchResultItems }>)\n );\n const results = useMemo(\n () => mapResults(data?.results ?? [], projectId, schema, scope, defaultScope) ?? [],\n [data, defaultScope, projectId, schema, scope]\n );\n\n return { results, error, isLoading };\n}\n\n/**\n * Find the name of the attribute of an entity with isPrimary === true.\n * The value of that attribute is returned as the value for the relationship attribute\n */\nfunction getPrimaryAttributeName(schemaAttributes: Attribute[]): string {\n return schemaAttributes.find((attr) => attr.isPrimary)?.name ?? schemaAttributes[0]?.name;\n}\n\nfunction mapResults(\n results: RawSearchResultItems | undefined,\n projectId: string,\n schema: Entity[],\n scope: string,\n defaultScope: string\n): SearchResultItem[] | undefined {\n return results\n ?.filter((result) => (result as RawResultItem)?.hits?.length > 0)\n .map((result) => {\n const item = result as RawResultItem;\n const entityNamePlural = item.collection.replace(`${projectId}_`, '').replace(/_\\d+$/, '');\n const entitySchema = find<Entity>(propEq(entityNamePlural, 'plural'))(schema);\n\n if (!entitySchema) {\n return [];\n }\n\n const primaryAttributeName = getPrimaryAttributeName(entitySchema?.attributes ?? []);\n const entityName = entitySchema?.name ?? entityNamePlural;\n\n // iterate over the hits and return an object with the primary attribute value first and then the rest of the attributes.\n return item.hits.map(({ document }) => {\n const primaryAttribute = document[primaryAttributeName];\n const scopedPrimaryAttribute =\n primaryAttribute && typeof primaryAttribute !== 'string'\n ? (primaryAttribute[scope] ?? primaryAttribute[defaultScope])\n : null;\n const primaryAttributeValue = scopedPrimaryAttribute ?? document[primaryAttributeName];\n const attributes = Object.entries(document).reduce(\n (acc: Omit<SearchResultItem, '_id' | '_entityName' | '_entityNamePlural'>, [key, value]) => {\n if (key !== primaryAttributeName && key !== 'id' && key !== '_updatedAt') {\n const scopedValue = typeof value !== 'string' ? (value[scope] ?? value[defaultScope]) : value;\n\n acc[key] = scopedValue;\n }\n\n return acc;\n },\n {}\n );\n\n return {\n _id: document.id,\n _entityName: entityName,\n _entityNamePlural: entityNamePlural,\n [primaryAttributeName]: primaryAttributeValue as string,\n ...attributes,\n };\n });\n })\n .flat();\n}\n"]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import'./index.css';import {a,b,c,e}from'./chunk-YW2EEXMV.js';import {a as a$1}from'./chunk-O2QMYUPS.js';import {useRef,useState,useEffect}from'react';import {Check,Copy}from'lucide-react';import {jsx,jsxs}from'react/jsx-runtime';var g=500,P=3e3;function D({value:e$1}){let r=useRef(null),n=useRef(null),[h,v]=useState(false),[i,c$1]=useState(false),[x,f]=useState(false);useEffect(()=>{let o=r.current;if(!o)return;function l(){r.current&&v(r.current.scrollWidth>r.current.clientWidth);}l();let u=new ResizeObserver(l);return u.observe(o),()=>{u.disconnect();}},[e$1]),useEffect(()=>()=>{n.current&&clearTimeout(n.current);},[]);async function C(o){if(o.preventDefault(),o.stopPropagation(),!!e$1){try{await navigator.clipboard.writeText(e$1);}catch{return}c$1(true),f(true),n.current&&clearTimeout(n.current),n.current=setTimeout(()=>{c$1(false),f(false);},P);}}function w(o){i||f(o&&h);}if(!e$1)return jsx("div",{className:"fk:truncate"});let E=e$1.length>g?`${e$1.slice(0,g)}\u2026`:e$1;return jsx(a,{delayDuration:400,children:jsxs(b,{open:x,onOpenChange:w,children:[jsx(c,{asChild:true,children:jsxs("button",{"aria-label":"Copy value",className:a$1("fk:group/copyable fk:relative fk:flex fk:w-full fk:min-w-0 fk:items-center fk:rounded-sm fk:border-0 fk:bg-transparent fk:px-0.5 fk:-mx-0.5 fk:py-0.5 fk:text-left fk:text-inherit fk:font-inherit","fk:cursor-pointer fk:transition-[transform,background-color] fk:duration-75 fk:ease-out","fk:hover:bg-muted/50 fk:active:translate-y-px fk:active:scale-[0.98] fk:active:bg-muted/70","fk:focus-visible:outline-hidden fk:focus-visible:ring-1 fk:focus-visible:ring-ring"),onClick:C,type:"button",children:[jsx("span",{className:"fk:min-w-0 fk:flex-1 fk:truncate fk:pr-4",ref:r,children:e$1}),jsx("span",{"aria-hidden":true,className:a$1("fk:pointer-events-none fk:absolute fk:right-0.5 fk:top-1/2 fk:flex fk:-translate-y-1/2 fk:items-center fk:justify-center","fk:rounded-sm fk:bg-muted/80 fk:p-0.5 fk:text-muted-foreground fk:shadow-sm fk:ring-1 fk:ring-border/60","fk:transition-opacity fk:duration-100",i?"fk:opacity-100 fk:text-foreground":"fk:opacity-0 fk:group-hover/copyable:opacity-100 fk:group-focus-visible/copyable:opacity-100"),children:i?jsx(Check,{className:"fk:size-3"}):jsx(Copy,{className:"fk:size-3"})})]})}),jsx(e,{className:"fk:max-w-xs fk:wrap-break-word",children:i?"Copied to clipboard":E})]})})}export{D as a};//# sourceMappingURL=chunk-ZEZ6TRCO.js.map
|
|
2
|
+
//# sourceMappingURL=chunk-ZEZ6TRCO.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/data-grid/preview-components/copyable-truncated-text.tsx"],"names":["TOOLTIP_MAX_LENGTH","COPIED_DISMISS_MS","CopyableTruncatedText","value","textRef","useRef","dismissTimeoutRef","isTruncated","setIsTruncated","useState","copied","setCopied","tooltipOpen","setTooltipOpen","useEffect","element","updateTruncation","observer","handleClick","event","handleTooltipOpenChange","open","jsx","tooltipText","TooltipProvider","jsxs","Tooltip","TooltipTrigger","cn","CheckIcon","CopyIcon","TooltipContent"],"mappings":"sOAQA,IAAMA,CAAAA,CAAqB,GAAA,CACrBC,CAAAA,CAAoB,IAMnB,SAASC,CAAAA,CAAsB,CAAE,KAAA,CAAAC,GAAM,CAAA,CAA4C,CACxF,IAAMC,CAAAA,CAAUC,OAAwB,IAAI,CAAA,CACtCC,CAAAA,CAAoBD,MAAAA,CAA6C,IAAI,CAAA,CACrE,CAACE,CAAAA,CAAaC,CAAc,CAAA,CAAIC,QAAAA,CAAS,KAAK,CAAA,CAC9C,CAACC,CAAAA,CAAQC,GAAS,CAAA,CAAIF,SAAS,KAAK,CAAA,CACpC,CAACG,CA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,CAEJ","file":"chunk-ZEZ6TRCO.js","sourcesContent":["'use client';\n\nimport { useEffect, useRef, useState } from 'react';\nimport type { JSX, MouseEvent } from 'react';\nimport { Check as CheckIcon, Copy as CopyIcon } from 'lucide-react';\nimport { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from '../../ui/primitives/tooltip';\nimport { cn } from '../../ui/lib/utils';\n\nconst TOOLTIP_MAX_LENGTH = 500;\nconst COPIED_DISMISS_MS = 3000;\n\ntype CopyableTruncatedTextProps = {\n value: string;\n};\n\nexport function CopyableTruncatedText({ value }: CopyableTruncatedTextProps): JSX.Element {\n const textRef = useRef<HTMLSpanElement>(null);\n const dismissTimeoutRef = useRef<ReturnType<typeof setTimeout> | null>(null);\n const [isTruncated, setIsTruncated] = useState(false);\n const [copied, setCopied] = useState(false);\n const [tooltipOpen, setTooltipOpen] = useState(false);\n\n useEffect(() => {\n const element = textRef.current;\n\n if (!element) {\n return;\n }\n\n function updateTruncation(): void {\n if (!textRef.current) {\n return;\n }\n\n setIsTruncated(textRef.current.scrollWidth > textRef.current.clientWidth);\n }\n\n updateTruncation();\n\n const observer = new ResizeObserver(updateTruncation);\n observer.observe(element);\n\n return () => {\n observer.disconnect();\n };\n }, [value]);\n\n useEffect(() => {\n return () => {\n if (dismissTimeoutRef.current) {\n clearTimeout(dismissTimeoutRef.current);\n }\n };\n }, []);\n\n async function handleClick(event: MouseEvent<HTMLButtonElement>): Promise<void> {\n event.preventDefault();\n event.stopPropagation();\n\n if (!value) {\n return;\n }\n\n try {\n await navigator.clipboard.writeText(value);\n } catch {\n return;\n }\n\n setCopied(true);\n setTooltipOpen(true);\n\n if (dismissTimeoutRef.current) {\n clearTimeout(dismissTimeoutRef.current);\n }\n\n dismissTimeoutRef.current = setTimeout(() => {\n setCopied(false);\n setTooltipOpen(false);\n }, COPIED_DISMISS_MS);\n }\n\n function handleTooltipOpenChange(open: boolean): void {\n if (copied) {\n return;\n }\n\n setTooltipOpen(open && isTruncated);\n }\n\n if (!value) {\n return <div className=\"fk:truncate\" />;\n }\n\n const tooltipText =\n value.length > TOOLTIP_MAX_LENGTH ? `${value.slice(0, TOOLTIP_MAX_LENGTH)}…` : value;\n\n return (\n <TooltipProvider delayDuration={400}>\n <Tooltip open={tooltipOpen} onOpenChange={handleTooltipOpenChange}>\n <TooltipTrigger asChild>\n <button\n aria-label=\"Copy value\"\n className={cn(\n 'fk:group/copyable fk:relative fk:flex fk:w-full fk:min-w-0 fk:items-center fk:rounded-sm fk:border-0 fk:bg-transparent fk:px-0.5 fk:-mx-0.5 fk:py-0.5 fk:text-left fk:text-inherit fk:font-inherit',\n 'fk:cursor-pointer fk:transition-[transform,background-color] fk:duration-75 fk:ease-out',\n 'fk:hover:bg-muted/50 fk:active:translate-y-px fk:active:scale-[0.98] fk:active:bg-muted/70',\n 'fk:focus-visible:outline-hidden fk:focus-visible:ring-1 fk:focus-visible:ring-ring'\n )}\n onClick={handleClick}\n type=\"button\"\n >\n <span className=\"fk:min-w-0 fk:flex-1 fk:truncate fk:pr-4\" ref={textRef}>\n {value}\n </span>\n <span\n aria-hidden\n className={cn(\n 'fk:pointer-events-none fk:absolute fk:right-0.5 fk:top-1/2 fk:flex fk:-translate-y-1/2 fk:items-center fk:justify-center',\n 'fk:rounded-sm fk:bg-muted/80 fk:p-0.5 fk:text-muted-foreground fk:shadow-sm fk:ring-1 fk:ring-border/60',\n 'fk:transition-opacity fk:duration-100',\n copied\n ? 'fk:opacity-100 fk:text-foreground'\n : 'fk:opacity-0 fk:group-hover/copyable:opacity-100 fk:group-focus-visible/copyable:opacity-100'\n )}\n >\n {copied ? <CheckIcon className=\"fk:size-3\" /> : <CopyIcon className=\"fk:size-3\" />}\n </span>\n </button>\n </TooltipTrigger>\n <TooltipContent className=\"fk:max-w-xs fk:wrap-break-word\">\n {copied ? 'Copied to clipboard' : tooltipText}\n </TooltipContent>\n </Tooltip>\n </TooltipProvider>\n );\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","file":"datetime-
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"datetime-NQTYGZIC.js"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","file":"editor-
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"editor-YIRZQR3D.js"}
|
package/dist/index.css
CHANGED
|
@@ -48,6 +48,7 @@
|
|
|
48
48
|
--fk-leading-relaxed: 1.625;
|
|
49
49
|
--fk-radius-xs: 0.125rem;
|
|
50
50
|
--fk-drop-shadow-md: 0 3px 3px rgb(0 0 0 / 0.12);
|
|
51
|
+
--fk-ease-out: cubic-bezier(0, 0, 0.2, 1);
|
|
51
52
|
--fk-ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);
|
|
52
53
|
--fk-animate-spin: spin 1s linear infinite;
|
|
53
54
|
--fk-animate-pulse: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
|
|
@@ -278,6 +279,9 @@
|
|
|
278
279
|
.fk\:right-0 {
|
|
279
280
|
right: calc(var(--fk-spacing) * 0);
|
|
280
281
|
}
|
|
282
|
+
.fk\:right-0\.5 {
|
|
283
|
+
right: calc(var(--fk-spacing) * 0.5);
|
|
284
|
+
}
|
|
281
285
|
.fk\:right-0\.75 {
|
|
282
286
|
right: calc(var(--fk-spacing) * 0.75);
|
|
283
287
|
}
|
|
@@ -360,6 +364,9 @@
|
|
|
360
364
|
max-width: 1400px;
|
|
361
365
|
}
|
|
362
366
|
}
|
|
367
|
+
.fk\:-mx-0\.5 {
|
|
368
|
+
margin-inline: calc(var(--fk-spacing) * -0.5);
|
|
369
|
+
}
|
|
363
370
|
.fk\:-mx-1 {
|
|
364
371
|
margin-inline: calc(var(--fk-spacing) * -1);
|
|
365
372
|
}
|
|
@@ -1370,6 +1377,9 @@
|
|
|
1370
1377
|
.fk\:w-48\! {
|
|
1371
1378
|
width: calc(var(--fk-spacing) * 48) !important;
|
|
1372
1379
|
}
|
|
1380
|
+
.fk\:w-50 {
|
|
1381
|
+
width: calc(var(--fk-spacing) * 50);
|
|
1382
|
+
}
|
|
1373
1383
|
.fk\:w-52 {
|
|
1374
1384
|
width: calc(var(--fk-spacing) * 52);
|
|
1375
1385
|
}
|
|
@@ -1400,9 +1410,6 @@
|
|
|
1400
1410
|
.fk\:w-\[150px\] {
|
|
1401
1411
|
width: 150px;
|
|
1402
1412
|
}
|
|
1403
|
-
.fk\:w-\[200px\] {
|
|
1404
|
-
width: 200px;
|
|
1405
|
-
}
|
|
1406
1413
|
.fk\:w-\[350px\] {
|
|
1407
1414
|
width: 350px;
|
|
1408
1415
|
}
|
|
@@ -1436,6 +1443,9 @@
|
|
|
1436
1443
|
.fk\:max-w-screen-lg {
|
|
1437
1444
|
max-width: var(--fk-breakpoint-lg);
|
|
1438
1445
|
}
|
|
1446
|
+
.fk\:max-w-xs {
|
|
1447
|
+
max-width: var(--fk-container-xs);
|
|
1448
|
+
}
|
|
1439
1449
|
.fk\:min-w-\(--cell-size\) {
|
|
1440
1450
|
min-width: var(--cell-size);
|
|
1441
1451
|
}
|
|
@@ -1914,6 +1924,12 @@
|
|
|
1914
1924
|
background-color: color-mix(in oklab, hsl(var(--muted)) 50%, transparent);
|
|
1915
1925
|
}
|
|
1916
1926
|
}
|
|
1927
|
+
.fk\:bg-muted\/80 {
|
|
1928
|
+
background-color: hsl(var(--muted));
|
|
1929
|
+
@supports (color: color-mix(in lab, red, red)) {
|
|
1930
|
+
background-color: color-mix(in oklab, hsl(var(--muted)) 80%, transparent);
|
|
1931
|
+
}
|
|
1932
|
+
}
|
|
1917
1933
|
.fk\:bg-overlay\/75 {
|
|
1918
1934
|
background-color: hsl(var(--overlay));
|
|
1919
1935
|
@supports (color: color-mix(in lab, red, red)) {
|
|
@@ -2001,6 +2017,9 @@
|
|
|
2001
2017
|
.fk\:px-\(--cell-size\) {
|
|
2002
2018
|
padding-inline: var(--cell-size);
|
|
2003
2019
|
}
|
|
2020
|
+
.fk\:px-0\.5 {
|
|
2021
|
+
padding-inline: calc(var(--fk-spacing) * 0.5);
|
|
2022
|
+
}
|
|
2004
2023
|
.fk\:px-1 {
|
|
2005
2024
|
padding-inline: calc(var(--fk-spacing) * 1);
|
|
2006
2025
|
}
|
|
@@ -2076,6 +2095,9 @@
|
|
|
2076
2095
|
.fk\:pr-3 {
|
|
2077
2096
|
padding-right: calc(var(--fk-spacing) * 3);
|
|
2078
2097
|
}
|
|
2098
|
+
.fk\:pr-4 {
|
|
2099
|
+
padding-right: calc(var(--fk-spacing) * 4);
|
|
2100
|
+
}
|
|
2079
2101
|
.fk\:pr-6 {
|
|
2080
2102
|
padding-right: calc(var(--fk-spacing) * 6);
|
|
2081
2103
|
}
|
|
@@ -2211,6 +2233,9 @@
|
|
|
2211
2233
|
.fk\:text-balance {
|
|
2212
2234
|
text-wrap: balance;
|
|
2213
2235
|
}
|
|
2236
|
+
.fk\:wrap-break-word {
|
|
2237
|
+
overflow-wrap: break-word;
|
|
2238
|
+
}
|
|
2214
2239
|
.fk\:whitespace-nowrap {
|
|
2215
2240
|
white-space: nowrap;
|
|
2216
2241
|
}
|
|
@@ -2253,6 +2278,9 @@
|
|
|
2253
2278
|
color: color-mix(in oklab, hsl(var(--foreground)) 60%, transparent);
|
|
2254
2279
|
}
|
|
2255
2280
|
}
|
|
2281
|
+
.fk\:text-inherit {
|
|
2282
|
+
color: inherit;
|
|
2283
|
+
}
|
|
2256
2284
|
.fk\:text-link {
|
|
2257
2285
|
color: hsl(var(--link));
|
|
2258
2286
|
}
|
|
@@ -2332,6 +2360,9 @@
|
|
|
2332
2360
|
.fk\:opacity-70 {
|
|
2333
2361
|
opacity: 70%;
|
|
2334
2362
|
}
|
|
2363
|
+
.fk\:opacity-100 {
|
|
2364
|
+
opacity: 100%;
|
|
2365
|
+
}
|
|
2335
2366
|
.fk\:shadow-\[0_0_0_1px_hsl\(var\(--sidebar-border\)\)\] {
|
|
2336
2367
|
--tw-shadow: 0 0 0 1px var(--tw-shadow-color, hsl(var(--sidebar-border)));
|
|
2337
2368
|
box-shadow: var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);
|
|
@@ -2348,6 +2379,10 @@
|
|
|
2348
2379
|
--tw-shadow: 0 0 #0000;
|
|
2349
2380
|
box-shadow: var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);
|
|
2350
2381
|
}
|
|
2382
|
+
.fk\:shadow-sm {
|
|
2383
|
+
--tw-shadow: 0 1px 3px 0 var(--tw-shadow-color, rgb(0 0 0 / 0.1)), 0 1px 2px -1px var(--tw-shadow-color, rgb(0 0 0 / 0.1));
|
|
2384
|
+
box-shadow: var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);
|
|
2385
|
+
}
|
|
2351
2386
|
.fk\:shadow-xl {
|
|
2352
2387
|
--tw-shadow: 0 20px 25px -5px var(--tw-shadow-color, rgb(0 0 0 / 0.1)), 0 8px 10px -6px var(--tw-shadow-color, rgb(0 0 0 / 0.1));
|
|
2353
2388
|
box-shadow: var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);
|
|
@@ -2360,6 +2395,10 @@
|
|
|
2360
2395
|
--tw-ring-shadow: var(--tw-ring-inset,) 0 0 0 calc(0px + var(--tw-ring-offset-width)) var(--tw-ring-color, currentcolor);
|
|
2361
2396
|
box-shadow: var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);
|
|
2362
2397
|
}
|
|
2398
|
+
.fk\:ring-1 {
|
|
2399
|
+
--tw-ring-shadow: var(--tw-ring-inset,) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color, currentcolor);
|
|
2400
|
+
box-shadow: var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);
|
|
2401
|
+
}
|
|
2363
2402
|
.fk\:ring-2 {
|
|
2364
2403
|
--tw-ring-shadow: var(--tw-ring-inset,) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color, currentcolor);
|
|
2365
2404
|
box-shadow: var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);
|
|
@@ -2367,6 +2406,12 @@
|
|
|
2367
2406
|
.fk\:ring-background {
|
|
2368
2407
|
--tw-ring-color: hsl(var(--background));
|
|
2369
2408
|
}
|
|
2409
|
+
.fk\:ring-border\/60 {
|
|
2410
|
+
--tw-ring-color: hsl(var(--border));
|
|
2411
|
+
@supports (color: color-mix(in lab, red, red)) {
|
|
2412
|
+
--tw-ring-color: color-mix(in oklab, hsl(var(--border)) 60%, transparent);
|
|
2413
|
+
}
|
|
2414
|
+
}
|
|
2370
2415
|
.fk\:ring-ring {
|
|
2371
2416
|
--tw-ring-color: hsl(var(--ring));
|
|
2372
2417
|
}
|
|
@@ -2418,6 +2463,11 @@
|
|
|
2418
2463
|
transition-timing-function: var(--tw-ease, var(--fk-default-transition-timing-function));
|
|
2419
2464
|
transition-duration: var(--tw-duration, var(--fk-default-transition-duration));
|
|
2420
2465
|
}
|
|
2466
|
+
.fk\:transition-\[transform\,background-color\] {
|
|
2467
|
+
transition-property: transform,background-color;
|
|
2468
|
+
transition-timing-function: var(--tw-ease, var(--fk-default-transition-timing-function));
|
|
2469
|
+
transition-duration: var(--tw-duration, var(--fk-default-transition-duration));
|
|
2470
|
+
}
|
|
2421
2471
|
.fk\:transition-\[width\,height\,padding\] {
|
|
2422
2472
|
transition-property: width,height,padding;
|
|
2423
2473
|
transition-timing-function: var(--tw-ease, var(--fk-default-transition-timing-function));
|
|
@@ -2456,6 +2506,14 @@
|
|
|
2456
2506
|
.fk\:transition-none {
|
|
2457
2507
|
transition-property: none;
|
|
2458
2508
|
}
|
|
2509
|
+
.fk\:duration-75 {
|
|
2510
|
+
--tw-duration: 75ms;
|
|
2511
|
+
transition-duration: 75ms;
|
|
2512
|
+
}
|
|
2513
|
+
.fk\:duration-100 {
|
|
2514
|
+
--tw-duration: 100ms;
|
|
2515
|
+
transition-duration: 100ms;
|
|
2516
|
+
}
|
|
2459
2517
|
.fk\:duration-200 {
|
|
2460
2518
|
--tw-duration: 200ms;
|
|
2461
2519
|
transition-duration: 200ms;
|
|
@@ -2468,6 +2526,10 @@
|
|
|
2468
2526
|
--tw-ease: linear;
|
|
2469
2527
|
transition-timing-function: linear;
|
|
2470
2528
|
}
|
|
2529
|
+
.fk\:ease-out {
|
|
2530
|
+
--tw-ease: var(--fk-ease-out);
|
|
2531
|
+
transition-timing-function: var(--fk-ease-out);
|
|
2532
|
+
}
|
|
2471
2533
|
.fk\:animate-in {
|
|
2472
2534
|
animation-name: enter;
|
|
2473
2535
|
animation-duration: 150ms;
|
|
@@ -2488,6 +2550,12 @@
|
|
|
2488
2550
|
.fk\:\[--cell-size\:--spacing\(8\)\] {
|
|
2489
2551
|
--cell-size: calc(var(--fk-spacing) * 8);
|
|
2490
2552
|
}
|
|
2553
|
+
.fk\:duration-75 {
|
|
2554
|
+
animation-duration: 75ms;
|
|
2555
|
+
}
|
|
2556
|
+
.fk\:duration-100 {
|
|
2557
|
+
animation-duration: 100ms;
|
|
2558
|
+
}
|
|
2491
2559
|
.fk\:duration-200 {
|
|
2492
2560
|
animation-duration: 200ms;
|
|
2493
2561
|
}
|
|
@@ -2497,6 +2565,9 @@
|
|
|
2497
2565
|
.fk\:ease-linear {
|
|
2498
2566
|
animation-timing-function: linear;
|
|
2499
2567
|
}
|
|
2568
|
+
.fk\:ease-out {
|
|
2569
|
+
animation-timing-function: cubic-bezier(0, 0, 0.2, 1);
|
|
2570
|
+
}
|
|
2500
2571
|
.fk\:fade-in-0 {
|
|
2501
2572
|
--tw-enter-opacity: 0;
|
|
2502
2573
|
}
|
|
@@ -2508,6 +2579,13 @@
|
|
|
2508
2579
|
opacity: 100%;
|
|
2509
2580
|
}
|
|
2510
2581
|
}
|
|
2582
|
+
.fk\:group-hover\/copyable\:opacity-100 {
|
|
2583
|
+
&:is(:where(.fk\:group\/copyable):hover *) {
|
|
2584
|
+
@media (hover: hover) {
|
|
2585
|
+
opacity: 100%;
|
|
2586
|
+
}
|
|
2587
|
+
}
|
|
2588
|
+
}
|
|
2511
2589
|
.fk\:group-hover\/menu-item\:opacity-100 {
|
|
2512
2590
|
&:is(:where(.fk\:group\/menu-item):hover *) {
|
|
2513
2591
|
@media (hover: hover) {
|
|
@@ -2515,6 +2593,11 @@
|
|
|
2515
2593
|
}
|
|
2516
2594
|
}
|
|
2517
2595
|
}
|
|
2596
|
+
.fk\:group-focus-visible\/copyable\:opacity-100 {
|
|
2597
|
+
&:is(:where(.fk\:group\/copyable):focus-visible *) {
|
|
2598
|
+
opacity: 100%;
|
|
2599
|
+
}
|
|
2600
|
+
}
|
|
2518
2601
|
.fk\:group-has-data-\[sidebar\=menu-action\]\/menu-item\:pr-8 {
|
|
2519
2602
|
&:is(:where(.fk\:group\/menu-item):has(*[data-sidebar="menu-action"]) *) {
|
|
2520
2603
|
padding-right: calc(var(--fk-spacing) * 8);
|
|
@@ -3518,6 +3601,25 @@
|
|
|
3518
3601
|
outline-color: hsl(var(--ring));
|
|
3519
3602
|
}
|
|
3520
3603
|
}
|
|
3604
|
+
.fk\:active\:translate-y-px {
|
|
3605
|
+
&:active {
|
|
3606
|
+
--tw-translate-y: 1px;
|
|
3607
|
+
translate: var(--tw-translate-x) var(--tw-translate-y);
|
|
3608
|
+
}
|
|
3609
|
+
}
|
|
3610
|
+
.fk\:active\:scale-\[0\.98\] {
|
|
3611
|
+
&:active {
|
|
3612
|
+
scale: 0.98;
|
|
3613
|
+
}
|
|
3614
|
+
}
|
|
3615
|
+
.fk\:active\:bg-muted\/70 {
|
|
3616
|
+
&:active {
|
|
3617
|
+
background-color: hsl(var(--muted));
|
|
3618
|
+
@supports (color: color-mix(in lab, red, red)) {
|
|
3619
|
+
background-color: color-mix(in oklab, hsl(var(--muted)) 70%, transparent);
|
|
3620
|
+
}
|
|
3621
|
+
}
|
|
3622
|
+
}
|
|
3521
3623
|
.fk\:active\:bg-sidebar-accent {
|
|
3522
3624
|
&:active {
|
|
3523
3625
|
background-color: hsl(var(--sidebar-accent));
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React$1 from 'react';
|
|
2
2
|
import React__default, { Dispatch, JSX, SetStateAction, UIEvent, ReactElement } from 'react';
|
|
3
|
-
import { A as AppContextType, a as ActionSetRelationship, b as ActionSetScope, C as Config, c as AppOptions, E as Entity, P as PluginOptions, d as ProjectOptions, O as OrderedAssetValue, e as SearchRequestProps, f as SearchResultItem, U as UseEntityQueryParams, M as MappedEntityItem, F as FormEntityItem, I as ImageValue, g as Schema, h as
|
|
4
|
-
export { D as DataType,
|
|
3
|
+
import { A as AppContextType, a as ActionSetRelationship, b as ActionSetScope, C as Config, c as AppOptions, E as Entity, P as PluginOptions, d as ProjectOptions, O as OrderedAssetValue, e as SearchRequestProps, f as SearchResultItem, U as UseEntityQueryParams, M as MappedEntityItem, F as FormEntityItem, I as ImageValue, g as Schema, h as AttributeValue, i as Attribute, j as MultipleRelationshipConnection, k as SingleRelationshipConnection } from './types.d-DiQPwK_q.js';
|
|
4
|
+
export { D as DataType, l as DefaultValue, m as DefaultValueByDataType, n as EntityData, o as FormFieldParams, p as FormFieldProps, q as FormFieldValue, L as LogoProps, r as ScopeType, S as SingleProject } from './types.d-DiQPwK_q.js';
|
|
5
5
|
export { Outlet, useLocation, useParams } from 'react-router-dom';
|
|
6
6
|
import { OperationVariables, DocumentNode, ErrorLike } from '@apollo/client';
|
|
7
7
|
export { gql } from '@apollo/client';
|
|
@@ -148,6 +148,25 @@ type EntityMutationResponse = [
|
|
|
148
148
|
];
|
|
149
149
|
declare function useEntityMutation(): EntityMutationResponse;
|
|
150
150
|
|
|
151
|
+
/**
|
|
152
|
+
* Soft-refetch active list queries for an entity without clearing the current rows first.
|
|
153
|
+
* Prefer this after mutations; use `useEntityQuery().reload` when an explicit loading state is desired.
|
|
154
|
+
*/
|
|
155
|
+
declare function useRefreshEntityList(entityNameOrPlural: string): () => Promise<void>;
|
|
156
|
+
|
|
157
|
+
type EntityListRowPatch = {
|
|
158
|
+
_id: string;
|
|
159
|
+
attributes: {
|
|
160
|
+
[key: string]: string;
|
|
161
|
+
};
|
|
162
|
+
};
|
|
163
|
+
|
|
164
|
+
/**
|
|
165
|
+
* Patch active list rows for an entity without a soft-refetch.
|
|
166
|
+
* Prefer this after mutations that only change row fields (e.g. tag connect/disconnect).
|
|
167
|
+
*/
|
|
168
|
+
declare function usePatchEntityList(entityNameOrPlural: string): (patches: EntityListRowPatch[]) => void;
|
|
169
|
+
|
|
151
170
|
type EntityQuery = {
|
|
152
171
|
queryEntityName: string;
|
|
153
172
|
query: string;
|
|
@@ -158,12 +177,23 @@ declare function getEntityQuery(entityNamePlural: string, scope: string, schema:
|
|
|
158
177
|
/**
|
|
159
178
|
* Returns a string with the GraphQl query needed to mutate the dataToMutate object for the given entity and scope.
|
|
160
179
|
*/
|
|
161
|
-
declare function getEntityUpdateMutation(entityNamePlural: string, entityId: string, scope: string, schema: Schema, originalData: FormEntityItem, dataToMutate:
|
|
180
|
+
declare function getEntityUpdateMutation(entityNamePlural: string, entityId: string, scope: string, schema: Schema, originalData: FormEntityItem, dataToMutate: FormEntityItem, options?: {
|
|
181
|
+
responseFields?: string;
|
|
182
|
+
}): string;
|
|
162
183
|
/**
|
|
163
|
-
* Returns a string with the GraphQl mutation needed to delete
|
|
184
|
+
* Returns a string with the GraphQl mutation needed to delete one or more entities.
|
|
164
185
|
*/
|
|
165
|
-
declare function getEntityDeleteMutation(entityName: string, schema: Schema,
|
|
166
|
-
declare function
|
|
186
|
+
declare function getEntityDeleteMutation(entityName: string, schema: Schema, ids: string | readonly string[]): string;
|
|
187
|
+
declare function getEntityDeleteWhere(ids: string | readonly string[]): {
|
|
188
|
+
_id: {
|
|
189
|
+
eq: string;
|
|
190
|
+
};
|
|
191
|
+
} | {
|
|
192
|
+
_id: {
|
|
193
|
+
in: string[];
|
|
194
|
+
};
|
|
195
|
+
};
|
|
196
|
+
declare function getEntityCreateMutation(entityNamePlural: string, schema: Schema, entityData: FormEntityItem, _id: string): string;
|
|
167
197
|
declare function getEntitySchema(schema: Schema, entityNamePlural: string): Entity | undefined;
|
|
168
198
|
|
|
169
199
|
interface DataTableFacetedFilterProps<TData, TValue> {
|
|
@@ -289,7 +319,8 @@ type ActionDeleteEntity = {
|
|
|
289
319
|
_id?: string;
|
|
290
320
|
type: 'DeleteEntity';
|
|
291
321
|
payload: {
|
|
292
|
-
|
|
322
|
+
/** One id, or many ids for a single batch delete mutation. */
|
|
323
|
+
entityId: string | string[];
|
|
293
324
|
entityName: string;
|
|
294
325
|
silent?: boolean;
|
|
295
326
|
};
|
|
@@ -323,4 +354,4 @@ declare const assetSchema: Entity;
|
|
|
323
354
|
|
|
324
355
|
declare const tagSchema: Entity;
|
|
325
356
|
|
|
326
|
-
export { AppOptions, Attribute, AttributeValue, type ConfigContext, DataTable, DataTableColumnHeader, DataTableFacetedFilter, DataTableRowActions, DataTableSortedBy, DataTableToolbar, DataTableViewOptions, DefaultValueSwitch, Entity,
|
|
357
|
+
export { AppOptions, Attribute, AttributeValue, type ConfigContext, DataTable, DataTableColumnHeader, DataTableFacetedFilter, DataTableRowActions, DataTableSortedBy, DataTableToolbar, DataTableViewOptions, DefaultValueSwitch, Entity, type EntityListRowPatch, FlexkitStudio, FormEntityItem, IMAGES_BASE_URL, MappedEntityItem, PluginOptions, ProjectDisabled, Schema, SchemaError, SearchRequestProps, SearchResultItem, type UploadedFileResult, assetSchema, defineConfig, defineEntity, getEntityCreateMutation, getEntityDeleteMutation, getEntityDeleteWhere, getEntityQuery, getEntitySchema, getEntityUpdateMutation, tagSchema, useAppContext, useAppDispatch, useAuth, useConfig, useDispatch, useEntityMutation, useEntityQuery, useGraphQLError, useGridColumnsDefinition, usePatchEntityList, useRefreshEntityList, useSearch, useUploadAssets };
|