@inizioevoke/astro-core 2.3.2 → 3.0.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.
@@ -64,7 +64,7 @@ The ISI starts collapsed to zero height. The built-in button toggles it open and
64
64
 
65
65
  ```astro
66
66
  ---
67
- import { BottomISI } from '@inizioevoke/astro-core';
67
+ import BottomISI from '@inizioevoke/astro-core/BottomISI';
68
68
  ---
69
69
  <footer>
70
70
  <BottomISI>
@@ -80,7 +80,7 @@ The partial excerpt is always visible. Clicking it expands the full ISI on top.
80
80
 
81
81
  ```astro
82
82
  ---
83
- import { BottomISI } from '@inizioevoke/astro-core';
83
+ import BottomISI from '@inizioevoke/astro-core/BottomISI';
84
84
  ---
85
85
  <footer>
86
86
  <BottomISI>
@@ -101,7 +101,7 @@ Set a visible collapsed height so the ISI is always partially shown even before
101
101
 
102
102
  ```astro
103
103
  ---
104
- import { BottomISI } from '@inizioevoke/astro-core';
104
+ import BottomISI from '@inizioevoke/astro-core/BottomISI';
105
105
  ---
106
106
  <style>
107
107
  footer evo-isi {
@@ -156,7 +156,7 @@ Replace the built-in toggle with your own markup using the named slots.
156
156
  </BottomISI>
157
157
 
158
158
  <script>
159
- import type { IEvoIsiElement } from '@inizioevoke/astro-core';
159
+ import type { IEvoIsiElement } from '@inizioevoke/astro-core/lib/BottomISI';
160
160
 
161
161
  const isi = document.querySelector<IEvoIsiElement>('#page-isi');
162
162
 
@@ -22,7 +22,7 @@ The image will be optimized by default. Optimization options include `format`, `
22
22
  ```html
23
23
  <!-- Astro Page -->
24
24
  ---
25
- import { CssBackgroundImage } from '@inizioevoke/astro-core';
25
+ import CssBackgroundImage from '@inizioevoke/astro-core/CssBackgroundImage';
26
26
  import Layout from '../layouts/Layout.astro';
27
27
  import bgImg_m from '../assets/img/background-m.jpg';
28
28
  import bgImg_d from '../assets/img/background-d.jpg';
@@ -22,7 +22,7 @@ The image will be optimized by default. Optimization options include `format`, `
22
22
  ```html
23
23
  <!-- Astro Page -->
24
24
  ---
25
- import { CssVariables } from '@inizioevoke/astro-core';
25
+ import CssVariables from '@inizioevoke/astro-core/CssVariables';
26
26
  import Layout from '../layouts/Layout.astro';
27
27
  import bgImg_m from '../assets/img/background-m.jpg';
28
28
  import bgImg_d from '../assets/img/background-d.jpg';
@@ -45,7 +45,7 @@ The underlying `<evo-flip-card>` custom element exposes the following API for pr
45
45
 
46
46
  ```astro
47
47
  ---
48
- import { FlipCard } from '@inizioevoke/astro-core';
48
+ import FlipCard from '@inizioevoke/astro-core/FlipCard';
49
49
  ---
50
50
  <FlipCard width={400} height={300}>
51
51
  <div slot="front">
@@ -89,7 +89,7 @@ Access the `<evo-modal>` element directly to call these methods:
89
89
  Importable from the package entry point for use in client scripts.
90
90
 
91
91
  ```ts
92
- import { showModal, hideModal, hideModals, showOverlay, hideOverlay, bindTriggers } from '@inizioevoke/astro-core';
92
+ import { showModal, hideModal, hideModals, showOverlay, hideOverlay, bindTriggers } from '@inizioevoke/astro-core/lib/Modal';
93
93
  ```
94
94
 
95
95
  | Function | Signature | Description |
@@ -135,7 +135,7 @@ Any element with the class `evo-modal-action-hide` inside a modal will close it
135
135
 
136
136
  ```astro
137
137
  ---
138
- import { Modal, ModalTrigger } from '@inizioevoke/astro-core';
138
+ import Modal, { ModalTrigger } from '@inizioevoke/astro-core/Modal';
139
139
  ---
140
140
  <ModalTrigger modal="info-modal">Open modal</ModalTrigger>
141
141
 
@@ -176,7 +176,7 @@ import { Modal, ModalTrigger } from '@inizioevoke/astro-core';
176
176
 
177
177
  ```astro
178
178
  <script>
179
- import { showModal } from '@inizioevoke/astro-core';
179
+ import { showModal } from '@inizioevoke/astro-core/lib/Modal';
180
180
 
