@studiometa/ui 0.2.47 → 0.2.49

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.
Files changed (57) hide show
  1. package/atoms/Button/Button.twig +15 -5
  2. package/atoms/FigureVideo/FigureVideo.cjs +132 -0
  3. package/atoms/FigureVideo/FigureVideo.cjs.map +7 -0
  4. package/atoms/FigureVideo/FigureVideo.d.ts +51 -0
  5. package/atoms/FigureVideo/FigureVideo.js +110 -0
  6. package/atoms/FigureVideo/FigureVideo.js.map +7 -0
  7. package/atoms/FigureVideo/FigureVideo.twig +152 -0
  8. package/atoms/FigureVideo/FigureVideoTwicpics.cjs +153 -0
  9. package/atoms/FigureVideo/FigureVideoTwicpics.cjs.map +7 -0
  10. package/atoms/FigureVideo/FigureVideoTwicpics.d.ts +57 -0
  11. package/atoms/FigureVideo/FigureVideoTwicpics.js +135 -0
  12. package/atoms/FigureVideo/FigureVideoTwicpics.js.map +7 -0
  13. package/atoms/FigureVideo/FigureVideoTwicpics.twig +98 -0
  14. package/atoms/FigureVideo/index.cjs +22 -0
  15. package/atoms/FigureVideo/index.cjs.map +7 -0
  16. package/atoms/FigureVideo/index.d.ts +2 -0
  17. package/atoms/FigureVideo/index.js +3 -0
  18. package/atoms/FigureVideo/index.js.map +7 -0
  19. package/atoms/Icon/IconInline.twig +11 -4
  20. package/atoms/Icon/IconInlineImg.twig +44 -41
  21. package/atoms/index.cjs +1 -0
  22. package/atoms/index.cjs.map +2 -2
  23. package/atoms/index.d.ts +1 -0
  24. package/atoms/index.js +1 -0
  25. package/atoms/index.js.map +2 -2
  26. package/molecules/AnchorNav/AnchorNav.cjs +63 -0
  27. package/molecules/AnchorNav/AnchorNav.cjs.map +7 -0
  28. package/molecules/AnchorNav/AnchorNav.d.ts +24 -0
  29. package/molecules/AnchorNav/AnchorNav.js +41 -0
  30. package/molecules/AnchorNav/AnchorNav.js.map +7 -0
  31. package/molecules/AnchorNav/AnchorNavLink.cjs +40 -0
  32. package/molecules/AnchorNav/AnchorNavLink.cjs.map +7 -0
  33. package/molecules/AnchorNav/AnchorNavLink.d.ts +19 -0
  34. package/molecules/AnchorNav/AnchorNavLink.js +18 -0
  35. package/molecules/AnchorNav/AnchorNavLink.js.map +7 -0
  36. package/molecules/AnchorNav/AnchorNavTarget.cjs +35 -0
  37. package/molecules/AnchorNav/AnchorNavTarget.cjs.map +7 -0
  38. package/molecules/AnchorNav/AnchorNavTarget.d.ts +13 -0
  39. package/molecules/AnchorNav/AnchorNavTarget.js +13 -0
  40. package/molecules/AnchorNav/AnchorNavTarget.js.map +7 -0
  41. package/molecules/AnchorNav/index.cjs +23 -0
  42. package/molecules/AnchorNav/index.cjs.map +7 -0
  43. package/molecules/AnchorNav/index.d.ts +3 -0
  44. package/molecules/AnchorNav/index.js +4 -0
  45. package/molecules/AnchorNav/index.js.map +7 -0
  46. package/molecules/IconList/IconList.twig +83 -0
  47. package/molecules/index.cjs +1 -0
  48. package/molecules/index.cjs.map +2 -2
  49. package/molecules/index.d.ts +1 -0
  50. package/molecules/index.js +1 -0
  51. package/molecules/index.js.map +2 -2
  52. package/organisms/Frame/Frame.cjs +20 -7
  53. package/organisms/Frame/Frame.cjs.map +3 -3
  54. package/organisms/Frame/Frame.d.ts +2 -2
  55. package/organisms/Frame/Frame.js +20 -7
  56. package/organisms/Frame/Frame.js.map +3 -3
  57. package/package.json +1 -1
