@fluid-topics/ft-viewer 2.1.23 → 2.2.0

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.
@@ -3,7 +3,6 @@ export * from "./ft-ud-viewer-context";
3
3
  export * from "./model/ft-ud-viewer.models";
4
4
  export * from "./components/registration";
5
5
  export * from "./components/ft-ud-viewer-content";
6
- export * from "./components/ft-ud-viewer-content-control";
7
6
  export * from "./components/ft-ud-viewer-filename";
8
7
  export * from "./components/ft-ud-viewer-title";
9
8
  export * from "./components/ft-ud-viewer-mime-type-icon";
package/build/ud/index.js CHANGED
@@ -3,7 +3,6 @@ export * from "./ft-ud-viewer-context";
3
3
  export * from "./model/ft-ud-viewer.models";
4
4
  export * from "./components/registration";
5
5
  export * from "./components/ft-ud-viewer-content";
6
- export * from "./components/ft-ud-viewer-content-control";
7
6
  export * from "./components/ft-ud-viewer-filename";
8
7
  export * from "./components/ft-ud-viewer-title";
9
8
  export * from "./components/ft-ud-viewer-mime-type-icon";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluid-topics/ft-viewer",
3
- "version": "2.1.23",
3
+ "version": "2.2.0",
4
4
  "description": "File viewer components",
5
5
  "keywords": [
6
6
  "Lit"
@@ -19,18 +19,18 @@
19
19
  "url": "ssh://git@scm.mrs.antidot.net:2222/fluidtopics/ft-web-components.git"
20
20
  },
21
21
  "dependencies": {
22
- "@fluid-topics/ft-content-watermark": "2.1.23",
23
- "@fluid-topics/ft-i18n": "2.1.23",
24
- "@fluid-topics/ft-reader-attachments": "2.1.23",
25
- "@fluid-topics/ft-reader-feedback": "2.1.23",
26
- "@fluid-topics/ft-search-result-context": "2.1.23",
27
- "@fluid-topics/ft-wc-utils": "2.1.23",
22
+ "@fluid-topics/ft-content-watermark": "2.2.0",
23
+ "@fluid-topics/ft-i18n": "2.2.0",
24
+ "@fluid-topics/ft-reader-attachments": "2.2.0",
25
+ "@fluid-topics/ft-reader-feedback": "2.2.0",
26
+ "@fluid-topics/ft-search-result-context": "2.2.0",
27
+ "@fluid-topics/ft-wc-utils": "2.2.0",
28
28
  "@fluid-topics/public-api": "1.0.137",
29
29
  "@lit/context": "1.1.6",
30
- "lit": "3.1.0"
30
+ "lit": "3.3.3"
31
31
  },
32
32
  "devDependencies": {
33
- "@fluid-topics/ft-wc-test-utils": "2.1.23"
33
+ "@fluid-topics/ft-wc-test-utils": "2.2.0"
34
34
  },
35
- "gitHead": "e3ca12cf64b1a6af677ff8eb408b8dd3e85797f3"
35
+ "gitHead": "524448c19965dfe37c04bfb9a6d0e7d084fa12ce"
36
36
  }
