@adobe/uix-core 0.6.3
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/LICENSE +201 -0
- package/README.md +1 -0
- package/dist/debug-emitter.d.ts +25 -0
- package/dist/debug-emitter.d.ts.map +1 -0
- package/dist/debuglog.d.ts +70 -0
- package/dist/debuglog.d.ts.map +1 -0
- package/dist/emitter.d.ts +62 -0
- package/dist/emitter.d.ts.map +1 -0
- package/dist/esm/index.js +259 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +266 -0
- package/dist/index.js.map +1 -0
- package/dist/namespace-proxy.d.ts +32 -0
- package/dist/namespace-proxy.d.ts.map +1 -0
- package/dist/timeout-promise.d.ts +12 -0
- package/dist/timeout-promise.d.ts.map +1 -0
- package/dist/types.d.ts +177 -0
- package/dist/types.d.ts.map +1 -0
- package/package.json +36 -0
- package/src/debug-emitter.ts +83 -0
- package/src/debuglog.ts +284 -0
- package/src/emitter.ts +90 -0
- package/src/index.ts +23 -0
- package/src/namespace-proxy.ts +82 -0
- package/src/timeout-promise.ts +36 -0
- package/src/types.ts +224 -0
- package/tsconfig.json +14 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/debuglog.ts","../../src/debug-emitter.ts","../../src/emitter.ts","../../src/namespace-proxy.ts","../../src/timeout-promise.ts"],"names":["target"],"mappings":";AAmBA,IAAM,aAAa,MACjB,OAAO,OAAO,eAAe,cAC7B,OAAO,WAAW,8BAA8B,EAAE;AAuBpD,IAAM,UAAkC;AAAA,EACtC,QAAQ;AAAA,IACN,MAAM;AAAA,IACN,MAAM;AAAA,IACN,SAAS;AAAA,IACT,UAAU;AAAA,IACV,UAAU;AAAA,EACZ;AAAA,EACA,OAAO;AAAA,IACL,MAAM;AAAA,IACN,MAAM;AAAA,IACN,SAAS;AAAA,IACT,UAAU;AAAA,IACV,UAAU;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M,IAAI;AAAA,UACR,2BAA2B,OAAO,IAAI;AAAA,QACxC;AAAA,MACF;AAAA,IACF;AAAA,EACF;AACA,QAAM,SAAS,CAAC;AAGhB,MAAI,KAAK,SAAS,GAAG;AACnB,WAAO,IAAI,MAAkC,QAAQ,OAAO;AAAA,EAC9D;AACA,QAAM,UAAU,IAAI,SAClB,OAAO;AAAA,IACL,MAAM,KAAK,MAAM,GAAG,EAAE;AAAA,IACtB,MAAM,KAAK,KAAK,SAAS;AAAA,IACzB;AAAA,EACF,CAAC;AACH,SAAO,IAAI,MAAsB,SAAS;AAAA,IACxC,GAAG;AAAA,IACH,MAAMA,SAAQ,GAAG,MAAiB;AAChC,aAAOA,QAAO,GAAG,IAAI;AAAA,IACvB;AAAA,EACF,CAAC;AACH;;;AC3DO,SAAS,eAAkB,WAAmB,SAAqB;AACxE,SAAO,IAAI,QAAQ,CAAC,SAAS,WAAW;AACtC,UAAM,UAAU;AAAA,MACd,MAAM,OAAO,IAAI,MAAM,mBAAmB,aAAa,CAAC;AAAA,MACxD;AAAA,IACF;AACA,YACG,KAAK,CAAC,WAAW;AAChB,mBAAa,OAAO;AACpB,cAAQ,MAAM;AAAA,IAChB,CAAC,EACA,MAAM,MAAM;AAAA,EACjB,CAAC;AACH","sourcesContent":["/*\nCopyright 2022 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\n/**\n * Fancy looking console decorator.\n * @hidden\n * @internal\n */\n\n/** @internal */\nconst isDarkMode = () =>\n typeof window.matchMedia === \"function\" &&\n window.matchMedia(\"(prefers-color-scheme: dark)\").matches;\n\n/** @internal */\ntype Layout = {\n padX: number;\n padY: number;\n rounded: number;\n fontSize: number;\n emphasis: Style;\n};\n/** @internal */\ntype HexColor = `#${string}` | \"transparent\";\n/** @internal */\ntype Color = {\n text: HexColor;\n bg: HexColor;\n hilight: HexColor;\n shadow: HexColor;\n};\n/** @internal */\ntype ThemeSpec = Color & Layout;\n\n/** @internal */\nconst Layouts: Record<string, Layout> = {\n medium: {\n padX: 5,\n padY: 3,\n rounded: 4,\n fontSize: 100,\n emphasis: \"font-weight: bold;\",\n },\n small: {\n padX: 3,\n padY: 1,\n rounded: 2,\n fontSize: 95,\n emphasis: \"font-style: italic;\",\n },\n};\n\n/** @internal */\nconst Colors: Record<string, Color> = {\n yellow: {\n text: \"#333333\",\n bg: \"#EBD932\",\n hilight: \"#F7E434\",\n shadow: \"#D1C12C\",\n },\n green: {\n text: \"#333333\",\n bg: \"#96EB5E\",\n hilight: \"#9EF763\",\n shadow: \"#85D154\",\n },\n blue: {\n text: \"#333333\",\n bg: \"#8DD0EB\",\n hilight: \"#88F0F7\",\n shadow: \"#74AED4\",\n },\n gray: isDarkMode()\n ? {\n text: \"#eeeeee\",\n bg: \"transparent\",\n hilight: \"#cecece\",\n shadow: \"#cecece\",\n }\n : {\n text: \"#333333\",\n bg: \"#eeeeee\",\n hilight: \"#f6f6f6\",\n shadow: \"#cecece\",\n },\n};\n\n/** @internal */\ntype ThemeTag = `${keyof typeof Colors} ${keyof typeof Layouts}`;\n\n/**\n * @internal\n */\nexport type Theme = ThemeSpec | ThemeTag;\n\n/** @internal */\ntype LogDecorator = (...args: unknown[]) => unknown[];\n\n/** @internal */\ntype Style = `${string};`;\n\nfunction memoizeUnary<T, U>(fn: (arg: T) => U): typeof fn {\n const cache: Map<T, U> = new Map();\n return (arg) => {\n if (!cache.has(arg)) {\n const result = fn(arg);\n cache.set(arg, result);\n if (cache.size > 100) {\n cache.delete(cache.keys().next().value as T);\n }\n return result;\n }\n return cache.get(arg);\n };\n}\n\nconst toTheme = memoizeUnary((theme: Theme): ThemeSpec => {\n if (typeof theme === \"string\") {\n const [color, size] = theme.split(\" \");\n return {\n ...Colors[color],\n ...Layouts[size],\n };\n }\n return theme;\n});\n\nconst block: Style = `display: inline-block; border: 1px solid;`;\n\nconst flatten = (side: \"left\" | \"right\"): Style =>\n `padding-${side}: 0px; border-${side}-width: 0px; border-top-${side}-radius: 0px; border-bottom-${side}-radius: 0px;`;\n\nconst toColor = ({ bg, hilight, shadow, text }: Color): Style =>\n `color: ${text}; background: ${bg}; border-color: ${hilight} ${shadow} ${shadow} ${hilight};`;\n\nconst toLayout = ({ fontSize, padY, padX, rounded }: Layout) =>\n `font-size: ${fontSize}%; padding: ${padY}px ${padX}px; border-radius: ${rounded}px;`;\n\nconst toBubbleStyle = memoizeUnary((theme: ThemeSpec): string[] => {\n const base = `${block}${toColor(theme)}${toLayout(theme)}`;\n return [\n `${base}${flatten(\"right\")}`,\n `${base}${flatten(\"left\")}${theme.emphasis}`,\n ] as Style[];\n});\n\nfunction toBubblePrepender(\n bubbleLeft: string,\n bubbleRight: string,\n theme: ThemeSpec\n): LogDecorator {\n const prefix = `%c${bubbleLeft}%c ${bubbleRight}`;\n const [left, right] = toBubbleStyle(theme);\n return (args: unknown[]) => {\n const bubbleArgs = [prefix, left, right];\n if (typeof args[0] === \"string\") {\n bubbleArgs[0] = `${prefix}%c ${args.shift() as string}`;\n bubbleArgs.push(\"\"); // reset style\n }\n return [...bubbleArgs, ...args];\n };\n}\n\n/** @internal */\nconst stateTypes = {\n event: \"️⚡️\",\n} as const;\n\nconst stateDelim = \" ⤻ \";\n\n/** @internal */\ntype DebugState = { type: keyof typeof stateTypes; name: string };\n\n// Serialize to memoize.\nconst getStateFormatter = memoizeUnary((stateJson: string) => {\n const stateStack = JSON.parse(stateJson) as unknown as DebugState[];\n const firstState = stateStack.shift();\n const left = stateTypes[firstState.type];\n const right = [\n firstState.name,\n ...stateStack.map((state) => `${stateTypes[state.type]} ${state.name}`),\n ].join(stateDelim);\n return toBubblePrepender(left, right, toTheme(\"gray small\"));\n});\nconst getStatePrepender = (stateStack: DebugState[]) =>\n getStateFormatter(JSON.stringify(stateStack));\n\nconst overrideMethods = [\"log\", \"error\", \"warn\", \"info\", \"debug\"] as const;\n\nconst identity = <T>(x: T) => x;\n\nconst noop = (): (() => undefined) => undefined;\n\n/**\n * A console, plus some methods to track event lifecycles.\n * @internal\n */\nexport interface DebugLogger extends Console {\n /**\n * Stop all logging; methods do nothing\n * @internal\n */\n detach(): void;\n /**\n * Add an event bubble to the log during handler.\n */\n pushState(state: DebugState): void;\n /**\n * Remove the bubble when event is done dispatching\n */\n popState(): void;\n}\n\n/**\n * Returns a console whose methods autoformat with bubbles.\n * @internal\n */\nexport function _customConsole(\n theme: Theme,\n type: string,\n name: string\n): DebugLogger {\n const prepender = toBubblePrepender(`X${type}`, name, toTheme(theme));\n let statePrepender: LogDecorator = identity as LogDecorator;\n const stateStack: DebugState[] = [];\n const loggerProto: PropertyDescriptorMap = {\n detach: {\n writable: true,\n configurable: true,\n value(this: DebugLogger) {\n overrideMethods.forEach((method) => {\n this[method] = noop;\n });\n },\n },\n pushState: {\n value(state: DebugState) {\n stateStack.push(state);\n statePrepender = getStatePrepender(stateStack);\n },\n },\n popState: {\n value() {\n stateStack.pop();\n statePrepender =\n stateStack.length === 0\n ? (identity as LogDecorator)\n : getStatePrepender(stateStack);\n },\n },\n };\n const customConsole = Object.create(\n console,\n overrideMethods.reduce((out, level) => {\n out[level] = {\n writable: true,\n configurable: true,\n value(...args: unknown[]) {\n console[level](...prepender(statePrepender(args)));\n },\n };\n return out;\n }, loggerProto)\n ) as DebugLogger;\n return customConsole;\n}\n\n/**\n * @internal\n */\nexport const quietConsole = new Proxy(console, {\n get() {\n return noop;\n },\n});\n","/*\nCopyright 2022 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\nimport { _customConsole, DebugLogger, Theme } from \"./debuglog.js\";\nimport { Emits, Unsubscriber } from \"./types.js\";\n\n/**\n * Adds methods for logging events\n * @internal\n */\nexport interface EmitterDebugLogger extends DebugLogger {\n /**\n * Listen to an event and pass the logger to the handler\n * @internal\n */\n listen(\n type: string,\n listener: (logger: EmitterDebugLogger, ev: CustomEvent) => unknown\n ): this;\n}\n\n/**\n * Debugger for EventTarget objects like Hosts, Ports and Guests, which\n * patches dispatchEvent to log events\n * Adapter to attach console logging listeners to all events on an emitter.\n * @internal\n */\nexport function debugEmitter(\n emitter: Emits,\n opts: {\n theme: Theme;\n type?: string;\n id?: string;\n }\n): EmitterDebugLogger {\n const logger = _customConsole(\n opts.theme,\n opts.type ||\n (Object.getPrototypeOf(emitter) as typeof emitter).constructor.name,\n opts.id || emitter.id\n ) as EmitterDebugLogger;\n const oldDispatch = emitter.dispatchEvent;\n emitter.dispatchEvent = (event) => {\n logger.pushState({ type: \"event\", name: event.type });\n const retVal = oldDispatch.call(emitter, event) as boolean;\n logger.popState();\n return retVal;\n };\n\n const subscriptions: Unsubscriber[] = [];\n\n const oldDetach = logger.detach;\n logger.detach = () => {\n oldDetach.call(logger);\n subscriptions.forEach((unsubscribe) => unsubscribe());\n };\n\n /**\n * Listens and passes a logger to callbacks\n */\n function listen(\n type: string,\n listener: (logger: EmitterDebugLogger, ev: CustomEvent) => unknown\n ) {\n subscriptions.push(\n emitter.addEventListener(type, (event) => listener(logger, event))\n );\n return logger;\n }\n\n logger.listen = listen;\n\n return logger;\n}\n","/*\nCopyright 2022 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\nimport { Emits, Unsubscriber, NamedEvent } from \"./types.js\";\n\n/**\n * Browser-native {@link https://developer.mozilla.org/en-US/docs/Web/API/EventTarget | EventTarget}\n * whose {@link Emitter.addEventListener} method returns an anonymous function\n * which unsubscribes the original handler.\n *\n * Also provides typed events via generics. You can create or extend this class\n * to define custom emitters with known event names and signatures.\n *\n * @example\n * ```ts\n * import type { NamedEvent, Emitter } from '@adobe/uix-sdk'\n *\n * class FizzBuzzEmitter extends Emitter<\n * NamedEvent<\"fizz\", { fizzCount: number }> |\n * NamedEvent<\"buzz\", { buzzCount: number }> |\n * NamedEvent<\"fizzbuzz\">\n * > {\n * }\n * ```\n * The `FizzBuzzEmitter` class will now type check its events and event\n * listeners, providing autosuggest in editors.\n *\n * @see [EventTarget - MDN](https://developer.mozilla.org/en-US/docs/Web/API/EventTarget)\n *\n * @public\n */\nexport class Emitter<Events extends NamedEvent>\n extends EventTarget\n implements Emits<Events>\n{\n /**\n * An arbitrary string to uniquely identify this emitter and its events.\n * @public\n */\n id: string;\n constructor(id: string) {\n super();\n this.id = id;\n }\n /**\n * Convenience method to construct and dispatch custom events.\n *\n * @param type - Name of one of the allowed events this can emit\n * @param detail - Object to expose in the {@link https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent/detail | CustomEvent#detail}\n * property.\n * @public\n */\n protected emit<Event extends Events>(\n type: Event[\"type\"],\n detail: Event[\"detail\"]\n ): void {\n const event = new CustomEvent<typeof detail>(type, { detail });\n this.dispatchEvent(event);\n }\n /**\n * Subscribe to an event and receive an unsubscribe callback.\n * @see [EventTarget.addEventListener - MDN](https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener)\n *\n * Identical to `EventTarget.addEventListener`, but returns an \"unsubscriber\"\n * function which detaches the listener when invoked. Solves an ergonomic\n * problem with native EventTargets where it's impossible to detach listeners\n * without having a reference to the original handler.\n *\n * @typeParam E - Name of one of the allowed events this can emit\n * @param type - Event type\n * @param listener - Event handler\n * @returns Call to unsubscribe listener.\n */\n addEventListener<\n Type extends Events[\"type\"],\n Event extends Extract<Events, { type: Type }>\n >(type: Type, listener: (ev: Event) => unknown): Unsubscriber {\n super.addEventListener(type, listener);\n return () => super.removeEventListener(type, listener);\n }\n}\n","/*\nCopyright 2022 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\n/* eslint-disable @typescript-eslint/no-explicit-any */\nimport { RemoteHostApis, RemoteMethodInvoker } from \"./types.js\";\n\n/**\n * Build a fake object that turns \"method calls\" into RPC messages\n * The resulting object will recursively make more fake proxies on demand until\n * one of the looked-up properties is invoked as a function.\n * Then it will call the passed `invoke` method with a {@link HostMethodAddress}\n * that can send the method invocation as an RPC message to another realm.\n *\n * @example\n * ```js\n * const invoker = (methodAddress) => console.log(\n * address.path,\n * address.name,\n * address.args\n * );\n * const ns = makeNamespaceProxy(invoker);\n *\n * // looking up any property on the object will work\n *\n * ns.example.builds.method.call.message(\"foo\", 1);\n *\n * // Console will log:\n * ['example','builds','method','call']\n * 'message'\n * [\"foo\", 1]\n *```\n * @internal\n *\n * @param invoke - Callback that receives address\n */\nexport function makeNamespaceProxy<ProxiedApi extends object>(\n invoke: RemoteMethodInvoker<unknown>,\n path: string[] = []\n): RemoteHostApis<ProxiedApi> {\n const handler: ProxyHandler<Record<string, any>> = {\n get: (target, prop) => {\n if (typeof prop === \"string\") {\n if (!Reflect.has(target, prop)) {\n const next = makeNamespaceProxy(invoke, path.concat(prop));\n Reflect.set(target, prop, next);\n }\n return Reflect.get(target, prop) as unknown;\n } else {\n throw new Error(\n `Cannot look up a symbol ${String(prop)} on a host connection proxy.`\n );\n }\n },\n };\n const target = {} as unknown as RemoteHostApis<ProxiedApi>;\n // Only trap the apply if there's at least two levels of namespace.\n // uix.host() is not a function, and neither is uix.host.bareMethod().\n if (path.length < 2) {\n return new Proxy<RemoteHostApis<ProxiedApi>>(target, handler);\n }\n const invoker = (...args: unknown[]) =>\n invoke({\n path: path.slice(0, -1),\n name: path[path.length - 1],\n args,\n });\n return new Proxy<typeof invoker>(invoker, {\n ...handler,\n apply(target, _, args: unknown[]) {\n return target(...args);\n },\n }) as unknown as typeof target;\n}\n","/*\nCopyright 2022 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\n/**\n * Add a timeout to a Promise. The returned Promise will resolve to the value of\n * the original Promise, but if it doesn't resolve within the timeout interval,\n * it will reject with a timeout error.\n * @internal\n *\n * @param timeoutMs - Time to wait (ms) before rejecting\n * @param promise - Original promise to set a timeout for\n * @returns - Promise that rejects after X milliseconds have passed\n */\nexport function timeoutPromise<T>(timeoutMs: number, promise: Promise<T>) {\n return new Promise((resolve, reject) => {\n const timeout = setTimeout(\n () => reject(new Error(`Timed out after ${timeoutMs}ms`)),\n timeoutMs\n );\n promise\n .then((result) => {\n clearTimeout(timeout);\n resolve(result);\n })\n .catch(reject);\n });\n}\n"]}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Core utilities, types and contracts for the Adobe UIX SDK.
|
|
3
|
+
* @packageDocumentation
|
|
4
|
+
*/
|
|
5
|
+
export * from "./debug-emitter";
|
|
6
|
+
export * from "./debuglog";
|
|
7
|
+
export * from "./emitter";
|
|
8
|
+
export * from "./namespace-proxy";
|
|
9
|
+
export * from "./timeout-promise";
|
|
10
|
+
export * from "./types";
|
|
11
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAYA;;;GAGG;AAEH,cAAc,iBAAiB,CAAC;AAChC,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,SAAS,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,266 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
// src/debuglog.ts
|
|
4
|
+
var isDarkMode = () => typeof window.matchMedia === "function" && window.matchMedia("(prefers-color-scheme: dark)").matches;
|
|
5
|
+
var Layouts = {
|
|
6
|
+
medium: {
|
|
7
|
+
padX: 5,
|
|
8
|
+
padY: 3,
|
|
9
|
+
rounded: 4,
|
|
10
|
+
fontSize: 100,
|
|
11
|
+
emphasis: "font-weight: bold;"
|
|
12
|
+
},
|
|
13
|
+
small: {
|
|
14
|
+
padX: 3,
|
|
15
|
+
padY: 1,
|
|
16
|
+
rounded: 2,
|
|
17
|
+
fontSize: 95,
|
|
18
|
+
emphasis: "font-style: italic;"
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
var Colors = {
|
|
22
|
+
yellow: {
|
|
23
|
+
text: "#333333",
|
|
24
|
+
bg: "#EBD932",
|
|
25
|
+
hilight: "#F7E434",
|
|
26
|
+
shadow: "#D1C12C"
|
|
27
|
+
},
|
|
28
|
+
green: {
|
|
29
|
+
text: "#333333",
|
|
30
|
+
bg: "#96EB5E",
|
|
31
|
+
hilight: "#9EF763",
|
|
32
|
+
shadow: "#85D154"
|
|
33
|
+
},
|
|
34
|
+
blue: {
|
|
35
|
+
text: "#333333",
|
|
36
|
+
bg: "#8DD0EB",
|
|
37
|
+
hilight: "#88F0F7",
|
|
38
|
+
shadow: "#74AED4"
|
|
39
|
+
},
|
|
40
|
+
gray: isDarkMode() ? {
|
|
41
|
+
text: "#eeeeee",
|
|
42
|
+
bg: "transparent",
|
|
43
|
+
hilight: "#cecece",
|
|
44
|
+
shadow: "#cecece"
|
|
45
|
+
} : {
|
|
46
|
+
text: "#333333",
|
|
47
|
+
bg: "#eeeeee",
|
|
48
|
+
hilight: "#f6f6f6",
|
|
49
|
+
shadow: "#cecece"
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
function memoizeUnary(fn) {
|
|
53
|
+
const cache = /* @__PURE__ */ new Map();
|
|
54
|
+
return (arg) => {
|
|
55
|
+
if (!cache.has(arg)) {
|
|
56
|
+
const result = fn(arg);
|
|
57
|
+
cache.set(arg, result);
|
|
58
|
+
if (cache.size > 100) {
|
|
59
|
+
cache.delete(cache.keys().next().value);
|
|
60
|
+
}
|
|
61
|
+
return result;
|
|
62
|
+
}
|
|
63
|
+
return cache.get(arg);
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
var toTheme = memoizeUnary((theme) => {
|
|
67
|
+
if (typeof theme === "string") {
|
|
68
|
+
const [color, size] = theme.split(" ");
|
|
69
|
+
return {
|
|
70
|
+
...Colors[color],
|
|
71
|
+
...Layouts[size]
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
return theme;
|
|
75
|
+
});
|
|
76
|
+
var block = `display: inline-block; border: 1px solid;`;
|
|
77
|
+
var flatten = (side) => `padding-${side}: 0px; border-${side}-width: 0px; border-top-${side}-radius: 0px; border-bottom-${side}-radius: 0px;`;
|
|
78
|
+
var toColor = ({ bg, hilight, shadow, text }) => `color: ${text}; background: ${bg}; border-color: ${hilight} ${shadow} ${shadow} ${hilight};`;
|
|
79
|
+
var toLayout = ({ fontSize, padY, padX, rounded }) => `font-size: ${fontSize}%; padding: ${padY}px ${padX}px; border-radius: ${rounded}px;`;
|
|
80
|
+
var toBubbleStyle = memoizeUnary((theme) => {
|
|
81
|
+
const base = `${block}${toColor(theme)}${toLayout(theme)}`;
|
|
82
|
+
return [
|
|
83
|
+
`${base}${flatten("right")}`,
|
|
84
|
+
`${base}${flatten("left")}${theme.emphasis}`
|
|
85
|
+
];
|
|
86
|
+
});
|
|
87
|
+
function toBubblePrepender(bubbleLeft, bubbleRight, theme) {
|
|
88
|
+
const prefix = `%c${bubbleLeft}%c ${bubbleRight}`;
|
|
89
|
+
const [left, right] = toBubbleStyle(theme);
|
|
90
|
+
return (args) => {
|
|
91
|
+
const bubbleArgs = [prefix, left, right];
|
|
92
|
+
if (typeof args[0] === "string") {
|
|
93
|
+
bubbleArgs[0] = `${prefix}%c ${args.shift()}`;
|
|
94
|
+
bubbleArgs.push("");
|
|
95
|
+
}
|
|
96
|
+
return [...bubbleArgs, ...args];
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
var stateTypes = {
|
|
100
|
+
event: "\uFE0F\u26A1\uFE0F"
|
|
101
|
+
};
|
|
102
|
+
var stateDelim = " \u293B ";
|
|
103
|
+
var getStateFormatter = memoizeUnary((stateJson) => {
|
|
104
|
+
const stateStack = JSON.parse(stateJson);
|
|
105
|
+
const firstState = stateStack.shift();
|
|
106
|
+
const left = stateTypes[firstState.type];
|
|
107
|
+
const right = [
|
|
108
|
+
firstState.name,
|
|
109
|
+
...stateStack.map((state) => `${stateTypes[state.type]} ${state.name}`)
|
|
110
|
+
].join(stateDelim);
|
|
111
|
+
return toBubblePrepender(left, right, toTheme("gray small"));
|
|
112
|
+
});
|
|
113
|
+
var getStatePrepender = (stateStack) => getStateFormatter(JSON.stringify(stateStack));
|
|
114
|
+
var overrideMethods = ["log", "error", "warn", "info", "debug"];
|
|
115
|
+
var identity = (x) => x;
|
|
116
|
+
var noop = () => void 0;
|
|
117
|
+
function _customConsole(theme, type, name) {
|
|
118
|
+
const prepender = toBubblePrepender(`X${type}`, name, toTheme(theme));
|
|
119
|
+
let statePrepender = identity;
|
|
120
|
+
const stateStack = [];
|
|
121
|
+
const loggerProto = {
|
|
122
|
+
detach: {
|
|
123
|
+
writable: true,
|
|
124
|
+
configurable: true,
|
|
125
|
+
value() {
|
|
126
|
+
overrideMethods.forEach((method) => {
|
|
127
|
+
this[method] = noop;
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
},
|
|
131
|
+
pushState: {
|
|
132
|
+
value(state) {
|
|
133
|
+
stateStack.push(state);
|
|
134
|
+
statePrepender = getStatePrepender(stateStack);
|
|
135
|
+
}
|
|
136
|
+
},
|
|
137
|
+
popState: {
|
|
138
|
+
value() {
|
|
139
|
+
stateStack.pop();
|
|
140
|
+
statePrepender = stateStack.length === 0 ? identity : getStatePrepender(stateStack);
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
};
|
|
144
|
+
const customConsole = Object.create(
|
|
145
|
+
console,
|
|
146
|
+
overrideMethods.reduce((out, level) => {
|
|
147
|
+
out[level] = {
|
|
148
|
+
writable: true,
|
|
149
|
+
configurable: true,
|
|
150
|
+
value(...args) {
|
|
151
|
+
console[level](...prepender(statePrepender(args)));
|
|
152
|
+
}
|
|
153
|
+
};
|
|
154
|
+
return out;
|
|
155
|
+
}, loggerProto)
|
|
156
|
+
);
|
|
157
|
+
return customConsole;
|
|
158
|
+
}
|
|
159
|
+
var quietConsole = new Proxy(console, {
|
|
160
|
+
get() {
|
|
161
|
+
return noop;
|
|
162
|
+
}
|
|
163
|
+
});
|
|
164
|
+
|
|
165
|
+
// src/debug-emitter.ts
|
|
166
|
+
function debugEmitter(emitter, opts) {
|
|
167
|
+
const logger = _customConsole(
|
|
168
|
+
opts.theme,
|
|
169
|
+
opts.type || Object.getPrototypeOf(emitter).constructor.name,
|
|
170
|
+
opts.id || emitter.id
|
|
171
|
+
);
|
|
172
|
+
const oldDispatch = emitter.dispatchEvent;
|
|
173
|
+
emitter.dispatchEvent = (event) => {
|
|
174
|
+
logger.pushState({ type: "event", name: event.type });
|
|
175
|
+
const retVal = oldDispatch.call(emitter, event);
|
|
176
|
+
logger.popState();
|
|
177
|
+
return retVal;
|
|
178
|
+
};
|
|
179
|
+
const subscriptions = [];
|
|
180
|
+
const oldDetach = logger.detach;
|
|
181
|
+
logger.detach = () => {
|
|
182
|
+
oldDetach.call(logger);
|
|
183
|
+
subscriptions.forEach((unsubscribe) => unsubscribe());
|
|
184
|
+
};
|
|
185
|
+
function listen(type, listener) {
|
|
186
|
+
subscriptions.push(
|
|
187
|
+
emitter.addEventListener(type, (event) => listener(logger, event))
|
|
188
|
+
);
|
|
189
|
+
return logger;
|
|
190
|
+
}
|
|
191
|
+
logger.listen = listen;
|
|
192
|
+
return logger;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
// src/emitter.ts
|
|
196
|
+
var Emitter = class extends EventTarget {
|
|
197
|
+
constructor(id) {
|
|
198
|
+
super();
|
|
199
|
+
this.id = id;
|
|
200
|
+
}
|
|
201
|
+
emit(type, detail) {
|
|
202
|
+
const event = new CustomEvent(type, { detail });
|
|
203
|
+
this.dispatchEvent(event);
|
|
204
|
+
}
|
|
205
|
+
addEventListener(type, listener) {
|
|
206
|
+
super.addEventListener(type, listener);
|
|
207
|
+
return () => super.removeEventListener(type, listener);
|
|
208
|
+
}
|
|
209
|
+
};
|
|
210
|
+
|
|
211
|
+
// src/namespace-proxy.ts
|
|
212
|
+
function makeNamespaceProxy(invoke, path = []) {
|
|
213
|
+
const handler = {
|
|
214
|
+
get: (target2, prop) => {
|
|
215
|
+
if (typeof prop === "string") {
|
|
216
|
+
if (!Reflect.has(target2, prop)) {
|
|
217
|
+
const next = makeNamespaceProxy(invoke, path.concat(prop));
|
|
218
|
+
Reflect.set(target2, prop, next);
|
|
219
|
+
}
|
|
220
|
+
return Reflect.get(target2, prop);
|
|
221
|
+
} else {
|
|
222
|
+
throw new Error(
|
|
223
|
+
`Cannot look up a symbol ${String(prop)} on a host connection proxy.`
|
|
224
|
+
);
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
};
|
|
228
|
+
const target = {};
|
|
229
|
+
if (path.length < 2) {
|
|
230
|
+
return new Proxy(target, handler);
|
|
231
|
+
}
|
|
232
|
+
const invoker = (...args) => invoke({
|
|
233
|
+
path: path.slice(0, -1),
|
|
234
|
+
name: path[path.length - 1],
|
|
235
|
+
args
|
|
236
|
+
});
|
|
237
|
+
return new Proxy(invoker, {
|
|
238
|
+
...handler,
|
|
239
|
+
apply(target2, _, args) {
|
|
240
|
+
return target2(...args);
|
|
241
|
+
}
|
|
242
|
+
});
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
// src/timeout-promise.ts
|
|
246
|
+
function timeoutPromise(timeoutMs, promise) {
|
|
247
|
+
return new Promise((resolve, reject) => {
|
|
248
|
+
const timeout = setTimeout(
|
|
249
|
+
() => reject(new Error(`Timed out after ${timeoutMs}ms`)),
|
|
250
|
+
timeoutMs
|
|
251
|
+
);
|
|
252
|
+
promise.then((result) => {
|
|
253
|
+
clearTimeout(timeout);
|
|
254
|
+
resolve(result);
|
|
255
|
+
}).catch(reject);
|
|
256
|
+
});
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
exports.Emitter = Emitter;
|
|
260
|
+
exports._customConsole = _customConsole;
|
|
261
|
+
exports.debugEmitter = debugEmitter;
|
|
262
|
+
exports.makeNamespaceProxy = makeNamespaceProxy;
|
|
263
|
+
exports.quietConsole = quietConsole;
|
|
264
|
+
exports.timeoutPromise = timeoutPromise;
|
|
265
|
+
//# sourceMappingURL=out.js.map
|
|
266
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/debuglog.ts","../src/debug-emitter.ts","../src/emitter.ts","../src/namespace-proxy.ts","../src/timeout-promise.ts"],"names":["target"],"mappings":";AAmBA,IAAM,aAAa,MACjB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ACjD,KAAK,CAACA,SAAQ,SAAS;AACrB,UAAI,OAAO,SAAS,UAAU;AAC5B,YAAI,CAAC,QAAQ,IAAIA,SAAQ,IAAI,GAAG;AAC9B,gBAAM,OAAO,mBAAmB,QAAQ,KAAK,OAAO,IAAI,CAAC;AACzD,kBAAQ,IAAIA,SAAQ,MAAM,IAAI;AAAA,QAChC;AACA,eAAO,QAAQ,IAAIA,SAAQ,IAAI;AAAA,MACjC,OAAO;AACL,cAAM,IAAI;AAAA,UACR,2BAA2B,OAAO,IAAI;AAAA,QACxC;AAAA,MACF;AAAA,IACF;AAAA,EACF;AACA,QAAM,SAAS,CAAC;AAGhB,MAAI,KAAK,SAAS,GAAG;AACnB,WAAO,IAAI,MAAkC,QAAQ,OAAO;AAAA,EAC9D;AACA,QAAM,UAAU,IAAI,SAClB,OAAO;AAAA,IACL,MAAM,KAAK,MAAM,GAAG,EAAE;AAAA,IACtB,MAAM,KAAK,KAAK,SAAS;AAAA,IACzB;AAAA,EACF,CAAC;AACH,SAAO,IAAI,MAAsB,SAAS;AAAA,IACxC,GAAG;AAAA,IACH,MAAMA,SAAQ,GAAG,MAAiB;AAChC,aAAOA,QAAO,GAAG,IAAI;AAAA,IACvB;AAAA,EACF,CAAC;AACH;;;AC3DO,SAAS,eAAkB,WAAmB,SAAqB;AACxE,SAAO,IAAI,QAAQ,CAAC,SAAS,WAAW;AACtC,UAAM,UAAU;AAAA,MACd,MAAM,OAAO,IAAI,MAAM,mBAAmB,aAAa,CAAC;AAAA,MACxD;AAAA,IACF;AACA,YACG,KAAK,CAAC,WAAW;AAChB,mBAAa,OAAO;AACpB,cAAQ,MAAM;AAAA,IAChB,CAAC,EACA,MAAM,MAAM;AAAA,EACjB,CAAC;AACH","sourcesContent":["/*\nCopyright 2022 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\n/**\n * Fancy looking console decorator.\n * @hidden\n * @internal\n */\n\n/** @internal */\nconst isDarkMode = () =>\n typeof window.matchMedia === \"function\" &&\n window.matchMedia(\"(prefers-color-scheme: dark)\").matches;\n\n/** @internal */\ntype Layout = {\n padX: number;\n padY: number;\n rounded: number;\n fontSize: number;\n emphasis: Style;\n};\n/** @internal */\ntype HexColor = `#${string}` | \"transparent\";\n/** @internal */\ntype Color = {\n text: HexColor;\n bg: HexColor;\n hilight: HexColor;\n shadow: HexColor;\n};\n/** @internal */\ntype ThemeSpec = Color & Layout;\n\n/** @internal */\nconst Layouts: Record<string, Layout> = {\n medium: {\n padX: 5,\n padY: 3,\n rounded: 4,\n fontSize: 100,\n emphasis: \"font-weight: bold;\",\n },\n small: {\n padX: 3,\n padY: 1,\n rounded: 2,\n fontSize: 95,\n emphasis: \"font-style: italic;\",\n },\n};\n\n/** @internal */\nconst Colors: Record<string, Color> = {\n yellow: {\n text: \"#333333\",\n bg: \"#EBD932\",\n hilight: \"#F7E434\",\n shadow: \"#D1C12C\",\n },\n green: {\n text: \"#333333\",\n bg: \"#96EB5E\",\n hilight: \"#9EF763\",\n shadow: \"#85D154\",\n },\n blue: {\n text: \"#333333\",\n bg: \"#8DD0EB\",\n hilight: \"#88F0F7\",\n shadow: \"#74AED4\",\n },\n gray: isDarkMode()\n ? {\n text: \"#eeeeee\",\n bg: \"transparent\",\n hilight: \"#cecece\",\n shadow: \"#cecece\",\n }\n : {\n text: \"#333333\",\n bg: \"#eeeeee\",\n hilight: \"#f6f6f6\",\n shadow: \"#cecece\",\n },\n};\n\n/** @internal */\ntype ThemeTag = `${keyof typeof Colors} ${keyof typeof Layouts}`;\n\n/**\n * @internal\n */\nexport type Theme = ThemeSpec | ThemeTag;\n\n/** @internal */\ntype LogDecorator = (...args: unknown[]) => unknown[];\n\n/** @internal */\ntype Style = `${string};`;\n\nfunction memoizeUnary<T, U>(fn: (arg: T) => U): typeof fn {\n const cache: Map<T, U> = new Map();\n return (arg) => {\n if (!cache.has(arg)) {\n const result = fn(arg);\n cache.set(arg, result);\n if (cache.size > 100) {\n cache.delete(cache.keys().next().value as T);\n }\n return result;\n }\n return cache.get(arg);\n };\n}\n\nconst toTheme = memoizeUnary((theme: Theme): ThemeSpec => {\n if (typeof theme === \"string\") {\n const [color, size] = theme.split(\" \");\n return {\n ...Colors[color],\n ...Layouts[size],\n };\n }\n return theme;\n});\n\nconst block: Style = `display: inline-block; border: 1px solid;`;\n\nconst flatten = (side: \"left\" | \"right\"): Style =>\n `padding-${side}: 0px; border-${side}-width: 0px; border-top-${side}-radius: 0px; border-bottom-${side}-radius: 0px;`;\n\nconst toColor = ({ bg, hilight, shadow, text }: Color): Style =>\n `color: ${text}; background: ${bg}; border-color: ${hilight} ${shadow} ${shadow} ${hilight};`;\n\nconst toLayout = ({ fontSize, padY, padX, rounded }: Layout) =>\n `font-size: ${fontSize}%; padding: ${padY}px ${padX}px; border-radius: ${rounded}px;`;\n\nconst toBubbleStyle = memoizeUnary((theme: ThemeSpec): string[] => {\n const base = `${block}${toColor(theme)}${toLayout(theme)}`;\n return [\n `${base}${flatten(\"right\")}`,\n `${base}${flatten(\"left\")}${theme.emphasis}`,\n ] as Style[];\n});\n\nfunction toBubblePrepender(\n bubbleLeft: string,\n bubbleRight: string,\n theme: ThemeSpec\n): LogDecorator {\n const prefix = `%c${bubbleLeft}%c ${bubbleRight}`;\n const [left, right] = toBubbleStyle(theme);\n return (args: unknown[]) => {\n const bubbleArgs = [prefix, left, right];\n if (typeof args[0] === \"string\") {\n bubbleArgs[0] = `${prefix}%c ${args.shift() as string}`;\n bubbleArgs.push(\"\"); // reset style\n }\n return [...bubbleArgs, ...args];\n };\n}\n\n/** @internal */\nconst stateTypes = {\n event: \"️⚡️\",\n} as const;\n\nconst stateDelim = \" ⤻ \";\n\n/** @internal */\ntype DebugState = { type: keyof typeof stateTypes; name: string };\n\n// Serialize to memoize.\nconst getStateFormatter = memoizeUnary((stateJson: string) => {\n const stateStack = JSON.parse(stateJson) as unknown as DebugState[];\n const firstState = stateStack.shift();\n const left = stateTypes[firstState.type];\n const right = [\n firstState.name,\n ...stateStack.map((state) => `${stateTypes[state.type]} ${state.name}`),\n ].join(stateDelim);\n return toBubblePrepender(left, right, toTheme(\"gray small\"));\n});\nconst getStatePrepender = (stateStack: DebugState[]) =>\n getStateFormatter(JSON.stringify(stateStack));\n\nconst overrideMethods = [\"log\", \"error\", \"warn\", \"info\", \"debug\"] as const;\n\nconst identity = <T>(x: T) => x;\n\nconst noop = (): (() => undefined) => undefined;\n\n/**\n * A console, plus some methods to track event lifecycles.\n * @internal\n */\nexport interface DebugLogger extends Console {\n /**\n * Stop all logging; methods do nothing\n * @internal\n */\n detach(): void;\n /**\n * Add an event bubble to the log during handler.\n */\n pushState(state: DebugState): void;\n /**\n * Remove the bubble when event is done dispatching\n */\n popState(): void;\n}\n\n/**\n * Returns a console whose methods autoformat with bubbles.\n * @internal\n */\nexport function _customConsole(\n theme: Theme,\n type: string,\n name: string\n): DebugLogger {\n const prepender = toBubblePrepender(`X${type}`, name, toTheme(theme));\n let statePrepender: LogDecorator = identity as LogDecorator;\n const stateStack: DebugState[] = [];\n const loggerProto: PropertyDescriptorMap = {\n detach: {\n writable: true,\n configurable: true,\n value(this: DebugLogger) {\n overrideMethods.forEach((method) => {\n this[method] = noop;\n });\n },\n },\n pushState: {\n value(state: DebugState) {\n stateStack.push(state);\n statePrepender = getStatePrepender(stateStack);\n },\n },\n popState: {\n value() {\n stateStack.pop();\n statePrepender =\n stateStack.length === 0\n ? (identity as LogDecorator)\n : getStatePrepender(stateStack);\n },\n },\n };\n const customConsole = Object.create(\n console,\n overrideMethods.reduce((out, level) => {\n out[level] = {\n writable: true,\n configurable: true,\n value(...args: unknown[]) {\n console[level](...prepender(statePrepender(args)));\n },\n };\n return out;\n }, loggerProto)\n ) as DebugLogger;\n return customConsole;\n}\n\n/**\n * @internal\n */\nexport const quietConsole = new Proxy(console, {\n get() {\n return noop;\n },\n});\n","/*\nCopyright 2022 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\nimport { _customConsole, DebugLogger, Theme } from \"./debuglog.js\";\nimport { Emits, Unsubscriber } from \"./types.js\";\n\n/**\n * Adds methods for logging events\n * @internal\n */\nexport interface EmitterDebugLogger extends DebugLogger {\n /**\n * Listen to an event and pass the logger to the handler\n * @internal\n */\n listen(\n type: string,\n listener: (logger: EmitterDebugLogger, ev: CustomEvent) => unknown\n ): this;\n}\n\n/**\n * Debugger for EventTarget objects like Hosts, Ports and Guests, which\n * patches dispatchEvent to log events\n * Adapter to attach console logging listeners to all events on an emitter.\n * @internal\n */\nexport function debugEmitter(\n emitter: Emits,\n opts: {\n theme: Theme;\n type?: string;\n id?: string;\n }\n): EmitterDebugLogger {\n const logger = _customConsole(\n opts.theme,\n opts.type ||\n (Object.getPrototypeOf(emitter) as typeof emitter).constructor.name,\n opts.id || emitter.id\n ) as EmitterDebugLogger;\n const oldDispatch = emitter.dispatchEvent;\n emitter.dispatchEvent = (event) => {\n logger.pushState({ type: \"event\", name: event.type });\n const retVal = oldDispatch.call(emitter, event) as boolean;\n logger.popState();\n return retVal;\n };\n\n const subscriptions: Unsubscriber[] = [];\n\n const oldDetach = logger.detach;\n logger.detach = () => {\n oldDetach.call(logger);\n subscriptions.forEach((unsubscribe) => unsubscribe());\n };\n\n /**\n * Listens and passes a logger to callbacks\n */\n function listen(\n type: string,\n listener: (logger: EmitterDebugLogger, ev: CustomEvent) => unknown\n ) {\n subscriptions.push(\n emitter.addEventListener(type, (event) => listener(logger, event))\n );\n return logger;\n }\n\n logger.listen = listen;\n\n return logger;\n}\n","/*\nCopyright 2022 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\nimport { Emits, Unsubscriber, NamedEvent } from \"./types.js\";\n\n/**\n * Browser-native {@link https://developer.mozilla.org/en-US/docs/Web/API/EventTarget | EventTarget}\n * whose {@link Emitter.addEventListener} method returns an anonymous function\n * which unsubscribes the original handler.\n *\n * Also provides typed events via generics. You can create or extend this class\n * to define custom emitters with known event names and signatures.\n *\n * @example\n * ```ts\n * import type { NamedEvent, Emitter } from '@adobe/uix-sdk'\n *\n * class FizzBuzzEmitter extends Emitter<\n * NamedEvent<\"fizz\", { fizzCount: number }> |\n * NamedEvent<\"buzz\", { buzzCount: number }> |\n * NamedEvent<\"fizzbuzz\">\n * > {\n * }\n * ```\n * The `FizzBuzzEmitter` class will now type check its events and event\n * listeners, providing autosuggest in editors.\n *\n * @see [EventTarget - MDN](https://developer.mozilla.org/en-US/docs/Web/API/EventTarget)\n *\n * @public\n */\nexport class Emitter<Events extends NamedEvent>\n extends EventTarget\n implements Emits<Events>\n{\n /**\n * An arbitrary string to uniquely identify this emitter and its events.\n * @public\n */\n id: string;\n constructor(id: string) {\n super();\n this.id = id;\n }\n /**\n * Convenience method to construct and dispatch custom events.\n *\n * @param type - Name of one of the allowed events this can emit\n * @param detail - Object to expose in the {@link https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent/detail | CustomEvent#detail}\n * property.\n * @public\n */\n protected emit<Event extends Events>(\n type: Event[\"type\"],\n detail: Event[\"detail\"]\n ): void {\n const event = new CustomEvent<typeof detail>(type, { detail });\n this.dispatchEvent(event);\n }\n /**\n * Subscribe to an event and receive an unsubscribe callback.\n * @see [EventTarget.addEventListener - MDN](https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener)\n *\n * Identical to `EventTarget.addEventListener`, but returns an \"unsubscriber\"\n * function which detaches the listener when invoked. Solves an ergonomic\n * problem with native EventTargets where it's impossible to detach listeners\n * without having a reference to the original handler.\n *\n * @typeParam E - Name of one of the allowed events this can emit\n * @param type - Event type\n * @param listener - Event handler\n * @returns Call to unsubscribe listener.\n */\n addEventListener<\n Type extends Events[\"type\"],\n Event extends Extract<Events, { type: Type }>\n >(type: Type, listener: (ev: Event) => unknown): Unsubscriber {\n super.addEventListener(type, listener);\n return () => super.removeEventListener(type, listener);\n }\n}\n","/*\nCopyright 2022 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\n/* eslint-disable @typescript-eslint/no-explicit-any */\nimport { RemoteHostApis, RemoteMethodInvoker } from \"./types.js\";\n\n/**\n * Build a fake object that turns \"method calls\" into RPC messages\n * The resulting object will recursively make more fake proxies on demand until\n * one of the looked-up properties is invoked as a function.\n * Then it will call the passed `invoke` method with a {@link HostMethodAddress}\n * that can send the method invocation as an RPC message to another realm.\n *\n * @example\n * ```js\n * const invoker = (methodAddress) => console.log(\n * address.path,\n * address.name,\n * address.args\n * );\n * const ns = makeNamespaceProxy(invoker);\n *\n * // looking up any property on the object will work\n *\n * ns.example.builds.method.call.message(\"foo\", 1);\n *\n * // Console will log:\n * ['example','builds','method','call']\n * 'message'\n * [\"foo\", 1]\n *```\n * @internal\n *\n * @param invoke - Callback that receives address\n */\nexport function makeNamespaceProxy<ProxiedApi extends object>(\n invoke: RemoteMethodInvoker<unknown>,\n path: string[] = []\n): RemoteHostApis<ProxiedApi> {\n const handler: ProxyHandler<Record<string, any>> = {\n get: (target, prop) => {\n if (typeof prop === \"string\") {\n if (!Reflect.has(target, prop)) {\n const next = makeNamespaceProxy(invoke, path.concat(prop));\n Reflect.set(target, prop, next);\n }\n return Reflect.get(target, prop) as unknown;\n } else {\n throw new Error(\n `Cannot look up a symbol ${String(prop)} on a host connection proxy.`\n );\n }\n },\n };\n const target = {} as unknown as RemoteHostApis<ProxiedApi>;\n // Only trap the apply if there's at least two levels of namespace.\n // uix.host() is not a function, and neither is uix.host.bareMethod().\n if (path.length < 2) {\n return new Proxy<RemoteHostApis<ProxiedApi>>(target, handler);\n }\n const invoker = (...args: unknown[]) =>\n invoke({\n path: path.slice(0, -1),\n name: path[path.length - 1],\n args,\n });\n return new Proxy<typeof invoker>(invoker, {\n ...handler,\n apply(target, _, args: unknown[]) {\n return target(...args);\n },\n }) as unknown as typeof target;\n}\n","/*\nCopyright 2022 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\n/**\n * Add a timeout to a Promise. The returned Promise will resolve to the value of\n * the original Promise, but if it doesn't resolve within the timeout interval,\n * it will reject with a timeout error.\n * @internal\n *\n * @param timeoutMs - Time to wait (ms) before rejecting\n * @param promise - Original promise to set a timeout for\n * @returns - Promise that rejects after X milliseconds have passed\n */\nexport function timeoutPromise<T>(timeoutMs: number, promise: Promise<T>) {\n return new Promise((resolve, reject) => {\n const timeout = setTimeout(\n () => reject(new Error(`Timed out after ${timeoutMs}ms`)),\n timeoutMs\n );\n promise\n .then((result) => {\n clearTimeout(timeout);\n resolve(result);\n })\n .catch(reject);\n });\n}\n"]}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { RemoteHostApis, RemoteMethodInvoker } from "./types.js";
|
|
2
|
+
/**
|
|
3
|
+
* Build a fake object that turns "method calls" into RPC messages
|
|
4
|
+
* The resulting object will recursively make more fake proxies on demand until
|
|
5
|
+
* one of the looked-up properties is invoked as a function.
|
|
6
|
+
* Then it will call the passed `invoke` method with a {@link HostMethodAddress}
|
|
7
|
+
* that can send the method invocation as an RPC message to another realm.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```js
|
|
11
|
+
* const invoker = (methodAddress) => console.log(
|
|
12
|
+
* address.path,
|
|
13
|
+
* address.name,
|
|
14
|
+
* address.args
|
|
15
|
+
* );
|
|
16
|
+
* const ns = makeNamespaceProxy(invoker);
|
|
17
|
+
*
|
|
18
|
+
* // looking up any property on the object will work
|
|
19
|
+
*
|
|
20
|
+
* ns.example.builds.method.call.message("foo", 1);
|
|
21
|
+
*
|
|
22
|
+
* // Console will log:
|
|
23
|
+
* ['example','builds','method','call']
|
|
24
|
+
* 'message'
|
|
25
|
+
* ["foo", 1]
|
|
26
|
+
*```
|
|
27
|
+
* @internal
|
|
28
|
+
*
|
|
29
|
+
* @param invoke - Callback that receives address
|
|
30
|
+
*/
|
|
31
|
+
export declare function makeNamespaceProxy<ProxiedApi extends object>(invoke: RemoteMethodInvoker<unknown>, path?: string[]): RemoteHostApis<ProxiedApi>;
|
|
32
|
+
//# sourceMappingURL=namespace-proxy.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"namespace-proxy.d.ts","sourceRoot":"","sources":["../src/namespace-proxy.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAEjE;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,wBAAgB,kBAAkB,CAAC,UAAU,SAAS,MAAM,EAC1D,MAAM,EAAE,mBAAmB,CAAC,OAAO,CAAC,EACpC,IAAI,GAAE,MAAM,EAAO,GAClB,cAAc,CAAC,UAAU,CAAC,CAkC5B"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Add a timeout to a Promise. The returned Promise will resolve to the value of
|
|
3
|
+
* the original Promise, but if it doesn't resolve within the timeout interval,
|
|
4
|
+
* it will reject with a timeout error.
|
|
5
|
+
* @internal
|
|
6
|
+
*
|
|
7
|
+
* @param timeoutMs - Time to wait (ms) before rejecting
|
|
8
|
+
* @param promise - Original promise to set a timeout for
|
|
9
|
+
* @returns - Promise that rejects after X milliseconds have passed
|
|
10
|
+
*/
|
|
11
|
+
export declare function timeoutPromise<T>(timeoutMs: number, promise: Promise<T>): Promise<unknown>;
|
|
12
|
+
//# sourceMappingURL=timeout-promise.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"timeout-promise.d.ts","sourceRoot":"","sources":["../src/timeout-promise.ts"],"names":[],"mappings":"AAYA;;;;;;;;;GASG;AACH,wBAAgB,cAAc,CAAC,CAAC,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,oBAavE"}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Extract keys of T whose values are are assignable to U.
|
|
3
|
+
* @internal
|
|
4
|
+
*/
|
|
5
|
+
declare type ExtractKeys<T, U> = {
|
|
6
|
+
[P in keyof T]: T[P] extends U ? P : never;
|
|
7
|
+
}[keyof T];
|
|
8
|
+
/**
|
|
9
|
+
* @internal
|
|
10
|
+
*/
|
|
11
|
+
declare type GuestApiMethod = (...args: any[]) => any;
|
|
12
|
+
/**
|
|
13
|
+
* @internal
|
|
14
|
+
*/
|
|
15
|
+
export interface GuestApiNS {
|
|
16
|
+
[k: string]: GuestApiMethod;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* @internal
|
|
20
|
+
*/
|
|
21
|
+
export interface GuestApis {
|
|
22
|
+
[k: string]: GuestApiNS;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* @internal
|
|
26
|
+
*/
|
|
27
|
+
export declare type RemoteGuestApiNS<G extends GuestApiNS = GuestApiNS> = {
|
|
28
|
+
[K in ExtractKeys<G, GuestApiMethod>]: (...args: Parameters<G[K]>) => Promise<ReturnType<G[K]>>;
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* @internal
|
|
32
|
+
*/
|
|
33
|
+
export declare type RemoteGuestApis<G extends GuestApis = GuestApis> = {
|
|
34
|
+
[K in ExtractKeys<G, GuestApiNS>]: RemoteGuestApiNS<GuestApiNS>;
|
|
35
|
+
};
|
|
36
|
+
/**
|
|
37
|
+
* @internal
|
|
38
|
+
*/
|
|
39
|
+
export declare type VirtualApi = Record<string, object | ((...args: unknown[]) => unknown)>;
|
|
40
|
+
/**
|
|
41
|
+
* @internal
|
|
42
|
+
*/
|
|
43
|
+
export declare type RemoteHostApis<Api = VirtualApi> = {
|
|
44
|
+
[K in ExtractKeys<Api, CallableFunction | object>]: Api[K] extends (...args: unknown[]) => PromiseLike<any> ? Api[K] : Api[K] extends (...args: infer A) => infer R ? (...args: A) => Promise<R> : RemoteHostApis<Api[K]>;
|
|
45
|
+
};
|
|
46
|
+
/**
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* An individual UI extension retrieved from the registry.
|
|
50
|
+
*
|
|
51
|
+
* @remarks This interface is likely to expand. As the metadata from the
|
|
52
|
+
* extension registry stabilizes, it should probably be passed through.
|
|
53
|
+
* Right now, there are too many cases where an extension string ID
|
|
54
|
+
* is directly used; this should probably be an opaque, structured object.
|
|
55
|
+
*
|
|
56
|
+
* @public
|
|
57
|
+
*/
|
|
58
|
+
export interface Extension {
|
|
59
|
+
/**
|
|
60
|
+
* Unique ID of the extension. Must be unique across entire app
|
|
61
|
+
*/
|
|
62
|
+
id: string;
|
|
63
|
+
/**
|
|
64
|
+
* Location of the document to load for the {@link @adobe/uix-guest#GuestServer}
|
|
65
|
+
*/
|
|
66
|
+
url: string;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Describes a method invocation to/from a remote realm, such as an iframe.
|
|
70
|
+
*
|
|
71
|
+
* @example Calling a host API method
|
|
72
|
+
*
|
|
73
|
+
* #### `extension.ts`
|
|
74
|
+
* ```ts
|
|
75
|
+
* // The following line causes the Guest object to build a `HostMethodAddress`
|
|
76
|
+
* // and dispatch it to the parent app
|
|
77
|
+
* uix.host.accounts.lookup.byQuery('Kevin', { pick: 'homeAddress' });
|
|
78
|
+
* ```
|
|
79
|
+
*
|
|
80
|
+
* The above call produces this `HostMethodAddress` and sends it to the invoker:
|
|
81
|
+
* ```json
|
|
82
|
+
* {
|
|
83
|
+
* path: ["accounts","lookup"],
|
|
84
|
+
* name: "byQuery",
|
|
85
|
+
* args: ["Kevin", { "pick": "homeAddress" }]
|
|
86
|
+
* }
|
|
87
|
+
* ```
|
|
88
|
+
* @internal
|
|
89
|
+
*
|
|
90
|
+
*/
|
|
91
|
+
export interface HostMethodAddress<Args = unknown[]> {
|
|
92
|
+
/**
|
|
93
|
+
* Consecutive dot lookups on nested objects before the actual function call.
|
|
94
|
+
*/
|
|
95
|
+
path: string[];
|
|
96
|
+
/**
|
|
97
|
+
* Name of the method to be called as a function.
|
|
98
|
+
*/
|
|
99
|
+
name: string;
|
|
100
|
+
/**
|
|
101
|
+
* Any (serializable) arguments to the remote function.
|
|
102
|
+
*/
|
|
103
|
+
args: Args;
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* A callback to pass to a new namespace proxy. It will call that
|
|
107
|
+
* call back with a {@link HostMethodAddress} when one of its properties is
|
|
108
|
+
* invoked as a method.
|
|
109
|
+
*
|
|
110
|
+
* Because the typical use case is for asynchronous cross-realm communication,
|
|
111
|
+
* the callback is expected to return a Promise for the return value.
|
|
112
|
+
* @internal
|
|
113
|
+
*/
|
|
114
|
+
export declare type RemoteMethodInvoker<T> = (address: HostMethodAddress) => Promise<T>;
|
|
115
|
+
/**
|
|
116
|
+
* Interface for decoupling Port from GuestServer.host
|
|
117
|
+
* @internal
|
|
118
|
+
*/
|
|
119
|
+
export interface HostConnection<T = unknown> {
|
|
120
|
+
/**
|
|
121
|
+
* see {@link @adobe/uix-host#Port}
|
|
122
|
+
*/
|
|
123
|
+
getSharedContext(): Record<string, unknown>;
|
|
124
|
+
/**
|
|
125
|
+
* see {@link @adobe/uix-host#Port}
|
|
126
|
+
*/
|
|
127
|
+
invokeHostMethod: RemoteMethodInvoker<T>;
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* {@inheritDoc @adobe/uix-host#Port}
|
|
131
|
+
* @internal
|
|
132
|
+
*/
|
|
133
|
+
export interface GuestConnection {
|
|
134
|
+
id: string;
|
|
135
|
+
url: URL;
|
|
136
|
+
attachUI(frame: HTMLIFrameElement, privateMethods?: RemoteHostApis): {
|
|
137
|
+
promise: Promise<unknown>;
|
|
138
|
+
destroy: Function;
|
|
139
|
+
};
|
|
140
|
+
load(): Promise<unknown>;
|
|
141
|
+
error?: Error;
|
|
142
|
+
hasCapabilities(capabilities: unknown): boolean;
|
|
143
|
+
isReady(): boolean;
|
|
144
|
+
provide(apis: unknown): void;
|
|
145
|
+
unload(): Promise<unknown>;
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* BEGIN EVENTS
|
|
149
|
+
*/
|
|
150
|
+
/**
|
|
151
|
+
* Returned from {@link Emitter.addEventListener}. Unsubscribes the original
|
|
152
|
+
* handler when called.
|
|
153
|
+
* @internal
|
|
154
|
+
*/
|
|
155
|
+
export declare type Unsubscriber = () => void;
|
|
156
|
+
/**
|
|
157
|
+
* Strongly typed event with a string `type` parameter.
|
|
158
|
+
* @internal
|
|
159
|
+
*/
|
|
160
|
+
export declare type NamedEvent<Type extends string = string, Detail = Record<string, unknown>> = CustomEvent<Detail> & {
|
|
161
|
+
readonly type: Type;
|
|
162
|
+
};
|
|
163
|
+
/**
|
|
164
|
+
* Typed EventTarget
|
|
165
|
+
* @internal
|
|
166
|
+
*/
|
|
167
|
+
export interface Emits<Events extends NamedEvent = NamedEvent> extends EventTarget {
|
|
168
|
+
id: string;
|
|
169
|
+
/**
|
|
170
|
+
* Same as EventTarget.addEventListener but returns an unsubscribe callback.
|
|
171
|
+
*/
|
|
172
|
+
addEventListener<Type extends Events["type"]>(type: Type, listener: (ev: Extract<Events, {
|
|
173
|
+
type: Type;
|
|
174
|
+
}>) => unknown): () => void;
|
|
175
|
+
}
|
|
176
|
+
export {};
|
|
177
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAcA;;;GAGG;AACH,aAAK,WAAW,CAAC,CAAC,EAAE,CAAC,IAAI;KACtB,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,GAAG,CAAC,GAAG,KAAK;CAC3C,CAAC,MAAM,CAAC,CAAC,CAAC;AAEX;;GAEG;AACH,aAAK,cAAc,GAAG,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,CAAC;AAE9C;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,CAAC,CAAC,EAAE,MAAM,GAAG,cAAc,CAAC;CAC7B;AAED;;GAEG;AACH,MAAM,WAAW,SAAS;IACxB,CAAC,CAAC,EAAE,MAAM,GAAG,UAAU,CAAC;CACzB;AAED;;GAEG;AACH,oBAAY,gBAAgB,CAAC,CAAC,SAAS,UAAU,GAAG,UAAU,IAAI;KAC/D,CAAC,IAAI,WAAW,CA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IAAI,EAAE,IAAI,CAAC;CACrB,CAAC;AAEF;;;GAGG;AACH,MAAM,WAAW,KAAK,CAAC,MAAM,SAAS,UAAU,GAAG,UAAU,CAC3D,SAAQ,WAAW;IACnB,EAAE,EAAE,MAAM,CAAC;IACX;;OAEG;IACH,gBAAgB,CAAC,IAAI,SAAS,MAAM,CAAC,MAAM,CAAC,EAC1C,IAAI,EAAE,IAAI,EACV,QAAQ,EAAE,CAAC,EAAE,EAAE,OAAO,CAAC,MAAM,EAAE;QAAE,IAAI,EAAE,IAAI,CAAA;KAAE,CAAC,KAAK,OAAO,GACzD,MAAM,IAAI,CAAC;CACf"}
|
package/package.json
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@adobe/uix-core",
|
|
3
|
+
"version": "0.6.3",
|
|
4
|
+
"description": "Internal utilities for the UIX SDK",
|
|
5
|
+
"author": "Adobe, Inc,",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"module": "dist/esm/index.js",
|
|
8
|
+
"main": "dist/index.js",
|
|
9
|
+
"browser": "dist/index.js",
|
|
10
|
+
"exports": {
|
|
11
|
+
"import": "./dist/esm/index.js",
|
|
12
|
+
"require": "./dist/index.js"
|
|
13
|
+
},
|
|
14
|
+
"types": "dist/index.d.ts",
|
|
15
|
+
"scripts": {
|
|
16
|
+
"build": "tsup",
|
|
17
|
+
"watch": "tsup --watch --silent"
|
|
18
|
+
},
|
|
19
|
+
"browserslist": [
|
|
20
|
+
"> 0.2%, last 2 versions, not dead"
|
|
21
|
+
],
|
|
22
|
+
"bugs": "https://git.corp.adobe.com/dx-devex-acceleration/uix-sdk/issues",
|
|
23
|
+
"files": [
|
|
24
|
+
"README.md",
|
|
25
|
+
"dist",
|
|
26
|
+
"src",
|
|
27
|
+
"tsconfig.json"
|
|
28
|
+
],
|
|
29
|
+
"homepage": "https://git.corp.adobe.com/dx-devex-acceleration/uix-sdk",
|
|
30
|
+
"license": "Apache-2.0",
|
|
31
|
+
"repository": {
|
|
32
|
+
"type": "git",
|
|
33
|
+
"url": "https://git.corp.adobe.com/dx-devex-acceleration/uix-sdk.git"
|
|
34
|
+
},
|
|
35
|
+
"sideEffects": false
|
|
36
|
+
}
|