@@ -0,0 +1,57 @@
1
+ import type { BaseConfig, BaseProps } from '@studiometa/js-toolkit';
2
+ import { FigureVideo } from './FigureVideo.js';
3
+ export interface FigureVideoTwicpicsProps extends BaseProps {
4
+ $refs: {
5
+ video: HTMLVideoElement;
6
+ };
7
+ $options: {
8
+ lazy: boolean;
9
+ transform: string;
10
+ domain: string;
11
+ path: string;
12
+ step: number;
13
+ mode: string;
14
+ };
15
+ }
16
+ /**
17
+ * FigureVideo class.
18
+ *
19
+ * Manager lazyloading image sources.
20
+ */
21
+ export declare class FigureVideoTwicpics<T extends BaseProps = BaseProps> extends FigureVideo<T & FigureVideoTwicpicsProps> {
22
+ /**
23
+ * Config.
24
+ */
25
+ static config: BaseConfig;
26
+ /**
27
+ * Get the Twicpics path.
28
+ */
29
+ get path(): string;
30
+ /**
31
+ * Get the Twicpics domain.
32
+ */
33
+ get domain(): string;
34
+ /**
35
+ * Format the source for Twicpics.
36
+ * @param {string} src
37
+ * @param {Array} options
38
+ * @returns {string}
39
+ */
40
+ formatSrc(src: string, options?: Array<string>): string;
41
+ /**
42
+ * Load poster
43
+ */
44
+ loadPoster(): Promise<void | HTMLImageElement>;
45
+ /**
46
+ * Load sources
47
+ */
48
+ loadSources(): Promise<void>;
49
+ /**
50
+ * Reassign the source from the original on resize.
51
+ */
52
+ resized(): Promise<void>;
53
+ /**
54
+ * Do not terminate on image load as we need to set the src on resize.
55
+ */
56
+ onLoad(): void;
57
+ }
@@ -0,0 +1,135 @@
1
+ import {
2
+ withLeadingSlash,
3
+ withoutLeadingSlash,
4
+ withoutTrailingSlash
5
+ } from "@studiometa/js-toolkit/utils";
6
+ import { loadImage } from "../index.js";
7
+ import { FigureVideo } from "./FigureVideo.js";
8
+ function normalizeSize(that, prop) {
9
+ const { step } = that.$options;
10
+ return Math.ceil(that.$refs.video[prop] / step) * step;
11
+ }
12
+ class FigureVideoTwicpics extends FigureVideo {
13
+ /**
14
+ * Config.
15
+ */
16
+ static config = {
17
+ ...FigureVideo.config,
18
+ name: "FigureVideoTwicpics",
19
+ options: {
20
+ ...FigureVideo.config.options,
21
+ transform: String,
22
+ domain: String,
23
+ path: String,
24
+ step: {
25
+ type: Number,
26
+ default: 50
27
+ },
28
+ mode: {
29
+ type: String,
30
+ default: "cover"
31
+ }
32
+ }
33
+ };
34
+ /**
35
+ * Get the Twicpics path.
36
+ */
37
+ get path() {
38
+ return withoutTrailingSlash(withoutLeadingSlash(this.$options.path));
39
+ }
40
+ /**
41
+ * Get the Twicpics domain.
42
+ */
43
+ get domain() {
44
+ if (this.$options.domain) {
45
+ return this.$options.domain;
46
+ }
47
+ const url = new URL(this.sources[0].dataset.src);
48
+ return url.host;
49
+ }
50
+ /**
51
+ * Format the source for Twicpics.
52
+ * @param {string} src
53
+ * @param {Array} options
54
+ * @returns {string}
55
+ */
56
+ formatSrc(src, options = []) {
57
+ const url = new URL(src, "https://localhost");
58
+ url.host = this.domain;
59
+ url.port = "";
60
+ if (this.path && !url.pathname.startsWith(withLeadingSlash(this.path))) {
61
+ url.pathname = `/${this.path}${url.pathname}`;
62
+ }
63
+ const width = normalizeSize(this, "offsetWidth");
64
+ const height = normalizeSize(this, "offsetHeight");
65
+ this.$log(this.$options.mode, width, height);
66
+ url.searchParams.set(
67
+ "twic",
68
+ ["v1", this.$options.transform, `${this.$options.mode}=${width}x${height}`, ...options].filter(Boolean).join("/")
69
+ );
70
+ url.search = decodeURIComponent(url.search);
71
+ return url.toString();
72
+ }
73
+ /**
74
+ * Load poster
75
+ */
76
+ loadPoster() {
77
+ const { video } = this.$refs;
78
+ if (!video.dataset.poster) {
79
+ return Promise.resolve();
80
+ }
81
+ const twicPoster = this.formatSrc(video.dataset.poster);
82
+ return loadImage(twicPoster).then(() => {
83
+ video.poster = twicPoster;
84
+ this.$log("fresh poster loaded");
85
+ });
86
+ }
87
+ /**
88
+ * Load sources
89
+ */
90
+ loadSources() {
91
+ const { video } = this.$refs;
92
+ this.sources.forEach((source) => {
93
+ if (!source.dataset.src) {
94
+ return;
95
+ }
96
+ source.src = this.formatSrc(
97
+ source.dataset.src,
98
+ source.dataset.output ? [`output=${source.dataset.output}`] : []
99
+ );
100
+ });
101
+ return new Promise((resolve) => {
102
+ const loadHandler = () => {
103
+ resolve();
104
+ video.removeEventListener("canplaythrough", loadHandler);
105
+ this.$log("fresh sources loaded");
106
+ };
107
+ video.addEventListener("canplaythrough", loadHandler);
108
+ this.$refs.video.width = normalizeSize(this, "offsetWidth");
109
+ this.$refs.video.height = normalizeSize(this, "offsetHeight");
110
+ video.load();
111
+ });
112
+ }
113
+ /**
114
+ * Reassign the source from the original on resize.
115
+ */
116
+ async resized() {
117
+ const width = normalizeSize(this, "offsetWidth");
118
+ const height = normalizeSize(this, "offsetHeight");
119
+ if (width === this.$refs.video.width && height === this.$refs.video.height) {
120
+ return;
121
+ }
122
+ this.$refs.video.width = width;
123
+ this.$refs.video.height = height;
124
+ await this.load();
125
+ }
126
+ /**
127
+ * Do not terminate on image load as we need to set the src on resize.
128
+ */
129
+ onLoad() {
130
+ }
131
+ }
132
+ export {
133
+ FigureVideoTwicpics
134
+ };
135
+ //# sourceMappingURL=FigureVideoTwicpics.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../packages/ui/atoms/FigureVideo/FigureVideoTwicpics.ts"],
4
+ "sourcesContent": ["import type { BaseConfig, BaseProps } from '@studiometa/js-toolkit';\nimport {\n withLeadingSlash,\n withoutLeadingSlash,\n withoutTrailingSlash,\n} from '@studiometa/js-toolkit/utils';\nimport { loadImage } from '../index.js';\nimport { FigureVideo } from './FigureVideo.js';\n\nexport interface FigureVideoTwicpicsProps extends BaseProps {\n $refs: {\n video: HTMLVideoElement;\n };\n $options: {\n lazy: boolean;\n transform: string;\n domain: string;\n path: string;\n step: number;\n mode: string;\n };\n}\n\n/**\n * Normalize the given size to the step option.\n */\n// eslint-disable-next-line no-use-before-define\nfunction normalizeSize(that: FigureVideoTwicpics, prop: string): number {\n const { step } = that.$options;\n return Math.ceil(that.$refs.video[prop] / step) * step;\n}\n\n/**\n * FigureVideo class.\n *\n * Manager lazyloading image sources.\n */\nexport class FigureVideoTwicpics<T extends BaseProps = BaseProps> extends FigureVideo<\n T & FigureVideoTwicpicsProps\n> {\n /**\n * Config.\n */\n static config: BaseConfig = {\n ...FigureVideo.config,\n name: 'FigureVideoTwicpics',\n options: {\n ...FigureVideo.config.options,\n transform: String,\n domain: String,\n path: String,\n step: {\n type: Number,\n default: 50,\n },\n mode: {\n type: String,\n default: 'cover',\n },\n },\n };\n\n /**\n * Get the Twicpics path.\n */\n get path(): string {\n return withoutTrailingSlash(withoutLeadingSlash(this.$options.path));\n }\n\n /**\n * Get the Twicpics domain.\n */\n get domain(): string {\n if (this.$options.domain) {\n return this.$options.domain;\n }\n const url = new URL(this.sources[0].dataset.src);\n return url.host;\n }\n\n /**\n * Format the source for Twicpics.\n * @param {string} src\n * @param {Array} options\n * @returns {string}\n */\n formatSrc(src: string, options: Array<string> = []): string {\n const url = new URL(src, 'https://localhost');\n url.host = this.domain;\n url.port = '';\n\n if (this.path && !url.pathname.startsWith(withLeadingSlash(this.path))) {\n url.pathname = `/${this.path}${url.pathname}`;\n }\n\n const width = normalizeSize(this, 'offsetWidth');\n const height = normalizeSize(this, 'offsetHeight');\n\n this.$log(this.$options.mode, width, height);\n\n url.searchParams.set(\n 'twic',\n ['v1', this.$options.transform, `${this.$options.mode}=${width}x${height}`, ...options]\n .filter(Boolean)\n .join('/'),\n );\n\n url.search = decodeURIComponent(url.search);\n\n return url.toString();\n }\n\n /**\n * Load poster\n */\n loadPoster(): Promise<void|HTMLImageElement> {\n const { video } = this.$refs;\n\n if (!video.dataset.poster) {\n return Promise.resolve();\n }\n\n const twicPoster = this.formatSrc(video.dataset.poster);\n\n return loadImage(twicPoster).then(() => {\n video.poster = twicPoster;\n this.$log('fresh poster loaded');\n });\n }\n\n /**\n * Load sources\n */\n loadSources(): Promise<void> {\n const { video } = this.$refs;\n\n this.sources.forEach((source) => {\n if (!source.dataset.src) {\n return;\n }\n source.src = this.formatSrc(\n source.dataset.src,\n source.dataset.output ? [`output=${source.dataset.output}`] : [],\n );\n });\n\n return new Promise((resolve) => {\n const loadHandler = () => {\n resolve();\n video.removeEventListener('canplaythrough', loadHandler);\n this.$log('fresh sources loaded');\n };\n\n video.addEventListener('canplaythrough', loadHandler);\n\n this.$refs.video.width = normalizeSize(this, 'offsetWidth');\n this.$refs.video.height = normalizeSize(this, 'offsetHeight');\n\n video.load();\n });\n }\n\n /**\n * Reassign the source from the original on resize.\n */\n async resized() {\n const width = normalizeSize(this, 'offsetWidth');\n const height = normalizeSize(this, 'offsetHeight');\n\n if (width === this.$refs.video.width && height === this.$refs.video.height) {\n return;\n }\n\n this.$refs.video.width = width;\n this.$refs.video.height = height;\n\n await this.load();\n }\n\n /**\n * Do not terminate on image load as we need to set the src on resize.\n */\n onLoad() {\n // Do not terminate on image load as we need.\n }\n}\n"],
5
+ "mappings": "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",
6
+ "names": []
7
+ }
@@ -0,0 +1,98 @@
1
+ {#
2
+ /**
3
+ * @file
4
+ * FigureVideo with Twicpics component.
5
+ *
6
+ * @param string $twic_domain
7
+ * The Twicpics domain to use.
8
+ * @param string $twic_path
9
+ * The Twicpics path to use.
10
+ * @param object $twic_transform
11
+ * Custom transforms for Twicpics.
12
+ */
13
+ #}
14
+
15
+ {% extends '@ui-pkg/atoms/FigureVideo/FigureVideo.twig' %}
16
+
17
+ {% set twic_param = 'v1' %}
18
+ {% if twic_transform is defined %}
19
+ {% set formatted_transform = [] %}
20
+ {% for key, value in twic_transform %}
21
+ {% set formatted_transform = formatted_transform|merge(['%s=%s'|format(key, value)]) %}
22
+ {% endfor %}
23
+ {% set formatted_transform = formatted_transform|join('/') %}
24
+
25
+ {% set twic_param = 'v1/%s'|format(formatted_transform) %}
26
+ {% set attr = (attr ?? {})|merge({ data_option_transform: formatted_transform }) %}
27
+ {% endif %}
28
+
29
+ {% if twic_domain is defined %}
30
+ {% set attr = (attr ?? {})|merge({ data_option_domain: twic_domain }) %}
31
+ {% endif %}
32
+
33
+ {% if twic_path is defined %}
34
+ {% set attr = (attr ?? {})|merge({ data_option_path: twic_path }) %}
35
+ {% endif %}
36
+
37
+ {% block sources %}
38
+ {% if sources is empty %}
39
+ {% set twic_src =
40
+ twig_toolkit_url(src).withQueryParameter('twic', twic_param).withScheme('https')
41
+ %}
42
+
43
+ {% if twic_domain is defined %}
44
+ {% set twic_src = twic_src.withHost(twic_domain) %}
45
+ {% endif %}
46
+
47
+ {% if twic_path is defined %}
48
+ {% set twic_src = twic_src.withPath(twic_path ~ twic_src.getPath()) %}
49
+ {% endif %}
50
+
51
+ {% set sources = [
52
+ {
53
+ src: twic_src.withQueryParameter('twic', '%s/output=%s'|format(twic_param, 'h265')),
54
+ data_output: lazy ? 'h265' : false,
55
+ type: 'video/mp4;codecs=hvc1'
56
+ },
57
+ {
58
+ src: twic_src.withQueryParameter('twic', '%s/output=%s'|format(twic_param, 'vp9')),
59
+ data_output: lazy ? 'vp9' : false,
60
+ type: 'video/webm;codecs=vp9'
61
+ },
62
+ {
63
+ src: twic_src.withQueryParameter('twic', '%s/output=%s'|format(twic_param, 'h264')),
64
+ data_output: lazy ? 'h264' : false
65
+ }
66
+ ] %}
67
+ {% endif %}
68
+
69
+ {% for source in sources %}
70
+ {% if twic_src is empty and source.src is not empty %}
71
+ {% set source_twic_src =
72
+ twig_toolkit_url(source.src).withQueryParameter('twic', twic_param).withScheme('https')
73
+ %}
74
+
75
+ {% if twic_domain is defined %}
76
+ {% set source_twic_src = source_twic_src.withHost(twic_domain) %}
77
+ {% endif %}
78
+
79
+ {% if twic_path is defined %}
80
+ {% set source_twic_src = source_twic_src.withPath(twic_path ~ source_twic_src.getPath()) %}
81
+ {% endif %}
82
+ {% else %}
83
+ {% set source_twic_src = source.src %}
84
+ {% endif %}
85
+
86
+ <source {{
87
+ html_attributes(
88
+ merge_html_attributes(
89
+ source,
90
+ {
91
+ src: lazy ? false : source_twic_src|default(false),
92
+ data_src: lazy ? source_twic_src|default(false) : false
93
+ }
94
+ )
95
+ )
96
+ }} />
97
+ {% endfor %}
98
+ {% endblock %}
@@ -0,0 +1,22 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __copyProps = (to, from, except, desc) => {
6
+ if (from && typeof from === "object" || typeof from === "function") {
7
+ for (let key of __getOwnPropNames(from))
8
+ if (!__hasOwnProp.call(to, key) && key !== except)
9
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
10
+ }
11
+ return to;
12
+ };
13
+ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
14
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
15
+
16
+ // packages/ui/atoms/FigureVideo/index.ts
17
+ var FigureVideo_exports = {};
18
+ module.exports = __toCommonJS(FigureVideo_exports);
19
+ __reExport(FigureVideo_exports, require("./FigureVideo.cjs"), module.exports);
20
+ __reExport(FigureVideo_exports, require("./FigureVideoTwicpics.cjs"), module.exports);
21
+ if (module.exports.default) module.exports = module.exports.default;
22
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../packages/ui/atoms/FigureVideo/index.ts"],
4
+ "sourcesContent": ["export * from './FigureVideo.js';\nexport * from './FigureVideoTwicpics.js';\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;AAAA;AAAA;AAAA,gCAAc,8BAAd;AACA,gCAAc,sCADd;",
6
+ "names": []
7
+ }
@@ -0,0 +1,2 @@
1
+ export * from './FigureVideo.js';
2
+ export * from './FigureVideoTwicpics.js';
@@ -0,0 +1,3 @@
1
+ export * from "./FigureVideo.js";
2
+ export * from "./FigureVideoTwicpics.js";
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../packages/ui/atoms/FigureVideo/index.ts"],
4
+ "sourcesContent": ["export * from './FigureVideo.js';\nexport * from './FigureVideoTwicpics.js';\n"],
5
+ "mappings": "AAAA,cAAc;AACd,cAAc;",
6
+ "names": []
7
+ }
@@ -3,8 +3,9 @@
3
3
  * @file
