@studiometa/ui 0.2.4 → 0.2.7

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 (65) hide show
  1. package/atoms/Button/Button.twig +68 -0
  2. package/atoms/Button/StyledButton.twig +47 -0
  3. package/atoms/Cursor/Cursor.twig +28 -0
  4. package/atoms/Figure/Figure.cjs +12 -3
  5. package/atoms/Figure/Figure.d.ts +18 -0
  6. package/atoms/Figure/Figure.js +1 -1
  7. package/atoms/Figure/Figure.twig +120 -0
  8. package/atoms/Figure/FigureTwicPics.cjs +72 -0
  9. package/atoms/Figure/FigureTwicPics.d.ts +48 -0
  10. package/atoms/Figure/FigureTwicPics.js +1 -0
  11. package/atoms/Figure/index.cjs +31 -0
  12. package/atoms/Figure/index.d.ts +2 -0
  13. package/atoms/Figure/index.js +1 -0
  14. package/atoms/Icon/Icon.twig +13 -0
  15. package/atoms/LargeText/LargeText.twig +49 -0
  16. package/atoms/ScrollAnimation/AbstractScrollAnimation.cjs +126 -0
  17. package/atoms/ScrollAnimation/AbstractScrollAnimation.d.ts +133 -0
  18. package/atoms/ScrollAnimation/AbstractScrollAnimation.js +1 -0
  19. package/atoms/ScrollAnimation/ScrollAnimation.cjs +51 -0
  20. package/atoms/ScrollAnimation/ScrollAnimation.d.ts +55 -0
  21. package/atoms/ScrollAnimation/ScrollAnimation.js +1 -0
  22. package/atoms/ScrollAnimation/ScrollAnimationChild.cjs +51 -0
  23. package/atoms/ScrollAnimation/ScrollAnimationChild.d.ts +13 -0
  24. package/atoms/ScrollAnimation/ScrollAnimationChild.js +1 -0
  25. package/atoms/ScrollAnimation/ScrollAnimationChildWithEase.cjs +41 -0
  26. package/atoms/ScrollAnimation/ScrollAnimationChildWithEase.d.ts +6 -0
  27. package/atoms/ScrollAnimation/ScrollAnimationChildWithEase.js +1 -0
  28. package/atoms/ScrollAnimation/ScrollAnimationParent.cjs +48 -0
  29. package/atoms/ScrollAnimation/ScrollAnimationParent.d.ts +35 -0
  30. package/atoms/ScrollAnimation/ScrollAnimationParent.js +1 -0
  31. package/atoms/ScrollAnimation/ScrollAnimationWithEase.cjs +41 -0
  32. package/atoms/ScrollAnimation/ScrollAnimationWithEase.d.ts +6 -0
  33. package/atoms/ScrollAnimation/ScrollAnimationWithEase.js +1 -0
  34. package/atoms/ScrollAnimation/animationScrollWithEase.cjs +70 -0
  35. package/atoms/ScrollAnimation/animationScrollWithEase.d.ts +11 -0
  36. package/atoms/ScrollAnimation/animationScrollWithEase.js +1 -0
  37. package/atoms/ScrollAnimation/index.cjs +41 -0
  38. package/atoms/ScrollAnimation/index.d.ts +7 -0
  39. package/atoms/ScrollAnimation/index.js +1 -0
  40. package/atoms/index.cjs +2 -2
  41. package/atoms/index.d.ts +2 -1
  42. package/atoms/index.js +1 -1
  43. package/index.cjs +1 -0
  44. package/index.d.ts +1 -0
  45. package/index.js +1 -1
  46. package/molecules/Accordion/Accordion.twig +54 -0
  47. package/molecules/Modal/Modal.twig +108 -0
  48. package/molecules/Modal/StyledModal.twig +39 -0
  49. package/molecules/Panel/Panel.twig +73 -0
  50. package/molecules/Panel/StyledPanel.twig +28 -0
  51. package/molecules/Slider/Slider.cjs +12 -4
  52. package/molecules/Slider/Slider.d.ts +11 -0
  53. package/molecules/Slider/Slider.js +1 -1
  54. package/molecules/Slider/SliderItem.cjs +5 -4
  55. package/molecules/Slider/SliderItem.d.ts +5 -0
  56. package/molecules/Slider/SliderItem.js +1 -1
  57. package/molecules/Sticky/Sticky.twig +31 -0
  58. package/molecules/Tabs/Tabs.twig +20 -0
  59. package/organisms/Frame/Frame.cjs +40 -1
  60. package/organisms/Frame/Frame.d.ts +34 -1
  61. package/organisms/Frame/Frame.js +1 -1
  62. package/organisms/Frame/FrameTarget.cjs +3 -3
  63. package/organisms/Frame/FrameTarget.js +1 -1
  64. package/organisms/ImageGrid/ImageGrid.twig +42 -0
  65. package/package.json +2 -2
