@cyberskill/design 1.5.0 → 1.6.0

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 (196) hide show
  1. package/DESIGN.md +1 -1
  2. package/README.md +4 -4
  3. package/SKILL.md +3 -3
  4. package/VERSION +1 -1
  5. package/_ds_bundle.js +2 -2
  6. package/_esm/cs.mjs +2 -2
  7. package/docs/contrast-report.md +1 -1
  8. package/docs/conventions.md +4 -4
  9. package/docs/quality-gates.md +3 -1
  10. package/docs/release-notes.md +1 -1
  11. package/docs/vi/contrast-report.md +1 -1
  12. package/docs/vi/conventions.md +2 -2
  13. package/docs/vi/quality-gates.md +3 -1
  14. package/docs/vi/release-notes.md +1 -1
  15. package/llms.txt +3 -3
  16. package/package.json +6 -4
  17. package/templates/_vendor/doc-export.js +435 -0
  18. package/templates/_vendor/support.js +1860 -0
  19. package/templates/app-shell/ds-base.js +8 -0
  20. package/templates/app-shell/support.js +41 -15
  21. package/templates/article/ds-base.js +8 -0
  22. package/templates/article/support.js +41 -15
  23. package/templates/auth/ds-base.js +8 -0
  24. package/templates/auth/support.js +41 -15
  25. package/templates/bod-deck/ds-base.js +8 -0
  26. package/templates/bod-deck/support.js +41 -15
  27. package/templates/bod-investor-update/ds-base.js +8 -0
  28. package/templates/bod-investor-update/support.js +41 -15
  29. package/templates/bod-memo/ds-base.js +8 -0
  30. package/templates/bod-memo/support.js +41 -15
  31. package/templates/bod-minutes/ds-base.js +8 -0
  32. package/templates/bod-minutes/support.js +41 -15
  33. package/templates/bod-report/ds-base.js +8 -0
  34. package/templates/bod-report/support.js +41 -15
  35. package/templates/bod-resolution/ds-base.js +8 -0
  36. package/templates/bod-resolution/support.js +41 -15
  37. package/templates/culture-event-invite/ds-base.js +8 -0
  38. package/templates/culture-event-invite/support.js +41 -15
  39. package/templates/dashboard/ds-base.js +8 -0
  40. package/templates/dashboard/support.js +41 -15
  41. package/templates/delivery-change-note/ds-base.js +8 -0
  42. package/templates/delivery-change-note/support.js +41 -15
  43. package/templates/delivery-kickoff/ds-base.js +8 -0
  44. package/templates/delivery-kickoff/support.js +41 -15
  45. package/templates/delivery-qbr-deck/ds-base.js +8 -0
  46. package/templates/delivery-qbr-deck/support.js +41 -15
  47. package/templates/delivery-runbook/ds-base.js +8 -0
  48. package/templates/delivery-runbook/support.js +41 -15
  49. package/templates/delivery-status-email/ds-base.js +8 -0
  50. package/templates/delivery-status-email/support.js +41 -15
  51. package/templates/doc-style-guide/ds-base.js +8 -0
  52. package/templates/doc-style-guide/support.js +41 -15
  53. package/templates/doc-suite-index/ds-base.js +8 -0
  54. package/templates/doc-suite-index/support.js +41 -15
  55. package/templates/doc-templates/ds-base.js +8 -0
  56. package/templates/doc-templates/support.js +41 -15
  57. package/templates/email/ds-base.js +8 -0
  58. package/templates/email/support.js +41 -15
  59. package/templates/finance-dunning-email/ds-base.js +8 -0
  60. package/templates/finance-dunning-email/support.js +41 -15
  61. package/templates/finance-expense-report/ds-base.js +8 -0
  62. package/templates/finance-expense-report/support.js +41 -15
  63. package/templates/finance-invoice/ds-base.js +8 -0
  64. package/templates/finance-invoice/support.js +41 -15
  65. package/templates/finance-quote/ds-base.js +8 -0
  66. package/templates/finance-quote/support.js +41 -15
  67. package/templates/hr-announcement/ds-base.js +8 -0
  68. package/templates/hr-announcement/support.js +41 -15
  69. package/templates/hr-interview-kit/ds-base.js +8 -0
  70. package/templates/hr-interview-kit/support.js +41 -15
  71. package/templates/hr-offboarding/ds-base.js +8 -0
  72. package/templates/hr-offboarding/support.js +41 -15
  73. package/templates/hr-performance-review/ds-base.js +8 -0
  74. package/templates/hr-performance-review/support.js +41 -15
  75. package/templates/hr-pip/ds-base.js +8 -0
  76. package/templates/hr-pip/support.js +41 -15
  77. package/templates/legal-msa/ds-base.js +8 -0
  78. package/templates/legal-msa/support.js +41 -15
  79. package/templates/legal-sow/ds-base.js +8 -0
  80. package/templates/legal-sow/support.js +41 -15
  81. package/templates/marketing-campaign-brief/ds-base.js +8 -0
  82. package/templates/marketing-campaign-brief/support.js +41 -15
  83. package/templates/marketing-case-study/ds-base.js +8 -0
  84. package/templates/marketing-case-study/support.js +41 -15
  85. package/templates/marketing-launch/ds-base.js +8 -0
  86. package/templates/marketing-launch/support.js +41 -15
  87. package/templates/marketing-newsletter/ds-base.js +8 -0
  88. package/templates/marketing-newsletter/support.js +41 -15
  89. package/templates/marketing-page/ds-base.js +8 -0
  90. package/templates/marketing-page/support.js +41 -15
  91. package/templates/marketing-press-release/ds-base.js +8 -0
  92. package/templates/marketing-press-release/support.js +41 -15
  93. package/templates/marketing-social-kit/ds-base.js +8 -0
  94. package/templates/marketing-social-kit/support.js +41 -15
  95. package/templates/sales-one-pager/ds-base.js +8 -0
  96. package/templates/sales-one-pager/support.js +41 -15
  97. package/templates/sales-proposal-deck/ds-base.js +8 -0
  98. package/templates/sales-proposal-deck/support.js +41 -15
  99. package/templates/settings/ds-base.js +8 -0
  100. package/templates/settings/support.js +41 -15
  101. package/templates/slide-deck/ds-base.js +8 -0
  102. package/templates/slide-deck/support.js +41 -15
  103. package/templates/team-meeting-agenda/ds-base.js +8 -0
  104. package/templates/team-meeting-agenda/support.js +41 -15
  105. package/templates/tech-incident-report/ds-base.js +8 -0
  106. package/templates/tech-incident-report/support.js +41 -15
  107. package/templates/tech-release-notes/ds-base.js +8 -0
  108. package/templates/tech-release-notes/support.js +41 -15
  109. package/templates/tech-retro/ds-base.js +8 -0
  110. package/templates/tech-retro/support.js +41 -15
  111. package/templates/tech-rfc/ds-base.js +8 -0
  112. package/templates/tech-rfc/support.js +41 -15
  113. package/templates/vn-appointment-transfer/ds-base.js +8 -0
  114. package/templates/vn-appointment-transfer/support.js +41 -15
  115. package/templates/vn-certificate-of-employment/ds-base.js +8 -0
  116. package/templates/vn-certificate-of-employment/support.js +41 -15
  117. package/templates/vn-code-of-conduct/ds-base.js +8 -0
  118. package/templates/vn-code-of-conduct/support.js +41 -15
  119. package/templates/vn-compensation-regulation/ds-base.js +8 -0
  120. package/templates/vn-compensation-regulation/support.js +41 -15
  121. package/templates/vn-contract-amendment/ds-base.js +8 -0
  122. package/templates/vn-contract-amendment/support.js +41 -15
  123. package/templates/vn-contractor-agreement/ds-base.js +8 -0
  124. package/templates/vn-contractor-agreement/support.js +41 -15
  125. package/templates/vn-data-protection-policy/ds-base.js +8 -0
  126. package/templates/vn-data-protection-policy/support.js +41 -15
  127. package/templates/vn-disciplinary-case-file/ds-base.js +8 -0
  128. package/templates/vn-disciplinary-case-file/support.js +41 -15
  129. package/templates/vn-disciplinary-schedule/ds-base.js +8 -0
  130. package/templates/vn-disciplinary-schedule/support.js +41 -15
  131. package/templates/vn-employee-request/ds-base.js +8 -0
  132. package/templates/vn-employee-request/support.js +41 -15
  133. package/templates/vn-exit-handover/ds-base.js +8 -0
  134. package/templates/vn-exit-handover/support.js +41 -15
  135. package/templates/vn-foreign-employee-pack/ds-base.js +8 -0
  136. package/templates/vn-foreign-employee-pack/support.js +41 -15
  137. package/templates/vn-framework-agreement/ds-base.js +8 -0
  138. package/templates/vn-framework-agreement/support.js +41 -15
  139. package/templates/vn-grassroots-democracy/ds-base.js +8 -0
  140. package/templates/vn-grassroots-democracy/support.js +41 -15
  141. package/templates/vn-infosec-policy/ds-base.js +8 -0
  142. package/templates/vn-infosec-policy/support.js +41 -15
  143. package/templates/vn-internal-labor-regulations/ds-base.js +8 -0
  144. package/templates/vn-internal-labor-regulations/support.js +41 -15
  145. package/templates/vn-internship-agreement/ds-base.js +8 -0
  146. package/templates/vn-internship-agreement/support.js +41 -15
  147. package/templates/vn-job-description/ds-base.js +8 -0
  148. package/templates/vn-job-description/support.js +41 -15
  149. package/templates/vn-labor-contract/ds-base.js +8 -0
  150. package/templates/vn-labor-contract/support.js +41 -15
  151. package/templates/vn-labour-management-book/ds-base.js +8 -0
  152. package/templates/vn-labour-management-book/support.js +41 -15
  153. package/templates/vn-mutual-nda/ds-base.js +8 -0
  154. package/templates/vn-mutual-nda/support.js +41 -15
  155. package/templates/vn-ndnca-ip/ds-base.js +8 -0
  156. package/templates/vn-ndnca-ip/support.js +41 -15
  157. package/templates/vn-offer-letter/ds-base.js +8 -0
  158. package/templates/vn-offer-letter/support.js +41 -15
  159. package/templates/vn-onboarding-checklist/ds-base.js +8 -0
  160. package/templates/vn-onboarding-checklist/support.js +41 -15
  161. package/templates/vn-pdpl-consent/ds-base.js +8 -0
  162. package/templates/vn-pdpl-consent/support.js +41 -15
  163. package/templates/vn-performance-evaluation-regulation/ds-base.js +8 -0
  164. package/templates/vn-performance-evaluation-regulation/support.js +41 -15
  165. package/templates/vn-performance-review-form/ds-base.js +8 -0
  166. package/templates/vn-performance-review-form/support.js +41 -15
  167. package/templates/vn-phantom-stock/ds-base.js +8 -0
  168. package/templates/vn-phantom-stock/support.js +41 -15
  169. package/templates/vn-probation-contract/ds-base.js +8 -0
  170. package/templates/vn-probation-contract/support.js +41 -15
  171. package/templates/vn-receipt-acknowledgement/ds-base.js +8 -0
  172. package/templates/vn-receipt-acknowledgement/support.js +41 -15
  173. package/templates/vn-remote-work-policy/ds-base.js +8 -0
  174. package/templates/vn-remote-work-policy/support.js +41 -15
  175. package/templates/vn-resignation-letter/ds-base.js +8 -0
  176. package/templates/vn-resignation-letter/support.js +41 -15
  177. package/templates/vn-salary-scale/ds-base.js +8 -0
  178. package/templates/vn-salary-scale/support.js +41 -15
  179. package/templates/vn-sow-appendix/ds-base.js +8 -0
  180. package/templates/vn-sow-appendix/support.js +41 -15
  181. package/templates/vn-termination-decision/ds-base.js +8 -0
  182. package/templates/vn-termination-decision/support.js +41 -15
  183. package/templates/vn-total-rewards-appendix/ds-base.js +8 -0
  184. package/templates/vn-total-rewards-appendix/support.js +41 -15
  185. package/templates/vn-training-commitment/ds-base.js +8 -0
  186. package/templates/vn-training-commitment/support.js +41 -15
  187. package/templates/vn-travel-expense-policy/ds-base.js +8 -0
  188. package/templates/vn-travel-expense-policy/support.js +41 -15
  189. package/tokens/element-seeds.json +1 -1
  190. package/tokens/native/CSTokens.kt +1 -1
  191. package/tokens/native/CSTokens.swift +1 -1
  192. package/tokens/native/cs_tokens.dart +1 -1
  193. package/tokens/provenance.json +6 -6
  194. package/tokens/tokens.dtcg.json +1 -1
  195. package/tokens/tokens.js +2 -2
  196. package/tokens/tokens.json +1 -1
