create-flow-os 0.0.1-dev.1771840262 → 0.0.1-dev.1771979366

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 (230) hide show
  1. package/package.json +8 -23
  2. package/{profiles/server/packages/style → src/create}/index.ts +31 -30
  3. package/src/index.ts +14 -0
  4. package/src/init/index.ts +66 -0
  5. package/src/init/lib.ts +36 -0
  6. package/src/init/scaffold.ts +43 -0
  7. package/LICENSE +0 -97
  8. package/README.md +0 -26
  9. package/bin/index.js +0 -1215
  10. package/config.json +0 -89
  11. package/lib/utils.ts +0 -91
  12. package/packages/client/client/root.css +0 -9
  13. package/packages/client/client/root.tsx +0 -6
  14. package/packages/client/client/routes/404.tsx +0 -24
  15. package/packages/client/client/routes/index.tsx +0 -48
  16. package/packages/server/server/routes/hello.get.ts +0 -3
  17. package/profiles/client/.dockerignore +0 -12
  18. package/profiles/client/.oxfmtrc.json +0 -7
  19. package/profiles/client/.oxlintrc.json +0 -13
  20. package/profiles/client/.vscode/settings.json +0 -12
  21. package/profiles/client/Dockerfile +0 -26
  22. package/profiles/client/README.md +0 -34
  23. package/profiles/client/bun.lock +0 -352
  24. package/profiles/client/client/root.css +0 -9
  25. package/profiles/client/client/root.tsx +0 -6
  26. package/profiles/client/client/routes/404.tsx +0 -24
  27. package/profiles/client/client/routes/about.tsx +0 -7
  28. package/profiles/client/client/routes/index.tsx +0 -48
  29. package/profiles/client/flow.config.ts +0 -6
  30. package/profiles/client/index.html +0 -5
  31. package/profiles/client/package.json +0 -32
  32. package/profiles/client/packages/client/LICENSE +0 -97
  33. package/profiles/client/packages/client/build/config.ts +0 -211
  34. package/profiles/client/packages/client/build/vite.ts +0 -98
  35. package/profiles/client/packages/client/features/attrs.ts +0 -32
  36. package/profiles/client/packages/client/features/class-flow.ts +0 -116
  37. package/profiles/client/packages/client/features/index.ts +0 -8
  38. package/profiles/client/packages/client/features/pseudo-injector.ts +0 -40
  39. package/profiles/client/packages/client/features/style-flow.ts +0 -106
  40. package/profiles/client/packages/client/features/style.ts +0 -27
  41. package/profiles/client/packages/client/features/utils.ts +0 -4
  42. package/profiles/client/packages/client/features/viewport.ts +0 -20
  43. package/profiles/client/packages/client/index.ts +0 -7
  44. package/profiles/client/packages/client/package.json +0 -48
  45. package/profiles/client/packages/client/runtime/dom.ts +0 -2
  46. package/profiles/client/packages/client/runtime/jsx-dev-runtime.ts +0 -1
  47. package/profiles/client/packages/client/runtime/jsx-runtime.ts +0 -1
  48. package/profiles/client/packages/client/runtime/jsx-types.d.ts +0 -66
  49. package/profiles/client/packages/client/runtime/jsx.ts +0 -101
  50. package/profiles/client/packages/client/scripts/build.ts +0 -14
  51. package/profiles/client/packages/client/scripts/preview.ts +0 -14
  52. package/profiles/client/packages/client/scripts/start-dev.ts +0 -49
  53. package/profiles/client/packages/core/LICENSE +0 -97
  54. package/profiles/client/packages/core/dom.ts +0 -43
  55. package/profiles/client/packages/core/for.ts +0 -42
  56. package/profiles/client/packages/core/index.ts +0 -5
  57. package/profiles/client/packages/core/lifecycle.ts +0 -6
  58. package/profiles/client/packages/core/package.json +0 -16
  59. package/profiles/client/packages/core/show-switch.ts +0 -56
  60. package/profiles/client/packages/core/state.ts +0 -56
  61. package/profiles/client/packages/router/LICENSE +0 -97
  62. package/profiles/client/packages/router/index.ts +0 -20
  63. package/profiles/client/packages/router/matcher.ts +0 -105
  64. package/profiles/client/packages/router/package.json +0 -15
  65. package/profiles/client/packages/router/router.ts +0 -185
  66. package/profiles/client/packages/router/types.ts +0 -34
  67. package/profiles/client/packages/router/utils.ts +0 -45
  68. package/profiles/client/packages/style/LICENSE +0 -97
  69. package/profiles/client/packages/style/breakpoints.ts +0 -20
  70. package/profiles/client/packages/style/extension/.vscodeignore +0 -5
  71. package/profiles/client/packages/style/extension/flow-style-colors-0.0.1.vsix +0 -0
  72. package/profiles/client/packages/style/extension/out/extension.js +0 -130
  73. package/profiles/client/packages/style/extension/package.json +0 -24
  74. package/profiles/client/packages/style/extension/src/extension.ts +0 -146
  75. package/profiles/client/packages/style/extension/tsconfig.json +0 -12
  76. package/profiles/client/packages/style/index.ts +0 -30
  77. package/profiles/client/packages/style/package.json +0 -20
  78. package/profiles/client/packages/style/react.ts +0 -68
  79. package/profiles/client/packages/style/resolve.ts +0 -127
  80. package/profiles/client/packages/style/server.ts +0 -299
  81. package/profiles/client/packages/style/shorthand.ts +0 -96
  82. package/profiles/client/packages/style/style-builder/button.ts +0 -41
  83. package/profiles/client/packages/style/style-builder/constants.ts +0 -16
  84. package/profiles/client/packages/style/style-builder/dom.ts +0 -18
  85. package/profiles/client/packages/style/style-builder/index.ts +0 -48
  86. package/profiles/client/packages/style/style-builder/panel.ts +0 -69
  87. package/profiles/client/packages/style/style-builder/position.ts +0 -25
  88. package/profiles/client/packages/style/visual-builder.ts +0 -822
  89. package/profiles/client/packages/style/vite-plugin.ts +0 -86
  90. package/profiles/client/tsconfig.json +0 -30
  91. package/profiles/full/.dockerignore +0 -12
  92. package/profiles/full/.oxfmtrc.json +0 -7
  93. package/profiles/full/.oxlintrc.json +0 -13
  94. package/profiles/full/.vscode/settings.json +0 -12
  95. package/profiles/full/Dockerfile +0 -26
  96. package/profiles/full/README.md +0 -34
  97. package/profiles/full/bun.lock +0 -352
  98. package/profiles/full/client/root.css +0 -9
  99. package/profiles/full/client/root.tsx +0 -6
  100. package/profiles/full/client/routes/404.tsx +0 -24
  101. package/profiles/full/client/routes/about.tsx +0 -7
  102. package/profiles/full/client/routes/index.tsx +0 -48
  103. package/profiles/full/flow.config.ts +0 -6
  104. package/profiles/full/index.html +0 -5
  105. package/profiles/full/package.json +0 -33
  106. package/profiles/full/packages/client/LICENSE +0 -97
  107. package/profiles/full/packages/client/build/config.ts +0 -211
  108. package/profiles/full/packages/client/build/vite.ts +0 -98
  109. package/profiles/full/packages/client/features/attrs.ts +0 -32
  110. package/profiles/full/packages/client/features/class-flow.ts +0 -116
  111. package/profiles/full/packages/client/features/index.ts +0 -8
  112. package/profiles/full/packages/client/features/pseudo-injector.ts +0 -40
  113. package/profiles/full/packages/client/features/style-flow.ts +0 -106
  114. package/profiles/full/packages/client/features/style.ts +0 -27
  115. package/profiles/full/packages/client/features/utils.ts +0 -4
  116. package/profiles/full/packages/client/features/viewport.ts +0 -20
  117. package/profiles/full/packages/client/index.ts +0 -7
  118. package/profiles/full/packages/client/package.json +0 -48
  119. package/profiles/full/packages/client/runtime/dom.ts +0 -2
  120. package/profiles/full/packages/client/runtime/jsx-dev-runtime.ts +0 -1
  121. package/profiles/full/packages/client/runtime/jsx-runtime.ts +0 -1
  122. package/profiles/full/packages/client/runtime/jsx-types.d.ts +0 -66
  123. package/profiles/full/packages/client/runtime/jsx.ts +0 -101
  124. package/profiles/full/packages/client/scripts/build.ts +0 -14
  125. package/profiles/full/packages/client/scripts/preview.ts +0 -14
  126. package/profiles/full/packages/client/scripts/start-dev.ts +0 -49
  127. package/profiles/full/packages/core/LICENSE +0 -97
  128. package/profiles/full/packages/core/dom.ts +0 -43
  129. package/profiles/full/packages/core/for.ts +0 -42
  130. package/profiles/full/packages/core/index.ts +0 -5
  131. package/profiles/full/packages/core/lifecycle.ts +0 -6
  132. package/profiles/full/packages/core/package.json +0 -16
  133. package/profiles/full/packages/core/show-switch.ts +0 -56
  134. package/profiles/full/packages/core/state.ts +0 -56
  135. package/profiles/full/packages/router/LICENSE +0 -97
  136. package/profiles/full/packages/router/index.ts +0 -20
  137. package/profiles/full/packages/router/matcher.ts +0 -105
  138. package/profiles/full/packages/router/package.json +0 -15
  139. package/profiles/full/packages/router/router.ts +0 -185
  140. package/profiles/full/packages/router/types.ts +0 -34
  141. package/profiles/full/packages/router/utils.ts +0 -45
  142. package/profiles/full/packages/server/LICENSE +0 -97
  143. package/profiles/full/packages/server/core.ts +0 -140
  144. package/profiles/full/packages/server/index.ts +0 -24
  145. package/profiles/full/packages/server/package.json +0 -32
  146. package/profiles/full/packages/server/plugin.ts +0 -79
  147. package/profiles/full/packages/server/production.ts +0 -75
  148. package/profiles/full/packages/server/scripts/start.ts +0 -11
  149. package/profiles/full/packages/style/LICENSE +0 -97
  150. package/profiles/full/packages/style/breakpoints.ts +0 -20
  151. package/profiles/full/packages/style/extension/.vscodeignore +0 -5
  152. package/profiles/full/packages/style/extension/flow-style-colors-0.0.1.vsix +0 -0
  153. package/profiles/full/packages/style/extension/out/extension.js +0 -130
  154. package/profiles/full/packages/style/extension/package.json +0 -24
  155. package/profiles/full/packages/style/extension/src/extension.ts +0 -146
  156. package/profiles/full/packages/style/extension/tsconfig.json +0 -12
  157. package/profiles/full/packages/style/index.ts +0 -30
  158. package/profiles/full/packages/style/package.json +0 -20
  159. package/profiles/full/packages/style/react.ts +0 -68
  160. package/profiles/full/packages/style/resolve.ts +0 -127
  161. package/profiles/full/packages/style/server.ts +0 -299
  162. package/profiles/full/packages/style/shorthand.ts +0 -96
  163. package/profiles/full/packages/style/style-builder/button.ts +0 -41
  164. package/profiles/full/packages/style/style-builder/constants.ts +0 -16
  165. package/profiles/full/packages/style/style-builder/dom.ts +0 -18
  166. package/profiles/full/packages/style/style-builder/index.ts +0 -48
  167. package/profiles/full/packages/style/style-builder/panel.ts +0 -69
  168. package/profiles/full/packages/style/style-builder/position.ts +0 -25
  169. package/profiles/full/packages/style/visual-builder.ts +0 -822
  170. package/profiles/full/packages/style/vite-plugin.ts +0 -86
  171. package/profiles/full/server/routes/hello.get.ts +0 -3
  172. package/profiles/full/tsconfig.json +0 -30
  173. package/profiles/server/.dockerignore +0 -12
  174. package/profiles/server/.oxfmtrc.json +0 -7
  175. package/profiles/server/.oxlintrc.json +0 -13
  176. package/profiles/server/.vscode/settings.json +0 -12
  177. package/profiles/server/Dockerfile +0 -26
  178. package/profiles/server/README.md +0 -34
  179. package/profiles/server/bun.lock +0 -352
  180. package/profiles/server/flow.config.ts +0 -7
  181. package/profiles/server/index.html +0 -5
  182. package/profiles/server/package.json +0 -30
  183. package/profiles/server/packages/core/LICENSE +0 -97
  184. package/profiles/server/packages/core/dom.ts +0 -43
  185. package/profiles/server/packages/core/for.ts +0 -42
  186. package/profiles/server/packages/core/index.ts +0 -5
  187. package/profiles/server/packages/core/lifecycle.ts +0 -6
  188. package/profiles/server/packages/core/package.json +0 -16
  189. package/profiles/server/packages/core/show-switch.ts +0 -56
  190. package/profiles/server/packages/core/state.ts +0 -56
  191. package/profiles/server/packages/router/LICENSE +0 -97
  192. package/profiles/server/packages/router/index.ts +0 -20
  193. package/profiles/server/packages/router/matcher.ts +0 -105
  194. package/profiles/server/packages/router/package.json +0 -15
  195. package/profiles/server/packages/router/router.ts +0 -185
  196. package/profiles/server/packages/router/types.ts +0 -34
  197. package/profiles/server/packages/router/utils.ts +0 -45
  198. package/profiles/server/packages/server/LICENSE +0 -97
  199. package/profiles/server/packages/server/core.ts +0 -140
  200. package/profiles/server/packages/server/index.ts +0 -24
  201. package/profiles/server/packages/server/package.json +0 -32
  202. package/profiles/server/packages/server/plugin.ts +0 -79
  203. package/profiles/server/packages/server/production.ts +0 -75
  204. package/profiles/server/packages/server/scripts/start.ts +0 -11
  205. package/profiles/server/packages/style/LICENSE +0 -97
  206. package/profiles/server/packages/style/breakpoints.ts +0 -20
  207. package/profiles/server/packages/style/extension/.vscodeignore +0 -5
  208. package/profiles/server/packages/style/extension/flow-style-colors-0.0.1.vsix +0 -0
  209. package/profiles/server/packages/style/extension/out/extension.js +0 -130
  210. package/profiles/server/packages/style/extension/package.json +0 -24
  211. package/profiles/server/packages/style/extension/src/extension.ts +0 -146
  212. package/profiles/server/packages/style/extension/tsconfig.json +0 -12
  213. package/profiles/server/packages/style/package.json +0 -20
  214. package/profiles/server/packages/style/react.ts +0 -68
  215. package/profiles/server/packages/style/resolve.ts +0 -127
  216. package/profiles/server/packages/style/server.ts +0 -299
  217. package/profiles/server/packages/style/shorthand.ts +0 -96
  218. package/profiles/server/packages/style/style-builder/button.ts +0 -41
  219. package/profiles/server/packages/style/style-builder/constants.ts +0 -16
  220. package/profiles/server/packages/style/style-builder/dom.ts +0 -18
  221. package/profiles/server/packages/style/style-builder/index.ts +0 -48
  222. package/profiles/server/packages/style/style-builder/panel.ts +0 -69
  223. package/profiles/server/packages/style/style-builder/position.ts +0 -25
  224. package/profiles/server/packages/style/visual-builder.ts +0 -822
  225. package/profiles/server/packages/style/vite-plugin.ts +0 -86
  226. package/profiles/server/server/routes/hello.get.ts +0 -3
  227. package/profiles/server/tsconfig.json +0 -30
  228. package/templates/flow.config.client.ts +0 -6
  229. package/templates/flow.config.full.ts +0 -6
  230. package/templates/flow.config.server.ts +0 -7
