@gem-sdk/core 1.44.0-dev.129 → 1.44.0-dev.136

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.
@@ -0,0 +1,17 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var jsxRuntime = require('react/jsx-runtime');
6
+ var react = require('react');
7
+ var useApplyAnimation = require('../hooks/animation/useApplyAnimation.js');
8
+
9
+ const ComponentAnimation = ({ ...props })=>{
10
+ useApplyAnimation.default({
11
+ props
12
+ });
13
+ return /*#__PURE__*/ jsxRuntime.jsx(jsxRuntime.Fragment, {});
14
+ };
15
+ var ComponentAnimation$1 = /*#__PURE__*/ react.memo(ComponentAnimation);
16
+
17
+ exports.default = ComponentAnimation$1;
@@ -8,7 +8,6 @@ var composeAdvanceStyle = require('../helpers/compose-advance-style.js');
8
8
  var constant = require('./constant.js');
9
9
  var RenderCustomCode = require('./RenderCustomCode.js');
10
10
  var ComponentToolbarPreview = require('./ComponentToolbarPreview.js');
11
- var useApplyAnimation = require('../hooks/animation/useApplyAnimation.js');
12
11
  require('zustand');
13
12
  require('swr');
14
13
  require('@gem-sdk/adapter-shopify');
@@ -19,6 +18,7 @@ require('vanilla-lazyload');
19
18
  require('../hooks/useCartUI.js');
20
19
  var cls = require('../helpers/cls.js');
21
20
  require('../helpers/convert.js');
21
+ var ComponentAnimation = require('./ComponentAnimation.js');
22
22
 