@@ -22,6 +22,14 @@
22
22
  s.onerror = () => console.error('ds-base.js: failed to load ' + s.src + ' — if this is a consuming project, point the base line in ds-base.js at the bound _ds/<folder> tree relative to this page (e.g. _ds/<folder> at the project root, ../_ds/<folder> one level down); in a fresh design system this can just mean the bundle is not compiled yet');
23
23
  document.head.appendChild(s);
24
24
 
25
+ // Print documents: PDF (window.print) + editable DOCX toolbar (TASK-IMP-022).
26
+ // Path is relative to this template folder → templates/_vendor/doc-export.js
27
+ if (document.querySelector('meta[name="omelette-owns-print"]')) {
28
+ const ex = document.createElement('script');
29
+ ex.src = '../_vendor/doc-export.js';
30
+ document.head.appendChild(ex);
31
+ }
32
+
25
33
  const syncLang = () => {
26
34
  try {
27
35
  const a = document.querySelector('[lang]');
@@ -769,15 +769,32 @@
769
769
  return {};
770
770
  }
771
771
  };
772
+ /**
773
+ * Evaluate DC class source without Function-constructor / eval call sites
774
+ * (site CSP forbids unsafe-eval; 'unsafe-inline' still allows a synchronous
775
+ * classic script).
776
+ */
772
777
  function evalDcLogic(src) {
773
- //! nosemgrep: eval-and-function-constructor
774
- const fn = new Function(
775
- "DCLogic",
776
- "StreamableLogic",
777
- "React",
778
- src + '\n;return (typeof Component!=="undefined"&&Component)||undefined;'
779
- );
780
- return fn(StreamableLogic, StreamableLogic, getReact());
778
+ const key = "__dcEvalResult_" + Math.random().toString(36).slice(2);
779
+ window.__DCLogic = StreamableLogic;
780
+ window.__DCReactForEval = getReact();
781
+ const safeSrc = String(src).replace(/<\/(script)/gi, "<\\/$1");
782
+ const el = document.createElement("script");
783
+ el.text =
784
+ "var DCLogic=window.__DCLogic,StreamableLogic=window.__DCLogic,React=window.__DCReactForEval;\n" +
785
+ safeSrc +
786
+ "\n;window[" +
787
+ JSON.stringify(key) +
788
+ ']=(typeof Component!=="undefined"&&Component)||undefined;';
789
+ (document.documentElement || document.head).appendChild(el);
790
+ el.remove();
791
+ const result = window[key];
792
+ try {
793
+ delete window[key];
794
+ } catch (_) {
795
+ window[key] = void 0;
796
+ }
797
+ return result;
781
798
  }
