@plaidev/karte-action-sdk 1.1.270-29419384.246a50882 → 1.1.270-29420750.2ec690591
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/components-flex/css.d.ts +2 -2
- package/dist/components-flex/props.d.ts +2 -2
- package/dist/components-flex/responsiveProp.d.ts +7 -0
- package/dist/hydrate/components-flex/css.d.ts +2 -2
- package/dist/hydrate/components-flex/props.d.ts +2 -2
- package/dist/hydrate/components-flex/responsiveProp.d.ts +7 -0
- package/dist/hydrate/index.d.ts +1 -0
- package/dist/hydrate/index.es.js +168 -102
- package/dist/hydrate/index.svelte5.d.ts +2 -1
- package/dist/hydrate/preview.d.ts +28 -0
- package/dist/hydrate/stores.d.ts +22 -1
- package/dist/hydrate/types.d.ts +13 -0
- package/dist/hydrate/utils.d.ts +1 -0
- package/dist/index.es.d.ts +1 -0
- package/dist/index.es.js +168 -102
- package/dist/preview.d.ts +28 -0
- package/dist/stores.d.ts +22 -1
- package/dist/svelte5/components-flex/css.d.ts +2 -2
- package/dist/svelte5/components-flex/props.d.ts +2 -2
- package/dist/svelte5/components-flex/responsiveProp.d.ts +7 -0
- package/dist/svelte5/hydrate/components-flex/css.d.ts +2 -2
- package/dist/svelte5/hydrate/components-flex/props.d.ts +2 -2
- package/dist/svelte5/hydrate/components-flex/responsiveProp.d.ts +7 -0
- package/dist/svelte5/hydrate/index.es.d.ts +2 -1
- package/dist/svelte5/hydrate/index.es.js +157 -94
- package/dist/svelte5/hydrate/preview.d.ts +28 -0
- package/dist/svelte5/hydrate/stores.d.ts +22 -1
- package/dist/svelte5/hydrate/types.d.ts +13 -0
- package/dist/svelte5/hydrate/utils.d.ts +1 -0
- package/dist/svelte5/index.es.d.ts +2 -1
- package/dist/svelte5/index.es.js +157 -94
- package/dist/svelte5/index.front2.es.js +157 -94
- package/dist/svelte5/index.svelte5.d.ts +2 -1
- package/dist/svelte5/preview.d.ts +28 -0
- package/dist/svelte5/stores.d.ts +22 -1
- package/dist/svelte5/types.d.ts +13 -0
- package/dist/svelte5/utils.d.ts +1 -0
- package/dist/templates.cjs.js +3 -2
- package/dist/templates.js +3 -2
- package/dist/types.d.ts +13 -0
- package/dist/utils.d.ts +1 -0
- package/package.json +1 -1
- package/dist/components-flex/responsive.d.ts +0 -26
- package/dist/hydrate/components-flex/responsive.d.ts +0 -26
- package/dist/svelte5/components-flex/responsive.d.ts +0 -26
- package/dist/svelte5/hydrate/components-flex/responsive.d.ts +0 -26
|
@@ -58,6 +58,9 @@ const NOOP = (_args) => {};
|
|
|
58
58
|
/** @internal */
|
|
59
59
|
const isPreview = () => isInFrame();
|
|
60
60
|
const isCanvasPreview = () => typeof document !== "undefined" ? (document?.querySelector("#preview")?.getAttribute("data-canvas-preview") ?? "false") === "true" : false;
|
|
61
|
+
const getPreviewId = () => {
|
|
62
|
+
return typeof document !== "undefined" ? document.documentElement.getAttribute("data-krt-preview-id") ?? "" : "";
|
|
63
|
+
};
|
|
61
64
|
const isOnSite = () => typeof document !== "undefined" ? (document?.querySelector("#preview")?.getAttribute("data-on-site") ?? "true") === "true" : true;
|
|
62
65
|
const isInFrame = () => window && window.self !== window.top;
|
|
63
66
|
/** @internal */
|
|
@@ -1147,6 +1150,33 @@ function setDestroyed(on$1) {
|
|
|
1147
1150
|
*
|
|
1148
1151
|
* @internal
|
|
1149
1152
|
*/
|
|
1153
|
+
const breakpoints = writable([]);
|
|
1154
|
+
/**
|
|
1155
|
+
* ブレイクポイントの一覧を取得する
|
|
1156
|
+
*
|
|
1157
|
+
* @returns 現在のブレイクポイントの一覧
|
|
1158
|
+
*/
|
|
1159
|
+
function getBreakpoints() {
|
|
1160
|
+
return get(breakpoints);
|
|
1161
|
+
}
|
|
1162
|
+
/**
|
|
1163
|
+
* 変数を設定する
|
|
1164
|
+
*
|
|
1165
|
+
* @remarks
|
|
1166
|
+
* 設定したブレイクポイントは、ビジュアルエディタでブレイクポイントとして利用できます。
|
|
1167
|
+
*
|
|
1168
|
+
* @param values - ブレイクポイントの一覧
|
|
1169
|
+
*/
|
|
1170
|
+
function setBreakpoints(values) {
|
|
1171
|
+
if (!get(breakpoints)) breakpoints.set([]);
|
|
1172
|
+
breakpoints.update(() => values);
|
|
1173
|
+
return getBreakpoints();
|
|
1174
|
+
}
|
|
1175
|
+
/**
|
|
1176
|
+
* Store to handle variables
|
|
1177
|
+
*
|
|
1178
|
+
* @internal
|
|
1179
|
+
*/
|
|
1150
1180
|
const variables = writable({});
|
|
1151
1181
|
/**
|
|
1152
1182
|
* 変数の一覧を取得する
|
|
@@ -2363,6 +2393,93 @@ async function loadGlobalStyle(href) {
|
|
|
2363
2393
|
});
|
|
2364
2394
|
}
|
|
2365
2395
|
|
|
2396
|
+
//#endregion
|
|
2397
|
+
//#region src/preview.ts
|
|
2398
|
+
/** @internal */
|
|
2399
|
+
const initPreview = () => {
|
|
2400
|
+
if (!isPreview()) return () => {};
|
|
2401
|
+
let root$56;
|
|
2402
|
+
let timer = null;
|
|
2403
|
+
const previewId = getPreviewId();
|
|
2404
|
+
const LAYER_ID_ATTR_KEY = "data-layer-id";
|
|
2405
|
+
const toInfo = (element) => {
|
|
2406
|
+
if (!element) return null;
|
|
2407
|
+
const rect = element.getBoundingClientRect();
|
|
2408
|
+
const styles = window.getComputedStyle(element);
|
|
2409
|
+
return {
|
|
2410
|
+
layerId: element.getAttribute(LAYER_ID_ATTR_KEY),
|
|
2411
|
+
top: rect.top,
|
|
2412
|
+
left: rect.left,
|
|
2413
|
+
width: rect.width,
|
|
2414
|
+
height: rect.height,
|
|
2415
|
+
direction: styles?.flexDirection === "row" || styles?.flexDirection === "row-reverse" ? "row" : "column",
|
|
2416
|
+
classNames: Array.from(element.classList.values()),
|
|
2417
|
+
styles: {
|
|
2418
|
+
direction: styles.flexDirection,
|
|
2419
|
+
opacity: styles.opacity,
|
|
2420
|
+
rowGap: styles.rowGap,
|
|
2421
|
+
columnGap: styles.columnGap,
|
|
2422
|
+
paddingLeft: styles.paddingLeft,
|
|
2423
|
+
paddingRight: styles.paddingRight,
|
|
2424
|
+
paddingTop: styles.paddingTop,
|
|
2425
|
+
paddingBottom: styles.paddingBottom,
|
|
2426
|
+
zIndex: styles.zIndex,
|
|
2427
|
+
position: styles.position,
|
|
2428
|
+
top: styles.top,
|
|
2429
|
+
left: styles.left,
|
|
2430
|
+
right: styles.right,
|
|
2431
|
+
bottom: styles.bottom
|
|
2432
|
+
}
|
|
2433
|
+
};
|
|
2434
|
+
};
|
|
2435
|
+
const w$1 = (w$2) => w$2.parent === w$2 ? w$2 : w$2.parent;
|
|
2436
|
+
const postUpdateLayers = () => {
|
|
2437
|
+
const layerElements = Array.from(root$56.querySelectorAll(`[${LAYER_ID_ATTR_KEY}]`)).map((el) => toInfo(el));
|
|
2438
|
+
if (layerElements.length === 0) return;
|
|
2439
|
+
w$1(window).postMessage({
|
|
2440
|
+
type: "KARTE-ACTION-PREVIEW-UPDATE-LAYERS",
|
|
2441
|
+
detail: {
|
|
2442
|
+
previewId,
|
|
2443
|
+
layerElements
|
|
2444
|
+
}
|
|
2445
|
+
}, "*");
|
|
2446
|
+
};
|
|
2447
|
+
const rootObserver = new MutationObserver(postUpdateLayers);
|
|
2448
|
+
const handleMessage = (e) => {
|
|
2449
|
+
console.log("message", e);
|
|
2450
|
+
const data = e.data;
|
|
2451
|
+
if (data.event_name === "OVERRIDE_LAYER_STYLE") {
|
|
2452
|
+
const { layerId = "", styles = [] } = data.detail || {};
|
|
2453
|
+
const layerElement = root$56.querySelector(`[${LAYER_ID_ATTR_KEY}="${layerId}"]`);
|
|
2454
|
+
if (!layerElement) return;
|
|
2455
|
+
styles.forEach(({ key, value }) => {
|
|
2456
|
+
layerElement.style.setProperty(key, value);
|
|
2457
|
+
});
|
|
2458
|
+
}
|
|
2459
|
+
};
|
|
2460
|
+
(() => {
|
|
2461
|
+
const init = () => {
|
|
2462
|
+
root$56 = getActionRoot();
|
|
2463
|
+
if (root$56) {
|
|
2464
|
+
rootObserver.observe(root$56, {
|
|
2465
|
+
childList: true,
|
|
2466
|
+
subtree: true,
|
|
2467
|
+
characterData: true,
|
|
2468
|
+
attributes: true
|
|
2469
|
+
});
|
|
2470
|
+
timer = setInterval(postUpdateLayers, 1e3);
|
|
2471
|
+
window.addEventListener("message", handleMessage);
|
|
2472
|
+
} else setTimeout(init, 30);
|
|
2473
|
+
};
|
|
2474
|
+
init();
|
|
2475
|
+
})();
|
|
2476
|
+
return () => {
|
|
2477
|
+
if (timer) clearInterval(timer);
|
|
2478
|
+
rootObserver.disconnect();
|
|
2479
|
+
window.removeEventListener("message", handleMessage);
|
|
2480
|
+
};
|
|
2481
|
+
};
|
|
2482
|
+
|
|
2366
2483
|
//#endregion
|
|
2367
2484
|
//#region src/action.ts
|
|
2368
2485
|
/**
|
|
@@ -2407,6 +2524,7 @@ function create(App, options) {
|
|
|
2407
2524
|
publish: options.publish,
|
|
2408
2525
|
data
|
|
2409
2526
|
};
|
|
2527
|
+
const destroyPreview = initPreview();
|
|
2410
2528
|
const handleDestroy = () => {
|
|
2411
2529
|
const { onDestroyHandlers } = getInternalHandlers();
|
|
2412
2530
|
onDestroyHandlers?.forEach((h$1) => {
|
|
@@ -2415,6 +2533,7 @@ function create(App, options) {
|
|
|
2415
2533
|
});
|
|
2416
2534
|
const { onDestroyHandlers: onDestroyWidgetHandlers } = getWidgetHandlers();
|
|
2417
2535
|
if (onDestroyWidgetHandlers) onDestroyWidgetHandlers.forEach((h$1) => h$1(actionProps));
|
|
2536
|
+
destroyPreview();
|
|
2418
2537
|
};
|
|
2419
2538
|
setSystem({
|
|
2420
2539
|
apiKey: data.api_key || null,
|
|
@@ -3400,19 +3519,17 @@ function createComponentRawCss(layerId, define) {
|
|
|
3400
3519
|
return define(gen).join("\n");
|
|
3401
3520
|
}
|
|
3402
3521
|
function toResponsiveSelector(responsiveSetting, body) {
|
|
3403
|
-
const {
|
|
3404
|
-
|
|
3405
|
-
|
|
3522
|
+
const { breakpointId } = responsiveSetting;
|
|
3523
|
+
const breakpoint = getBreakpoints().find((v) => v.id === breakpointId);
|
|
3524
|
+
if (breakpoint && breakpoint.mediaQuery) {
|
|
3525
|
+
const { maxWidth, minWidth, orientation } = breakpoint.mediaQuery;
|
|
3406
3526
|
const prefix = `@media screen and`;
|
|
3407
|
-
if (raw) return `${prefix} (${raw}) {\n${body}\n}`;
|
|
3408
3527
|
const orientationStyle = orientation ? ` and (orientation: ${orientation})` : "";
|
|
3409
|
-
if (
|
|
3410
|
-
|
|
3411
|
-
|
|
3412
|
-
else if (range.min) return `${prefix} (min-width: ${range.min}px)${orientationStyle} {\n${body}\n}`;
|
|
3413
|
-
}
|
|
3528
|
+
if (minWidth && maxWidth) return `${prefix} (min-width: ${minWidth}px)${orientationStyle} and (max-width: ${maxWidth}px) {\n${body}\n}`;
|
|
3529
|
+
else if (maxWidth) return `${prefix} (max-width: ${maxWidth}px)${orientationStyle} {\n${body}\n}`;
|
|
3530
|
+
else if (minWidth) return `${prefix} (min-width: ${minWidth}px)${orientationStyle} {\n${body}\n}`;
|
|
3414
3531
|
return "";
|
|
3415
|
-
}
|
|
3532
|
+
}
|
|
3416
3533
|
return "";
|
|
3417
3534
|
}
|
|
3418
3535
|
function toStyleTag(css) {
|
|
@@ -3457,7 +3574,9 @@ function State($$anchor, $$props) {
|
|
|
3457
3574
|
$.push($$props, false);
|
|
3458
3575
|
let customBrandKit = $.prop($$props, "customBrandKit", 8, void 0);
|
|
3459
3576
|
let globalCssCode = $.prop($$props, "globalCssCode", 8, void 0);
|
|
3577
|
+
let breakpoints$1 = $.prop($$props, "breakpoints", 24, () => []);
|
|
3460
3578
|
setContext("brandKit", getBrandKit(customBrandKit()));
|
|
3579
|
+
setBreakpoints(breakpoints$1());
|
|
3461
3580
|
$.init();
|
|
3462
3581
|
var fragment = root$55();
|
|
3463
3582
|
var node = $.first_child(fragment);
|
|
@@ -3528,57 +3647,25 @@ const ROUND_VARIANT = {
|
|
|
3528
3647
|
};
|
|
3529
3648
|
|
|
3530
3649
|
//#endregion
|
|
3531
|
-
//#region src/components-flex/
|
|
3532
|
-
const USER_AGENT_VARIANT = {
|
|
3533
|
-
smartphone: { regex: /iPhone|Android.*Mobile/i },
|
|
3534
|
-
tablet: { regex: /iPad|Android(?!.*Mobile)/i },
|
|
3535
|
-
pc: { regex: /Windows NT|Macintosh|Linux x86_64/i },
|
|
3536
|
-
windows: { regex: /Windows NT/i },
|
|
3537
|
-
mac: { regex: /Macintosh|Mac OS X/i },
|
|
3538
|
-
ios: { regex: /iPhone|iPad|iPod/i },
|
|
3539
|
-
android: { regex: /Android/i },
|
|
3540
|
-
safari: { regex: /Safari/i },
|
|
3541
|
-
chrome: { regex: /Chrome|CriOS/i },
|
|
3542
|
-
firefox: { regex: /Firefox/i },
|
|
3543
|
-
ios_webview: { regex: /iPhone|iPad|iPod/i },
|
|
3544
|
-
android_webview: { regex: /; wv\)/i }
|
|
3545
|
-
};
|
|
3650
|
+
//#region src/components-flex/responsiveProp.ts
|
|
3546
3651
|
const isMatchMediaQueryCondition = (condition) => {
|
|
3547
|
-
const {
|
|
3652
|
+
const { minWidth, maxWidth, orientation } = condition;
|
|
3548
3653
|
if (orientation) return window.matchMedia(`(orientation: ${condition.orientation})`).matches;
|
|
3549
|
-
if (
|
|
3550
|
-
|
|
3551
|
-
|
|
3552
|
-
else if (typeof min === "number") return window.matchMedia(`(min-width: ${min}px)`).matches;
|
|
3553
|
-
else if (typeof max === "number") return window.matchMedia(`(max-width: ${max}px)`).matches;
|
|
3554
|
-
}
|
|
3555
|
-
if (raw) return window.matchMedia(raw).matches;
|
|
3654
|
+
if (typeof minWidth === "number" && typeof maxWidth === "number") return window.matchMedia(`(min-width: ${minWidth}px) and (max-width: ${maxWidth}px)`).matches;
|
|
3655
|
+
else if (typeof minWidth === "number") return window.matchMedia(`(min-width: ${minWidth}px)`).matches;
|
|
3656
|
+
else if (typeof maxWidth === "number") return window.matchMedia(`(max-width: ${maxWidth}px)`).matches;
|
|
3556
3657
|
return false;
|
|
3557
3658
|
};
|
|
3558
|
-
const isMatchUserAgentCondition = (condition) => {
|
|
3559
|
-
const { variants, regex } = condition;
|
|
3560
|
-
if (variants) return variants.some((variant) => {
|
|
3561
|
-
const regex$1 = USER_AGENT_VARIANT[variant]?.regex;
|
|
3562
|
-
if (!regex$1) return false;
|
|
3563
|
-
return new RegExp(regex$1).test(navigator.userAgent);
|
|
3564
|
-
});
|
|
3565
|
-
else if (regex) return new RegExp(regex).test(navigator.userAgent);
|
|
3566
|
-
return false;
|
|
3567
|
-
};
|
|
3568
|
-
const isMatchResponsiveSetting = (setting) => {
|
|
3569
|
-
const { mediaQueryCondition, userAgentCondition } = setting;
|
|
3570
|
-
if (mediaQueryCondition) return isMatchMediaQueryCondition(mediaQueryCondition);
|
|
3571
|
-
else if (userAgentCondition) return isMatchUserAgentCondition(userAgentCondition);
|
|
3572
|
-
else return false;
|
|
3573
|
-
};
|
|
3574
3659
|
function useResponsiveProps(props) {
|
|
3575
3660
|
return readable(props, (set) => {
|
|
3576
3661
|
if (!props.responsiveSettings) {
|
|
3577
3662
|
set(props);
|
|
3578
3663
|
return () => {};
|
|
3579
3664
|
}
|
|
3665
|
+
const breakpoints$1 = getBreakpoints();
|
|
3580
3666
|
const update = () => {
|
|
3581
|
-
const
|
|
3667
|
+
const breakpoint = breakpoints$1.find((v) => v.mediaQuery && isMatchMediaQueryCondition(v.mediaQuery));
|
|
3668
|
+
const matchedSetting = props.responsiveSettings.find((v) => v.breakpointId === breakpoint?.id);
|
|
3582
3669
|
if (matchedSetting) set(Object.assign({}, props, matchedSetting.props ?? {}));
|
|
3583
3670
|
else set(props);
|
|
3584
3671
|
};
|
|
@@ -4179,11 +4266,7 @@ var Avatar_css_default = (layerId, props) => {
|
|
|
4179
4266
|
appearance: "none"
|
|
4180
4267
|
}),
|
|
4181
4268
|
toDynamicStyle$3(layerId, props),
|
|
4182
|
-
...props.responsiveSettings?.map((v) =>
|
|
4183
|
-
if (v.mediaQueryCondition) return toResponsiveSelector(v, toDynamicStyle$3(layerId, v.props));
|
|
4184
|
-
else if (v.userAgentCondition) return "";
|
|
4185
|
-
return "";
|
|
4186
|
-
}) ?? [],
|
|
4269
|
+
...props.responsiveSettings?.map((v) => toResponsiveSelector(v, toDynamicStyle$3(layerId, v.props))) ?? [],
|
|
4187
4270
|
props.customizeCss
|
|
4188
4271
|
]);
|
|
4189
4272
|
};
|
|
@@ -4819,14 +4902,10 @@ var Icon_css_default = (layerId, props, _brandKit) => {
|
|
|
4819
4902
|
style("&[aria-disabled=\"true\"]:hover", { opacity: "0.24" }),
|
|
4820
4903
|
style("&[aria-hidden=\"true\"]", { display: "none" }),
|
|
4821
4904
|
toDynamicStyle$2(layerId, props),
|
|
4822
|
-
...props.responsiveSettings?.map((v) => {
|
|
4823
|
-
|
|
4824
|
-
|
|
4825
|
-
|
|
4826
|
-
}));
|
|
4827
|
-
else if (v.userAgentCondition) return "";
|
|
4828
|
-
return "";
|
|
4829
|
-
}) ?? [],
|
|
4905
|
+
...props.responsiveSettings?.map((v) => toResponsiveSelector(v, toDynamicStyle$2(layerId, {
|
|
4906
|
+
variant: v.props.variant ?? props.variant,
|
|
4907
|
+
...v.props
|
|
4908
|
+
}))) ?? [],
|
|
4830
4909
|
props.customizeCss
|
|
4831
4910
|
]);
|
|
4832
4911
|
};
|
|
@@ -5090,11 +5169,7 @@ var Button_css_default = (layerId, props, brandKit) => {
|
|
|
5090
5169
|
marginRight: "-0.2em"
|
|
5091
5170
|
}),
|
|
5092
5171
|
toDynamicStyle$1(layerId, props, brandKit),
|
|
5093
|
-
...props.responsiveSettings?.map((v) =>
|
|
5094
|
-
if (v.mediaQueryCondition) return toResponsiveSelector(v, toDynamicStyle$1(layerId, v.props, brandKit));
|
|
5095
|
-
else if (v.userAgentCondition) return "";
|
|
5096
|
-
return "";
|
|
5097
|
-
}) ?? [],
|
|
5172
|
+
...props.responsiveSettings?.map((v) => toResponsiveSelector(v, toDynamicStyle$1(layerId, v.props, brandKit))) ?? [],
|
|
5098
5173
|
props.customizeCss
|
|
5099
5174
|
]);
|
|
5100
5175
|
};
|
|
@@ -6002,11 +6077,7 @@ var Layout_css_default = (layerId, props, brandKit) => {
|
|
|
6002
6077
|
style("&[data-clickable=\"true\"]", { cursor: "pointer" }),
|
|
6003
6078
|
style("&[data-clickable=\"true\"]:hover", { opacity: .8 }),
|
|
6004
6079
|
toDynamicStyle$4(props),
|
|
6005
|
-
...props.responsiveSettings?.map((v) =>
|
|
6006
|
-
if (v.mediaQueryCondition) return toResponsiveSelector(v, toDynamicStyle$4(v.props));
|
|
6007
|
-
else if (v.userAgentCondition) return "";
|
|
6008
|
-
return "";
|
|
6009
|
-
}) ?? [],
|
|
6080
|
+
...props.responsiveSettings?.map((v) => toResponsiveSelector(v, toDynamicStyle$4(v.props))) ?? [],
|
|
6010
6081
|
props.customizeCss
|
|
6011
6082
|
]);
|
|
6012
6083
|
};
|
|
@@ -6489,14 +6560,10 @@ var Text_css_default = (layerId, props, brandKit) => {
|
|
|
6489
6560
|
wordBreak: "break-all"
|
|
6490
6561
|
}),
|
|
6491
6562
|
toDynamicStyle$4(props),
|
|
6492
|
-
...props.responsiveSettings?.map((v) => {
|
|
6493
|
-
|
|
6494
|
-
|
|
6495
|
-
|
|
6496
|
-
}));
|
|
6497
|
-
else if (v.userAgentCondition) return "";
|
|
6498
|
-
return "";
|
|
6499
|
-
}) ?? [],
|
|
6563
|
+
...props.responsiveSettings?.map((v) => toResponsiveSelector(v, toDynamicStyle$4({
|
|
6564
|
+
...v.props,
|
|
6565
|
+
content: v.props.content ?? props.content
|
|
6566
|
+
}))) ?? [],
|
|
6500
6567
|
props.customizeCss
|
|
6501
6568
|
]);
|
|
6502
6569
|
};
|
|
@@ -6694,14 +6761,10 @@ var TextLink_css_default = (layerId, props, brandKit) => {
|
|
|
6694
6761
|
style("&[aria-disabled=\"true\"]:hover", { opacity: "0.24" }),
|
|
6695
6762
|
style("&[aria-hidden=\"true\"]", { display: "none" }),
|
|
6696
6763
|
toDynamicStyle(layerId, props, brandKit),
|
|
6697
|
-
...props.responsiveSettings?.map((v) => {
|
|
6698
|
-
|
|
6699
|
-
|
|
6700
|
-
|
|
6701
|
-
}, brandKit));
|
|
6702
|
-
else if (v.userAgentCondition) return "";
|
|
6703
|
-
return "";
|
|
6704
|
-
}) ?? [],
|
|
6764
|
+
...props.responsiveSettings?.map((v) => toResponsiveSelector(v, toDynamicStyle(layerId, {
|
|
6765
|
+
...v.props,
|
|
6766
|
+
label: v.props.label ?? props.label
|
|
6767
|
+
}, brandKit))) ?? [],
|
|
6705
6768
|
props.customizeCss
|
|
6706
6769
|
]);
|
|
6707
6770
|
};
|
|
@@ -7807,7 +7870,7 @@ var root$3 = $.template(`<!> <!>`, 1);
|
|
|
7807
7870
|
function ClipCopy($$anchor, $$props) {
|
|
7808
7871
|
$.push($$props, false);
|
|
7809
7872
|
const [$$stores, $$cleanup] = $.setup_stores();
|
|
7810
|
-
const $
|
|
7873
|
+
const $responsiveSettings = () => $.store_get(responsiveSettings, "$responsiveSettings", $$stores);
|
|
7811
7874
|
const rProps = $.mutable_state();
|
|
7812
7875
|
let props = $.prop($$props, "props", 24, () => ({}));
|
|
7813
7876
|
let layerId = $.prop($$props, "layerId", 24, () => crypto.randomUUID());
|
|
@@ -7815,7 +7878,7 @@ function ClipCopy($$anchor, $$props) {
|
|
|
7815
7878
|
let buttonElement = $.mutable_state();
|
|
7816
7879
|
let showTooltip = $.mutable_state(false);
|
|
7817
7880
|
const cssCode = ClipCopy_css_default(layerId(), props());
|
|
7818
|
-
const
|
|
7881
|
+
const responsiveSettings = useResponsiveProps(props());
|
|
7819
7882
|
const handleClick = async (e) => {
|
|
7820
7883
|
e.preventDefault();
|
|
7821
7884
|
const targetText = $.get(rProps).content ?? $.get(buttonElement)?.innerText ?? "";
|
|
@@ -7832,8 +7895,8 @@ function ClipCopy($$anchor, $$props) {
|
|
|
7832
7895
|
console.warn(e$1);
|
|
7833
7896
|
}
|
|
7834
7897
|
};
|
|
7835
|
-
$.legacy_pre_effect(() => $
|
|
7836
|
-
$.set(rProps, $
|
|
7898
|
+
$.legacy_pre_effect(() => $responsiveSettings(), () => {
|
|
7899
|
+
$.set(rProps, $responsiveSettings());
|
|
7837
7900
|
});
|
|
7838
7901
|
$.legacy_pre_effect_reset();
|
|
7839
7902
|
$.init();
|
|
@@ -9285,7 +9348,6 @@ var index_svelte5_exports = /* @__PURE__ */ __export({
|
|
|
9285
9348
|
TEXT_THEME: () => TEXT_THEME,
|
|
9286
9349
|
TEXT_VARIANTS: () => TEXT_VARIANTS,
|
|
9287
9350
|
TextDirections: () => TextDirections,
|
|
9288
|
-
USER_AGENT_VARIANT: () => USER_AGENT_VARIANT,
|
|
9289
9351
|
WritingModes: () => WritingModes,
|
|
9290
9352
|
addChoiceAnswer: () => addChoiceAnswer,
|
|
9291
9353
|
addFreeAnswer: () => addFreeAnswer,
|
|
@@ -9336,6 +9398,7 @@ var index_svelte5_exports = /* @__PURE__ */ __export({
|
|
|
9336
9398
|
getVariables: () => getVariables,
|
|
9337
9399
|
hideOnScroll: () => hideOnScroll,
|
|
9338
9400
|
hideOnTime: () => hideOnTime,
|
|
9401
|
+
initPreview: () => initPreview,
|
|
9339
9402
|
initialize: () => initialize,
|
|
9340
9403
|
isOpened: () => isOpened,
|
|
9341
9404
|
listenLogger: () => listenLogger,
|
|
@@ -17,12 +17,13 @@ export type { CollectionConfig, ActionTableRowRequestConfig, ActionTableRowsRequ
|
|
|
17
17
|
export { addChoiceAnswer, addFreeAnswer, removeAnswer, getAnsweredQuestion, getAnsweredQuestionIds, sendAnswer, sendAnswers } from "./form.js";
|
|
18
18
|
export * as widget from "./widget.js";
|
|
19
19
|
export { onMount, onDestory, beforeUpdate, afterUpdate, tick, LAYOUT_COMPONENT_NAMES } from "./components/index.js";
|
|
20
|
+
export * from "./preview.js";
|
|
20
21
|
export * from "./components-flex/form.js";
|
|
21
22
|
export { default as State } from "./components-flex/state/State.svelte.js";
|
|
22
23
|
export { default as StateItem } from "./components-flex/state/StateItem.svelte.js";
|
|
23
24
|
export * from "./components-flex/shared/types.js";
|
|
24
25
|
export * from "./components-flex/props.js";
|
|
25
|
-
export * from "./components-flex/
|
|
26
|
+
export * from "./components-flex/responsiveProp.js";
|
|
26
27
|
export { default as FlexAvatar } from "./components-flex/avatar/Avatar.svelte.js";
|
|
27
28
|
export * from "./components-flex/avatar/types.js";
|
|
28
29
|
export * from "./components-flex/avatar/styles.js";
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export type ElementInfoStyles = {
|
|
2
|
+
opacity: string;
|
|
3
|
+
rowGap: string;
|
|
4
|
+
columnGap: string;
|
|
5
|
+
direction: string;
|
|
6
|
+
paddingLeft: string;
|
|
7
|
+
paddingRight: string;
|
|
8
|
+
paddingTop: string;
|
|
9
|
+
paddingBottom: string;
|
|
10
|
+
zIndex: string;
|
|
11
|
+
position: string;
|
|
12
|
+
top: string;
|
|
13
|
+
left: string;
|
|
14
|
+
right: string;
|
|
15
|
+
bottom: string;
|
|
16
|
+
};
|
|
17
|
+
export type ElementInfo = {
|
|
18
|
+
top: number;
|
|
19
|
+
left: number;
|
|
20
|
+
width: number;
|
|
21
|
+
height: number;
|
|
22
|
+
layerId: string;
|
|
23
|
+
direction: "row" | "column" | "";
|
|
24
|
+
classNames: string[];
|
|
25
|
+
styles: ElementInfoStyles;
|
|
26
|
+
};
|
|
27
|
+
/** @internal */
|
|
28
|
+
export declare const initPreview: () => (() => void);
|
package/dist/svelte5/stores.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { get as get_ } from "svelte/store";
|
|
2
2
|
import type { Writable as Writable_ } from "svelte/store";
|
|
3
|
-
import
|
|
3
|
+
import { ActionSetting, ActionEventHandler, ActionVariables, SystemConfig, ActionRunnerContext, Breakpoint } from "./types.js";
|
|
4
4
|
/** @internal */
|
|
5
5
|
export type Store<T> = Writable_<T>;
|
|
6
6
|
/**
|
|
@@ -350,6 +350,27 @@ export declare function setDestroyed(on: boolean): void;
|
|
|
350
350
|
*
|
|
351
351
|
* @internal
|
|
352
352
|
*/
|
|
353
|
+
export declare const breakpoints: Store<Breakpoint[]>;
|
|
354
|
+
/**
|
|
355
|
+
* ブレイクポイントの一覧を取得する
|
|
356
|
+
*
|
|
357
|
+
* @returns 現在のブレイクポイントの一覧
|
|
358
|
+
*/
|
|
359
|
+
export declare function getBreakpoints(): Breakpoint[];
|
|
360
|
+
/**
|
|
361
|
+
* 変数を設定する
|
|
362
|
+
*
|
|
363
|
+
* @remarks
|
|
364
|
+
* 設定したブレイクポイントは、ビジュアルエディタでブレイクポイントとして利用できます。
|
|
365
|
+
*
|
|
366
|
+
* @param values - ブレイクポイントの一覧
|
|
367
|
+
*/
|
|
368
|
+
export declare function setBreakpoints(values: Breakpoint[]): Breakpoint[];
|
|
369
|
+
/**
|
|
370
|
+
* Store to handle variables
|
|
371
|
+
*
|
|
372
|
+
* @internal
|
|
373
|
+
*/
|
|
353
374
|
export declare const variables: Store<{
|
|
354
375
|
[key: string]: any;
|
|
355
376
|
}>;
|
package/dist/svelte5/types.d.ts
CHANGED
|
@@ -18,6 +18,19 @@ export type ActionVariables = {
|
|
|
18
18
|
[key: string]: any;
|
|
19
19
|
};
|
|
20
20
|
/**
|
|
21
|
+
* ブレイクポイント
|
|
22
|
+
*
|
|
23
|
+
* @public
|
|
24
|
+
*/
|
|
25
|
+
export type Breakpoint = {
|
|
26
|
+
id: string;
|
|
27
|
+
mediaQuery?: {
|
|
28
|
+
minWidth?: number;
|
|
29
|
+
maxWidth?: number;
|
|
30
|
+
orientation?: "portrait" | "landscape";
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
21
34
|
* アクションの send 関数
|
|
22
35
|
*
|
|
23
36
|
* @public
|
package/dist/svelte5/utils.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ export declare const NOOP: Function;
|
|
|
4
4
|
/** @internal */
|
|
5
5
|
export declare const isPreview: () => boolean;
|
|
6
6
|
export declare const isCanvasPreview: () => boolean;
|
|
7
|
+
export declare const getPreviewId: () => string;
|
|
7
8
|
export declare const isOnSite: () => boolean;
|
|
8
9
|
export declare const isInFrame: () => boolean;
|
|
9
10
|
/** @internal */
|
package/dist/templates.cjs.js
CHANGED
|
@@ -13,7 +13,7 @@ function createAppScript(script = "", icons = [], customComponents = []) {
|
|
|
13
13
|
// DON'T TOUCH THIS: SDK generates the following code
|
|
14
14
|
import type { ActionProps, ActionVariables } from '@plaidev/karte-action-sdk';
|
|
15
15
|
import type { Data, Props, Variables } from './gen';
|
|
16
|
-
import { onMount } from 'svelte';
|
|
16
|
+
import { onMount, tick } from 'svelte';
|
|
17
17
|
import { writable } from 'svelte/store';
|
|
18
18
|
import {
|
|
19
19
|
state,
|
|
@@ -95,7 +95,8 @@ let data = writable<Data & ActionVariables>({ ...data_ });
|
|
|
95
95
|
export let onShow: (props: ActionProps<Props, Variables>) => void = _props => {};
|
|
96
96
|
export let onChangeState: (props: ActionProps<Props, Variables>, stateId: string) => void = (_props, _state) => {};
|
|
97
97
|
${script}
|
|
98
|
-
onMount(() => {
|
|
98
|
+
onMount(async () => {
|
|
99
|
+
await tick();
|
|
99
100
|
onShow({ send, data: $data });
|
|
100
101
|
});
|
|
101
102
|
|
package/dist/templates.js
CHANGED
|
@@ -12,7 +12,7 @@ function createAppScript(script = "", icons = [], customComponents = []) {
|
|
|
12
12
|
// DON'T TOUCH THIS: SDK generates the following code
|
|
13
13
|
import type { ActionProps, ActionVariables } from '@plaidev/karte-action-sdk';
|
|
14
14
|
import type { Data, Props, Variables } from './gen';
|
|
15
|
-
import { onMount } from 'svelte';
|
|
15
|
+
import { onMount, tick } from 'svelte';
|
|
16
16
|
import { writable } from 'svelte/store';
|
|
17
17
|
import {
|
|
18
18
|
state,
|
|
@@ -94,7 +94,8 @@ let data = writable<Data & ActionVariables>({ ...data_ });
|
|
|
94
94
|
export let onShow: (props: ActionProps<Props, Variables>) => void = _props => {};
|
|
95
95
|
export let onChangeState: (props: ActionProps<Props, Variables>, stateId: string) => void = (_props, _state) => {};
|
|
96
96
|
${script}
|
|
97
|
-
onMount(() => {
|
|
97
|
+
onMount(async () => {
|
|
98
|
+
await tick();
|
|
98
99
|
onShow({ send, data: $data });
|
|
99
100
|
});
|
|
100
101
|
|
package/dist/types.d.ts
CHANGED
|
@@ -18,6 +18,19 @@ export type ActionVariables = {
|
|
|
18
18
|
[key: string]: any;
|
|
19
19
|
};
|
|
20
20
|
/**
|
|
21
|
+
* ブレイクポイント
|
|
22
|
+
*
|
|
23
|
+
* @public
|
|
24
|
+
*/
|
|
25
|
+
export type Breakpoint = {
|
|
26
|
+
id: string;
|
|
27
|
+
mediaQuery?: {
|
|
28
|
+
minWidth?: number;
|
|
29
|
+
maxWidth?: number;
|
|
30
|
+
orientation?: "portrait" | "landscape";
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
21
34
|
* アクションの send 関数
|
|
22
35
|
*
|
|
23
36
|
* @public
|
package/dist/utils.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ export declare const NOOP: Function;
|
|
|
4
4
|
/** @internal */
|
|
5
5
|
export declare const isPreview: () => boolean;
|
|
6
6
|
export declare const isCanvasPreview: () => boolean;
|
|
7
|
+
export declare const getPreviewId: () => string;
|
|
7
8
|
export declare const isOnSite: () => boolean;
|
|
8
9
|
export declare const isInFrame: () => boolean;
|
|
9
10
|
/** @internal */
|
package/package.json
CHANGED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { FlexComponentProps } from "./props.js";
|
|
2
|
-
import { Readable } from "svelte/store";
|
|
3
|
-
export declare const USER_AGENT_VARIANT: Record<string, {
|
|
4
|
-
regex: RegExp;
|
|
5
|
-
}>;
|
|
6
|
-
export type MediaQueryCondition = {
|
|
7
|
-
range?: {
|
|
8
|
-
min?: number;
|
|
9
|
-
max?: number;
|
|
10
|
-
};
|
|
11
|
-
raw?: string;
|
|
12
|
-
orientation?: "portrait" | "landscape";
|
|
13
|
-
};
|
|
14
|
-
export type UserAgentVariant = keyof typeof USER_AGENT_VARIANT;
|
|
15
|
-
export type UserAgentCondition = {
|
|
16
|
-
variants?: UserAgentVariant[];
|
|
17
|
-
regex?: string;
|
|
18
|
-
};
|
|
19
|
-
export type ResponsiveSetting<T extends object> = {
|
|
20
|
-
id: string;
|
|
21
|
-
label: string;
|
|
22
|
-
mediaQueryCondition?: MediaQueryCondition;
|
|
23
|
-
userAgentCondition?: UserAgentCondition;
|
|
24
|
-
props: Partial<T>;
|
|
25
|
-
};
|
|
26
|
-
export declare function useResponsiveProps<T extends object>(props: FlexComponentProps<T>): Readable<T>;
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { FlexComponentProps } from "./props.js";
|
|
2
|
-
import { Readable } from "svelte/store";
|
|
3
|
-
export declare const USER_AGENT_VARIANT: Record<string, {
|
|
4
|
-
regex: RegExp;
|
|
5
|
-
}>;
|
|
6
|
-
export type MediaQueryCondition = {
|
|
7
|
-
range?: {
|
|
8
|
-
min?: number;
|
|
9
|
-
max?: number;
|
|
10
|
-
};
|
|
11
|
-
raw?: string;
|
|
12
|
-
orientation?: "portrait" | "landscape";
|
|
13
|
-
};
|
|
14
|
-
export type UserAgentVariant = keyof typeof USER_AGENT_VARIANT;
|
|
15
|
-
export type UserAgentCondition = {
|
|
16
|
-
variants?: UserAgentVariant[];
|
|
17
|
-
regex?: string;
|
|
18
|
-
};
|
|
19
|
-
export type ResponsiveSetting<T extends object> = {
|
|
20
|
-
id: string;
|
|
21
|
-
label: string;
|
|
22
|
-
mediaQueryCondition?: MediaQueryCondition;
|
|
23
|
-
userAgentCondition?: UserAgentCondition;
|
|
24
|
-
props: Partial<T>;
|
|
25
|
-
};
|
|
26
|
-
export declare function useResponsiveProps<T extends object>(props: FlexComponentProps<T>): Readable<T>;
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { FlexComponentProps } from "./props.js";
|
|
2
|
-
import { Readable } from "svelte/store";
|
|
3
|
-
export declare const USER_AGENT_VARIANT: Record<string, {
|
|
4
|
-
regex: RegExp;
|
|
5
|
-
}>;
|
|
6
|
-
export type MediaQueryCondition = {
|
|
7
|
-
range?: {
|
|
8
|
-
min?: number;
|
|
9
|
-
max?: number;
|
|
10
|
-
};
|
|
11
|
-
raw?: string;
|
|
12
|
-
orientation?: "portrait" | "landscape";
|
|
13
|
-
};
|
|
14
|
-
export type UserAgentVariant = keyof typeof USER_AGENT_VARIANT;
|
|
15
|
-
export type UserAgentCondition = {
|
|
16
|
-
variants?: UserAgentVariant[];
|
|
17
|
-
regex?: string;
|
|
18
|
-
};
|
|
19
|
-
export type ResponsiveSetting<T extends object> = {
|
|
20
|
-
id: string;
|
|
21
|
-
label: string;
|
|
22
|
-
mediaQueryCondition?: MediaQueryCondition;
|
|
23
|
-
userAgentCondition?: UserAgentCondition;
|
|
24
|
-
props: Partial<T>;
|
|
25
|
-
};
|
|
26
|
-
export declare function useResponsiveProps<T extends object>(props: FlexComponentProps<T>): Readable<T>;
|