@orunelle/theme-editor 0.0.0-stage → 2.0.0-alpha.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,7 @@
1
+ import { type PreviewFrameMessage, type PreviewHostMessage, type PreviewIdentity } from "@orunelle/theme-contract/preview";
2
+ export interface EditorFrameConnection {
3
+ send(message: Omit<PreviewHostMessage, "sessionId" | "documentId" | "generation" | "sequence"> & Record<string, unknown>, sequence: number): void;
4
+ close(): void;
5
+ }
6
+ export declare function connectEditorFrame(frame: HTMLIFrameElement, identity: PreviewIdentity, receive: (message: PreviewFrameMessage) => void, disconnected: (reason: "connecting" | "unavailable" | "expired") => void): EditorFrameConnection;
7
+ //# sourceMappingURL=bridge.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bridge.d.ts","sourceRoot":"","sources":["../src/bridge.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,KAAK,mBAAmB,EACxB,KAAK,kBAAkB,EACvB,KAAK,eAAe,EACrB,MAAM,kCAAkC,CAAC;AAE1C,MAAM,WAAW,qBAAqB;IACpC,IAAI,CACF,OAAO,EAAE,IAAI,CACX,kBAAkB,EAClB,WAAW,GAAG,YAAY,GAAG,YAAY,GAAG,UAAU,CACvD,GACC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACzB,QAAQ,EAAE,MAAM,GACf,IAAI,CAAC;IACR,KAAK,IAAI,IAAI,CAAC;CACf;AACD,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,iBAAiB,EACxB,QAAQ,EAAE,eAAe,EACzB,OAAO,EAAE,CAAC,OAAO,EAAE,mBAAmB,KAAK,IAAI,EAC/C,YAAY,EAAE,CAAC,MAAM,EAAE,YAAY,GAAG,aAAa,GAAG,SAAS,KAAK,IAAI,GACvE,qBAAqB,CAqHvB"}
package/dist/bridge.js ADDED
@@ -0,0 +1,108 @@
1
+ import { boundedPreviewMessage, previewBootSchema, previewFrameMessageSchema, samePreviewIdentity, } from "@orunelle/theme-contract/preview";
2
+ export function connectEditorFrame(frame, identity, receive, disconnected) {
3
+ let generation = 0, documentId = "", port, timer, closed = false, ready = false, attempts = 0, booted = false;
4
+ function connect() {
5
+ if (closed)
6
+ return;
7
+ if (closed || !frame.contentWindow || Date.now() >= identity.expiresAt) {
8
+ disconnected(Date.now() >= identity.expiresAt ? "expired" : "unavailable");
9
+ return;
10
+ }
11
+ if (++attempts > 8) {
12
+ disconnected("unavailable");
13
+ return;
14
+ }
15
+ port?.close();
16
+ const channel = new MessageChannel();
17
+ port = channel.port1;
18
+ port.onmessage = (event) => {
19
+ if (!boundedPreviewMessage(event.data))
20
+ return;
21
+ const parsed = previewFrameMessageSchema.safeParse(event.data);
22
+ if (!parsed.success)
23
+ return;
24
+ const message = parsed.data;
25
+ if (message.sessionId !== identity.sessionId ||
26
+ message.documentId !== documentId ||
27
+ message.generation !== generation ||
28
+ Date.now() >= identity.expiresAt)
29
+ return;
30
+ if (message.type === "ready") {
31
+ ready = true;
32
+ if (timer)
33
+ clearTimeout(timer);
34
+ }
35
+ receive(message);
36
+ };
37
+ frame.contentWindow.postMessage({ type: "orunelle.preview.connect", identity, documentId, generation }, "*", [channel.port2]);
38
+ timer = setTimeout(() => {
39
+ if (!ready)
40
+ connect();
41
+ }, 1000);
42
+ }
43
+ function load() {
44
+ ready = false;
45
+ if (timer)
46
+ clearTimeout(timer);
47
+ attempts = 0;
48
+ booted = false;
49
+ generation++;
50
+ documentId = crypto.randomUUID();
51
+ disconnected("connecting");
52
+ connect();
53
+ }
54
+ function boot(event) {
55
+ if (event.source !== frame.contentWindow ||
56
+ event.origin !== "null" ||
57
+ !boundedPreviewMessage(event.data))
58
+ return;
59
+ const parsed = previewBootSchema.safeParse(event.data);
60
+ if (parsed.success &&
61
+ samePreviewIdentity(parsed.data.identity, identity) &&
62
+ !ready &&
63
+ !booted) {
64
+ booted = true;
65
+ attempts = 0;
66
+ if (timer)
67
+ clearTimeout(timer);
68
+ if (!generation) {
69
+ generation = 1;
70
+ documentId = crypto.randomUUID();
71
+ }
72
+ connect();
73
+ }
74
+ }
75
+ frame.addEventListener("load", load);
76
+ window.addEventListener("message", boot);
77
+ if (frame.contentWindow)
78
+ load();
79
+ const expiry = setTimeout(() => {
80
+ ready = false;
81
+ if (timer)
82
+ clearTimeout(timer);
83
+ port?.close();
84
+ if (!closed)
85
+ disconnected("expired");
86
+ }, Math.max(0, identity.expiresAt - Date.now()));
87
+ return {
88
+ send(message, sequence) {
89
+ if (ready && Date.now() < identity.expiresAt)
90
+ port?.postMessage({
91
+ ...message,
92
+ sessionId: identity.sessionId,
93
+ documentId,
94
+ generation,
95
+ sequence,
96
+ });
97
+ },
98
+ close() {
99
+ closed = true;
100
+ if (timer)
101
+ clearTimeout(timer);
102
+ clearTimeout(expiry);
103
+ port?.close();
104
+ frame.removeEventListener("load", load);
105
+ window.removeEventListener("message", boot);
106
+ },
107
+ };
108
+ }
@@ -0,0 +1,18 @@
1
+ import { type MerchantManifest, type ThemeConfiguration } from "@orunelle/theme-contract";
2
+ export * from "./bridge.js";
3
+ export * from "./structure.js";
4
+ export declare function sameConfiguration(a: ThemeConfiguration, b: ThemeConfiguration): boolean;
5
+ export interface EditorHistory {
6
+ present: ThemeConfiguration;
7
+ past: ThemeConfiguration[];
8
+ future: ThemeConfiguration[];
9
+ coalesceKey: string;
10
+ editedAt: number;
11
+ }
12
+ export declare function createHistory(configuration: ThemeConfiguration): EditorHistory;
13
+ export declare function editHistory(history: EditorHistory, manifest: MerchantManifest, configuration: ThemeConfiguration, key?: string, now?: number): EditorHistory;
14
+ export declare function undoHistory(history: EditorHistory): EditorHistory;
15
+ export declare function redoHistory(history: EditorHistory): EditorHistory;
16
+ export * from "./save.js";
17
+ export * from "./nodes.js";
18
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,KAAK,gBAAgB,EACrB,KAAK,kBAAkB,EACxB,MAAM,0BAA0B,CAAC;AAClC,cAAc,aAAa,CAAC;AAC5B,cAAc,gBAAgB,CAAC;AAE/B,wBAAgB,iBAAiB,CAC/B,CAAC,EAAE,kBAAkB,EACrB,CAAC,EAAE,kBAAkB,GACpB,OAAO,CAET;AAED,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,kBAAkB,CAAC;IAC5B,IAAI,EAAE,kBAAkB,EAAE,CAAC;IAC3B,MAAM,EAAE,kBAAkB,EAAE,CAAC;IAC7B,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;CAClB;AACD,wBAAgB,aAAa,CAC3B,aAAa,EAAE,kBAAkB,GAChC,aAAa,CAQf;AACD,wBAAgB,WAAW,CACzB,OAAO,EAAE,aAAa,EACtB,QAAQ,EAAE,gBAAgB,EAC1B,aAAa,EAAE,kBAAkB,EACjC,GAAG,SAAK,EACR,GAAG,SAAa,GACf,aAAa,CA4Bf;AACD,wBAAgB,WAAW,CAAC,OAAO,EAAE,aAAa,GAAG,aAAa,CAWjE;AACD,wBAAgB,WAAW,CAAC,OAAO,EAAE,aAAa,GAAG,aAAa,CAWjE;AACD,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,62 @@
1
+ import { canonicalPreviewJson } from "@orunelle/theme-contract/preview";
2
+ import { validateConfiguration, } from "@orunelle/theme-contract";
3
+ export * from "./bridge.js";
4
+ export * from "./structure.js";
5
+ export function sameConfiguration(a, b) {
6
+ return canonicalPreviewJson(a) === canonicalPreviewJson(b);
7
+ }
8
+ export function createHistory(configuration) {
9
+ return {
10
+ present: structuredClone(configuration),
11
+ past: [],
12
+ future: [],
13
+ coalesceKey: "",
14
+ editedAt: 0,
15
+ };
16
+ }
17
+ export function editHistory(history, manifest, configuration, key = "", now = Date.now()) {
18
+ const issue = validateConfiguration(manifest, configuration, history.present.installationId);
19
+ if (issue)
20
+ throw new Error(`${issue.code}: ${issue.path}`);
21
+ if (sameConfiguration(configuration, history.present))
22
+ return history;
23
+ const coalesce = key && key === history.coalesceKey && now - history.editedAt < 700;
24
+ let past = coalesce ? history.past : [...history.past, history.present];
25
+ while (past.length > 40 ||
26
+ past.reduce((bytes, snapshot) => bytes + new TextEncoder().encode(JSON.stringify(snapshot)).length, 0) >
27
+ 8 * 1024 * 1024)
28
+ past = past.slice(1);
29
+ return {
30
+ present: structuredClone(configuration),
31
+ past,
32
+ future: [],
33
+ coalesceKey: key,
34
+ editedAt: now,
35
+ };
36
+ }
37
+ export function undoHistory(history) {
38
+ const previous = history.past.at(-1);
39
+ return previous
40
+ ? {
41
+ present: previous,
42
+ past: history.past.slice(0, -1),
43
+ future: [history.present, ...history.future],
44
+ coalesceKey: "",
45
+ editedAt: 0,
46
+ }
47
+ : history;
48
+ }
49
+ export function redoHistory(history) {
50
+ const next = history.future[0];
51
+ return next
52
+ ? {
53
+ present: next,
54
+ past: [...history.past, history.present],
55
+ future: history.future.slice(1),
56
+ coalesceKey: "",
57
+ editedAt: 0,
58
+ }
59
+ : history;
60
+ }
61
+ export * from "./save.js";
62
+ export * from "./nodes.js";
@@ -0,0 +1,8 @@
1
+ import { type ConfigurationTemplate, type MerchantManifest, type NodeDestination, type ThemeConfiguration, type SettingValues } from "@orunelle/theme-contract";
2
+ /**
3
+ * Adds a node at the destination. With a preset index, the node starts from that
4
+ * preset's settings and block subtree; explicit `settings` still win.
5
+ */
6
+ export declare function addThemeNode(manifest: MerchantManifest, input: ThemeConfiguration, type: string, destination: NodeDestination, settings?: SettingValues, presetIndex?: number): ThemeConfiguration;
7
+ export declare function inheritComposition(manifest: MerchantManifest, input: ThemeConfiguration, defaults: ConfigurationTemplate, kind: "group" | "template", id: string): ThemeConfiguration;
8
+ //# sourceMappingURL=nodes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"nodes.d.ts","sourceRoot":"","sources":["../src/nodes.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,qBAAqB,EAC1B,KAAK,gBAAgB,EACrB,KAAK,eAAe,EACpB,KAAK,kBAAkB,EAEvB,KAAK,aAAa,EAEnB,MAAM,0BAA0B,CAAC;AAClC;;;GAGG;AACH,wBAAgB,YAAY,CAC1B,QAAQ,EAAE,gBAAgB,EAC1B,KAAK,EAAE,kBAAkB,EACzB,IAAI,EAAE,MAAM,EACZ,WAAW,EAAE,eAAe,EAC5B,QAAQ,GAAE,aAAkB,EAC5B,WAAW,CAAC,EAAE,MAAM,GACnB,kBAAkB,CA6DpB;AACD,wBAAgB,kBAAkB,CAChC,QAAQ,EAAE,gBAAgB,EAC1B,KAAK,EAAE,kBAAkB,EACzB,QAAQ,EAAE,qBAAqB,EAC/B,IAAI,EAAE,OAAO,GAAG,UAAU,EAC1B,EAAE,EAAE,MAAM,GACT,kBAAkB,CA0BpB"}
package/dist/nodes.js ADDED
@@ -0,0 +1,83 @@
1
+ import { validateConfiguration, } from "@orunelle/theme-contract";
2
+ /**
3
+ * Adds a node at the destination. With a preset index, the node starts from that
4
+ * preset's settings and block subtree; explicit `settings` still win.
5
+ */
6
+ export function addThemeNode(manifest, input, type, destination, settings = {}, presetIndex) {
7
+ const next = structuredClone(input), definitions = manifest.editor?.nodeTypes ?? {};
8
+ const preset = presetIndex === undefined
9
+ ? undefined
10
+ : definitions[type]?.presets?.[presetIndex];
11
+ if (presetIndex !== undefined && !preset)
12
+ throw new Error("Unknown preset");
13
+ function create(kind, parent, depth, blocks) {
14
+ const definition = definitions[kind];
15
+ if (!definition || depth > 8)
16
+ throw new Error("Cannot create the required child structure");
17
+ const node = {
18
+ id: crypto.randomUUID(),
19
+ type: kind,
20
+ parent,
21
+ children: [],
22
+ settings: {},
23
+ };
24
+ next.nodes.push(node);
25
+ if (blocks) {
26
+ for (const block of blocks) {
27
+ const child = create(block.type, node.id, depth + 1, block.blocks ?? []);
28
+ child.settings = structuredClone(block.settings ?? {});
29
+ node.children.push(child.id);
30
+ }
31
+ return node;
32
+ }
33
+ for (let i = 0; i < (definition.minChildren ?? 0); i++) {
34
+ const childType = definition.allowedChildren[0];
35
+ if (!childType)
36
+ throw new Error("Missing required child type");
37
+ node.children.push(create(childType, node.id, depth + 1).id);
38
+ }
39
+ return node;
40
+ }
41
+ const parent = destination.kind === "node"
42
+ ? next.nodes.find((node) => node.id === destination.id)
43
+ : undefined;
44
+ const node = create(type, parent?.id ?? null, 0, preset ? (preset.blocks ?? []) : undefined);
45
+ node.settings = structuredClone({ ...preset?.settings, ...settings });
46
+ const list = parent?.children ??
47
+ (next[destination.kind === "group" ? "groups" : "templates"][destination.id] ??= { roots: [] }).roots;
48
+ list.splice(destination.index, 0, node.id);
49
+ const issue = validateConfiguration(manifest, next, input.installationId);
50
+ if (issue)
51
+ throw new Error(`${issue.code}: ${issue.path}`);
52
+ return next;
53
+ }
54
+ export function inheritComposition(manifest, input, defaults, kind, id) {
55
+ const next = structuredClone(input), key = kind === "group" ? "groups" : "templates";
56
+ if (Object.hasOwn(next[key], id))
57
+ return next;
58
+ const source = defaults[key][id];
59
+ if (!source)
60
+ throw new Error("No default composition is available");
61
+ const remap = new Map();
62
+ function copy(id, parent) {
63
+ const source = defaults.nodes.find((node) => node.id === id);
64
+ if (!source)
65
+ throw new Error("Missing inherited node");
66
+ const replacement = crypto.randomUUID();
67
+ remap.set(id, replacement);
68
+ const node = {
69
+ ...structuredClone(source),
70
+ id: replacement,
71
+ parent,
72
+ children: [],
73
+ };
74
+ next.nodes.push(node);
75
+ node.children = source.children.map((child) => copy(child, replacement));
76
+ return replacement;
77
+ }
78
+ next[key][id] = { roots: source.roots.map((root) => copy(root, null)) };
79
+ const issue = validateConfiguration(manifest, next, input.installationId);
80
+ if (issue)
81
+ throw new Error(`${issue.code}: ${issue.path}`);
82
+ return next;
83
+ }
package/dist/save.d.ts ADDED
@@ -0,0 +1,15 @@
1
+ import { type MerchantManifest, type ThemeConfiguration } from "@orunelle/theme-contract";
2
+ export interface DraftSave {
3
+ requestKey: string;
4
+ expectedRevision: number;
5
+ configuration: ThemeConfiguration;
6
+ }
7
+ export interface DraftRecovery {
8
+ revision: number;
9
+ configuration: ThemeConfiguration;
10
+ pending?: DraftSave;
11
+ }
12
+ export declare function recoveryKey(actor: string, store: string, installation: string): string;
13
+ export declare function readRecovery(raw: string | null, manifest: MerchantManifest, installation: string): DraftRecovery | undefined;
14
+ export declare function prepareSave(revision: number, configuration: ThemeConfiguration, pending?: DraftSave): DraftSave;
15
+ //# sourceMappingURL=save.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"save.d.ts","sourceRoot":"","sources":["../src/save.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,gBAAgB,EACrB,KAAK,kBAAkB,EACxB,MAAM,0BAA0B,CAAC;AAClC,MAAM,WAAW,SAAS;IACxB,UAAU,EAAE,MAAM,CAAC;IACnB,gBAAgB,EAAE,MAAM,CAAC;IACzB,aAAa,EAAE,kBAAkB,CAAC;CACnC;AACD,MAAM,WAAW,aAAa;IAC5B,QAAQ,EAAE,MAAM,CAAC;IACjB,aAAa,EAAE,kBAAkB,CAAC;IAClC,OAAO,CAAC,EAAE,SAAS,CAAC;CACrB;AACD,wBAAgB,WAAW,CACzB,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,MAAM,EACb,YAAY,EAAE,MAAM,UAGrB;AACD,wBAAgB,YAAY,CAC1B,GAAG,EAAE,MAAM,GAAG,IAAI,EAClB,QAAQ,EAAE,gBAAgB,EAC1B,YAAY,EAAE,MAAM,GACnB,aAAa,GAAG,SAAS,CA0B3B;AACD,wBAAgB,WAAW,CACzB,QAAQ,EAAE,MAAM,EAChB,aAAa,EAAE,kBAAkB,EACjC,OAAO,CAAC,EAAE,SAAS,GAClB,SAAS,CAQX"}
package/dist/save.js ADDED
@@ -0,0 +1,32 @@
1
+ import { validateConfiguration, } from "@orunelle/theme-contract";
2
+ export function recoveryKey(actor, store, installation) {
3
+ return `orunelle.theme.v2:${actor}:${store}:${installation}`;
4
+ }
5
+ export function readRecovery(raw, manifest, installation) {
6
+ if (!raw || new TextEncoder().encode(raw).length > 450000)
7
+ return;
8
+ try {
9
+ const value = JSON.parse(raw);
10
+ if (!Number.isSafeInteger(value.revision) ||
11
+ value.revision < 1 ||
12
+ validateConfiguration(manifest, value.configuration, installation))
13
+ return;
14
+ if (value.pending &&
15
+ (!/^[a-f0-9-]{36}$/.test(value.pending.requestKey) ||
16
+ !Number.isSafeInteger(value.pending.expectedRevision) ||
17
+ value.pending.expectedRevision < 1 ||
18
+ validateConfiguration(manifest, value.pending.configuration, installation)))
19
+ return;
20
+ return value;
21
+ }
22
+ catch {
23
+ return;
24
+ }
25
+ }
26
+ export function prepareSave(revision, configuration, pending) {
27
+ return (pending ?? {
28
+ requestKey: crypto.randomUUID(),
29
+ expectedRevision: revision,
30
+ configuration: structuredClone(configuration),
31
+ });
32
+ }
@@ -0,0 +1,9 @@
1
+ import { type MerchantManifest, type NodeDestination, type ThemeConfiguration } from "@orunelle/theme-contract";
2
+ export declare function nodeOwner(configuration: ThemeConfiguration, id: string): {
3
+ kind: "node" | "group" | "template";
4
+ id: string;
5
+ roots: string[];
6
+ } | undefined;
7
+ export declare function nodeAncestors(configuration: ThemeConfiguration, id: string): string[];
8
+ export declare function dropDestination(manifest: MerchantManifest, configuration: ThemeConfiguration, source: string, target: string, after?: boolean): NodeDestination | undefined;
9
+ //# sourceMappingURL=structure.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"structure.d.ts","sourceRoot":"","sources":["../src/structure.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,gBAAgB,EACrB,KAAK,eAAe,EACpB,KAAK,kBAAkB,EACxB,MAAM,0BAA0B,CAAC;AAClC,wBAAgB,SAAS,CACvB,aAAa,EAAE,kBAAkB,EACjC,EAAE,EAAE,MAAM,GAER;IAAE,IAAI,EAAE,MAAM,GAAG,OAAO,GAAG,UAAU,CAAC;IAAC,EAAE,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,EAAE,CAAA;CAAE,GACpE,SAAS,CAgBZ;AACD,wBAAgB,aAAa,CAC3B,aAAa,EAAE,kBAAkB,EACjC,EAAE,EAAE,MAAM,GACT,MAAM,EAAE,CAQV;AACD,wBAAgB,eAAe,CAC7B,QAAQ,EAAE,gBAAgB,EAC1B,aAAa,EAAE,kBAAkB,EACjC,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,EACd,KAAK,UAAQ,GACZ,eAAe,GAAG,SAAS,CAgC7B"}
@@ -0,0 +1,60 @@
1
+ import { moveNode, } from "@orunelle/theme-contract";
2
+ export function nodeOwner(configuration, id) {
3
+ const node = configuration.nodes.find((n) => n.id === id);
4
+ if (!node)
5
+ return undefined;
6
+ if (node.parent) {
7
+ const parent = configuration.nodes.find((n) => n.id === node.parent);
8
+ return parent
9
+ ? { kind: "node", id: parent.id, roots: parent.children }
10
+ : undefined;
11
+ }
12
+ for (const kind of ["group", "template"])
13
+ for (const [key, entry] of Object.entries(configuration[kind === "group" ? "groups" : "templates"]))
14
+ if (entry.roots.includes(id))
15
+ return { kind, id: key, roots: entry.roots };
16
+ return undefined;
17
+ }
18
+ export function nodeAncestors(configuration, id) {
19
+ const result = [];
20
+ let node = configuration.nodes.find((n) => n.id === id);
21
+ while (node?.parent && result.length < 8) {
22
+ result.unshift(node.parent);
23
+ node = configuration.nodes.find((n) => n.id === node.parent);
24
+ }
25
+ return result;
26
+ }
27
+ export function dropDestination(manifest, configuration, source, target, after = false) {
28
+ if (source === target)
29
+ return undefined;
30
+ const parent = configuration.nodes.find((n) => n.id === target), child = configuration.nodes.find((n) => n.id === source);
31
+ if (!parent || !child)
32
+ return undefined;
33
+ const definition = manifest.editor?.nodeTypes[parent.type];
34
+ const candidate = definition?.allowedChildren.includes(child.type)
35
+ ? {
36
+ kind: "node",
37
+ id: target,
38
+ index: parent.children.filter((id) => id !== source).length,
39
+ }
40
+ : (() => {
41
+ const owner = nodeOwner(configuration, target);
42
+ return owner
43
+ ? {
44
+ kind: owner.kind,
45
+ id: owner.id,
46
+ index: owner.roots.filter((id) => id !== source).indexOf(target) +
47
+ (after ? 1 : 0),
48
+ }
49
+ : undefined;
50
+ })();
51
+ if (!candidate)
52
+ return undefined;
53
+ try {
54
+ moveNode(manifest, configuration, source, candidate);
55
+ return candidate;
56
+ }
57
+ catch {
58
+ return undefined;
59
+ }
60
+ }
package/package.json CHANGED
@@ -1,6 +1,36 @@
1
1
  {
2
2
  "name": "@orunelle/theme-editor",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "version": "2.0.0-alpha.14",
4
+ "description": "Orunelle theme editor bridge for the merchant theme editor",
5
+ "license": "UNLICENSED",
6
+ "homepage": "https://orunelle.com",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "git+https://github.com/Orunelle/frontend.git",
10
+ "directory": "packages/theme-editor"
11
+ },
12
+ "publishConfig": {
13
+ "access": "public",
14
+ "tag": "alpha"
15
+ },
16
+ "type": "module",
17
+ "files": [
18
+ "dist"
19
+ ],
20
+ "exports": {
21
+ ".": {
22
+ "types": "./dist/index.d.ts",
23
+ "import": "./dist/index.js"
24
+ }
25
+ },
26
+ "dependencies": {
27
+ "@orunelle/theme-contract": "2.0.0-alpha.14"
28
+ },
29
+ "devDependencies": {
30
+ "typescript": "5.9.3"
31
+ },
32
+ "scripts": {
33
+ "build": "tsc",
34
+ "typecheck": "tsc --noEmit"
35
+ }
6
36
  }
package/README.md DELETED
@@ -1,3 +0,0 @@
1
- # Temporary Holding Version
2
-
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.