@brytdesigns/shopify-ajax-cart-components 1.3.0 → 1.3.2
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/dist/esm/index.js +33 -26
- package/dist/esm/index.js.map +1 -1
- package/dist/jsdelivr/components/cart-context.js +22 -0
- package/dist/jsdelivr/components/cart-context.js.map +1 -0
- package/dist/jsdelivr/components/cart-data-array-item.js +19 -0
- package/dist/jsdelivr/components/cart-data-array-item.js.map +1 -0
- package/dist/jsdelivr/components/cart-data-array.js +58 -0
- package/dist/jsdelivr/components/cart-data-array.js.map +1 -0
- package/dist/jsdelivr/components/cart-data-conditions.js +97 -0
- package/dist/jsdelivr/components/cart-data-conditions.js.map +1 -0
- package/dist/jsdelivr/components/cart-data-injection.js +89 -0
- package/dist/jsdelivr/components/cart-data-injection.js.map +1 -0
- package/dist/jsdelivr/components/cart-data-listener-status.js +35 -0
- package/dist/jsdelivr/components/cart-data-listener-status.js.map +1 -0
- package/dist/jsdelivr/components/cart-data-listener.js +163 -0
- package/dist/jsdelivr/components/cart-data-listener.js.map +1 -0
- package/dist/jsdelivr/components/cart-data.js +29 -0
- package/dist/jsdelivr/components/cart-data.js.map +1 -0
- package/dist/jsdelivr/components/cart-loading-state.js +39 -0
- package/dist/jsdelivr/components/cart-loading-state.js.map +1 -0
- package/dist/jsdelivr/components/index.js +11 -0
- package/dist/jsdelivr/components/index.js.map +1 -0
- package/dist/jsdelivr/hooks/index.js +7 -0
- package/dist/jsdelivr/hooks/index.js.map +1 -0
- package/dist/jsdelivr/hooks/useCartValue.js +23 -0
- package/dist/jsdelivr/hooks/useCartValue.js.map +1 -0
- package/dist/{main → jsdelivr}/hooks/useFormattedValue.js +5 -5
- package/dist/jsdelivr/hooks/useFormattedValue.js.map +1 -0
- package/dist/{main → jsdelivr}/hooks/useFullPropertyPath.js +3 -3
- package/dist/jsdelivr/hooks/useFullPropertyPath.js.map +1 -0
- package/dist/jsdelivr/hooks/useHybridCart.js +23 -0
- package/dist/jsdelivr/hooks/useHybridCart.js.map +1 -0
- package/dist/jsdelivr/hooks/useListenerStatus.js +33 -0
- package/dist/jsdelivr/hooks/useListenerStatus.js.map +1 -0
- package/dist/jsdelivr/index.js +72 -0
- package/dist/jsdelivr/index.js.map +1 -0
- package/dist/jsdelivr/utils/formatValue.js +22 -0
- package/dist/jsdelivr/utils/formatValue.js.map +1 -0
- package/dist/jsdelivr/utils/getTargetElement.js +13 -0
- package/dist/jsdelivr/utils/getTargetElement.js.map +1 -0
- package/dist/jsdelivr/utils/getTemplateContent.js +11 -0
- package/dist/jsdelivr/utils/getTemplateContent.js.map +1 -0
- package/dist/jsdelivr/utils/getValueFromPath.js +14 -0
- package/dist/jsdelivr/utils/getValueFromPath.js.map +1 -0
- package/dist/jsdelivr/utils/index.js +7 -0
- package/dist/jsdelivr/utils/index.js.map +1 -0
- package/dist/jsdelivr/utils/parseNestedObject.js +32 -0
- package/dist/jsdelivr/utils/parseNestedObject.js.map +1 -0
- package/dist/main/components/cart-data-array-injection.js +3 -4
- package/dist/main/components/cart-data-array-injection.js.map +1 -1
- package/dist/main/components/cart-data-array.js +2 -3
- package/dist/main/components/cart-data-array.js.map +1 -1
- package/dist/main/components/cart-data-conditions.js +2 -3
- package/dist/main/components/cart-data-conditions.js.map +1 -1
- package/dist/main/components/cart-data-injection.js +1 -3
- package/dist/main/components/cart-data-injection.js.map +1 -1
- package/dist/main/components/cart-data-listener.js +13 -14
- package/dist/main/components/cart-data-listener.js.map +1 -1
- package/dist/main/components/cart-data.js +1 -3
- package/dist/main/components/cart-data.js.map +1 -1
- package/dist/main/hooks/index.js +18 -2
- package/dist/main/hooks/index.js.map +1 -1
- package/dist/main/index.d.ts +1150 -317
- package/package.json +3 -3
- package/dist/main/hooks/useFormattedValue.js.map +0 -1
- package/dist/main/hooks/useFullPropertyPath.js.map +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@brytdesigns/shopify-ajax-cart-components",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.2",
|
|
4
4
|
"description": "Headless web components for the Ajax Cart Library",
|
|
5
5
|
"main": "./dist/main/index.js",
|
|
6
6
|
"types": "./dist/main/index.d.ts",
|
|
@@ -19,8 +19,8 @@
|
|
|
19
19
|
"component-register": "^0.8.7",
|
|
20
20
|
"lodash.debounce": "^4.0.8",
|
|
21
21
|
"solid-js": "^1.9.9",
|
|
22
|
-
"@brytdesigns/shopify-ajax-cart": "1.1.
|
|
23
|
-
"@brytdesigns/web-component-core": "1.1.
|
|
22
|
+
"@brytdesigns/shopify-ajax-cart": "1.1.1",
|
|
23
|
+
"@brytdesigns/web-component-core": "1.1.4"
|
|
24
24
|
},
|
|
25
25
|
"author": "Bryt Designs",
|
|
26
26
|
"license": "ISC",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/hooks/useFormattedValue.ts"],"names":[],"mappings":";;;;;;AAaO,SAAS,kBAAkB,OAAkB,EAAA;AAClD,EAAM,MAAA,KAAA,GAAQ,aAAa,EAAE,IAAA,EAAM,QAAQ,IAAM,EAAA,OAAA,EAAS,OAAQ,CAAA,OAAA,EAAS,CAAA;AAE3E,EAAM,MAAA,cAAA,GAAiB,WAAW,MAAM;AACtC,IAAA,MAAM,IAAI,KAAM,EAAA;AAChB,IAAI,IAAA,CAAA,KAAM,MAAa,OAAA,IAAA;AACvB,IACE,IAAA,OAAO,MAAM,QACb,IAAA,OAAO,MAAM,QACb,IAAA,OAAO,MAAM,SACb,EAAA;AACA,MAAA,OAAO,WAAY,CAAA,OAAA,CAAQ,MAAU,IAAA,EAAA,EAAI,CAAC,CAAA;AAAA;AAE5C,IAAQ,OAAA,CAAA,IAAA;AAAA,MACN,OAAQ,CAAA,OAAA;AAAA,MACR,CAAA,0FAAA,EAA6F,OAAO,CAAC,CAAA,CAAA,CAAA;AAAA,MACrG;AAAA,KACF;AACA,IAAO,OAAA,IAAA;AAAA,GACR,CAAA;AAED,EAAO,OAAA,cAAA;AACT","file":"useFormattedValue.js","sourcesContent":["import { type Accessor, createMemo } from \"solid-js\";\nimport { type ICustomElement } from \"component-register\";\n\nimport { type ValidAjaxPath } from \"./useFullPropertyPath.js\";\nimport { formatValue, type Format } from \"../utils/index.js\";\nimport { useCartValue } from \"./useCartValue.js\";\n\ntype Options = {\n path: Accessor<ValidAjaxPath>;\n format?: Format;\n element: HTMLElement & ICustomElement;\n};\n\nexport function useFormattedValue(options: Options) {\n const value = useCartValue({ path: options.path, element: options.element });\n\n const formattedValue = createMemo(() => {\n const v = value();\n if (v === null) return null;\n if (\n typeof v === \"string\" ||\n typeof v === \"number\" ||\n typeof v === \"boolean\"\n ) {\n return formatValue(options.format || \"\", v);\n }\n console.warn(\n options.element,\n `useFormattedValue: Unsupported value type. Expected string, number, or boolean. Received: ${typeof v}.`,\n v,\n );\n return null;\n });\n\n return formattedValue;\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/hooks/useFullPropertyPath.ts"],"names":[],"mappings":";;;;AA0BA,SAAS,8BACP,OACyB,EAAA;AACzB,EAAA,OAAO,OAAQ,CAAA,IAAA;AACjB;AAEA,MAAM,uBAAA,GAA0B,cAAc,6BAA6B,CAAA;AAEpE,SAAS,8BAA+B,CAAA;AAAA,EAC7C,OAAA;AAAA,EACA;AACF,CAGgC,EAAA;AAC9B,EAAA,OAAO,OAAQ,CAAA,uBAAA,EAAyB,EAAE,IAAA,IAAQ,OAAO,CAAA;AAC3D;AAEO,SAAS,2BACd,OACA,EAAA;AACA,EAAO,OAAA,OAAA;AACT;AAEO,SAAS,oBAAoB,KAGjC,EAAA;AACD,EAAA,MAAM,OAAU,GAAA,OAAA,CAAQ,uBAAyB,EAAA,KAAA,CAAM,OAAO,CAAA;AAC9D,EAAM,MAAA,QAAA,GAAW,2BAA2B,OAAO,CAAA;AACnD,EAAA,OAAO,WAAW,MAAM;AACtB,IAAA,IAAI,OAAO,QAAa,KAAA,UAAA,IAAc,OAAO,KAAA,CAAM,SAAS,UAAY,EAAA;AACtE,MAAA,OAAO,MAAM,IAAK,EAAA;AAAA,eAElB,OAAO,QAAA,KAAa,cACpB,OAAO,KAAA,CAAM,SAAS,UACtB,EAAA;AACA,MAAA,OAAO,QAAS,EAAA;AAAA,eAEhB,OAAO,QAAA,KAAa,cACpB,OAAO,KAAA,CAAM,SAAS,UACtB,EAAA;AACA,MAAA,OAAO,GAAG,QAAS,EAAC,CAAI,CAAA,EAAA,KAAA,CAAM,MAAM,CAAA,CAAA;AAAA;AAEtC,IAAO,OAAA,EAAA;AAAA,GACR,CAAA;AACH","file":"useFullPropertyPath.js","sourcesContent":["import type { Path } from \"../utils\";\n\nimport AjaxCart from \"@brytdesigns/shopify-ajax-cart\";\nimport { createMemo, type Accessor } from \"solid-js\";\nimport {\n createContext,\n consume,\n provide,\n type ICustomElement,\n} from \"component-register\";\n\ntype AjaxCartData = (typeof AjaxCart)[\"data\"];\n\nexport type ValidAjaxPath = Path<AjaxCartData>;\n\ntype WalkableNode = Parameters<typeof provide>[2];\n\ntype FullPropertyPathContextType = ReturnType<\n typeof createFullPathPropertyContext\n>;\n\ntype Options = {\n path: Accessor<ValidAjaxPath>;\n element: HTMLElement & ICustomElement;\n};\n\nfunction createFullPathPropertyContext(\n options: Options,\n): Accessor<ValidAjaxPath> {\n return options.path;\n}\n\nconst FullPropertyPathContext = createContext(createFullPathPropertyContext);\n\nexport function provideFullPropertyPathContext({\n element,\n path,\n}: {\n element: WalkableNode;\n path: Accessor<ValidAjaxPath>;\n}): FullPropertyPathContextType {\n return provide(FullPropertyPathContext, { path }, element);\n}\n\nexport function useFullPropertyPathContext(\n context: FullPropertyPathContextType,\n) {\n return context;\n}\n\nexport function useFullPropertyPath(props: {\n element: HTMLElement & ICustomElement;\n path?: Accessor<ValidAjaxPath>;\n}) {\n const context = consume(FullPropertyPathContext, props.element);\n const basePath = useFullPropertyPathContext(context);\n return createMemo(() => {\n if (typeof basePath !== \"function\" && typeof props.path === \"function\") {\n return props.path();\n } else if (\n typeof basePath === \"function\" &&\n typeof props.path !== \"function\"\n ) {\n return basePath();\n } else if (\n typeof basePath === \"function\" &&\n typeof props.path === \"function\"\n ) {\n return `${basePath()}.${props.path()}` as ValidAjaxPath;\n }\n return \"\" as ValidAjaxPath;\n });\n}\n"]}
|