23
23
  const ComponentWrapperPreview = ({ children, ...props })=>{
24
24
  react.useEffect(()=>{
@@ -32,9 +32,6 @@ const ComponentWrapperPreview = ({ children, ...props })=>{
32
32
  }, [
33
33
  props.uid
34
34
  ]);
35
- useApplyAnimation.default({
36
- props
37
- });
38
35
  const pageType = shop.usePageType();
39
36
  if (props.type === 'section') {
40
37
  return null;
@@ -164,6 +161,9 @@ const ComponentWrapperPreview = ({ children, ...props })=>{
164
161
  // Render
165
162
  return /*#__PURE__*/ jsxRuntime.jsxs(jsxRuntime.Fragment, {
166
163
  children: [
164
+ /*#__PURE__*/ jsxRuntime.jsx(ComponentAnimation.default, {
165
+ ...props
166
+ }),
167
167
  /*#__PURE__*/ jsxRuntime.jsx(RenderCustomCode.default, {
168
168
  uid: props.uid,
169
169
  advanced: advanced
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  const BlogsDocument = `
4
- query blogs($after: Cursor, $before: Cursor, $first: Int, $last: Int, $orderBy: BlogOrder, $where: BlogWhereInput) {
4
+ query blogs($after: Cursor, $before: Cursor, $first: Int, $last: Int, $orderBy: BlogOrder, $where: BlogWhereInput, $articlesOrderBy: ArticleOrder) {
5
5
  blogs(
6
6
  after: $after
7
7
  before: $before
@@ -17,7 +17,7 @@ const BlogsDocument = `
17
17
  description
18
18
  descriptionMeta
19
19
  handle
20
- articles {
20
+ articles (orderBy: $articlesOrderBy) {
21
21
  edges {
22
22
  node {
23
23
  id
@@ -18,6 +18,7 @@ const useArticlesQuery = (variables, options)=>{
18
18
  };
19
19
  const useBlogsQuery = (variables, options)=>{
20
20
  const fetcher = useFetchHandle.useFetchHandle();
21
+ //@ts-ignore
21
22
  const fetchBlogs = ()=>fetcher([
22
23
  blogs_generated.BlogsDocument,
23
24
  variables ?? {}
@@ -2,9 +2,18 @@
2
2
 
3
3
  var react = require('react');
4
4
 
5
+ // Hàm debounce với TypeScript
6
+ function debounce(func, wait) {
7
+ let timeout;
8
+ return function(...args) {
9
+ clearTimeout(timeout);
10
+ timeout = setTimeout(()=>func.apply(this, args), wait);
11
+ };
12
+ }
5
13
  function subscribe(callback) {
6
- window.addEventListener('resize', callback);
7
- return ()=>window.removeEventListener('resize', callback);
14
+ const debouncedCallback = debounce(callback, 200); // Debounce với thời gian chờ 200ms
15
+ window.addEventListener('resize', debouncedCallback);
16
+ return ()=>window.removeEventListener('resize', debouncedCallback);
8
17
  }
9
18
  const useCurrentDevice = ()=>{
10
19
  return react.useSyncExternalStore(subscribe, ()=>{
@@ -0,0 +1,13 @@
1
+ import { jsx, Fragment } from 'react/jsx-runtime';
2
+ import { memo } from 'react';
3
+ import useApplyAnimation from '../hooks/animation/useApplyAnimation.js';
4
+
5
+ const ComponentAnimation = ({ ...props })=>{
6
+ useApplyAnimation({
7
+ props
8
+ });
9
+ return /*#__PURE__*/ jsx(Fragment, {});
10
+ };
11
+ var ComponentAnimation$1 = /*#__PURE__*/ memo(ComponentAnimation);
12
+
13
+ export { ComponentAnimation$1 as default };
@@ -4,7 +4,6 @@ import { composeAdvanceStyle } from '../helpers/compose-advance-style.js';
4
4
  import { disableWrap, excludeApplyStyle } from './constant.js';
5
5
  import RenderCustomCode from './RenderCustomCode.js';
6
6
  import ComponentToolbarPreview from './ComponentToolbarPreview.js';
7
- import useApplyAnimation from '../hooks/animation/useApplyAnimation.js';
8
7
  import 'zustand';
9
8
  import 'swr';
10
9
  import '@gem-sdk/adapter-shopify';
@@ -15,6 +14,7 @@ import 'vanilla-lazyload';
15
14
  import '../hooks/useCartUI.js';
16
15
  import { cls } from '../helpers/cls.js';
17
16
  import '../helpers/convert.js';
17
+ import ComponentAnimation from './ComponentAnimation.js';
18
18
 
19
19
  const ComponentWrapperPreview = ({ children, ...props })=>{
20
20
  useEffect(()=>{
@@ -28,9 +28,6 @@ const ComponentWrapperPreview = ({ children, ...props })=>{
28
28
  }, [
29
29
  props.uid
30
30
  ]);
31
- useApplyAnimation({
32
- props
33
- });
34
31
  const pageType = usePageType();
35
32
  if (props.type === 'section') {
36
33
  return null;
@@ -160,6 +157,9 @@ const ComponentWrapperPreview = ({ children, ...props })=>{
160
157
  // Render
161
158
  return /*#__PURE__*/ jsxs(Fragment, {
162
159
  children: [
160
+ /*#__PURE__*/ jsx(ComponentAnimation, {
161
+ ...props
162
+ }),
163
163
  /*#__PURE__*/ jsx(RenderCustomCode, {
164
164
  uid: props.uid,
165
165
  advanced: advanced
@@ -1,5 +1,5 @@
1
1
  const BlogsDocument = `
2
- query blogs($after: Cursor, $before: Cursor, $first: Int, $last: Int, $orderBy: BlogOrder, $where: BlogWhereInput) {
2
+ query blogs($after: Cursor, $before: Cursor, $first: Int, $last: Int, $orderBy: BlogOrder, $where: BlogWhereInput, $articlesOrderBy: ArticleOrder) {
3
3
  blogs(
4
4
  after: $after
5
5
  before: $before
@@ -15,7 +15,7 @@ const BlogsDocument = `
15
15
  description
16
16
  descriptionMeta
17
17
  handle
18
- articles {
18
+ articles (orderBy: $articlesOrderBy) {
19
19
  edges {
20
20
  node {
21
21
  id
@@ -16,6 +16,7 @@ const useArticlesQuery = (variables, options)=>{
16
16
  };
17
17
  const useBlogsQuery = (variables, options)=>{
18
18
  const fetcher = useFetchHandle();
19
+ //@ts-ignore
19
20
  const fetchBlogs = ()=>fetcher([
20
21
  BlogsDocument,
21
22
  variables ?? {}
@@ -1,8 +1,17 @@
1
1
  import { useSyncExternalStore } from 'react';
2
2
 
3
+ // Hàm debounce với TypeScript
4
+ function debounce(func, wait) {
5
+ let timeout;
6
+ return function(...args) {
7
+ clearTimeout(timeout);
8
+ timeout = setTimeout(()=>func.apply(this, args), wait);
9
+ };
10
+ }
3
11
  function subscribe(callback) {
4
- window.addEventListener('resize', callback);
5
- return ()=>window.removeEventListener('resize', callback);
12
+ const debouncedCallback = debounce(callback, 200); // Debounce với thời gian chờ 200ms
13
+ window.addEventListener('resize', debouncedCallback);
14
+ return ()=>window.removeEventListener('resize', debouncedCallback);
6
15
  }
7
16
  const useCurrentDevice = ()=>{
8
17
  return useSyncExternalStore(subscribe, ()=>{
@@ -36071,6 +36071,7 @@ type BlogsQueryVariables = Exact$1<{
36071
36071
  last?: InputMaybe$1<Scalars$2['Int']>;
36072
36072
  orderBy?: InputMaybe$1<BlogOrder$1>;
36073
36073
  where?: InputMaybe$1<BlogWhereInput$1>;
36074
+ articlesOrderBy: InputMaybe$1<ArticleOrder$1>;
36074
36075
  }>;
36075
36076
  type BlogsQueryResponse = {
36076
36077
  blogs?: Maybe$1<(Pick<BlogConnection$1, 'totalCount'> & {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gem-sdk/core",
3
- "version": "1.44.0-dev.129",
3
+ "version": "1.44.0-dev.136",
4
4
  "license": "MIT",
5
5
  "sideEffects": false,
6
6
  "main": "dist/cjs/index.js",
@@ -27,8 +27,8 @@
27
27
  "type-check": "yarn tsc --noEmit"
28
28
  },
29
29
  "devDependencies": {
30
- "@gem-sdk/adapter-shopify": "1.44.0-dev.123",
31
- "@gem-sdk/styles": "1.44.0-dev.124",
30
+ "@gem-sdk/adapter-shopify": "1.44.0-dev.136",
31
+ "@gem-sdk/styles": "1.44.0-dev.136",
32
32
  "@types/classnames": "^2.3.1"
33
33
  },
34
34
  "dependencies": {