4
4
  * Icon component
5
5
  *
6
- * @param string $name The file name of the icon.
7
- * @param array $attr Custom attributes.
6
+ * @param string $name The file name of the icon.
7
+ * @param boolean $ignore_missing Avoid empty <span> printing
8
+ * @param array $attr Custom attributes.
8
9
  */
9
10
  #}
10
11
 
@@ -21,6 +22,12 @@
21
22
  }
22
23
  ) %}
23
24
 
24
- <span {{ html_attributes(attributes) }}>
25
+ {%- set icon -%}
25
26
  {{ source('@svg/%s.svg'|format(name), ignore_missing = true) }}
26
- </span>
27
+ {%- endset -%}
28
+
29
+ {% if icon is not empty or not ignore_missing %}
30
+ <span {{ html_attributes(attributes) }}>
31
+ {{ icon }}
32
+ </span>
33
+ {% endif %}
@@ -4,54 +4,57 @@
4
4
  * Icon Image component
5
5
  * Use `<img>` instead of injecting the SVG file.
6
6
  *
7
- * @param string $name The file name of the icon.
8
- * @param array $attr Custom attributes.
9
- * @param array $css_vars Custom CSS variables to pass to the SVG.
10
- * @param string $current_color Custom color for the `currentColor` CSS variable in the SVG.
7
+ * @param string $name The file name of the icon.
8
+ * @param boolean $ignore_missing Avoid empty <img> printing
9
+ * @param array $attr Custom attributes.
10
+ * @param array $css_vars Custom CSS variables to pass to the SVG.
11
+ * @param string $current_color Custom color for the `currentColor` CSS variable in the SVG.
11
12
  */
