@riboseinc/paneron-registry-kit 2.2.12 → 2.2.13

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.
Files changed (45) hide show
  1. package/package.json +2 -2
  2. package/views/SearchQuery.js +9 -1
  3. package/views/SearchQuery.js.map +1 -1
  4. package/views/change-request/ChangeRequestContext.d.ts +7 -0
  5. package/views/change-request/ChangeRequestContext.js +82 -2
  6. package/views/change-request/ChangeRequestContext.js.map +1 -1
  7. package/views/change-request/Proposals.d.ts +16 -3
  8. package/views/change-request/Proposals.js +175 -79
  9. package/views/change-request/Proposals.js.map +1 -1
  10. package/views/change-request/util.d.ts +4 -0
  11. package/views/change-request/util.js +14 -0
  12. package/views/change-request/util.js.map +1 -0
  13. package/views/detail/ChangeRequest/index.js +16 -16
  14. package/views/detail/ChangeRequest/index.js.map +1 -1
  15. package/views/detail/RegisterHome/ActiveProposalDetails.js +2 -1
  16. package/views/detail/RegisterHome/ActiveProposalDetails.js.map +1 -1
  17. package/views/detail/RegisterHome/Block.d.ts +12 -2
  18. package/views/detail/RegisterHome/Block.js +40 -14
  19. package/views/detail/RegisterHome/Block.js.map +1 -1
  20. package/views/detail/RegisterHome/MetaSummary.js +4 -4
  21. package/views/detail/RegisterHome/MetaSummary.js.map +1 -1
  22. package/views/detail/RegisterHome/index.js +91 -8
  23. package/views/detail/RegisterHome/index.js.map +1 -1
  24. package/views/detail/RegisterItem/index.js +5 -3
  25. package/views/detail/RegisterItem/index.js.map +1 -1
  26. package/views/index.js +1 -1
  27. package/views/index.js.map +1 -1
  28. package/views/util.d.ts +19 -13
  29. package/views/util.js +11 -39
  30. package/views/util.js.map +1 -1
  31. package/site-builder/index.d.ts +0 -3
  32. package/site-builder/index.js +0 -75
  33. package/site-builder/index.js.map +0 -1
  34. package/site-builder/jsx-runtime.d.ts +0 -18
  35. package/site-builder/jsx-runtime.js +0 -107
  36. package/site-builder/jsx-runtime.js.map +0 -1
  37. package/site-builder/page.d.ts +0 -6
  38. package/site-builder/page.js +0 -24
  39. package/site-builder/page.js.map +0 -1
  40. package/views/change-request/ChangeProposalContext.d.ts +0 -3
  41. package/views/change-request/ChangeProposalContext.js +0 -4
  42. package/views/change-request/ChangeProposalContext.js.map +0 -1
  43. package/views/change-request/State.d.ts +0 -0
  44. package/views/change-request/State.js +0 -1
  45. package/views/change-request/State.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/views/index.tsx"],"names":[],"mappings":"AAAA,eAAe;AACf,8BAA8B;AAE9B,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,WAAW,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAC1E,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AAG1C,OAAO,EAAE,cAAc,EAAE,MAAM,0CAA0C,CAAC;AAC1E,OAAO,eAA8C,MAAM,0DAA0D,CAAC;AACtH,OAAO,EACL,mBAAmB,IAAI,kCAAkC,EACzD,sBAAsB,GACvB,MAAM,kEAAkE,CAAC;AAE1E,OAAO,EAML,cAAc,EACd,kBAAkB,GACnB,MAAM,UAAU,CAAC;AAElB,OAAO,EAAE,0BAA0B,EAAE,MAAM,WAAW,CAAC;AAEvD,OAAO,sBAAsB,MAAM,0BAA0B,CAAC;AAC9D,OAAO,EAAE,aAAa,EAAkB,UAAU,EAAE,MAAM,WAAW,CAAC;AACtE,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,gBAAgB,EAAE,MAAM,QAAQ,CAAC;AAC1C,OAAO,YAAY,MAAM,uBAAuB,CAAC;AACjD,OAAO,gBAAgB,EAAE,EAAE,SAAS,EAAiB,MAAM,oBAAoB,CAAC;AAChF,OAAO,EACL,oBAAoB,EACpB,4BAA4B,GAC7B,MAAM,uCAAuC,CAAC;AAC/C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KAAK,EAAE,OAAO,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC;YACrB,WAAW;YACX,gBAAgB;YAChB,OAAO,EAAE,cAAc,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS;YAExD,YAAY;YACZ,WAAW,EAAE,sBAAsB;YAEnC,MAAM,EAAE,QAAQ;YAEhB,oBAAoB;YAEpB,qBAAqB,EAAE,8BAA8B;YACrD,wBAAwB;YAExB,mBAAmB;YACnB,gCAAgC;YAChC,WAAW,EAAE,mBAAmB;YAEhC,aAAa;YACb,qBAAqB;YACrB,uBAAuB;SACxB,CAAC,CAAC,EAAE;YACH,oBAAoB;YACpB,8BAA8B;YAC9B,WAAW;YACX,gBAAgB;YAChB,cAAc;YACd,YAAY;YACZ,QAAQ;YACR,mBAAmB;YACnB,mBAAmB;YACnB,sBAAsB;YACtB,YAAY;YACZ,aAAa;YACb,qBAAqB;YACrB,uBAAuB;SACxB,CAAC;QACJ,IAAC,4BAA4B,IAAC,eAAe,EAAE,8BAA8B,IAC1E,QAAQ,CACoB,CACX,CACvB,CAAC;AACJ,CAAC,CAAA","sourcesContent":["/** @jsx jsx */\n/** @jsxFrag React.Fragment */\n\nimport React, { useContext, useCallback, useState, useMemo } from 'react';\nimport { useDebounce } from 'use-debounce';\nimport { jsx, css } from '@emotion/react';\n\nimport type { ValueHook } from '@riboseinc/paneron-extension-kit/types';\nimport { DatasetContext } from '@riboseinc/paneron-extension-kit/context';\nimport TabbedWorkspace, { type TabbedWorkspaceProps } from '@riboseinc/paneron-extension-kit/widgets/TabbedWorkspace';\nimport {\n makeContextProvider as makeTabbedWorkspaceContextProvider,\n TabbedWorkspaceContext,\n} from '@riboseinc/paneron-extension-kit/widgets/TabbedWorkspace/context';\n\nimport {\n type RegisterItem,\n type RegisterItemDataHook,\n type RegisterStakeholder,\n type RegistryViewProps,\n type InternalItemReference,\n isRegisterItem,\n isRegisterMetadata,\n} from '../types';\n\nimport { REGISTER_METADATA_FILENAME } from '../common';\n\nimport GenericRelatedItemView from './GenericRelatedItemView';\nimport { sidebarConfig, type SidebarID, sidebarIDs } from './sidebar';\nimport { BrowserCtx } from './BrowserCtx';\nimport { _getRelatedClass } from './util';\nimport RegisterHome from './detail/RegisterHome';\nimport protocolRegistry, { Protocols, type Protocol } from './protocolRegistry';\nimport {\n ChangeRequestContext,\n ChangeRequestContextProvider,\n} from './change-request/ChangeRequestContext';\nimport { useItemRef, itemPathInCR } from './itemPathUtils';\nexport { GenericRelatedItemView };\n\n\nconst TabbedWorkspaceContextProvider = makeTabbedWorkspaceContextProvider<Protocol, SidebarID>(\n 'Browse',\n sidebarIDs,\n protocolRegistry);\n\n\nexport const RegistryView: React.FC<RegistryViewProps> =\nfunction RegistryView (props) {\n return (\n <TabbedWorkspaceContextProvider stateKey=\"main-registry-view\">\n <BrowserCtxProvider {...props}>\n <RegistryWorkspace />\n </BrowserCtxProvider>\n </TabbedWorkspaceContextProvider>\n );\n};\n\n\nconst SIDEBAR_WIDTH_SETTING_NAME = 'registryMainSidebarWidthPixels'\n\n\nconst RegistryWorkspace: React.FC<Record<never, never>> =\nfunction RegistryWorkspace () {\n const { changeRequest: activeChangeRequest } = useContext(ChangeRequestContext);\n const { spawnTab } = useContext(TabbedWorkspaceContext);\n const { useSettings, updateSetting, useGlobalSettings } = useContext(DatasetContext);\n\n const globalMode: TabbedWorkspaceProps<any>['globalMode'] = useMemo(\n (() => activeChangeRequest\n ? {\n content: <>\n Viewing register as proposed — contents shown may differ from version in effect\n </>,\n intent: 'danger',\n onClick: () => spawnTab(`${Protocols.CHANGE_REQUEST}:/proposals/${activeChangeRequest.id}/main.yaml`),\n }\n : undefined),\n [activeChangeRequest?.id, spawnTab],\n );\n\n const { value: { settings } } = useSettings();\n const { value: { settings: globalSettings } } = useGlobalSettings();\n\n const stored = settings[SIDEBAR_WIDTH_SETTING_NAME];\n const sidebarWidth: number | undefined = stored && typeof stored === 'number'\n ? stored as number\n : undefined;\n\n return <TabbedWorkspace\n css={css`flex: 1 1 auto;`}\n sidebarConfig={sidebarConfig}\n sidebarPosition={globalSettings.sidebarPosition}\n sidebarIDs={sidebarIDs}\n newTabPrompt={<RegisterHome />}\n globalMode={globalMode}\n sidebarWidth={sidebarWidth}\n onSidebarResize={useCallback((width) => {\n updateSetting({ key: SIDEBAR_WIDTH_SETTING_NAME, value: width })\n }, [updateSetting])}\n />\n};\n\n\nconst BrowserCtxProvider: React.FC<RegistryViewProps> = function BrowserCtxProvider ({\n itemClassConfiguration,\n subregisters,\n keyExpression,\n defaultSearchCriteria,\n getQuickSearchPredicate,\n customViews,\n children,\n}) {\n\n const { useObjectData, useRemoteUsername } = useContext(DatasetContext);\n const { focusedTabURI, spawnTab } = useContext(TabbedWorkspaceContext);\n\n\n // Active item\n\n const selectedItemPath: string | null = useMemo((() =>\n focusedTabURI && focusedTabURI.startsWith(`${Protocols.ITEM_DETAILS}:`)\n ? focusedTabURI.split(':')[1]\n : null\n ), [focusedTabURI]);\n\n const selectedItemRef: InternalItemReference | null = useItemRef(\n subregisters !== undefined,\n selectedItemPath);\n\n const maybeSelectedRegisterItemData: Record<string, any> | null = useObjectData({\n objectPaths: selectedItemPath ? [selectedItemPath] : [],\n }).value.data[selectedItemPath ?? ''];\n\n const selectedRegisterItem: BrowserCtx['selectedRegisterItem'] = useMemo((() =>\n selectedItemRef\n ? maybeSelectedRegisterItemData &&\n isRegisterItem(maybeSelectedRegisterItemData)\n ? {\n item: maybeSelectedRegisterItemData,\n ref: selectedItemRef,\n itemClass: itemClassConfiguration[selectedItemRef.classID],\n }\n : undefined\n : null\n ), [selectedItemRef, maybeSelectedRegisterItemData]);\n\n\n // Active CR\n\n const [ activeChangeRequestID, setActiveChangeRequestID ] = useState<string | null>(null);\n\n\n // TODO: Confirm that end extensions using RegistryKit can’t just import hooks\n // from RegistryKit and we really have to pass this to them via context\n // TODO: Why not use useObjectData directly? Since register item paths\n // are just object paths. The casting here is optimistic, since an item at given path\n // may not be a RegisterItem.\n const useRegisterItemData: RegisterItemDataHook = useCallback((opts) => {\n // Original item path mapped to its potential alternative path in current CR,\n // if the item is clarified or added in it.\n // TODO(perf): Access CR data and check whether the item is affected instead of blindly trying CR paths\n const pathsToRequest: Record<string, string> = {};\n\n const { changeRequest: activeChangeRequest } = useContext(ChangeRequestContext);\n\n\n for (const givenItemPath of opts.itemPaths) {\n pathsToRequest[givenItemPath] = givenItemPath;\n\n // Don’t use CR alternative path for any path that is already explicitly in-CR.\n // TODO(perf): move out of the loop what’s possible, use map-reduce maybe too\n if (!opts.ignoreActiveCR && !givenItemPath.startsWith('/proposals') && activeChangeRequest?.id) {\n pathsToRequest[itemPathInCR(givenItemPath, activeChangeRequest.id)] = givenItemPath;\n }\n }\n\n const result = useObjectData({\n objectPaths: Object.keys(pathsToRequest),\n //nounLabel: 'register item(s)',\n }) as ValueHook<{ data: Record<string, Record<string, any> | null> }>;\n\n const itemData: Record<string, RegisterItem<any> | null> = {};\n for (const [alternativePath, itemPath] of Object.entries(pathsToRequest)) {\n const data = result.value.data[alternativePath]\n ?? result.value.data[itemPath]\n ?? null;\n if (isRegisterItem(data) || data === null) {\n itemData[itemPath] = data;\n }\n }\n\n // Convert dates\n // const parsedData: Record<string, RegisterItem<any> | null> = Object.entries(result.value.data).\n // map(([ path, data ]) => {\n // return {\n // [path]: data !== null\n // ? {\n // ...data,\n // dateAccepted: parseISO(data!.dateAccepted as unknown as string),\n // }\n // : null,\n // };\n // }).\n // reduce((p, c) => ({ ...p, ...c }), {});\n\n return {\n ...result,\n value: itemData,\n };\n }, [useObjectData, activeChangeRequestID]);\n\n\n // Register data\n\n const registerMetadataReq = useObjectData({\n objectPaths: [REGISTER_METADATA_FILENAME],\n nounLabel: 'register meta',\n }) as ValueHook<{ data: Record<string, Record<string, any> | null> }>;\n const maybeRegisterMetadata =\n registerMetadataReq.value.data?.[REGISTER_METADATA_FILENAME] ??\n (registerMetadataReq.isUpdating ? undefined : null);\n const registerMetadata = !maybeRegisterMetadata || isRegisterMetadata(maybeRegisterMetadata)\n ? maybeRegisterMetadata\n : null;\n\n const remoteUsername: string | undefined = useRemoteUsername().value.username;\n\n const stakeholder: RegisterStakeholder | undefined = useMemo((() => remoteUsername\n ? (registerMetadata?.stakeholders ?? []).\n find(s => s.gitServerUsername === remoteUsername)\n : undefined\n ), [remoteUsername, registerMetadata]);\n\n const getRelatedItemClassConfiguration = useMemo(\n (() => _getRelatedClass(itemClassConfiguration)),\n [itemClassConfiguration]);\n\n const [activeChangeRequestIDDebounced] = useDebounce(activeChangeRequestID, 200);\n const customViewsMemoized = useMemo((() => customViews ?? []), [customViews]); \n\n return (\n <BrowserCtx.Provider\n value={useMemo((() => ({\n stakeholder,\n registerMetadata,\n offline: remoteUsername === undefined ? true : undefined,\n\n subregisters,\n itemClasses: itemClassConfiguration,\n\n jumpTo: spawnTab,\n\n selectedRegisterItem,\n\n activeChangeRequestID: activeChangeRequestIDDebounced,\n setActiveChangeRequestID,\n\n useRegisterItemData,\n getRelatedItemClassConfiguration,\n customViews: customViewsMemoized,\n\n keyExpression,\n defaultSearchCriteria,\n getQuickSearchPredicate,\n })), [\n selectedRegisterItem,\n activeChangeRequestIDDebounced,\n stakeholder,\n registerMetadata,\n remoteUsername,\n subregisters,\n spawnTab,\n useRegisterItemData,\n customViewsMemoized,\n itemClassConfiguration,\n subregisters,\n keyExpression,\n defaultSearchCriteria,\n getQuickSearchPredicate,\n ])}>\n <ChangeRequestContextProvider changeRequestID={activeChangeRequestIDDebounced}>\n {children}\n </ChangeRequestContextProvider>\n </BrowserCtx.Provider>\n );\n}\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/views/index.tsx"],"names":[],"mappings":"AAAA,eAAe;AACf,8BAA8B;AAE9B,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,WAAW,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAC1E,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,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AAmB;YACnB,mBAAmB;YACnB,sBAAsB;YACtB,YAAY;YACZ,aAAa;YACb,qBAAqB;YACrB,uBAAuB;SACxB,CAAC;QACJ,IAAC,4BAA4B,IAAC,eAAe,EAAE,8BAA8B,IAC1E,QAAQ,CACoB,CACX,CACvB,CAAC;AACJ,CAAC,CAAA","sourcesContent":["/** @jsx jsx */\n/** @jsxFrag React.Fragment */\n\nimport React, { useContext, useCallback, useState, useMemo } from 'react';\nimport { useDebounce } from 'use-debounce';\nimport { jsx, css } from '@emotion/react';\n\nimport type { ValueHook } from '@riboseinc/paneron-extension-kit/types';\nimport { DatasetContext } from '@riboseinc/paneron-extension-kit/context';\nimport TabbedWorkspace, { type TabbedWorkspaceProps } from '@riboseinc/paneron-extension-kit/widgets/TabbedWorkspace';\nimport {\n makeContextProvider as makeTabbedWorkspaceContextProvider,\n TabbedWorkspaceContext,\n} from '@riboseinc/paneron-extension-kit/widgets/TabbedWorkspace/context';\n\nimport {\n type RegisterItem,\n type RegisterItemDataHook,\n type RegisterStakeholder,\n type RegistryViewProps,\n type InternalItemReference,\n isRegisterItem,\n isRegisterMetadata,\n} from '../types';\n\nimport { REGISTER_METADATA_FILENAME } from '../common';\n\nimport GenericRelatedItemView from './GenericRelatedItemView';\nimport { sidebarConfig, type SidebarID, sidebarIDs } from './sidebar';\nimport { BrowserCtx } from './BrowserCtx';\nimport { _getRelatedClass } from './util';\nimport RegisterHome from './detail/RegisterHome';\nimport protocolRegistry, { Protocols, type Protocol } from './protocolRegistry';\nimport {\n ChangeRequestContext,\n ChangeRequestContextProvider,\n} from './change-request/ChangeRequestContext';\nimport { useItemRef, itemPathInCR } from './itemPathUtils';\nexport { GenericRelatedItemView };\n\n\nconst TabbedWorkspaceContextProvider = makeTabbedWorkspaceContextProvider<Protocol, SidebarID>(\n 'Browse',\n sidebarIDs,\n protocolRegistry);\n\n\nexport const RegistryView: React.FC<RegistryViewProps> =\nfunction RegistryView (props) {\n return (\n <TabbedWorkspaceContextProvider stateKey=\"main-registry-view\">\n <BrowserCtxProvider {...props}>\n <RegistryWorkspace />\n </BrowserCtxProvider>\n </TabbedWorkspaceContextProvider>\n );\n};\n\n\nconst SIDEBAR_WIDTH_SETTING_NAME = 'registryMainSidebarWidthPixels'\n\n\nconst RegistryWorkspace: React.FC<Record<never, never>> =\nfunction RegistryWorkspace () {\n const { changeRequest: activeChangeRequest } = useContext(ChangeRequestContext);\n const { spawnTab } = useContext(TabbedWorkspaceContext);\n const { useSettings, updateSetting, useGlobalSettings } = useContext(DatasetContext);\n\n const globalMode: TabbedWorkspaceProps<any>['globalMode'] = useMemo(\n (() => activeChangeRequest\n ? {\n content: <>\n Viewing register as proposed — contents shown may differ from version in effect\n </>,\n intent: 'danger',\n onClick: () => spawnTab(`${Protocols.CHANGE_REQUEST}:/proposals/${activeChangeRequest.id}/main.yaml`),\n }\n : undefined),\n [activeChangeRequest?.id, spawnTab],\n );\n\n const { value: { settings } } = useSettings();\n const { value: { settings: globalSettings } } = useGlobalSettings();\n\n const stored = settings[SIDEBAR_WIDTH_SETTING_NAME];\n const sidebarWidth: number | undefined = stored && typeof stored === 'number'\n ? stored as number\n : undefined;\n\n return <TabbedWorkspace\n css={css`flex: 1 1 auto;`}\n sidebarConfig={sidebarConfig}\n sidebarPosition={globalSettings.sidebarPosition}\n sidebarIDs={[]}\n newTabPrompt={<RegisterHome />}\n globalMode={globalMode}\n sidebarWidth={sidebarWidth}\n onSidebarResize={useCallback((width) => {\n updateSetting({ key: SIDEBAR_WIDTH_SETTING_NAME, value: width })\n }, [updateSetting])}\n />\n};\n\n\nconst BrowserCtxProvider: React.FC<RegistryViewProps> = function BrowserCtxProvider ({\n itemClassConfiguration,\n subregisters,\n keyExpression,\n defaultSearchCriteria,\n getQuickSearchPredicate,\n customViews,\n children,\n}) {\n\n const { useObjectData, useRemoteUsername } = useContext(DatasetContext);\n const { focusedTabURI, spawnTab } = useContext(TabbedWorkspaceContext);\n\n\n // Active item\n\n const selectedItemPath: string | null = useMemo((() =>\n focusedTabURI && focusedTabURI.startsWith(`${Protocols.ITEM_DETAILS}:`)\n ? focusedTabURI.split(':')[1]\n : null\n ), [focusedTabURI]);\n\n const selectedItemRef: InternalItemReference | null = useItemRef(\n subregisters !== undefined,\n selectedItemPath);\n\n const maybeSelectedRegisterItemData: Record<string, any> | null = useObjectData({\n objectPaths: selectedItemPath ? [selectedItemPath] : [],\n }).value.data[selectedItemPath ?? ''];\n\n const selectedRegisterItem: BrowserCtx['selectedRegisterItem'] = useMemo((() =>\n selectedItemRef\n ? maybeSelectedRegisterItemData &&\n isRegisterItem(maybeSelectedRegisterItemData)\n ? {\n item: maybeSelectedRegisterItemData,\n ref: selectedItemRef,\n itemClass: itemClassConfiguration[selectedItemRef.classID],\n }\n : undefined\n : null\n ), [selectedItemRef, maybeSelectedRegisterItemData]);\n\n\n // Active CR\n\n const [ activeChangeRequestID, setActiveChangeRequestID ] = useState<string | null>(null);\n\n\n // TODO: Confirm that end extensions using RegistryKit can’t just import hooks\n // from RegistryKit and we really have to pass this to them via context\n // TODO: Why not use useObjectData directly? Since register item paths\n // are just object paths. The casting here is optimistic, since an item at given path\n // may not be a RegisterItem.\n const useRegisterItemData: RegisterItemDataHook = useCallback((opts) => {\n // Original item path mapped to its potential alternative path in current CR,\n // if the item is clarified or added in it.\n // TODO(perf): Access CR data and check whether the item is affected instead of blindly trying CR paths\n const pathsToRequest: Record<string, string> = {};\n\n const { changeRequest: activeChangeRequest } = useContext(ChangeRequestContext);\n\n\n for (const givenItemPath of opts.itemPaths) {\n pathsToRequest[givenItemPath] = givenItemPath;\n\n // Don’t use CR alternative path for any path that is already explicitly in-CR.\n // TODO(perf): move out of the loop what’s possible, use map-reduce maybe too\n if (!opts.ignoreActiveCR && !givenItemPath.startsWith('/proposals') && activeChangeRequest?.id) {\n pathsToRequest[itemPathInCR(givenItemPath, activeChangeRequest.id)] = givenItemPath;\n }\n }\n\n const result = useObjectData({\n objectPaths: Object.keys(pathsToRequest),\n //nounLabel: 'register item(s)',\n }) as ValueHook<{ data: Record<string, Record<string, any> | null> }>;\n\n const itemData: Record<string, RegisterItem<any> | null> = {};\n for (const [alternativePath, itemPath] of Object.entries(pathsToRequest)) {\n const data = result.value.data[alternativePath]\n ?? result.value.data[itemPath]\n ?? null;\n if (isRegisterItem(data) || data === null) {\n itemData[itemPath] = data;\n }\n }\n\n // Convert dates\n // const parsedData: Record<string, RegisterItem<any> | null> = Object.entries(result.value.data).\n // map(([ path, data ]) => {\n // return {\n // [path]: data !== null\n // ? {\n // ...data,\n // dateAccepted: parseISO(data!.dateAccepted as unknown as string),\n // }\n // : null,\n // };\n // }).\n // reduce((p, c) => ({ ...p, ...c }), {});\n\n return {\n ...result,\n value: itemData,\n };\n }, [useObjectData, activeChangeRequestID]);\n\n\n // Register data\n\n const registerMetadataReq = useObjectData({\n objectPaths: [REGISTER_METADATA_FILENAME],\n nounLabel: 'register meta',\n }) as ValueHook<{ data: Record<string, Record<string, any> | null> }>;\n const maybeRegisterMetadata =\n registerMetadataReq.value.data?.[REGISTER_METADATA_FILENAME] ??\n (registerMetadataReq.isUpdating ? undefined : null);\n const registerMetadata = !maybeRegisterMetadata || isRegisterMetadata(maybeRegisterMetadata)\n ? maybeRegisterMetadata\n : null;\n\n const remoteUsername: string | undefined = useRemoteUsername().value.username;\n\n const stakeholder: RegisterStakeholder | undefined = useMemo((() => remoteUsername\n ? (registerMetadata?.stakeholders ?? []).\n find(s => s.gitServerUsername === remoteUsername)\n : undefined\n ), [remoteUsername, registerMetadata]);\n\n const getRelatedItemClassConfiguration = useMemo(\n (() => _getRelatedClass(itemClassConfiguration)),\n [itemClassConfiguration]);\n\n const [activeChangeRequestIDDebounced] = useDebounce(activeChangeRequestID, 200);\n const customViewsMemoized = useMemo((() => customViews ?? []), [customViews]); \n\n return (\n <BrowserCtx.Provider\n value={useMemo((() => ({\n stakeholder,\n registerMetadata,\n offline: remoteUsername === undefined ? true : undefined,\n\n subregisters,\n itemClasses: itemClassConfiguration,\n\n jumpTo: spawnTab,\n\n selectedRegisterItem,\n\n activeChangeRequestID: activeChangeRequestIDDebounced,\n setActiveChangeRequestID,\n\n useRegisterItemData,\n getRelatedItemClassConfiguration,\n customViews: customViewsMemoized,\n\n keyExpression,\n defaultSearchCriteria,\n getQuickSearchPredicate,\n })), [\n selectedRegisterItem,\n activeChangeRequestIDDebounced,\n stakeholder,\n registerMetadata,\n remoteUsername,\n subregisters,\n spawnTab,\n useRegisterItemData,\n customViewsMemoized,\n itemClassConfiguration,\n subregisters,\n keyExpression,\n defaultSearchCriteria,\n getQuickSearchPredicate,\n ])}>\n <ChangeRequestContextProvider changeRequestID={activeChangeRequestIDDebounced}>\n {children}\n </ChangeRequestContextProvider>\n </BrowserCtx.Provider>\n );\n}\n"]}
