@teambit/compositions 0.0.881 → 0.0.883
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/composition.compare.section.js +0 -13
- package/dist/composition.compare.section.js.map +1 -1
- package/dist/composition.js +0 -10
- package/dist/composition.js.map +1 -1
- package/dist/composition.section.js +0 -13
- package/dist/composition.section.js.map +1 -1
- package/dist/compositions.aspect.js +0 -5
- package/dist/compositions.aspect.js.map +1 -1
- package/dist/compositions.composition.js +0 -6
- package/dist/compositions.composition.js.map +1 -1
- package/dist/compositions.graphql.js +0 -5
- package/dist/compositions.graphql.js.map +1 -1
- package/dist/compositions.js +9 -94
- package/dist/compositions.js.map +1 -1
- package/dist/compositions.main.runtime.js +8 -75
- package/dist/compositions.main.runtime.js.map +1 -1
- package/dist/compositions.preview-definition.js +0 -12
- package/dist/compositions.preview-definition.js.map +1 -1
- package/dist/compositions.preview.runtime.js +3 -33
- package/dist/compositions.preview.runtime.js.map +1 -1
- package/dist/compositions.ui.runtime.js +1 -35
- package/dist/compositions.ui.runtime.js.map +1 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.js +0 -30
- package/dist/index.js.map +1 -1
- package/dist/ui/composition-preview.js +5 -22
- package/dist/ui/composition-preview.js.map +1 -1
- package/dist/ui/compositions-panel/compositions-panel.js +10 -31
- package/dist/ui/compositions-panel/compositions-panel.js.map +1 -1
- package/dist/ui/compositions-panel-node/compositions-panel-node.js +5 -19
- package/dist/ui/compositions-panel-node/compositions-panel-node.js.map +1 -1
- package/dist/ui/compositions-panel-node/index.js +0 -2
- package/dist/ui/compositions-panel-node/index.js.map +1 -1
- package/dist/ui/index.js +0 -3
- package/dist/ui/index.js.map +1 -1
- package/dist/ui/use-compositions.js +3 -0
- package/dist/ui/use-compositions.js.map +1 -1
- package/package-tar/teambit-compositions-0.0.883.tgz +0 -0
- package/package.json +11 -13
- package/{preview-1666409808293.js → preview-1666582798766.js} +2 -2
- package/dist/ui/compositions-overview/compositions-overview.d.ts +0 -7
- package/dist/ui/compositions-overview/compositions-overview.js +0 -56
- package/dist/ui/compositions-overview/compositions-overview.js.map +0 -1
- package/dist/ui/compositions-overview/compositions-overview.module.scss +0 -17
- package/dist/ui/compositions-overview/index.d.ts +0 -1
- package/dist/ui/compositions-overview/index.js +0 -20
- package/dist/ui/compositions-overview/index.js.map +0 -1
- package/package-tar/teambit-compositions-0.0.881.tgz +0 -0
- package/ui/compositions-overview/compositions-overview.module.scss +0 -17
- package/ui/compositions-overview/compositions-overview.tsx +0 -21
- package/ui/compositions-overview/index.ts +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["CompositionsPreview","constructor","preview","render","componentId","modules","otherPreviewDefs","context","componentMap","fullName","compositions","selectPreviewModel","metadata","getMetadata","active","getActiveComposition","mainModule","default","componentFullName","previewModule","files","combined","Object","assign","componentMapMetadata","undefined","module","firstQueryParam","window","location","hash","split","query","getQuery","compositionId","getParam","first","head","firstId","identifier","values","provider","compPreview","registerPreview","name","bind","PreviewRuntime","PreviewAspect","CompositionsAspect","addRuntime"],"sources":["compositions.preview.runtime.ts"],"sourcesContent":["import { ComponentID } from '@teambit/component-id';\nimport {\n PreviewAspect,\n PreviewPreview,\n RenderingContext,\n PreviewRuntime,\n PreviewModule,\n ModuleFile,\n} from '@teambit/preview';\nimport head from 'lodash.head';\nimport { CompositionBrowserMetadataObject } from './composition';\n\nimport { CompositionsAspect } from './compositions.aspect';\n\nexport class CompositionsPreview {\n constructor(\n /**\n * preview extension.\n */\n private preview: PreviewPreview\n ) {}\n\n render(componentId: ComponentID, modules: PreviewModule, otherPreviewDefs, context: RenderingContext) {\n if (!modules.componentMap[componentId.fullName]) return;\n\n const compositions = this.selectPreviewModel(componentId.fullName, modules);\n const metadata = this.getMetadata(componentId.fullName, modules);\n const active = this.getActiveComposition(compositions, metadata);\n\n modules.mainModule.default(active, context);\n }\n\n /** gets relevant information for this preview to render */\n selectPreviewModel(componentFullName: string, previewModule: PreviewModule) {\n const files = previewModule.componentMap[componentFullName] || [];\n\n // allow compositions to come from many files. It is assumed they will have unique named\n const combined = Object.assign({}, ...files);\n return combined;\n }\n\n getMetadata(componentFullName: string, previewModule: PreviewModule): CompositionBrowserMetadataObject | undefined {\n const metadata = previewModule?.componentMapMetadata\n ? previewModule.componentMapMetadata[componentFullName]\n : undefined;\n if (metadata) {\n return metadata as CompositionBrowserMetadataObject;\n }\n return undefined;\n }\n\n private getActiveComposition(module: ModuleFile, metadata?: CompositionBrowserMetadataObject) {\n const firstQueryParam = window.location.hash.split('&')[1];\n const query = this.preview.getQuery();\n const compositionId = this.preview.getParam(query, 'name') || firstQueryParam;\n\n if (compositionId && module[compositionId]) {\n return module[compositionId];\n }\n\n if (metadata && metadata.compositions) {\n const first = head(metadata.compositions);\n const firstId = first?.identifier;\n if (firstId && module[firstId]) {\n return module[firstId];\n }\n }\n\n const first = head(Object.values(module));\n return first;\n }\n\n static runtime = PreviewRuntime;\n\n static dependencies = [PreviewAspect];\n\n static async provider([preview]: [PreviewPreview]) {\n const compPreview = new CompositionsPreview(preview);\n preview.registerPreview({\n name: 'compositions',\n render: compPreview.render.bind(compPreview),\n selectPreviewModel: compPreview.selectPreviewModel.bind(compPreview),\n default: true,\n });\n\n return compPreview;\n }\n}\n\nCompositionsAspect.addRuntime(CompositionsPreview);\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":["CompositionsPreview","constructor","preview","render","componentId","modules","otherPreviewDefs","context","componentMap","fullName","compositions","selectPreviewModel","metadata","getMetadata","active","getActiveComposition","mainModule","default","componentFullName","previewModule","files","combined","Object","assign","componentMapMetadata","undefined","module","firstQueryParam","window","location","hash","split","query","getQuery","compositionId","getParam","first","head","firstId","identifier","values","provider","compPreview","registerPreview","name","bind","PreviewRuntime","PreviewAspect","CompositionsAspect","addRuntime"],"sources":["compositions.preview.runtime.ts"],"sourcesContent":["import { ComponentID } from '@teambit/component-id';\nimport {\n PreviewAspect,\n PreviewPreview,\n RenderingContext,\n PreviewRuntime,\n PreviewModule,\n ModuleFile,\n} from '@teambit/preview';\nimport head from 'lodash.head';\nimport { CompositionBrowserMetadataObject } from './composition';\n\nimport { CompositionsAspect } from './compositions.aspect';\n\nexport class CompositionsPreview {\n constructor(\n /**\n * preview extension.\n */\n private preview: PreviewPreview\n ) {}\n\n render(componentId: ComponentID, modules: PreviewModule, otherPreviewDefs, context: RenderingContext) {\n if (!modules.componentMap[componentId.fullName]) return;\n\n const compositions = this.selectPreviewModel(componentId.fullName, modules);\n const metadata = this.getMetadata(componentId.fullName, modules);\n const active = this.getActiveComposition(compositions, metadata);\n\n modules.mainModule.default(active, context);\n }\n\n /** gets relevant information for this preview to render */\n selectPreviewModel(componentFullName: string, previewModule: PreviewModule) {\n const files = previewModule.componentMap[componentFullName] || [];\n\n // allow compositions to come from many files. It is assumed they will have unique named\n const combined = Object.assign({}, ...files);\n return combined;\n }\n\n getMetadata(componentFullName: string, previewModule: PreviewModule): CompositionBrowserMetadataObject | undefined {\n const metadata = previewModule?.componentMapMetadata\n ? previewModule.componentMapMetadata[componentFullName]\n : undefined;\n if (metadata) {\n return metadata as CompositionBrowserMetadataObject;\n }\n return undefined;\n }\n\n private getActiveComposition(module: ModuleFile, metadata?: CompositionBrowserMetadataObject) {\n const firstQueryParam = window.location.hash.split('&')[1];\n const query = this.preview.getQuery();\n const compositionId = this.preview.getParam(query, 'name') || firstQueryParam;\n\n if (compositionId && module[compositionId]) {\n return module[compositionId];\n }\n\n if (metadata && metadata.compositions) {\n const first = head(metadata.compositions);\n const firstId = first?.identifier;\n if (firstId && module[firstId]) {\n return module[firstId];\n }\n }\n\n const first = head(Object.values(module));\n return first;\n }\n\n static runtime = PreviewRuntime;\n\n static dependencies = [PreviewAspect];\n\n static async provider([preview]: [PreviewPreview]) {\n const compPreview = new CompositionsPreview(preview);\n preview.registerPreview({\n name: 'compositions',\n render: compPreview.render.bind(compPreview),\n selectPreviewModel: compPreview.selectPreviewModel.bind(compPreview),\n default: true,\n });\n\n return compPreview;\n }\n}\n\nCompositionsAspect.addRuntime(CompositionsPreview);\n"],"mappings":"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"}
|
|
@@ -1,115 +1,84 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
require("core-js/modules/es.array.iterator.js");
|
|
6
|
-
|
|
7
5
|
require("core-js/modules/es.promise.js");
|
|
8
|
-
|
|
9
6
|
Object.defineProperty(exports, "__esModule", {
|
|
10
7
|
value: true
|
|
11
8
|
});
|
|
12
9
|
exports.default = exports.CompositionsUI = void 0;
|
|
13
|
-
|
|
14
10
|
function _defineProperty2() {
|
|
15
11
|
const data = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
16
|
-
|
|
17
12
|
_defineProperty2 = function () {
|
|
18
13
|
return data;
|
|
19
14
|
};
|
|
20
|
-
|
|
21
15
|
return data;
|
|
22
16
|
}
|
|
23
|
-
|
|
24
17
|
function _harmony() {
|
|
25
18
|
const data = require("@teambit/harmony");
|
|
26
|
-
|
|
27
19
|
_harmony = function () {
|
|
28
20
|
return data;
|
|
29
21
|
};
|
|
30
|
-
|
|
31
22
|
return data;
|
|
32
23
|
}
|
|
33
|
-
|
|
34
24
|
function _component() {
|
|
35
25
|
const data = require("@teambit/component");
|
|
36
|
-
|
|
37
26
|
_component = function () {
|
|
38
27
|
return data;
|
|
39
28
|
};
|
|
40
|
-
|
|
41
29
|
return data;
|
|
42
30
|
}
|
|
43
|
-
|
|
44
31
|
function _ui() {
|
|
45
32
|
const data = require("@teambit/ui");
|
|
46
|
-
|
|
47
33
|
_ui = function () {
|
|
48
34
|
return data;
|
|
49
35
|
};
|
|
50
|
-
|
|
51
36
|
return data;
|
|
52
37
|
}
|
|
53
|
-
|
|
54
38
|
function _componentCompare() {
|
|
55
39
|
const data = require("@teambit/component-compare");
|
|
56
|
-
|
|
57
40
|
_componentCompare = function () {
|
|
58
41
|
return data;
|
|
59
42
|
};
|
|
60
|
-
|
|
61
43
|
return data;
|
|
62
44
|
}
|
|
63
|
-
|
|
64
45
|
function _composition() {
|
|
65
46
|
const data = require("./composition.section");
|
|
66
|
-
|
|
67
47
|
_composition = function () {
|
|
68
48
|
return data;
|
|
69
49
|
};
|
|
70
|
-
|
|
71
50
|
return data;
|
|
72
51
|
}
|
|
73
|
-
|
|
74
52
|
function _compositions() {
|
|
75
53
|
const data = require("./compositions.aspect");
|
|
76
|
-
|
|
77
54
|
_compositions = function () {
|
|
78
55
|
return data;
|
|
79
56
|
};
|
|
80
|
-
|
|
81
57
|
return data;
|
|
82
58
|
}
|
|
83
|
-
|
|
84
59
|
function _compositionCompare() {
|
|
85
60
|
const data = require("./composition.compare.section");
|
|
86
|
-
|
|
87
61
|
_compositionCompare = function () {
|
|
88
62
|
return data;
|
|
89
63
|
};
|
|
90
|
-
|
|
91
64
|
return data;
|
|
92
65
|
}
|
|
93
|
-
|
|
94
66
|
class CompositionsUI {
|
|
95
67
|
constructor(menuBarWidgetSlot, emptyStateSlot) {
|
|
96
68
|
this.menuBarWidgetSlot = menuBarWidgetSlot;
|
|
97
69
|
this.emptyStateSlot = emptyStateSlot;
|
|
98
70
|
}
|
|
71
|
+
|
|
99
72
|
/**
|
|
100
73
|
* register a new tester empty state. this allows to register a different empty state from each environment for example.
|
|
101
74
|
*/
|
|
102
|
-
|
|
103
|
-
|
|
104
75
|
registerEmptyState(emptyStateComponent) {
|
|
105
76
|
this.emptyStateSlot.register(emptyStateComponent);
|
|
106
77
|
return this;
|
|
107
78
|
}
|
|
108
|
-
|
|
109
79
|
registerMenuWidget(...widget) {
|
|
110
80
|
this.menuBarWidgetSlot.register(widget);
|
|
111
81
|
}
|
|
112
|
-
|
|
113
82
|
static async provider([component, componentCompare], config, [compositionMenuSlot, emptyStateSlot]) {
|
|
114
83
|
const compositions = new CompositionsUI(compositionMenuSlot, emptyStateSlot);
|
|
115
84
|
const section = new (_composition().CompositionsSection)(compositions, {
|
|
@@ -125,16 +94,13 @@ class CompositionsUI {
|
|
|
125
94
|
componentCompare.registerRoutes([compositionCompare.route]);
|
|
126
95
|
return compositions;
|
|
127
96
|
}
|
|
128
|
-
|
|
129
97
|
}
|
|
130
|
-
|
|
131
98
|
exports.CompositionsUI = CompositionsUI;
|
|
132
99
|
(0, _defineProperty2().default)(CompositionsUI, "dependencies", [_component().ComponentAspect, _componentCompare().ComponentCompareAspect]);
|
|
133
100
|
(0, _defineProperty2().default)(CompositionsUI, "runtime", _ui().UIRuntime);
|
|
134
101
|
(0, _defineProperty2().default)(CompositionsUI, "slots", [_harmony().Slot.withType(), _harmony().Slot.withType()]);
|
|
135
102
|
var _default = CompositionsUI;
|
|
136
103
|
exports.default = _default;
|
|
137
|
-
|
|
138
104
|
_compositions().CompositionsAspect.addRuntime(CompositionsUI);
|
|
139
105
|
|
|
140
106
|
//# sourceMappingURL=compositions.ui.runtime.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["CompositionsUI","constructor","menuBarWidgetSlot","emptyStateSlot","registerEmptyState","emptyStateComponent","register","registerMenuWidget","widget","provider","component","componentCompare","config","compositionMenuSlot","compositions","section","CompositionsSection","compositionCompare","CompositionCompareSection","registerRoute","route","registerNavigation","navigationLink","order","props","registerRoutes","ComponentAspect","ComponentCompareAspect","UIRuntime","Slot","withType","CompositionsAspect","addRuntime"],"sources":["compositions.ui.runtime.tsx"],"sourcesContent":["import type { ReactNode } from 'react';\nimport { ComponentType } from 'react';\nimport { Slot, SlotRegistry } from '@teambit/harmony';\nimport { ComponentAspect, ComponentUI } from '@teambit/component';\nimport { UIRuntime } from '@teambit/ui';\nimport { ComponentCompareUI, ComponentCompareAspect } from '@teambit/component-compare';\nimport { CompositionsSection } from './composition.section';\nimport { CompositionsAspect } from './compositions.aspect';\nimport { MenuBarWidget } from './compositions';\nimport { CompositionCompareSection } from './composition.compare.section';\n\nexport type CompositionsMenuSlot = SlotRegistry<MenuBarWidget[]>;\nexport type EmptyStateSlot = SlotRegistry<ComponentType>;\n\nexport class CompositionsUI {\n constructor(private menuBarWidgetSlot: CompositionsMenuSlot, private emptyStateSlot: EmptyStateSlot) {}\n\n /**\n * register a new tester empty state. this allows to register a different empty state from each environment for example.\n */\n registerEmptyState(emptyStateComponent: ComponentType) {\n this.emptyStateSlot.register(emptyStateComponent);\n return this;\n }\n\n registerMenuWidget(...widget: MenuBarWidget[]) {\n this.menuBarWidgetSlot.register(widget);\n }\n\n static dependencies = [ComponentAspect, ComponentCompareAspect];\n static runtime = UIRuntime;\n static slots = [Slot.withType<ReactNode>(), Slot.withType<ComponentType>()];\n\n static async provider(\n [component, componentCompare]: [ComponentUI, ComponentCompareUI],\n config: {},\n [compositionMenuSlot, emptyStateSlot]: [CompositionsMenuSlot, EmptyStateSlot]\n ) {\n const compositions = new CompositionsUI(compositionMenuSlot, emptyStateSlot);\n const section = new CompositionsSection(\n compositions,\n { menuBarWidgetSlot: compositions.menuBarWidgetSlot },\n emptyStateSlot\n );\n const compositionCompare = new CompositionCompareSection(emptyStateSlot);\n\n component.registerRoute(section.route);\n component.registerNavigation(section.navigationLink, section.order);\n componentCompare.registerNavigation({\n props: compositionCompare.navigationLink,\n order: compositionCompare.navigationLink.order,\n });\n componentCompare.registerRoutes([compositionCompare.route]);\n return compositions;\n }\n}\n\nexport default CompositionsUI;\n\nCompositionsAspect.addRuntime(CompositionsUI);\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":["CompositionsUI","constructor","menuBarWidgetSlot","emptyStateSlot","registerEmptyState","emptyStateComponent","register","registerMenuWidget","widget","provider","component","componentCompare","config","compositionMenuSlot","compositions","section","CompositionsSection","compositionCompare","CompositionCompareSection","registerRoute","route","registerNavigation","navigationLink","order","props","registerRoutes","ComponentAspect","ComponentCompareAspect","UIRuntime","Slot","withType","CompositionsAspect","addRuntime"],"sources":["compositions.ui.runtime.tsx"],"sourcesContent":["import type { ReactNode } from 'react';\nimport { ComponentType } from 'react';\nimport { Slot, SlotRegistry } from '@teambit/harmony';\nimport { ComponentAspect, ComponentUI } from '@teambit/component';\nimport { UIRuntime } from '@teambit/ui';\nimport { ComponentCompareUI, ComponentCompareAspect } from '@teambit/component-compare';\nimport { CompositionsSection } from './composition.section';\nimport { CompositionsAspect } from './compositions.aspect';\nimport { MenuBarWidget } from './compositions';\nimport { CompositionCompareSection } from './composition.compare.section';\n\nexport type CompositionsMenuSlot = SlotRegistry<MenuBarWidget[]>;\nexport type EmptyStateSlot = SlotRegistry<ComponentType>;\n\nexport class CompositionsUI {\n constructor(private menuBarWidgetSlot: CompositionsMenuSlot, private emptyStateSlot: EmptyStateSlot) {}\n\n /**\n * register a new tester empty state. this allows to register a different empty state from each environment for example.\n */\n registerEmptyState(emptyStateComponent: ComponentType) {\n this.emptyStateSlot.register(emptyStateComponent);\n return this;\n }\n\n registerMenuWidget(...widget: MenuBarWidget[]) {\n this.menuBarWidgetSlot.register(widget);\n }\n\n static dependencies = [ComponentAspect, ComponentCompareAspect];\n static runtime = UIRuntime;\n static slots = [Slot.withType<ReactNode>(), Slot.withType<ComponentType>()];\n\n static async provider(\n [component, componentCompare]: [ComponentUI, ComponentCompareUI],\n config: {},\n [compositionMenuSlot, emptyStateSlot]: [CompositionsMenuSlot, EmptyStateSlot]\n ) {\n const compositions = new CompositionsUI(compositionMenuSlot, emptyStateSlot);\n const section = new CompositionsSection(\n compositions,\n { menuBarWidgetSlot: compositions.menuBarWidgetSlot },\n emptyStateSlot\n );\n const compositionCompare = new CompositionCompareSection(emptyStateSlot);\n\n component.registerRoute(section.route);\n component.registerNavigation(section.navigationLink, section.order);\n componentCompare.registerNavigation({\n props: compositionCompare.navigationLink,\n order: compositionCompare.navigationLink.order,\n });\n componentCompare.registerRoutes([compositionCompare.route]);\n return compositions;\n }\n}\n\nexport default CompositionsUI;\n\nCompositionsAspect.addRuntime(CompositionsUI);\n"],"mappings":";;;;;;;;;;;;;;;;AAEA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAKO,MAAMA,cAAc,CAAC;EAC1BC,WAAW,CAASC,iBAAuC,EAAUC,cAA8B,EAAE;IAAA,KAAjFD,iBAAuC,GAAvCA,iBAAuC;IAAA,KAAUC,cAA8B,GAA9BA,cAA8B;EAAG;;EAEtG;AACF;AACA;EACEC,kBAAkB,CAACC,mBAAkC,EAAE;IACrD,IAAI,CAACF,cAAc,CAACG,QAAQ,CAACD,mBAAmB,CAAC;IACjD,OAAO,IAAI;EACb;EAEAE,kBAAkB,CAAC,GAAGC,MAAuB,EAAE;IAC7C,IAAI,CAACN,iBAAiB,CAACI,QAAQ,CAACE,MAAM,CAAC;EACzC;EAMA,aAAaC,QAAQ,CACnB,CAACC,SAAS,EAAEC,gBAAgB,CAAoC,EAChEC,MAAU,EACV,CAACC,mBAAmB,EAAEV,cAAc,CAAyC,EAC7E;IACA,MAAMW,YAAY,GAAG,IAAId,cAAc,CAACa,mBAAmB,EAAEV,cAAc,CAAC;IAC5E,MAAMY,OAAO,GAAG,KAAIC,kCAAmB,EACrCF,YAAY,EACZ;MAAEZ,iBAAiB,EAAEY,YAAY,CAACZ;IAAkB,CAAC,EACrDC,cAAc,CACf;IACD,MAAMc,kBAAkB,GAAG,KAAIC,+CAAyB,EAACf,cAAc,CAAC;IAExEO,SAAS,CAACS,aAAa,CAACJ,OAAO,CAACK,KAAK,CAAC;IACtCV,SAAS,CAACW,kBAAkB,CAACN,OAAO,CAACO,cAAc,EAAEP,OAAO,CAACQ,KAAK,CAAC;IACnEZ,gBAAgB,CAACU,kBAAkB,CAAC;MAClCG,KAAK,EAAEP,kBAAkB,CAACK,cAAc;MACxCC,KAAK,EAAEN,kBAAkB,CAACK,cAAc,CAACC;IAC3C,CAAC,CAAC;IACFZ,gBAAgB,CAACc,cAAc,CAAC,CAACR,kBAAkB,CAACG,KAAK,CAAC,CAAC;IAC3D,OAAON,YAAY;EACrB;AACF;AAAC;AAAA,gCAzCYd,cAAc,kBAeH,CAAC0B,4BAAe,EAAEC,0CAAsB,CAAC;AAAA,gCAfpD3B,cAAc,aAgBR4B,eAAS;AAAA,gCAhBf5B,cAAc,WAiBV,CAAC6B,eAAI,CAACC,QAAQ,EAAa,EAAED,eAAI,CAACC,QAAQ,EAAiB,CAAC;AAAA,eA0B9D9B,cAAc;AAAA;AAE7B+B,kCAAkB,CAACC,UAAU,CAAChC,cAAc,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -5,6 +5,5 @@ export type { CompositionsUI, CompositionsMenuSlot, EmptyStateSlot } from './com
|
|
|
5
5
|
export { Composition, CompositionProps } from './composition';
|
|
6
6
|
export { CompositionContent, CompositionContentProps } from './compositions';
|
|
7
7
|
export type { CompositionsPreview } from './compositions.preview.runtime';
|
|
8
|
-
export { CompositionsOverview } from './ui/compositions-overview';
|
|
9
8
|
export { ComponentComposition } from './ui';
|
|
10
9
|
export default CompositionsAspect;
|
package/dist/index.js
CHANGED
|
@@ -39,66 +39,36 @@ Object.defineProperty(exports, "CompositionsAspect", {
|
|
|
39
39
|
return _compositions().CompositionsAspect;
|
|
40
40
|
}
|
|
41
41
|
});
|
|
42
|
-
Object.defineProperty(exports, "CompositionsOverview", {
|
|
43
|
-
enumerable: true,
|
|
44
|
-
get: function () {
|
|
45
|
-
return _compositionsOverview().CompositionsOverview;
|
|
46
|
-
}
|
|
47
|
-
});
|
|
48
42
|
exports.default = void 0;
|
|
49
|
-
|
|
50
43
|
function _compositions() {
|
|
51
44
|
const data = require("./compositions.aspect");
|
|
52
|
-
|
|
53
45
|
_compositions = function () {
|
|
54
46
|
return data;
|
|
55
47
|
};
|
|
56
|
-
|
|
57
48
|
return data;
|
|
58
49
|
}
|
|
59
|
-
|
|
60
50
|
function _composition() {
|
|
61
51
|
const data = require("./composition");
|
|
62
|
-
|
|
63
52
|
_composition = function () {
|
|
64
53
|
return data;
|
|
65
54
|
};
|
|
66
|
-
|
|
67
55
|
return data;
|
|
68
56
|
}
|
|
69
|
-
|
|
70
57
|
function _compositions2() {
|
|
71
58
|
const data = require("./compositions");
|
|
72
|
-
|
|
73
59
|
_compositions2 = function () {
|
|
74
60
|
return data;
|
|
75
61
|
};
|
|
76
|
-
|
|
77
62
|
return data;
|
|
78
63
|
}
|
|
79
|
-
|
|
80
|
-
function _compositionsOverview() {
|
|
81
|
-
const data = require("./ui/compositions-overview");
|
|
82
|
-
|
|
83
|
-
_compositionsOverview = function () {
|
|
84
|
-
return data;
|
|
85
|
-
};
|
|
86
|
-
|
|
87
|
-
return data;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
64
|
function _ui() {
|
|
91
65
|
const data = require("./ui");
|
|
92
|
-
|
|
93
66
|
_ui = function () {
|
|
94
67
|
return data;
|
|
95
68
|
};
|
|
96
|
-
|
|
97
69
|
return data;
|
|
98
70
|
}
|
|
99
|
-
|
|
100
71
|
var _default = _compositions().CompositionsAspect;
|
|
101
|
-
|
|
102
72
|
exports.default = _default;
|
|
103
73
|
|
|
104
74
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["CompositionsAspect"],"sources":["index.ts"],"sourcesContent":["import { CompositionsAspect } from './compositions.aspect';\n\nexport { CompositionsAspect };\nexport type { CompositionsMain } from './compositions.main.runtime';\nexport type { CompositionsUI, CompositionsMenuSlot, EmptyStateSlot } from './compositions.ui.runtime';\nexport { Composition, CompositionProps } from './composition';\nexport { CompositionContent, CompositionContentProps } from './compositions';\nexport type { CompositionsPreview } from './compositions.preview.runtime';\nexport {
|
|
1
|
+
{"version":3,"names":["CompositionsAspect"],"sources":["index.ts"],"sourcesContent":["import { CompositionsAspect } from './compositions.aspect';\n\nexport { CompositionsAspect };\nexport type { CompositionsMain } from './compositions.main.runtime';\nexport type { CompositionsUI, CompositionsMenuSlot, EmptyStateSlot } from './compositions.ui.runtime';\nexport { Composition, CompositionProps } from './composition';\nexport { CompositionContent, CompositionContentProps } from './compositions';\nexport type { CompositionsPreview } from './compositions.preview.runtime';\nexport { ComponentComposition } from './ui';\nexport default CompositionsAspect;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAKA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAA4C,eAC7BA,kCAAkB;AAAA"}
|
|
@@ -1,66 +1,49 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports.ComponentComposition = ComponentComposition;
|
|
9
|
-
|
|
10
8
|
function _extends2() {
|
|
11
9
|
const data = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
12
|
-
|
|
13
10
|
_extends2 = function () {
|
|
14
11
|
return data;
|
|
15
12
|
};
|
|
16
|
-
|
|
17
13
|
return data;
|
|
18
14
|
}
|
|
19
|
-
|
|
20
15
|
function _objectWithoutProperties2() {
|
|
21
16
|
const data = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
22
|
-
|
|
23
17
|
_objectWithoutProperties2 = function () {
|
|
24
18
|
return data;
|
|
25
19
|
};
|
|
26
|
-
|
|
27
20
|
return data;
|
|
28
21
|
}
|
|
29
|
-
|
|
30
22
|
function _react() {
|
|
31
23
|
const data = _interopRequireWildcard(require("react"));
|
|
32
|
-
|
|
33
24
|
_react = function () {
|
|
34
25
|
return data;
|
|
35
26
|
};
|
|
36
|
-
|
|
37
27
|
return data;
|
|
38
28
|
}
|
|
39
|
-
|
|
40
29
|
function _previewUi() {
|
|
41
30
|
const data = require("@teambit/preview.ui.component-preview");
|
|
42
|
-
|
|
43
31
|
_previewUi = function () {
|
|
44
32
|
return data;
|
|
45
33
|
};
|
|
46
|
-
|
|
47
34
|
return data;
|
|
48
35
|
}
|
|
49
|
-
|
|
50
36
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
51
|
-
|
|
52
37
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
53
|
-
|
|
54
38
|
function ComponentComposition(_ref) {
|
|
55
39
|
let {
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
40
|
+
composition,
|
|
41
|
+
component,
|
|
42
|
+
queryParams = []
|
|
43
|
+
} = _ref,
|
|
44
|
+
rest = (0, _objectWithoutProperties2().default)(_ref, ["composition", "component", "queryParams"]);
|
|
61
45
|
const compositionParams = (0, _react().useMemo)(() => {
|
|
62
46
|
var _component$preview;
|
|
63
|
-
|
|
64
47
|
return (composition ? [(_component$preview = component.preview) !== null && _component$preview !== void 0 && _component$preview.isScaling ? `name=${composition.identifier}` : composition.identifier] : []).concat(queryParams);
|
|
65
48
|
}, [composition === null || composition === void 0 ? void 0 : composition.identifier, queryParams]);
|
|
66
49
|
return /*#__PURE__*/_react().default.createElement(_previewUi().ComponentPreview, (0, _extends2().default)({}, rest, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["ComponentComposition","composition","component","queryParams","rest","compositionParams","useMemo","preview","isScaling","identifier","concat","width","height"],"sources":["composition-preview.tsx"],"sourcesContent":["import React, { useMemo } from 'react';\nimport { ComponentPreview, ComponentPreviewProps } from '@teambit/preview.ui.component-preview';\n\nimport { Composition } from '../composition';\n\nexport type ComponentCompositionProps = {\n /**\n * composition to use for component rendering.\n */\n composition?: Composition;\n} & ComponentPreviewProps;\n\nexport function ComponentComposition({ composition, component, queryParams = [], ...rest }: ComponentCompositionProps) {\n const compositionParams = useMemo(\n () =>\n (composition\n ? [component.preview?.isScaling ? `name=${composition.identifier}` : composition.identifier]\n : []\n ).concat(queryParams),\n [composition?.identifier, queryParams]\n );\n\n return (\n <ComponentPreview\n {...rest}\n component={component}\n style={{ width: '100%', height: '100%' }}\n previewName=\"compositions\"\n queryParams={compositionParams}\n />\n );\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":["ComponentComposition","composition","component","queryParams","rest","compositionParams","useMemo","preview","isScaling","identifier","concat","width","height"],"sources":["composition-preview.tsx"],"sourcesContent":["import React, { useMemo } from 'react';\nimport { ComponentPreview, ComponentPreviewProps } from '@teambit/preview.ui.component-preview';\n\nimport { Composition } from '../composition';\n\nexport type ComponentCompositionProps = {\n /**\n * composition to use for component rendering.\n */\n composition?: Composition;\n} & ComponentPreviewProps;\n\nexport function ComponentComposition({ composition, component, queryParams = [], ...rest }: ComponentCompositionProps) {\n const compositionParams = useMemo(\n () =>\n (composition\n ? [component.preview?.isScaling ? `name=${composition.identifier}` : composition.identifier]\n : []\n ).concat(queryParams),\n [composition?.identifier, queryParams]\n );\n\n return (\n <ComponentPreview\n {...rest}\n component={component}\n style={{ width: '100%', height: '100%' }}\n previewName=\"compositions\"\n queryParams={compositionParams}\n />\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAAgG;AAAA;AAWzF,SAASA,oBAAoB,OAAmF;EAAA,IAAlF;MAAEC,WAAW;MAAEC,SAAS;MAAEC,WAAW,GAAG;IAAuC,CAAC;IAAjCC,IAAI;EACtF,MAAMC,iBAAiB,GAAG,IAAAC,gBAAO,EAC/B;IAAA;IAAA,OACE,CAACL,WAAW,GACR,CAAC,sBAAAC,SAAS,CAACK,OAAO,+CAAjB,mBAAmBC,SAAS,GAAI,QAAOP,WAAW,CAACQ,UAAW,EAAC,GAAGR,WAAW,CAACQ,UAAU,CAAC,GAC1F,EAAE,EACJC,MAAM,CAACP,WAAW,CAAC;EAAA,GACvB,CAACF,WAAW,aAAXA,WAAW,uBAAXA,WAAW,CAAEQ,UAAU,EAAEN,WAAW,CAAC,CACvC;EAED,oBACE,+BAAC,6BAAgB,+BACXC,IAAI;IACR,SAAS,EAAEF,SAAU;IACrB,KAAK,EAAE;MAAES,KAAK,EAAE,MAAM;MAAEC,MAAM,EAAE;IAAO,CAAE;IACzC,WAAW,EAAC,cAAc;IAC1B,WAAW,EAAEP;EAAkB,GAC/B;AAEN"}
|
|
@@ -1,94 +1,73 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports.CompositionsPanel = CompositionsPanel;
|
|
9
|
-
|
|
10
8
|
function _extends2() {
|
|
11
9
|
const data = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
12
|
-
|
|
13
10
|
_extends2 = function () {
|
|
14
11
|
return data;
|
|
15
12
|
};
|
|
16
|
-
|
|
17
13
|
return data;
|
|
18
14
|
}
|
|
19
|
-
|
|
20
15
|
function _objectWithoutProperties2() {
|
|
21
16
|
const data = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
22
|
-
|
|
23
17
|
_objectWithoutProperties2 = function () {
|
|
24
18
|
return data;
|
|
25
19
|
};
|
|
26
|
-
|
|
27
20
|
return data;
|
|
28
21
|
}
|
|
29
|
-
|
|
30
22
|
function _evangelistElements() {
|
|
31
23
|
const data = require("@teambit/evangelist.elements.icon");
|
|
32
|
-
|
|
33
24
|
_evangelistElements = function () {
|
|
34
25
|
return data;
|
|
35
26
|
};
|
|
36
|
-
|
|
37
27
|
return data;
|
|
38
28
|
}
|
|
39
|
-
|
|
40
29
|
function _classnames() {
|
|
41
30
|
const data = _interopRequireDefault(require("classnames"));
|
|
42
|
-
|
|
43
31
|
_classnames = function () {
|
|
44
32
|
return data;
|
|
45
33
|
};
|
|
46
|
-
|
|
47
34
|
return data;
|
|
48
35
|
}
|
|
49
|
-
|
|
50
36
|
function _react() {
|
|
51
37
|
const data = _interopRequireWildcard(require("react"));
|
|
52
|
-
|
|
53
38
|
_react = function () {
|
|
54
39
|
return data;
|
|
55
40
|
};
|
|
56
|
-
|
|
57
41
|
return data;
|
|
58
42
|
}
|
|
59
|
-
|
|
60
43
|
function _compositionsPanelModule() {
|
|
61
44
|
const data = _interopRequireDefault(require("./compositions-panel.module.scss"));
|
|
62
|
-
|
|
63
45
|
_compositionsPanelModule = function () {
|
|
64
46
|
return data;
|
|
65
47
|
};
|
|
66
|
-
|
|
67
48
|
return data;
|
|
68
49
|
}
|
|
69
|
-
|
|
70
50
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
71
|
-
|
|
72
51
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
73
|
-
|
|
74
52
|
function CompositionsPanel(_ref) {
|
|
75
53
|
let {
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
54
|
+
url,
|
|
55
|
+
compositions,
|
|
56
|
+
isScaling,
|
|
57
|
+
onSelectComposition: onSelect,
|
|
58
|
+
active,
|
|
59
|
+
className
|
|
60
|
+
} = _ref,
|
|
61
|
+
rest = (0, _objectWithoutProperties2().default)(_ref, ["url", "compositions", "isScaling", "onSelectComposition", "active", "className"]);
|
|
84
62
|
const handleSelect = (0, _react().useCallback)(selected => {
|
|
85
63
|
onSelect && onSelect(selected);
|
|
86
64
|
}, [onSelect]);
|
|
87
65
|
return /*#__PURE__*/_react().default.createElement("ul", (0, _extends2().default)({}, rest, {
|
|
88
66
|
className: (0, _classnames().default)(className)
|
|
89
67
|
}), compositions.map(composition => {
|
|
90
|
-
const href = isScaling ? `${url}&name=${composition.identifier}` : `${url}&${composition.identifier}`;
|
|
68
|
+
const href = isScaling ? `${url}&name=${composition.identifier}` : `${url}&${composition.identifier}`;
|
|
91
69
|
|
|
70
|
+
// TODO - move to composition panel node
|
|
92
71
|
return /*#__PURE__*/_react().default.createElement("li", {
|
|
93
72
|
key: composition.identifier,
|
|
94
73
|
className: (0, _classnames().default)(_compositionsPanelModule().default.linkWrapper, composition === active && _compositionsPanelModule().default.active)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["CompositionsPanel","url","compositions","isScaling","onSelectComposition","onSelect","active","className","rest","handleSelect","useCallback","selected","classNames","map","composition","href","identifier","styles","linkWrapper","panelLink","box","name","displayName","right","icon"],"sources":["compositions-panel.tsx"],"sourcesContent":["import { Icon } from '@teambit/evangelist.elements.icon';\nimport classNames from 'classnames';\nimport React, { useCallback } from 'react';\n\nimport { Composition } from '../../composition';\nimport styles from './compositions-panel.module.scss';\n\nexport type CompositionsPanelProps = {\n /**\n * list of compositions\n */\n compositions: Composition[];\n /**\n * select composition to display\n */\n onSelectComposition: (composition: Composition) => void;\n /**\n * the currently active composition\n */\n active?: Composition;\n /**\n * the url to the base composition. doesntc contain the current composition params\n */\n url: string;\n /**\n * checks if a component is using the new preview api. if false, doesnt scale to support new preview\n */\n isScaling?: boolean;\n} & React.HTMLAttributes<HTMLUListElement>;\n\nexport function CompositionsPanel({\n url,\n compositions,\n isScaling,\n onSelectComposition: onSelect,\n active,\n className,\n ...rest\n}: CompositionsPanelProps) {\n const handleSelect = useCallback(\n (selected: Composition) => {\n onSelect && onSelect(selected);\n },\n [onSelect]\n );\n\n return (\n <ul {...rest} className={classNames(className)}>\n {compositions.map((composition) => {\n const href = isScaling ? `${url}&name=${composition.identifier}` : `${url}&${composition.identifier}`;\n\n // TODO - move to composition panel node\n return (\n <li\n key={composition.identifier}\n className={classNames(styles.linkWrapper, composition === active && styles.active)}\n >\n <a className={styles.panelLink} onClick={() => handleSelect(composition)}>\n <span className={styles.box}></span>\n <span className={styles.name}>{composition.displayName}</span>\n </a>\n <div className={styles.right}>\n <a className={styles.panelLink} target=\"_blank\" rel=\"noopener noreferrer\" href={href}>\n <Icon className={styles.icon} of=\"open-tab\" />\n </a>\n </div>\n </li>\n );\n })}\n </ul>\n );\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":["CompositionsPanel","url","compositions","isScaling","onSelectComposition","onSelect","active","className","rest","handleSelect","useCallback","selected","classNames","map","composition","href","identifier","styles","linkWrapper","panelLink","box","name","displayName","right","icon"],"sources":["compositions-panel.tsx"],"sourcesContent":["import { Icon } from '@teambit/evangelist.elements.icon';\nimport classNames from 'classnames';\nimport React, { useCallback } from 'react';\n\nimport { Composition } from '../../composition';\nimport styles from './compositions-panel.module.scss';\n\nexport type CompositionsPanelProps = {\n /**\n * list of compositions\n */\n compositions: Composition[];\n /**\n * select composition to display\n */\n onSelectComposition: (composition: Composition) => void;\n /**\n * the currently active composition\n */\n active?: Composition;\n /**\n * the url to the base composition. doesntc contain the current composition params\n */\n url: string;\n /**\n * checks if a component is using the new preview api. if false, doesnt scale to support new preview\n */\n isScaling?: boolean;\n} & React.HTMLAttributes<HTMLUListElement>;\n\nexport function CompositionsPanel({\n url,\n compositions,\n isScaling,\n onSelectComposition: onSelect,\n active,\n className,\n ...rest\n}: CompositionsPanelProps) {\n const handleSelect = useCallback(\n (selected: Composition) => {\n onSelect && onSelect(selected);\n },\n [onSelect]\n );\n\n return (\n <ul {...rest} className={classNames(className)}>\n {compositions.map((composition) => {\n const href = isScaling ? `${url}&name=${composition.identifier}` : `${url}&${composition.identifier}`;\n\n // TODO - move to composition panel node\n return (\n <li\n key={composition.identifier}\n className={classNames(styles.linkWrapper, composition === active && styles.active)}\n >\n <a className={styles.panelLink} onClick={() => handleSelect(composition)}>\n <span className={styles.box}></span>\n <span className={styles.name}>{composition.displayName}</span>\n </a>\n <div className={styles.right}>\n <a className={styles.panelLink} target=\"_blank\" rel=\"noopener noreferrer\" href={href}>\n <Icon className={styles.icon} of=\"open-tab\" />\n </a>\n </div>\n </li>\n );\n })}\n </ul>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAGA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAAsD;AAAA;AAyB/C,SAASA,iBAAiB,OAQN;EAAA,IARO;MAChCC,GAAG;MACHC,YAAY;MACZC,SAAS;MACTC,mBAAmB,EAAEC,QAAQ;MAC7BC,MAAM;MACNC;IAEsB,CAAC;IADpBC,IAAI;EAEP,MAAMC,YAAY,GAAG,IAAAC,oBAAW,EAC7BC,QAAqB,IAAK;IACzBN,QAAQ,IAAIA,QAAQ,CAACM,QAAQ,CAAC;EAChC,CAAC,EACD,CAACN,QAAQ,CAAC,CACX;EAED,oBACE,kEAAQG,IAAI;IAAE,SAAS,EAAE,IAAAI,qBAAU,EAACL,SAAS;EAAE,IAC5CL,YAAY,CAACW,GAAG,CAAEC,WAAW,IAAK;IACjC,MAAMC,IAAI,GAAGZ,SAAS,GAAI,GAAEF,GAAI,SAAQa,WAAW,CAACE,UAAW,EAAC,GAAI,GAAEf,GAAI,IAAGa,WAAW,CAACE,UAAW,EAAC;;IAErG;IACA,oBACE;MACE,GAAG,EAAEF,WAAW,CAACE,UAAW;MAC5B,SAAS,EAAE,IAAAJ,qBAAU,EAACK,kCAAM,CAACC,WAAW,EAAEJ,WAAW,KAAKR,MAAM,IAAIW,kCAAM,CAACX,MAAM;IAAE,gBAEnF;MAAG,SAAS,EAAEW,kCAAM,CAACE,SAAU;MAAC,OAAO,EAAE,MAAMV,YAAY,CAACK,WAAW;IAAE,gBACvE;MAAM,SAAS,EAAEG,kCAAM,CAACG;IAAI,EAAQ,eACpC;MAAM,SAAS,EAAEH,kCAAM,CAACI;IAAK,GAAEP,WAAW,CAACQ,WAAW,CAAQ,CAC5D,eACJ;MAAK,SAAS,EAAEL,kCAAM,CAACM;IAAM,gBAC3B;MAAG,SAAS,EAAEN,kCAAM,CAACE,SAAU;MAAC,MAAM,EAAC,QAAQ;MAAC,GAAG,EAAC,qBAAqB;MAAC,IAAI,EAAEJ;IAAK,gBACnF,+BAAC,0BAAI;MAAC,SAAS,EAAEE,kCAAM,CAACO,IAAK;MAAC,EAAE,EAAC;IAAU,EAAG,CAC5C,CACA,CACH;EAET,CAAC,CAAC,CACC;AAET"}
|
|
@@ -1,59 +1,45 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports.CompositionsPanelNode = CompositionsPanelNode;
|
|
9
|
-
|
|
10
8
|
function _objectWithoutProperties2() {
|
|
11
9
|
const data = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
12
|
-
|
|
13
10
|
_objectWithoutProperties2 = function () {
|
|
14
11
|
return data;
|
|
15
12
|
};
|
|
16
|
-
|
|
17
13
|
return data;
|
|
18
14
|
}
|
|
19
|
-
|
|
20
15
|
function _classnames() {
|
|
21
16
|
const data = _interopRequireDefault(require("classnames"));
|
|
22
|
-
|
|
23
17
|
_classnames = function () {
|
|
24
18
|
return data;
|
|
25
19
|
};
|
|
26
|
-
|
|
27
20
|
return data;
|
|
28
21
|
}
|
|
29
|
-
|
|
30
22
|
function _react() {
|
|
31
23
|
const data = _interopRequireDefault(require("react"));
|
|
32
|
-
|
|
33
24
|
_react = function () {
|
|
34
25
|
return data;
|
|
35
26
|
};
|
|
36
|
-
|
|
37
27
|
return data;
|
|
38
28
|
}
|
|
39
|
-
|
|
40
29
|
function _compositionsPanelNodeModule() {
|
|
41
30
|
const data = _interopRequireDefault(require("./compositions-panel-node.module.scss"));
|
|
42
|
-
|
|
43
31
|
_compositionsPanelNodeModule = function () {
|
|
44
32
|
return data;
|
|
45
33
|
};
|
|
46
|
-
|
|
47
34
|
return data;
|
|
48
35
|
}
|
|
49
|
-
|
|
50
36
|
function CompositionsPanelNode(_ref) {
|
|
51
37
|
let {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
38
|
+
name,
|
|
39
|
+
onClick,
|
|
40
|
+
isActive
|
|
41
|
+
} = _ref,
|
|
42
|
+
rest = (0, _objectWithoutProperties2().default)(_ref, ["name", "onClick", "isActive"]);
|
|
57
43
|
return /*#__PURE__*/_react().default.createElement("li", rest, /*#__PURE__*/_react().default.createElement("div", {
|
|
58
44
|
className: (0, _classnames().default)(_compositionsPanelNodeModule().default.linkWrapper, {
|
|
59
45
|
[_compositionsPanelNodeModule().default.active]: isActive
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["CompositionsPanelNode","name","onClick","isActive","rest","classNames","styles","linkWrapper","active","panelLink"],"sources":["compositions-panel-node.tsx"],"sourcesContent":["import classNames from 'classnames';\nimport React from 'react';\n\nimport styles from './compositions-panel-node.module.scss';\n\nexport type CompositionsPanelNodeProps = {\n name: string;\n onClick: (event: React.MouseEvent<HTMLAnchorElement>) => void;\n isActive: boolean;\n} & React.HTMLAttributes<HTMLLIElement>;\n\nexport function CompositionsPanelNode({ name, onClick, isActive, ...rest }: CompositionsPanelNodeProps) {\n return (\n <li {...rest}>\n <div className={classNames(styles.linkWrapper, { [styles.active]: isActive })}>\n <a className={styles.panelLink} onClick={onClick}>\n {name}\n </a>\n </div>\n </li>\n );\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":["CompositionsPanelNode","name","onClick","isActive","rest","classNames","styles","linkWrapper","active","panelLink"],"sources":["compositions-panel-node.tsx"],"sourcesContent":["import classNames from 'classnames';\nimport React from 'react';\n\nimport styles from './compositions-panel-node.module.scss';\n\nexport type CompositionsPanelNodeProps = {\n name: string;\n onClick: (event: React.MouseEvent<HTMLAnchorElement>) => void;\n isActive: boolean;\n} & React.HTMLAttributes<HTMLLIElement>;\n\nexport function CompositionsPanelNode({ name, onClick, isActive, ...rest }: CompositionsPanelNodeProps) {\n return (\n <li {...rest}>\n <div className={classNames(styles.linkWrapper, { [styles.active]: isActive })}>\n <a className={styles.panelLink} onClick={onClick}>\n {name}\n </a>\n </div>\n </li>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAQO,SAASA,qBAAqB,OAAmE;EAAA,IAAlE;MAAEC,IAAI;MAAEC,OAAO;MAAEC;IAA8C,CAAC;IAAlCC,IAAI;EACtE,oBACE,qCAAQA,IAAI,eACV;IAAK,SAAS,EAAE,IAAAC,qBAAU,EAACC,sCAAM,CAACC,WAAW,EAAE;MAAE,CAACD,sCAAM,CAACE,MAAM,GAAGL;IAAS,CAAC;EAAE,gBAC5E;IAAG,SAAS,EAAEG,sCAAM,CAACG,SAAU;IAAC,OAAO,EAAEP;EAAQ,GAC9CD,IAAI,CACH,CACA,CACH;AAET"}
|
|
@@ -3,9 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
|
|
7
6
|
var _compositionsPanelNode = require("./compositions-panel-node");
|
|
8
|
-
|
|
9
7
|
Object.keys(_compositionsPanelNode).forEach(function (key) {
|
|
10
8
|
if (key === "default" || key === "__esModule") return;
|
|
11
9
|
if (key in exports && exports[key] === _compositionsPanelNode[key]) return;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export * from './compositions-panel-node';\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export * from './compositions-panel-node';\n"],"mappings":";;;;;AAAA;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA"}
|
package/dist/ui/index.js
CHANGED
|
@@ -9,14 +9,11 @@ Object.defineProperty(exports, "ComponentComposition", {
|
|
|
9
9
|
return _compositionPreview().ComponentComposition;
|
|
10
10
|
}
|
|
11
11
|
});
|
|
12
|
-
|
|
13
12
|
function _compositionPreview() {
|
|
14
13
|
const data = require("./composition-preview");
|
|
15
|
-
|
|
16
14
|
_compositionPreview = function () {
|
|
17
15
|
return data;
|
|
18
16
|
};
|
|
19
|
-
|
|
20
17
|
return data;
|
|
21
18
|
}
|
|
22
19
|
|
package/dist/ui/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export { ComponentComposition } from './composition-preview';\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export { ComponentComposition } from './composition-preview';\n"],"mappings":";;;;;;;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA"}
|
|
@@ -2,10 +2,13 @@
|
|
|
2
2
|
// import { ComponentModel } from '../../component';
|
|
3
3
|
// import { Composition } from '../composition';
|
|
4
4
|
// import { useDataQuery } from '../../ui';
|
|
5
|
+
|
|
5
6
|
// const GET_COMPOSITIONS = gql`
|
|
6
7
|
// compositions: {
|
|
8
|
+
|
|
7
9
|
// }
|
|
8
10
|
// `;
|
|
11
|
+
|
|
9
12
|
// export function useCompositions(component: ComponentModel): Composition[] | [] {
|
|
10
13
|
// useDataQuery();
|
|
11
14
|
// }
|