782
799
 
783
800
  // src/component.ts
@@ -1139,13 +1156,22 @@
1139
1156
  }).code : src;
1140
1157
  const module = { exports: {} };
1141
1158
  const before = new Set(Object.keys(window));
1142
- //! nosemgrep: eval-and-function-constructor
1143
- new Function("React", "module", "exports", "require", code)(
1144
- getReact(),
1145
- module,
1146
- module.exports,
1147
- () => ({})
1148
- );
1159
+ // CSP-safe: run Babel output via inline classic script (no Function ctor).
1160
+ window.__DCReactForEval = getReact();
1161
+ window.__DCModuleTmp = module;
1162
+ const safeCode = String(code).replace(/<\/(script)/gi, "<\\/$1");
1163
+ const el = document.createElement("script");
1164
+ el.text =
1165
+ "(function(React,module,exports,require){\n" +
1166
+ safeCode +
1167
+ "\n})(window.__DCReactForEval,window.__DCModuleTmp,window.__DCModuleTmp.exports,function(){return{};});";
1168
+ (document.documentElement || document.head).appendChild(el);
1169
+ el.remove();
1170
+ try {
1171
+ delete window.__DCModuleTmp;
1172
+ } catch (_) {
1173
+ window.__DCModuleTmp = void 0;
1174
+ }
1149
1175
  const globals = {};
