🚀 Socket Launch Week Day 5:Introducing Repository Access Permissions and Custom Roles.Learn more
Sign In

@forge/react

Package Overview
Dependencies
Maintainers
2
Versions
428
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@forge/react - npm Package Compare versions

Comparing version
8.0.1
to
8.0.2-next.0
+13
out/__test__/testUtils.d.ts
import { ForgeDoc } from '../types';
export type BridgeCall = {
cmd: string;
data: ForgeDoc;
};
type SetupBridge = () => BridgeCall[];
type GetLastBridgeCall = (bridgeCalls: BridgeCall[]) => BridgeCall | null;
type GetLastBridgeCallForgeDoc = (bridgeCalls: BridgeCall[]) => ForgeDoc | null;
export declare const setupBridge: SetupBridge;
export declare const getLastBridgeCall: GetLastBridgeCall;
export declare const getLastBridgeCallForgeDoc: GetLastBridgeCallForgeDoc;
export {};
//# sourceMappingURL=testUtils.d.ts.map
{"version":3,"file":"testUtils.d.ts","sourceRoot":"","sources":["../../src/__test__/testUtils.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAEpC,MAAM,MAAM,UAAU,GAAG;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,QAAQ,CAAA;CAAE,CAAC;AACzD,KAAK,WAAW,GAAG,MAAM,UAAU,EAAE,CAAC;AAEtC,KAAK,iBAAiB,GAAG,CAAC,WAAW,EAAE,UAAU,EAAE,KAAK,UAAU,GAAG,IAAI,CAAC;AAC1E,KAAK,yBAAyB,GAAG,CAAC,WAAW,EAAE,UAAU,EAAE,KAAK,QAAQ,GAAG,IAAI,CAAC;AAMhF,eAAO,MAAM,WAAW,EAAE,WAWzB,CAAC;AAEF,eAAO,MAAM,iBAAiB,EAAE,iBAK/B,CAAC;AAEF,eAAO,MAAM,yBAAyB,EAAE,yBAMvC,CAAC"}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getLastBridgeCallForgeDoc = exports.getLastBridgeCall = exports.setupBridge = void 0;
const setupBridge = () => {
const bridgeCalls = [];
global['self'] = {
__bridge: {
callBridge: (cmd, data) => {
bridgeCalls.push({ cmd, data });
}
}
};
return bridgeCalls;
};
exports.setupBridge = setupBridge;
const getLastBridgeCall = (bridgeCalls) => {
if (bridgeCalls.length === 0) {
return null;
}
return bridgeCalls[bridgeCalls.length - 1];
};
exports.getLastBridgeCall = getLastBridgeCall;
const getLastBridgeCallForgeDoc = (bridgeCalls) => {
const lastBridgeCall = (0, exports.getLastBridgeCall)(bridgeCalls);
if (lastBridgeCall === null) {
return lastBridgeCall;
}
return lastBridgeCall.data;
};
exports.getLastBridgeCallForgeDoc = getLastBridgeCallForgeDoc;
+7
-0
# @forge/react
## 8.0.2-next.0
### Patch Changes
- Updated dependencies [f48e6d8]
- @forge/ui@1.9.2-next.0
## 8.0.1

@@ -4,0 +11,0 @@

+73
-32
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
const jsx_runtime_1 = require("react/jsx-runtime");
const react_1 = tslib_1.__importStar(require("react"));
const reconciler_1 = require("../reconciler");
const emptyForgeDoc = (0, reconciler_1.createElement)('root');
const reconcilerTestRenderer_1 = tslib_1.__importDefault(require("./reconcilerTestRenderer"));
const components_1 = require("../components");
const get_1 = tslib_1.__importDefault(require("lodash/get"));
const testUtils_1 = require("./testUtils");
const emptyForgeDoc = (0, reconciler_1.createElement)({ type: 'root', props: {}, reconciliationCount: 0 });
const ButtonWithStatus = () => {
const [bool, setBool] = (0, react_1.useState)(true);
const appearance = bool ? 'inprogress' : 'success';
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(components_1.Button, Object.assign({ onClick: () => setBool(!bool) }, { children: "Click me!" })), (0, jsx_runtime_1.jsx)(components_1.Text, { children: (0, jsx_runtime_1.jsx)(components_1.StatusLozenge, Object.assign({ appearance: appearance }, { children: appearance })) })] }));
};
describe('Reconciliation counting', () => {
let bridgeCalls = [];
beforeAll(async () => {
bridgeCalls = (0, testUtils_1.setupBridge)();
const Test = () => {
return ((0, jsx_runtime_1.jsxs)(react_1.default.Fragment, { children: [(0, jsx_runtime_1.jsx)(ButtonWithStatus, {}), (0, jsx_runtime_1.jsx)(ButtonWithStatus, {})] }));
};
await reconcilerTestRenderer_1.default.create((0, jsx_runtime_1.jsx)(Test, {}));
});
it('initial reconcilation output is correct', () => {
const forgeDoc = (0, testUtils_1.getLastBridgeCallForgeDoc)(bridgeCalls);
expect(forgeDoc).toHaveProperty('forgeDoc.reconciliationCount', 1);
expect(forgeDoc).toHaveProperty('forgeDoc.children[0].props.onClick');
expect(forgeDoc).toHaveProperty('forgeDoc.children[0].reconciliationCount', 0);
expect(forgeDoc).toHaveProperty('forgeDoc.children[0].type', 'Button');
expect(forgeDoc).toHaveProperty('forgeDoc.children[2].type', 'Button');
});
it('calling the button click handler triggers reconciliation', () => {
const forgeDoc = (0, testUtils_1.getLastBridgeCallForgeDoc)(bridgeCalls);
const onClick = (0, get_1.default)(forgeDoc, 'forgeDoc.children[0].props.onClick');
if (onClick !== undefined) {
onClick();
const forgeDoc = (0, testUtils_1.getLastBridgeCallForgeDoc)(bridgeCalls);
expect(forgeDoc).toHaveProperty('forgeDoc.reconciliationCount', 2);
expect(forgeDoc).toHaveProperty('forgeDoc.children[0].reconciliationCount', 2);
expect(forgeDoc).toHaveProperty('forgeDoc.children[2].reconciliationCount', 0);
}
});
});
describe('hostConfig used functions', () => {
let bridgeCalls = [];
beforeAll(async () => {
bridgeCalls = (0, testUtils_1.setupBridge)();
});
it('resetAfterCommit should call bridge', () => {
let output;
global['self'] = {
__bridge: {
callBridge: (cmd, data) => {
output = data;
}
}
};
const testDoc = (0, reconciler_1.createElement)('root');
const testDoc = (0, reconciler_1.createElement)({ type: 'root', props: {}, reconciliationCount: 0 });
reconciler_1.hostConfig.resetAfterCommit(testDoc);
expect(output).toEqual({
const forgeDoc = (0, testUtils_1.getLastBridgeCallForgeDoc)(bridgeCalls);
expect(forgeDoc).toEqual({
forgeDoc: testDoc

@@ -32,7 +70,8 @@ });

},
key: expect.any(String)
key: expect.any(String),
reconciliationCount: 0
}));
});
it('createTextInstance returns ForgeDoc with UUID', () => {
const testDoc = (0, reconciler_1.createElement)('root');
const testDoc = (0, reconciler_1.createElement)({ type: 'root', props: {}, reconciliationCount: 0 });
const textInstance = reconciler_1.hostConfig.createTextInstance('test', testDoc, null, null);

@@ -45,8 +84,9 @@ expect(textInstance).toEqual(expect.objectContaining({

},
key: expect.any(String)
key: expect.any(String),
reconciliationCount: 0
}));
});
it('appendInitialChild adds child to empty children array', () => {
const parent = (0, reconciler_1.createElement)('parent');
const child = (0, reconciler_1.createElement)('child');
const parent = (0, reconciler_1.createElement)({ type: 'parent', props: {}, reconciliationCount: 0 });
const child = (0, reconciler_1.createElement)({ type: 'child', props: {}, reconciliationCount: 0 });
expect(parent).toHaveProperty('children', []);

@@ -59,4 +99,4 @@ reconciler_1.hostConfig.appendInitialChild(parent, child);

if (reconciler_1.hostConfig.appendChild !== undefined) {
const parent = (0, reconciler_1.createElement)('parent');
const child = (0, reconciler_1.createElement)('child');
const parent = (0, reconciler_1.createElement)({ type: 'parent', props: {}, reconciliationCount: 0 });
const child = (0, reconciler_1.createElement)({ type: 'child', props: {}, reconciliationCount: 0 });
expect(parent).toHaveProperty('children', []);

@@ -72,4 +112,4 @@ reconciler_1.hostConfig.appendChild(parent, child);

if (reconciler_1.hostConfig.appendChildToContainer !== undefined) {
const parent = (0, reconciler_1.createElement)('parent');
const child = (0, reconciler_1.createElement)('child');
const parent = (0, reconciler_1.createElement)({ type: 'parent', props: {}, reconciliationCount: 0 });
const child = (0, reconciler_1.createElement)({ type: 'child', props: {}, reconciliationCount: 0 });
expect(parent).toHaveProperty('children', []);

@@ -84,3 +124,3 @@ reconciler_1.hostConfig.appendChildToContainer(parent, child);

it('prepareUpdate should set new props as props on instance', () => {
const instance = (0, reconciler_1.createElement)('test', { oldProps: true });
const instance = (0, reconciler_1.createElement)({ type: 'test', props: { oldProps: true }, reconciliationCount: 0 });
const newProps = {

@@ -92,2 +132,3 @@ updated: true

expect(instance).toHaveProperty('props', newProps);
expect(instance).toHaveProperty('reconciliationCount', 1);
});

@@ -100,5 +141,5 @@ it('shouldSetTextContent returns false', () => {

if (reconciler_1.hostConfig.insertBefore !== undefined) {
const parent = (0, reconciler_1.createElement)('parent');
const child1 = (0, reconciler_1.createElement)('child1');
const child2 = (0, reconciler_1.createElement)('child2');
const parent = (0, reconciler_1.createElement)({ type: 'parent', props: {}, reconciliationCount: 0 });
const child1 = (0, reconciler_1.createElement)({ type: 'child1', props: {}, reconciliationCount: 0 });
const child2 = (0, reconciler_1.createElement)({ type: 'child2', props: {}, reconciliationCount: 0 });
reconciler_1.hostConfig.appendInitialChild(parent, child1);

@@ -113,5 +154,5 @@ expect(parent).toHaveProperty('children', [child1]);

if (reconciler_1.hostConfig.insertInContainerBefore !== undefined) {
const parent = (0, reconciler_1.createElement)('parent');
const child1 = (0, reconciler_1.createElement)('child1');
const child2 = (0, reconciler_1.createElement)('child2');
const parent = (0, reconciler_1.createElement)({ type: 'parent', props: {}, reconciliationCount: 0 });
const child1 = (0, reconciler_1.createElement)({ type: 'child1', props: {}, reconciliationCount: 0 });
const child2 = (0, reconciler_1.createElement)({ type: 'child2', props: {}, reconciliationCount: 0 });
reconciler_1.hostConfig.appendInitialChild(parent, child1);

@@ -127,4 +168,4 @@ reconciler_1.hostConfig.appendInitialChild(parent, child2);

if (reconciler_1.hostConfig.removeChild !== undefined) {
const parent = (0, reconciler_1.createElement)('parent');
const child = (0, reconciler_1.createElement)('child');
const parent = (0, reconciler_1.createElement)({ type: 'parent', props: {}, reconciliationCount: 0 });
const child = (0, reconciler_1.createElement)({ type: 'child', props: {}, reconciliationCount: 0 });
expect(parent).toHaveProperty('children', []);

@@ -140,4 +181,4 @@ reconciler_1.hostConfig.appendInitialChild(parent, child);

if (reconciler_1.hostConfig.removeChildFromContainer !== undefined) {
const parent = (0, reconciler_1.createElement)('parent');
const child = (0, reconciler_1.createElement)('child');
const parent = (0, reconciler_1.createElement)({ type: 'parent', props: {}, reconciliationCount: 0 });
const child = (0, reconciler_1.createElement)({ type: 'child', props: {}, reconciliationCount: 0 });
expect(parent).toHaveProperty('children', []);

@@ -153,3 +194,3 @@ reconciler_1.hostConfig.appendInitialChild(parent, child);

if (reconciler_1.hostConfig.commitTextUpdate !== undefined) {
const testDoc = (0, reconciler_1.createElement)('root');
const testDoc = (0, reconciler_1.createElement)({ type: 'root', props: {}, reconciliationCount: 0 });
const textInstance = reconciler_1.hostConfig.createTextInstance('test', testDoc, null, null);

@@ -156,0 +197,0 @@ reconciler_1.hostConfig.commitTextUpdate(textInstance, '', 'updated');

@@ -8,12 +8,9 @@ "use strict";

const reconcilerTestRenderer_1 = tslib_1.__importDefault(require("./reconcilerTestRenderer"));
const testUtils_1 = require("./testUtils");
describe('reconciled output', () => {
let bridgeCalls = [];
beforeAll(async () => {
bridgeCalls = (0, testUtils_1.setupBridge)();
});
it('renders legacy Table ForgeDoc', async () => {
let output = undefined;
global['self'] = {
__bridge: {
callBridge: (cmd, data) => {
output = data;
}
}
};
const Test = () => {

@@ -23,5 +20,6 @@ return ((0, jsx_runtime_1.jsx)(react_1.default.Fragment, { children: (0, jsx_runtime_1.jsxs)(components_1.Table, Object.assign({ rowsPerPage: 2 }, { children: [(0, jsx_runtime_1.jsxs)(components_1.Head, { children: [(0, jsx_runtime_1.jsx)(components_1.Cell, { children: (0, jsx_runtime_1.jsx)(components_1.Text, { children: "Issue Key" }) }), (0, jsx_runtime_1.jsx)(components_1.Cell, { children: (0, jsx_runtime_1.jsx)(components_1.Text, { children: "Status" }) })] }), (0, jsx_runtime_1.jsxs)(components_1.Row, { children: [(0, jsx_runtime_1.jsx)(components_1.Cell, { children: (0, jsx_runtime_1.jsx)(components_1.Text, { children: "XEN-1" }) }), (0, jsx_runtime_1.jsx)(components_1.Cell, { children: (0, jsx_runtime_1.jsx)(components_1.Text, { children: "In Progress" }) })] }), (0, jsx_runtime_1.jsxs)(components_1.Row, { children: [(0, jsx_runtime_1.jsx)(components_1.Cell, { children: (0, jsx_runtime_1.jsx)(components_1.Text, { children: "XEN-2" }) }), (0, jsx_runtime_1.jsx)(components_1.Cell, { children: (0, jsx_runtime_1.jsx)(components_1.Text, { children: "To Do" }) })] }), (0, jsx_runtime_1.jsxs)(components_1.Row, { children: [(0, jsx_runtime_1.jsx)(components_1.Cell, { children: (0, jsx_runtime_1.jsx)(components_1.Text, { children: "XEN-3" }) }), (0, jsx_runtime_1.jsx)(components_1.Cell, { children: (0, jsx_runtime_1.jsx)(components_1.Text, { children: "Done" }) })] }), (0, jsx_runtime_1.jsxs)(components_1.Row, { children: [(0, jsx_runtime_1.jsx)(components_1.Cell, { children: (0, jsx_runtime_1.jsx)(components_1.Text, { children: "XEN-4" }) }), (0, jsx_runtime_1.jsx)(components_1.Cell, { children: (0, jsx_runtime_1.jsx)(components_1.Text, { children: "In Progress" }) })] }), (0, jsx_runtime_1.jsxs)(components_1.Row, { children: [(0, jsx_runtime_1.jsx)(components_1.Cell, { children: (0, jsx_runtime_1.jsx)(components_1.Text, { children: "XEN-5" }) }), (0, jsx_runtime_1.jsx)(components_1.Cell, { children: (0, jsx_runtime_1.jsx)(components_1.Text, { children: "Cancelled" }) })] })] })) }));

await reconcilerTestRenderer_1.default.create((0, jsx_runtime_1.jsx)(Test, {}));
expect(output).toHaveProperty('forgeDoc.type', 'Root');
expect(output).toHaveProperty('forgeDoc.children[0].type', 'Table');
const forgeDoc = (0, testUtils_1.getLastBridgeCallForgeDoc)(bridgeCalls);
expect(forgeDoc).toHaveProperty('forgeDoc.type', 'Root');
expect(forgeDoc).toHaveProperty('forgeDoc.children[0].type', 'Table');
});
});

@@ -5,5 +5,3 @@ /// <reference types="node" />

type ElementType = string;
type ElementProps = {
[key: string]: any;
};
type ElementProps = InstanceProps;
export interface ForgeDoc {

@@ -14,2 +12,3 @@ type: ElementType;

key: string;
reconciliationCount: number;
}

@@ -20,3 +19,8 @@ export type CallBridge = (cmd: string, data: {

export declare const callBridge: CallBridge;
export declare const createElement: (type: ElementType, props?: ElementProps) => ForgeDoc;
export type CreateElement = (args: {
type: ElementType;
props: InstanceProps;
reconciliationCount: number;
}) => ForgeDoc;
export declare const createElement: CreateElement;
export declare const appendChild: (parent: ForgeDoc, child: ForgeDoc) => void;

@@ -23,0 +27,0 @@ export declare const insertBefore: (parent: ForgeDoc, child: ForgeDoc, beforeChild: ForgeDoc) => void;

@@ -1,1 +0,1 @@

{"version":3,"file":"reconciler.d.ts","sourceRoot":"","sources":["../src/reconciler.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAClC,OAAmB,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAI1D,KAAK,WAAW,GAAG,MAAM,CAAC;AAE1B,KAAK,YAAY,GAAG;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;CAAE,CAAC;AAE3C,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,WAAW,CAAC;IAClB,KAAK,EAAE,YAAY,CAAC;IACpB,QAAQ,EAAE,QAAQ,EAAE,CAAC;IACrB,GAAG,EAAE,MAAM,CAAC;CACb;AAED,MAAM,MAAM,UAAU,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE;IAAE,QAAQ,EAAE,QAAQ,CAAA;CAAE,KAAK,IAAI,CAAC;AAC7E,eAAO,MAAM,UAAU,EAAE,UAGxB,CAAC;AAEF,eAAO,MAAM,aAAa,SAAU,WAAW,UAAS,YAAY,KAAQ,QAS3E,CAAC;AAEF,eAAO,MAAM,WAAW,WAAY,QAAQ,SAAS,QAAQ,SAM5D,CAAC;AAEF,eAAO,MAAM,YAAY,WAAY,QAAQ,SAAS,QAAQ,eAAe,QAAQ,SAOpF,CAAC;AAEF,KAAK,cAAc,GAAG,MAAM,CAAC;AAE7B,KAAK,aAAa,GAAG,MAAM,CAAC,MAAM,EAA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IF,eAAO,MAAM,eAAe;sBACR,SAAS;CAiB5B,CAAC;AAEF,eAAe,eAAe,CAAC"}

@@ -13,3 +13,3 @@ "use strict";

exports.callBridge = callBridge;
const createElement = (type, props = {}) => {
const createElement = ({ type, props = {}, reconciliationCount }) => {
const { children } = props, restProps = tslib_1.__rest(props, ["children"]);

@@ -20,3 +20,4 @@ return {

props: restProps,
key: (0, uuid_1.v4)()
key: (0, uuid_1.v4)(),
reconciliationCount
};

@@ -49,17 +50,14 @@ };

resetAfterCommit(containerInfo) {
containerInfo.reconciliationCount = containerInfo.reconciliationCount + 1;
(0, exports.callBridge)('reconcile', { forgeDoc: containerInfo });
},
createInstance(type, instanceProps) {
const element = (0, exports.createElement)(type, instanceProps);
createInstance(type, instanceProps, rootContainer) {
const { reconciliationCount } = rootContainer;
const element = (0, exports.createElement)({ type, props: instanceProps, reconciliationCount });
return element;
},
createTextInstance(text) {
return {
type: 'String',
children: [],
props: {
text
},
key: (0, uuid_1.v4)()
};
createTextInstance(text, rootContainer) {
const { reconciliationCount } = rootContainer;
const element = (0, exports.createElement)({ type: 'String', props: { text }, reconciliationCount });
return element;
},

@@ -78,3 +76,5 @@ appendInitialChild(parentInstance, child) {

},
prepareUpdate(instance, type, oldProps, newProps) {
prepareUpdate(instance, type, oldProps, newProps, rootContainer) {
const { reconciliationCount } = rootContainer;
instance.reconciliationCount = reconciliationCount + 1;
instance.props = newProps;

@@ -147,3 +147,3 @@ return newProps;

render: (element) => {
const rootElement = (0, exports.createElement)('Root');
const rootElement = (0, exports.createElement)({ type: 'Root', props: {}, reconciliationCount: 0 });
const container = reconciler.createContainer(rootElement, 0, null, false, null, 'root', (err) => {

@@ -150,0 +150,0 @@ console.log(err);

{
"name": "@forge/react",
"version": "8.0.1",
"version": "8.0.2-next.0",
"description": "Forge React reconciler",

@@ -16,3 +16,3 @@ "author": "Atlassian",

"peerDependencies": {
"@forge/ui": "1.9.1"
"@forge/ui": "1.9.2-next.0"
},

@@ -25,3 +25,6 @@ "dependencies": {

"uuid": "^3.4.0"
},
"devDependencies": {
"lodash": "^4.17.21"
}
}

Sorry, the diff of this file is not supported yet