diff --git a/.github/workflows/docs-deploy.yml b/.github/workflows/docs-deploy.yml index 5cfcf1df..b1781c36 100644 --- a/.github/workflows/docs-deploy.yml +++ b/.github/workflows/docs-deploy.yml @@ -7,6 +7,11 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 + - name: run pre-deploy (build docs and more) + run: | + chmod +x ./scripts/docs-deploy/pre-deploy.sh + ./scripts/docs-deploy/pre-deploy.sh + shell: bash - name: copy docs to gridaco/grida.co uses: DevOpenWRT-Router/github-action-push-to-another-repository@main env: diff --git a/docs/flags/.gitignore b/docs/flags/.gitignore new file mode 100644 index 00000000..a646b350 --- /dev/null +++ b/docs/flags/.gitignore @@ -0,0 +1,7 @@ +## Learn more at scripts/docs-copy/flags-api-docs.js +# custom +----ignore.md +---custom.md + +# flags api docs +--*.md \ No newline at end of file diff --git a/docs/flags/README.md b/docs/flags/README.md new file mode 100644 index 00000000..607c2660 --- /dev/null +++ b/docs/flags/README.md @@ -0,0 +1,5 @@ +# Flags Documentation directory. + +Go to [Index](./index.md) + +## Flags Api references are copied from support-flags package via script - `/scripts/docs-copy/flags-api-docs.sh` diff --git a/docs/flags.md b/docs/flags/index.md similarity index 100% rename from docs/flags.md rename to docs/flags/index.md diff --git a/editor-packages/editor-canvas/README.md b/editor-packages/editor-canvas/README.md new file mode 100644 index 00000000..aa198bad --- /dev/null +++ b/editor-packages/editor-canvas/README.md @@ -0,0 +1 @@ +# A Interactive canvas for runtime frames. diff --git a/editor-packages/editor-canvas/canvas/canvas.tsx b/editor-packages/editor-canvas/canvas/canvas.tsx new file mode 100644 index 00000000..1fb294db --- /dev/null +++ b/editor-packages/editor-canvas/canvas/canvas.tsx @@ -0,0 +1,32 @@ +import React from "react"; +export function Canvas() { + const scale = 1; + return ( +
` element.
+
+**Text style**
+We don't yet support text style matching with `--p` flag.
+
+## See Also
+
+- [`--as-h1`](../--as-h1)
+- [`--as-h2`](../--as-h2)
+- [`--as-h3`](../--as-h3)
+- [`--as-h4`](../--as-h4)
+- [`--as-h5`](../--as-h5)
+- [`--as-h6`](../--as-h6)
+- [`--as-p`](../--as-p)
+- [`--as-br`](../--as-br)
diff --git a/packages/support-flags/--as-p/index.ts b/packages/support-flags/--as-p/index.ts
new file mode 100644
index 00000000..5157b7cb
--- /dev/null
+++ b/packages/support-flags/--as-p/index.ts
@@ -0,0 +1,21 @@
+// priamry
+export const flag_key__as_p = "as-p";
+// alias
+const flag_key__as_paragraph = "as-paragraph";
+const flag_key__paragraph = "paragraph";
+
+export const flag_key_alias__as_p = [
+ flag_key__as_p,
+ flag_key__as_paragraph,
+ flag_key__paragraph,
+];
+
+export interface AsParagraphFlag {
+ flag:
+ | typeof flag_key__as_p
+ | typeof flag_key__as_paragraph
+ | typeof flag_key__paragraph;
+
+ value: boolean;
+ _raw?: string;
+}
diff --git a/packages/support-flags/--as-span/README.md b/packages/support-flags/--as-span/README.md
new file mode 100644
index 00000000..85325de1
--- /dev/null
+++ b/packages/support-flags/--as-span/README.md
@@ -0,0 +1,59 @@
+# `--as-span` As TextSpan (Text)
+
+> This flag is for web platform. Otherwise, it will be ignored, have no impact on the final output.
+
+**Accepted keys**
+
+- `--as-span`
+- `--as-text-span`
+- `--as-textspan`
+- `--text-span`
+- `--textspan`
+
+## Syntax
+
+```ts
+`--as-span${"="typeof boolean}`
+```
+
+## Example
+
+```
+--as-span
+
+--as-span=true
+--as-span=false
+
+--as-span=yes
+--as-span=no
+
+----as-span
+```
+
+## Behavior
+
+**Element**
+When applied, this will force the node to be rendered as a `` element.
+
+**Text style**
+We don't yet support text style matching with `--as-span` flag.
+
+## Anatomy
+
+```ts
+export interface AsSpanFlag {
+ flag: "as-span" | "as-text-span" | "as-textspan" | "text-span" | "textspan";
+
+ value?: boolean;
+}
+```
+
+## See Also
+
+- [`--as-h1`](../--as-h1)
+- [`--as-h2`](../--as-h2)
+- [`--as-h3`](../--as-h3)
+- [`--as-h4`](../--as-h4)
+- [`--as-h5`](../--as-h5)
+- [`--as-h6`](../--as-h6)
+- [`--as-p`](../--as-p)
diff --git a/packages/support-flags/--as-span/index.ts b/packages/support-flags/--as-span/index.ts
new file mode 100644
index 00000000..4ccad77c
--- /dev/null
+++ b/packages/support-flags/--as-span/index.ts
@@ -0,0 +1,27 @@
+// primary
+export const flag_key__as_span = "as-span";
+// alias
+const flag_key__as_text_span = "as-text-span";
+const flag_key__as_textspan = "as-textspan";
+const flag_key__text_span = "text-span";
+const flag_key__textspan = "textspan";
+
+export const flag_key_alias__as_span = [
+ flag_key__as_span,
+ flag_key__as_text_span,
+ flag_key__as_textspan,
+ flag_key__text_span,
+ flag_key__textspan,
+];
+
+export interface AsTextSpanFlag {
+ flag:
+ | typeof flag_key__as_span
+ | typeof flag_key__as_text_span
+ | typeof flag_key__as_textspan
+ | typeof flag_key__text_span
+ | typeof flag_key__textspan;
+
+ value: boolean;
+ _raw?: string;
+}
diff --git a/packages/support-flags/--as-text-group/README.md b/packages/support-flags/--as-text-group/README.md
new file mode 100644
index 00000000..69332d0e
--- /dev/null
+++ b/packages/support-flags/--as-text-group/README.md
@@ -0,0 +1,3 @@
+## (Draft) Text group
+
+While creating a multilined, complex text, for example, inserting a custom emoji, or a custom image, we need to use a text group. This is usually done by using a autolayout or col-row oriented multiple autolayouts.
diff --git a/packages/support-flags/--exact-height/README.md b/packages/support-flags/--exact-height/README.md
deleted file mode 100644
index 26cdc8a5..00000000
--- a/packages/support-flags/--exact-height/README.md
+++ /dev/null
@@ -1,24 +0,0 @@
-# `--exact-height` Flag (Draft)
-
-When applied, this will force dedicated layer's height to be ignore responsive height, use current height as fixed height instead.
-
-## Syntax
-
-```ts
-`--exact-height${"="typeof boolean}`
-```
-
-## Example
-
-```
---exact-height
-
---exact-height=true
---exact-height=false
-
---exact-height=True
---exact-height=False
-
---exact-height=yes
---exact-height=no
-```
diff --git a/packages/support-flags/--exact-width/README.md b/packages/support-flags/--exact-width/README.md
deleted file mode 100644
index 1f2c3d00..00000000
--- a/packages/support-flags/--exact-width/README.md
+++ /dev/null
@@ -1,24 +0,0 @@
-# `--exact-width` Flag (Draft)
-
-When applied, this will force dedicated layer's `width` to be ignore responsive width, use current width as fixed width instead.
-
-## Syntax
-
-```ts
-`--exact-width${"="typeof boolean}`
-```
-
-## Example
-
-```
---exact-width
-
---exact-width=true
---exact-width=false
-
---exact-width=True
---exact-width=False
-
---exact-width=yes
---exact-width=no
-```
diff --git a/packages/support-flags/--export-as/README.md b/packages/support-flags/--export-as/README.md
new file mode 100644
index 00000000..e892b75d
--- /dev/null
+++ b/packages/support-flags/--export-as/README.md
@@ -0,0 +1,6 @@
+# Export As
+
+**Accepted keys**
+
+- `--export-as`
+- `--export`
diff --git a/packages/support-flags/--fix-bottom/README.md b/packages/support-flags/--fix-bottom/README.md
new file mode 100644
index 00000000..216594a6
--- /dev/null
+++ b/packages/support-flags/--fix-bottom/README.md
@@ -0,0 +1,7 @@
+# `--fix-bottom` Flag (Draft)
+
+When applied, this will force dedicated layer's bottom to be ignore responsive bottom, use current bottom as fixed bottom instead.
+
+> ⚠️ This is different from `--position-fixed`. In general, this flag is not used for designing a footer.
+
+## See also
diff --git a/packages/support-flags/--fix-height/README.md b/packages/support-flags/--fix-height/README.md
new file mode 100644
index 00000000..e6e13e7a
--- /dev/null
+++ b/packages/support-flags/--fix-height/README.md
@@ -0,0 +1,24 @@
+# `--fix-height` Flag (Draft)
+
+When applied, this will force dedicated layer's `height` to be ignore responsive `height`, use current `height` as fixed `height` instead.
+
+## Syntax
+
+```ts
+`--fix-height${"="typeof boolean}`
+```
+
+## Example
+
+```
+--fix-height
+
+--fix-height=true
+--fix-height=false
+
+--fix-height=True
+--fix-height=False
+
+--fix-height=yes
+--fix-height=no
+```
diff --git a/packages/support-flags/--fix-height/index.ts b/packages/support-flags/--fix-height/index.ts
new file mode 100644
index 00000000..72a8d0c5
--- /dev/null
+++ b/packages/support-flags/--fix-height/index.ts
@@ -0,0 +1,10 @@
+export const flag_key__fix_height = "fix-height";
+
+export const flag_key_alias__fix_height = [flag_key__fix_height];
+
+export interface FixHeightFlag {
+ flag: typeof flag_key__fix_height;
+
+ value: true;
+ _raw?: string;
+}
diff --git a/packages/support-flags/--fix-width/README.md b/packages/support-flags/--fix-width/README.md
new file mode 100644
index 00000000..5e7b57f9
--- /dev/null
+++ b/packages/support-flags/--fix-width/README.md
@@ -0,0 +1,28 @@
+# `--fix-width` Flag (Draft)
+
+When applied, this will force dedicated layer's `width` to be ignore responsive width, use current width as fixed width instead.
+
+**Accepted keys**
+
+- `--fix-width`
+
+## Syntax
+
+```ts
+`--fix-width${"="typeof boolean}`
+```
+
+## Example
+
+```
+--fix-width
+
+--fix-width=true
+--fix-width=false
+
+--fix-width=True
+--fix-width=False
+
+--fix-width=yes
+--fix-width=no
+```
diff --git a/packages/support-flags/--fix-width/index.ts b/packages/support-flags/--fix-width/index.ts
new file mode 100644
index 00000000..1d8d23c8
--- /dev/null
+++ b/packages/support-flags/--fix-width/index.ts
@@ -0,0 +1,9 @@
+export const flag_key__fix_width = "fix-width";
+
+export const flag_key_alias__fix_width = [flag_key__fix_width];
+export interface FixWidthFlag {
+ flag: typeof flag_key__fix_width;
+
+ value: true;
+ _raw?: string;
+}
diff --git a/packages/support-flags/--height/README.md b/packages/support-flags/--height/README.md
new file mode 100644
index 00000000..275732a6
--- /dev/null
+++ b/packages/support-flags/--height/README.md
@@ -0,0 +1,117 @@
+# `--height` for explicit height
+
+**Accepted keys**
+
+- `--height`
+- `--h`
+
+## Syntax
+
+```ts
+`--height=${typeof length}`;
+```
+
+## Example
+
+```
+--height=100
+--h=100
+
+--height=100px
+
+--height=100vh
+```
+
+## Behavior
+
+**Element**
+There is no impact on element itself, but it can break relative layouts.
+
+**Style**
+When applied, this will force the node to be rendered with a `height` style.
+
+## (Proposal) (Draft) Advanced use
+
+> This feature is a proposal, won't work on production use.
+
+height and height support specifying min, max, and initial values.
+
+This is how it looks like:
+
+`--height=(initial)` or `--height=(min)-(max)-(initial)`
+
+```
+--height=100px // initial only
+--height=100px-1080px-50vh // min, max, initial
+--height=100px-1080px // min, max
+--height=?-1080px // min (none), max
+--height=100px-? // min , max (none)
+--height=100px-?-50vh // min , max (none), initial
+```
+
+you can skip the declaration with `?` keyword. this is a special keyword, interpreted as `undefined`
+
+"`--height=100px-?-50vh`" this will make css for example, as below.
+
+```css
+.foo {
+ min-height: 100px;
+ height: 50vh;
+}
+```
+
+"`--height=100px-1080px`" this indicates only min and max, yet, still the height will be specified based on current height of the origin design.
+
+```css
+.foo {
+ min-height: 100px;
+ max-height: 1080px;
+ height: 400px; /* this is from the design */
+}
+```
+
+### Ignoring one of the property
+
+**Using explicit `--ignore` flag**
+to ignore the height, you can use new flag `--ignore` set to height. like so - `--ignore=height`
+
+```css
+.foo {
+ min-height: 100px;
+ max-height: 1080px;
+ /* height: 400px; this is ignored by --ignore flag */
+}
+```
+
+**Using `?` keyword**
+Otherwise, you can simply use silincer keyword `?` to ignore the height, like so - `--height=100px-1080px-?`
+
+This will also generate style like below.
+
+```css
+.foo {
+ min-height: 100px;
+ max-height: 1080px;
+ /* height: 400px; this is ignored by "?" keyword */
+}
+```
+
+### Referencing current value with `.`
+
+Setting max-height to current height (based on design) with - `--height=100px-.-.`
+
+This will generate style like below.
+
+```css
+.foo {
+ min-height: 100px;
+ max-height: 400px; /* the current height from design */
+ height: 400px; /* the current height from design */
+}
+```
+
+## See Also
+
+- [`--max-height`](../--max-height)
+- [`--min-height`](../--min-height)
+- [`--width`](../--width)
diff --git a/packages/support-flags/--height/index.ts b/packages/support-flags/--height/index.ts
new file mode 100644
index 00000000..52409ceb
--- /dev/null
+++ b/packages/support-flags/--height/index.ts
@@ -0,0 +1,18 @@
+import { DimensionLength } from "@reflect-ui/core";
+
+export const flag_key__height = "height";
+
+export const flag_key_alias__height = [flag_key__height];
+
+export interface HeightFlag {
+ flag: typeof flag_key__height;
+
+ value:
+ | DimensionLength
+ | {
+ min?: DimensionLength;
+ max?: DimensionLength;
+ initial?: DimensionLength;
+ };
+ _raw?: string;
+}
diff --git a/packages/support-flags/--max-height/README.md b/packages/support-flags/--max-height/README.md
new file mode 100644
index 00000000..c5a2f735
--- /dev/null
+++ b/packages/support-flags/--max-height/README.md
@@ -0,0 +1,36 @@
+# Max height
+
+**Accepted keys**
+
+- `--max-height`
+- `--maxheight`
+
+## Syntax
+
+```ts
+`--max-height=${typeof length}`;
+```
+
+## Example
+
+```
+--max-height=100
+
+--max-height=100px
+
+--max-height=100vh
+```
+
+## Behavior
+
+**Element**
+There is no impact on element itself, but it can break relative layouts.
+
+**Style**
+When applied, this will force the node to be rendered with a `max-height` style.
+
+## See Also
+
+- [`--max-width`](../--max-width)
+- [`--min-height`](../--max-height)
+- [`--height`](../--height)
diff --git a/packages/support-flags/--max-height/index.ts b/packages/support-flags/--max-height/index.ts
new file mode 100644
index 00000000..c5bf888a
--- /dev/null
+++ b/packages/support-flags/--max-height/index.ts
@@ -0,0 +1,18 @@
+import { DimensionLength } from "@reflect-ui/core";
+
+// primary
+export const flag_key__max_height = "max-height";
+// alias
+const flag_key__maxheight = "maxheight";
+
+export const flag_key_alias__max_height = [
+ flag_key__max_height,
+ flag_key__maxheight,
+];
+
+export interface MaxHeightFlag {
+ flag: typeof flag_key__max_height | typeof flag_key__maxheight;
+
+ value: DimensionLength;
+ _raw?: string;
+}
diff --git a/packages/support-flags/--max-width/README.md b/packages/support-flags/--max-width/README.md
new file mode 100644
index 00000000..6dd58b83
--- /dev/null
+++ b/packages/support-flags/--max-width/README.md
@@ -0,0 +1,36 @@
+# Max width
+
+**Accepted keys**
+
+- `--max-width`
+- `--maxwidth`
+
+## Syntax
+
+```ts
+`--max-width=${typeof length}`;
+```
+
+## Example
+
+```
+--max-width=100
+
+--max-width=100px
+
+--max-width=400vw
+```
+
+## Behavior
+
+**Element**
+There is no impact on element itself, but it can break relative layouts.
+
+**Style**
+When applied, this will force the node to be rendered with a max-width style.
+
+## See Also
+
+- [`--max-height`](../--max-height)
+- [`--min-width`](../--max-width)
+- [`--width`](../--max-width)
diff --git a/packages/support-flags/--max-width/index.ts b/packages/support-flags/--max-width/index.ts
new file mode 100644
index 00000000..00b8afa1
--- /dev/null
+++ b/packages/support-flags/--max-width/index.ts
@@ -0,0 +1,18 @@
+import { DimensionLength } from "@reflect-ui/core";
+
+// primary
+export const flag_key__max_width = "max-width";
+// alias
+const flag_key__maxwidth = "maxwidth";
+
+export const flag_key_alias__max_width = [
+ flag_key__max_width,
+ flag_key__maxwidth,
+];
+
+export interface MaxWidthFlag {
+ flag: typeof flag_key__max_width | typeof flag_key__maxwidth;
+
+ value: DimensionLength;
+ _raw?: string;
+}
diff --git a/packages/support-flags/--min-height/README.md b/packages/support-flags/--min-height/README.md
new file mode 100644
index 00000000..059d7771
--- /dev/null
+++ b/packages/support-flags/--min-height/README.md
@@ -0,0 +1,36 @@
+# Min height
+
+**Accepted keys**
+
+- `--min-height`
+- `--minheight`
+
+## Syntax
+
+```ts
+`--min-height=${typeof length}`;
+```
+
+## Example
+
+```
+--min-height=100
+
+--min-height=100px
+
+--min-height=100vh
+```
+
+## Behavior
+
+**Element**
+There is no impact on element itself, but it can break relative layouts.
+
+**Style**
+When applied, this will force the node to be rendered with a `min-height` style.
+
+## See Also
+
+- [`--max-height`](../--max-height)
+- [`--min-width`](../--max-width)
+- [`--height`](../--height)
diff --git a/packages/support-flags/--min-height/index.ts b/packages/support-flags/--min-height/index.ts
new file mode 100644
index 00000000..e8b59db3
--- /dev/null
+++ b/packages/support-flags/--min-height/index.ts
@@ -0,0 +1,18 @@
+import { DimensionLength } from "@reflect-ui/core";
+
+// primary
+export const flag_key__min_height = "min-height";
+// alias
+const flag_key__minheight = "minheight";
+
+export const flag_key_alias__min_height = [
+ flag_key__min_height,
+ flag_key__minheight,
+];
+
+export interface MinHeightFlag {
+ flag: typeof flag_key__min_height | typeof flag_key__minheight;
+
+ value: DimensionLength;
+ _raw?: string;
+}
diff --git a/packages/support-flags/--min-width/README.md b/packages/support-flags/--min-width/README.md
new file mode 100644
index 00000000..28df8815
--- /dev/null
+++ b/packages/support-flags/--min-width/README.md
@@ -0,0 +1,36 @@
+# Min width
+
+**Accepted keys**
+
+- `--min-width`
+- `--minwidth`
+
+## Syntax
+
+```ts
+`--min-width=${typeof length}`;
+```
+
+## Example
+
+```
+--min-width=100
+
+--min-width=100px
+
+--min-width=100vw
+```
+
+## Behavior
+
+**Element**
+There is no impact on element itself, but it can break relative layouts.
+
+**Style**
+When applied, this will force the node to be rendered with a `min-width` style.
+
+## See Also
+
+- [`--max-width`](../--max-width)
+- [`--min-height`](../--min-height)
+- [`--width`](../--width)
diff --git a/packages/support-flags/--min-width/index.ts b/packages/support-flags/--min-width/index.ts
new file mode 100644
index 00000000..bd5be19c
--- /dev/null
+++ b/packages/support-flags/--min-width/index.ts
@@ -0,0 +1,18 @@
+import { DimensionLength } from "@reflect-ui/core";
+
+// primary
+export const flag_key__min_width = "min-width";
+// alias
+const flag_key__minwidth = "minwidth";
+
+export const flag_key_alias__min_width = [
+ flag_key__min_width,
+ flag_key__minwidth,
+];
+
+export interface MinWidthFlag {
+ flag: typeof flag_key__min_width | typeof flag_key__minwidth;
+
+ value: DimensionLength;
+ _raw?: string;
+}
diff --git a/packages/support-flags/--position-sticky/README.md b/packages/support-flags/--position-sticky/README.md
new file mode 100644
index 00000000..79ed0a42
--- /dev/null
+++ b/packages/support-flags/--position-sticky/README.md
@@ -0,0 +1 @@
+# (WIP) Position as Sticky.
diff --git a/packages/support-flags/--width/README.md b/packages/support-flags/--width/README.md
new file mode 100644
index 00000000..40beb9cb
--- /dev/null
+++ b/packages/support-flags/--width/README.md
@@ -0,0 +1,117 @@
+# `--width` for explicit width
+
+**Accepted keys**
+
+- `--width`
+- `--w`
+
+## Syntax
+
+```ts
+`--width=${typeof length}`;
+```
+
+## Example
+
+```
+--width=100
+--w=100
+
+--width=100px
+
+--width=400vw
+```
+
+## Behavior
+
+**Element**
+There is no impact on element itself, but it can break relative layouts.
+
+**Style**
+When applied, this will force the node to be rendered with a `width` style.
+
+## (Proposal) (Draft) Advanced use
+
+> This feature is a proposal, won't work on production use.
+
+width and height support specifying min, max, and initial values.
+
+This is how it looks like:
+
+`--width=(initial)` or `--width=(min)-(max)-(initial)`
+
+```
+--width=100px // initial only
+--width=100px-1080px-50vw // min, max, initial
+--width=100px-1080px // min, max
+--width=?-1080px // min (none), max
+--width=100px-? // min , max (none)
+--width=100px-?-50vw // min , max (none), initial
+```
+
+you can skip the declaration with `?` keyword. this is a special keyword, interpreted as `undefined`
+
+"`--width=100px-?-50vw`" this will make css for example, as below.
+
+```css
+.foo {
+ min-width: 100px;
+ width: 50vw;
+}
+```
+
+"`--width=100px-1080px`" this indicates only min and max, yet, still the width will be specified based on current width of the origin design.
+
+```css
+.foo {
+ min-width: 100px;
+ max-width: 1080px;
+ width: 400px; /* this is from the design */
+}
+```
+
+### Ignoring one of the property
+
+**Using explicit `--ignore` flag**
+to ignore the width, you can use new flag `--ignore` set to width. like so - `--ignore=width`
+
+```css
+.foo {
+ min-width: 100px;
+ max-width: 1080px;
+ /* width: 400px; this is ignored by --ignore flag */
+}
+```
+
+**Using `?` keyword**
+Otherwise, you can simply use silincer keyword `?` to ignore the width, like so - `--width=100px-1080px-?`
+
+This will also generate style like below.
+
+```css
+.foo {
+ min-width: 100px;
+ max-width: 1080px;
+ /* width: 400px; this is ignored by "?" keyword */
+}
+```
+
+### Referencing current value with `.`
+
+Setting max-width to current width (based on design) with - `--width=100px-.-.`
+
+This will generate style like below.
+
+```css
+.foo {
+ min-width: 100px;
+ max-width: 400px; /* the current width from design */
+ width: 400px; /* the current width from design */
+}
+```
+
+## See Also
+
+- [`--max-width`](../--max-width)
+- [`--min-width`](../--min-width)
+- [`--height`](../--height)
diff --git a/packages/support-flags/--width/index.ts b/packages/support-flags/--width/index.ts
new file mode 100644
index 00000000..44b9fabb
--- /dev/null
+++ b/packages/support-flags/--width/index.ts
@@ -0,0 +1,18 @@
+import { DimensionLength } from "@reflect-ui/core";
+
+export const flag_key__width = "width";
+
+export const flag_key_alias__width = [flag_key__width];
+
+export interface WidthFlag {
+ flag: typeof flag_key__width;
+
+ value:
+ | DimensionLength
+ | {
+ min?: DimensionLength;
+ max?: DimensionLength;
+ initial?: DimensionLength;
+ };
+ _raw?: string;
+}
diff --git a/packages/support-flags/index.ts b/packages/support-flags/index.ts
index a1d48997..85d4a3ef 100644
--- a/packages/support-flags/index.ts
+++ b/packages/support-flags/index.ts
@@ -1,29 +1,4 @@
-import { parse as parseflags } from "@design-sdk/flags/parsing-strategy-dashdash";
-
-import { flag_key__artwork } from "./--artwork";
-import { flag_key__as_wrap } from "./--as-wrap";
-import { flag_key__module } from "./--module";
export * from "./types";
-
-export function parse(name: string) {
- try {
- return parseflags(name, [
- {
- name: flag_key__artwork,
- type: "bool",
- },
- {
- name: flag_key__as_wrap,
- type: "bool",
- },
- {
- name: flag_key__module,
- type: "bool", // TODO: support string also.
- },
- //. TODO: add other flags under here.
- ]);
- } catch (_) {
- console.error("error while parsing flags", _);
- return {};
- }
-}
+export * as keys from "./keys";
+export { parse } from "./parse";
+export type { FlagsParseResult } from "./parse";
diff --git a/packages/support-flags/keys.ts b/packages/support-flags/keys.ts
new file mode 100644
index 00000000..3761cb8e
--- /dev/null
+++ b/packages/support-flags/keys.ts
@@ -0,0 +1,61 @@
+import { flag_key_alias__as_h1, flag_key__as_h1 } from "./--as-h1";
+import { flag_key_alias__as_h2, flag_key__as_h2 } from "./--as-h2";
+import { flag_key_alias__as_h3, flag_key__as_h3 } from "./--as-h3";
+import { flag_key_alias__as_h4, flag_key__as_h4 } from "./--as-h4";
+import { flag_key_alias__as_h5, flag_key__as_h5 } from "./--as-h5";
+import { flag_key_alias__as_h6, flag_key__as_h6 } from "./--as-h6";
+import { flag_key_alias__as_p, flag_key__as_p } from "./--as-p";
+import { flag_key_alias__as_span, flag_key__as_span } from "./--as-span";
+
+import { flag_key_alias__width, flag_key__width } from "./--width";
+import { flag_key_alias__min_width, flag_key__min_width } from "./--min-width";
+import { flag_key_alias__max_width, flag_key__max_width } from "./--max-width";
+
+import { flag_key_alias__height, flag_key__height } from "./--height";
+// prettier-ignore
+import { flag_key_alias__min_height, flag_key__min_height } from "./--min-height";
+// prettier-ignore
+import { flag_key_alias__max_height, flag_key__max_height } from "./--max-height";
+import { flag_key_alias__fix_width, flag_key__fix_width } from "./--fix-width";
+// prettier-ignore
+import { flag_key_alias__fix_height, flag_key__fix_height } from "./--fix-height";
+
+export {
+ flag_key__as_h1,
+ flag_key__as_h2,
+ flag_key__as_h3,
+ flag_key__as_h4,
+ flag_key__as_h5,
+ flag_key__as_h6,
+};
+export { flag_key__as_p };
+export { flag_key__as_span };
+
+export {
+ flag_key__width,
+ flag_key__min_width,
+ flag_key__max_width,
+ flag_key__height,
+ flag_key__min_height,
+ flag_key__max_height,
+};
+export { flag_key__fix_width, flag_key__fix_height };
+
+export const alias = {
+ as_h1: flag_key_alias__as_h1,
+ as_h2: flag_key_alias__as_h2,
+ as_h3: flag_key_alias__as_h3,
+ as_h4: flag_key_alias__as_h4,
+ as_h5: flag_key_alias__as_h5,
+ as_h6: flag_key_alias__as_h6,
+ as_p: flag_key_alias__as_p,
+ as_span: flag_key_alias__as_span,
+ width: flag_key_alias__width,
+ min_width: flag_key_alias__min_width,
+ max_width: flag_key_alias__max_width,
+ height: flag_key_alias__height,
+ min_height: flag_key_alias__min_height,
+ max_height: flag_key_alias__max_height,
+ fix_width: flag_key_alias__fix_width,
+ fix_height: flag_key_alias__fix_height,
+};
diff --git a/packages/support-flags/parse.ts b/packages/support-flags/parse.ts
new file mode 100644
index 00000000..319fc834
--- /dev/null
+++ b/packages/support-flags/parse.ts
@@ -0,0 +1,301 @@
+import {
+ parse as parseflags,
+ Option,
+ Results,
+} from "@design-sdk/flags/parsing-strategy-dashdash";
+
+import * as keys from "./keys";
+
+import { flag_key__artwork } from "./--artwork";
+import { flag_key__as_wrap } from "./--as-wrap";
+import { flag_key__module } from "./--module";
+import type {
+ HeadingFlag,
+ TextElementPreferenceFlag,
+ AsParagraphFlag,
+ AsTextSpanFlag,
+ SimpleBooleanValueFlag,
+ FixWHFlag,
+ WHDeclarationFlag,
+} from "./types";
+
+export type FlagsParseResult = Results & {
+ __meta: {
+ [key: string]: boolean;
+ };
+};
+
+export function parse(name: string): FlagsParseResult {
+ try {
+ const _raw_parsed = parseflags(name, [
+ {
+ name: flag_key__artwork,
+ type: "bool",
+ },
+ {
+ name: flag_key__as_wrap,
+ type: "bool",
+ },
+ //#region
+ __h1_alias_pref,
+ __h2_alias_pref,
+ __h3_alias_pref,
+ __h4_alias_pref,
+ __h5_alias_pref,
+ __h6_alias_pref,
+ __p_alias_pref,
+ __textspan_alias_pref,
+ //#endregion
+
+ //#region
+ __width_alias_pref,
+ __max_width_alias_pref,
+ __min_width_alias_pref,
+ __height_alias_pref,
+ __max_height_alias_pref,
+ __min_height_alias_pref,
+ //#endregion
+
+ //#region
+ __fix_width_alias_pref,
+ __fix_height_alias_pref,
+ //#endregion
+
+ {
+ name: flag_key__module,
+ type: "bool", // TODO: support string also.
+ },
+ //. TODO: add other flags under here.
+ ]);
+
+ const as_heading_flag = transform_heading_alias_from_raw(_raw_parsed);
+ const as_paragraph_flag = handle_single_boolean_flag_alias