1150
1176
  for (const k of Object.keys(window)) {
1151
1177
  if (!before.has(k) && typeof window[k] === "function") {
@@ -22,6 +22,14 @@
22
22
  s.onerror = () => console.error('ds-base.js: failed to load ' + s.src + ' — if this is a consuming project, point the base line in ds-base.js at the bound _ds/<folder> tree relative to this page (e.g. _ds/<folder> at the project root, ../_ds/<folder> one level down); in a fresh design system this can just mean the bundle is not compiled yet');
23
23
  document.head.appendChild(s);
24
24
 
25
+ // Print documents: PDF (window.print) + editable DOCX toolbar (TASK-IMP-022).
26
+ // Path is relative to this template folder → templates/_vendor/doc-export.js
27
+ if (document.querySelector('meta[name="omelette-owns-print"]')) {
28
+ const ex = document.createElement('script');
29
+ ex.src = '../_vendor/doc-export.js';
30
+ document.head.appendChild(ex);
31
+ }
32
+
25
33
  const syncLang = () => {
26
34
  try {
27
35
  const a = document.querySelector('[lang]');
@@ -769,15 +769,32 @@
769
769
  return {};
770
770
  }
771
771
  };
772
+ /**
773
+ * Evaluate DC class source without Function-constructor / eval call sites
774
+ * (site CSP forbids unsafe-eval; 'unsafe-inline' still allows a synchronous
775
+ * classic script).
776
+ */
772
777
  function evalDcLogic(src) {
773
- //! nosemgrep: eval-and-function-constructor
774
- const fn = new Function(
775
- "DCLogic",
776
- "StreamableLogic",
777
- "React",
778
- src + '\n;return (typeof Component!=="undefined"&&Component)||undefined;'
779
- );
780
- return fn(StreamableLogic, StreamableLogic, getReact());
778
+ const key = "__dcEvalResult_" + Math.random().toString(36).slice(2);
779
+ window.__DCLogic = StreamableLogic;
780
+ window.__DCReactForEval = getReact();
781
+ const safeSrc = String(src).replace(/<\/(script)/gi, "<\\/$1");
782
+ const el = document.createElement("script");
783
+ el.text =
784
+ "var DCLogic=window.__DCLogic,StreamableLogic=window.__DCLogic,React=window.__DCReactForEval;\n" +
785
+ safeSrc +
786
+ "\n;window[" +
787
+ JSON.stringify(key) +
788
+ ']=(typeof Component!=="undefined"&&Component)||undefined;';
789
+ (document.documentElement || document.head).appendChild(el);
790
+ el.remove();
791
+ const result = window[key];
792
+ try {
793
+ delete window[key];
794
+ } catch (_) {
795
+ window[key] = void 0;
796
+ }
797
+ return result;
781
798
  }
782
799
 
783
800
  // src/component.ts
@@ -1139,13 +1156,22 @@
1139
1156
  }).code : src;
1140
1157
  const module = { exports: {} };
1141
1158
  const before = new Set(Object.keys(window));
1142
- //! nosemgrep: eval-and-function-constructor
1143
- new Function("React", "module", "exports", "require", code)(
1144
- getReact(),
1145
- module,
1146
- module.exports,
1147
- () => ({})
1148
- );
1159
+ // CSP-safe: run Babel output via inline classic script (no Function ctor).
1160
+ window.__DCReactForEval = getReact();
1161
+ window.__DCModuleTmp = module;
1162
+ const safeCode = String(code).replace(/<\/(script)/gi, "<\\/$1");
1163
+ const el = document.createElement("script");
1164
+ el.text =
1165
+ "(function(React,module,exports,require){\n" +
1166
+ safeCode +
1167
+ "\n})(window.__DCReactForEval,window.__DCModuleTmp,window.__DCModuleTmp.exports,function(){return{};});";
1168
+ (document.documentElement || document.head).appendChild(el);
1169
+ el.remove();
1170
+ try {
1171
+ delete window.__DCModuleTmp;
1172
+ } catch (_) {
1173
+ window.__DCModuleTmp = void 0;
1174
+ }
1149
1175
  const globals = {};