12
13
  #}
13
14
  {%- set svg -%}
14
15
  {{ source('@svg/%s.svg'|format(name), ignore_missing = true) }}
15
16
  {%- endset -%}
16
17
 
17
- {% if current_color is defined or css_vars is defined %}
18
- {%- set style -%}
19
- <style>
20
- :root {
21
- {% if current_color is defined %}
22
- color: {{ current_color }};
23
- {% endif %}
24
- {% if css_vars is defined %}
25
- {% for var, value in css_vars %}
26
- --{{ var }}: {{ value }};
27
- {% endfor %}
28
- {% endif %}
29
- }
30
- </style>
31
- {%- endset -%}
18
+ {% if svg is not empty or not ignore_missing %}
19
+ {% if current_color is defined or css_vars is defined %}
20
+ {%- set style -%}
21
+ <style>
22
+ :root {
23
+ {% if current_color is defined %}
24
+ color: {{ current_color }};
25
+ {% endif %}
26
+ {% if css_vars is defined %}
27
+ {% for var, value in css_vars %}
28
+ --{{ var }}: {{ value }};
29
+ {% endfor %}
30
+ {% endif %}
31
+ }
32
+ </style>
33
+ {%- endset -%}
32
34
 
33
- {% set svg = svg|replace({ '</svg>': '%s</svg>'|format(style) }) %}
34
- {% endif %}
35
+ {% set svg = svg|replace({ '</svg>': '%s</svg>'|format(style) }) %}
36
+ {% endif %}
35
37
 