181
181
  document.querySelector('#open-btn').addEventListener('click', () => {
182
182
  showModal('info-modal', {
@@ -191,7 +191,7 @@ import { Modal, ModalTrigger } from '@inizioevoke/astro-core';
191
191
  ### Binding dynamically added triggers
192
192
 
193
193
  ```ts
194
- import { bindTriggers } from '@inizioevoke/astro-core';
194
+ import { bindTriggers } from '@inizioevoke/astro-core/lib/Modal';
195
195
 
196
196
  // After inserting new trigger elements into the DOM:
197
197
  bindTriggers(myContainer);
@@ -201,7 +201,7 @@ bindTriggers(myContainer);
201
201
 
202
202
  ```astro
203
203
  ---
204
- import { Modal, ModalOverlay } from '@inizioevoke/astro-core';
204
+ import Modal, { ModalOverlay } from '@inizioevoke/astro-core/Modal';
205
205
  ---
206
206
  <ModalOverlay class="my-overlay" />
207
207
 
@@ -67,7 +67,7 @@ Access the `<evo-scroll-container>` element directly to use these members:
67
67
  Importable from the package entry point for use in client scripts.
68
68
 
69
69
  ```ts
70
- import { resize, refresh, getScroll, scroll, getScrollContainer } from '@inizioevoke/astro-core';
70
+ import { resize, refresh, getScroll, scroll, getScrollContainer } from '@inizioevoke/astro-core/lib/ScrollContainer';
71
71
  ```
72
72
 
73
73
  | Function | Signature | Description |
@@ -86,7 +86,7 @@ import { resize, refresh, getScroll, scroll, getScrollContainer } from '@inizioe
86
86
 
87
87
  ```astro
88
88
  ---
89
- import { ScrollContainer } from '@inizioevoke/astro-core';
89
+ import ScrollContainer from '@inizioevoke/astro-core/ScrollContainer';
90
90
  ---
91
91
  <ScrollContainer height={400}>
92
92
  <p>Line 1</p>
@@ -133,7 +133,7 @@ import { ScrollContainer } from '@inizioevoke/astro-core';
133
133
  ### Using utility functions
134
134
 
135
135
  ```ts
136
- import { scroll, refresh } from '@inizioevoke/astro-core';
136
+ import { scroll, refresh } from '@inizioevoke/astro-core/lib/ScrollContainer';
137
137
 
138
138
  // Smooth-scroll to position
139
139
  scroll('#my-scroll', { top: 200, behavior: 'smooth' });
@@ -49,7 +49,7 @@ Defines a single tab. Rendered as a child of `Tabs`. The tab button label comes
49
49
 
50
50
  ```astro
51
51
  ---
52
- import { Tabs, TabItem } from '@inizioevoke/astro-core';
52
+ import { Tabs, TabItem } from '@inizioevoke/astro-core/Tabs';
53
53
  ---
54
54
  <Tabs>
55
55
  <TabItem active>
@@ -0,0 +1,66 @@
1
+ # Astro Utilities
2
+
3
+ ## addCssClassToAttrs
4
+
5
+ Merges one or more CSS class names into an Astro element's spread attributes object, preserving any existing `class` or `class:list` values.
6
+
7
+ This is an internal utility used by components to inject required class names without overwriting consumer-supplied classes.
8
+
9
+ ### Usage
10
+
11
+ ```ts
12
+ import { addCssClassToAttrs } from '../../lib/utils';
13
+
14
+ const { ...attrs } = Astro.props;
15
+ addCssClassToAttrs(attrs, 'my-component');
16
+ // attrs now has class:list: ['my-component']
17
+ ```
18
+
19
+ ```ts
20
+ // Multiple classes at once
21
+ addCssClassToAttrs(attrs, ['base-class', 'modifier-class']);
22
+ ```
23
+
24
+ ### API
25
+
26
+ #### `addCssClassToAttrs(attrs, cssClass)`
27
+
28
+ Mutates `attrs` in place. After the call, `attrs['class:list']` is set and `attrs['class']` is removed (Astro resolves `class:list` to the final `class` attribute at render time).
29
+
30
+ | Parameter | Type | Description |
31
+ |-----------|------|-------------|
32
+ | `attrs` | `HTMLAttributes<T>` | The spread attributes object from `Astro.props`. Mutated in place. |
33
+ | `cssClass` | `string \| string[]` | One or more class names to add. |
34
+
35
+ **Merge behavior**
36
+
37
+ | Before call | Result |
38
+ |-------------|--------|
39
+ | No `class` or `class:list` on `attrs` | `class:list` is set to `cssClass`. |
40
+ | `class` present | Existing value is moved into `class:list` alongside `cssClass`; `class` is deleted. |
41
+ | `class:list` present | `cssClass` is appended to the existing `class:list` array. |
42
+
43
+ ### Example — component usage
44
+
45
+ ```astro
46
+ ---
47
+ import type { HTMLAttributes } from 'astro/types';
48
+ import { addCssClassToAttrs } from '../../lib/utils';
49
+
50
+ interface Props extends HTMLAttributes<'div'> {}
51
+ const { ...attrs } = Astro.props;
52
+
53
+ addCssClassToAttrs(attrs, 'my-component');
54
+ ---
55
+
56
+ <div {...attrs}>
57
+ <slot />
58
+ </div>
59
+ ```
60
+
61
+ A consumer can pass `class` or `class:list` freely and the component's own class is always included:
62
+
63
+ ```astro
64
+ <MyComponent class="consumer-class">...</MyComponent>
65
+ <!-- Renders: <div class="my-component consumer-class">...</div> -->
66
+ ```
package/package.json CHANGED
@@ -1,22 +1,30 @@
1
1
  {
2
2
  "name": "@inizioevoke/astro-core",
3
- "version": "2.3.2",
3
+ "version": "3.0.0",
4
4
  "description": "",
5
5
  "license": "ISC",
6
6
  "author": "",
7
7
  "type": "module",
8
8
  "main": "./index.ts",
9
- "exports": {
10
- ".": "./src/components/index.ts",
9
+ "exports": {
11
10
  "./integrations": "./src/integrations/index.ts",
12
- "./lib": "./src/lib/index.ts",
13
- "./lib/FlipCard": "./src/components/FlipCard/index.ts",
14
- "./lib/BottomISI": "./src/components/BottomISI/index.ts",
15
- "./lib/Modal": "./src/components/Modal/index.ts",
16
- "./lib/PdfViewer": "./src/components/PdfViewer/index.ts",
17
- "./lib/ScrollContainer": "./src/components/ScrollContainer/index.ts",
18
- "./lib/gestures": "./src/lib/gestures/index.ts",
19
- "./server": "./src/server/index.ts"
11
+ "./utils": "./src/lib/utils.ts",
12
+
13
+ "./CssBackgroundImage": "./src/components/CssBackgroundImage/index.ts",
14
+ "./CssVariables": "./src/components/CssVariables/index.ts",
15
+ "./FlipCard": "./src/components/FlipCard/index.ts",
16
+ "./BottomISI": "./src/components/ISI/BottomISI/index.ts",
17
+ "./Modal": "./src/components/Modal/index.ts",
18
+ "./ScrollContainer": "./src/components/ScrollContainer/index.ts",
19
+ "./Tabs": "./src/components/Tabs/index.ts",
20
+
21
+ "./lib/FlipCard": "./src/components/FlipCard/FlipCard.ts",
22
+ "./lib/BottomISI": "./src/components/ISI/BottomISI/BottomISI.ts",
23
+ "./lib/Modal": "./src/components/Modal/Modal.ts",
24
+ "./lib/ScrollContainer": "./src/components/ScrollContainer/ScrollContainer.ts",
25
+
26
+ "./lib/gestures/pinch": "./src/lib/client/gestures/pinch.ts",
27
+ "./lib/gestures/swipe": "./src/lib/client/gestures/swipe.ts"
20
28
  },
21
29
  "scripts": {
22
30
  "postinstall": "node postinstall.mjs"
@@ -0,0 +1,4 @@
1
+ export {
2
+ default,
3
+ type Props as CssBackgroundImageProps,
4
+ } from "./CssBackgroundImage.astro";
@@ -0,0 +1,7 @@
1
+ export {
2
+ default,
3
+ type Props as CssVariablesProps,
4
+ type CssBreakpoint,
5
+ type CssVariable,
6
+ type CssImageVariable
7
+ } from "./CssVariables.astro";
@@ -1 +1,4 @@
1
- export * from './FlipCard';
1
+ export {
2
+ default,
3
+ type Props as FlipCardProps,
4
+ } from "./FlipCard.astro";
@@ -1,6 +1,6 @@
1
1
  ---
2
- import type { HTMLAttributes, HTMLTag } from 'astro/types';
3
- import { addCssClassToAttrs } from '../../../server/index';
2
+ import type { HTMLAttributes } from 'astro/types';
3
+ import { addCssClassToAttrs } from '../../../lib/utils';
4
4
  import ScrollContainer, { type Props as ScrollContainerProps } from '../../ScrollContainer/ScrollContainer.astro';
5
5
  import './BottomISI.css';
6
6
 
@@ -1 +1,4 @@
1
- export * from './BottomISI';
1
+ export {
2
+ default,
3
+ type Props as BottomISIProps
4
+ } from "./BottomISI.astro";
@@ -1 +1,14 @@
1
- export * from './Modal';
1
+ export {
2
+ default,
3
+ type Props as ModalProps,
4
+ } from "./Modal.astro";
5
+
6
+ export {
7
+ default as ModalOverlay,
8
+ type Props as ModalOverlayProps,
9
+ } from "./ModalOverlay.astro";
10
+
11
+ export {
12
+ default as ModalTrigger,
13
+ type Props as ModalTriggerProps,
14
+ } from "./ModalTrigger.astro";
@@ -1 +1,4 @@
1
- export * from './ScrollContainer';
1
+ export {
2
+ default,
3
+ type Props as ScrollContainerProps,
4
+ } from "./ScrollContainer.astro";
@@ -0,0 +1,9 @@
1
+ export {
2
+ default as Tabs,
3
+ type Props as TabsProps
4
+ } from "./Tabs.astro";
5
+
6
+ export {
7
+ default as TabItem,
8
+ type Props as TabItemProps,
9
+ } from "./TabItem.astro";
@@ -0,0 +1 @@
1
+ export * from './gestures';
@@ -1,22 +0,0 @@
1
- # RightISI
2
-
3
- ```jsx
4
- <RightISI
5
- scrollContainer={{ // optional
6
- /* ScrollContainer props */
7
- }}
8
- headerButton={true} // optional
9
- >
10
- <!-- optional -->
11
- <div slot="header">Header Content</div>
12
-
13
- <!-- optional -->
14
- <Fragment slot="header-button"><button>My Button</button></Fragment>
15
-
16
- <!-- ISI content -->
17
- <h2>Important Safety Information</h2>
18
- <p>Content</p>
19
-
20
- <div slot="footer">Footer Content</div>
21
- </RightISI>
22
- ```
@@ -1,72 +0,0 @@
1
- export {
2
- default as CssBackgroundImage,
3
- type Props as CssBackgroundImageProps,
4
- } from "./CssBackgroundImage.astro";
5
-
6
- export {
7
- default as CssVariables,
8
- type Props as CssVariablesProps,
9
- type CssBreakpoint,
10
- type CssVariable,
11
- type CssImageVariable
12
- } from "./CssVariables.astro";
13
-
14
- export {
15
- default as FlipCard,
16
- type Props as FlipCardProps,
17
- } from "./FlipCard/FlipCard.astro";
18
-
19
- export {
20
- default as BottomISI,
21
- type Props as BottomISIProps
22
- } from "./ISI/BottomISI/BottomISI.astro";
23
-
24
- // export {
25
- // default as BottomScrollableISI,
26
- // type Props as BottomScrollableISIProps
27
- // } from "./ISI/Bottom/BottomScrollableISI.astro";
28
-
29
- export {
30
- default as RightISI,
31
- type Props as RightISIProps,
32
- } from "./ISI/RightISI/RightISI.astro";
33
-
34
- export {
35
- default as Modal,
36
- type Props as ModalProps,
37
- } from "./Modal/Modal.astro";
38
-
39
- export {
40
- default as ModalOverlay,
41
- type Props as ModalOverlayProps,
42
- } from "./Modal/ModalOverlay.astro";
43
-
44
- export {
45
- default as ModalTrigger,
46
- type Props as ModalTriggerProps,
47
- } from "./Modal/ModalTrigger.astro";
48
-
49
- export {
50
- default as PdfViewer,
51
- type Props as PdfViewerProps,
52
- } from "./PdfViewer/PdfViewer.astro";
53
-
54
- export {
55
- default as ScrollContainer,
56
- type Props as ScrollContainerProps,
57
- } from "./ScrollContainer/ScrollContainer.astro";
58
-
59
- export {
60
- default as Tabs,
61
- type Props as TabsProps
62
- } from "./Tabs/Tabs.astro";
63
-
64
- export {
65
- default as TabItem,
66
- type Props as TabItemProps,
67
- } from "./Tabs/TabItem.astro";
68
-
69
- export {
70
- default as Zoom,
71
- type Props as ZoomProps
72
- } from "./Zoom/Zoom.astro";
package/src/lib/index.ts DELETED
@@ -1,6 +0,0 @@
1
- export * as FlipCard from '../components/FlipCard/FlipCard';
2
- export * as ISI from '../components/ISI/index';
3
- export * as gestures from './gestures';
4
- export * as Modal from '../components/Modal/Modal';
5
- export * as PdfViewer from '../components/PdfViewer/PdfViewer';
6
- export * as ScrollContainer from '../components/ScrollContainer/ScrollContainer';
File without changes
File without changes
File without changes
File without changes