1150
1176
  for (const k of Object.keys(window)) {
1151
1177
  if (!before.has(k) && typeof window[k] === "function") {
@@ -22,6 +22,14 @@
22
22
  s.onerror = () => console.error('ds-base.js: failed to load ' + s.src + ' — if this is a consuming project, point the base line in ds-base.js at the bound _ds/<folder> tree relative to this page (e.g. _ds/<folder> at the project root, ../_ds/<folder> one level down); in a fresh design system this can just mean the bundle is not compiled yet');
23
23
  document.head.appendChild(s);
24
24
 
25
+ // Print documents: PDF (window.print) + editable DOCX toolbar (TASK-IMP-022).
26
+ // Path is relative to this template folder → templates/_vendor/doc-export.js
27
+ if (document.querySelector('meta[name="omelette-owns-print"]')) {
28
+ const ex = document.createElement('script');
29
+ ex.src = '../_vendor/doc-export.js';
30
+ document.head.appendChild(ex);
31
+ }
32
+
25
33
  const syncLang = () => {
26
34
  try {
27
35
  const a = document.querySelector('[lang]');
@@ -769,15 +769,32 @@
769
769
  return {};
770
770
  }
771
771
  };
772
+ /**
773
+ * Evaluate DC class source without Function-constructor / eval call sites
774
+ * (site CSP forbids unsafe-eval; 'unsafe-inline' still allows a synchronous
775
+ * classic script).
776
+ */
772
777
  function evalDcLogic(src) {
773
- //! nosemgrep: eval-and-function-constructor
774
- const fn = new Function(
775
- "DCLogic",
776
- "StreamableLogic",
777
- "React",
778
- src + '\n;return (typeof Component!=="undefined"&&Component)||undefined;'
779
- );
780
- return fn(StreamableLogic, StreamableLogic, getReact());
778
+ const key = "__dcEvalResult_" + Math.random().toString(36).slice(2);
779
+ window.__DCLogic = StreamableLogic;
780
+ window.__DCReactForEval = getReact();
781
+ const safeSrc = String(src).replace(/<\/(script)/gi, "<\\/$1");
782
+ const el = document.createElement("script");
783
+ el.text =
784
+ "var DCLogic=window.__DCLogic,StreamableLogic=window.__DCLogic,React=window.__DCReactForEval;\n" +
785
+ safeSrc +
786
+ "\n;window[" +
787
+ JSON.stringify(key) +
788
+ ']=(typeof Component!=="undefined"&&Component)||undefined;';
789
+ (document.documentElement || document.head).appendChild(el);
790
+ el.remove();
791
+ const result = window[key];
792
+ try {
793
+ delete window[key];
794
+ } catch (_) {
795
+ window[key] = void 0;
796
+ }
797
+ return result;
781
798
  }
782
799
 
783
800
  // src/component.ts
@@ -1139,13 +1156,22 @@
1139
1156
  }).code : src;
1140
1157
  const module = { exports: {} };
1141
1158
  const before = new Set(Object.keys(window));
1142
- //! nosemgrep: eval-and-function-constructor
1143
- new Function("React", "module", "exports", "require", code)(
1144
- getReact(),
1145
- module,
1146
- module.exports,
1147
- () => ({})
1148
- );
1159
+ // CSP-safe: run Babel output via inline classic script (no Function ctor).
1160
+ window.__DCReactForEval = getReact();
1161
+ window.__DCModuleTmp = module;
1162
+ const safeCode = String(code).replace(/<\/(script)/gi, "<\\/$1");
1163
+ const el = document.createElement("script");
1164
+ el.text =
1165
+ "(function(React,module,exports,require){\n" +
1166
+ safeCode +
1167
+ "\n})(window.__DCReactForEval,window.__DCModuleTmp,window.__DCModuleTmp.exports,function(){return{};});";
1168
+ (document.documentElement || document.head).appendChild(el);
1169
+ el.remove();
1170
+ try {
1171
+ delete window.__DCModuleTmp;
1172
+ } catch (_) {
1173
+ window.__DCModuleTmp = void 0;
1174
+ }
1149
1175
  const globals = {};
1150
1176
  for (const k of Object.keys(window)) {
1151
1177
  if (!before.has(k) && typeof window[k] === "function") {
@@ -22,6 +22,14 @@
22
22
  s.onerror = () => console.error('ds-base.js: failed to load ' + s.src + ' — if this is a consuming project, point the base line in ds-base.js at the bound _ds/<folder> tree relative to this page (e.g. _ds/<folder> at the project root, ../_ds/<folder> one level down); in a fresh design system this can just mean the bundle is not compiled yet');
23
23
  document.head.appendChild(s);
24
24
 
25
+ // Print documents: PDF (window.print) + editable DOCX toolbar (TASK-IMP-022).
26
+ // Path is relative to this template folder → templates/_vendor/doc-export.js
27
+ if (document.querySelector('meta[name="omelette-owns-print"]')) {
28
+ const ex = document.createElement('script');
29
+ ex.src = '../_vendor/doc-export.js';
30
+ document.head.appendChild(ex);
31
+ }
32
+
25
33
  const syncLang = () => {
26
34
  try {
27
35
  const a = document.querySelector('[lang]');
@@ -769,15 +769,32 @@
769
769
  return {};
770
770
  }
771
771
  };
772
+ /**
773
+ * Evaluate DC class source without Function-constructor / eval call sites
774
+ * (site CSP forbids unsafe-eval; 'unsafe-inline' still allows a synchronous
775
+ * classic script).
776
+ */
772
777
  function evalDcLogic(src) {
773
- //! nosemgrep: eval-and-function-constructor
774
- const fn = new Function(
775
- "DCLogic",
776
- "StreamableLogic",
777
- "React",
778
- src + '\n;return (typeof Component!=="undefined"&&Component)||undefined;'
779
- );
780
- return fn(StreamableLogic, StreamableLogic, getReact());
778
+ const key = "__dcEvalResult_" + Math.random().toString(36).slice(2);
779
+ window.__DCLogic = StreamableLogic;
780
+ window.__DCReactForEval = getReact();
781
+ const safeSrc = String(src).replace(/<\/(script)/gi, "<\\/$1");
782
+ const el = document.createElement("script");
783
+ el.text =
784
+ "var DCLogic=window.__DCLogic,StreamableLogic=window.__DCLogic,React=window.__DCReactForEval;\n" +
785
+ safeSrc +
786
+ "\n;window[" +
787
+ JSON.stringify(key) +
788
+ ']=(typeof Component!=="undefined"&&Component)||undefined;';
789
+ (document.documentElement || document.head).appendChild(el);
790
+ el.remove();
791
+ const result = window[key];
792
+ try {
793
+ delete window[key];
794
+ } catch (_) {
795
+ window[key] = void 0;
796
+ }
797
+ return result;
781
798
  }
782
799
 
783
800
  // src/component.ts
@@ -1139,13 +1156,22 @@
1139
1156
  }).code : src;