36
- {% if not 'xmlns="http://www.w3.org/2000/svg"' in svg %}
37
- {% set svg = svg|replace({ '<svg': '<svg %s'|format('xmlns="http://www.w3.org/2000/svg"') }) %}
38
- {% endif %}
38
+ {% if not 'xmlns="http://www.w3.org/2000/svg"' in svg %}
39
+ {% set svg = svg|replace({ '<svg': '<svg %s'|format('xmlns="http://www.w3.org/2000/svg"') }) %}
40
+ {% endif %}
39
41
 
40
- {% set attributes = merge_html_attributes(
41
- attr ?? null,
42
- {
43
- width: '',
44
- height: '',
45
- alt: ' ',
46
- aria_hidden: 'true'
47
- },
48
- {
49
- src: 'data:image/svg+xml,%s'|format(svg|url_encode),
50
- class: [
51
- 'icon-img',
52
- 'icon-img--%s'|format(name),
53
- ],
54
- }
55
- ) %}
42
+ {% set attributes = merge_html_attributes(
43
+ attr ?? null,
44
+ {
45
+ width: '',
46
+ height: '',
47
+ alt: ' ',
48
+ aria_hidden: 'true'
49
+ },
50
+ {
51
+ src: svg ? 'data:image/svg+xml,%s'|format(svg|url_encode) : '',
52
+ class: [
53
+ 'icon-img',
54
+ 'icon-img--%s'|format(name),
55
+ ],
56
+ }
57
+ ) %}
56
58
 
