@swarm.ing/pieui 2.1.2 → 2.1.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.
Files changed (43) hide show
  1. package/README.md +52 -0
  2. package/dist/components/Common/DeviceStorageCard/ui/DeviceStorageCard.d.ts +15 -0
  3. package/dist/components/Common/DeviceStorageCard/ui/DeviceStorageCard.d.ts.map +1 -1
  4. package/dist/components/Common/SessionStorageCard/ui/SessionStorageCard.d.ts +15 -0
  5. package/dist/components/Common/SessionStorageCard/ui/SessionStorageCard.d.ts.map +1 -1
  6. package/dist/components/index.d.ts +0 -2
  7. package/dist/components/index.d.ts.map +1 -1
  8. package/dist/components/index.esm.js +1 -1
  9. package/dist/components/index.js +1 -1
  10. package/dist/index.d.ts +2 -2
  11. package/dist/index.d.ts.map +1 -1
  12. package/dist/index.esm.js +2 -2
  13. package/dist/index.js +2 -2
  14. package/dist/pieui.components.json +62 -62
  15. package/dist/storybook/addon/manager.esm.js +2 -0
  16. package/dist/storybook/addon/manager.js +2 -0
  17. package/dist/telegram/components/CloudStorageCard/index.d.ts.map +1 -0
  18. package/dist/telegram/components/CloudStorageCard/types/index.d.ts.map +1 -0
  19. package/dist/telegram/components/CloudStorageCard/ui/CloudStorageCard.d.ts +15 -0
  20. package/dist/telegram/components/CloudStorageCard/ui/CloudStorageCard.d.ts.map +1 -0
  21. package/dist/telegram/components/SecureStorageCard/index.d.ts.map +1 -0
  22. package/dist/telegram/components/SecureStorageCard/types/index.d.ts.map +1 -0
  23. package/dist/telegram/components/SecureStorageCard/ui/SecureStorageCard.d.ts +15 -0
  24. package/dist/telegram/components/SecureStorageCard/ui/SecureStorageCard.d.ts.map +1 -0
  25. package/dist/telegram/index.d.ts +4 -0
  26. package/dist/telegram/index.d.ts.map +1 -1
  27. package/dist/telegram/index.esm.js +1 -1
  28. package/dist/telegram/index.js +1 -1
  29. package/dist/util/ajaxCommonUtils.d.ts +60 -13
  30. package/dist/util/ajaxCommonUtils.d.ts.map +1 -1
  31. package/package.json +2 -2
  32. package/dist/components/Common/CloudStorageCard/index.d.ts.map +0 -1
  33. package/dist/components/Common/CloudStorageCard/types/index.d.ts.map +0 -1
  34. package/dist/components/Common/CloudStorageCard/ui/CloudStorageCard.d.ts +0 -4
  35. package/dist/components/Common/CloudStorageCard/ui/CloudStorageCard.d.ts.map +0 -1
  36. package/dist/components/Common/SecureStorageCard/index.d.ts.map +0 -1
  37. package/dist/components/Common/SecureStorageCard/types/index.d.ts.map +0 -1
  38. package/dist/components/Common/SecureStorageCard/ui/SecureStorageCard.d.ts +0 -4
  39. package/dist/components/Common/SecureStorageCard/ui/SecureStorageCard.d.ts.map +0 -1
  40. /package/dist/{components/Common → telegram/components}/CloudStorageCard/index.d.ts +0 -0
  41. /package/dist/{components/Common → telegram/components}/CloudStorageCard/types/index.d.ts +0 -0
  42. /package/dist/{components/Common → telegram/components}/SecureStorageCard/index.d.ts +0 -0
  43. /package/dist/{components/Common → telegram/components}/SecureStorageCard/types/index.d.ts +0 -0
@@ -27,23 +27,64 @@ export type GetAjaxSubmitOptions = {
27
27
  retryPolicy?: RetryPolicy;
28
28
  };