@@ -1,5 +0,0 @@
1
- import { FtViewerContentControl } from "../../common/ft-viewer-content-control";
2
- declare const FtAssetViewerContentControl_base: import("./registration").FtAssetViewerComponentType<typeof FtViewerContentControl>;
3
- export declare class FtAssetViewerContentControl extends FtAssetViewerContentControl_base {
4
- }
5
- export {};
@@ -1,4 +0,0 @@
1
- import { toFtAssetViewerComponent } from "./registration";
2
- import { FtViewerContentControl } from "../../common/ft-viewer-content-control";
3
- export class FtAssetViewerContentControl extends toFtAssetViewerComponent(FtViewerContentControl) {
4
- }
@@ -1,35 +0,0 @@
1
- import { FtViewerComponent } from "./FtViewerComponent";
2
- import { FtFileDescriptor, FtViewerContentControls } from "./model/ft-viewer.models";
3
- import { ElementDefinitionsMap } from "@fluid-topics/ft-wc-utils";
4
- import { nothing, PropertyValues } from "lit";
5
- import { FtIcons } from "@fluid-topics/ft-icon";
6
- import { FtTooltip } from "@fluid-topics/ft-tooltip";
7
- type ControlDefintion = {
8
- ariaLabel: () => string;
9
- icon: FtIcons;
10
- disabled?: () => boolean;
11
- run: () => void;
12
- };
13
- declare const FtViewerContentControl_base: typeof FtViewerComponent & import("@fluid-topics/ft-wc-utils").Constructor<import("@fluid-topics/ft-i18n").FtLitElementWithI18nInterface> & import("@fluid-topics/ft-wc-utils").Constructor<import("@fluid-topics/ft-wc-utils").FtLitElementWithConditionalVisibilityInterface>;
14
- export declare class FtViewerContentControl extends FtViewerContentControl_base {
15
- static elementDefinitions: ElementDefinitionsMap;
16
- disabled: boolean;
17
- tabindex: number | null;
18
- role: string | null;
19
- ariaLabel: string | null;
20
- control: FtViewerContentControls;
21
- descriptor?: FtFileDescriptor;
22
- zoom: number | undefined;
23
- rotation: number;
24
- protected controlDefinitions: Record<FtViewerContentControls, ControlDefintion>;
25
- static styles: import("lit").CSSResult;
26
- protected render(): import("lit-html").TemplateResult<1> | typeof nothing;
27
- protected willUpdate(props: PropertyValues): void;
28
- onI18nUpdate(context: string): void;
29
- private updateAriaLabel;
30
- tooltip?: FtTooltip;
31
- connectedCallback(): void;
32
- disconnectedCallback(): void;
33
- private modifyContent;
34
- }
35
- export {};
@@ -1,164 +0,0 @@
1
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
- return c > 3 && r && Object.defineProperty(target, key, r), r;
6
- };
7
- import { FtViewerComponent } from "./FtViewerComponent";
8
- import { property, query, } from "lit/decorators.js";
9
- import { FtViewerContentControls, } from "./model/ft-viewer.models";
10
- import { designSystemVariables, redux, withConditionalVisibility, } from "@fluid-topics/ft-wc-utils";
11
- import { css, html, nothing, } from "lit";
12
- import { withI18n } from "@fluid-topics/ft-i18n";
13
- import { FtIcon, FtIcons, } from "@fluid-topics/ft-icon";
14
- import { FtTooltip } from "@fluid-topics/ft-tooltip";
15
- import { defaultViewerMessages, viewerContext, } from "./ft-viewer.messages";
16
- export class FtViewerContentControl extends withConditionalVisibility(withI18n(FtViewerComponent)) {
17
- constructor() {
18
- super(...arguments);
19
- this.disabled = false;
20
- this.tabindex = 0;
21
- this.role = "button";
22
- this.ariaLabel = "";
23
- this.control = FtViewerContentControls.FIT_TO_CONTAINER;
24
- this.controlDefinitions = {
25
- [FtViewerContentControls.FIT_TO_CONTAINER]: {
26
- ariaLabel: () => viewerContext.messages.fitToContainerAriaLabel(),
27
- icon: FtIcons.ZOOM_FULLSCREEN,
28
- run: () => { var _a; return (_a = this.viewerStateManager) === null || _a === void 0 ? void 0 : _a.setZoom(undefined); },
29
- },
30
- [FtViewerContentControls.ZOOM_REAL_SIZE]: {
31
- ariaLabel: () => viewerContext.messages.zoomRealSizeAriaLabel(),
32
- icon: FtIcons.ZOOM_REALSIZE,
33
- run: () => { var _a; return (_a = this.viewerStateManager) === null || _a === void 0 ? void 0 : _a.setZoom(1); },
34
- },
35
- [FtViewerContentControls.ZOOM_IN]: {
36
- ariaLabel: () => viewerContext.messages.zoomInAriaLabel(),
37
- icon: FtIcons.ZOOM_IN,
38
- disabled: () => { var _a; return ((_a = this.zoom) !== null && _a !== void 0 ? _a : 1) > 20; },
39
- run: () => { var _a, _b; return (_a = this.viewerStateManager) === null || _a === void 0 ? void 0 : _a.setZoom(((_b = this.zoom) !== null && _b !== void 0 ? _b : 1) * 1.2); },
40
- },
41
- [FtViewerContentControls.ZOOM_OUT]: {
42
- ariaLabel: () => viewerContext.messages.zoomOutAriaLabel(),
43
- icon: FtIcons.ZOOM_OUT,
44
- disabled: () => { var _a; return ((_a = this.zoom) !== null && _a !== void 0 ? _a : 1) < 0.05; },
45
- run: () => { var _a, _b; return (_a = this.viewerStateManager) === null || _a === void 0 ? void 0 : _a.setZoom(((_b = this.zoom) !== null && _b !== void 0 ? _b : 1) / 1.2); },
46
- },
47
- [FtViewerContentControls.ROTATE_LEFT]: {
48
- ariaLabel: () => viewerContext.messages.rotateLeftAriaLabel(),
49
- icon: FtIcons.ARROW_ROTATE_LEFT,
50
- run: () => { var _a; return (_a = this.viewerStateManager) === null || _a === void 0 ? void 0 : _a.setRotation(this.rotation - 90); },
51
- },
52
- [FtViewerContentControls.ROTATE_RIGHT]: {
53
- ariaLabel: () => viewerContext.messages.rotateRightAriaLabel(),
54
- icon: FtIcons.ARROW_ROTATE_RIGHT,
55
- run: () => { var _a; return (_a = this.viewerStateManager) === null || _a === void 0 ? void 0 : _a.setRotation(this.rotation + 90); },
56
- },
57
- };
58
- this.modifyContent = () => {
59
- var _a;
60
- (_a = this.controlDefinitions[this.control]) === null || _a === void 0 ? void 0 : _a.run();
61
- };
62
- }
63
- render() {
64
- var _a;
65
- return this.isVisible ? html `
66
- <slot>
67
- <ft-tooltip text="${this.ariaLabel}">
68
- <ft-icon value="${(_a = this.controlDefinitions[this.control]) === null || _a === void 0 ? void 0 : _a.icon}"></ft-icon>
69
- </ft-tooltip>
70
- </slot>
71
- ` : nothing;
72
- }
73
- willUpdate(props) {
74
- var _a, _b, _c, _d;
75
- super.willUpdate(props);
76
- this.updateAriaLabel();
77
- this.disabled = (_c = (_b = (_a = this.controlDefinitions[this.control]) === null || _a === void 0 ? void 0 : _a.disabled) === null || _b === void 0 ? void 0 : _b.call(_a)) !== null && _c !== void 0 ? _c : false;
78
- this.isVisible = !!((_d = this.descriptor) === null || _d === void 0 ? void 0 : _d.viewableInCurrentBrowser) && this.descriptor.mimeType.startsWith("image/");
79
- }
80
- onI18nUpdate(context) {
81
- super.onI18nUpdate(context);
82
- this.updateAriaLabel();
83
- }
84
- updateAriaLabel() {
85
- var _a;
86
- this.ariaLabel = (_a = this.controlDefinitions[this.control]) === null || _a === void 0 ? void 0 : _a.ariaLabel();
87
- }
88
- connectedCallback() {
89
- super.connectedCallback();
90
- this.addI18nContext(viewerContext, defaultViewerMessages);
91
- this.updateComplete.then(() => { var _a; return (_a = this.tooltip) === null || _a === void 0 ? void 0 : _a.setupFor(this); });
92
- this.addEventListener("click", this.modifyContent);
93
- }
94
- disconnectedCallback() {
95
- super.disconnectedCallback();
96
- this.removeEventListener("click", this.modifyContent);
97
- }
98
- }
99
- FtViewerContentControl.elementDefinitions = {
100
- "ft-icon": FtIcon,
101
- "ft-tooltip": FtTooltip,
102
- };
103
- FtViewerContentControl.styles = css `
104
- :host {
105
- display: inline-block;
106
- opacity: 1;
107
- filter: grayscale(0);
108
- transition: opacity 0.2s ease-in-out, filter 0.2s ease-in-out;
109
- cursor: pointer;
110
- }
111
-
112
- :host([disabled]) {
113
- opacity: 0.8;
114
- filter: grayscale(1);
115
- pointer-events: none;
116
- cursor: inherit;
117
- }
118
-
119
- ft-icon {
120
- display: inline-flex;
121
- align-items: center;
122
- justify-content: center;
123
- width: 40px;
124
- height: 40px;
125
- border-radius: 50%;
126
- background-color: ${designSystemVariables.colorPrimary};
127
- color: ${designSystemVariables.colorOnPrimary};
128
- cursor: pointer;
129
- transition: background-color 0.2s ease-in-out, color 0.2s ease-in-out;
130
- }
131
-
132
- :host:hover, :host:focus-within {
133
- ft-icon {
134
- background-color: hsl(from ${designSystemVariables.colorPrimary} h s calc(l + 30));
135
- }
136
- }
137
- `;
138
- __decorate([
139
- property({ type: Boolean, reflect: true })
140
- ], FtViewerContentControl.prototype, "disabled", void 0);
141
- __decorate([
142
- property({ reflect: true })
143
- ], FtViewerContentControl.prototype, "tabindex", void 0);
144
- __decorate([
145
- property({ reflect: true })
146
- ], FtViewerContentControl.prototype, "role", void 0);
147
- __decorate([
148
- property({ reflect: true, attribute: "aria-label" })
149
- ], FtViewerContentControl.prototype, "ariaLabel", void 0);
150
- __decorate([
151
- property()
152
- ], FtViewerContentControl.prototype, "control", void 0);
153
- __decorate([
154
- redux({ store: "viewer" })
155
- ], FtViewerContentControl.prototype, "descriptor", void 0);
156
- __decorate([
157
- redux({ store: "viewer", selector: ({ contentModifiers }) => contentModifiers.zoom })
158
- ], FtViewerContentControl.prototype, "zoom", void 0);
159
- __decorate([
160
- redux({ store: "viewer", selector: ({ contentModifiers }) => contentModifiers.rotation })
161
- ], FtViewerContentControl.prototype, "rotation", void 0);
162
- __decorate([
163
- query("ft-tooltip")
164
- ], FtViewerContentControl.prototype, "tooltip", void 0);
@@ -1,11 +0,0 @@
1
- import { DefaultI18nMessages, I18nMessageContext, I18nMessages } from "@fluid-topics/ft-i18n";
2
- export interface FtViewerMessages extends I18nMessages {
3
- fitToContainerAriaLabel(): string;
4
- zoomRealSizeAriaLabel(): string;
5
- zoomInAriaLabel(): string;
6
- zoomOutAriaLabel(): string;
7
- rotateLeftAriaLabel(): string;
8
- rotateRightAriaLabel(): string;
9
- }
10
- export declare const viewerContext: I18nMessageContext<FtViewerMessages>;
11
- export declare const defaultViewerMessages: DefaultI18nMessages<FtViewerMessages>;
@@ -1,10 +0,0 @@
1
- import { I18nMessageContext, } from "@fluid-topics/ft-i18n";
2
- export const viewerContext = I18nMessageContext.build("designedViewer");
3
- export const defaultViewerMessages = {
4
- fitToContainerAriaLabel: "Fill available space",
5
- zoomRealSizeAriaLabel: "Display content at original size",
6
- zoomInAriaLabel: "Zoom in",
7
- zoomOutAriaLabel: "Zoom out",
8
- rotateLeftAriaLabel: "Rotate left",
9
- rotateRightAriaLabel: "Rotate right",
10
- };
@@ -1,5 +0,0 @@
1
- import { FtViewerContentControl } from "../../common/ft-viewer-content-control";
2
- declare const FtUdViewerContentControl_base: import("./registration").FtUdViewerComponentType<typeof FtViewerContentControl>;
3
- export declare class FtUdViewerContentControl extends FtUdViewerContentControl_base {
4
- }
5
- export {};
@@ -1,4 +0,0 @@
1
- import { toFtUdViewerComponent } from "./registration";
2
- import { FtViewerContentControl } from "../../common/ft-viewer-content-control";
3
- export class FtUdViewerContentControl extends toFtUdViewerComponent(FtViewerContentControl) {
4
- }