@italone/solace 0.0.1

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,8 @@
1
+ 'use strict';
2
+
3
+ var devtools = require('./index-rtpmWox-.cjs');
4
+
5
+
6
+
7
+ exports.createDevtoolsRecorder = devtools.createDevtoolsRecorder;
8
+ exports.onDevtoolsEvent = devtools.onDevtoolsEvent;
@@ -0,0 +1,54 @@
1
+ type DevtoolsEvent = {
2
+ type: "component:mount";
3
+ id: number;
4
+ name: string;
5
+ } | {
6
+ type: "component:update";
7
+ id: number;
8
+ name: string;
9
+ } | {
10
+ type: "component:unmount";
11
+ id: number;
12
+ name: string;
13
+ } | {
14
+ type: "component:emit";
15
+ id: number;
16
+ name: string;
17
+ event: string;
18
+ handlerCount: number;
19
+ } | {
20
+ type: "scheduler:flush";
21
+ queuedJobs: number;
22
+ dedupedJobs: number;
23
+ durationMs: number;
24
+ } | {
25
+ type: "reactivity:trigger";
26
+ targetType: string;
27
+ keyType: string;
28
+ effectCount: number;
29
+ scheduledEffects: number;
30
+ runEffects: number;
31
+ } | {
32
+ type: "renderer:element";
33
+ operation: "mount" | "update" | "unmount";
34
+ tag: string;
35
+ } | {
36
+ type: "store:action";
37
+ name: string;
38
+ status: "success" | "error";
39
+ durationMs: number;
40
+ };
41
+ type DevtoolsEventListener = (event: DevtoolsEvent) => void;
42
+ interface DevtoolsRecorderOptions {
43
+ limit?: number;
44
+ }
45
+ interface DevtoolsRecorder {
46
+ clear(): void;
47
+ snapshot(): DevtoolsEvent[];
48
+ stop(): void;
49
+ }
50
+ declare function onDevtoolsEvent(listener: DevtoolsEventListener): () => void;
51
+ declare function createDevtoolsRecorder(options?: DevtoolsRecorderOptions): DevtoolsRecorder;
52
+
53
+ export { createDevtoolsRecorder, onDevtoolsEvent };
54
+ export type { DevtoolsEvent, DevtoolsEventListener, DevtoolsRecorder, DevtoolsRecorderOptions };
@@ -0,0 +1 @@
1
+ export { c as createDevtoolsRecorder, o as onDevtoolsEvent } from './index-CkECgTuy.js';
@@ -0,0 +1,53 @@
1
+ var ShapeFlags;
2
+ (function (ShapeFlags) {
3
+ ShapeFlags[ShapeFlags["ELEMENT"] = 1] = "ELEMENT";
4
+ ShapeFlags[ShapeFlags["TEXT_CHILDREN"] = 2] = "TEXT_CHILDREN";
5
+ ShapeFlags[ShapeFlags["ARRAY_CHILDREN"] = 4] = "ARRAY_CHILDREN";
6
+ ShapeFlags[ShapeFlags["COMPONENT"] = 8] = "COMPONENT";
7
+ ShapeFlags[ShapeFlags["FRAGMENT"] = 16] = "FRAGMENT";
8
+ })(ShapeFlags || (ShapeFlags = {}));
9
+
10
+ const Fragment = Symbol("Solace.Fragment");
11
+ function createVNode(type, props = null, children = null) {
12
+ let shapeFlag = getShapeFlag(type);
13
+ if (typeof children === "string") {
14
+ shapeFlag |= ShapeFlags.TEXT_CHILDREN;
15
+ }
16
+ else if (Array.isArray(children)) {
17
+ shapeFlag |= ShapeFlags.ARRAY_CHILDREN;
18
+ }
19
+ else if (children !== null && !isVNodeSlots(children)) {
20
+ children = [children];
21
+ shapeFlag |= ShapeFlags.ARRAY_CHILDREN;
22
+ }
23
+ return {
24
+ type,
25
+ props,
26
+ key: normalizeKey(props?.key),
27
+ children,
28
+ shapeFlag,
29
+ el: null,
30
+ component: null,
31
+ };
32
+ }
33
+ function getShapeFlag(type) {
34
+ if (type === Fragment) {
35
+ return ShapeFlags.FRAGMENT;
36
+ }
37
+ return typeof type === "string" ? ShapeFlags.ELEMENT : ShapeFlags.COMPONENT;
38
+ }
39
+ function normalizeKey(key) {
40
+ return typeof key === "string" || typeof key === "number" ? key : null;
41
+ }
42
+ function isVNodeSlots(children) {
43
+ return (children !== null &&
44
+ typeof children === "object" &&
45
+ !Array.isArray(children) &&
46
+ !("type" in children));
47
+ }
48
+
49
+ function h(type, props = null, children = null) {
50
+ return createVNode(type, props, children);
51
+ }
52
+
53
+ export { Fragment as F, ShapeFlags as S, h };
@@ -0,0 +1,56 @@
1
+ 'use strict';
2
+
3
+ exports.ShapeFlags = void 0;
4
+ (function (ShapeFlags) {
5
+ ShapeFlags[ShapeFlags["ELEMENT"] = 1] = "ELEMENT";
6
+ ShapeFlags[ShapeFlags["TEXT_CHILDREN"] = 2] = "TEXT_CHILDREN";
7
+ ShapeFlags[ShapeFlags["ARRAY_CHILDREN"] = 4] = "ARRAY_CHILDREN";
8
+ ShapeFlags[ShapeFlags["COMPONENT"] = 8] = "COMPONENT";
9
+ ShapeFlags[ShapeFlags["FRAGMENT"] = 16] = "FRAGMENT";
10
+ })(exports.ShapeFlags || (exports.ShapeFlags = {}));
11
+
12
+ const Fragment = Symbol("Solace.Fragment");
13
+ function createVNode(type, props = null, children = null) {
14
+ let shapeFlag = getShapeFlag(type);
15
+ if (typeof children === "string") {
16
+ shapeFlag |= exports.ShapeFlags.TEXT_CHILDREN;
17
+ }
18
+ else if (Array.isArray(children)) {
19
+ shapeFlag |= exports.ShapeFlags.ARRAY_CHILDREN;
20
+ }
21
+ else if (children !== null && !isVNodeSlots(children)) {
22
+ children = [children];
23
+ shapeFlag |= exports.ShapeFlags.ARRAY_CHILDREN;
24
+ }
25
+ return {
26
+ type,
27
+ props,
28
+ key: normalizeKey(props?.key),
29
+ children,
30
+ shapeFlag,
31
+ el: null,
32
+ component: null,
33
+ };
34
+ }
35
+ function getShapeFlag(type) {
36
+ if (type === Fragment) {
37
+ return exports.ShapeFlags.FRAGMENT;
38
+ }
39
+ return typeof type === "string" ? exports.ShapeFlags.ELEMENT : exports.ShapeFlags.COMPONENT;
40
+ }
41
+ function normalizeKey(key) {
42
+ return typeof key === "string" || typeof key === "number" ? key : null;
43
+ }
44
+ function isVNodeSlots(children) {
45
+ return (children !== null &&
46
+ typeof children === "object" &&
47
+ !Array.isArray(children) &&
48
+ !("type" in children));
49
+ }
50
+
51
+ function h(type, props = null, children = null) {
52
+ return createVNode(type, props, children);
53
+ }
54
+
55
+ exports.Fragment = Fragment;
56
+ exports.h = h;
@@ -0,0 +1,91 @@
1
+ const listeners = new Set();
2
+ function onDevtoolsEvent(listener) {
3
+ listeners.add(listener);
4
+ return () => {
5
+ listeners.delete(listener);
6
+ };
7
+ }
8
+ function emitDevtoolsEvent(event) {
9
+ for (const listener of listeners) {
10
+ try {
11
+ listener(event);
12
+ }
13
+ catch (error) {
14
+ console.error("Solace DevTools listener failed", error);
15
+ }
16
+ }
17
+ }
18
+ function hasDevtoolsListeners() {
19
+ return listeners.size > 0;
20
+ }
21
+ function createDevtoolsRecorder(options = {}) {
22
+ const { limit } = options;
23
+ if (limit !== undefined && (!Number.isInteger(limit) || limit < 1)) {
24
+ throw new Error("DevTools recorder limit must be a positive integer");
25
+ }
26
+ const events = [];
27
+ const unsubscribe = onDevtoolsEvent((event) => {
28
+ events.push(serializeDevtoolsEvent(event));
29
+ if (limit !== undefined && events.length > limit) {
30
+ events.splice(0, events.length - limit);
31
+ }
32
+ });
33
+ return {
34
+ clear: () => {
35
+ events.length = 0;
36
+ },
37
+ snapshot: () => [...events],
38
+ stop: unsubscribe,
39
+ };
40
+ }
41
+ function serializeDevtoolsEvent(event) {
42
+ switch (event.type) {
43
+ case "component:mount":
44
+ case "component:update":
45
+ case "component:unmount":
46
+ return {
47
+ type: event.type,
48
+ id: event.id,
49
+ name: event.name,
50
+ };
51
+ case "component:emit":
52
+ return {
53
+ type: event.type,
54
+ id: event.id,
55
+ name: event.name,
56
+ event: event.event,
57
+ handlerCount: event.handlerCount,
58
+ };
59
+ case "scheduler:flush":
60
+ return {
61
+ type: event.type,
62
+ queuedJobs: event.queuedJobs,
63
+ dedupedJobs: event.dedupedJobs,
64
+ durationMs: event.durationMs,
65
+ };
66
+ case "reactivity:trigger":
67
+ return {
68
+ type: event.type,
69
+ targetType: event.targetType,
70
+ keyType: event.keyType,
71
+ effectCount: event.effectCount,
72
+ scheduledEffects: event.scheduledEffects,
73
+ runEffects: event.runEffects,
74
+ };
75
+ case "renderer:element":
76
+ return {
77
+ type: event.type,
78
+ operation: event.operation,
79
+ tag: event.tag,
80
+ };
81
+ case "store:action":
82
+ return {
83
+ type: event.type,
84
+ name: event.name,
85
+ status: event.status,
86
+ durationMs: event.durationMs,
87
+ };
88
+ }
89
+ }
90
+
91
+ export { createDevtoolsRecorder as c, emitDevtoolsEvent as e, hasDevtoolsListeners as h, onDevtoolsEvent as o };
@@ -0,0 +1,96 @@
1
+ 'use strict';
2
+
3
+ const listeners = new Set();
4
+ function onDevtoolsEvent(listener) {
5
+ listeners.add(listener);
6
+ return () => {
7
+ listeners.delete(listener);
8
+ };
9
+ }
10
+ function emitDevtoolsEvent(event) {
11
+ for (const listener of listeners) {
12
+ try {
13
+ listener(event);
14
+ }
15
+ catch (error) {
16
+ console.error("Solace DevTools listener failed", error);
17
+ }
18
+ }
19
+ }
20
+ function hasDevtoolsListeners() {
21
+ return listeners.size > 0;
22
+ }
23
+ function createDevtoolsRecorder(options = {}) {
24
+ const { limit } = options;
25
+ if (limit !== undefined && (!Number.isInteger(limit) || limit < 1)) {
26
+ throw new Error("DevTools recorder limit must be a positive integer");
27
+ }
28
+ const events = [];
29
+ const unsubscribe = onDevtoolsEvent((event) => {
30
+ events.push(serializeDevtoolsEvent(event));
31
+ if (limit !== undefined && events.length > limit) {
32
+ events.splice(0, events.length - limit);
33
+ }
34
+ });
35
+ return {
36
+ clear: () => {
37
+ events.length = 0;
38
+ },
39
+ snapshot: () => [...events],
40
+ stop: unsubscribe,
41
+ };
42
+ }
43
+ function serializeDevtoolsEvent(event) {
44
+ switch (event.type) {
45
+ case "component:mount":
46
+ case "component:update":
47
+ case "component:unmount":
48
+ return {
49
+ type: event.type,
50
+ id: event.id,
51
+ name: event.name,
52
+ };
53
+ case "component:emit":
54
+ return {
55
+ type: event.type,
56
+ id: event.id,
57
+ name: event.name,
58
+ event: event.event,
59
+ handlerCount: event.handlerCount,
60
+ };
61
+ case "scheduler:flush":
62
+ return {
63
+ type: event.type,
64
+ queuedJobs: event.queuedJobs,
65
+ dedupedJobs: event.dedupedJobs,
66
+ durationMs: event.durationMs,
67
+ };
68
+ case "reactivity:trigger":
69
+ return {
70
+ type: event.type,
71
+ targetType: event.targetType,
72
+ keyType: event.keyType,
73
+ effectCount: event.effectCount,
74
+ scheduledEffects: event.scheduledEffects,
75
+ runEffects: event.runEffects,
76
+ };
77
+ case "renderer:element":
78
+ return {
79
+ type: event.type,
80
+ operation: event.operation,
81
+ tag: event.tag,
82
+ };
83
+ case "store:action":
84
+ return {
85
+ type: event.type,
86
+ name: event.name,
87
+ status: event.status,
88
+ durationMs: event.durationMs,
89
+ };
90
+ }
91
+ }
92
+
93
+ exports.createDevtoolsRecorder = createDevtoolsRecorder;
94
+ exports.emitDevtoolsEvent = emitDevtoolsEvent;
95
+ exports.hasDevtoolsListeners = hasDevtoolsListeners;
96
+ exports.onDevtoolsEvent = onDevtoolsEvent;