29
29
  /**
30
- * Reads the value(s) for a single dep name from the DOM, following the same
31
- * convention used by Ajax cards. Returns an array because file inputs can
32
- * contribute multiple values for the same key.
30
+ * The origin a dep value is read from. `dom` is the default for any name
31
+ * without a recognized prefix.
32
+ */
33
+ export type DepSource = 'dom' | 'sid' | 'localStorage' | 'sessionStorage' | 'cookie' | 'url' | 'telegram:cloud' | 'telegram:secure';
34
+ /**
35
+ * Splits a dep name into its source and bare key, following the magic-name
36
+ * convention used by Ajax cards.
37
+ *
38
+ * - `'sid'` → `{ source: 'sid', key: 'sid' }` (SocketIO session id).
39
+ * - `'localStorage:token'` → `{ source: 'localStorage', key: 'token' }`; the
40
+ * same for `sessionStorage:`, `cookie:`, `url:`, `telegram:cloud:` and
41
+ * `telegram:secure:` prefixes.
42
+ * - Anything else (including a name that contains a colon but no recognized
43
+ * prefix) → `{ source: 'dom', key: <name> }`.
33
44
  *
45
+ * The returned `key` is what gets sent to the backend as the field name, so a
46
+ * prefixed dep is submitted under its bare key (`localStorage:token` → `token`).
47
+ */
48
+ export declare const parseDepName: (depName: string) => {
49
+ source: DepSource;
50
+ key: string;
51
+ };
52
+ /**
53
+ * Reads the value(s) for a single dep name, following the same convention used
54
+ * by Ajax cards. Returns an array because file inputs (and cookies / repeated
55
+ * URL params) can contribute multiple values for the same key.
56
+ *
57
+ * The source is determined by {@link parseDepName}:
34
58
  * - `'sid'` resolves to `window.sid`. The caller must ensure SocketIO is
35
59
  * ready (e.g. via {@link waitForSidAvailable}) before calling this.
36
- * - Other names are looked up via `document.getElementsByName`; only the
37
- * first match is read.
38
- * - `<input type="file">` returns every selected `File`.
39
- * - Other `<input>` / `<textarea>` returns the current `.value`.
40
- * - Missing inputs return `[]` (and emit a warning when `renderingLogEnabled`).
60
+ * - `localStorage:` / `sessionStorage:` read `getItem(key)` (try/caught, since
61
+ * storage access can throw in private mode); missing/blocked → `[]`.
62
+ * - `cookie:` reads and `decodeURIComponent`s the matching cookie; missing →
63
+ * `[]`.
64
+ * - `url:` reads `URLSearchParams(location.search).getAll(key)` (repeated
65
+ * params supported); missing → `[]`.
66
+ * - `telegram:cloud:` / `telegram:secure:` are asynchronous and cannot be
67
+ * served here — they return `[]`. Use {@link readAjaxKeyAsync} instead (the
68
+ * Ajax submit flow already does).
69
+ * - DOM names are looked up via `document.getElementsByName`; only the first
70
+ * match is read. `<input type="file">` returns every selected `File`; other
71
+ * `<input>` / `<textarea>` returns the current `.value`.
72
+ * - Missing values return `[]` (and emit a warning when `renderingLogEnabled`).
41
73
  *
42
74
  * Must run in a browser environment — relies on `document` and `window`.
43
75
  *
44
- * @throws if `depName === 'sid'` and `window.sid` is not initialized.
76
+ * @throws if the resolved source is `sid` and `window.sid` is not initialized.
45
77
  */
46
78
  export declare const readAjaxKey: (depName: string, renderingLogEnabled?: boolean) => Array<string | File>;