57
- <img {{ html_attributes(attributes) }}>
59
+ <img {{ html_attributes(attributes) }}>
60
+ {% endif %}
package/atoms/index.cjs CHANGED
@@ -21,6 +21,7 @@ __reExport(atoms_exports, require("./AnchorScrollTo/index.cjs"), module.exports)
21
21
  __reExport(atoms_exports, require("./CircularMarquee/index.cjs"), module.exports);
22
22
  __reExport(atoms_exports, require("./Cursor/index.cjs"), module.exports);
23
23
  __reExport(atoms_exports, require("./Figure/index.cjs"), module.exports);
24
+ __reExport(atoms_exports, require("./FigureVideo/index.cjs"), module.exports);
24
25
  __reExport(atoms_exports, require("./LargeText/index.cjs"), module.exports);
25
26
  __reExport(atoms_exports, require("./LazyInclude/index.cjs"), module.exports);
26
27
  __reExport(atoms_exports, require("./Prefetch/index.cjs"), module.exports);
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../packages/ui/atoms/index.ts"],
4
- "sourcesContent": ["export * from './Action/index.js';\nexport * from './AnchorScrollTo/index.js';\nexport * from './CircularMarquee/index.js';\nexport * from './Cursor/index.js';\nexport * from './Figure/index.js';\nexport * from './LargeText/index.js';\nexport * from './LazyInclude/index.js';\nexport * from './Prefetch/index.js';\nexport * from './ScrollAnimation/index.js';\nexport * from './ScrollReveal/index.js';\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;AAAA;AAAA;AAAA,0BAAc,+BAAd;AACA,0BAAc,uCADd;AAEA,0BAAc,wCAFd;AAGA,0BAAc,+BAHd;AAIA,0BAAc,+BAJd;AAKA,0BAAc,kCALd;AAMA,0BAAc,oCANd;AAOA,0BAAc,iCAPd;AAQA,0BAAc,wCARd;AASA,0BAAc,qCATd;",
4
+ "sourcesContent": ["export * from './Action/index.js';\nexport * from './AnchorScrollTo/index.js';\nexport * from './CircularMarquee/index.js';\nexport * from './Cursor/index.js';\nexport * from './Figure/index.js';\nexport * from './FigureVideo/index.js';\nexport * from './LargeText/index.js';\nexport * from './LazyInclude/index.js';\nexport * from './Prefetch/index.js';\nexport * from './ScrollAnimation/index.js';\nexport * from './ScrollReveal/index.js';\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;AAAA;AAAA;AAAA,0BAAc,+BAAd;AACA,0BAAc,uCADd;AAEA,0BAAc,wCAFd;AAGA,0BAAc,+BAHd;AAIA,0BAAc,+BAJd;AAKA,0BAAc,oCALd;AAMA,0BAAc,kCANd;AAOA,0BAAc,oCAPd;AAQA,0BAAc,iCARd;AASA,0BAAc,wCATd;AAUA,0BAAc,qCAVd;",
6
6
  "names": []
7
7
  }
package/atoms/index.d.ts CHANGED
@@ -3,6 +3,7 @@ export * from './AnchorScrollTo/index.js';
3
3
  export * from './CircularMarquee/index.js';
4
4
  export * from './Cursor/index.js';
5
5
  export * from './Figure/index.js';
6
+ export * from './FigureVideo/index.js';
6
7
  export * from './LargeText/index.js';
7
8
  export * from './LazyInclude/index.js';
8
9
  export * from './Prefetch/index.js';
package/atoms/index.js CHANGED
@@ -3,6 +3,7 @@ export * from "./AnchorScrollTo/index.js";
3
3
  export * from "./CircularMarquee/index.js";
4
4
  export * from "./Cursor/index.js";
5
5
  export * from "./Figure/index.js";
6
+ export * from "./FigureVideo/index.js";
6
7
  export * from "./LargeText/index.js";
7
8
  export * from "./LazyInclude/index.js";
8
9
  export * from "./Prefetch/index.js";
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../packages/ui/atoms/index.ts"],
4
- "sourcesContent": ["export * from './Action/index.js';\nexport * from './AnchorScrollTo/index.js';\nexport * from './CircularMarquee/index.js';\nexport * from './Cursor/index.js';\nexport * from './Figure/index.js';\nexport * from './LargeText/index.js';\nexport * from './LazyInclude/index.js';\nexport * from './Prefetch/index.js';\nexport * from './ScrollAnimation/index.js';\nexport * from './ScrollReveal/index.js';\n"],
5
- "mappings": "AAAA,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;",
4
+ "sourcesContent": ["export * from './Action/index.js';\nexport * from './AnchorScrollTo/index.js';\nexport * from './CircularMarquee/index.js';\nexport * from './Cursor/index.js';\nexport * from './Figure/index.js';\nexport * from './FigureVideo/index.js';\nexport * from './LargeText/index.js';\nexport * from './LazyInclude/index.js';\nexport * from './Prefetch/index.js';\nexport * from './ScrollAnimation/index.js';\nexport * from './ScrollReveal/index.js';\n"],
5
+ "mappings": "AAAA,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;",
6
6
  "names": []
7
7
  }