package/views/util.d.ts CHANGED
@@ -2,7 +2,7 @@
2
2
  /** @jsxFrag React.Fragment */
3
3
  import React from 'react';
4
4
  import { type HelmetProps } from 'react-helmet';
5
- import { type FormGroupProps, type ButtonProps, type TagProps } from '@blueprintjs/core';
5
+ import { type CardProps, type FormGroupProps, type ButtonProps, type TagProps } from '@blueprintjs/core';
6
6
  import { type HelpTooltipProps } from '@riboseinc/paneron-extension-kit/widgets/HelpTooltip';
7
7
  import type { ItemClassConfiguration, RelatedItemClassConfiguration } from '../types';
8
8
  export { GenericRelatedItemView } from './GenericRelatedItemView';
@@ -30,15 +30,6 @@ export declare const Datestamp: React.FC<{
30
30
  /** Foramts given date as plain text. */
31
31
  export declare function formatDate(date: Date): string;
32
32
  export declare const _getRelatedClass: (classes: Record<string, ItemClassConfiguration<any>>) => (clsID: string) => RelatedItemClassConfiguration;
33
- /**
34
- * Suitable for use as tab contents for TabbedWorkspace.
35
- * Provides top bar with actions and main content.
36
- */
37
- export declare const TabContentsWithActions: React.FC<{
38
- actions: JSX.Element;
39
- main: JSX.Element;
40
- className?: string;
41
- }>;
42
33
  export declare type ClassificationEntry = TagProps & {
43
34
  tooltip?: HelpTooltipProps;
44
35
  };
@@ -58,16 +49,31 @@ export interface TabContentsWithHeaderProps {
58
49
  * 'card-grid' implies 'scrollable'.
59
50
  */
60
51
  layout?: undefined | 'card-grid' | 'scrollable';
52
+ layoutOptions?: Record<string, unknown>;
53
+ }
54
+ interface Grid extends TabContentsWithHeaderProps {
55
+ layout: 'card-grid';
56
+ layoutOptions?: {
57
+ gapPx?: number;
58
+ stretch?: boolean;
59
+ };
61
60
  }
62
- export declare const TabContentsWithHeader: React.FC<TabContentsWithHeaderProps>;
61
+ interface Scrollable extends TabContentsWithHeaderProps {
62
+ layout: 'scrollable';
63
+ layoutOptions?: never;
64
+ }
65
+ interface NoLayout extends TabContentsWithHeaderProps {
66
+ layout?: undefined;
67
+ layoutOptions?: never;
68
+ }
69
+ export declare const TabContentsWithHeader: React.FC<Grid | Scrollable | NoLayout>;
63
70
  export declare type ActionProps = ButtonProps & ({
64
71
  popup?: JSX.Element;
65
72
  tooltip?: string;
66
73
  });
67
74
  export declare const CardInGrid: React.FC<{
68
75
  description: string;
69
- className?: string;
70
- }>;
76
+ } & CardProps>;
71
77
  /** Useful in case of tab “card-grid” layout. */