1140
1157
  const module = { exports: {} };
1141
1158
  const before = new Set(Object.keys(window));
1142
- //! nosemgrep: eval-and-function-constructor
1143
- new Function("React", "module", "exports", "require", code)(
1144
- getReact(),
1145
- module,
1146
- module.exports,
1147
- () => ({})
1148
- );
1159
+ // CSP-safe: run Babel output via inline classic script (no Function ctor).
1160
+ window.__DCReactForEval = getReact();
1161
+ window.__DCModuleTmp = module;
1162
+ const safeCode = String(code).replace(/<\/(script)/gi, "<\\/$1");
1163
+ const el = document.createElement("script");
1164
+ el.text =
1165
+ "(function(React,module,exports,require){\n" +
1166
+ safeCode +
1167
+ "\n})(window.__DCReactForEval,window.__DCModuleTmp,window.__DCModuleTmp.exports,function(){return{};});";
1168
+ (document.documentElement || document.head).appendChild(el);
1169
+ el.remove();
1170
+ try {
1171
+ delete window.__DCModuleTmp;
1172
+ } catch (_) {
1173
+ window.__DCModuleTmp = void 0;
1174
+ }
1149
1175
  const globals = {};
1150
1176
  for (const k of Object.keys(window)) {
1151
1177
  if (!before.has(k) && typeof window[k] === "function") {
@@ -22,6 +22,14 @@
22
22
  s.onerror = () => console.error('ds-base.js: failed to load ' + s.src + ' — if this is a consuming project, point the base line in ds-base.js at the bound _ds/<folder> tree relative to this page (e.g. _ds/<folder> at the project root, ../_ds/<folder> one level down); in a fresh design system this can just mean the bundle is not compiled yet');
23
23
  document.head.appendChild(s);
24
24
 
25
+ // Print documents: PDF (window.print) + editable DOCX toolbar (TASK-IMP-022).
26
+ // Path is relative to this template folder → templates/_vendor/doc-export.js
27
+ if (document.querySelector('meta[name="omelette-owns-print"]')) {
28
+ const ex = document.createElement('script');
29
+ ex.src = '../_vendor/doc-export.js';
30
+ document.head.appendChild(ex);
31
+ }
32
+
25
33
  const syncLang = () => {
26
34
  try {
27
35
  const a = document.querySelector('[lang]');
@@ -769,15 +769,32 @@
769
769
  return {};
770
770
  }
771
771
  };
772
+ /**
773
+ * Evaluate DC class source without Function-constructor / eval call sites
774
+ * (site CSP forbids unsafe-eval; 'unsafe-inline' still allows a synchronous
775
+ * classic script).
776
+ */
772
777
  function evalDcLogic(src) {
773
- //! nosemgrep: eval-and-function-constructor
774
- const fn = new Function(
775
- "DCLogic",
776
- "StreamableLogic",
777
- "React",
778
- src + '\n;return (typeof Component!=="undefined"&&Component)||undefined;'
779
- );
780
- return fn(StreamableLogic, StreamableLogic, getReact());
778
+ const key = "__dcEvalResult_" + Math.random().toString(36).slice(2);
779
+ window.__DCLogic = StreamableLogic;
780
+ window.__DCReactForEval = getReact();
781
+ const safeSrc = String(src).replace(/<\/(script)/gi, "<\\/$1");
782
+ const el = document.createElement("script");
783
+ el.text =
784
+ "var DCLogic=window.__DCLogic,StreamableLogic=window.__DCLogic,React=window.__DCReactForEval;\n" +
785
+ safeSrc +
786
+ "\n;window[" +
787
+ JSON.stringify(key) +
788
+ ']=(typeof Component!=="undefined"&&Component)||undefined;';
789
+ (document.documentElement || document.head).appendChild(el);
790
+ el.remove();
791
+ const result = window[key];
792
+ try {
793
+ delete window[key];
794
+ } catch (_) {
795
+ window[key] = void 0;
796
+ }
797
+ return result;
781
798
  }
782
799
 
783
800
  // src/component.ts
@@ -1139,13 +1156,22 @@
1139
1156
  }).code : src;