@@ -1,97 +0,0 @@
1
- Flow OS Framework and all packages in this repository are licensed under the
2
- PolyForm Shield License 1.0.0. This license applies to the entire repository
3
- (framework, packages/*, client, server, and any other code herein).
4
-
5
- Required Notice: Copyright (c) Flow OS. All rights reserved.
6
-
7
- -------------------------------------------------------------------------------
8
-
9
- # PolyForm Shield License 1.0.0
10
-
11
- ## Acceptance
12
-
13
- In order to get any license under these terms, you must agree to them as both strict obligations and conditions to all your licenses.
14
-
15
- ## Copyright License
16
-
17
- The licensor grants you a copyright license for the software to do everything you might do with the software that would otherwise infringe the licensor's copyright in it for any permitted purpose. However, you may only distribute the software according to [Distribution License](#distribution-license) and make changes or new works based on the software according to [Changes and New Works License](#changes-and-new-works-license).
18
-
19
- ## Distribution License
20
-
21
- The licensor grants you an additional copyright license to distribute copies of the software. Your license to distribute covers distributing the software with changes and new works permitted by [Changes and New Works License](#changes-and-new-works-license).
22
-
23
- ## Notices
24
-
25
- You must ensure that anyone who gets a copy of any part of the software from you also gets a copy of these terms or the URL for them above, as well as copies of any plain-text lines beginning with `Required Notice:` that the licensor provided with the software. For example:
26
-
27
- > Required Notice: Copyright Yoyodyne, Inc. (http://example.com)
28
-
29
- ## Changes and New Works License
30
-
31
- The licensor grants you an additional copyright license to make changes and new works based on the software for any permitted purpose.
32
-
33
- ## Patent License
34
-
35
- The licensor grants you a patent license for the software that covers patent claims the licensor can license, or becomes able to license, that you would infringe by using the software.
36
-
37
- ## Noncompete
38
-
39
- Any purpose is a permitted purpose, except for providing any product that competes with the software or any product the licensor or any of its affiliates provides using the software.
40
-
41
- ## Competition
42
-
43
- Goods and services compete even when they provide functionality through different kinds of interfaces or for different technical platforms. Applications can compete with services, libraries with plugins, frameworks with development tools, and so on, even if they're written in different programming languages or for different computer architectures. Goods and services compete even when provided free of charge. If you market a product as a practical substitute for the software or another product, it definitely competes.
44
-
45
- ## New Products
46
-
47
- If you are using the software to provide a product that does not compete, but the licensor or any of its affiliates brings your product into competition by providing a new version of the software or another product using the software, you may continue using versions of the software available under these terms beforehand to provide your competing product, but not any later versions.
48
-
49
- ## Discontinued Products
50
-
51
- You may begin using the software to compete with a product or service that the licensor or any of its affiliates has stopped providing, unless the licensor includes a plain-text line beginning with `Licensor Line of Business:` with the software that mentions that line of business. For example:
52
-
53
- > Licensor Line of Business: YoyodyneCMS Content Management System (http://example.com/cms)
54
-
55
- Licensor Line of Business: Flow OS application framework and development tooling (create-flow, @flow.os/* packages, and related framework components).
56
-
57
- ## Sales of Business
58
-
59
- If the licensor or any of its affiliates sells a line of business developing the software or using the software to provide a product, the buyer can also enforce [Noncompete](#noncompete) for that product.
60
-
61
- ## Fair Use
62
-
63
- You may have "fair use" rights for the software under the law. These terms do not limit them.
64
-
65
- ## No Other Rights
66
-
67
- These terms do not allow you to sublicense or transfer any of your licenses to anyone else, or prevent the licensor from granting licenses to anyone else. These terms do not imply any other licenses.
68
-
69
- ## Patent Defense
70
-
71
- If you make any written claim that the software infringes or contributes to infringement of any patent, your patent license for the software granted under these terms ends immediately. If your company makes such a claim, your patent license ends immediately for work on behalf of your company.
72
-
73
- ## Violations
74
-
75
- The first time you are notified in writing that you have violated any of these terms, or done anything with the software not covered by your licenses, your licenses can nonetheless continue if you come into full compliance with these terms, and take practical steps to correct past violations, within 32 days of receiving notice. Otherwise, all your licenses end immediately.
76
-
77
- ## No Liability
78
-
79
- ***As far as the law allows, the software comes as is, without any warranty or condition, and the licensor will not be liable to you for any damages arising out of these terms or the use or nature of the software, under any kind of legal claim.***
80
-
81
- ## Definitions
82
-
83
- The **licensor** is the individual or entity offering these terms, and the **software** is the software the licensor makes available under these terms.
84
-
85
- A **product** can be a good or service, or a combination of them.
86
-
87
- **You** refers to the individual or entity agreeing to these terms.
88
-
89
- **Your company** is any legal entity, sole proprietorship, or other kind of organization that you work for, plus all its affiliates.
90
-
91
- **Affiliates** means the other organizations than an organization has control over, is under the control of, or is under common control with.
92
-
93
- **Control** means ownership of substantially all the assets of an entity, or the power to direct its management and policies by vote, contract, or otherwise. Control can be direct or indirect.
94
-
95
- **Your licenses** are all the licenses granted to you for the software under these terms.
96
-
97
- **Use** means anything you do with the software requiring one of your licenses.
@@ -1,20 +0,0 @@
1
- /** Chiavi viewport: ordine da piccolo a grande (merge sovrascrive). */
2
- export const VIEWPORT_KEYS = ['mob', 'tab', 'des'] as const;
3
- export type ViewportKey = (typeof VIEWPORT_KEYS)[number];
4
-
5
- /** Chiavi pseudo-stato (hover, active, focus). */
6
- export const PSEUDO_KEYS = ['hover', 'active', 'focus', 'focusVisible'] as const;
7
- export type PseudoKey = (typeof PSEUDO_KEYS)[number];
8
-
9
- /** Larghezze min (px) per viewport. mob < 640, tab 640–1023, des 1024+. */
10
- export const VIEWPORT_WIDTHS: Record<ViewportKey, number> = {
11
- mob: 0,
12
- tab: 640,
13
- des: 1024,
14
- };
15
-
16
- export function getViewportKeyFromWidth(w: number): ViewportKey {
17
- if (w >= 1024) return 'des';
18
- if (w >= 640) return 'tab';
19
- return 'mob';
20
- }
@@ -1,5 +0,0 @@
1
- .vscode/**
2
- src/**
3
- tsconfig.json
4
- .gitignore
5
- **/*.map
@@ -1,130 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.activate = activate;
4
- exports.deactivate = deactivate;
5
- const vscode = require("vscode");
6
- function parseHexColor(text) {
7
- const hex = text.replace(/^#/, '');
8
- if (hex.length === 3) {
9
- const r = parseInt(hex[0] + hex[0], 16) / 255;
10
- const g = parseInt(hex[1] + hex[1], 16) / 255;
11
- const b = parseInt(hex[2] + hex[2], 16) / 255;
12
- return { r, g, b, a: 1 };
13
- }
14
- if (hex.length === 6 || hex.length === 8) {
15
- const r = parseInt(hex.slice(0, 2), 16) / 255;
16
- const g = parseInt(hex.slice(2, 4), 16) / 255;
17
- const b = parseInt(hex.slice(4, 6), 16) / 255;
18
- const a = hex.length === 8 ? parseInt(hex.slice(6, 8), 16) / 255 : 1;
19
- return { r, g, b, a };
20
- }
21
- return null;
22
- }
23
- function parseRgb(text) {
24
- const m = text.match(/rgba?\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)(?:\s*,\s*([\d.]+))?\s*\)/);
25
- if (!m)
26
- return null;
27
- return {
28
- r: Math.min(255, parseInt(m[1], 10)) / 255,
29
- g: Math.min(255, parseInt(m[2], 10)) / 255,
30
- b: Math.min(255, parseInt(m[3], 10)) / 255,
31
- a: m[4] != null ? parseFloat(m[4]) : 1,
32
- };
33
- }
34
- function findColorRanges(document) {
35
- const text = document.getText();
36
- const results = [];
37
- const hexPattern = /#[0-9a-fA-F]{3,8}(?![0-9a-fA-F])/g;
38
- let m;
39
- while ((m = hexPattern.exec(text)) !== null) {
40
- const full = m[0];
41
- const color = parseHexColor(full);
42
- if (color) {
43
- results.push({
44
- range: new vscode.Range(document.positionAt(m.index), document.positionAt(m.index + full.length)),
45
- color: new vscode.Color(color.r, color.g, color.b, color.a),
46
- });
47
- }
48
- }
49
- const rgbPattern = /rgba?\s*\(\s*\d+\s*,\s*\d+\s*,\s*\d+(?:\s*,\s*[\d.]+)?\s*\)/g;
50
- while ((m = rgbPattern.exec(text)) !== null) {
51
- const color = parseRgb(m[0]);
52
- if (color) {
53
- results.push({
54
- range: new vscode.Range(document.positionAt(m.index), document.positionAt(m.index + m[0].length)),
55
- color: new vscode.Color(color.r, color.g, color.b, color.a),
56
- });
57
- }
58
- }
59
- return results;
60
- }
61
- function provideColorPresentations(color, context) {
62
- const { red, green, blue, alpha } = color;
63
- const r = Math.round(red * 255);
64
- const g = Math.round(green * 255);
65
- const b = Math.round(blue * 255);
66
- const hex = `#${r.toString(16).padStart(2, '0')}${g.toString(16).padStart(2, '0')}${b.toString(16).padStart(2, '0')}`;
67
- const out = [
68
- { label: hex, textEdit: new vscode.TextEdit(context.range, hex) },
69
- ];
70
- if (alpha < 1) {
71
- const hexa = hex + Math.round(alpha * 255).toString(16).padStart(2, '0');
72
- out.push({ label: hexa, textEdit: new vscode.TextEdit(context.range, hexa) }, { label: `rgba(${r}, ${g}, ${b}, ${alpha.toFixed(2)})`, textEdit: new vscode.TextEdit(context.range, `rgba(${r}, ${g}, ${b}, ${alpha.toFixed(2)})`) });
73
- }
74
- else {
75
- out.push({ label: `rgb(${r}, ${g}, ${b})`, textEdit: new vscode.TextEdit(context.range, `rgb(${r}, ${g}, ${b})`) });
76
- }
77
- return out;
78
- }
79
- function activate(context) {
80
- // Assicura che il quadratino colore sia visibile (può essere stato disattivato in precedenza)
81
- const cfg = vscode.workspace.getConfiguration('editor');
82
- if (cfg.get('colorDecorators') === false) {
83
- void cfg.update('colorDecorators', true, vscode.ConfigurationTarget.Workspace);
84
- }
85
- // Quadrato nativo: click sul colore → picker inline
86
- const colorProvider = vscode.languages.registerColorProvider([{ language: 'typescript' }, { language: 'typescriptreact' }, { language: 'javascript' }, { language: 'javascriptreact' }], {
87
- provideDocumentColors(document) {
88
- return findColorRanges(document);
89
- },
90
- provideColorPresentations(color, ctx) {
91
- return provideColorPresentations(color, ctx);
92
- },
93
- });
94
- context.subscriptions.push(colorProvider);
95
- // Comando alternativo: cursore sul colore → Ctrl+Shift+C → input hex/rgb
96
- const editCmd = vscode.commands.registerCommand('flow-style-colors.editColor', async () => {
97
- const editor = vscode.window.activeTextEditor;
98
- if (!editor)
99
- return;
100
- const doc = editor.document;
101
- const pos = editor.selection.active;
102
- const infos = findColorRanges(doc);
103
- const info = infos.find((i) => i.range.contains(pos));
104
- if (!info) {
105
- void vscode.window.showInformationMessage('Posiziona il cursore su un colore (#hex o rgb(...))');
106
- return;
107
- }
108
- const current = doc.getText(info.range);
109
- const newValue = await vscode.window.showInputBox({
110
- title: 'Modifica colore',
111
- value: current,
112
- prompt: 'Hex (#fff) o rgb(r,g,b)',
113
- validateInput(v) {
114
- const t = v.trim();
115
- if (/^#[0-9a-fA-F]{3,8}$/.test(t))
116
- return null;
117
- if (/^rgba?\s*\(\s*\d+\s*,\s*\d+\s*,\s*\d+(?:\s*,\s*[\d.]+)?\s*\)$/.test(t))
118
- return null;
119
- return 'Inserisci #hex o rgb(r,g,b)';
120
- },
121
- });
122
- if (newValue == null)
123
- return;
124
- const edit = new vscode.WorkspaceEdit();
125
- edit.replace(doc.uri, info.range, newValue.trim());
126
- await vscode.workspace.applyEdit(edit);
127
- });
128
- context.subscriptions.push(editCmd);
129
- }
130
- function deactivate() { }
@@ -1,24 +0,0 @@
1
- {
2
- "name": "flow-style-colors",
3
- "displayName": "Flow Style — Color Picker",
4
- "description": "Cerchio + color picker per hex/rgb in TS/JS",
5
- "version": "0.0.1",
6
- "publisher": "flow-framework",
7
- "engines": { "vscode": "^1.85.0" },
8
- "categories": ["Other"],
9
- "activationEvents": ["onLanguage:typescript", "onLanguage:typescriptreact", "onLanguage:javascript", "onLanguage:javascriptreact"],
10
- "main": "./out/extension.js",
11
- "contributes": {
12
- "commands": [{ "command": "flow-style-colors.editColor", "title": "Flow Style: Modifica colore" }],
13
- "keybindings": [{ "command": "flow-style-colors.editColor", "key": "ctrl+shift+c", "when": "editorTextFocus" }]
14
- },
15
- "scripts": {
16
- "vscode:prepublish": "tsc -p .",
17
- "compile": "tsc -p .",
18
- "watch": "tsc -w -p ."
19
- },
20
- "devDependencies": {
21
- "@types/vscode": "^1.85.0",
22
- "typescript": "~5.7.0"
23
- }
24
- }
@@ -1,146 +0,0 @@
1
- import * as vscode from 'vscode';
2
-
3
- function parseHexColor(text: string): { r: number; g: number; b: number; a: number } | null {
4
- const hex = text.replace(/^#/, '');
5
- if (hex.length === 3) {
6
- const r = parseInt(hex[0] + hex[0], 16) / 255;
7
- const g = parseInt(hex[1] + hex[1], 16) / 255;
8
- const b = parseInt(hex[2] + hex[2], 16) / 255;
9
- return { r, g, b, a: 1 };
10
- }
11
- if (hex.length === 6 || hex.length === 8) {
12
- const r = parseInt(hex.slice(0, 2), 16) / 255;
13
- const g = parseInt(hex.slice(2, 4), 16) / 255;
14
- const b = parseInt(hex.slice(4, 6), 16) / 255;
15
- const a = hex.length === 8 ? parseInt(hex.slice(6, 8), 16) / 255 : 1;
16
- return { r, g, b, a };
17
- }
18
- return null;
19
- }
20
-
21
- function parseRgb(text: string): { r: number; g: number; b: number; a: number } | null {
22
- const m = text.match(/rgba?\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)(?:\s*,\s*([\d.]+))?\s*\)/);
23
- if (!m) return null;
24
- return {
25
- r: Math.min(255, parseInt(m[1], 10)) / 255,
26
- g: Math.min(255, parseInt(m[2], 10)) / 255,
27
- b: Math.min(255, parseInt(m[3], 10)) / 255,
28
- a: m[4] != null ? parseFloat(m[4]) : 1,
29
- };
30
- }
31
-
32
- function findColorRanges(document: vscode.TextDocument): vscode.ColorInformation[] {
33
- const text = document.getText();
34
- const results: vscode.ColorInformation[] = [];
35
-
36
- const hexPattern = /#[0-9a-fA-F]{3,8}(?![0-9a-fA-F])/g;
37
- let m: RegExpExecArray | null;
38
- while ((m = hexPattern.exec(text)) !== null) {
39
- const full = m[0];
40
- const color = parseHexColor(full);
41
- if (color) {
42
- results.push({
43
- range: new vscode.Range(
44
- document.positionAt(m.index),
45
- document.positionAt(m.index + full.length)
46
- ),
47
- color: new vscode.Color(color.r, color.g, color.b, color.a),
48
- });
49
- }
50
- }
51
-
52
- const rgbPattern = /rgba?\s*\(\s*\d+\s*,\s*\d+\s*,\s*\d+(?:\s*,\s*[\d.]+)?\s*\)/g;
53
- while ((m = rgbPattern.exec(text)) !== null) {
54
- const color = parseRgb(m[0]);
55
- if (color) {
56
- results.push({
57
- range: new vscode.Range(
58
- document.positionAt(m.index),
59
- document.positionAt(m.index + m[0].length)
60
- ),
61
- color: new vscode.Color(color.r, color.g, color.b, color.a),
62
- });
63
- }
64
- }
65
-
66
- return results;
67
- }
68
-
69
- function provideColorPresentations(
70
- color: vscode.Color,
71
- context: { document: vscode.TextDocument; range: vscode.Range }
72
- ): vscode.ColorPresentation[] {
73
- const { red, green, blue, alpha } = color;
74
- const r = Math.round(red * 255);
75
- const g = Math.round(green * 255);
76
- const b = Math.round(blue * 255);
77
- const hex = `#${r.toString(16).padStart(2, '0')}${g.toString(16).padStart(2, '0')}${b.toString(16).padStart(2, '0')}`;
78
- const out: vscode.ColorPresentation[] = [
79
- { label: hex, textEdit: new vscode.TextEdit(context.range, hex) },
80
- ];
81
- if (alpha < 1) {
82
- const hexa = hex + Math.round(alpha * 255).toString(16).padStart(2, '0');
83
- out.push(
84
- { label: hexa, textEdit: new vscode.TextEdit(context.range, hexa) },
85
- { label: `rgba(${r}, ${g}, ${b}, ${alpha.toFixed(2)})`, textEdit: new vscode.TextEdit(context.range, `rgba(${r}, ${g}, ${b}, ${alpha.toFixed(2)})`) }
86
- );
87
- } else {
88
- out.push({ label: `rgb(${r}, ${g}, ${b})`, textEdit: new vscode.TextEdit(context.range, `rgb(${r}, ${g}, ${b})`) });
89
- }
90
- return out;
91
- }
92
-
93
- export function activate(context: vscode.ExtensionContext): void {
94
- // Assicura che il quadratino colore sia visibile (può essere stato disattivato in precedenza)
95
- const cfg = vscode.workspace.getConfiguration('editor');
96
- if (cfg.get('colorDecorators') === false) {
97
- void cfg.update('colorDecorators', true, vscode.ConfigurationTarget.Workspace);
98
- }
99
-
100
- // Quadrato nativo: click sul colore → picker inline
101
- const colorProvider = vscode.languages.registerColorProvider(
102
- [{ language: 'typescript' }, { language: 'typescriptreact' }, { language: 'javascript' }, { language: 'javascriptreact' }],
103
- {
104
- provideDocumentColors(document) {
105
- return findColorRanges(document);
106
- },
107
- provideColorPresentations(color, ctx) {
108
- return provideColorPresentations(color, ctx);
109
- },
110
- }
111
- );
112
- context.subscriptions.push(colorProvider);
113
-
114
- // Comando alternativo: cursore sul colore → Ctrl+Shift+C → input hex/rgb
115
- const editCmd = vscode.commands.registerCommand('flow-style-colors.editColor', async () => {
116
- const editor = vscode.window.activeTextEditor;
117
- if (!editor) return;
118
- const doc = editor.document;
119
- const pos = editor.selection.active;
120
- const infos = findColorRanges(doc);
121
- const info = infos.find((i) => i.range.contains(pos));
122
- if (!info) {
123
- void vscode.window.showInformationMessage('Posiziona il cursore su un colore (#hex o rgb(...))');
124
- return;
125
- }
126
- const current = doc.getText(info.range);
127
- const newValue = await vscode.window.showInputBox({
128
- title: 'Modifica colore',
129
- value: current,
130
- prompt: 'Hex (#fff) o rgb(r,g,b)',
131
- validateInput(v) {
132
- const t = v.trim();
133
- if (/^#[0-9a-fA-F]{3,8}$/.test(t)) return null;
134
- if (/^rgba?\s*\(\s*\d+\s*,\s*\d+\s*,\s*\d+(?:\s*,\s*[\d.]+)?\s*\)$/.test(t)) return null;
135
- return 'Inserisci #hex o rgb(r,g,b)';
136
- },
137
- });
138
- if (newValue == null) return;
139
- const edit = new vscode.WorkspaceEdit();
140
- edit.replace(doc.uri, info.range, newValue.trim());
141
- await vscode.workspace.applyEdit(edit);
142
- });
143
- context.subscriptions.push(editCmd);
144
- }
145
-
146
- export function deactivate(): void {}
@@ -1,12 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "target": "ES2022",
4
- "module": "commonjs",
5
- "lib": ["ES2022"],
6
- "outDir": "out",
7
- "rootDir": "src",
8
- "strict": true,
9
- "skipLibCheck": true
10
- },
11
- "include": ["src/**/*"]
12
- }
@@ -1,30 +0,0 @@
1
- // ───────────────────────────────────────────────────────────────────────────────
2
- // For other frameworks for wrapping App
3
- // <FlowStyle> <App /> </FlowStyle>
4
- // ───────────────────────────────────────────────────────────────────────────────
5
- export { flowStyle as FlowStyle } from './resolve.js';
6
-
7
-
8
- // ───────────────────────────────────────────────────────────────────────────────
9
- // Visual builder (UI)
10
- // ───────────────────────────────────────────────────────────────────────────────
11
- export { VisualStyleBuilder, initVisualStyleBuilder } from './visual-builder.js';
12
- export type { VisualStyleBuilderOptions } from './visual-builder.js';
13
-
14
- // Plugin Vite (node only): usa import('@flow.os/style/vite-plugin').styleFlowServerPlugin()
15
-
16
- // ───────────────────────────────────────────────────────────────────────────────
17
- // Flow Style Builder – sempre esportato da style; pulsante trascinabile + pannello
18
- // ───────────────────────────────────────────────────────────────────────────────
19
- export { initFlowStyleBuilder, flowStyleBuilder } from './style-builder/index.js';
20
- export type { FlowStyleBuilderOptions, FlowStyleBuilderPosition } from './style-builder/index.js';
21
-
22
-
23
- // ───────────────────────────────────────────────────────────────────────────────
24
- // For @flow.os/client internal use
25
- // ───────────────────────────────────────────────────────────────────────────────
26
- export { resolveLayer, resolvePseudoStyle, styleToCssText } from './resolve.js';
27
- export { VIEWPORT_KEYS, PSEUDO_KEYS, getViewportKeyFromWidth } from './breakpoints.js';
28
- export type { PlainLayer } from './resolve.js';
29
- export type { ViewportKey, PseudoKey } from './breakpoints.js';
30
- export type { StyleShorthandKey } from './shorthand.js';
@@ -1,20 +0,0 @@
1
- {
2
- "name": "@flow.os/style",
3
- "version": "0.0.4",
4
- "license": "PolyForm-Shield-1.0.0",
5
- "type": "module",
6
- "main": "./index.ts",
7
- "types": "./index.ts",
8
- "exports": {
9
- ".": {
10
- "types": "./index.ts",
11
- "import": "./index.ts",
12
- "default": "./index.ts"
13
- },
14
- "./vite-plugin": {
15
- "types": "./vite-plugin.ts",
16
- "import": "./vite-plugin.ts",
17
- "default": "./vite-plugin.ts"
18
- }
19
- }
20
- }
@@ -1,68 +0,0 @@
1
- /**
2
- * React: use styleFlow or s prop (same as Flow framework).
3
- * 1. Call initFlowStyle(React) once in entry.
4
- * 2. Wrap app in <FlowStyleRoot>.
5
- * 3. Use <div styleFlow={...} /> or <div s={...} />.
6
- * Peer dependency: react >= 18.
7
- */
8
- import React from 'react';
9
- import { useState, useEffect } from 'react';
10
- import { flowStyle } from './resolve.js';
11
- import { getViewportKeyFromWidth } from './breakpoints.js';
12
- import type { ViewportKey } from './breakpoints.js';
13
-
14
- let currentViewport: ViewportKey =
15
- typeof window !== 'undefined' ? getViewportKeyFromWidth(window.innerWidth) : 'mob';
16
-
17
- let patched = false;
18
-
19
- export type FlowStyleValue = Parameters<typeof flowStyle>[0];
20
-
21
- /**
22
- * Call once in your entry (e.g. main.tsx). Then use styleFlow or s prop (same as Flow framework).
23
- */
24
- export function initFlowStyle(ReactLib: typeof React): void {
25
- if (patched) return;
26
- const orig = ReactLib.createElement;
27
- (ReactLib as unknown as { createElement: typeof React.createElement }).createElement = function (
28
- type: unknown,
29
- config: Record<string, unknown> | null,
30
- ...args: unknown[]
31
- ) {
32
- const flowValue = config?.styleFlow ?? config?.s;
33
- if (flowValue != null) {
34
- const resolved = flowStyle(flowValue as FlowStyleValue, currentViewport);
35
- const prevStyle = (config!.style as Record<string, string>) ?? {};
36
- config = { ...config };
37
- config.className = [config.className, resolved.class].filter(Boolean).join(' ');
38
- config.style = { ...resolved.style, ...prevStyle };
39
- delete config.styleFlow;
40
- delete config.s;
41
- }
42
- return (orig as (...a: unknown[]) => React.ReactElement).call(this, type, config, ...args);
43
- };
44
- patched = true;
45
- }
46
-
47
- /** Wrap your app so viewport updates on resize; then use styleFlow or s on any element. */
48
- export function FlowStyleRoot({ children }: { children: React.ReactNode }): React.ReactElement {
49
- const [viewport, setViewport] = useState<ViewportKey>(() => currentViewport);
50
-
51
- useEffect(() => {
52
- currentViewport = viewport;
53
- }, [viewport]);
54
-
55
- useEffect(() => {
56
- if (typeof window === 'undefined') return;
57
- const onResize = () => {
58
- const next = getViewportKeyFromWidth(window.innerWidth);
59
- currentViewport = next;
60
- setViewport(next);
61
- };
62
- window.addEventListener('resize', onResize);
63
- return () => window.removeEventListener('resize', onResize);
64
- }, []);
65
-
66
- return <>{children}</>;
67
- }
68
-