72
78
  export declare const FormGroupAsCardInGrid: React.FC<FormGroupProps & {
73
79
  paddingPx?: number;
package/views/util.js CHANGED
@@ -11,7 +11,7 @@ Object.defineProperty(exports, "GenericRelatedItemView", {
11
11
  return _GenericRelatedItemView.GenericRelatedItemView;
12
12
  }
13
13
  });
14
- exports.FormGroupAsCardInGrid = exports.CardInGrid = exports.TabContentsWithHeader = exports.TabContentsWithActions = exports._getRelatedClass = exports.Datestamp = exports.PropertyDetailView = exports.RegisterHelmet = void 0;
14
+ exports.FormGroupAsCardInGrid = exports.CardInGrid = exports.TabContentsWithHeader = exports._getRelatedClass = exports.Datestamp = exports.PropertyDetailView = exports.RegisterHelmet = void 0;
15
15
 
16
16
  var _format = _interopRequireDefault(require("date-fns/format"));
17
17
 
@@ -138,40 +138,8 @@ const _getRelatedClass = classes => {
138
138
  };
139
139
  };
140
140
  };
141
- /**
142
- * Suitable for use as tab contents for TabbedWorkspace.
143
- * Provides top bar with actions and main content.
144
- */
145
-
146
141
 
