@juo/blocks 1.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.
- package/dist/ExtensionRoot-CZyBNJZY.js +159 -0
- package/dist/block-VhmfGB3N.js +51 -0
- package/dist/block.d.ts +96 -0
- package/dist/block.d.ts.map +1 -0
- package/dist/bridge-DQsM97cH.js +490 -0
- package/dist/context.d.ts +76 -0
- package/dist/context.d.ts.map +1 -0
- package/dist/context.test.d.ts +2 -0
- package/dist/context.test.d.ts.map +1 -0
- package/dist/core.js +1163 -0
- package/dist/editor/bridge.d.ts +75 -0
- package/dist/editor/bridge.d.ts.map +1 -0
- package/dist/editor/bridge.test.d.ts +2 -0
- package/dist/editor/bridge.test.d.ts.map +1 -0
- package/dist/editor/components.d.ts +31 -0
- package/dist/editor/components.d.ts.map +1 -0
- package/dist/editor/handler.d.ts +10 -0
- package/dist/editor/handler.d.ts.map +1 -0
- package/dist/editor/main.d.ts +17 -0
- package/dist/editor/main.d.ts.map +1 -0
- package/dist/editor/messages.d.ts +233 -0
- package/dist/editor/messages.d.ts.map +1 -0
- package/dist/editor.js +711 -0
- package/dist/flows/MockWorkflowApiAdapter.d.ts +13 -0
- package/dist/flows/MockWorkflowApiAdapter.d.ts.map +1 -0
- package/dist/flows/WorkflowService.d.ts +175 -0
- package/dist/flows/WorkflowService.d.ts.map +1 -0
- package/dist/flows/__tests__/WorkflowService.test.d.ts +2 -0
- package/dist/flows/__tests__/WorkflowService.test.d.ts.map +1 -0
- package/dist/flows/__tests__/defaults.test.d.ts +2 -0
- package/dist/flows/__tests__/defaults.test.d.ts.map +1 -0
- package/dist/flows/__tests__/juo-workflow.test.d.ts +2 -0
- package/dist/flows/__tests__/juo-workflow.test.d.ts.map +1 -0
- package/dist/flows/__tests__/overlay-behavior.test.d.ts +2 -0
- package/dist/flows/__tests__/overlay-behavior.test.d.ts.map +1 -0
- package/dist/flows/__tests__/theme-state-surfaces.test.d.ts +2 -0
- package/dist/flows/__tests__/theme-state-surfaces.test.d.ts.map +1 -0
- package/dist/flows/defaults.d.ts +15 -0
- package/dist/flows/defaults.d.ts.map +1 -0
- package/dist/flows/index.d.ts +4 -0
- package/dist/flows/index.d.ts.map +1 -0
- package/dist/flows/juo-workflow.d.ts +48 -0
- package/dist/flows/juo-workflow.d.ts.map +1 -0
- package/dist/juo-workflow-RSrOuKUH.js +591 -0
- package/dist/main.d.ts +11 -0
- package/dist/main.d.ts.map +1 -0
- package/dist/preact/block.d.ts +21 -0
- package/dist/preact/block.d.ts.map +1 -0
- package/dist/preact/block.test.d.ts +2 -0
- package/dist/preact/block.test.d.ts.map +1 -0
- package/dist/preact/bridge.d.ts +11 -0
- package/dist/preact/bridge.d.ts.map +1 -0
- package/dist/preact/context.d.ts +31 -0
- package/dist/preact/context.d.ts.map +1 -0
- package/dist/preact/main.d.ts +11 -0
- package/dist/preact/main.d.ts.map +1 -0
- package/dist/preact/signals.d.ts +23 -0
- package/dist/preact/signals.d.ts.map +1 -0
- package/dist/preact.js +230 -0
- package/dist/react/block.d.ts +21 -0
- package/dist/react/block.d.ts.map +1 -0
- package/dist/react/block.test.d.ts +2 -0
- package/dist/react/block.test.d.ts.map +1 -0
- package/dist/react/bridge.d.ts +11 -0
- package/dist/react/bridge.d.ts.map +1 -0
- package/dist/react/context.d.ts +28 -0
- package/dist/react/context.d.ts.map +1 -0
- package/dist/react/main.d.ts +11 -0
- package/dist/react/main.d.ts.map +1 -0
- package/dist/react/signals.d.ts +23 -0
- package/dist/react/signals.d.ts.map +1 -0
- package/dist/react.js +205 -0
- package/dist/services/index.d.ts +4 -0
- package/dist/services/index.d.ts.map +1 -0
- package/dist/services/login/index.d.ts +23 -0
- package/dist/services/login/index.d.ts.map +1 -0
- package/dist/services/login/loginService.d.ts +82 -0
- package/dist/services/login/loginService.d.ts.map +1 -0
- package/dist/services/product/adapter.d.ts +20 -0
- package/dist/services/product/adapter.d.ts.map +1 -0
- package/dist/services/product/index.d.ts +5 -0
- package/dist/services/product/index.d.ts.map +1 -0
- package/dist/services/product/productService.d.ts +12 -0
- package/dist/services/product/productService.d.ts.map +1 -0
- package/dist/services/product/types.d.ts +32 -0
- package/dist/services/product/types.d.ts.map +1 -0
- package/dist/services/subscription/adapter.d.ts +49 -0
- package/dist/services/subscription/adapter.d.ts.map +1 -0
- package/dist/services/subscription/index.d.ts +5 -0
- package/dist/services/subscription/index.d.ts.map +1 -0
- package/dist/services/subscription/list.d.ts +22 -0
- package/dist/services/subscription/list.d.ts.map +1 -0
- package/dist/services/subscription/store.d.ts +30 -0
- package/dist/services/subscription/store.d.ts.map +1 -0
- package/dist/services/subscription/subscriptionService.d.ts +12 -0
- package/dist/services/subscription/subscriptionService.d.ts.map +1 -0
- package/dist/services/subscription/types.d.ts +76 -0
- package/dist/services/subscription/types.d.ts.map +1 -0
- package/dist/shared/block.d.ts +17 -0
- package/dist/shared/block.d.ts.map +1 -0
- package/dist/shared/context.d.ts +16 -0
- package/dist/shared/context.d.ts.map +1 -0
- package/dist/shared/signals.d.ts +17 -0
- package/dist/shared/signals.d.ts.map +1 -0
- package/dist/state.d.ts +81 -0
- package/dist/state.d.ts.map +1 -0
- package/dist/theme-state-BZplRS92.js +886 -0
- package/dist/theme-state.d.ts +85 -0
- package/dist/theme-state.d.ts.map +1 -0
- package/dist/theme-state.locales.test.d.ts +2 -0
- package/dist/theme-state.locales.test.d.ts.map +1 -0
- package/dist/translation.d.ts +14 -0
- package/dist/translation.d.ts.map +1 -0
- package/dist/translation.test.d.ts +2 -0
- package/dist/translation.test.d.ts.map +1 -0
- package/dist/utils/index.d.ts +32 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/login.d.ts +11 -0
- package/dist/utils/login.d.ts.map +1 -0
- package/dist/utils/uuid.d.ts +2 -0
- package/dist/utils/uuid.d.ts.map +1 -0
- package/dist/vue/block.d.ts +7 -0
- package/dist/vue/block.d.ts.map +1 -0
- package/dist/vue/bridge.d.ts +11 -0
- package/dist/vue/bridge.d.ts.map +1 -0
- package/dist/vue/context.d.ts +24 -0
- package/dist/vue/context.d.ts.map +1 -0
- package/dist/vue/main.d.ts +6 -0
- package/dist/vue/main.d.ts.map +1 -0
- package/dist/vue/signals.d.ts +5 -0
- package/dist/vue/signals.d.ts.map +1 -0
- package/dist/vue/target.d.ts +2 -0
- package/dist/vue/target.d.ts.map +1 -0
- package/dist/vue/transform.d.ts +2 -0
- package/dist/vue/transform.d.ts.map +1 -0
- package/dist/vue.js +254 -0
- package/dist/web-components/Block.d.ts +17 -0
- package/dist/web-components/Block.d.ts.map +1 -0
- package/dist/web-components/Block.test.d.ts +2 -0
- package/dist/web-components/Block.test.d.ts.map +1 -0
- package/dist/web-components/ExtensionRoot.d.ts +29 -0
- package/dist/web-components/ExtensionRoot.d.ts.map +1 -0
- package/dist/web-components/editor/InlineText.d.ts +29 -0
- package/dist/web-components/editor/InlineText.d.ts.map +1 -0
- package/dist/web-components/editor/main.d.ts +2 -0
- package/dist/web-components/editor/main.d.ts.map +1 -0
- package/dist/web-components/runtime/InlineText.d.ts +6 -0
- package/dist/web-components/runtime/InlineText.d.ts.map +1 -0
- package/dist/web-components/runtime/main.d.ts +2 -0
- package/dist/web-components/runtime/main.d.ts.map +1 -0
- package/dist/web-components-editor.js +183 -0
- package/dist/web-components-runtime.js +55 -0
- package/package.json +62 -0
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { ReadonlySignal, Signal } from '@preact/signals-core';
|
|
2
|
+
import { Block, BlockInstance } from './block';
|
|
3
|
+
export type ThemeSurface = "page" | "overlay";
|
|
4
|
+
export type GlobalStyleColors = {
|
|
5
|
+
accent: string;
|
|
6
|
+
secondary: string;
|
|
7
|
+
tint: string;
|
|
8
|
+
callout: string;
|
|
9
|
+
success: string;
|
|
10
|
+
error: string;
|
|
11
|
+
information: string;
|
|
12
|
+
warning: string;
|
|
13
|
+
background: string;
|
|
14
|
+
};
|
|
15
|
+
export type ThemeType = "neutral" | "warm" | "cold";
|
|
16
|
+
export type GlobalStyles = {
|
|
17
|
+
volume: "compact" | "comfort" | "spacious";
|
|
18
|
+
style: "bare" | "ghost" | "tinted" | "solid" | "layered";
|
|
19
|
+
corners: "sharp" | "soft" | "round" | "pill";
|
|
20
|
+
buttonCorners: "sharp" | "round" | "circle";
|
|
21
|
+
thumbnailCorners: "sharp" | "round" | "circle";
|
|
22
|
+
theme: "preset" | "custom";
|
|
23
|
+
themeType: ThemeType;
|
|
24
|
+
colors: GlobalStyleColors;
|
|
25
|
+
};
|
|
26
|
+
export declare const DEFAULT_GLOBAL_STYLES: GlobalStyles;
|
|
27
|
+
export type ThemeSurfaceState = {
|
|
28
|
+
blocks: Signal<BlockInstance[]>;
|
|
29
|
+
};
|
|
30
|
+
export type TranslationMode = "override" | "default";
|
|
31
|
+
export type TranslationScope = {
|
|
32
|
+
kind: "theme";
|
|
33
|
+
} | {
|
|
34
|
+
kind: "block";
|
|
35
|
+
blockId: string;
|
|
36
|
+
};
|
|
37
|
+
export type TranslationOverride = {
|
|
38
|
+
locale: string;
|
|
39
|
+
key: string;
|
|
40
|
+
value: string;
|
|
41
|
+
scope: TranslationScope;
|
|
42
|
+
};
|
|
43
|
+
export type TranslationCatalogs = {
|
|
44
|
+
theme: {
|
|
45
|
+
defaults: Record<string, string>;
|
|
46
|
+
overrides: Record<string, string>;
|
|
47
|
+
};
|
|
48
|
+
blocks: {
|
|
49
|
+
defaults: Record<string, Record<string, string>>;
|
|
50
|
+
modes: Record<string, Record<string, TranslationMode>>;
|
|
51
|
+
overrides: Record<string, Record<string, string>>;
|
|
52
|
+
};
|
|
53
|
+
};
|
|
54
|
+
export type ThemeLocaleState = {
|
|
55
|
+
locale: ReadonlySignal<string>;
|
|
56
|
+
catalogs: ReadonlySignal<TranslationCatalogs | null>;
|
|
57
|
+
setLocale: (locale: string) => Promise<void>;
|
|
58
|
+
};
|
|
59
|
+
export type ThemeState = {
|
|
60
|
+
page: ThemeSurfaceState;
|
|
61
|
+
overlay: ThemeSurfaceState;
|
|
62
|
+
locales: ThemeLocaleState;
|
|
63
|
+
globalStyles: ReadonlySignal<GlobalStyles>;
|
|
64
|
+
setGlobalStyles: (styles: GlobalStyles) => void;
|
|
65
|
+
resolve: (surface: ThemeSurface, id: string, defaultBlock: string) => Promise<{
|
|
66
|
+
blocks: Block[];
|
|
67
|
+
}>;
|
|
68
|
+
};
|
|
69
|
+
export declare const ThemeStateContext: {
|
|
70
|
+
__context__: ThemeState;
|
|
71
|
+
};
|
|
72
|
+
export declare function indexOverrides(overrides: TranslationOverride[]): {
|
|
73
|
+
theme: Record<string, string>;
|
|
74
|
+
blocks: Record<string, Record<string, string>>;
|
|
75
|
+
};
|
|
76
|
+
export declare function createThemeState(deps: {
|
|
77
|
+
resolve: (surface: ThemeSurface, id: string, defaultBlock: string) => Promise<{
|
|
78
|
+
blocks: Block[];
|
|
79
|
+
}>;
|
|
80
|
+
translations?: {
|
|
81
|
+
resolveTranslations: (locale: string) => Promise<TranslationOverride[]>;
|
|
82
|
+
};
|
|
83
|
+
initialGlobalStyles?: GlobalStyles;
|
|
84
|
+
}): ThemeState;
|
|
85
|
+
//# sourceMappingURL=theme-state.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"theme-state.d.ts","sourceRoot":"","sources":["../src/theme-state.ts"],"names":[],"mappings":"AAAA,OAAO,EAAU,KAAK,cAAc,EAAE,KAAK,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAEhF,OAAO,EAEL,KAAK,KAAK,EAEV,KAAK,aAAa,EAGnB,MAAM,SAAS,CAAC;AAEjB,MAAM,MAAM,YAAY,GAAG,MAAM,GAAG,SAAS,CAAC;AAE9C,MAAM,MAAM,iBAAiB,GAAG;IAC9B,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MA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C;IAC9B,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;CAChD,CAmBA;AAED,wBAAgB,gBAAgB,CAAC,IAAI,EAAE;IACrC,OAAO,EAAE,CACP,OAAO,EAAE,YAAY,EACrB,EAAE,EAAE,MAAM,EACV,YAAY,EAAE,MAAM,KACjB,OAAO,CAAC;QAAE,MAAM,EAAE,KAAK,EAAE,CAAA;KAAE,CAAC,CAAC;IAClC,YAAY,CAAC,EAAE;QACb,mBAAmB,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,OAAO,CAAC,mBAAmB,EAAE,CAAC,CAAC;KACzE,CAAC;IACF,mBAAmB,CAAC,EAAE,YAAY,CAAC;CACpC,GAAG,UAAU,CA8Hb"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"theme-state.locales.test.d.ts","sourceRoot":"","sources":["../src/theme-state.locales.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ReadonlySignal } from '@preact/signals-core';
|
|
2
|
+
import { ThemeLocaleState } from './theme-state';
|
|
3
|
+
export interface TranslationService {
|
|
4
|
+
readonly locale: ReadonlySignal<string>;
|
|
5
|
+
resolve(blockType: string | null, blockId: string | null, key: string): string;
|
|
6
|
+
}
|
|
7
|
+
export type TranslationServiceOptions = {
|
|
8
|
+
loadDefaultTranslations?: (locale: string) => Promise<Record<string, string>>;
|
|
9
|
+
};
|
|
10
|
+
export declare const TranslationContext: {
|
|
11
|
+
__context__: TranslationService;
|
|
12
|
+
};
|
|
13
|
+
export declare function createTranslationService(locales: ThemeLocaleState, options?: TranslationServiceOptions): TranslationService;
|
|
14
|
+
//# sourceMappingURL=translation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"translation.d.ts","sourceRoot":"","sources":["../src/translation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,KAAK,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAE3E,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAEtD,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,MAAM,EAAE,cAAc,CAAC,MAAM,CAAC,CAAC;IACxC,OAAO,CACL,SAAS,EAAE,MAAM,GAAG,IAAI,EACxB,OAAO,EAAE,MAAM,GAAG,IAAI,EACtB,GAAG,EAAE,MAAM,GACV,MAAM,CAAC;CACX;AAED,MAAM,MAAM,yBAAyB,GAAG;IACtC,uBAAuB,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;CAC/E,CAAC;AAEF,eAAO,MAAM,kBAAkB;;CACmB,CAAC;AAWnD,wBAAgB,wBAAwB,CACtC,OAAO,EAAE,gBAAgB,EACzB,OAAO,GAAE,yBAA8B,GACtC,kBAAkB,CA+DpB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"translation.test.d.ts","sourceRoot":"","sources":["../src/translation.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export type Failure<E = unknown> = {
|
|
2
|
+
_tag: "Failure";
|
|
3
|
+
error: E;
|
|
4
|
+
};
|
|
5
|
+
export type Success<T = void> = {
|
|
6
|
+
_tag: "Success";
|
|
7
|
+
data: T;
|
|
8
|
+
};
|
|
9
|
+
export type Result<T = void, E = unknown> = Failure<E> | Success<T>;
|
|
10
|
+
export interface PageInfo {
|
|
11
|
+
hasNextPage: boolean;
|
|
12
|
+
hasPrevPage: boolean;
|
|
13
|
+
startCursor: string | null;
|
|
14
|
+
endCursor: string | null;
|
|
15
|
+
}
|
|
16
|
+
export interface PaginatedList<T> {
|
|
17
|
+
items: T[];
|
|
18
|
+
pageInfo: PageInfo;
|
|
19
|
+
}
|
|
20
|
+
export type ErrorDetails = {
|
|
21
|
+
title: string;
|
|
22
|
+
message: string;
|
|
23
|
+
};
|
|
24
|
+
export type Image = {
|
|
25
|
+
url: string;
|
|
26
|
+
altText?: string;
|
|
27
|
+
};
|
|
28
|
+
export type PriceWithCurrency = {
|
|
29
|
+
amount: string;
|
|
30
|
+
currencyCode: string;
|
|
31
|
+
};
|
|
32
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,OAAO,CAAC,CAAC,GAAG,OAAO,IAAI;IACjC,IAAI,EAAE,SAAS,CAAC;IAChB,KAAK,EAAE,CAAC,CAAC;CACV,CAAC;AAEF,MAAM,MAAM,OAAO,CAAC,CAAC,GAAG,IAAI,IAAI;IAC9B,IAAI,EAAE,SAAS,CAAC;IAChB,IAAI,EAAE,CAAC,CAAC;CACT,CAAC;AAEF,MAAM,MAAM,MAAM,CAAC,CAAC,GAAG,IAAI,EAAE,CAAC,GAAG,OAAO,IAAI,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;AAEpE,MAAM,WAAW,QAAQ;IACvB,WAAW,EAAE,OAAO,CAAC;IACrB,WAAW,EAAE,OAAO,CAAC;IACrB,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;CAC1B;AAED,MAAM,WAAW,aAAa,CAAC,CAAC;IAC9B,KAAK,EAAE,CAAC,EAAE,CAAC;IACX,QAAQ,EAAE,QAAQ,CAAC;CACpB;AAED,MAAM,MAAM,YAAY,GAAG;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC;AAE9D,MAAM,MAAM,KAAK,GAAG;IAClB,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG;IAC9B,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,EAAE,MAAM,CAAC;CACtB,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export declare const PARAMS: {
|
|
2
|
+
readonly DELETGATED_TOKEN: "delegated-token";
|
|
3
|
+
readonly REDIRECT_TO: "redirect-to";
|
|
4
|
+
readonly ACTION: "action";
|
|
5
|
+
readonly MISSING: "missing";
|
|
6
|
+
readonly CODE: "code";
|
|
7
|
+
readonly ERROR: "error";
|
|
8
|
+
readonly STATE: "state";
|
|
9
|
+
readonly REFRESH: "refresh";
|
|
10
|
+
};
|
|
11
|
+
//# sourceMappingURL=login.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"login.d.ts","sourceRoot":"","sources":["../../src/utils/login.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,MAAM;;;;;;;;;CAST,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"uuid.d.ts","sourceRoot":"","sources":["../../src/utils/uuid.ts"],"names":[],"mappings":"AACA,wBAAgB,IAAI,QAQnB"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Component } from 'vue';
|
|
2
|
+
import { BlockInstance } from '../main.ts';
|
|
3
|
+
export declare function createVueRenderer(component: Component): (block: BlockInstance) => HTMLDivElement;
|
|
4
|
+
export declare function createVueCeRenderer(name: string, component: Component, { shadowRoot }?: {
|
|
5
|
+
shadowRoot?: boolean;
|
|
6
|
+
}): (block: BlockInstance) => HTMLDivElement;
|
|
7
|
+
//# sourceMappingURL=block.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"block.d.ts","sourceRoot":"","sources":["../../src/vue/block.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EAOV,MAAM,KAAK,CAAC;AACb,OAAO,EAAE,aAAa,EAAoB,MAAM,aAAa,CAAC;AAmB9D,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,SAAS,WAiBrC,aAAa,oBAa7B;AAED,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,MAAM,EACZ,SAAS,EAAE,SAAS,EACpB,EAAE,UAAiB,EAAE,GAAE;IAAE,UAAU,CAAC,EAAE,OAAO,CAAA;CAAO,4CAoCrD"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { PresetData, ExtractPresetState, ExtractPresetContext } from '../editor/bridge';
|
|
2
|
+
type PresetChangeCallback<TPresets> = (preset: PresetData<ExtractPresetState<TPresets>, ExtractPresetContext<TPresets>> | null) => void;
|
|
3
|
+
export interface UseBridgeOptions<TPresets = unknown> {
|
|
4
|
+
onPresetChange: PresetChangeCallback<TPresets>;
|
|
5
|
+
}
|
|
6
|
+
export interface BlockBridgeAPI {
|
|
7
|
+
readonly isEditorMode: boolean;
|
|
8
|
+
}
|
|
9
|
+
export declare function useBridge<TPresets = unknown>(options: UseBridgeOptions<TPresets>): BlockBridgeAPI;
|
|
10
|
+
export {};
|
|
11
|
+
//# sourceMappingURL=bridge.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bridge.d.ts","sourceRoot":"","sources":["../../src/vue/bridge.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,KAAK,UAAU,EACf,KAAK,kBAAkB,EACvB,KAAK,oBAAoB,EAC1B,MAAM,kBAAkB,CAAC;AAG1B,KAAK,oBAAoB,CAAC,QAAQ,IAAI,CACpC,MAAM,EAAE,UAAU,CAChB,kBAAkB,CAAC,QAAQ,CAAC,EAC5B,oBAAoB,CAAC,QAAQ,CAAC,CAC/B,GAAG,IAAI,KACL,IAAI,CAAC;AAEV,MAAM,WAAW,gBAAgB,CAAC,QAAQ,GAAG,OAAO;IAClD,cAAc,EAAE,oBAAoB,CAAC,QAAQ,CAAC,CAAC;CAChD;AAED,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,YAAY,EAAE,OAAO,CAAC;CAChC;AAED,wBAAgB,SAAS,CAAC,QAAQ,GAAG,OAAO,EAC1C,OAAO,EAAE,gBAAgB,CAAC,QAAQ,CAAC,GAClC,cAAc,CA0BhB"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Ref } from 'vue';
|
|
2
|
+
import { ContextType, UnknownContext } from '../main.ts';
|
|
3
|
+
import { Signal } from '@preact/signals-core';
|
|
4
|
+
export declare const ContextProvider: import('vue').DefineSetupFnComponent<Record<string, any>, {}, {}, Record<string, any> & {}, import('vue').PublicProps>;
|
|
5
|
+
export declare function useProvideContextProvider(root: Ref<HTMLElement | null>): void;
|
|
6
|
+
export declare function useBlockId(): Ref<string | null>;
|
|
7
|
+
export declare function useBlockType(): Ref<string | null>;
|
|
8
|
+
/**
|
|
9
|
+
* Returns a function that blocks can call to register dynamic translation keys
|
|
10
|
+
* with the editor. The editor uses these keys to show a translation panel UI.
|
|
11
|
+
*
|
|
12
|
+
* The `keys` argument is a Record mapping translation key to its default value.
|
|
13
|
+
* This is a no-op when not running inside an editor iframe.
|
|
14
|
+
*/
|
|
15
|
+
export declare function useRegisterTranslationKeys(): (keys: Record<string, string>) => void;
|
|
16
|
+
export declare function useContext<C extends UnknownContext>(context: C): Wrap<ContextType<C>>;
|
|
17
|
+
export declare function useProvideContext<C extends UnknownContext>(context: C, init: ContextType<C>): void;
|
|
18
|
+
type Wrap<T> = T extends Signal<infer V> ? Ref<V> : T extends Function ? T : T extends Record<any, any> ? {
|
|
19
|
+
[K in keyof T]: Wrap<T[K]>;
|
|
20
|
+
} & {
|
|
21
|
+
$: T;
|
|
22
|
+
} : T;
|
|
23
|
+
export {};
|
|
24
|
+
//# sourceMappingURL=context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../src/vue/context.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAgB,GAAG,EAAE,MAAM,KAAK,CAAC;AAC7C,OAAO,EACL,WAAW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,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { Signal } from '../main.ts';
|
|
2
|
+
import { MaybeRefOrGetter, Ref } from 'vue';
|
|
3
|
+
export declare function toSignal<T>(ref: MaybeRefOrGetter<T>): Signal<T>;
|
|
4
|
+
export declare function toRef<T>(signal: Signal<T> | (() => T)): Ref<NoInfer<T>>;
|
|
5
|
+
//# sourceMappingURL=signals.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"signals.d.ts","sourceRoot":"","sources":["../../src/vue/signals.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,MAAM,EAAE,MAAM,aAAa,CAAC;AACrD,OAAO,EAAa,gBAAgB,EAAE,GAAG,EAAwB,MAAM,KAAK,CAAC;AAI7E,wBAAgB,QAAQ,CAAC,CAAC,EAAE,GAAG,EAAE,gBAAgB,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC,CAY/D;AAID,wBAAgB,KAAK,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,GAAG,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CA8BvE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"target.d.ts","sourceRoot":"","sources":["../../src/vue/target.ts"],"names":[],"mappings":"AAEA,wBAAgB,SAAS,8DAkBxB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transform.d.ts","sourceRoot":"","sources":["../../src/vue/transform.ts"],"names":[],"mappings":"AAGA,wBAAgB,aAAa,CAAC,CAAC,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,GAAG,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAMhE"}
|
package/dist/vue.js
ADDED
|
@@ -0,0 +1,254 @@
|
|
|
1
|
+
import { toValue, watchEffect, customRef, defineComponent, ref, getCurrentInstance, onMounted, provide, h, renderSlot, inject, computed, createApp, useHost, defineCustomElement } from "vue";
|
|
2
|
+
import { signal, effect, injectContext, provideContext, createCeRenderer } from "@juo/blocks";
|
|
3
|
+
import { c as createRegisterBlockTranslationKeysMessage, a as createEditorBridge } from "./bridge-DQsM97cH.js";
|
|
4
|
+
const signalsMap = /* @__PURE__ */ new WeakMap();
|
|
5
|
+
function toSignal(ref2) {
|
|
6
|
+
if (!signalsMap.has(ref2)) {
|
|
7
|
+
const s = signal(toValue(ref2));
|
|
8
|
+
watchEffect(() => {
|
|
9
|
+
s.value = toValue(ref2);
|
|
10
|
+
});
|
|
11
|
+
signalsMap.set(ref2, s);
|
|
12
|
+
}
|
|
13
|
+
return signalsMap.get(ref2);
|
|
14
|
+
}
|
|
15
|
+
const refsMap = /* @__PURE__ */ new WeakMap();
|
|
16
|
+
function toRef(signal2) {
|
|
17
|
+
if (!refsMap.has(signal2)) {
|
|
18
|
+
const r = customRef((track, trigger) => {
|
|
19
|
+
effect(() => {
|
|
20
|
+
typeof signal2 === "function" ? signal2() : signal2.value;
|
|
21
|
+
trigger();
|
|
22
|
+
});
|
|
23
|
+
return {
|
|
24
|
+
get() {
|
|
25
|
+
track();
|
|
26
|
+
const value = typeof signal2 === "function" ? signal2() : signal2.value;
|
|
27
|
+
return value;
|
|
28
|
+
},
|
|
29
|
+
set(value) {
|
|
30
|
+
if (typeof signal2 === "function") {
|
|
31
|
+
throw new Error("Readonly ref");
|
|
32
|
+
}
|
|
33
|
+
signal2.value = value;
|
|
34
|
+
trigger();
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
});
|
|
38
|
+
refsMap.set(signal2, r);
|
|
39
|
+
}
|
|
40
|
+
return refsMap.get(signal2);
|
|
41
|
+
}
|
|
42
|
+
const key = Symbol();
|
|
43
|
+
const ContextProvider = defineComponent((_, { slots }) => {
|
|
44
|
+
const root = ref(null);
|
|
45
|
+
const instance = getCurrentInstance();
|
|
46
|
+
const mounted = ref(false);
|
|
47
|
+
function mount() {
|
|
48
|
+
var _a;
|
|
49
|
+
root.value = ((_a = instance.proxy) == null ? void 0 : _a.$el) ?? null;
|
|
50
|
+
mounted.value = true;
|
|
51
|
+
console.debug("vue/context-provider:ready");
|
|
52
|
+
}
|
|
53
|
+
if (instance == null ? void 0 : instance.isMounted) {
|
|
54
|
+
mount();
|
|
55
|
+
} else {
|
|
56
|
+
onMounted(mount);
|
|
57
|
+
}
|
|
58
|
+
provide(key, root);
|
|
59
|
+
return () => h(
|
|
60
|
+
"div",
|
|
61
|
+
{ class: "contents" },
|
|
62
|
+
mounted.value ? renderSlot(slots, "default") : []
|
|
63
|
+
);
|
|
64
|
+
});
|
|
65
|
+
function useProvideContextProvider(root) {
|
|
66
|
+
provide(key, root);
|
|
67
|
+
}
|
|
68
|
+
function useBlockId() {
|
|
69
|
+
const root = inject(key);
|
|
70
|
+
return computed(() => {
|
|
71
|
+
var _a;
|
|
72
|
+
if (!((_a = root == null ? void 0 : root.value) == null ? void 0 : _a.parentElement)) {
|
|
73
|
+
return null;
|
|
74
|
+
}
|
|
75
|
+
const parent = root.value.parentElement;
|
|
76
|
+
return parent.getAttribute("data-block-id");
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
function useBlockType() {
|
|
80
|
+
const root = inject(key);
|
|
81
|
+
return computed(() => {
|
|
82
|
+
var _a;
|
|
83
|
+
if (!((_a = root == null ? void 0 : root.value) == null ? void 0 : _a.parentElement)) {
|
|
84
|
+
return null;
|
|
85
|
+
}
|
|
86
|
+
const parent = root.value.parentElement;
|
|
87
|
+
return parent.getAttribute("data-block-type");
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
function useRegisterTranslationKeys() {
|
|
91
|
+
const blockId = useBlockId();
|
|
92
|
+
const blockType = useBlockType();
|
|
93
|
+
return (keys) => {
|
|
94
|
+
const id = blockId.value;
|
|
95
|
+
const type = blockType.value;
|
|
96
|
+
if (!id || !type) return;
|
|
97
|
+
if (typeof window === "undefined" || window.parent === window) return;
|
|
98
|
+
window.parent.postMessage(
|
|
99
|
+
createRegisterBlockTranslationKeysMessage({ blockId: id, blockType: type, keys }),
|
|
100
|
+
"*"
|
|
101
|
+
);
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
function useContext(context) {
|
|
105
|
+
const root = inject(key);
|
|
106
|
+
if ((root == null ? void 0 : root.value) == null) {
|
|
107
|
+
throw new Error("ContextProvider not available");
|
|
108
|
+
}
|
|
109
|
+
return wrap(injectContext(root.value, context));
|
|
110
|
+
}
|
|
111
|
+
function useProvideContext(context, init) {
|
|
112
|
+
const root = inject(key);
|
|
113
|
+
if ((root == null ? void 0 : root.value) == null) {
|
|
114
|
+
throw new Error("ContextProvider not available");
|
|
115
|
+
}
|
|
116
|
+
provideContext(root.value, context, init);
|
|
117
|
+
}
|
|
118
|
+
function wrap(obj) {
|
|
119
|
+
if (typeof obj !== "object" || obj == null) {
|
|
120
|
+
return obj;
|
|
121
|
+
}
|
|
122
|
+
return new Proxy(obj, {
|
|
123
|
+
get(target, key2) {
|
|
124
|
+
const val = target[key2];
|
|
125
|
+
if (key2 === "$") {
|
|
126
|
+
return target;
|
|
127
|
+
}
|
|
128
|
+
if (typeof val === "object" && val != null && "brand" in val) {
|
|
129
|
+
return toRef(val);
|
|
130
|
+
}
|
|
131
|
+
if (typeof val === "object" && val != null && !Array.isArray(val) && typeof val !== "function") {
|
|
132
|
+
return wrap(val);
|
|
133
|
+
}
|
|
134
|
+
return val;
|
|
135
|
+
}
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
const VueSlotWrapper = defineComponent({
|
|
139
|
+
props: ["block"],
|
|
140
|
+
render() {
|
|
141
|
+
return h("div");
|
|
142
|
+
},
|
|
143
|
+
mounted() {
|
|
144
|
+
const children = (Array.isArray(this.$props.block) ? this.$props.block : [this.$props.block]).map(
|
|
145
|
+
(block) => typeof block === "string" ? block : block.definition.render(block)
|
|
146
|
+
);
|
|
147
|
+
this.$el.replaceChildren(...children);
|
|
148
|
+
}
|
|
149
|
+
});
|
|
150
|
+
function createVueRenderer(component) {
|
|
151
|
+
function renderSlots(slots) {
|
|
152
|
+
if (!slots) {
|
|
153
|
+
return slots;
|
|
154
|
+
}
|
|
155
|
+
const renderedSlots = Object.fromEntries(
|
|
156
|
+
Object.entries(slots).map(([key2, value]) => [
|
|
157
|
+
key2,
|
|
158
|
+
// Fix slot rendering
|
|
159
|
+
typeof value === "string" ? value : h(VueSlotWrapper, { block: value })
|
|
160
|
+
])
|
|
161
|
+
);
|
|
162
|
+
return renderedSlots;
|
|
163
|
+
}
|
|
164
|
+
return (block) => {
|
|
165
|
+
const app = createApp(
|
|
166
|
+
h(ContextProvider, {}, [
|
|
167
|
+
h(component, block.props, renderSlots(block.slots))
|
|
168
|
+
])
|
|
169
|
+
);
|
|
170
|
+
const wrapper = document.createElement("div");
|
|
171
|
+
wrapper.setAttribute("data-block-id", block.id);
|
|
172
|
+
app.mount(wrapper);
|
|
173
|
+
return wrapper;
|
|
174
|
+
};
|
|
175
|
+
}
|
|
176
|
+
function createVueCeRenderer(name, component, { shadowRoot = true } = {}) {
|
|
177
|
+
if (customElements.get(name) != null) {
|
|
178
|
+
console.warn(`Custom element '${name}' already defined`);
|
|
179
|
+
return createCeRenderer(name);
|
|
180
|
+
}
|
|
181
|
+
const C = defineComponent(
|
|
182
|
+
(props, { attrs, slots }) => {
|
|
183
|
+
const root = ref(useHost());
|
|
184
|
+
const mounted = ref(false);
|
|
185
|
+
useProvideContextProvider(root);
|
|
186
|
+
setTimeout(() => {
|
|
187
|
+
mounted.value = true;
|
|
188
|
+
}, 0);
|
|
189
|
+
return () => mounted.value ? h(component, { ...props, ...attrs }, slots) : null;
|
|
190
|
+
},
|
|
191
|
+
{
|
|
192
|
+
// @ts-expect-error Untyped
|
|
193
|
+
props: component.props,
|
|
194
|
+
// @ts-expect-error Untyped
|
|
195
|
+
slots: component.slots
|
|
196
|
+
}
|
|
197
|
+
);
|
|
198
|
+
C.styles = component.styles;
|
|
199
|
+
customElements.define(name, defineCustomElement(C, { shadowRoot }));
|
|
200
|
+
return createCeRenderer(name);
|
|
201
|
+
}
|
|
202
|
+
function useTarget() {
|
|
203
|
+
var _a;
|
|
204
|
+
const instance = getCurrentInstance();
|
|
205
|
+
if (instance == null) {
|
|
206
|
+
throw new Error("No instance available");
|
|
207
|
+
}
|
|
208
|
+
const target = ref(null);
|
|
209
|
+
if (instance.isMounted) {
|
|
210
|
+
target.value = (_a = instance.proxy) == null ? void 0 : _a.$el;
|
|
211
|
+
} else {
|
|
212
|
+
onMounted(() => {
|
|
213
|
+
var _a2;
|
|
214
|
+
target.value = (_a2 = instance.proxy) == null ? void 0 : _a2.$el;
|
|
215
|
+
});
|
|
216
|
+
}
|
|
217
|
+
return target;
|
|
218
|
+
}
|
|
219
|
+
function useBridge(options) {
|
|
220
|
+
const blockId = useBlockId();
|
|
221
|
+
const editorBridge = createEditorBridge();
|
|
222
|
+
const callbackRef = ref(options.onPresetChange);
|
|
223
|
+
watchEffect(() => {
|
|
224
|
+
callbackRef.value = options.onPresetChange;
|
|
225
|
+
});
|
|
226
|
+
const isEditorMode = computed(() => blockId.value !== null);
|
|
227
|
+
watchEffect((onCleanup) => {
|
|
228
|
+
const currentBlockId = blockId.value;
|
|
229
|
+
if (!currentBlockId) return;
|
|
230
|
+
const unsub = editorBridge.onBlockPresetChange(
|
|
231
|
+
currentBlockId,
|
|
232
|
+
(preset) => {
|
|
233
|
+
callbackRef.value(preset);
|
|
234
|
+
}
|
|
235
|
+
).unsubscribe;
|
|
236
|
+
onCleanup(unsub);
|
|
237
|
+
});
|
|
238
|
+
return { isEditorMode: isEditorMode.value };
|
|
239
|
+
}
|
|
240
|
+
export {
|
|
241
|
+
ContextProvider,
|
|
242
|
+
createVueCeRenderer,
|
|
243
|
+
createVueRenderer,
|
|
244
|
+
toRef,
|
|
245
|
+
toSignal,
|
|
246
|
+
useBlockId,
|
|
247
|
+
useBlockType,
|
|
248
|
+
useBridge,
|
|
249
|
+
useContext,
|
|
250
|
+
useProvideContext,
|
|
251
|
+
useProvideContextProvider,
|
|
252
|
+
useRegisterTranslationKeys,
|
|
253
|
+
useTarget
|
|
254
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export default class Block extends HTMLElement {
|
|
2
|
+
/** @description The block name to render */
|
|
3
|
+
private name;
|
|
4
|
+
private disposeEffect?;
|
|
5
|
+
static get observedAttributes(): string[];
|
|
6
|
+
constructor();
|
|
7
|
+
connectedCallback(): void;
|
|
8
|
+
attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
|
|
9
|
+
disconnectedCallback(): void;
|
|
10
|
+
private renderBlock;
|
|
11
|
+
}
|
|
12
|
+
declare global {
|
|
13
|
+
interface HTMLElementTagNameMap {
|
|
14
|
+
"juo-block": Block;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=Block.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Block.d.ts","sourceRoot":"","sources":["../../src/web-components/Block.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,OAAO,OAAO,KAAM,SAAQ,WAAW;IAC5C,4CAA4C;IAC5C,OAAO,CAAC,IAAI,CAA+B;IAE3C,OAAO,CAAC,aAAa,CAAC,CAAa;IAEnC,MAAM,KAAK,kBAAkB,aAE5B;;IAMD,iBAAiB;IAQjB,wBAAwB,CACtB,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,MAAM,GAAG,IAAI,EACvB,QAAQ,EAAE,MAAM,GAAG,IAAI;IAOzB,oBAAoB;IAOpB,OAAO,CAAC,WAAW;CAoBpB;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,WAAW,EAAE,KAAK,CAAC;KACpB;CACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Block.test.d.ts","sourceRoot":"","sources":["../../src/web-components/Block.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export default class ExtensionRoot extends HTMLElement {
|
|
2
|
+
private state;
|
|
3
|
+
private themeState;
|
|
4
|
+
private unsubscribeThemeContext?;
|
|
5
|
+
private disposeEffect?;
|
|
6
|
+
/**
|
|
7
|
+
* Optional function to wrap each rendered block element.
|
|
8
|
+
* Called with the rendered block HTMLElement, must return an HTMLElement.
|
|
9
|
+
* When set, the wrapper sits between the editor wrapper (outer) and the actual block (inner).
|
|
10
|
+
* Must be set before blocks are first rendered; changing it afterwards has no effect
|
|
11
|
+
* on already-cached block wrappers.
|
|
12
|
+
*/
|
|
13
|
+
blockWrapper: ((rendered: HTMLElement) => HTMLElement) | null;
|
|
14
|
+
static get observedAttributes(): string[];
|
|
15
|
+
constructor();
|
|
16
|
+
private wrapperCache;
|
|
17
|
+
private withWrapper;
|
|
18
|
+
private getSurface;
|
|
19
|
+
private setStateFromThemeState;
|
|
20
|
+
connectedCallback(): void;
|
|
21
|
+
attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
|
|
22
|
+
disconnectedCallback(): void;
|
|
23
|
+
}
|
|
24
|
+
declare global {
|
|
25
|
+
interface HTMLElementTagNameMap {
|
|
26
|
+
"juo-extension-root": ExtensionRoot;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=ExtensionRoot.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ExtensionRoot.d.ts","sourceRoot":"","sources":["../../src/web-components/ExtensionRoot.ts"],"names":[],"mappings":"AAWA,MAAM,CAAC,OAAO,OAAO,aAAc,SAAQ,WAAW;IACpD,OAAO,CAAC,KAAK,CAA8B;IAC3C,OAAO,CAAC,UAAU,CAA2B;IAC7C,OAAO,CAAC,uBAAuB,CAAC,CAAa;IAC7C,OAAO,CAAC,aAAa,CAAC,CAAa;IAEnC;;;;;;OAMG;IACI,YAAY,EAAE,CAAC,CAAC,QAAQ,EAAE,WAAW,KAAK,WAAW,CAAC,GAAG,IAAI,CAAQ;IAE5E,MAAM,KAAK,kBAAkB,aAE5B;;IAMD,OAAO,CAAC,YAAY,CAGhB;IAEJ,OAAO,CAAC,WAAW;IAanB,OAAO,CAAC,UAAU;IAIlB,OAAO,CAAC,sBAAsB;IAM9B,iBAAiB;IAqDjB,wBAAwB,CACtB,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,MAAM,GAAG,IAAI,EACvB,QAAQ,EAAE,MAAM,GAAG,IAAI;IAiBzB,oBAAoB;CAWrB;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,oBAAoB,EAAE,aAAa,CAAC;KACrC;CACF"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export default class InlineText extends HTMLElement {
|
|
2
|
+
private editorBridge;
|
|
3
|
+
private translationService;
|
|
4
|
+
private propName;
|
|
5
|
+
private blockId;
|
|
6
|
+
private blockType;
|
|
7
|
+
private boundHandleBlur;
|
|
8
|
+
private boundHandlePointerDown;
|
|
9
|
+
private lastValue;
|
|
10
|
+
private dispose?;
|
|
11
|
+
static get observedAttributes(): string[];
|
|
12
|
+
constructor();
|
|
13
|
+
connectedCallback(): void;
|
|
14
|
+
private get isReadonly();
|
|
15
|
+
private initializeEditorMode;
|
|
16
|
+
private handlePointerDown;
|
|
17
|
+
private handleBlur;
|
|
18
|
+
private static injectedRoots;
|
|
19
|
+
private injectStyles;
|
|
20
|
+
private sendUpdate;
|
|
21
|
+
attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
|
|
22
|
+
disconnectedCallback(): void;
|
|
23
|
+
}
|
|
24
|
+
declare global {
|
|
25
|
+
interface HTMLElementTagNameMap {
|
|
26
|
+
"juo-text": InlineText;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=InlineText.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InlineText.d.ts","sourceRoot":"","sources":["../../../src/web-components/editor/InlineText.ts"],"names":[],"mappings":"AASA,MAAM,CAAC,OAAO,OAAO,UAAW,SAAQ,WAAW;IACjD,OAAO,CAAC,YAAY,CAAsD;IAC1E,OAAO,CAAC,kBAAkB,CAAmC;IAC7D,OAAO,CAAC,QAAQ,CAAuB;IACvC,OAAO,CAAC,OAAO,CAAuB;IACtC,OAAO,CAAC,SAAS,CAAuB;IACxC,OAAO,CAAC,eAAe,CAA8B;IACrD,OAAO,CAAC,sBAAsB,CAAqC;IACnE,OAAO,CAAC,SAAS,CAAuB;IACxC,OAAO,CAAC,OAAO,CAAC,CAAa;IAE7B,MAAM,KAAK,kBAAkB,aAE5B;;IAMD,iBAAiB;IA0CjB,OAAO,KAAK,UAAU,GAErB;IAED,OAAO,CAAC,oBAAoB;IA+C5B,OAAO,CAAC,iBAAiB;IAkBzB,OAAO,CAAC,UAAU;IAKlB,OAAO,CAAC,MAAM,CAAC,aAAa,CAAwC;IAEpE,OAAO,CAAC,YAAY;IA2BpB,OAAO,CAAC,UAAU;IA+BlB,wBAAwB,CACtB,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,MAAM,GAAG,IAAI,EACvB,QAAQ,EAAE,MAAM,GAAG,IAAI;IAOzB,oBAAoB;CAQrB;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,UAAU,EAAE,UAAU,CAAC;KACxB;CACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../../../src/web-components/editor/main.ts"],"names":[],"mappings":""}
|