@foblex/m-render 2.9.5 → 3.0.1

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/README.md CHANGED
@@ -109,7 +109,7 @@ export const routes: Routes = [
109
109
 
110
110
  ### `ng-component`
111
111
 
112
- Render Angular components with optional height and linked source code:
112
+ Render Angular components or external URLs (via `iframe`) with optional height and linked source code:
113
113
 
114
114
  ```markdown
115
115
  ::: ng-component <component-selector></component-selector> [height]="YOUR EXAMPLE HEIGHT"
@@ -118,6 +118,14 @@ Render Angular components with optional height and linked source code:
118
118
  :::
119
119
  ```
120
120
 
121
+ ```markdown
122
+ ::: ng-component [url]="https://example.com" [height]="60vh"
123
+ [component.ts] <<< /assets/component.ts
124
+ :::
125
+ ```
126
+
127
+ `ng-component` supports full-screen mode out of the box for both Angular previews and iframe previews.
128
+
121
129
  ### `code-group`
122
130
 
123
131
  Group multiple code snippets into tabs:
@@ -28,6 +28,7 @@
28
28
  }
29
29
 
30
30
  .f-code-view, .f-example-view {
31
+ position: relative;
31
32
  background-color: var(--code-view-background);
32
33
  border-radius: var(--code-view-border-radius);
33
34
  overflow-x: auto;
@@ -56,6 +57,33 @@
56
57
  }
57
58
  }
58
59
 
60
+ .f-fullscreen-button {
61
+ position: absolute;
62
+ top: 8px;
63
+ right: 20px;
64
+ border: 1px solid var(--code-view-copy-button-border-color);
65
+ border-radius: 4px;
66
+ width: 32px;
67
+ height: 32px;
68
+ z-index: 3;
69
+ background-color: var(--code-view-copy-button-background);
70
+ opacity: 0;
71
+ cursor: pointer;
72
+ background-image: var(--fullscreen-icon);
73
+ background-position: 50%;
74
+ background-size: 14px;
75
+ background-repeat: no-repeat;
76
+ transition: background-color 0.25s, opacity 0.25s;
77
+
78
+ &.exit {
79
+ background-image: var(--fullscreen-exit-icon);
80
+ }
81
+
82
+ &:hover {
83
+ background-color: var(--code-view-copy-button-hover-background);
84
+ }
85
+ }
86
+
59
87
  .f-code-language {
60
88
  position: absolute;
61
89
  top: 2px;
@@ -78,6 +106,14 @@
78
106
  .f-code-language {
79
107
  opacity: 0;
80
108
  }
109
+
110
+ .f-fullscreen-button {
111
+ opacity: 1;
112
+
113
+ &:active {
114
+ opacity: 0.1;
115
+ }
116
+ }
81
117
  }
82
118
  }
83
119
 
@@ -85,5 +121,25 @@
85
121
  width: 100%;
86
122
  height: 300px;
87
123
  overflow: hidden;
124
+
125
+ &.f-example-view-fullscreen {
126
+ border-radius: 0;
127
+ }
128
+
129
+ .f-example-iframe {
130
+ width: 100%;
131
+ height: 100%;
132
+ border: none;
133
+ }
134
+
135
+ &.f-example-view-fullscreen .f-fullscreen-button {
136
+ opacity: 1;
137
+ }
138
+ }
139
+
140
+ @media (hover: none) {
141
+ .f-example-view .f-fullscreen-button {
142
+ opacity: 1;
143
+ }
88
144
  }
89
145
  }
@@ -1,5 +1,7 @@
1
1
  :root {
2
2
  --copy-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' stroke='rgba(128,128,128,1)' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' viewBox='0 0 24 24'%3E%3Crect width='8' height='4' x='8' y='2' rx='1' ry='1'/%3E%3Cpath d='M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2'/%3E%3C/svg%3E");
3
+ --fullscreen-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' stroke='rgba(128,128,128,1)' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' viewBox='0 0 24 24'%3E%3Cpath d='M8 3H5a2 2 0 0 0-2 2v3M16 3h3a2 2 0 0 1 2 2v3M8 21H5a2 2 0 0 1-2-2v-3M16 21h3a2 2 0 0 0 2-2v-3'/%3E%3C/svg%3E");
4
+ --fullscreen-exit-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' stroke='rgba(128,128,128,1)' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' viewBox='0 0 24 24'%3E%3Cpath d='M8 3v3a2 2 0 0 1-2 2H3M21 8h-3a2 2 0 0 1-2-2V3M3 16h3a2 2 0 0 1 2 2v3M21 16h-3a2 2 0 0 0-2 2v3'/%3E%3C/svg%3E");
3
5
  }
