@riboseinc/paneron-registry-kit 2.1.2 → 2.1.4
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/package.json +1 -1
- package/types/proposal.d.ts +3 -1
- package/types/proposal.js.map +1 -1
- package/views/detail/RegisterHome/index.js +73 -0
- package/views/detail/RegisterHome/index.js.map +1 -1
- package/views/sidebar/{Export/index.js → ExportImport/ExportOptions.js} +11 -6
- package/views/sidebar/ExportImport/ExportOptions.js.map +1 -0
- package/views/sidebar/ExportImport/ImportOptions.d.ts +4 -0
- package/views/sidebar/ExportImport/ImportOptions.js +19 -0
- package/views/sidebar/ExportImport/ImportOptions.js.map +1 -0
- package/views/sidebar/ExportImport/index.d.ts +3 -0
- package/views/sidebar/ExportImport/index.js +23 -0
- package/views/sidebar/ExportImport/index.js.map +1 -0
- package/views/sidebar/index.js +26 -27
- package/views/sidebar/index.js.map +1 -1
- package/site-builder/index.d.ts +0 -6
- package/site-builder/index.js +0 -29
- package/site-builder/index.js.map +0 -1
- package/site-builder/jsx-runtime.d.ts +0 -18
- package/site-builder/jsx-runtime.js +0 -107
- package/site-builder/jsx-runtime.js.map +0 -1
- package/site-builder/page.d.ts +0 -6
- package/site-builder/page.js +0 -22
- package/site-builder/page.js.map +0 -1
- package/views/change-request/ChangeProposalContext.d.ts +0 -3
- package/views/change-request/ChangeProposalContext.js +0 -4
- package/views/change-request/ChangeProposalContext.js.map +0 -1
- package/views/sidebar/Export/index.js.map +0 -1
- /package/views/sidebar/{Export/index.d.ts → ExportImport/ExportOptions.d.ts} +0 -0
package/package.json
CHANGED
package/types/proposal.d.ts
CHANGED
|
@@ -6,7 +6,9 @@ export declare const DISPOSITION_OPTIONS: readonly ["withdrawn", "accepted", "no
|
|
|
6
6
|
* Item paths in proposal set must start with a slash
|
|
7
7
|
* and will be treated relative to dataset root.
|
|
8
8
|
* Object paths should conform to registry item path shape
|
|
9
|
-
* of
|
|
9
|
+
* of `/<classID>/<itemID>.yaml`.
|
|
10
|
+
* (the `[/subregisterID]/<classID>/<itemID>.yaml` is acceptable
|
|
11
|
+
* but deprecated, as subregisters are deprecated).
|
|
10
12
|
*/
|
|
11
13
|
export declare type ProposalSet = {
|
|
12
14
|
[objectPath: string]: ChangeProposal;
|
package/types/proposal.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"proposal.js","sourceRoot":"","sources":["../../src/types/proposal.ts"],"names":[],"mappings":"AAIA,MAAM,CAAC,MAAM,iBAAiB,GAAG;IAC/B,SAAS;IACT,WAAW;IACX,OAAO;CACC,CAAC;AAEX,MAAM,CAAC,MAAM,mBAAmB,GAAG;IACjC,WAAW;IACX,UAAU;IACV,aAAa;CACL,CAAC;
|
|
1
|
+
{"version":3,"file":"proposal.js","sourceRoot":"","sources":["../../src/types/proposal.ts"],"names":[],"mappings":"AAIA,MAAM,CAAC,MAAM,iBAAiB,GAAG;IAC/B,SAAS;IACT,WAAW;IACX,OAAO;CACC,CAAC;AAEX,MAAM,CAAC,MAAM,mBAAmB,GAAG;IACjC,WAAW;IACX,UAAU;IACV,aAAa;CACL,CAAC;AA6CX,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B,UAAU;IACV,eAAe;IACf,WAAW;CACH,CAAC;AAqBX,MAAM,CAAC,MAAM,eAAe,GAAG;IAC7B,cAAc;IACd,YAAY;IACZ,cAAc;CACN,CAAC","sourcesContent":["import type { RegisterStakeholder } from './stakeholder';\nimport type { Citation } from './util';\n\n\nexport const DECISION_STATUSES = [\n 'pending',\n 'tentative',\n 'final',\n] as const;\n\nexport const DISPOSITION_OPTIONS = [\n 'withdrawn',\n 'accepted',\n 'notAccepted',\n] as const;\n\n/**\n * Item paths in proposal set must start with a slash\n * and will be treated relative to dataset root.\n * Object paths should conform to registry item path shape\n * of `/<classID>/<itemID>.yaml`.\n * (the `[/subregisterID]/<classID>/<itemID>.yaml` is acceptable\n * but deprecated, as subregisters are deprecated).\n */\nexport type ProposalSet = {\n [objectPath: string]: ChangeProposal\n}\n\n/** A change request, per ISO 19135-1 model. */\nexport interface ChangeRequest {\n // Supplied by sponsor\n /** Justification for the change */\n justification: string\n\n proposals: ProposalSet\n\n // Enforced by the system\n id: string\n timeStarted: Date\n timeProposed?: Date\n timeDisposed?: Date\n sponsor: RegisterStakeholder\n\n // Supplied by register manager\n status: typeof DECISION_STATUSES[number] // Default filled in by the system but changeable\n disposition?: typeof DISPOSITION_OPTIONS[number]\n controlBodyDecisionEvent?: string\n controlBodyNotes?: string\n registerManagerNotes?: string\n}\n\n\n/**\n * Change request properties for the purposes of drafting.\n * (`controlBodyNotes` is in question.)\n */\nexport type DraftChangeRequest =\n Pick<ChangeRequest, 'proposals' | 'justification' | 'controlBodyNotes' | 'sponsor'>;\n\nexport const PROPOSAL_TYPES = [\n 'addition',\n 'clarification',\n 'amendment',\n] as const;\n\ninterface BaseProposal {\n //itemID: RegisterItemID\n disposition?: 'accepted' | 'notAccepted'\n type: typeof PROPOSAL_TYPES[number]\n sources?: Citation[]\n}\n\nexport interface Addition extends BaseProposal {\n type: 'addition'\n ///** New item data. */\n //payload: Payload\n}\n\nexport interface Clarification extends BaseProposal {\n type: 'clarification'\n ///** Updated item data */\n //payload: Payload\n}\n\nexport const AMENDMENT_TYPES = [\n 'supersession',\n 'retirement',\n 'invalidation',\n] as const;\ninterface BaseAmendment extends BaseProposal {\n type: 'amendment'\n amendmentType: typeof AMENDMENT_TYPES[number]\n}\nexport interface Retirement extends BaseAmendment {\n amendmentType: 'retirement'\n}\nexport interface Supersession extends BaseAmendment {\n amendmentType: 'supersession'\n supersedingItemIDs: string[]\n}\nexport interface Invalidation extends BaseAmendment {\n amendmentType: 'invalidation'\n}\nexport type Amendment = Supersession | Retirement | Invalidation\n\nexport type ChangeProposal = Amendment | Clarification | Addition\n"]}
|
|
@@ -21,6 +21,10 @@ var _RegisterStakeholder = require("../../RegisterStakeholder");
|
|
|
21
21
|
|
|
22
22
|
var _objectChangeset = require("../../change-request/objectChangeset");
|
|
23
23
|
|
|
24
|
+
var _cr = require("../../../types/cr");
|
|
25
|
+
|
|
26
|
+
var _item = require("../../../types/item");
|
|
27
|
+
|
|
24
28
|
var _protocolRegistry = require("../../protocolRegistry");
|
|
25
29
|
|
|
26
30
|
var _itemPathUtils = require("../../itemPathUtils");
|
|
@@ -46,6 +50,7 @@ const RegisterHome = function () {
|
|
|
46
50
|
offline
|
|
47
51
|
} = (0, _react.useContext)(_BrowserCtx.BrowserCtx);
|
|
48
52
|
const {
|
|
53
|
+
requestFileFromFilesystem,
|
|
49
54
|
makeRandomID,
|
|
50
55
|
updateObjects,
|
|
51
56
|
performOperation
|
|
@@ -75,6 +80,70 @@ const RegisterHome = function () {
|
|
|
75
80
|
}
|
|
76
81
|
}
|
|
77
82
|
|
|
83
|
+
async function getCRImportChangeset() {
|
|
84
|
+
var _a, _b;
|
|
85
|
+
|
|
86
|
+
if (!requestFileFromFilesystem) {
|
|
87
|
+
throw new Error("Cannot request file from filesystem");
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
const data = await requestFileFromFilesystem({
|
|
91
|
+
prompt: "Select one register proposal JSON file",
|
|
92
|
+
filters: [{
|
|
93
|
+
name: "JSON files",
|
|
94
|
+
extensions: ['.json']
|
|
95
|
+
}]
|
|
96
|
+
});
|
|
97
|
+
const fileData = Object.values(data)[0];
|
|
98
|
+
|
|
99
|
+
if (!fileData) {
|
|
100
|
+
throw new Error("No file was selected");
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
const crID = (_a = fileData.proposalDraft) === null || _a === void 0 ? void 0 : _a.id;
|
|
104
|
+
|
|
105
|
+
if (!crID) {
|
|
106
|
+
throw new Error("Invalid file format");
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
if (fileData.proposalDraft.state !== _cr.State.DRAFT) {
|
|
110
|
+
throw new Error(`Invalid proposal state (must be ${_cr.State.DRAFT})`);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
const crPath = (0, _itemPathUtils.crIDToCRPath)(crID);
|
|
114
|
+
const changeset = {
|
|
115
|
+
[crPath]: {
|
|
116
|
+
oldValue: null,
|
|
117
|
+
newValue: fileData.proposalDraft
|
|
118
|
+
}
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
for (const [itemPath, itemPayload] of Object.entries((_b = fileData.itemPayloads) !== null && _b !== void 0 ? _b : {})) {
|
|
122
|
+
if (!(0, _item.isRegisterItem)(itemPayload)) {
|
|
123
|
+
throw new Error("Invalid register item data found in proposal payloads");
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
changeset[(0, _itemPathUtils.itemPathInCR)(itemPath, crID)] = {
|
|
127
|
+
oldValue: null,
|
|
128
|
+
newValue: itemPayload
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
return [changeset, crID];
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
async function handleImportProposal() {
|
|
136
|
+
const [objectChangeset, crID] = await performOperation('reading proposal data', getCRImportChangeset)();
|
|
137
|
+
await performOperation('creating proposal', updateObjects !== null && updateObjects !== void 0 ? updateObjects : async () => {
|
|
138
|
+
throw new Error("Read-only dataset");
|
|
139
|
+
})({
|
|
140
|
+
commitMessage: "import proposal",
|
|
141
|
+
objectChangeset
|
|
142
|
+
});
|
|
143
|
+
setNewProposalIdea('');
|
|
144
|
+
spawnTab(`${_protocolRegistry.Protocols.CHANGE_REQUEST}:${(0, _itemPathUtils.crIDToCRPath)(crID)}`);
|
|
145
|
+
}
|
|
146
|
+
|
|
78
147
|
const menu = (0, _react2.jsx)(_core.Menu, {
|
|
79
148
|
css: (0, _react2.css)`margin: 10px;`
|
|
80
149
|
}, (0, _react2.jsx)(_core.MenuDivider, {
|
|
@@ -103,6 +172,10 @@ const RegisterHome = function () {
|
|
|
103
172
|
icon: "tick"
|
|
104
173
|
})
|
|
105
174
|
})), (0, _react2.jsx)(_core.MenuItem, {
|
|
175
|
+
text: "Import proposal",
|
|
176
|
+
icon: "import",
|
|
177
|
+
onClick: handleImportProposal
|
|
178
|
+
}), (0, _react2.jsx)(_core.MenuItem, {
|
|
106
179
|
text: "View register metadata",
|
|
107
180
|
icon: "properties",
|
|
108
181
|
onClick: () => spawnTab(_protocolRegistry.Protocols.REGISTER_META)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/views/detail/RegisterHome/index.tsx"],"names":[],"mappings":"AAAA,eAAe;AACf,8BAA8B;AAE9B,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACpD,wCAAwC;AACxC,OAAO,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,EAAE,aAAa,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AACrH,OAAO,EAAE,cAAc,EAAE,MAAM,0CAA0C,CAAC;AAC1E,OAAO,EAAE,sBAAsB,EAAE,MAAM,kEAAkE,CAAC;AAC1G,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,wBAAwB,EAAE,MAAM,2BAA2B,CAAC;AACrE,OAAO,EAAE,oBAAoB,EAAE,MAAM,sCAAsC,CAAC;AAE5E,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAGnD,MAAM,YAAY,GAClB;;IACE,MAAM,EAAE,QAAQ,EAAE,GAAG,UAAU,CAAC,sBAAsB,CAAC,CAAC;IACxD,MAAM,EAAE,WAAW,EAAE,gBAAgB,EAAE,WAAW,EAAE,OAAO,EAAE,GAAG,UAAU,CAAC,UAAU,CAAC,CAAC;IACvF,MAAM,EAAE,YAAY,EAAE,aAAa,EAAE,gBAAgB,EAAE,GAAG,UAAU,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OAAO,EAAE,GAAG,EAAE,CAAC,QAAQ,CAAC,SAAS,CAAC,aAAa,CAAC,GAChD,CACG,CACR,CAAC;IAEF,MAAM,KAAK,GAAG,IAAC,OAAO,IAAC,MAAM,EAAC,SAAS,EAAC,GAAG,EAAE,GAAG,CAAA,mBAAmB,IAChE,WAAW;QACV,CAAC,CAAC;;YAA+B,wBAAwB,CAAC,WAAW,CAAC;gBAAK;QAC3E,CAAC,CAAC,OAAO;YACP,CAAC,CAAC,4KAGiC;YACnC,CAAC,CAAC,kIAGG,CACD,CAAA;IAEV,MAAM,QAAQ,GAAG,gBAAgB;QAC/B,CAAC,CAAC,IAAC,aAAa,IACZ,KAAK,EAAE,cAAc,gBAAgB,CAAC,IAAI,EAAE,EAC5C,WAAW,EAAE;gBACV,KAAK;gBACL,IAAI,CACJ,GACH;QACJ,CAAC,CAAC,gBAAgB,KAAK,SAAS;YAC9B,CAAC,CAAC,IAAC,aAAa,IACZ,IAAI,EAAE,IAAC,OAAO,OAAG,EACjB,WAAW,EAAC,oCAA+B,GAC3C;YACJ,CAAC,CAAC,IAAC,aAAa,IACZ,IAAI,EAAC,cAAc,EACnB,KAAK,EAAC,0CAA0C,EAChD,WAAW,EAAE,0BACV,IAAI,CACJ,GACH,CAAC;IAET,OAAO,QAAQ,CAAC;AAClB,CAAC,CAAA;AAED,eAAe,YAAY,CAAC","sourcesContent":["/** @jsx jsx */\n/** @jsxFrag React.Fragment */\n\nimport React, { useContext, useState } from 'react';\n//import { Helmet } from 'react-helmet';\nimport { jsx, css } from '@emotion/react';\nimport { Menu, MenuDivider, MenuItem, InputGroup, Button, NonIdealState, Spinner, Callout } from '@blueprintjs/core';\nimport { DatasetContext } from '@riboseinc/paneron-extension-kit/context';\nimport { TabbedWorkspaceContext } from '@riboseinc/paneron-extension-kit/widgets/TabbedWorkspace/context';\nimport { BrowserCtx } from '../../BrowserCtx';\nimport { registerStakeholderPlain } from '../../RegisterStakeholder';\nimport { newCRObjectChangeset } from '../../change-request/objectChangeset';\n\nimport { Protocols } from '../../protocolRegistry';\nimport { crIDToCRPath } from '../../itemPathUtils';\n\n\nconst RegisterHome: React.VoidFunctionComponent<Record<never, never>> =\nfunction () {\n const { spawnTab } = useContext(TabbedWorkspaceContext);\n const { customViews, registerMetadata, stakeholder, offline } = useContext(BrowserCtx);\n const { makeRandomID, updateObjects, performOperation } = useContext(DatasetContext);\n\n const [ newProposalIdea, setNewProposalIdea ] = useState<string>('');\n\n const registerVersion = registerMetadata?.version;\n const canCreateCR = (\n stakeholder &&\n stakeholder.role &&\n stakeholder.gitServerUsername?.trim() !== '' &&\n makeRandomID &&\n updateObjects &&\n (registerVersion?.id ?? '').trim() !== '');\n\n async function createCR(justification: string): Promise<string> {\n if (canCreateCR) {\n const id = await makeRandomID();\n await updateObjects({\n commitMessage: \"start new proposal\",\n objectChangeset: newCRObjectChangeset(\n id,\n justification,\n registerVersion!,\n stakeholder.gitServerUsername!,\n ),\n });\n return id;\n } else {\n throw new Error(\"Unable to create proposal: read-only dataset\");\n }\n }\n\n async function handleNewProposal() {\n if (newProposalIdea) {\n const crID = await performOperation(\"creating proposal\", createCR)(newProposalIdea);\n setNewProposalIdea('');\n spawnTab(`${Protocols.CHANGE_REQUEST}:${crIDToCRPath(crID)}`);\n }\n }\n\n const menu = (\n <Menu css={css`margin: 10px;`}>\n <MenuDivider title=\"Quick links\" />\n {customViews.map((cv, _) => \n <MenuItem\n key={cv.id}\n text={cv.label}\n title={cv.description}\n icon={cv.icon}\n onClick={() => spawnTab(`${Protocols.CUSTOM_VIEW}:${cv.id}/index`)}\n />\n )}\n {customViews.length > 0 ? <MenuDivider /> : null}\n\n <MenuItem\n text={`Propose a change to version ${registerMetadata?.version?.id ?? '(missing)'}`}\n disabled={!canCreateCR}\n icon=\"lightbulb\"\n title={canCreateCR\n ? \"A blank proposal will be created and opened in a new tab.\"\n : undefined}>\n <InputGroup\n value={newProposalIdea || undefined}\n placeholder=\"Your idea…\"\n title=\"Justification draft (you can change this later)\"\n onChange={evt => setNewProposalIdea(evt.currentTarget.value)}\n rightElement={\n <Button\n small\n intent={newProposalIdea ? 'primary': undefined}\n disabled={!newProposalIdea}\n onClick={handleNewProposal}\n icon=\"tick\"\n />\n }\n />\n </MenuItem>\n <MenuItem\n text=\"View register metadata\"\n icon=\"properties\"\n onClick={() => spawnTab(Protocols.REGISTER_META)}\n />\n </Menu>\n );\n\n const intro = <Callout intent=\"primary\" css={css`text-align: left;`}>\n {stakeholder\n ? <>You can create proposals as {registerStakeholderPlain(stakeholder)}.</>\n : offline\n ? <>\n Because this repository is offline (no remote configured),\n and remote username is currently required for proposal,\n you cannot create proposals.</>\n : <>\n Since your remote username is not in the list of stakeholders,\n you cannot create proposals currently.\n </>}\n </Callout>\n\n const greeting = registerMetadata\n ? <NonIdealState\n title={`Welcome to ${registerMetadata.name}`}\n description={<>\n {intro}\n {menu}\n </>}\n />\n : registerMetadata === undefined\n ? <NonIdealState\n icon={<Spinner />}\n description=\"Loading register information…\"\n />\n : <NonIdealState\n icon=\"heart-broken\"\n title=\"Register metadata is missing or invalid.\"\n description={<>\n {menu}\n </>}\n />;\n\n return greeting;\n}\n\nexport default RegisterHome;\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/views/detail/RegisterHome/index.tsx"],"names":[],"mappings":"AAAA,eAAe;AACf,8BAA8B;AAE9B,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACpD,wCAAwC;AACxC,OAAO,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,EAAE,aAAa,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AACrH,OAAO,EAAE,cAAc,EAAE,MAAM,0CAA0C,CAAC;AAC1E,OAAO,EAAE,sBAAsB,EAAE,MAAM,kEAAk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AE,iBAAiB,EAC1B,IAAI,EAAC,MAAM,GACX,GAEJ,CACO;QACX,IAAC,QAAQ,IACP,IAAI,EAAC,iBAAiB,EACtB,IAAI,EAAC,QAAQ,EACb,OAAO,EAAE,oBAAoB,GAC7B;QACF,IAAC,QAAQ,IACP,IAAI,EAAC,wBAAwB,EAC7B,IAAI,EAAC,YAAY,EACjB,OAAO,EAAE,GAAG,EAAE,CAAC,QAAQ,CAAC,SAAS,CAAC,aAAa,CAAC,GAChD,CACG,CACR,CAAC;IAEF,MAAM,KAAK,GAAG,IAAC,OAAO,IAAC,MAAM,EAAC,SAAS,EAAC,GAAG,EAAE,GAAG,CAAA,mBAAmB,IAChE,WAAW;QACV,CAAC,CAAC;;YAA+B,wBAAwB,CAAC,WAAW,CAAC;gBAAK;QAC3E,CAAC,CAAC,OAAO;YACP,CAAC,CAAC,4KAGiC;YACnC,CAAC,CAAC,kIAGG,CACD,CAAA;IAEV,MAAM,QAAQ,GAAG,gBAAgB;QAC/B,CAAC,CAAC,IAAC,aAAa,IACZ,KAAK,EAAE,cAAc,gBAAgB,CAAC,IAAI,EAAE,EAC5C,WAAW,EAAE;gBACV,KAAK;gBACL,IAAI,CACJ,GACH;QACJ,CAAC,CAAC,gBAAgB,KAAK,SAAS;YAC9B,CAAC,CAAC,IAAC,aAAa,IACZ,IAAI,EAAE,IAAC,OAAO,OAAG,EACjB,WAAW,EAAC,oCAA+B,GAC3C;YACJ,CAAC,CAAC,IAAC,aAAa,IACZ,IAAI,EAAC,cAAc,EACnB,KAAK,EAAC,0CAA0C,EAChD,WAAW,EAAE,0BACV,IAAI,CACJ,GACH,CAAC;IAET,OAAO,QAAQ,CAAC;AAClB,CAAC,CAAA;AAED,eAAe,YAAY,CAAC","sourcesContent":["/** @jsx jsx */\n/** @jsxFrag React.Fragment */\n\nimport React, { useContext, useState } from 'react';\n//import { Helmet } from 'react-helmet';\nimport { jsx, css } from '@emotion/react';\nimport { Menu, MenuDivider, MenuItem, InputGroup, Button, NonIdealState, Spinner, Callout } from '@blueprintjs/core';\nimport { DatasetContext } from '@riboseinc/paneron-extension-kit/context';\nimport { TabbedWorkspaceContext } from '@riboseinc/paneron-extension-kit/widgets/TabbedWorkspace/context';\nimport { BrowserCtx } from '../../BrowserCtx';\nimport { registerStakeholderPlain } from '../../RegisterStakeholder';\nimport { newCRObjectChangeset } from '../../change-request/objectChangeset';\nimport { State as ProposalState } from '../../../types/cr';\nimport { isRegisterItem } from '../../../types/item';\n\nimport { Protocols } from '../../protocolRegistry';\nimport { crIDToCRPath, itemPathInCR } from '../../itemPathUtils';\n\n\nconst RegisterHome: React.VoidFunctionComponent<Record<never, never>> =\nfunction () {\n const { spawnTab } = useContext(TabbedWorkspaceContext);\n const { customViews, registerMetadata, stakeholder, offline } = useContext(BrowserCtx);\n const { requestFileFromFilesystem, makeRandomID, updateObjects, performOperation } = useContext(DatasetContext);\n\n const [ newProposalIdea, setNewProposalIdea ] = useState<string>('');\n\n const registerVersion = registerMetadata?.version;\n const canCreateCR = (\n stakeholder &&\n stakeholder.role &&\n stakeholder.gitServerUsername?.trim() !== '' &&\n makeRandomID &&\n updateObjects &&\n (registerVersion?.id ?? '').trim() !== '');\n\n async function createCR(justification: string): Promise<string> {\n if (canCreateCR) {\n const id = await makeRandomID();\n await updateObjects({\n commitMessage: \"start new proposal\",\n objectChangeset: newCRObjectChangeset(\n id,\n justification,\n registerVersion!,\n stakeholder.gitServerUsername!,\n ),\n });\n return id;\n } else {\n throw new Error(\"Unable to create proposal: read-only dataset\");\n }\n }\n\n async function handleNewProposal() {\n if (newProposalIdea) {\n const crID = await performOperation(\"creating proposal\", createCR)(newProposalIdea);\n setNewProposalIdea('');\n spawnTab(`${Protocols.CHANGE_REQUEST}:${crIDToCRPath(crID)}`);\n }\n }\n\n async function getCRImportChangeset() {\n if (!requestFileFromFilesystem) {\n throw new Error(\"Cannot request file from filesystem\");\n }\n const data = await requestFileFromFilesystem({\n prompt: \"Select one register proposal JSON file\",\n filters: [\n { name: \"JSON files\", extensions: ['.json'] },\n ],\n });\n const fileData = Object.values(data)[0]!;\n if (!fileData) {\n throw new Error(\"No file was selected\");\n }\n const crID = fileData.proposalDraft?.id;\n if (!crID) {\n throw new Error(\"Invalid file format\");\n }\n if (fileData.proposalDraft.state !== ProposalState.DRAFT) {\n throw new Error(`Invalid proposal state (must be ${ProposalState.DRAFT})`);\n }\n const crPath = crIDToCRPath(crID);\n const changeset = {\n [crPath]: {\n oldValue: null,\n newValue: fileData.proposalDraft,\n },\n };\n for (const [itemPath, itemPayload] of Object.entries(fileData.itemPayloads ?? {})) {\n if (!isRegisterItem(itemPayload)) {\n throw new Error(\"Invalid register item data found in proposal payloads\");\n }\n changeset[itemPathInCR(itemPath, crID)] = {\n oldValue: null,\n newValue: itemPayload,\n };\n }\n return [changeset, crID];\n }\n\n async function handleImportProposal() {\n const [objectChangeset, crID] = await performOperation(\n 'reading proposal data',\n getCRImportChangeset,\n )();\n\n await performOperation(\n 'creating proposal',\n updateObjects ?? (async () => { throw new Error(\"Read-only dataset\"); }),\n )({\n commitMessage: \"import proposal\",\n objectChangeset,\n });\n\n setNewProposalIdea('');\n spawnTab(`${Protocols.CHANGE_REQUEST}:${crIDToCRPath(crID)}`);\n }\n\n const menu = (\n <Menu css={css`margin: 10px;`}>\n <MenuDivider title=\"Quick links\" />\n {customViews.map((cv, _) => \n <MenuItem\n key={cv.id}\n text={cv.label}\n title={cv.description}\n icon={cv.icon}\n onClick={() => spawnTab(`${Protocols.CUSTOM_VIEW}:${cv.id}/index`)}\n />\n )}\n {customViews.length > 0 ? <MenuDivider /> : null}\n\n <MenuItem\n text={`Propose a change to version ${registerMetadata?.version?.id ?? '(missing)'}`}\n disabled={!canCreateCR}\n icon=\"lightbulb\"\n title={canCreateCR\n ? \"A blank proposal will be created and opened in a new tab.\"\n : undefined}>\n <InputGroup\n value={newProposalIdea || undefined}\n placeholder=\"Your idea…\"\n title=\"Justification draft (you can change this later)\"\n onChange={evt => setNewProposalIdea(evt.currentTarget.value)}\n rightElement={\n <Button\n small\n intent={newProposalIdea ? 'primary': undefined}\n disabled={!newProposalIdea}\n onClick={handleNewProposal}\n icon=\"tick\"\n />\n }\n />\n </MenuItem>\n <MenuItem\n text=\"Import proposal\"\n icon=\"import\"\n onClick={handleImportProposal}\n />\n <MenuItem\n text=\"View register metadata\"\n icon=\"properties\"\n onClick={() => spawnTab(Protocols.REGISTER_META)}\n />\n </Menu>\n );\n\n const intro = <Callout intent=\"primary\" css={css`text-align: left;`}>\n {stakeholder\n ? <>You can create proposals as {registerStakeholderPlain(stakeholder)}.</>\n : offline\n ? <>\n Because this repository is offline (no remote configured),\n and remote username is currently required for proposal,\n you cannot create proposals.</>\n : <>\n Since your remote username is not in the list of stakeholders,\n you cannot create proposals currently.\n </>}\n </Callout>\n\n const greeting = registerMetadata\n ? <NonIdealState\n title={`Welcome to ${registerMetadata.name}`}\n description={<>\n {intro}\n {menu}\n </>}\n />\n : registerMetadata === undefined\n ? <NonIdealState\n icon={<Spinner />}\n description=\"Loading register information…\"\n />\n : <NonIdealState\n icon=\"heart-broken\"\n title=\"Register metadata is missing or invalid.\"\n description={<>\n {menu}\n </>}\n />;\n\n return greeting;\n}\n\nexport default RegisterHome;\n"]}
|
|
@@ -23,7 +23,7 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
23
23
|
|
|
24
24
|
/** @jsxFrag React.Fragment */
|
|
25
25
|
const ExportSidebarBlock = function () {
|
|
26
|
-
var _a, _b;
|
|
26
|
+
var _a, _b, _c;
|
|
27
27
|
|
|
28
28
|
const {
|
|
29
29
|
writeFileToFilesystem,
|
|
@@ -31,17 +31,22 @@ const ExportSidebarBlock = function () {
|
|
|
31
31
|
getBlob
|
|
32
32
|
} = (0, _react.useContext)(_context.DatasetContext);
|
|
33
33
|
const {
|
|
34
|
-
selectedRegisterItem
|
|
34
|
+
selectedRegisterItem,
|
|
35
|
+
registerMetadata
|
|
35
36
|
} = (0, _react.useContext)(_BrowserCtx.BrowserCtx);
|
|
37
|
+
const proposedNamePrefix = (selectedRegisterItem === null || selectedRegisterItem === void 0 ? void 0 : selectedRegisterItem.item.id) && (registerMetadata === null || registerMetadata === void 0 ? void 0 : registerMetadata.name) ? `${(_a = registerMetadata.name) !== null && _a !== void 0 ? _a : 'unnamed-register'} item-${selectedRegisterItem.item.id}` : '';
|
|
36
38
|
|
|
37
|
-
async function handleExport(bufferData) {
|
|
39
|
+
async function handleExport(bufferData, filenameExtension) {
|
|
38
40
|
if (!writeFileToFilesystem) {
|
|
39
41
|
throw new Error("Unable to export: filesystem write function unavailable");
|
|
40
42
|
}
|
|
41
43
|
|
|
44
|
+
const separator = proposedNamePrefix && !filenameExtension.startsWith('.') ? ' ' : '';
|
|
45
|
+
const defaultPath = `${proposedNamePrefix}${separator}${filenameExtension}`;
|
|
42
46
|
await writeFileToFilesystem({
|
|
43
47
|
dialogOpts: {
|
|
44
48
|
prompt: "Choose location to export to",
|
|
49
|
+
defaultPath,
|
|
45
50
|
filters: [{
|
|
46
51
|
name: 'All files',
|
|
47
52
|
extensions: ['*']
|
|
@@ -76,15 +81,15 @@ const ExportSidebarBlock = function () {
|
|
|
76
81
|
return (0, _react2.jsx)(_core.ButtonGroup, {
|
|
77
82
|
vertical: true,
|
|
78
83
|
fill: true
|
|
79
|
-
}, ((
|
|
84
|
+
}, ((_c = (_b = selectedRegisterItem === null || selectedRegisterItem === void 0 ? void 0 : selectedRegisterItem.itemClass) === null || _b === void 0 ? void 0 : _b.exportFormats) !== null && _c !== void 0 ? _c : []).map((exportFormat, idx) => (0, _react2.jsx)(_core.Button, {
|
|
80
85
|
fill: true,
|
|
81
86
|
key: idx,
|
|
82
87
|
alignText: "left",
|
|
83
|
-
onClick: async () => await handleExport(await getExportedData(exportFormat))
|
|
88
|
+
onClick: async () => await handleExport(await getExportedData(exportFormat), exportFormat.filenameExtension)
|
|
84
89
|
}, exportFormat.label)), (0, _react2.jsx)(_core.Button, {
|
|
85
90
|
fill: true,
|
|
86
91
|
alignText: "left",
|
|
87
|
-
onClick: async () => await handleExport(await getExportedData())
|
|
92
|
+
onClick: async () => await handleExport(await getExportedData(), '.json')
|
|
88
93
|
}, "JSON"));
|
|
89
94
|
}
|
|
90
95
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ExportOptions.js","sourceRoot":"","sources":["../../../../src/views/sidebar/ExportImport/ExportOptions.tsx"],"names":[],"mappings":"AAAA,eAAe;AACf,8BAA8B;AAE9B,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAC1C,OAAO,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AACrC,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,EAAE,cAAc,EAAE,MAAM,0CAA0C,CAAC;AAE1E,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAG9C,MAAM,CAAC,MAAM,kBAAkB,GAAmC;;IAChE,MAAM,EAAE,qBAAqB,EAAE,aAAa,EAAE,OAAO,EAAE,GAAG,UAAU,CAAC,cAAc,CAAC,CAAC;IACrF,MAAM,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,GAAG,UAAU,CAAC,UAAU,CAAC,CAAC;IAE1E,MAAM,kBAAkB,GAAG,CAAA,oBAAoB,aAApB,oBAAoB,uBAApB,oBAAoB,CAAE,IAAI,CAAC,EAAE,MAAI,gBAAgB,aAAhB,gBAAgB,uBAAhB,gBAAgB,CAAE,IAAI,CAAA;QAChF,CAAC,CAAC,GAAG,MAAA,gBAAgB,CAAC,IAAI,mCAAI,kBAAkB,SAAS,oBAAoB,CAAC,IAAI,CAAC,EAAE,EAAE;QACvF,CAAC,CAAC,EAAE,CAAC;IAEP,KAAK,UAAU,YAAY,CAAC,UAAsB,EAAE,iBAAyB;QAC3E,IAAI,CAAC,qBAAqB,EAAE;YAC1B,MAAM,IAAI,KAAK,CAAC,yDAAyD,CA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AI,QACJ,GAAG,EAAE,GAAG,EACR,SAAS,EAAC,MAAM,EAChB,OAAO,EAAE,KAAK,IAAI,EAAE,CAAC,MAAM,YAAY,CACtC,MAAM,eAAe,CAAC,YAAY,CAAC,EACnC,YAAY,CAAC,iBAAiB,CAC/B,IACD,YAAY,CAAC,KAAK,CACZ,CACV;YACD,IAAC,MAAM,IACH,IAAI,QACJ,SAAS,EAAC,MAAM,EAChB,OAAO,EAAE,KAAK,IAAI,EAAE,CAAC,MAAM,YAAY,CACtC,MAAM,eAAe,EAAE,EACvB,OAAO,CACR,WAEK,CACG,CACd,CAAC;KACH;AACH,CAAC,CAAA;AAED,eAAe,kBAAkB,CAAC","sourcesContent":["/** @jsx jsx */\n/** @jsxFrag React.Fragment */\n\nimport React, { useContext } from 'react';\nimport { jsx } from '@emotion/react';\nimport { Button, ButtonGroup } from '@blueprintjs/core';\nimport { DatasetContext } from '@riboseinc/paneron-extension-kit/context';\nimport { ExportFormatConfiguration } from '../../../types';\nimport { BrowserCtx } from '../../BrowserCtx';\n\n\nexport const ExportSidebarBlock: React.FC<Record<never, never>> = function () {\n const { writeFileToFilesystem, getObjectData, getBlob } = useContext(DatasetContext);\n const { selectedRegisterItem, registerMetadata } = useContext(BrowserCtx);\n\n const proposedNamePrefix = selectedRegisterItem?.item.id && registerMetadata?.name\n ? `${registerMetadata.name ?? 'unnamed-register'} item-${selectedRegisterItem.item.id}`\n : '';\n\n async function handleExport(bufferData: Uint8Array, filenameExtension: string) {\n if (!writeFileToFilesystem) {\n throw new Error(\"Unable to export: filesystem write function unavailable\");\n }\n\n const separator = proposedNamePrefix && !filenameExtension.startsWith('.')\n ? ' '\n : '';\n\n const defaultPath = `${proposedNamePrefix}${separator}${filenameExtension}`;\n\n await writeFileToFilesystem({\n dialogOpts: {\n prompt: \"Choose location to export to\",\n defaultPath,\n filters: [{ name: 'All files', extensions: ['*'] }],\n },\n bufferData,\n });\n }\n\n async function getExportedData(formatConfig?: ExportFormatConfiguration<any>): Promise<Uint8Array> {\n if (!selectedRegisterItem) {\n throw new Error(\"Unable to export item: current item data not available\");\n }\n if (!getBlob) {\n throw new Error(\"Unable to export item: no blob helper\");\n }\n if (formatConfig) {\n return await formatConfig.exportItem(selectedRegisterItem.item, { getObjectData, getBlob });\n } else {\n return await getBlob(JSON.stringify(selectedRegisterItem.item));\n }\n }\n\n if (!selectedRegisterItem) {\n return <></>;\n } else {\n return (\n <ButtonGroup vertical fill>\n {(selectedRegisterItem?.itemClass?.exportFormats ?? []).map((exportFormat, idx) =>\n <Button\n fill\n key={idx}\n alignText=\"left\"\n onClick={async () => await handleExport(\n await getExportedData(exportFormat),\n exportFormat.filenameExtension,\n )}>\n {exportFormat.label}\n </Button>\n )}\n <Button\n fill\n alignText=\"left\"\n onClick={async () => await handleExport(\n await getExportedData(),\n '.json',\n )}>\n JSON\n </Button>\n </ButtonGroup>\n );\n }\n}\n\nexport default ExportSidebarBlock;\n"]}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = exports.ImportSidebarBlock = void 0;
|
|
7
|
+
|
|
8
|
+
var _react = require("@emotion/react");
|
|
9
|
+
|
|
10
|
+
/** @jsx jsx */
|
|
11
|
+
///** @jsxFrag React.Fragment */
|
|
12
|
+
//import React from 'react';
|
|
13
|
+
const ImportSidebarBlock = function () {
|
|
14
|
+
return (0, _react.jsx)("span", null, "Import TBD");
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
exports.ImportSidebarBlock = ImportSidebarBlock;
|
|
18
|
+
var _default = ImportSidebarBlock;
|
|
19
|
+
exports.default = _default;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ImportOptions.js","sourceRoot":"","sources":["../../../../src/views/sidebar/ExportImport/ImportOptions.tsx"],"names":[],"mappings":"AAAA,eAAe;AACf,gCAAgC;AAEhC,4BAA4B;AAC5B,OAAO,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AAGrC,MAAM,CAAC,MAAM,kBAAkB,GAAmC;IAChE,OAAO,+BAAuB,CAAC;AACjC,CAAC,CAAA;AAED,eAAe,kBAAkB,CAAC","sourcesContent":["/** @jsx jsx */\n///** @jsxFrag React.Fragment */\n\n//import React from 'react';\nimport { jsx } from '@emotion/react';\n\n\nexport const ImportSidebarBlock: React.FC<Record<never, never>> = function () {\n return <span>Import TBD</span>;\n}\n\nexport default ImportSidebarBlock;\n"]}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "ExportOptions", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _ExportOptions.default;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
Object.defineProperty(exports, "ImportOptions", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function () {
|
|
15
|
+
return _ImportOptions.default;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
var _ExportOptions = _interopRequireDefault(require("./ExportOptions"));
|
|
20
|
+
|
|
21
|
+
var _ImportOptions = _interopRequireDefault(require("./ImportOptions"));
|
|
22
|
+
|
|
23
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/views/sidebar/ExportImport/index.tsx"],"names":[],"mappings":"AAAA,OAAO,aAAa,MAAM,iBAAiB,CAAC;AAC5C,OAAO,aAAa,MAAM,iBAAiB,CAAC;AAE5C,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,CAAC","sourcesContent":["import ExportOptions from './ExportOptions';\nimport ImportOptions from './ImportOptions';\n\nexport { ExportOptions, ImportOptions };\n"]}
|
package/views/sidebar/index.js
CHANGED
|
@@ -5,9 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.sidebarConfig = exports.sidebarIDs = void 0;
|
|
7
7
|
|
|
8
|
-
var _react =
|
|
9
|
-
|
|
10
|
-
var _react2 = require("@emotion/react");
|
|
8
|
+
var _react = require("@emotion/react");
|
|
11
9
|
|
|
12
10
|
var _core = require("@blueprintjs/core");
|
|
13
11
|
|
|
@@ -19,30 +17,31 @@ var _Search = _interopRequireDefault(require("./Search"));
|
|
|
19
17
|
|
|
20
18
|
var _Registration = require("./Registration");
|
|
21
19
|
|
|
22
|
-
var
|
|
20
|
+
var _ExportImport = require("./ExportImport");
|
|
23
21
|
|
|
24
22
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
25
23
|
|
|
26
24
|
/** @jsx jsx */
|
|
27
25
|
|
|
28
26
|
/** @jsxFrag React.Fragment */
|
|
27
|
+
//import React from 'react';
|
|
29
28
|
const sidebarIDs = ['Browse', 'Registration', 'Export'];
|
|
30
29
|
exports.sidebarIDs = sidebarIDs;
|
|
31
30
|
const sidebarConfig = {
|
|
32
31
|
Browse: {
|
|
33
|
-
icon: () => (0,
|
|
32
|
+
icon: () => (0, _react.jsx)(_core.Icon, {
|
|
34
33
|
icon: "list"
|
|
35
34
|
}),
|
|
36
35
|
title: "Register items",
|
|
37
36
|
blocks: [{
|
|
38
37
|
key: 'browse',
|
|
39
|
-
title: (0,
|
|
40
|
-
css: (0,
|
|
41
|
-
}, "Preset searches", (0,
|
|
38
|
+
title: (0, _react.jsx)("div", {
|
|
39
|
+
css: (0, _react.css)`display: flex; justify-content: space-between`
|
|
40
|
+
}, "Preset searches", (0, _react.jsx)(_HelpTooltip.default, {
|
|
42
41
|
content: "Browse register items by pre-made categories"
|
|
43
42
|
})),
|
|
44
|
-
content: (0,
|
|
45
|
-
css: (0,
|
|
43
|
+
content: (0, _react.jsx)(_Browse.default, {
|
|
44
|
+
css: (0, _react.css)`position: absolute; inset: 0;`
|
|
46
45
|
}),
|
|
47
46
|
nonCollapsible: false,
|
|
48
47
|
// These have to have height specified due to absolute positioning.
|
|
@@ -50,52 +49,52 @@ const sidebarConfig = {
|
|
|
50
49
|
}, {
|
|
51
50
|
key: 'search',
|
|
52
51
|
title: "New search",
|
|
53
|
-
content: (0,
|
|
54
|
-
css: (0,
|
|
52
|
+
content: (0, _react.jsx)(_Search.default, {
|
|
53
|
+
css: (0, _react.css)`position: absolute; inset: 0;`
|
|
55
54
|
}),
|
|
56
55
|
nonCollapsible: false,
|
|
57
56
|
height: 400
|
|
58
57
|
}]
|
|
59
58
|
},
|
|
60
59
|
Registration: {
|
|
61
|
-
icon: () => (0,
|
|
60
|
+
icon: () => (0, _react.jsx)(_core.Icon, {
|
|
62
61
|
icon: "lightbulb"
|
|
63
62
|
}),
|
|
64
63
|
title: "Proposals",
|
|
65
64
|
blocks: [{
|
|
66
65
|
key: 'pending-crs',
|
|
67
|
-
title: (0,
|
|
68
|
-
css: (0,
|
|
69
|
-
}, "Pending proposals", (0,
|
|
66
|
+
title: (0, _react.jsx)("div", {
|
|
67
|
+
css: (0, _react.css)`display: flex; justify-content: space-between`
|
|
68
|
+
}, "Pending proposals", (0, _react.jsx)(_HelpTooltip.default, {
|
|
70
69
|
content: "Proposals pending decision. If a register item is selected, only proposals affecting that item are shown."
|
|
71
70
|
})),
|
|
72
|
-
content: (0,
|
|
71
|
+
content: (0, _react.jsx)(_Registration.PendingChangeRequestsBlock, null),
|
|
73
72
|
height: 300
|
|
74
73
|
}, {
|
|
75
74
|
key: 'cr-history',
|
|
76
|
-
title: (0,
|
|
77
|
-
css: (0,
|
|
78
|
-
}, "History", (0,
|
|
75
|
+
title: (0, _react.jsx)("div", {
|
|
76
|
+
css: (0, _react.css)`display: flex; justify-content: space-between`
|
|
77
|
+
}, "History", (0, _react.jsx)(_HelpTooltip.default, {
|
|
79
78
|
content: "Resolved proposals. If a register item is selected, only proposals affecting that item are shown."
|
|
80
79
|
})),
|
|
81
|
-
content: (0,
|
|
80
|
+
content: (0, _react.jsx)(_Registration.ChangeRequestHistoryBlock, null),
|
|
82
81
|
height: 300
|
|
83
82
|
}]
|
|
84
83
|
},
|
|
85
84
|
Export: {
|
|
86
|
-
icon: () => (0,
|
|
85
|
+
icon: () => (0, _react.jsx)(_core.Icon, {
|
|
87
86
|
icon: "changes"
|
|
88
87
|
}),
|
|
89
|
-
title: "Import and export",
|
|
88
|
+
title: "Import and export options",
|
|
90
89
|
blocks: [{
|
|
91
90
|
key: 'export',
|
|
92
|
-
title: "Export",
|
|
93
|
-
content: (0,
|
|
91
|
+
title: "Export options",
|
|
92
|
+
content: (0, _react.jsx)(_ExportImport.ExportOptions, null),
|
|
94
93
|
nonCollapsible: true
|
|
95
94
|
}, {
|
|
96
95
|
key: 'import',
|
|
97
|
-
title: "Import",
|
|
98
|
-
content: (0,
|
|
96
|
+
title: "Import options",
|
|
97
|
+
content: (0, _react.jsx)(_ExportImport.ImportOptions, null),
|
|
99
98
|
nonCollapsible: false,
|
|
100
99
|
collapsedByDefault: true
|
|
101
100
|
}]
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/views/sidebar/index.tsx"],"names":[],"mappings":"AAAA,eAAe;AACf,8BAA8B;AAE9B,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/views/sidebar/index.tsx"],"names":[],"mappings":"AAAA,eAAe;AACf,8BAA8B;AAE9B,4BAA4B;AAC5B,OAAO,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAGzC,OAAO,WAAW,MAAM,sDAAsD,CAAC;AAE/E,OAAO,MAAM,MAAM,UAAU,CAAC;AAC9B,OAAO,MAAM,MAAM,UAAU,CAAC;AAC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AG;aACZ,EAAE;gBACD,GAAG,EAAE,YAAY;gBACjB,KAAK,EAAE,aAAK,GAAG,EAAE,GAAG,CAAA,+CAA+C;;oBAEjE,IAAC,WAAW,IAAC,OAAO,EAAC,mGAAmG,GAAG,CACvH;gBACN,OAAO,EAAE,IAAC,yBAAyB,OAAG;gBACtC,MAAM,EAAE,GAAG;aACZ,CAAC;KACH;IACD,MAAM,EAAE;QACN,IAAI,EAAE,GAAG,EAAE,CAAC,IAAC,IAAI,IAAC,IAAI,EAAC,SAAS,GAAG;QACnC,KAAK,EAAE,2BAA2B;QAClC,MAAM,EAAE,CAAC;gBACP,GAAG,EAAE,QAAQ;gBACb,KAAK,EAAE,gBAAgB;gBACvB,OAAO,EAAE,IAAC,aAAa,OAAG;gBAC1B,cAAc,EAAE,IAAI;aACrB,EAAE;gBACD,GAAG,EAAE,QAAQ;gBACb,KAAK,EAAE,gBAAgB;gBACvB,OAAO,EAAE,IAAC,aAAa,OAAG;gBAC1B,cAAc,EAAE,KAAK;gBACrB,kBAAkB,EAAE,IAAI;aACzB,CAAC;KACH;CACF,CAAC","sourcesContent":["/** @jsx jsx */\n/** @jsxFrag React.Fragment */\n\n//import React from 'react';\nimport { jsx, css } from '@emotion/react';\nimport { Icon } from '@blueprintjs/core';\n\nimport type { SuperSidebarConfig } from '@riboseinc/paneron-extension-kit/widgets/TabbedWorkspace/types';\nimport HelpTooltip from '@riboseinc/paneron-extension-kit/widgets/HelpTooltip';\n\nimport Browse from './Browse';\nimport Search from './Search';\nimport { PendingChangeRequestsBlock, ChangeRequestHistoryBlock } from './Registration';\nimport { ExportOptions, ImportOptions } from './ExportImport';\n\n\nexport const sidebarIDs = [\n 'Browse',\n 'Registration',\n 'Export',\n] as const;\n\nexport type SidebarID = typeof sidebarIDs[number];\n\nexport const sidebarConfig: SuperSidebarConfig<SidebarID> = {\n Browse: {\n icon: () => <Icon icon=\"list\" />,\n title: \"Register items\",\n blocks: [{\n key: 'browse',\n title: <div css={css`display: flex; justify-content: space-between`}>\n Preset searches\n <HelpTooltip content=\"Browse register items by pre-made categories\" />\n </div>,\n content: <Browse css={css`position: absolute; inset: 0;`} />,\n nonCollapsible: false,\n // These have to have height specified due to absolute positioning.\n height: 400,\n }, {\n key: 'search',\n title: \"New search\",\n content: <Search css={css`position: absolute; inset: 0;`} />,\n nonCollapsible: false,\n height: 400,\n }],\n },\n Registration: {\n icon: () => <Icon icon=\"lightbulb\" />,\n title: \"Proposals\",\n blocks: [{\n key: 'pending-crs',\n title: <div css={css`display: flex; justify-content: space-between`}>\n Pending proposals\n <HelpTooltip content=\"Proposals pending decision. If a register item is selected, only proposals affecting that item are shown.\" />\n </div>,\n content: <PendingChangeRequestsBlock />,\n height: 300,\n }, {\n key: 'cr-history',\n title: <div css={css`display: flex; justify-content: space-between`}>\n History\n <HelpTooltip content=\"Resolved proposals. If a register item is selected, only proposals affecting that item are shown.\" />\n </div>,\n content: <ChangeRequestHistoryBlock />,\n height: 300,\n }],\n },\n Export: {\n icon: () => <Icon icon=\"changes\" />,\n title: \"Import and export options\",\n blocks: [{\n key: 'export',\n title: \"Export options\",\n content: <ExportOptions />,\n nonCollapsible: true,\n }, {\n key: 'import',\n title: \"Import options\",\n content: <ImportOptions />,\n nonCollapsible: false,\n collapsedByDefault: true,\n }],\n },\n};\n"]}
|
package/site-builder/index.d.ts
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import type { BufferDataset } from '@riboseinc/paneron-extension-kit/types/buffers';
|
|
2
|
-
import type { DatasetContext } from '@riboseinc/paneron-extension-kit/types/renderer';
|
|
3
|
-
export default function exportPublicSite({ getObjectData }: {
|
|
4
|
-
getObjectData: DatasetContext["getObjectData"];
|
|
5
|
-
onProgress?: (message: string) => void;
|
|
6
|
-
}): AsyncGenerator<BufferDataset, void, void>;
|
package/site-builder/index.js
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = exportPublicSite;
|
|
7
|
-
|
|
8
|
-
var _common = require("../common");
|
|
9
|
-
|
|
10
|
-
var _page = _interopRequireDefault(require("./page"));
|
|
11
|
-
|
|
12
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
|
-
|
|
14
|
-
const enc = new TextEncoder();
|
|
15
|
-
|
|
16
|
-
async function* exportPublicSite({
|
|
17
|
-
getObjectData
|
|
18
|
-
}) {
|
|
19
|
-
const registerMeta = (await getObjectData({
|
|
20
|
-
objectPaths: [`/${_common.REGISTER_METADATA_FILENAME}`]
|
|
21
|
-
})).data[`/${_common.REGISTER_METADATA_FILENAME}`];
|
|
22
|
-
yield {
|
|
23
|
-
'/hello.txt': enc.encode('hello'),
|
|
24
|
-
'/index.html': enc.encode((0, _page.default)({
|
|
25
|
-
title: "Register"
|
|
26
|
-
})),
|
|
27
|
-
'/register-meta.json': enc.encode(JSON.stringify(registerMeta))
|
|
28
|
-
};
|
|
29
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/site-builder/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,0BAA0B,EAAE,MAAM,WAAW,CAAC;AACvD,OAAO,OAAO,MAAM,QAAQ,CAAC;AAG7B,MAAM,GAAG,GAAG,IAAI,WAAW,EAAE,CAAC;AAG9B,MAAM,CAAC,OAAO,CAAC,KAAK,SAAS,CAAC,CAAC,gBAAgB,CAAC,EAAE,aAAa,EAG9D;IACC,MAAM,YAAY,GAAG,CAAC,MAAM,aAAa,CAAC;QACxC,WAAW,EAAE,CAAC,IAAI,0BAA0B,EAAE,CAAC;KAChD,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,0BAA0B,EAAE,CAAC,CAAC;IAE3C,MAAM;QACJ,YAAY,EAAE,GAAG,CAAC,MAAM,CAAC,OAAO,CAAC;QACjC,aAAa,EAAE,GAAG,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,KAAK,EAAE,UAAU,EAAE,CAAC,CAAC;QACzD,qBAAqB,EAAE,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,YAAY,CAAC,CAAC;KAChE,CAAC;AACJ,CAAC","sourcesContent":["import type { BufferDataset } from '@riboseinc/paneron-extension-kit/types/buffers';\nimport type { DatasetContext } from '@riboseinc/paneron-extension-kit/types/renderer';\nimport { REGISTER_METADATA_FILENAME } from '../common'; \nimport getHTML from './page';\n\n\nconst enc = new TextEncoder();\n\n\nexport default async function* exportPublicSite({ getObjectData }: {\n getObjectData: DatasetContext[\"getObjectData\"],\n onProgress?: (message: string) => void,\n}): AsyncGenerator<BufferDataset, void, void> {\n const registerMeta = (await getObjectData({\n objectPaths: [`/${REGISTER_METADATA_FILENAME}`],\n })).data[`/${REGISTER_METADATA_FILENAME}`];\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"]}
|
|
@@ -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 '&';
|
|
42
|
-
} else if (quote) {
|
|
43
|
-
return '"';
|
|
44
|
-
} else {
|
|
45
|
-
return ' ';
|
|
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,gBAAgB,GAAG,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;AAC3C,MAAM,gBAAgB,GAAG,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;AAE3C,SAAS,OAAO,CAAC,KAAa,EAAE,KAAa;IAC3C,MAAM,QAAQ,GAAG,KAAK,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;IACzC,OAAO,gBAAgB,IAAI,QAAQ,IAAI,gBAAgB,IAAI,QAAQ,CAAC;AACtE,CAAC;AAAA,CAAC;AAEF,SAAS,WAAW,CAAC,UAAkB;IACrC,IAAI,UAAU,GAAG,EAAE,CAAC;IACpB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,UAAU,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;QAC1C,MAAM,cAAc,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,UAAU,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;QACjE,MAAM,iBAAiB,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC;QACjD,MAAM,cAAc,GAAG,CAAC,GAAG,UAAU,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,UAAU,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;QACrF,IAAI,CAAC,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,CAAC,OAAO,CAAC,UAAU,CAAC,QAAQ,CAAC;gBAChC,CAAC,CAAC,UAAU,CAAC,QAAQ;gBACrB,CAAC,CAAC,CAAC,UAAU,CAAC,QAAQ,CAAC,CAC1B;YACH,CAAC,CAAC,EAAE,CAAC;QACP,MAAM,KAAK,GAAG,MAAM,IAAI,MAAM;YAC5B,CAAC,CAAC,GAAG,MAAM,KAAK,MAAM,EAAE;YACxB,CAAC,CAAC,MAAM,IAAI,MAAM,CAAC;QACrB,OAAO,IAAI,OAAO,GAAG,UAAU,CAAC,CAAC,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 '&'; }\n else if (quote) { return '"'; }\n else { return ' '; }\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"]}
|
package/site-builder/page.d.ts
DELETED
package/site-builder/page.js
DELETED
|
@@ -1,22 +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
|
-
}
|
package/site-builder/page.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"page.js","sourceRoot":"","sources":["../../src/site-builder/page.tsx"],"names":[],"mappings":";AAOA,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","sourcesContent":["/** @jsxImportSource . */\n\n\ninterface PageMeta {\n title: string\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"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ChangeProposalContext.js","sourceRoot":"","sources":["../../../src/views/change-request/ChangeProposalContext.tsx"],"names":[],"mappings":";AACA;;GAEG","sourcesContent":["\n/**\n * Context pertaining to given register item changes within active proposal, if any.\n */\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/views/sidebar/Export/index.tsx"],"names":[],"mappings":"AAAA,eAAe;AACf,8BAA8B;AAE9B,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,OAA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,CAAC;IAED,IAAI,CAAC,oBAAoB,EAAE;QACzB,OAAO,yBAAK,CAAC;KACd;SAAM;QACL,OAAO,CACN,IAAC,WAAW,IAAC,QAAQ,QAAC,IAAI;YACvB,CAAC,MAAA,MAAA,oBAAoB,aAApB,oBAAoB,uBAApB,oBAAoB,CAAE,SAAS,0CAAE,aAAa,mCAAI,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,YAAY,EAAE,GAAG,EAAE,EAAE,CAChF,IAAC,MAAM,IAAC,IAAI,QAAC,GAAG,EAAE,GAAG,EAAE,SAAS,EAAC,MAAM,EAAC,OAAO,EAAE,KAAK,IAAI,EAAE,CAAC,MAAM,YAAY,CAAC,MAAM,eAAe,CAAC,YAAY,CAAC,CAAC,IACjH,YAAY,CAAC,KAAK,CACZ,CACV;YACD,IAAC,MAAM,IAAC,IAAI,QAAC,SAAS,EAAC,MAAM,EAAC,OAAO,EAAE,KAAK,IAAI,EAAE,CAAC,MAAM,YAAY,CAAC,MAAM,eAAe,EAAE,CAAC,WAErF,CACG,CACd,CAAC;KACH;AACH,CAAC,CAAA;AAED,eAAe,kBAAkB,CAAC","sourcesContent":["/** @jsx jsx */\n/** @jsxFrag React.Fragment */\n\nimport React, { useContext } from 'react';\nimport { jsx } from '@emotion/react';\nimport { Button, ButtonGroup } from '@blueprintjs/core';\nimport { DatasetContext } from '@riboseinc/paneron-extension-kit/context';\nimport { ExportFormatConfiguration } from '../../../types';\nimport { BrowserCtx } from '../../BrowserCtx';\n\n\nexport const ExportSidebarBlock: React.FC<Record<never, never>> = function () {\n const { writeFileToFilesystem, getObjectData, getBlob } = useContext(DatasetContext);\n const { selectedRegisterItem } = useContext(BrowserCtx);\n\n async function handleExport(bufferData: Uint8Array) {\n if (!writeFileToFilesystem) {\n throw new Error(\"Unable to export: filesystem write function unavailable\");\n }\n\n await writeFileToFilesystem({\n dialogOpts: {\n prompt: \"Choose location to export to\",\n filters: [{ name: 'All files', extensions: ['*'] }],\n },\n bufferData,\n });\n }\n\n async function getExportedData(formatConfig?: ExportFormatConfiguration<any>): Promise<Uint8Array> {\n if (!selectedRegisterItem) {\n throw new Error(\"Unable to export item: current item data not available\");\n }\n if (!getBlob) {\n throw new Error(\"Unable to export item: no blob helper\");\n }\n if (formatConfig) {\n return await formatConfig.exportItem(selectedRegisterItem.item, { getObjectData, getBlob });\n } else {\n return await getBlob(JSON.stringify(selectedRegisterItem.item));\n }\n }\n\n if (!selectedRegisterItem) {\n return <></>;\n } else {\n return (\n <ButtonGroup vertical fill>\n {(selectedRegisterItem?.itemClass?.exportFormats ?? []).map((exportFormat, idx) =>\n <Button fill key={idx} alignText=\"left\" onClick={async () => await handleExport(await getExportedData(exportFormat))}>\n {exportFormat.label}\n </Button>\n )}\n <Button fill alignText=\"left\" onClick={async () => await handleExport(await getExportedData())}>\n JSON\n </Button>\n </ButtonGroup>\n );\n }\n}\n\nexport default ExportSidebarBlock;\n"]}
|
|
File without changes
|