1140
1157
  const module = { exports: {} };
1141
1158
  const before = new Set(Object.keys(window));
1142
- //! nosemgrep: eval-and-function-constructor
1143
- new Function("React", "module", "exports", "require", code)(
1144
- getReact(),
1145
- module,
1146
- module.exports,
1147
- () => ({})
1148
- );
1159
+ // CSP-safe: run Babel output via inline classic script (no Function ctor).
1160
+ window.__DCReactForEval = getReact();
1161
+ window.__DCModuleTmp = module;
1162
+ const safeCode = String(code).replace(/<\/(script)/gi, "<\\/$1");
1163
+ const el = document.createElement("script");
1164
+ el.text =
1165
+ "(function(React,module,exports,require){\n" +
1166
+ safeCode +
1167
+ "\n})(window.__DCReactForEval,window.__DCModuleTmp,window.__DCModuleTmp.exports,function(){return{};});";
1168
+ (document.documentElement || document.head).appendChild(el);
1169
+ el.remove();
1170
+ try {
1171
+ delete window.__DCModuleTmp;
1172
+ } catch (_) {
1173
+ window.__DCModuleTmp = void 0;
1174
+ }
1149
1175
  const globals = {};
1150
1176
  for (const k of Object.keys(window)) {
1151
1177
  if (!before.has(k) && typeof window[k] === "function") {
@@ -22,6 +22,14 @@
22
22
  s.onerror = () => console.error('ds-base.js: failed to load ' + s.src + ' — if this is a consuming project, point the base line in ds-base.js at the bound _ds/<folder> tree relative to this page (e.g. _ds/<folder> at the project root, ../_ds/<folder> one level down); in a fresh design system this can just mean the bundle is not compiled yet');
23
23
  document.head.appendChild(s);
24
24
 
25
+ // Print documents: PDF (window.print) + editable DOCX toolbar (TASK-IMP-022).
26
+ // Path is relative to this template folder → templates/_vendor/doc-export.js
27
+ if (document.querySelector('meta[name="omelette-owns-print"]')) {
28
+ const ex = document.createElement('script');
29
+ ex.src = '../_vendor/doc-export.js';
30
+ document.head.appendChild(ex);
31
+ }
32
+
25
33
  const syncLang = () => {
26
34
  try {
27
35
  const a = document.querySelector('[lang]');
@@ -769,15 +769,32 @@
769
769
  return {};
770
770
  }
771
771
  };
772
+ /**
773
+ * Evaluate DC class source without Function-constructor / eval call sites
774
+ * (site CSP forbids unsafe-eval; 'unsafe-inline' still allows a synchronous
775
+ * classic script).
776
+ */
772
777
  function evalDcLogic(src) {
773
- //! nosemgrep: eval-and-function-constructor
774
- const fn = new Function(
775
- "DCLogic",
776
- "StreamableLogic",
777
- "React",
778
- src + '\n;return (typeof Component!=="undefined"&&Component)||undefined;'
779
- );
780
- return fn(StreamableLogic, StreamableLogic, getReact());
778
+ const key = "__dcEvalResult_" + Math.random().toString(36).slice(2);
779
+ window.__DCLogic = StreamableLogic;
780
+ window.__DCReactForEval = getReact();
781
+ const safeSrc = String(src).replace(/<\/(script)/gi, "<\\/$1");
782
+ const el = document.createElement("script");
783
+ el.text =
784
+ "var DCLogic=window.__DCLogic,StreamableLogic=window.__DCLogic,React=window.__DCReactForEval;\n" +
785
+ safeSrc +
786
+ "\n;window[" +
787
+ JSON.stringify(key) +
788
+ ']=(typeof Component!=="undefined"&&Component)||undefined;';
789
+ (document.documentElement || document.head).appendChild(el);
790
+ el.remove();
791
+ const result = window[key];
792
+ try {
793
+ delete window[key];
794
+ } catch (_) {
795
+ window[key] = void 0;
796
+ }
797
+ return result;
781
798
  }
782
799
 
783
800
  // src/component.ts
@@ -1139,13 +1156,22 @@
1139
1156
  }).code : src;
1140
1157
  const module = { exports: {} };
1141
1158
  const before = new Set(Object.keys(window));
1142
- //! nosemgrep: eval-and-function-constructor
1143
- new Function("React", "module", "exports", "require", code)(
1144
- getReact(),
1145
- module,
1146
- module.exports,
1147
- () => ({})
1148
- );
1159
+ // CSP-safe: run Babel output via inline classic script (no Function ctor).
1160
+ window.__DCReactForEval = getReact();
1161
+ window.__DCModuleTmp = module;
1162
+ const safeCode = String(code).replace(/<\/(script)/gi, "<\\/$1");
1163
+ const el = document.createElement("script");
1164
+ el.text =
1165
+ "(function(React,module,exports,require){\n" +
1166
+ safeCode +
1167
+ "\n})(window.__DCReactForEval,window.__DCModuleTmp,window.__DCModuleTmp.exports,function(){return{};});";
1168
+ (document.documentElement || document.head).appendChild(el);
1169
+ el.remove();
1170
+ try {
1171
+ delete window.__DCModuleTmp;
1172
+ } catch (_) {
1173
+ window.__DCModuleTmp = void 0;
1174
+ }
1149
1175
  const globals = {};