147
142
  exports._getRelatedClass = _getRelatedClass;
148
-
149
- const TabContentsWithActions = function ({
150
- actions,
151
- main,
152
- className
153
- }) {
154
- return (0, _react2.jsx)("div", {
155
- css: (0, _react2.css)`
156
- position: absolute; inset: 0;
157
- display: flex; flex-flow: column nowrap;
158
- `,
159
- className: className
160
- }, (0, _react2.jsx)("div", {
161
- css: (0, _react2.css)`flex: 0; padding: 10px; display: flex; flex-flow: row wrap; gap: 10px;`
162
- }, actions), (0, _react2.jsx)("div", {
163
- css: (0, _react2.css)`
164
- position: relative;
165
- flex: 1;
166
- padding: 10px;
167
- overflow-y: auto;
168
- background: ${_core.Colors.GRAY5};
169
- .bp4-dark & { background: ${_core.Colors.DARK_GRAY2}; }
170
- `
171
- }, main));
172
- };
173
-
174
- exports.TabContentsWithActions = TabContentsWithActions;
175
143
  const paddingPx = 11;
176
144
 
177
145
  function findEnabledActions(props) {
@@ -183,10 +151,13 @@ const TabContentsWithHeader = function ({
183
151
  smallTitle,
184
152
  classification,
185
153
  actions,
186
- className,
187
154
  layout,
155
+ layoutOptions,
156
+ className,
188
157
  children
189
158
  }) {
159
+ var _a;
160
+
190
161
  const hasClassification = (classification !== null && classification !== void 0 ? classification : []).length > 0;
191
162
  const enabledActions = actions ? findEnabledActions(actions) : [];
192
163
  const hasActions = enabledActions.length > 0; // if (enabledActions.length === 1 && !enabledActions[0].intent) {
@@ -268,8 +239,8 @@ const TabContentsWithHeader = function ({
268
239
  display: flex;
269
240
  flex-flow: row wrap;
270
241
  align-content: flex-start;
271
- align-items: flex-start;
272
- gap: 10px;
242
+ ${(layoutOptions === null || layoutOptions === void 0 ? void 0 : layoutOptions.stretch) ? 'align-items: stretch;' : 'align-items: flex-start;'}
243
+ gap: ${(_a = layoutOptions === null || layoutOptions === void 0 ? void 0 : layoutOptions.gapPx) !== null && _a !== void 0 ? _a : 10}px;
273
244
  ` : ''}
274
245
  `
275
246
  }, children), hasActions ? (0, _react2.jsx)("div", {
@@ -324,13 +295,14 @@ const Action = function ({
324
295
  const CardInGrid = function ({
325
296
  description,
326
297
  className,
327
- children
298
+ ...props
328
299
  }) {
329
300
  return (0, _react2.jsx)(_core.Card, {
330
301
  css: (0, _react2.css)`border-radius: 5px;`,
331
302
  title: description,
332
- className: `${_core.Classes.ELEVATION_3} ${className !== null && className !== void 0 ? className : ''}`
333
- }, children);
303
+ className: !props.interactive ? `${_core.Classes.ELEVATION_3} ${className !== null && className !== void 0 ? className : ''}` : className,
304
+ ...props
305
+ });
334
306
  };
335
307
  /** Useful in case of tab “card-grid” layout. */
336
308
 
package/views/util.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"util.js","sourceRoot":"","sources":["../../src/views/util.tsx"],"names":[],"mappings":"AAAA,eAAe;AACf,8BAA8B;AAE9B,iCAAiC;AACjC,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAc,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAChD,OAAO,EAAE,MAAM,EAAoB,MAAM,cAAc,CAAC;AACxD,OAAO,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EACL,IAAI,EACJ,OAAO,EACP,SAAS,EACT,EAAE,EAAE,EAAE,EACN,MAAM,IAAI,UAAU,EACpB,WAAW,EACX,GAAG,EACH,MAAM,GACP,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,QAAQ,IAAI,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,cAAc,EAAE,MAAM,0CAA0C,CAAC;AAC1E,OAAO,WAAsC,MAAM,sDAAsD,CAAC;AAE1G,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAGlE;;;GAGG;AACH,MAAM,UAAU,oBAAoB,CAClC,GAAW,EACX,YAAoB,EAAE;IAEtB,OAAO,GAAG,CAAC,MAAM,GAA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AM,qBAAqB,GAClC,UAAU,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE;IAC/B,MAAM,UAAU,GAAG,SAAS,aAAT,SAAS,cAAT,SAAS,GAAI,EAAE,CAAC;IACnC,OAAO,CACL,IAAC,SAAS,OACJ,KAAK,EACT,GAAG,EAAE,GAAG,CAAA;;;;mBAIK,UAAU;;;;2BAIF,UAAU;;;;;iBAKpB,UAAU;;;;;;;;sBAQL,MAAM,CAAC,KAAK;oCACE,MAAM,CAAC,UAAU;OAC9C,EACD,SAAS,EAAE,OAAO,CAAC,WAAW,GAC9B,CACH,CAAC;AACJ,CAAC,CAAC","sourcesContent":["/** @jsx jsx */\n/** @jsxFrag React.Fragment */\n\n//import log from 'electron-log';\nimport format from 'date-fns/format';\nimport React, { memo, useContext } from 'react';\nimport { Helmet, type HelmetProps } from 'react-helmet';\nimport { css, jsx } from '@emotion/react';\nimport {\n Card,\n Classes,\n FormGroup, type FormGroupProps,\n H2, H4,\n Button as BaseButton, type ButtonProps,\n ButtonGroup,\n Tag, type TagProps,\n Colors,\n} from '@blueprintjs/core';\nimport { Popover2 as Popover } from '@blueprintjs/popover2';\nimport { DatasetContext } from '@riboseinc/paneron-extension-kit/context';\nimport HelpTooltip, { type HelpTooltipProps } from '@riboseinc/paneron-extension-kit/widgets/HelpTooltip';\nimport type { ItemClassConfiguration, RelatedItemClassConfiguration } from '../types';\nexport { GenericRelatedItemView } from './GenericRelatedItemView';\n\n\n/**\n * Get give string truncated & with ellipsis appended\n * if its length exceeds given number of characters.\n */\nexport function maybeEllipsizeString(\n str: string,\n maxLength: number = 20,\n): string {\n return str.length > maxLength\n ? `${str.slice(0, maxLength)}…`\n : str;\n}\n\n\nexport const RegisterHelmet: React.FC<HelmetProps> = memo(function (props) {\n const { title: datasetTitle } = useContext(DatasetContext);\n\n return (\n <Helmet\n titleTemplate={`%s in ${datasetTitle} register`}\n defaultTitle={`${datasetTitle} register`}>\n {props.children}\n </Helmet>\n );\n});\n\n\n/**\n * A wrapper to show property data with its label(s).\n */\nexport const PropertyDetailView: React.FC<FormGroupProps & {\n /** @deprecated use `label` instead */\n title?: FormGroupProps[\"label\"]\n /** @deprecated use `labelInfo` instead */\n secondaryTitle?: FormGroupProps[\"labelInfo\"]\n}> = function ({\n label, labelInfo,\n title, secondaryTitle,\n ...props }) {\n return (\n <FormGroup\n label={label || title ? `${label ?? title}:` : undefined}\n labelInfo={labelInfo ?? secondaryTitle}\n css={css`\n &, &.bp4-inline {\n label.bp4-label {\n /*\n * Since it’s in flex container, label expands to fill its width,\n * and due to the mechanics of how labels work (?)\n * any button (e.g., for deletion) within labelInfo\n * would responds to events of the entire label\n * (meaning you can hover space to the right of the label and labelInfo\n * and the button would still be clickable).\n * This makes the label not fill flex container width.\n */\n align-self: flex-start;\n\n font-weight: bold;\n line-height: unset;\n text-transform: capitalize;\n .bp4-text-muted {\n text-transform: none;\n }\n }\n }\n `}\n {...props}\n />\n );\n};\n\n\n/** Formats given date as a span with tooltip set to full ISO date & time. */\nexport const Datestamp: React.FC<{\n date: Date\n title?: string\n className?: string\n}> = function ({ date, title, className }) {\n const asString = formatDate(date);\n return <span\n className={className}\n title={`${title ? `${title}: ` : ''}${date?.toString() ?? 'N/A'}`}>\n {asString}\n </span>;\n};\n\n\n/** Foramts given date as plain text. */\nexport function formatDate(date: Date): string {\n try {\n return format(date, 'yyyy-MM-dd');\n } catch (e) {\n return `Invalid date (${e})`;\n }\n}\n\n\nexport const _getRelatedClass = (classes: Record<string, ItemClassConfiguration<any>>) => {\n return (clsID: string): RelatedItemClassConfiguration => {\n const cfg = classes[clsID];\n return {\n title: cfg.meta.title,\n // TODO: The itemView/listItemView inconsistency is annoying\n itemView: cfg.views.listItemView,\n };\n };\n};\n\n\n/**\n * Suitable for use as tab contents for TabbedWorkspace.\n * Provides top bar with actions and main content.\n */\nexport const TabContentsWithActions: React.FC<{\n actions: JSX.Element;\n main: JSX.Element;\n className?: string;\n}> = function ({ actions, main, className }) {\n return (\n <div css={css`\n position: absolute; inset: 0;\n display: flex; flex-flow: column nowrap;\n `} className={className}>\n <div css={css`flex: 0; padding: 10px; display: flex; flex-flow: row wrap; gap: 10px;`}>\n {actions}\n </div>\n <div css={css`\n position: relative;\n flex: 1;\n padding: 10px;\n overflow-y: auto;\n background: ${Colors.GRAY5};\n .bp4-dark & { background: ${Colors.DARK_GRAY2}; }\n `}>\n {main}\n </div>\n </div>\n );\n};\n\n\nexport type ClassificationEntry = TagProps & { tooltip?: HelpTooltipProps };\nexport interface TabContentsWithHeaderProps {\n title: JSX.Element | string\n smallTitle?: boolean\n classification?: ClassificationEntry[]\n actions?: (ActionProps | ActionProps[])[]\n tooltip?: HelpTooltipProps\n className?: string\n\n /**\n * CSS to apply to child contents wrapper div.\n *\n * If 'card-grid', children would be expected to be cards\n * (e.g., `FormGroupAsCardInGrid` or `CardInGrid`)\n *\n * 'card-grid' implies 'scrollable'.\n */\n layout?: undefined | 'card-grid' | 'scrollable'\n}\nconst paddingPx = 11;\nfunction findEnabledActions\n<T extends ButtonProps | ButtonProps[] = ButtonProps | ButtonProps[]>\n(props: T[]): ButtonProps[] {\n return props.map(props =>\n (props as ButtonProps[]).length !== undefined\n ? (props as ButtonProps[]).filter(p => !p.disabled)\n : !(props as ButtonProps).disabled\n ? props\n : []\n ).flat();\n}\nexport const TabContentsWithHeader: React.FC<TabContentsWithHeaderProps> =\nfunction ({ title, smallTitle, classification, actions, className, layout, children }) {\n const hasClassification = (classification ?? []).length > 0;\n\n const enabledActions = actions ? findEnabledActions(actions) : [];\n const hasActions = enabledActions.length > 0;\n\n // if (enabledActions.length === 1 && !enabledActions[0].intent) {\n // enabledActions[0].intent = 'primary';\n // }\n\n return (\n <div css={css`\n position: absolute; inset: 0;\n padding-top: ${paddingPx}px;\n ${hasActions ? `padding-bottom: ${paddingPx}px;` : ''}\n display: flex; flex-flow: column nowrap;\n gap: ${paddingPx}px;\n `} className={className}>\n {smallTitle\n ? <H4 css={css`margin: 0 ${paddingPx}px;`}>{title}</H4>\n : <H2 css={css`margin: 0 ${paddingPx}px;`}>{title}</H2>}\n {hasClassification\n ? <div css={css`\n flex: 0;\n margin: 0 ${paddingPx}px;\n display: flex;\n flex-flow: row wrap;\n gap: ${paddingPx}px;\n `}>\n {classification!.map((p, idx) =>\n <Tag\n key={idx}\n minimal\n {...p}\n large={!smallTitle}\n rightIcon={p.tooltip\n ? <HelpTooltip {...p.tooltip} />\n : undefined}\n />\n )}\n </div>\n : null}\n <div css={css`\n position: relative;\n flex: 1;\n overflow-y: auto;\n\n ${layout === undefined\n ? `\n > :only-child { position: absolute; inset: 0 }\n box-shadow: black 0 0 20px -10px;\n `\n : `\n padding: 0 10px;\n &::after, &::before {\n pointer-events: none;\n content: \" \";\n display: block;\n position: sticky;\n width: 100%;\n height: 1px;\n background: ${Colors.GRAY5};\n .bp4-dark & { background: ${Colors.DARK_GRAY2}; }\n z-index: 10;\n }\n &::before {\n top: 0;\n box-shadow: ${Colors.GRAY5} 0 -20px 20px 20px;\n .bp4-dark & {\n box-shadow: ${Colors.DARK_GRAY2} 0 -20px 20px 20px;\n }\n }\n &::after {\n bottom: 0;\n box-shadow: ${Colors.GRAY5} 0 20px 20px 20px;\n .bp4-dark & {\n box-shadow: ${Colors.DARK_GRAY2} 0 20px 20px 20px;\n }\n }\n `}\n\n ${layout === 'scrollable' || layout === 'card-grid'\n ? `\n background: ${Colors.GRAY5};\n .bp4-dark & { background: ${Colors.DARK_GRAY2}; }\n `\n : ''}\n\n ${layout === 'card-grid'\n ? `\n display: flex;\n flex-flow: row wrap;\n align-content: flex-start;\n align-items: flex-start;\n gap: 10px;\n `\n : ''}\n `}>\n {children}\n </div>\n\n {hasActions\n ? <div css={css`\n margin: 0 ${paddingPx}px;\n flex: 0; display: flex; flex-flow: row wrap; gap: ${paddingPx}px;\n `}>\n {actions!.map((props, idx) => {\n if (props.hasOwnProperty('length') && (props as ButtonProps[]).length !== undefined) {\n return (\n <ButtonGroup key={idx}>\n {(props as ButtonProps[]).map(p =>\n <Action {...p} />\n )}\n </ButtonGroup>\n );\n } else {\n return <Action key={idx} {...(props as ButtonProps)} />;\n }\n })}\n </div>\n : null}\n </div>\n );\n};\n\n\nexport type ActionProps = ButtonProps & ({ popup?: JSX.Element, tooltip?: string });\n/** Mostly a button, but with an optional popup. */\nconst Action: React.FC<ActionProps> = function ({ popup, tooltip, ...props }) {\n const btn = <BaseButton\n {...props}\n intent={props.disabled ? undefined : props.intent}\n onClick={props.disabled ? undefined : props.onClick}\n disabled={props.active ? false : props.disabled}\n title={tooltip}\n rightIcon={popup ? 'more' : undefined}\n />;\n\n if (popup && !props.disabled) {\n return (\n <Popover content={popup} placement=\"top\" minimal interactionKind=\"click\">\n {btn}\n </Popover>\n );\n } else {\n return btn;\n }\n};\n\n\nexport const CardInGrid: React.FC<{ description: string, className?: string }> = function ({ description, className, children }) {\n return (\n <Card\n css={css`border-radius: 5px;`}\n title={description}\n className={`${Classes.ELEVATION_3} ${className ?? ''}`}>\n {children}\n </Card>\n );\n};\n\n\n/** Useful in case of tab “card-grid” layout. */\nexport const FormGroupAsCardInGrid: React.FC<FormGroupProps & { paddingPx?: number }> =\nfunction ({ paddingPx, ...props }) {\n const paddingPx_ = paddingPx ?? 11;\n return (\n <FormGroup\n {...props}\n css={css`\n margin: 0;\n\n border-radius: 5px;\n padding: ${paddingPx_}px;\n\n > label.bp4-label {\n font-weight: bold;\n margin-bottom: ${paddingPx_}px;\n }\n > .bp4-form-content {\n display: flex;\n flex-flow: column nowrap;\n gap: ${paddingPx_}px;\n\n > .bp4-form-group {\n margin: 0;\n }\n }\n\n /* Note: these colors are picked to work with some form widgets, date input widget specifically. */\n background: ${Colors.WHITE};\n .bp4-dark & { background: ${Colors.DARK_GRAY3}; }\n `}\n className={Classes.ELEVATION_3}\n />\n );\n};\n"]}
1
+ {"version":3,"file":"util.js","sourceRoot":"","sources":["../../src/views/util.tsx"],"names":[],"mappings":"AAAA,eAAe;AACf,8BAA8B;AAE9B,iCAAiC;AACjC,O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,OAAO,QAAC,eAAe,EAAC,OAAO,IACrE,GAAG,CACI,CACX,CAAC;KACH;SAAM;QACL,OAAO,GAAG,CAAC;KACZ;AACH,CAAC,CAAC;AAGF,MAAM,CAAC,MAAM,UAAU,GACvB,UAAU,EAAE,WAAW,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE;IAC5C,OAAO,CACL,IAAC,IAAI,IACH,GAAG,EAAE,GAAG,CAAA,qBAAqB,EAC7B,KAAK,EAAE,WAAW,EAClB,SAAS,EAAE,CAAC,KAAK,CAAC,WAAW;YAC3B,CAAC,CAAC,GAAG,OAAO,CAAC,WAAW,IAAI,SAAS,aAAT,SAAS,cAAT,SAAS,GAAI,EAAE,EAAE;YAC7C,CAAC,CAAC,SAAS,KACT,KAAK,GACT,CACH,CAAC;AACJ,CAAC,CAAC;AAGF,gDAAgD;AAChD,MAAM,CAAC,MAAM,qBAAqB,GAClC,UAAU,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE;IAC/B,MAAM,UAAU,GAAG,SAAS,aAAT,SAAS,cAAT,SAAS,GAAI,EAAE,CAAC;IACnC,OAAO,CACL,IAAC,SAAS,OACJ,KAAK,EACT,GAAG,EAAE,GAAG,CAAA;;;;mBAIK,UAAU;;;;2BAIF,UAAU;;;;;iBAKpB,UAAU;;;;;;;;sBAQL,MAAM,CAAC,KAAK;oCACE,MAAM,CAAC,UAAU;OAC9C,EACD,SAAS,EAAE,OAAO,CAAC,WAAW,GAC9B,CACH,CAAC;AACJ,CAAC,CAAC","sourcesContent":["/** @jsx jsx */\n/** @jsxFrag React.Fragment */\n\n//import log from 'electron-log';\nimport format from 'date-fns/format';\nimport React, { memo, useContext } from 'react';\nimport { Helmet, type HelmetProps } from 'react-helmet';\nimport { css, jsx } from '@emotion/react';\nimport {\n Card, type CardProps,\n Classes,\n FormGroup, type FormGroupProps,\n H2, H4,\n Button as BaseButton, type ButtonProps,\n ButtonGroup,\n Tag, type TagProps,\n Colors,\n} from '@blueprintjs/core';\nimport { Popover2 as Popover } from '@blueprintjs/popover2';\nimport { DatasetContext } from '@riboseinc/paneron-extension-kit/context';\nimport HelpTooltip, { type HelpTooltipProps } from '@riboseinc/paneron-extension-kit/widgets/HelpTooltip';\nimport type { ItemClassConfiguration, RelatedItemClassConfiguration } from '../types';\nexport { GenericRelatedItemView } from './GenericRelatedItemView';\n\n\n/**\n * Get give string truncated & with ellipsis appended\n * if its length exceeds given number of characters.\n */\nexport function maybeEllipsizeString(\n str: string,\n maxLength: number = 20,\n): string {\n return str.length > maxLength\n ? `${str.slice(0, maxLength)}…`\n : str;\n}\n\n\nexport const RegisterHelmet: React.FC<HelmetProps> = memo(function (props) {\n const { title: datasetTitle } = useContext(DatasetContext);\n\n return (\n <Helmet\n titleTemplate={`%s in ${datasetTitle} register`}\n defaultTitle={`${datasetTitle} register`}>\n {props.children}\n </Helmet>\n );\n});\n\n\n/**\n * A wrapper to show property data with its label(s).\n */\nexport const PropertyDetailView: React.FC<FormGroupProps & {\n /** @deprecated use `label` instead */\n title?: FormGroupProps[\"label\"]\n /** @deprecated use `labelInfo` instead */\n secondaryTitle?: FormGroupProps[\"labelInfo\"]\n}> = function ({\n label, labelInfo,\n title, secondaryTitle,\n ...props }) {\n return (\n <FormGroup\n label={label || title ? `${label ?? title}:` : undefined}\n labelInfo={labelInfo ?? secondaryTitle}\n css={css`\n &, &.bp4-inline {\n label.bp4-label {\n /*\n * Since it’s in flex container, label expands to fill its width,\n * and due to the mechanics of how labels work (?)\n * any button (e.g., for deletion) within labelInfo\n * would responds to events of the entire label\n * (meaning you can hover space to the right of the label and labelInfo\n * and the button would still be clickable).\n * This makes the label not fill flex container width.\n */\n align-self: flex-start;\n\n font-weight: bold;\n line-height: unset;\n text-transform: capitalize;\n .bp4-text-muted {\n text-transform: none;\n }\n }\n }\n `}\n {...props}\n />\n );\n};\n\n\n/** Formats given date as a span with tooltip set to full ISO date & time. */\nexport const Datestamp: React.FC<{\n date: Date\n title?: string\n className?: string\n}> = function ({ date, title, className }) {\n const asString = formatDate(date);\n return <span\n className={className}\n title={`${title ? `${title}: ` : ''}${date?.toString() ?? 'N/A'}`}>\n {asString}\n </span>;\n};\n\n\n/** Foramts given date as plain text. */\nexport function formatDate(date: Date): string {\n try {\n return format(date, 'yyyy-MM-dd');\n } catch (e) {\n return `Invalid date (${e})`;\n }\n}\n\n\nexport const _getRelatedClass = (classes: Record<string, ItemClassConfiguration<any>>) => {\n return (clsID: string): RelatedItemClassConfiguration => {\n const cfg = classes[clsID];\n return {\n title: cfg.meta.title,\n // TODO: The itemView/listItemView inconsistency is annoying\n itemView: cfg.views.listItemView,\n };\n };\n};\n\n\n// /**\n// * Suitable for use as tab contents for TabbedWorkspace.\n// * Provides top bar with actions and main content.\n// */\n// export const TabContentsWithActions: React.FC<{\n// actions: JSX.Element;\n// main: JSX.Element;\n// gapPx?: number;\n// className?: string;\n// }> = function ({ actions, gapPx: _gapPx, main, className }) {\n// const gapPx = _gapPx ?? 10;\n// return (\n// <div css={css`\n// position: absolute; inset: 0;\n// display: flex; flex-flow: column nowrap;\n// `} className={className}>\n// <div css={css`flex: 0; padding: ${gapPx}px; display: flex; flex-flow: row wrap; gap: ${gapPx}px;`}>\n// {actions}\n// </div>\n// <div css={css`\n// position: relative;\n// flex: 1;\n// padding: ${gapPx}px;\n// overflow-y: auto;\n// background: ${Colors.GRAY5};\n// .bp4-dark & { background: ${Colors.DARK_GRAY2}; }\n// `}>\n// {main}\n// </div>\n// </div>\n// );\n// };\n\n\nexport type ClassificationEntry = TagProps & { tooltip?: HelpTooltipProps };\nexport interface TabContentsWithHeaderProps {\n title: JSX.Element | string\n smallTitle?: boolean\n classification?: ClassificationEntry[]\n actions?: (ActionProps | ActionProps[])[]\n tooltip?: HelpTooltipProps\n className?: string\n\n /**\n * CSS to apply to child contents wrapper div.\n *\n * If 'card-grid', children would be expected to be cards\n * (e.g., `FormGroupAsCardInGrid` or `CardInGrid`)\n *\n * 'card-grid' implies 'scrollable'.\n */\n layout?: undefined | 'card-grid' | 'scrollable'\n layoutOptions?: Record<string, unknown>\n}\ninterface Grid extends TabContentsWithHeaderProps {\n layout: 'card-grid'\n layoutOptions?: {\n gapPx?: number\n stretch?: boolean\n }\n}\ninterface Scrollable extends TabContentsWithHeaderProps {\n layout: 'scrollable'\n layoutOptions?: never\n}\ninterface NoLayout extends TabContentsWithHeaderProps {\n layout?: undefined\n layoutOptions?: never\n}\nconst paddingPx = 11;\nfunction findEnabledActions\n<T extends ButtonProps | ButtonProps[] = ButtonProps | ButtonProps[]>\n(props: T[]): ButtonProps[] {\n return props.map(props =>\n (props as ButtonProps[]).length !== undefined\n ? (props as ButtonProps[]).filter(p => !p.disabled)\n : !(props as ButtonProps).disabled\n ? props\n : []\n ).flat();\n}\nexport const TabContentsWithHeader: React.FC<Grid | Scrollable | NoLayout> =\nfunction ({ title, smallTitle, classification, actions, layout, layoutOptions, className, children }) {\n const hasClassification = (classification ?? []).length > 0;\n\n const enabledActions = actions ? findEnabledActions(actions) : [];\n const hasActions = enabledActions.length > 0;\n\n // if (enabledActions.length === 1 && !enabledActions[0].intent) {\n // enabledActions[0].intent = 'primary';\n // }\n\n return (\n <div css={css`\n position: absolute; inset: 0;\n padding-top: ${paddingPx}px;\n ${hasActions ? `padding-bottom: ${paddingPx}px;` : ''}\n display: flex; flex-flow: column nowrap;\n gap: ${paddingPx}px;\n `} className={className}>\n {smallTitle\n ? <H4 css={css`margin: 0 ${paddingPx}px;`}>{title}</H4>\n : <H2 css={css`margin: 0 ${paddingPx}px;`}>{title}</H2>}\n {hasClassification\n ? <div css={css`\n flex: 0;\n margin: 0 ${paddingPx}px;\n display: flex;\n flex-flow: row wrap;\n gap: ${paddingPx}px;\n `}>\n {classification!.map((p, idx) =>\n <Tag\n key={idx}\n minimal\n {...p}\n large={!smallTitle}\n rightIcon={p.tooltip\n ? <HelpTooltip {...p.tooltip} />\n : undefined}\n />\n )}\n </div>\n : null}\n <div css={css`\n position: relative;\n flex: 1;\n overflow-y: auto;\n\n ${layout === undefined\n ? `\n > :only-child { position: absolute; inset: 0 }\n box-shadow: black 0 0 20px -10px;\n `\n : `\n padding: 0 10px;\n &::after, &::before {\n pointer-events: none;\n content: \" \";\n display: block;\n position: sticky;\n width: 100%;\n height: 1px;\n background: ${Colors.GRAY5};\n .bp4-dark & { background: ${Colors.DARK_GRAY2}; }\n z-index: 10;\n }\n &::before {\n top: 0;\n box-shadow: ${Colors.GRAY5} 0 -20px 20px 20px;\n .bp4-dark & {\n box-shadow: ${Colors.DARK_GRAY2} 0 -20px 20px 20px;\n }\n }\n &::after {\n bottom: 0;\n box-shadow: ${Colors.GRAY5} 0 20px 20px 20px;\n .bp4-dark & {\n box-shadow: ${Colors.DARK_GRAY2} 0 20px 20px 20px;\n }\n }\n `}\n\n ${layout === 'scrollable' || layout === 'card-grid'\n ? `\n background: ${Colors.GRAY5};\n .bp4-dark & { background: ${Colors.DARK_GRAY2}; }\n `\n : ''}\n\n ${layout === 'card-grid'\n ? `\n display: flex;\n flex-flow: row wrap;\n align-content: flex-start;\n ${layoutOptions?.stretch\n ? 'align-items: stretch;'\n : 'align-items: flex-start;'}\n gap: ${layoutOptions?.gapPx ?? 10}px;\n `\n : ''}\n `}>\n {children}\n </div>\n\n {hasActions\n ? <div css={css`\n margin: 0 ${paddingPx}px;\n flex: 0; display: flex; flex-flow: row wrap; gap: ${paddingPx}px;\n `}>\n {actions!.map((props, idx) => {\n if (props.hasOwnProperty('length') && (props as ButtonProps[]).length !== undefined) {\n return (\n <ButtonGroup key={idx}>\n {(props as ButtonProps[]).map(p =>\n <Action {...p} />\n )}\n </ButtonGroup>\n );\n } else {\n return <Action key={idx} {...(props as ButtonProps)} />;\n }\n })}\n </div>\n : null}\n </div>\n );\n};\n\n\nexport type ActionProps = ButtonProps & ({ popup?: JSX.Element, tooltip?: string });\n/** Mostly a button, but with an optional popup. */\nconst Action: React.FC<ActionProps> = function ({ popup, tooltip, ...props }) {\n const btn = <BaseButton\n {...props}\n intent={props.disabled ? undefined : props.intent}\n onClick={props.disabled ? undefined : props.onClick}\n disabled={props.active ? false : props.disabled}\n title={tooltip}\n rightIcon={popup ? 'more' : undefined}\n />;\n\n if (popup && !props.disabled) {\n return (\n <Popover content={popup} placement=\"top\" minimal interactionKind=\"click\">\n {btn}\n </Popover>\n );\n } else {\n return btn;\n }\n};\n\n\nexport const CardInGrid: React.FC<{ description: string } & CardProps> =\nfunction ({ description, className, ...props }) {\n return (\n <Card\n css={css`border-radius: 5px;`}\n title={description}\n className={!props.interactive\n ? `${Classes.ELEVATION_3} ${className ?? ''}`\n : className}\n {...props}\n />\n );\n};\n\n\n/** Useful in case of tab “card-grid” layout. */\nexport const FormGroupAsCardInGrid: React.FC<FormGroupProps & { paddingPx?: number }> =\nfunction ({ paddingPx, ...props }) {\n const paddingPx_ = paddingPx ?? 11;\n return (\n <FormGroup\n {...props}\n css={css`\n margin: 0;\n\n border-radius: 5px;\n padding: ${paddingPx_}px;\n\n > label.bp4-label {\n font-weight: bold;\n margin-bottom: ${paddingPx_}px;\n }\n > .bp4-form-content {\n display: flex;\n flex-flow: column nowrap;\n gap: ${paddingPx_}px;\n\n > .bp4-form-group {\n margin: 0;\n }\n }\n\n /* Note: these colors are picked to work with some form widgets, date input widget specifically. */\n background: ${Colors.WHITE};\n .bp4-dark & { background: ${Colors.DARK_GRAY3}; }\n `}\n className={Classes.ELEVATION_3}\n />\n );\n};\n"]}
@@ -1,3 +0,0 @@
1
- import type { ExporterConstructor } from '@riboseinc/paneron-extension-kit/types/export-formats';
2
- declare const exporter: ExporterConstructor;
3
- export default exporter;
@@ -1,75 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
-
8
- var _common = require("../common");
9
-
10
- var _register = require("../types/register");
11
-
12
- var _page = _interopRequireDefault(require("./page"));
13
-
14
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
15
-
16
- //import type { RegisterItem } from '../types/item';
17
- //import { REGISTER_ITEM_QUERY } from '../views/itemQueryUtils';
18
- const exporter = async function* exportPublicSite({
19
- getObjectData,
20
- getMapReducedData,
21
- onProgress
22
- }) {
23
- const registerMeta = (await getObjectData({
24
- objectPaths: [`/${_common.REGISTER_METADATA_FILENAME}`]
25
- })).data[`/${_common.REGISTER_METADATA_FILENAME}`];
26
-
27
- if (!(0, _register.isRegisterMetadata)(registerMeta)) {
28
- throw new Error("Invalid register metadata found");
29
- } //const itemsByClass: { [clsID: string]: RegisterItem<any> } = await getMapReducedData({
30
- // chains: {
31
- // byClass: {
32
- // mapFunc: PUBLIC_ITEM_MAPPER,
33
- // reduceFunc: PUBLIC_ITEM_REDUCER,
34
- // },
35
- // },
36
- //});
37
- //const classIDs = Object.keys(itemsByClass);
38
-
39
-
40
- yield {
41
- '/hello.txt': enc.encode('hello'),
42
- '/index.html': enc.encode((0, _page.default)({
43
- title: "Register"
44
- })),
45
- '/register-meta.json': enc.encode(JSON.stringify(registerMeta))
46
- };
47
- };
48
-
49
- var _default = exporter;
50
- exports.default = _default;
51
- const enc = new TextEncoder(); // const PUBLIC_ITEM_PREDICATE = `
52
- // (${REGISTER_ITEM_QUERY}) && obj.status === 'valid'
53
- // `;
54
- //
55
- // /** Emits register items keyed by class ID. */
56
- //const PUBLIC_ITEM_MAPPER = `
57
- // if (${PUBLIC_ITEM_PREDICATE}) {
58
- // const pathWithoutSubregister = objPath.replace(/^\/subregisters/, '');
59
- // const components = pathWithoutSubregister.split('/');
60
- // const clsID = components[1];
61
- // emit([clsID, obj]);
62
- // }
63
- //`;
64
- //
65
- //const PUBLIC_ITEM_REDUCER = `
66
- // const acc = accumulator ?? {};
67
- //
68
- // // value[0] is item class ID
69
- // acc[value[0]] ??= [];
70
- //
71
- // // value[1] is full register item data
72
- // acc[value[0]].push(value[1]);
73
- //
74
- // return acc;
75
- //`;
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/site-builder/index.ts"],"names":[],"mappings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AC/B,kCAAkC;AAClC,EAAE;AACF,gCAAgC;AAChC,yBAAyB;AACzB,EAAE;AACF,0CAA0C;AAC1C,iCAAiC;AACjC,EAAE;AACF,eAAe;AACf,IAAI","sourcesContent":["import type { BufferDataset } from '@riboseinc/paneron-extension-kit/types/buffers';\nimport type { ExporterConstructor } from '@riboseinc/paneron-extension-kit/types/export-formats';\n//import type { RegisterItem } from '../types/item';\nimport { REGISTER_METADATA_FILENAME } from '../common'; \n//import { REGISTER_ITEM_QUERY } from '../views/itemQueryUtils';\nimport { isRegisterMetadata } from '../types/register';\nimport getHTML from './page';\n\n\nconst exporter: ExporterConstructor = async function * exportPublicSite({\n getObjectData,\n getMapReducedData,\n onProgress,\n}): AsyncGenerator<BufferDataset, void, void> {\n const registerMeta = (await getObjectData({\n objectPaths: [`/${REGISTER_METADATA_FILENAME}`],\n })).data[`/${REGISTER_METADATA_FILENAME}`];\n\n if (!isRegisterMetadata(registerMeta)) {\n throw new Error(\"Invalid register metadata found\");\n }\n\n //const itemsByClass: { [clsID: string]: RegisterItem<any> } = await getMapReducedData({\n // chains: {\n // byClass: {\n // mapFunc: PUBLIC_ITEM_MAPPER,\n // reduceFunc: PUBLIC_ITEM_REDUCER,\n // },\n // },\n //});\n\n //const classIDs = Object.keys(itemsByClass);\n\n yield {\n '/hello.txt': enc.encode('hello'),\n '/index.html': enc.encode(getHTML({ title: \"Register\" })),\n '/register-meta.json': enc.encode(JSON.stringify(registerMeta)),\n };\n};\n\n\nexport default exporter;\n\n\nconst enc = new TextEncoder();\n\n\n// const PUBLIC_ITEM_PREDICATE = `\n// (${REGISTER_ITEM_QUERY}) && obj.status === 'valid'\n// `;\n// \n// /** Emits register items keyed by class ID. */\n//const PUBLIC_ITEM_MAPPER = `\n// if (${PUBLIC_ITEM_PREDICATE}) {\n// const pathWithoutSubregister = objPath.replace(/^\\/subregisters/, '');\n// const components = pathWithoutSubregister.split('/');\n// const clsID = components[1];\n// emit([clsID, obj]);\n// }\n//`;\n//\n//const PUBLIC_ITEM_REDUCER = `\n// const acc = accumulator ?? {};\n//\n// // value[0] is item class ID\n// acc[value[0]] ??= [];\n//\n// // value[1] is full register item data\n// acc[value[0]].push(value[1]);\n//\n// return acc;\n//`;\n"]}
@@ -1,18 +0,0 @@
1
- export declare namespace JSX {
2
- type Element = string;
3
- interface IntrinsicElements {
4
- [el: string]: any;
5
- }
6
- }
7
- declare type AttributeValue = number | string | Date | boolean;
8
- export interface Children {
9
- children?: string | string[];
10
- }
11
- export interface CustomElementHandler {
12
- (attributes: Attributes & Children, contents: string[]): string;
13
- }
14
- export interface Attributes {
15
- [key: string]: AttributeValue;
16
- }
17
- declare function createElement(name: string | CustomElementHandler, attributes: Attributes & Children | undefined, ...contents: string[]): string;
18
- export { createElement as jsxs, createElement as jsx };
@@ -1,107 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.jsx = exports.jsxs = createElement;
7
- const capitalACharCode = 'A'.charCodeAt(0);
8
- const capitalZCharCode = 'Z'.charCodeAt(0);
9
-
10
- function isUpper(input, index) {
11
- const charCode = input.charCodeAt(index);
12
- return capitalACharCode <= charCode && capitalZCharCode >= charCode;
13
- }
14
-
15
- ;
16
-
17
- function toKebabCase(camelCased) {
18
- let kebabCased = '';
19
-
20
- for (let i = 0; i < camelCased.length; i++) {
21
- const prevUpperCased = i > 0 ? isUpper(camelCased, i - 1) : true;
22
- const currentUpperCased = isUpper(camelCased, i);
23
- const nextUpperCased = i < camelCased.length - 1 ? isUpper(camelCased, i + 1) : true;
24
-
25
- if (!prevUpperCased && currentUpperCased || currentUpperCased && !nextUpperCased) {
26
- kebabCased += '-';
27
- kebabCased += camelCased[i].toLowerCase();
28
- } else {
29
- kebabCased += camelCased[i];
30
- }
31
- }
32
-
33
- return kebabCased;
34
- }
35
-
36
- ;
37
-
38
- function escapeAttrNodeValue(value) {
39
- return value.replace(/(&)|(")|(\u00A0)/g, (_, amp, quote) => {
40
- if (amp) {
41
- return '&amp;';
42
- } else if (quote) {
43
- return '&quot;';
44
- } else {
45
- return '&nbsp;';
46
- }
47
- });
48
- }
49
-
50
- ;
51
-
52
- function getAttributeStringifier(attributes) {
53
- return function attributeToString(name) {
54
- const value = attributes[name];
55
- const formattedName = toKebabCase(name);
56
-
57
- const makeAttribute = value => `${formattedName}="${value}"`;
58
-
59
- if (value instanceof Date) {
60
- return makeAttribute(value.toISOString());
61
- } else switch (typeof value) {
62
- case 'boolean':
63
- if (value) {
64
- return formattedName;
65
- } else {
66
- return '';
67
- }
68
-
69
- default:
70
- return makeAttribute(escapeAttrNodeValue(value.toString()));
71
- }
72
- };
73
- }
74
-
75
- ;
76
-
77
- function attributesToString(attributes) {
78
- const spaceSeparated = Object.keys(attributes).filter(attribute => attribute !== 'children').map(getAttributeStringifier(attributes)).filter(attribute => attribute.length).join(' ');
79
-
80
- if (spaceSeparated.trim()) {
81
- return ` ${spaceSeparated}`;
82
- } else {
83
- return '';
84
- }
85
- }
86
-
87
- ;
88
-
89
- function contentsToString(contents) {
90
- var _a;
91
-
92
- return (_a = contents.map(elements => Array.isArray(elements) ? elements.join('\n') : elements).join('\n')) !== null && _a !== void 0 ? _a : '';
93
- }
94
-
95
- ;
96
-
97
- function createElement(name, attributes, ...contents) {
98
- if (typeof name === 'function') {
99
- return name(attributes !== null && attributes !== void 0 ? attributes : {}, contents);
100
- } else {
101
- const tagName = toKebabCase(name);
102
- const inner1 = contentsToString(contents);
103
- const inner2 = (attributes === null || attributes === void 0 ? void 0 : attributes.children) ? contentsToString(Array.isArray(attributes.children) ? attributes.children : [attributes.children]) : '';
104
- const inner = inner1 && inner2 ? `${inner1}\n${inner2}` : inner1 || inner2;
105
- return `<${tagName}${attributes ? attributesToString(attributes) : ''}>${inner}</${tagName}>`;
106
- }
107
- }
@@ -1 +0,0 @@
1
- {"version":3,"file":"jsx-runtime.js","sourceRoot":"","sources":["../../src/site-builder/jsx-runtime.ts"],"names":[],"mappings":"AAqBA,MAAM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,CAAC,kBAAkB,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,EAAE,IAAI,KAAK,KAAK,OAAO,GAAG,CAAC;KAC/F;AACH,CAAC;AAED,OAAO,EAAE,aAAa,IAAI,IAAI,EAAE,aAAa,IAAI,GAAG,EAAE,CAAA","sourcesContent":["export namespace JSX {\n export type Element = string;\n export interface IntrinsicElements {\n [el: string]: any\n }\n}\n\ntype AttributeValue = number | string | Date | boolean;\n\nexport interface Children {\n children?: string | string[];\n}\n\nexport interface CustomElementHandler {\n (attributes: Attributes & Children, contents: string[]): string;\n}\n\nexport interface Attributes {\n [key: string]: AttributeValue;\n}\n\nconst capitalACharCode = 'A'.charCodeAt(0);\nconst capitalZCharCode = 'Z'.charCodeAt(0);\n\nfunction isUpper(input: string, index: number) {\n const charCode = input.charCodeAt(index);\n return capitalACharCode <= charCode && capitalZCharCode >= charCode;\n};\n\nfunction toKebabCase(camelCased: string) {\n let kebabCased = '';\n for (let i = 0; i < camelCased.length; i++) {\n const prevUpperCased = i > 0 ? isUpper(camelCased, i - 1) : true;\n const currentUpperCased = isUpper(camelCased, i);\n const nextUpperCased = i < camelCased.length - 1 ? isUpper(camelCased, i + 1) : true;\n if (!prevUpperCased && currentUpperCased || currentUpperCased && !nextUpperCased) {\n kebabCased += '-';\n kebabCased += camelCased[i].toLowerCase();\n } else {\n kebabCased += camelCased[i];\n }\n }\n return kebabCased;\n};\n\nfunction escapeAttrNodeValue(value: string) {\n return (\n value.replace(/(&)|(\")|(\\u00A0)/g, (_, amp, quote) => {\n if (amp) { return '&amp;'; }\n else if (quote) { return '&quot;'; }\n else { return '&nbsp;'; }\n })\n );\n};\n\nfunction getAttributeStringifier(attributes: Attributes) {\n return function attributeToString(name: string): string {\n const value = attributes[name];\n const formattedName = toKebabCase(name);\n const makeAttribute = (value: string) => `${formattedName}=\"${value}\"`;\n\n if (value instanceof Date) {\n return makeAttribute(value.toISOString());\n } else switch (typeof value) {\n case 'boolean':\n if (value) {\n return formattedName;\n } else {\n return '';\n }\n default:\n return makeAttribute(escapeAttrNodeValue(value.toString()));\n }\n }\n};\n\nfunction attributesToString(attributes: Attributes) {\n const spaceSeparated = Object.keys(attributes).\n filter(attribute => attribute !== 'children').\n map(getAttributeStringifier(attributes)).\n filter(attribute => attribute.length).\n join(' ');\n if (spaceSeparated.trim()) {\n return ` ${spaceSeparated}`;\n } else {\n return '';\n }\n};\n\nfunction contentsToString(contents: string[]) {\n return contents.\n map(elements => Array.isArray(elements) ? elements.join('\\n') : elements).\n join('\\n') ?? ''\n};\n\nfunction createElement(\n name: string | CustomElementHandler,\n attributes: Attributes & Children | undefined,\n ...contents: string[]\n): string {\n if (typeof name === 'function') {\n return name(attributes ?? {}, contents);\n } else {\n const tagName = toKebabCase(name);\n const inner1 = contentsToString(contents);\n const inner2 = attributes?.children\n ? contentsToString(\n Array.isArray(attributes.children)\n ? attributes.children\n : [attributes.children]\n )\n : '';\n const inner = inner1 && inner2\n ? `${inner1}\\n${inner2}`\n : inner1 || inner2;\n return `<${tagName}${attributes ? attributesToString(attributes) : ''}>${inner}</${tagName}>`;\n }\n}\n\nexport { createElement as jsxs, createElement as jsx }\n"]}
@@ -1,6 +0,0 @@
1
- /** @jsxImportSource . */
2
- interface PageMeta {
3
- title: string;
4
- }
5
- export default function getHTML(meta: PageMeta): string;
6
- export {};
@@ -1,24 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = getHTML;
7
-
8
- var _jsxRuntime = require("./jsx-runtime");
9
-
10
- function getHTML(meta) {
11
- return (0, _jsxRuntime.jsxs)("html", {
12
- children: [(0, _jsxRuntime.jsx)("head", {
13
- children: (0, _jsxRuntime.jsx)("title", {
14
- children: meta.title
15
- })
16
- }), (0, _jsxRuntime.jsx)("body", {
17
- children: (0, _jsxRuntime.jsx)("div", {
18
- children: "test"
19
- })
20
- })]
21
- });
22
- }
23
-
24
- ;
@@ -1 +0,0 @@
1
- {"version":3,"file":"page.js","sourceRoot":"","sources":["../../src/site-builder/page.tsx"],"names":[],"mappings":";AAQA,MAAM,CAAC,OAAO,UAAU,OAAO,CAAC,IAAc;IAC5C,OAAO,2BACL,yBACE,0BAAQ,IAAI,CAAC,KAAK,GAAS,GACtB,EACP,yBACE,iCAAe,GACV,IACF,CAAC;AACV,CAAC;AAAA,CAAC","sourcesContent":["/** @jsxImportSource . */\n\n\ninterface PageMeta {\n title: string\n}\n\n\nexport default function getHTML(meta: PageMeta): string {\n return <html>\n <head>\n <title>{meta.title}</title>\n </head>\n <body>\n <div>test</div>\n </body>\n </html>;\n};\n\n// XXX: Write `getHead()`\n"]}
@@ -1,3 +0,0 @@
1
- /**
2
- * Context pertaining to given register item changes within active proposal, if any.
3
- */
@@ -1,4 +0,0 @@
1
- "use strict";
2
- /**
3
- * Context pertaining to given register item changes within active proposal, if any.
4
- */
@@ -1 +0,0 @@
1
- {"version":3,"file":"ChangeProposalContext.js","sourceRoot":"","sources":["../../../src/views/change-request/ChangeProposalContext.tsx"],"names":[],"mappings":";AAAA;;GAEG","sourcesContent":["/**\n * Context pertaining to given register item changes within active proposal, if any.\n */\n"]}
File without changes
@@ -1 +0,0 @@
1
- "use strict";
@@ -1 +0,0 @@
1
- {"version":3,"file":"State.js","sourceRoot":"","sources":["../../../src/views/change-request/State.tsx"],"names":[],"mappings":"","sourcesContent":[""]}