@dropins/tools 2.0.0-beta.1 → 2.0.1-alpha-20260728135101
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/CHANGELOG.md +462 -64
- package/LICENSE.md +257 -157
- package/chunks/Image.js.map +1 -1
- package/chunks/cjs.js.map +1 -1
- package/chunks/format-calendar-date.js.map +1 -1
- package/chunks/image-params-keymap.js.map +1 -1
- package/chunks/initializer.js.map +1 -1
- package/chunks/locale-config.js.map +1 -1
- package/chunks/preact-vendor.js.map +1 -1
- package/chunks/vcomponent.js.map +1 -1
- package/components.js +1 -1
- package/components.js.map +1 -1
- package/event-bus.js.map +1 -1
- package/fetch-graphql.js.map +1 -1
- package/lib/aem/assets.js.map +1 -1
- package/lib/aem/configs.js.map +1 -1
- package/lib.js.map +1 -1
- package/package.json +1 -1
- package/recaptcha.js.map +1 -1
- package/shims/importmap.js.map +1 -1
- package/signals.js.map +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"image-params-keymap.js","sources":["/@dropins/tools/src/lib/image-params-keymap.ts"],"sourcesContent":["/********************************************************************\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: Adobe permits you to use, modify, and distribute this
|
|
1
|
+
{"version":3,"file":"image-params-keymap.js","sources":["/@dropins/tools/src/lib/image-params-keymap.ts"],"sourcesContent":["/********************************************************************\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: Adobe permits you to use, modify, and distribute this\n * file in accordance with the terms of the Adobe license agreement\n * accompanying it.\n *******************************************************************/\n\nclass ImageParamsKeyMap {\n private _map:\n { [key: string]: string | ((data: any) => [string, string]) } | undefined;\n\n get map() {\n return this._map;\n }\n\n set map(value: typeof this._map) {\n this._map = value;\n }\n\n public getMethods() {\n return {\n setMap: (value: typeof this._map) => {\n this.map = value;\n },\n getMap: () => this.map,\n };\n }\n}\n\nconst keyMap = new ImageParamsKeyMap();\n\nexport const { setMap: setImageParamsKeyMap, getMap: getImageParamsKeyMap } =\n keyMap.getMethods();\n"],"names":["ImageParamsKeyMap","__publicField","value","keyMap","setImageParamsKeyMap","getImageParamsKeyMap"],"mappings":"oKASA,MAAMA,CAAkB,CAAxB,cACUC,EAAA,aAGR,IAAI,KAAM,CACR,OAAO,KAAK,IACd,CAEA,IAAI,IAAIC,EAAyB,CAC/B,KAAK,KAAOA,CACd,CAEO,YAAa,CAClB,MAAO,CACL,OAASA,GAA4B,CACnC,KAAK,IAAMA,CACb,EACA,OAAQ,IAAM,KAAK,GAAA,CAEvB,CACF,CAEA,MAAMC,EAAS,IAAIH,EAEN,CAAE,OAAQI,EAAsB,OAAQC,CAAA,EACnDF,EAAO,WAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"initializer.js","sources":["/@dropins/tools/src/lib/config.ts","/@dropins/tools/src/lib/initializer.ts"],"sourcesContent":["/********************************************************************\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: Adobe permits you to use, modify, and distribute this
|
|
1
|
+
{"version":3,"file":"initializer.js","sources":["/@dropins/tools/src/lib/config.ts","/@dropins/tools/src/lib/initializer.ts"],"sourcesContent":["/********************************************************************\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: Adobe permits you to use, modify, and distribute this\n * file in accordance with the terms of the Adobe license agreement\n * accompanying it.\n *******************************************************************/\n\nexport class Config<T> {\n private config: T;\n\n constructor(initialConfig: T) {\n this.config = initialConfig;\n }\n\n getConfig(): T {\n return this.config;\n }\n\n setConfig(newConfig: T): void {\n this.config = newConfig;\n }\n}\n","/********************************************************************\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: Adobe permits you to use, modify, and distribute this\n * file in accordance with the terms of the Adobe license agreement\n * accompanying it.\n *******************************************************************/\n\nimport {\n Config,\n setImageParamsKeyMap,\n setGlobalLocale,\n} from '@adobe-commerce/elsie/lib';\n\ntype Listener = { off(): void };\n\ntype Listeners<T> = (config?: T) => Array<Listener | undefined>;\n\ntype Init<T> = (config?: T) => Promise<void>;\n\ntype Options<T> = { init: Init<T>; listeners: Listeners<T> };\n\nexport type Model<T = any, D = any> = {\n transformer?: (data: D) => T & { [key: string]: any };\n};\n\n/**\n * The `Initializer` class is responsible for setting up event listeners and initializing a module with the given configuration.\n *\n * @template T - The type of the configuration object.\n * @class\n */\nexport class Initializer<T> {\n private _listeners: Listener[] = [];\n listeners: Listeners<T>;\n init: Init<T>;\n config = new Config<T>({} as T);\n\n /**\n * Creates an instance of Initializer.\n * @param options - The initialization options.\n * @param options.init - A function that initializes the module.\n * @param options.listeners - A function that sets up event listeners.\n */\n constructor({ init, listeners }: Options<T>) {\n this.listeners = (config) => {\n // Unbind existing listeners\n this._listeners.forEach((listener) => listener.off());\n // Bind new listeners\n return (this._listeners = listeners(config) as Listener[]);\n };\n\n this.init = (options) => {\n const { imageParamsKeyMap, globalLocale, ...rest } = options as any;\n this.config.setConfig({ ...this.config.getConfig(), ...rest });\n setImageParamsKeyMap(imageParamsKeyMap);\n setGlobalLocale(globalLocale);\n return init(options);\n };\n }\n}\n\ntype Initializers = [Initializer<any>, { [key: string]: any } | undefined][];\n\n/**\n * The Initializers class provides methods to register, mount, and configure initializers.\n *\n * @class\n *\n * @method register - Registers a new initializer. If the initializers have already been mounted, it immediately binds the event listeners and initializes the API for the new initializer.\n * @method mount - Mounts all registered initializers. This involves binding the event listeners and initializing the APIs for each initializer, in that order.\n * @method setImageParamKeys - Sets the image parameter keys. These keys are used when initializing the APIs for the initializers.\n */\nexport class initializers {\n static _initializers: Initializers = [];\n static _mounted: boolean = false;\n static _imageParamsKeyMap: { [key: string]: string } | undefined = undefined;\n static _globalLocale: string | undefined = undefined;\n /**\n * Registers a new initializer. If the initializers have already been mounted,it immediately binds the event listeners and initializes the API for the new initializer.\n * @param initializer - The initializer to register.\n * @param options - Optional configuration for the initializer.\n */\n static register(\n initializer: Initializer<any>,\n options?: { [key: string]: any },\n ) {\n if (initializers._mounted) {\n initializer.listeners?.(options);\n initializer.init?.(options);\n }\n initializers._initializers.push([initializer, options]);\n }\n\n /**\n * Mounts the provided initializer immediately. This involves binding the event listeners and initializing the API for the initializer.\n */\n static async mountImmediately(\n initializer: Initializer<any>,\n options?: { [key: string]: any },\n ) {\n initializer.listeners?.(options);\n await initializer.init?.({\n imageParamsKeyMap: initializers._imageParamsKeyMap,\n globalLocale: initializers._globalLocale,\n ...options,\n });\n }\n\n /**\n * Mounts all registered initializers. This involves binding the event listeners and initializing the APIs for each initializer, in that order.\n */\n static mount() {\n initializers._mounted = true;\n // In this specific order\n // 1. Bind events\n initializers._initializers?.forEach(([initializer, options]) => {\n initializer.listeners?.(options);\n });\n\n // 2. Initialize APIs\n initializers._initializers?.forEach(([initializer, options]) => {\n initializer.init?.({\n imageParamsKeyMap: initializers._imageParamsKeyMap,\n globalLocale: initializers._globalLocale,\n ...options,\n });\n });\n }\n /**\n * Sets the image parameter keys. These keys are used when initializing the APIs for the initializers.\n * @param params - The image parameter keys.\n */\n static setImageParamKeys(params: { [key: string]: any }) {\n initializers._imageParamsKeyMap = params;\n }\n\n /**\n * Sets the global locale. This locale is used by components that need consistent formatting regardless of the user's browser locale.\n * @param locale - The locale string (e.g., 'en-US', 'es-MX', 'fr-FR').\n */\n static setGlobalLocale(locale: string) {\n initializers._globalLocale = locale;\n }\n}\n"],"names":["Config","initialConfig","__publicField","newConfig","Initializer","init","listeners","config","listener","options","imageParamsKeyMap","globalLocale","rest","setImageParamsKeyMap","setGlobalLocale","_initializers","initializer","_a","_b","params","locale","initializers"],"mappings":"wPASO,MAAMA,CAAU,CAGrB,YAAYC,EAAkB,CAFtBC,EAAA,eAGN,KAAK,OAASD,CAChB,CAEA,WAAe,CACb,OAAO,KAAK,MACd,CAEA,UAAUE,EAAoB,CAC5B,KAAK,OAASA,CAChB,CACF,CCUO,MAAMC,CAAe,CAY1B,YAAY,CAAE,KAAAC,EAAM,UAAAC,GAAyB,CAXrCJ,EAAA,kB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cA,EAAa,cAC3B,GAAGN,CAAA,EAEP,EACF,CAKA,OAAO,kBAAkBU,EAAgC,CACvDJ,EAAa,mBAAqBI,CACpC,CAMA,OAAO,gBAAgBC,EAAgB,CACrCL,EAAa,cAAgBK,CAC/B,CACF,EAtEElB,EADWa,EACJ,gBAA8B,CAAA,GACrCb,EAFWa,EAEJ,WAAoB,IAC3Bb,EAHWa,EAGJ,sBACPb,EAJWa,EAIJ,iBAJF,IAAMM,EAANN"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"locale-config.js","sources":["/@dropins/tools/src/lib/locale-config.ts"],"sourcesContent":["/********************************************************************\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: Adobe permits you to use, modify, and distribute this
|
|
1
|
+
{"version":3,"file":"locale-config.js","sources":["/@dropins/tools/src/lib/locale-config.ts"],"sourcesContent":["/********************************************************************\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: Adobe permits you to use, modify, and distribute this\n * file in accordance with the terms of the Adobe license agreement\n * accompanying it.\n *******************************************************************/\n\nclass LocaleConfig {\n private _locale?: string | undefined;\n\n get locale() {\n return this._locale;\n }\n\n set locale(value: typeof this._locale) {\n this._locale = value;\n }\n\n public getMethods() {\n return {\n setLocale: (value: typeof this._locale) => {\n this.locale = value;\n },\n getLocale: () => this.locale,\n };\n }\n}\n\nconst localeConfig = new LocaleConfig();\n\nexport const { setLocale: setGlobalLocale, getLocale: getGlobalLocale } =\n localeConfig.getMethods();\n"],"names":["LocaleConfig","__publicField","value","localeConfig","setGlobalLocale","getGlobalLocale"],"mappings":"oKASA,MAAMA,CAAa,CAAnB,cACUC,EAAA,gBAER,IAAI,QAAS,CACX,OAAO,KAAK,OACd,CAEA,IAAI,OAAOC,EAA4B,CACrC,KAAK,QAAUA,CACjB,CAEO,YAAa,CAClB,MAAO,CACL,UAAYA,GAA+B,CACzC,KAAK,OAASA,CAChB,EACA,UAAW,IAAM,KAAK,MAAA,CAE1B,CACF,CAEA,MAAMC,EAAe,IAAIH,EAEZ,CAAE,UAAWI,EAAiB,UAAWC,CAAA,EACpDF,EAAa,WAAA"}
|