4
6
 
5
7
  .f-icon {
@@ -3,7 +3,7 @@ import { inject, signal, computed, ChangeDetectionStrategy, Component } from '@a
3
3
  import { LOCAL_STORAGE, GTagService } from './foblex-m-render.mjs';
4
4
 
5
5
  const F_ACCEPT_COOKIES_KEY = 'm-accepts-cookies';
6
- class CookiePopupComponent {
6
+ class CookiePopup {
7
7
  _localStorage = inject(LOCAL_STORAGE);
8
8
  _gtag = inject(GTagService, { optional: true });
9
9
  _consentValue = signal(null, ...(ngDevMode ? [{ debugName: "_consentValue" }] : []));
@@ -27,13 +27,13 @@ class CookiePopupComponent {
27
27
  this._gtag?.updateConsent(true);
28
28
  this._consentValue.set('true');
29
29
  }
30
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.8", ngImport: i0, type: CookiePopupComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
31
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.1.8", type: CookiePopupComponent, isStandalone: true, selector: "cookie-popup", ngImport: i0, template: "@if (showPopup()) {\n <div class=\"docs-cookies-popup docs-invert-mode\">\n <p>This site uses cookies from Google to deliver its services and to analyze traffic.</p>\n\n <div>\n <a href=\"https://policies.google.com/technologies/cookies\" target=\"_blank\" rel=\"noopener\">\n <button class=\"f-button\" [attr.text]=\"'Learn more'\" aria-label=\"Learn More\">\n Learn more\n </button>\n </a>\n <button\n (click)=\"accept()\"\n class=\"f-button\"\n [attr.text]=\"'Ok, Got it'\"\n aria-label=\"Ok, Got it\">\n Ok, Got it\n </button>\n </div>\n </div>\n}\n", styles: [":host{position:fixed;bottom:16px;right:16px;z-index:99999;opacity:0;visibility:hidden;animation:1s linear forwards .5s fadeIn}.docs-cookies-popup{padding:1rem;background-color:var(--background-color);border:1px solid var(--divider-color);color:var(--primary-text);border-radius:var(--border-radius);font-size:14px;max-width:310px;transition:background-color .3s ease,border-color .3s ease,color .3s ease;box-shadow:var(--shadow-3)}.docs-cookies-popup>div{display:flex;gap:8px;align-items:center;width:100%;margin-block-start:1rem}.f-button{outline:none;border:none;height:unset;line-height:26px;font-size:14px;font-weight:500;border-radius:var(--border-radius)}@keyframes fadeIn{to{opacity:100%;visibility:visible}}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
30
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.4", ngImport: i0, type: CookiePopup, deps: [], target: i0.ɵɵFactoryTarget.Component });
31
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.1.4", type: CookiePopup, isStandalone: true, selector: "cookie-popup", ngImport: i0, template: "@if (showPopup()) {\n <div class=\"docs-cookies-popup docs-invert-mode\">\n <p>This site uses cookies from Google to deliver its services and to analyze traffic.</p>\n\n <div>\n <a href=\"https://policies.google.com/technologies/cookies\" target=\"_blank\" rel=\"noopener\">\n <button class=\"f-button\" [attr.text]=\"'Learn more'\" aria-label=\"Learn More\">\n Learn more\n </button>\n </a>\n <button\n (click)=\"accept()\"\n class=\"f-button\"\n [attr.text]=\"'Ok, Got it'\"\n aria-label=\"Ok, Got it\">\n Ok, Got it\n </button>\n </div>\n </div>\n}\n", styles: [":host{position:fixed;bottom:16px;right:16px;z-index:99999;opacity:0;visibility:hidden;animation:1s linear forwards .5s fadeIn}.docs-cookies-popup{padding:1rem;background-color:var(--background-color);border:1px solid var(--divider-color);color:var(--primary-text);border-radius:var(--border-radius);font-size:14px;max-width:310px;transition:background-color .3s ease,border-color .3s ease,color .3s ease;box-shadow:var(--shadow-3)}.docs-cookies-popup>div{display:flex;gap:8px;align-items:center;width:100%;margin-block-start:1rem}.f-button{outline:none;border:none;height:unset;line-height:26px;font-size:14px;font-weight:500;border-radius:var(--border-radius)}@keyframes fadeIn{to{opacity:100%;visibility:visible}}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
32
32
  }
33
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.8", ngImport: i0, type: CookiePopupComponent, decorators: [{
33
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.4", ngImport: i0, type: CookiePopup, decorators: [{
34
34
  type: Component,
35
35
  args: [{ selector: 'cookie-popup', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, template: "@if (showPopup()) {\n <div class=\"docs-cookies-popup docs-invert-mode\">\n <p>This site uses cookies from Google to deliver its services and to analyze traffic.</p>\n\n <div>\n <a href=\"https://policies.google.com/technologies/cookies\" target=\"_blank\" rel=\"noopener\">\n <button class=\"f-button\" [attr.text]=\"'Learn more'\" aria-label=\"Learn More\">\n Learn more\n </button>\n </a>\n <button\n (click)=\"accept()\"\n class=\"f-button\"\n [attr.text]=\"'Ok, Got it'\"\n aria-label=\"Ok, Got it\">\n Ok, Got it\n </button>\n </div>\n </div>\n}\n", styles: [":host{position:fixed;bottom:16px;right:16px;z-index:99999;opacity:0;visibility:hidden;animation:1s linear forwards .5s fadeIn}.docs-cookies-popup{padding:1rem;background-color:var(--background-color);border:1px solid var(--divider-color);color:var(--primary-text);border-radius:var(--border-radius);font-size:14px;max-width:310px;transition:background-color .3s ease,border-color .3s ease,color .3s ease;box-shadow:var(--shadow-3)}.docs-cookies-popup>div{display:flex;gap:8px;align-items:center;width:100%;margin-block-start:1rem}.f-button{outline:none;border:none;height:unset;line-height:26px;font-size:14px;font-weight:500;border-radius:var(--border-radius)}@keyframes fadeIn{to{opacity:100%;visibility:visible}}\n"] }]
36
36
  }], ctorParameters: () => [] });
37
37
 
38
- export { CookiePopupComponent, F_ACCEPT_COOKIES_KEY };
39
- //# sourceMappingURL=foblex-m-render-cookie-popup.component-Cx-ELX3C.mjs.map
38
+ export { CookiePopup, F_ACCEPT_COOKIES_KEY };
39
+ //# sourceMappingURL=foblex-m-render-cookie-popup-DzpgC1SS.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"foblex-m-render-cookie-popup-DzpgC1SS.mjs","sources":["../../../../libs/m-render/src/lib/analytics/cookie-popup/cookie-popup.ts","../../../../libs/m-render/src/lib/analytics/cookie-popup/cookie-popup.html"],"sourcesContent":["import { ChangeDetectionStrategy, Component, computed, inject, signal } from '@angular/core';\nimport { GTagService } from '../g-tag.service';\nimport { LOCAL_STORAGE } from '../../common';\n\nexport const F_ACCEPT_COOKIES_KEY = 'm-accepts-cookies';\n\n@Component({\n selector: 'cookie-popup',\n standalone: true,\n templateUrl: './cookie-popup.html',\n styleUrls: ['./cookie-popup.scss'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class CookiePopup {\n private readonly _localStorage = inject(LOCAL_STORAGE);\n private readonly _gtag = inject(GTagService, { optional: true });\n\n private readonly _consentValue = signal<string | null>(null);\n\n protected readonly showPopup = computed(() =>\n this._gtag !== null &&\n this._consentValue() !== 'true' &&\n this._consentValue() !== 'false',\n );\n\n constructor() {\n try {\n const value = this._localStorage?.getItem(F_ACCEPT_COOKIES_KEY);\n this._consentValue.set(value);\n } catch {\n this._consentValue.set(null);\n }\n }\n\n protected accept(): void {\n try {\n this._localStorage?.setItem(F_ACCEPT_COOKIES_KEY, 'true');\n } catch { /* empty */ }\n\n this._gtag?.updateConsent(true);\n this._consentValue.set('true');\n }\n}\n\n","@if (showPopup()) {\n <div class=\"docs-cookies-popup docs-invert-mode\">\n <p>This site uses cookies from Google to deliver its services and to analyze traffic.</p>\n\n <div>\n <a href=\"https://policies.google.com/technologies/cookies\" target=\"_blank\" rel=\"noopener\">\n <button class=\"f-button\" [attr.text]=\"'Learn more'\" aria-label=\"Learn More\">\n Learn more\n </button>\n </a>\n <button\n (click)=\"accept()\"\n class=\"f-button\"\n [attr.text]=\"'Ok, Got it'\"\n aria-label=\"Ok, Got it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