@@ -0,0 +1,68 @@
1
+ {#
2
+ /**
3
+ * @file
4
+ * Button component.
5
+ *
6
+ * @param string $label
7
+ * @param string $tag
8
+ * @param string $href
9
+ * @param array $attr
10
+ * @param string $icon
11
+ * @param array|string $icon_classes
12
+ * @param 'start'|'end' $icon_position
13
+ * @param boolean $icon_only
14
+ */
15
+ #}
16
+
17
+ {# Customizable tag with a default value. #}
18
+ {% set tag =
19
+ tag|default(href is defined or (attr is defined and attr.href is defined) ? 'a' : 'button')
20
+ %}
21
+
22
+ {# Default icon values #}
23
+ {% set icon_position = icon_position|default('start') %}
24
+ {% set icon_only = icon_only|default(false) %}
25
+
26
+ {# Final attributes are a merge of the defaults, the given and then the required #}
27
+ {% set attributes =
28
+ merge_html_attributes(
29
+ attr ?? null,
30
+ {
31
+ title: label,
32
+ type: tag == 'button' ? 'button' : false,
33
+ href: tag == 'a' and href is defined ? href : false,
34
+ aria_label: icon_only ? label : false
35
+ },
36
+ { class: ['btn'] }
37
+ )
38
+ %}
39
+
40
+ {% set rendered_icon %}
41
+ {% block icon %}
42
+ {% include '@ui/atoms/Icon/Icon.twig' with {
43
+ name: icon ?? '',
44
+ classes: icon_classes ?? {
45
+ 'mr-3': not icon_only and icon_position == 'start',
46
+ 'ml-3': not icon_only and icon_position == 'end',
47
+ }
48
+ } %}
49
+ {% endblock %}
50
+ {% endset %}
51
+
52
+ {% html_element tag with attributes %}
53
+ {% block content %}
54
+ {% if icon is defined and icon_position == 'start' %}
55
+ {{ rendered_icon }}
56
+ {% endif %}
57
+ {% block label %}
58
+ {% if icon_only %}
59
+ <span class="sr-only">{{ label }}</span>
60
+ {% else %}
61
+ {{ label }}
62
+ {% endif %}
63
+ {% endblock %}
64
+ {% if icon is defined and icon_position == 'end' %}
65
+ {{ rendered_icon }}
66
+ {% endif %}
67
+ {% endblock %}
68
+ {% end_html_element %}
@@ -0,0 +1,47 @@
1
+ {#
2
+ /**
3
+ * @file
4
+ * Styled button.
5
+ *
6
+ * @param 'primary'|'secondary'|'tertiary' $theme
7
+ */
8
+ #}
9
+
10
+ {% extends '@ui/atoms/Button/Button.twig' %}
11
+
12
+ {% set icon_only = icon_only|default(false) %}
13
+
14
+ {% set theme = theme|default('primary') %}
15
+
16
+ {% set theme_shared = [
17
+ 'rounded cursor-pointer transition',
18
+ 'disabled:cursor-not-allowed',
19
+ {
20
+ 'inline-block': icon is not defined,
21
+ 'inline-flex items-center': icon is defined,
22
+ 'px-6 py-4': not icon_only,
23
+ 'p-4': icon_only
24
+ }
25
+ ] %}
26
+
27
+ {% set theme_primary = ['text-white bg-black', 'hover:bg-opacity-75 disabled:bg-opacity-50'] %}
28
+
29
+ {% set theme_secondary = [
30
+ 'ring ring-inset ring-2 ring-black ring-opacity-25',
31
+ {
32
+ 'hover:ring-opacity-100': (attr is defined and attr.disabled is not defined)
33
+ or attr is not defined
34
+ }
35
+ ] %}
36
+
37
+ {% set attr =
38
+ attr
39
+ |default({})
40
+ |merge({
41
+ class: [
42
+ theme_shared,
43
+ theme == 'primary' ? theme_primary : '',
44
+ theme == 'secondary' ? theme_secondary : ''
45
+ ]
46
+ })
47
+ %}
@@ -0,0 +1,28 @@
1
+ {#
2
+ /**
3
+ * @file
4
+ * Cursor component.
5
+ *
6
+ * @param array $attr
7
+ * Custom attributes for the root element.
8
+ *
9
+ * @block $content
10
+ * Custom content for the root element, defaults to `''`.
11
+ */
12
+ #}
13
+
14
+ {% set attributes =
15
+ merge_html_attributes(
16
+ attr ?? null,
17
+ {
18
+ data_component: 'Cursor',
19
+ class: 'fixed top-0 left-0 w-12 h-12 -mt-6 -ml-6 rounded-full bg-black'
20
+ },
21
+ { class: 'pointer-events-none' }
22
+ )
23
+ %}
24
+
25
+ <div {{ html_attributes(attributes) }}>
26
+ {% block content %}
27
+ {% endblock %}
28
+ </div>
@@ -29,6 +29,12 @@ __export(Figure_exports, {
29
29
  module.exports = __toCommonJS(Figure_exports);
30
30
  var import_js_toolkit = require("@studiometa/js-toolkit");
31
31
  var Figure = class extends (0, import_js_toolkit.withMountWhenInView)(import_js_toolkit.Base, { threshold: [0, 1] }) {
32
+ get src() {
33
+ return this.$refs.img.src;
34
+ }
35
+ set src(value) {
36
+ this.$refs.img.src = value;
37
+ }
32
38
  mounted() {
33
39
  if (!this.$refs.img) {
34
40
  throw new Error("[Figure] The `img` ref is required.");
@@ -36,13 +42,16 @@ var Figure = class extends (0, import_js_toolkit.withMountWhenInView)(import_js_
36
42
  if (!(this.$refs.img instanceof HTMLImageElement)) {
37
43
  throw new Error("[Figure] The `img` ref must be an `<img>` element.");
38
44
  }
39
- if (this.$refs.img.hasAttribute("data-src") && this.$refs.img.getAttribute("data-src") !== this.$refs.img.src) {
40
- this.$refs.img.src = this.$refs.img.getAttribute("data-src");
45
+ if (this.$options.lazy && this.$refs.img.hasAttribute("data-src") && this.$refs.img.getAttribute("data-src") !== this.src) {
46
+ this.src = this.$refs.img.getAttribute("data-src");
41
47
  }
42
48
  }
43
49
  };
44
50
  __publicField(Figure, "config", {
45
51
  name: "Figure",
46
- refs: ["img"]
52
+ refs: ["img"],
53
+ options: {
54
+ lazy: Boolean
55
+ }
47
56
  });
48
57
  if (module.exports.default) module.exports = module.exports.default;
@@ -15,7 +15,25 @@ export default class Figure extends Base {
15
15
  static config: {
16
16
  name: string;
17
17
  refs: string[];
18
+ options: {
19
+ lazy: BooleanConstructor;
20
+ };
18
21
  };
22
+ /**
23
+ * Set the image source.
24
+ *
25
+ * @this {Figure & FigureInterface}
26
+ * @param {string} value
27
+ * @returns {void}
28
+ */
29
+ set src(arg: string);
30
+ /**
31
+ * Get the image source.
32
+ *
33
+ * @this {Figure & FigureInterface}
34
+ * @returns {string}
35
+ */
36
+ get src(): string;
19
37
  /**
20
38
  * Load on mount.
21
39
  * @this {Figure & FigureInterface}
@@ -1 +1 @@
1
- import{Base as e,withMountWhenInView as t}from"@studiometa/js-toolkit";class i extends t(e,{threshold:[0,1]}){static config={name:"Figure",refs:["img"]};mounted(){if(!this.$refs.img)throw new Error("[Figure] The `img` ref is required.");if(!(this.$refs.img instanceof HTMLImageElement))throw new Error("[Figure] The `img` ref must be an `<img>` element.");this.$refs.img.hasAttribute("data-src")&&this.$refs.img.getAttribute("data-src")!==this.$refs.img.src&&(this.$refs.img.src=this.$refs.img.getAttribute("data-src"))}}export{i as default};
1
+ import{Base as t,withMountWhenInView as r}from"@studiometa/js-toolkit";class i extends r(t,{threshold:[0,1]}){static config={name:"Figure",refs:["img"],options:{lazy:Boolean}};get src(){return this.$refs.img.src}set src(e){this.$refs.img.src=e}mounted(){if(!this.$refs.img)throw new Error("[Figure] The `img` ref is required.");if(!(this.$refs.img instanceof HTMLImageElement))throw new Error("[Figure] The `img` ref must be an `<img>` element.");this.$options.lazy&&this.$refs.img.hasAttribute("data-src")&&this.$refs.img.getAttribute("data-src")!==this.src&&(this.src=this.$refs.img.getAttribute("data-src"))}}export{i as default};
@@ -0,0 +1,120 @@
1
+ {#
2
+ /**
3
+ * @file
4
+ * Figure component.
5
+ *
6
+ * @param string $src
7
+ * @param string $srcset
8
+ * @param string $sizes
9
+ * @param number $width
10
+ * @param number $height
11
+ * @param string $alt
12
+ * @param string $caption
13
+ * @param boolean $lazy
14
+ * @param 'cover'|'contain'|'fill'|'none' $fit
15
+ * Define how the image will fit.
16
+ * @param boolean $absolute
17
+ * Use absolute position on the image holder instead of relative.
18
+ * @param boolean $inline
19
+ * Wether to enable the display of the figure inline or not. When `inline`, the root element
20
+ * will have a max-width set corresponding to the `width` given. Use with caution.
21
+ * @param array $attr
22
+ * Custom attributes for the root element.
23
+ * @param array $inner_attr
24
+ * Custom attributes for the inner element.
25
+ * @param array $img_attr
26
+ * Custom attributes for the image element.
27
+ * @param array $caption_attr
28
+ * Custom attributes for the caption element.
29
+ *
30
+ * @block $caption
31
+ * Use this block to customize the image's caption.
32
+ *
33
+ * @todo
34
+ * - twicpics: use TwicPics to serve image at the right size
35
+ * - loading: display a loader while loading, the fallback image if there was an error
36
+ * - mode: img | background → is it really necessary with `object-fit-...`?
37
+ */
38
+ #}
39
+
40
+ {% set absolute = absolute|default(false) %}
41
+ {% set inline = inline|default(false) %}
42
+ {% set fit = fit ?? null %}
43
+ {% set height = height|default(100) %}
44
+ {% set width = width|default(100) %}
45
+ {% set lazy = lazy ?? true %}
46
+
47
+ {%- set placeholder_markup -%}
48
+ <svg xmlns="http://www.w3.org/2000/svg"
49
+ viewbox="0 0 {{ width }} {{ height }}"
50
+ width="{{ width }}"
51
+ height="{{ height }}">
52
+ <rect x="0" y="0" width="{{ width }}" height="{{ height }}" fill="#eee" />
53
+ </svg>
54
+ {%- endset -%}
55
+ {% set generic_placeholder = 'data:image/svg+xml,%s'|format(placeholder_markup|url_encode) %}
56
+
57
+ {% set attributes =
58
+ merge_html_attributes(
59
+ attr ?? null,
60
+ { data_component: 'Figure', class: ['figure', 'w-full'] },
61
+ {
62
+ style: { height: absolute ? '100%' : '', maxWidth: inline ? width ~ 'px' : '' },
63
+ data_option_lazy: lazy
64
+ }
65
+ )
66
+ %}
67
+
68
+ {% set img_attributes =
69
+ merge_html_attributes(
70
+ img_attr ?? null,
71
+ { class: 'figure__img' },
72
+ {
73
+ class: [
74
+ 'absolute inset-0 w-full max-w-none h-full',
75
+ {
76
+ 'object-cover': fit == 'cover',
77
+ 'object-contain': fit == 'contain',
78
+ 'object-fill': fit == 'fill',
79
+ 'object-none': fit == 'none'
80
+ }
81
+ ],
82
+ src: lazy ? placeholder|default(generic_placeholder) : src,
83
+ data_src: lazy ? src|default(generic_placeholder) : src,
84
+ alt: alt|default(''),
85
+ width: width|default(false),
86
+ height: height|default(false),
87
+ srcset: srcset|default(false),
88
+ sizes: sizes|default(false),
89
+ data_ref: 'img'
90
+ }
91
+ )
92
+ %}
93
+
94
+ {% set inner_attributes =
95
+ merge_html_attributes(
96
+ inner_attr ?? null,
97
+ { class: ['figure__inner'] },
98
+ {
99
+ class: absolute ? ['absolute', 'inset-0'] : ['relative', 'w-full', 'h-0'],
100
+ style: { paddingTop: absolute ? '' : height * 100 / width ~ '%' }
101
+ }
102
+ )
103
+ %}
104
+
105
+ {% set caption_attributes =
106
+ merge_html_attributes(caption_attr ?? null, { class: 'figure__caption' })
107
+ %}
108
+
109
+ <figure {{ html_attributes(attributes) }}>
110
+ <div {{ html_attributes(inner_attributes) }}>
111
+ <img {{ html_attributes(img_attributes) }} />
112
+ </div>
113
+ {% if caption is defined %}
114
+ {% block caption %}
115
+ <figcaption {{ html_attributes(caption_attributes) }}>
116
+ {{ caption }}
117
+ </figcaption>
118
+ {% endblock %}
119
+ {% endif %}
120
+ </figure>
@@ -0,0 +1,72 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
21
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
22
+ var __publicField = (obj, key, value) => {
23
+ __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
24
+ return value;
25
+ };
26
+
27
+ // packages/ui/atoms/Figure/FigureTwicPics.js
28
+ var FigureTwicPics_exports = {};
29
+ __export(FigureTwicPics_exports, {
30
+ default: () => FigureTwicPics
31
+ });
32
+ module.exports = __toCommonJS(FigureTwicPics_exports);
33
+ var import_Figure = __toESM(require("./Figure.cjs"), 1);
34
+ function normalizeSize(that, prop) {
35
+ const { step } = that.$options;
36
+ return Math.ceil(that.$refs.img[prop] / step) * step;
37
+ }
38
+ var FigureTwicPics = class extends import_Figure.default {
39
+ get domain() {
40
+ const url = new URL(this.$refs.img.dataset.src);
41
+ return url.host;
42
+ }
43
+ set src(value) {
44
+ const url = new URL(value);
45
+ url.host = this.domain;
46
+ const width = normalizeSize(this, "offsetWidth");
47
+ const height = normalizeSize(this, "offsetHeight");
48
+ url.searchParams.set("twic", ["v1", this.$options.transform, `${this.$options.mode}=${width}x${height}`].filter(Boolean).join("/"));
49
+ url.search = decodeURIComponent(url.search);
50
+ super.src = url.toString();
51
+ }
52
+ resized() {
53
+ this.src = this.$refs.img.dataset.src;
54
+ }
55
+ };
56
+ __publicField(FigureTwicPics, "config", {
57
+ ...import_Figure.default.config,
58
+ name: "FigureTwicPics",
59
+ options: {
60
+ ...import_Figure.default.config.options,
61
+ transform: String,
62
+ step: {
63
+ type: Number,
64
+ default: 50
65
+ },
66
+ mode: {
67
+ type: String,
68
+ default: "cover"
69
+ }
70
+ }
71
+ });
72
+ if (module.exports.default) module.exports = module.exports.default;
@@ -0,0 +1,48 @@
1
+ /**
2
+ * Figure class.
3
+ *
4
+ * Manager lazyloading image sources.
5
+ */
6
+ export default class FigureTwicPics extends Figure {
7
+ /**
8
+ * Config.
9
+ */
10
+ static config: {
11
+ name: string;
12
+ options: {
13
+ transform: StringConstructor;
14
+ step: {
15
+ type: NumberConstructor;
16
+ default: number;
17
+ };
18
+ mode: {
19
+ type: StringConstructor;
20
+ default: string;
21
+ };
22
+ lazy: BooleanConstructor;
23
+ };
24
+ refs: string[];
25
+ };
26
+ /**
27
+ * Get the TwicPics domain.
28
+ *
29
+ * @this {FigureTwicPicsInterface}
30
+ * @returns {string}
31
+ */
32
+ get domain(): string;
33
+ /**
34
+ * Reassign the source from the original on resized.
35
+ *
36
+ * @this {FigureTwicPicsInterface}
37
+ * @returns {void}
38
+ */
39
+ resized(this: FigureTwicPicsInterface): void;
40
+ }
41
+ export type FigureInterface = import('./Figure.js').FigureInterface;
42
+ export type FigureTwicPicsInterface = FigureTwicPics & FigureInterface & {
43
+ $options: {
44
+ transform: string;
45
+ step: number;
46
+ };
47
+ };
48
+ import Figure from "./Figure.js";
@@ -0,0 +1 @@
1
+ import i from"./Figure.js";function o(e,s){const{step:t}=e.$options;return Math.ceil(e.$refs.img[s]/t)*t}class c extends i{static config={...i.config,name:"FigureTwicPics",options:{...i.config.options,transform:String,step:{type:Number,default:50},mode:{type:String,default:"cover"}}};get domain(){return new URL(this.$refs.img.dataset.src).host}set src(s){const t=new URL(s);t.host=this.domain;const r=o(this,"offsetWidth"),n=o(this,"offsetHeight");t.searchParams.set("twic",["v1",this.$options.transform,`${this.$options.mode}=${r}x${n}`].filter(Boolean).join("/")),t.search=decodeURIComponent(t.search),super.src=t.toString()}resized(){this.src=this.$refs.img.dataset.src}}export{c as default};
@@ -0,0 +1,31 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
20
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
21
+
22
+ // packages/ui/atoms/Figure/index.js
23
+ var Figure_exports = {};
24
+ __export(Figure_exports, {
25
+ Figure: () => import_Figure.default,
26
+ FigureTwicPics: () => import_FigureTwicPics.default
27
+ });
28
+ module.exports = __toCommonJS(Figure_exports);
29
+ var import_Figure = __toESM(require("./Figure.cjs"), 1);
30
+ var import_FigureTwicPics = __toESM(require("./FigureTwicPics.cjs"), 1);
31
+ if (module.exports.default) module.exports = module.exports.default;
@@ -0,0 +1,2 @@
1
+ export { default as Figure } from "./Figure.js";
2
+ export { default as FigureTwicPics } from "./FigureTwicPics.js";
@@ -0,0 +1 @@
1
+ import{default as a}from"./Figure.js";import{default as i}from"./FigureTwicPics.js";export{a as Figure,i as FigureTwicPics};
@@ -0,0 +1,13 @@
1
+ {#
2
+ /**
3
+ * @file
4
+ * Icon component
5
+ *
6
+ * @param string $name The file name of the icon.
7
+ * @param string[] $classes Additional classes.
8
+ */
9
+ #}
10
+
11
+ <span class="icon {{ 'icon--%s'|format(name) }} {{ html_classes(classes|default('inline-block')) }}">
12
+ {{ source('@svg/%s.svg'|format(name), ignore_missing = true) }}
13
+ </span>
@@ -0,0 +1,49 @@
1
+ {#
2
+ /**
3
+ * @file
4
+ * LargeText component.
5
+ *
6
+ * @param string $content
7
+ * The text content.
8
+ * @param number $repeat
9
+ * The number of times the content should be repeated, defaults to 2.
10
+ * @param array $attr
11
+ * Custom attributes for the root element.
12
+ * @param array $target_attr
13
+ * Custom attributes for the target element.
14
+ */
15
+ #}
16
+
17
+ {% set attributes =
18
+ merge_html_attributes(
19
+ attr ?? null,
20
+ { data_component: 'LargeText' },
21
+ { class: 'overflow-x-hidden pointer-events-none' }
22
+ )
23
+ %}
24
+
25
+ {% set target_attributes =
26
+ merge_html_attributes(
27
+ target_attr ?? null,
28
+ { class: 'text-9xl font-bold' },
29
+ { data_ref: 'target', class: 'relative inline-block whitespace-nowrap' }
30
+ )
31
+ %}
32
+
33
+ {% set position_factor = attributes.data_option_sensitivity is defined
34
+ and attributes.data_option_sensitivity < 0
35
+ ? - 100
36
+ : 100
37
+ %}
38
+
39
+ <div {{ html_attributes(attributes) }}>
40
+ <span {{ html_attributes(target_attributes) }}>
41
+ {% for count in 1..repeat ?? 2 %}
42
+ {% set content_attributes = {
43
+ style: { left: loop.first ? '' : loop.index0 * position_factor ~ '%' },
44
+ class: { 'absolute top-0': not loop.first }
45
+ } %}
46
+ <span {{ html_attributes(content_attributes) }}>&nbsp;{{ content }}</span>
47
+ {% endfor %}
48
+ </span>
49
+ </div>
@@ -0,0 +1,126 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var __publicField = (obj, key, value) => {
20
+ __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
21
+ return value;
22
+ };
23
+
24
+ // packages/ui/atoms/ScrollAnimation/AbstractScrollAnimation.js
25
+ var AbstractScrollAnimation_exports = {};
26
+ __export(AbstractScrollAnimation_exports, {
27
+ default: () => AbstractScrollAnimation
28
+ });
29
+ module.exports = __toCommonJS(AbstractScrollAnimation_exports);
30
+ var import_js_toolkit = require("@studiometa/js-toolkit");
31
+ var import_utils = require("@studiometa/js-toolkit/utils");
32
+ function getDefaults() {
33
+ return {
34
+ x: 0,
35
+ y: 0,
36
+ z: 0,
37
+ scale: 1,
38
+ scaleX: 1,
39
+ scaleY: 1,
40
+ rotate: 0,
41
+ skewX: 0,
42
+ skewY: 0,
43
+ opacity: 1
44
+ };
45
+ }
46
+ var AbstractScrollAnimation = class extends (0, import_js_toolkit.withFreezedOptions)(import_js_toolkit.Base) {
47
+ get target() {
48
+ return this.$el;
49
+ }
50
+ get has() {
51
+ const has = {
52
+ x: false,
53
+ y: false,
54
+ z: false,
55
+ scale: false,
56
+ scaleX: false,
57
+ scaleY: false,
58
+ rotate: false,
59
+ skewX: false,
60
+ skewY: false,
61
+ opacity: false,
62
+ transform: false
63
+ };
64
+ Object.keys(this.$options.from).forEach((key) => {
65
+ has[key] = this.$options.from[key] !== this.$options.to[key];
66
+ });
67
+ has.transform = Object.keys(has).filter((key) => key !== "opacity" && key !== "transform").some((key) => has[key]);
68
+ Object.defineProperty(this, "has", { value: has });
69
+ return has;
70
+ }
71
+ scrolledInView(props) {
72
+ if (!this.has.opacity && !this.has.transform) {
73
+ return;
74
+ }
75
+ const progress = (0, import_utils.map)((0, import_utils.clamp)(props.dampedProgress.y, this.$options.playRange[0], this.$options.playRange[1]), this.$options.playRange[0], this.$options.playRange[1], 0, 1);
76
+ this.render(progress);
77
+ }
78
+ render(progress) {
79
+ if (this.has.opacity) {
80
+ this.target.style.opacity = String((0, import_utils.map)(progress, 0, 1, this.$options.from.opacity, this.$options.to.opacity));
81
+ }
82
+ if (this.has.transform) {
83
+ let transform = (0, import_utils.matrix)({
84
+ translateX: this.has.x ? (0, import_utils.lerp)(this.$options.from.x, this.$options.to.x, progress) : void 0,
85
+ translateY: this.has.y ? (0, import_utils.lerp)(this.$options.from.y, this.$options.to.y, progress) : void 0,
86
+ scaleX: this.has.scale ? (0, import_utils.lerp)(this.$options.from.scale, this.$options.to.scale, progress) : this.has.scaleX ? (0, import_utils.lerp)(this.$options.from.scaleX, this.$options.to.scaleX, progress) : void 0,
87
+ scaleY: this.has.scale ? (0, import_utils.lerp)(this.$options.from.scale, this.$options.to.scale, progress) : this.has.scaleY ? (0, import_utils.lerp)(this.$options.from.scaleY, this.$options.to.scaleY, progress) : void 0,
88
+ skewX: this.has.skewX ? (0, import_utils.lerp)(this.$options.from.skewX, this.$options.to.skewX, progress) : void 0,
89
+ skewY: this.has.skewY ? (0, import_utils.lerp)(this.$options.from.skewY, this.$options.to.skewY, progress) : void 0
90
+ });
91
+ if (this.has.rotate) {
92
+ transform += ` rotate(${(0, import_utils.lerp)(this.$options.from.rotate, this.$options.to.rotate, progress)}deg)`;
93
+ }
94
+ transform += `translateZ(${this.has.z ? (0, import_utils.lerp)(this.$options.from.z, this.$options.to.z, progress) : 0})`;
95
+ this.target.style.transform = transform;
96
+ }
97
+ }
98
+ };
99
+ __publicField(AbstractScrollAnimation, "config", {
100
+ name: "AbstractScrollAnimation",
101
+ options: {
102
+ playRange: {
103
+ type: Array,
104
+ default: () => [0, 1]
105
+ },
106
+ dampFactor: {
107
+ type: Number,
108
+ default: 0.5
109
+ },
110
+ dampPrecision: {
111
+ type: Number,
112
+ default: 1e-3
113
+ },
114
+ from: {
115
+ type: Object,
116
+ default: getDefaults,
117
+ merge: true
118
+ },
119
+ to: {
120
+ type: Object,
121
+ default: getDefaults,
122
+ merge: true
123
+ }
124
+ }
125
+ });
126
+ if (module.exports.default) module.exports = module.exports.default;