79
+ /**
80
+ * Asynchronous counterpart to {@link readAjaxKey}. Behaves identically for all
81
+ * synchronous sources (it delegates to `readAjaxKey`) but additionally resolves
82
+ * the asynchronous Telegram sources (`telegram:cloud:` / `telegram:secure:`).
83
+ *
84
+ * This is what the Ajax submit flow uses so that every supported source — sync
85
+ * or async — can contribute values to the request.
86
+ */
87
+ export declare const readAjaxKeyAsync: (depName: string, renderingLogEnabled?: boolean) => Promise<Array<string | File>>;
47
88
  /**
48
89
  * Builds an async "submit" function that issues an AJAX request to
49
90
  * `api/ajax_content{pathname}` and streams (or JSON-decodes) the response
@@ -52,8 +93,11 @@ export declare const readAjaxKey: (depName: string, renderingLogEnabled?: boolea
52
93
  * The returned function collects form data from:
53
94
  * 1. the static `kwargs` object,
54
95
  * 2. any `extraKwargs` passed at call time,
55
- * 3. named inputs from the DOM listed in `depsNames` (including `sid`,
56
- * which is resolved via {@link waitForSidAvailable}), and
96
+ * 3. the dep names in `depsNames`, each resolved by {@link readAjaxKeyAsync}
97
+ * from its source: DOM inputs by default, `sid` (resolved via
98
+ * {@link waitForSidAvailable}), or the `localStorage:`, `sessionStorage:`,
99
+ * `cookie:`, `url:`, `telegram:cloud:` and `telegram:secure:` prefixes —
100
+ * submitted under the bare key, and
57
101
  * 4. file inputs (multiple files supported).
58
102
  *
59
103
  * If the server streams NDJSON, each line is parsed as a `UIEventType` and
@@ -65,8 +109,11 @@ export declare const readAjaxKey: (depName: string, renderingLogEnabled?: boolea
65
109
  *
66
110
  * @param setUiAjaxConfiguration Setter provided by the enclosing Ajax card.
67
111
  * @param kwargs Static key/value pairs appended to the request.
68
- * @param depsNames Names of DOM inputs whose current values should
69
- * also be sent.
112
+ * @param depsNames Dep names whose current values should also be
113
+ * sent. Plain names read DOM inputs; the
114
+ * `localStorage:`, `sessionStorage:`, `cookie:`,
115
+ * `url:`, `telegram:cloud:` and `telegram:secure:`
116
+ * prefixes read those client sources.
70
117
  * @param pathname Path segment appended to `api/ajax_content`.
71
118
  * @param options See {@link GetAjaxSubmitOptions}.
72
119
  * @returns An `async (extraKwargs?) => Promise<any>` submit function.
@@ -1 +1 @@
1
- {"version":3,"file":"ajaxCommonUtils.d.ts","sourceRoot":"","sources":["../../src/util/ajaxCommonUtils.ts"],"names":[],"mappings":"AAEA,OAAO,UAAU,CAAA;AACjB,OAAO,EAAE,0BAA0B,EAAe,MAAM,UAAU,CAAA;AAKlE;;GAEG;AACH,MAAM,MAAM,WAAW,GAAG;IACtB,kEAAkE;IAClE,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,iFAAiF;IACjF,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,kJAAkJ;IAClJ,OAAO,CAAC,EAAE,MAAM,EAAE,CAAA;CACrB,CAAA;AAED;;;;GAIG;AACH,MAAM,MAAM,oBAAoB,GAAG;IAC/B,4DAA4D;IAC5D,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACzB,uEAAuE;IACvE,mBAAmB,CAAC,EAAE,OAAO,CAAA;IAC7B,8DAA8D;IAC9D,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,+DAA+D;IAC/D,WAAW,CAAC,EAAE,WAAW,CAAA;CAC5B,CAAA;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,WAAW,GACpB,SAAS,MAAM,EACf,sBAAqB,OAAe,KACrC,KAAK,CAAC,MAAM,GAAG,IAAI,CAyBrB,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,eAAO,MAAM,aAAa,GACtB,yBAAyB,0BAA0B,EACnD,SAAQ,MAAM,CAAC,MAAM,EAAE,GAAG,CAAM,EAChC,YAAW,KAAK,CAAC,MAAM,CAAM,EAC7B,WAAW,MAAM,EACjB,UAAU,oBAAoB,MAahB,cAAa,MAAM,CAAC,MAAM,EAAE,GAAG,CAAM,iBAuKtD,CAAA;AAED;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,aAAa,GACtB,yBAAyB,0BAA0B,EACnD,S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;;;GAyBG;AACH,eAAO,MAAM,WAAW,GACpB,SAAS,MAAM,EACf,sBAAqB,OAAe,KACrC,KAAK,CAAC,MAAM,GAAG,IAAI,CA6ErB,CAAA;AA6ED;;;;;;;GAOG;AACH,eAAO,MAAM,gBAAgB,GACzB,SAAS,MAAM,EACf,sBAAqB,OAAe,KACrC,OAAO,CAAC,KAAK,CAAC,MAAM,GAAG,IAAI,CAAC,CAM9B,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,eAAO,MAAM,aAAa,GACtB,yBAAyB,0BAA0B,EACnD,SAAQ,MAAM,CAAC,MAAM,EAAE,GAAG,CAAM,EAChC,YAAW,KAAK,CAAC,MAAM,CAAM,EAC7B,WAAW,MAAM,EACjB,UAAU,oBAAoB,MAahB,cAAa,MAAM,CAAC,MAAM,EAAE,GAAG,CAAM,iBA2KtD,CAAA;AAED;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,aAAa,GACtB,yBAAyB,0BAA0B,EACnD,SAAQ,MAAM,CAAC,MAAM,EAAE,GAAG,CAAM,EAChC,YAAW,KAAK,CAAC,MAAM,CAAM,EAC7B,WAAW,MAAM,EACjB,UAAU;IAAE,OAAO,CAAC,EAAE,MAAM,CAAC;IAAC,WAAW,CAAC,EAAE,WAAW,CAAA;CAAE,oBAjM9B,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,iBA6NjD,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@swarm.ing/pieui",
3
- "version": "2.1.2",
3
+ "version": "2.1.3",
4
4
  "description": "A React component library featuring PieCard component",
5
5
  "repository": {
6
6
  "type": "git",
@@ -61,7 +61,7 @@
61
61
  }
62
62
  },
63
63
  "scripts": {
64
- "build": "rm -rf ./dist && rm -rf pieui-*.tgz && bun run build:clean && NODE_ENV=production bun run build:esm && NODE_ENV=production bun run build:cjs && NODE_ENV=production bun run build:components:esm && NODE_ENV=production bun run build:components:cjs && NODE_ENV=production bun run build:agent:esm && NODE_ENV=production bun run build:agent:cjs && NODE_ENV=production bun run build:telegram:esm && NODE_ENV=production bun run build:telegram:cjs && NODE_ENV=production bun run build:max:esm && NODE_ENV=production bun run build:max:cjs && NODE_ENV=production bun run build:storybook:esm && NODE_ENV=production bun run build:storybook:cjs && NODE_ENV=production bun run build:storybook:addon:esm && NODE_ENV=production bun run build:storybook:addon:cjs && NODE_ENV=production bun run build:storybook:addon:preset && bun run build:banner && NODE_ENV=production bun run build:types && NODE_ENV=production bun run build:cli && bun src/cli.ts postbuild --src-dir src --out-dir dist && bun pm pack",
64
+ "build": "rm -rf ./dist && rm -rf pieui-*.tgz && bun run build:clean && NODE_ENV=production bun run build:esm && NODE_ENV=production bun run build:cjs && NODE_ENV=production bun run build:components:esm && NODE_ENV=production bun run build:components:cjs && NODE_ENV=production bun run build:agent:esm && NODE_ENV=production bun run build:agent:cjs && NODE_ENV=production bun run build:telegram:esm && NODE_ENV=production bun run build:telegram:cjs && NODE_ENV=production bun run build:max:esm && NODE_ENV=production bun run build:max:cjs && NODE_ENV=production bun run build:storybook:esm && NODE_ENV=production bun run build:storybook:cjs && NODE_ENV=production bun run build:storybook:addon:esm && NODE_ENV=production bun run build:storybook:addon:cjs && NODE_ENV=production bun run build:storybook:addon:manager:esm && NODE_ENV=production bun run build:storybook:addon:manager:cjs && NODE_ENV=production bun run build:storybook:addon:preset && bun run build:banner && NODE_ENV=production bun run build:types && NODE_ENV=production bun run build:cli && bun src/cli.ts postbuild --src-dir src --out-dir dist && bun pm pack",
65
65
  "build:banner": "node -e \"const fs=require('fs');['dist/index.esm.js','dist/index.js','dist/components/index.esm.js','dist/components/index.js','dist/agent/index.esm.js','dist/agent/index.js','dist/telegram/index.esm.js','dist/telegram/index.js','dist/max/index.esm.js','dist/max/index.js','dist/storybook/index.esm.js','dist/storybook/index.js','dist/storybook/addon/index.esm.js','dist/storybook/addon/index.js'].forEach(f=>{if(fs.existsSync(f)){fs.writeFileSync(f,'\\\"use client\\\";\\n'+fs.readFileSync(f,'utf8'))}})\"",
66
66
  "build:clean": "rm -rf dist",
67
67
  "build:esm": "bun build src/index.ts --outfile dist/index.esm.js --format esm --target browser --jsx=automatic --jsx-import-source=react --minify --packages=external",
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/Common/CloudStorageCard/index.ts"],"names":[],"mappings":";AAGA,wBAIE"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/Common/CloudStorageCard/types/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAA;AAE3D,MAAM,WAAW,oBAAoB;IACjC,IAAI,EAAE,MAAM,CAAA;IACZ,GAAG,EAAE,MAAM,CAAA;IACX,KAAK,EAAE,MAAM,CAAA;IAEb,kBAAkB,CAAC,EAAE,OAAO,CAAA;IAC5B,oBAAoB,CAAC,EAAE,OAAO,CAAA;IAC9B,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB,iBAAiB,CAAC,EAAE,MAAM,CAAA;CAC7B;AAED,MAAM,WAAW,qBAAsB,SAAQ,uBAAuB,CAAC,oBAAoB,CAAC;CAAG"}
@@ -1,4 +0,0 @@
1
- import { CloudStorageCardProps } from '../types';
2
- declare const CloudStorageCard: ({ data }: CloudStorageCardProps) => import("react").JSX.Element;
3
- export default CloudStorageCard;
4
- //# sourceMappingURL=CloudStorageCard.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"CloudStorageCard.d.ts","sourceRoot":"","sources":["../../../../../src/components/Common/CloudStorageCard/ui/CloudStorageCard.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAA;AAGhD,QAAA,MAAM,gBAAgB,GAAI,UAAU,qBAAqB,gCA6CxD,CAAA;AAED,eAAe,gBAAgB,CAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/Common/SecureStorageCard/index.ts"],"names":[],"mappings":";AAGA,wBAIE"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/Common/SecureStorageCard/types/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAA;AAE3D,MAAM,WAAW,qBAAqB;IAClC,IAAI,EAAE,MAAM,CAAA;IACZ,GAAG,EAAE,MAAM,CAAA;IACX,KAAK,EAAE,MAAM,CAAA;IAEb,kBAAkB,CAAC,EAAE,OAAO,CAAA;IAC5B,oBAAoB,CAAC,EAAE,OAAO,CAAA;IAC9B,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB,iBAAiB,CAAC,EAAE,MAAM,CAAA;CAC7B;AAED,MAAM,WAAW,sBAAuB,SAAQ,uBAAuB,CAAC,qBAAqB,CAAC;CAAG"}
@@ -1,4 +0,0 @@
1
- import { SecureStorageCardProps } from '../types';
2
- declare const SecureStorageCard: ({ data }: SecureStorageCardProps) => import("react").JSX.Element;
3
- export default SecureStorageCard;
4
- //# sourceMappingURL=SecureStorageCard.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"SecureStorageCard.d.ts","sourceRoot":"","sources":["../../../../../src/components/Common/SecureStorageCard/ui/SecureStorageCard.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAA;AAGjD,QAAA,MAAM,iBAAiB,GAAI,UAAU,sBAAsB,gCA6C1D,CAAA;AAED,eAAe,iBAAiB,CAAA"}