itmar-block-packages 2.1.2 → 3.0.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/README.md +18 -4
- package/build/cjs/AnimationBlock.js +61 -92
- package/build/cjs/AnimationBlock.js.map +1 -1
- package/build/cjs/BlockEditWrapper.js +3 -10
- package/build/cjs/BlockEditWrapper.js.map +1 -1
- package/build/cjs/BlockPlace.js +277 -482
- package/build/cjs/BlockPlace.js.map +1 -1
- package/build/cjs/BrockInserter.js +195 -191
- package/build/cjs/BrockInserter.js.map +1 -1
- package/build/cjs/DateElm.js +254 -281
- package/build/cjs/DateElm.js.map +1 -1
- package/build/cjs/DraggableBox.js +99 -129
- package/build/cjs/DraggableBox.js.map +1 -1
- package/build/cjs/GridControls.js +292 -392
- package/build/cjs/GridControls.js.map +1 -1
- package/build/cjs/IconSelectControl.js +65 -156
- package/build/cjs/IconSelectControl.js.map +1 -1
- package/build/cjs/JapaneseHolidays.js +67 -76
- package/build/cjs/JapaneseHolidays.js.map +1 -1
- package/build/cjs/MasonryControl.js +95 -100
- package/build/cjs/MasonryControl.js.map +1 -1
- package/build/cjs/PseudoElm.js +37 -50
- package/build/cjs/PseudoElm.js.map +1 -1
- package/build/cjs/ShadowStyle.js +216 -430
- package/build/cjs/ShadowStyle.js.map +1 -1
- package/build/cjs/SwiperControl.js +240 -241
- package/build/cjs/SwiperControl.js.map +1 -1
- package/build/cjs/ToggleElement.js +17 -9
- package/build/cjs/ToggleElement.js.map +1 -1
- package/build/cjs/TypographyControls.js +73 -139
- package/build/cjs/TypographyControls.js.map +1 -1
- package/build/cjs/UpdateAllPostsBlockAttributes.js +102 -119
- package/build/cjs/UpdateAllPostsBlockAttributes.js.map +1 -1
- package/build/cjs/ZipAddress.js +27 -23
- package/build/cjs/ZipAddress.js.map +1 -1
- package/build/cjs/blockStore.js +42 -47
- package/build/cjs/blockStore.js.map +1 -1
- package/build/cjs/cssPropertes.js +165 -117
- package/build/cjs/cssPropertes.js.map +1 -1
- package/build/cjs/customHooks.js +277 -0
- package/build/cjs/customHooks.js.map +1 -0
- package/build/cjs/formatCreate.js +115 -145
- package/build/cjs/formatCreate.js.map +1 -1
- package/build/cjs/hslToRgb.js +112 -116
- package/build/cjs/hslToRgb.js.map +1 -1
- package/build/cjs/index.js +15 -11
- package/build/cjs/index.js.map +1 -1
- package/build/cjs/mediaUpload.js +95 -158
- package/build/cjs/mediaUpload.js.map +1 -1
- package/build/cjs/node_modules/swiper/shared/ssr-window.esm.js +144 -0
- package/build/cjs/node_modules/swiper/shared/ssr-window.esm.js.map +1 -0
- package/build/cjs/node_modules/swiper/shared/swiper-core.js +3925 -0
- package/build/cjs/node_modules/swiper/shared/swiper-core.js.map +1 -0
- package/build/cjs/node_modules/swiper/shared/utils.js +294 -0
- package/build/cjs/node_modules/swiper/shared/utils.js.map +1 -0
- package/build/cjs/pickupStore.js +56 -54
- package/build/cjs/pickupStore.js.map +1 -1
- package/build/cjs/shopfiApi.js +127 -138
- package/build/cjs/shopfiApi.js.map +1 -1
- package/build/cjs/types/AnimationBlock.d.ts +22 -0
- package/build/cjs/types/BlockEditWrapper.d.ts +7 -0
- package/build/cjs/types/BlockPlace.d.ts +49 -0
- package/build/cjs/types/BrockInserter.d.ts +6 -0
- package/build/cjs/types/DateElm.d.ts +69 -0
- package/build/cjs/types/DraggableBox.d.ts +19 -0
- package/build/cjs/types/GridControls.d.ts +27 -0
- package/build/cjs/types/IconSelectControl.d.ts +17 -0
- package/build/cjs/types/JapaneseHolidays.d.ts +6 -0
- package/build/cjs/types/MasonryControl.d.ts +35 -0
- package/build/cjs/types/PseudoElm.d.ts +11 -0
- package/build/cjs/types/ShadowStyle.d.ts +33 -0
- package/build/cjs/types/SwiperControl.d.ts +12 -0
- package/build/cjs/types/ToggleElement.d.ts +13 -0
- package/build/cjs/types/TypographyControls.d.ts +17 -0
- package/build/cjs/types/UpdateAllPostsBlockAttributes.d.ts +10 -0
- package/build/cjs/types/ZipAddress.d.ts +18 -0
- package/build/cjs/types/blockStore.d.ts +15 -0
- package/build/cjs/types/cssPropertes.d.ts +53 -0
- package/build/cjs/types/customHooks.d.ts +11 -0
- package/build/cjs/types/formatCreate.d.ts +18 -0
- package/build/cjs/types/hslToRgb.d.ts +23 -0
- package/build/cjs/types/index.d.ts +31 -0
- package/build/cjs/types/mediaUpload.d.ts +29 -0
- package/build/cjs/types/pickupStore.d.ts +39 -0
- package/build/cjs/types/shopfiApi.d.ts +18 -0
- package/build/cjs/types/validationCheck.d.ts +5 -0
- package/build/cjs/types/wordpressApi.d.ts +99 -0
- package/build/cjs/validationCheck.js +15 -9
- package/build/cjs/validationCheck.js.map +1 -1
- package/build/cjs/wordpressApi.js +364 -576
- package/build/cjs/wordpressApi.js.map +1 -1
- package/build/esm/AnimationBlock.d.ts +22 -0
- package/build/esm/AnimationBlock.js +61 -92
- package/build/esm/AnimationBlock.js.map +1 -1
- package/build/esm/BlockEditWrapper.d.ts +7 -0
- package/build/esm/BlockEditWrapper.js +4 -11
- package/build/esm/BlockEditWrapper.js.map +1 -1
- package/build/esm/BlockPlace.d.ts +49 -0
- package/build/esm/BlockPlace.js +279 -484
- package/build/esm/BlockPlace.js.map +1 -1
- package/build/esm/BrockInserter.d.ts +6 -0
- package/build/esm/BrockInserter.js +195 -191
- package/build/esm/BrockInserter.js.map +1 -1
- package/build/esm/DateElm.d.ts +69 -0
- package/build/esm/DateElm.js +254 -281
- package/build/esm/DateElm.js.map +1 -1
- package/build/esm/DraggableBox.d.ts +19 -0
- package/build/esm/DraggableBox.js +99 -129
- package/build/esm/DraggableBox.js.map +1 -1
- package/build/esm/GridControls.d.ts +27 -0
- package/build/esm/GridControls.js +294 -394
- package/build/esm/GridControls.js.map +1 -1
- package/build/esm/IconSelectControl.d.ts +17 -0
- package/build/esm/IconSelectControl.js +65 -156
- package/build/esm/IconSelectControl.js.map +1 -1
- package/build/esm/JapaneseHolidays.d.ts +6 -0
- package/build/esm/JapaneseHolidays.js +67 -76
- package/build/esm/JapaneseHolidays.js.map +1 -1
- package/build/esm/MasonryControl.d.ts +35 -0
- package/build/esm/MasonryControl.js +95 -100
- package/build/esm/MasonryControl.js.map +1 -1
- package/build/esm/PseudoElm.d.ts +11 -0
- package/build/esm/PseudoElm.js +37 -50
- package/build/esm/PseudoElm.js.map +1 -1
- package/build/esm/ShadowStyle.d.ts +33 -0
- package/build/esm/ShadowStyle.js +217 -431
- package/build/esm/ShadowStyle.js.map +1 -1
- package/build/esm/SwiperControl.d.ts +12 -0
- package/build/esm/SwiperControl.js +240 -241
- package/build/esm/SwiperControl.js.map +1 -1
- package/build/esm/ToggleElement.d.ts +13 -0
- package/build/esm/ToggleElement.js +17 -9
- package/build/esm/ToggleElement.js.map +1 -1
- package/build/esm/TypographyControls.d.ts +17 -0
- package/build/esm/TypographyControls.js +73 -139
- package/build/esm/TypographyControls.js.map +1 -1
- package/build/esm/UpdateAllPostsBlockAttributes.d.ts +10 -0
- package/build/esm/UpdateAllPostsBlockAttributes.js +103 -120
- package/build/esm/UpdateAllPostsBlockAttributes.js.map +1 -1
- package/build/esm/ZipAddress.d.ts +18 -0
- package/build/esm/ZipAddress.js +27 -23
- package/build/esm/ZipAddress.js.map +1 -1
- package/build/esm/blockStore.d.ts +15 -0
- package/build/esm/blockStore.js +42 -47
- package/build/esm/blockStore.js.map +1 -1
- package/build/esm/cssPropertes.d.ts +53 -0
- package/build/esm/cssPropertes.js +165 -117
- package/build/esm/cssPropertes.js.map +1 -1
- package/build/esm/customHooks.d.ts +11 -0
- package/build/esm/customHooks.js +267 -0
- package/build/esm/customHooks.js.map +1 -0
- package/build/esm/formatCreate.d.ts +18 -0
- package/build/esm/formatCreate.js +115 -145
- package/build/esm/formatCreate.js.map +1 -1
- package/build/esm/hslToRgb.d.ts +23 -0
- package/build/esm/hslToRgb.js +112 -116
- package/build/esm/hslToRgb.js.map +1 -1
- package/build/esm/index.d.ts +27 -0
- package/build/esm/index.js +8 -1
- package/build/esm/index.js.map +1 -1
- package/build/esm/mediaUpload.d.ts +29 -0
- package/build/esm/mediaUpload.js +95 -158
- package/build/esm/mediaUpload.js.map +1 -1
- package/build/esm/node_modules/swiper/shared/ssr-window.esm.js +141 -0
- package/build/esm/node_modules/swiper/shared/ssr-window.esm.js.map +1 -0
- package/build/esm/node_modules/swiper/shared/swiper-core.js +3922 -0
- package/build/esm/node_modules/swiper/shared/swiper-core.js.map +1 -0
- package/build/esm/node_modules/swiper/shared/utils.js +274 -0
- package/build/esm/node_modules/swiper/shared/utils.js.map +1 -0
- package/build/esm/pickupStore.d.ts +39 -0
- package/build/esm/pickupStore.js +56 -54
- package/build/esm/pickupStore.js.map +1 -1
- package/build/esm/shopfiApi.d.ts +18 -0
- package/build/esm/shopfiApi.js +127 -138
- package/build/esm/shopfiApi.js.map +1 -1
- package/build/esm/types/AnimationBlock.d.ts +22 -0
- package/build/esm/types/BlockEditWrapper.d.ts +7 -0
- package/build/esm/types/BlockPlace.d.ts +49 -0
- package/build/esm/types/BrockInserter.d.ts +6 -0
- package/build/esm/types/DateElm.d.ts +69 -0
- package/build/esm/types/DraggableBox.d.ts +19 -0
- package/build/esm/types/GridControls.d.ts +27 -0
- package/build/esm/types/IconSelectControl.d.ts +17 -0
- package/build/esm/types/JapaneseHolidays.d.ts +6 -0
- package/build/esm/types/MasonryControl.d.ts +35 -0
- package/build/esm/types/PseudoElm.d.ts +11 -0
- package/build/esm/types/ShadowStyle.d.ts +33 -0
- package/build/esm/types/SwiperControl.d.ts +12 -0
- package/build/esm/types/ToggleElement.d.ts +13 -0
- package/build/esm/types/TypographyControls.d.ts +17 -0
- package/build/esm/types/UpdateAllPostsBlockAttributes.d.ts +10 -0
- package/build/esm/types/ZipAddress.d.ts +18 -0
- package/build/esm/types/blockStore.d.ts +15 -0
- package/build/esm/types/cssPropertes.d.ts +53 -0
- package/build/esm/types/customHooks.d.ts +11 -0
- package/build/esm/types/formatCreate.d.ts +18 -0
- package/build/esm/types/hslToRgb.d.ts +23 -0
- package/build/esm/types/index.d.ts +31 -0
- package/build/esm/types/mediaUpload.d.ts +29 -0
- package/build/esm/types/pickupStore.d.ts +39 -0
- package/build/esm/types/shopfiApi.d.ts +18 -0
- package/build/esm/types/validationCheck.d.ts +5 -0
- package/build/esm/types/wordpressApi.d.ts +99 -0
- package/build/esm/validationCheck.d.ts +5 -0
- package/build/esm/validationCheck.js +15 -9
- package/build/esm/validationCheck.js.map +1 -1
- package/build/esm/wordpressApi.d.ts +99 -0
- package/build/esm/wordpressApi.js +365 -577
- package/build/esm/wordpressApi.js.map +1 -1
- package/package.json +29 -7
- package/build/cjs/_virtual/_rollupPluginBabelHelpers.js +0 -117
- package/build/cjs/_virtual/_rollupPluginBabelHelpers.js.map +0 -1
- package/build/cjs/customFooks.js +0 -300
- package/build/cjs/customFooks.js.map +0 -1
- package/build/esm/_virtual/_rollupPluginBabelHelpers.js +0 -107
- package/build/esm/_virtual/_rollupPluginBabelHelpers.js.map +0 -1
- package/build/esm/customFooks.js +0 -290
- package/build/esm/customFooks.js.map +0 -1
|
@@ -0,0 +1,274 @@
|
|
|
1
|
+
import { a as getWindow } from './ssr-window.esm.js';
|
|
2
|
+
|
|
3
|
+
function classesToTokens(classes = '') {
|
|
4
|
+
return classes.trim().split(' ').filter(c => !!c.trim());
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
function deleteProps(obj) {
|
|
8
|
+
const object = obj;
|
|
9
|
+
Object.keys(object).forEach(key => {
|
|
10
|
+
try {
|
|
11
|
+
object[key] = null;
|
|
12
|
+
} catch (e) {
|
|
13
|
+
// no getter for object
|
|
14
|
+
}
|
|
15
|
+
try {
|
|
16
|
+
delete object[key];
|
|
17
|
+
} catch (e) {
|
|
18
|
+
// something got wrong
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
function nextTick(callback, delay = 0) {
|
|
23
|
+
return setTimeout(callback, delay);
|
|
24
|
+
}
|
|
25
|
+
function now() {
|
|
26
|
+
return Date.now();
|
|
27
|
+
}
|
|
28
|
+
function getComputedStyle(el) {
|
|
29
|
+
const window = getWindow();
|
|
30
|
+
let style;
|
|
31
|
+
if (window.getComputedStyle) {
|
|
32
|
+
style = window.getComputedStyle(el, null);
|
|
33
|
+
}
|
|
34
|
+
if (!style && el.currentStyle) {
|
|
35
|
+
style = el.currentStyle;
|
|
36
|
+
}
|
|
37
|
+
if (!style) {
|
|
38
|
+
style = el.style;
|
|
39
|
+
}
|
|
40
|
+
return style;
|
|
41
|
+
}
|
|
42
|
+
function getTranslate(el, axis = 'x') {
|
|
43
|
+
const window = getWindow();
|
|
44
|
+
let matrix;
|
|
45
|
+
let curTransform;
|
|
46
|
+
let transformMatrix;
|
|
47
|
+
const curStyle = getComputedStyle(el);
|
|
48
|
+
if (window.WebKitCSSMatrix) {
|
|
49
|
+
curTransform = curStyle.transform || curStyle.webkitTransform;
|
|
50
|
+
if (curTransform.split(',').length > 6) {
|
|
51
|
+
curTransform = curTransform.split(', ').map(a => a.replace(',', '.')).join(', ');
|
|
52
|
+
}
|
|
53
|
+
// Some old versions of Webkit choke when 'none' is passed; pass
|
|
54
|
+
// empty string instead in this case
|
|
55
|
+
transformMatrix = new window.WebKitCSSMatrix(curTransform === 'none' ? '' : curTransform);
|
|
56
|
+
} else {
|
|
57
|
+
transformMatrix = curStyle.MozTransform || curStyle.OTransform || curStyle.MsTransform || curStyle.msTransform || curStyle.transform || curStyle.getPropertyValue('transform').replace('translate(', 'matrix(1, 0, 0, 1,');
|
|
58
|
+
matrix = transformMatrix.toString().split(',');
|
|
59
|
+
}
|
|
60
|
+
if (axis === 'x') {
|
|
61
|
+
// Latest Chrome and webkits Fix
|
|
62
|
+
if (window.WebKitCSSMatrix) curTransform = transformMatrix.m41;
|
|
63
|
+
// Crazy IE10 Matrix
|
|
64
|
+
else if (matrix.length === 16) curTransform = parseFloat(matrix[12]);
|
|
65
|
+
// Normal Browsers
|
|
66
|
+
else curTransform = parseFloat(matrix[4]);
|
|
67
|
+
}
|
|
68
|
+
if (axis === 'y') {
|
|
69
|
+
// Latest Chrome and webkits Fix
|
|
70
|
+
if (window.WebKitCSSMatrix) curTransform = transformMatrix.m42;
|
|
71
|
+
// Crazy IE10 Matrix
|
|
72
|
+
else if (matrix.length === 16) curTransform = parseFloat(matrix[13]);
|
|
73
|
+
// Normal Browsers
|
|
74
|
+
else curTransform = parseFloat(matrix[5]);
|
|
75
|
+
}
|
|
76
|
+
return curTransform || 0;
|
|
77
|
+
}
|
|
78
|
+
function isObject(o) {
|
|
79
|
+
return typeof o === 'object' && o !== null && o.constructor && Object.prototype.toString.call(o).slice(8, -1) === 'Object';
|
|
80
|
+
}
|
|
81
|
+
function isNode(node) {
|
|
82
|
+
// eslint-disable-next-line
|
|
83
|
+
if (typeof window !== 'undefined' && typeof window.HTMLElement !== 'undefined') {
|
|
84
|
+
return node instanceof HTMLElement;
|
|
85
|
+
}
|
|
86
|
+
return node && (node.nodeType === 1 || node.nodeType === 11);
|
|
87
|
+
}
|
|
88
|
+
function extend(...args) {
|
|
89
|
+
const to = Object(args[0]);
|
|
90
|
+
for (let i = 1; i < args.length; i += 1) {
|
|
91
|
+
const nextSource = args[i];
|
|
92
|
+
if (nextSource !== undefined && nextSource !== null && !isNode(nextSource)) {
|
|
93
|
+
const keysArray = Object.keys(Object(nextSource)).filter(key => key !== '__proto__' && key !== 'constructor' && key !== 'prototype');
|
|
94
|
+
for (let nextIndex = 0, len = keysArray.length; nextIndex < len; nextIndex += 1) {
|
|
95
|
+
const nextKey = keysArray[nextIndex];
|
|
96
|
+
const desc = Object.getOwnPropertyDescriptor(nextSource, nextKey);
|
|
97
|
+
if (desc !== undefined && desc.enumerable) {
|
|
98
|
+
if (isObject(to[nextKey]) && isObject(nextSource[nextKey])) {
|
|
99
|
+
if (nextSource[nextKey].__swiper__) {
|
|
100
|
+
to[nextKey] = nextSource[nextKey];
|
|
101
|
+
} else {
|
|
102
|
+
extend(to[nextKey], nextSource[nextKey]);
|
|
103
|
+
}
|
|
104
|
+
} else if (!isObject(to[nextKey]) && isObject(nextSource[nextKey])) {
|
|
105
|
+
to[nextKey] = {};
|
|
106
|
+
if (nextSource[nextKey].__swiper__) {
|
|
107
|
+
to[nextKey] = nextSource[nextKey];
|
|
108
|
+
} else {
|
|
109
|
+
extend(to[nextKey], nextSource[nextKey]);
|
|
110
|
+
}
|
|
111
|
+
} else {
|
|
112
|
+
to[nextKey] = nextSource[nextKey];
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
return to;
|
|
119
|
+
}
|
|
120
|
+
function setCSSProperty(el, varName, varValue) {
|
|
121
|
+
el.style.setProperty(varName, varValue);
|
|
122
|
+
}
|
|
123
|
+
function animateCSSModeScroll({
|
|
124
|
+
swiper,
|
|
125
|
+
targetPosition,
|
|
126
|
+
side
|
|
127
|
+
}) {
|
|
128
|
+
const window = getWindow();
|
|
129
|
+
const startPosition = -swiper.translate;
|
|
130
|
+
let startTime = null;
|
|
131
|
+
let time;
|
|
132
|
+
const duration = swiper.params.speed;
|
|
133
|
+
swiper.wrapperEl.style.scrollSnapType = 'none';
|
|
134
|
+
window.cancelAnimationFrame(swiper.cssModeFrameID);
|
|
135
|
+
const dir = targetPosition > startPosition ? 'next' : 'prev';
|
|
136
|
+
const isOutOfBound = (current, target) => {
|
|
137
|
+
return dir === 'next' && current >= target || dir === 'prev' && current <= target;
|
|
138
|
+
};
|
|
139
|
+
const animate = () => {
|
|
140
|
+
time = new Date().getTime();
|
|
141
|
+
if (startTime === null) {
|
|
142
|
+
startTime = time;
|
|
143
|
+
}
|
|
144
|
+
const progress = Math.max(Math.min((time - startTime) / duration, 1), 0);
|
|
145
|
+
const easeProgress = 0.5 - Math.cos(progress * Math.PI) / 2;
|
|
146
|
+
let currentPosition = startPosition + easeProgress * (targetPosition - startPosition);
|
|
147
|
+
if (isOutOfBound(currentPosition, targetPosition)) {
|
|
148
|
+
currentPosition = targetPosition;
|
|
149
|
+
}
|
|
150
|
+
swiper.wrapperEl.scrollTo({
|
|
151
|
+
[side]: currentPosition
|
|
152
|
+
});
|
|
153
|
+
if (isOutOfBound(currentPosition, targetPosition)) {
|
|
154
|
+
swiper.wrapperEl.style.overflow = 'hidden';
|
|
155
|
+
swiper.wrapperEl.style.scrollSnapType = '';
|
|
156
|
+
setTimeout(() => {
|
|
157
|
+
swiper.wrapperEl.style.overflow = '';
|
|
158
|
+
swiper.wrapperEl.scrollTo({
|
|
159
|
+
[side]: currentPosition
|
|
160
|
+
});
|
|
161
|
+
});
|
|
162
|
+
window.cancelAnimationFrame(swiper.cssModeFrameID);
|
|
163
|
+
return;
|
|
164
|
+
}
|
|
165
|
+
swiper.cssModeFrameID = window.requestAnimationFrame(animate);
|
|
166
|
+
};
|
|
167
|
+
animate();
|
|
168
|
+
}
|
|
169
|
+
function elementChildren(element, selector = '') {
|
|
170
|
+
const window = getWindow();
|
|
171
|
+
const children = [...element.children];
|
|
172
|
+
if (window.HTMLSlotElement && element instanceof HTMLSlotElement) {
|
|
173
|
+
children.push(...element.assignedElements());
|
|
174
|
+
}
|
|
175
|
+
if (!selector) {
|
|
176
|
+
return children;
|
|
177
|
+
}
|
|
178
|
+
return children.filter(el => el.matches(selector));
|
|
179
|
+
}
|
|
180
|
+
function elementIsChildOfSlot(el, slot) {
|
|
181
|
+
// Breadth-first search through all parent's children and assigned elements
|
|
182
|
+
const elementsQueue = [slot];
|
|
183
|
+
while (elementsQueue.length > 0) {
|
|
184
|
+
const elementToCheck = elementsQueue.shift();
|
|
185
|
+
if (el === elementToCheck) {
|
|
186
|
+
return true;
|
|
187
|
+
}
|
|
188
|
+
elementsQueue.push(...elementToCheck.children, ...(elementToCheck.shadowRoot ? elementToCheck.shadowRoot.children : []), ...(elementToCheck.assignedElements ? elementToCheck.assignedElements() : []));
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
function elementIsChildOf(el, parent) {
|
|
192
|
+
const window = getWindow();
|
|
193
|
+
let isChild = parent.contains(el);
|
|
194
|
+
if (!isChild && window.HTMLSlotElement && parent instanceof HTMLSlotElement) {
|
|
195
|
+
const children = [...parent.assignedElements()];
|
|
196
|
+
isChild = children.includes(el);
|
|
197
|
+
if (!isChild) {
|
|
198
|
+
isChild = elementIsChildOfSlot(el, parent);
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
return isChild;
|
|
202
|
+
}
|
|
203
|
+
function showWarning(text) {
|
|
204
|
+
try {
|
|
205
|
+
console.warn(text);
|
|
206
|
+
return;
|
|
207
|
+
} catch (err) {
|
|
208
|
+
// err
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
function createElement(tag, classes = []) {
|
|
212
|
+
const el = document.createElement(tag);
|
|
213
|
+
el.classList.add(...(Array.isArray(classes) ? classes : classesToTokens(classes)));
|
|
214
|
+
return el;
|
|
215
|
+
}
|
|
216
|
+
function elementPrevAll(el, selector) {
|
|
217
|
+
const prevEls = [];
|
|
218
|
+
while (el.previousElementSibling) {
|
|
219
|
+
const prev = el.previousElementSibling; // eslint-disable-line
|
|
220
|
+
if (selector) {
|
|
221
|
+
if (prev.matches(selector)) prevEls.push(prev);
|
|
222
|
+
} else prevEls.push(prev);
|
|
223
|
+
el = prev;
|
|
224
|
+
}
|
|
225
|
+
return prevEls;
|
|
226
|
+
}
|
|
227
|
+
function elementNextAll(el, selector) {
|
|
228
|
+
const nextEls = [];
|
|
229
|
+
while (el.nextElementSibling) {
|
|
230
|
+
const next = el.nextElementSibling; // eslint-disable-line
|
|
231
|
+
if (selector) {
|
|
232
|
+
if (next.matches(selector)) nextEls.push(next);
|
|
233
|
+
} else nextEls.push(next);
|
|
234
|
+
el = next;
|
|
235
|
+
}
|
|
236
|
+
return nextEls;
|
|
237
|
+
}
|
|
238
|
+
function elementStyle(el, prop) {
|
|
239
|
+
const window = getWindow();
|
|
240
|
+
return window.getComputedStyle(el, null).getPropertyValue(prop);
|
|
241
|
+
}
|
|
242
|
+
function elementIndex(el) {
|
|
243
|
+
let child = el;
|
|
244
|
+
let i;
|
|
245
|
+
if (child) {
|
|
246
|
+
i = 0;
|
|
247
|
+
// eslint-disable-next-line
|
|
248
|
+
while ((child = child.previousSibling) !== null) {
|
|
249
|
+
if (child.nodeType === 1) i += 1;
|
|
250
|
+
}
|
|
251
|
+
return i;
|
|
252
|
+
}
|
|
253
|
+
return undefined;
|
|
254
|
+
}
|
|
255
|
+
function elementParents(el, selector) {
|
|
256
|
+
const parents = []; // eslint-disable-line
|
|
257
|
+
let parent = el.parentElement; // eslint-disable-line
|
|
258
|
+
while (parent) {
|
|
259
|
+
{
|
|
260
|
+
parents.push(parent);
|
|
261
|
+
}
|
|
262
|
+
parent = parent.parentElement;
|
|
263
|
+
}
|
|
264
|
+
return parents;
|
|
265
|
+
}
|
|
266
|
+
function elementOuterSize(el, size, includeMargins) {
|
|
267
|
+
const window = getWindow();
|
|
268
|
+
{
|
|
269
|
+
return el[size === 'width' ? 'offsetWidth' : 'offsetHeight'] + parseFloat(window.getComputedStyle(el, null).getPropertyValue(size === 'width' ? 'margin-right' : 'margin-top')) + parseFloat(window.getComputedStyle(el, null).getPropertyValue(size === 'width' ? 'margin-left' : 'margin-bottom'));
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
export { setCSSProperty as b, createElement as c, elementParents as d, elementChildren as e, now as h, elementOuterSize as i, elementIndex as j, classesToTokens as k, getTranslate as l, nextTick as n, isObject as p, elementStyle as q, elementNextAll as r, elementPrevAll as t, animateCSSModeScroll as u, showWarning as v, elementIsChildOf as w, extend as x, deleteProps as y };
|
|
274
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sources":["../../../../../node_modules/swiper/shared/utils.mjs"],"sourcesContent":["import { a as getWindow, g as getDocument } from './ssr-window.esm.mjs';\n\nfunction classesToTokens(classes = '') {\n return classes.trim().split(' ').filter(c => !!c.trim());\n}\n\nfunction deleteProps(obj) {\n const object = obj;\n Object.keys(object).forEach(key => {\n try {\n object[key] = null;\n } catch (e) {\n // no getter for object\n }\n try {\n delete object[key];\n } catch (e) {\n // something got wrong\n }\n });\n}\nfunction nextTick(callback, delay = 0) {\n return setTimeout(callback, delay);\n}\nfunction now() {\n return Date.now();\n}\nfunction getComputedStyle(el) {\n const window = getWindow();\n let style;\n if (window.getComputedStyle) {\n style = window.getComputedStyle(el, null);\n }\n if (!style && el.currentStyle) {\n style = el.currentStyle;\n }\n if (!style) {\n style = el.style;\n }\n return style;\n}\nfunction getTranslate(el, axis = 'x') {\n const window = getWindow();\n let matrix;\n let curTransform;\n let transformMatrix;\n const curStyle = getComputedStyle(el);\n if (window.WebKitCSSMatrix) {\n curTransform = curStyle.transform || curStyle.webkitTransform;\n if (curTransform.split(',').length > 6) {\n curTransform = curTransform.split(', ').map(a => a.replace(',', '.')).join(', ');\n }\n // Some old versions of Webkit choke when 'none' is passed; pass\n // empty string instead in this case\n transformMatrix = new window.WebKitCSSMatrix(curTransform === 'none' ? '' : curTransform);\n } else {\n transformMatrix = curStyle.MozTransform || curStyle.OTransform || curStyle.MsTransform || curStyle.msTransform || curStyle.transform || curStyle.getPropertyValue('transform').replace('translate(', 'matrix(1, 0, 0, 1,');\n matrix = transformMatrix.toString().split(',');\n }\n if (axis === 'x') {\n // Latest Chrome and webkits Fix\n if (window.WebKitCSSMatrix) curTransform = transformMatrix.m41;\n // Crazy IE10 Matrix\n else if (matrix.length === 16) curTransform = parseFloat(matrix[12]);\n // Normal Browsers\n else curTransform = parseFloat(matrix[4]);\n }\n if (axis === 'y') {\n // Latest Chrome and webkits Fix\n if (window.WebKitCSSMatrix) curTransform = transformMatrix.m42;\n // Crazy IE10 Matrix\n else if (matrix.length === 16) curTransform = parseFloat(matrix[13]);\n // Normal Browsers\n else curTransform = parseFloat(matrix[5]);\n }\n return curTransform || 0;\n}\nfunction isObject(o) {\n return typeof o === 'object' && o !== null && o.constructor && Object.prototype.toString.call(o).slice(8, -1) === 'Object';\n}\nfunction isNode(node) {\n // eslint-disable-next-line\n if (typeof window !== 'undefined' && typeof window.HTMLElement !== 'undefined') {\n return node instanceof HTMLElement;\n }\n return node && (node.nodeType === 1 || node.nodeType === 11);\n}\nfunction extend(...args) {\n const to = Object(args[0]);\n for (let i = 1; i < args.length; i += 1) {\n const nextSource = args[i];\n if (nextSource !== undefined && nextSource !== null && !isNode(nextSource)) {\n const keysArray = Object.keys(Object(nextSource)).filter(key => key !== '__proto__' && key !== 'constructor' && key !== 'prototype');\n for (let nextIndex = 0, len = keysArray.length; nextIndex < len; nextIndex += 1) {\n const nextKey = keysArray[nextIndex];\n const desc = Object.getOwnPropertyDescriptor(nextSource, nextKey);\n if (desc !== undefined && desc.enumerable) {\n if (isObject(to[nextKey]) && isObject(nextSource[nextKey])) {\n if (nextSource[nextKey].__swiper__) {\n to[nextKey] = nextSource[nextKey];\n } else {\n extend(to[nextKey], nextSource[nextKey]);\n }\n } else if (!isObject(to[nextKey]) && isObject(nextSource[nextKey])) {\n to[nextKey] = {};\n if (nextSource[nextKey].__swiper__) {\n to[nextKey] = nextSource[nextKey];\n } else {\n extend(to[nextKey], nextSource[nextKey]);\n }\n } else {\n to[nextKey] = nextSource[nextKey];\n }\n }\n }\n }\n }\n return to;\n}\nfunction setCSSProperty(el, varName, varValue) {\n el.style.setProperty(varName, varValue);\n}\nfunction animateCSSModeScroll({\n swiper,\n targetPosition,\n side\n}) {\n const window = getWindow();\n const startPosition = -swiper.translate;\n let startTime = null;\n let time;\n const duration = swiper.params.speed;\n swiper.wrapperEl.style.scrollSnapType = 'none';\n window.cancelAnimationFrame(swiper.cssModeFrameID);\n const dir = targetPosition > startPosition ? 'next' : 'prev';\n const isOutOfBound = (current, target) => {\n return dir === 'next' && current >= target || dir === 'prev' && current <= target;\n };\n const animate = () => {\n time = new Date().getTime();\n if (startTime === null) {\n startTime = time;\n }\n const progress = Math.max(Math.min((time - startTime) / duration, 1), 0);\n const easeProgress = 0.5 - Math.cos(progress * Math.PI) / 2;\n let currentPosition = startPosition + easeProgress * (targetPosition - startPosition);\n if (isOutOfBound(currentPosition, targetPosition)) {\n currentPosition = targetPosition;\n }\n swiper.wrapperEl.scrollTo({\n [side]: currentPosition\n });\n if (isOutOfBound(currentPosition, targetPosition)) {\n swiper.wrapperEl.style.overflow = 'hidden';\n swiper.wrapperEl.style.scrollSnapType = '';\n setTimeout(() => {\n swiper.wrapperEl.style.overflow = '';\n swiper.wrapperEl.scrollTo({\n [side]: currentPosition\n });\n });\n window.cancelAnimationFrame(swiper.cssModeFrameID);\n return;\n }\n swiper.cssModeFrameID = window.requestAnimationFrame(animate);\n };\n animate();\n}\nfunction getSlideTransformEl(slideEl) {\n return slideEl.querySelector('.swiper-slide-transform') || slideEl.shadowRoot && slideEl.shadowRoot.querySelector('.swiper-slide-transform') || slideEl;\n}\nfunction elementChildren(element, selector = '') {\n const window = getWindow();\n const children = [...element.children];\n if (window.HTMLSlotElement && element instanceof HTMLSlotElement) {\n children.push(...element.assignedElements());\n }\n if (!selector) {\n return children;\n }\n return children.filter(el => el.matches(selector));\n}\nfunction elementIsChildOfSlot(el, slot) {\n // Breadth-first search through all parent's children and assigned elements\n const elementsQueue = [slot];\n while (elementsQueue.length > 0) {\n const elementToCheck = elementsQueue.shift();\n if (el === elementToCheck) {\n return true;\n }\n elementsQueue.push(...elementToCheck.children, ...(elementToCheck.shadowRoot ? elementToCheck.shadowRoot.children : []), ...(elementToCheck.assignedElements ? elementToCheck.assignedElements() : []));\n }\n}\nfunction elementIsChildOf(el, parent) {\n const window = getWindow();\n let isChild = parent.contains(el);\n if (!isChild && window.HTMLSlotElement && parent instanceof HTMLSlotElement) {\n const children = [...parent.assignedElements()];\n isChild = children.includes(el);\n if (!isChild) {\n isChild = elementIsChildOfSlot(el, parent);\n }\n }\n return isChild;\n}\nfunction showWarning(text) {\n try {\n console.warn(text);\n return;\n } catch (err) {\n // err\n }\n}\nfunction createElement(tag, classes = []) {\n const el = document.createElement(tag);\n el.classList.add(...(Array.isArray(classes) ? classes : classesToTokens(classes)));\n return el;\n}\nfunction elementOffset(el) {\n const window = getWindow();\n const document = getDocument();\n const box = el.getBoundingClientRect();\n const body = document.body;\n const clientTop = el.clientTop || body.clientTop || 0;\n const clientLeft = el.clientLeft || body.clientLeft || 0;\n const scrollTop = el === window ? window.scrollY : el.scrollTop;\n const scrollLeft = el === window ? window.scrollX : el.scrollLeft;\n return {\n top: box.top + scrollTop - clientTop,\n left: box.left + scrollLeft - clientLeft\n };\n}\nfunction elementPrevAll(el, selector) {\n const prevEls = [];\n while (el.previousElementSibling) {\n const prev = el.previousElementSibling; // eslint-disable-line\n if (selector) {\n if (prev.matches(selector)) prevEls.push(prev);\n } else prevEls.push(prev);\n el = prev;\n }\n return prevEls;\n}\nfunction elementNextAll(el, selector) {\n const nextEls = [];\n while (el.nextElementSibling) {\n const next = el.nextElementSibling; // eslint-disable-line\n if (selector) {\n if (next.matches(selector)) nextEls.push(next);\n } else nextEls.push(next);\n el = next;\n }\n return nextEls;\n}\nfunction elementStyle(el, prop) {\n const window = getWindow();\n return window.getComputedStyle(el, null).getPropertyValue(prop);\n}\nfunction elementIndex(el) {\n let child = el;\n let i;\n if (child) {\n i = 0;\n // eslint-disable-next-line\n while ((child = child.previousSibling) !== null) {\n if (child.nodeType === 1) i += 1;\n }\n return i;\n }\n return undefined;\n}\nfunction elementParents(el, selector) {\n const parents = []; // eslint-disable-line\n let parent = el.parentElement; // eslint-disable-line\n while (parent) {\n if (selector) {\n if (parent.matches(selector)) parents.push(parent);\n } else {\n parents.push(parent);\n }\n parent = parent.parentElement;\n }\n return parents;\n}\nfunction elementTransitionEnd(el, callback) {\n function fireCallBack(e) {\n if (e.target !== el) return;\n callback.call(el, e);\n el.removeEventListener('transitionend', fireCallBack);\n }\n if (callback) {\n el.addEventListener('transitionend', fireCallBack);\n }\n}\nfunction elementOuterSize(el, size, includeMargins) {\n const window = getWindow();\n if (includeMargins) {\n return el[size === 'width' ? 'offsetWidth' : 'offsetHeight'] + parseFloat(window.getComputedStyle(el, null).getPropertyValue(size === 'width' ? 'margin-right' : 'margin-top')) + parseFloat(window.getComputedStyle(el, null).getPropertyValue(size === 'width' ? 'margin-left' : 'margin-bottom'));\n }\n return el.offsetWidth;\n}\nfunction makeElementsArray(el) {\n return (Array.isArray(el) ? el : [el]).filter(e => !!e);\n}\nfunction getRotateFix(swiper) {\n return v => {\n if (Math.abs(v) > 0 && swiper.browser && swiper.browser.need3dFix && Math.abs(v) % 90 === 0) {\n return v + 0.001;\n }\n return v;\n };\n}\nfunction setInnerHTML(el, html = '') {\n if (typeof trustedTypes !== 'undefined') {\n el.innerHTML = trustedTypes.createPolicy('html', {\n createHTML: s => s\n }).createHTML(html);\n } else {\n el.innerHTML = html;\n }\n}\n\nexport { getRotateFix as a, setCSSProperty as b, createElement as c, elementParents as d, elementChildren as e, elementOffset as f, getSlideTransformEl as g, now as h, elementOuterSize as i, elementIndex as j, classesToTokens as k, getTranslate as l, makeElementsArray as m, nextTick as n, elementTransitionEnd as o, isObject as p, elementStyle as q, elementNextAll as r, setInnerHTML as s, elementPrevAll as t, animateCSSModeScroll as u, showWarning as v, elementIsChildOf as w, extend as x, deleteProps as y };\n"],"names":[],"mappings":";;AAEA,SAAS,eAAe,CAAC,OAAO,GAAG,EAAE,EAAE;AACvC,EAAE,OAAO,OAAO,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;AAC1D;;AAEA,SAAS,WAAW,CAAC,GAAG,EAAE;AAC1B,EAAE,MAAM,MAAM,GAAG,GAAG;AACpB,EAAE,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,GAAG,IAAI;AACrC,IAAI,IAAI;AACR,MAAM,MAAM,CAAC,GAAG,CAAC,GAAG,IAAI;AACxB,IAAI,CAAC,CAAC,OAAO,CAAC,EAAE;AAChB;AACA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,EAAE,cAAc,EAAE;AACpD,EAAE,MAAM,MAAM,GAAG,SAAS,EAAE;AAC5B,EAAsB;AACtB,IAAI,OAAO,EAAE,CAAC,IAAI,KAAK,OAAO,GAAG,aAAa,GAAG,cAAc,CAAC,GAAG,UAAU,CAAC,MAAM,CAAC,gBAAgB,CAAC,EAAE,EAAE,IAAI,CAAC,CAAC,gBAAgB,CAAC,IAAI,KAAK,OAAO,GAAG,cAAc,GAAG,YAAY,CAAC,CAAC,GAAG,UAAU,CAAC,MAAM,CAAC,gBAAgB,CAAC,EAAE,EAAE,IAAI,CAAC,CAAC,gBAAgB,CAAC,IAAI,KAAK,OAAO,GAAG,aAAa,GAAG,eAAe,CAAC,CAAC;AACxS,EAAE;AAEF;;;;","x_google_ignoreList":[0]}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
declare const GLOBAL_KEY = "__itmar_pickup_store__";
|
|
2
|
+
interface PickupState {
|
|
3
|
+
page: number;
|
|
4
|
+
searchKeyWord: string;
|
|
5
|
+
periodDisp: string;
|
|
6
|
+
periodQueryObj: Record<string, any>;
|
|
7
|
+
termParamObj: Record<string, any> | null;
|
|
8
|
+
termQueryObj: any[];
|
|
9
|
+
posts: any[];
|
|
10
|
+
rawPosts: any[] | null;
|
|
11
|
+
targetIndex: number;
|
|
12
|
+
total: number;
|
|
13
|
+
}
|
|
14
|
+
interface PickupContext {
|
|
15
|
+
id: string;
|
|
16
|
+
pickupEl: HTMLElement | null;
|
|
17
|
+
dataset: Record<string, string | undefined>;
|
|
18
|
+
state: PickupState;
|
|
19
|
+
listeners: Set<(ctx: PickupContext) => void>;
|
|
20
|
+
cache: {
|
|
21
|
+
taxonomies: any | null;
|
|
22
|
+
};
|
|
23
|
+
inflight: {
|
|
24
|
+
abort: AbortController | null;
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
declare global {
|
|
28
|
+
interface Window {
|
|
29
|
+
[GLOBAL_KEY]: {
|
|
30
|
+
contexts: Map<string, PickupContext>;
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
export declare function ensureCtx(id: string | undefined): PickupContext | null;
|
|
35
|
+
export declare function registerPickup(pickupEl: HTMLElement | null): PickupContext | null;
|
|
36
|
+
export declare function getCtx(id: string): PickupContext | null;
|
|
37
|
+
export declare function subscribe(id: string, fn: (ctx: PickupContext) => void): () => void;
|
|
38
|
+
export declare function setState(id: string, partial: Partial<PickupState>): void;
|
|
39
|
+
export {};
|
package/build/esm/pickupStore.js
CHANGED
|
@@ -1,70 +1,72 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var GLOBAL_KEY = "__itmar_pickup_store__";
|
|
1
|
+
const GLOBAL_KEY = "__itmar_pickup_store__";
|
|
4
2
|
function getGlobalStore() {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
}
|
|
10
|
-
return window[GLOBAL_KEY];
|
|
3
|
+
if (!window[GLOBAL_KEY]) {
|
|
4
|
+
window[GLOBAL_KEY] = { contexts: new Map() };
|
|
5
|
+
}
|
|
6
|
+
return window[GLOBAL_KEY];
|
|
11
7
|
}
|
|
12
|
-
|
|
8
|
+
const contexts = getGlobalStore().contexts;
|
|
13
9
|
function createCtx(id) {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
10
|
+
return {
|
|
11
|
+
id,
|
|
12
|
+
pickupEl: null,
|
|
13
|
+
dataset: {},
|
|
14
|
+
state: {
|
|
15
|
+
page: 0,
|
|
16
|
+
searchKeyWord: "",
|
|
17
|
+
periodDisp: "",
|
|
18
|
+
periodQueryObj: {},
|
|
19
|
+
termParamObj: null,
|
|
20
|
+
termQueryObj: [],
|
|
21
|
+
posts: [],
|
|
22
|
+
rawPosts: null,
|
|
23
|
+
targetIndex: -1,
|
|
24
|
+
total: 0,
|
|
25
|
+
},
|
|
26
|
+
listeners: new Set(),
|
|
27
|
+
cache: {
|
|
28
|
+
taxonomies: null,
|
|
29
|
+
},
|
|
30
|
+
inflight: {
|
|
31
|
+
abort: null,
|
|
32
|
+
},
|
|
33
|
+
};
|
|
38
34
|
}
|
|
39
35
|
function ensureCtx(id) {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
36
|
+
if (!id)
|
|
37
|
+
return null;
|
|
38
|
+
if (!contexts.has(id))
|
|
39
|
+
contexts.set(id, createCtx(id));
|
|
40
|
+
return contexts.get(id) || null;
|
|
43
41
|
}
|
|
44
42
|
function registerPickup(pickupEl) {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
43
|
+
const id = pickupEl?.dataset?.pickup_id;
|
|
44
|
+
if (!id)
|
|
45
|
+
return null;
|
|
46
|
+
const ctx = ensureCtx(id);
|
|
47
|
+
if (!ctx)
|
|
48
|
+
return null;
|
|
49
|
+
ctx.pickupEl = pickupEl;
|
|
50
|
+
ctx.dataset = { ...pickupEl.dataset };
|
|
51
|
+
return ctx;
|
|
52
52
|
}
|
|
53
53
|
function getCtx(id) {
|
|
54
|
-
|
|
54
|
+
return contexts.get(id) || null;
|
|
55
55
|
}
|
|
56
56
|
function subscribe(id, fn) {
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
57
|
+
const ctx = ensureCtx(id);
|
|
58
|
+
if (!ctx)
|
|
59
|
+
return () => { };
|
|
60
|
+
ctx.listeners.add(fn);
|
|
61
|
+
fn(ctx); // 初回通知
|
|
62
|
+
return () => ctx.listeners.delete(fn);
|
|
62
63
|
}
|
|
63
64
|
function setState(id, partial) {
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
65
|
+
const ctx = ensureCtx(id);
|
|
66
|
+
if (!ctx)
|
|
67
|
+
return;
|
|
68
|
+
ctx.state = { ...ctx.state, ...partial };
|
|
69
|
+
ctx.listeners.forEach((l) => l(ctx));
|
|
68
70
|
}
|
|
69
71
|
|
|
70
72
|
export { ensureCtx, getCtx, registerPickup, setState, subscribe };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pickupStore.js","sources":["../../src/pickupStore.
|
|
1
|
+
{"version":3,"file":"pickupStore.js","sources":["../../src/pickupStore.ts"],"sourcesContent":[null],"names":[],"mappings":"AAAA,MAAM,UAAU,GAAG,wBAAwB;AAuC3C,SAAS,cAAc,GAAA;AACrB,IAAA,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,EAAE;QACvB,MAAM,CAAC,UAAU,CAAC,GAAG,EAAE,QAAQ,EAAE,IAAI,GAAG,EAAE,EAAE;IAC9C;AACA,IAAA,OAAO,MAAM,CAAC,UAAU,CAAC;AAC3B;AAEA,MAAM,QAAQ,GAAG,cAAc,EAAE,CAAC,QAAQ;AAE1C,SAAS,SAAS,CAAC,EAAU,EAAA;IAC3B,OAAO;QACL,EAAE;AACF,QAAA,QAAQ,EAAE,IAAI;AACd,QAAA,OAAO,EAAE,EAAE;AACX,QAAA,KAAK,EAAE;AACL,YAAA,IAAI,EAAE,CAAC;AACP,YAAA,aAAa,EAAE,EAAE;AACjB,YAAA,UAAU,EAAE,EAAE;AACd,YAAA,cAAc,EAAE,EAAE;AAClB,YAAA,YAAY,EAAE,IAAI;AAClB,YAAA,YAAY,EAAE,EAAE;AAChB,YAAA,KAAK,EAAE,EAAE;AACT,YAAA,QAAQ,EAAE,IAAI;YACd,WAAW,EAAE,EAAE;AACf,YAAA,KAAK,EAAE,CAAC;AACT,SAAA;QACD,SAAS,EAAE,IAAI,GAAG,EAAE;AACpB,QA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CAAC,SAAS,CAAC,MAAM,CAAC,EAAE,CAAC;AACvC;AAEM,SAAU,QAAQ,CAAC,EAAU,EAAE,OAA6B,EAAA;AAChE,IAAA,MAAM,GAAG,GAAG,SAAS,CAAC,EAAE,CAAC;AACzB,IAAA,IAAI,CAAC,GAAG;QAAE;AACV,IAAA,GAAG,CAAC,KAAK,GAAG,EAAE,GAAG,GAAG,CAAC,KAAK,EAAE,GAAG,OAAO,EAAE;AACxC,IAAA,GAAG,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC;AACtC;;;;"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export declare function redirectCustomerAuthorize(shopId: string, clientId: string, userMail: string, callbackUri: string, // Shopify側の管理画面で登録したリダイレクト先
|
|
2
|
+
redirectUri: string): Promise<void>;
|
|
3
|
+
/**
|
|
4
|
+
* Shopifyの顧客トークンを検証し、ログイン状態を確認する
|
|
5
|
+
*/
|
|
6
|
+
export declare function checkCustomerLoginState(): Promise<boolean | void>;
|
|
7
|
+
/**
|
|
8
|
+
* 通信モードの定義
|
|
9
|
+
* auto: URLから自動判別
|
|
10
|
+
* rest: WP REST API形式 (application/json)
|
|
11
|
+
* admin: admin-ajax.php形式 (x-www-form-urlencoded)
|
|
12
|
+
*/
|
|
13
|
+
type ApiMode = "auto" | "rest" | "admin";
|
|
14
|
+
/**
|
|
15
|
+
* 統合された WordPress 通信関数
|
|
16
|
+
*/
|
|
17
|
+
export declare function sendRegistrationRequest<T = any>(urlOrPath: string, data?: Record<string, any>, mode?: ApiMode): Promise<T>;
|
|
18
|
+
export {};
|