@@ -0,0 +1,63 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+
19
+ // packages/ui/molecules/AnchorNav/AnchorNav.ts
20
+ var AnchorNav_exports = {};
21
+ __export(AnchorNav_exports, {
22
+ AnchorNav: () => AnchorNav
23
+ });
24
+ module.exports = __toCommonJS(AnchorNav_exports);
25
+ var import_js_toolkit = require("@studiometa/js-toolkit");
26
+ var import_AnchorNavLink = require("./AnchorNavLink.cjs");
27
+ var import_AnchorNavTarget = require("./AnchorNavTarget.cjs");
28
+ var AnchorNav = class extends import_js_toolkit.Base {
29
+ /**
30
+ * Config
31
+ */
32
+ static config = {
33
+ name: "AnchorNav",
34
+ components: {
35
+ AnchorNavLink: import_AnchorNavLink.AnchorNavLink,
36
+ AnchorNavTarget: import_AnchorNavTarget.AnchorNavTarget
37
+ }
38
+ };
39
+ /**
40
+ * Listen to the AnchorNavTarget that is mounted
41
+ */
42
+ onAnchorNavTargetMounted(index) {
43
+ const { id } = this.$children.AnchorNavTarget[index].$el;
44
+ this.$children.AnchorNavLink.forEach((anchorNavLink) => {
45
+ if (id === anchorNavLink.targetId) {
46
+ anchorNavLink.enter();
47
+ }
48
+ });
49
+ }
50
+ /**
51
+ * Listen to the AnchorNavTarget that is destroyed
52
+ */
53
+ onAnchorNavTargetDestroyed(index) {
54
+ const { id } = this.$children.AnchorNavTarget[index].$el;
55
+ this.$children.AnchorNavLink.forEach((anchorNavLink) => {
56
+ if (id === anchorNavLink.targetId) {
57
+ anchorNavLink.leave();
58
+ }
59
+ });
60
+ }
61
+ };
62
+ if (module.exports.default) module.exports = module.exports.default;
63
+ //# sourceMappingURL=AnchorNav.cjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../packages/ui/molecules/AnchorNav/AnchorNav.ts"],
4
+ "sourcesContent": ["import { Base } from '@studiometa/js-toolkit';\nimport type { BaseProps, BaseConfig } from '@studiometa/js-toolkit';\nimport { AnchorNavLink } from './AnchorNavLink.js';\nimport { AnchorNavTarget } from './AnchorNavTarget.js';\n\nexport interface AnchorNavProps extends BaseProps {\n $children: {\n AnchorNavLink: AnchorNavLink[];\n AnchorNavTarget: AnchorNavTarget[];\n };\n}\n\nexport class AnchorNav<T extends BaseProps = BaseProps> extends Base<T & AnchorNavProps> {\n /**\n * Config\n */\n static config: BaseConfig = {\n name: 'AnchorNav',\n components: {\n AnchorNavLink,\n AnchorNavTarget,\n },\n };\n\n /**\n * Listen to the AnchorNavTarget that is mounted\n */\n onAnchorNavTargetMounted(index) {\n const { id } = this.$children.AnchorNavTarget[index].$el;\n this.$children.AnchorNavLink.forEach((anchorNavLink) => {\n if (id === anchorNavLink.targetId) {\n anchorNavLink.enter();\n }\n });\n }\n\n /**\n * Listen to the AnchorNavTarget that is destroyed\n */\n onAnchorNavTargetDestroyed(index) {\n const { id } = this.$children.AnchorNavTarget[index].$el;\n this.$children.AnchorNavLink.forEach((anchorNavLink) => {\n if (id === anchorNavLink.targetId) {\n anchorNavLink.leave();\n }\n });\n }\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,wBAAqB;AAErB,2BAA8B;AAC9B,6BAAgC;AASzB,IAAM,YAAN,cAAyD,uBAAyB;AAAA;AAAA;AAAA;AAAA,EAIvF,OAAO,SAAqB;AAAA,IAC1B,MAAM;AAAA,IACN,YAAY;AAAA,MACV;AAAA,MACA;AAAA,IACF;AAAA,EACF;AAAA;AAAA;AAAA;AAAA,EAKA,yBAAyB,OAAO;AAC9B,UAAM,EAAE,GAAG,IAAI,KAAK,UAAU,gBAAgB,KAAK,EAAE;AACrD,SAAK,UAAU,cAAc,QAAQ,CAAC,kBAAkB;AACtD,UAAI,OAAO,cAAc,UAAU;AACjC,sBAAc,MAAM;AAAA,MACtB;AAAA,IACF,CAAC;AAAA,EACH;AAAA;AAAA;AAAA;AAAA,EAKA,2BAA2B,OAAO;AAChC,UAAM,EAAE,GAAG,IAAI,KAAK,UAAU,gBAAgB,KAAK,EAAE;AACrD,SAAK,UAAU,cAAc,QAAQ,CAAC,kBAAkB;AACtD,UAAI,OAAO,cAAc,UAAU;AACjC,sBAAc,MAAM;AAAA,MACtB;AAAA,IACF,CAAC;AAAA,EACH;AACF;",
6
+ "names": []
7
+ }
@@ -0,0 +1,24 @@
1
+ import { Base } from '@studiometa/js-toolkit';
2
+ import type { BaseProps, BaseConfig } from '@studiometa/js-toolkit';
3
+ import { AnchorNavLink } from './AnchorNavLink.js';
4
+ import { AnchorNavTarget } from './AnchorNavTarget.js';
5
+ export interface AnchorNavProps extends BaseProps {
6
+ $children: {
7
+ AnchorNavLink: AnchorNavLink[];
8
+ AnchorNavTarget: AnchorNavTarget[];
9
+ };
10
+ }
11
+ export declare class AnchorNav<T extends BaseProps = BaseProps> extends Base<T & AnchorNavProps> {
12
+ /**
13
+ * Config
14
+ */
15
+ static config: BaseConfig;
16
+ /**
17
+ * Listen to the AnchorNavTarget that is mounted
18
+ */
19
+ onAnchorNavTargetMounted(index: any): void;
20
+ /**
21
+ * Listen to the AnchorNavTarget that is destroyed
22
+ */
23
+ onAnchorNavTargetDestroyed(index: any): void;
24
+ }