1150
1176
  for (const k of Object.keys(window)) {
1151
1177
  if (!before.has(k) && typeof window[k] === "function") {
@@ -22,6 +22,14 @@
22
22
  s.onerror = () => console.error('ds-base.js: failed to load ' + s.src + ' — if this is a consuming project, point the base line in ds-base.js at the bound _ds/<folder> tree relative to this page (e.g. _ds/<folder> at the project root, ../_ds/<folder> one level down); in a fresh design system this can just mean the bundle is not compiled yet');
23
23
  document.head.appendChild(s);
24
24
 
25
+ // Print documents: PDF (window.print) + editable DOCX toolbar (TASK-IMP-022).
26
+ // Path is relative to this template folder → templates/_vendor/doc-export.js
27
+ if (document.querySelector('meta[name="omelette-owns-print"]')) {
28
+ const ex = document.createElement('script');
29
+ ex.src = '../_vendor/doc-export.js';
30
+ document.head.appendChild(ex);
31
+ }
32
+
25
33
  const syncLang = () => {
26
34
  try {
27
35
  const a = document.querySelector('[lang]');
@@ -769,15 +769,32 @@
769
769
  return {};
770
770
  }
771
771
  };
772
+ /**
773
+ * Evaluate DC class source without Function-constructor / eval call sites
774
+ * (site CSP forbids unsafe-eval; 'unsafe-inline' still allows a synchronous
775
+ * classic script).
776
+ */
772
777
  function evalDcLogic(src) {
773
- //! nosemgrep: eval-and-function-constructor
774
- const fn = new Function(
775
- "DCLogic",
776
- "StreamableLogic",
777
- "React",
778
- src + '\n;return (typeof Component!=="undefined"&&Component)||undefined;'
779
- );
780
- return fn(StreamableLogic, StreamableLogic, getReact());
778
+ const key = "__dcEvalResult_" + Math.random().toString(36).slice(2);
779
+ window.__DCLogic = StreamableLogic;
780
+ window.__DCReactForEval = getReact();
781
+ const safeSrc = String(src).replace(/<\/(script)/gi, "<\\/$1");
782
+ const el = document.createElement("script");
783
+ el.text =
784
+ "var DCLogic=window.__DCLogic,StreamableLogic=window.__DCLogic,React=window.__DCReactForEval;\n" +
785
+ safeSrc +
786
+ "\n;window[" +
787
+ JSON.stringify(key) +
788
+ ']=(typeof Component!=="undefined"&&Component)||undefined;';
789
+ (document.documentElement || document.head).appendChild(el);
790
+ el.remove();
791
+ const result = window[key];
792
+ try {
793
+ delete window[key];
794
+ } catch (_) {
795
+ window[key] = void 0;
796
+ }
797
+ return result;
781
798
  }
782
799
 
783
800
  // src/component.ts
@@ -1139,13 +1156,22 @@
1139
1156
  }).code : src;
1140
1157
  const module = { exports: {} };
1141
1158
  const before = new Set(Object.keys(window));
1142
- //! nosemgrep: eval-and-function-constructor
1143
- new Function("React", "module", "exports", "require", code)(
1144
- getReact(),
1145
- module,
1146
- module.exports,
1147
- () => ({})
1148
- );
1159
+ // CSP-safe: run Babel output via inline classic script (no Function ctor).
1160
+ window.__DCReactForEval = getReact();
1161
+ window.__DCModuleTmp = module;
1162
+ const safeCode = String(code).replace(/<\/(script)/gi, "<\\/$1");
1163
+ const el = document.createElement("script");
1164
+ el.text =
1165
+ "(function(React,module,exports,require){\n" +
1166
+ safeCode +
1167
+ "\n})(window.__DCReactForEval,window.__DCModuleTmp,window.__DCModuleTmp.exports,function(){return{};});";
1168
+ (document.documentElement || document.head).appendChild(el);
1169
+ el.remove();
1170
+ try {
1171
+ delete window.__DCModuleTmp;
1172
+ } catch (_) {
1173
+ window.__DCModuleTmp = void 0;
1174
+ }
1149
1175
  const globals = {};
1150
1176
  for (const k of Object.keys(window)) {
1151
1177
  if (!before.has(k) && typeof window[k] === "function") {
@@ -22,6 +22,14 @@
22
22
  s.onerror = () => console.error('ds-base.js: failed to load ' + s.src + ' — if this is a consuming project, point the base line in ds-base.js at the bound _ds/<folder> tree relative to this page (e.g. _ds/<folder> at the project root, ../_ds/<folder> one level down); in a fresh design system this can just mean the bundle is not compiled yet');
23
23
  document.head.appendChild(s);
24
24
 
25
+ // Print documents: PDF (window.print) + editable DOCX toolbar (TASK-IMP-022).
26
+ // Path is relative to this template folder → templates/_vendor/doc-export.js
27
+ if (document.querySelector('meta[name="omelette-owns-print"]')) {
28
+ const ex = document.createElement('script');
29
+ ex.src = '../_vendor/doc-export.js';
30
+ document.head.appendChild(ex);
31
+ }
32
+
25
33
  const syncLang = () => {
26
34
  try {
27
35
  const a = document.querySelector('[lang]');