@pure-ds/core 0.7.46 → 0.7.47
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/custom-elements.json +193 -2
- package/dist/types/src/js/pds-core/pds-config.d.ts +4 -5
- package/dist/types/src/js/pds-core/pds-config.d.ts.map +1 -1
- package/dist/types/src/js/pds-core/pds-enhancers.d.ts.map +1 -1
- package/dist/types/src/js/pds-core/pds-generator.d.ts +16 -2
- package/dist/types/src/js/pds-core/pds-generator.d.ts.map +1 -1
- package/package.json +1 -1
- package/packages/pds-cli/bin/pds-mcp-health.js +1 -1
- package/packages/pds-cli/bin/pds-mcp-server.js +1 -1
- package/packages/pds-cli/bin/pds-setup-mcp.js +1 -1
- package/packages/pds-cli/bin/templates/bootstrap/esbuild-dev.cjs +65 -6
- package/packages/pds-cli/bin/templates/bootstrap/esbuild-dev.mjs +65 -6
- package/packages/pds-cli/bin/templates/bootstrap/public/assets/js/dev-reload.js +68 -9
- package/public/assets/js/app.js +1 -1
- package/public/assets/js/pds-enhancers.js +1 -1
- package/public/assets/js/pds-manager.js +444 -269
- package/public/assets/pds/core/pds-enhancers.js +1 -1
- package/public/assets/pds/core/pds-manager.js +444 -269
- package/public/assets/pds/pds-css-complete.json +544 -55
- package/public/assets/pds/pds.css-data.json +154 -0
- package/public/assets/pds/vscode-custom-data.json +30 -0
- package/readme.md +15 -1
- package/src/js/pds-core/pds-config.js +63 -10
- package/src/js/pds-core/pds-enhancers.js +6 -1
- package/src/js/pds-core/pds-generator.js +770 -210
- package/src/js/pds.js +4 -4
package/custom-elements.json
CHANGED
|
@@ -2817,6 +2817,143 @@
|
|
|
2817
2817
|
"description": "Locale switcher component.\r\n\r\nThe component only persists canonical 5-letter locale tags (`xx-YY`),\r\nfor example `en-US` and `nl-NL`.",
|
|
2818
2818
|
"name": "PdsLocale",
|
|
2819
2819
|
"members": [
|
|
2820
|
+
{
|
|
2821
|
+
"kind": "field",
|
|
2822
|
+
"name": "formAssociated",
|
|
2823
|
+
"type": {
|
|
2824
|
+
"text": "boolean"
|
|
2825
|
+
},
|
|
2826
|
+
"static": true,
|
|
2827
|
+
"default": "true"
|
|
2828
|
+
},
|
|
2829
|
+
{
|
|
2830
|
+
"kind": "method",
|
|
2831
|
+
"name": "formAssociatedCallback"
|
|
2832
|
+
},
|
|
2833
|
+
{
|
|
2834
|
+
"kind": "method",
|
|
2835
|
+
"name": "formDisabledCallback",
|
|
2836
|
+
"parameters": [
|
|
2837
|
+
{
|
|
2838
|
+
"name": "disabled"
|
|
2839
|
+
}
|
|
2840
|
+
]
|
|
2841
|
+
},
|
|
2842
|
+
{
|
|
2843
|
+
"kind": "method",
|
|
2844
|
+
"name": "formResetCallback"
|
|
2845
|
+
},
|
|
2846
|
+
{
|
|
2847
|
+
"kind": "method",
|
|
2848
|
+
"name": "formStateRestoreCallback",
|
|
2849
|
+
"parameters": [
|
|
2850
|
+
{
|
|
2851
|
+
"name": "state"
|
|
2852
|
+
}
|
|
2853
|
+
]
|
|
2854
|
+
},
|
|
2855
|
+
{
|
|
2856
|
+
"kind": "method",
|
|
2857
|
+
"name": "checkValidity"
|
|
2858
|
+
},
|
|
2859
|
+
{
|
|
2860
|
+
"kind": "method",
|
|
2861
|
+
"name": "reportValidity"
|
|
2862
|
+
},
|
|
2863
|
+
{
|
|
2864
|
+
"kind": "field",
|
|
2865
|
+
"name": "form",
|
|
2866
|
+
"readonly": true,
|
|
2867
|
+
"type": {
|
|
2868
|
+
"text": "HTMLFormElement|null"
|
|
2869
|
+
},
|
|
2870
|
+
"description": "Associated form element."
|
|
2871
|
+
},
|
|
2872
|
+
{
|
|
2873
|
+
"kind": "field",
|
|
2874
|
+
"name": "labels",
|
|
2875
|
+
"readonly": true,
|
|
2876
|
+
"type": {
|
|
2877
|
+
"text": "NodeListOf<HTMLLabelElement>|null"
|
|
2878
|
+
},
|
|
2879
|
+
"description": "Associated labels."
|
|
2880
|
+
},
|
|
2881
|
+
{
|
|
2882
|
+
"kind": "field",
|
|
2883
|
+
"name": "type",
|
|
2884
|
+
"readonly": true,
|
|
2885
|
+
"type": {
|
|
2886
|
+
"text": "string"
|
|
2887
|
+
},
|
|
2888
|
+
"description": "Form control type."
|
|
2889
|
+
},
|
|
2890
|
+
{
|
|
2891
|
+
"kind": "field",
|
|
2892
|
+
"name": "validity",
|
|
2893
|
+
"readonly": true,
|
|
2894
|
+
"type": {
|
|
2895
|
+
"text": "ValidityState|null"
|
|
2896
|
+
},
|
|
2897
|
+
"description": "Current validity state."
|
|
2898
|
+
},
|
|
2899
|
+
{
|
|
2900
|
+
"kind": "field",
|
|
2901
|
+
"name": "validationMessage",
|
|
2902
|
+
"readonly": true,
|
|
2903
|
+
"type": {
|
|
2904
|
+
"text": "string"
|
|
2905
|
+
},
|
|
2906
|
+
"description": "Current validation message."
|
|
2907
|
+
},
|
|
2908
|
+
{
|
|
2909
|
+
"kind": "field",
|
|
2910
|
+
"name": "willValidate",
|
|
2911
|
+
"readonly": true,
|
|
2912
|
+
"type": {
|
|
2913
|
+
"text": "boolean"
|
|
2914
|
+
},
|
|
2915
|
+
"description": "Whether the control participates in validation."
|
|
2916
|
+
},
|
|
2917
|
+
{
|
|
2918
|
+
"kind": "field",
|
|
2919
|
+
"name": "name",
|
|
2920
|
+
"type": {
|
|
2921
|
+
"text": "string"
|
|
2922
|
+
},
|
|
2923
|
+
"description": "Form field name."
|
|
2924
|
+
},
|
|
2925
|
+
{
|
|
2926
|
+
"kind": "field",
|
|
2927
|
+
"name": "value",
|
|
2928
|
+
"type": {
|
|
2929
|
+
"text": "string"
|
|
2930
|
+
},
|
|
2931
|
+
"description": "Selected canonical locale tag (`xx-YY`)."
|
|
2932
|
+
},
|
|
2933
|
+
{
|
|
2934
|
+
"kind": "field",
|
|
2935
|
+
"name": "required",
|
|
2936
|
+
"type": {
|
|
2937
|
+
"text": "boolean"
|
|
2938
|
+
},
|
|
2939
|
+
"description": "Whether a value is required."
|
|
2940
|
+
},
|
|
2941
|
+
{
|
|
2942
|
+
"kind": "field",
|
|
2943
|
+
"name": "disabled",
|
|
2944
|
+
"type": {
|
|
2945
|
+
"text": "boolean"
|
|
2946
|
+
},
|
|
2947
|
+
"description": "Whether interaction is disabled."
|
|
2948
|
+
},
|
|
2949
|
+
{
|
|
2950
|
+
"kind": "field",
|
|
2951
|
+
"name": "mode",
|
|
2952
|
+
"type": {
|
|
2953
|
+
"text": "\"compact\"|\"full\""
|
|
2954
|
+
},
|
|
2955
|
+
"description": "Label display mode."
|
|
2956
|
+
},
|
|
2820
2957
|
{
|
|
2821
2958
|
"kind": "method",
|
|
2822
2959
|
"name": "whenReady",
|
|
@@ -2850,21 +2987,75 @@
|
|
|
2850
2987
|
}
|
|
2851
2988
|
],
|
|
2852
2989
|
"events": [
|
|
2990
|
+
{
|
|
2991
|
+
"name": "input",
|
|
2992
|
+
"type": {
|
|
2993
|
+
"text": "Event"
|
|
2994
|
+
},
|
|
2995
|
+
"description": "Native-like input event when user selection changes."
|
|
2996
|
+
},
|
|
2997
|
+
{
|
|
2998
|
+
"name": "change",
|
|
2999
|
+
"type": {
|
|
3000
|
+
"text": "Event"
|
|
3001
|
+
},
|
|
3002
|
+
"description": "Native-like change event when user selection changes."
|
|
3003
|
+
},
|
|
2853
3004
|
{
|
|
2854
3005
|
"name": "pds-locale:ready",
|
|
2855
3006
|
"type": {
|
|
2856
3007
|
"text": "CustomEvent"
|
|
2857
3008
|
},
|
|
2858
3009
|
"description": "Emitted after locale availability is resolved."
|
|
3010
|
+
},
|
|
3011
|
+
{
|
|
3012
|
+
"description": "Emitted after a new locale is selected.",
|
|
3013
|
+
"name": "pds:locale:changed"
|
|
2859
3014
|
}
|
|
2860
3015
|
],
|
|
2861
3016
|
"attributes": [
|
|
2862
3017
|
{
|
|
3018
|
+
"name": "name",
|
|
3019
|
+
"type": {
|
|
3020
|
+
"text": "string"
|
|
3021
|
+
},
|
|
3022
|
+
"description": "Form field name used during submit."
|
|
3023
|
+
},
|
|
3024
|
+
{
|
|
3025
|
+
"name": "value",
|
|
3026
|
+
"type": {
|
|
3027
|
+
"text": "string"
|
|
3028
|
+
},
|
|
3029
|
+
"description": "Selected canonical locale tag (`xx-YY`)."
|
|
3030
|
+
},
|
|
3031
|
+
{
|
|
3032
|
+
"name": "required",
|
|
3033
|
+
"type": {
|
|
3034
|
+
"text": "boolean"
|
|
3035
|
+
},
|
|
3036
|
+
"description": "Requires a locale value for validity."
|
|
3037
|
+
},
|
|
3038
|
+
{
|
|
3039
|
+
"name": "disabled",
|
|
3040
|
+
"type": {
|
|
3041
|
+
"text": "boolean"
|
|
3042
|
+
},
|
|
3043
|
+
"description": "Disables interaction and omits form value."
|
|
3044
|
+
},
|
|
3045
|
+
{
|
|
3046
|
+
"name": "mode",
|
|
3047
|
+
"type": {
|
|
3048
|
+
"text": "\"compact\"|\"full\""
|
|
3049
|
+
},
|
|
3050
|
+
"description": "Label display mode. In `compact`, the UI shows 2-letter aliases and puts the full Intl language name in the `title` attribute. In `full`, it renders the full Intl language name as the visible label.",
|
|
3051
|
+
"default": "\"compact\""
|
|
3052
|
+
},
|
|
3053
|
+
{
|
|
3054
|
+
"name": "data-label",
|
|
2863
3055
|
"type": {
|
|
2864
3056
|
"text": "string"
|
|
2865
3057
|
},
|
|
2866
|
-
"description": "Accessible label for the locale radio group."
|
|
2867
|
-
"name": "data-label"
|
|
3058
|
+
"description": "Accessible label for the locale radio group."
|
|
2868
3059
|
}
|
|
2869
3060
|
],
|
|
2870
3061
|
"superclass": {
|
|
@@ -1680,7 +1680,6 @@ export const presets: {
|
|
|
1680
1680
|
darkMode: {
|
|
1681
1681
|
background: string;
|
|
1682
1682
|
secondary: string;
|
|
1683
|
-
primary: string;
|
|
1684
1683
|
};
|
|
1685
1684
|
};
|
|
1686
1685
|
typography: {
|
|
@@ -2028,19 +2027,19 @@ export type PDSColorsConfig = {
|
|
|
2028
2027
|
*/
|
|
2029
2028
|
background?: string;
|
|
2030
2029
|
/**
|
|
2031
|
-
* - Drives semantic success scale: --color-success
|
|
2030
|
+
* - Drives semantic success scale and role tokens: --color-success-*, --color-success-fill/text/*, and --surface-*-success-text.
|
|
2032
2031
|
*/
|
|
2033
2032
|
success?: string | null;
|
|
2034
2033
|
/**
|
|
2035
|
-
* - Drives semantic warning scale: --color-warning
|
|
2034
|
+
* - Drives semantic warning scale and role tokens: --color-warning-*, --color-warning-fill/text/*, and --surface-*-warning-text.
|
|
2036
2035
|
*/
|
|
2037
2036
|
warning?: string | null;
|
|
2038
2037
|
/**
|
|
2039
|
-
* - Drives semantic danger scale: --color-danger
|
|
2038
|
+
* - Drives semantic danger scale and role tokens: --color-danger-*, --color-danger-fill/text/*, and --surface-*-danger-text.
|
|
2040
2039
|
*/
|
|
2041
2040
|
danger?: string | null;
|
|
2042
2041
|
/**
|
|
2043
|
-
* - Drives semantic info scale: --color-info
|
|
2042
|
+
* - Drives semantic info scale and role tokens: --color-info-*, --color-info-fill/text/*, and --surface-*-info-text.
|
|
2044
2043
|
*/
|
|
2045
2044
|
info?: string | null;
|
|
2046
2045
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pds-config.d.ts","sourceRoot":"","sources":["../../../../../src/js/pds-core/pds-config.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"pds-config.d.ts","sourceRoot":"","sources":["../../../../../src/js/pds-core/pds-config.js"],"names":[],"mappings":"AAu+CA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAgCC;AAED,qEAEC;AAED;;UAUC;AAED;;UAUC;AA6nCD;;;;;;GAMG;AACH,kCAJW,MAAM,WACN,MAAM,WACH,GAAG,EAAA,QAuBhB;AA9vDD;;;GAGG;AACH,sCAGE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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AC,WAAW,CAAC;;;WAKpC,MAAM;aACN,MAAM;aACN,eAAe;gBACf,WAAW,EAAE,GAAG,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC;wBAC3C,OAAO;kBACP,OAAO;sBACP,MAAM;oBACN,OAAO;qBACP,MAAM,EAAE;iBACR,mBAAmB;iBACnB,MAAM;cACN,GAAG;eACH,OAAO;mBACP,qBAAqB;UACrB,GAAG;;AA8sCf;;;;;;;;;;;;;;;EASE;AAVF,2BAAoB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pds-enhancers.d.ts","sourceRoot":"","sources":["../../../../../src/js/pds-core/pds-enhancers.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"pds-enhancers.d.ts","sourceRoot":"","sources":["../../../../../src/js/pds-core/pds-enhancers.js"],"names":[],"mappings":"AAw0BA;;;;;GAKG;AACH;;;IAGI;AAlzBJ,mDAmBC"}
|
|
@@ -6,10 +6,14 @@
|
|
|
6
6
|
* @param {object} designConfig - A full or partial PDS config object
|
|
7
7
|
* @param {object} [options]
|
|
8
8
|
* @param {number} [options.minContrast=4.5] - Minimum contrast ratio for normal text
|
|
9
|
-
* @
|
|
9
|
+
* @param {boolean} [options.warnOnHueDrift=true] - Emit non-blocking brand-identity hue drift warnings for darkMode overrides.
|
|
10
|
+
* @param {number} [options.maxHueDrift=35] - Maximum recommended hue delta (degrees) before warning.
|
|
11
|
+
* @returns {{ ok: boolean, issues: Array<{path:string, message:string, ratio:number, min:number, context?:string}>, warnings: Array<{path:string, message:string, context?:string}> }}
|
|
10
12
|
*/
|
|
11
13
|
export function validateDesign(designConfig?: object, options?: {
|
|
12
14
|
minContrast?: number;
|
|
15
|
+
warnOnHueDrift?: boolean;
|
|
16
|
+
maxHueDrift?: number;
|
|
13
17
|
}): {
|
|
14
18
|
ok: boolean;
|
|
15
19
|
issues: Array<{
|
|
@@ -19,6 +23,11 @@ export function validateDesign(designConfig?: object, options?: {
|
|
|
19
23
|
min: number;
|
|
20
24
|
context?: string;
|
|
21
25
|
}>;
|
|
26
|
+
warnings: Array<{
|
|
27
|
+
path: string;
|
|
28
|
+
message: string;
|
|
29
|
+
context?: string;
|
|
30
|
+
}>;
|
|
22
31
|
};
|
|
23
32
|
/**
|
|
24
33
|
* Validate multiple design configurations at once.
|
|
@@ -26,7 +35,7 @@ export function validateDesign(designConfig?: object, options?: {
|
|
|
26
35
|
*
|
|
27
36
|
* @param {Array<object>} designs - Array of design configs; items may include an optional `name` property.
|
|
28
37
|
* @param {object} [options] - Options forwarded to validateDesign (e.g., { minContrast })
|
|
29
|
-
* @returns {{ ok: boolean, results: Array<{ name?: string, ok: boolean, issues: Array<{path:string, message:string, ratio:number, min:number, context?:string}> }> }}
|
|
38
|
+
* @returns {{ ok: boolean, results: Array<{ name?: string, ok: boolean, issues: Array<{path:string, message:string, ratio:number, min:number, context?:string}>, warnings?: Array<{path:string, message:string, context?:string}> }> }}
|
|
30
39
|
*/
|
|
31
40
|
export function validateDesigns(designs?: Array<object>, options?: object): {
|
|
32
41
|
ok: boolean;
|
|
@@ -40,6 +49,11 @@ export function validateDesigns(designs?: Array<object>, options?: object): {
|
|
|
40
49
|
min: number;
|
|
41
50
|
context?: string;
|
|
42
51
|
}>;
|
|
52
|
+
warnings?: Array<{
|
|
53
|
+
path: string;
|
|
54
|
+
message: string;
|
|
55
|
+
context?: string;
|
|
56
|
+
}>;
|
|
43
57
|
}>;
|
|
44
58
|
};
|
|
45
59
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pds-generator.d.ts","sourceRoot":"","sources":["../../../../../src/js/pds-core/pds-generator.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"pds-generator.d.ts","sourceRoot":"","sources":["../../../../../src/js/pds-core/pds-generator.js"],"names":[],"mappings":"AAy9LA;;;;;;;;;;;GAWG;AACH,8CAPW,MAAM,YAEd;IAAyB,WAAW,GAA5B,MAAM;IACY,cAAc,GAAhC,OAAO;I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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAAmC;IA6BrC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAiCC;IAiiBD;;;;OAIG;IACH,kDAyBC;IAiFD;;;;;;;;;;;;;;;;;;;;;;;;;;;;MA6DC;IA6nID;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAEC;IAGD,oBAEC;IAgyBD,qBAEC;IACD,yBAEC;IACD,yBAEC;IACD,wBAEC;IACD,yBAMC;IAED;;;;;;OAMG;IACH,oBA6JC;IAGD,4BAEC;IACD,gCAEC;IACD,gCAEC;IACD,+BAEC;IAmBD;;;OAGG;IACH;;;;;;MAoBC;;CAkBF"}
|
package/package.json
CHANGED
|
@@ -4,9 +4,14 @@ const http = require("http");
|
|
|
4
4
|
const reloadPort = 4174;
|
|
5
5
|
const reloadClients = new Set();
|
|
6
6
|
|
|
7
|
+
function removeClient(client) {
|
|
8
|
+
reloadClients.delete(client);
|
|
9
|
+
}
|
|
10
|
+
|
|
7
11
|
function startReloadServer() {
|
|
8
12
|
const server = http.createServer((req, res) => {
|
|
9
|
-
|
|
13
|
+
const reqUrl = new URL(req.url || "/", "http://localhost");
|
|
14
|
+
if (reqUrl.pathname !== "/events") {
|
|
10
15
|
res.writeHead(404);
|
|
11
16
|
res.end();
|
|
12
17
|
return;
|
|
@@ -19,12 +24,55 @@ function startReloadServer() {
|
|
|
19
24
|
"Access-Control-Allow-Origin": "*",
|
|
20
25
|
});
|
|
21
26
|
|
|
22
|
-
|
|
27
|
+
// Keep reconnects gentle if the server restarts briefly.
|
|
28
|
+
res.write("retry: 1500\n\n");
|
|
23
29
|
reloadClients.add(res);
|
|
24
30
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
31
|
+
const cleanup = () => removeClient(res);
|
|
32
|
+
req.on("close", cleanup);
|
|
33
|
+
req.on("aborted", cleanup);
|
|
34
|
+
res.on("close", cleanup);
|
|
35
|
+
res.on("error", cleanup);
|
|
36
|
+
|
|
37
|
+
// Initial comment flushes headers and confirms stream is alive.
|
|
38
|
+
res.write(": connected\n\n");
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
const heartbeat = setInterval(() => {
|
|
42
|
+
for (const client of reloadClients) {
|
|
43
|
+
if (client.destroyed || client.writableEnded) {
|
|
44
|
+
removeClient(client);
|
|
45
|
+
continue;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
try {
|
|
49
|
+
client.write(": keepalive\n\n");
|
|
50
|
+
} catch {
|
|
51
|
+
removeClient(client);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}, 15000);
|
|
55
|
+
|
|
56
|
+
heartbeat.unref();
|
|
57
|
+
|
|
58
|
+
const shutdown = () => {
|
|
59
|
+
clearInterval(heartbeat);
|
|
60
|
+
for (const client of reloadClients) {
|
|
61
|
+
try {
|
|
62
|
+
client.end();
|
|
63
|
+
} catch {
|
|
64
|
+
// Ignore teardown errors.
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
reloadClients.clear();
|
|
68
|
+
server.close();
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
process.once("SIGINT", shutdown);
|
|
72
|
+
process.once("SIGTERM", shutdown);
|
|
73
|
+
|
|
74
|
+
server.on("error", (err) => {
|
|
75
|
+
console.error("Live reload server error:", err);
|
|
28
76
|
});
|
|
29
77
|
|
|
30
78
|
server.listen(reloadPort, () => {
|
|
@@ -33,8 +81,19 @@ function startReloadServer() {
|
|
|
33
81
|
}
|
|
34
82
|
|
|
35
83
|
function notifyReload() {
|
|
84
|
+
const payload = JSON.stringify({ type: "reload", t: Date.now() });
|
|
36
85
|
for (const client of reloadClients) {
|
|
37
|
-
client.
|
|
86
|
+
if (client.destroyed || client.writableEnded) {
|
|
87
|
+
removeClient(client);
|
|
88
|
+
continue;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
try {
|
|
92
|
+
client.write("event: reload\n");
|
|
93
|
+
client.write("data: " + payload + "\n\n");
|
|
94
|
+
} catch {
|
|
95
|
+
removeClient(client);
|
|
96
|
+
}
|
|
38
97
|
}
|
|
39
98
|
}
|
|
40
99
|
|
|
@@ -4,9 +4,14 @@ import http from "http";
|
|
|
4
4
|
const reloadPort = 4174;
|
|
5
5
|
const reloadClients = new Set();
|
|
6
6
|
|
|
7
|
+
function removeClient(client) {
|
|
8
|
+
reloadClients.delete(client);
|
|
9
|
+
}
|
|
10
|
+
|
|
7
11
|
function startReloadServer() {
|
|
8
12
|
const server = http.createServer((req, res) => {
|
|
9
|
-
|
|
13
|
+
const reqUrl = new URL(req.url || "/", "http://localhost");
|
|
14
|
+
if (reqUrl.pathname !== "/events") {
|
|
10
15
|
res.writeHead(404);
|
|
11
16
|
res.end();
|
|
12
17
|
return;
|
|
@@ -19,12 +24,55 @@ function startReloadServer() {
|
|
|
19
24
|
"Access-Control-Allow-Origin": "*",
|
|
20
25
|
});
|
|
21
26
|
|
|
22
|
-
|
|
27
|
+
// Keep reconnects gentle if the server restarts briefly.
|
|
28
|
+
res.write("retry: 1500\n\n");
|
|
23
29
|
reloadClients.add(res);
|
|
24
30
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
31
|
+
const cleanup = () => removeClient(res);
|
|
32
|
+
req.on("close", cleanup);
|
|
33
|
+
req.on("aborted", cleanup);
|
|
34
|
+
res.on("close", cleanup);
|
|
35
|
+
res.on("error", cleanup);
|
|
36
|
+
|
|
37
|
+
// Initial comment flushes headers and confirms stream is alive.
|
|
38
|
+
res.write(": connected\n\n");
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
const heartbeat = setInterval(() => {
|
|
42
|
+
for (const client of reloadClients) {
|
|
43
|
+
if (client.destroyed || client.writableEnded) {
|
|
44
|
+
removeClient(client);
|
|
45
|
+
continue;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
try {
|
|
49
|
+
client.write(": keepalive\n\n");
|
|
50
|
+
} catch {
|
|
51
|
+
removeClient(client);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}, 15000);
|
|
55
|
+
|
|
56
|
+
heartbeat.unref();
|
|
57
|
+
|
|
58
|
+
const shutdown = () => {
|
|
59
|
+
clearInterval(heartbeat);
|
|
60
|
+
for (const client of reloadClients) {
|
|
61
|
+
try {
|
|
62
|
+
client.end();
|
|
63
|
+
} catch {
|
|
64
|
+
// Ignore teardown errors.
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
reloadClients.clear();
|
|
68
|
+
server.close();
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
process.once("SIGINT", shutdown);
|
|
72
|
+
process.once("SIGTERM", shutdown);
|
|
73
|
+
|
|
74
|
+
server.on("error", (err) => {
|
|
75
|
+
console.error("Live reload server error:", err);
|
|
28
76
|
});
|
|
29
77
|
|
|
30
78
|
server.listen(reloadPort, () => {
|
|
@@ -33,8 +81,19 @@ function startReloadServer() {
|
|
|
33
81
|
}
|
|
34
82
|
|
|
35
83
|
function notifyReload() {
|
|
84
|
+
const payload = JSON.stringify({ type: "reload", t: Date.now() });
|
|
36
85
|
for (const client of reloadClients) {
|
|
37
|
-
client.
|
|
86
|
+
if (client.destroyed || client.writableEnded) {
|
|
87
|
+
removeClient(client);
|
|
88
|
+
continue;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
try {
|
|
92
|
+
client.write("event: reload\n");
|
|
93
|
+
client.write("data: " + payload + "\n\n");
|
|
94
|
+
} catch {
|
|
95
|
+
removeClient(client);
|
|
96
|
+
}
|
|
38
97
|
}
|
|
39
98
|
}
|
|
40
99
|
|
|
@@ -3,16 +3,75 @@ const shouldConnect =
|
|
|
3
3
|
|
|
4
4
|
if (shouldConnect) {
|
|
5
5
|
const reloadPort = 4174;
|
|
6
|
-
const endpoint = "
|
|
7
|
-
const
|
|
6
|
+
const endpoint = location.protocol + "//" + location.hostname + ":" + reloadPort + "/events";
|
|
7
|
+
const minReloadIntervalMs = 800;
|
|
8
|
+
let source;
|
|
9
|
+
let reconnectTimer;
|
|
10
|
+
let isReloading = false;
|
|
11
|
+
let lastReloadAt = Number(sessionStorage.getItem("__pdsLastReloadAt") || "0");
|
|
8
12
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
13
|
+
function shouldReloadNow() {
|
|
14
|
+
const now = Date.now();
|
|
15
|
+
if (isReloading) {
|
|
16
|
+
return false;
|
|
12
17
|
}
|
|
13
|
-
|
|
18
|
+
if (now - lastReloadAt < minReloadIntervalMs) {
|
|
19
|
+
return false;
|
|
20
|
+
}
|
|
21
|
+
isReloading = true;
|
|
22
|
+
lastReloadAt = now;
|
|
23
|
+
sessionStorage.setItem("__pdsLastReloadAt", String(lastReloadAt));
|
|
24
|
+
return true;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function handleReloadEvent(event) {
|
|
28
|
+
const data = (event && event.data) || "";
|
|
29
|
+
if (data === "reload") {
|
|
30
|
+
if (shouldReloadNow()) {
|
|
31
|
+
location.reload();
|
|
32
|
+
}
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
try {
|
|
37
|
+
const payload = JSON.parse(data);
|
|
38
|
+
if (payload && payload.type === "reload" && shouldReloadNow()) {
|
|
39
|
+
location.reload();
|
|
40
|
+
}
|
|
41
|
+
} catch {
|
|
42
|
+
// Ignore non-JSON messages like keepalive comments.
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
function connect() {
|
|
47
|
+
source = new EventSource(endpoint);
|
|
48
|
+
source.addEventListener("reload", handleReloadEvent);
|
|
49
|
+
source.onmessage = handleReloadEvent;
|
|
50
|
+
|
|
51
|
+
source.onerror = () => {
|
|
52
|
+
source.close();
|
|
53
|
+
|
|
54
|
+
if (isReloading || reconnectTimer) {
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
reconnectTimer = setTimeout(() => {
|
|
59
|
+
reconnectTimer = undefined;
|
|
60
|
+
connect();
|
|
61
|
+
}, 1000);
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
window.addEventListener("beforeunload", () => {
|
|
66
|
+
isReloading = true;
|
|
67
|
+
if (source) {
|
|
68
|
+
source.close();
|
|
69
|
+
}
|
|
70
|
+
if (reconnectTimer) {
|
|
71
|
+
clearTimeout(reconnectTimer);
|
|
72
|
+
reconnectTimer = undefined;
|
|
73
|
+
}
|
|
74
|
+
});
|
|
14
75
|
|
|
15
|
-
|
|
16
|
-
source.close();
|
|
17
|
-
};
|
|
76
|
+
connect();
|
|
18
77
|
}
|